@eodash/eodash 5.0.0-alpha.2.4 → 5.0.0-alpha.2.6
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 +31 -7
- package/core/client/App.vue +6 -7
- package/core/client/SuspensedDashboard.ce.vue +59 -45
- package/core/client/asWebComponent.d.ts +10 -5
- package/core/client/asWebComponent.js +6 -6
- package/core/client/components/DashboardLayout.vue +63 -21
- package/core/client/components/DynamicWebComponent.vue +44 -44
- package/core/client/components/ErrorAlert.vue +24 -7
- package/core/client/components/Footer.vue +34 -15
- package/core/client/components/Header.vue +10 -5
- package/core/client/components/IframeWrapper.vue +4 -4
- package/core/client/components/Loading.vue +17 -18
- package/core/client/components/MobileLayout.vue +82 -29
- package/core/client/composables/DefineEodash.js +38 -28
- package/core/client/composables/DefineWidgets.js +105 -79
- package/core/client/composables/index.js +43 -141
- package/core/client/eodash.js +46 -39
- package/core/client/main.js +2 -2
- package/core/client/plugins/index.js +11 -9
- package/core/client/plugins/vuetify.js +9 -10
- package/core/client/render.js +4 -5
- 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 -248
- package/core/client/utils/eodashSTAC.js +151 -66
- package/core/client/utils/helpers.js +18 -20
- package/core/client/utils/index.js +25 -14
- package/core/client/utils/keys.js +2 -2
- package/core/client/views/Dashboard.vue +70 -42
- package/core/client/vite-env.d.ts +19 -17
- package/dist/client/DashboardLayout-BuDcv6LM.js +156 -0
- package/dist/client/{DynamicWebComponent-C4Hotc4H.js → DynamicWebComponent-BEP4rVce.js} +7 -7
- package/dist/client/EodashDatePicker-oFb1zt5E.js +1211 -0
- package/dist/client/EodashItemFilter-BElmgrST.js +63 -0
- package/dist/client/{EodashMap-CGrQjZ1P.js → EodashMap-DXyOgcEd.js} +11333 -14025
- package/dist/client/Footer-CoPx6UXQ.js +115 -0
- package/dist/client/Header-C-zX31Ys.js +635 -0
- package/dist/client/{IframeWrapper-Cg3GMmfW.js → IframeWrapper-2w2ye0zM.js} +4 -4
- package/dist/client/MobileLayout-C9OVcP12.js +945 -0
- package/dist/client/{VMain-BHYlmRic.js → VMain-Dm43jd43.js} +8 -8
- package/dist/client/{WidgetsContainer-dje9QSk0.js → WidgetsContainer-BS87sLqk.js} +12 -5
- package/dist/client/asWebComponent-CpQUVi2N.js +20135 -0
- package/dist/client/{basedecoder-Qm25PwVp-CHo5Pomv.js → basedecoder-DHcBySSe-BmCFNFnw.js} +5 -6
- package/dist/client/{decoder-HRvnjnEI-BQ2rajuJ.js → decoder-CP4lv0Kb-BHrv68IA.js} +1 -1
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +10 -0
- package/dist/client/eo-dash.js +3 -3
- package/dist/client/eodashSTAC-Q7kbX1Gy.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-BVFQ82G4.js +183 -0
- package/dist/client/{index-CaDDfJYE.js → index-dOzyv_xR.js} +43 -74
- package/dist/client/{jpeg-DNfUpLwy-Fjan-04T.js → jpeg-BAgeD1d3-oeHbFPUL.js} +5 -6
- package/dist/client/{lerc-_E46UbWQ-Beu35ovS.js → lerc-DzVumYtB-rm1Xco54.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-Dd7m-btU.js → ssrBoot-L9KejErM.js} +3 -3
- package/dist/client/style.css +2 -2
- package/dist/client/transition-DCePIwYR.js +34 -0
- 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 +3 -3
- package/dist/node/types.d.ts +32 -38
- package/package.json +13 -14
- package/widgets/EodashDatePicker.vue +145 -41
- package/widgets/EodashItemFilter.vue +41 -22
- package/widgets/EodashMap.vue +87 -20
- package/widgets/WidgetsContainer.vue +45 -27
- package/dist/client/DashboardLayout-ZaSRMD1M.js +0 -149
- package/dist/client/EodashDatePicker-C4kKjxKy.js +0 -1653
- package/dist/client/EodashItemFilter-cBHC0YEM.js +0 -51
- package/dist/client/Footer-pS636dEP.js +0 -118
- package/dist/client/Header-DQuaLdjl.js +0 -605
- package/dist/client/MobileLayout-BLXFBWI_.js +0 -987
- package/dist/client/asWebComponent-Bvb3xkxI.js +0 -13311
- package/dist/client/deflate-Be2Arps5-hDqMz3RA.js +0 -10
- package/dist/client/forwardRefs-Bxeu9Obx.js +0 -142
- package/dist/client/index-DlNICb3T.js +0 -34
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<iframe :src="src"
|
|
2
|
+
<iframe :src="src" class="fill-height fill-width"></iframe>
|
|
3
3
|
</template>
|
|
4
4
|
<script setup>
|
|
5
5
|
defineProps({
|
|
6
6
|
src: {
|
|
7
7
|
type: String,
|
|
8
|
-
required: true
|
|
9
|
-
}
|
|
10
|
-
})
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
11
|
</script>
|
|
@@ -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,57 +1,110 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-main class="overflow-hidden
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
>
|
|
13
22
|
<Suspense suspensible>
|
|
14
|
-
<div
|
|
15
|
-
<component
|
|
16
|
-
|
|
23
|
+
<div class="component-container" v-show="activeIdx === idx">
|
|
24
|
+
<component
|
|
25
|
+
:key="importedWidget.value.id"
|
|
26
|
+
:is="importedWidget.value.component"
|
|
27
|
+
v-bind="importedWidget.value.props"
|
|
28
|
+
/>
|
|
17
29
|
</div>
|
|
18
30
|
</Suspense>
|
|
19
31
|
</div>
|
|
20
32
|
</template>
|
|
21
33
|
|
|
22
|
-
<v-tabs
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
>
|
|
25
42
|
<template v-for="(importedWidget, idx) in importedWidgets" :key="idx">
|
|
26
43
|
<v-tab v-if="importedWidget.value.component" :value="idx">
|
|
27
44
|
{{ importedWidget.value.title }}
|
|
28
45
|
</v-tab>
|
|
29
46
|
</template>
|
|
30
47
|
</v-tabs>
|
|
31
|
-
|
|
32
48
|
</v-main>
|
|
33
49
|
</template>
|
|
34
50
|
<script setup>
|
|
35
|
-
import { eodashKey } from
|
|
36
|
-
import { inject, ref, onMounted } from
|
|
37
|
-
import { useDefineWidgets } from
|
|
38
|
-
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";
|
|
39
55
|
|
|
40
|
-
const eodash = /** @type {import("@/types").Eodash} */(inject(eodashKey));
|
|
56
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
|
|
41
57
|
|
|
42
58
|
//import widgets
|
|
43
|
-
const widgetsConfig = eodash.template.widgets
|
|
44
|
-
const importedWidgets = useDefineWidgets(widgetsConfig)
|
|
45
|
-
const [bgWidget] = useDefineWidgets([eodash.template?.background])
|
|
59
|
+
const widgetsConfig = eodash.template.widgets;
|
|
60
|
+
const importedWidgets = useDefineWidgets(widgetsConfig);
|
|
61
|
+
const [bgWidget] = useDefineWidgets([eodash.template?.background]);
|
|
62
|
+
|
|
63
|
+
const { mainRect } = useLayout();
|
|
46
64
|
|
|
47
|
-
const
|
|
65
|
+
const activeIdx = ref(-1);
|
|
48
66
|
|
|
49
|
-
|
|
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("");
|
|
50
72
|
|
|
51
|
-
/** @type {import("vue").Ref<import("vuetify/components").VTabs|null>} */
|
|
52
|
-
const tabs = ref(null)
|
|
53
|
-
const tabsHeightFromBtm = ref('')
|
|
54
73
|
onMounted(() => {
|
|
55
|
-
|
|
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>
|
|
80
|
+
<style scoped>
|
|
81
|
+
.main {
|
|
82
|
+
height: 91dvh;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.panel {
|
|
86
|
+
top: v-bind("mainRectTopPx");
|
|
87
|
+
bottom: v-bind("tabsHeightFromBtm");
|
|
88
|
+
position: absolute;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
width: 100%;
|
|
91
|
+
left: 0;
|
|
92
|
+
z-index: 1;
|
|
93
|
+
background: rgb(var(--v-theme-surface));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.component-container {
|
|
97
|
+
height: 90%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.close-btn {
|
|
101
|
+
height: 5%;
|
|
102
|
+
position: relative;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tabs {
|
|
106
|
+
bottom: v-bind("mainRectBtmPx");
|
|
107
|
+
position: relative;
|
|
108
|
+
z-index: 10;
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -2,56 +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 {
|
|
38
|
+
const configJs = "/config.js";
|
|
34
39
|
assignInstance(
|
|
35
|
-
(await import(
|
|
36
|
-
|
|
40
|
+
(await import(/* @vite-ignore */ new URL(configJs, import.meta.url).href))
|
|
41
|
+
.default,
|
|
42
|
+
);
|
|
37
43
|
} catch {
|
|
38
44
|
try {
|
|
39
|
-
assignInstance(
|
|
45
|
+
assignInstance(
|
|
46
|
+
await import("user:config").then(async (m) => await m["default"]),
|
|
47
|
+
);
|
|
40
48
|
} catch {
|
|
41
|
-
console.error(
|
|
49
|
+
console.error("no dashboard configuration defined");
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
|
-
return eodash
|
|
45
|
-
}
|
|
52
|
+
return eodash;
|
|
53
|
+
};
|
|
46
54
|
|
|
47
55
|
/**
|
|
48
|
-
* @param {((
|
|
49
|
-
*
|
|
56
|
+
* @param {((
|
|
57
|
+
* store: import("@/types").EodashStore,
|
|
58
|
+
* ) => Promise<import("@/types").Eodash>)
|
|
59
|
+
* | import("@/types").Eodash} config
|
|
50
60
|
*/
|
|
51
61
|
export const createEodash = async (config) => {
|
|
52
62
|
if (config instanceof Function) {
|
|
53
|
-
return await config(store)
|
|
63
|
+
return await config(store);
|
|
54
64
|
} else {
|
|
55
|
-
return config
|
|
65
|
+
return config;
|
|
56
66
|
}
|
|
57
|
-
}
|
|
67
|
+
};
|
|
@@ -1,135 +1,161 @@
|
|
|
1
|
-
import { defineAsyncComponent, reactive, shallowRef, watch } from
|
|
2
|
-
import { useSTAcStore } from
|
|
3
|
-
import { storeToRefs } from
|
|
4
|
-
import Loading from '@/components/Loading.vue';
|
|
1
|
+
import { defineAsyncComponent, reactive, shallowRef, watch } from "vue";
|
|
2
|
+
import { useSTAcStore } from "@/store/stac";
|
|
3
|
+
import { storeToRefs } from "pinia";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* @typedef {{
|
|
8
|
-
* component:import(
|
|
7
|
+
* component: import("vue").Component | null;
|
|
9
8
|
* props: Record<string, unknown>;
|
|
10
|
-
* title
|
|
11
|
-
* id:string|number|symbol;
|
|
9
|
+
* title: string;
|
|
10
|
+
* id: string | number | symbol;
|
|
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
|
+
* | undefined
|
|
44
|
+
* )[]
|
|
45
|
+
* | import("@/types").WidgetsContainerProps["widgets"]
|
|
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
|
-
|
|
60
|
+
layout: { x: 0, y: 0, h: 0, w: 0 },
|
|
61
|
+
});
|
|
59
62
|
|
|
60
|
-
if (
|
|
61
|
-
const { selectedStac } = storeToRefs(useSTAcStore())
|
|
62
|
-
watch(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
definedConfig =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
+
);
|
|
70
82
|
} else {
|
|
71
|
-
definedWidget.value = getWidgetDefinition(
|
|
83
|
+
definedWidget.value = getWidgetDefinition(
|
|
84
|
+
/** @type {import("@/types").StaticWidget} */ (config),
|
|
85
|
+
);
|
|
72
86
|
}
|
|
73
|
-
definedWidgets.push(definedWidget)
|
|
87
|
+
definedWidgets.push(definedWidget);
|
|
74
88
|
}
|
|
75
|
-
return definedWidgets
|
|
76
|
-
}
|
|
77
|
-
|
|
89
|
+
return definedWidgets;
|
|
90
|
+
};
|
|
78
91
|
|
|
79
92
|
/**
|
|
80
93
|
* Converts a static widget configuration to a defined imported widget
|
|
81
|
-
*
|
|
94
|
+
*
|
|
95
|
+
* @param {import("@/types").StaticWidget
|
|
96
|
+
* | Omit<import("@/types").StaticWidget, "layout">
|
|
97
|
+
* | undefined
|
|
98
|
+
* | null} [config]
|
|
82
99
|
* @returns {DefinedWidget}
|
|
83
|
-
|
|
100
|
+
*/
|
|
84
101
|
const getWidgetDefinition = (config) => {
|
|
85
|
-
/**
|
|
86
|
-
* @type {DefinedWidget}
|
|
87
|
-
*/
|
|
102
|
+
/** @type {DefinedWidget} */
|
|
88
103
|
const importedWidget = {
|
|
89
104
|
component: null,
|
|
90
105
|
props: {},
|
|
91
|
-
title:
|
|
106
|
+
title: "",
|
|
92
107
|
id: Symbol(),
|
|
93
|
-
|
|
108
|
+
layout: reactive({ x: 0, y: 0, h: 0, w: 0 }),
|
|
109
|
+
};
|
|
94
110
|
switch (config?.type) {
|
|
95
|
-
case
|
|
111
|
+
case "internal":
|
|
96
112
|
importedWidget.component = defineAsyncComponent({
|
|
97
|
-
loader:
|
|
113
|
+
loader:
|
|
114
|
+
internalWidgets[
|
|
115
|
+
/** @type {import("@/types").InternalComponentWidget} * */ (config)
|
|
116
|
+
?.widget.name
|
|
117
|
+
],
|
|
98
118
|
suspensible: true,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
});
|
|
120
|
+
importedWidget.props = reactive(
|
|
121
|
+
/** @type {import("@/types").InternalComponentWidget} * */ (config)
|
|
122
|
+
?.widget.properties ?? {},
|
|
123
|
+
);
|
|
102
124
|
|
|
103
125
|
break;
|
|
104
126
|
|
|
105
|
-
case
|
|
127
|
+
case "web-component":
|
|
106
128
|
importedWidget.component = defineAsyncComponent({
|
|
107
|
-
loader: () => import(
|
|
129
|
+
loader: () => import("@/components/DynamicWebComponent.vue"),
|
|
108
130
|
suspensible: true,
|
|
109
|
-
|
|
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
|
-
|
|
120
|
-
importedWidget.props = reactive(config.widget)
|
|
139
|
+
});
|
|
140
|
+
importedWidget.props = reactive(config.widget);
|
|
121
141
|
break;
|
|
122
142
|
|
|
123
143
|
default:
|
|
124
144
|
if (!config) {
|
|
125
|
-
return importedWidget
|
|
145
|
+
return importedWidget;
|
|
126
146
|
} else {
|
|
127
|
-
console.error(
|
|
147
|
+
console.error("Widget type not found");
|
|
128
148
|
}
|
|
129
149
|
break;
|
|
130
150
|
}
|
|
131
|
-
importedWidget.title = config?.title ??
|
|
132
|
-
importedWidget.id = config?.id ?? importedWidget.id
|
|
133
|
-
return importedWidget
|
|
134
|
-
}
|
|
151
|
+
importedWidget.title = config?.title ?? "";
|
|
152
|
+
importedWidget.id = config?.id ?? importedWidget.id;
|
|
135
153
|
|
|
154
|
+
if ("layout" in config) {
|
|
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;
|
|
159
|
+
}
|
|
160
|
+
return importedWidget;
|
|
161
|
+
};
|