@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-rc

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 (113) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -4
  4. package/core/client/components/DashboardLayout.vue +36 -14
  5. package/core/client/components/Loading.vue +6 -9
  6. package/core/client/components/MobileLayout.vue +16 -14
  7. package/core/client/composables/DefineEodash.js +14 -4
  8. package/core/client/composables/DefineTemplate.js +67 -0
  9. package/core/client/composables/DefineWidgets.js +3 -2
  10. package/core/client/composables/EodashMap.js +360 -0
  11. package/core/client/composables/EodashProcess.js +574 -0
  12. package/core/client/composables/index.js +136 -28
  13. package/core/client/eodash.js +395 -80
  14. package/core/client/eodashSTAC/EodashCollection.js +432 -0
  15. package/core/client/eodashSTAC/createLayers.js +315 -0
  16. package/core/client/eodashSTAC/helpers.js +375 -0
  17. package/core/client/eodashSTAC/triggers.js +43 -0
  18. package/core/client/plugins/axios.js +8 -0
  19. package/core/client/plugins/index.js +2 -1
  20. package/core/client/plugins/vuetify.js +2 -1
  21. package/core/client/store/actions.js +79 -0
  22. package/core/client/store/index.js +4 -18
  23. package/core/client/store/stac.js +99 -9
  24. package/core/client/store/states.js +37 -0
  25. package/core/client/{types.d.ts → types.ts} +66 -20
  26. package/core/client/utils/keys.js +2 -0
  27. package/core/client/utils/states.js +22 -0
  28. package/core/client/views/Dashboard.vue +22 -49
  29. package/core/client/vite-env.d.ts +2 -10
  30. package/dist/client/DashboardLayout-232tRmjz.js +84 -0
  31. package/dist/client/DynamicWebComponent-Cl4LqHU6.js +88 -0
  32. package/dist/client/EodashDatePicker-Pok6bZwU.js +306 -0
  33. package/dist/client/EodashItemFilter-16eMMjTV.js +151 -0
  34. package/dist/client/EodashLayerControl-De7IlCm_.js +120 -0
  35. package/dist/client/EodashLayoutSwitcher-C-3-jjn5.js +52 -0
  36. package/dist/client/EodashMap-CMvbfI6-.js +549 -0
  37. package/dist/client/EodashMapBtns-BeknGDtc.js +107 -0
  38. package/dist/client/EodashProcess-BwKAa9Ee.js +1476 -0
  39. package/dist/client/EodashStacInfo-_BfonNUG.js +85 -0
  40. package/dist/client/EodashTools-PD3XPYuR.js +103 -0
  41. package/dist/client/ExportState-DOrT7M15.js +644 -0
  42. package/dist/client/Footer-CCigxYBo.js +141 -0
  43. package/dist/client/Header-C2cdx4gb.js +437 -0
  44. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  45. package/dist/client/MobileLayout-BdiFjHg7.js +1207 -0
  46. package/dist/client/PopUp--_xn1Cms.js +410 -0
  47. package/dist/client/VImg-9xu2l99m.js +384 -0
  48. package/dist/client/VMain-BUs3kDTd.js +43 -0
  49. package/dist/client/VOverlay-D89omJis.js +1453 -0
  50. package/dist/client/VTooltip-CDu3bErh.js +86 -0
  51. package/dist/client/WidgetsContainer-aFG9yFT6.js +83 -0
  52. package/dist/client/asWebComponent-BRGyP_j5.js +11943 -0
  53. package/dist/client/{style.css → eo-dash.css} +2 -2
  54. package/dist/client/eo-dash.js +2 -6
  55. package/dist/client/forwardRefs-CYrR6bMw.js +245 -0
  56. package/dist/client/index-BZwk0V42.js +199 -0
  57. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  58. package/dist/client/transition-DG9nRSW4.js +37 -0
  59. package/dist/node/cli.js +4 -4
  60. package/dist/node/types.d.ts +2 -0
  61. package/package.json +73 -38
  62. package/widgets/EodashDatePicker.vue +176 -134
  63. package/widgets/EodashItemFilter.vue +79 -38
  64. package/widgets/EodashLayerControl.vue +111 -0
  65. package/widgets/EodashLayoutSwitcher.vue +36 -0
  66. package/widgets/EodashMap.vue +108 -133
  67. package/widgets/EodashMapBtns.vue +62 -8
  68. package/widgets/EodashProcess.vue +143 -0
  69. package/widgets/EodashStacInfo.vue +82 -0
  70. package/widgets/EodashTools.vue +83 -0
  71. package/widgets/ExportState.vue +17 -13
  72. package/widgets/PopUp.vue +24 -2
  73. package/core/client/SuspensedDashboard.ce.vue +0 -105
  74. package/core/client/asWebComponent.d.ts +0 -23
  75. package/core/client/store/Actions.js +0 -14
  76. package/core/client/store/States.js +0 -16
  77. package/core/client/utils/eodashSTAC.js +0 -249
  78. package/core/client/utils/helpers.js +0 -38
  79. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  80. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  81. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  82. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  83. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  84. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  85. package/dist/client/ExportState-CCzOhppU.js +0 -558
  86. package/dist/client/Footer-BPAND0yG.js +0 -115
  87. package/dist/client/Header-DLhebNvG.js +0 -350
  88. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  89. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  90. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  91. package/dist/client/VImg-DxHcztfM.js +0 -291
  92. package/dist/client/VMain-BLX5vRRn.js +0 -39
  93. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  94. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  95. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  96. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  97. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  98. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  99. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  100. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  101. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  102. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  103. package/dist/client/index-Q-bHLjxx.js +0 -153
  104. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  105. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  106. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  107. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  108. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  109. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  110. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  111. package/dist/client/transition-CSJhuYGK.js +0 -34
  112. package/dist/client/webfontloader-qotgY98I.js +0 -435
  113. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
