@eodash/eodash 5.0.0-alpha.2.26 → 5.0.0-alpha.2.27

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 (108) hide show
  1. package/core/client/asWebComponent.js +2 -3
  2. package/core/client/components/DashboardLayout.vue +35 -13
  3. package/core/client/components/Loading.vue +6 -9
  4. package/core/client/components/MobileLayout.vue +16 -14
  5. package/core/client/composables/DefineEodash.js +13 -3
  6. package/core/client/composables/DefineTemplate.js +67 -0
  7. package/core/client/composables/DefineWidgets.js +3 -2
  8. package/core/client/composables/EodashMap.js +39 -14
  9. package/core/client/composables/EodashProcess.js +574 -0
  10. package/core/client/composables/index.js +54 -11
  11. package/core/client/eodash.js +383 -125
  12. package/core/client/{utils/eodashSTAC.js → eodashSTAC/EodashCollection.js} +75 -41
  13. package/core/client/{utils → eodashSTAC}/createLayers.js +10 -8
  14. package/core/client/{utils → eodashSTAC}/helpers.js +47 -75
  15. package/core/client/eodashSTAC/triggers.js +43 -0
  16. package/core/client/plugins/vuetify.js +2 -1
  17. package/core/client/store/{Actions.js → actions.js} +16 -2
  18. package/core/client/store/index.js +4 -18
  19. package/core/client/store/stac.js +4 -4
  20. package/core/client/store/{States.js → states.js} +2 -0
  21. package/{dist/types/core/client/types.d.ts → core/client/types.ts} +47 -8
  22. package/core/client/utils/keys.js +2 -0
  23. package/core/client/utils/states.js +8 -3
  24. package/core/client/views/Dashboard.vue +6 -4
  25. package/core/client/vite-env.d.ts +1 -16
  26. package/dist/client/{DashboardLayout-E_JzgCH5.js → DashboardLayout-232tRmjz.js} +23 -25
  27. package/dist/client/{DynamicWebComponent-C9pVUfT3.js → DynamicWebComponent-Cl4LqHU6.js} +1 -1
  28. package/dist/client/{EodashDatePicker-CjU8R2ia.js → EodashDatePicker-Pok6bZwU.js} +78 -165
  29. package/dist/client/EodashItemFilter-16eMMjTV.js +151 -0
  30. package/dist/client/{EodashLayerControl-mKfwru42.js → EodashLayerControl-De7IlCm_.js} +19 -11
  31. package/dist/client/EodashLayoutSwitcher-C-3-jjn5.js +52 -0
  32. package/dist/client/{EodashMap-BpwL82-w.js → EodashMap-CMvbfI6-.js} +116 -39
  33. package/dist/client/EodashMapBtns-BeknGDtc.js +107 -0
  34. package/dist/client/EodashProcess-BwKAa9Ee.js +1476 -0
  35. package/dist/client/EodashStacInfo-_BfonNUG.js +85 -0
  36. package/dist/client/EodashTools-PD3XPYuR.js +103 -0
  37. package/dist/client/{ExportState-ByVuIAQb.js → ExportState-DOrT7M15.js} +5 -5
  38. package/dist/client/{Footer-D691KLtK.js → Footer-CCigxYBo.js} +1 -1
  39. package/dist/client/{Header-B8UBQstf.js → Header-C2cdx4gb.js} +3 -3
  40. package/dist/client/{MobileLayout-6bHjYguI.js → MobileLayout-BdiFjHg7.js} +28 -31
  41. package/dist/client/{PopUp-CdFcnKMY.js → PopUp--_xn1Cms.js} +37 -9
  42. package/dist/client/{VImg-fKGJ7xyb.js → VImg-9xu2l99m.js} +2 -2
  43. package/dist/client/{VMain-Hf5R6yWY.js → VMain-BUs3kDTd.js} +1 -1
  44. package/dist/client/{VOverlay-ClFjEtlD.js → VOverlay-D89omJis.js} +3 -3
  45. package/dist/client/VTooltip-CDu3bErh.js +86 -0
  46. package/dist/client/{WidgetsContainer-XXYJfaPR.js → WidgetsContainer-aFG9yFT6.js} +1 -1
  47. package/dist/client/{asWebComponent-BsbKnhGV.js → asWebComponent-BRGyP_j5.js} +1495 -1142
  48. package/dist/client/{style.css → eo-dash.css} +2 -2
  49. package/dist/client/eo-dash.js +1 -1
  50. package/dist/client/{forwardRefs-I2EA3z3_.js → forwardRefs-CYrR6bMw.js} +1 -1
  51. package/dist/client/{index-B3dnMr8a.js → index-BZwk0V42.js} +1 -1
  52. package/dist/client/{transition-DJ9gfiuP.js → transition-DG9nRSW4.js} +1 -1
  53. package/dist/node/cli.js +3 -3
  54. package/package.json +56 -34
  55. package/widgets/EodashDatePicker.vue +68 -54
  56. package/widgets/EodashItemFilter.vue +60 -105
  57. package/widgets/EodashLayerControl.vue +19 -8
  58. package/widgets/EodashLayoutSwitcher.vue +36 -0
  59. package/widgets/EodashMap.vue +27 -28
  60. package/widgets/EodashMapBtns.vue +41 -4
  61. package/widgets/EodashProcess.vue +143 -0
  62. package/widgets/EodashStacInfo.vue +82 -0
  63. package/widgets/EodashTools.vue +83 -0
  64. package/widgets/ExportState.vue +3 -3
  65. package/widgets/PopUp.vue +24 -2
  66. package/core/client/asWebComponent.d.ts +0 -23
  67. package/core/client/types.d.ts +0 -279
  68. package/dist/client/EodashItemFilter-VGQasaBJ.js +0 -194
  69. package/dist/client/EodashMapBtns-GNNBdBW9.js +0 -66
  70. package/dist/types/core/client/App.vue.d.ts +0 -7
  71. package/dist/types/core/client/asWebComponent.d.ts +0 -9
  72. package/dist/types/core/client/components/DashboardLayout.vue.d.ts +0 -2
  73. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +0 -18
  74. package/dist/types/core/client/components/ErrorAlert.vue.d.ts +0 -2
  75. package/dist/types/core/client/components/Footer.vue.d.ts +0 -2
  76. package/dist/types/core/client/components/Header.vue.d.ts +0 -2
  77. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +0 -7
  78. package/dist/types/core/client/components/Loading.vue.d.ts +0 -2
  79. package/dist/types/core/client/components/MobileLayout.vue.d.ts +0 -2
  80. package/dist/types/core/client/composables/DefineEodash.d.ts +0 -2
  81. package/dist/types/core/client/composables/DefineWidgets.d.ts +0 -14
  82. package/dist/types/core/client/composables/EodashMap.d.ts +0 -5
  83. package/dist/types/core/client/composables/index.d.ts +0 -29
  84. package/dist/types/core/client/eodash.d.ts +0 -8
  85. package/dist/types/core/client/main.d.ts +0 -2
  86. package/dist/types/core/client/plugins/axios.d.ts +0 -2
  87. package/dist/types/core/client/plugins/index.d.ts +0 -3
  88. package/dist/types/core/client/plugins/vuetify.d.ts +0 -82
  89. package/dist/types/core/client/render.d.ts +0 -1
  90. package/dist/types/core/client/store/Actions.d.ts +0 -11
  91. package/dist/types/core/client/store/States.d.ts +0 -21
  92. package/dist/types/core/client/store/index.d.ts +0 -2
  93. package/dist/types/core/client/store/stac.d.ts +0 -25
  94. package/dist/types/core/client/utils/createLayers.d.ts +0 -45
  95. package/dist/types/core/client/utils/eodashSTAC.d.ts +0 -82
  96. package/dist/types/core/client/utils/helpers.d.ts +0 -84
  97. package/dist/types/core/client/utils/index.d.ts +0 -2
  98. package/dist/types/core/client/utils/keys.d.ts +0 -6
  99. package/dist/types/core/client/utils/states.d.ts +0 -14
  100. package/dist/types/core/client/views/Dashboard.vue.d.ts +0 -9
  101. package/dist/types/widgets/EodashDatePicker.vue.d.ts +0 -7
  102. package/dist/types/widgets/EodashItemFilter.vue.d.ts +0 -33
  103. package/dist/types/widgets/EodashLayerControl.vue.d.ts +0 -7
  104. package/dist/types/widgets/EodashMap.vue.d.ts +0 -7
  105. package/dist/types/widgets/EodashMapBtns.vue.d.ts +0 -9
  106. package/dist/types/widgets/ExportState.vue.d.ts +0 -7
  107. package/dist/types/widgets/PopUp.vue.d.ts +0 -14
  108. package/dist/types/widgets/WidgetsContainer.vue.d.ts +0 -7
