@eodash/eodash 5.0.0-alpha.2.8 → 5.0.0-processing

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 (138) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -3
  4. package/core/client/components/DashboardLayout.vue +6 -2
  5. package/core/client/composables/DefineEodash.js +1 -1
  6. package/core/client/composables/EodashMap.js +349 -0
  7. package/core/client/composables/EodashProcess.js +575 -0
  8. package/core/client/composables/index.js +107 -24
  9. package/core/client/eodash.js +83 -10
  10. package/core/client/plugins/axios.js +8 -0
  11. package/core/client/plugins/index.js +2 -1
  12. package/core/client/store/Actions.js +63 -12
  13. package/core/client/store/States.js +19 -0
  14. package/core/client/store/stac.js +98 -8
  15. package/core/client/types.d.ts +25 -18
  16. package/core/client/utils/createLayers.js +313 -0
  17. package/core/client/utils/eodashSTAC.js +320 -170
  18. package/core/client/utils/helpers.js +369 -9
  19. package/core/client/utils/keys.js +2 -0
  20. package/core/client/utils/states.js +17 -0
  21. package/core/client/views/Dashboard.vue +17 -46
  22. package/core/client/vite-env.d.ts +1 -9
  23. package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
  24. package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
  25. package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
  26. package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
  27. package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
  28. package/dist/client/EodashMap-CQnOePpy.js +486 -0
  29. package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
  30. package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
  31. package/dist/client/ExportState-BT8MLAW7.js +644 -0
  32. package/dist/client/Footer-C6GUG84G.js +141 -0
  33. package/dist/client/Header-D2dtCWp8.js +437 -0
  34. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  35. package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
  36. package/dist/client/PopUp-Bm01q7Ko.js +389 -0
  37. package/dist/client/VImg-B8AbetCE.js +384 -0
  38. package/dist/client/VMain-DnGlQUyr.js +43 -0
  39. package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
  40. package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
  41. package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
  42. package/dist/client/eo-dash.js +2 -6
  43. package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
  44. package/dist/client/index-DlIO7sJ3.js +199 -0
  45. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  46. package/dist/client/style.css +2 -2
  47. package/dist/client/transition-BiR8wMn1.js +37 -0
  48. package/dist/node/cli.js +4 -4
  49. package/dist/node/types.d.ts +2 -0
  50. package/dist/types/core/client/App.vue.d.ts +7 -0
  51. package/dist/types/core/client/asWebComponent.d.ts +9 -0
  52. package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
  53. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
  54. package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
  55. package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
  56. package/dist/types/core/client/components/Header.vue.d.ts +2 -0
  57. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
  58. package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
  59. package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
  60. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
  61. package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
  62. package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
  63. package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
  64. package/dist/types/core/client/composables/index.d.ts +30 -0
  65. package/dist/types/core/client/eodash.d.ts +8 -0
  66. package/dist/types/core/client/main.d.ts +2 -0
  67. package/dist/types/core/client/plugins/axios.d.ts +2 -0
  68. package/dist/types/core/client/plugins/index.d.ts +3 -0
  69. package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
  70. package/dist/types/core/client/render.d.ts +1 -0
  71. package/dist/types/core/client/store/Actions.d.ts +12 -0
  72. package/dist/types/core/client/store/States.d.ts +22 -0
  73. package/dist/types/core/client/store/index.d.ts +2 -0
  74. package/dist/types/core/client/store/stac.d.ts +25 -0
  75. package/dist/types/core/client/types.d.ts +279 -0
  76. package/dist/types/core/client/utils/createLayers.d.ts +45 -0
  77. package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
  78. package/dist/types/core/client/utils/helpers.d.ts +84 -0
  79. package/dist/types/core/client/utils/index.d.ts +2 -0
  80. package/dist/types/core/client/utils/keys.d.ts +6 -0
  81. package/dist/types/core/client/utils/states.d.ts +14 -0
  82. package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
  83. package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
  84. package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
  85. package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
  86. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
  87. package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
  88. package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
  89. package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
  90. package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
  91. package/dist/types/widgets/ExportState.vue.d.ts +7 -0
  92. package/dist/types/widgets/PopUp.vue.d.ts +22 -0
  93. package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
  94. package/package.json +58 -37
  95. package/widgets/EodashDatePicker.vue +128 -100
  96. package/widgets/EodashItemFilter.vue +149 -47
  97. package/widgets/EodashLayerControl.vue +98 -0
  98. package/widgets/EodashMap.vue +98 -122
  99. package/widgets/EodashMapBtns.vue +24 -7
  100. package/widgets/EodashProcess.vue +151 -0
  101. package/widgets/ExportState.vue +15 -11
  102. package/core/client/SuspensedDashboard.ce.vue +0 -105
  103. package/dist/client/DashboardLayout-CKOExc7r.js +0 -156
  104. package/dist/client/DynamicWebComponent-m1Zbbw6n.js +0 -57
  105. package/dist/client/EodashDatePicker-CGdJRGZJ.js +0 -252
  106. package/dist/client/EodashItemFilter-BjM_LHaE.js +0 -63
  107. package/dist/client/EodashMap-61UMC8sv.js +0 -86917
  108. package/dist/client/EodashMapBtns-DVITfAFx.js +0 -36
  109. package/dist/client/ExportState-DhpK09GR.js +0 -558
  110. package/dist/client/Footer-CIwjaddz.js +0 -115
  111. package/dist/client/Header-BcM-pZFi.js +0 -350
  112. package/dist/client/IframeWrapper-CAe6HPqe.js +0 -19
  113. package/dist/client/MobileLayout-DcZOQX8r.js +0 -945
  114. package/dist/client/PopUp-DCaITceG.js +0 -300
  115. package/dist/client/VImg-C-I_7puM.js +0 -291
  116. package/dist/client/VMain-Cd3P0YTG.js +0 -39
  117. package/dist/client/VOverlay-AcvFgk39.js +0 -967
  118. package/dist/client/WidgetsContainer-B0-q0EMO.js +0 -129
  119. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  120. package/dist/client/asWebComponent-zuKR9I1w.js +0 -20361
  121. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  122. package/dist/client/decoder-CP4lv0Kb-DdKalImK.js +0 -10
  123. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  124. package/dist/client/eodashSTAC-DGB50vNk.js +0 -2788
  125. package/dist/client/eox-itemfilter-TaBxgqq_.js +0 -7565
  126. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  127. package/dist/client/forwardRefs-BnxE4iKQ.js +0 -185
  128. package/dist/client/index-hSIi5Ygk.js +0 -153
  129. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  130. package/dist/client/lerc-DzVumYtB-cTUap6k_.js +0 -1027
  131. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  132. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  133. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  134. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  135. package/dist/client/ssrBoot-D3KF5Thc.js +0 -17
  136. package/dist/client/transition-D3a4tiJv.js +0 -34
  137. package/dist/client/webfontloader-qotgY98I.js +0 -435
  138. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,22 @@
