@eodash/eodash 5.0.0-rc.1.5 → 5.0.0-rc.2

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 (62) hide show
  1. package/README.md +1 -1
  2. package/core/client/composables/EodashMap.js +47 -28
  3. package/core/client/composables/EodashProcess.js +51 -5
  4. package/core/client/composables/index.js +8 -1
  5. package/core/client/eodash.js +21 -7
  6. package/core/client/eodashSTAC/EodashCollection.js +24 -4
  7. package/core/client/eodashSTAC/createLayers.js +62 -6
  8. package/core/client/eodashSTAC/helpers.js +48 -5
  9. package/core/client/eodashSTAC/triggers.js +52 -1
  10. package/core/client/store/stac.js +7 -2
  11. package/core/client/types.ts +10 -1
  12. package/core/client/utils/index.js +12 -0
  13. package/core/client/utils/states.js +18 -1
  14. package/core/client/views/Dashboard.vue +3 -1
  15. package/dist/client/{DashboardLayout-B-4X57-t.js → DashboardLayout-VrJIbhe8.js} +2 -2
  16. package/dist/client/{DynamicWebComponent-Dj3QYwag.js → DynamicWebComponent-BCwpocDX.js} +1 -1
  17. package/dist/client/EodashDatePicker-Bp5ec3BC.js +430 -0
  18. package/dist/client/{EodashItemFilter-DBQwJQPh.js → EodashItemFilter-Cx0t-qeW.js} +1 -1
  19. package/dist/client/{EodashLayerControl-C5fOCvoI.js → EodashLayerControl-DERx00In.js} +10 -2
  20. package/dist/client/{EodashLayoutSwitcher-BMO9k_20.js → EodashLayoutSwitcher-DTS7otlk.js} +2 -2
  21. package/dist/client/{EodashMap-D2bnMLAC.js → EodashMap-C-I6puhb.js} +101 -73
  22. package/dist/client/{EodashMapBtns-l9B977id.js → EodashMapBtns-CWgtJiG4.js} +4 -4
  23. package/dist/client/{EodashProcess-BtIlJvF1.js → EodashProcess-DWrTIyHT.js} +188 -33
  24. package/dist/client/{EodashStacInfo-CPVvp_Hm.js → EodashStacInfo-Dvsk97Mz.js} +1 -1
  25. package/dist/client/{EodashTools-DY2dlNXW.js → EodashTools-CdnjgTTl.js} +4 -4
  26. package/dist/client/{ExportState-BvD5A0XG.js → ExportState-S4lcehm3.js} +4 -4
  27. package/dist/client/{Footer-w95gBnSH.js → Footer-DlIEbXp-.js} +1 -1
  28. package/dist/client/{Header-BpiorKy9.js → Header-CTiEXLi0.js} +3 -3
  29. package/dist/client/{MobileLayout-CmVlZe7S.js → MobileLayout-DRgyQYFz.js} +17 -7
  30. package/dist/client/{PopUp-CREaSybs.js → PopUp-CzqV8BFZ.js} +3 -3
  31. package/dist/client/{VImg-DF9esgdd.js → VImg-Bn8bCvVM.js} +2 -2
  32. package/dist/client/{VMain-BWLMf-rn.js → VMain-2GOqWb6m.js} +1 -1
  33. package/dist/client/{VOverlay-DmNfblmy.js → VOverlay-BetC0LGI.js} +3 -3
  34. package/dist/client/{VTooltip-C3PeE7iO.js → VTooltip-BWg0dxx5.js} +3 -3
  35. package/dist/client/{WidgetsContainer-6FHEEXns.js → WidgetsContainer-Cv466WUW.js} +1 -1
  36. package/dist/client/{asWebComponent-BnFMd0T6.js → asWebComponent-CLUhauLl.js} +422 -164
  37. package/dist/client/eo-dash.css +1 -1
  38. package/dist/client/eo-dash.js +1 -1
  39. package/dist/client/{forwardRefs-BF3Me2RX.js → forwardRefs-CxSsJulB.js} +1 -1
  40. package/dist/client/{index-CRd5-RSy.js → index-BMj56LY3.js} +1 -1
  41. package/dist/client/{transition-Cpn_g5jE.js → transition-DidoPMgC.js} +1 -1
  42. package/dist/node/cli.js +2 -2
  43. package/dist/types/core/client/composables/EodashMap.d.ts +2 -1
  44. package/dist/types/core/client/composables/EodashProcess.d.ts +17 -11
  45. package/dist/types/core/client/composables/index.d.ts +1 -1
  46. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +11 -4
  47. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +6 -6
  48. package/dist/types/core/client/eodashSTAC/helpers.d.ts +77 -20
  49. package/dist/types/core/client/eodashSTAC/triggers.d.ts +6 -0
  50. package/dist/types/core/client/types.d.ts +13 -1
  51. package/dist/types/core/client/utils/index.d.ts +1 -0
  52. package/dist/types/core/client/utils/states.d.ts +9 -0
  53. package/dist/types/widgets/EodashDatePicker.vue.d.ts +459 -2
  54. package/dist/types/widgets/EodashMap.vue.d.ts +2 -0
  55. package/dist/types/widgets/EodashProcess.vue.d.ts +1 -0
  56. package/dist/types/widgets/PopUp.vue.d.ts +1 -2
  57. package/package.json +24 -24
  58. package/widgets/EodashDatePicker.vue +139 -22
  59. package/widgets/EodashLayerControl.vue +13 -1
  60. package/widgets/EodashMap.vue +63 -5
  61. package/widgets/EodashProcess.vue +82 -22
  62. package/dist/client/EodashDatePicker-DGRJrJ0s.js +0 -306
