@eodash/eodash 5.0.0-rc.2.5 → 5.0.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.
Files changed (77) hide show
  1. package/core/client/composables/DefineWidgets.js +8 -1
  2. package/core/client/eodash.js +9 -9
  3. package/core/client/eodashSTAC/createLayers.js +4 -18
  4. package/core/client/eodashSTAC/helpers.js +23 -0
  5. package/core/client/store/stac.js +3 -1
  6. package/core/client/types.ts +125 -19
  7. package/core/client/utils/states.js +9 -0
  8. package/dist/client/{DashboardLayout-BX3Sm_Vx.js → DashboardLayout-CkWvOMOW.js} +2 -2
  9. package/dist/client/{DynamicWebComponent-BqoHM1np.js → DynamicWebComponent-DYBbpvUK.js} +1 -1
  10. package/dist/client/{EodashDatePicker-BoWV2vc8.js → EodashDatePicker-CALmW3SI.js} +3 -83
  11. package/dist/client/{EodashItemFilter-127fZLyK.js → EodashItemFilter-DlQiE713.js} +1 -1
  12. package/dist/client/{EodashLayerControl-B-pZaizw.js → EodashLayerControl-DEzEbft7.js} +8 -2
  13. package/dist/client/{EodashLayoutSwitcher-DwexHfOD.js → EodashLayoutSwitcher-CDeCV8F-.js} +2 -2
  14. package/dist/client/{EodashMapBtns-Jfn3bpWD.js → EodashMapBtns-CktQCfa-.js} +36 -12
  15. package/dist/client/{EodashStacInfo-STq_bW7S.js → EodashStacInfo-DPPxDkF6.js} +7 -1
  16. package/dist/client/{EodashTools-uxSuJhVJ.js → EodashTools-CUaL9s4H.js} +5 -4
  17. package/dist/client/{ExportState-Ckcb6u01.js → ExportState-DjyIZVhl.js} +27 -12
  18. package/dist/client/{Footer-C8JP-coH.js → Footer-DyL0JoWt.js} +1 -1
  19. package/dist/client/{Header-Dxx7q9FW.js → Header-B5Dgty9l.js} +3 -3
  20. package/dist/client/{MobileLayout-BE19Peep.js → MobileLayout-CRsg_5Q4.js} +5 -5
  21. package/dist/client/{PopUp-D3IyjsN4.js → PopUp-BfB8s_ki.js} +3 -3
  22. package/dist/client/ProcessList-DTefwQZx.js +484 -0
  23. package/dist/client/{VImg-BmCNSu3X.js → VImg-FD1WVphJ.js} +2 -2
  24. package/dist/client/{VMain-eZDKIfmJ.js → VMain-DJKG4SvM.js} +1 -1
  25. package/dist/client/{VOverlay-BS-E4Z6g.js → VOverlay-BzOdRu9h.js} +15 -6
  26. package/dist/client/{VTooltip-BMsliOuh.js → VTooltip-CfeefrXI.js} +3 -3
  27. package/dist/client/{WidgetsContainer-Cl6M5R5c.js → WidgetsContainer-C2TaTdb6.js} +1 -1
  28. package/dist/client/{asWebComponent-Df8nUiLs.js → asWebComponent-CLhcT715.js} +100 -96
  29. package/dist/client/eo-dash.css +2 -2
  30. package/dist/client/eo-dash.js +1 -1
  31. package/dist/client/{forwardRefs-lhDuXD-N.js → forwardRefs-Bon_Kku1.js} +9 -9
  32. package/dist/client/index-4CT7Tz83.js +85 -0
  33. package/dist/client/{index-Bt5GEGxl.js → index-Bm9cbtx5.js} +1 -1
  34. package/dist/client/{EodashMap-BSR7_wRA.js → index-CIHH_3dW.js} +101 -80
  35. package/dist/client/{EodashProcess-CpbZPYBp.js → index-DiGDvTQU.js} +346 -468
  36. package/dist/client/{transition-DHEuQX4I.js → transition-C5I57hn6.js} +1 -1
  37. package/dist/types/core/client/components/MobileLayout.vue.d.ts +9 -9
  38. package/dist/types/core/client/eodashSTAC/helpers.d.ts +3 -2
  39. package/dist/types/core/client/types.d.ts +83 -17
  40. package/dist/types/core/client/utils/states.d.ts +7 -0
  41. package/dist/types/widgets/EodashDatePicker.vue.d.ts +4 -4
  42. package/dist/types/widgets/EodashItemFilter.vue.d.ts +18 -18
  43. package/dist/types/widgets/EodashLayerControl.vue.d.ts +2 -2
  44. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +2 -2
  45. package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +9 -0
  46. package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -0
  47. package/dist/types/widgets/EodashMapBtns.vue.d.ts +8 -2
  48. package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +2 -0
  49. package/dist/types/widgets/EodashProcess/methods/async.d.ts +45 -0
  50. package/dist/types/widgets/EodashProcess/methods/composables.d.ts +19 -0
  51. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +78 -0
  52. package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +54 -0
  53. package/dist/types/widgets/EodashProcess/methods/utils.d.ts +42 -0
  54. package/dist/types/widgets/EodashStacInfo.vue.d.ts +12 -12
  55. package/dist/types/widgets/EodashTools.vue.d.ts +44 -6
  56. package/dist/types/widgets/PopUp.vue.d.ts +4 -4
  57. package/package.json +27 -27
  58. package/widgets/EodashLayerControl.vue +8 -1
  59. package/widgets/{EodashMap.vue → EodashMap/index.vue} +51 -31
  60. package/widgets/EodashMap/methods/create-layers-config.js +151 -0
  61. package/{core/client/composables/EodashMap.js → widgets/EodashMap/methods/index.js} +4 -153
  62. package/widgets/EodashMapBtns.vue +33 -7
  63. package/widgets/EodashProcess/ProcessList.vue +82 -0
  64. package/widgets/EodashProcess/index.vue +186 -0
  65. package/widgets/EodashProcess/methods/async.js +209 -0
  66. package/widgets/EodashProcess/methods/composables.js +129 -0
  67. package/widgets/EodashProcess/methods/handling.js +254 -0
  68. package/widgets/EodashProcess/methods/outputs.js +216 -0
  69. package/widgets/EodashProcess/methods/utils.js +138 -0
  70. package/widgets/EodashStacInfo.vue +6 -0
  71. package/widgets/EodashTools.vue +1 -0
  72. package/core/client/composables/EodashProcess.js +0 -654
  73. package/dist/types/core/client/composables/EodashMap.d.ts +0 -6
  74. package/dist/types/core/client/composables/EodashProcess.d.ts +0 -162
  75. package/widgets/EodashProcess.vue +0 -206
  76. /package/dist/types/widgets/{EodashMap.vue.d.ts → EodashMap/index.vue.d.ts} +0 -0
  77. /package/dist/types/widgets/{EodashProcess.vue.d.ts → EodashProcess/index.vue.d.ts} +0 -0
