@sedoo/unidoo 0.0.67 → 0.0.71
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 +174 -131
- package/dist/unidoo.common.js.map +1 -1
- package/dist/unidoo.umd.js +174 -131
- 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/date-switcher.vue +4 -4
- package/src/components/unidoo-player/level-selector/level-selector-row.vue +19 -19
- package/src/components/unidoo-player/level-selector/level-selector.vue +59 -51
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div date-switch>
|
|
3
|
-
<v-btn icon x-small :disabled="!previousAvailable" style="margin-right: 4px;" @click="goToPreviousAvailable(1)">
|
|
3
|
+
<v-btn icon x-small :disabled="!previousAvailable" title="Previous available" style="margin-right: 4px;" @click="goToPreviousAvailable(1)">
|
|
4
4
|
<v-icon>mdi-skip-previous</v-icon>
|
|
5
5
|
</v-btn>
|
|
6
|
-
<v-btn icon x-small :disabled="!hasPrevious" style="margin-right: 8px;" @click="switchDate(-1)">
|
|
6
|
+
<v-btn icon x-small :disabled="!hasPrevious" title="Previous day" style="margin-right: 8px;" @click="switchDate(-1)">
|
|
7
7
|
<v-icon>mdi-rewind</v-icon>
|
|
8
8
|
</v-btn>
|
|
9
9
|
<v-icon>mdi-calendar-month</v-icon>
|
|
10
|
-
<v-btn icon x-small :disabled="!hasNext" style="margin-left: 8px;" @click="switchDate(1)">
|
|
10
|
+
<v-btn icon x-small :disabled="!hasNext" title="Next day" style="margin-left: 8px;" @click="switchDate(1)">
|
|
11
11
|
<v-icon>mdi-fast-forward</v-icon>
|
|
12
12
|
</v-btn>
|
|
13
|
-
<v-btn icon x-small :disabled="!nextAvailable" style="margin-left: 4px;" @click="goToNextAvailable(1)">
|
|
13
|
+
<v-btn icon x-small :disabled="!nextAvailable" title="Next available" style="margin-left: 4px;" @click="goToNextAvailable(1)">
|
|
14
14
|
<v-icon>mdi-skip-next</v-icon>
|
|
15
15
|
</v-btn>
|
|
16
16
|
</div>
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div selector-row>
|
|
3
|
-
<
|
|
3
|
+
<div container>
|
|
4
4
|
|
|
5
5
|
<span label>{{label}} : </span>
|
|
6
6
|
|
|
7
7
|
<span line v-if="options && options.length > 0">
|
|
8
|
-
<span v-for="
|
|
9
|
-
value
|
|
10
|
-
:
|
|
11
|
-
:class="'level ' + ((availableOptions.includes(
|
|
12
|
-
@click="emitInput(
|
|
13
|
-
>{{
|
|
8
|
+
<span v-for="item in options"
|
|
9
|
+
:key="item.value"
|
|
10
|
+
:title="item.legend"
|
|
11
|
+
:class="'level ' + ((availableOptions.includes(item.value)) ? 'clickable-level ' : 'disabled-level ') + focus(item.value)"
|
|
12
|
+
@click="emitInput(item.value, (availableOptions.includes(item.value)))"
|
|
13
|
+
>{{item.value}}</span>
|
|
14
14
|
</span>
|
|
15
15
|
<span line v-else>
|
|
16
|
-
<span v-for="
|
|
17
|
-
value
|
|
18
|
-
:
|
|
19
|
-
:class="'level ' + 'clickable-level ' + focus(
|
|
20
|
-
@click="$emit('input',
|
|
21
|
-
>{{
|
|
16
|
+
<span v-for="item in availableOptions"
|
|
17
|
+
:key="item.value"
|
|
18
|
+
:title="item.legend"
|
|
19
|
+
:class="'level ' + 'clickable-level ' + focus(item.value)"
|
|
20
|
+
@click="$emit('input', item.value)"
|
|
21
|
+
>{{item.value}}</span>
|
|
22
22
|
</span>
|
|
23
23
|
|
|
24
|
-
</
|
|
24
|
+
</div>
|
|
25
25
|
|
|
26
26
|
</div>
|
|
27
27
|
</template>
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
watch: {
|
|
56
56
|
availableOptions(val) {
|
|
57
57
|
if (val.length) {
|
|
58
|
-
if(this.value && val.includes(this.value)){
|
|
58
|
+
if (this.value && val.includes(this.value)) {
|
|
59
59
|
this.$emit('input', this.value);
|
|
60
60
|
} else {
|
|
61
61
|
this.$emit('input', val[0]);
|
|
@@ -67,14 +67,14 @@ export default {
|
|
|
67
67
|
|
|
68
68
|
methods: {
|
|
69
69
|
|
|
70
|
-
emitInput(key, available){
|
|
71
|
-
if(available){
|
|
70
|
+
emitInput(key, available) {
|
|
71
|
+
if (available) {
|
|
72
72
|
this.$emit('input', key);
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
|
|
76
76
|
focus(key) {
|
|
77
|
-
return this.value
|
|
77
|
+
return this.value === key ? 'level-focused' : '';
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -87,6 +87,7 @@ export default {
|
|
|
87
87
|
|
|
88
88
|
[selector-row] [container]{
|
|
89
89
|
display: flex;
|
|
90
|
+
flex-wrap: wrap;
|
|
90
91
|
justify-items: center;
|
|
91
92
|
align-items: center;
|
|
92
93
|
}
|
|
@@ -139,4 +140,3 @@ export default {
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
</style>
|
|
142
|
-
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div selector>
|
|
3
3
|
<v-col level-selector v-if="levels && data">
|
|
4
4
|
|
|
5
|
-
<
|
|
5
|
+
<div style="display: flex; flex-wrap: wrap; margin: 0 -12px;" v-for="(key) in levelKeys"
|
|
6
6
|
:key="key"
|
|
7
7
|
>
|
|
8
8
|
<level-selector-row
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
:options="getAllOptions(key)"
|
|
13
13
|
></level-selector-row>
|
|
14
14
|
|
|
15
|
-
</
|
|
15
|
+
</div>
|
|
16
16
|
</v-col>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
@@ -31,7 +31,7 @@ export default {
|
|
|
31
31
|
type: Array
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
-
showUnavailable:{
|
|
34
|
+
showUnavailable: {
|
|
35
35
|
type: Boolean,
|
|
36
36
|
default: true
|
|
37
37
|
}
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
selector: null,
|
|
42
42
|
levelOptions: null, // tree used to update options
|
|
43
43
|
options: null,
|
|
44
|
-
entries:
|
|
44
|
+
entries: null,
|
|
45
45
|
levelKeys: null,
|
|
46
46
|
availableOptions: null
|
|
47
47
|
}),
|
|
@@ -60,16 +60,16 @@ export default {
|
|
|
60
60
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
|
-
mounted(){
|
|
63
|
+
mounted() {
|
|
64
64
|
this.initData(this.data);
|
|
65
65
|
},
|
|
66
66
|
|
|
67
67
|
methods: {
|
|
68
68
|
|
|
69
69
|
initData(data) {
|
|
70
|
-
if(data){
|
|
71
|
-
if(data.entries && data.entries.length){
|
|
72
|
-
if(data.levels){
|
|
70
|
+
if (data) {
|
|
71
|
+
if (data.entries && data.entries.length) {
|
|
72
|
+
if (data.levels) {
|
|
73
73
|
this.initLevels(data.levels, data.entries);
|
|
74
74
|
} else {
|
|
75
75
|
this.$emit('input', this.sort(data.entries));
|
|
@@ -82,7 +82,7 @@ export default {
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
|
|
85
|
-
loadSelector(val){
|
|
85
|
+
loadSelector(val) {
|
|
86
86
|
// update options by level
|
|
87
87
|
if (val) {
|
|
88
88
|
if (!this.availableOptions) {
|
|
@@ -93,7 +93,7 @@ export default {
|
|
|
93
93
|
const self = this;
|
|
94
94
|
keys.forEach(k => {
|
|
95
95
|
const values = self.optionsFromLevel(k);
|
|
96
|
-
if (JSON.stringify(values)
|
|
96
|
+
if (JSON.stringify(values) !== JSON.stringify(self.availableOptions[k])) {
|
|
97
97
|
self.availableOptions[k] = values;
|
|
98
98
|
}
|
|
99
99
|
})
|
|
@@ -102,9 +102,8 @@ export default {
|
|
|
102
102
|
this.$emit('input', this.sort(this.entries[this.getLevelIdFromSelector(val)]));
|
|
103
103
|
},
|
|
104
104
|
|
|
105
|
-
initLevels(levels, entries){
|
|
106
|
-
|
|
107
|
-
if(levels.length > 0 && entries.length > 0){
|
|
105
|
+
initLevels(levels, entries) {
|
|
106
|
+
if (levels.length > 0 && entries.length > 0) {
|
|
108
107
|
this.levelKeys = [];
|
|
109
108
|
this.levels = {};
|
|
110
109
|
this.entries = {};
|
|
@@ -112,67 +111,62 @@ export default {
|
|
|
112
111
|
|
|
113
112
|
levels.forEach(l => {
|
|
114
113
|
this.levelKeys.push(l.name);
|
|
115
|
-
this.levels[l.name] = { label
|
|
114
|
+
this.levels[l.name] = { label: l.label };
|
|
116
115
|
});
|
|
117
116
|
|
|
118
117
|
this.levelKeys.sort();
|
|
119
118
|
|
|
120
119
|
// init default selector using first entry
|
|
121
|
-
|
|
120
|
+
const defaultSelector = {};
|
|
122
121
|
entries[0].levels.forEach(l => {
|
|
123
122
|
defaultSelector[l.name] = l.value;
|
|
124
123
|
});
|
|
125
124
|
|
|
126
125
|
// init options tree
|
|
127
|
-
|
|
126
|
+
const tempOptions = {};
|
|
128
127
|
entries.forEach(entry => {
|
|
129
|
-
if(entry.levels){
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
let entryLevels = [...entry.levels];
|
|
128
|
+
if (entry.levels) {
|
|
129
|
+
const entryLevels = [...entry.levels];
|
|
133
130
|
entryLevels.sort((a, b) => b.name.localeCompare(a.name));
|
|
134
131
|
|
|
135
132
|
let branch = null;
|
|
136
133
|
entryLevels.forEach(l => {
|
|
137
|
-
|
|
134
|
+
const tuple = {};
|
|
138
135
|
tuple[l.value] = branch
|
|
139
136
|
branch = tuple;
|
|
140
|
-
|
|
141
137
|
});
|
|
142
138
|
|
|
143
139
|
this.mergeDeep(tempOptions, branch);
|
|
144
140
|
|
|
145
|
-
|
|
141
|
+
const curLevels = entry.levels;
|
|
146
142
|
curLevels.sort((a, b) => a.name.localeCompare(b.name));
|
|
147
143
|
|
|
148
144
|
let levelId = '';
|
|
149
145
|
curLevels.forEach(l => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.pushIfNotExist(this.levels[l.name].values, l.value);
|
|
154
|
-
|
|
146
|
+
if (this.levels[l.name]) {
|
|
147
|
+
if (!this.levels[l.name].values) this.levels[l.name].values = [];
|
|
148
|
+
this.pushIfObjectNotExist(this.levels[l.name].values, { value: l.value, legend: this.getLegend(l.value) });
|
|
149
|
+
// this.pushIfNotExist(this.levels[l.name].values, l.value);
|
|
155
150
|
}
|
|
156
151
|
|
|
157
152
|
// compute id with options combination
|
|
158
153
|
levelId += ((levelId) ? SEPARATOR : '') + l.value;
|
|
159
154
|
});
|
|
160
155
|
|
|
161
|
-
if(!this.entries[levelId]) this.entries[levelId] = [];
|
|
156
|
+
if (!this.entries[levelId]) this.entries[levelId] = [];
|
|
162
157
|
|
|
163
158
|
// store data by options combination
|
|
164
159
|
this.entries[levelId].push(entry);
|
|
165
160
|
}
|
|
166
|
-
|
|
167
161
|
});
|
|
168
162
|
|
|
169
163
|
this.levelOptions = tempOptions;
|
|
170
164
|
|
|
171
|
-
if(this.selector){
|
|
165
|
+
if (this.selector) {
|
|
172
166
|
// try to return data from entries map and last selector value
|
|
173
167
|
// else use selector default value
|
|
174
|
-
|
|
175
|
-
if(lastSelectionEntries && lastSelectionEntries.length > 0){
|
|
168
|
+
const lastSelectionEntries = this.entries[this.getLevelIdFromSelector(this.selector)];
|
|
169
|
+
if (lastSelectionEntries && lastSelectionEntries.length > 0) {
|
|
176
170
|
this.loadSelector(this.selector);
|
|
177
171
|
} else {
|
|
178
172
|
this.selector = defaultSelector;
|
|
@@ -183,6 +177,17 @@ export default {
|
|
|
183
177
|
}
|
|
184
178
|
},
|
|
185
179
|
|
|
180
|
+
getLegend(value){
|
|
181
|
+
if(value && this.data && this.data.legend){
|
|
182
|
+
const legend = this.data.legend.find(el => (el.code && el.code.toUpperCase() === value.toUpperCase()));
|
|
183
|
+
if(legend) {
|
|
184
|
+
return legend.label;
|
|
185
|
+
} else {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
|
|
186
191
|
mergeDeep(target, source) {
|
|
187
192
|
const isObject = (obj) => obj && typeof obj === 'object';
|
|
188
193
|
|
|
@@ -195,7 +200,7 @@ export default {
|
|
|
195
200
|
const sourceValue = source[key];
|
|
196
201
|
|
|
197
202
|
if (isObject(targetValue) && isObject(sourceValue)) {
|
|
198
|
-
|
|
203
|
+
const t = Object.assign({}, targetValue);
|
|
199
204
|
target[key] = this.mergeDeep(t, sourceValue);
|
|
200
205
|
} else {
|
|
201
206
|
target[key] = sourceValue;
|
|
@@ -205,10 +210,10 @@ export default {
|
|
|
205
210
|
return target;
|
|
206
211
|
},
|
|
207
212
|
|
|
208
|
-
getLevelIdFromSelector(selectorValue){
|
|
213
|
+
getLevelIdFromSelector(selectorValue) {
|
|
209
214
|
let levelId = '';
|
|
210
|
-
if(selectorValue){
|
|
211
|
-
|
|
215
|
+
if (selectorValue) {
|
|
216
|
+
const keys = Object.keys(selectorValue);
|
|
212
217
|
keys.sort();
|
|
213
218
|
|
|
214
219
|
keys.forEach(k => {
|
|
@@ -218,21 +223,20 @@ export default {
|
|
|
218
223
|
return levelId;
|
|
219
224
|
},
|
|
220
225
|
|
|
221
|
-
optionsFromLevel(key){
|
|
222
|
-
if(this.levelOptions && this.selector){
|
|
223
|
-
|
|
226
|
+
optionsFromLevel(key) {
|
|
227
|
+
if (this.levelOptions && this.selector) {
|
|
224
228
|
const selectorKeys = Object.keys(this.selector);
|
|
225
229
|
selectorKeys.sort();
|
|
226
230
|
|
|
227
231
|
const index = selectorKeys.indexOf(key);
|
|
228
|
-
const indexes = selectorKeys.slice(0,index);
|
|
232
|
+
const indexes = selectorKeys.slice(0, index);
|
|
229
233
|
|
|
230
234
|
// traverse levelOptions by level using selector values
|
|
231
235
|
let result = this.levelOptions;
|
|
232
236
|
const self = this;
|
|
233
237
|
indexes.forEach(k => {
|
|
234
238
|
const tmp = result[self.selector[k]];
|
|
235
|
-
if(tmp){
|
|
239
|
+
if (tmp) {
|
|
236
240
|
result = tmp;
|
|
237
241
|
} else {
|
|
238
242
|
result = result[Object.keys(result)[0]];
|
|
@@ -243,8 +247,8 @@ export default {
|
|
|
243
247
|
}
|
|
244
248
|
},
|
|
245
249
|
|
|
246
|
-
getAllOptions(key){
|
|
247
|
-
if(this.showUnavailable && this.levels[key]){
|
|
250
|
+
getAllOptions(key) {
|
|
251
|
+
if (this.showUnavailable && this.levels[key]) {
|
|
248
252
|
return this.levels[key].values;
|
|
249
253
|
} else {
|
|
250
254
|
return null;
|
|
@@ -257,9 +261,16 @@ export default {
|
|
|
257
261
|
}
|
|
258
262
|
},
|
|
259
263
|
|
|
260
|
-
|
|
264
|
+
pushIfObjectNotExist(array, element) {
|
|
265
|
+
if (array && !array.some(e => e.value === element.value)) {
|
|
266
|
+
array.push(element);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
sort(array) {
|
|
261
272
|
if (array) {
|
|
262
|
-
if (array.length > 1){
|
|
273
|
+
if (array.length > 1) {
|
|
263
274
|
let compare = null;
|
|
264
275
|
|
|
265
276
|
compare = function(a, b) {
|
|
@@ -271,10 +282,10 @@ export default {
|
|
|
271
282
|
second = parseInt(b.type);
|
|
272
283
|
}
|
|
273
284
|
|
|
274
|
-
if (
|
|
285
|
+
if (first > second) {
|
|
275
286
|
return 1;
|
|
276
287
|
}
|
|
277
|
-
if (
|
|
288
|
+
if (first < second) {
|
|
278
289
|
return -1;
|
|
279
290
|
}
|
|
280
291
|
return 0;
|
|
@@ -287,14 +298,11 @@ export default {
|
|
|
287
298
|
} else {
|
|
288
299
|
return array;
|
|
289
300
|
}
|
|
290
|
-
|
|
291
301
|
},
|
|
292
302
|
}
|
|
293
303
|
|
|
294
304
|
}
|
|
295
305
|
</script>
|
|
296
306
|
<style scoped>
|
|
297
|
-
|
|
298
307
|
|
|
299
308
|
</style>
|
|
300
|
-
|