@eodash/eodash 5.0.0-alpha.2.15 → 5.0.0-alpha.2.17

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 (54) hide show
  1. package/README.md +1 -1
  2. package/core/client/composables/EodashMap.js +296 -0
  3. package/core/client/composables/index.js +15 -4
  4. package/core/client/eodash.js +7 -2
  5. package/core/client/plugins/axios.js +8 -0
  6. package/core/client/store/Actions.js +32 -11
  7. package/core/client/store/States.js +8 -1
  8. package/core/client/store/stac.js +59 -6
  9. package/core/client/types.d.ts +6 -2
  10. package/core/client/utils/createLayers.js +187 -49
  11. package/core/client/utils/eodashSTAC.js +147 -31
  12. package/core/client/utils/helpers.js +259 -13
  13. package/core/client/utils/states.js +17 -0
  14. package/dist/client/{DashboardLayout-DQE4aB6e.js → DashboardLayout-BR1lU9ER.js} +2 -2
  15. package/dist/client/{DynamicWebComponent-TrDsJuF8.js → DynamicWebComponent-7z8VFsrZ.js} +1 -1
  16. package/dist/client/EodashDatePicker-o7ZOYIHL.js +259 -0
  17. package/dist/client/EodashItemFilter-lNjVkidr.js +7651 -0
  18. package/dist/client/EodashLayerControl-B0N8_XmX.js +24485 -0
  19. package/dist/client/{EodashMap--2y6XErO.js → EodashMap-DFT2R2Rk.js} +22298 -24006
  20. package/dist/client/{EodashMapBtns-BSf3iUAb.js → EodashMapBtns-CoGjVl8Y.js} +2 -2
  21. package/dist/client/{ExportState-BTONkMIz.js → ExportState-Dwv37MRw.js} +171 -158
  22. package/dist/client/{Footer-B7JDXdxT.js → Footer-DuScuHSx.js} +59 -57
  23. package/dist/client/{Header-Dlumetq0.js → Header-C4Y0u0E5.js} +70 -70
  24. package/dist/client/{IframeWrapper-DRjSqhFx.js → IframeWrapper-D1TfK4xH.js} +1 -1
  25. package/dist/client/{MobileLayout-9z2X_rmU.js → MobileLayout-C-b8DIFO.js} +43 -41
  26. package/dist/client/{PopUp-CXbMBYGh.js → PopUp-DBMZX3l3.js} +5 -5
  27. package/dist/client/{VImg-Dgk5tryv.js → VImg-bAMQHnMM.js} +33 -31
  28. package/dist/client/VMain-Df5VMG9r.js +38 -0
  29. package/dist/client/VOverlay-D5GzAYRY.js +973 -0
  30. package/dist/client/{WidgetsContainer-CHK_3dlD.js → WidgetsContainer-yZDmY6_u.js} +1 -1
  31. package/dist/client/asWebComponent-DhR2_xlP.js +24492 -0
  32. package/dist/client/eo-dash.js +1 -1
  33. package/dist/client/{forwardRefs-OX_5lLJW.js → forwardRefs-C0MQxvur.js} +1 -1
  34. package/dist/client/{index-B_KfD-iF.js → index-qNWeBhRh.js} +23 -23
  35. package/dist/client/{lerc-B4lXefGh-CplqAh1B.js → lerc-B4lXefGh-CsL-d8wY.js} +1 -1
  36. package/dist/client/{ssrBoot-BZTPJZkq.js → ssrBoot-Xmkz8T49.js} +1 -1
  37. package/dist/client/style.css +2 -2
  38. package/dist/client/{transition-Dq8XIV_D.js → transition-DRzZPWIN.js} +1 -1
  39. package/dist/client/{webfontloader-qotgY98I.js → webfontloader-CqD-lAx-.js} +1 -1
  40. package/dist/node/cli.js +1 -1
  41. package/package.json +27 -22
  42. package/widgets/EodashDatePicker.vue +104 -100
  43. package/widgets/EodashItemFilter.vue +2 -0
  44. package/widgets/EodashLayerControl.vue +69 -2
  45. package/widgets/EodashMap.vue +31 -214
  46. package/widgets/ExportState.vue +12 -9
  47. package/dist/client/EodashDatePicker-CkA9rHp6.js +0 -252
  48. package/dist/client/EodashItemFilter-Bp0lcvbI.js +0 -10121
  49. package/dist/client/EodashLayerControl-lfLYqyeU.js +0 -20963
  50. package/dist/client/VMain-Ubv9jyyL.js +0 -39
  51. package/dist/client/VOverlay-CqZC2CbA.js +0 -972
  52. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  53. package/dist/client/asWebComponent-Ddg71BJk.js +0 -20451
  54. package/dist/client/helpers-BCawTwFg.js +0 -1390
