@eodash/eodash 5.0.0-alpha.1.14 → 5.0.0-alpha.1.15
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.
- package/core/App.vue +17 -2
- package/core/components/DashboardLayout.vue +3 -2
- package/core/components/Footer.vue +11 -3
- package/core/components/MobileLayout.vue +28 -45
- package/core/composables/DefineWidgets.js +1 -1
- package/core/composables/index.js +137 -98
- package/core/eodash.js +53 -61
- package/core/store/stac.js +2 -2
- package/core/types.d.ts +64 -44
- package/core/utils/eodashSTAC.js +74 -39
- package/core/utils/helpers.js +40 -0
- package/core/utils/index.js +0 -20
- package/core/vite-env.d.ts +3 -0
- package/package.json +4 -3
- package/widgets/EodashDatePicker.vue +30 -11
- package/widgets/EodashItemFilter.vue +60 -0
- package/widgets/EodashMap.vue +43 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eodash/eodash",
|
|
3
|
-
"version": "5.0.0-alpha.1.
|
|
3
|
+
"version": "5.0.0-alpha.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./core/types.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"preview": "vite preview",
|
|
25
25
|
"lint": "eslint . --fix",
|
|
26
26
|
"docs:generate": "typedoc --options typedoc.config.json",
|
|
27
|
-
"docs:dev": "vitepress dev docs",
|
|
27
|
+
"docs:dev": "vitepress dev docs --port 3333",
|
|
28
28
|
"docs:build": "npm run docs:generate && vitepress build docs",
|
|
29
29
|
"docs:preview": "vitepress preview docs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@eox/itemfilter": "^0.14.0",
|
|
32
33
|
"@eox/layout": "^0.1.0",
|
|
33
34
|
"@eox/map": "^1.4.0",
|
|
34
35
|
"@eox/stacinfo": "^0.3.0",
|
|
@@ -72,4 +73,4 @@
|
|
|
72
73
|
"bin": {
|
|
73
74
|
"eodash": "./bin/app.js"
|
|
74
75
|
}
|
|
75
|
-
}
|
|
76
|
+
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="fill-height fill-width align-center justify-center">
|
|
3
3
|
<div v-if="inline" class="fill-height fill-width">
|
|
4
|
-
<!-- <p class="text-subtitle-1 ma-1 pa-2">currently selected date is {{ currentDate }}</p> -->
|
|
5
|
-
<v-text-field base-color="primary" density="comfortable" type="date" bg-color="surface" color="primary"
|
|
6
|
-
validate-on="input" min="1980-01-01" :max="new Date().toISOString().split(`T`)[0]" label="Select Date"
|
|
7
|
-
:value="currentDate" v-model="currentDate" />
|
|
8
|
-
</div>
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
<v-text-field base-color="primary" class="fill-height fill-width pa-2 align-center" type="date" bg-color="surface"
|
|
6
|
+
color="primary" density="comfortable" label="Select Date" v-model="currentDate" variant="plain" hide-details />
|
|
7
|
+
</div>
|
|
8
|
+
<v-date-picker v-else ref="datePicker" :width="width" :height="height" hide-header v-model="currentDate"
|
|
9
|
+
color="primary" bg-color="surface" location="center" class="overflow-auto fill-height fill-width"
|
|
10
|
+
position="relative" show-adjacent-months></v-date-picker>
|
|
13
11
|
</span>
|
|
14
12
|
</template>
|
|
15
13
|
<script setup>
|
|
16
|
-
import { computed } from "vue";
|
|
14
|
+
import { computed, ref, onMounted } from "vue";
|
|
17
15
|
import { datetime } from "@/store/States"
|
|
18
16
|
|
|
19
17
|
const props = defineProps(["inline"])
|
|
18
|
+
|
|
20
19
|
const currentDate = computed({
|
|
21
20
|
get() {
|
|
22
21
|
return props.inline ? datetime.value.split("T")[0] : new Date(datetime.value) ?? new Date()
|
|
@@ -24,9 +23,29 @@ const currentDate = computed({
|
|
|
24
23
|
/** @param {Date | string} updatedDate */
|
|
25
24
|
set(updatedDate) {
|
|
26
25
|
if (props.inline) {
|
|
27
|
-
updatedDate = new Date(updatedDate)
|
|
26
|
+
updatedDate = new Date(updatedDate);
|
|
27
|
+
}
|
|
28
|
+
//@ts-expect-error
|
|
29
|
+
if (updatedDate instanceof Date && !isNaN(updatedDate)) {
|
|
30
|
+
datetime.value = updatedDate.toISOString()
|
|
31
|
+
} else {
|
|
32
|
+
datetime.value = new Date().toISOString()
|
|
28
33
|
}
|
|
29
|
-
datetime.value = /** @type {Date} */ (updatedDate).toISOString()
|
|
30
34
|
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @type {import("vue").Ref<import("vuetify/components").VDatePicker | null>}
|
|
39
|
+
**/
|
|
40
|
+
const datePicker = ref(null)
|
|
41
|
+
/** @type {import("vue").Ref<string|undefined>} */
|
|
42
|
+
const width = ref()
|
|
43
|
+
/** @type {import("vue").Ref<string|undefined>} */
|
|
44
|
+
const height = ref()
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
/** @type {HTMLElement} */
|
|
47
|
+
const parentEl = datePicker.value?.$el.parentElement?.parentElement
|
|
48
|
+
width.value = parentEl?.clientWidth ? parentEl.clientWidth + "px" : undefined
|
|
49
|
+
height.value = parentEl?.clientHeight ? parentEl.clientHeight + "px" : undefined
|
|
31
50
|
})
|
|
32
51
|
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DynamicWebComponent :link="link" tag-name="eox-itemfilter" :properties="properties" :on-mounted="onMounted" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup>
|
|
5
|
+
import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
|
|
6
|
+
|
|
7
|
+
const link = () => import("@eox/itemfilter");
|
|
8
|
+
|
|
9
|
+
const properties = {
|
|
10
|
+
config: {
|
|
11
|
+
titleProperty: "title",
|
|
12
|
+
filterProperties: [
|
|
13
|
+
{
|
|
14
|
+
keys: ["title", "themes"],
|
|
15
|
+
title: "Search",
|
|
16
|
+
type: "text",
|
|
17
|
+
expanded: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: "themes",
|
|
21
|
+
title: "Theme",
|
|
22
|
+
type: "multiselect",
|
|
23
|
+
featured: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
aggregateResults: "themes",
|
|
27
|
+
enableHighlighting: true,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @type {import("../core/types").WebComponentProps["onMounted"]}*/
|
|
32
|
+
const onMounted = (el, store, router) => {
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} Item
|
|
35
|
+
* @property {string} href
|
|
36
|
+
* */
|
|
37
|
+
/** @type {any} */ (el).apply(
|
|
38
|
+
// Only list child elements in list
|
|
39
|
+
store.stac?.filter((item) => item.rel === "child")
|
|
40
|
+
);
|
|
41
|
+
// Check if indicator is selected
|
|
42
|
+
const { query } = router.currentRoute.value;
|
|
43
|
+
if ("indicator" in query) {
|
|
44
|
+
const match = store.stac?.find((item) => item.id === query.indicator);
|
|
45
|
+
if (match) {
|
|
46
|
+
//@ts-expect-error
|
|
47
|
+
(el).selectedResult = match;
|
|
48
|
+
store.loadSelectedSTAC(match.href);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** @type {any} */ (el).config.onSelect =
|
|
52
|
+
/**
|
|
53
|
+
* @param {Item} item
|
|
54
|
+
* */
|
|
55
|
+
async (item) => {
|
|
56
|
+
console.log(item);
|
|
57
|
+
await store.loadSelectedSTAC(item.href);
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
</script>
|
package/widgets/EodashMap.vue
CHANGED
|
@@ -4,51 +4,69 @@
|
|
|
4
4
|
</template>
|
|
5
5
|
<script setup>
|
|
6
6
|
import { inject, watch } from "vue";
|
|
7
|
-
import { toAbsolute } from
|
|
7
|
+
import { toAbsolute } from "stac-js/src/http.js";
|
|
8
8
|
import { EodashCollection } from "@/utils/eodashSTAC";
|
|
9
9
|
import { eodashKey } from "@/store/Keys";
|
|
10
10
|
import { mapInstance, datetime } from "@/store/States";
|
|
11
11
|
import DynamicWebComponent from "@/components/DynamicWebComponent.vue";
|
|
12
12
|
import { storeToRefs } from "pinia";
|
|
13
|
-
import
|
|
13
|
+
import { useRouter } from "vue-router";
|
|
14
|
+
import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
|
|
14
15
|
|
|
15
|
-
const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey)
|
|
16
|
+
const eodashConfig = /** @type {import("@/types").Eodash} */ inject(eodashKey);
|
|
16
17
|
|
|
17
18
|
const properties = {
|
|
18
19
|
class: "fill-height fill-width overflow-none",
|
|
19
20
|
center: [15, 48],
|
|
20
21
|
layers: [{ type: "Tile", source: { type: "OSM" } }],
|
|
22
|
+
};
|
|
23
|
+
const router = useRouter();
|
|
24
|
+
const { query } = router.currentRoute.value;
|
|
25
|
+
if ("x" in query && "y" in query) {
|
|
26
|
+
properties.center = [Number(query.x), Number(query.y)];
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
if ("z" in query) {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
properties.zoom = query.z;
|
|
31
|
+
}
|
|
32
|
+
const link = () => import("@eox/map");
|
|
23
33
|
|
|
24
34
|
/** @type {import("openlayers").EventsListenerFunctionType}*/
|
|
25
35
|
let handleMoveEnd;
|
|
26
36
|
|
|
27
37
|
/** @type {import("@/types").WebComponentProps["onMounted"]} */
|
|
28
|
-
const onMounted = (el, store,
|
|
29
|
-
|
|
30
|
-
mapInstance.value = /** @type {any} */(el).map;
|
|
38
|
+
const onMounted = (el, store, _router) => {
|
|
39
|
+
mapInstance.value = /** @type {any} */ (el).map;
|
|
31
40
|
|
|
32
|
-
const { selectedStac } = storeToRefs(store)
|
|
41
|
+
const { selectedStac } = storeToRefs(store);
|
|
33
42
|
|
|
34
|
-
watch(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
watch(
|
|
44
|
+
[selectedStac, datetime],
|
|
45
|
+
async ([updatedStac, updatedTime]) => {
|
|
46
|
+
if (updatedStac) {
|
|
47
|
+
const parentCollUrl = toAbsolute(
|
|
48
|
+
`./${updatedStac.id}/collection.json`,
|
|
49
|
+
eodashConfig.stacEndpoint
|
|
50
|
+
);
|
|
51
|
+
const childCollUrl = toAbsolute(
|
|
52
|
+
updatedStac.links[1].href,
|
|
53
|
+
parentCollUrl
|
|
54
|
+
);
|
|
55
|
+
const eodash = new EodashCollection(childCollUrl);
|
|
56
|
+
if (updatedTime) {
|
|
57
|
+
/** @type {any} */ (el).layers = await eodash.createLayersJson(
|
|
58
|
+
new Date(updatedTime)
|
|
59
|
+
);
|
|
60
|
+
} else {
|
|
61
|
+
/** @type {any} */ (el).layers = await eodash.createLayersJson();
|
|
62
|
+
}
|
|
43
63
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true }
|
|
66
|
+
);
|
|
67
|
+
};
|
|
47
68
|
/** @type {import("@/types").WebComponentProps["onUnmounted"]} */
|
|
48
69
|
const onUnmounted = (_el, _store, _router) => {
|
|
49
|
-
mapInstance.value?.un(
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
mapInstance.value?.un("moveend", handleMoveEnd);
|
|
71
|
+
};
|
|
54
72
|
</script>
|