@eodash/eodash 5.6.1 → 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/DashboardLayout.vue +1 -1
- 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/composables/index.js +6 -2
- package/core/client/eodashSTAC/EodashCollection.js +79 -45
- package/core/client/eodashSTAC/cql.js +64 -0
- package/core/client/eodashSTAC/createLayers.js +192 -125
- package/core/client/eodashSTAC/helpers.js +423 -97
- 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 +155 -29
- package/core/client/utils/bands-editor/exampleSchema.json +50 -50
- package/core/client/utils/index.js +4 -0
- package/core/client/utils/states.js +10 -0
- package/dist/client/{DashboardLayout-CqMb7OXc.js → DashboardLayout-ePbdvUTE.js} +5 -5
- package/dist/client/{DynamicWebComponent-DqKqTf7l.js → DynamicWebComponent-g5SdRbjY.js} +1 -1
- package/dist/client/{EodashChart-PkUQfH0k.js → EodashChart-ChrkA5oS.js} +7 -6
- package/dist/client/{EodashDatePicker-DLJGdTtX.js → EodashDatePicker-CY1TrsDo.js} +3 -3
- package/dist/client/{EodashItemFilter-Dk8KjFcX.js → EodashItemFilter-DzshHDlS.js} +2 -1
- package/dist/client/{EodashLayerControl-CC1Cogrn.js → EodashLayerControl-DMCeMkSd.js} +70 -22
- package/dist/client/{EodashLayoutSwitcher-5WZYd6rr.js → EodashLayoutSwitcher-iJ8mX1rF.js} +3 -3
- package/dist/client/EodashMapBtns-C7Cr7q5Y.js +592 -0
- package/dist/client/EodashStacInfo-K7-iuXa7.js +169 -0
- package/dist/client/{EodashTools-CGZtTh45.js → EodashTools-BEK7e7JM.js} +4 -4
- package/dist/client/{ExportState-Ce0ZnrX_.js → ExportState-CqIzfMYQ.js} +6 -168
- package/dist/client/{Footer-CnZqEiop.js → Footer-1P0cmBOZ.js} +1 -1
- package/dist/client/{Header-Dr5PBIm8.js → Header-CkkBaBNh.js} +2 -2
- package/dist/client/MobileLayout-BPf49kDU.js +118 -0
- package/dist/client/{PopUp-DjvE_71e.js → PopUp-DPZq5SWI.js} +4 -168
- package/dist/client/{ProcessList-kf3olI7W.js → ProcessList-DuI6WpS1.js} +5 -5
- package/dist/client/VDivider-Bj9LG_JV.js +168 -0
- package/dist/client/{VImg-Bj6uWt6j.js → VImg-Ddv5OyMz.js} +2 -2
- package/dist/client/{VMain-Cm0UmKGi.js → VMain-7yqk_qC3.js} +1 -1
- package/dist/client/{VTooltip-DbBu-ky3.js → VTooltip-2hAJyEoa.js} +2 -2
- package/dist/client/{WidgetsContainer-CfLnd44U.js → WidgetsContainer-2DOrlwCB.js} +1 -1
- package/dist/client/{asWebComponent-DfULAbpq.js → asWebComponent-BlFN2lkB.js} +493 -335
- package/dist/client/{async-CIbKXEEe.js → async-B2H8ZwUK.js} +21 -10
- package/dist/client/create-layers-config-u_vn5hPk.js +182 -0
- package/dist/client/dialog-transition-BrMkMiNa.js +170 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-yj3VWOK5.js → forwardRefs-DAlror6d.js} +8 -87
- package/dist/client/{handling-s8xt2JwF.js → handling-B6I1V5eG.js} +123 -85
- package/dist/client/{helpers-DAVGYl_f.js → helpers-CBqIUSXJ.js} +3034 -1649
- package/dist/client/index-BWq1ZKaV.js +3168 -0
- package/dist/client/{index-CYz6dT7K.js → index-CJ9UI3ln.js} +2 -2
- package/dist/client/index-DXLz4sFR.js +442 -0
- package/dist/client/{index-4TrjfJ32.js → index-DhKU6KqM.js} +230 -231
- package/dist/client/{index-Bu8BMA9q.js → index-DjQlbWbJ.js} +70 -83
- 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/mosaic-BFYLEwyx.js +455 -0
- package/dist/client/templates.js +250 -119
- package/dist/client/{transition-DaOsiD4u.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/composables/index.d.ts +1 -3
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +62 -31
- package/dist/types/core/client/eodashSTAC/cql.d.ts +15 -0
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +44 -25
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +78 -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 +131 -25
- package/dist/types/core/client/utils/states.d.ts +12 -0
- package/dist/types/templates/baseConfig.d.ts +1 -88
- 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 +36 -17
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +23 -10
- package/dist/types/widgets/EodashMap/index.vue.d.ts +91 -35
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -8
- 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/composables.d.ts +1 -1
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -8
- 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 +54 -0
- package/dist/types/widgets/EodashTimeSlider/methods/index.d.ts +34 -0
- package/dist/types/widgets/EodashTimeSlider/types.d.ts +52 -0
- package/dist/types/widgets/EodashTools.vue.d.ts +5 -5
- package/package.json +46 -46
- 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 +64 -14
- package/widgets/EodashMap/EodashMapBtns.vue +153 -47
- package/widgets/EodashMap/index.vue +101 -105
- package/widgets/EodashMap/methods/btns.js +37 -5
- package/widgets/EodashMap/methods/create-layers-config.js +18 -16
- package/widgets/EodashMap/methods/index.js +89 -8
- package/widgets/EodashMap/methods/use-map-loading.js +52 -0
- package/widgets/EodashProcess/index.vue +2 -1
- package/widgets/EodashProcess/methods/async.js +19 -8
- package/widgets/EodashProcess/methods/composables.js +63 -77
- package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +9 -5
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +7 -4
- package/widgets/EodashProcess/methods/handling.js +105 -72
- package/widgets/EodashProcess/states.js +1 -1
- package/widgets/EodashStacInfo.vue +64 -2
- package/widgets/EodashTimeSlider/index.vue +208 -0
- package/widgets/EodashTimeSlider/methods/index.js +236 -0
- package/widgets/EodashTimeSlider/types.ts +54 -0
- package/dist/client/EodashMapBtns-BHrSDNoC.js +0 -435
- package/dist/client/EodashStacInfo-B90wobPc.js +0 -107
- package/dist/client/EodashTimeSlider-5vm7F3ju.js +0 -53
- package/dist/client/MobileLayout-DyMjaeif.js +0 -118
- package/dist/client/index-CugS__t5.js +0 -570
- package/dist/types/widgets/EodashTimeSlider.vue.d.ts +0 -15
- package/widgets/EodashTimeSlider.vue +0 -40
|
@@ -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
|
};
|