@@ -1,306 +0,0 @@
1
- import { resolveComponent, render, h, mergeProps, customRef, ref, reactive, toRef, watch, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, withDirectives, createBlock, createCommentVNode } from 'vue';
2
- import { DatePicker } from 'v-calendar';
3
- import { E as isObject, Y as consoleError, Z as datetime, $ as useSTAcStore, a0 as eodashCollections, a1 as makePanelTransparent, V as VBtn, y as VIcon } from './asWebComponent-BnFMd0T6.js';
4
- import { mdiRayEndArrow, mdiRayStartArrow } from '@mdi/js';
5
- import log from 'loglevel';
6
- import { V as VTooltip } from './VTooltip-C3PeE7iO.js';
7
-
8
- // Utilities
9
- function useDirectiveComponent(component, props) {
10
- const concreteComponent = typeof component === 'string' ? resolveComponent(component) : component;
11
- const hook = mountComponent(concreteComponent, props);
12
- return {
13
- mounted: hook,
14
- updated: hook,
15
- unmounted(el) {
16
- render(null, el);
17
- }
18
- };
19
- }
20
- function mountComponent(component, props) {
21
- return function (el, binding, vnode) {
22
- const _props = typeof props === 'function' ? props(binding) : props;
23
- const text = binding.value?.text ?? binding.value ?? _props?.text;
24
- const value = isObject(binding.value) ? binding.value : {};
25
-
26
- // Get the children from the props or directive value, or the element's children
27
- const children = () => text ?? el.textContent;
28
-
29
- // If vnode.ctx is the same as the instance, then we're bound to a plain element
30
- // and need to find the nearest parent component instance to inherit provides from
31
- const provides = (vnode.ctx === binding.instance.$ ? findComponentParent(vnode, binding.instance.$)?.provides : vnode.ctx?.provides) ?? binding.instance.$.provides;
32
- const node = h(component, mergeProps(_props, value), children);
33
- node.appContext = Object.assign(Object.create(null), binding.instance.$.appContext, {
34
- provides
35
- });
36
- render(node, el);
37
- };
38
- }
39
- function findComponentParent(vnode, root) {
40
- // Walk the tree from root until we find the child vnode
41
- const stack = new Set();
42
- const walk = children => {
43
- for (const child of children) {
44
- if (!child) continue;
45
- if (child === vnode || child.el && vnode.el && child.el === vnode.el) {
46
- return true;
47
- }
48
- stack.add(child);
49
- let result;
50
- if (child.suspense) {
51
- result = walk([child.ssContent]);
52
- } else if (Array.isArray(child.children)) {
53
- result = walk(child.children);
54
- } else if (child.component?.vnode) {
55
- result = walk([child.component?.subTree]);
56
- }
57
- if (result) {
58
- return result;
59
- }
60
- stack.delete(child);
61
- }
62
- return false;
63
- };
64
- if (!walk([root.subTree])) {
65
- consoleError('Could not find original vnode, component will not inherit provides');
66
- return root;
67
- }
68
-
69
- // Return the first component parent
70
- const result = Array.from(stack).reverse();
71
- for (const child of result) {
72
- if (child.component) {
73
- return child.component;
74
- }
75
- }
76
- return root;
77
- }
78
-
79
- // Components
80
- const Tooltip = useDirectiveComponent(VTooltip, binding => {
81
- return {
82
- activator: 'parent',
83
- location: binding.arg?.replace('-', ' '),
84
- text: typeof binding.value === 'boolean' ? undefined : binding.value
85
- };
86
- });
87
-
88
- const _hoisted_1 = { class: "d-flex flex-row align-center justify-center pb-1" };
89
- const _hoisted_2 = {
90
- class: "flex rounded-lg border border-gray-300 dark:border-gray-600",
91
- style: {"margin":"2px"}
92
- };
93
- const _hoisted_3 = ["value"];
94
-
95
- // holds the number value of the datetime
96
-
97
- const _sfc_main = {
98
- __name: 'EodashDatePicker',
99
- props: {
100
- hintText: {
101
- type: String,
102
- default: null,
103
- },
104
- hideArrows: {
105
- type: Boolean,
106
- default: false,
107
- },
108
- hideInputField: {
109
- type: Boolean,
110
- default: false,
111
- },
112
- },
113
- setup(__props) {
114
-
115
- const currentDate = customRef((track, trigger) => ({
116
- get() {
117
- track();
118
- return new Date(datetime.value).getTime();
119
- },
120
- /** @param {number} num */
121
- set(num) {
122
- trigger();
123
- log.debug("Datepicker setting currentDate", datetime.value);
124
- datetime.value = new Date(num).toISOString();
125
- },
126
- }));
127
-
128
- const masks = ref({
129
- input: "YYYY-MM-DD",
130
- });
131
-
132
-
133
-
134
- /**
135
- * Attributes displayed on datepicker
136
- *
137
- * @type {import("vue").Reactive<
138
- * (
139
- * | Partial<import("v-calendar/dist/types/src/utils/attribute").AttributeConfig>
140
- * | undefined
141
- * )[]
142
- * >}
143
- */
144
- const attributes = reactive([]);
145
-
146
- /** @type {import("vue").Ref<HTMLDivElement|null>} */
147
- const rootRef = ref(null);
148
-
149
- const selectedStac = toRef(useSTAcStore(), "selectedStac");
150
-
151
- watch(
152
- selectedStac,
153
- async (updatedStac, previousStac) => {
154
- if (updatedStac && previousStac?.id !== updatedStac.id) {
155
- log.debug("Datepicker selected STAC change triggered");
156
- const wongPalette = [
157
- "#009E73",
158
- "#0072B2",
159
- "#E69F00",
160
- "#CC79A7",
161
- "#56B4E9",
162
- "#D55E00",
163
- ];
164
- // remove old values
165
- attributes.splice(0, attributes.length);
166
-
167
- for (let idx = 0; idx < eodashCollections.length; idx++) {
168
- log.debug("Retrieving dates", eodashCollections[idx]);
169
- await eodashCollections[idx].fetchCollection();
170
- const dates = [
171
- ...new Set(
172
- eodashCollections[idx].getItems()?.reduce((valid, it) => {
173
- const parsed = Date.parse(/** @type {string} */ (it.datetime));
174
- if (parsed) {
175
- valid.push(new Date(parsed));
176
- }
177
- return valid;
178
- }, /** @type {Date[]} */ ([])),
179
- ),
180
- ];
181
- attributes.push({
182
- key: "id-" + idx.toString() + Math.random().toString(16).slice(2),
183
- bar: {
184
- style: {
185
- backgroundColor: wongPalette[idx % wongPalette.length],
186
- },
187
- },
188
- dates,
189
- content: {
190
- style: {
191
- color: "#000000",
192
- "font-weight": "bold",
193
- },
194
- },
195
- });
196
- }
197
- }
198
- },
199
- { immediate: true },
200
- );
201
-
202
- /**
203
- * @param {boolean} reverse
204
- */
205
- function jumpDate(reverse) {
206
- if (attributes.length) {
207
- let latestDateMS = reverse ? Infinity : -Infinity;
208
- attributes.forEach((coll) => {
209
- if (coll?.dates) {
210
- coll.dates.forEach((d) => {
211
- // TODO: we need to handle time ranges and other options here
212
- if (d instanceof Date) {
213
- const mathFun = reverse ? "min" : "max";
214
- latestDateMS = Math[mathFun](latestDateMS, d.getTime());
215
- }
216
- });
217
- }
218
- });
219
- currentDate.value =
220
- latestDateMS === -Infinity
221
- ? Date.now()
222
- : latestDateMS === Infinity
223
- ? 0
224
- : latestDateMS;
225
- }
226
- }
227
-
228
- makePanelTransparent(rootRef);
229
-
230
- return (_ctx, _cache) => {
231
-
232
-
233
-
234
-
235
- return (openBlock(), createElementBlock("div", {
236
- ref_key: "rootRef",
237
- ref: rootRef,
238
- class: "datePicker"
239
- }, [
240
- createVNode(unref(DatePicker), {
241
- modelValue: currentDate.value,
242
- "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => ((currentDate).value = $event)),
243
- modelModifiers: { number: true },
244
- attributes: attributes,
245
- masks: masks.value,
246
- expanded: "",
247
- class: "bg-surface overflow-auto",
248
- style: {"background-color":"transparent","max-width":"100%"}
249
- }, {
250
- footer: withCtx(() => [
251
- createElementVNode("div", _hoisted_1, [
252
- (!__props.hideArrows)
253
- ? withDirectives((openBlock(), createBlock(VBtn, {
254
- key: 0,
255
- density: "compact",
256
- variant: "text",
257
- onClick: _cache[0] || (_cache[0] = $event => (jumpDate(true)))
258
- }, {
259
- default: withCtx(() => [
260
- createVNode(VIcon, {
261
- icon: [unref(mdiRayEndArrow)]
262
- }, null, 8 /* PROPS */, ["icon"])
263
- ]),
264
- _: 1 /* STABLE */
265
- })), [
266
- [Tooltip, 'Set date to oldest available dataset', "bottom"]
267
- ])
268
- : createCommentVNode("v-if", true),
269
- createElementVNode("div", _hoisted_2, [
270
- (!__props.hideInputField)
271
- ? (openBlock(), createElementBlock("input", {
272
- key: 0,
273
- value: new Date(currentDate.value).toLocaleDateString(),
274
- style: {"margin":"1px"},
275
- class: "flex-grow px-1 py-1 dark:bg-gray-700"
276
- }, null, 8 /* PROPS */, _hoisted_3))
277
- : createCommentVNode("v-if", true)
278
- ]),
279
- (!__props.hideArrows)
280
- ? withDirectives((openBlock(), createBlock(VBtn, {
281
- key: 1,
282
- density: "compact",
283
- variant: "text",
284
- onClick: _cache[1] || (_cache[1] = $event => (jumpDate(false)))
285
- }, {
286
- default: withCtx(() => [
287
- createVNode(VIcon, {
288
- icon: [unref(mdiRayStartArrow)]
289
- }, null, 8 /* PROPS */, ["icon"])
290
- ]),
291
- _: 1 /* STABLE */
292
- })), [
293
- [Tooltip, 'Set date to latest available dataset', "bottom"]
294
- ])
295
- : createCommentVNode("v-if", true)
296
- ])
297
- ]),
298
- _: 1 /* STABLE */
299
- }, 8 /* PROPS */, ["modelValue", "attributes", "masks"])
300
- ], 512 /* NEED_PATCH */))
301
- }
302
- }
303
-
304
- };
305
-
306
- export { _sfc_main as default };