@eodash/eodash 5.0.0-rc.1.6 → 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 (55) hide show
  1. package/core/client/composables/EodashMap.js +30 -25
  2. package/core/client/composables/index.js +8 -1
  3. package/core/client/eodash.js +14 -1
  4. package/core/client/eodashSTAC/EodashCollection.js +9 -5
  5. package/core/client/eodashSTAC/createLayers.js +1 -1
  6. package/core/client/eodashSTAC/helpers.js +10 -2
  7. package/core/client/eodashSTAC/triggers.js +52 -1
  8. package/core/client/store/stac.js +7 -2
  9. package/core/client/types.ts +3 -1
  10. package/core/client/utils/index.js +12 -0
  11. package/core/client/utils/states.js +16 -2
  12. package/core/client/views/Dashboard.vue +3 -1
  13. package/dist/client/{DashboardLayout-SZfMDUoR.js → DashboardLayout-VrJIbhe8.js} +2 -2
  14. package/dist/client/{DynamicWebComponent-I9gzMY0L.js → DynamicWebComponent-BCwpocDX.js} +1 -1
  15. package/dist/client/{EodashDatePicker-B9_u6TTm.js → EodashDatePicker-Bp5ec3BC.js} +60 -35
  16. package/dist/client/{EodashItemFilter-G7YsYO3B.js → EodashItemFilter-Cx0t-qeW.js} +1 -1
  17. package/dist/client/{EodashLayerControl-CJ94ul63.js → EodashLayerControl-DERx00In.js} +1 -1
  18. package/dist/client/{EodashLayoutSwitcher-DRKm8A8U.js → EodashLayoutSwitcher-DTS7otlk.js} +2 -2
  19. package/dist/client/{EodashMap-Dp44Ajbi.js → EodashMap-C-I6puhb.js} +50 -72
  20. package/dist/client/{EodashMapBtns-BlPFwhPc.js → EodashMapBtns-CWgtJiG4.js} +4 -4
  21. package/dist/client/{EodashProcess-BLmIgUGT.js → EodashProcess-DWrTIyHT.js} +32 -10
  22. package/dist/client/{EodashStacInfo-BIRcfcMo.js → EodashStacInfo-Dvsk97Mz.js} +1 -1
  23. package/dist/client/{EodashTools-PNfJ-Cw3.js → EodashTools-CdnjgTTl.js} +4 -4
  24. package/dist/client/{ExportState-5JyTshJH.js → ExportState-S4lcehm3.js} +4 -4
  25. package/dist/client/{Footer-CM9hgdQP.js → Footer-DlIEbXp-.js} +1 -1
  26. package/dist/client/{Header-BTq4DW1x.js → Header-CTiEXLi0.js} +3 -3
  27. package/dist/client/{MobileLayout-Atfoxf8d.js → MobileLayout-DRgyQYFz.js} +17 -7
  28. package/dist/client/{PopUp-Bmfn3N_4.js → PopUp-CzqV8BFZ.js} +3 -3
  29. package/dist/client/{VImg-CUF4S39i.js → VImg-Bn8bCvVM.js} +2 -2
  30. package/dist/client/{VMain-CQpXnzDR.js → VMain-2GOqWb6m.js} +1 -1
  31. package/dist/client/{VOverlay-DUnITwM1.js → VOverlay-BetC0LGI.js} +3 -3
  32. package/dist/client/{VTooltip-BYTlbKer.js → VTooltip-BWg0dxx5.js} +3 -3
  33. package/dist/client/{WidgetsContainer-BPbgxdb0.js → WidgetsContainer-Cv466WUW.js} +1 -1
  34. package/dist/client/{asWebComponent-DW1XzZkL.js → asWebComponent-CLUhauLl.js} +302 -154
  35. package/dist/client/eo-dash.css +1 -1
  36. package/dist/client/eo-dash.js +1 -1
  37. package/dist/client/{forwardRefs-gx1Fzngc.js → forwardRefs-CxSsJulB.js} +1 -1
  38. package/dist/client/{index-DvFppNyk.js → index-BMj56LY3.js} +1 -1
  39. package/dist/client/{transition-j2eWJYMg.js → transition-DidoPMgC.js} +1 -1
  40. package/dist/node/cli.js +2 -2
  41. package/dist/types/core/client/composables/EodashMap.d.ts +2 -2
  42. package/dist/types/core/client/composables/index.d.ts +1 -1
  43. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +2 -0
  44. package/dist/types/core/client/eodashSTAC/helpers.d.ts +4 -2
  45. package/dist/types/core/client/eodashSTAC/triggers.d.ts +6 -0
  46. package/dist/types/core/client/types.d.ts +3 -1
  47. package/dist/types/core/client/utils/index.d.ts +1 -0
  48. package/dist/types/core/client/utils/states.d.ts +8 -1
  49. package/dist/types/widgets/EodashDatePicker.vue.d.ts +455 -0
  50. package/dist/types/widgets/EodashMap.vue.d.ts +2 -0
  51. package/dist/types/widgets/EodashProcess.vue.d.ts +1 -0
  52. package/package.json +19 -19
  53. package/widgets/EodashDatePicker.vue +51 -17
  54. package/widgets/EodashMap.vue +14 -2
  55. package/widgets/EodashProcess.vue +25 -11