1
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
2
+ export default _default;
3
+ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
+ $slots: S;
5
+ });
6
+ declare const __VLS_component: import("vue").DefineComponent<{}, {
7
+ height: string;
8
+ maxHeight: string;
9
+ maxWidth: string;
10
+ width: string;
11
+ widget?: import("../core/client/types").Widget<"compiletime"> | undefined;
12
+ $props: {
13
+ readonly height?: string | undefined;
14
+ readonly maxHeight?: string | undefined;
15
+ readonly maxWidth?: string | undefined;
16
+ readonly width?: string | undefined;
17
+ readonly widget?: import("../core/client/types").Widget<"compiletime"> | undefined;
18
+ };
19
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ declare function __VLS_template(): {
21
+ default?(_: {}): any;
22
+ };
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ widgets: Omit<import("../core/client/types").Widget<"compiletime">, "layout">[];
3
+ $props: {
4
+ readonly widgets?: Omit<import("../core/client/types").Widget<"compiletime">, "layout">[] | undefined;
5
+ };
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.8",
3
+ "version": "5.0.0-processing",
4
4
  "type": "module",
5
- "types": "./core/client/types.d.ts",
6
5
  "files": [
7
6
  "core/client",
8
7
  "widgets",
@@ -10,11 +9,11 @@
10
9
  ],
11
10
  "exports": {
12
11
  ".": {
13
- "types": "./core/client/types.d.ts",
12
+ "types": "./dist/types/core/client/types.d.ts",
14
13
  "default": "./core/client/main.js"
15
14
  },
16
15
  "./webcomponent": {
17
- "types": "./core/client/asWebComponent.d.ts",
16
+ "types": "./dist/types/core/client/asWebComponent.d.ts",
18
17
  "default": "./dist/client/eo-dash.js"
19
18
  },
20
19
  "./webcomponent.css": "./dist/client/style.css",
@@ -25,12 +24,15 @@
25
24
  },
26
25
  "browser": "./core/client/main.js",
27
26
  "scripts": {
27
+ "start": "npx eodash dev --entryPoint core/client/eodash.js",
28
28
  "prepare": "rollup -c",
29
- "prepack": "npm run build:lib",
29
+ "prepack": "npm run build:lib && npm run build:types",
30
30
  "dev": "npx eodash dev --entryPoint core/client/eodash.js",
31
+ "dev:lib": "npx eodash dev --entryPoint core/client/eodash.js --lib",
31
32
  "build": "npx eodash build --entryPoint core/client/eodash.js",
32
33
  "build:lib": "npx eodash build --entryPoint core/client/eodash.js --lib --outDir dist/client",
33
34
  "build:cli": "rollup -c",
35
+ "build:types": "vue-tsc --declaration --emitDeclarationOnly && cp -rf ./core/client/types.d.ts ./dist/types/core/client/types.d.ts && tsc-alias",
34
36
  "check": "vue-tsc --noEmit --skipLibCheck && eslint .",
35
37
  "format": "prettier . --write --ignore-unknown",
36
38
  "preview": "npx eodash preview",
@@ -46,49 +48,68 @@
46
48
  "docs:generate": "typedoc --options typedoc.config.json"
47
49
  },
48
50
  "dependencies": {
49
- "@eox/itemfilter": "^0.14.1",
50
- "@eox/layout": "^0.1.0",
51
- "@eox/map": "^1.9.1",
52
- "@eox/stacinfo": "^0.3.0",
51
+ "@eox/chart": "^0.3.0",
52
+ "@eox/drawtools": "^0.13.1",
53
+ "@eox/itemfilter": "^1.6.2",
54
+ "@eox/jsonform": "^0.11.0",
55
+ "@eox/layercontrol": "^0.26.0",
56
+ "@eox/layout": "^0.3.0",
57
+ "@eox/map": "^1.17.0",
58
+ "@eox/stacinfo": "^0.6.0",
59
+ "@eox/timecontrol": "^0.10.0",
53
60
  "@mdi/js": "^7.4.47",
54
- "@vitejs/plugin-vue": "^5.0.0",
61
+ "@vitejs/plugin-vue": "^5.1.4",
62
+ "@vueuse/core": "^11.1.0",
55
63
  "animated-details": "gist:2912bb049fa906671807415eb0e87188",
56
- "axios": "^1.6.2",
57
- "commander": "^12.0.0",
58
- "core-js": "^3.29.0",
59
- "pinia": "^2.0.0",
60
- "sass": "^1.60.0",
64
+ "axios": "^1.7.7",
65
+ "axios-cache-interceptor": "^1.6.2",
66
+ "commander": "^12.1.0",
67
+ "color-legend-element": "^1.3.0",
68
+ "core-js": "^3.39.0",
69
+ "loglevel": "^1.9.2",
70
+ "pinia": "^2.2.6",
71
+ "sass": "^1.80.6",
61
72
  "stac-js": "^0.0.9",
62
- "stac-ts": "^1.0.3",
63
- "v-calendar": "^3.1.2",
64
- "vite": "^5.1.5",
65
- "vite-plugin-vuetify": "^2.0.0",
66
- "vue": "^3.2.0",
67
- "vuetify": "^3.6.5",
73
+ "v-calendar": "3.0.0",
74
+ "vega": "^5.30.0",
75
+ "vega-embed": "^6.28.0",
76
+ "vega-lite": "^5.21.0",
77
+ "vite": "^5.4.10",
78
+ "vite-plugin-vuetify": "^2.0.4",
79
+ "vue": "^3.5.0",
80
+ "vuetify": "^3.7.4",
68
81
  "webfontloader": "^1.6.28"
69
82
  },
70
83
  "devDependencies": {
71
- "@babel/types": "^7.21.4",
84
+ "@babel/types": "^7.26.0",
72
85
  "@eox/eslint-config": "^2.0.0",
73
- "@pinia/testing": "^0.1.3",
74
- "@types/node": "latest",
86
+ "@pinia/testing": "^0.1.7",
87
+ "@types/mustache": "^4.2.5",
88
+ "@types/node": "^22.9.0",
75
89
  "@types/openlayers": "^4.6.23",
76
90
  "@types/webfontloader": "^1.6.38",
77
- "cypress": "^13.13.0",
78
- "eslint": "^9.4.0",
79
- "eslint-plugin-vue": "^9.26.0",
80
- "prettier": "^3.3.2",
81
- "terminate": "^2.6.1",
82
- "typedoc": "^0.26.3",
83
- "typedoc-plugin-markdown": "^4.1.0",
84
- "typedoc-plugin-vue": "^1.1.0",
85
- "typedoc-vitepress-theme": "^1.0.0-next.0",
86
- "typescript": "^5.0.0",
87
- "unplugin-fonts": "^1.0.3",
88
- "vitepress": "^1.0.0",
89
- "vitest": "^1.4.0",
91
+ "cypress": "^13.15.2",
92
+ "eslint": "^9.14.0",
93
+ "eslint-plugin-vue": "^9.30.0",
94
+ "mustache": "^4.2.0",
95
+ "prettier": "^3.3.3",
96
+ "rollup": "^4.24.4",
97
+ "stac-ts": "^1.0.4",
98
+ "terminate": "^2.8.0",
99
+ "typedoc": "^0.27.0",
100
+ "typedoc-plugin-markdown": "^4.2.10",
101
+ "typedoc-plugin-vue": "^1.2.0",
102
+ "typedoc-vitepress-theme": "^1.0.2",
103
+ "typescript": "^5.6.3",
104
+ "unplugin-fonts": "^1.1.1",
105
+ "vitepress": "^1.5.0",
106
+ "tsc-alias": "^1.8.10",
107
+ "vitest": "^1.6.0",
90
108
  "vue-tsc": "2.0.22"
91
109
  },
110
+ "engines": {
111
+ "node": ">=20.15.1"
112
+ },
92
113
  "bin": {
93
114
  "eodash": "./dist/node/cli.js"
94
115
  }
@@ -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"
@@ -13,6 +17,11 @@
13
17
  />
14
18
  </div>
15
19
  </template>
20
+ <template #footer v-if="hintText">
21
+ <div class="w-full px-4 pb-3" style="font-size: 12px">
22
+ <span v-html="hintText" />
23
+ </div>
24
+ </template>
16
25
  </VCDatePicker>
17
26
  <v-row align="center" justify="center" style="margin-top: 6px">
18
27
  <v-btn
@@ -33,129 +42,148 @@
33
42
  </v-btn>
34
43
  </v-row>
35
44
  </template>
36
-
37
45
  <script setup>
38
46
  import { DatePicker as VCDatePicker } from "v-calendar";
39
47
  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";
48
+ import { watch, reactive, ref, customRef, onMounted } from "vue";
43
49
  import { storeToRefs } from "pinia";
44
50
  import { useSTAcStore } from "@/store/stac";
45
51
  import { datetime } from "@/store/States";
46
52
  import { mdiRayStartArrow, mdiRayEndArrow } from "@mdi/js";
47
- import { extractCollectionUrls } from "@/utils/eodashSTAC";
48
-
49
- /**
50
- * @param {boolean} reverse
51
- */
52
- function jumpDate(reverse) {
53
- if (attributes.value && attributes.value.length > 0) {
54
- // We have potentially multiple collections we need to iterate (currently only one)
55
- let latestDateMS = reverse ? Infinity : -Infinity;
56
- attributes.value.forEach((coll) => {
57
- if (coll?.dates) {
58
- coll.dates.forEach((d) => {
59
- // TODO: we need to handle time ranges and other options here
60
- if (d instanceof Date) {
61
- if (
62
- (!reverse && d.getTime() > latestDateMS) ||
63
- (reverse && d.getTime() < latestDateMS)
64
- ) {
65
- latestDateMS = d.getTime();
66
- }
67
- }
68
- });
69
- }
70
- });
71
- if (latestDateMS !== 0) {
72
- currentDate.value = new Date(latestDateMS);
73
- }
74
- }
75
- }
53
+ import { eodashCollections } from "@/utils/states";
54
+ import log from "loglevel";
76
55
 
77
- const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
56
+ // holds the number value of the datetime
57
+ const currentDate = customRef((track, trigger) => ({
58
+ get() {
59
+ track();
60
+ return new Date(datetime.value).getTime();
61
+ },
62
+ /** @param {number} num */
63
+ set(num) {
64
+ trigger();
65
+ log.debug("Datepicker setting currentDate", datetime.value);
66
+ datetime.value = new Date(num).toISOString();
67
+ },
68
+ }));
78
69
 
79
70
  const masks = ref({
80
71
  input: "YYYY-MM-DD",
81
72
  });
82
73
 
74
+ defineProps({
75
+ hintText: {
76
+ type: String,
77
+ default: null,
78
+ },
79
+ });
80
+
83
81
  /**
84
82
  * Attributes displayed on datepicker
85
83
  *
86
- * @type {import("vue").Ref<
84
+ * @type {import("vue").Reactive<
87
85
  * (
88
- * | import("v-calendar/dist/types/src/utils/attribute").AttributeConfig
86
+ * | Partial<import("v-calendar/dist/types/src/utils/attribute").AttributeConfig>
89
87
  * | undefined
90
88
  * )[]
91
89
  * >}
92
90
  */
93
- const attributes = ref([]);
91
+ const attributes = reactive([]);
94
92
 
95
- const currentDate = computed({
96
- get() {
97
- return datetime.value ? new Date(datetime.value) : new Date();
98
- },
99
- /** @param {Date | string} updatedDate */
100
- set(updatedDate) {
101
- if (updatedDate instanceof Date && !isNaN(updatedDate.getTime())) {
102
- datetime.value = new Date(
103
- updatedDate.getTime() - updatedDate.getTimezoneOffset() * 60000,
104
- ).toISOString();
105
- } else {
106
- datetime.value = new Date().toISOString();
107
- }
108
- },
109
- });
110
- /** @type {import("@/types").WebComponentProps["onMounted"]} */
111
- onMounted(() => {
112
- const { selectedStac } = storeToRefs(useSTAcStore());
113
- watch(
114
- [selectedStac],
115
- async ([updatedStac]) => {
116
- if (updatedStac) {
117
- const parentCollUrl = toAbsolute(
118
- `./${updatedStac.id}/collection.json`,
119
- eodashConfig.stacEndpoint,
120
- );
121
- const collectionUrls = extractCollectionUrls(
122
- selectedStac.value,
123
- parentCollUrl,
124
- );
125
- const wongPalette = [
126
- "#009E73",
127
- "#0072B2",
128
- "#E69F00",
129
- "#CC79A7",
130
- "#56B4E9",
131
- "#D55E00",
93
+ const { selectedStac } = storeToRefs(useSTAcStore());
94
+
95
+ watch(
96
+ selectedStac,
97
+ async (updatedStac, previousStac) => {
98
+ if (updatedStac && previousStac?.id !== updatedStac.id) {
99
+ log.debug("Datepicker selected STAC change triggered");
100
+ const wongPalette = [
101
+ "#009E73",
102
+ "#0072B2",
103
+ "#E69F00",
104
+ "#CC79A7",
105
+ "#56B4E9",
106
+ "#D55E00",
107
+ ];
108
+ // remove old values
109
+ attributes.splice(0, attributes.length);
110
+
111
+ for (let idx = 0; idx < eodashCollections.length; idx++) {
112
+ log.debug("Retrieving dates", eodashCollections[idx]);
113
+ await eodashCollections[idx].fetchCollection();
114
+ const dates = [
115
+ ...new Set(
116
+ eodashCollections[idx].getItems()?.reduce((valid, it) => {
117
+ const parsed = Date.parse(/** @type {string} */ (it.datetime));
118
+ if (parsed) {
119
+ valid.push(new Date(parsed));
120
+ }
121
+ return valid;
122
+ }, /** @type {Date[]} */ ([])),
123
+ ),
132
124
  ];
133
- for (let idx = 0; idx < collectionUrls.length; idx++) {
134
- const stacCollection = await (
135
- await fetch(collectionUrls[idx])
136
- ).json();
137
- const dates = stacCollection.links
138
- .filter(
139
- (/** @type {{ rel: string; datetime: string }} */ item) =>
140
- item.rel === "item" && "datetime" in item,
141
- )
142
- .map(
143
- (/** @type {{ datetime: string }} */ it) => new Date(it.datetime),
144
- );
145
- attributes.value = [
146
- {
147
- bar: {
148
- style: {
149
- backgroundColor: wongPalette[idx % wongPalette.length],
150
- },
151
- },
152
- dates,
125
+ attributes.push({
126
+ key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
127
+ bar: {
128
+ style: {
129
+ backgroundColor: wongPalette[idx % wongPalette.length],
153
130
  },
154
- ];
155
- }
131
+ },
132
+ dates,
133
+ content: {
134
+ style: {
135
+ color: "#000000",
136
+ "font-weight": "bold",
137
+ },
138
+ },
139
+ });
156
140
  }
157
- },
158
- { immediate: true },
159
- );
141
+ }
142
+ },
143
+ { immediate: true },
144
+ );
145
+
146
+ /**
147
+ * @param {boolean} reverse
148
+ */
149
+ function jumpDate(reverse) {
150
+ if (attributes.length) {
151
+ let latestDateMS = reverse ? Infinity : -Infinity;
152
+ attributes.forEach((coll) => {
153
+ if (coll?.dates) {
154
+ coll.dates.forEach((d) => {
155
+ // TODO: we need to handle time ranges and other options here
156
+ if (d instanceof Date) {
157
+ const mathFun = reverse ? "min" : "max";
158
+ latestDateMS = Math[mathFun](latestDateMS, d.getTime());
159
+ }
160
+ });
161
+ }
162
+ });
163
+ currentDate.value =
164
+ latestDateMS === -Infinity
165
+ ? Date.now()
166
+ : latestDateMS === Infinity
167
+ ? 0
168
+ : latestDateMS;
169
+ }
170
+ }
171
+
172
+ // fixes calendar dispalcement on lib mode
173
+ const transform = ref("");
174
+ onMounted(() => {
175
+ transform.value = document.querySelector("eo-dash")
176
+ ? "translate3d(50px,-80px,0)"
177
+ : "translate3d(0px,-80px,0)";
160
178
  });
161
179
  </script>
180
+ <style>
181
+ .vc-day-content {
182
+ color: #5e5e5e;
183
+ font-weight: normal;
184
+ }
185
+
186
+ .vc-popover-content-wrapper {
187
+ transform: v-bind("transform") !important;
188
+ }
189
+ </style>
@@ -1,45 +1,162 @@
1
1
  <template>
2
- <DynamicWebComponent
3
- :link="link"
4
- tag-name="eox-itemfilter"
5
- :properties="properties"
6
- :on-mounted="onMounted"
7
- />
2
+ <eox-itemfilter
3
+ class="fill-height"
4
+ v-bind="config"
5
+ ref="eoxItemFilter"
6
+ style="overflow: auto"
7
+ @select="onSelect"
8
+ >
9
+ <h4 slot="filterstitle" style="margin: 14px 8px">{{ filtersTitle }}</h4>
10
+
11
+ <h4 slot="resultstitle" style="margin: 14px 8px">{{ resultsTitle }}</h4>
12
+ </eox-itemfilter>
8
13
  </template>
9
14
  <script setup>
10
- import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
15
+ import { useSTAcStore } from "@/store/stac";
16
+ import "@eox/itemfilter";
17
+ import { onMounted, ref } from "vue";
11
18
 
12
- const link = () => import("@eox/itemfilter");
19
+ const props = defineProps({
20
+ enableCompare: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
24
+ filtersTitle: {
25
+ type: String,
26
+ default: "Indicators",
27
+ },
28
+ resultsTitle: {
29
+ type: String,
30
+ default: "",
31
+ },
32
+ titleProperty: {
33
+ type: String,
34
+ default: "title",
35
+ },
13
36
 
14
- const properties = {
15
- config: {
16
- titleProperty: "title",
17
- filterProperties: [
37
+ aggregateResults: {
38
+ type: String,
39
+ default: "themes",
40
+ },
41
+ enableHighlighting: { type: Boolean, default: true },
42
+ expandMultipleFilters: { type: Boolean, default: true },
43
+ expandMultipleResults: { type: Boolean, default: true },
44
+ filterProperties: {
45
+ /** @type {import("vue").PropType<{
46
+ * keys:string[];
47
+ * title:string;
48
+ * type:string;
49
+ * expanded?:boolean
50
+ * }[]> }*/
51
+ type: Array,
52
+ default: () => [
18
53
  {
19
- keys: ["title", "themes"],
54
+ keys: ["title", "themes", "description"],
20
55
  title: "Search",
21
56
  type: "text",
22
- // expanded: true,
23
57
  },
24
58
  {
25
59
  key: "themes",
26
60
  title: "Theme Filter",
27
61
  type: "multiselect",
28
- // featured: true,
29
- // expanded: true
30
62
  },
31
63
  ],
32
- aggregateResults: "themes",
33
- enableHighlighting: true,
34
- expandMultipleFilters: false,
35
- expandMultipleResults: false,
36
64
  },
65
+ });
66
+ /** @param {any} evt*/
67
+ const onSelect = async (evt) => {
68
+ // reset the style of all compare buttons
69
+ eoxItemFilter.value?.shadowRoot
70
+ ?.querySelectorAll(".compareMapButton")
71
+ .forEach((res) => res.setAttribute("style", defaultStyle));
72
+ const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
73
+ if (item) {
74
+ // Reset compare stac to empty
75
+ store.resetSelectedCompareSTAC();
76
+ await store.loadSelectedSTAC(item.href);
77
+ } else {
78
+ // TODO: it is possible to unselect items now
79
+ // we need to consider how to reset to "default"
80
+ // if that happens here
81
+ }
82
+ };
83
+ const config = {
84
+ titleProperty: props.titleProperty,
85
+ filterProperties: props.filterProperties,
86
+ aggregateResults: props.aggregateResults,
87
+ enableHighlighting: props.enableHighlighting,
88
+ expandMultipleFilters: props.expandMultipleFilters,
89
+ expandMultipleResults: props.expandMultipleResults,
37
90
  };
91
+ /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
92
+ const eoxItemFilter = ref(null);
38
93
 
39
- /** @type {import("@/types").WebComponentProps["onMounted"]} */
40
- const onMounted = (el, store) => {
41
- /** @type {any} */ (el).style.height = "100%";
94
+ const store = useSTAcStore();
42
95
 
96
+ const defaultStyle =
97
+ "float:right; height:15px; padding:4px; margin-top:-4px; background-color:white;";
98
+ const highlightStyle =
99
+ "float:right; height:15px; padding:4px; margin-top:-4px; background-color:#9bcaeb;";
100
+
101
+ const injectCompareButtons = () => {
102
+ setTimeout(() => {
103
+ /** @type {any} */
104
+ (eoxItemFilter.value)?.shadowRoot
105
+ .querySelectorAll("details>summary")
106
+ .forEach((/** @type {HTMLElement} */ el) =>
107
+ el.setAttribute("style", "width: 100%"),
108
+ );
109
+ /** @type {any} */
110
+ (eoxItemFilter.value)?.shadowRoot
111
+ .querySelectorAll("details>div li")
112
+ .forEach((/** @type {HTMLElement} */ res) => {
113
+ let compareButton = document.createElement("button");
114
+ compareButton.className = "compareMapButton";
115
+ compareButton.dataset.id = res.children[0].id;
116
+
117
+ compareButton.onclick = async (
118
+ /** {Event & { currentTarget: HTMLElement }} */ evt,
119
+ ) => {
120
+ // reset the style of all compare buttons
121
+ eoxItemFilter.value?.shadowRoot
122
+ ?.querySelectorAll(".compareMapButton")
123
+ .forEach((res) => {
124
+ res.setAttribute("style", defaultStyle);
125
+ });
126
+ const currentTarget = /** @type {HTMLElement}*/ (evt.currentTarget);
127
+ currentTarget?.setAttribute("style", highlightStyle);
128
+ const selected = eoxItemFilter.value?.items.find(
129
+ (/** @type {HTMLElement} */ it) =>
130
+ it.id === currentTarget?.dataset.id,
131
+ );
132
+ if (selected) {
133
+ await store.loadSelectedCompareSTAC(selected.href);
134
+ }
135
+ };
136
+ compareButton.setAttribute("style", defaultStyle);
137
+ const svgIcon = document.createElementNS(
138
+ "http://www.w3.org/2000/svg",
139
+ "svg",
140
+ );
141
+ const iconPath = document.createElementNS(
142
+ "http://www.w3.org/2000/svg",
143
+ "path",
144
+ );
145
+ svgIcon.setAttribute("width", "15");
146
+ svgIcon.setAttribute("height", "15");
147
+ svgIcon.setAttribute("viewBox", "0 0 24 24");
148
+ iconPath.setAttribute(
149
+ "d",
150
+ "M19,3H14V5H19V18L14,12V21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,18H5L10,12M10,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H10V23H12V1H10V3Z",
151
+ );
152
+ svgIcon.appendChild(iconPath);
153
+ compareButton.appendChild(svgIcon);
154
+ res.append(compareButton);
155
+ });
156
+ }, 100);
157
+ };
158
+
159
+ onMounted(() => {
43
160
  const style = document.createElement("style");
44
161
  style.innerHTML = `
45
162
  section {
@@ -51,29 +168,14 @@ const onMounted = (el, store) => {
51
168
  right: 8px;
52
169
  }
53
170
  `;
54
- el?.shadowRoot?.appendChild(style);
55
-
56
- const filterstitle = document.createElement("div");
57
- filterstitle.setAttribute("slot", "filterstitle");
58
- filterstitle.innerHTML = `<h4 style="margin: 14px 8px">Indicators</h4>`;
59
- /** @type {any} */ (el).appendChild(filterstitle);
60
- const resultstitle = document.createElement("div");
61
- resultstitle.setAttribute("slot", "resultstitle");
62
- /** @type {any} */ (el).appendChild(resultstitle);
171
+ eoxItemFilter.value?.shadowRoot?.appendChild(style);
63
172
 
64
- /**
65
- * @typedef {object} Item
66
- * @property {string} href
67
- */
68
- /** @type {any} */ (el).apply(
69
- // Only list child elements in list
70
- store.stac?.filter((item) => item.rel === "child"),
71
- );
72
- /** @type {any} */ (el).config.onSelect =
73
- /** @param {Item} item */
74
- async (item) => {
75
- console.log(item);
76
- await store.loadSelectedSTAC(item.href);
77
- };
78
- };
173
+ // Only list child elements in list
174
+ const items = store.stac?.filter((item) => item.rel === "child");
175
+ /** @type {any} */
176
+ (eoxItemFilter.value).items = items;
177
+ if (props.enableCompare) {
178
+ injectCompareButtons();
179
+ }
180
+ });
79
181
  </script>