package/package.json CHANGED
@@ -1,23 +1,36 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.2.9",
3
+ "version": "5.0.0-rc",
4
4
  "type": "module",
5
- "types": "./core/client/types.d.ts",
5
+ "types": "./dist/types/core/client/types.d.ts",
6
6
  "files": [
7
7
  "core/client",
8
8
  "widgets",
9
9
  "dist"
10
10
  ],
11
+ "typesVersions": {
12
+ "*": {
13
+ ".": [
14
+ "./dist/types/core/client/types.d.ts"
15
+ ],
16
+ "webcomponent": [
17
+ "./dist/types/core/client/asWebComponent.d.ts"
18
+ ],
19
+ "config": [
20
+ "./dist/node/types.d.ts"
21
+ ]
22
+ }
23
+ },
11
24
  "exports": {
12
25
  ".": {
13
- "types": "./core/client/types.d.ts",
26
+ "types": "./dist/types/core/client/types.d.ts",
14
27
  "default": "./core/client/main.js"
15
28
  },
16
29
  "./webcomponent": {
17
- "types": "./core/client/asWebComponent.d.ts",
30
+ "types": "./dist/types/core/client/asWebComponent.d.ts",
18
31
  "default": "./dist/client/eo-dash.js"
19
32
  },
20
- "./webcomponent.css": "./dist/client/style.css",
33
+ "./webcomponent.css": "./dist/client/eo-dash.css",
21
34
  "./config": {
22
35
  "types": "./dist/node/types.d.ts",
23
36
  "default": "./dist/node/main.js"
@@ -25,12 +38,15 @@
25
38
  },
26
39
  "browser": "./core/client/main.js",
27
40
  "scripts": {
41
+ "start": "npx eodash dev --entryPoint core/client/eodash.js",
28
42
  "prepare": "rollup -c",
29
- "prepack": "npm run build:lib",
43
+ "prepack": "npm run build:lib && npm run build:types",
30
44
  "dev": "npx eodash dev --entryPoint core/client/eodash.js",
45
+ "dev:lib": "npx eodash dev --entryPoint core/client/eodash.js --lib",
31
46
  "build": "npx eodash build --entryPoint core/client/eodash.js",
32
47
  "build:lib": "npx eodash build --entryPoint core/client/eodash.js --lib --outDir dist/client",
33
48
  "build:cli": "rollup -c",
49
+ "build:types": "vue-tsc --declaration --emitDeclarationOnly && tsc-alias",
34
50
  "check": "vue-tsc --noEmit --skipLibCheck && eslint .",
35
51
  "format": "prettier . --write --ignore-unknown",
36
52
  "preview": "npx eodash preview",
@@ -46,49 +62,68 @@
46
62
  "docs:generate": "typedoc --options typedoc.config.json"
47
63
  },
48
64
  "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",
65
+ "@eox/chart": "^0.3.0",
66
+ "@eox/drawtools": "^0.13.2",
67
+ "@eox/itemfilter": "^1.7.0",
68
+ "@eox/jsonform": "0.11.3-dev.1734708668.0",
69
+ "@eox/layercontrol": "^0.28.0",
70
+ "@eox/layout": "^0.3.0",
71
+ "@eox/map": "^1.19.0",
72
+ "@eox/stacinfo": "^0.6.0",
73
+ "@eox/timecontrol": "^0.12.0",
53
74
  "@mdi/js": "^7.4.47",
54
- "@vitejs/plugin-vue": "^5.0.0",
75
+ "@vitejs/plugin-vue": "^5.2.1",
76
+ "@vueuse/core": "^12.0.0",
55
77
  "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",
78
+ "axios": "^1.7.9",
79
+ "axios-cache-interceptor": "^1.6.2",
80
+ "color-legend-element": "^1.3.0",
81
+ "commander": "^12.1.0",
82
+ "core-js": "^3.39.0",
83
+ "loglevel": "^1.9.2",
84
+ "pinia": "^2.3.0",
85
+ "sass": "^1.83.0",
61
86
  "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",
87
+ "v-calendar": "3.0.0",
88
+ "vega": "^5.30.0",
89
+ "vega-embed": "^6.29.0",
90
+ "vega-lite": "^5.23.0",
91
+ "vite": "^6.0.5",
92
+ "vite-plugin-vuetify": "^2.0.4",
93
+ "vue": "^3.5.0",
94
+ "vuetify": "^3.7.6",
68
95
  "webfontloader": "^1.6.28"
69
96
  },
