@eodash/eodash 5.0.0-alpha.2.18 → 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.
- package/core/client/App.vue +11 -1
- package/core/client/asWebComponent.js +9 -2
- package/core/client/composables/EodashMap.js +83 -97
- package/core/client/eodash.js +25 -4
- package/core/client/store/Actions.js +6 -0
- package/core/client/utils/createLayers.js +25 -10
- package/core/client/utils/eodashSTAC.js +13 -5
- package/core/client/utils/helpers.js +3 -3
- package/core/client/views/Dashboard.vue +17 -46
- package/dist/client/DashboardLayout-CPIA_V5h.js +86 -0
- package/dist/client/DynamicWebComponent-Bm2S0izi.js +88 -0
- package/dist/client/EodashDatePicker-Tdk5Xx9F.js +393 -0
- package/dist/client/EodashItemFilter-BUyqlf5G.js +194 -0
- package/dist/client/EodashLayerControl-DRYy-Air.js +111 -0
- package/dist/client/EodashMap-B_F51bLD.js +472 -0
- package/dist/client/EodashMapBtns-COBF3RhH.js +66 -0
- package/dist/client/ExportState-DkDHsbWL.js +644 -0
- package/dist/client/Footer-D8rQVlJH.js +141 -0
- package/dist/client/Header-CasZzQOl.js +437 -0
- package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
- package/dist/client/MobileLayout-CukFMuL9.js +1210 -0
- package/dist/client/PopUp-BXrxWSQ4.js +382 -0
- package/dist/client/VImg-DB_1xaqP.js +384 -0
- package/dist/client/VMain-nLmJhfgS.js +43 -0
- package/dist/client/VOverlay-naLhQSyZ.js +1453 -0
- package/dist/client/WidgetsContainer-CQY2xBg1.js +83 -0
- package/dist/client/asWebComponent-CIm1IGNl.js +11556 -0
- package/dist/client/eo-dash.js +2 -6
- package/dist/client/forwardRefs-q4ZkKtOv.js +245 -0
- package/dist/client/index-D-kMSCQA.js +199 -0
- package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
- package/dist/client/style.css +2 -2
- package/dist/client/transition-DKGepKqs.js +37 -0
- package/dist/node/cli.js +5 -5
- package/dist/node/types.d.ts +2 -0
- package/package.json +25 -23
- package/widgets/EodashDatePicker.vue +20 -9
- package/widgets/EodashLayerControl.vue +21 -4
- package/core/client/SuspensedDashboard.ce.vue +0 -105
- package/dist/client/DashboardLayout-Dk6lzKZA.js +0 -156
- package/dist/client/DynamicWebComponent-BkMCGU7a.js +0 -57
- package/dist/client/EodashDatePicker-D27wn0jP.js +0 -276
- package/dist/client/EodashItemFilter-DS1mOc2p.js +0 -7651
- package/dist/client/EodashLayerControl-BqGA6jbV.js +0 -24534
- package/dist/client/EodashMap-BnVrfBnA.js +0 -88027
- package/dist/client/EodashMapBtns-rv-U1nI_.js +0 -50
- package/dist/client/ExportState-C3Z1ET5c.js +0 -571
- package/dist/client/Footer-BBkNiqPm.js +0 -117
- package/dist/client/Header-BQKHLO5P.js +0 -350
- package/dist/client/IframeWrapper-BX4e2uxq.js +0 -19
- package/dist/client/MobileLayout-C2aqobN5.js +0 -947
- package/dist/client/PopUp-DG3zrW12.js +0 -300
- package/dist/client/VImg-BLpHACcB.js +0 -293
- package/dist/client/VMain-DOyRcpub.js +0 -38
- package/dist/client/VOverlay-DAiInZQP.js +0 -973
- package/dist/client/WidgetsContainer-BqoX7R5Z.js +0 -129
- package/dist/client/asWebComponent-tNU8_fkz.js +0 -24518
- package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
- package/dist/client/decoder-DJlmx386-DJlmx386.js +0 -8
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
- package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
- package/dist/client/forwardRefs-BexjzXbg.js +0 -185
- package/dist/client/index-F73os72i.js +0 -153
- package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
- package/dist/client/lerc-B4lXefGh-DhdntrgS.js +0 -1027
- package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
- package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
- package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
- package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
- package/dist/client/ssrBoot-C71RpKe4.js +0 -17
- package/dist/client/transition-DNdd2Y-1.js +0 -34
- package/dist/client/webfontloader-C7dpDL7m.js +0 -435
- package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { inject, openBlock, createBlock, withCtx, createElementVNode, unref, createElementBlock, Suspense, resolveDynamicComponent, mergeProps, createCommentVNode, Fragment, renderList, Transition } from 'vue';
|
|
2
|
+
import { _ as _export_sfc, F as eodashKey, G as useDefineWidgets } from './asWebComponent-CIm1IGNl.js';
|
|
3
|
+
import '@eox/layout';
|
|
4
|
+
import { V as VMain } from './VMain-nLmJhfgS.js';
|
|
5
|
+
|
|
6
|
+
const _hoisted_1 = ["gap"];
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "bg-panel",
|
|
10
|
+
x: "0",
|
|
11
|
+
y: "0",
|
|
12
|
+
h: "12",
|
|
13
|
+
w: "12"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_3 = ["h", "w", "x", "y"];
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const _sfc_main = {
|
|
19
|
+
__name: 'DashboardLayout',
|
|
20
|
+
setup(__props) {
|
|
21
|
+
|
|
22
|
+
const eodash = /** @type {import("@/types").Eodash} */ (inject(eodashKey));
|
|
23
|
+
|
|
24
|
+
const [bgWidget] = useDefineWidgets([eodash.template?.background]);
|
|
25
|
+
|
|
26
|
+
const importedWidgets = useDefineWidgets(eodash.template?.widgets);
|
|
27
|
+
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
return (openBlock(), createBlock(VMain, null, {
|
|
32
|
+
default: withCtx(() => [
|
|
33
|
+
createElementVNode("eox-layout", {
|
|
34
|
+
gap: unref(eodash).template.gap ?? 2
|
|
35
|
+
}, [
|
|
36
|
+
(unref(bgWidget).component)
|
|
37
|
+
? (openBlock(), createElementBlock("eox-layout-item", _hoisted_2, [
|
|
38
|
+
(openBlock(), createBlock(Suspense, { suspensible: "" }, {
|
|
39
|
+
default: withCtx(() => [
|
|
40
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(bgWidget).component), mergeProps({ id: "bg-widget" }, unref(bgWidget).props), null, 16 /* FULL_PROPS */))
|
|
41
|
+
]),
|
|
42
|
+
_: 1 /* STABLE */
|
|
43
|
+
}))
|
|
44
|
+
]))
|
|
45
|
+
: createCommentVNode("v-if", true),
|
|
46
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(importedWidgets), (importedWidget, idx) => {
|
|
47
|
+
return (openBlock(), createBlock(Transition, {
|
|
48
|
+
key: idx,
|
|
49
|
+
name: "fade"
|
|
50
|
+
}, {
|
|
51
|
+
default: withCtx(() => [
|
|
52
|
+
(importedWidget.value.component)
|
|
53
|
+
? (openBlock(), createElementBlock("eox-layout-item", {
|
|
54
|
+
key: importedWidget.value.id,
|
|
55
|
+
class: "panel bg-surface",
|
|
56
|
+
h: importedWidget.value.layout.h,
|
|
57
|
+
w: importedWidget.value.layout.w,
|
|
58
|
+
x: importedWidget.value.layout.x,
|
|
59
|
+
y: importedWidget.value.layout.y
|
|
60
|
+
}, [
|
|
61
|
+
(openBlock(), createBlock(Suspense, { suspensible: "" }, {
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
(openBlock(), createBlock(resolveDynamicComponent(importedWidget.value.component), mergeProps({
|
|
64
|
+
key: importedWidget.value.id,
|
|
65
|
+
ref_for: true
|
|
66
|
+
}, importedWidget.value.props), null, 16 /* FULL_PROPS */))
|
|
67
|
+
]),
|
|
68
|
+
_: 2 /* DYNAMIC */
|
|
69
|
+
}, 1024 /* DYNAMIC_SLOTS */))
|
|
70
|
+
], 8 /* PROPS */, _hoisted_3))
|
|
71
|
+
: createCommentVNode("v-if", true)
|
|
72
|
+
]),
|
|
73
|
+
_: 2 /* DYNAMIC */
|
|
74
|
+
}, 1024 /* DYNAMIC_SLOTS */))
|
|
75
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
76
|
+
], 8 /* PROPS */, _hoisted_1)
|
|
77
|
+
]),
|
|
78
|
+
_: 1 /* STABLE */
|
|
79
|
+
}))
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
};
|
|
84
|
+
const DashboardLayout = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-a859692c"]]);
|
|
85
|
+
|
|
86
|
+
export { DashboardLayout as default };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { withAsyncContext, ref, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, resolveDynamicComponent, mergeProps } from 'vue';
|
|
2
|
+
import { $ as useSTAcStore } from './asWebComponent-CIm1IGNl.js';
|
|
3
|
+
|
|
4
|
+
const _hoisted_1 = { class: "d-flex flex-column fill-height overflow-auto" };
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const _sfc_main = {
|
|
8
|
+
__name: 'DynamicWebComponent',
|
|
9
|
+
props: {
|
|
10
|
+
link: {
|
|
11
|
+
type: [String, Function],
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
constructorProp: String,
|
|
15
|
+
tagName: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
properties: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {
|
|
22
|
+
return {};
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
onMounted: Function,
|
|
26
|
+
onUnmounted: Function,
|
|
27
|
+
},
|
|
28
|
+
async setup(__props) {
|
|
29
|
+
|
|
30
|
+
let __temp, __restore;
|
|
31
|
+
|
|
32
|
+
const props = /** @type {import("@/types").WebComponentProps} */ (
|
|
33
|
+
__props
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const getWebComponent = async () =>
|
|
37
|
+
typeof props.link === "string"
|
|
38
|
+
? await import(/* @vite-ignore */ props.link)
|
|
39
|
+
: await props.link();
|
|
40
|
+
|
|
41
|
+
const imported = !customElements.get(props.tagName)
|
|
42
|
+
? (
|
|
43
|
+
([__temp,__restore] = withAsyncContext(() => getWebComponent().catch((e) => {
|
|
44
|
+
console.error(e);
|
|
45
|
+
}))),
|
|
46
|
+
__temp = await __temp,
|
|
47
|
+
__restore(),
|
|
48
|
+
__temp
|
|
49
|
+
)
|
|
50
|
+
: null;
|
|
51
|
+
|
|
52
|
+
const defined = customElements.get(props.tagName);
|
|
53
|
+
|
|
54
|
+
// if the imported link doesn't define the custom tag provided
|
|
55
|
+
if (!defined && props.constructorProp) {
|
|
56
|
+
const Constructor = imported[props.constructorProp];
|
|
57
|
+
customElements.define(props.tagName, Constructor);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const store = useSTAcStore();
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {HTMLElement & Record<string | number | symbol, unknown>} CustomElement
|
|
64
|
+
* @type {import("vue").Ref<CustomElement | null>}
|
|
65
|
+
*/
|
|
66
|
+
const elementRef = ref(null);
|
|
67
|
+
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
props.onMounted?.(elementRef.value, store);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
onUnmounted(() => {
|
|
73
|
+
props.onUnmounted?.(elementRef.value, store);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return (_ctx, _cache) => {
|
|
77
|
+
return (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
78
|
+
(openBlock(), createBlock(resolveDynamicComponent(__props.tagName), mergeProps(__props.properties, {
|
|
79
|
+
ref_key: "elementRef",
|
|
80
|
+
ref: elementRef
|
|
81
|
+
}), null, 16 /* FULL_PROPS */))
|
|
82
|
+
]))
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { _sfc_main as default };
|
|
@@ -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 };
|