@eodash/eodash 5.0.0-alpha.2.19 → 5.0.0-alpha.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/core/client/App.vue +11 -1
  2. package/core/client/asWebComponent.js +9 -2
  3. package/core/client/views/Dashboard.vue +17 -46
  4. package/dist/client/DashboardLayout-CPIA_V5h.js +86 -0
  5. package/dist/client/DynamicWebComponent-Bm2S0izi.js +88 -0
  6. package/dist/client/EodashDatePicker-Tdk5Xx9F.js +393 -0
  7. package/dist/client/EodashItemFilter-BUyqlf5G.js +194 -0
  8. package/dist/client/EodashLayerControl-DRYy-Air.js +111 -0
  9. package/dist/client/EodashMap-B_F51bLD.js +472 -0
  10. package/dist/client/EodashMapBtns-COBF3RhH.js +66 -0
  11. package/dist/client/ExportState-DkDHsbWL.js +644 -0
  12. package/dist/client/Footer-D8rQVlJH.js +141 -0
  13. package/dist/client/Header-CasZzQOl.js +437 -0
  14. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  15. package/dist/client/MobileLayout-CukFMuL9.js +1210 -0
  16. package/dist/client/PopUp-BXrxWSQ4.js +382 -0
  17. package/dist/client/VImg-DB_1xaqP.js +384 -0
  18. package/dist/client/VMain-nLmJhfgS.js +43 -0
  19. package/dist/client/VOverlay-naLhQSyZ.js +1453 -0
  20. package/dist/client/WidgetsContainer-CQY2xBg1.js +83 -0
  21. package/dist/client/asWebComponent-CIm1IGNl.js +11556 -0
  22. package/dist/client/eo-dash.js +2 -6
  23. package/dist/client/forwardRefs-q4ZkKtOv.js +245 -0
  24. package/dist/client/index-D-kMSCQA.js +199 -0
  25. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  26. package/dist/client/style.css +2 -2
  27. package/dist/client/transition-DKGepKqs.js +37 -0
  28. package/dist/node/cli.js +5 -5
  29. package/dist/node/types.d.ts +2 -0
  30. package/package.json +21 -19
  31. package/widgets/EodashDatePicker.vue +20 -9
  32. package/core/client/SuspensedDashboard.ce.vue +0 -105
  33. package/dist/client/DashboardLayout-CU4js3lr.js +0 -156
  34. package/dist/client/DynamicWebComponent-BsYZdIEB.js +0 -57
  35. package/dist/client/EodashDatePicker-DZoH_gRX.js +0 -276
  36. package/dist/client/EodashItemFilter-CHBfsFSm.js +0 -7666
  37. package/dist/client/EodashLayerControl-CuY-cAx8.js +0 -24665
  38. package/dist/client/EodashMap-Ch43fWNv.js +0 -88369
  39. package/dist/client/EodashMapBtns-CFA2uti4.js +0 -50
  40. package/dist/client/ExportState-C6raDjTt.js +0 -570
  41. package/dist/client/Footer-D8T5ROhF.js +0 -117
  42. package/dist/client/Header-B8B4Z5R9.js +0 -350
  43. package/dist/client/IframeWrapper-BK2JxzSJ.js +0 -19
  44. package/dist/client/MobileLayout-aZaYvF8V.js +0 -947
  45. package/dist/client/PopUp-DdHXoNOP.js +0 -300
  46. package/dist/client/VImg-yb8O1cb8.js +0 -293
  47. package/dist/client/VMain-Dknnyxts.js +0 -38
  48. package/dist/client/VOverlay-BCOn3hd6.js +0 -973
  49. package/dist/client/WidgetsContainer-BixUyr1e.js +0 -129
  50. package/dist/client/asWebComponent-CHqY8A1z.js +0 -24636
  51. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  52. package/dist/client/decoder-DJlmx386-DJlmx386.js +0 -8
  53. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  54. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  55. package/dist/client/forwardRefs-dcYA2XVU.js +0 -185
  56. package/dist/client/index-BVuSHaVu.js +0 -153
  57. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  58. package/dist/client/lerc-BPVtQnt3-08GHszVp.js +0 -1027
  59. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  60. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  61. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  62. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  63. package/dist/client/ssrBoot-DU2S_nLc.js +0 -17
  64. package/dist/client/transition-C_fi1aa6.js +0 -34
  65. package/dist/client/webfontloader-Ofarvipf.js +0 -435
  66. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,393 @@