70
97
  "devDependencies": {
71
- "@babel/types": "^7.21.4",
98
+ "@babel/types": "^7.26.3",
72
99
  "@eox/eslint-config": "^2.0.0",
73
- "@pinia/testing": "^0.1.3",
74
- "@types/node": "latest",
100
+ "@pinia/testing": "^0.1.7",
101
+ "@types/mustache": "^4.2.5",
102
+ "@types/node": "^22.10.2",
75
103
  "@types/openlayers": "^4.6.23",
76
104
  "@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",
105
+ "cypress": "^13.17.0",
106
+ "eslint": "^9.17.0",
107
+ "eslint-plugin-vue": "^9.32.0",
108
+ "mustache": "^4.2.0",
109
+ "prettier": "^3.4.2",
110
+ "rollup": "^4.28.1",
111
+ "stac-ts": "^1.0.4",
112
+ "terminate": "^2.8.0",
113
+ "tsc-alias": "^1.8.10",
114
+ "typedoc": "^0.27.5",
115
+ "typedoc-plugin-markdown": "^4.3.3",
116
+ "typedoc-plugin-vue": "^1.3.0",
117
+ "typedoc-vitepress-theme": "^1.1.1",
118
+ "typescript": "^5.7.2",
119
+ "unplugin-fonts": "^1.3.1",
120
+ "vitepress": "^1.5.0",
121
+ "vitest": "^1.6.0",
90
122
  "vue-tsc": "2.0.22"
91
123
  },
124
+ "engines": {
125
+ "node": ">=20.15.1"
126
+ },
92
127
  "bin": {
93
128
  "eodash": "./dist/node/cli.js"
94
129
  }
@@ -1,161 +1,203 @@
1
1
  <template>
2
- <VCDatePicker v-model="currentDate" :masks="masks" :attributes="attributes">
3
- <template #default="{ inputValue, inputEvents }">
4
- <div
5
- class="flex rounded-lg border border-gray-300 dark:border-gray-600"
6
- style="margin: 2px"
7
- >
8
- <input
9
- :value="inputValue"
10
- v-on="inputEvents"
11
- style="margin: 1px"
12
- class="flex-grow px-1 py-1 bg-white dark:bg-gray-700"
13
- />
14
- </div>
15
- </template>
16
- </VCDatePicker>
17
- <v-row align="center" justify="center" style="margin-top: 6px">
18
- <v-btn
19
- style="padding: 0px; margin-right: 4px"
20
- density="compact"
21
- v-tooltip:bottom="'Set date to oldest available dataset'"
22
- @click="jumpDate(true)"
2
+ <div ref="rootRef" class="datePicker">
3
+ <VCDatePicker
4
+ v-model.number="currentDate"
5
+ :attributes="attributes"
6
+ :masks="masks"
7
+ expanded
8
+ class="bg-surface overflow-auto"
9
+ style="background-color: transparent; max-width: 100%"
23
10
  >
