@eodash/eodash 5.1.0 → 5.3.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/components/DashboardLayout.vue +1 -2
- package/core/client/components/EodashOverlay.vue +4 -5
- package/core/client/components/MobileLayout.vue +42 -21
- package/core/client/composables/index.js +54 -60
- package/core/client/eodashSTAC/EodashCollection.js +199 -108
- package/core/client/eodashSTAC/auth.js +86 -0
- package/core/client/eodashSTAC/createLayers.js +234 -4
- package/core/client/eodashSTAC/helpers.js +281 -59
- package/core/client/eodashSTAC/parquet.js +0 -13
- package/core/client/eodashSTAC/triggers.js +1 -1
- package/core/client/store/actions.js +14 -0
- package/core/client/store/stac.js +46 -8
- package/core/client/store/states.js +6 -0
- package/core/client/types.ts +206 -3
- package/core/client/utils/bands-editor/arithmetic.js +144 -0
- package/core/client/utils/bands-editor/colors.js +36 -0
- package/core/client/utils/bands-editor/dom.js +196 -0
- package/core/client/utils/bands-editor/exampleSchema.json +1320 -0
- package/core/client/utils/bands-editor/index.js +68 -0
- package/core/client/utils/bands-editor/rgb.js +102 -0
- package/core/client/utils/index.js +5 -2
- package/core/client/views/Dashboard.vue +1 -1
- package/core/client/vite-env.d.ts +122 -0
- package/dist/client/{DashboardLayout-ByVs1DrY.js → DashboardLayout-Cq15p4TH.js} +5 -6
- package/dist/client/{DynamicWebComponent-C3W7HSQm.js → DynamicWebComponent-Cv-fPRG1.js} +1 -1
- package/dist/client/{EodashDatePicker-BIAf1sMT.js → EodashDatePicker-CPlJwEIO.js} +20 -22
- package/dist/client/{EodashItemFilter-DPznh8UB.js → EodashItemFilter-Ydebgbjj.js} +46 -31
- package/dist/client/EodashLayerControl-COhrkNEs.js +1517 -0
- package/dist/client/{EodashLayoutSwitcher-C5qTEffW.js → EodashLayoutSwitcher-pnKhTRZV.js} +4 -4
- package/dist/client/EodashMapBtns-Cj0Fx119.js +301 -0
- package/dist/client/{EodashStacInfo-CSvvF2jI.js → EodashStacInfo-Dadkg_Nj.js} +1 -1
- package/dist/client/EodashTimeSlider-CpoHX0S7.js +53 -0
- package/dist/client/{EodashTools-Cv1SXQ5y.js → EodashTools-UGBG7KC9.js} +10 -7
- package/dist/client/{ExportState-D-iuwaad.js → ExportState-GtJkAqeZ.js} +145 -121
- package/dist/client/{Footer-CyF0zRAk.js → Footer-D3ZPG5c4.js} +1 -1
- package/dist/client/{Header-CgD8jDKU.js → Header-z6AK-wpN.js} +2 -3
- package/dist/client/MobileLayout-BXNsNftb.js +118 -0
- package/dist/client/{PopUp-BsYLvWch.js → PopUp-BbQdjENV.js} +79 -44
- package/dist/client/{ProcessList-C2xsLU2_.js → ProcessList-C6VsdsYI.js} +18 -12
- package/dist/client/{VImg-OHe8YTs2.js → VImg-CxaMSB99.js} +203 -5
- package/dist/client/{VMain-PryTLU4a.js → VMain-Ds7yw0wj.js} +1 -1
- package/dist/client/{VTooltip-DZ0fjpB3.js → VTooltip-Cze6CEVh.js} +2 -3
- package/dist/client/{WidgetsContainer-B9LBadcC.js → WidgetsContainer-D66bj-JJ.js} +1 -1
- package/dist/client/asWebComponent-CWbNRdf9.js +8895 -0
- package/dist/client/{async-DkSu_u2K.js → async-BA7oWCMX.js} +69 -5
- package/dist/client/easing-CH0-9wR8.js +35 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{VOverlay-yUn7p-Uf.js → forwardRefs-BUfxOIo-.js} +308 -28
- package/dist/client/{handling-CgmFXkW6.js → handling-DlNTtKB-.js} +27 -6
- package/dist/client/{helpers-Dy0Q13tP.js → helpers-CtE0W7iu.js} +595 -278
- package/dist/client/{index-skjhlH8u.js → index-CeEZIjO6.js} +26 -13
- package/dist/client/{index-Ch_HchK3.js → index-CsKbRDeN.js} +238 -77
- package/dist/client/{index-Dqj4tbx2.js → index-D4_NRKrf.js} +2 -2
- package/dist/client/index-DeECc3lV.js +571 -0
- package/dist/client/material-symbols-outlined.woff2 +0 -0
- package/dist/client/material-symbols-rounded.woff2 +0 -0
- package/dist/client/material-symbols-sharp.woff2 +0 -0
- package/dist/client/material-symbols-subset.woff2 +0 -0
- package/dist/client/templates.js +106 -49
- package/dist/client/{transition-C98Yn4Vo.js → transition-Byvp3L6Y.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +24 -10
- package/dist/types/core/client/eodashSTAC/auth.d.ts +7 -0
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +15 -3
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +51 -15
- package/dist/types/core/client/plugins/vuetify.d.ts +14 -14
- package/dist/types/core/client/store/actions.d.ts +2 -0
- package/dist/types/core/client/store/stac.d.ts +16 -7
- package/dist/types/core/client/store/states.d.ts +4 -0
- package/dist/types/core/client/types.d.ts +171 -3
- package/dist/types/core/client/utils/bands-editor/arithmetic.d.ts +8 -0
- package/dist/types/core/client/utils/bands-editor/colors.d.ts +15 -0
- package/dist/types/core/client/utils/bands-editor/dom.d.ts +42 -0
- package/dist/types/core/client/utils/bands-editor/index.d.ts +20 -0
- package/dist/types/core/client/utils/bands-editor/rgb.d.ts +15 -0
- package/dist/types/core/client/utils/index.d.ts +1 -1
- package/dist/types/templates/baseConfig.d.ts +87 -1
- package/dist/types/templates/compare.d.ts +0 -25
- package/dist/types/templates/expert.d.ts +17 -21
- package/dist/types/templates/explore.d.ts +67 -0
- package/dist/types/templates/index.d.ts +1 -1
- package/dist/types/templates/{light.d.ts → lite.d.ts} +9 -0
- package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +21 -0
- package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +49 -0
- package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +4 -0
- package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +12 -0
- package/dist/types/widgets/EodashItemCatalog/types.d.ts +14 -0
- package/dist/types/widgets/{EodashMapBtns.vue.d.ts → EodashMap/EodashMapBtns.vue.d.ts} +6 -0
- package/dist/types/widgets/EodashMap/index.vue.d.ts +114 -0
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -1
- package/dist/types/widgets/EodashMap/methods/index.d.ts +1 -1
- package/dist/types/widgets/EodashProcess/methods/async.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +1 -1
- package/dist/types/widgets/EodashTimeSlider.vue.d.ts +7 -0
- package/dist/types/widgets/EodashTools.vue.d.ts +10 -10
- package/dist/types/widgets/ExportState.vue.d.ts +2 -0
- package/package.json +31 -28
- package/templates/baseConfig.js +10 -5
- package/templates/compare.js +2 -22
- package/templates/expert.js +19 -18
- package/templates/explore.js +62 -0
- package/templates/index.js +1 -1
- package/templates/{light.js → lite.js} +11 -2
- package/widgets/EodashDatePicker.vue +15 -18
- package/widgets/EodashItemCatalog/index.vue +161 -0
- package/widgets/EodashItemCatalog/methods/filters.js +216 -0
- package/widgets/EodashItemCatalog/methods/handlers.js +50 -0
- package/widgets/EodashItemCatalog/methods/map.js +144 -0
- package/widgets/EodashItemCatalog/types.ts +15 -0
- package/widgets/EodashItemFilter.vue +35 -28
- package/widgets/EodashLayerControl.vue +10 -6
- package/widgets/EodashLayoutSwitcher.vue +1 -1
- package/widgets/EodashMap/EodashMapBtns.vue +278 -0
- package/widgets/EodashMap/index.vue +263 -38
- package/widgets/EodashMap/methods/create-layers-config.js +9 -6
- package/widgets/EodashMap/methods/index.js +27 -13
- package/widgets/EodashProcess/ProcessList.vue +13 -1
- package/widgets/EodashProcess/index.vue +17 -1
- package/widgets/EodashProcess/methods/async.js +22 -1
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +25 -3
- package/widgets/EodashProcess/methods/handling.js +2 -0
- package/widgets/EodashProcess/methods/outputs.js +1 -0
- package/widgets/EodashProcess/methods/utils.js +45 -1
- package/widgets/EodashTimeSlider.vue +40 -0
- package/widgets/EodashTools.vue +7 -3
- package/widgets/ExportState.vue +53 -22
- package/dist/client/EodashLayerControl-Bhxjw4V2.js +0 -154
- package/dist/client/EodashMapBtns-WoGq8MuV.js +0 -173
- package/dist/client/MobileLayout-EKQ_kpSh.js +0 -1226
- package/dist/client/asWebComponent-By_7_JjS.js +0 -19193
- package/dist/client/forwardRefs-BXxrv98s.js +0 -272
- package/dist/client/index-BuhOHXKv.js +0 -199
- package/widgets/EodashMapBtns.vue +0 -155
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, withAsyncContext, useTemplateRef, ref, createElementBlock, openBlock, createVNode, createElementVNode, withCtx, unref, toDisplayString } from 'vue';
|
|
2
|
+
import { E as useSTAcStore, K as useOnLayersUpdate, _ as _export_sfc, L as VRow } from './asWebComponent-CWbNRdf9.js';
|
|
3
|
+
import { E as indicator, h as mapEl, L as sanitizeBbox, j as axios } from './helpers-CtE0W7iu.js';
|
|
4
|
+
import { i as inAndOut } from './easing-CH0-9wR8.js';
|
|
5
|
+
import { mdiViewDashboard } from '@mdi/js';
|
|
6
|
+
import _sfc_main$1 from './EodashLayoutSwitcher-pnKhTRZV.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {import("../types").FiltersConfig} filtersConfig
|
|
11
|
+
*/
|
|
12
|
+
const createSubtitleProperty = (filtersConfig) => {
|
|
13
|
+
/**
|
|
14
|
+
* @param {Record<string, any>} item
|
|
15
|
+
*/ // should be dynamic based on a prop
|
|
16
|
+
return (item) => {
|
|
17
|
+
let subtitle = "";
|
|
18
|
+
filtersConfig.forEach((filter) => {
|
|
19
|
+
const property = filter.property;
|
|
20
|
+
if ((!filter.icon && !filter.unitLabel) || !item.properties[property]) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (filter.icon) {
|
|
24
|
+
subtitle += filter.icon;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let value = item.properties[property];
|
|
28
|
+
if (typeof value === "number" && !Number.isInteger(value)) {
|
|
29
|
+
value = value.toFixed(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
subtitle += value;
|
|
33
|
+
|
|
34
|
+
if (filter.unitLabel) {
|
|
35
|
+
subtitle += filter.unitLabel;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return subtitle;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {Array<{
|
|
44
|
+
* property: string,
|
|
45
|
+
* type: "range" | "multiselect" | "select",
|
|
46
|
+
* title?: string,
|
|
47
|
+
* min?: number,
|
|
48
|
+
* max?: number,
|
|
49
|
+
* filterKeys?: string[],
|
|
50
|
+
* state?: Record<string, boolean>,
|
|
51
|
+
* placeholder?: string,
|
|
52
|
+
* }>} filtersConfig
|
|
53
|
+
*/
|
|
54
|
+
// Transform simple filter configs into eox-itemfilter format
|
|
55
|
+
const createFilterProperties = (filtersConfig) => {
|
|
56
|
+
const store = useSTAcStore();
|
|
57
|
+
const baseFilters = [
|
|
58
|
+
{
|
|
59
|
+
key: "collection",
|
|
60
|
+
title: "Collections",
|
|
61
|
+
type: "multiselect",
|
|
62
|
+
placeholder: "Select collections",
|
|
63
|
+
inline: false,
|
|
64
|
+
filterKeys: store.stac?.map((col) => col.id) || [],
|
|
65
|
+
...(indicator.value && { state: { [indicator.value]: true } }),
|
|
66
|
+
},
|
|
67
|
+
// {
|
|
68
|
+
// key: "properties.datetime",
|
|
69
|
+
// title: "Date",
|
|
70
|
+
// type: "range",
|
|
71
|
+
// format: "date",
|
|
72
|
+
// }
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
const dynamicFilters = filtersConfig
|
|
76
|
+
.map((filter) => {
|
|
77
|
+
const propertyKey = `properties.${filter.property}`;
|
|
78
|
+
|
|
79
|
+
if (filter.type === "range") {
|
|
80
|
+
return {
|
|
81
|
+
key: propertyKey,
|
|
82
|
+
title: filter.title || filter.property,
|
|
83
|
+
type: "range",
|
|
84
|
+
expanded: true,
|
|
85
|
+
filterKeys: [filter.min || 0, filter.max || 100],
|
|
86
|
+
state: {
|
|
87
|
+
min: filter.min ?? 0,
|
|
88
|
+
max: filter.max ?? 100,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
} else if (filter.type === "multiselect") {
|
|
92
|
+
return {
|
|
93
|
+
key: propertyKey,
|
|
94
|
+
title: filter.title || filter.property,
|
|
95
|
+
type: "multiselect",
|
|
96
|
+
placeholder: filter.placeholder || `Select ${filter.property}`,
|
|
97
|
+
inline: false,
|
|
98
|
+
filterKeys: filter.filterKeys || [],
|
|
99
|
+
state: filter.state,
|
|
100
|
+
};
|
|
101
|
+
} else if (filter.type === "select") {
|
|
102
|
+
return {
|
|
103
|
+
key: propertyKey,
|
|
104
|
+
title: filter.title || filter.property,
|
|
105
|
+
type: "select",
|
|
106
|
+
placeholder:
|
|
107
|
+
filter.placeholder || `Select ${filter.title || filter.property}`,
|
|
108
|
+
filterKeys: filter.filterKeys || [],
|
|
109
|
+
state: filter.state,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null;
|
|
114
|
+
})
|
|
115
|
+
.filter(Boolean);
|
|
116
|
+
|
|
117
|
+
return [...baseFilters, ...dynamicFilters];
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Build STAC API filter string from dynamic filters
|
|
122
|
+
* @param {Record<string,any>} filters
|
|
123
|
+
* @param {import("../types").FiltersConfig} propsFilters
|
|
124
|
+
* @returns {string}
|
|
125
|
+
*/
|
|
126
|
+
const buildStacFilters = (filters, propsFilters) => {
|
|
127
|
+
/** @type {string[]} */
|
|
128
|
+
const stacFilters = [];
|
|
129
|
+
|
|
130
|
+
propsFilters.forEach((filterConfig) => {
|
|
131
|
+
const filterKey = `properties.${filterConfig.property}`;
|
|
132
|
+
const filterValue = filters[filterKey];
|
|
133
|
+
|
|
134
|
+
if (!filterValue) return;
|
|
135
|
+
|
|
136
|
+
if (filterConfig.type === "range" && filterValue.state) {
|
|
137
|
+
const { min, max } = filterValue.state;
|
|
138
|
+
|
|
139
|
+
// Add range filters based on configuration
|
|
140
|
+
if (min !== undefined && min > (filterConfig.min || 0)) {
|
|
141
|
+
stacFilters.push(`${filterConfig.property}>=${min}`);
|
|
142
|
+
}
|
|
143
|
+
if (max !== undefined && max < (filterConfig.max || 100)) {
|
|
144
|
+
stacFilters.push(`${filterConfig.property}<=${max}`);
|
|
145
|
+
}
|
|
146
|
+
} else if (
|
|
147
|
+
filterConfig.type === "multiselect" &&
|
|
148
|
+
filterValue.stringifiedState
|
|
149
|
+
) {
|
|
150
|
+
// Handle multiselect filters
|
|
151
|
+
const selectedValues = filterValue.stringifiedState;
|
|
152
|
+
if (selectedValues.length > 0) {
|
|
153
|
+
stacFilters.push(`${filterConfig.property} IN (${selectedValues})`);
|
|
154
|
+
}
|
|
155
|
+
} else if (filterConfig.type === "select" && filterValue.stringifiedState) {
|
|
156
|
+
// Handle single select filters
|
|
157
|
+
const selectedValue = filterValue.stringifiedState;
|
|
158
|
+
if (selectedValue) {
|
|
159
|
+
stacFilters.push(`${filterConfig.property}='${selectedValue}'`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return stacFilters.join(" AND ");
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Build search URL with proper STAC API parameters
|
|
169
|
+
* @param {Record<string,any>} filters
|
|
170
|
+
* @param {Array<any>} propsFilters
|
|
171
|
+
* @param {boolean} bboxFilter
|
|
172
|
+
* @returns {string}
|
|
173
|
+
*/
|
|
174
|
+
const buildSearchUrl = (filters, propsFilters, bboxFilter) => {
|
|
175
|
+
const store = useSTAcStore();
|
|
176
|
+
const params = new URLSearchParams();
|
|
177
|
+
|
|
178
|
+
// Add collections
|
|
179
|
+
if (filters.collection?.stringifiedState) {
|
|
180
|
+
params.append(
|
|
181
|
+
"collections",
|
|
182
|
+
filters.collection.stringifiedState.replaceAll(" ", ""),
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (mapEl.value?.lonLatExtent && bboxFilter) {
|
|
187
|
+
params.append(
|
|
188
|
+
"bbox",
|
|
189
|
+
sanitizeBbox([...mapEl.value.lonLatExtent]).join(","),
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Add dynamic filters
|
|
194
|
+
const stacFilter = buildStacFilters(filters, propsFilters);
|
|
195
|
+
if (stacFilter) {
|
|
196
|
+
params.append("filter", stacFilter);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Add limit
|
|
200
|
+
params.append("limit", "100");
|
|
201
|
+
|
|
202
|
+
return `${store.stacEndpoint}/search?${params.toString()}`;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* @param {import("../types").FiltersConfig} propsFilters
|
|
208
|
+
* @param {boolean} bboxFilter
|
|
209
|
+
*/
|
|
210
|
+
const createExternalFilter = (propsFilters, bboxFilter) => {
|
|
211
|
+
/**
|
|
212
|
+
* @param {Array<any>} _items
|
|
213
|
+
* @param {Record<string,any>} filters
|
|
214
|
+
*/
|
|
215
|
+
return (_items, filters) => ({
|
|
216
|
+
url: buildSearchUrl(filters, propsFilters, bboxFilter),
|
|
217
|
+
key: "features",
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
*
|
|
223
|
+
* @param {import("@/types").GeoJsonFeature[]} features
|
|
224
|
+
*/
|
|
225
|
+
function renderItemsFeatures(features) {
|
|
226
|
+
let analysisLayers =
|
|
227
|
+
/** @type {import("@eox/map/src/layers").EOxLayerTypeGroup} */ (
|
|
228
|
+
mapEl.value?.layers?.find((l) => l.properties?.id === "AnalysisGroup")
|
|
229
|
+
);
|
|
230
|
+
if (!mapEl.value || !features) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (!analysisLayers) {
|
|
234
|
+
analysisLayers = {
|
|
235
|
+
type: "Group",
|
|
236
|
+
properties: {
|
|
237
|
+
id: "AnalysisGroup",
|
|
238
|
+
title: "Data Layers",
|
|
239
|
+
},
|
|
240
|
+
layers: [],
|
|
241
|
+
};
|
|
242
|
+
mapEl.value.layers = [analysisLayers, ...mapEl.value.layers.reverse()];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const stacItemsLayer = {
|
|
246
|
+
type: "Vector",
|
|
247
|
+
properties: {
|
|
248
|
+
id: "stac-items",
|
|
249
|
+
title: "STAC Items",
|
|
250
|
+
},
|
|
251
|
+
source: {
|
|
252
|
+
type: "Vector",
|
|
253
|
+
url:
|
|
254
|
+
"data:application/geo+json," +
|
|
255
|
+
encodeURIComponent(
|
|
256
|
+
JSON.stringify({ type: "FeatureCollection", features }),
|
|
257
|
+
),
|
|
258
|
+
format: "GeoJSON",
|
|
259
|
+
},
|
|
260
|
+
style: {
|
|
261
|
+
"fill-color": "transparent",
|
|
262
|
+
"stroke-color": "#003170",
|
|
263
|
+
},
|
|
264
|
+
interactions: [
|
|
265
|
+
{
|
|
266
|
+
type: "select",
|
|
267
|
+
options: {
|
|
268
|
+
id: "stac-items",
|
|
269
|
+
condition: "pointermove",
|
|
270
|
+
style: {
|
|
271
|
+
"stroke-color": "white",
|
|
272
|
+
"stroke-width": 3,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
};
|
|
278
|
+
const exists = analysisLayers.layers.some(
|
|
279
|
+
(l) => l.properties?.id === "stac-items",
|
|
280
|
+
);
|
|
281
|
+
if (exists) {
|
|
282
|
+
//@ts-expect-error todo
|
|
283
|
+
mapEl.value.addOrUpdateLayer(stacItemsLayer);
|
|
284
|
+
return;
|
|
285
|
+
} else {
|
|
286
|
+
//@ts-expect-error todo
|
|
287
|
+
analysisLayers.layers.unshift(stacItemsLayer);
|
|
288
|
+
mapEl.value.layers = [...mapEl.value.layers].reverse();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* @param {import("vue").Ref<any>} itemFilter
|
|
294
|
+
* @param {boolean} bboxFilter
|
|
295
|
+
*/
|
|
296
|
+
const useSearchOnMapMove = (itemFilter, bboxFilter) => {
|
|
297
|
+
if (!bboxFilter) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
/** @type {NodeJS.Timeout} */
|
|
301
|
+
let timeout;
|
|
302
|
+
const handler = () => {
|
|
303
|
+
clearTimeout(timeout);
|
|
304
|
+
timeout = setTimeout(() => {
|
|
305
|
+
itemFilter.value?.search();
|
|
306
|
+
}, 800); // 800ms debounce
|
|
307
|
+
};
|
|
308
|
+
onMounted(() => {
|
|
309
|
+
mapEl.value?.map.on("moveend", handler);
|
|
310
|
+
});
|
|
311
|
+
onUnmounted(() => {
|
|
312
|
+
mapEl.value?.map.un("moveend", handler);
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
*
|
|
317
|
+
* @param {import("vue").Ref<import("@/types").GeoJsonFeature[]>} currentItems
|
|
318
|
+
*/
|
|
319
|
+
const useRenderItemsFeatures = (currentItems) => {
|
|
320
|
+
const renderOnUpdate = () =>
|
|
321
|
+
useOnLayersUpdate(() => {
|
|
322
|
+
// consider cases where this is not needed
|
|
323
|
+
renderItemsFeatures(currentItems.value);
|
|
324
|
+
});
|
|
325
|
+
onMounted(() => {
|
|
326
|
+
renderItemsFeatures(currentItems.value);
|
|
327
|
+
renderOnUpdate();
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
*
|
|
332
|
+
* @param {import("vue").Ref<any>} itemfilterEl
|
|
333
|
+
*/
|
|
334
|
+
function useRenderOnFeatureHover(itemfilterEl) {
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
337
|
+
* @param {CustomEvent} evt
|
|
338
|
+
*/
|
|
339
|
+
const handler = (evt) => {
|
|
340
|
+
const itemId = evt.detail?.feature?.getId();
|
|
341
|
+
if (!itemId) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const item = itemfilterEl.value.items?.find(
|
|
345
|
+
//@ts-expect-error todo
|
|
346
|
+
(r) => r.id === itemId,
|
|
347
|
+
);
|
|
348
|
+
if (item) {
|
|
349
|
+
itemfilterEl.value.selectedResult = item;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
onMounted(() => {
|
|
353
|
+
//@ts-expect-error todo
|
|
354
|
+
mapEl.value?.addEventListener("select", handler);
|
|
355
|
+
});
|
|
356
|
+
onUnmounted(() => {
|
|
357
|
+
//@ts-expect-error todo
|
|
358
|
+
mapEl.value?.removeEventListener("select", handler);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @param {import("vue").Ref<import("@/types").GeoJsonFeature[]>} currentItems
|
|
364
|
+
*/
|
|
365
|
+
const createOnFilterHandler = (currentItems) => {
|
|
366
|
+
/** @param {CustomEvent} evt */
|
|
367
|
+
return (evt) => {
|
|
368
|
+
currentItems.value = evt.detail.results;
|
|
369
|
+
renderItemsFeatures(currentItems.value);
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
*
|
|
374
|
+
* @param {ReturnType<typeof import("@/store/stac.js").useSTAcStore>} store
|
|
375
|
+
* @returns
|
|
376
|
+
*/
|
|
377
|
+
const createOnSelectHandler = (store) => {
|
|
378
|
+
/** @param {CustomEvent} evt */
|
|
379
|
+
return async (evt) => {
|
|
380
|
+
const item = /** @type {import("stac-ts").StacItem} */ (evt.detail);
|
|
381
|
+
if (!item) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (store.selectedStac?.id === item.collection) {
|
|
385
|
+
store.selectedItem = item;
|
|
386
|
+
} else {
|
|
387
|
+
await store.loadSelectedSTAC(item.collection, false, item);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
mapEl.value?.selectInteractions["stac-items"]?.highlightById([item.id], {
|
|
391
|
+
padding: [100, 100, 100, 100],
|
|
392
|
+
duration: 1200,
|
|
393
|
+
easing: inAndOut,
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
*
|
|
400
|
+
* @param {CustomEvent} evt
|
|
401
|
+
*/
|
|
402
|
+
const onMouseEnterResult = (evt) => {
|
|
403
|
+
mapEl.value?.selectInteractions["stac-items"]?.highlightById([evt.detail.id]);
|
|
404
|
+
};
|
|
405
|
+
const onMouseLeaveResult = () => {
|
|
406
|
+
mapEl.value?.selectInteractions["stac-items"]?.highlightById([]);
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const _style_0 = "eox-itemfilter[data-v-64c66d83]{flex-basis:20%;height:100%;overflow:hidden!important;padding:1rem;--eox-itemfilter-results-color: var(--v-theme-surface) !important}.title[data-v-64c66d83]{padding:1em;margin:.2em}";
|
|
410
|
+
|
|
411
|
+
const _hoisted_1 = [".imageProperty", ".subTitleProperty", ".filterProperties", ".items", "externalFilter"];
|
|
412
|
+
const _hoisted_2 = {
|
|
413
|
+
slot: "filterstitle",
|
|
414
|
+
style: {"margin":"14px 8px"}
|
|
415
|
+
};
|
|
416
|
+
const _hoisted_3 = {
|
|
417
|
+
slot: "resultstitle",
|
|
418
|
+
style: {"margin":"14px 8px"}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
const _sfc_main = {
|
|
423
|
+
__name: 'index',
|
|
424
|
+
props: {
|
|
425
|
+
title: {
|
|
426
|
+
type: String,
|
|
427
|
+
default: "Explore Catalog",
|
|
428
|
+
},
|
|
429
|
+
layoutTarget: {
|
|
430
|
+
type: String,
|
|
431
|
+
default: "lite",
|
|
432
|
+
},
|
|
433
|
+
layoutIcon: {
|
|
434
|
+
type: String,
|
|
435
|
+
default: mdiViewDashboard,
|
|
436
|
+
},
|
|
437
|
+
filtersTitle: {
|
|
438
|
+
type: String,
|
|
439
|
+
default: "Filters:",
|
|
440
|
+
},
|
|
441
|
+
resultsTitle: {
|
|
442
|
+
type: String,
|
|
443
|
+
default: "Items:",
|
|
444
|
+
},
|
|
445
|
+
bboxFilter: {
|
|
446
|
+
type: Boolean,
|
|
447
|
+
default: true,
|
|
448
|
+
},
|
|
449
|
+
imageProperty: {
|
|
450
|
+
type: String,
|
|
451
|
+
default: "assets.thumbnail.href",
|
|
452
|
+
},
|
|
453
|
+
filters: {
|
|
454
|
+
/** @type {import("vue").PropType<import("./types").FiltersConfig>} */
|
|
455
|
+
type: Array,
|
|
456
|
+
default: () => [
|
|
457
|
+
{
|
|
458
|
+
property: "eo:cloud_cover",
|
|
459
|
+
type: "range",
|
|
460
|
+
title: "Cloud Cover (%)",
|
|
461
|
+
min: 0,
|
|
462
|
+
max: 100,
|
|
463
|
+
icon: `<svg style="height: 1rem; transform: translateY(-2px); fill: currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>weather-cloudy</title><path d="M6,19A5,5 0 0,1 1,14A5,5 0 0,1 6,9C7,6.65 9.3,5 12,5C15.43,5 18.24,7.66 18.5,11.03L19,11A4,4 0 0,1 23,15A4,4 0 0,1 19,19H6M19,13H17V12A5,5 0 0,0 12,7C9.5,7 7.45,8.82 7.06,11.19C6.73,11.07 6.37,11 6,11A3,3 0 0,0 3,14A3,3 0 0,0 6,17H19A2,2 0 0,0 21,15A2,2 0 0,0 19,13Z" /></svg>`,
|
|
464
|
+
unitLabel: "%",
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
async setup(__props) {
|
|
470
|
+
|
|
471
|
+
let __temp, __restore;
|
|
472
|
+
|
|
473
|
+
if (!customElements.get("eox-itemfilter")) {
|
|
474
|
+
(
|
|
475
|
+
([__temp,__restore] = withAsyncContext(() => import('@eox/itemfilter'))),
|
|
476
|
+
await __temp,
|
|
477
|
+
__restore()
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Props definition
|
|
482
|
+
const props = __props;
|
|
483
|
+
|
|
484
|
+
// Store and template refs
|
|
485
|
+
const store = useSTAcStore();
|
|
486
|
+
const itemfilterEl = useTemplateRef("itemfilter");
|
|
487
|
+
|
|
488
|
+
// Reactive state
|
|
489
|
+
/** @type {import("vue").Ref<import("@/types").GeoJsonFeature[]>} */
|
|
490
|
+
const currentItems = ref([]);
|
|
491
|
+
(
|
|
492
|
+
([__temp,__restore] = withAsyncContext(() => axios
|
|
493
|
+
.get(store.stacEndpoint + "/search?limit=100")
|
|
494
|
+
.then((res) => (currentItems.value = res.data.features)))),
|
|
495
|
+
await __temp,
|
|
496
|
+
__restore()
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const items = currentItems.value;
|
|
500
|
+
|
|
501
|
+
const filterProperties = createFilterProperties(props.filters);
|
|
502
|
+
|
|
503
|
+
const subTitleProperty = createSubtitleProperty(props.filters);
|
|
504
|
+
|
|
505
|
+
const externalFilterHandler = createExternalFilter(
|
|
506
|
+
props.filters,
|
|
507
|
+
props.bboxFilter,
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
// Event handlers
|
|
511
|
+
/**
|
|
512
|
+
* @param {CustomEvent} evt
|
|
513
|
+
*/
|
|
514
|
+
const onFilter = createOnFilterHandler(currentItems);
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* @param {CustomEvent} evt
|
|
518
|
+
*/
|
|
519
|
+
const onSelectItem = createOnSelectHandler(store);
|
|
520
|
+
|
|
521
|
+
// composables
|
|
522
|
+
|
|
523
|
+
// Render items features on the map
|
|
524
|
+
useRenderItemsFeatures(currentItems);
|
|
525
|
+
// Search on map move logic
|
|
526
|
+
useSearchOnMapMove(itemfilterEl, props.bboxFilter);
|
|
527
|
+
|
|
528
|
+
useRenderOnFeatureHover(itemfilterEl);
|
|
529
|
+
|
|
530
|
+
onUnmounted(() => {
|
|
531
|
+
store.selectedItem = null;
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
return (_ctx, _cache) => {
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
return (openBlock(), createElementBlock("span", null, [
|
|
538
|
+
createVNode(VRow, { class: "title align-center justify-space-between" }, {
|
|
539
|
+
default: withCtx(() => [
|
|
540
|
+
_cache[4] || (_cache[4] = createElementVNode("h4", null, "Catalog Items", -1 /* CACHED */)),
|
|
541
|
+
createVNode(_sfc_main$1, {
|
|
542
|
+
target: __props.layoutTarget,
|
|
543
|
+
icon: __props.layoutIcon
|
|
544
|
+
}, null, 8 /* PROPS */, ["target", "icon"])
|
|
545
|
+
]),
|
|
546
|
+
_: 1 /* STABLE */
|
|
547
|
+
}),
|
|
548
|
+
createElementVNode("eox-itemfilter", {
|
|
549
|
+
ref: "itemfilter",
|
|
550
|
+
titleProperty: "id",
|
|
551
|
+
".imageProperty": __props.imageProperty,
|
|
552
|
+
".subTitleProperty": unref(subTitleProperty),
|
|
553
|
+
".filterProperties": unref(filterProperties),
|
|
554
|
+
".items": unref(items),
|
|
555
|
+
onSelect: _cache[0] || (_cache[0] = (...args) => (unref(onSelectItem) && unref(onSelectItem)(...args))),
|
|
556
|
+
onFilter: _cache[1] || (_cache[1] = (...args) => (unref(onFilter) && unref(onFilter)(...args))),
|
|
557
|
+
"onMouseenter:result": _cache[2] || (_cache[2] = (...args) => (unref(onMouseEnterResult) && unref(onMouseEnterResult)(...args))),
|
|
558
|
+
"onMouseleave:result": _cache[3] || (_cache[3] = (...args) => (unref(onMouseLeaveResult) && unref(onMouseLeaveResult)(...args))),
|
|
559
|
+
externalFilter: unref(externalFilterHandler)
|
|
560
|
+
}, [
|
|
561
|
+
createElementVNode("h4", _hoisted_2, toDisplayString(__props.filtersTitle), 1 /* TEXT */),
|
|
562
|
+
createElementVNode("h4", _hoisted_3, toDisplayString(__props.resultsTitle), 1 /* TEXT */)
|
|
563
|
+
], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1)
|
|
564
|
+
]))
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
};
|
|
569
|
+
const index = /*#__PURE__*/_export_sfc(_sfc_main, [['styles',[_style_0]],['__scopeId',"data-v-64c66d83"]]);
|
|
570
|
+
|
|
571
|
+
export { index as default };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|