1
+ import { computed, ref, mergeProps, createVNode, resolveComponent, render, h, useCssVars, customRef, reactive, watch, onMounted, openBlock, createElementBlock, Fragment, unref, createSlots, withCtx, createElementVNode, toHandlers, withDirectives, createBlock } from 'vue';
2
+ import { DatePicker } from 'v-calendar';
3
+ import { storeToRefs } from 'pinia';
4
+ import { p as propsFactory, o as omit, g as genericComponent, j as useProxiedModel, Y as getUid, a as useRender, E as isObject, Z as datetime, $ as useSTAcStore, a0 as eodashCollections, a1 as VRow, V as VBtn, y as VIcon } from './asWebComponent-CIm1IGNl.js';
5
+ import { mdiRayEndArrow, mdiRayStartArrow } from '@mdi/js';
6
+ import log from 'loglevel';
7
+ import { m as makeVOverlayProps, V as VOverlay } from './VOverlay-naLhQSyZ.js';
8
+ import { b as useScopeId, f as forwardRefs } from './forwardRefs-q4ZkKtOv.js';
9
+
10
+ const makeVTooltipProps = propsFactory({
11
+ id: String,
12
+ text: String,
13
+ ...omit(makeVOverlayProps({
14
+ closeOnBack: false,
15
+ location: 'end',
16
+ locationStrategy: 'connected',
17
+ eager: true,
18
+ minWidth: 0,
19
+ offset: 10,
20
+ openOnClick: false,
21
+ openOnHover: true,
22
+ origin: 'auto',
23
+ scrim: false,
24
+ scrollStrategy: 'reposition',
25
+ transition: false
26
+ }), ['absolute', 'persistent'])
27
+ }, 'VTooltip');
28
+ const VTooltip = genericComponent()({
29
+ name: 'VTooltip',
30
+ props: makeVTooltipProps(),
31
+ emits: {
32
+ 'update:modelValue': value => true
33
+ },
34
+ setup(props, _ref) {
35
+ let {
36
+ slots
37
+ } = _ref;
38
+ const isActive = useProxiedModel(props, 'modelValue');
39
+ const {
40
+ scopeId
41
+ } = useScopeId();
42
+ const uid = getUid();
43
+ const id = computed(() => props.id || `v-tooltip-${uid}`);
44
+ const overlay = ref();
45
+ const location = computed(() => {
46
+ return props.location.split(' ').length > 1 ? props.location : props.location + ' center';
47
+ });
48
+ const origin = computed(() => {
49
+ return props.origin === 'auto' || props.origin === 'overlap' || props.origin.split(' ').length > 1 || props.location.split(' ').length > 1 ? props.origin : props.origin + ' center';
50
+ });
51
+ const transition = computed(() => {
52
+ if (props.transition) return props.transition;
53
+ return isActive.value ? 'scale-transition' : 'fade-transition';
54
+ });
55
+ const activatorProps = computed(() => mergeProps({
56
+ 'aria-describedby': id.value
57
+ }, props.activatorProps));
58
+ useRender(() => {
59
+ const overlayProps = VOverlay.filterProps(props);
60
+ return createVNode(VOverlay, mergeProps({
61
+ "ref": overlay,
62
+ "class": ['v-tooltip', props.class],
63
+ "style": props.style,
64
+ "id": id.value
65
+ }, overlayProps, {
66
+ "modelValue": isActive.value,
67
+ "onUpdate:modelValue": $event => isActive.value = $event,
68
+ "transition": transition.value,
69
+ "absolute": true,
70
+ "location": location.value,
71
+ "origin": origin.value,
72
+ "persistent": true,
73
+ "role": "tooltip",
74
+ "activatorProps": activatorProps.value,
75
+ "_disableGlobalStack": true
76
+ }, scopeId), {
77
+ activator: slots.activator,
78
+ default: function () {
79
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
80
+ args[_key] = arguments[_key];
81
+ }
82
+ return slots.default?.(...args) ?? props.text;
83
+ }
84
+ });
85
+ });
86
+ return forwardRefs({}, overlay);
87
+ }
88
+ });
89
+
90
+ // Utilities
91
+ function useDirectiveComponent(component, props) {
92
+ const concreteComponent = typeof component === 'string' ? resolveComponent(component) : component;
93
+ const hook = mountComponent(concreteComponent, props);
94
+ return {
95
+ mounted: hook,
96
+ updated: hook,
97
+ unmounted(el) {
98
+ render(null, el);
99
+ }
100
+ };
101
+ }
102
+ function mountComponent(component, props) {
103
+ return function (el, binding, vnode) {
104
+ const _props = typeof props === 'function' ? props(binding) : props;
105
+ const text = binding.value?.text ?? binding.value ?? _props?.text;
106
+ const value = isObject(binding.value) ? binding.value : {};
107
+
108
+ // Get the children from the props or directive value, or the element's children
109
+ const children = () => text ?? el.textContent;
110
+
111
+ // If vnode.ctx is the same as the instance, then we're bound to a plain element
112
+ // and need to find the nearest parent component instance to inherit provides from
113
+ const provides = (vnode.ctx === binding.instance.$ ? findComponentParent(vnode, binding.instance.$)?.provides : vnode.ctx?.provides) ?? binding.instance.$.provides;
114
+ const node = h(component, mergeProps(_props, value), children);
115
+ node.appContext = Object.assign(Object.create(null), binding.instance.$.appContext, {
116
+ provides
117
+ });
118
+ render(node, el);
119
+ };
120
+ }
121
+ function findComponentParent(vnode, root) {
122
+ // Walk the tree from root until we find the child vnode
123
+ const stack = new Set();
124
+ const walk = children => {
125
+ for (const child of children) {
126
+ if (!child) continue;
127
+ if (child === vnode) {
128
+ return true;
129
+ }
130
+ stack.add(child);
131
+ let result;
132
+ if (child.suspense) {
133
+ result = walk([child.ssContent]);
134
+ } else if (Array.isArray(child.children)) {
135
+ result = walk(child.children);
136
+ } else if (child.component?.vnode) {
137
+ result = walk([child.component?.subTree]);
138
+ }
139
+ if (result) {
140
+ return result;
141
+ }
142
+ stack.delete(child);
143
+ }
144
+ return false;
145
+ };
146
+ if (!walk([root.subTree])) {
147
+ throw new Error('Could not find original vnode');
148
+ }
149
+
150
+ // Return the first component parent
151
+ const result = Array.from(stack).reverse();
152
+ for (const child of result) {
153
+ if (child.component) {
154
+ return child.component;
155
+ }
156
+ }
157
+ return root;
158
+ }
159
+
160
+ // Components
161
+ const Tooltip = useDirectiveComponent(VTooltip, binding => {
162
+ return {
163
+ activator: 'parent',
164
+ location: binding.arg?.replace('-', ' '),
165
+ text: typeof binding.value === 'boolean' ? undefined : binding.value
166
+ };
167
+ });
168
+
169
+ const _hoisted_1 = {
170
+ class: "flex rounded-lg border border-gray-300 dark:border-gray-600",
171
+ style: {"margin":"2px"}
172
+ };
173
+ const _hoisted_2 = ["value"];
174
+ const _hoisted_3 = {
175
+ class: "w-full px-4 pb-3",
176
+ style: {"font-size":"12px"}
177
+ };
178
+ const _hoisted_4 = ["innerHTML"];
179
+
180
+ // holds the number value of the datetime
181
+
182
+ const _sfc_main = {
183
+ __name: 'EodashDatePicker',
184
+ props: {
185
+ hintText: {
186
+ type: String,
187
+ default: null,
188
+ },
189
+ },
190
+ setup(__props) {
191
+
192
+ useCssVars(_ctx => ({
193
+ "cd569fa8": (transform.value)
194
+ }));
195
+
196
+ const currentDate = customRef((track, trigger) => ({
197
+ get() {
198
+ track();
199
+ return new Date(datetime.value).getTime();
200
+ },
201
+ /** @param {number} num */
202
+ set(num) {
203
+ trigger();
204
+ log.debug("Datepicker setting currentDate", datetime.value);
205
+ datetime.value = new Date(num).toISOString();
206
+ },
207
+ }));
208
+
209
+ const masks = ref({
210
+ input: "YYYY-MM-DD",
211
+ });
212
+
213
+
214
+
215
+ /**
216
+ * Attributes displayed on datepicker
217
+ *
218
+ * @type {import("vue").Reactive<
219
+ * (
220
+ * | Partial<import("v-calendar/dist/types/src/utils/attribute").AttributeConfig>
221
+ * | undefined
222
+ * )[]
223
+ * >}
224
+ */
225
+ const attributes = reactive([]);
226
+
227
+ const { selectedStac } = storeToRefs(useSTAcStore());
228
+
229
+ watch(
230
+ selectedStac,
231
+ async (updatedStac, previousStac) => {
232
+ if (updatedStac && previousStac?.id !== updatedStac.id) {
233
+ log.debug("Datepicker selected STAC change triggered");
234
+ const wongPalette = [
235
+ "#009E73",
236
+ "#0072B2",
237
+ "#E69F00",
238
+ "#CC79A7",
239
+ "#56B4E9",
240
+ "#D55E00",
241
+ ];
242
+ // remove old values
243
+ attributes.splice(0, attributes.length);
244
+
245
+ for (let idx = 0; idx < eodashCollections.length; idx++) {
246
+ log.debug("Retrieving dates", eodashCollections[idx]);
247
+ await eodashCollections[idx].fetchCollection();
248
+ const dates = [
249
+ ...new Set(
250
+ eodashCollections[idx].getItems()?.reduce((valid, it) => {
251
+ const parsed = Date.parse(/** @type {string} */ (it.datetime));
252
+ if (parsed) {
253
+ valid.push(new Date(parsed));
254
+ }
255
+ return valid;
256
+ }, /** @type {Date[]} */ ([])),
257
+ ),
258
+ ];
259
+ attributes.push({
260
+ key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
261
+ bar: {
262
+ style: {
263
+ backgroundColor: wongPalette[idx % wongPalette.length],
264
+ },
265
+ },
266
+ dates,
267
+ content: {
268
+ style: {
269
+ color: "#000000",
270
+ "font-weight": "bold",
271
+ },
272
+ },
273
+ });
274
+ }
275
+ }
276
+ },
277
+ { immediate: true },
278
+ );
279
+
280
+ /**
281
+ * @param {boolean} reverse
282
+ */
283
+ function jumpDate(reverse) {
284
+ if (attributes.length) {
285
+ let latestDateMS = reverse ? Infinity : -Infinity;
286
+ attributes.forEach((coll) => {
287
+ if (coll?.dates) {
288
+ coll.dates.forEach((d) => {
289
+ // TODO: we need to handle time ranges and other options here
290
+ if (d instanceof Date) {
291
+ const mathFun = reverse ? "min" : "max";
292
+ latestDateMS = Math[mathFun](latestDateMS, d.getTime());
293
+ }
294
+ });
295
+ }
296
+ });
297
+ currentDate.value =
298
+ latestDateMS === -Infinity
299
+ ? Date.now()
300
+ : latestDateMS === Infinity
301
+ ? 0
302
+ : latestDateMS;
303
+ }
304
+ }
305
+
306
+ // fixes calendar dispalcement on lib mode
307
+ const transform = ref("");
308
+ onMounted(() => {
309
+ transform.value = document.querySelector("eo-dash")
310
+ ? "translate3d(50px,-80px,0)"
311
+ : "translate3d(0px,-80px,0)";
312
+ });
313
+
314
+ return (_ctx, _cache) => {
315
+
316
+
317
+
318
+
319
+
320
+ return (openBlock(), createElementBlock(Fragment, null, [
321
+ createVNode(unref(DatePicker), {
322
+ modelValue: currentDate.value,
323
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((currentDate).value = $event)),
324
+ modelModifiers: { number: true },
325
+ masks: masks.value,
326
+ attributes: attributes
327
+ }, createSlots({
328
+ default: withCtx(({ inputValue, inputEvents }) => [
329
+ createElementVNode("div", _hoisted_1, [
330
+ createElementVNode("input", mergeProps({ value: inputValue }, toHandlers(inputEvents, true), {
331
+ style: {"margin":"1px"},
332
+ class: "flex-grow px-1 py-1 bg-white dark:bg-gray-700"
333
+ }), null, 16 /* FULL_PROPS */, _hoisted_2)
334
+ ])
335
+ ]),
336
+ _: 2 /* DYNAMIC */
337
+ }, [
338
+ (__props.hintText)
339
+ ? {
340
+ name: "footer",
341
+ fn: withCtx(() => [
342
+ createElementVNode("div", _hoisted_3, [
343
+ createElementVNode("span", { innerHTML: __props.hintText }, null, 8 /* PROPS */, _hoisted_4)
344
+ ])
345
+ ]),
346
+ key: "0"
347
+ }
348
+ : undefined
349
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["modelValue", "masks", "attributes"]),
350
+ createVNode(VRow, {
351
+ align: "center",
352
+ justify: "center",
353
+ style: {"margin-top":"6px"}
354
+ }, {
355
+ default: withCtx(() => [
356
+ withDirectives((openBlock(), createBlock(VBtn, {
357
+ style: {"padding":"0px","margin-right":"4px"},
358
+ density: "compact",
359
+ onClick: _cache[1] || (_cache[1] = $event => (jumpDate(true)))
360
+ }, {
361
+ default: withCtx(() => [
362
+ createVNode(VIcon, {
363
+ icon: [unref(mdiRayEndArrow)]
364
+ }, null, 8 /* PROPS */, ["icon"])
365
+ ]),
366
+ _: 1 /* STABLE */
367
+ })), [
368
+ [Tooltip, 'Set date to oldest available dataset', "bottom"]
369
+ ]),
370
+ withDirectives((openBlock(), createBlock(VBtn, {
371
+ style: {"padding":"0px","margin-left":"4px"},
372
+ density: "compact",
373
+ onClick: _cache[2] || (_cache[2] = $event => (jumpDate(false)))
374
+ }, {
375
+ default: withCtx(() => [
376
+ createVNode(VIcon, {
377
+ icon: [unref(mdiRayStartArrow)]
378
+ }, null, 8 /* PROPS */, ["icon"])
379
+ ]),
380
+ _: 1 /* STABLE */
381
+ })), [
382
+ [Tooltip, 'Set date to latest available dataset', "bottom"]
383
+ ])
384
+ ]),
385
+ _: 1 /* STABLE */
386
+ })
387
+ ], 64 /* STABLE_FRAGMENT */))
388
+ }
389
+ }
390
+
391
+ };
392
+
393
+ export { _sfc_main as default };
@@ -0,0 +1,194 @@
1
+ import { ref, onMounted, openBlock, createElementBlock, mergeProps, createElementVNode, toDisplayString } from 'vue';
2
+ import { $ as useSTAcStore } from './asWebComponent-CIm1IGNl.js';
3
+ import '@eox/itemfilter';
4
+
5
+ const _hoisted_1 = {
6
+ slot: "filterstitle",
7
+ style: {"margin":"14px 8px"}
8
+ };
9
+ const _hoisted_2 = {
10
+ slot: "resultstitle",
11
+ style: {"margin":"14px 8px"}
12
+ };
13
+
14
+ const defaultStyle =
15
+ "float:right; height:15px; padding:4px; margin-top:-4px; background-color:white;";
16
+ const highlightStyle =
17
+ "float:right; height:15px; padding:4px; margin-top:-4px; background-color:#9bcaeb;";
18
+
19
+
20
+ const _sfc_main = {
21
+ __name: 'EodashItemFilter',
22
+ props: {
23
+ enableCompare: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ filtersTitle: {
28
+ type: String,
29
+ default: "Indicators",
30
+ },
31
+ resultsTitle: {
32
+ type: String,
33
+ default: "",
34
+ },
35
+ titleProperty: {
36
+ type: String,
37
+ default: "title",
38
+ },
39
+
40
+ aggregateResults: {
41
+ type: String,
42
+ default: "themes",
43
+ },
44
+ enableHighlighting: { type: Boolean, default: true },
45
+ expandMultipleFilters: { type: Boolean, default: true },
46
+ expandMultipleResults: { type: Boolean, default: true },
47
+ filterProperties: {
48
+ /** @type {import("vue").PropType<{
49
+ * keys:string[];
50
+ * title:string;
51
+ * type:string;
52
+ * expanded?:boolean
53
+ * }[]> }*/
54
+ type: Array,
55
+ default: () => [
56
+ {
57
+ keys: ["title", "themes", "description"],
58
+ title: "Search",
59
+ type: "text",
60
+ },
61
+ {
62
+ key: "themes",
63
+ title: "Theme Filter",
64
+ type: "multiselect",
65
+ },
66
+ ],
67
+ },
68
+ },
69
+ setup(__props) {
70
+
71
+ const props = __props;
72
+ /** @param {any} evt*/
73
+ const onSelect = async (evt) => {
74
+ // reset the style of all compare buttons
75
+ eoxItemFilter.value?.shadowRoot
76
+ ?.querySelectorAll(".compareMapButton")
77
+ .forEach((res) => res.setAttribute("style", defaultStyle));
78
+ const item = /** @type {import('stac-ts').StacLink} */ evt.detail;
79
+ if (item) {
80
+ // Reset compare stac to empty
81
+ store.resetSelectedCompareSTAC();
82
+ await store.loadSelectedSTAC(item.href);
83
+ }
84
+ };
85
+ const config = {
86
+ titleProperty: props.titleProperty,
87
+ filterProperties: props.filterProperties,
88
+ aggregateResults: props.aggregateResults,
89
+ enableHighlighting: props.enableHighlighting,
90
+ expandMultipleFilters: props.expandMultipleFilters,
91
+ expandMultipleResults: props.expandMultipleResults,
92
+ };
93
+ /** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
94
+ const eoxItemFilter = ref(null);
95
+
96
+ const store = useSTAcStore();
97
+
98
+ const injectCompareButtons = () => {
99
+ setTimeout(() => {
100
+ /** @type {any} */
101
+ (eoxItemFilter.value)?.shadowRoot
102
+ .querySelectorAll("details>summary")
103
+ .forEach((/** @type {HTMLElement} */ el) =>
104
+ el.setAttribute("style", "width: 100%"),
105
+ );
106
+ /** @type {any} */
107
+ (eoxItemFilter.value)?.shadowRoot
108
+ .querySelectorAll("details>div li")
109
+ .forEach((/** @type {HTMLElement} */ res) => {
110
+ let compareButton = document.createElement("button");
111
+ compareButton.className = "compareMapButton";
112
+ compareButton.dataset.id = res.children[0].id;
113
+
114
+ compareButton.onclick = async (
115
+ /** {Event & { currentTarget: HTMLElement }} */ evt,
116
+ ) => {
117
+ // reset the style of all compare buttons
118
+ eoxItemFilter.value?.shadowRoot
119
+ ?.querySelectorAll(".compareMapButton")
120
+ .forEach((res) => {
121
+ res.setAttribute("style", defaultStyle);
122
+ });
123
+ const currentTarget = /** @type {HTMLElement}*/ (evt.currentTarget);
124
+ currentTarget?.setAttribute("style", highlightStyle);
125
+ const selected = eoxItemFilter.value?.items.find(
126
+ (/** @type {HTMLElement} */ it) =>
127
+ it.id === currentTarget?.dataset.id,
128
+ );
129
+ if (selected) {
130
+ await store.loadSelectedCompareSTAC(selected.href);
131
+ }
132
+ };
133
+ compareButton.setAttribute("style", defaultStyle);
134
+ const svgIcon = document.createElementNS(
135
+ "http://www.w3.org/2000/svg",
136
+ "svg",
137
+ );
138
+ const iconPath = document.createElementNS(
139
+ "http://www.w3.org/2000/svg",
140
+ "path",
141
+ );
142
+ svgIcon.setAttribute("width", "15");
143
+ svgIcon.setAttribute("height", "15");
144
+ svgIcon.setAttribute("viewBox", "0 0 24 24");
145
+ iconPath.setAttribute(
146
+ "d",
147
+ "M19,3H14V5H19V18L14,12V21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,18H5L10,12M10,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H10V23H12V1H10V3Z",
148
+ );
149
+ svgIcon.appendChild(iconPath);
150
+ compareButton.appendChild(svgIcon);
151
+ res.append(compareButton);
152
+ });
153
+ }, 100);
154
+ };
155
+
156
+ onMounted(() => {
157
+ const style = document.createElement("style");
158
+ style.innerHTML = `
159
+ section {
160
+ margin: 0 !important;
161
+ }
162
+ section button#filter-reset {
163
+ padding: 0 8px;
164
+ top: 8px;
165
+ right: 8px;
166
+ }
167
+ `;
168
+ eoxItemFilter.value?.shadowRoot?.appendChild(style);
169
+
170
+ // Only list child elements in list
171
+ const items = store.stac?.filter((item) => item.rel === "child");
172
+ /** @type {any} */
173
+ (eoxItemFilter.value).items = items;
174
+ if (props.enableCompare) {
175
+ injectCompareButtons();
176
+ }
177
+ });
178
+
179
+ return (_ctx, _cache) => {
180
+ return (openBlock(), createElementBlock("eox-itemfilter", mergeProps({ class: "fill-height" }, config, {
181
+ ref_key: "eoxItemFilter",
182
+ ref: eoxItemFilter,
183
+ style: {"overflow":"auto"},
184
+ onSelect: onSelect
185
+ }), [
186
+ createElementVNode("h4", _hoisted_1, toDisplayString(__props.filtersTitle), 1 /* TEXT */),
187
+ createElementVNode("h4", _hoisted_2, toDisplayString(__props.resultsTitle), 1 /* TEXT */)
188
+ ], 16 /* FULL_PROPS */))
189
+ }
190
+ }
191
+
192
+ };
193
+
194
+ export { _sfc_main as default };
@@ -0,0 +1,111 @@
1
+ import { computed, ref, openBlock, createElementBlock, unref, createCommentVNode } from 'vue';
2
+ import '@eox/layercontrol';
3
+ import '@eox/jsonform';
4
+ import '@eox/timecontrol';
5
+ import { $ as useSTAcStore, a2 as mapCompareEl, a3 as mapEl, a4 as eodashCompareCollections, a0 as eodashCollections, a5 as getColFromLayer } from './asWebComponent-CIm1IGNl.js';
6
+ import { storeToRefs } from 'pinia';
7
+
8
+ const _hoisted_1 = { class: "d-flex flex-column fill-height overflow-auto" };
9
+ const _hoisted_2 = ["for"];
10
+
11
+
12
+ const _sfc_main = {
13
+ __name: 'EodashLayerControl',
14
+ props: {
15
+ map: {
16
+ type: String,
17
+ default: "first",
18
+ },
19
+ },
20
+ setup(__props) {
21
+
22
+ const props = __props;
23
+
24
+ const showControls = computed(() => {
25
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
26
+ if (props.map === "second") {
27
+ return mapCompareEl.value !== null && selectedCompareStac.value !== null;
28
+ }
29
+ if (mapEl.value !== null && selectedStac.value !== null) {
30
+ return true;
31
+ }
32
+ return false;
33
+ });
34
+
35
+ const eodashCols =
36
+ props.map === "second" ? eodashCompareCollections : eodashCollections;
37
+ const mapElement = props.map === "second" ? mapCompareEl : mapEl;
38
+
39
+ /** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
40
+ const eoxLayercontrol = ref(null);
41
+
42
+ /** @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt */
43
+ const handleDatetimeUpdate = async (evt) => {
44
+ const { layer, datetime } = evt.detail;
45
+
46
+ const ec = await getColFromLayer(eodashCols, layer);
47
+
48
+ /** @type {Record<string,any>[] | undefined} */
49
+ let updatedLayers = [];
50
+
51
+ if (ec) {
52
+ await ec.fetchCollection();
53
+ updatedLayers = await ec.updateLayerJson(
54
+ datetime,
55
+ layer.get("id"),
56
+ props.map,
57
+ );
58
+ }
59
+ /** @type {Record<String,any>[] | undefined} */
60
+ const dataLayers = updatedLayers?.find(
61
+ (l) => l?.properties?.id === "AnalysisGroup",
62
+ )?.layers;
63
+
64
+ if (dataLayers?.length) {
65
+ // Add expand to all analysis layers
66
+ dataLayers?.forEach((dl) => {
67
+ dl.properties.layerControlExpand = true;
68
+ dl.properties.layerControlToolsExpand = true;
69
+ });
70
+ // assign layers to the map
71
+ /** @type {HTMLElement & Record<string,any>} */
72
+ (mapElement.value).layers = updatedLayers;
73
+ }
74
+ };
75
+
76
+ // ----- debounce logic
77
+ /** @type {NodeJS.Timeout | undefined} */
78
+ let timeout;
79
+
80
+ /**
81
+ * @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt
82
+ **/
83
+ const debouncedHandleDateTime = (evt) => {
84
+ clearTimeout(timeout);
85
+ timeout = setTimeout(() => {
86
+ handleDatetimeUpdate(evt);
87
+ }, 500);
88
+ };
89
+ // ------
90
+
91
+ return (_ctx, _cache) => {
92
+ return (openBlock(), createElementBlock("span", _hoisted_1, [
93
+ (showControls.value)
94
+ ? (openBlock(), createElementBlock("eox-layercontrol", {
95
+ key: 0,
96
+ for: unref(mapElement),
97
+ ".tools": ['datetime', 'info', 'config', 'opacity'],
98
+ "onDatetime:updated": debouncedHandleDateTime,
99
+ class: "fill-height",
100
+ toolsAsList: "true",
101
+ ref_key: "eoxLayercontrol",
102
+ ref: eoxLayercontrol
103
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2))
104
+ : createCommentVNode("v-if", true)
105
+ ]))
106
+ }
107
+ }
108
+
109
+ };
110
+
111
+ export { _sfc_main as default };