24
- <v-icon :icon="[mdiRayEndArrow]" />
25
- </v-btn>
26
- <v-btn
27
- style="padding: 0px; margin-left: 4px"
28
- density="compact"
29
- v-tooltip:bottom="'Set date to latest available dataset'"
30
- @click="jumpDate(false)"
31
- >
32
- <v-icon :icon="[mdiRayStartArrow]" />
33
- </v-btn>
34
- </v-row>
11
+ <template #footer>
12
+ <div class="d-flex flex-row align-center justify-center pb-1">
13
+ <v-btn
14
+ v-if="!hideArrows"
15
+ density="compact"
16
+ v-tooltip:bottom="'Set date to oldest available dataset'"
17
+ variant="text"
18
+ @click="jumpDate(true)"
19
+ >
20
+ <v-icon :icon="[mdiRayEndArrow]" />
21
+ </v-btn>
22
+ <div
23
+ class="flex rounded-lg border border-gray-300 dark:border-gray-600"
24
+ style="margin: 2px"
25
+ >
26
+ <input
27
+ v-if="!hideInputField"
28
+ :value="new Date(currentDate).toLocaleDateString()"
29
+ style="margin: 1px"
30
+ class="flex-grow px-1 py-1 dark:bg-gray-700"
31
+ />
32
+ </div>
33
+ <v-btn
34
+ v-if="!hideArrows"
35
+ density="compact"
36
+ variant="text"
37
+ v-tooltip:bottom="'Set date to latest available dataset'"
38
+ @click="jumpDate(false)"
39
+ >
40
+ <v-icon :icon="[mdiRayStartArrow]" />
41
+ </v-btn>
42
+ </div>
43
+ </template>
44
+ </VCDatePicker>
45
+ </div>
35
46
  </template>
36
-
37
47
  <script setup>
38
48
  import { DatePicker as VCDatePicker } from "v-calendar";
39
49
  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";
43
- import { storeToRefs } from "pinia";
50
+ import { watch, reactive, ref, customRef, toRef } from "vue";
44
51
  import { useSTAcStore } from "@/store/stac";
45
- import { datetime } from "@/store/States";
52
+ import { datetime } from "@/store/states";
46
53
  import { mdiRayStartArrow, mdiRayEndArrow } from "@mdi/js";
47
- import { extractCollectionUrls } from "@/utils/eodashSTAC";
54
+ import { eodashCollections } from "@/utils/states";
55
+ import log from "loglevel";
56
+ import { makePanelTransparent } from "@/composables";
48
57
 
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
- }
76
-
77
- const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
58
+ // holds the number value of the datetime
59
+ const currentDate = customRef((track, trigger) => ({
60
+ get() {
61
+ track();
62
+ return new Date(datetime.value).getTime();
63
+ },
64
+ /** @param {number} num */
65
+ set(num) {
66
+ trigger();
67
+ log.debug("Datepicker setting currentDate", datetime.value);
68
+ datetime.value = new Date(num).toISOString();
69
+ },
70
+ }));
78
71
 
79
72
  const masks = ref({
80
73
  input: "YYYY-MM-DD",
81
74
  });
82
75
 
76
+ defineProps({
77
+ hintText: {
78
+ type: String,
79
+ default: null,
80
+ },
81
+ hideArrows: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ hideInputField: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+ });
90
+
83
91
  /**
84
92
  * Attributes displayed on datepicker
85
93
  *
86
- * @type {import("vue").Ref<
94
+ * @type {import("vue").Reactive<
87
95
  * (
88
- * | import("v-calendar/dist/types/src/utils/attribute").AttributeConfig
96
+ * | Partial<import("v-calendar/dist/types/src/utils/attribute").AttributeConfig>
89
97
  * | undefined
90
98
  * )[]
91
99
  * >}
92
100
  */