@@ -0,0 +1,151 @@
1
+ import { computed, ref, openBlock, createElementBlock, mergeProps, unref, createElementVNode, toDisplayString } from 'vue';
2
+ import { t as useDisplay, $ as useSTAcStore } from './asWebComponent-BRGyP_j5.js';
3
+ import '@eox/itemfilter';
4
+
5
+ const _hoisted_1 = [".items"];
6
+ const _hoisted_2 = {
7
+ slot: "filterstitle",
8
+ style: {"margin":"14px 8px"}
9
+ };
10
+ const _hoisted_3 = {
11
+ slot: "resultstitle",
12
+ style: {"margin":"14px 8px"}
13
+ };
14
+
15
+
16
+ const _sfc_main = {
17
+ __name: 'EodashItemFilter',
18
+ props: {
19
+ enableCompare: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
23
+ filtersTitle: {
24
+ type: String,
25
+ default: "Indicators",
26
+ },
27
+ resultsTitle: {
28
+ type: String,
29
+ default: "Results",
30
+ },
31
+ titleProperty: {
32
+ type: String,
33
+ default: "title",
34
+ },
35
+ aggregateResults: {
36
+ type: String,
37
+ default: undefined,
38
+ },
39
+ imageProperty: {
40
+ type: String,
41
+ default: "",
42
+ },
43
+ subTitleProperty: {
44
+ type: String,
45
+ default: "",
46
+ },
47
+ resultType: {
48
+ type: String,
49
+ default: "",
50
+ },
51
+ cssVars: {
52
+ type: [String, Object],
53
+ default: "",
54
+ },
55
+ enableHighlighting: { type: Boolean, default: true },
56
+ expandMultipleFilters: { type: Boolean, default: true },
57
+ expandMultipleResults: { type: Boolean, default: true },
58
+ filterProperties: {
59
+ /** @type {import("vue").PropType<{
60
+ * keys:string[];
61
+ * title:string;
62
+ * type:string;
63
+ * expanded?:boolean
64
+ * }[]> }*/
65
+ type: Array,
66
+ default: () => [
67
+ {
68
+ keys: ["title", "themes", "description"],
69
+ title: "Search",
70
+ type: "text",
71
+ },
72
+ {
73
+ key: "themes",
74
+ title: "Theme Filter",
75
+ type: "multiselect",
76
+ },
77
+ ],
78
+ },
79
+ },
80
+ emits: ["select"],
81
+ setup(__props, { emit: __emit }) {
82
+
83
+ const emit = __emit;
84
+
85
+ const props = __props;
86
+ /**
87
+ * @param {import("stac-ts").StacLink} item
88
+ */
89
+ const selectIndicator = async (item) => {
90
+ if (item) {
91
+ // Reset compare stac to empty
92
+ store.resetSelectedCompareSTAC();
93
+ await store.loadSelectedSTAC(item.href);
94
+ emit("select", item);
95
+ } else {
96
+ store.selectedStac = null;
97
+ }
98
+ };
99
+ /**
100
+ * @param {import("stac-ts").StacLink} item
101
+ */
102
+ const selectCompareIndicator = (item) => {
103
+ if (item) {
104
+ store.loadSelectedCompareSTAC(item.href);
105
+ emit("select", item);
106
+ }
107
+ };
108
+ /** @param {any} evt*/
109
+ const onSelect = async (evt) => {
110
+ const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
111
+ if (props.enableCompare) {
112
+ selectCompareIndicator(item);
113
+ } else {
114
+ selectIndicator(item);
115
+ }
116
+ };
117
+ const { smAndDown } = useDisplay();
118
+ const config = computed(() => ({
119
+ titleProperty: props.titleProperty,
120
+ enableHighlighting: props.enableHighlighting,
121
+ expandMultipleFilters: props.expandMultipleFilters,
122
+ expandMultipleResults: props.expandMultipleResults,
123
+ subTitleProperty: props.subTitleProperty,
124
+ resultType: props.resultType,
125
+ imageProperty: props.imageProperty,
126
+ aggregateResults: props.aggregateResults,
127
+ style: props.cssVars,
128
+ filterProperties: smAndDown.value ? "" : props.filterProperties,
129
+ }));
130
+ /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
131
+ const eoxItemFilter = ref(null);
132
+
133
+ const store = useSTAcStore();
134
+
135
+ return (_ctx, _cache) => {
136
+ return (openBlock(), createElementBlock("eox-itemfilter", mergeProps({ class: "fill-height" }, config.value, {
137
+ ref_key: "eoxItemFilter",
138
+ ref: eoxItemFilter,
139
+ style: {"overflow":"auto","--background-color":"none"},
140
+ onSelect: onSelect,
141
+ ".items": unref(store).stac?.filter((item) => item.rel === "child")
142
+ }), [
143
+ createElementVNode("h4", _hoisted_2, toDisplayString(__props.filtersTitle), 1 /* TEXT */),
144
+ createElementVNode("h4", _hoisted_3, toDisplayString(__props.resultsTitle), 1 /* TEXT */)
145
+ ], 48 /* FULL_PROPS, NEED_HYDRATION */, _hoisted_1))
146
+ }
147
+ }
148
+
149
+ };
150
+
151
+ export { _sfc_main as default };
@@ -1,9 +1,9 @@
1
- import { computed, ref, openBlock, createElementBlock, unref, createCommentVNode } from 'vue';
1
+ import { computed, ref, openBlock, createElementBlock, mergeProps, unref, createCommentVNode } from 'vue';
2
2
  import '@eox/layercontrol';