@@ -1,4 +1,4 @@
1
- import { p as m, ay as b, d, bi as l, ab as u } from "./asWebComponent-Ddg71BJk.js";
1
+ import { p as m, az as b, d, bo as l, ab as u } from "./asWebComponent-DhR2_xlP.js";
2
2
  const j = m({
3
3
  transition: {
4
4
  type: [Boolean, String, Object],
@@ -1,4 +1,4 @@
1
- import { g as Ft } from "./_commonjsHelpers-DaMA6jEr.js";
1
+ import { av as Ft } from "./asWebComponent-DhR2_xlP.js";
2
2
  var ot = { exports: {} };
3
3
  (function(O) {
4
4
  (function() {
package/dist/node/cli.js CHANGED
@@ -17,4 +17,4 @@ ${i.lib?`<eo-dash style="height:100dvh;"/>
17
17
  <script type="module" src="${t.resolve(`/@fs/${c}`,"core/client/render.js")}"><\/script>
18
18
  `}
19
19
  </body>
20
- </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:z,plugins:[N({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),O({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:M}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:R,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function M(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await I(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const Y=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},B=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await L(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await T(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function G(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const K=process.argv?.[2];(async()=>{switch(K){case"dev":await Y();break;case"build":await B();break;case"preview":await G();break;default:console.error("command not found");break}})();
20
+ </html>`,D=C(({mode:e,command:n})=>({base:i.base??"",cacheDir:z,plugins:[N({customElement:!1,template:{transformAssetUrls:A,compilerOptions:{isCustomElement:a=>!a.includes("v-")&&a.includes("-")}}}),O({autoImport:!0}),e==="development"&&{name:"inject-html",configureServer:M}],customLogger:v,define:{"process.env":{}},resolve:{alias:{"@":t.join(c,"core/client"),"^":t.join(c,"widgets"),"user:config":g,"user:widgets":w},extensions:[".js",".json",".jsx",".mjs",".ts",".tsx",".vue"]},server:{warmup:{clientFiles:[t.join(c,"core/client/**")]},port:i.port??3e3,open:i.open,fs:{allow:[x(process.cwd())]},host:i.host},root:c,optimizeDeps:e==="development"?{include:["webfontloader","vuetify","vue","pinia","stac-js","urijs","loglevel"],noDiscovery:!0}:{},publicDir:i.publicDir===!1?!1:R,build:{lib:i.lib&&n==="build"&&{entry:t.join(c,"core/client/asWebComponent.js"),fileName:"eo-dash",formats:["es"],name:"@eodash/eodash"},outDir:f,emptyOutDir:!0,rollupOptions:i.lib&&n==="build"?{input:t.join(c,"core/client/asWebComponent.js")}:void 0,target:"esnext"}}));async function M(e){e.watcher.add([g,l,t.join(w,"**/*.vue")]);let n="";const a=v.info;return v.info=(o,r)=>{if(o.includes("core")){const d=o.split("/")[0].split(" ");d.pop();const p=d.join(" ")+" "+n.replace(s,"");return a(p,r)}return a(o,r)},e.watcher.on("change",async o=>{n=o,o===l&&e.hot.send({type:"full-reload",path:o})}),()=>{e.middlewares.use(async(o,r,d)=>{if(o.originalUrl==="/@fs/config.js"||o.originalUrl==="/config.js"){r.statusCode=200,r.setHeader("Content-Type","text/javascript"),u(l)&&await I(l).then(p=>{r.write(p)}),r.end();return}if(o.url?.endsWith(".html")){r.statusCode=200,r.setHeader("Content-Type","text/html");const p=await e.transformIndexHtml(o.url,y,o.originalUrl);r.end(p);return}d()})}}const Y=async()=>{const e=await k(await D({mode:"development",command:"serve"}));await e.listen(),e.printUrls(),e.bindCLIShortcuts({print:!0})},B=async()=>{const e=async()=>{const n=await D({mode:"production",command:"build"});await F(n),u(l)&&await L(l,t.join(f,"config.js"),{recursive:!0}).catch(a=>{console.error(a)})};if(i.lib)await e();else{const n=t.join(c,"/index.html");await T(n,y).then(async()=>{await e(),await $(n).catch(()=>{console.error("failed to remove index.html")})})}};async function G(){(await S({root:s,base:i.base??"",preview:{port:isNaN(i.port)?8080:i.port,open:i.open,host:i.host},build:{outDir:f}})).printUrls()}const K=process.argv?.[2];(async()=>{switch(K){case"dev":await Y();break;case"build":await B();break;case"preview":await G();break;default:console.error("command not found");break}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.15",
3
+ "version": "5.0.0-alpha.2.17",
4
4
  "type": "module",
5
5
  "types": "./core/client/types.d.ts",
6
6
  "files": [
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "browser": "./core/client/main.js",
27
27
  "scripts": {
28
+ "start": "npx eodash dev --entryPoint core/client/eodash.js",
28
29
  "prepare": "rollup -c",
29
30
  "prepack": "npm run build:lib",
30
31
  "dev": "npx eodash dev --entryPoint core/client/eodash.js",
@@ -46,48 +47,52 @@
46
47
  "docs:generate": "typedoc --options typedoc.config.json"
47
48
  },
48
49
  "dependencies": {
49
- "@eox/itemfilter": "^1.0.1",
50
+ "@eox/itemfilter": "^1.1.0",
50
51
  "@eox/jsonform": "^0.8.2",
51
- "@eox/layercontrol": "^0.18.1",
52
+ "@eox/layercontrol": "^0.20.0",
52
53
  "@eox/layout": "^0.1.0",
53
- "@eox/map": "1.11.2",
54
+ "@eox/map": "^1.13.0",
54
55
  "@eox/stacinfo": "^0.3.3",
56
+ "@eox/timecontrol": "^0.7.2",
55
57
  "@mdi/js": "^7.4.47",
56
- "@vitejs/plugin-vue": "^5.0.5",
58
+ "@vitejs/plugin-vue": "^5.1.2",
59
+ "@vueuse/core": "^10.11.1",
57
60
  "animated-details": "gist:2912bb049fa906671807415eb0e87188",
58
- "axios": "^1.7.2",
61
+ "axios": "^1.7.4",
62
+ "axios-cache-interceptor": "^1.5.3",
59
63
  "commander": "^12.1.0",
60
- "core-js": "^3.37.1",
61
- "pinia": "^2.1.7",
62
- "sass": "^1.77.7",
64
+ "core-js": "^3.38.1",
65
+ "loglevel": "^1.9.1",
66
+ "pinia": "^2.2.2",
67
+ "sass": "^1.77.8",
63
68
  "stac-js": "^0.0.9",
64
69
  "stac-ts": "^1.0.3",
65
70
  "v-calendar": "^3.1.2",
66
- "vite": "^5.3.3",
67
- "vite-plugin-vuetify": "^2.0.3",
71
+ "vite": "^5.4.2",
72
+ "vite-plugin-vuetify": "^2.0.4",
68
73
  "vue": "^3.2.0",
69
- "vuetify": "^3.6.12",
74
+ "vuetify": "^3.7.0",
70
75
  "webfontloader": "^1.6.28"
71
76
  },
72
77
  "devDependencies": {
73
- "@babel/types": "^7.24.7",
78
+ "@babel/types": "^7.25.4",
74
79
  "@eox/eslint-config": "^2.0.0",
75
- "@pinia/testing": "^0.1.3",
76
- "@types/node": "latest",
80
+ "@pinia/testing": "^0.1.5",
81
+ "@types/node": "^22.5.0",
77
82
  "@types/openlayers": "^4.6.23",
78
83
  "@types/webfontloader": "^1.6.38",
79
- "cypress": "^13.13.0",
80
- "eslint": "^9.6.0",
84
+ "cypress": "^13.13.3",
85
+ "eslint": "^9.9.0",
81
86
  "eslint-plugin-vue": "^9.27.0",
82
- "prettier": "^3.3.2",
87
+ "prettier": "^3.3.3",
83
88
  "terminate": "^2.8.0",
84
- "typedoc": "^0.26.4",
85
- "typedoc-plugin-markdown": "^4.2.0",
89
+ "typedoc": "^0.26.6",
90
+ "typedoc-plugin-markdown": "^4.2.5",
86
91
  "typedoc-plugin-vue": "^1.2.0",
87
92
  "typedoc-vitepress-theme": "^1.0.1",
88
- "typescript": "^5.5.3",
93
+ "typescript": "^5.5.4",
89
94
  "unplugin-fonts": "^1.1.1",
90
- "vitepress": "^1.3.0",
95
+ "vitepress": "^1.3.3",
91
96
  "vitest": "^1.6.0",
92
97
  "vue-tsc": "2.0.22"
93
98
  },
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <VCDatePicker v-model="currentDate" :masks="masks" :attributes="attributes">
2
+ <VCDatePicker
3
+ v-model.number="currentDate"
4
+ :masks="masks"
5
+ :attributes="attributes"
6
+ >
3
7
  <template #default="{ inputValue, inputEvents }">
4
8
  <div
5
9
  class="flex rounded-lg border border-gray-300 dark:border-gray-600"
@@ -37,45 +41,27 @@
37
41
  <script setup>
38
42
  import { DatePicker as VCDatePicker } from "v-calendar";
39
43
  import "v-calendar/style.css";
40
- import { computed, ref, onMounted, watch, inject } from "vue";
41
- import { eodashKey } from "@/utils/keys";
42
- import { toAbsolute } from "stac-js/src/http.js";
44
+ import { watch, reactive, ref, customRef } from "vue";
43
45
  import { storeToRefs } from "pinia";
44
46
  import { useSTAcStore } from "@/store/stac";
45
47
  import { datetime } from "@/store/States";
46
48
  import { mdiRayStartArrow, mdiRayEndArrow } from "@mdi/js";
47
- import { extractCollectionUrls } from "@/utils/helpers";
48
- import axios from "axios";
49
+ import { eodashCollections } from "@/utils/states";
50
+ import log from "loglevel";
49
51
 
50
- /**
51
- * @param {boolean} reverse
52
- */
53
- function jumpDate(reverse) {
54
- if (attributes.value && attributes.value.length > 0) {
55
- // We have potentially multiple collections we need to iterate (currently only one)
56
- let latestDateMS = reverse ? Infinity : -Infinity;
57
- attributes.value.forEach((coll) => {
58
- if (coll?.dates) {
59
- coll.dates.forEach((d) => {
60
- // TODO: we need to handle time ranges and other options here
61
- if (d instanceof Date) {
62
- if (
63
- (!reverse && d.getTime() > latestDateMS) ||
64
- (reverse && d.getTime() < latestDateMS)
65
- ) {
66
- latestDateMS = d.getTime();
67
- }
68
- }
69
- });
70
- }
71
- });
72
- if (latestDateMS !== 0) {
73
- currentDate.value = new Date(latestDateMS);
74
- }
75
- }
76
- }
77
-
78
- const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
52
+ // holds the number value of the datetime
53
+ const currentDate = customRef((track, trigger) => ({
54
+ get() {
55
+ track();
56
+ return new Date(datetime.value).getTime();
57
+ },
58
+ /** @param {number} num */
59
+ set(num) {
60
+ trigger();
61
+ log.debug("Datepicker setting currentDate", datetime.value);
62
+ datetime.value = new Date(num).toISOString();
63
+ },
64
+ }));
79
65
 
80
66
  const masks = ref({
81
67
  input: "YYYY-MM-DD",
@@ -84,79 +70,97 @@ const masks = ref({
84
70
  /**
85
71
  * Attributes displayed on datepicker
86
72
  *
87
- * @type {import("vue").Ref<
73
+ * @type {import("vue").Reactive<
88
74
  * (
89
75
  * | import("v-calendar/dist/types/src/utils/attribute").AttributeConfig
90
76
  * | undefined
91
77
  * )[]
92
78
  * >}
93
79
  */
94
- const attributes = ref([]);
80
+ const attributes = reactive([]);
95
81
 
96
- const currentDate = computed({
97
- get() {
98
- return datetime.value ? new Date(datetime.value) : new Date();
99
- },
100
- /** @param {Date | string} updatedDate */
101
- set(updatedDate) {
102
- if (updatedDate instanceof Date && !isNaN(updatedDate.getTime())) {
103
- datetime.value = new Date(
104
- updatedDate.getTime() - updatedDate.getTimezoneOffset() * 60000,
105
- ).toISOString();
106
- } else {
107
- datetime.value = new Date().toISOString();
108
- }
109
- },
110
- });
111
- /** @type {import("@/types").WebComponentProps["onMounted"]} */
112
- onMounted(() => {
113
- const { selectedStac } = storeToRefs(useSTAcStore());
114
- watch(
115
- [selectedStac],
116
- async ([updatedStac]) => {
117
- if (updatedStac) {
118
- const parentCollUrl = toAbsolute(
119
- `./${updatedStac.id}/collection.json`,
120
- eodashConfig.stacEndpoint,
121
- );
122
- const collectionUrls = extractCollectionUrls(
123
- selectedStac.value,
124
- parentCollUrl,
125
- );
126
- const wongPalette = [
127
- "#009E73",
128
- "#0072B2",
129
- "#E69F00",
130
- "#CC79A7",
131
- "#56B4E9",
132
- "#D55E00",
82
+ const { selectedStac } = storeToRefs(useSTAcStore());
83
+
84
+ watch(
85
+ selectedStac,
86
+ async (updatedStac, previousStac) => {
87
+ if (updatedStac && previousStac?.id !== updatedStac.id) {
88
+ log.debug("Datepicker selected STAC change triggered");
89
+ const wongPalette = [
90
+ "#009E73",
91
+ "#0072B2",
92
+ "#E69F00",
93
+ "#CC79A7",
94
+ "#56B4E9",
95
+ "#D55E00",
96
+ ];
97
+ // remove old values
98
+ attributes.splice(0, attributes.length);
99
+
100
+ for (let idx = 0; idx < eodashCollections.length; idx++) {
101
+ log.debug("Retrieving dates", eodashCollections[idx]);
102
+ await eodashCollections[idx].fetchCollection();
103
+ const dates = [
104
+ ...new Set(
105
+ eodashCollections[idx].getItems()?.reduce((valid, it) => {
106
+ const parsed = Date.parse(/** @type {string} */ (it.datetime));
107
+ if (parsed) {
108
+ valid.push(new Date(parsed));
109
+ }
110
+ return valid;
111
+ }, /** @type {Date[]} */ ([])),
112
+ ),
133
113
  ];
134
- for (let idx = 0; idx < collectionUrls.length; idx++) {
135
- const stacCollection = await axios
136
- .get(collectionUrls[idx])
137
- .then((resp) => resp.data);
138
- const dates = stacCollection.links
139
- .filter(
140
- (/** @type {{ rel: string; datetime: string }} */ item) =>
141
- item.rel === "item" && "datetime" in item,
142
- )
143
- .map(
144
- (/** @type {{ datetime: string }} */ it) => new Date(it.datetime),
145
- );
146
- attributes.value = [
147
- {
148
- bar: {
149
- style: {
150
- backgroundColor: wongPalette[idx % wongPalette.length],
151
- },
152
- },
153
- dates,
114
+ attributes.push({
115
+ key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
116
+ bar: {
117
+ style: {
118
+ backgroundColor: wongPalette[idx % wongPalette.length],
154
119
  },
155
- ];
156
- }
120
+ },
121
+ dates,
122
+ });
157
123
  }
158
- },
159
- { immediate: true },
160
- );
161
- });
124
+ // We try to set the current time selection
125
+ // to latest extent date
126
+ // @ts-expect-error it seems the temporal extent is not defined in type
127
+ const interval = updatedStac?.extent?.temporal?.interval;
128
+ if (interval && interval.length > 0 && interval[0].length > 1) {
129
+ const endInterval = new Date(interval[0][1]);
130
+ log.debug(
131
+ "Datepicker: found stac extent, setting time to latest value",
132
+ endInterval,
133
+ );
134
+ currentDate.value = endInterval?.getTime();
135
+ }
136
+ }
137
+ },
138
+ { immediate: true },
139
+ );
140
+
141
+ /**
142
+ * @param {boolean} reverse
143
+ */
144
+ function jumpDate(reverse) {
145
+ if (attributes.length) {
146
+ let latestDateMS = reverse ? Infinity : -Infinity;
147
+ attributes.forEach((coll) => {
148
+ if (coll?.dates) {
149
+ coll.dates.forEach((d) => {
150
+ // TODO: we need to handle time ranges and other options here
151
+ if (d instanceof Date) {
152
+ const mathFun = reverse ? "min" : "max";
153
+ latestDateMS = Math[mathFun](latestDateMS, d.getTime());
154
+ }
155
+ });
156
+ }
157
+ });
158
+ currentDate.value =
159
+ latestDateMS === -Infinity
160
+ ? Date.now()
161
+ : latestDateMS === Infinity
162
+ ? 0
163
+ : latestDateMS;
164
+ }
165
+ }
162
166
  </script>
@@ -71,6 +71,8 @@ const onSelect = async (evt) => {
71
71
  .forEach((res) => res.setAttribute("style", defaultStyle));
72
72
  const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
73
73
  if (item) {
74
+ // Reset compare stac to empty
75
+ store.resetSelectedCompareSTAC();
74
76
  await store.loadSelectedSTAC(item.href);
75
77
  } else {
76
78
  // TODO: it is possible to unselect items now
@@ -1,13 +1,80 @@
1
1
  <template>
2
2
  <span class="d-flex flex-column fill-height overflow-auto pa-4">
3
- <eox-layercontrol v-if="mapEl" :for="mapEl" ref="eoxLayercontrol" />
3
+ <eox-layercontrol
4
+ v-if="mapElement"
5
+ :for="mapElement"
6
+ @datetime:updated="debouncedHandleDateTime"
7
+ class="fill-height"
8
+ ref="eoxLayercontrol"
9
+ />
4
10
  </span>
5
11
  </template>
6
12
  <script setup>
7
13
  import "@eox/layercontrol";
8
14
  import "@eox/jsonform";
15
+ import "@eox/timecontrol";
16
+
9
17
  import { ref } from "vue";
10
- import { mapEl } from "@/store/States";
18
+ import { mapEl, mapCompareEl } from "@/store/States";
19
+ import { getColFromLayer } from "@/utils/helpers";
20
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
21
+
22
+ const props = defineProps({
23
+ map: {
24
+ type: String,
25
+ default: "first",
26
+ },
27
+ });
28
+
29
+ const eodashCols =
30
+ props.map === "second" ? eodashCompareCollections : eodashCollections;
31
+ const mapElement = props.map === "second" ? mapCompareEl : mapEl;
32
+
11
33
  /** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
12
34
  const eoxLayercontrol = ref(null);
35
+
36
+ /** @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt */
37
+ const handleDatetimeUpdate = async (evt) => {
38
+ const { layer, datetime } = evt.detail;
39
+
40
+ const ec = await getColFromLayer(eodashCols, layer);
41
+
42
+ /** @type {Record<string,any>[] | undefined} */
43
+ let updatedLayers = [];
44
+
45
+ if (ec) {
46
+ await ec.fetchCollection();
47
+ updatedLayers = await ec.updateLayerJson(datetime, layer.get("id"));
48
+ }
49
+ /** @type {Record<String,any>[] | undefined} */
50
+ const dataLayers = updatedLayers?.find(
51
+ (l) => l?.properties?.id === "AnalysisGroup",
52
+ )?.layers;
53
+
54
+ if (dataLayers?.length) {
55
+ // Add expand to all analysis layers
56
+ dataLayers?.forEach((dl) => {
57
+ dl.properties.layerControlExpand = true;
58
+ dl.properties.layerControlToolsExpand = true;
59
+ });
60
+ // assign layers to the map
61
+ /** @type {HTMLElement & Record<string,any>} */
62
+ (mapElement.value).layers = updatedLayers;
63
+ }
64
+ };
65
+
66
+ // ----- debounce logic
67
+ /** @type {NodeJS.Timeout | undefined} */
68
+ let timeout;
69
+
70
+ /**
71
+ * @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt
72
+ **/
73
+ const debouncedHandleDateTime = (evt) => {
74
+ clearTimeout(timeout);
75
+ timeout = setTimeout(() => {
76
+ handleDatetimeUpdate(evt);
77
+ }, 500);
78
+ };
79
+ // ------
13
80
  </script>