@@ -210,6 +210,7 @@ const createLayersConfig = async (
210
210
  * @param {import("vue").Ref<string>} datetime
211
211
  * @param {import("vue").Ref<Record<string,any>[]>} mapLayers
212
212
  * @param {import("vue").Ref<import("@eox/map").EOxMap| null>} partnerMap
213
+ * @param {boolean} zoomToExtent
213
214
  */
214
215
  export const useInitMap = (
215
216
  mapElement,
@@ -218,6 +219,7 @@ export const useInitMap = (
218
219
  datetime,
219
220
  mapLayers,
220
221
  partnerMap,
222
+ zoomToExtent,
221
223
  ) => {
222
224
  log.debug(
223
225
  "InitMap",
@@ -310,29 +312,31 @@ export const useInitMap = (
310
312
  datetime.value = endInterval.toISOString();
311
313
  }
312
314
 
313
- // Try to move map view to extent only when main
314
- // indicator and map changes
315
- if (
316
- mapElement?.value?.id === "main" &&
317
- updatedStac.extent?.spatial.bbox &&
318
- !posIsSetFromUrl.value
319
- ) {
320
- // Sanitize extent,
321
- const b = updatedStac.extent?.spatial.bbox[0];
322
- const sanitizedExtent = [
323
- b?.[0] > -180 ? b?.[0] : -180,
324
- b?.[1] > -90 ? b?.[1] : -90,
325
- b?.[2] < 180 ? b?.[2] : 180,
326
- b?.[3] < 90 ? b?.[3] : 90,
327
- ];
315
+ if (zoomToExtent) {
316
+ // Try to move map view to extent only when main
317
+ // indicator and map changes
318
+ if (
319
+ mapElement?.value?.id === "main" &&
320
+ updatedStac.extent?.spatial.bbox &&
321
+ !posIsSetFromUrl.value
322
+ ) {
323
+ // Sanitize extent,
324
+ const b = updatedStac.extent?.spatial.bbox[0];
325
+ const sanitizedExtent = [
326
+ b?.[0] > -180 ? b?.[0] : -180,
327
+ b?.[1] > -90 ? b?.[1] : -90,
328
+ b?.[2] < 180 ? b?.[2] : 180,
329
+ b?.[3] < 90 ? b?.[3] : 90,
330
+ ];
328
331
 
329
- const reprojExtent = mapElement.value?.transformExtent(
330
- sanitizedExtent,
331
- "EPSG:4326",
332
- mapElement.value?.map?.getView().getProjection(),
333
- );
334
- /** @type {import("@eox/map").EOxMap} */
335
- (mapElement.value).zoomExtent = reprojExtent;
332
+ const reprojExtent = mapElement.value?.transformExtent(
333
+ sanitizedExtent,
334
+ "EPSG:4326",
335
+ mapElement.value?.map?.getView().getProjection(),
336
+ );
337
+ /** @type {import("@eox/map").EOxMap} */
338
+ (mapElement.value).zoomExtent = reprojExtent;
339
+ }
336
340
  }
337
341
  if (posIsSetFromUrl.value) {
338
342
  posIsSetFromUrl.value = false;
@@ -361,14 +365,15 @@ export const useInitMap = (
361
365
  /**
362
366
  *
363
367
  * @param {EodashCollection[]} eodashCols
364
- * @param {import("vue").Ref<import("@/types").EodashStyleJson["tooltip"]>} tooltipProperties
368
+ * @param {import("vue").Ref<Exclude<import("@/types").EodashStyleJson["tooltip"],undefined>>} tooltipProperties
365
369
  */
366
370
  export const useUpdateTooltipProperties = (eodashCols, tooltipProperties) => {
367
371
  useOnLayersUpdate(async () => {
368
- tooltipProperties.value = [];
372
+ const tooltips = [];
369
373
  for (const ec of eodashCols) {
370
- tooltipProperties.value.push(...(await ec.getToolTipProperties()));
374
+ tooltips.push(...(await ec.getToolTipProperties()));
371
375
  }
376
+ tooltipProperties.value = tooltips;
372
377
  log.debug("Updated tooltip properties", tooltipProperties.value);
373
378
  });
374
379
  };
@@ -17,6 +17,7 @@ import log from "loglevel";
17
17
  import { eodashKey, eoxLayersKey } from "@/utils/keys";
18
18
  import { useEventBus } from "@vueuse/core";
19
19
  import { posIsSetFromUrl } from "@/utils/states";
20
+ import { setCollectionsPalette } from "@/utils";
20
21
 
21
22
  /**
22
23
  * Creates an absolute URL from a relative link and assignes it to `currentUrl`
@@ -81,13 +82,19 @@ export const useCompareAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
81
82
  * `ThemeDefinition`
82
83
  *
83
84
  * @param {string} themeName - Name of the theme to be updated
84
- * @param {import("vuetify").ThemeDefinition} [themeDefinition={}] - New
85
+ * @param {import("@/types").Eodash["brand"]["theme"]} [themeDefinition={}] - New
85
86
  * defintion to be updated to. Default is `{}`
86
87
  * @returns {import("vuetify").ThemeInstance}
87
88
  */
88
89
  export const useUpdateTheme = (themeName, themeDefinition = {}) => {
89
90
  const theme = useTheme();
90
91
 
92
+ // extract collections palette from the theme
93
+ if (themeDefinition.collectionsPalette?.length) {
94
+ setCollectionsPalette(themeDefinition.collectionsPalette);
95
+ delete themeDefinition.collectionsPalette;
96
+ }
97
+
91
98
  /** @type {(keyof import("vuetify").ThemeDefinition)[]} */ (
92
99
  Object.keys(themeDefinition)
93
100
  ).forEach((key) => {
@@ -30,6 +30,18 @@ export const eodash = reactive({
30
30
  "surface-opacity": 0.6,
31
31
  "primary-opacity": 0.8,
32
32
  },
33
+ // Bank-Wong palette
34
+ collectionsPalette: [
35
+ "#009E73",
36
+ "#E69F00",
37
+ "#56B4E9",
38
+ "#009E73",
39
+ "#F0E442",
40
+ "#0072B2",
41
+ "#D55E00",
42
+ "#CC79A7",
43
+ "#994F00",
44
+ ],
33
45
  },
34
46
  footerText: "Demo configuration of eodash client",
35
47
  },
@@ -149,7 +161,6 @@ export const eodash = reactive({
149
161
  properties: {
150
162
  hintText: `<b>Hint:</b> closest available date is displayed <br />
151
163
  on map (see Analysis Layers)`,
152
- toggleCalendar: true,
153
164
  },
154
165
  },
155
166
  }
@@ -248,6 +259,7 @@ export const eodash = reactive({
248
259
  properties: {
249
260
  hintText: `<b>Hint:</b> closest available date is displayed <br />
250
261
  on map (see Analysis Layers)`,
262
+ toggleCalendar: true,
251
263
  },
252
264
  },
253
265
  }
@@ -420,6 +432,7 @@ export const eodash = reactive({
420
432
  properties: {
421
433
  hintText: `<b>Hint:</b> closest available date is displayed <br />
422
434
  on map (see Analysis Layers)`,
435
+ toggleCalendar: true,
423
436
  },
424
437
  },
425
438
  }
@@ -31,9 +31,12 @@ export class EodashCollection {
31
31
  */
32
32
  selectedItem;
33
33
 
34
- /** @type {import("@/types").EodashStyleJson["tooltip"]} */
34
+ /** @type {Exclude<import("@/types").EodashStyleJson["tooltip"],undefined>} */
35
35
  #tooltipProperties = [];
36
36
 
37
+ /** @type {string | undefined} */
38
+ color;
39
+
37
40
  // read only
38
41
  get collectionStac() {
39
42
  return this.#collectionStac;
@@ -148,6 +151,7 @@ export class EodashCollection {
148
151
  // less control.
149
152
 
150
153
  let { layerConfig, style } = extractLayerConfig(
154
+ this.#collectionStac?.id ?? "",
151
155
  await fetchStyle(item, itemUrl),
152
156
  );
153
157
 
@@ -182,6 +186,10 @@ export class EodashCollection {
182
186
  layerLegend: this.#collectionStac["eox:colorlegend"],
183
187
  };
184
188
  }
189
+ extraProperties = {
190
+ ...extraProperties,
191
+ ...(this.color && { color: this.color }),
192
+ };
185
193
  const links = await createLayersFromLinks(
186
194
  this.#collectionStac?.id ?? "",
187
195
  title,
@@ -374,7 +382,6 @@ export class EodashCollection {
374
382
  indicator?.title || indicator.id,
375
383
  //@ts-expect-error indicator instead of item
376
384
  indicator,
377
- // layerDatetime,
378
385
  )),
379
386
  ...(await createLayersFromAssets(
380
387
  indicator?.id ?? "",
@@ -382,9 +389,6 @@ export class EodashCollection {
382
389
  indicatorAssets,
383
390
  //@ts-expect-error indicator instead of item
384
391
  indicator,
385
- // style,
386
- // layerConfig,
387
- // layerDatetime,
388
392
  )),
389
393
  ];
390
394
  }
@@ -82,7 +82,7 @@ export async function createLayersFromAssets(
82
82
  {
83
83
  type: "select",
84
84
  options: {
85
- id: "selectInteraction",
85
+ id: (Math.random() * 10000).toFixed() + "_selectInteraction",
86
86
  condition: "pointermove",
87
87
  style: {
88
88
  "stroke-color": "#335267",
@@ -1,6 +1,7 @@
1
1
  import { toAbsolute } from "stac-js/src/http.js";
2
2
  import axios from "@/plugins/axios";
3
3
  import log from "loglevel";
4
+ import { getStyleVariablesState } from "./triggers.js";
4
5
 
5
6
  /** @param {import("stac-ts").StacLink[]} [links] */
6
7
  export function generateFeatures(links) {
@@ -39,12 +40,19 @@ export function generateFeatures(links) {
39
40
  /**
40
41
  * Sperates and extracts layerConfig (jsonform schema & legend) from a style json
41
42
  *
42
- * @param { import("@/types").EodashStyleJson} [style] */
43
- export function extractLayerConfig(style) {
43
+ * @param {string} collectionId
44
+ * @param { import("@/types").EodashStyleJson} [style]
45
+ * */
46
+ export function extractLayerConfig(collectionId, style) {
44
47
  if (!style) {
45
48
  return { layerConfig: undefined, style: undefined };
46
49
  }
47
50
  style = { ...style };
51
+
52
+ if (Object.keys(style.variables ?? {}).length) {
53
+ style.variables = getStyleVariablesState(collectionId, style.variables);
54
+ }
55
+
48
56
  /** @type {Record<string,unknown> | undefined} */
49
57
  let layerConfig = undefined;
50
58
 
@@ -4,7 +4,7 @@
4
4
  import { changeMapProjection, registerProjection } from "@/store/actions";
5
5
  import log from "loglevel";
6
6
  import { getProjectionCode } from "./helpers";
7
- import { availableMapProjection } from "@/store/states";
7
+ import { availableMapProjection, mapEl } from "@/store/states";
8
8
 
9
9
  /**
10
10
  * checks if there's a projection on the Collection and
@@ -41,3 +41,54 @@ export const setMapProjFromCol = async (STAcCollection) => {
41
41
  await changeMapProjection((availableMapProjection.value = ""));
42
42
  }
43
43
  };
44
+ /**
45
+ *
46
+ * @param {string} collectionId
47
+ * @param {import("@/types").EodashStyleJson["variables"]} variables
48
+ */
49
+ export function getStyleVariablesState(collectionId, variables) {
50
+ const mapElement = /** @type {import("@eox/map").EOxMap} */ (mapEl.value);
51
+ if (!mapElement || !mapElement.layers.length || !variables) {
52
+ return variables;
53
+ }
54
+
55
+ const analysisGroup = mapElement.layers.find(
56
+ (layer) => layer.properties?.id === "AnalysisGroup",
57
+ );
58
+ if (!analysisGroup) {
59
+ return variables;
60
+ }
61
+ const matchingLayer = analysisGroup.layers?.find((layer) => {
62
+ const [collection, ..._other] = layer.properties?.id.split(";:;") ?? [
63
+ "",
64
+ "",
65
+ "",
66
+ ];
67
+ return (
68
+ collection === collectionId &&
69
+ ["Vector", "WebGLTile"].includes(layer?.type ?? "")
70
+ );
71
+ });
72
+
73
+ if (!matchingLayer) {
74
+ return variables;
75
+ }
76
+
77
+ const olLayer = mapElement.getLayerById(matchingLayer.properties?.id ?? "");
78
+ const oldVariablesState = /** @type {import("ol/layer").WebGLTile} */ (
79
+ olLayer
80
+ //@ts-expect-error todo
81
+ ).getStyle()?.variables;
82
+ if (!oldVariablesState) {
83
+ return variables;
84
+ }
85
+ const styleVariablesKeys = Object.keys(variables);
86
+ const matchingKeys =
87
+ Object.keys(oldVariablesState).every((key) =>
88
+ styleVariablesKeys.includes(key),
89
+ ) &&
90
+ styleVariablesKeys.every((key) =>
91
+ Object.keys(oldVariablesState).includes(key),
92
+ );
93
+ return matchingKeys ? oldVariablesState : variables;
94
+ }
@@ -5,7 +5,11 @@ import { useAbsoluteUrl, useCompareAbsoluteUrl } from "@/composables/index";
5
5
  import { eodashKey } from "@/utils/keys";
6
6
  import { indicator } from "@/store/states";
7
7
  import { extractCollectionUrls } from "@/eodashSTAC/helpers";
8
- import { eodashCollections, eodashCompareCollections } from "@/utils/states";
8
+ import {
9
+ eodashCollections,
10
+ eodashCompareCollections,
11
+ collectionsPalette,
12
+ } from "@/utils/states";
9
13
  import { EodashCollection } from "@/eodashSTAC/EodashCollection";
10
14
  import log from "loglevel";
11
15
 
@@ -92,9 +96,10 @@ export const useSTAcStore = defineStore("stac", () => {
92
96
  );
93
97
 
94
98
  await Promise.all(
95
- collectionUrls.map((cu) => {
99
+ collectionUrls.map((cu, idx) => {
96
100
  const ec = new EodashCollection(cu);
97
101
  ec.fetchCollection();
102
+ ec.color = collectionsPalette[idx % collectionsPalette.length];
98
103
  return ec;
99
104
  }),
100
105
  ).then((collections) => {
@@ -229,7 +229,9 @@ export type Eodash<T extends ExecutionTime = "compiletime"> = {
229
229
  * Dashboard theme as a custom [vuetifyJs
230
230
  * theme](https://vuetifyjs.com/en/features/theme/).
231
231
  */
232
- theme?: import("vuetify/lib/index.mjs").ThemeDefinition;
232
+ theme?: import("vuetify/lib/index.mjs").ThemeDefinition & {
233
+ collectionsPalette?: string[];
234
+ };
233
235
  /** Text applied to the footer. */
234
236
  footerText?: string;
235
237
  };
@@ -1,3 +1,5 @@
1
+ import log from "loglevel";
2
+ import { collectionsPalette } from "./states";
1
3
  /**
2
4
  * Loads font in the app using `webfontloader`
3
5
  *
@@ -49,3 +51,13 @@ export const copyToClipBoard = async (text, showIcon) => {
49
51
  showIcon.value = false;
50
52
  }, 2000);
51
53
  };
54
+
55
+ /**
56
+ * Sets the color palette for STAC indicators
57
+ * @param {string[]} colors
58
+ **/
59
+ export const setCollectionsPalette = (colors) => {
60
+ log.debug("Setting collections color palette", colors);
61
+ collectionsPalette.splice(0, collectionsPalette.length);
62
+ collectionsPalette.push(...colors);
63
+ };
@@ -1,4 +1,4 @@
1
- import { ref, shallowReactive } from "vue";
1
+ import { reactive, ref, shallowReactive } from "vue";
2
2
 
3
3
  /**
4
4
  * Array of eodash STAC Collections extracted from the current selected indicator.
@@ -21,5 +21,19 @@ export const eodashCompareCollections = shallowReactive([]);
21
21
  /** whether the map postion was set in URL params on first load */
22
22
  export const posIsSetFromUrl = ref(false);
23
23
 
24
- /** @type {import("vue").Ref<Record<string,any>|undefined>} */
24
+ /**
25
+ * Current value of the layer control JSON form for the latest layer the user interacted with.
26
+ * @type {import("vue").Ref<Record<string, any> | undefined>}
27
+ */
25
28
  export const layerControlFormValue = ref({});
29
+ /**
30
+ * STAC indicators color palette, defaults to Bank-Wong palette
31
+ * @type {string[]} */
32
+ export const collectionsPalette = reactive([
33
+ "#009E73",
34
+ "#0072B2",
35
+ "#E69F00",
36
+ "#CC79A7",
37
+ "#56B4E9",
38
+ "#D55E00",
39
+ ]);
@@ -35,7 +35,9 @@ const eodash = await useEodashRuntime(props.config);
35
35
 
36
36
  useURLSearchParametersSync();
37
37
 
38
- const theme = useUpdateTheme("dashboardTheme", eodash.brand?.theme);
38
+ const theme = useUpdateTheme("dashboardTheme", {
39
+ ...(eodash.brand?.theme ?? {}),
40
+ });
39
41
  theme.global.name.value = "dashboardTheme";
40
42
 
41
43
  await loadFont(
@@ -1,7 +1,7 @@
1
1
  import { openBlock, createBlock, withCtx, createElementVNode, unref, normalizeStyle, createElementBlock, Suspense, resolveDynamicComponent, mergeProps, createCommentVNode, Fragment, renderList, Transition } from 'vue';
2
2
  import '@eox/layout';
3
- import { _ as _export_sfc, F as useDefineTemplate } from './asWebComponent-DW1XzZkL.js';
4
- import { V as VMain } from './VMain-CQpXnzDR.js';
3
+ import { _ as _export_sfc, F as useDefineTemplate } from './asWebComponent-CLUhauLl.js';
4
+ import { V as VMain } from './VMain-2GOqWb6m.js';
5
5
 
6
6
  const _hoisted_1 = ["gap"];
7
7
  const _hoisted_2 = ["id", "h", "w", "x", "y"];
@@ -1,5 +1,5 @@
1
1
  import { withAsyncContext, ref, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, resolveDynamicComponent, mergeProps } from 'vue';
2
- import { $ as useSTAcStore } from './asWebComponent-DW1XzZkL.js';
2
+ import { $ as useSTAcStore } from './asWebComponent-CLUhauLl.js';
3
3
 
4
4
  const _hoisted_1 = { class: "d-flex flex-column fill-height overflow-auto" };
5
5
 
@@ -1,9 +1,9 @@
1
- import { resolveComponent, render, h, mergeProps, useCssVars, customRef, ref, reactive, toRef, watch, onMounted, openBlock, createElementBlock, createVNode, unref, createSlots, withCtx, createElementVNode, withDirectives, createBlock, createCommentVNode, toHandlers } from 'vue';
1
+ import { resolveComponent, render, h, mergeProps, useCssVars, useTemplateRef, customRef, ref, computed, reactive, toRef, watch, onMounted, openBlock, createElementBlock, createVNode, unref, createSlots, withCtx, createElementVNode, withDirectives, createBlock, createCommentVNode, toHandlers } from 'vue';
2
2
  import { DatePicker } from 'v-calendar';
3
- import { E as isObject, Y as consoleError, t as useDisplay, Z as datetime, $ as useSTAcStore, a0 as eodashCollections, a1 as makePanelTransparent, V as VBtn, y as VIcon } from './asWebComponent-DW1XzZkL.js';
3
+ import { E as isObject, Y as consoleError, t as useDisplay, Z as datetime, $ as useSTAcStore, a0 as eodashCollections, a1 as collectionsPalette, a2 as makePanelTransparent, V as VBtn, y as VIcon } from './asWebComponent-CLUhauLl.js';
4
4
  import { mdiRayEndArrow, mdiRayStartArrow } from '@mdi/js';
5
5
  import log from 'loglevel';
6
- import { V as VTooltip } from './VTooltip-BYTlbKer.js';
6
+ import { V as VTooltip } from './VTooltip-BWg0dxx5.js';
7
7
 
8
8
  // Utilities
9
9
  function useDirectiveComponent(component, props) {
@@ -86,23 +86,27 @@ const Tooltip = useDirectiveComponent(VTooltip, binding => {
86
86
  });
87
87
 
88
88
  const _hoisted_1 = {
89
+ ref: "rootRef",
90
+ class: "datePicker"
91
+ };
92
+ const _hoisted_2 = {
89
93
  class: "bg-surface d-flex flex-row align-center justify-center pb-1",
90
94
  style: {"overflow":"hidden","width":"100%"}
91
95
  };
92
- const _hoisted_2 = {
96
+ const _hoisted_3 = {
93
97
  class: "flex rounded-lg border border-gray-300 dark:border-gray-600",
94
98
  style: {"margin":"2px","min-width":"0"}
95
99
  };
96
- const _hoisted_3 = ["value"];
97
- const _hoisted_4 = {
100
+ const _hoisted_4 = ["value"];
101
+ const _hoisted_5 = {
98
102
  class: "d-flex flex-row align-center justify-center pb-1",
99
103
  style: {"overflow":"hidden","width":"100%"}
100
104
  };
101
- const _hoisted_5 = {
105
+ const _hoisted_6 = {
102
106
  class: "flex rounded-lg border border-gray-300 dark:border-gray-600",
103
107
  style: {"margin":"2px","min-width":"0"}
104
108
  };
105
- const _hoisted_6 = ["value"];
109
+ const _hoisted_7 = ["value"];
106
110
 
107
111
 
108
112
  const _sfc_main = {
@@ -128,11 +132,15 @@ const _sfc_main = {
128
132
  setup(__props) {
129
133
 
130
134
  useCssVars(_ctx => ({
131
- "ad11927a": (transform.value)
135
+ "45a34dce": (transform.value)
132
136
  }));
133
137
 
134
138
  const { lgAndDown } = useDisplay();
135
139
 
140
+ const rootEl = useTemplateRef("rootRef");
141
+
142
+ const datePickerEl = useTemplateRef("datePicker");
143
+
136
144
  // holds the number value of the datetime
137
145
  const currentDate = customRef((track, trigger) => ({
138
146
  get() {
@@ -143,7 +151,13 @@ const currentDate = customRef((track, trigger) => ({
143
151
  set(num) {
144
152
  trigger();
145
153
  log.debug("Datepicker setting currentDate", datetime.value);
146
- datetime.value = new Date(num).toISOString();
154
+ const date = new Date(num);
155
+ datetime.value = date.toISOString();
156
+ //@ts-expect-error supports move method https://vcalendar.io/datepicker/basics.html#basics
157
+ datePickerEl.value?.move({
158
+ month: date.getMonth() + 1,
159
+ year: date.getFullYear(),
160
+ });
147
161
  },
148
162
  }));
149
163
 
@@ -151,6 +165,28 @@ const masks = ref({
151
165
  input: "YYYY-MM-DD",
152
166
  });
153
167
 
168
+ /** @param {Date} date */
169
+ const formatDate = (date) => {
170
+ const years = date.getFullYear();
171
+ const month = date.getMonth() + 1;
172
+ const day = date.getDate();
173
+ return `${years}-${month < 10 ? "0" + month : month}-${
174
+ day < 10 ? "0" + day : day
175
+ }`;
176
+ };
177
+ /**
178
+ *
179
+ * @param e {Event}
180
+ */
181
+ const onInputChange = (e) => {
182
+ currentDate.value = new Date(
183
+ /** @type {HTMLInputElement} */ (e.target)?.value,
184
+ ).getTime();
185
+ };
186
+ const maskedCurrentDate = computed(() =>
187
+ formatDate(new Date(currentDate.value)),
188
+ );
189
+
154
190
 
155
191
 
156
192
  /**
@@ -165,9 +201,6 @@ const masks = ref({
165
201
  */
166
202
  const attributes = reactive([]);
167
203
 
168
- /** @type {import("vue").Ref<HTMLDivElement|null>} */
169
- const rootRef = ref(null);
170
-
171
204
  const selectedStac = toRef(useSTAcStore(), "selectedStac");
172
205
 
173
206
  watch(
@@ -175,20 +208,13 @@ watch(
175
208
  async (updatedStac, previousStac) => {
176
209
  if (updatedStac && previousStac?.id !== updatedStac.id) {
177
210
  log.debug("Datepicker selected STAC change triggered");
178
- const wongPalette = [
179
- "#009E73",
180
- "#0072B2",
181
- "#E69F00",
182
- "#CC79A7",
183
- "#56B4E9",
184
- "#D55E00",
185
- ];
186
211
  // remove old values
187
212
  attributes.splice(0, attributes.length);
188
213
 
189
214
  for (let idx = 0; idx < eodashCollections.length; idx++) {
190
215
  log.debug("Retrieving dates", eodashCollections[idx]);
191
216
  await eodashCollections[idx].fetchCollection();
217
+
192
218
  const dates = [
193
219
  ...new Set(
194
220
  eodashCollections[idx].getItems()?.reduce((valid, it) => {
@@ -204,7 +230,8 @@ watch(
204
230
  key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
205
231
  dot: {
206
232
  style: {
207
- backgroundColor: wongPalette[idx % wongPalette.length],
233
+ backgroundColor:
234
+ collectionsPalette[idx % collectionsPalette.length],
208
235
  },
209
236
  },
210
237
  dates,
@@ -255,19 +282,16 @@ onMounted(() => {
255
282
  : "translate3d(0px,-80px,0)";
256
283
  });
257
284
 
258
- makePanelTransparent(rootRef);
285
+ makePanelTransparent(rootEl);
259
286
 
260
287
  return (_ctx, _cache) => {
261
288
 
262
289
 
263
290
 
264
291
 
265
- return (openBlock(), createElementBlock("div", {
266
- ref_key: "rootRef",
267
- ref: rootRef,
268
- class: "datePicker"
269
- }, [
292
+ return (openBlock(), createElementBlock("div", _hoisted_1, [
270
293
  createVNode(unref(DatePicker), {
294
+ ref: "datePicker",
271
295
  modelValue: currentDate.value,
272
296
  "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => ((currentDate).value = $event)),
273
297
  modelModifiers: { number: true },
@@ -281,7 +305,7 @@ return (_ctx, _cache) => {
281
305
  ? {
282
306
  name: "default",
283
307
  fn: withCtx(({ inputValue, inputEvents }) => [
284
- createElementVNode("div", _hoisted_1, [
308
+ createElementVNode("div", _hoisted_2, [
285
309
  (!__props.hideArrows)
286
310
  ? withDirectives((openBlock(), createBlock(VBtn, {
287
311
  key: 0,
@@ -302,7 +326,7 @@ return (_ctx, _cache) => {
302
326
  [Tooltip, 'Set date to oldest available dataset', "bottom"]
303
327
  ])
304
328
  : createCommentVNode("v-if", true),
305
- createElementVNode("div", _hoisted_2, [
329
+ createElementVNode("div", _hoisted_3, [
306
330
  (!__props.hideInputField)
307
331
  ? (openBlock(), createElementBlock("input", mergeProps({
308
332
  key: 0,
@@ -310,7 +334,7 @@ return (_ctx, _cache) => {
310
334
  }, toHandlers(inputEvents, true), {
311
335
  class: "flex-grow px-1 py-1 dark:bg-gray-700",
312
336
  style: {"margin":"1px","width":"100%","white-space":"nowrap","overflow":"hidden","text-overflow":"ellipsis"}
313
- }), null, 16 /* FULL_PROPS */, _hoisted_3))
337
+ }), null, 16 /* FULL_PROPS */, _hoisted_4))
314
338
  : createCommentVNode("v-if", true)
315
339
  ]),
316
340
  (!__props.hideArrows)
@@ -340,7 +364,7 @@ return (_ctx, _cache) => {
340
364
  : {
341
365
  name: "footer",
342
366
  fn: withCtx(() => [
343
- createElementVNode("div", _hoisted_4, [
367
+ createElementVNode("div", _hoisted_5, [
344
368
  (!__props.hideArrows)
345
369
  ? withDirectives((openBlock(), createBlock(VBtn, {
346
370
  key: 0,
@@ -361,14 +385,15 @@ return (_ctx, _cache) => {
361
385
  [Tooltip, 'Set date to oldest available dataset', "bottom"]
362
386
  ])
363
387
  : createCommentVNode("v-if", true),
364
- createElementVNode("div", _hoisted_5, [
388
+ createElementVNode("div", _hoisted_6, [
365
389
  (!__props.hideInputField)
366
390
  ? (openBlock(), createElementBlock("input", {
367
391
  key: 0,
368
- value: new Date(currentDate.value).toLocaleDateString(),
392
+ value: maskedCurrentDate.value,
393
+ onChange: onInputChange,
369
394
  class: "flex-grow px-1 py-1 dark:bg-gray-700",
370
395
  style: {"margin":"1px","width":"100%","white-space":"nowrap","overflow":"hidden","text-overflow":"ellipsis"}
371
- }, null, 8 /* PROPS */, _hoisted_6))
396
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_7))
372
397
  : createCommentVNode("v-if", true)
373
398
  ]),
374
399
  (!__props.hideArrows)
@@ -1,5 +1,5 @@
1
1
  import { computed, ref, openBlock, createElementBlock, mergeProps, unref, createElementVNode, toDisplayString } from 'vue';
2
- import { t as useDisplay, $ as useSTAcStore } from './asWebComponent-DW1XzZkL.js';
2
+ import { t as useDisplay, $ as useSTAcStore } from './asWebComponent-CLUhauLl.js';
3
3
  import '@eox/itemfilter';
4
4
 
5
5
  const _hoisted_1 = [".items"];