@eodash/eodash 5.0.0-alpha.2.5 → 5.0.0-alpha.2.7
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/README.md +19 -5
- package/core/client/App.vue +6 -7
- package/core/client/SuspensedDashboard.ce.vue +58 -40
- package/core/client/asWebComponent.d.ts +10 -5
- package/core/client/asWebComponent.js +6 -6
- package/core/client/components/DashboardLayout.vue +35 -16
- package/core/client/components/DynamicWebComponent.vue +44 -44
- package/core/client/components/ErrorAlert.vue +19 -7
- package/core/client/components/Footer.vue +28 -14
- package/core/client/components/Header.vue +4 -4
- package/core/client/components/IframeWrapper.vue +3 -3
- package/core/client/components/Loading.vue +17 -18
- package/core/client/components/MobileLayout.vue +48 -26
- package/core/client/composables/DefineEodash.js +38 -29
- package/core/client/composables/DefineWidgets.js +101 -81
- package/core/client/composables/index.js +43 -29
- package/core/client/eodash.js +59 -41
- package/core/client/main.js +2 -2
- package/core/client/plugins/index.js +9 -10
- package/core/client/plugins/vuetify.js +9 -10
- package/core/client/render.js +4 -5
- package/core/client/store/Actions.js +8 -0
- package/core/client/store/States.js +8 -13
- package/core/client/store/index.js +14 -11
- package/core/client/store/stac.js +51 -37
- package/core/client/types.d.ts +173 -200
- package/core/client/utils/eodashSTAC.js +130 -49
- package/core/client/utils/helpers.js +18 -20
- package/core/client/utils/index.js +29 -10
- package/core/client/utils/keys.js +2 -2
- package/core/client/views/Dashboard.vue +53 -36
- package/core/client/vite-env.d.ts +19 -17
- package/dist/client/{DashboardLayout-BYROtP-7.js → DashboardLayout-Cbci3g7o.js} +9 -9
- package/dist/client/{DynamicWebComponent-BQhxFPM0.js → DynamicWebComponent-DzmQ3Fr3.js} +3 -3
- package/dist/client/EodashDatePicker-SP5bYISd.js +252 -0
- package/dist/client/{EodashItemFilter-DIBDAHcc.js → EodashItemFilter-B9Tf2TBw.js} +4 -6
- package/dist/client/{EodashMap-C6jJ2Lb_.js → EodashMap-D_znzmX7.js} +13131 -14490
- package/dist/client/EodashMapBtns-BOKugQ88.js +37 -0
- package/dist/client/ExportState-D7m9s4T8.js +558 -0
- package/dist/client/{Footer-BVIZms1S.js → Footer-C2uV1-zu.js} +12 -12
- package/dist/client/Header-C2ROtxo_.js +350 -0
- package/dist/client/{IframeWrapper-XKChM78a.js → IframeWrapper-Wwou4pwf.js} +1 -1
- package/dist/client/{MobileLayout-BlGcMQra.js → MobileLayout-DR27Ctiz.js} +45 -57
- package/dist/client/PopUp-bPGAY43o.js +300 -0
- package/dist/client/VImg-swqiqth2.js +291 -0
- package/dist/client/{VMain-C9XV5Lyg.js → VMain-Bu1bPjvK.js} +2 -2
- package/dist/client/VOverlay-D_MKJ4vQ.js +967 -0
- package/dist/client/{WidgetsContainer-BQXHnZpa.js → WidgetsContainer-CpxYT8YI.js} +10 -3
- package/dist/client/{asWebComponent-CbdGxelK.js → asWebComponent-DeaU3QoK.js} +6332 -6159
- package/dist/client/{basedecoder-Qm25PwVp-CHo5Pomv.js → basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
- package/dist/client/{decoder-HRvnjnEI-CHAYOWhz.js → decoder-CP4lv0Kb-nokx54iM.js} +1 -1
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
- package/dist/client/eo-dash.js +2 -2
- package/dist/client/eodashSTAC-CFQuZ_cI.js +2788 -0
- package/dist/client/{eox-itemfilter-DcQkRD2l.js → eox-itemfilter-TaBxgqq_.js} +1002 -974
- package/dist/client/{eox-map-C3DL31fp.js → eox-map-L7abwKTR.js} +5677 -5695
- package/dist/client/{forwardRefs-CyCJOFsz.js → forwardRefs-D0a135Tc.js} +43 -50
- package/dist/client/{index-CabQjjQg.js → index-CoqcWt6E.js} +4 -4
- package/dist/client/{jpeg-DNfUpLwy-Fjan-04T.js → jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
- package/dist/client/{lerc-_E46UbWQ-TxBH4OeK.js → lerc-DzVumYtB-B3rx9xzz.js} +5 -7
- package/dist/client/{lzw-BOMhmEDy-Dboc93VO.js → lzw-LAGDNbSC-DkP96qO9.js} +1 -1
- package/dist/client/{packbits-DaUD6MLm-Bu1PoTGa.js → packbits-BlDR4Kj5-C66n1-zr.js} +1 -1
- package/dist/client/{pako.esm-C3kYPGGQ-BMki8cQY.js → pako.esm-CB1uQYY0-DB0PYm1P.js} +6 -12
- package/dist/client/{raw-CcGKjn8q-DFOt-i8n.js → raw-CMGvRjfu-BRi6E4i1.js} +1 -1
- package/dist/client/{ssrBoot-DWJ-z4I-.js → ssrBoot-C-inWOiD.js} +1 -1
- package/dist/client/style.css +2 -2
- package/dist/client/{transition-BlLt41wg.js → transition-C8le0YwQ.js} +3 -3
- package/dist/client/{webfontloader-CyOFAuFB.js → webfontloader-qotgY98I.js} +56 -92
- package/dist/client/{webimage-D2c098k3-DLj1LQxB.js → webimage-BM_pbLN3-L2cGWK5l.js} +1 -1
- package/dist/node/cli.js +1 -1
- package/dist/node/types.d.ts +32 -38
- package/package.json +12 -12
- package/widgets/EodashDatePicker.vue +94 -43
- package/widgets/EodashItemFilter.vue +13 -10
- package/widgets/EodashMap.vue +87 -20
- package/widgets/EodashMapBtns.vue +34 -0
- package/widgets/ExportState.vue +112 -0
- package/widgets/PopUp.vue +40 -0
- package/widgets/WidgetsContainer.vue +45 -27
- package/dist/client/EodashDatePicker-CFltnt5d.js +0 -1194
- package/dist/client/Header-TsTL1d2R.js +0 -633
- package/dist/client/deflate-Be2Arps5-hDqMz3RA.js +0 -10
- package/dist/client/http-ZWiLaAeR.js +0 -1337
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-row class="d-flex justify-center align-center
|
|
2
|
+
<v-row class="d-flex justify-center align-center">
|
|
3
3
|
<v-col class="flex-column justify-center align-center">
|
|
4
4
|
<ErrorAlert v-model="error" />
|
|
5
5
|
<Suspense>
|
|
6
|
-
<component
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<component
|
|
7
|
+
v-if="loading.component"
|
|
8
|
+
:is="loading.component"
|
|
9
|
+
v-bind="loading.props"
|
|
10
|
+
></component>
|
|
11
|
+
<div v-else class="text-center">Loading...</div>
|
|
10
12
|
<template #fallback>
|
|
11
|
-
<div class="text-center">
|
|
12
|
-
Loading...
|
|
13
|
-
</div>
|
|
13
|
+
<div class="text-center">Loading...</div>
|
|
14
14
|
</template>
|
|
15
15
|
</Suspense>
|
|
16
16
|
</v-col>
|
|
17
17
|
</v-row>
|
|
18
18
|
</template>
|
|
19
19
|
<script setup>
|
|
20
|
-
import { inject, onErrorCaptured, ref } from
|
|
21
|
-
import { eodashKey } from
|
|
22
|
-
import { useDefineWidgets } from
|
|
23
|
-
import ErrorAlert from
|
|
20
|
+
import { inject, onErrorCaptured, ref } from "vue";
|
|
21
|
+
import { eodashKey } from "@/utils/keys";
|
|
22
|
+
import { useDefineWidgets } from "@/composables/DefineWidgets";
|
|
23
|
+
import ErrorAlert from "./ErrorAlert.vue";
|
|
24
24
|
|
|
25
|
-
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey))
|
|
25
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
|
|
26
26
|
|
|
27
|
-
const [loading] = useDefineWidgets([eodash.template.loading])
|
|
27
|
+
const [loading] = useDefineWidgets([eodash.template.loading]);
|
|
28
28
|
|
|
29
|
-
const error = ref(
|
|
29
|
+
const error = ref("");
|
|
30
30
|
onErrorCaptured((e, inst, info) => {
|
|
31
31
|
error.value = `
|
|
32
32
|
${e}.
|
|
33
33
|
component: ${inst?.$.type.name}.
|
|
34
34
|
info: ${info}.
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
|
|
35
|
+
`;
|
|
36
|
+
});
|
|
38
37
|
</script>
|
|
@@ -1,59 +1,81 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-main class="overflow-hidden main">
|
|
3
3
|
<Suspense suspensible>
|
|
4
|
-
<component
|
|
4
|
+
<component
|
|
5
|
+
id="bg-widget"
|
|
6
|
+
v-if="bgWidget.component"
|
|
7
|
+
:is="bgWidget.component"
|
|
8
|
+
v-bind="bgWidget.props"
|
|
9
|
+
></component>
|
|
5
10
|
</Suspense>
|
|
6
11
|
|
|
7
12
|
<template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
|
|
8
|
-
<div
|
|
9
|
-
|
|
13
|
+
<div
|
|
14
|
+
v-if="importedWidget.value.component"
|
|
15
|
+
v-show="activeIdx === idx"
|
|
16
|
+
id="overlay"
|
|
17
|
+
class="pa-2 panel"
|
|
18
|
+
>
|
|
19
|
+
<v-btn icon variant="text" class="close-btn" @click="activeIdx = -1"
|
|
20
|
+
>✕</v-btn
|
|
21
|
+
>
|
|
10
22
|
<Suspense suspensible>
|
|
11
23
|
<div class="component-container" v-show="activeIdx === idx">
|
|
12
|
-
<component
|
|
13
|
-
|
|
24
|
+
<component
|
|
25
|
+
:key="importedWidget.value.id"
|
|
26
|
+
:is="importedWidget.value.component"
|
|
27
|
+
v-bind="importedWidget.value.props"
|
|
28
|
+
/>
|
|
14
29
|
</div>
|
|
15
30
|
</Suspense>
|
|
16
31
|
</div>
|
|
17
32
|
</template>
|
|
18
33
|
|
|
19
|
-
<v-tabs
|
|
34
|
+
<v-tabs
|
|
35
|
+
ref="tabs"
|
|
36
|
+
align-tabs="center"
|
|
37
|
+
bg-color="surface"
|
|
38
|
+
class="tabs"
|
|
39
|
+
show-arrows
|
|
40
|
+
v-model="activeIdx"
|
|
41
|
+
>
|
|
20
42
|
<template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
|
|
21
43
|
<v-tab v-if="importedWidget.value.component" :value="idx">
|
|
22
44
|
{{ importedWidget.value.title }}
|
|
23
45
|
</v-tab>
|
|
24
46
|
</template>
|
|
25
47
|
</v-tabs>
|
|
26
|
-
|
|
27
48
|
</v-main>
|
|
28
49
|
</template>
|
|
29
50
|
<script setup>
|
|
30
|
-
import { eodashKey } from
|
|
31
|
-
import { inject, ref, onMounted } from
|
|
32
|
-
import { useDefineWidgets } from
|
|
33
|
-
import { useLayout } from "vuetify"
|
|
51
|
+
import { eodashKey } from "@/utils/keys";
|
|
52
|
+
import { inject, ref, onMounted } from "vue";
|
|
53
|
+
import { useDefineWidgets } from "@/composables/DefineWidgets";
|
|
54
|
+
import { useLayout } from "vuetify";
|
|
34
55
|
|
|
35
|
-
const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey));
|
|
56
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
|
|
36
57
|
|
|
37
58
|
//import widgets
|
|
38
|
-
const widgetsConfig = eodash.template.widgets
|
|
39
|
-
const importedWidgets = useDefineWidgets(widgetsConfig)
|
|
40
|
-
const [bgWidget] = useDefineWidgets([eodash.template?.background])
|
|
59
|
+
const widgetsConfig = eodash.template.widgets;
|
|
60
|
+
const importedWidgets = useDefineWidgets(widgetsConfig);
|
|
61
|
+
const [bgWidget] = useDefineWidgets([eodash.template?.background]);
|
|
41
62
|
|
|
42
|
-
const { mainRect } = useLayout()
|
|
63
|
+
const { mainRect } = useLayout();
|
|
43
64
|
|
|
44
|
-
const activeIdx = ref(-1)
|
|
65
|
+
const activeIdx = ref(-1);
|
|
45
66
|
|
|
46
|
-
/** @type {import("vue").Ref<import("vuetify/components").VTabs|null>} */
|
|
47
|
-
const tabs = ref(null)
|
|
48
|
-
const tabsHeightFromBtm = ref(
|
|
49
|
-
const mainRectTopPx = ref(
|
|
50
|
-
const mainRectBtmPx = ref(
|
|
67
|
+
/** @type {import("vue").Ref<import("vuetify/components").VTabs | null>} */
|
|
68
|
+
const tabs = ref(null);
|
|
69
|
+
const tabsHeightFromBtm = ref("");
|
|
70
|
+
const mainRectTopPx = ref("");
|
|
71
|
+
const mainRectBtmPx = ref("");
|
|
51
72
|
|
|
52
73
|
onMounted(() => {
|
|
53
|
-
mainRectTopPx.value = mainRect.value.top +
|
|
54
|
-
mainRectBtmPx.value = (mainRect.value.bottom || 48) +
|
|
55
|
-
tabsHeightFromBtm.value =
|
|
56
|
-
|
|
74
|
+
mainRectTopPx.value = mainRect.value.top + "px";
|
|
75
|
+
mainRectBtmPx.value = (mainRect.value.bottom || 48) + "px";
|
|
76
|
+
tabsHeightFromBtm.value =
|
|
77
|
+
mainRect.value.bottom + (tabs.value?.$el?.clientHeight ?? 0) + "px";
|
|
78
|
+
});
|
|
57
79
|
</script>
|
|
58
80
|
<style scoped>
|
|
59
81
|
.main {
|
|
@@ -2,57 +2,66 @@ import store from "@/store";
|
|
|
2
2
|
import { eodashKey } from "@/utils/keys";
|
|
3
3
|
import { inject } from "vue";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
|
-
* Sets user defined instance on runtime.
|
|
9
|
-
*
|
|
6
|
+
* Sets user defined instance on runtime. Consumes `/@fs/config.js` and assign
|
|
7
|
+
* it to `eodash`
|
|
8
|
+
*
|
|
10
9
|
* @async
|
|
11
|
-
* @returns {Promise<import("@/types").Eodash>}
|
|
12
10
|
* @param {string | undefined} runtimeConfig
|
|
11
|
+
* @returns {Promise<import("@/types").Eodash>}
|
|
13
12
|
* @see {@linkplain '@/eodash.js'}
|
|
14
13
|
*/
|
|
15
14
|
export const useEodashRuntime = async (runtimeConfig) => {
|
|
16
|
-
const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey))
|
|
17
|
-
/**
|
|
18
|
-
* @param {import("@/types").Eodash} config
|
|
19
|
-
*/
|
|
15
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
|
|
16
|
+
/** @param {import("@/types").Eodash} config */
|
|
20
17
|
const assignInstance = (config) => {
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
/** @type {(keyof import("@/types").Eodash)[]} */ (
|
|
19
|
+
Object.keys(eodash)
|
|
20
|
+
).forEach((key) => {
|
|
21
|
+
//@ts-expect-error to do
|
|
22
|
+
eodash[key] = config[key];
|
|
23
|
+
});
|
|
24
|
+
};
|
|
27
25
|
|
|
28
26
|
if (runtimeConfig) {
|
|
29
|
-
assignInstance(
|
|
30
|
-
|
|
27
|
+
assignInstance(
|
|
28
|
+
(
|
|
29
|
+
await import(
|
|
30
|
+
/* @vite-ignore */ new URL(runtimeConfig, import.meta.url).href
|
|
31
|
+
)
|
|
32
|
+
).default,
|
|
33
|
+
);
|
|
34
|
+
return eodash;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
try {
|
|
34
|
-
const configJs =
|
|
38
|
+
const configJs = "/config.js";
|
|
35
39
|
assignInstance(
|
|
36
|
-
(await import(
|
|
37
|
-
|
|
40
|
+
(await import(/* @vite-ignore */ new URL(configJs, import.meta.url).href))
|
|
41
|
+
.default,
|
|
42
|
+
);
|
|
38
43
|
} catch {
|
|
39
44
|
try {
|
|
40
|
-
assignInstance(
|
|
45
|
+
assignInstance(
|
|
46
|
+
await import("user:config").then(async (m) => await m["default"]),
|
|
47
|
+
);
|
|
41
48
|
} catch {
|
|
42
|
-
console.error(
|
|
49
|
+
console.error("no dashboard configuration defined");
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
|
-
return eodash
|
|
46
|
-
}
|
|
52
|
+
return eodash;
|
|
53
|
+
};
|
|
47
54
|
|
|
48
55
|
/**
|
|
49
|
-
* @param {((
|
|
50
|
-
*
|
|
56
|
+
* @param {((
|
|
57
|
+
* store: import("@/types").EodashStore,
|
|
58
|
+
* ) => Promise<import("@/types").Eodash>)
|
|
59
|
+
* | import("@/types").Eodash} config
|
|
51
60
|
*/
|
|
52
61
|
export const createEodash = async (config) => {
|
|
53
62
|
if (config instanceof Function) {
|
|
54
|
-
return await config(store)
|
|
63
|
+
return await config(store);
|
|
55
64
|
} else {
|
|
56
|
-
return config
|
|
65
|
+
return config;
|
|
57
66
|
}
|
|
58
|
-
}
|
|
67
|
+
};
|
|
@@ -1,141 +1,161 @@
|
|
|
1
|
-
import { defineAsyncComponent, reactive, shallowRef, watch } from
|
|
2
|
-
import { useSTAcStore } from
|
|
3
|
-
import { storeToRefs } from
|
|
1
|
+
import { defineAsyncComponent, reactive, shallowRef, watch } from "vue";
|
|
2
|
+
import { useSTAcStore } from "@/store/stac";
|
|
3
|
+
import { storeToRefs } from "pinia";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {{
|
|
7
|
-
* component: import(
|
|
7
|
+
* component: import("vue").Component | null;
|
|
8
8
|
* props: Record<string, unknown>;
|
|
9
9
|
* title: string;
|
|
10
10
|
* id: string | number | symbol;
|
|
11
|
-
* layout: { x: number; y: number; h: number; w: number }
|
|
11
|
+
* layout: { x: number; y: number; h: number; w: number };
|
|
12
12
|
* }} DefinedWidget
|
|
13
|
-
*/
|
|
13
|
+
*/
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {import('vue').ShallowRef<DefinedWidget>} ReactiveDefinedWidget
|
|
17
|
-
*/
|
|
15
|
+
/** @typedef {import("vue").ShallowRef<DefinedWidget>} ReactiveDefinedWidget */
|
|
18
16
|
|
|
19
17
|
const internalWidgets = (() => {
|
|
20
|
-
/**
|
|
21
|
-
* @type {Record<string,() => Promise<import('vue').Component>>}
|
|
22
|
-
*/
|
|
18
|
+
/** @type {Record<string, () => Promise<import("vue").Component>>} */
|
|
23
19
|
const importMap = {
|
|
24
|
-
...import.meta.glob(
|
|
25
|
-
...import.meta.glob("user:widgets/**/*.vue")
|
|
26
|
-
}
|
|
20
|
+
...import.meta.glob("^/**/*.vue"),
|
|
21
|
+
...import.meta.glob("user:widgets/**/*.vue"),
|
|
22
|
+
};
|
|
27
23
|
for (const key in importMap) {
|
|
28
|
-
const newKey = /** @type {string} */(key.split(
|
|
29
|
-
Object.defineProperty(
|
|
30
|
-
|
|
24
|
+
const newKey = /** @type {string} */ (key.split("/").at(-1)).slice(0, -4);
|
|
25
|
+
Object.defineProperty(
|
|
26
|
+
importMap,
|
|
27
|
+
newKey,
|
|
28
|
+
/** @type {PropertyDescriptor} */ (
|
|
29
|
+
Object.getOwnPropertyDescriptor(importMap, key)
|
|
30
|
+
),
|
|
31
|
+
);
|
|
31
32
|
delete importMap[key];
|
|
32
33
|
}
|
|
33
|
-
return importMap
|
|
34
|
+
return importMap;
|
|
34
35
|
})();
|
|
35
36
|
|
|
36
|
-
|
|
37
37
|
/**
|
|
38
38
|
* Composable that converts widgets Configurations to defined imported widgets
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
39
|
+
*
|
|
40
|
+
* @param {(
|
|
41
|
+
* | import("@/types").Widget
|
|
42
|
+
* | import("@/types").BackgroundWidget
|
|
43
|
+
* | Omit<import("@/types").Widget, "layout">
|
|
44
|
+
* | undefined
|
|
45
|
+
* )[]
|
|
46
|
+
* | undefined} widgetConfigs
|
|
47
|
+
* @returns {ReactiveDefinedWidget[]}
|
|
48
|
+
*/
|
|
43
49
|
export const useDefineWidgets = (widgetConfigs) => {
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
const definedWidgets = []
|
|
50
|
+
/** @type {ReactiveDefinedWidget[]} */
|
|
51
|
+
const definedWidgets = [];
|
|
48
52
|
|
|
49
|
-
for (const config of
|
|
50
|
-
/**
|
|
51
|
-
* @type {ReactiveDefinedWidget}
|
|
52
|
-
*/
|
|
53
|
+
for (const config of widgetConfigs ?? []) {
|
|
54
|
+
/** @type {ReactiveDefinedWidget} */
|
|
53
55
|
const definedWidget = shallowRef({
|
|
54
56
|
component: null,
|
|
55
57
|
props: {},
|
|
56
|
-
title:
|
|
58
|
+
title: "",
|
|
57
59
|
id: Symbol(),
|
|
58
|
-
layout: { x: 0, y: 0, h: 0, w: 0 }
|
|
59
|
-
})
|
|
60
|
+
layout: { x: 0, y: 0, h: 0, w: 0 },
|
|
61
|
+
});
|
|
60
62
|
|
|
61
|
-
if (
|
|
62
|
-
const { selectedStac } = storeToRefs(useSTAcStore())
|
|
63
|
-
watch(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
definedConfig =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
if ("defineWidget" in (config ?? {})) {
|
|
64
|
+
const { selectedStac } = storeToRefs(useSTAcStore());
|
|
65
|
+
watch(
|
|
66
|
+
selectedStac,
|
|
67
|
+
(updatedStac) => {
|
|
68
|
+
let definedConfig =
|
|
69
|
+
/** @type {import("@/types").FunctionalWidget} */ (
|
|
70
|
+
config
|
|
71
|
+
)?.defineWidget(updatedStac);
|
|
72
|
+
if (definedConfig) {
|
|
73
|
+
definedConfig = reactive(definedConfig);
|
|
74
|
+
}
|
|
75
|
+
definedWidget.value =
|
|
76
|
+
definedWidget.value.id === definedConfig?.id
|
|
77
|
+
? definedWidget.value
|
|
78
|
+
: getWidgetDefinition(definedConfig);
|
|
79
|
+
},
|
|
80
|
+
{ immediate: true },
|
|
81
|
+
);
|
|
71
82
|
} else {
|
|
72
|
-
definedWidget.value = getWidgetDefinition(
|
|
83
|
+
definedWidget.value = getWidgetDefinition(
|
|
84
|
+
/** @type {import("@/types").StaticWidget} */ (config),
|
|
85
|
+
);
|
|
73
86
|
}
|
|
74
|
-
definedWidgets.push(definedWidget)
|
|
87
|
+
definedWidgets.push(definedWidget);
|
|
75
88
|
}
|
|
76
|
-
return definedWidgets
|
|
77
|
-
}
|
|
78
|
-
|
|
89
|
+
return definedWidgets;
|
|
90
|
+
};
|
|
79
91
|
|
|
80
92
|
/**
|
|
81
93
|
* Converts a static widget configuration to a defined imported widget
|
|
82
|
-
*
|
|
94
|
+
*
|
|
95
|
+
* @param {import("@/types").StaticWidget
|
|
96
|
+
* | Omit<import("@/types").StaticWidget, "layout">
|
|
97
|
+
* | undefined
|
|
98
|
+
* | null} [config]
|
|
83
99
|
* @returns {DefinedWidget}
|
|
84
|
-
|
|
100
|
+
*/
|
|
85
101
|
const getWidgetDefinition = (config) => {
|
|
86
|
-
/**
|
|
87
|
-
* @type {DefinedWidget}
|
|
88
|
-
*/
|
|
102
|
+
/** @type {DefinedWidget} */
|
|
89
103
|
const importedWidget = {
|
|
90
104
|
component: null,
|
|
91
105
|
props: {},
|
|
92
|
-
title:
|
|
106
|
+
title: "",
|
|
93
107
|
id: Symbol(),
|
|
94
|
-
layout: reactive({ x: 0, y: 0, h: 0, w: 0 })
|
|
95
|
-
}
|
|
108
|
+
layout: reactive({ x: 0, y: 0, h: 0, w: 0 }),
|
|
109
|
+
};
|
|
96
110
|
switch (config?.type) {
|
|
97
|
-
case
|
|
111
|
+
case "internal":
|
|
98
112
|
importedWidget.component = defineAsyncComponent({
|
|
99
|
-
loader:
|
|
113
|
+
loader:
|
|
114
|
+
internalWidgets[
|
|
115
|
+
/** @type {import("@/types").InternalComponentWidget} * */ (config)
|
|
116
|
+
?.widget.name
|
|
117
|
+
],
|
|
100
118
|
suspensible: true,
|
|
101
|
-
})
|
|
102
|
-
importedWidget.props = reactive(
|
|
119
|
+
});
|
|
120
|
+
importedWidget.props = reactive(
|
|
121
|
+
/** @type {import("@/types").InternalComponentWidget} * */ (config)
|
|
122
|
+
?.widget.properties ?? {},
|
|
123
|
+
);
|
|
103
124
|
|
|
104
125
|
break;
|
|
105
126
|
|
|
106
|
-
case
|
|
127
|
+
case "web-component":
|
|
107
128
|
importedWidget.component = defineAsyncComponent({
|
|
108
|
-
loader: () => import(
|
|
129
|
+
loader: () => import("@/components/DynamicWebComponent.vue"),
|
|
109
130
|
suspensible: true,
|
|
110
|
-
})
|
|
111
|
-
importedWidget.props = reactive(config.widget)
|
|
131
|
+
});
|
|
132
|
+
importedWidget.props = reactive(config.widget);
|
|
112
133
|
|
|
113
134
|
break;
|
|
114
|
-
case
|
|
135
|
+
case "iframe":
|
|
115
136
|
importedWidget.component = defineAsyncComponent({
|
|
116
|
-
loader: () => import(
|
|
137
|
+
loader: () => import("@/components/IframeWrapper.vue"),
|
|
117
138
|
suspensible: true,
|
|
118
|
-
})
|
|
119
|
-
importedWidget.props = reactive(config.widget)
|
|
139
|
+
});
|
|
140
|
+
importedWidget.props = reactive(config.widget);
|
|
120
141
|
break;
|
|
121
142
|
|
|
122
143
|
default:
|
|
123
144
|
if (!config) {
|
|
124
|
-
return importedWidget
|
|
145
|
+
return importedWidget;
|
|
125
146
|
} else {
|
|
126
|
-
console.error(
|
|
147
|
+
console.error("Widget type not found");
|
|
127
148
|
}
|
|
128
149
|
break;
|
|
129
150
|
}
|
|
130
|
-
importedWidget.title = config?.title ??
|
|
131
|
-
importedWidget.id = config?.id ?? importedWidget.id
|
|
151
|
+
importedWidget.title = config?.title ?? "";
|
|
152
|
+
importedWidget.id = config?.id ?? importedWidget.id;
|
|
132
153
|
|
|
133
154
|
if ("layout" in config) {
|
|
134
|
-
importedWidget.layout.x = config.layout.x
|
|
135
|
-
importedWidget.layout.y = config.layout.y
|
|
136
|
-
importedWidget.layout.h = config.layout.h
|
|
137
|
-
importedWidget.layout.w = config.layout.w
|
|
155
|
+
importedWidget.layout.x = config.layout.x;
|
|
156
|
+
importedWidget.layout.y = config.layout.y;
|
|
157
|
+
importedWidget.layout.h = config.layout.h;
|
|
158
|
+
importedWidget.layout.w = config.layout.w;
|
|
138
159
|
}
|
|
139
|
-
return importedWidget
|
|
140
|
-
}
|
|
141
|
-
|
|
160
|
+
return importedWidget;
|
|
161
|
+
};
|
|
@@ -9,9 +9,11 @@ import { useSTAcStore } from "@/store/stac";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates an absolute URL from a relative link and assignes it to `currentUrl`
|
|
12
|
-
*
|
|
13
|
-
* @param {string} [
|
|
14
|
-
* @
|
|
12
|
+
*
|
|
13
|
+
* @param {string} [rel=''] Default is `''`
|
|
14
|
+
* @param {string} [base=eodash.stacEndpoint] - Base URL, default value is the
|
|
15
|
+
* root stac catalog. Default is `eodash.stacEndpoint`
|
|
16
|
+
* @returns {import("vue").Ref<string>} - Returns `currentUrl`
|
|
15
17
|
* @see {@link '@/store/States.js'}
|
|
16
18
|
*/
|
|
17
19
|
export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
|
|
@@ -35,16 +37,18 @@ export const useAbsoluteUrl = (rel = "", base = eodash.stacEndpoint) => {
|
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
|
-
* Updates an existing Vuetify theme.
|
|
39
|
-
*
|
|
40
|
+
* Updates an existing Vuetify theme. updates only the values provided in the
|
|
41
|
+
* `ThemeDefinition`
|
|
42
|
+
*
|
|
40
43
|
* @param {string} themeName - Name of the theme to be updated
|
|
41
|
-
* @param {import(
|
|
42
|
-
*
|
|
44
|
+
* @param {import("vuetify").ThemeDefinition} [themeDefinition={}] - New
|
|
45
|
+
* defintion to be updated to. Default is `{}`
|
|
46
|
+
* @returns {import("vuetify").ThemeInstance}
|
|
43
47
|
*/
|
|
44
48
|
export const useUpdateTheme = (themeName, themeDefinition = {}) => {
|
|
45
49
|
const theme = useTheme();
|
|
46
50
|
|
|
47
|
-
/** @type {
|
|
51
|
+
/** @type {(keyof import("vuetify").ThemeDefinition)[]} */ (
|
|
48
52
|
Object.keys(themeDefinition)
|
|
49
53
|
).forEach((key) => {
|
|
50
54
|
if (key === "dark") {
|
|
@@ -52,7 +56,7 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
|
|
|
52
56
|
themeDefinition[key]
|
|
53
57
|
);
|
|
54
58
|
} else {
|
|
55
|
-
//@ts-expect-error
|
|
59
|
+
//@ts-expect-error to do
|
|
56
60
|
theme.themes.value[themeName][key] = {
|
|
57
61
|
...theme.themes.value[themeName][key],
|
|
58
62
|
...themeDefinition[key],
|
|
@@ -62,27 +66,25 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
|
|
|
62
66
|
return theme;
|
|
63
67
|
};
|
|
64
68
|
|
|
65
|
-
/**
|
|
66
|
-
* Composable that syncs store and URLSearchParameters
|
|
67
|
-
*/
|
|
69
|
+
/** Composable that syncs store and URLSearchParameters */
|
|
68
70
|
|
|
69
71
|
export const useURLSearchParametersSync = () => {
|
|
70
72
|
onMounted(async () => {
|
|
71
73
|
// Analyze currently set url params when first loaded and set them in the store
|
|
72
|
-
if (
|
|
74
|
+
if ("URLSearchParams" in window) {
|
|
73
75
|
const searchParams = new URLSearchParams(window.location.search);
|
|
74
|
-
/** @type {number} */
|
|
76
|
+
/** @type {number | undefined} */
|
|
75
77
|
let x,
|
|
76
|
-
/** @type {number} */
|
|
78
|
+
/** @type {number | undefined} */
|
|
77
79
|
y,
|
|
78
|
-
/** @type {number} */
|
|
80
|
+
/** @type {number | undefined} */
|
|
79
81
|
z;
|
|
80
82
|
searchParams.forEach(async (value, key) => {
|
|
81
83
|
if (key === "indicator") {
|
|
82
|
-
const { loadSelectedSTAC, stac } = useSTAcStore()
|
|
83
|
-
const match = stac?.find(link => link.id == value)
|
|
84
|
+
const { loadSelectedSTAC, stac } = useSTAcStore();
|
|
85
|
+
const match = stac?.find((link) => link.id == value);
|
|
84
86
|
if (match) {
|
|
85
|
-
await loadSelectedSTAC(match.href)
|
|
87
|
+
await loadSelectedSTAC(match.href);
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
if (key === "x") {
|
|
@@ -94,28 +96,40 @@ export const useURLSearchParametersSync = () => {
|
|
|
94
96
|
if (key === "z") {
|
|
95
97
|
z = Number(value);
|
|
96
98
|
}
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
if (x !== undefined && y !== undefined && z !== undefined) {
|
|
99
|
+
});
|
|
100
|
+
if (x && y && z) {
|
|
100
101
|
mapPosition.value = [x, y, z];
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
watch(
|
|
104
105
|
[indicator, mapPosition],
|
|
105
106
|
([updatedIndicator, updatedMapPosition]) => {
|
|
106
|
-
if (
|
|
107
|
+
if ("URLSearchParams" in window) {
|
|
107
108
|
const searchParams = new URLSearchParams(window.location.search);
|
|
108
109
|
if (updatedIndicator !== "") {
|
|
109
110
|
searchParams.set("indicator", updatedIndicator);
|
|
110
111
|
}
|
|
111
112
|
if (updatedMapPosition && updatedMapPosition.length === 3) {
|
|
112
|
-
searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ??
|
|
113
|
-
searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ??
|
|
114
|
-
searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ??
|
|
113
|
+
searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ?? "");
|
|
114
|
+
searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ?? "");
|
|
115
|
+
searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ?? "");
|
|
115
116
|
}
|
|
116
|
-
const newRelativePathQuery =
|
|
117
|
-
|
|
117
|
+
const newRelativePathQuery =
|
|
118
|
+
window.location.pathname + "?" + searchParams.toString();
|
|
119
|
+
history.pushState(null, "", newRelativePathQuery);
|
|
118
120
|
}
|
|
119
|
-
}
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** @param {import("vue").Ref<HTMLElement|null>} root - components root element ref*/
|
|
127
|
+
export const makePanelTransparent = (root) => {
|
|
128
|
+
onMounted(() => {
|
|
129
|
+
const eoxItem = root.value?.parentElement;
|
|
130
|
+
if (eoxItem?.tagName === "EOX-LAYOUT-ITEM") {
|
|
131
|
+
eoxItem.style.background = "transparent";
|
|
132
|
+
eoxItem.style.border = "transparent";
|
|
133
|
+
}
|
|
120
134
|
});
|
|
121
135
|
};
|