@eodash/eodash 5.0.0-rc.1.5 → 5.0.0-rc.2

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 (62) hide show
  1. package/README.md +1 -1
  2. package/core/client/composables/EodashMap.js +47 -28
  3. package/core/client/composables/EodashProcess.js +51 -5
  4. package/core/client/composables/index.js +8 -1
  5. package/core/client/eodash.js +21 -7
  6. package/core/client/eodashSTAC/EodashCollection.js +24 -4
  7. package/core/client/eodashSTAC/createLayers.js +62 -6
  8. package/core/client/eodashSTAC/helpers.js +48 -5
  9. package/core/client/eodashSTAC/triggers.js +52 -1
  10. package/core/client/store/stac.js +7 -2
  11. package/core/client/types.ts +10 -1
  12. package/core/client/utils/index.js +12 -0
  13. package/core/client/utils/states.js +18 -1
  14. package/core/client/views/Dashboard.vue +3 -1
  15. package/dist/client/{DashboardLayout-B-4X57-t.js → DashboardLayout-VrJIbhe8.js} +2 -2
  16. package/dist/client/{DynamicWebComponent-Dj3QYwag.js → DynamicWebComponent-BCwpocDX.js} +1 -1
  17. package/dist/client/EodashDatePicker-Bp5ec3BC.js +430 -0
  18. package/dist/client/{EodashItemFilter-DBQwJQPh.js → EodashItemFilter-Cx0t-qeW.js} +1 -1
  19. package/dist/client/{EodashLayerControl-C5fOCvoI.js → EodashLayerControl-DERx00In.js} +10 -2
  20. package/dist/client/{EodashLayoutSwitcher-BMO9k_20.js → EodashLayoutSwitcher-DTS7otlk.js} +2 -2
  21. package/dist/client/{EodashMap-D2bnMLAC.js → EodashMap-C-I6puhb.js} +101 -73
  22. package/dist/client/{EodashMapBtns-l9B977id.js → EodashMapBtns-CWgtJiG4.js} +4 -4
  23. package/dist/client/{EodashProcess-BtIlJvF1.js → EodashProcess-DWrTIyHT.js} +188 -33
  24. package/dist/client/{EodashStacInfo-CPVvp_Hm.js → EodashStacInfo-Dvsk97Mz.js} +1 -1
  25. package/dist/client/{EodashTools-DY2dlNXW.js → EodashTools-CdnjgTTl.js} +4 -4
  26. package/dist/client/{ExportState-BvD5A0XG.js → ExportState-S4lcehm3.js} +4 -4
  27. package/dist/client/{Footer-w95gBnSH.js → Footer-DlIEbXp-.js} +1 -1
  28. package/dist/client/{Header-BpiorKy9.js → Header-CTiEXLi0.js} +3 -3
  29. package/dist/client/{MobileLayout-CmVlZe7S.js → MobileLayout-DRgyQYFz.js} +17 -7
  30. package/dist/client/{PopUp-CREaSybs.js → PopUp-CzqV8BFZ.js} +3 -3
  31. package/dist/client/{VImg-DF9esgdd.js → VImg-Bn8bCvVM.js} +2 -2
  32. package/dist/client/{VMain-BWLMf-rn.js → VMain-2GOqWb6m.js} +1 -1
  33. package/dist/client/{VOverlay-DmNfblmy.js → VOverlay-BetC0LGI.js} +3 -3
  34. package/dist/client/{VTooltip-C3PeE7iO.js → VTooltip-BWg0dxx5.js} +3 -3
  35. package/dist/client/{WidgetsContainer-6FHEEXns.js → WidgetsContainer-Cv466WUW.js} +1 -1
  36. package/dist/client/{asWebComponent-BnFMd0T6.js → asWebComponent-CLUhauLl.js} +422 -164
  37. package/dist/client/eo-dash.css +1 -1
  38. package/dist/client/eo-dash.js +1 -1
  39. package/dist/client/{forwardRefs-BF3Me2RX.js → forwardRefs-CxSsJulB.js} +1 -1
  40. package/dist/client/{index-CRd5-RSy.js → index-BMj56LY3.js} +1 -1
  41. package/dist/client/{transition-Cpn_g5jE.js → transition-DidoPMgC.js} +1 -1
  42. package/dist/node/cli.js +2 -2
  43. package/dist/types/core/client/composables/EodashMap.d.ts +2 -1
  44. package/dist/types/core/client/composables/EodashProcess.d.ts +17 -11
  45. package/dist/types/core/client/composables/index.d.ts +1 -1
  46. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +11 -4
  47. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +6 -6
  48. package/dist/types/core/client/eodashSTAC/helpers.d.ts +77 -20
  49. package/dist/types/core/client/eodashSTAC/triggers.d.ts +6 -0
  50. package/dist/types/core/client/types.d.ts +13 -1
  51. package/dist/types/core/client/utils/index.d.ts +1 -0
  52. package/dist/types/core/client/utils/states.d.ts +9 -0
  53. package/dist/types/widgets/EodashDatePicker.vue.d.ts +459 -2
  54. package/dist/types/widgets/EodashMap.vue.d.ts +2 -0
  55. package/dist/types/widgets/EodashProcess.vue.d.ts +1 -0
  56. package/dist/types/widgets/PopUp.vue.d.ts +1 -2
  57. package/package.json +24 -24
  58. package/widgets/EodashDatePicker.vue +139 -22
  59. package/widgets/EodashLayerControl.vue +13 -1
  60. package/widgets/EodashMap.vue +63 -5
  61. package/widgets/EodashProcess.vue +82 -22
  62. package/dist/client/EodashDatePicker-DGRJrJ0s.js +0 -306
