@afeefa/vue-app 0.0.164 → 0.0.166
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.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.166
|
package/package.json
CHANGED
@@ -178,9 +178,15 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
178
178
|
}
|
179
179
|
|
180
180
|
get date () {
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
if (!this.value_) {
|
182
|
+
return null
|
183
|
+
}
|
184
|
+
|
185
|
+
// format date to v-date-picker compatible string: https://stackoverflow.com/a/29774197
|
186
|
+
const offset = this.value_.getTimezoneOffset()
|
187
|
+
let date = new Date(this.value_.getTime() - (offset * 60 * 1000))
|
188
|
+
date = date.toISOString().substr(0, this.type === 'month' ? 7 : 10)
|
189
|
+
return date
|
184
190
|
}
|
185
191
|
|
186
192
|
get label () {
|
@@ -207,7 +213,16 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
207
213
|
}
|
208
214
|
|
209
215
|
dateChanged (date) {
|
210
|
-
|
216
|
+
if (date) {
|
217
|
+
// take given date string an create a local time date object
|
218
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format
|
219
|
+
// > When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as local time.
|
220
|
+
const dateStringThatGetsConvertedToLocalDate = date + 'T00:00'
|
221
|
+
this.value_ = new Date(dateStringThatGetsConvertedToLocalDate)
|
222
|
+
} else {
|
223
|
+
this.value_ = null
|
224
|
+
}
|
225
|
+
|
211
226
|
this.validate()
|
212
227
|
|
213
228
|
this.close()
|
@@ -223,7 +238,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin, UsesPositio
|
|
223
238
|
const monthName = date.toLocaleString('default', { month: 'long' })
|
224
239
|
return monthName + ' ' + date.getFullYear()
|
225
240
|
}
|
226
|
-
return formatDate(
|
241
|
+
return formatDate(date)
|
227
242
|
}
|
228
243
|
|
229
244
|
validate () {
|
@@ -71,16 +71,22 @@ export default class FlyingContextContainer extends Vue {
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|
74
|
-
domChanged () {
|
74
|
+
domChanged ([...mutationRecords]) {
|
75
75
|
const container = this.getChildrenContainer()
|
76
|
+
|
76
77
|
this.visible = !!container.children.length
|
78
|
+
const isOpening = mutationRecords.length === 1 && mutationRecords[0].addedNodes.length === 1 // only 1 record ... and this one is 'added'
|
79
|
+
console.log(mutationRecords)
|
77
80
|
|
78
81
|
const el = document.documentElement
|
79
82
|
|
80
|
-
if (
|
83
|
+
if (isOpening) {
|
81
84
|
const style = getComputedStyle(el)
|
82
85
|
this.oldOverflowY = style.overflowY
|
83
86
|
this.lastScrollbarWidth = this.getScrollbarWidth()
|
87
|
+
}
|
88
|
+
|
89
|
+
if (this.visible) {
|
84
90
|
setTimeout(() => {
|
85
91
|
el.style.overflowY = 'hidden'
|
86
92
|
el.style.marginRight = this.lastScrollbarWidth + 'px'
|