3
3
  import '@eox/jsonform';
4
4
  import '@eox/timecontrol';
5
5
  import 'color-legend-element';
6
- import { $ as useSTAcStore, a2 as mapCompareEl, a3 as mapEl, a4 as eodashCompareCollections, a0 as eodashCollections, a5 as getColFromLayer } from './asWebComponent-BsbKnhGV.js';
6
+ import { $ as useSTAcStore, a2 as mapCompareEl, a3 as mapEl, a4 as eodashCompareCollections, a0 as eodashCollections, a5 as getColFromLayer } from './asWebComponent-BRGyP_j5.js';
7
7
  import { storeToRefs } from 'pinia';
8
8
 
9
9
  const _hoisted_1 = { class: "d-flex flex-column fill-height overflow-auto" };
@@ -17,20 +17,29 @@ const _sfc_main = {
17
17
  type: String,
18
18
  default: "first",
19
19
  },
20
+ tools: {
21
+ type: Array,
22
+ default: () => ["datetime", "info", "config", "legend", "opacity"],
23
+ },
24
+ cssVars: {
25
+ type: Object,
26
+ },
20
27
  },
21
28
  setup(__props) {
22
29
 
23
30
  const props = __props;
24
31
 
32
+ const config = {
33
+ tools: props.tools,
34
+ style: props.cssVars,
35
+ };
36
+
37
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
25
38
  const showControls = computed(() => {
26
- const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
27
39
  if (props.map === "second") {
28
40
  return mapCompareEl.value !== null && selectedCompareStac.value !== null;
29
41
  }
30
- if (mapEl.value !== null && selectedStac.value !== null) {
31
- return true;
32
- }
33
- return false;
42
+ return mapEl.value !== null && selectedStac.value !== null;
34
43
  });
35
44
 
36
45
  const eodashCols =
@@ -92,16 +101,15 @@ const debouncedHandleDateTime = (evt) => {
92
101
  return (_ctx, _cache) => {
93
102
  return (openBlock(), createElementBlock("span", _hoisted_1, [
94
103
  (showControls.value)
95
- ? (openBlock(), createElementBlock("eox-layercontrol", {
96
- key: 0,
104
+ ? (openBlock(), createElementBlock("eox-layercontrol", mergeProps({ key: 0 }, config, {
97
105
  for: unref(mapElement),
98
- ".tools": ['datetime', 'info', 'config', 'legend', 'opacity'],
99
106
  "onDatetime:updated": debouncedHandleDateTime,
100
107
  class: "fill-height",
101
108
  toolsAsList: "true",
109
+ style: {"--eox-background-color":"transparent"},
102
110
  ref_key: "eoxLayercontrol",
103
111
  ref: eoxLayercontrol
104
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2))
112
+ }), null, 16 /* FULL_PROPS */, _hoisted_2))
105
113
  : createCommentVNode("v-if", true)
106
114
  ]))
107
115
  }
@@ -0,0 +1,52 @@
1
+ import { ref, openBlock, createElementBlock, createVNode, withCtx, mergeProps } from 'vue';
2
+ import { a1 as makePanelTransparent, y as VIcon, ak as activeTemplate } from './asWebComponent-BRGyP_j5.js';
3
+ import { mdiViewDashboard } from '@mdi/js';
4
+ import { V as VTooltip } from './VTooltip-CDu3bErh.js';
5
+
6
+ const _sfc_main = {
7
+ __name: 'EodashLayoutSwitcher',
8
+ props: {
9
+ target: {
10
+ type: String,
11
+ default: "main",
12
+ },
13
+ // mdi/js icon
14
+ icon: {
15
+ type: String,
16
+ default: mdiViewDashboard,
17
+ },
18
+ },
19
+ setup(__props) {
20
+
21
+
22
+
23
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
24
+ const rootRef = ref(null);
25
+ makePanelTransparent(rootRef);
26
+
27
+ return (_ctx, _cache) => {
28
+
29
+
30
+
31
+ return (openBlock(), createElementBlock("div", {
32
+ ref_key: "rootRef",
33
+ ref: rootRef
34
+ }, [
35
+ createVNode(VTooltip, {
36
+ text: `Switch to ${__props.target} mode`
37
+ }, {
38
+ activator: withCtx(({ props }) => [
39
+ createVNode(VIcon, mergeProps(props, {
40
+ onClick: _cache[0] || (_cache[0] = $event => (activeTemplate.value = __props.target)),
41
+ icon: [__props.icon]
42
+ }), null, 16 /* FULL_PROPS */, ["icon"])
43
+ ]),
44
+ _: 1 /* STABLE */
45
+ }, 8 /* PROPS */, ["text"])
46
+ ], 512 /* NEED_PATCH */))
47
+ }
48
+ }
49
+
50
+ };
51
+
52
+ export { _sfc_main as default };
@@ -1,9 +1,50 @@
1
- import { onMounted, onUnmounted, watch, ref, computed, openBlock, createElementBlock, createElementVNode } from 'vue';
1
+ import { onMounted, onUnmounted, watch, nextTick, toRaw, ref, computed, openBlock, createElementBlock, createElementVNode, unref } from 'vue';
2
2
  import '@eox/map';
3
- import '@eox/map/dist/eox-map-advanced-layers-and-sources.js';
4
- import { $ as useSTAcStore, a6 as setMapProjFromCol, a7 as EodashCollection, a8 as mapPosition, a3 as mapEl, a2 as mapCompareEl, Z as datetime, a4 as eodashCompareCollections, a0 as eodashCollections } from './asWebComponent-BsbKnhGV.js';
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
5
  import { storeToRefs } from 'pinia';
6
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
+ };
7
48
 
8
49
  /**
9
50
  * Holder for previous compare map view as it is overwritten by sync
@@ -12,7 +53,7 @@ import log from 'loglevel';
12
53
  let viewHolder = null;
13
54
 
14
55
  /**
15
- * Description placeholder
56
+ * Handles updating {@link mapPosition} on movement on the map
16
57
  *
17
58
  * @param {import("vue").Ref<HTMLElement & Record<string,any> & {map:import("ol").Map } | null>} mapElement
18
59
  * @param {import("vue").Ref<(number | undefined)[]>} mapPosition
@@ -32,6 +73,9 @@ const useHandleMapMoveEnd = (mapElement, mapPosition) => {
32
73
  !Number.isNaN(z)
33
74
  ) {
34
75
  mapPosition.value = [lonlat[0], lonlat[1], z];
76
+ if (posIsSetFromUrl.value) {
77
+ posIsSetFromUrl.value = false;
78
+ }
35
79
  }
36
80
  };
37
81
 
@@ -73,7 +117,7 @@ const createLayersConfig = async (
73
117
  type: "Group",
74
118
  properties: {
75
119
  id: "AnalysisGroup",
76
- title: "Analysis Layers",
120
+ title: "Data Layers",
77
121
  layerControlExpand: true,
78
122
  },
79
123
  layers: /** @type {Record<string,any>[]}*/ ([]),
@@ -98,7 +142,10 @@ const createLayersConfig = async (
98
142
  const indicatorLayers =
99
143
  //@ts-expect-error indicator is collection
100
144
  await EodashCollection.getIndicatorLayers(selectedIndicator);
101
-
145
+ const geodbLayer = EodashCollection.getGeoDBLayer(eodashCols);
146
+ if (geodbLayer) {
147
+ dataLayers.layers.push(geodbLayer);
148
+ }
102
149
  const baseLayers = {
103
150
  type: "Group",
104
151
  properties: {
@@ -193,7 +240,7 @@ const createLayersConfig = async (
193
240
  };
194
241
 
195
242
  /**
196
- * Description placeholder
243
+ * Initializes the map and updates it based on changes in the selected indicator and datetime,
197
244
  *
198
245
  * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
199
246
  * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
@@ -217,6 +264,7 @@ const useInitMap = (
217
264
  eodashCols.values,
218
265
  datetime.value,
219
266
  );
267
+ const layersEvent = useEventBus(eoxLayersKey);
220
268
 
221
269
  const stopIndicatorWatcher = watch(
222
270
  [selectedIndicator, datetime],
@@ -269,6 +317,9 @@ const useInitMap = (
269
317
  JSON.parse(JSON.stringify(layersCollection)),
270
318
  );
271
319
  mapLayers.value = layersCollection;
320
+ await nextTick(() => {
321
+ layersEvent.emit("time:updated", mapLayers.value);
322
+ });
272
323
  return;
273
324
  }
274
325
 
@@ -299,14 +350,18 @@ const useInitMap = (
299
350
 
300
351
  // Try to move map view to extent only when main
301
352
  // indicator and map changes
302
- if (mapElement?.value?.id === "main") {
353
+ if (
354
+ mapElement?.value?.id === "main" &&
355
+ updatedStac.extent?.spatial.bbox &&
356
+ !posIsSetFromUrl.value
357
+ ) {
303
358
  // Sanitize extent,
304
359
  const b = updatedStac.extent?.spatial.bbox[0];
305
360
  const sanitizedExtent = [
306
- b[0] > -180 ? b[0] : -180,
307
- b[1] > -90 ? b[1] : -90,
308
- b[2] < 180 ? b[2] : 180,
309
- b[3] < 90 ? b[3] : 90,
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,
310
365
  ];
311
366
 
312
367
  const reprojExtent = mapElement.value?.transformExtent(
@@ -314,9 +369,12 @@ const useInitMap = (
314
369
  "EPSG:4326",
315
370
  mapElement.value?.map?.getView().getProjection(),
316
371
  );
317
- /** @type {any} */
372
+ /** @type {import("@eox/map").EOxMap} */
318
373
  (mapElement.value).zoomExtent = reprojExtent;
319
374
  }
375
+ if (posIsSetFromUrl.value) {
376
+ posIsSetFromUrl.value = false;
377
+ }
320
378
 
321
379
  log.debug(
322
380
  "Assigned layers",
@@ -324,6 +382,12 @@ const useInitMap = (
324
382
  );
325
383
 
326
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
+ });
327
391
  }
328
392
  },
329
393
  { immediate: true },
@@ -334,11 +398,25 @@ const useInitMap = (
334
398
  });
