@eodash/eodash 5.7.0 → 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/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 +87 -24
- package/core/client/eodashSTAC/cql.js +64 -0
- package/core/client/eodashSTAC/createLayers.js +353 -187
- package/core/client/eodashSTAC/helpers.js +694 -110
- package/core/client/eodashSTAC/mosaic.js +422 -0
- package/core/client/plugins/axios.js +31 -1
- package/core/client/store/actions.js +1 -1
- package/core/client/store/stac.js +54 -4
- package/core/client/store/states.js +20 -2
- package/core/client/types.ts +152 -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-DEs4f_Vy.js} +2 -2
- package/dist/client/{DynamicWebComponent-CnKhYo0K.js → DynamicWebComponent-PvnV88BA.js} +1 -1
- package/dist/client/EodashChart-D-3AGKZY.js +260 -0
- package/dist/client/{EodashDatePicker-CMPDT-ce.js → EodashDatePicker-Dm_goZzs.js} +3 -3
- package/dist/client/{EodashItemFilter-BpdA8QQa.js → EodashItemFilter-CJy3zYzD.js} +2 -1
- package/dist/client/{EodashLayerControl-BHpDA4_0.js → EodashLayerControl-rL8UnpkA.js} +55 -33
- package/dist/client/{EodashLayoutSwitcher-B1fRUt7G.js → EodashLayoutSwitcher-ZRlESI9O.js} +3 -3
- package/dist/client/{EodashMapBtns-Cpned0tc.js → EodashMapBtns-CG7u2Aq8.js} +227 -112
- package/dist/client/EodashStacInfo-CJhhxthD.js +169 -0
- package/dist/client/{EodashTools-1zHz26gv.js → EodashTools-CWyK8QJT.js} +4 -4
- package/dist/client/{ExportState-DbOm8hBI.js → ExportState-BXhy5TOU.js} +20 -174
- package/dist/client/{Footer-BKg-VVkj.js → Footer-DZPvnhcT.js} +1 -1
- package/dist/client/{Header-DCrwCvmY.js → Header-CiGsDE_a.js} +2 -2
- package/dist/client/{MobileLayout-vWSHpluo.js → MobileLayout-BJHW7x5V.js} +2 -2
- package/dist/client/{PopUp-9uimfK49.js → PopUp-7_XnhvCc.js} +4 -168
- package/dist/client/{ProcessList-CTTIZa06.js → ProcessList-LL_UCbvc.js} +5 -5
- package/dist/client/VDivider-DWYM0WUr.js +168 -0
- package/dist/client/{VImg-CrmB76ZY.js → VImg-B75dgw2K.js} +2 -2
- package/dist/client/{VMain-OKZNpcEG.js → VMain-DvMmOL4f.js} +1 -1
- package/dist/client/{VTooltip-CJw2FyWk.js → VTooltip-ClWHUmWL.js} +2 -2
- package/dist/client/{WidgetsContainer-BaWOnE5R.js → WidgetsContainer-BqaWs4ch.js} +1 -1
- package/dist/client/{asWebComponent-BHWpMuE3.js → asWebComponent-IZanwL-A.js} +677 -379
- package/dist/client/{async-DSKj6g1f.js → async-CiNIOBVz.js} +31 -29
- package/dist/client/{create-layers-config-CBoYedqB.js → create-layers-config-3S3y_kZg.js} +17 -17
- package/dist/client/dialog-transition-c4ZSnzac.js +170 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DH51zPUr.js → forwardRefs-B-c1_6yo.js} +8 -87
- package/dist/client/{handling-BrcDDlgS.js → handling-NvY8Csry.js} +3 -4
- package/dist/client/{helpers-DjZVl_WF.js → helpers-BFuh19CP.js} +1094 -194
- package/dist/client/{index-1JKE68n3.js → index-1wMAyuNL.js} +219 -67
- package/dist/client/{index-CSG_JoOA.js → index-B8jGJSTA.js} +62 -56
- package/dist/client/{index-Cu3-13Xg.js → index-BKQQJkhy.js} +167 -61
- package/dist/client/index-D0jUyol8.js +3167 -0
- package/dist/client/{index-CUjl-ZsI.js → index-KGxz5Egv.js} +2 -2
- package/dist/client/mosaic-vHvSuih6.js +459 -0
- package/dist/client/templates.js +251 -121
- package/dist/client/{transition-OHcz5Qq1.js → transition-BkyUsZh_.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 +118 -19
- package/dist/types/core/client/eodashSTAC/mosaic.d.ts +56 -0
- package/dist/types/core/client/store/stac.d.ts +38 -8
- package/dist/types/core/client/store/states.d.ts +24 -2
- package/dist/types/core/client/types.d.ts +128 -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 +10 -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/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +1 -1
- 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 +34 -34
- package/templates/baseConfig.js +37 -6
- package/templates/compare.js +61 -7
- package/templates/expert.js +24 -2
- package/templates/explore.js +12 -5
- package/templates/lite.js +13 -0
- package/widgets/EodashChart.vue +162 -21
- 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 +141 -28
- package/widgets/EodashLayerControl.vue +51 -25
- package/widgets/EodashMap/EodashMapBtns.vue +109 -48
- package/widgets/EodashMap/index.vue +91 -105
- package/widgets/EodashMap/methods/btns.js +64 -31
- 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 +58 -0
- package/widgets/EodashProcess/index.vue +136 -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/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/widgets/ExportState.vue +13 -4
- package/dist/client/EodashChart-CLDqE93C.js +0 -144
- package/dist/client/EodashStacInfo-BQspAHKH.js +0 -107
- package/dist/client/index-5Jhsa8Xe.js +0 -570
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { sanitizeBbox } from "@/eodashSTAC/helpers";
|
|
2
2
|
import { indicator, mapEl } from "@/store/states";
|
|
3
3
|
import { useSTAcStore } from "@/store/stac";
|
|
4
|
+
import axios from "@/plugins/axios";
|
|
5
|
+
import { buildCqlFilter } from "@/eodashSTAC/cql";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
*
|
|
@@ -43,14 +45,20 @@ export const createSubtitleProperty = (filtersConfig) => {
|
|
|
43
45
|
* title?: string,
|
|
44
46
|
* min?: number,
|
|
45
47
|
* max?: number,
|
|
48
|
+
* step?: number,
|
|
46
49
|
* filterKeys?: string[],
|
|
47
50
|
* state?: Record<string, boolean>,
|
|
48
51
|
* placeholder?: string,
|
|
52
|
+
* format?: string,
|
|
49
53
|
* }>} filtersConfig
|
|
54
|
+
* @param {boolean} datetimeFilter
|
|
50
55
|
*/
|
|
51
56
|
// Transform simple filter configs into eox-itemfilter format
|
|
52
|
-
export const createFilterProperties = (filtersConfig) => {
|
|
57
|
+
export const createFilterProperties = (filtersConfig, datetimeFilter) => {
|
|
53
58
|
const store = useSTAcStore();
|
|
59
|
+
const customDatetimeConfig = filtersConfig.find(
|
|
60
|
+
(f) => f.property === "datetime",
|
|
61
|
+
);
|
|
54
62
|
const baseFilters = [
|
|
55
63
|
{
|
|
56
64
|
key: "collection",
|
|
@@ -58,18 +66,25 @@ export const createFilterProperties = (filtersConfig) => {
|
|
|
58
66
|
type: "multiselect",
|
|
59
67
|
placeholder: "Select collections",
|
|
60
68
|
inline: false,
|
|
61
|
-
filterKeys:
|
|
69
|
+
filterKeys:
|
|
70
|
+
store.stac?.filter((col) => col.id).map((col) => col.id) || [],
|
|
62
71
|
...(indicator.value && { state: { [indicator.value]: true } }),
|
|
63
72
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
...(datetimeFilter || customDatetimeConfig
|
|
74
|
+
? [
|
|
75
|
+
{
|
|
76
|
+
key: "datetime",
|
|
77
|
+
title: "Date",
|
|
78
|
+
type: "range",
|
|
79
|
+
format: "date",
|
|
80
|
+
...(customDatetimeConfig || {}),
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
: []),
|
|
70
84
|
];
|
|
71
85
|
|
|
72
86
|
const dynamicFilters = filtersConfig
|
|
87
|
+
.filter((f) => f.property !== "datetime")
|
|
73
88
|
.map((filter) => {
|
|
74
89
|
const propertyKey = `properties.${filter.property}`;
|
|
75
90
|
|
|
@@ -79,8 +94,12 @@ export const createFilterProperties = (filtersConfig) => {
|
|
|
79
94
|
title: filter.title || filter.property,
|
|
80
95
|
type: "range",
|
|
81
96
|
expanded: true,
|
|
97
|
+
min: filter.min,
|
|
98
|
+
max: filter.max,
|
|
99
|
+
step: filter.step,
|
|
100
|
+
format: filter.format,
|
|
82
101
|
filterKeys: [filter.min || 0, filter.max || 100],
|
|
83
|
-
state: {
|
|
102
|
+
state: filter.state ?? {
|
|
84
103
|
min: filter.min ?? 0,
|
|
85
104
|
max: filter.max ?? 100,
|
|
86
105
|
},
|
|
@@ -114,65 +133,28 @@ export const createFilterProperties = (filtersConfig) => {
|
|
|
114
133
|
return [...baseFilters, ...dynamicFilters];
|
|
115
134
|
};
|
|
116
135
|
|
|
117
|
-
/**
|
|
118
|
-
* Build STAC API filter string from dynamic filters
|
|
119
|
-
* @param {Record<string,any>} filters
|
|
120
|
-
* @param {import("../types").FiltersConfig} propsFilters
|
|
121
|
-
* @returns {string}
|
|
122
|
-
*/
|
|
123
|
-
export const buildStacFilters = (filters, propsFilters) => {
|
|
124
|
-
/** @type {string[]} */
|
|
125
|
-
const stacFilters = [];
|
|
126
|
-
|
|
127
|
-
propsFilters.forEach((filterConfig) => {
|
|
128
|
-
const filterKey = `properties.${filterConfig.property}`;
|
|
129
|
-
const filterValue = filters[filterKey];
|
|
130
|
-
|
|
131
|
-
if (!filterValue) return;
|
|
132
|
-
|
|
133
|
-
if (filterConfig.type === "range" && filterValue.state) {
|
|
134
|
-
const { min, max } = filterValue.state;
|
|
135
|
-
|
|
136
|
-
// Add range filters based on configuration
|
|
137
|
-
if (min !== undefined && min > (filterConfig.min || 0)) {
|
|
138
|
-
stacFilters.push(`${filterConfig.property}>=${min}`);
|
|
139
|
-
}
|
|
140
|
-
if (max !== undefined && max < (filterConfig.max || 100)) {
|
|
141
|
-
stacFilters.push(`${filterConfig.property}<=${max}`);
|
|
142
|
-
}
|
|
143
|
-
} else if (
|
|
144
|
-
filterConfig.type === "multiselect" &&
|
|
145
|
-
filterValue.stringifiedState
|
|
146
|
-
) {
|
|
147
|
-
// Handle multiselect filters
|
|
148
|
-
const selectedValues = filterValue.stringifiedState;
|
|
149
|
-
if (selectedValues.length > 0) {
|
|
150
|
-
stacFilters.push(`${filterConfig.property} IN (${selectedValues})`);
|
|
151
|
-
}
|
|
152
|
-
} else if (filterConfig.type === "select" && filterValue.stringifiedState) {
|
|
153
|
-
// Handle single select filters
|
|
154
|
-
const selectedValue = filterValue.stringifiedState;
|
|
155
|
-
if (selectedValue) {
|
|
156
|
-
stacFilters.push(`${filterConfig.property}='${selectedValue}'`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
return stacFilters.join(" AND ");
|
|
162
|
-
};
|
|
163
|
-
|
|
164
136
|
/**
|
|
165
137
|
* Build search URL with proper STAC API parameters
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {Array<any>} propsFilters
|
|
138
|
+
* @param {import("@/types").ItemFilterFilters} filters
|
|
168
139
|
* @param {boolean} bboxFilter
|
|
140
|
+
* @param {boolean} datetimeFilter
|
|
141
|
+
* @param {Number} searchLimit
|
|
142
|
+
* @param {string} [sortBy]
|
|
143
|
+
* @param {string | null} [stacEndpoint]
|
|
169
144
|
* @returns {string}
|
|
170
145
|
*/
|
|
171
|
-
export const buildSearchUrl = (
|
|
146
|
+
export const buildSearchUrl = (
|
|
147
|
+
filters,
|
|
148
|
+
bboxFilter,
|
|
149
|
+
datetimeFilter,
|
|
150
|
+
searchLimit,
|
|
151
|
+
sortBy,
|
|
152
|
+
stacEndpoint,
|
|
153
|
+
) => {
|
|
172
154
|
const store = useSTAcStore();
|
|
155
|
+
const endpoint = stacEndpoint || store.stacEndpoint;
|
|
173
156
|
const params = new URLSearchParams();
|
|
174
157
|
|
|
175
|
-
// Add collections
|
|
176
158
|
if (filters.collection?.stringifiedState) {
|
|
177
159
|
params.append(
|
|
178
160
|
"collections",
|
|
@@ -187,30 +169,112 @@ export const buildSearchUrl = (filters, propsFilters, bboxFilter) => {
|
|
|
187
169
|
);
|
|
188
170
|
}
|
|
189
171
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
172
|
+
if (datetimeFilter) {
|
|
173
|
+
const datetime = formatDatetimeParam(
|
|
174
|
+
/** @type {import("@/types").ItemFilterRange} */ (filters.datetime),
|
|
175
|
+
);
|
|
176
|
+
if (datetime) {
|
|
177
|
+
params.append("datetime", datetime);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const cqlFilter = buildCqlFilter(filters);
|
|
182
|
+
if (cqlFilter) {
|
|
183
|
+
params.append("filter", cqlFilter);
|
|
184
|
+
}
|
|
185
|
+
if (sortBy) {
|
|
186
|
+
params.append("sortby", sortBy);
|
|
194
187
|
}
|
|
195
188
|
|
|
196
|
-
|
|
197
|
-
params.append("limit", "100");
|
|
189
|
+
params.append("limit", searchLimit.toString());
|
|
198
190
|
|
|
199
|
-
return `${
|
|
191
|
+
return `${endpoint}/search?${params.toString()}`;
|
|
200
192
|
};
|
|
201
193
|
|
|
202
194
|
/**
|
|
203
195
|
*
|
|
204
196
|
* @param {import("../types").FiltersConfig} propsFilters
|
|
205
197
|
* @param {boolean} bboxFilter
|
|
198
|
+
* @param {boolean} datetimeFilter
|
|
199
|
+
* @param {import("vue").Ref<import("@/types").GeoJsonFeature[]>} currentItems
|
|
200
|
+
* @param {import("vue").Ref<string>} sortBy
|
|
201
|
+
* @param {Number} searchLimit
|
|
202
|
+
* @param {import("vue").Ref<import("stac-ts").StacItem | null>} [selectedItemRef]
|
|
203
|
+
* @param {import("vue").Ref<string | null> | string | null} [stacEndpoint]
|
|
206
204
|
*/
|
|
207
|
-
export const createExternalFilter = (
|
|
205
|
+
export const createExternalFilter = (
|
|
206
|
+
propsFilters,
|
|
207
|
+
bboxFilter,
|
|
208
|
+
datetimeFilter,
|
|
209
|
+
currentItems,
|
|
210
|
+
sortBy,
|
|
211
|
+
searchLimit,
|
|
212
|
+
selectedItemRef,
|
|
213
|
+
stacEndpoint,
|
|
214
|
+
) => {
|
|
215
|
+
const hasCustomDatetime = propsFilters.some((f) => f.property === "datetime");
|
|
216
|
+
const effectiveDatetimeFilter = datetimeFilter || hasCustomDatetime;
|
|
217
|
+
let controller = new AbortController();
|
|
208
218
|
/**
|
|
209
219
|
* @param {Array<any>} _items
|
|
210
220
|
* @param {Record<string,any>} filters
|
|
211
221
|
*/
|
|
212
222
|
return (_items, filters) => ({
|
|
213
|
-
url: buildSearchUrl(
|
|
214
|
-
|
|
223
|
+
url: buildSearchUrl(
|
|
224
|
+
filters,
|
|
225
|
+
bboxFilter,
|
|
226
|
+
effectiveDatetimeFilter,
|
|
227
|
+
searchLimit,
|
|
228
|
+
sortBy.value,
|
|
229
|
+
typeof stacEndpoint === "object" ? stacEndpoint?.value : stacEndpoint,
|
|
230
|
+
),
|
|
231
|
+
/** @param {string} url */
|
|
232
|
+
fetchFn: async (url) => {
|
|
233
|
+
controller.abort();
|
|
234
|
+
controller = new AbortController();
|
|
235
|
+
const signal = controller.signal;
|
|
236
|
+
return await axios
|
|
237
|
+
.get(url, { signal })
|
|
238
|
+
.then((res) => {
|
|
239
|
+
/** @type {import("@/types").GeoJsonFeature[]} */
|
|
240
|
+
const results = res.data.features;
|
|
241
|
+
const selected = selectedItemRef?.value;
|
|
242
|
+
if (selected && !results.some((r) => r.id === selected.id)) {
|
|
243
|
+
return [selected, ...results];
|
|
244
|
+
}
|
|
245
|
+
return results;
|
|
246
|
+
})
|
|
247
|
+
.catch((e) => {
|
|
248
|
+
// return previous items if aborted
|
|
249
|
+
if (e.name === "AbortError" || e.name === "CanceledError") {
|
|
250
|
+
return currentItems.value;
|
|
251
|
+
}
|
|
252
|
+
console.error(e);
|
|
253
|
+
return [];
|
|
254
|
+
});
|
|
255
|
+
},
|
|
215
256
|
});
|
|
216
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @param {import("@/types").ItemFilterRange} datetimeFilter
|
|
261
|
+
*/
|
|
262
|
+
function formatDatetimeParam(datetimeFilter) {
|
|
263
|
+
if (!datetimeFilter) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
const min = datetimeFilter?.min ? new Date(datetimeFilter.min) : null;
|
|
267
|
+
const max = datetimeFilter?.max ? new Date(datetimeFilter.max) : null;
|
|
268
|
+
const start = datetimeFilter.state?.min
|
|
269
|
+
? new Date(datetimeFilter.state.min)
|
|
270
|
+
: null;
|
|
271
|
+
const end = datetimeFilter.state?.max
|
|
272
|
+
? new Date(datetimeFilter.state.max)
|
|
273
|
+
: null;
|
|
274
|
+
const includeStart = start && (!min || start > min);
|
|
275
|
+
const includeEnd = end && (!max || end < max);
|
|
276
|
+
if (!includeStart && !includeEnd) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
return `${includeStart ? start.toISOString() : ".."}/${includeEnd ? end.toISOString() : ".."}`;
|
|
280
|
+
}
|
|
@@ -1,50 +1,144 @@
|
|
|
1
|
-
import { mapEl } from "@/store/states";
|
|
2
1
|
import { inAndOut } from "ol/easing";
|
|
3
2
|
import { renderItemsFeatures } from "./map";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Build a compact signature from filter key + stringified state.
|
|
6
|
+
* @param {import("@/types").ItemFilterFilters | undefined} filters
|
|
7
|
+
* @returns {string}
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
const getFiltersSignature = (filters) => {
|
|
10
|
+
if (!filters) return "";
|
|
11
|
+
return Object.keys(filters)
|
|
12
|
+
.sort()
|
|
13
|
+
.map((key) => `${key}:${filters[key]?.stringifiedState ?? ""}`)
|
|
14
|
+
.join("|");
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {{
|
|
19
|
+
* currentItems: import("vue").Ref<import("@/types").GeoJsonFeature[]>,
|
|
20
|
+
* mapElement: import("vue").Ref<import("@eox/map").EOxMap | null>,
|
|
21
|
+
* hoverProperties: string[] | undefined,
|
|
22
|
+
* stacItemsStyle?: object,
|
|
23
|
+
* stacItemsInteractionStyle?: object,
|
|
24
|
+
* itemfilterEl?: import("vue").Ref<any>,
|
|
25
|
+
* selectedItemRef?: import("vue").Ref<import("stac-ts").StacItem | null>,
|
|
26
|
+
* mosaicOptions?: {
|
|
27
|
+
* isMosaicEnabled: import("vue").ComputedRef<boolean>,
|
|
28
|
+
* getMosaicEndpoint: () => string | null | undefined,
|
|
29
|
+
* scheduleMosaicUpdate: (mosaicEndpoint: string | null | undefined, timeRange?: [string,string], filters?: import("@/types").ItemFilterFilters) => void,
|
|
30
|
+
* } | null
|
|
31
|
+
* }} params
|
|
32
|
+
*/
|
|
33
|
+
export const createOnFilterHandler = ({
|
|
34
|
+
currentItems,
|
|
35
|
+
mapElement,
|
|
36
|
+
hoverProperties,
|
|
37
|
+
stacItemsStyle,
|
|
38
|
+
stacItemsInteractionStyle,
|
|
39
|
+
itemfilterEl,
|
|
40
|
+
selectedItemRef,
|
|
41
|
+
mosaicOptions = null,
|
|
42
|
+
}) => {
|
|
43
|
+
let lastScheduledFiltersKey = "";
|
|
44
|
+
|
|
9
45
|
/** @param {CustomEvent} evt */
|
|
10
46
|
return (evt) => {
|
|
11
47
|
currentItems.value = evt.detail.results;
|
|
12
|
-
renderItemsFeatures(
|
|
48
|
+
renderItemsFeatures(
|
|
49
|
+
currentItems.value,
|
|
50
|
+
mapElement,
|
|
51
|
+
hoverProperties,
|
|
52
|
+
stacItemsStyle,
|
|
53
|
+
stacItemsInteractionStyle,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const selected = selectedItemRef?.value;
|
|
57
|
+
if (selected && itemfilterEl?.value) {
|
|
58
|
+
itemfilterEl.value.selectedResult = selected;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (mosaicOptions?.isMosaicEnabled.value && !selected) {
|
|
62
|
+
const nextFiltersKey = getFiltersSignature(evt.detail.filters);
|
|
63
|
+
if (nextFiltersKey === lastScheduledFiltersKey) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
lastScheduledFiltersKey = nextFiltersKey;
|
|
68
|
+
mosaicOptions.scheduleMosaicUpdate(
|
|
69
|
+
mosaicOptions.getMosaicEndpoint(),
|
|
70
|
+
undefined,
|
|
71
|
+
evt.detail.filters,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
13
74
|
};
|
|
14
75
|
};
|
|
15
76
|
/**
|
|
16
77
|
*
|
|
17
78
|
* @param {ReturnType<typeof import("@/store/stac.js").useSTAcStore>} store
|
|
79
|
+
* @param {boolean} enableCompare
|
|
80
|
+
* @param {import("vue").Ref<import("@eox/map").EOxMap | null>} mapElement
|
|
18
81
|
* @returns
|
|
19
82
|
*/
|
|
20
|
-
export const createOnSelectHandler = (store) => {
|
|
83
|
+
export const createOnSelectHandler = (store, enableCompare, mapElement) => {
|
|
21
84
|
/** @param {CustomEvent} evt */
|
|
22
85
|
return async (evt) => {
|
|
23
86
|
const item = /** @type {import("stac-ts").StacItem} */ (evt.detail);
|
|
24
87
|
if (!item) {
|
|
25
88
|
return;
|
|
26
89
|
}
|
|
27
|
-
if (
|
|
28
|
-
store.
|
|
90
|
+
if (enableCompare) {
|
|
91
|
+
if (item.id === store.selectedCompareItem?.id) {
|
|
92
|
+
store.selectedCompareItem = null;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (store.selectedCompareStac?.id === item.collection) {
|
|
96
|
+
store.selectedCompareItem = item;
|
|
97
|
+
} else {
|
|
98
|
+
await store.loadSelectedCompareSTAC(item.collection, false, item);
|
|
99
|
+
}
|
|
29
100
|
} else {
|
|
30
|
-
|
|
101
|
+
if (item.id === store.selectedItem?.id) {
|
|
102
|
+
store.selectedItem = null;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (store.selectedStac?.id === item.collection) {
|
|
106
|
+
store.selectedItem = item;
|
|
107
|
+
} else {
|
|
108
|
+
await store.loadSelectedSTAC(item.collection, false, item);
|
|
109
|
+
}
|
|
31
110
|
}
|
|
32
111
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
112
|
+
mapElement.value?.selectInteractions["stac-items"]?.highlightById(
|
|
113
|
+
[item.id],
|
|
114
|
+
{
|
|
115
|
+
padding: [100, 100, 100, 100],
|
|
116
|
+
duration: 1200,
|
|
117
|
+
easing: inAndOut,
|
|
118
|
+
},
|
|
119
|
+
);
|
|
38
120
|
};
|
|
39
121
|
};
|
|
40
122
|
|
|
41
123
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param {CustomEvent} evt
|
|
124
|
+
* @param {import("vue").Ref<import("@eox/map").EOxMap | null>} mapElement
|
|
44
125
|
*/
|
|
45
|
-
export const
|
|
46
|
-
|
|
126
|
+
export const createOnMouseEnterResult = (mapElement) => {
|
|
127
|
+
/**
|
|
128
|
+
* @param {CustomEvent} evt
|
|
129
|
+
*/
|
|
130
|
+
return (evt) => {
|
|
131
|
+
mapElement.value?.selectInteractions["stac-item-hover"]?.highlightById([
|
|
132
|
+
evt.detail.id,
|
|
133
|
+
]);
|
|
134
|
+
};
|
|
47
135
|
};
|
|
48
|
-
|
|
49
|
-
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @param {import("vue").Ref<import("@eox/map").EOxMap | null>} mapElement
|
|
139
|
+
*/
|
|
140
|
+
export const createOnMouseLeaveResult = (mapElement) => {
|
|
141
|
+
return () => {
|
|
142
|
+
mapElement.value?.selectInteractions["stac-item-hover"]?.highlightById([]);
|
|
143
|
+
};
|
|
50
144
|
};
|