@sedoo/unidoo 0.1.70 → 0.1.72

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,7 +1,6 @@
1
1
  <template>
2
2
  <v-container>
3
-
4
- <h3 class="product-viewer-title" v-if="breadcrumb">{{breadcrumb}}</h3>
3
+ <h3 class="product-viewer-title" v-if="breadcrumb">{{ breadcrumb }}</h3>
5
4
 
6
5
  <v-col v-if="viewer === 'tree'">
7
6
  <tree-viewer
@@ -25,7 +24,7 @@
25
24
  v-bind:campaign="campaign"
26
25
  ></wms-player>
27
26
  </v-col>
28
- <v-col v-else-if="viewer === 'iframe'">
27
+ <v-col v-else-if="viewer === 'iframe'">
29
28
  <iframe-viewer
30
29
  v-bind:service="service"
31
30
  v-bind:product="product"
@@ -33,7 +32,6 @@
33
32
  ></iframe-viewer>
34
33
  </v-col>
35
34
  <v-col v-else>
36
-
37
35
  <div v-if="day">
38
36
  <viewer-wrapper
39
37
  v-bind:service="service"
@@ -44,7 +42,7 @@
44
42
  v-bind:heatmapKey="heatmapKey"
45
43
  ></viewer-wrapper>
46
44
  </div>
47
- <div v-else-if="initialYear && year !== initialYear">
45
+ <div v-else-if="initialYear && year !== initialYear">
48
46
  <div loading>
49
47
  <b>loading data availability ...</b>
50
48
  </div>
@@ -56,7 +54,9 @@
56
54
  </div>
57
55
 
58
56
  <setting-available-data
59
- :positionLastAvailableDayForAllProducts="positionLastAvailableDayForAllProducts"
57
+ :positionLastAvailableDayForAllProducts="
58
+ positionLastAvailableDayForAllProducts
59
+ "
60
60
  @save="positionLastAvailableDayForAllProducts = $event"
61
61
  />
62
62
 
@@ -65,9 +65,13 @@
65
65
  v-bind:service="service"
66
66
  v-bind:product="product"
67
67
  v-bind:campaign="campaign"
68
- :positionLastAvailableDayForAllProducts="positionLastAvailableDayForAllProducts"
68
+ :positionLastAvailableDayForAllProducts="
69
+ positionLastAvailableDayForAllProducts
70
+ "
69
71
  v-on:hasDataTriggered="hasData = $event"
70
- v-on:positionLastAvailableDayTriggered="positionLastAvailableDay = $event"
72
+ v-on:positionLastAvailableDayTriggered="
73
+ positionLastAvailableDay = $event
74
+ "
71
75
  ></years-component>
72
76
 
73
77
  <heatmap-component
@@ -84,27 +88,24 @@
84
88
  <div v-if="!dontShowMessageAgain && shouldShowMessage">
85
89
  <message-available-data @closeMessage="closeMessage($event)" />
86
90
  </div>
87
-
88
91
  </v-col>
89
-
90
92
  </v-container>
91
-
92
93
  </template>
93
94
 
94
95
  <script>
95
- import viewerWrapper from '../viewer-wrapper/viewer-wrapper'
96
- import yearsComponent from '../years-component/years-component'
97
- import heatmapComponent from '../heatmap-component/heatmap-component'
98
- import treeViewer from '../tree-viewer/tree-viewer'
99
- import wmtsPlayer from '../map-player/wmts-player.vue'
100
- import wmsPlayer from '../map-player/wms-player.vue'
101
- import iframeViewer from '../iframe-viewer/iframe-viewer'
96
+ import viewerWrapper from "../viewer-wrapper/viewer-wrapper";
97
+ import yearsComponent from "../years-component/years-component";
98
+ import heatmapComponent from "../heatmap-component/heatmap-component";
99
+ import treeViewer from "../tree-viewer/tree-viewer";
100
+ import wmtsPlayer from "../map-player/wmts-player.vue";
101
+ import wmsPlayer from "../map-player/wms-player.vue";
102
+ import iframeViewer from "../iframe-viewer/iframe-viewer";
102
103
  import messageAvailableData from "../message-available-data/message-available-data.vue";
103
104
  import SettingAvailableData from "../setting-available-data/setting-available-data.vue";
104
105
  import moment from "moment";
105
106
 
