@eodash/eodash 5.1.0 → 5.3.0

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 (133) hide show
  1. package/core/client/components/DashboardLayout.vue +1 -2
  2. package/core/client/components/EodashOverlay.vue +4 -5
  3. package/core/client/components/MobileLayout.vue +42 -21
  4. package/core/client/composables/index.js +54 -60
  5. package/core/client/eodashSTAC/EodashCollection.js +199 -108
  6. package/core/client/eodashSTAC/auth.js +86 -0
  7. package/core/client/eodashSTAC/createLayers.js +234 -4
  8. package/core/client/eodashSTAC/helpers.js +281 -59
  9. package/core/client/eodashSTAC/parquet.js +0 -13
  10. package/core/client/eodashSTAC/triggers.js +1 -1
  11. package/core/client/store/actions.js +14 -0
  12. package/core/client/store/stac.js +46 -8
  13. package/core/client/store/states.js +6 -0
  14. package/core/client/types.ts +206 -3
  15. package/core/client/utils/bands-editor/arithmetic.js +144 -0
  16. package/core/client/utils/bands-editor/colors.js +36 -0
  17. package/core/client/utils/bands-editor/dom.js +196 -0
  18. package/core/client/utils/bands-editor/exampleSchema.json +1320 -0
  19. package/core/client/utils/bands-editor/index.js +68 -0
  20. package/core/client/utils/bands-editor/rgb.js +102 -0
  21. package/core/client/utils/index.js +5 -2
  22. package/core/client/views/Dashboard.vue +1 -1
  23. package/core/client/vite-env.d.ts +122 -0
  24. package/dist/client/{DashboardLayout-ByVs1DrY.js → DashboardLayout-Cq15p4TH.js} +5 -6
  25. package/dist/client/{DynamicWebComponent-C3W7HSQm.js → DynamicWebComponent-Cv-fPRG1.js} +1 -1
  26. package/dist/client/{EodashDatePicker-BIAf1sMT.js → EodashDatePicker-CPlJwEIO.js} +20 -22
  27. package/dist/client/{EodashItemFilter-DPznh8UB.js → EodashItemFilter-Ydebgbjj.js} +46 -31
  28. package/dist/client/EodashLayerControl-COhrkNEs.js +1517 -0
  29. package/dist/client/{EodashLayoutSwitcher-C5qTEffW.js → EodashLayoutSwitcher-pnKhTRZV.js} +4 -4
  30. package/dist/client/EodashMapBtns-Cj0Fx119.js +301 -0
  31. package/dist/client/{EodashStacInfo-CSvvF2jI.js → EodashStacInfo-Dadkg_Nj.js} +1 -1
  32. package/dist/client/EodashTimeSlider-CpoHX0S7.js +53 -0
  33. package/dist/client/{EodashTools-Cv1SXQ5y.js → EodashTools-UGBG7KC9.js} +10 -7
  34. package/dist/client/{ExportState-D-iuwaad.js → ExportState-GtJkAqeZ.js} +145 -121
  35. package/dist/client/{Footer-CyF0zRAk.js → Footer-D3ZPG5c4.js} +1 -1
  36. package/dist/client/{Header-CgD8jDKU.js → Header-z6AK-wpN.js} +2 -3
  37. package/dist/client/MobileLayout-BXNsNftb.js +118 -0
  38. package/dist/client/{PopUp-BsYLvWch.js → PopUp-BbQdjENV.js} +79 -44
  39. package/dist/client/{ProcessList-C2xsLU2_.js → ProcessList-C6VsdsYI.js} +18 -12
  40. package/dist/client/{VImg-OHe8YTs2.js → VImg-CxaMSB99.js} +203 -5
  41. package/dist/client/{VMain-PryTLU4a.js → VMain-Ds7yw0wj.js} +1 -1
  42. package/dist/client/{VTooltip-DZ0fjpB3.js → VTooltip-Cze6CEVh.js} +2 -3
  43. package/dist/client/{WidgetsContainer-B9LBadcC.js → WidgetsContainer-D66bj-JJ.js} +1 -1
  44. package/dist/client/asWebComponent-CWbNRdf9.js +8895 -0
  45. package/dist/client/{async-DkSu_u2K.js → async-BA7oWCMX.js} +69 -5
  46. package/dist/client/easing-CH0-9wR8.js +35 -0
  47. package/dist/client/eo-dash.js +1 -1
  48. package/dist/client/{VOverlay-yUn7p-Uf.js → forwardRefs-BUfxOIo-.js} +308 -28
  49. package/dist/client/{handling-CgmFXkW6.js → handling-DlNTtKB-.js} +27 -6
  50. package/dist/client/{helpers-Dy0Q13tP.js → helpers-CtE0W7iu.js} +595 -278
  51. package/dist/client/{index-skjhlH8u.js → index-CeEZIjO6.js} +26 -13
  52. package/dist/client/{index-Ch_HchK3.js → index-CsKbRDeN.js} +238 -77
  53. package/dist/client/{index-Dqj4tbx2.js → index-D4_NRKrf.js} +2 -2
  54. package/dist/client/index-DeECc3lV.js +571 -0
  55. package/dist/client/material-symbols-outlined.woff2 +0 -0
  56. package/dist/client/material-symbols-rounded.woff2 +0 -0
  57. package/dist/client/material-symbols-sharp.woff2 +0 -0
  58. package/dist/client/material-symbols-subset.woff2 +0 -0
  59. package/dist/client/templates.js +106 -49
  60. package/dist/client/{transition-C98Yn4Vo.js → transition-Byvp3L6Y.js} +1 -1
  61. package/dist/node/cli.js +6 -6
  62. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +24 -10
  63. package/dist/types/core/client/eodashSTAC/auth.d.ts +7 -0
  64. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +15 -3
  65. package/dist/types/core/client/eodashSTAC/helpers.d.ts +51 -15
  66. package/dist/types/core/client/plugins/vuetify.d.ts +14 -14
  67. package/dist/types/core/client/store/actions.d.ts +2 -0
  68. package/dist/types/core/client/store/stac.d.ts +16 -7
  69. package/dist/types/core/client/store/states.d.ts +4 -0
  70. package/dist/types/core/client/types.d.ts +171 -3
  71. package/dist/types/core/client/utils/bands-editor/arithmetic.d.ts +8 -0
  72. package/dist/types/core/client/utils/bands-editor/colors.d.ts +15 -0
  73. package/dist/types/core/client/utils/bands-editor/dom.d.ts +42 -0
  74. package/dist/types/core/client/utils/bands-editor/index.d.ts +20 -0
  75. package/dist/types/core/client/utils/bands-editor/rgb.d.ts +15 -0
  76. package/dist/types/core/client/utils/index.d.ts +1 -1
  77. package/dist/types/templates/baseConfig.d.ts +87 -1
  78. package/dist/types/templates/compare.d.ts +0 -25
  79. package/dist/types/templates/expert.d.ts +17 -21
  80. package/dist/types/templates/explore.d.ts +67 -0
  81. package/dist/types/templates/index.d.ts +1 -1
  82. package/dist/types/templates/{light.d.ts → lite.d.ts} +9 -0
  83. package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +21 -0
  84. package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +49 -0
  85. package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +4 -0
  86. package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +12 -0
  87. package/dist/types/widgets/EodashItemCatalog/types.d.ts +14 -0
  88. package/dist/types/widgets/{EodashMapBtns.vue.d.ts → EodashMap/EodashMapBtns.vue.d.ts} +6 -0
  89. package/dist/types/widgets/EodashMap/index.vue.d.ts +114 -0
  90. package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -1
  91. package/dist/types/widgets/EodashMap/methods/index.d.ts +1 -1
  92. package/dist/types/widgets/EodashProcess/methods/async.d.ts +1 -0
  93. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +1 -1
  94. package/dist/types/widgets/EodashTimeSlider.vue.d.ts +7 -0
  95. package/dist/types/widgets/EodashTools.vue.d.ts +10 -10
  96. package/dist/types/widgets/ExportState.vue.d.ts +2 -0
  97. package/package.json +31 -28
  98. package/templates/baseConfig.js +10 -5
  99. package/templates/compare.js +2 -22
  100. package/templates/expert.js +19 -18
  101. package/templates/explore.js +62 -0
  102. package/templates/index.js +1 -1
  103. package/templates/{light.js → lite.js} +11 -2
  104. package/widgets/EodashDatePicker.vue +15 -18
  105. package/widgets/EodashItemCatalog/index.vue +161 -0
  106. package/widgets/EodashItemCatalog/methods/filters.js +216 -0
  107. package/widgets/EodashItemCatalog/methods/handlers.js +50 -0
  108. package/widgets/EodashItemCatalog/methods/map.js +144 -0
  109. package/widgets/EodashItemCatalog/types.ts +15 -0
  110. package/widgets/EodashItemFilter.vue +35 -28
  111. package/widgets/EodashLayerControl.vue +10 -6
  112. package/widgets/EodashLayoutSwitcher.vue +1 -1
  113. package/widgets/EodashMap/EodashMapBtns.vue +278 -0
  114. package/widgets/EodashMap/index.vue +263 -38
  115. package/widgets/EodashMap/methods/create-layers-config.js +9 -6
  116. package/widgets/EodashMap/methods/index.js +27 -13
  117. package/widgets/EodashProcess/ProcessList.vue +13 -1
  118. package/widgets/EodashProcess/index.vue +17 -1
  119. package/widgets/EodashProcess/methods/async.js +22 -1
  120. package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +25 -3
  121. package/widgets/EodashProcess/methods/handling.js +2 -0
  122. package/widgets/EodashProcess/methods/outputs.js +1 -0
  123. package/widgets/EodashProcess/methods/utils.js +45 -1
  124. package/widgets/EodashTimeSlider.vue +40 -0
  125. package/widgets/EodashTools.vue +7 -3
  126. package/widgets/ExportState.vue +53 -22
  127. package/dist/client/EodashLayerControl-Bhxjw4V2.js +0 -154
  128. package/dist/client/EodashMapBtns-WoGq8MuV.js +0 -173
  129. package/dist/client/MobileLayout-EKQ_kpSh.js +0 -1226
  130. package/dist/client/asWebComponent-By_7_JjS.js +0 -19193
  131. package/dist/client/forwardRefs-BXxrv98s.js +0 -272
  132. package/dist/client/index-BuhOHXKv.js +0 -199
  133. package/widgets/EodashMapBtns.vue +0 -155
