@eodash/eodash 5.7.0 → 5.7.1
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/EodashOverlay.vue +27 -4
- package/core/client/composables/DefineEodash.js +0 -1
- package/core/client/composables/DefineWidgets.js +3 -1
- package/core/client/eodashSTAC/EodashCollection.js +74 -20
- package/core/client/eodashSTAC/cql.js +64 -0
- package/core/client/eodashSTAC/createLayers.js +169 -116
- package/core/client/eodashSTAC/helpers.js +391 -98
- package/core/client/eodashSTAC/mosaic.js +416 -0
- package/core/client/plugins/axios.js +31 -1
- package/core/client/store/actions.js +1 -1
- package/core/client/store/stac.js +25 -4
- package/core/client/store/states.js +20 -2
- package/core/client/types.ts +147 -28
- package/core/client/utils/bands-editor/exampleSchema.json +50 -50
- package/core/client/utils/states.js +10 -0
- package/dist/client/{DashboardLayout-kRsmsNW5.js → DashboardLayout-ePbdvUTE.js} +2 -2
- package/dist/client/{DynamicWebComponent-CnKhYo0K.js → DynamicWebComponent-g5SdRbjY.js} +1 -1
- package/dist/client/{EodashChart-CLDqE93C.js → EodashChart-ChrkA5oS.js} +7 -6
- package/dist/client/{EodashDatePicker-CMPDT-ce.js → EodashDatePicker-CY1TrsDo.js} +3 -3
- package/dist/client/{EodashItemFilter-BpdA8QQa.js → EodashItemFilter-DzshHDlS.js} +2 -1
- package/dist/client/{EodashLayerControl-BHpDA4_0.js → EodashLayerControl-DMCeMkSd.js} +50 -20
- package/dist/client/{EodashLayoutSwitcher-B1fRUt7G.js → EodashLayoutSwitcher-iJ8mX1rF.js} +3 -3
- package/dist/client/{EodashMapBtns-Cpned0tc.js → EodashMapBtns-C7Cr7q5Y.js} +200 -86
- package/dist/client/EodashStacInfo-K7-iuXa7.js +169 -0
- package/dist/client/{EodashTools-1zHz26gv.js → EodashTools-BEK7e7JM.js} +4 -4
- package/dist/client/{ExportState-DbOm8hBI.js → ExportState-CqIzfMYQ.js} +6 -168
- package/dist/client/{Footer-BKg-VVkj.js → Footer-1P0cmBOZ.js} +1 -1
- package/dist/client/{Header-DCrwCvmY.js → Header-CkkBaBNh.js} +2 -2
- package/dist/client/{MobileLayout-vWSHpluo.js → MobileLayout-BPf49kDU.js} +2 -2
- package/dist/client/{PopUp-9uimfK49.js → PopUp-DPZq5SWI.js} +4 -168
- package/dist/client/{ProcessList-CTTIZa06.js → ProcessList-DuI6WpS1.js} +5 -5
- package/dist/client/VDivider-Bj9LG_JV.js +168 -0
- package/dist/client/{VImg-CrmB76ZY.js → VImg-Ddv5OyMz.js} +2 -2
- package/dist/client/{VMain-OKZNpcEG.js → VMain-7yqk_qC3.js} +1 -1
- package/dist/client/{VTooltip-CJw2FyWk.js → VTooltip-2hAJyEoa.js} +2 -2
- package/dist/client/{WidgetsContainer-BaWOnE5R.js → WidgetsContainer-2DOrlwCB.js} +1 -1
- package/dist/client/{asWebComponent-BHWpMuE3.js → asWebComponent-BlFN2lkB.js} +456 -306
- package/dist/client/{async-DSKj6g1f.js → async-B2H8ZwUK.js} +2 -2
- package/dist/client/{create-layers-config-CBoYedqB.js → create-layers-config-u_vn5hPk.js} +17 -17
- package/dist/client/dialog-transition-BrMkMiNa.js +170 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DH51zPUr.js → forwardRefs-DAlror6d.js} +8 -87
- package/dist/client/{handling-BrcDDlgS.js → handling-B6I1V5eG.js} +3 -3
- package/dist/client/{helpers-DjZVl_WF.js → helpers-CBqIUSXJ.js} +794 -182
- package/dist/client/index-BWq1ZKaV.js +3168 -0
- package/dist/client/{index-CUjl-ZsI.js → index-CJ9UI3ln.js} +2 -2
- package/dist/client/{index-CSG_JoOA.js → index-DXLz4sFR.js} +62 -56
- package/dist/client/{index-1JKE68n3.js → index-DhKU6KqM.js} +211 -67
- package/dist/client/{index-Cu3-13Xg.js → index-DjQlbWbJ.js} +7 -6
- package/dist/client/mosaic-BFYLEwyx.js +455 -0
- package/dist/client/templates.js +250 -119
- package/dist/client/{transition-OHcz5Qq1.js → transition-D_W6Wn9v.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/types.d.ts +4 -0
- package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +57 -25
- package/dist/types/core/client/eodashSTAC/cql.d.ts +15 -0
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +42 -23
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +77 -18
- package/dist/types/core/client/eodashSTAC/mosaic.d.ts +56 -0
- package/dist/types/core/client/store/stac.d.ts +31 -7
- package/dist/types/core/client/store/states.d.ts +24 -2
- package/dist/types/core/client/types.d.ts +123 -24
- package/dist/types/core/client/utils/states.d.ts +12 -0
- package/dist/types/templates/baseConfig.d.ts +1 -100
- package/dist/types/templates/compare.d.ts +32 -3
- package/dist/types/templates/expert.d.ts +18 -0
- package/dist/types/templates/explore.d.ts +9 -1
- package/dist/types/templates/lite.d.ts +11 -0
- package/dist/types/widgets/EodashChart.vue.d.ts +5 -3
- package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +129 -2
- package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +28 -6
- package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +17 -4
- package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +16 -4
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +35 -16
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +14 -10
- package/dist/types/widgets/EodashMap/index.vue.d.ts +86 -37
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -1
- package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -1
- package/dist/types/widgets/EodashMap/methods/use-map-loading.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/index.vue.d.ts +5 -3
- package/dist/types/widgets/EodashProcess/states.d.ts +1 -1
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +20 -0
- package/dist/types/widgets/EodashTimeSlider/index.vue.d.ts +20 -0
- package/dist/types/widgets/EodashTimeSlider/methods/index.d.ts +3 -8
- package/dist/types/widgets/EodashTimeSlider/types.d.ts +6 -16
- package/dist/types/widgets/EodashTools.vue.d.ts +5 -5
- package/package.json +33 -33
- package/templates/baseConfig.js +36 -6
- package/templates/compare.js +62 -7
- package/templates/expert.js +23 -0
- package/templates/explore.js +11 -5
- package/templates/lite.js +14 -0
- package/widgets/EodashChart.vue +1 -0
- package/widgets/EodashItemCatalog/index.vue +363 -35
- package/widgets/EodashItemCatalog/methods/filters.js +134 -70
- package/widgets/EodashItemCatalog/methods/handlers.js +113 -19
- package/widgets/EodashItemCatalog/methods/map.js +142 -28
- package/widgets/EodashLayerControl.vue +42 -11
- package/widgets/EodashMap/EodashMapBtns.vue +109 -48
- package/widgets/EodashMap/index.vue +89 -105
- package/widgets/EodashMap/methods/btns.js +37 -5
- package/widgets/EodashMap/methods/create-layers-config.js +16 -16
- package/widgets/EodashMap/methods/index.js +71 -8
- package/widgets/EodashMap/methods/use-map-loading.js +52 -0
- package/widgets/EodashProcess/index.vue +1 -0
- package/widgets/EodashProcess/states.js +1 -1
- package/widgets/EodashStacInfo.vue +64 -2
- package/widgets/EodashTimeSlider/index.vue +58 -2
- package/widgets/EodashTimeSlider/methods/index.js +5 -48
- package/widgets/EodashTimeSlider/types.ts +7 -17
- package/dist/client/EodashStacInfo-BQspAHKH.js +0 -107
- package/dist/client/index-5Jhsa8Xe.js +0 -570
|
@@ -1,570 +0,0 @@
|
|
|
1
|
-
import { onMounted, onUnmounted, withAsyncContext, useTemplateRef, ref, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, unref, toDisplayString } from 'vue';
|
|
2
|
-
import { H as useSTAcStore, N as useOnLayersUpdate, _ as _export_sfc, O as VRow } from './asWebComponent-BHWpMuE3.js';
|
|
3
|
-
import { E as indicator, i as mapEl, Q as sanitizeBbox, d as axios } from './helpers-DjZVl_WF.js';
|
|
4
|
-
import { i as inAndOut } from './easing-CH0-9wR8.js';
|
|
5
|
-
import { mdiViewDashboard } from '@mdi/js';
|
|
6
|
-
import _sfc_main$1 from './EodashLayoutSwitcher-B1fRUt7G.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 = [...mapEl.value.layers, analysisLayers];
|
|
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.push(stacItemsLayer);
|
|
288
|
-
mapEl.value.layers = [...mapEl.value.layers];
|
|
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
|
-
onMounted(() => {
|
|
321
|
-
renderItemsFeatures(currentItems.value);
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
useOnLayersUpdate(() => {
|
|
325
|
-
// consider cases where this is not needed
|
|
326
|
-
renderItemsFeatures(currentItems.value);
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
*
|
|
331
|
-
* @param {import("vue").Ref<any>} itemfilterEl
|
|
332
|
-
*/
|
|
333
|
-
function useHighlightOnFeatureHover(itemfilterEl) {
|
|
334
|
-
/**
|
|
335
|
-
*
|
|
336
|
-
* @param {CustomEvent} evt
|
|
337
|
-
*/
|
|
338
|
-
const handler = (evt) => {
|
|
339
|
-
const itemId = evt.detail?.feature?.getId();
|
|
340
|
-
if (!itemId) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
const item = itemfilterEl.value.items?.find(
|
|
344
|
-
//@ts-expect-error todo
|
|
345
|
-
(r) => r.id === itemId,
|
|
346
|
-
);
|
|
347
|
-
if (item) {
|
|
348
|
-
itemfilterEl.value.selectedResult = item;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
onMounted(() => {
|
|
352
|
-
//@ts-expect-error todo
|
|
353
|
-
mapEl.value?.addEventListener("select", handler);
|
|
354
|
-
});
|
|
355
|
-
onUnmounted(() => {
|
|
356
|
-
//@ts-expect-error todo
|
|
357
|
-
mapEl.value?.removeEventListener("select", handler);
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* @param {import("vue").Ref<import("@/types").GeoJsonFeature[]>} currentItems
|
|
363
|
-
*/
|
|
364
|
-
const createOnFilterHandler = (currentItems) => {
|
|
365
|
-
/** @param {CustomEvent} evt */
|
|
366
|
-
return (evt) => {
|
|
367
|
-
currentItems.value = evt.detail.results;
|
|
368
|
-
renderItemsFeatures(currentItems.value);
|
|
369
|
-
};
|
|
370
|
-
};
|
|
371
|
-
/**
|
|
372
|
-
*
|
|
373
|
-
* @param {ReturnType<typeof import("@/store/stac.js").useSTAcStore>} store
|
|
374
|
-
* @returns
|
|
375
|
-
*/
|
|
376
|
-
const createOnSelectHandler = (store) => {
|
|
377
|
-
/** @param {CustomEvent} evt */
|
|
378
|
-
return async (evt) => {
|
|
379
|
-
const item = /** @type {import("stac-ts").StacItem} */ (evt.detail);
|
|
380
|
-
if (!item) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
if (store.selectedStac?.id === item.collection) {
|
|
384
|
-
store.selectedItem = item;
|
|
385
|
-
} else {
|
|
386
|
-
await store.loadSelectedSTAC(item.collection, false, item);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
mapEl.value?.selectInteractions["stac-items"]?.highlightById([item.id], {
|
|
390
|
-
padding: [100, 100, 100, 100],
|
|
391
|
-
duration: 1200,
|
|
392
|
-
easing: inAndOut,
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
*
|
|
399
|
-
* @param {CustomEvent} evt
|
|
400
|
-
*/
|
|
401
|
-
const onMouseEnterResult = (evt) => {
|
|
402
|
-
mapEl.value?.selectInteractions["stac-items"]?.highlightById([evt.detail.id]);
|
|
403
|
-
};
|
|
404
|
-
const onMouseLeaveResult = () => {
|
|
405
|
-
mapEl.value?.selectInteractions["stac-items"]?.highlightById([]);
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const _style_0 = "eox-itemfilter[data-v-4d4f6477]{flex-basis:20%;height:100%;overflow:hidden!important;padding:1rem;--eox-itemfilter-results-color: var(--v-theme-surface) !important}.title[data-v-4d4f6477]{padding:1em;margin:.2em}";
|
|
409
|
-
|
|
410
|
-
const _hoisted_1 = [".imageProperty", ".subTitleProperty", ".filterProperties", ".items", "externalFilter"];
|
|
411
|
-
const _hoisted_2 = {
|
|
412
|
-
slot: "filterstitle",
|
|
413
|
-
style: {"margin":"14px 8px"}
|
|
414
|
-
};
|
|
415
|
-
const _hoisted_3 = {
|
|
416
|
-
slot: "resultstitle",
|
|
417
|
-
style: {"margin":"14px 8px"}
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const _sfc_main = {
|
|
422
|
-
__name: 'index',
|
|
423
|
-
props: {
|
|
424
|
-
title: {
|
|
425
|
-
type: String,
|
|
426
|
-
default: "Explore Catalog",
|
|
427
|
-
},
|
|
428
|
-
layoutTarget: {
|
|
429
|
-
type: String,
|
|
430
|
-
default: "lite",
|
|
431
|
-
},
|
|
432
|
-
layoutIcon: {
|
|
433
|
-
type: String,
|
|
434
|
-
default: mdiViewDashboard,
|
|
435
|
-
},
|
|
436
|
-
filtersTitle: {
|
|
437
|
-
type: String,
|
|
438
|
-
default: "Filters:",
|
|
439
|
-
},
|
|
440
|
-
resultsTitle: {
|
|
441
|
-
type: String,
|
|
442
|
-
default: "Items:",
|
|
443
|
-
},
|
|
444
|
-
bboxFilter: {
|
|
445
|
-
type: Boolean,
|
|
446
|
-
default: true,
|
|
447
|
-
},
|
|
448
|
-
imageProperty: {
|
|
449
|
-
type: String,
|
|
450
|
-
default: "assets.thumbnail.href",
|
|
451
|
-
},
|
|
452
|
-
filters: {
|
|
453
|
-
/** @type {import("vue").PropType<import("./types").FiltersConfig>} */
|
|
454
|
-
type: Array,
|
|
455
|
-
default: () => [
|
|
456
|
-
{
|
|
457
|
-
property: "eo:cloud_cover",
|
|
458
|
-
type: "range",
|
|
459
|
-
title: "Cloud Cover (%)",
|
|
460
|
-
min: 0,
|
|
461
|
-
max: 100,
|
|
462
|
-
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>`,
|
|
463
|
-
unitLabel: "%",
|
|
464
|
-
},
|
|
465
|
-
],
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
async setup(__props) {
|
|
469
|
-
|
|
470
|
-
let __temp, __restore;
|
|
471
|
-
|
|
472
|
-
if (!customElements.get("eox-itemfilter")) {
|
|
473
|
-
(
|
|
474
|
-
([__temp,__restore] = withAsyncContext(() => import('@eox/itemfilter'))),
|
|
475
|
-
await __temp,
|
|
476
|
-
__restore()
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// Props definition
|
|
481
|
-
const props = __props;
|
|
482
|
-
|
|
483
|
-
// Store and template refs
|
|
484
|
-
const store = useSTAcStore();
|
|
485
|
-
const itemfilterEl = useTemplateRef("itemfilter");
|
|
486
|
-
|
|
487
|
-
// Reactive state
|
|
488
|
-
/** @type {import("vue").Ref<import("@/types").GeoJsonFeature[]>} */
|
|
489
|
-
const currentItems = ref([]);
|
|
490
|
-
(
|
|
491
|
-
([__temp,__restore] = withAsyncContext(() => axios
|
|
492
|
-
.get(store.stacEndpoint + "/search?limit=100")
|
|
493
|
-
.then((res) => (currentItems.value = res.data.features)))),
|
|
494
|
-
await __temp,
|
|
495
|
-
__restore()
|
|
496
|
-
);
|
|
497
|
-
|
|
498
|
-
const items = currentItems.value;
|
|
499
|
-
|
|
500
|
-
const filterProperties = createFilterProperties(props.filters);
|
|
501
|
-
|
|
502
|
-
const subTitleProperty = createSubtitleProperty(props.filters);
|
|
503
|
-
|
|
504
|
-
const externalFilterHandler = createExternalFilter(
|
|
505
|
-
props.filters,
|
|
506
|
-
props.bboxFilter,
|
|
507
|
-
);
|
|
508
|
-
|
|
509
|
-
// Event handlers
|
|
510
|
-
/**
|
|
511
|
-
* @param {CustomEvent} evt
|
|
512
|
-
*/
|
|
513
|
-
const onFilter = createOnFilterHandler(currentItems);
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* @param {CustomEvent} evt
|
|
517
|
-
*/
|
|
518
|
-
const onSelectItem = createOnSelectHandler(store);
|
|
519
|
-
|
|
520
|
-
// composables
|
|
521
|
-
|
|
522
|
-
// Render items features on the map
|
|
523
|
-
useRenderItemsFeatures(currentItems);
|
|
524
|
-
// Search on map move logic
|
|
525
|
-
useSearchOnMapMove(itemfilterEl, props.bboxFilter);
|
|
526
|
-
|
|
527
|
-
useHighlightOnFeatureHover(itemfilterEl);
|
|
528
|
-
|
|
529
|
-
onUnmounted(() => {
|
|
530
|
-
store.selectedItem = null;
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
return (_ctx, _cache) => {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
return (openBlock(), createElementBlock("span", null, [
|
|
537
|
-
createVNode(VRow, { class: "title align-center justify-space-between" }, {
|
|
538
|
-
default: withCtx(() => [
|
|
539
|
-
_cache[4] || (_cache[4] = createElementVNode("h4", null, "Catalog Items", -1 /* CACHED */)),
|
|
540
|
-
createVNode(_sfc_main$1, {
|
|
541
|
-
target: __props.layoutTarget,
|
|
542
|
-
icon: __props.layoutIcon
|
|
543
|
-
}, null, 8 /* PROPS */, ["target", "icon"])
|
|
544
|
-
]),
|
|
545
|
-
_: 1 /* STABLE */
|
|
546
|
-
}),
|
|
547
|
-
createElementVNode("eox-itemfilter", {
|
|
548
|
-
ref: "itemfilter",
|
|
549
|
-
titleProperty: "id",
|
|
550
|
-
".imageProperty": __props.imageProperty,
|
|
551
|
-
".subTitleProperty": unref(subTitleProperty),
|
|
552
|
-
".filterProperties": unref(filterProperties),
|
|
553
|
-
".items": unref(items),
|
|
554
|
-
onSelect: _cache[0] || (_cache[0] = (...args) => (unref(onSelectItem) && unref(onSelectItem)(...args))),
|
|
555
|
-
onFilter: _cache[1] || (_cache[1] = (...args) => (unref(onFilter) && unref(onFilter)(...args))),
|
|
556
|
-
"onMouseenter:result": _cache[2] || (_cache[2] = (...args) => (unref(onMouseEnterResult) && unref(onMouseEnterResult)(...args))),
|
|
557
|
-
"onMouseleave:result": _cache[3] || (_cache[3] = (...args) => (unref(onMouseLeaveResult) && unref(onMouseLeaveResult)(...args))),
|
|
558
|
-
externalFilter: unref(externalFilterHandler)
|
|
559
|
-
}, [
|
|
560
|
-
createElementVNode("h4", _hoisted_2, toDisplayString(__props.filtersTitle), 1 /* TEXT */),
|
|
561
|
-
createElementVNode("h4", _hoisted_3, toDisplayString(__props.resultsTitle), 1 /* TEXT */)
|
|
562
|
-
], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1)
|
|
563
|
-
]))
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
};
|
|
568
|
-
const index = /*#__PURE__*/_export_sfc(_sfc_main, [['styles',[_style_0]],['__scopeId',"data-v-4d4f6477"]]);
|
|
569
|
-
|
|
570
|
-
export { index as default };
|