@eodash/eodash 5.7.1 → 5.8.0
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/client/eodashSTAC/EodashCollection.js +14 -5
- package/core/client/eodashSTAC/createLayers.js +193 -80
- package/core/client/eodashSTAC/helpers.js +330 -39
- package/core/client/eodashSTAC/mosaic.js +10 -4
- package/core/client/store/stac.js +29 -0
- package/core/client/types.ts +5 -0
- package/dist/client/{DashboardLayout-ePbdvUTE.js → DashboardLayout-DEs4f_Vy.js} +2 -2
- package/dist/client/{DynamicWebComponent-g5SdRbjY.js → DynamicWebComponent-PvnV88BA.js} +1 -1
- package/dist/client/EodashChart-D-3AGKZY.js +260 -0
- package/dist/client/{EodashDatePicker-CY1TrsDo.js → EodashDatePicker-Dm_goZzs.js} +3 -3
- package/dist/client/{EodashItemFilter-DzshHDlS.js → EodashItemFilter-CJy3zYzD.js} +2 -2
- package/dist/client/{EodashLayerControl-DMCeMkSd.js → EodashLayerControl-rL8UnpkA.js} +11 -19
- package/dist/client/{EodashLayoutSwitcher-iJ8mX1rF.js → EodashLayoutSwitcher-ZRlESI9O.js} +3 -3
- package/dist/client/{EodashMapBtns-C7Cr7q5Y.js → EodashMapBtns-CG7u2Aq8.js} +34 -33
- package/dist/client/{EodashStacInfo-K7-iuXa7.js → EodashStacInfo-CJhhxthD.js} +2 -2
- package/dist/client/{EodashTools-BEK7e7JM.js → EodashTools-CWyK8QJT.js} +4 -4
- package/dist/client/{ExportState-CqIzfMYQ.js → ExportState-BXhy5TOU.js} +19 -11
- package/dist/client/{Footer-1P0cmBOZ.js → Footer-DZPvnhcT.js} +1 -1
- package/dist/client/{Header-CkkBaBNh.js → Header-CiGsDE_a.js} +2 -2
- package/dist/client/{MobileLayout-BPf49kDU.js → MobileLayout-BJHW7x5V.js} +2 -2
- package/dist/client/{PopUp-DPZq5SWI.js → PopUp-7_XnhvCc.js} +3 -3
- package/dist/client/{ProcessList-DuI6WpS1.js → ProcessList-LL_UCbvc.js} +4 -4
- package/dist/client/{VDivider-Bj9LG_JV.js → VDivider-DWYM0WUr.js} +2 -2
- package/dist/client/{VImg-Ddv5OyMz.js → VImg-B75dgw2K.js} +2 -2
- package/dist/client/{VMain-7yqk_qC3.js → VMain-DvMmOL4f.js} +1 -1
- package/dist/client/{VTooltip-2hAJyEoa.js → VTooltip-ClWHUmWL.js} +2 -2
- package/dist/client/{WidgetsContainer-2DOrlwCB.js → WidgetsContainer-BqaWs4ch.js} +1 -1
- package/dist/client/{asWebComponent-BlFN2lkB.js → asWebComponent-IZanwL-A.js} +239 -91
- package/dist/client/{async-B2H8ZwUK.js → async-CiNIOBVz.js} +31 -29
- package/dist/client/{create-layers-config-u_vn5hPk.js → create-layers-config-3S3y_kZg.js} +1 -1
- package/dist/client/{dialog-transition-BrMkMiNa.js → dialog-transition-c4ZSnzac.js} +2 -2
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DAlror6d.js → forwardRefs-B-c1_6yo.js} +2 -2
- package/dist/client/{handling-B6I1V5eG.js → handling-NvY8Csry.js} +3 -4
- package/dist/client/{helpers-CBqIUSXJ.js → helpers-BFuh19CP.js} +328 -40
- package/dist/client/{index-DhKU6KqM.js → index-1wMAyuNL.js} +17 -9
- package/dist/client/{index-DXLz4sFR.js → index-B8jGJSTA.js} +4 -4
- package/dist/client/{index-DjQlbWbJ.js → index-BKQQJkhy.js} +166 -61
- package/dist/client/{index-BWq1ZKaV.js → index-D0jUyol8.js} +10 -11
- package/dist/client/{index-CJ9UI3ln.js → index-KGxz5Egv.js} +2 -2
- package/dist/client/{mosaic-BFYLEwyx.js → mosaic-vHvSuih6.js} +10 -6
- package/dist/client/templates.js +6 -7
- package/dist/client/{transition-D_W6Wn9v.js → transition-BkyUsZh_.js} +1 -1
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +47 -7
- package/dist/types/core/client/store/stac.d.ts +8 -2
- package/dist/types/core/client/types.d.ts +5 -0
- package/dist/types/templates/explore.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +1 -1
- package/package.json +5 -5
- package/templates/baseConfig.js +2 -1
- package/templates/compare.js +0 -1
- package/templates/expert.js +2 -3
- package/templates/explore.js +1 -0
- package/templates/lite.js +0 -1
- package/widgets/EodashChart.vue +161 -21
- package/widgets/EodashItemCatalog/methods/map.js +0 -1
- package/widgets/EodashLayerControl.vue +10 -15
- package/widgets/EodashMap/index.vue +3 -1
- package/widgets/EodashMap/methods/btns.js +27 -26
- package/widgets/EodashMap/methods/use-map-loading.js +8 -2
- package/widgets/EodashProcess/index.vue +135 -16
- package/widgets/EodashProcess/methods/composables.js +13 -0
- package/widgets/EodashProcess/methods/outputs.js +0 -1
- package/widgets/EodashProcess/methods/utils.js +29 -27
- package/widgets/ExportState.vue +13 -4
- package/dist/client/EodashChart-ChrkA5oS.js +0 -145
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="container" class="
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<div ref="container" class="eodash-process-container">
|
|
3
|
+
<div class="eodash-process-content">
|
|
4
|
+
<ProcessList :map-element="mapElement" :enable-compare="enableCompare" />
|
|
5
|
+
<eox-jsonform
|
|
6
|
+
v-if="jsonformSchema"
|
|
7
|
+
:key="jsonformKey"
|
|
8
|
+
ref="jsonformEl"
|
|
9
|
+
.schema="jsonformSchema"
|
|
10
|
+
></eox-jsonform>
|
|
11
|
+
<EodashChart
|
|
12
|
+
v-if="!areChartsSeparateLayout"
|
|
13
|
+
:vega-embed-options="vegaEmbedOptions"
|
|
14
|
+
:enable-compare="enableCompare"
|
|
15
|
+
>
|
|
16
|
+
</EodashChart>
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
class="eodash-process-actions"
|
|
20
|
+
v-if="showExecBtn || (processResults.length && isProcessed && !isAsync)"
|
|
14
21
|
>
|
|
15
|
-
</EodashChart>
|
|
16
|
-
<div class="text-right">
|
|
17
22
|
<v-btn
|
|
18
23
|
v-if="showExecBtn"
|
|
19
24
|
:loading="loading"
|
|
@@ -45,7 +50,7 @@ import "@eox/drawtools";
|
|
|
45
50
|
import "@eox/jsonform";
|
|
46
51
|
import { useSTAcStore } from "@/store/stac";
|
|
47
52
|
import { storeToRefs } from "pinia";
|
|
48
|
-
import { computed, ref, useTemplateRef } from "vue";
|
|
53
|
+
import { computed, ref, useTemplateRef, watch } from "vue";
|
|
49
54
|
import ProcessList from "./ProcessList.vue";
|
|
50
55
|
import EodashChart from "../EodashChart.vue";
|
|
51
56
|
import { handleProcesses } from "./methods/handling";
|
|
@@ -88,6 +93,90 @@ const jsonformEl =
|
|
|
88
93
|
useTemplateRef("jsonformEl")
|
|
89
94
|
);
|
|
90
95
|
|
|
96
|
+
// Inject custom styles into the eox-jsonform shadow DOM to make eox-drawtools inline
|
|
97
|
+
watch(jsonformEl, (el) => {
|
|
98
|
+
if (el && el.shadowRoot) {
|
|
99
|
+
const styleId = "eodash-drawtools-inline-style";
|
|
100
|
+
if (!el.shadowRoot.getElementById(styleId)) {
|
|
101
|
+
const style = document.createElement("style");
|
|
102
|
+
style.id = styleId;
|
|
103
|
+
style.textContent = `
|
|
104
|
+
/* Compact standard form elements */
|
|
105
|
+
.form-control, .form-group {
|
|
106
|
+
margin-bottom: 8px !important;
|
|
107
|
+
}
|
|
108
|
+
.form-control > label, .form-group > label {
|
|
109
|
+
margin-bottom: 2px !important;
|
|
110
|
+
font-size: 0.9em;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Specific layout for drawtools */
|
|
114
|
+
.form-control:has(eox-drawtools) {
|
|
115
|
+
position: relative;
|
|
116
|
+
padding: 8px 12px !important;
|
|
117
|
+
border: none !important;
|
|
118
|
+
background: transparent !important;
|
|
119
|
+
margin-bottom: 8px !important;
|
|
120
|
+
}
|
|
121
|
+
.form-control:has(eox-drawtools) > label {
|
|
122
|
+
position: absolute;
|
|
123
|
+
left: 12px;
|
|
124
|
+
top: 8px;
|
|
125
|
+
margin: 0 !important;
|
|
126
|
+
width: calc(100% - 180px); /* Give label maximum available width */
|
|
127
|
+
line-height: 1.2;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: flex-start;
|
|
130
|
+
padding-top: 8px;
|
|
131
|
+
pointer-events: none; /* Let clicks pass through to buttons if they overlap slightly */
|
|
132
|
+
}
|
|
133
|
+
.form-control:has(eox-drawtools) > eox-drawtools {
|
|
134
|
+
display: block;
|
|
135
|
+
width: 100%;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
el.shadowRoot.appendChild(style);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const injectDrawtoolsStyle = () => {
|
|
142
|
+
const drawtools = el?.shadowRoot?.querySelector("eox-drawtools");
|
|
143
|
+
if (drawtools && drawtools.shadowRoot) {
|
|
144
|
+
if (
|
|
145
|
+
!drawtools.shadowRoot.getElementById("eodash-drawtools-indent-style")
|
|
146
|
+
) {
|
|
147
|
+
const dtStyle = document.createElement("style");
|
|
148
|
+
dtStyle.id = "eodash-drawtools-indent-style";
|
|
149
|
+
dtStyle.textContent = `
|
|
150
|
+
eox-drawtools-controller {
|
|
151
|
+
display: flex;
|
|
152
|
+
justify-content: flex-end; /* Push buttons to the right */
|
|
153
|
+
min-height: 40px;
|
|
154
|
+
width: 100%;
|
|
155
|
+
}
|
|
156
|
+
eox-drawtools-list {
|
|
157
|
+
display: block;
|
|
158
|
+
margin-top: 10px;
|
|
159
|
+
width: 100%;
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
drawtools.shadowRoot.appendChild(dtStyle);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
if (!injectDrawtoolsStyle()) {
|
|
170
|
+
const observer = new MutationObserver(() => {
|
|
171
|
+
if (injectDrawtoolsStyle()) {
|
|
172
|
+
observer.disconnect();
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
observer.observe(el.shadowRoot, { childList: true, subtree: true });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
91
180
|
const isAsync = computed(
|
|
92
181
|
() =>
|
|
93
182
|
selectedStac.value?.links.filter((l) => l.endpoint === "eoxhub_workspaces")
|
|
@@ -189,7 +278,37 @@ useAutoExec(autoExec, jsonformEl, jsonformSchema, startProcess);
|
|
|
189
278
|
</script>
|
|
190
279
|
<style>
|
|
191
280
|
eox-jsonform {
|
|
192
|
-
padding: 0
|
|
281
|
+
padding: 0 12px;
|
|
193
282
|
min-height: 0px;
|
|
283
|
+
flex-shrink: 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* Force the specific panel wrapping this component to utilize 100% height */
|
|
287
|
+
.bg-surface:has(.eodash-process-container) {
|
|
288
|
+
height: calc(100% - 30px);
|
|
289
|
+
overflow: hidden;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* Make sure this container takes up full height and acts as a flex column */
|
|
293
|
+
.eodash-process-container {
|
|
294
|
+
height: 100%;
|
|
295
|
+
display: flex;
|
|
296
|
+
flex-direction: column;
|
|
297
|
+
overflow: hidden;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.eodash-process-content {
|
|
301
|
+
flex-grow: 1;
|
|
302
|
+
overflow-y: auto;
|
|
303
|
+
display: flex;
|
|
304
|
+
flex-direction: column;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.eodash-process-actions {
|
|
308
|
+
text-align: right;
|
|
309
|
+
padding: 4px 12px;
|
|
310
|
+
flex-shrink: 0;
|
|
311
|
+
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
312
|
+
background: inherit;
|
|
194
313
|
}
|
|
195
314
|
</style>
|
|
@@ -59,6 +59,19 @@ export const useInitProcess = ({
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
if (newJsonForm) {
|
|
62
|
+
// Layer rebuilds strip drawtools' selection interactions; remount
|
|
63
|
+
// the form so initSelection re-attaches them.
|
|
64
|
+
const selectionStripped =
|
|
65
|
+
Object.values(newJsonForm.properties ?? {}).some(
|
|
66
|
+
(p) => p?.options?.drawtools?.layerId,
|
|
67
|
+
) &&
|
|
68
|
+
!mapElement.value?.selectInteractions?.[
|
|
69
|
+
"SelectLayerClickInteraction"
|
|
70
|
+
];
|
|
71
|
+
if (selectionStripped) {
|
|
72
|
+
jsonformSchema.value = null;
|
|
73
|
+
await nextTick();
|
|
74
|
+
}
|
|
62
75
|
jsonformSchema.value = newJsonForm;
|
|
63
76
|
}
|
|
64
77
|
}
|
|
@@ -89,10 +89,10 @@ export async function createTiffLayerDefinition(
|
|
|
89
89
|
}
|
|
90
90
|
// We want to make sure the urls are alphabetically sorted
|
|
91
91
|
urls = urls.sort();
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
const layerdef =
|
|
94
94
|
urls.length > 0
|
|
95
|
-
? {
|
|
95
|
+
? /** @type {import("@eox/map/src/layers").EOxLayerType<"WebGLTile","GeoTIFF">} */ ({
|
|
96
96
|
type: "WebGLTile",
|
|
97
97
|
source: {
|
|
98
98
|
type: "GeoTIFF",
|
|
@@ -106,7 +106,7 @@ export async function createTiffLayerDefinition(
|
|
|
106
106
|
layerControlToolsExpand: true,
|
|
107
107
|
},
|
|
108
108
|
...(style && { style: style }),
|
|
109
|
-
}
|
|
109
|
+
})
|
|
110
110
|
: undefined;
|
|
111
111
|
|
|
112
112
|
// We want to see if the currently selected indicator uses a
|
|
@@ -309,31 +309,33 @@ export async function creatAsyncProcessLayerDefinitions(
|
|
|
309
309
|
|
|
310
310
|
switch (resultItem.type) {
|
|
311
311
|
case "image/tiff": {
|
|
312
|
-
layers.push(
|
|
313
|
-
type
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
...(selectedStac["eodash:mapProjection"]?.["name"] && {
|
|
312
|
+
layers.push(
|
|
313
|
+
/** @type {import("@eox/map/src/layers").EOxLayerType<"WebGLTile","GeoTIFF">} */ ({
|
|
314
|
+
type: "WebGLTile",
|
|
315
|
+
properties: {
|
|
316
|
+
id: endpointLink.id + "_process" + resultItem.id + postfixId,
|
|
317
|
+
title:
|
|
318
|
+
"Results " +
|
|
319
|
+
(selectedStac?.id ?? "") +
|
|
320
|
+
" " +
|
|
321
|
+
(resultItem.id ?? ""),
|
|
322
|
+
layerControlToolsExpand: true,
|
|
323
|
+
...(layerConfig && { layerConfig }),
|
|
324
|
+
...extraProperties,
|
|
325
|
+
},
|
|
326
|
+
source: {
|
|
327
|
+
type: "GeoTIFF",
|
|
328
|
+
normalize: !style,
|
|
329
|
+
sources: resultItem.urls.map((url) => ({ url })),
|
|
331
330
|
//@ts-expect-error TODO
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
331
|
+
...(selectedStac["eodash:mapProjection"]?.["name"] && {
|
|
332
|
+
//@ts-expect-error TODO
|
|
333
|
+
projection: selectedStac["eodash:mapProjection"]["name"],
|
|
334
|
+
}),
|
|
335
|
+
},
|
|
336
|
+
...(style && { style }),
|
|
337
|
+
}),
|
|
338
|
+
);
|
|
337
339
|
break;
|
|
338
340
|
}
|
|
339
341
|
case "application/geo+json": {
|
package/widgets/ExportState.vue
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<strong>Map Layers Configuration</strong>
|
|
35
35
|
</p>
|
|
36
36
|
<div class="pa-3 code-block mb-4">
|
|
37
|
-
{{ removeUnneededProperties(getLayers()) }}
|
|
37
|
+
{{ removeUnneededProperties(getLayers(), layerControlFormValue) }}
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<div v-if="chartSpec" class="mb-4">
|
|
@@ -63,6 +63,7 @@ import { copyToClipBoard } from "@/utils";
|
|
|
63
63
|
import { ref } from "vue";
|
|
64
64
|
import { getLayers as getLayerAction } from "@/store/actions";
|
|
65
65
|
import { mapPosition, availableMapProjection, chartSpec } from "@/store/states";
|
|
66
|
+
import { layerControlFormValue } from "@/utils/states";
|
|
66
67
|
import { removeUnneededProperties } from "@/eodashSTAC/helpers";
|
|
67
68
|
import { base64EncodeSpec } from "@eox/chart";
|
|
68
69
|
|
|
@@ -86,7 +87,15 @@ const copyBtns = [
|
|
|
86
87
|
{
|
|
87
88
|
id: Symbol(),
|
|
88
89
|
copyFn: async () =>
|
|
89
|
-
await copyToClipBoard(
|
|
90
|
+
await copyToClipBoard(
|
|
91
|
+
JSON.stringify(
|
|
92
|
+
removeUnneededProperties(
|
|
93
|
+
props.getLayers(),
|
|
94
|
+
layerControlFormValue.value,
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
copySuccess,
|
|
98
|
+
),
|
|
90
99
|
copyAs: "layers configuration",
|
|
91
100
|
},
|
|
92
101
|
{
|
|
@@ -110,7 +119,7 @@ const getMapStepCode = () => {
|
|
|
110
119
|
#### Tour step title
|
|
111
120
|
Text describing the current step of the tour and why it is interesting what the map shows currently
|
|
112
121
|
`;
|
|
113
|
-
return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers()))}' ${endTag}`;
|
|
122
|
+
return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers(), layerControlFormValue.value))}' ${endTag}`;
|
|
114
123
|
};
|
|
115
124
|
const getMapEntryCode = () => {
|
|
116
125
|
const [x, y, z] = mapPosition.value;
|
|
@@ -118,7 +127,7 @@ const getMapEntryCode = () => {
|
|
|
118
127
|
"## Map Example <!" +
|
|
119
128
|
'--{as="eox-map" style="width: 100%; height: 500px;" layers=';
|
|
120
129
|
const endTag = `zoom="${z}" center=[${[x, y]}] projection="${availableMapProjection.value}" }-->`;
|
|
121
|
-
return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers()))}' ${endTag}`;
|
|
130
|
+
return `${preTag}'${JSON.stringify(removeUnneededProperties(props.getLayers(), layerControlFormValue.value))}' ${endTag}`;
|
|
122
131
|
};
|
|
123
132
|
|
|
124
133
|
const getChartExportCode = () => {
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { computed, ref, useTemplateRef, onMounted, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createCommentVNode, normalizeStyle, toRaw } from 'vue';
|
|
2
|
-
import '@eox/chart';
|
|
3
|
-
import { o as onChartClick } from './handling-B6I1V5eG.js';
|
|
4
|
-
import { ac as compareChartData, ad as chartData, X as compareChartSpec, W as chartSpec, V as areChartsSeparateLayout } from './helpers-CBqIUSXJ.js';
|
|
5
|
-
import { _ as _export_sfc, ad as getOverlayParent } from './asWebComponent-BlFN2lkB.js';
|
|
6
|
-
import { mdiArrowCollapse, mdiArrowExpand } from '@mdi/js';
|
|
7
|
-
import { T as Tooltip } from './index-CJ9UI3ln.js';
|
|
8
|
-
|
|
9
|
-
const _style_0 = ".chart-frame[data-v-9ad3f535]{position:relative}.chart-toggle[data-v-9ad3f535]{position:absolute;top:18px;right:46px;z-index:2;cursor:pointer}";
|
|
10
|
-
|
|
11
|
-
const _hoisted_1 = { ref: "container" };
|
|
12
|
-
const _hoisted_2 = { class: "chart-frame" };
|
|
13
|
-
const _hoisted_3 = {
|
|
14
|
-
viewBox: "0 0 20 20",
|
|
15
|
-
width: "20",
|
|
16
|
-
height: "20",
|
|
17
|
-
"aria-hidden": "true"
|
|
18
|
-
};
|
|
19
|
-
const _hoisted_4 = ["d"];
|
|
20
|
-
const _hoisted_5 = [".spec", ".dataValues", ".opt"];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const _sfc_main = {
|
|
24
|
-
__name: 'EodashChart',
|
|
25
|
-
props: {
|
|
26
|
-
enableCompare: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: false,
|
|
29
|
-
},
|
|
30
|
-
vegaEmbedOptions: {
|
|
31
|
-
/** @type {import("vue").PropType<import("vega-embed").EmbedOptions>} */
|
|
32
|
-
type: Object,
|
|
33
|
-
default() {
|
|
34
|
-
return { actions: true };
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
setup(__props) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const usedChartData = computed(() => {
|
|
43
|
-
return __props.enableCompare ? compareChartData.value : chartData.value;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const usedChartSpec = computed(() => {
|
|
47
|
-
return __props.enableCompare ? compareChartSpec.value : chartSpec.value;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const chartRenderKey = ref(0);
|
|
51
|
-
const frameHeight = ref(225);
|
|
52
|
-
const containerEl = useTemplateRef("container");
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
@type { MutationObserver | null}
|
|
56
|
-
*/
|
|
57
|
-
let observer = null;
|
|
58
|
-
|
|
59
|
-
onMounted(() => {
|
|
60
|
-
const el = containerEl.value;
|
|
61
|
-
if (!el) return;
|
|
62
|
-
|
|
63
|
-
const parent = el.parentElement?.parentElement;
|
|
64
|
-
if (parent) {
|
|
65
|
-
const parentHeight = parent.getBoundingClientRect().height;
|
|
66
|
-
frameHeight.value = Math.max(225, Math.floor(parentHeight));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// for mobile view, the overlay panel containing chart is initially hidden
|
|
70
|
-
// we create an observer when display of overlay is not none anymore
|
|
71
|
-
const overlay = getOverlayParent(el);
|
|
72
|
-
if (!overlay) return;
|
|
73
|
-
|
|
74
|
-
observer = new MutationObserver(async () => {
|
|
75
|
-
const style = getComputedStyle(overlay);
|
|
76
|
-
const visible = style.display !== "none";
|
|
77
|
-
if (visible) {
|
|
78
|
-
// forcibly rerender chart, otherwise size of canvas is 0
|
|
79
|
-
chartRenderKey.value = Math.random();
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
observer.observe(overlay, {
|
|
84
|
-
attributes: true,
|
|
85
|
-
attributeFilter: ["style", "class"],
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
onBeforeUnmount(() => {
|
|
90
|
-
observer?.disconnect();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const chartStyles = computed(() => {
|
|
94
|
-
const styles = {
|
|
95
|
-
height: `${frameHeight.value}px`,
|
|
96
|
-
};
|
|
97
|
-
return styles;
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const toggleIcon = computed(() =>
|
|
101
|
-
areChartsSeparateLayout.value ? mdiArrowCollapse : mdiArrowExpand,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
function toggleLayout() {
|
|
105
|
-
areChartsSeparateLayout.value = !areChartsSeparateLayout.value;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (_ctx, _cache) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
112
|
-
createElementVNode("div", _hoisted_2, [
|
|
113
|
-
(usedChartData.value && usedChartSpec.value)
|
|
114
|
-
? withDirectives((openBlock(), createElementBlock("button", {
|
|
115
|
-
key: 0,
|
|
116
|
-
class: "chart-toggle",
|
|
117
|
-
onClick: toggleLayout
|
|
118
|
-
}, [
|
|
119
|
-
(openBlock(), createElementBlock("svg", _hoisted_3, [
|
|
120
|
-
createElementVNode("path", { d: toggleIcon.value }, null, 8 /* PROPS */, _hoisted_4)
|
|
121
|
-
]))
|
|
122
|
-
])), [
|
|
123
|
-
[Tooltip, unref(areChartsSeparateLayout) ? 'Minimize' : 'Maximize']
|
|
124
|
-
])
|
|
125
|
-
: createCommentVNode("v-if", true),
|
|
126
|
-
(usedChartData.value && usedChartSpec.value)
|
|
127
|
-
? (openBlock(), createElementBlock("eox-chart", {
|
|
128
|
-
class: "pa-2",
|
|
129
|
-
".spec": toRaw(usedChartSpec.value),
|
|
130
|
-
key: chartRenderKey.value,
|
|
131
|
-
".dataValues": toRaw(usedChartData.value),
|
|
132
|
-
"onClick:item": _cache[0] || (_cache[0] = (...args) => (unref(onChartClick) && unref(onChartClick)(...args))),
|
|
133
|
-
style: normalizeStyle(chartStyles.value),
|
|
134
|
-
".opt": __props.vegaEmbedOptions
|
|
135
|
-
}, null, 44 /* STYLE, PROPS, NEED_HYDRATION */, _hoisted_5))
|
|
136
|
-
: createCommentVNode("v-if", true)
|
|
137
|
-
])
|
|
138
|
-
], 512 /* NEED_PATCH */))
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
};
|
|
143
|
-
const EodashChart = /*#__PURE__*/_export_sfc(_sfc_main, [['styles',[_style_0]],['__scopeId',"data-v-9ad3f535"]]);
|
|
144
|
-
|
|
145
|
-
export { EodashChart as default };
|