93
- const attributes = ref([]);
101
+ const attributes = reactive([]);
94
102
 
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",
103
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
104
+ const rootRef = ref(null);
105
+
106
+ const selectedStac = toRef(useSTAcStore(), "selectedStac");
107
+
108
+ watch(
109
+ selectedStac,
110
+ async (updatedStac, previousStac) => {
111
+ if (updatedStac && previousStac?.id !== updatedStac.id) {
112
+ log.debug("Datepicker selected STAC change triggered");
113
+ const wongPalette = [
114
+ "#009E73",
115
+ "#0072B2",
116
+ "#E69F00",
117
+ "#CC79A7",
118
+ "#56B4E9",
119
+ "#D55E00",
120
+ ];
121
+ // remove old values
122
+ attributes.splice(0, attributes.length);
123
+
124
+ for (let idx = 0; idx < eodashCollections.length; idx++) {
125
+ log.debug("Retrieving dates", eodashCollections[idx]);
126
+ await eodashCollections[idx].fetchCollection();
127
+ const dates = [
128
+ ...new Set(
129
+ eodashCollections[idx].getItems()?.reduce((valid, it) => {
130
+ const parsed = Date.parse(/** @type {string} */ (it.datetime));
131
+ if (parsed) {
132
+ valid.push(new Date(parsed));
133
+ }
134
+ return valid;
135
+ }, /** @type {Date[]} */ ([])),
136
+ ),
132
137
  ];
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,
138
+ attributes.push({
139
+ key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
140
+ bar: {
141
+ style: {
142
+ backgroundColor: wongPalette[idx % wongPalette.length],
153
143
  },
154
- ];
155
- }
144
+ },
145
+ dates,
146
+ content: {
147
+ style: {
148
+ color: "#000000",
149
+ "font-weight": "bold",
150
+ },
151
+ },
152
+ });
156
153
  }
157
- },
158
- { immediate: true },
159
- );
160
- });
154
+ }
155
+ },
156
+ { immediate: true },
157
+ );
158
+
159
+ /**
160
+ * @param {boolean} reverse
161
+ */
162
+ function jumpDate(reverse) {
163
+ if (attributes.length) {
164
+ let latestDateMS = reverse ? Infinity : -Infinity;
165
+ attributes.forEach((coll) => {
166
+ if (coll?.dates) {
167
+ coll.dates.forEach((d) => {
168
+ // TODO: we need to handle time ranges and other options here
169
+ if (d instanceof Date) {
170
+ const mathFun = reverse ? "min" : "max";
171
+ latestDateMS = Math[mathFun](latestDateMS, d.getTime());
172
+ }
173
+ });
174
+ }
175
+ });
176
+ currentDate.value =
177
+ latestDateMS === -Infinity
178
+ ? Date.now()
179
+ : latestDateMS === Infinity
180
+ ? 0
181
+ : latestDateMS;
182
+ }
183
+ }
184
+
185
+ makePanelTransparent(rootRef);
161
186
  </script>
187
+ <style>
188
+ @media (min-width: 960px) {
189
+ .datePicker {
190
+ position: absolute;
191
+ bottom: 0;
192
+ width: 100%;
193
+ }
194
+ }
195
+ .vc-day-content {
196
+ color: #5e5e5e;
197
+ font-weight: normal;
198
+ }
199
+
200
+ .vc-highlight-content-solid {
201
+ color: white !important;
202
+ }
203
+ </style>
@@ -1,5 +1,12 @@
1
1
  <template>
2
- <eox-itemfilter class="fill-height" :config="config" ref="eoxItemFilter">
2
+ <eox-itemfilter
3
+ class="fill-height"
4
+ v-bind="config"
5
+ ref="eoxItemFilter"
6
+ style="overflow: auto; --background-color: none"
7
+ @select="onSelect"
8
+ .items='store.stac?.filter((item) => item.rel === "child")'
9
+ >
3
10
  <h4 slot="filterstitle" style="margin: 14px 8px">{{ filtersTitle }}</h4>
4
11
 
5
12
  <h4 slot="resultstitle" style="margin: 14px 8px">{{ resultsTitle }}</h4>
@@ -8,29 +15,52 @@
8
15
  <script setup>
9
16
  import { useSTAcStore } from "@/store/stac";
10
17
  import "@eox/itemfilter";
11
- import { onMounted, ref } from "vue";
18
+
19
+ import { computed, ref } from "vue";
20
+ import { useDisplay } from "vuetify/lib/framework.mjs";
21
+
22
+ const emit = defineEmits(["select"]);
12
23
 