335
399
  };
336
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
+
337
416
  const _hoisted_1 = [".enabled"];
338
- const _hoisted_2 = [".layers"];
417
+ const _hoisted_2 = [".center", ".zoom", ".layers"];
339
418
  const _hoisted_3 = [".layers"];
340
419
 
341
-
342
420
  const _sfc_main = {
343
421
  __name: 'EodashMap',
344
422
  props: {
@@ -346,11 +424,26 @@ const _sfc_main = {
346
424
  type: Boolean,
347
425
  default: false,
348
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
+ },
349
437
  },
350
438
  setup(__props) {
351
439
 
352
440
  const props = __props;
353
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);
354
447
  /** @type {import("vue").Ref<Record<string,any>[]>} */
355
448
  const eoxMapLayers = ref([
356
449
  {
@@ -375,32 +468,15 @@ const eoxMapCompareLayers = ref([
375
468
  },
376
469
  ]);
377
470
 
471
+ const animationOptions = {
472
+ duration: 1200,
473
+ easing: inAndOut,
474
+ };
475
+
378
476
  /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
379
477
  const eoxMap = ref(null);
380
478
  /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
381
479
  const compareMap = ref(null);
382
-
383
- const eoxMapConfig = {
384
- /** @type {(number|undefined)[] | undefined} */
385
- center: [15, 48],
386
- /** @type {number | undefined} */
387
- zoom: 4,
388
- };
389
-
390
- const eoxCompareMapConfig = {
391
- /** @type {(number|undefined)[] | undefined} */
392
- center: [15, 48],
393
- /** @type {number | undefined} */
394
- zoom: 4,
395
- };
396
-
397
- // Check if selected indicator was already set in store
398
- if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
399
- // TODO: do further checks for invalid values?
400
- // TODO: can we expect the values to be in a specific projection
401
- eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
402
- eoxMapConfig.zoom = mapPosition.value[2];
403
- }
404
480
  const { selectedCompareStac } = storeToRefs(useSTAcStore());
405
481
  const showCompare = computed(() =>
406
482
  props.enableCompare && !!selectedCompareStac.value ? "" : "first",
@@ -450,8 +526,10 @@ return (_ctx, _cache) => {
450
526
  slot: "first",
451
527
  ref_key: "eoxMap",
452
528
  ref: eoxMap,
453
- ".config": eoxMapConfig,
454
529
  id: "main",
530
+ ".animationOptions": animationOptions,
531
+ ".center": unref(initialCenter),
532
+ ".zoom": unref(initialZoom),
455
533
  ".layers": eoxMapLayers.value
456
534
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2),
457
535
  createElementVNode("eox-map", {
@@ -460,7 +538,6 @@ return (_ctx, _cache) => {
460
538
  slot: "second",
461
539
  ref_key: "compareMap",
462
540
  ref: compareMap,
463
- ".config": eoxCompareMapConfig,
464
541
  ".layers": eoxMapCompareLayers.value
465
542
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3)
466
543
  ], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1))
@@ -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 };