@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-rc

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.
Files changed (113) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -4
  4. package/core/client/components/DashboardLayout.vue +36 -14
  5. package/core/client/components/Loading.vue +6 -9
  6. package/core/client/components/MobileLayout.vue +16 -14
  7. package/core/client/composables/DefineEodash.js +14 -4
  8. package/core/client/composables/DefineTemplate.js +67 -0
  9. package/core/client/composables/DefineWidgets.js +3 -2
  10. package/core/client/composables/EodashMap.js +360 -0
  11. package/core/client/composables/EodashProcess.js +574 -0
  12. package/core/client/composables/index.js +136 -28
  13. package/core/client/eodash.js +395 -80
  14. package/core/client/eodashSTAC/EodashCollection.js +432 -0
  15. package/core/client/eodashSTAC/createLayers.js +315 -0
  16. package/core/client/eodashSTAC/helpers.js +375 -0
  17. package/core/client/eodashSTAC/triggers.js +43 -0
  18. package/core/client/plugins/axios.js +8 -0
  19. package/core/client/plugins/index.js +2 -1
  20. package/core/client/plugins/vuetify.js +2 -1
  21. package/core/client/store/actions.js +79 -0
  22. package/core/client/store/index.js +4 -18
  23. package/core/client/store/stac.js +99 -9
  24. package/core/client/store/states.js +37 -0
  25. package/core/client/{types.d.ts → types.ts} +66 -20
  26. package/core/client/utils/keys.js +2 -0
  27. package/core/client/utils/states.js +22 -0
  28. package/core/client/views/Dashboard.vue +22 -49
  29. package/core/client/vite-env.d.ts +2 -10
  30. package/dist/client/DashboardLayout-232tRmjz.js +84 -0
  31. package/dist/client/DynamicWebComponent-Cl4LqHU6.js +88 -0
  32. package/dist/client/EodashDatePicker-Pok6bZwU.js +306 -0
  33. package/dist/client/EodashItemFilter-16eMMjTV.js +151 -0
  34. package/dist/client/EodashLayerControl-De7IlCm_.js +120 -0
  35. package/dist/client/EodashLayoutSwitcher-C-3-jjn5.js +52 -0
  36. package/dist/client/EodashMap-CMvbfI6-.js +549 -0
  37. package/dist/client/EodashMapBtns-BeknGDtc.js +107 -0
  38. package/dist/client/EodashProcess-BwKAa9Ee.js +1476 -0
  39. package/dist/client/EodashStacInfo-_BfonNUG.js +85 -0
  40. package/dist/client/EodashTools-PD3XPYuR.js +103 -0
  41. package/dist/client/ExportState-DOrT7M15.js +644 -0
  42. package/dist/client/Footer-CCigxYBo.js +141 -0
  43. package/dist/client/Header-C2cdx4gb.js +437 -0
  44. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  45. package/dist/client/MobileLayout-BdiFjHg7.js +1207 -0
  46. package/dist/client/PopUp--_xn1Cms.js +410 -0
  47. package/dist/client/VImg-9xu2l99m.js +384 -0
  48. package/dist/client/VMain-BUs3kDTd.js +43 -0
  49. package/dist/client/VOverlay-D89omJis.js +1453 -0
  50. package/dist/client/VTooltip-CDu3bErh.js +86 -0
  51. package/dist/client/WidgetsContainer-aFG9yFT6.js +83 -0
  52. package/dist/client/asWebComponent-BRGyP_j5.js +11943 -0
  53. package/dist/client/{style.css → eo-dash.css} +2 -2
  54. package/dist/client/eo-dash.js +2 -6
  55. package/dist/client/forwardRefs-CYrR6bMw.js +245 -0
  56. package/dist/client/index-BZwk0V42.js +199 -0
  57. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  58. package/dist/client/transition-DG9nRSW4.js +37 -0
  59. package/dist/node/cli.js +4 -4
  60. package/dist/node/types.d.ts +2 -0
  61. package/package.json +73 -38
  62. package/widgets/EodashDatePicker.vue +176 -134
  63. package/widgets/EodashItemFilter.vue +79 -38
  64. package/widgets/EodashLayerControl.vue +111 -0
  65. package/widgets/EodashLayoutSwitcher.vue +36 -0
  66. package/widgets/EodashMap.vue +108 -133
  67. package/widgets/EodashMapBtns.vue +62 -8
  68. package/widgets/EodashProcess.vue +143 -0
  69. package/widgets/EodashStacInfo.vue +82 -0
  70. package/widgets/EodashTools.vue +83 -0
  71. package/widgets/ExportState.vue +17 -13
  72. package/widgets/PopUp.vue +24 -2
  73. package/core/client/SuspensedDashboard.ce.vue +0 -105
  74. package/core/client/asWebComponent.d.ts +0 -23
  75. package/core/client/store/Actions.js +0 -14
  76. package/core/client/store/States.js +0 -16
  77. package/core/client/utils/eodashSTAC.js +0 -249
  78. package/core/client/utils/helpers.js +0 -38
  79. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  80. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  81. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  82. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  83. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  84. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  85. package/dist/client/ExportState-CCzOhppU.js +0 -558
  86. package/dist/client/Footer-BPAND0yG.js +0 -115
  87. package/dist/client/Header-DLhebNvG.js +0 -350
  88. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  89. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  90. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  91. package/dist/client/VImg-DxHcztfM.js +0 -291
  92. package/dist/client/VMain-BLX5vRRn.js +0 -39
  93. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  94. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  95. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  96. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  97. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  98. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  99. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  100. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  101. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  102. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  103. package/dist/client/index-Q-bHLjxx.js +0 -153
  104. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  105. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  106. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  107. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  108. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  109. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  110. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  111. package/dist/client/transition-CSJhuYGK.js +0 -34
  112. package/dist/client/webfontloader-qotgY98I.js +0 -435
  113. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,549 @@