@@ -0,0 +1,144 @@
1
+ import { useOnLayersUpdate } from "@/composables";
2
+ import { mapEl } from "@/store/states";
3
+ import { onMounted, onUnmounted } from "vue";
4
+
5
+ /**
6
+ *
7
+ * @param {import("@/types").GeoJsonFeature[]} features
8
+ */
9
+ export function renderItemsFeatures(features) {
10
+ let analysisLayers =
11
+ /** @type {import("@eox/map/src/layers").EOxLayerTypeGroup} */ (
12
+ mapEl.value?.layers?.find((l) => l.properties?.id === "AnalysisGroup")
13
+ );
14
+ if (!mapEl.value || !features) {
15
+ return;
16
+ }
17
+ if (!analysisLayers) {
18
+ analysisLayers = {
19
+ type: "Group",
20
+ properties: {
21
+ id: "AnalysisGroup",
22
+ title: "Data Layers",
23
+ },
24
+ layers: [],
25
+ };
26
+ mapEl.value.layers = [analysisLayers, ...mapEl.value.layers.reverse()];
27
+ }
28
+
29
+ const stacItemsLayer = {
30
+ type: "Vector",
31
+ properties: {
32
+ id: "stac-items",
33
+ title: "STAC Items",
34
+ },
35
+ source: {
36
+ type: "Vector",
37
+ url:
38
+ "data:application/geo+json," +
39
+ encodeURIComponent(
40
+ JSON.stringify({ type: "FeatureCollection", features }),
41
+ ),
42
+ format: "GeoJSON",
43
+ },
44
+ style: {
45
+ "fill-color": "transparent",
46
+ "stroke-color": "#003170",
47
+ },
48
+ interactions: [
49
+ {
50
+ type: "select",
51
+ options: {
52
+ id: "stac-items",
53
+ condition: "pointermove",
54
+ style: {
55
+ "stroke-color": "white",
56
+ "stroke-width": 3,
57
+ },
58
+ },
59
+ },
60
+ ],
61
+ };
62
+ const exists = analysisLayers.layers.some(
63
+ (l) => l.properties?.id === "stac-items",
64
+ );
65
+ if (exists) {
66
+ //@ts-expect-error todo
67
+ mapEl.value.addOrUpdateLayer(stacItemsLayer);
68
+ return;
69
+ } else {
70
+ //@ts-expect-error todo
71
+ analysisLayers.layers.unshift(stacItemsLayer);
72
+ mapEl.value.layers = [...mapEl.value.layers].reverse();
73
+ }
74
+ }
75
+
76
+ /**
77
+ * @param {import("vue").Ref<any>} itemFilter
78
+ * @param {boolean} bboxFilter
79
+ */
80
+ export const useSearchOnMapMove = (itemFilter, bboxFilter) => {
81
+ if (!bboxFilter) {
82
+ return;
83
+ }
84
+ /** @type {NodeJS.Timeout} */
85
+ let timeout;
86
+ const handler = () => {
87
+ clearTimeout(timeout);
88
+ timeout = setTimeout(() => {
89
+ itemFilter.value?.search();
90
+ }, 800); // 800ms debounce
91
+ };
92
+ onMounted(() => {
93
+ mapEl.value?.map.on("moveend", handler);
94
+ });
95
+ onUnmounted(() => {
96
+ mapEl.value?.map.un("moveend", handler);
97
+ });
98
+ };
99
+ /**
100
+ *
101
+ * @param {import("vue").Ref<import("@/types").GeoJsonFeature[]>} currentItems
102
+ */
103
+ export const useRenderItemsFeatures = (currentItems) => {
104
+ const renderOnUpdate = () =>
105
+ useOnLayersUpdate(() => {
106
+ // consider cases where this is not needed
107
+ renderItemsFeatures(currentItems.value);
108
+ });
109
+ onMounted(() => {
110
+ renderItemsFeatures(currentItems.value);
111
+ renderOnUpdate();
112
+ });
113
+ };
114
+ /**
115
+ *
116
+ * @param {import("vue").Ref<any>} itemfilterEl
117
+ */
118
+ export function useRenderOnFeatureHover(itemfilterEl) {
119
+ /**
120
+ *
121
+ * @param {CustomEvent} evt
122
+ */
123
+ const handler = (evt) => {
124
+ const itemId = evt.detail?.feature?.getId();
125
+ if (!itemId) {
126
+ return;
127
+ }
128
+ const item = itemfilterEl.value.items?.find(
129
+ //@ts-expect-error todo
130
+ (r) => r.id === itemId,
131
+ );
132
+ if (item) {
133
+ itemfilterEl.value.selectedResult = item;
134
+ }
135
+ };
136
+ onMounted(() => {
137
+ //@ts-expect-error todo
138
+ mapEl.value?.addEventListener("select", handler);
139
+ });
140
+ onUnmounted(() => {
141
+ //@ts-expect-error todo
142
+ mapEl.value?.removeEventListener("select", handler);
143
+ });
144
+ }
@@ -0,0 +1,15 @@
1
+ export interface FilterConfigItem {
2
+ property: string;
3
+ type: "range" | "multiselect" | "select";
4
+ title?: string;
5
+ min?: number;
6
+ max?: number;
7
+ filterKeys?: string[];
8
+ state?: Record<string, boolean>;
9
+ placeholder?: string;
10
+ /** svg icon */
11
+ icon?: string;
12
+ unitLabel?: string;
13
+ }
14
+
15
+ export type FiltersConfig = FilterConfigItem[];
@@ -5,22 +5,26 @@
5
5
  ref="eoxItemFilter"
