@sedoo/unidoo 0.0.63 → 0.0.64
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/dist/unidoo.common.js +106 -105
- package/dist/unidoo.common.js.map +1 -1
- package/dist/unidoo.umd.js +106 -105
- package/dist/unidoo.umd.js.map +1 -1
- package/dist/unidoo.umd.min.js +2 -2
- package/dist/unidoo.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/unidoo-heatmap/UnidooHeatmap.vue +18 -17
- package/src/components/unidoo-heatmap/date-switcher.vue +21 -23
package/package.json
CHANGED
|
@@ -88,7 +88,7 @@ export default {
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
data: () => ({
|
|
91
|
-
now: new Date(new Date().setHours(23,59,59,999))
|
|
91
|
+
now: new Date(new Date().setHours(23, 59, 59, 999))
|
|
92
92
|
}),
|
|
93
93
|
watch: {
|
|
94
94
|
dateValue (val) {
|
|
@@ -123,7 +123,7 @@ export default {
|
|
|
123
123
|
return DEFAULT_LOCALE
|
|
124
124
|
},
|
|
125
125
|
dateValue() {
|
|
126
|
-
if(this.value){
|
|
126
|
+
if (this.value) {
|
|
127
127
|
return (this.value instanceof Date) ? this.value : this.value.date;
|
|
128
128
|
} else {
|
|
129
129
|
return this.value;
|
|
@@ -132,17 +132,17 @@ export default {
|
|
|
132
132
|
},
|
|
133
133
|
beforeMount () {
|
|
134
134
|
Plugin.EventBus.$on("unidoo-heatmap-set-date", params => {
|
|
135
|
-
if(this.heatmapKey) {
|
|
136
|
-
if (params.key === this.heatmapKey && params.date){
|
|
135
|
+
if (this.heatmapKey) {
|
|
136
|
+
if (params.key === this.heatmapKey && params.date) {
|
|
137
137
|
this.setDate(params.date)
|
|
138
138
|
}
|
|
139
|
-
} else if(params.date) {
|
|
139
|
+
} else if (params.date) {
|
|
140
140
|
this.setDate(params.date)
|
|
141
141
|
}
|
|
142
142
|
})
|
|
143
143
|
Plugin.EventBus.$on("unidoo-heatmap-get-date", params => {
|
|
144
|
-
if(this.heatmapKey) {
|
|
145
|
-
if (params.key === this.heatmapKey){
|
|
144
|
+
if (this.heatmapKey) {
|
|
145
|
+
if (params.key === this.heatmapKey) {
|
|
146
146
|
this.updateDateSwitcher(this.dateValue)
|
|
147
147
|
}
|
|
148
148
|
} else {
|
|
@@ -185,7 +185,7 @@ export default {
|
|
|
185
185
|
handleClick (e, day) {
|
|
186
186
|
if (day) {
|
|
187
187
|
if (day.date <= this.now && (typeof day.count === 'number' || this.missingAllowed)) {
|
|
188
|
-
if(this.returnObject){
|
|
188
|
+
if (this.returnObject) {
|
|
189
189
|
this.$emit('input', day);
|
|
190
190
|
} else {
|
|
191
191
|
this.$emit('input', day.date);
|
|
@@ -201,23 +201,24 @@ export default {
|
|
|
201
201
|
updateDateSwitcher (d) {
|
|
202
202
|
this.$unidooDateSwitcher.update({
|
|
203
203
|
hasPrevious: this.hasPreviousDate(d),
|
|
204
|
-
hasNext
|
|
205
|
-
previousAvailable
|
|
206
|
-
nextAvailable
|
|
204
|
+
hasNext: this.hasNextDate(d),
|
|
205
|
+
previousAvailable: this.heatmap.getPreviousAvailableDate(d),
|
|
206
|
+
nextAvailable: this.heatmap.getNextAvailableDate(d)
|
|
207
207
|
}, this.heatmapKey);
|
|
208
208
|
},
|
|
209
209
|
hasPreviousDate (d) {
|
|
210
|
-
if(!d || !this.compairDateWithYear(d)) return false
|
|
210
|
+
if (!d || !this.compairDateWithYear(d)) return false;
|
|
211
211
|
const syear = (this.year instanceof Date) ? this.year.getFullYear() : this.year;
|
|
212
212
|
const firstDay = new Date(syear, 0, 1);
|
|
213
|
-
|
|
213
|
+
d.setHours(0, 0, 0, 0);
|
|
214
|
+
if (d <= firstDay) return false;
|
|
214
215
|
return true;
|
|
215
216
|
},
|
|
216
217
|
hasNextDate (d) {
|
|
217
|
-
if(!d || !this.compairDateWithYear(d)) return false
|
|
218
|
+
if (!d || !this.compairDateWithYear(d)) return false
|
|
218
219
|
const today = new Date();
|
|
219
|
-
today.setHours(0,0,0,0);
|
|
220
|
-
if(d >= today) return false;
|
|
220
|
+
today.setHours(0, 0, 0, 0);
|
|
221
|
+
if (d >= today) return false;
|
|
221
222
|
return true;
|
|
222
223
|
},
|
|
223
224
|
focusDate (d) {
|
|
@@ -288,7 +289,7 @@ export default {
|
|
|
288
289
|
first.getDate() === second.getDate()
|
|
289
290
|
},
|
|
290
291
|
compairDateWithYear (d) {
|
|
291
|
-
if(this.year && d){
|
|
292
|
+
if (this.year && d) {
|
|
292
293
|
const sd = '' + ((d instanceof Date) ? d.getFullYear() : d);
|
|
293
294
|
const syear = '' + ((this.year instanceof Date) ? this.year.getFullYear() : this.year);
|
|
294
295
|
return syear === sd;
|
|
@@ -21,8 +21,8 @@ import Plugin from '../../plugin.js'
|
|
|
21
21
|
|
|
22
22
|
export default {
|
|
23
23
|
props: {
|
|
24
|
-
date
|
|
25
|
-
type
|
|
24
|
+
date: {
|
|
25
|
+
type: [String, Date],
|
|
26
26
|
default: null
|
|
27
27
|
},
|
|
28
28
|
heatmapKey: {
|
|
@@ -44,18 +44,18 @@ export default {
|
|
|
44
44
|
},
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
computed:{
|
|
48
|
-
cleanedDate(){
|
|
47
|
+
computed: {
|
|
48
|
+
cleanedDate() {
|
|
49
49
|
return this.cleanDate(this.date);
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
beforeMount () {
|
|
53
53
|
Plugin.EventBus.$on("unidoo-dateswitcher-update", params => {
|
|
54
|
-
if(this.heatmapKey) {
|
|
55
|
-
if (params.key === this.heatmapKey && params.data){
|
|
54
|
+
if (this.heatmapKey) {
|
|
55
|
+
if (params.key === this.heatmapKey && params.data) {
|
|
56
56
|
this.updateNearDates(params.data);
|
|
57
57
|
}
|
|
58
|
-
} else if(params.data) {
|
|
58
|
+
} else if (params.data) {
|
|
59
59
|
this.updateNearDates(params.data);
|
|
60
60
|
} else {
|
|
61
61
|
this.reset();
|
|
@@ -68,36 +68,36 @@ export default {
|
|
|
68
68
|
},
|
|
69
69
|
|
|
70
70
|
methods: {
|
|
71
|
-
reset(){
|
|
71
|
+
reset() {
|
|
72
72
|
this.hasNext = false
|
|
73
73
|
this.hasPrevious = false
|
|
74
74
|
this.nextAvailable = null
|
|
75
75
|
this.previousAvailable = null
|
|
76
76
|
},
|
|
77
77
|
goToNextAvailable() {
|
|
78
|
-
if(this.hasNext) {
|
|
78
|
+
if (this.hasNext) {
|
|
79
79
|
this.$unidooHeatmap.setDate(this.cleanDate(this.nextAvailable), this.heatmapKey);
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
goToPreviousAvailable() {
|
|
84
|
-
if(this.hasPrevious) {
|
|
84
|
+
if (this.hasPrevious) {
|
|
85
85
|
this.$unidooHeatmap.setDate(this.cleanDate(this.previousAvailable), this.heatmapKey);
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
|
|
89
|
-
switchDate(n){
|
|
90
|
-
if(this.cleanedDate && n){
|
|
91
|
-
if((n > 0 && this.hasNext) || (n < 0 && this.hasPrevious)){
|
|
92
|
-
|
|
89
|
+
switchDate(n) {
|
|
90
|
+
if (this.cleanedDate && n) {
|
|
91
|
+
if ((n > 0 && this.hasNext) || (n < 0 && this.hasPrevious)) {
|
|
92
|
+
const newDate = new Date(this.cleanedDate);
|
|
93
93
|
newDate.setDate(this.cleanedDate.getDate() + n);
|
|
94
94
|
this.$unidooHeatmap.setDate(newDate, this.heatmapKey);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
|
|
99
|
-
updateNearDates(data){
|
|
100
|
-
if(data){
|
|
99
|
+
updateNearDates(data) {
|
|
100
|
+
if (data) {
|
|
101
101
|
this.hasNext = data.hasNext
|
|
102
102
|
this.hasPrevious = data.hasPrevious
|
|
103
103
|
this.nextAvailable = data.nextAvailable
|
|
@@ -105,11 +105,11 @@ export default {
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
|
|
108
|
-
cleanDate(date){
|
|
109
|
-
if(date){
|
|
110
|
-
if(date instanceof Date){
|
|
108
|
+
cleanDate(date) {
|
|
109
|
+
if (date) {
|
|
110
|
+
if (date instanceof Date) {
|
|
111
111
|
return date;
|
|
112
|
-
} else if(typeof date === 'string'){
|
|
112
|
+
} else if (typeof date === 'string') {
|
|
113
113
|
return new Date(date);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -128,6 +128,4 @@ export default {
|
|
|
128
128
|
background: rgb(245,245,245);
|
|
129
129
|
border-radius: 5px;
|
|
130
130
|
}
|
|
131
|
-
</style>
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
</style>
|