106
107
  export default {
107
- name: 'campaign-product-block',
108
+ name: "campaign-product-block",
108
109
 
109
110
  components: {
110
111
  SettingAvailableData,
@@ -119,30 +120,29 @@ export default {
119
120
  },
120
121
 
121
122
  props: {
122
-
123
123
  service: {
124
124
  type: String,
125
- default: () => ''
125
+ default: () => ""
126
126
  },
127
127
 
128
128
  product: {
129
129
  type: String,
130
- default: () => ''
130
+ default: () => ""
131
131
  },
132
132
 
133
133
  campaign: {
134
134
  type: String,
135
- default: () => ''
135
+ default: () => ""
136
136
  },
137
137
 
138
138
  breadcrumb: {
139
139
  type: String,
140
- default: () => ''
140
+ default: () => ""
141
141
  },
142
142
 
143
143
  viewer: {
144
144
  type: String,
145
- default: () => ''
145
+ default: () => ""
146
146
  },
147
147
 
148
148
  baseFolder: {
@@ -174,19 +174,29 @@ export default {
174
174
 
175
175
  computed: {
176
176
  isTodayDate() {
177
- const formattedToday = moment().format('YYYY-MM-DD');
177
+ const formattedToday = moment().format("YYYY-MM-DD");
178
178
  return this.day === formattedToday;
179
179
  },
180
180
  isDateParam() {
181
- // Get url parameters
182
- const urlParams = new URLSearchParams(window.location.search);
183
- // Get the value of the 'date' url parameter
184
- const dateParam = urlParams.get("date");
185
- // Return true if the 'date' url parameter exists
186
- return !!(dateParam);
181
+ if (typeof window !== "undefined") {
182
+ // Get url parameters
183
+ const urlParams = new URLSearchParams(window.location.search);
184
+ // Get the value of the 'date' url parameter
185
+ const dateParam = urlParams.get("date");
186
+ // Return true if the 'date' url parameter exists
187
+ return !!dateParam;
188
+ }
189
+ return false;
187
190
  },
188
191
  shouldShowMessage() {
189
- return this.hasData && this.positionLastAvailableDay && this.day && !this.isTodayDate && !this.hasUserInteracted && !this.isDateParam;
192
+ return (
193
+ this.hasData &&
194
+ this.positionLastAvailableDay &&
195
+ this.day &&
196
+ !this.isTodayDate &&
197
+ !this.hasUserInteracted &&
198
+ !this.isDateParam
199
+ );
190
200
  }
191
201
  },
192
202
 
@@ -197,22 +207,27 @@ export default {
197
207
 
198
208
  methods: {
199
209
  handleDateParam() {
200
- const params = new URLSearchParams(document.location.search);
201
- const sdate = params.get("date");
202
- const date = this.stringToDate(sdate);
203
- if (date) {
204
- this.initialYear = '' + date.getFullYear();
205
- this.year = this.initialYear;
206
- this.initialDay = { date: date };
210
+ if (typeof document !== "undefined") {
211
+ const params = new URLSearchParams(document.location.search);
212
+ const sdate = params.get("date");
213
+ const date = this.stringToDate(sdate);
214
+ if (date) {
215
+ this.initialYear = "" + date.getFullYear();
216
+ this.year = this.initialYear;
217
+ this.initialDay = { date: date };
218
+ }
207
219
  }
208
220
  },
209
221
  create_UUID() {
210
222
  var dt = new Date().getTime();
211
- var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
223
+ var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
224
+ /[xy]/g,
225
+ function (c) {
212
226
  var r = (dt + Math.random() * 16) % 16 | 0;
213
227
  dt = Math.floor(dt / 16);
214
- return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
215
- });
228
+ return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
229
+ }
230
+ );
216
231
  return uuid;
217
232
  },
218
233
  stringToDate(s) {
@@ -233,7 +248,7 @@ export default {
233
248
  };
234
249
  </script>
235
250
  <style scoped>
236
- [loading]{
251
+ [loading] {
237
252
  display: flex;
238
253
  justify-content: center;
239
254
  align-items: center;
@@ -1,15 +1,15 @@
1
1
  <template>
2
2
  <div heatmap-calendar>
3
3
  <unidoo-heatmap
4
- ref="heatmap"
5
- v-model="date"
6
- :values="dates"
7
- :missingAllowed="false"
8
- :max="1"
9
- :completeValue="0"
10
- :year="endDate"
11
- :showCount="false"
12
- :rangeColor="[
4
+ ref="heatmap"
5
+ v-model="date"
6
+ :values="dates"
7
+ :missingAllowed="false"
8
+ :max="1"
9
+ :completeValue="0"
10
+ :year="endDate"
11
+ :showCount="false"
12
+ :rangeColor="[
13
13
  '#ebedf0',
14
14
  '#dae2ef',
15
15
  '#c0ddf9',
@@ -17,8 +17,8 @@
17
17
  '#3886e1',
18
18
  '#17459e'
19
19
  ]"
20
- :tooltip-unit="unit"
21
- :heatmapKey="heatmapKey"
20
+ :tooltip-unit="unit"
21
+ :heatmapKey="heatmapKey"
22
22
  ></unidoo-heatmap>
23
23
  <div spinner v-if="isLoading">
24
24
  <loading-component></loading-component>
@@ -77,7 +77,6 @@ export default {
77
77
  type: Boolean,
78
78
  default: false
79
79
  }
80
-
81
80
  },
82
81
 
83
82
  data: () => ({
@@ -148,50 +147,52 @@ export default {
148
147
  this.isLoading = true;
149
148
  const self = this;
150
149
  axios
151
- .get(
152
- this.service +
153
- "/request?product=" +
154
- this.product +
155
- "&filter=" +
156
- year +
157
- (this.campaign ? "&campaign=" + this.campaign : "")
158
- )
159
- .then((response) => {
160
- if (self.year === year) {
161
- // self.year == year s'assure de ne pas utiliser le resultat d'une requete précédente
162
- if (response.data && response.data.entries) {
163
- self.searchResult = response.data.entries;
164
- // sort searchResult
165
- self.sort(self.searchResult);
166
- if (self.initialValue && self.isFirstLoad) {
167
- const date =
168
- self.initialValue instanceof Date
169
- ? self.initialValue
170
- : self.initialValue.date;
171
- setTimeout(() => {
172
- // wait availability assignement
173
- self.emitDate(date);
174
- }, 500);
175
- self.isFirstLoad = false;
176
- } else if (this.positionLastAvailableDay || year !== dateToSpecificTimeZone(new Date()).getFullYear() + "") {
177
- self.goToLastDay();
178
- } else {
179
- // Go to current day if not this.positionLastAvailableDay and the year is the current year
180
- self.goToCurrentDay();
181
- }
182
- } else {
183
- self.goToCurrentDay();
184
- self.searchResult = [];
185
- }
186
- self.isLoading = false;
187
- }
150
+ .get(
151
+ this.service +
152
+ "/request?product=" +
153
+ this.product +
154
+ "&filter=" +
155
+ year +
156
+ (this.campaign ? "&campaign=" + this.campaign : "")
157
+ )
158
+ .then((response) => {
159
+ if (self.year === year) {
160
+ // self.year == year s'assure de ne pas utiliser le resultat d'une requete précédente
161
+ if (response.data && response.data.entries) {
162
+ self.searchResult = response.data.entries;
163
+ // sort searchResult
164
+ self.sort(self.searchResult);
165
+ if (self.initialValue && self.isFirstLoad) {
166
+ const date =
167
+ self.initialValue instanceof Date
168
+ ? self.initialValue
169
+ : self.initialValue.date;
170
+ setTimeout(() => {
171
+ // wait availability assignement
172
+ self.emitDate(date);
173
+ }, 500);
174
+ self.isFirstLoad = false;
175
+ } else if (
176
+ this.positionLastAvailableDay ||
177
+ year !== dateToSpecificTimeZone(new Date()).getFullYear() + ""
178
+ ) {
179
+ self.goToLastDay();
180
+ } else {
181
+ // Go to current day if not this.positionLastAvailableDay and the year is the current year
182
+ self.goToCurrentDay();
188
183
  }
189
- )
190
- .catch(() => {
191
- self.goToCurrentDay();
192
- self.searchResult = [];
184
+ } else {
185
+ self.goToCurrentDay();
186
+ self.searchResult = [];
187
+ }
193
188
  self.isLoading = false;
194
- });
189
+ }
190
+ })
191
+ .catch(() => {
192
+ self.goToCurrentDay();
193
+ self.searchResult = [];
194
+ self.isLoading = false;
195
+ });
195
196
  } else {
196
197
  console.error("Error service or product are not defined");
197
198
  }
@@ -200,7 +201,7 @@ export default {
200
201
  goToLastDay() {
201
202
  if (this.searchResult && this.searchResult.length > 0) {
202
203
  const yearDates = this.searchResult.filter(
203
- (item) => item.date && item.date.includes(this.year)
204
+ (item) => item.date && item.date.includes(this.year)
204
205
  );
205
206
  if (yearDates && yearDates.length > 0) {
206
207
  const lastEntry = yearDates[0];
@@ -208,7 +209,10 @@ export default {
208
209
  this.emitDate(d);
209
210
  }
210
211
  } else {
211
- if (this.year === dateToSpecificTimeZone(new Date()).getFullYear() + "") {
212
+ if (
213
+ this.year ===
214
+ dateToSpecificTimeZone(new Date()).getFullYear() + ""
215
+ ) {
212
216
  this.goToCurrentDay();
213
217
  } else {
214
218
  const d = dateToSpecificTimeZone(new Date(this.year, 0, 1));
@@ -268,8 +272,7 @@ export default {
268
272
  }
269
273
  }
270
274
  }
271
- }
272
- ;
275
+ };
273
276
  </script>
274
277
 
275
278
  <style scoped>
@@ -189,7 +189,7 @@ export default {
189
189
 
190
190
  methods: {
191
191
  initMap() {
192
- if (this.id) {
192
+ if (this.id && typeof document !== "undefined") {
193
193
  // coordonnées souris
194
194
  var mousePositionControl = new MousePosition({
195
195
  coordinateFormat: createStringXY(4),