1
+ import { onMounted, onUnmounted, watch, nextTick, toRaw, ref, computed, openBlock, createElementBlock, createElementVNode, unref } from 'vue';
2
+ import '@eox/map';
3
+ import '@eox/map/src/plugins/advancedLayersAndSources';
4
+ import { a6 as registerProjection, a7 as getProjectionCode, a8 as availableMapProjection, a9 as changeMapProjection, aa as eoxLayersKey, $ as useSTAcStore, ab as posIsSetFromUrl, ac as EodashCollection, ad as mapPosition, a3 as mapEl, a2 as mapCompareEl, Z as datetime, a4 as eodashCompareCollections, a0 as eodashCollections } from './asWebComponent-BRGyP_j5.js';
5
+ import { storeToRefs } from 'pinia';
6
+ import log from 'loglevel';
7
+ import { useEventBus } from '@vueuse/core';
8
+
9
+ /*
10
+ * eodashSTAC helpers that utilizes the app states or actions
11
+ */
12
+
13
+ /**
14
+ * checks if there's a projection on the Collection and
15
+ * updates {@link availableMapProjection}
16
+ * @param {import('stac-ts').StacCollection} [STAcCollection]
17
+ */
18
+ const setMapProjFromCol = async (STAcCollection) => {
19
+ // if a projection exists on the collection level
20
+ log.debug("Checking for available map projection in indicator");
21
+ const projection =
22
+ /** @type {number | string | {name: string, def: string} | undefined} */
23
+ (
24
+ STAcCollection?.["eodash:mapProjection"] ||
25
+ STAcCollection?.["proj:epsg"] ||
26
+ STAcCollection?.["eodash:proj4_def"]
27
+ );
28
+ if (projection) {
29
+ log.debug("Projection found", projection);
30
+ await registerProjection(projection);
31
+ const projectionCode = getProjectionCode(projection);
32
+ if (availableMapProjection.value !== projectionCode) {
33
+ log.debug(
34
+ "Changing map projection",
35
+ availableMapProjection.value,
36
+ projectionCode,
37
+ );
38
+ await changeMapProjection(projection);
39
+ }
40
+ // set it for `EodashMapBtns`
41
+ availableMapProjection.value = /** @type {string} */ (projectionCode);
42
+ } else {
43
+ // reset to default projection
44
+ log.debug("Resetting projection to default EPSG:3857");
45
+ await changeMapProjection((availableMapProjection.value = ""));
46
+ }
47
+ };
48
+
49
+ /**
50
+ * Holder for previous compare map view as it is overwritten by sync
51
+ * @type { {map:import("ol").View } | null} mapElement
52
+ */
53
+ let viewHolder = null;
54
+
55
+ /**
56
+ * Handles updating {@link mapPosition} on movement on the map
57
+ *
58
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> & {map:import("ol").Map } | null>} mapElement
59
+ * @param {import("vue").Ref<(number | undefined)[]>} mapPosition
60
+ */
61
+ const useHandleMapMoveEnd = (mapElement, mapPosition) => {
62
+ /** @type {import("openlayers").EventsListenerFunctionType} */
63
+ const handleMoveEnd = (evt) => {
64
+ const map = /** @type {import("openlayers").Map | undefined} */ (
65
+ /** @type {any} */ (evt).map
66
+ );
67
+ const lonlat = mapElement.value?.lonLatCenter;
68
+ const z = map?.getView().getZoom();
69
+ if (
70
+ lonlat &&
71
+ !Number.isNaN(lonlat[0]) &&
72
+ !Number.isNaN(lonlat[1]) &&
73
+ !Number.isNaN(z)
74
+ ) {
75
+ mapPosition.value = [lonlat[0], lonlat[1], z];
76
+ if (posIsSetFromUrl.value) {
77
+ posIsSetFromUrl.value = false;
78
+ }
79
+ }
80
+ };
81
+
82
+ onMounted(() => {
83
+ /** @type {import('ol/Map').default} */
84
+ (mapElement.value?.map)?.on("moveend", handleMoveEnd);
85
+ });
86
+
87
+ onUnmounted(() => {
88
+ /** @type {import('ol/Map').default} */
89
+ (mapElement.value?.map)?.un("moveend", handleMoveEnd);
90
+ });
91
+ };
92
+
93
+ /**
94
+ * Creates full layer configuration from indicator and time information
95
+ * @param {import("stac-ts").StacCatalog
96
+ * | import("stac-ts").StacCollection
97
+ * | import("stac-ts").StacItem
98
+ * | null
99
+ * } selectedIndicator
100
+ * @param {EodashCollection[]} eodashCols
101
+ * @param {string} [updatedTime]
102
+ */
103
+
104
+ const createLayersConfig = async (
105
+ selectedIndicator,
106
+ eodashCols,
107
+ updatedTime,
108
+ ) => {
109
+ log.debug(
110
+ "Creating layers config",
111
+ selectedIndicator,
112
+ eodashCols,
113
+ updatedTime,
114
+ );
115
+ const layersCollection = [];
116
+ const dataLayers = {
117
+ type: "Group",
118
+ properties: {
119
+ id: "AnalysisGroup",
120
+ title: "Data Layers",
121
+ layerControlExpand: true,
122
+ },
123
+ layers: /** @type {Record<string,any>[]}*/ ([]),
124
+ };
125
+
126
+ for (const ec of eodashCols) {
127
+ let layers;
128
+ if (updatedTime) {
129
+ layers = await ec.createLayersJson(new Date(updatedTime));
130
+ } else {
131
+ layers = await ec.createLayersJson();
132
+ }
133
+ // Add expand to all analysis layers
134
+ layers.forEach((dl) => {
135
+ dl.properties.layerControlExpand = true;
136
+ dl.properties.layerControlToolsExpand = true;
137
+ });
138
+ dataLayers.layers.push(...layers);
139
+ }
140
+
141
+ layersCollection.push(dataLayers);
142
+ const indicatorLayers =
143
+ //@ts-expect-error indicator is collection
144
+ await EodashCollection.getIndicatorLayers(selectedIndicator);
145
+ const geodbLayer = EodashCollection.getGeoDBLayer(eodashCols);
146
+ if (geodbLayer) {
147
+ dataLayers.layers.push(geodbLayer);
148
+ }
149
+ const baseLayers = {
150
+ type: "Group",
151
+ properties: {
152
+ id: "BaseLayersGroup",
153
+ title: "Base Layers",
154
+ },
155
+ layers: /** @type {Record<string,any>[]}*/ ([]),
156
+ };
157
+
158
+ const indicatorBaseLayers = indicatorLayers.filter(
159
+ (l) => l.properties.group === "baselayer",
160
+ );
161
+
162
+ if (indicatorBaseLayers.length) {
163
+ // Only one baselayer can be set to visible, let's first set all to
164
+ // false that have not a dedicated property visible, then check
165
+ // if there are more then one visible and only allow one
166
+ let counter = 0;
167
+ let lastPos = 0;
168
+ for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
169
+ const bl = indicatorBaseLayers[indx];
170
+ if (!("visible" in bl.properties)) {
171
+ bl.properties.visible = false;
172
+ }
173
+
174
+ if (bl.properties.visible) {
175
+ counter++;
176
+ lastPos = indx;
177
+ }
178
+ }
179
+
180
+ // if none visible set the last one as visible
181
+ if (counter === 0) {
182
+ indicatorBaseLayers[0].properties.visible = true;
183
+ }
184
+
185
+ // disable all apart from last
186
+ if (counter > 0) {
187
+ indicatorBaseLayers.forEach((bl, indx) => {
188
+ if (indx !== lastPos) {
189
+ bl.properties.visible = false;
190
+ } else {
191
+ bl.properties.visible = true;
192
+ }
193
+ });
194
+ }
195
+
196
+ baseLayers.layers.push(...indicatorBaseLayers);
197
+
198
+ // Add exclusive to baselayers and make sure only one is selected
199
+ baseLayers.layers.forEach((bl) => {
200
+ bl.properties.layerControlExclusive = true;
201
+ });
202
+ } else {
203
+ // Default to some baselayer
204
+ baseLayers.layers.push({
205
+ type: "Tile",
206
+ properties: {
207
+ id: "osm",
208
+ title: "Background",
209
+ layerControlExclusive: true,
210
+ },
211
+ source: {
212
+ type: "OSM",
213
+ },
214
+ });
215
+ }
216
+
217
+ if (baseLayers.layers.length) {
218
+ layersCollection.push(baseLayers);
219
+ }
220
+
221
+ const overlayLayers = {
222
+ type: "Group",
223
+ properties: {
224
+ id: "OverlayGroup",
225
+ title: "Overlay Layers",
226
+ },
227
+ layers: /** @type {Record<string,any>[]}*/ ([]),
228
+ };
229
+
230
+ const indicatorOverlays = indicatorLayers.filter(
231
+ (l) => l.properties.group === "overlay",
232
+ );
233
+
234
+ if (indicatorOverlays.length) {
235
+ overlayLayers.layers.push(...indicatorOverlays);
236
+ layersCollection.unshift(overlayLayers);
237
+ }
238
+
239
+ return layersCollection;
240
+ };
241
+
242
+ /**
243
+ * Initializes the map and updates it based on changes in the selected indicator and datetime,
244
+ *
245
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
246
+ * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
247
+ * @param {EodashCollection[]} eodashCols
248
+ * @param {import("vue").Ref<string>} datetime
249
+ * @param {import("vue").Ref<Record<string,any>[]>} mapLayers
250
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
251
+ */
252
+ const useInitMap = (
253
+ mapElement,
254
+ selectedIndicator,
255
+ eodashCols,
256
+ datetime,
257
+ mapLayers,
258
+ partnerMap,
259
+ ) => {
260
+ log.debug(
261
+ "InitMap",
262
+ mapElement.value,
263
+ selectedIndicator.value,
264
+ eodashCols.values,
265
+ datetime.value,
266
+ );
267
+ const layersEvent = useEventBus(eoxLayersKey);
268
+
269
+ const stopIndicatorWatcher = watch(
270
+ [selectedIndicator, datetime],
271
+ async ([updatedStac, updatedTime], [previousStac, previousTime]) => {
272
+ if (updatedStac) {
273
+ log.debug(
274
+ "Selected Indicator watch triggered",
275
+ updatedStac,
276
+ updatedTime,
277
+ );
278
+
279
+ if (mapElement?.value?.id === "main") {
280
+ // Making sure main map gets the viewer that seems to be
281
+ // removed when the second map is no longer rendered
282
+ if (viewHolder !== null) {
283
+ // Set view to previous compare view
284
+ mapElement?.value?.map.setView(viewHolder);
285
+ viewHolder = null;
286
+ }
287
+ }
288
+ let layersCollection = [];
289
+
290
+ const onlyTimeChanged =
291
+ updatedStac?.id === previousStac?.id && updatedTime !== previousTime;
292
+
293
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
294
+ if (mapElement?.value?.id === "main") {
295
+ // Main map being initialized
296
+ // Set projection based on indicator level information for both maps
297
+ await setMapProjFromCol(updatedStac);
298
+ } else {
299
+ // Compare map being initialized
300
+ if (selectedCompareStac.value !== null) {
301
+ // save view of compare map
302
+ viewHolder = mapElement?.value?.map.getView();
303
+ /** @type {any} */
304
+ (mapElement.value).sync = partnerMap.value;
305
+ }
306
+ }
307
+
308
+ // We re-crate the configuration if time changed
309
+ if (onlyTimeChanged) {
310
+ layersCollection = await createLayersConfig(
311
+ updatedStac,
312
+ eodashCols,
313
+ updatedTime,
314
+ );
315
+ log.debug(
316
+ "Assigned layers after changing time only",
317
+ JSON.parse(JSON.stringify(layersCollection)),
318
+ );
319
+ mapLayers.value = layersCollection;
320
+ await nextTick(() => {
321
+ layersEvent.emit("time:updated", mapLayers.value);
322
+ });
323
+ return;
324
+ }
325
+
326
+ /** @type {Record<string,any>[]} */
327
+ layersCollection = await createLayersConfig(
328
+ updatedStac,
329
+ eodashCols,
330
+ datetime.value,
331
+ );
332
+
333
+ // We try to set the current time selection to latest extent date
334
+ let endInterval = null;
335
+ const interval = updatedStac?.extent?.temporal?.interval;
336
+ if (interval && interval.length > 0 && interval[0].length > 1) {
337
+ // @ts-expect-error this is the defined STAC structure
338
+ endInterval = new Date(interval[0][1]);
339
+ log.debug(
340
+ "Indicator load: found stac extent, setting time to latest value",
341
+ endInterval,
342
+ );
343
+ }
344
+ if (
345
+ endInterval !== null &&
346
+ endInterval.toISOString() !== datetime.value
347
+ ) {
348
+ datetime.value = endInterval.toISOString();
349
+ }
350
+
351
+ // Try to move map view to extent only when main
352
+ // indicator and map changes
353
+ if (
354
+ mapElement?.value?.id === "main" &&
355
+ updatedStac.extent?.spatial.bbox &&
356
+ !posIsSetFromUrl.value
357
+ ) {
358
+ // Sanitize extent,
359
+ const b = updatedStac.extent?.spatial.bbox[0];
360
+ const sanitizedExtent = [
361
+ b?.[0] > -180 ? b?.[0] : -180,
362
+ b?.[1] > -90 ? b?.[1] : -90,
363
+ b?.[2] < 180 ? b?.[2] : 180,
364
+ b?.[3] < 90 ? b?.[3] : 90,
365
+ ];
366
+
367
+ const reprojExtent = mapElement.value?.transformExtent(
368
+ sanitizedExtent,
369
+ "EPSG:4326",
370
+ mapElement.value?.map?.getView().getProjection(),
371
+ );
372
+ /** @type {import("@eox/map").EOxMap} */
373
+ (mapElement.value).zoomExtent = reprojExtent;
374
+ }
375
+ if (posIsSetFromUrl.value) {
376
+ posIsSetFromUrl.value = false;
377
+ }
378
+
379
+ log.debug(
380
+ "Assigned layers",
381
+ JSON.parse(JSON.stringify(layersCollection)),
382
+ );
383
+
384
+ mapLayers.value = layersCollection;
385
+ // Emit event to update layers
386
+ await nextTick(() => {
387
+ mapElement.value?.updateComplete.then(() => {
388
+ layersEvent.emit("layers:updated", mapLayers.value);
389
+ });
390
+ });
391
+ }
392
+ },
393
+ { immediate: true },
394
+ );
395
+
396
+ onUnmounted(() => {
397
+ stopIndicatorWatcher();
398
+ });
399
+ };
400
+
401
+ /**
402
+ * @module ol/easing
403
+ */
404
+
405
+
406
+ /**
407
+ * Start slow, speed up, and then slow down again.
408
+ * @param {number} t Input between 0 and 1.
409
+ * @return {number} Output between 0 and 1.
410
+ * @api
411
+ */
412
+ function inAndOut(t) {
413
+ return 3 * t * t - 2 * t * t * t;
414
+ }
415
+
416
+ const _hoisted_1 = [".enabled"];
417
+ const _hoisted_2 = [".center", ".zoom", ".layers"];
418
+ const _hoisted_3 = [".layers"];
419
+
420
+ const _sfc_main = {
421
+ __name: 'EodashMap',
422
+ props: {
423
+ enableCompare: {
424
+ type: Boolean,
425
+ default: false,
426
+ },
427
+ /** @type {import("vue").PropType<[number,number]>} */
428
+ center: {
429
+ //@ts-expect-error todo
430
+ type: Array,
431
+ default: () => [15, 48],
432
+ },
433
+ zoom: {
434
+ type: Number,
435
+ default: 4,
436
+ },
437
+ },
438
+ setup(__props) {
439
+
440
+ const props = __props;
441
+
442
+ const initialCenter = toRaw([
443
+ mapPosition.value?.[0] ?? props.center?.[0],
444
+ mapPosition.value?.[1] ?? props.center?.[1],
445
+ ]);
446
+ const initialZoom = toRaw(mapPosition.value?.[2] ?? props.zoom);
447
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
448
+ const eoxMapLayers = ref([
449
+ {
450
+ type: "Tile",
451
+ source: { type: "OSM" },
452
+ properties: {
453
+ id: "osm",
454
+ title: "Background",
455
+ },
456
+ },
457
+ ]);
458
+
459
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
460
+ const eoxMapCompareLayers = ref([
461
+ {
462
+ type: "Tile",
463
+ source: { type: "OSM" },
464
+ properties: {
465
+ id: "osm",
466
+ title: "Background",
467
+ },
468
+ },
469
+ ]);
470
+
471
+ const animationOptions = {
472
+ duration: 1200,
473
+ easing: inAndOut,
474
+ };
475
+
476
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
477
+ const eoxMap = ref(null);
478
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
479
+ const compareMap = ref(null);
480
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
481
+ const showCompare = computed(() =>
482
+ props.enableCompare && !!selectedCompareStac.value ? "" : "first",
483
+ );
484
+
485
+ useHandleMapMoveEnd(eoxMap, mapPosition);
486
+
487
+ onMounted(() => {
488
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
489
+ // assign map Element state to eox map
490
+ mapEl.value = eoxMap.value;
491
+
492
+ if (props.enableCompare) {
493
+ mapCompareEl.value = compareMap.value;
494
+ }
495
+
496
+ if (props.enableCompare) {
497
+ useInitMap(
498
+ compareMap,
499
+ //@ts-expect-error todo selectedStac as collection
500
+ selectedCompareStac,
501
+ eodashCompareCollections,
502
+ datetime,
503
+ eoxMapCompareLayers,
504
+ eoxMap,
505
+ );
506
+ }
507
+
508
+ useInitMap(
509
+ eoxMap,
510
+ //@ts-expect-error todo selectedStac as collection
511
+ selectedStac,
512
+ eodashCollections,
513
+ datetime,
514
+ eoxMapLayers,
515
+ compareMap,
516
+ );
517
+ });
518
+
519
+ return (_ctx, _cache) => {
520
+ return (openBlock(), createElementBlock("eox-map-compare", {
521
+ class: "fill-height fill-width overflow-none",
522
+ ".enabled": showCompare.value
523
+ }, [
524
+ createElementVNode("eox-map", {
525
+ class: "fill-height fill-width overflow-none",
526
+ slot: "first",
527
+ ref_key: "eoxMap",
528
+ ref: eoxMap,
529
+ id: "main",
530
+ ".animationOptions": animationOptions,
531
+ ".center": unref(initialCenter),
532
+ ".zoom": unref(initialZoom),
533
+ ".layers": eoxMapLayers.value
534
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2),
535
+ createElementVNode("eox-map", {
536
+ class: "fill-height fill-width overflow-none",
537
+ id: "compare",
538
+ slot: "second",
539
+ ref_key: "compareMap",
540
+ ref: compareMap,
541
+ ".layers": eoxMapCompareLayers.value
542
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3)
543
+ ], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1))
544
+ }
545
+ }
546
+
547
+ };
548
+
549
+ export { _sfc_main as default };
@@ -0,0 +1,107 @@
1
+ import { computed, ref, openBlock, createElementBlock, createBlock, unref, createCommentVNode, createVNode, withCtx } from 'vue';
2
+ import { _ as _export_sfc, t as useDisplay, a1 as makePanelTransparent, V as VBtn, a8 as availableMapProjection, a9 as changeMapProjection, ae as setActiveTemplate } from './asWebComponent-BRGyP_j5.js';
3
+ import { mdiMapPlus, mdiEarthBox, mdiCompare } from '@mdi/js';
4
+ import ExportState from './ExportState-DOrT7M15.js';
5
+ import _sfc_main$1 from './PopUp--_xn1Cms.js';
6
+ import _sfc_main$2 from './EodashItemFilter-16eMMjTV.js';
7
+
8
+ const _sfc_main = {
9
+ __name: 'EodashMapBtns',
10
+ props: {
11
+ exportMap: {
12
+ type: Boolean,
13
+ default: true,
14
+ },
15
+ changeProjection: {
16
+ type: Boolean,
17
+ default: true,
18
+ },
19
+ compareIndicators: {
20
+ type: Boolean,
21
+ default: true,
22
+ },
23
+ },
24
+ setup(__props) {
25
+
26
+
27
+ const { smAndDown } = useDisplay();
28
+ const popupWidth = computed(() => (smAndDown ? "70%" : "500px"));
29
+ const popupHeight = computed(() => (smAndDown ? "90%" : "500px"));
30
+
31
+ const showMapState = ref(false);
32
+ const showCompareIndicators = ref(false);
33
+
34
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
35
+ const rootRef = ref(null);
36
+
37
+ const onSelectCompareIndicator = () => {
38
+ setActiveTemplate("compare");
39
+ showCompareIndicators.value = !showCompareIndicators.value;
40
+ };
41
+
42
+ makePanelTransparent(rootRef);
43
+
44
+ return (_ctx, _cache) => {
45
+
46
+
47
+ return (openBlock(), createElementBlock("div", {
48
+ ref_key: "rootRef",
49
+ ref: rootRef,
50
+ class: "d-flex flex-column align-end justify-end my-3 pa-2"
51
+ }, [
52
+ (__props.exportMap)
53
+ ? (openBlock(), createBlock(VBtn, {
54
+ key: 0,
55
+ class: "map-btn",
56
+ icon: [unref(mdiMapPlus)],
57
+ onClick: _cache[0] || (_cache[0] = $event => (showMapState.value = !showMapState.value))
58
+ }, null, 8 /* PROPS */, ["icon"]))
59
+ : createCommentVNode("v-if", true),
60
+ (__props.exportMap)
61
+ ? (openBlock(), createBlock(ExportState, {
62
+ key: 1,
63
+ modelValue: showMapState.value,
64
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((showMapState).value = $event))
65
+ }, null, 8 /* PROPS */, ["modelValue"]))
66
+ : createCommentVNode("v-if", true),
67
+ (__props.changeProjection && !!unref(availableMapProjection))
68
+ ? (openBlock(), createBlock(VBtn, {
69
+ key: 2,
70
+ class: "map-btn",
71
+ icon: [unref(mdiEarthBox)],
72
+ onClick: _cache[2] || (_cache[2] = $event => (unref(changeMapProjection)(unref(availableMapProjection))))
73
+ }, null, 8 /* PROPS */, ["icon"]))
74
+ : createCommentVNode("v-if", true),
75
+ (__props.compareIndicators)
76
+ ? (openBlock(), createBlock(VBtn, {
77
+ key: 3,
78
+ class: "map-btn",
79
+ icon: [unref(mdiCompare)],
80
+ onClick: _cache[3] || (_cache[3] = $event => (showCompareIndicators.value = !showCompareIndicators.value))
81
+ }, null, 8 /* PROPS */, ["icon"]))
82
+ : createCommentVNode("v-if", true),
83
+ createVNode(_sfc_main$1, {
84
+ modelValue: showCompareIndicators.value,
85
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => ((showCompareIndicators).value = $event)),
86
+ maxWidth: popupWidth.value,
87
+ maxHeight: popupHeight.value
88
+ }, {
89
+ default: withCtx(() => [
90
+ createVNode(_sfc_main$2, {
91
+ enableCompare: true,
92
+ "filters-title": "",
93
+ "results-title": "Select an indicator to compare",
94
+ "filter-properties": [],
95
+ onSelect: onSelectCompareIndicator
96
+ })
97
+ ]),
98
+ _: 1 /* STABLE */
99
+ }, 8 /* PROPS */, ["modelValue", "maxWidth", "maxHeight"])
100
+ ], 512 /* NEED_PATCH */))
101
+ }
102
+ }
103
+
104
+ };
105
+ const EodashMapBtns = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-37c140ec"]]);
106
+
107
+ export { EodashMapBtns as default };