@@ -1,54 +1,15 @@
1
- import { onMounted, onUnmounted, watch, nextTick, toRaw, ref, computed, openBlock, createElementBlock, createElementVNode, unref } from 'vue';
1
+ import { onMounted, onUnmounted, watch, nextTick, ref, toRaw, computed, openBlock, createElementBlock, createElementVNode, unref, normalizeStyle } from 'vue';
2
2
  import '@eox/map';
3
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-BnFMd0T6.js';
4
+ import { a8 as eoxLayersKey, $ as useSTAcStore, a9 as setMapProjFromCol, aa as posIsSetFromUrl, ab as useOnLayersUpdate, ac as EodashCollection, ad as mapPosition, a4 as mapEl, a3 as mapCompareEl, Z as datetime, a0 as eodashCollections, a5 as eodashCompareCollections, a6 as layerControlFormValue } from './asWebComponent-CLUhauLl.js';
5
5
  import { storeToRefs } from 'pinia';
6
6
  import log from 'loglevel';
7
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
- };
8
+ import mustache from 'mustache';
48
9
 
49
10
  /**
50
11
  * Holder for previous compare map view as it is overwritten by sync
51
- * @type { {map:import("ol").View } | null} mapElement
12
+ * @type { import("ol").View | null} mapElement
52
13
  */
53
14
  let viewHolder = null;
54
15
 