13
24
  const props = defineProps({
25
+ enableCompare: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
14
29
  filtersTitle: {
15
30
  type: String,
16
31
  default: "Indicators",
17
32
  },
18
33
  resultsTitle: {
19
34
  type: String,
20
- default: "",
35
+ default: "Results",
21
36
  },
22
37
  titleProperty: {
23
38
  type: String,
24
39
  default: "title",
25
40
  },
26
-
27
41
  aggregateResults: {
28
42
  type: String,
29
- default: "themes",
43
+ default: undefined,
44
+ },
45
+ imageProperty: {
46
+ type: String,
47
+ default: "",
48
+ },
49
+ subTitleProperty: {
50
+ type: String,
51
+ default: "",
52
+ },
53
+ resultType: {
54
+ type: String,
55
+ default: "",
56
+ },
57
+ cssVars: {
58
+ type: [String, Object],
59
+ default: "",
30
60
  },
31
61
  enableHighlighting: { type: Boolean, default: true },
32
- expandMultipleFilters: { type: Boolean, default: false },
33
- expandMultipleResults: { type: Boolean, default: false },
62
+ expandMultipleFilters: { type: Boolean, default: true },
63
+ expandMultipleResults: { type: Boolean, default: true },
34
64
  filterProperties: {
35
65
  /** @type {import("vue").PropType<{
36
66
  * keys:string[];
@@ -53,43 +83,54 @@ const props = defineProps({
53
83
  ],
54
84
  },
55
85
  });
56
-
57
- const config = {
86
+ /**
87
+ * @param {import("stac-ts").StacLink} item
88
+ */
89
+ const selectIndicator = async (item) => {
90
+ if (item) {
91
+ // Reset compare stac to empty
92
+ store.resetSelectedCompareSTAC();
93
+ await store.loadSelectedSTAC(item.href);
94
+ emit("select", item);
95
+ } else {
96
+ store.selectedStac = null;
97
+ }
98
+ };
99
+ /**
100
+ * @param {import("stac-ts").StacLink} item
101
+ */
102
+ const selectCompareIndicator = (item) => {
103
+ if (item) {
104
+ store.loadSelectedCompareSTAC(item.href);
105
+ emit("select", item);
106
+ } else {
107
+ // TODO
108
+ }
109
+ };
110
+ /** @param {any} evt*/
111
+ const onSelect = async (evt) => {
112
+ const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
113
+ if (props.enableCompare) {
114
+ selectCompareIndicator(item);
115
+ } else {
116
+ selectIndicator(item);
117
+ }
118
+ };
119
+ const { smAndDown } = useDisplay();
120
+ const config = computed(() => ({
58
121
  titleProperty: props.titleProperty,
59
- filterProperties: props.filterProperties,
60
- aggregateResults: props.aggregateResults,
61
122
  enableHighlighting: props.enableHighlighting,
62
123
  expandMultipleFilters: props.expandMultipleFilters,
63
124
  expandMultipleResults: props.expandMultipleResults,
64
- };
125
+ subTitleProperty: props.subTitleProperty,
126
+ resultType: props.resultType,
127
+ imageProperty: props.imageProperty,
128
+ aggregateResults: props.aggregateResults,
129
+ style: props.cssVars,
130
+ filterProperties: smAndDown.value ? "" : props.filterProperties,
131
+ }));
65
132
  /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
66
133
  const eoxItemFilter = ref(null);
67
134
 
68
135
  const store = useSTAcStore();
69
-
70
- onMounted(() => {
71
- const style = document.createElement("style");
72
- style.innerHTML = `
73
- section {
74
- margin: 0 !important;
75
- }
76
- section button#filter-reset {
77
- padding: 0 8px;
78
- top: 8px;
79
- right: 8px;
80
- }
81
- `;
82
- eoxItemFilter.value?.shadowRoot?.appendChild(style);
83
-
84
- eoxItemFilter.value?.apply(
85
- // Only list child elements in list
86
- store.stac?.filter((item) => item.rel === "child"),
87
- );
88
- /** @type {any} */ (eoxItemFilter.value).config.onSelect =
89
- /** @param {import('stac-ts').StacLink} item */
90
- async (item) => {
91
- await store.loadSelectedSTAC(item.href);
92
- console.log(item, store.selectedStac);
93
- };
94
- });
95
136
  </script>