6
6
  style="overflow: auto; --background-color: none"
7
7
  @select="onSelect"
8
- .items="store.stac?.filter((item) => item.rel === 'child')"
8
+ .items="items"
9
9
  >
10
10
  <h4 slot="filterstitle" style="margin: 14px 8px">{{ filtersTitle }}</h4>
11
-
12
11
  <h4 slot="resultstitle" style="margin: 14px 8px">{{ resultsTitle }}</h4>
13
12
  </eox-itemfilter>
14
13
  </template>
15
14
  <script setup>
16
15
  import { useSTAcStore } from "@/store/stac";
17
16
  import { isFirstLoad } from "@/utils/states";
18
- import "@eox/itemfilter";
19
17
  import { computed, ref } from "vue";
20
18
 
19
+ if (!customElements.get("eox-itemfilter")) {
20
+ await import("@eox/itemfilter");
21
+ }
22
+
21
23
  const store = useSTAcStore();
22
24
  const emit = defineEmits(["select"]);
23
-
25
+ const items = store.isApi
26
+ ? store.stac
27
+ : store.stac?.filter((item) => item.rel === "child");
24
28
  const props = defineProps({
25
29
  enableCompare: {
26
30
  type: Boolean,
@@ -87,31 +91,36 @@ const props = defineProps({
87
91
  },
88
92
  });
89
93
  /**
90
- * @param {import("stac-ts").StacLink} item
94
+ *
95
+ * @param {Function} loader Function to load the item
96
+ * @param {Function} reset Function to reset the selection
91
97
  */
92
- const selectIndicator = async (item) => {
93
- if (item) {
94
- if (isFirstLoad.value) {
95
- // prevent the map from jumping to the initial position
96
- isFirstLoad.value = false;
98
+ const createSelect = (loader, reset) => {
99
+ /**
100
+ * @param {import("stac-ts").StacLink | import("stac-ts").StacCollection} item
101
+ */
102
+ return async (item) => {
103
+ if (item) {
104
+ if (isFirstLoad.value) {
105
+ // prevent the map from jumping to the initial position
106
+ isFirstLoad.value = false;
107
+ }
108
+ const href = /** @type {string} */ (store.isApi ? item.id : item.href);
109
+ await loader(href);
110
+ emit("select", item);
111
+ } else {
112
+ reset();
97
113
  }
98
- await store.loadSelectedSTAC(item.href);
99
- emit("select", item);
100
- } else {
101
- store.selectedStac = null;
102
- }
103
- };
104
- /**
105
- * @param {import("stac-ts").StacLink} item
106
- */
107
- const selectCompareIndicator = (item) => {
108
- if (item) {
109
- store.loadSelectedCompareSTAC(item.href);
110
- emit("select", item);
111
- } else {
112
- store.resetSelectedCompareSTAC();
113
- }
114
+ };
114
115
  };
116
+ const selectIndicator = createSelect(
117
+ store.loadSelectedSTAC,
118
+ () => (store.selectedStac = null),
119
+ );
120
+ const selectCompareIndicator = createSelect(
121
+ store.loadSelectedCompareSTAC,
122
+ store.resetSelectedCompareSTAC,
123
+ );
115
124
  /** @param {any} evt*/
116
125
  const onSelect = async (evt) => {
117
126
  const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
@@ -121,7 +130,6 @@ const onSelect = async (evt) => {
121
130
  selectIndicator(item);
122
131
  }
123
132
  };
124
-
125
133
  const config = computed(() => ({
126
134
  titleProperty: props.titleProperty,
127
135
  enableHighlighting: props.enableHighlighting,
@@ -138,7 +146,6 @@ const config = computed(() => ({
138
146
  /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
139
147
  const eoxItemFilter = ref(null);
140
148
  </script>
141
-
142
149
  <style scoped>
143
150
  eox-itemfilter {
144
151
  --form-flex-direction: row;
@@ -5,9 +5,9 @@
5
5
  :key="mapElement"
6
6
  v-bind="config"
7
7
  :for="mapElement"
8
+ .customEditorInterfaces="bandsEditorInterface"
8
9
  @datetime:updated="debouncedHandleDateTime"
9
10
  toolsAsList="true"
10
- style="--eox-background-color: transparent"
11
11
  ref="eoxLayercontrol"
12
12
  @layerConfig:change="onLayerConfigChange"
13
13
  >
@@ -22,12 +22,8 @@
22
22
  </span>
23
23
  </template>
24
24
  <script setup>
25
- import "@eox/layercontrol";
26
-
27
- import "@eox/jsonform";
28
- import "@eox/timecontrol";
29
25
  import "color-legend-element";
30
-
26
+ import "@eox/timecontrol";
31
27
  import { computed, ref } from "vue";
32
28
  import { mapEl, mapCompareEl } from "@/store/states";
33
29
  import { getColFromLayer } from "@/eodashSTAC/helpers";
@@ -39,6 +35,14 @@ import {
39
35
  } from "@/utils/states";
40
36
  import { storeToRefs } from "pinia";
41
37
  import { useSTAcStore } from "@/store/stac";
38
+ import { bandsEditorInterface } from "@/utils/bands-editor";
39
+
40
+ if (!customElements.get("eox-layercontrol")) {
41
+ await import("@eox/layercontrol");
42
+ }
43
+ if (!customElements.get("eox-jsonform")) {
44
+ await import("@eox/jsonform");
45
+ }
42
46
 
43
47
  const props = defineProps({
44
48
  map: {
@@ -24,7 +24,7 @@ const { mobile } = useDisplay();
24
24
  defineProps({
25
25
  target: {
26
26
  type: String,
27
- default: "main",
27
+ default: "expert",
28
28
  },
29
29
  // mdi/js icon
30
30
  icon: {
@@ -0,0 +1,278 @@
1
+ <template>
2
+ <div ref="rootRef" class="map-buttons d-flex flex-column align-end">
3
+ <button
4
+ v-if="enableZoom"
5
+ class="primary small circle small-elevate"
6
+ @click="onMapZoomIn"
7
+ >
8
+ <i class="small"
9
+ ><svg viewBox="0 0 24 24"><path :d="mdiPlus" /></svg
10
+ ></i>
11
+ <div class="tooltip left">Zoom in</div>
12
+ </button>
13
+
14
+ <button
15
+ v-if="enableZoom"
16
+ class="primary small circle small-elevate"
17
+ @click="onMapZoomOut"
18
+ >
19
+ <i class="small"
20
+ ><svg viewBox="0 0 24 24"><path :d="mdiMinus" /></svg
21
+ ></i>
22
+ <div class="tooltip left">Zoom out</div>
23
+ </button>
24
+
25
+ <button
26
+ v-if="exportMap"
27
+ class="primary small circle small-elevate"
28
+ @click="showMapState = !showMapState"
29
+ >
30
+ <i class="small"
31
+ ><svg viewBox="0 0 24 24"><path :d="mdiMapPlus" /></svg
32
+ ></i>
33
+ <div class="tooltip left">Extract storytelling configuration</div>
34
+ </button>
35
+ <ExportState v-if="exportMap" v-model="showMapState" />
36
+
37
+ <button
38
+ v-if="changeProjection && !!availableMapProjection"
39
+ class="primary small circle small-elevate"
40
+ @click="changeMapProjection(availableMapProjection)"
41
+ >
42
+ <i class="small"
43
+ ><svg viewBox="0 0 24 24"><path :d="mdiEarthBox" /></svg
44
+ ></i>
45
+ <div class="tooltip left">Change map projection</div>
46
+ </button>
47
+ <button
48
+ v-if="compareIndicators"
49
+ class="primary small circle small-elevate"
50
+ @click="onCompareClick"
51
+ >
52
+ <i class="small"
53
+ ><svg viewBox="0 0 24 24"><path :d="compareIcon" /></svg
54
+ ></i>
55
+ <div class="tooltip left">Compare mode</div>
56
+ </button>
57
+ <button
58
+ v-if="backToPOIs && (poi || comparePoi)"
59
+ class="primary small circle small-elevate"
60
+ @click="loadPOiIndicator()"
61
+ >
62
+ <i class="small"
63
+ ><svg viewBox="0 0 24 24">
64
+ <path :d="mdiStarFourPointsCircleOutline" /></svg
65
+ ></i>
66
+ <div class="tooltip left">Back to POIs</div>
67
+ </button>
68
+ <eox-geosearch
69
+ v-if="mapEl && enableSearch"
70
+ :for="mapEl"
71
+ :endpoint="opencageUrl"
72
+ class="geosearch-detached"
73
+ label="Search"
74
+ small
75
+ button
76
+ list-direction="left"
77
+ results-direction="down"
78
+ tooltip="Search"
79
+ tooltip-direction="left"
80
+ ></eox-geosearch>
81
+ <PopUp
82
+ v-model="showCompareIndicators"
83
+ :maxWidth="popupWidth"
84
+ :width="popupWidth"
85
+ :max-height="popupHeight"
86
+ :height="popupHeight"
87
+ >
88
+ <EodashItemFilter
89
+ v-bind="itemFilterConfig"
90
+ :enableCompare="true"
91
+ @select="onSelectCompareIndicator"
92
+ />
93
+ </PopUp>
94
+ </div>
95
+ </template>
96
+ <script setup>
97
+ import { useTransparentPanel } from "@/composables";
98
+ import { changeMapProjection, setActiveTemplate } from "@/store/actions";
99
+ import {
100
+ activeTemplate,
101
+ availableMapProjection,
102
+ comparePoi,
103
+ mapEl,
104
+ poi,
105
+ } from "@/store/states";
106
+ import {
107
+ mdiCompare,
108
+ mdiCompareRemove,
109
+ mdiEarthBox,
110
+ mdiMapPlus,
111
+ mdiMinus,
112
+ mdiPlus,
113
+ mdiStarFourPointsCircleOutline,
114
+ } from "@mdi/js";
115
+ import ExportState from "^/ExportState.vue";
116
+ import { computed, ref, triggerRef } from "vue";
117
+ import PopUp from "^/PopUp.vue";
118
+ import EodashItemFilter from "^/EodashItemFilter.vue";
119
+ import { useDisplay } from "vuetify";
120
+ import { useSTAcStore } from "@/store/stac";
121
+ import { storeToRefs } from "pinia";
122
+ import { loadPOiIndicator } from "^/EodashProcess/methods/handling";
123
+ import { easeOut } from "ol/easing.js";
124
+
125
+ import "@eox/geosearch";
126
+
127
+ const {
128
+ compareIndicators,
129
+ changeProjection,
130
+ exportMap,
131
+ backToPOIs,
132
+ enableSearch,
133
+ enableZoom,
134
+ } = defineProps({
135
+ exportMap: {
136
+ type: Boolean,
137
+ default: true,
138
+ },
139
+ changeProjection: {
140
+ type: Boolean,
141
+ default: true,
142
+ },
143
+ compareIndicators: {
144
+ /** @type {import("vue").PropType<boolean | {
145
+ compareTemplate?:string;
146
+ fallbackTemplate?:string;
147
+ itemFilterConfig?:Partial<InstanceType<import("./EodashItemFilter.vue").default>["$props"]>
148
+ }> }*/
149
+ type: [Boolean, Object],
150
+ default: true,
151
+ },
152
+ backToPOIs: {
153
+ type: Boolean,
154
+ default: true,
155
+ },
156
+ enableSearch: {
157
+ type: Boolean,
158
+ default: true,
159
+ },
160
+ enableZoom: {
161
+ type: Boolean,
162
+ default: true,
163
+ },
164
+ });
165
+ const { selectedStac, selectedCompareStac } = storeToRefs(useSTAcStore());
166
+ const { resetSelectedCompareSTAC } = useSTAcStore();
167
+ const { smAndDown } = useDisplay();
168
+ const popupWidth = computed(() => (smAndDown.value ? "80%" : "70%"));
169
+ const popupHeight = computed(() => (smAndDown.value ? "90%" : "70%"));
170
+
171
+ const showMapState = ref(false);
172
+ const showCompareIndicators = ref(false);
173
+ const compareIcon = computed(() =>
174
+ activeTemplate.value ===
175
+ ((typeof compareIndicators === "object" &&
176
+ compareIndicators?.compareTemplate) ||
177
+ "compare")
178
+ ? mdiCompareRemove
179
+ : mdiCompare,
180
+ );
181
+ const itemFilterConfig = {
182
+ enableHighlighting: false,
183
+ resultType: "cards",
184
+ style: "--select-filter-max-items: 8",
185
+ "filters-title": "Select an indicator to compare",
186
+ subTitleProperty: "subtitle",
187
+ imageProperty: "thumbnail",
188
+ aggregateResults: "collection_group",
189
+ "results-title": "",
190
+ ...(typeof compareIndicators === "object" &&
191
+ compareIndicators.itemFilterConfig),
192
+ };
193
+
194
+ const onCompareClick = () => {
195
+ showCompareIndicators.value =
196
+ activeTemplate.value !==
197
+ ((typeof compareIndicators === "object" &&
198
+ compareIndicators.compareTemplate) ||
199
+ "compare");
200
+
201
+ const fallbackTemplate =
202
+ (typeof compareIndicators === "object" &&
203
+ compareIndicators.fallbackTemplate) ||
204
+ "expert";
205
+ selectedCompareStac.value = null;
206
+ resetSelectedCompareSTAC();
207
+ setActiveTemplate(fallbackTemplate);
208
+ triggerRef(selectedStac);
209
+ };
210
+
211
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
212
+ const rootRef = ref(null);
213
+
214
+ const onSelectCompareIndicator = () => {
215
+ const compareTemplate =
216
+ (typeof compareIndicators === "object" &&
217
+ compareIndicators.compareTemplate) ||
218
+ "compare";
219
+ setActiveTemplate(compareTemplate);
220
+ showCompareIndicators.value = !showCompareIndicators.value;
221
+ };
222
+
223
+ useTransparentPanel(rootRef);
224
+
225
+ const onMapZoomOut = () => {
226
+ const map = mapEl.value?.map;
227
+ const currentZoom = map?.getView().getZoom();
228
+ if (currentZoom !== undefined && currentZoom !== null) {
229
+ const view = map?.getView();
230
+
231
+ if (view !== undefined && view.getZoom()) {
232
+ view.animate({
233
+ zoom: currentZoom - 1,
234
+ duration: 250,
235
+ easing: easeOut,
236
+ });
237
+ }
238
+ }
239
+ };
240
+
241
+ const onMapZoomIn = () => {
242
+ const map = mapEl.value?.map;
243
+ const currentZoom = map?.getView().getZoom();
244
+ if (currentZoom !== undefined && currentZoom !== null) {
245
+ const view = map?.getView();
246
+
247
+ if (view !== undefined && view.getZoom()) {
248
+ view.animate({
249
+ zoom: currentZoom + 1,
250
+ duration: 250,
251
+ easing: easeOut,
252
+ });
253
+ }
254
+ }
255
+ };
256
+ const opencageApiKey = process.env.EODASH_OPENCAGE || "NO_KEY_FOUND";
257
+ const opencageUrl = `https://api.opencagedata.com/geocode/v1/json?key=${opencageApiKey}`;
258
+
259
+ /*const menu = document
260
+ .querySelector("eox-geosearch")
261
+ .renderRoot.querySelector("menu");*/
262
+ </script>
263
+
264
+ <style scoped>
265
+ @import url("@eox/ui/style.css");
266
+
267
+ .map-buttons button {
268
+ margin-bottom: 5px;
269
+ background-color: var(--primary);
270
+ }
271
+
272
+ /* Container constraints removal */
273
+ eox-geosearch {
274
+ position: relative !important;
275
+ overflow: visible !important;
276
+ z-index: 10;
277
+ }
278
+ </style>