@@ -242,12 +203,13 @@ const createLayersConfig = async (
242
203
  /**
243
204
  * Initializes the map and updates it based on changes in the selected indicator and datetime,
244
205
  *
245
- * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
206
+ * @param {import("vue").Ref<import("@eox/map").EOxMap| null>} mapElement
246
207
  * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
247
208
  * @param {EodashCollection[]} eodashCols
248
209
  * @param {import("vue").Ref<string>} datetime
249
210
  * @param {import("vue").Ref<Record<string,any>[]>} mapLayers
250
- * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
211
+ * @param {import("vue").Ref<import("@eox/map").EOxMap| null>} partnerMap
212
+ * @param {boolean} zoomToExtent
251
213
  */
252
214
  const useInitMap = (
253
215
  mapElement,
@@ -256,6 +218,7 @@ const useInitMap = (
256
218
  datetime,
257
219
  mapLayers,
258
220
  partnerMap,
221
+ zoomToExtent,
259
222
  ) => {
260
223
  log.debug(
261
224
  "InitMap",
@@ -299,7 +262,7 @@ const useInitMap = (
299
262
  // Compare map being initialized
300
263
  if (selectedCompareStac.value !== null) {
301
264
  // save view of compare map
302
- viewHolder = mapElement?.value?.map.getView();
265
+ viewHolder = mapElement?.value?.map.getView() ?? null;
303
266
  /** @type {any} */
304
267
  (mapElement.value).sync = partnerMap.value;
305
268
  }
@@ -348,29 +311,31 @@ const useInitMap = (
348
311
  datetime.value = endInterval.toISOString();
349
312
  }
350
313
 
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;
314
+ if (zoomToExtent) {
315
+ // Try to move map view to extent only when main
316
+ // indicator and map changes
317
+ if (
318
+ mapElement?.value?.id === "main" &&
319
+ updatedStac.extent?.spatial.bbox &&
320
+ !posIsSetFromUrl.value
321
+ ) {
322
+ // Sanitize extent,
323
+ const b = updatedStac.extent?.spatial.bbox[0];
324
+ const sanitizedExtent = [
325
+ b?.[0] > -180 ? b?.[0] : -180,
326
+ b?.[1] > -90 ? b?.[1] : -90,
327
+ b?.[2] < 180 ? b?.[2] : 180,
328
+ b?.[3] < 90 ? b?.[3] : 90,
329
+ ];
330
+
331
+ const reprojExtent = mapElement.value?.transformExtent(
332
+ sanitizedExtent,
333
+ "EPSG:4326",
334
+ mapElement.value?.map?.getView().getProjection(),
335
+ );
336
+ /** @type {import("@eox/map").EOxMap} */
337
+ (mapElement.value).zoomExtent = reprojExtent;
338
+ }
374
339
  }
375
340
  if (posIsSetFromUrl.value) {
376
341
  posIsSetFromUrl.value = false;
@@ -380,7 +345,6 @@ const useInitMap = (
380
345
  "Assigned layers",
381
346
  JSON.parse(JSON.stringify(layersCollection)),
382
347
  );
383
-
384
348
  mapLayers.value = layersCollection;
385
349
  // Emit event to update layers
386
350
  await nextTick(() => {
@@ -397,6 +361,21 @@ const useInitMap = (
397
361
  stopIndicatorWatcher();
398
362
  });
399
363
  };
364
+ /**
365
+ *
366
+ * @param {EodashCollection[]} eodashCols
367
+ * @param {import("vue").Ref<Exclude<import("@/types").EodashStyleJson["tooltip"],undefined>>} tooltipProperties
368
+ */
369
+ const useUpdateTooltipProperties = (eodashCols, tooltipProperties) => {
370
+ useOnLayersUpdate(async () => {
371
+ const tooltips = [];
372
+ for (const ec of eodashCols) {
373
+ tooltips.push(...(await ec.getToolTipProperties()));
374
+ }
375
+ tooltipProperties.value = tooltips;
376
+ log.debug("Updated tooltip properties", tooltipProperties.value);
377
+ });
378
+ };
400
379
 
401
380
  /**
402
381
  * @module ol/easing
@@ -417,6 +396,7 @@ const _hoisted_1 = [".enabled"];
417
396
  const _hoisted_2 = [".center", ".zoom", ".layers"];
418
397
  const _hoisted_3 = [".layers"];
419
398
 
399
+
420
400
  const _sfc_main = {
421
401
  __name: 'EodashMap',
422
402
  props: {
@@ -434,11 +414,18 @@ const _sfc_main = {
434
414
  type: Number,
435
415
  default: 4,
436
416
  },
417
+ zoomToExtent: {
418
+ type: Boolean,
419
+ default: true,
420
+ },
437
421
  },
438
422
  setup(__props) {
439
423
 
440
424
  const props = __props;
441
425
 
426
+ /** @type {import("vue").Ref<Exclude<import("@/types").EodashStyleJson["tooltip"], undefined>>} */
427
+ const tooltipProperties = ref([]);
428
+
442
429
  const initialCenter = toRaw([
443
430
  mapPosition.value?.[0] ?? props.center?.[0],
444
431
  mapPosition.value?.[1] ?? props.center?.[1],
@@ -473,9 +460,9 @@ const animationOptions = {
473
460
  easing: inAndOut,
474
461
  };
475
462
 
476
- /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
463
+ /** @type {import("vue").Ref<import("@eox/map").EOxMap | null>} */
477
464
  const eoxMap = ref(null);
478
- /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
465
+ /** @type {import("vue").Ref<import("@eox/map").EOxMap | null>} */
479
466
  const compareMap = ref(null);
480
467
  const { selectedCompareStac } = storeToRefs(useSTAcStore());
481
468
  const showCompare = computed(() =>
@@ -502,6 +489,7 @@ onMounted(() => {
502
489
  datetime,
503
490
  eoxMapCompareLayers,
504
491
  eoxMap,
492
+ false,
505
493
  );
506
494
  }
507
495
 
@@ -513,9 +501,44 @@ onMounted(() => {
513
501
  datetime,
514
502
  eoxMapLayers,
515
503
  compareMap,
504
+ props.zoomToExtent,
516
505
  );
517
506
  });
518
507
 
508
+ useUpdateTooltipProperties(eodashCollections, tooltipProperties);
509
+
510
+ const tooltipStyles = computed(() => ({
511
+ visibility: tooltipProperties.value.length ? "visible" : "hidden",
512
+ }));
513
+ /**
514
+ * @param {{key:string; value:string}} param
515
+ * @returns {{key:string; value?:string} | undefined}
516
+ */
517
+ const tooltipPropertyTransform = (param) => {
518
+ /** @type {typeof tooltipProperties.value} */
519
+ const updatedProperties = JSON.parse(
520
+ mustache.render(JSON.stringify(tooltipProperties.value), {
521
+ ...(layerControlFormValue.value ?? {}),
522
+ }),
523
+ );
524
+
525
+ const tooltipProp = updatedProperties?.find((prop) => prop.id === param.key);
526
+ if (!tooltipProp) {
527
+ return undefined;
528
+ }
529
+ if (typeof param.value === "object") {
530
+ param.value = JSON.stringify(param.value);
531
+ }
532
+ if (!isNaN(Number(param.value))) {
533
+ param.value = Number(param.value).toFixed(4).toString();
534
+ }
535
+
536
+ return {
537
+ key: tooltipProp.title || tooltipProp.id,
538
+ value: param.value + " " + (tooltipProp.appendix || ""),
539
+ };
540
+ };
541
+
519
542
  return (_ctx, _cache) => {
520
543
  return (openBlock(), createElementBlock("eox-map-compare", {
521
544
  class: "fill-height fill-width overflow-none",
@@ -531,7 +554,12 @@ return (_ctx, _cache) => {
531
554
  ".center": unref(initialCenter),
532
555
  ".zoom": unref(initialZoom),
533
556
  ".layers": eoxMapLayers.value
534
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2),
557
+ }, [
558
+ createElementVNode("eox-map-tooltip", {
559
+ style: normalizeStyle(tooltipStyles.value),
560
+ ".propertyTransform": tooltipPropertyTransform
561
+ }, null, 36 /* STYLE, NEED_HYDRATION */)
562
+ ], 40 /* PROPS, NEED_HYDRATION */, _hoisted_2),
535
563
  createElementVNode("eox-map", {
536
564
  class: "fill-height fill-width overflow-none",
537
565
  id: "compare",
@@ -1,9 +1,9 @@
1
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-BnFMd0T6.js';
2
+ import { _ as _export_sfc, t as useDisplay, a2 as makePanelTransparent, V as VBtn, ae as availableMapProjection, af as changeMapProjection, ag as setActiveTemplate } from './asWebComponent-CLUhauLl.js';
3
3
  import { mdiMapPlus, mdiEarthBox, mdiCompare } from '@mdi/js';
4
- import ExportState from './ExportState-BvD5A0XG.js';
5
- import _sfc_main$1 from './PopUp-CREaSybs.js';
6
- import _sfc_main$2 from './EodashItemFilter-DBQwJQPh.js';
4
+ import ExportState from './ExportState-S4lcehm3.js';
5
+ import _sfc_main$1 from './PopUp-CzqV8BFZ.js';
6
+ import _sfc_main$2 from './EodashItemFilter-Cx0t-qeW.js';
7
7
 
8
8
  const _sfc_main = {
9
9
  __name: 'EodashMapBtns',