@sedoo/unidoo 0.0.61 → 0.0.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedoo/unidoo",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build --target lib --name unidoo src/plugin.js",
@@ -95,13 +95,14 @@ export default {
95
95
  this.focusDate(val)
96
96
  this.updateDateSwitcher(val)
97
97
  },
98
- year (val) {
99
- if (val !== this.year) {
98
+ year (val, old) {
99
+ if (val !== old) {
100
100
  const rects = document.querySelectorAll('[heatmap-calendar] [month] .monthday')
101
101
  rects.forEach(element => {
102
102
  element.classList.remove('day-focus')
103
103
  });
104
104
  this.focusDate(this.dateValue)
105
+ this.updateDateSwitcher(null)
105
106
  }
106
107
  }
107
108
  },
@@ -206,13 +207,14 @@ export default {
206
207
  }, this.heatmapKey);
207
208
  },
208
209
  hasPreviousDate (d) {
209
- if(!d || this.year != d.getFullYear()) return false
210
- const firstDay = new Date(this.year, 0, 1);
210
+ if(!d || !this.compairDateWithYear(d)) return false
211
+ const syear = (this.year instanceof Date) ? this.year.getFullYear() : this.year;
212
+ const firstDay = new Date(syear, 0, 1);
211
213
  if(d <= firstDay) return false;
212
214
  return true;
213
215
  },
214
216
  hasNextDate (d) {
215
- if(!d || this.year != d.getFullYear()) return false
217
+ if(!d || !this.compairDateWithYear(d)) return false
216
218
  const today = new Date();
217
219
  today.setHours(0,0,0,0);
218
220
  if(d >= today) return false;
@@ -284,6 +286,15 @@ export default {
284
286
  return first.getFullYear() === second.getFullYear() &&
285
287
  first.getMonth() === second.getMonth() &&
286
288
  first.getDate() === second.getDate()
289
+ },
290
+ compairDateWithYear (d) {
291
+ if(this.year && d){
292
+ const sd = '' + ((d instanceof Date) ? d.getFullYear() : d);
293
+ const syear = '' + ((this.year instanceof Date) ? this.year.getFullYear() : this.year);
294
+ return syear === sd;
295
+ } else {
296
+ return false
297
+ }
287
298
  }
288
299
  }
289
300
  }
@@ -57,6 +57,8 @@ export default {
57
57
  }
58
58
  } else if(params.data) {
59
59
  this.updateNearDates(params.data);
60
+ } else {
61
+ this.reset();
60
62
  }
61
63
  })
62
64
  },
@@ -66,7 +68,12 @@ export default {
66
68
  },
67
69
 
68
70
  methods: {
69
-
71
+ reset(){
72
+ this.hasNext = false
73
+ this.hasPrevious = false
74
+ this.nextAvailable = null
75
+ this.previousAvailable = null
76
+ },
70
77
  goToNextAvailable() {
71
78
  if(this.hasNext) {
72
79
  this.$unidooHeatmap.setDate(this.cleanDate(this.nextAvailable), this.heatmapKey);