@@ -1,162 +0,0 @@
1
- /**
2
- * Polls the process status and fetches a result item when the process is successful.
3
- *
4
- * @param {Object} params - Parameters for polling the process status.
5
- * @param {string} params.processUrl - The URL of the process JSON report.
6
- * @param {import("vue").Ref<boolean>} params.isPolling - checks wether the polling should continue
7
- * @param {number} [params.pollInterval=5000] - The interval (in milliseconds) between polling attempts.
8
- * @param {number} [params.maxRetries=60] - The maximum number of polling attempts.
9
- * @returns {Promise<JSON>} The fetched results JSON.
10
- * @throws {Error} If the process does not complete successfully within the maximum retries.
11
- */
12
- export function pollProcessStatus({ processUrl, isPolling, pollInterval, maxRetries, }: {
13
- processUrl: string;
14
- isPolling: import("vue").Ref<boolean>;
15
- pollInterval?: number | undefined;
16
- maxRetries?: number | undefined;
17
- }): Promise<JSON>;
18
- /**
19
- * Auto execute the process when the jsonform has the execute option
20
- *
21
- * @param {import("vue").Ref<boolean>} autoExec
22
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} jsonformEl
23
- * @param {import("vue").Ref<Record<string,any> | null>} jsonformSchema
24
- * @param {() => Promise<void>} startProcess
25
- **/
26
- export function useAutoExec(autoExec: import("vue").Ref<boolean>, jsonformEl: import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>, jsonformSchema: import("vue").Ref<Record<string, any> | null>, startProcess: () => Promise<void>): void;
27
- /**
28
- * @param {Record<string,any> |null} [jsonformSchema]
29
- **/
30
- export function getBboxProperty(jsonformSchema?: Record<string, any> | null): string;
31
- /**
32
- * Extracts the keys of type "geojson" from the jsonform schema
33
- * @param {Record<string,any> |null} [jsonformSchema]
34
- **/
35
- export function getGeoJsonProperties(jsonformSchema?: Record<string, any> | null): string[];
36
- /**
37
- * Converts jsonform geojson values to stringified geometries
38
- * @param {Record<string,any> |null} [jsonformSchema]
39
- * @param {Record<string,any>} jsonformValue
40
- **/
41
- export function extractGeometries(jsonformValue: Record<string, any>, jsonformSchema?: Record<string, any> | null): void;
42
- /**
43
- * Injects CSS to remove the borders of the jsonform from inside the shadowRoot
44
- * @param {import("@eox/jsonform").EOxJSONForm | null} jsonFormEl
45
- **/
46
- export function injectJsonformCSS(jsonFormEl: import("@eox/jsonform").EOxJSONForm | null): void;
47
- /**
48
- * @param {import("stac-ts").StacLink[] | undefined} links
49
- * @param {Record<string,any>|undefined} jsonformValue
50
- * @param {number[]} origBbox
51
- */
52
- export function processImage(links: import("stac-ts").StacLink[] | undefined, jsonformValue: Record<string, any> | undefined, origBbox: number[]): {
53
- type: string;
54
- properties: {
55
- id: unknown;
56
- title: string;
57
- };
58
- source: {
59
- type: string;
60
- imageExtent: number[];
61
- url: string;
62
- };
63
- }[] | undefined;
64
- /**
65
- * @param {import("stac-ts").StacLink[] | undefined} links
66
- * @param {Record<string,any> | undefined} jsonformValue
67
- * @param {string} layerId
68
- */
69
- export function processVector(links: import("stac-ts").StacLink[] | undefined, jsonformValue: Record<string, any> | undefined, layerId: string): Promise<Record<string, any>[] | undefined>;
70
- /**
71
- * @param {import("stac-ts").StacLink[] | undefined} links
72
- * @param {Record<string,any> | undefined} jsonformValue
73
- * @param {import("vue").Ref<boolean>} isPolling
74
- * @param {string} layerId
75
- */
76
- export function processGeoTiff(links: import("stac-ts").StacLink[] | undefined, jsonformValue: Record<string, any> | undefined, layerId: string, isPolling: import("vue").Ref<boolean>): Promise<{
77
- style?: Record<string, any> | undefined;
78
- type: string;
79
- source: {
80
- type: string;
81
- normalize: boolean;
82
- sources: {
83
- url: string;
84
- }[];
85
- };
86
- properties: {
87
- layerConfig?: Record<string, any> | undefined;
88
- id: string;
89
- title: string;
90
- };
91
- } | undefined>;
92
- /**
93
- * @param {import("stac-ts").StacLink[] | undefined} links
94
- * @param {Record<string,any> | undefined} jsonformValue
95
- * @param {string} specUrl
96
- * @returns {Promise<[import("@eox/chart").EOxChart["spec"] | null,Record<string,any>|null]>}
97
- **/
98
- export function getChartValues(links: import("stac-ts").StacLink[] | undefined, jsonformValue: Record<string, any> | undefined, specUrl: string): Promise<[import("@eox/chart").EOxChart["spec"] | null, Record<string, any> | null]>;
99
- /**
100
- * @param {Object} params
101
- * @param {import("vue").Ref<boolean>} params.loading
102
- * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} params.selectedStac
103
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
104
- * @param {import("vue").Ref<Record<string,any>|null>} params.jsonformSchema
105
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
106
- * @param {import("vue").Ref<Record<string, any> | null>} params.chartData
107
- * @param {import("vue").Ref<boolean>} params.isPolling
108
- * @param {import("vue").Ref<any[]>} params.processResults
109
- */
110
- export function handleProcesses({ loading, selectedStac, jsonformEl, jsonformSchema, chartSpec, chartData, isPolling, processResults, }: {
111
- loading: import("vue").Ref<boolean>;
112
- selectedStac: import("vue").Ref<import("stac-ts").StacCollection | null>;
113
- jsonformEl: import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>;
114
- jsonformSchema: import("vue").Ref<Record<string, any> | null>;
115
- chartSpec: import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>;
116
- chartData: import("vue").Ref<Record<string, any> | null>;
117
- isPolling: import("vue").Ref<boolean>;
118
- processResults: import("vue").Ref<any[]>;
119
- }): Promise<void>;
120
- /**
121
- * Reset the process state
122
- * @param {Object} params
123
- * @param {import("vue").Ref<boolean>} params.loading
124
- * @param {import("vue").Ref<boolean>} params.isProcessed
125
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
126
- * @param {import("vue").Ref<boolean>} params.isPolling
127
- * @param {import("vue").Ref<any[]>} params.processResults
128
- * @param {import("vue").Ref<Record<string,any>|null>} params.jsonformSchema
129
- */
130
- export function resetProcess({ loading, isProcessed, chartSpec, jsonformSchema, processResults, isPolling, }: {
131
- loading: import("vue").Ref<boolean>;
132
- isProcessed: import("vue").Ref<boolean>;
133
- chartSpec: import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>;
134
- isPolling: import("vue").Ref<boolean>;
135
- processResults: import("vue").Ref<any[]>;
136
- jsonformSchema: import("vue").Ref<Record<string, any> | null>;
137
- }): void;
138
- /**
139
- * Description placeholder
140
- *
141
- * @export
142
- * @async
143
- * @param {Object} params
144
- * @param {import("vue").Ref<import("stac-ts").StacCollection>} params.selectedStac
145
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
146
- * @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema
147
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
148
- * @param {import("vue").Ref<any[]>} params.processResults
149
- * @param {import("vue").Ref<boolean>} params.isProcessed
150
- * @param {import("vue").Ref<boolean>} params.loading
151
- * @param {import("vue").Ref<boolean>} params.isPolling
152
- */
153
- export function initProcess({ selectedStac, jsonformEl, jsonformSchema, chartSpec, isProcessed, processResults, loading, isPolling, }: {
154
- selectedStac: import("vue").Ref<import("stac-ts").StacCollection>;
155
- jsonformEl: import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>;
156
- jsonformSchema: import("vue").Ref<Record<string, any> | null>;
157
- chartSpec: import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>;
158
- processResults: import("vue").Ref<any[]>;
159
- isProcessed: import("vue").Ref<boolean>;
160
- loading: import("vue").Ref<boolean>;
161
- isPolling: import("vue").Ref<boolean>;
162
- }): Promise<void>;
@@ -1,206 +0,0 @@
1
- <template>
2
- <div ref="container" class="process-container">
3
- <eox-jsonform
4
- v-if="jsonformSchema"
5
- ref="jsonformEl"
6
- .schema="jsonformSchema"
7
- ></eox-jsonform>
8
- <eox-chart
9
- class="chart"
10
- v-if="isProcessed && chartSpec"
11
- .spec="toRaw(chartSpec)"
12
- .dataValues="toRaw(chartData)"
13
- :style="chartStyles"
14
- />
15
- <v-container>
16
- <span>
17
- <v-btn
18
- v-if="!autoExec"
19
- :loading="loading"
20
- style="float: right; margin-right: 20px"
21
- @click="startProcess"
22
- color="primary"
23
- >
24
- Execute
25
- </v-btn>
26
- <v-btn
27
- v-if="processResults.length && isProcessed"
28
- color="primary"
29
- @click="downloadResults"
30
- >
31
- Download
32
- </v-btn>
33
- </span>
34
- </v-container>
35
- </div>
36
- </template>
37
- <script setup>
38
- import "@eox/chart";
39
- import "@eox/drawtools";
40
- import "@eox/jsonform";
41
-
42
- import { computed, onMounted, ref, toRaw, useTemplateRef } from "vue";
43
- import { useSTAcStore } from "@/store/stac";
44
- import { storeToRefs } from "pinia";
45
- import { mapEl } from "@/store/states";
46
- import { useOnLayersUpdate } from "@/composables";
47
- import { useEventBus } from "@vueuse/core";
48
- import { eoxLayersKey } from "@/utils/keys";
49
- import {
50
- handleProcesses,
51
- initProcess,
52
- useAutoExec,
53
- } from "@/composables/EodashProcess";
54
-
55
- const layersEvents = useEventBus(eoxLayersKey);
56
- const { selectedStac } = storeToRefs(useSTAcStore());
57
-
58
- /** @type {import("vue").Ref<import("vega").Spec|null>} */
59
- const chartSpec = ref(null);
60
-
61
- /** @type {import("vue").Ref<Record<string,any>|null>} */
62
- const chartData = ref(null);
63
- const isProcessed = ref(false);
64
-
65
- /** @type {import("vue").Ref<Record<string,any>|null>} */
66
- const jsonformSchema = ref(null);
67
-
68
- /** @type {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} */
69
- const jsonformEl = ref(null);
70
-
71
- const containerEl = useTemplateRef("container");
72
-
73
- const loading = ref(false);
74
-
75
- const autoExec = ref(false);
76
-
77
- const isPolling = ref(false);
78
- /** @type {import("vue").Ref<any[]>} */
79
- const processResults = ref([]);
80
-
81
- const downloadResults = () => {
82
- processResults.value.forEach((result) => {
83
- if (!result) {
84
- return;
85
- }
86
- let url = "";
87
- let downloadFile = "";
88
- if (typeof result === "string") {
89
- url = result;
90
- //@ts-expect-error TODO
91
- downloadFile = url.includes("/") ? url.split("/").pop() : url;
92
- downloadFile = downloadFile.includes("?")
93
- ? downloadFile.split("?")[0]
94
- : downloadFile;
95
- } else {
96
- result = JSON.stringify(result);
97
- const blob = new Blob([result], { type: "text" });
98
- url = URL.createObjectURL(blob);
99
- downloadFile = selectedStac.value?.id + "_process_results.json";
100
- }
101
- const link = document.createElement("a");
102
- if (confirm(`Would you like to download ${downloadFile}?`)) {
103
- link.href = url;
104
- link.download = downloadFile;
105
- link.click();
106
- }
107
- URL.revokeObjectURL(url);
108
- link.remove();
109
- });
110
- };
111
- onMounted(async () => {
112
- // wait for the layers to be rendered
113
- if (mapEl.value?.layers.length > 1) {
114
- await initProcess({
115
- //@ts-expect-error TODO
116
- selectedStac,
117
- jsonformEl,
118
- jsonformSchema,
119
- chartSpec,
120
- isProcessed,
121
- processResults,
122
- loading,
123
- isPolling,
124
- });
125
- } else {
126
- layersEvents.once(async () => {
127
- await initProcess({
128
- //@ts-expect-error TODO
129
- selectedStac,
130
- jsonformEl,
131
- jsonformSchema,
132
- chartSpec,
133
- isProcessed,
134
- loading,
135
- processResults,
136
- isPolling,
137
- });
138
- });
139
- }
140
- });
141
-
142
- useOnLayersUpdate(async (evt, _payload) => {
143
- if (evt === "layers:updated") {
144
- await initProcess({
145
- //@ts-expect-error TODO
146
- selectedStac,
147
- jsonformEl,
148
- jsonformSchema,
149
- chartSpec,
150
- isProcessed,
151
- processResults,
152
- loading,
153
- isPolling,
154
- });
155
- }
156
- });
157
-
158
- const startProcess = async () => {
159
- const errors = jsonformEl.value?.editor.validate();
160
- if (errors?.length) {
161
- console.warn("[eodash] Form validation failed", errors);
162
- return;
163
- }
164
- processResults.value = [];
165
- await handleProcesses({
166
- jsonformEl,
167
- jsonformSchema,
168
- chartSpec,
169
- chartData,
170
- loading,
171
- //@ts-expect-error TODO
172
- selectedStac,
173
- isProcessed,
174
- isPolling,
175
- processResults,
176
- });
177
- isProcessed.value = true;
178
- };
179
- useAutoExec(autoExec, jsonformEl, jsonformSchema, startProcess);
180
-
181
- const chartStyles = computed(() => {
182
- /** @type {Record<string,string> }*/
183
- const styles = {};
184
- if (!chartSpec.value?.["height"]) {
185
- styles["height"] =
186
- Math.max(
187
- (containerEl.value?.offsetHeight ?? 0) -
188
- (jsonformEl.value?.offsetHeight ?? 0),
189
- 200,
190
- ) + "px";
191
- }
192
- return styles;
193
- });
194
- </script>
195
- <style>
196
- .process-container {
197
- height: 100%;
198
- overflow-y: auto;
199
- }
200
- eox-chart {
201
- --background-color: transparent;
202
- }
203
- eox-jsonform {
204
- padding: 0.7em;
205
- }
206
- </style>