eco-vue-js 0.10.77 → 0.10.79
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/dist/components/Chart/WChartLine.vue.d.ts +38 -0
- package/dist/components/Chart/WChartLine.vue.d.ts.map +1 -0
- package/dist/components/Chart/WChartLine.vue.js +296 -0
- package/dist/components/Chart/WChartLine.vue2.js +5 -0
- package/dist/components/Chart/WChartLinear.vue.d.ts +49 -0
- package/dist/components/Chart/WChartLinear.vue.d.ts.map +1 -0
- package/dist/components/Chart/WChartLinear.vue.js +126 -0
- package/dist/components/Chart/WChartLinear.vue2.js +5 -0
- package/dist/components/Chart/components/ChartAxis.vue.d.ts +10 -0
- package/dist/components/Chart/components/ChartAxis.vue.d.ts.map +1 -0
- package/dist/components/Chart/components/ChartAxis.vue.js +40 -0
- package/dist/components/Chart/components/ChartAxis.vue2.js +5 -0
- package/dist/components/Chart/types.d.ts +16 -0
- package/dist/components/Chart/types.d.ts.map +1 -0
- package/dist/components/DragContainer/use/useDragContainer.js +1 -0
- package/dist/components/InfiniteList/components/InfiniteListScroll.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/components/InfiniteListScroll.vue.js +8 -11
- package/dist/components/Input/WInputAsync.vue.js +1 -1
- package/dist/components/Nav/WNavItemExpand.vue.d.ts +1 -1
- package/dist/components/Nav/WNavItemExpand.vue.d.ts.map +1 -1
- package/dist/components/Nav/WNavItemExpand.vue.js +5 -5
- package/dist/components/Select/WSelectSingle.vue.js +1 -1
- package/dist/components/Tooltip/WTooltip.vue.d.ts +6 -1
- package/dist/components/Tooltip/WTooltip.vue.d.ts.map +1 -1
- package/dist/components/Tooltip/WTooltip.vue.js +16 -11
- package/dist/components/Tooltip/WTooltipContainer.vue.d.ts +69 -1
- package/dist/components/Tooltip/WTooltipContainer.vue.d.ts.map +1 -1
- package/dist/components/Tooltip/WTooltipContainer.vue.js +22 -47
- package/dist/components/Tooltip/components/TooltipContainer.vue.d.ts +1 -1
- package/dist/components/Tooltip/components/TooltipContainer.vue.d.ts.map +1 -1
- package/dist/components/Tooltip/models/tooltipMeta.d.ts +32 -0
- package/dist/components/Tooltip/models/tooltipMeta.d.ts.map +1 -0
- package/dist/components/Tooltip/models/tooltipMeta.js +40 -0
- package/dist/imports/componentsPlugin.d.ts +3 -1
- package/dist/imports/componentsPlugin.d.ts.map +1 -1
- package/dist/main.js +3 -1
- package/dist/utils/ApiClient.d.ts +1 -0
- package/dist/utils/ApiClient.d.ts.map +1 -1
- package/dist/utils/ApiClient.js +3 -0
- package/dist/utils/dateTime.d.ts +1 -0
- package/dist/utils/dateTime.d.ts.map +1 -1
- package/dist/utils/dateTime.js +4 -1
- package/package.json +10 -4
- package/dist/components/Tooltip/models/utils.js +0 -6
- package/dist/utils/Tooltip.d.ts +0 -17
- package/dist/utils/Tooltip.d.ts.map +0 -1
- package/dist/utils/Tooltip.js +0 -14
@@ -0,0 +1,38 @@
|
|
1
|
+
import { ChartContext } from './types';
|
2
|
+
declare const _default: <Data extends Record<string, number>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & ({
|
4
|
+
data: Data[];
|
5
|
+
xKey: keyof Data;
|
6
|
+
yKey: keyof Data;
|
7
|
+
strokeStyle?: "solid" | "dashed" | "dotted";
|
8
|
+
strokeWidth?: number;
|
9
|
+
hasArea?: boolean;
|
10
|
+
showPoints?: boolean;
|
11
|
+
pointRadius?: number;
|
12
|
+
disableMessage?: string;
|
13
|
+
} & ChartContext) & Partial<{}>> & import('vue').PublicProps;
|
14
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
15
|
+
attrs: any;
|
16
|
+
slots: {
|
17
|
+
gradient?(_: {
|
18
|
+
scaleY: (value: number) => number;
|
19
|
+
scaleYPercent: (value: number) => number;
|
20
|
+
topPercent: number;
|
21
|
+
bottomPercent: number;
|
22
|
+
}): any;
|
23
|
+
tooltip?(_: {
|
24
|
+
d: Data;
|
25
|
+
x: number;
|
26
|
+
y: number;
|
27
|
+
index: number | null;
|
28
|
+
}): any;
|
29
|
+
};
|
30
|
+
emit: {};
|
31
|
+
}>) => import('vue').VNode & {
|
32
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
33
|
+
};
|
34
|
+
export default _default;
|
35
|
+
type __VLS_PrettifyLocal<T> = {
|
36
|
+
[K in keyof T]: T[K];
|
37
|
+
} & {};
|
38
|
+
//# sourceMappingURL=WChartLine.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WChartLine.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/WChartLine.vue"],"names":[],"mappings":"AAsIA;AA8UA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;yBAMxB,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnD,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WA6YO,mBAAmB,CAAC;cAzYpB,IAAI,EAAE;cACN,MAAM,IAAI;cACV,MAAM,IAAI;sBACF,OAAO,GAAG,QAAQ,GAAG,QAAQ;sBAC7B,MAAM;kBACV,OAAO;qBACJ,OAAO;sBACN,MAAM;yBACH,MAAM;mCAiYqE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;mCAjOmB,MAAM,KAAG,MAAM;;;YAqLf,GAAG;;;;;;YACJ,GAAG;;UA6CzB,EAAE;EAEL,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAxZzE,wBAwZ4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,296 @@
|
|
1
|
+
import { defineComponent, useId, useTemplateRef, ref, computed, watch, nextTick, onUnmounted, createElementBlock, openBlock, createElementVNode, createCommentVNode, unref, renderSlot, normalizeProps, guardReactiveProps, createVNode, withCtx, toDisplayString } from 'vue';
|
2
|
+
import _sfc_main$1 from '../Tooltip/WTooltip.vue.js';
|
3
|
+
|
4
|
+
const _hoisted_1 = { key: 0 };
|
5
|
+
const _hoisted_2 = ["id"];
|
6
|
+
const _hoisted_3 = ["id"];
|
7
|
+
const _hoisted_4 = ["id"];
|
8
|
+
const _hoisted_5 = ["d", "fill"];
|
9
|
+
const _hoisted_6 = ["d", "stroke-width", "stroke-dasharray"];
|
10
|
+
const _hoisted_7 = { key: 2 };
|
11
|
+
const _hoisted_8 = ["cx", "cy", "r"];
|
12
|
+
const _hoisted_9 = { key: 0 };
|
13
|
+
const _hoisted_10 = ["transform"];
|
14
|
+
const _hoisted_11 = ["x", "y1", "y2"];
|
15
|
+
const _hoisted_12 = ["y"];
|
16
|
+
const _hoisted_13 = ["fill", "mask"];
|
17
|
+
const _hoisted_14 = {
|
18
|
+
key: 1,
|
19
|
+
y: "0",
|
20
|
+
x: "0",
|
21
|
+
width: "100%",
|
22
|
+
height: "100%"
|
23
|
+
};
|
24
|
+
const _hoisted_15 = { class: "text-description text-2xs flex size-full cursor-not-allowed items-center opacity-40" };
|
25
|
+
const _hoisted_16 = { class: "pl-36" };
|
26
|
+
const ROUND_FACTOR = 100;
|
27
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
28
|
+
__name: "WChartLine",
|
29
|
+
props: {
|
30
|
+
data: {},
|
31
|
+
xKey: {},
|
32
|
+
yKey: {},
|
33
|
+
strokeStyle: {},
|
34
|
+
strokeWidth: {},
|
35
|
+
hasArea: { type: Boolean },
|
36
|
+
showPoints: { type: Boolean },
|
37
|
+
pointRadius: {},
|
38
|
+
disableMessage: {},
|
39
|
+
scaleX: { type: Function },
|
40
|
+
scaleY: { type: Function },
|
41
|
+
svgWidth: {},
|
42
|
+
svgHeight: {},
|
43
|
+
top: {},
|
44
|
+
bottom: {},
|
45
|
+
left: {},
|
46
|
+
right: {},
|
47
|
+
xExtent: {},
|
48
|
+
onUpdateDomain: { type: Function }
|
49
|
+
},
|
50
|
+
setup(__props) {
|
51
|
+
const props = __props;
|
52
|
+
const gradientId = useId();
|
53
|
+
const gradientAreaId = useId();
|
54
|
+
const maskId = useId();
|
55
|
+
const lineId = useId();
|
56
|
+
const overlayRef = useTemplateRef("overlay");
|
57
|
+
const tooltipRef = useTemplateRef("tooltip");
|
58
|
+
const hoveredIndex = ref(null);
|
59
|
+
const strokeDashArray = computed(() => {
|
60
|
+
const width = props.svgWidth - props.left - props.right;
|
61
|
+
switch (props.strokeStyle) {
|
62
|
+
case "dashed":
|
63
|
+
return width / (width > 500 ? 33 : 13);
|
64
|
+
case "dotted":
|
65
|
+
return "2,2";
|
66
|
+
default:
|
67
|
+
return void 0;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
const dataFiltered = computed(
|
71
|
+
() => props.data.filter(
|
72
|
+
(data) => typeof data[props.yKey] === "number" && typeof data[props.xKey] === "number" && data[props.xKey] >= props.xExtent[0] && data[props.xKey] <= props.xExtent[1]
|
73
|
+
)
|
74
|
+
);
|
75
|
+
const round = (value) => Math.round(value * ROUND_FACTOR) / ROUND_FACTOR;
|
76
|
+
const preparedData = computed(() => {
|
77
|
+
const result = dataFiltered.value.map((d) => ({
|
78
|
+
x: round(Math.min(Math.max(props.scaleX(d[props.xKey]), props.left), props.svgWidth - props.right)),
|
79
|
+
y: round(props.scaleY(d[props.yKey])),
|
80
|
+
d
|
81
|
+
}));
|
82
|
+
const lastIndex = result.length - 1;
|
83
|
+
if (result[lastIndex] && result[lastIndex].x !== props.left) result.push({ ...result[lastIndex], x: props.left });
|
84
|
+
if (result[0] && result[0].x !== props.right) result.unshift({ ...result[0], x: props.svgWidth - props.right });
|
85
|
+
return result;
|
86
|
+
});
|
87
|
+
const tooltipData = computed(() => {
|
88
|
+
return preparedData.value.slice(
|
89
|
+
preparedData.value[0]?.d === preparedData.value[1]?.d ? 1 : 0,
|
90
|
+
preparedData.value[preparedData.value.length - 1]?.d === preparedData.value[preparedData.value.length - 2]?.d ? -1 : void 0
|
91
|
+
).reverse();
|
92
|
+
});
|
93
|
+
const hoveredData = computed(() => {
|
94
|
+
if (hoveredIndex.value === null || !tooltipData.value[hoveredIndex.value]) return null;
|
95
|
+
return tooltipData.value[hoveredIndex.value];
|
96
|
+
});
|
97
|
+
const findNearestDataPoint = (mouseX) => {
|
98
|
+
const data = tooltipData.value;
|
99
|
+
if (data.length === 0) return null;
|
100
|
+
if (data.length === 1) return 0;
|
101
|
+
let left = 0;
|
102
|
+
let right = data.length - 1;
|
103
|
+
let closest = 0;
|
104
|
+
let minDistance = Math.abs(data[0].x - mouseX);
|
105
|
+
while (left <= right) {
|
106
|
+
const mid = Math.floor((left + right) / 2);
|
107
|
+
const distance = Math.abs(data[mid].x - mouseX);
|
108
|
+
if (distance < minDistance) {
|
109
|
+
minDistance = distance;
|
110
|
+
closest = mid;
|
111
|
+
}
|
112
|
+
if (data[mid].x < mouseX) {
|
113
|
+
left = mid + 1;
|
114
|
+
} else {
|
115
|
+
right = mid - 1;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
return closest;
|
119
|
+
};
|
120
|
+
const handleMouseMove = (event) => {
|
121
|
+
if (!overlayRef.value) return;
|
122
|
+
const rect = overlayRef.value.getBoundingClientRect();
|
123
|
+
const mouseX = event.clientX - rect.left;
|
124
|
+
const nearestIndex = findNearestDataPoint(mouseX);
|
125
|
+
if (nearestIndex !== null) {
|
126
|
+
hoveredIndex.value = nearestIndex;
|
127
|
+
} else {
|
128
|
+
hoveredIndex.value = null;
|
129
|
+
}
|
130
|
+
};
|
131
|
+
const closeTooltip = () => {
|
132
|
+
if (tooltipRef.value) tooltipRef.value?.close();
|
133
|
+
else hoveredIndex.value = null;
|
134
|
+
};
|
135
|
+
const linePath = computed(() => {
|
136
|
+
if (preparedData.value.length === 0) return "";
|
137
|
+
const commands = preparedData.value.map((d, i) => {
|
138
|
+
const command = i === 0 ? "M" : "L";
|
139
|
+
return `${command} ${d.x} ${d.y}`;
|
140
|
+
});
|
141
|
+
return commands.join(" ");
|
142
|
+
});
|
143
|
+
const areaPath = computed(() => {
|
144
|
+
if (!props.hasArea || preparedData.value.length === 0) return "";
|
145
|
+
const y0 = props.svgHeight - props.bottom;
|
146
|
+
let path = `M ${preparedData.value[0].x} ${y0}`;
|
147
|
+
path += ` L ${preparedData.value[0].x} ${preparedData.value[0].y}`;
|
148
|
+
for (let i = 1; i < preparedData.value.length; i++) {
|
149
|
+
path += ` L ${preparedData.value[i].x} ${preparedData.value[i].y}`;
|
150
|
+
}
|
151
|
+
path += ` L ${preparedData.value[preparedData.value.length - 1].x} ${y0}`;
|
152
|
+
path += " Z";
|
153
|
+
return path;
|
154
|
+
});
|
155
|
+
const yExtent = computed(() => {
|
156
|
+
if (props.data.length === 0) return [0, 100];
|
157
|
+
const yValues = dataFiltered.value.map((d) => d[props.yKey]);
|
158
|
+
return yValues.length > 0 ? [0, Math.max(...yValues)] : [0, 100];
|
159
|
+
});
|
160
|
+
const emitDomainUpdate = () => {
|
161
|
+
props.onUpdateDomain?.(lineId, yExtent.value);
|
162
|
+
};
|
163
|
+
const scaleYPercent = (value) => props.scaleY(value) / props.svgHeight;
|
164
|
+
watch(() => yExtent.value[0], emitDomainUpdate, { immediate: true });
|
165
|
+
watch(() => yExtent.value[1], emitDomainUpdate, { immediate: true });
|
166
|
+
watch(hoveredIndex, (value) => {
|
167
|
+
if (value !== null) nextTick(() => tooltipRef.value?.open());
|
168
|
+
});
|
169
|
+
watch(() => tooltipRef.value?.isOpen ?? false, (value) => {
|
170
|
+
if (value) return;
|
171
|
+
hoveredIndex.value = null;
|
172
|
+
});
|
173
|
+
onUnmounted(() => {
|
174
|
+
props.onUpdateDomain?.(lineId, [0, 0]);
|
175
|
+
});
|
176
|
+
return (_ctx, _cache) => {
|
177
|
+
return dataFiltered.value.length ? (openBlock(), createElementBlock("g", _hoisted_1, [
|
178
|
+
createElementVNode("defs", null, [
|
179
|
+
_ctx.$slots.gradient ? (openBlock(), createElementBlock("linearGradient", {
|
180
|
+
key: 0,
|
181
|
+
id: unref(gradientId),
|
182
|
+
gradientTransform: "rotate(90)"
|
183
|
+
}, [
|
184
|
+
renderSlot(_ctx.$slots, "gradient", normalizeProps(guardReactiveProps({
|
185
|
+
scaleY: _ctx.scaleY,
|
186
|
+
scaleYPercent,
|
187
|
+
topPercent: _ctx.top / _ctx.svgHeight,
|
188
|
+
bottomPercent: 1 - _ctx.bottom / _ctx.svgHeight
|
189
|
+
})))
|
190
|
+
], 8, _hoisted_2)) : createCommentVNode("", true),
|
191
|
+
_ctx.hasArea ? (openBlock(), createElementBlock("linearGradient", {
|
192
|
+
key: 1,
|
193
|
+
id: unref(gradientAreaId),
|
194
|
+
gradientTransform: "rotate(90)"
|
195
|
+
}, _cache[0] || (_cache[0] = [
|
196
|
+
createElementVNode("stop", {
|
197
|
+
offset: "0%",
|
198
|
+
"stop-color": "#222222"
|
199
|
+
}, null, -1),
|
200
|
+
createElementVNode("stop", {
|
201
|
+
offset: "70%",
|
202
|
+
"stop-color": "#111111"
|
203
|
+
}, null, -1),
|
204
|
+
createElementVNode("stop", {
|
205
|
+
offset: "100%",
|
206
|
+
"stop-color": "#000000"
|
207
|
+
}, null, -1)
|
208
|
+
]), 8, _hoisted_3)) : createCommentVNode("", true),
|
209
|
+
createElementVNode("mask", { id: unref(maskId) }, [
|
210
|
+
_ctx.hasArea && areaPath.value ? (openBlock(), createElementBlock("path", {
|
211
|
+
key: 0,
|
212
|
+
d: areaPath.value,
|
213
|
+
fill: `url(#${unref(gradientAreaId)})`,
|
214
|
+
class: "transition-[d]"
|
215
|
+
}, null, 8, _hoisted_5)) : createCommentVNode("", true),
|
216
|
+
linePath.value ? (openBlock(), createElementBlock("path", {
|
217
|
+
key: 1,
|
218
|
+
d: linePath.value,
|
219
|
+
fill: "none",
|
220
|
+
"stroke-width": _ctx.strokeWidth ?? 2,
|
221
|
+
"stroke-dasharray": strokeDashArray.value,
|
222
|
+
stroke: "white",
|
223
|
+
"stroke-linejoin": "round",
|
224
|
+
"stroke-linecap": "round",
|
225
|
+
class: "transition-[d]"
|
226
|
+
}, null, 8, _hoisted_6)) : createCommentVNode("", true),
|
227
|
+
_ctx.$slots.tooltip && hoveredData.value && unref(tooltipRef)?.isOpen ? (openBlock(), createElementBlock("g", _hoisted_7, [
|
228
|
+
createElementVNode("circle", {
|
229
|
+
cx: hoveredData.value.x,
|
230
|
+
cy: hoveredData.value.y,
|
231
|
+
r: _ctx.pointRadius ?? 3,
|
232
|
+
fill: "white"
|
233
|
+
}, null, 8, _hoisted_8)
|
234
|
+
])) : createCommentVNode("", true)
|
235
|
+
], 8, _hoisted_4)
|
236
|
+
]),
|
237
|
+
_ctx.$slots.tooltip && tooltipData.value.length !== 0 ? (openBlock(), createElementBlock("g", _hoisted_9, [
|
238
|
+
createElementVNode("rect", {
|
239
|
+
ref: "overlay",
|
240
|
+
width: "100%",
|
241
|
+
height: "100%",
|
242
|
+
fill: "transparent",
|
243
|
+
class: "cursor-crosshair",
|
244
|
+
onMousemove: handleMouseMove,
|
245
|
+
onMouseleave: closeTooltip
|
246
|
+
}, null, 544),
|
247
|
+
createElementVNode("g", {
|
248
|
+
transform: `translate(${hoveredData.value?.x ?? 0} 0)`
|
249
|
+
}, [
|
250
|
+
hoveredData.value && unref(tooltipRef)?.isOpen ? (openBlock(), createElementBlock("line", {
|
251
|
+
key: 0,
|
252
|
+
x: hoveredData.value.x,
|
253
|
+
y1: _ctx.top,
|
254
|
+
y2: _ctx.svgHeight - _ctx.bottom,
|
255
|
+
stroke: "currentColor",
|
256
|
+
"stroke-width": "1",
|
257
|
+
class: "text-description pointer-events-none"
|
258
|
+
}, null, 8, _hoisted_11)) : createCommentVNode("", true),
|
259
|
+
(openBlock(), createElementBlock("foreignObject", {
|
260
|
+
y: _ctx.svgHeight - _ctx.bottom
|
261
|
+
}, [
|
262
|
+
createVNode(_sfc_main$1, {
|
263
|
+
ref: "tooltip",
|
264
|
+
"no-trigger": ""
|
265
|
+
}, {
|
266
|
+
default: withCtx(() => [
|
267
|
+
hoveredData.value ? renderSlot(_ctx.$slots, "tooltip", {
|
268
|
+
key: 0,
|
269
|
+
d: hoveredData.value.d,
|
270
|
+
x: hoveredData.value.x,
|
271
|
+
y: hoveredData.value.y,
|
272
|
+
index: hoveredIndex.value
|
273
|
+
}) : createCommentVNode("", true)
|
274
|
+
]),
|
275
|
+
_: 3
|
276
|
+
}, 512)
|
277
|
+
], 8, _hoisted_12))
|
278
|
+
], 8, _hoisted_10)
|
279
|
+
])) : createCommentVNode("", true),
|
280
|
+
createElementVNode("rect", {
|
281
|
+
width: "100%",
|
282
|
+
height: "100%",
|
283
|
+
fill: _ctx.$slots.gradient ? `url(#${unref(gradientId)})` : "currentColor",
|
284
|
+
mask: `url(#${unref(maskId)})`,
|
285
|
+
class: "pointer-events-none transition-[color]"
|
286
|
+
}, null, 8, _hoisted_13)
|
287
|
+
])) : (openBlock(), createElementBlock("foreignObject", _hoisted_14, [
|
288
|
+
createElementVNode("div", _hoisted_15, [
|
289
|
+
createElementVNode("div", _hoisted_16, toDisplayString(_ctx.disableMessage ?? "No data is currently available"), 1)
|
290
|
+
])
|
291
|
+
]));
|
292
|
+
};
|
293
|
+
}
|
294
|
+
});
|
295
|
+
|
296
|
+
export { _sfc_main as default };
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ChartContext } from './types';
|
2
|
+
import { VNode } from 'vue';
|
3
|
+
type __VLS_Props = {
|
4
|
+
xDomain: [number, number];
|
5
|
+
yDomainGetter?: (extent: [number, number]) => [number, number];
|
6
|
+
height?: number;
|
7
|
+
xHidden?: boolean;
|
8
|
+
yHidden?: boolean;
|
9
|
+
yFormat?: (value: number) => string;
|
10
|
+
top?: number;
|
11
|
+
bottom?: number;
|
12
|
+
left?: number;
|
13
|
+
right?: number;
|
14
|
+
skeleton?: boolean;
|
15
|
+
};
|
16
|
+
declare function __VLS_template(): {
|
17
|
+
attrs: Partial<{}>;
|
18
|
+
slots: Readonly<{
|
19
|
+
default: (props: ChartContext) => VNode[];
|
20
|
+
}> & {
|
21
|
+
default: (props: ChartContext) => VNode[];
|
22
|
+
};
|
23
|
+
refs: {
|
24
|
+
container: HTMLDivElement;
|
25
|
+
};
|
26
|
+
rootEl: HTMLDivElement;
|
27
|
+
};
|
28
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
29
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
30
|
+
updateSize: () => void;
|
31
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
32
|
+
bottom: number;
|
33
|
+
left: number;
|
34
|
+
right: number;
|
35
|
+
top: number;
|
36
|
+
height: number;
|
37
|
+
yDomainGetter: (extent: [number, number]) => [number, number];
|
38
|
+
yFormat: (value: number) => string;
|
39
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
40
|
+
container: HTMLDivElement;
|
41
|
+
}, HTMLDivElement>;
|
42
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
43
|
+
export default _default;
|
44
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
45
|
+
new (): {
|
46
|
+
$slots: S;
|
47
|
+
};
|
48
|
+
};
|
49
|
+
//# sourceMappingURL=WChartLinear.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WChartLinear.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/WChartLinear.vue"],"names":[],"mappings":"AAoDA;AAqKA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AAEzC,OAAO,EAAC,KAAK,KAAK,EAAmE,MAAM,KAAK,CAAA;AAShG,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACnC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;AAsGJ,iBAAS,cAAc;WA+FT,OAAO,IAA6B;;iBA7GvC,CAAC,KAAK,EAAE,YAAY,KAAK,KAAK,EAAE;;iBAAhC,CAAC,KAAK,EAAE,YAAY,KAAK,KAAK,EAAE;;;;;;EAkH1C;AAmBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;YAlOR,MAAM;UACR,MAAM;WACL,MAAM;SAHR,MAAM;YAJH,MAAM;mBADC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC;aAIpD,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;;;kBA8OrC,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
import { defineComponent, ref, useTemplateRef, computed, watch, onMounted, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createBlock, createCommentVNode, renderSlot, unref } from 'vue';
|
2
|
+
import WSkeleton from '../Skeleton/WSkeleton.vue.js';
|
3
|
+
import DOMListenerContainer from '../../utils/DOMListenerContainer.js';
|
4
|
+
import { dateFormat } from '../../utils/dateTime.js';
|
5
|
+
import _sfc_main$1 from './components/ChartAxis.vue.js';
|
6
|
+
|
7
|
+
const _hoisted_1 = ["height", "width"];
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
|
+
__name: "WChartLinear",
|
10
|
+
props: {
|
11
|
+
xDomain: {},
|
12
|
+
yDomainGetter: { type: Function, default: void 0 },
|
13
|
+
height: { default: 0 },
|
14
|
+
xHidden: { type: Boolean },
|
15
|
+
yHidden: { type: Boolean },
|
16
|
+
yFormat: { type: Function, default: void 0 },
|
17
|
+
top: { default: 10 },
|
18
|
+
bottom: { default: 20 },
|
19
|
+
left: { default: 40 },
|
20
|
+
right: { default: 32 },
|
21
|
+
skeleton: { type: Boolean }
|
22
|
+
},
|
23
|
+
setup(__props, { expose: __expose }) {
|
24
|
+
const props = __props;
|
25
|
+
const svgWidth = ref(0);
|
26
|
+
const svgHeight = ref(props.height);
|
27
|
+
const containerRef = useTemplateRef("container");
|
28
|
+
const xExtent = computed(() => props.xDomain);
|
29
|
+
const lineDomains = ref(/* @__PURE__ */ new Map());
|
30
|
+
const yExtent = computed(() => {
|
31
|
+
if (lineDomains.value.size === 0) return [0, 100];
|
32
|
+
const allYValues = [];
|
33
|
+
lineDomains.value.forEach((domain) => {
|
34
|
+
allYValues.push(...domain);
|
35
|
+
});
|
36
|
+
return allYValues.length > 0 ? [Math.min(...allYValues), Math.max(...allYValues)] : [0, 100];
|
37
|
+
});
|
38
|
+
const yDomainComputed = computed(() => {
|
39
|
+
if (props.yDomainGetter) return props.yDomainGetter(yExtent.value);
|
40
|
+
const [min, max] = yExtent.value;
|
41
|
+
const yRoundFactor = min > -100 && min < 100 && max < 100 ? 10 : 100;
|
42
|
+
return [
|
43
|
+
Math.floor((min > 0 ? 0 : min) / yRoundFactor) * yRoundFactor,
|
44
|
+
Math.max(Math.ceil(max / yRoundFactor) * yRoundFactor, yRoundFactor)
|
45
|
+
];
|
46
|
+
});
|
47
|
+
const handleDomainUpdate = (lineId, yExtent2) => {
|
48
|
+
lineDomains.value.set(lineId, yExtent2);
|
49
|
+
};
|
50
|
+
const scaleX = (value) => props.left + (value - xExtent.value[0]) / (xExtent.value[1] - xExtent.value[0]) * (svgWidth.value - props.right - props.left);
|
51
|
+
const scaleY = (value) => svgHeight.value - props.bottom - (value - yDomainComputed.value[0]) / (yDomainComputed.value[1] - yDomainComputed.value[0]) * (svgHeight.value - props.bottom - props.top);
|
52
|
+
const updateSize = () => {
|
53
|
+
if (!containerRef.value) return;
|
54
|
+
svgWidth.value = Math.floor(containerRef.value.offsetWidth);
|
55
|
+
svgHeight.value = props.height || Math.floor(containerRef.value.parentElement?.offsetHeight ?? containerRef.value.offsetHeight);
|
56
|
+
};
|
57
|
+
const animationFrameId = ref();
|
58
|
+
const requestUpdateWidth = () => {
|
59
|
+
if (animationFrameId.value) cancelAnimationFrame(animationFrameId.value);
|
60
|
+
animationFrameId.value = requestAnimationFrame(updateSize);
|
61
|
+
};
|
62
|
+
watch(() => props.height, (newHeight) => {
|
63
|
+
if (newHeight) svgHeight.value = newHeight;
|
64
|
+
});
|
65
|
+
const listenerContainer = new DOMListenerContainer([window], ["resize"], requestUpdateWidth);
|
66
|
+
onMounted(() => {
|
67
|
+
updateSize();
|
68
|
+
});
|
69
|
+
onBeforeUnmount(() => {
|
70
|
+
listenerContainer.destroy();
|
71
|
+
});
|
72
|
+
__expose({
|
73
|
+
updateSize
|
74
|
+
});
|
75
|
+
return (_ctx, _cache) => {
|
76
|
+
return openBlock(), createElementBlock("div", {
|
77
|
+
ref: "container",
|
78
|
+
class: normalizeClass({
|
79
|
+
"size-full cursor-progress": _ctx.skeleton
|
80
|
+
})
|
81
|
+
}, [
|
82
|
+
_ctx.skeleton ? (openBlock(), createBlock(WSkeleton, {
|
83
|
+
key: 0,
|
84
|
+
class: "w-skeleton-w-full w-skeleton-h-full w-skeleton-rounded-3xl"
|
85
|
+
})) : svgWidth.value !== 0 && svgHeight.value !== 0 ? (openBlock(), createElementBlock("svg", {
|
86
|
+
key: 1,
|
87
|
+
height: svgHeight.value,
|
88
|
+
width: svgWidth.value,
|
89
|
+
class: "min-w-0"
|
90
|
+
}, [
|
91
|
+
!_ctx.xHidden ? (openBlock(), createBlock(_sfc_main$1, {
|
92
|
+
key: 0,
|
93
|
+
orientation: "x",
|
94
|
+
scale: scaleX,
|
95
|
+
format: (value) => unref(dateFormat)(new Date(value)),
|
96
|
+
domain: xExtent.value,
|
97
|
+
transform: `translate(0, ${svgHeight.value - _ctx.bottom})`
|
98
|
+
}, null, 8, ["format", "domain", "transform"])) : createCommentVNode("", true),
|
99
|
+
!_ctx.yHidden ? (openBlock(), createBlock(_sfc_main$1, {
|
100
|
+
key: 1,
|
101
|
+
orientation: "y",
|
102
|
+
scale: scaleY,
|
103
|
+
domain: yDomainComputed.value,
|
104
|
+
format: _ctx.yFormat,
|
105
|
+
transform: `translate(${_ctx.left}, 0)`
|
106
|
+
}, null, 8, ["domain", "format", "transform"])) : createCommentVNode("", true),
|
107
|
+
!_ctx.skeleton ? renderSlot(_ctx.$slots, "default", {
|
108
|
+
key: 2,
|
109
|
+
scaleX,
|
110
|
+
scaleY,
|
111
|
+
svgWidth: svgWidth.value,
|
112
|
+
svgHeight: svgHeight.value,
|
113
|
+
top: _ctx.top,
|
114
|
+
bottom: _ctx.bottom,
|
115
|
+
left: _ctx.left,
|
116
|
+
right: _ctx.right,
|
117
|
+
xExtent: xExtent.value,
|
118
|
+
onUpdateDomain: handleDomainUpdate
|
119
|
+
}) : createCommentVNode("", true)
|
120
|
+
], 8, _hoisted_1)) : createCommentVNode("", true)
|
121
|
+
], 2);
|
122
|
+
};
|
123
|
+
}
|
124
|
+
});
|
125
|
+
|
126
|
+
export { _sfc_main as default };
|
@@ -0,0 +1,10 @@
|
|
1
|
+
type __VLS_Props = {
|
2
|
+
orientation: 'x' | 'y';
|
3
|
+
scale: (value: number) => number;
|
4
|
+
domain: [number, number];
|
5
|
+
format: (value: number) => string;
|
6
|
+
transform: string;
|
7
|
+
};
|
8
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGGElement>;
|
9
|
+
export default _default;
|
10
|
+
//# sourceMappingURL=ChartAxis.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ChartAxis.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chart/components/ChartAxis.vue"],"names":[],"mappings":"AA6BA;AA4CA,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,GAAG,GAAG,GAAG,CAAA;IACtB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAC;;AA8DF,wBAOG"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createElementVNode, mergeProps, toDisplayString, unref } from 'vue';
|
2
|
+
import { numberCompactFormatter } from '../../../utils/utils.js';
|
3
|
+
|
4
|
+
const _hoisted_1 = ["transform"];
|
5
|
+
const _hoisted_2 = ["transform"];
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
7
|
+
__name: "ChartAxis",
|
8
|
+
props: {
|
9
|
+
orientation: {},
|
10
|
+
scale: { type: Function },
|
11
|
+
domain: {},
|
12
|
+
format: { type: Function },
|
13
|
+
transform: {}
|
14
|
+
},
|
15
|
+
setup(__props) {
|
16
|
+
return (_ctx, _cache) => {
|
17
|
+
return openBlock(), createElementBlock("g", {
|
18
|
+
class: "text-description font-medium",
|
19
|
+
"font-size": "8",
|
20
|
+
transform: _ctx.transform
|
21
|
+
}, [
|
22
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.domain, (item) => {
|
23
|
+
return openBlock(), createElementBlock("g", {
|
24
|
+
key: item,
|
25
|
+
transform: `translate(${_ctx.orientation === "x" ? `${_ctx.scale(item)}, 0` : `0, ${_ctx.scale(item)}`})`
|
26
|
+
}, [
|
27
|
+
createElementVNode("line", mergeProps({ ref_for: true }, _ctx.orientation === "x" ? { y2: 6 } : { x2: -6 }, { stroke: "currentcolor" }), null, 16),
|
28
|
+
createElementVNode("text", mergeProps(
|
29
|
+
{ ref_for: true },
|
30
|
+
_ctx.orientation === "x" ? { y: 8, dy: "0.72em", "text-anchor": "middle" } : { x: -9, dy: "0.32em", "text-anchor": "end" },
|
31
|
+
{ fill: "currentcolor" }
|
32
|
+
), toDisplayString(_ctx.format?.(item) ?? unref(numberCompactFormatter).format(item)), 17)
|
33
|
+
], 8, _hoisted_2);
|
34
|
+
}), 128))
|
35
|
+
], 8, _hoisted_1);
|
36
|
+
};
|
37
|
+
}
|
38
|
+
});
|
39
|
+
|
40
|
+
export { _sfc_main as default };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export interface ChartContext {
|
2
|
+
/** Scaling functions */
|
3
|
+
scaleX: (value: number) => number;
|
4
|
+
scaleY: (value: number) => number;
|
5
|
+
/** Chart dimensions */
|
6
|
+
svgWidth: number;
|
7
|
+
svgHeight: number;
|
8
|
+
top: number;
|
9
|
+
bottom: number;
|
10
|
+
left: number;
|
11
|
+
right: number;
|
12
|
+
xExtent: [number, number];
|
13
|
+
/** Domain update handler */
|
14
|
+
onUpdateDomain: (lineId: string, yExtent: [number, number]) => void;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzB,4BAA4B;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CACpE"}
|
@@ -7,6 +7,7 @@ import 'vue-router';
|
|
7
7
|
import '@tanstack/vue-query';
|
8
8
|
import '../../Button/WButton.vue.js';
|
9
9
|
import '../../../utils/mobile.js';
|
10
|
+
import '../../Tooltip/models/tooltipMeta.js';
|
10
11
|
import '../../Button/WButtonDropdown.vue.js';
|
11
12
|
import '../../../utils/supportsPassive.js';
|
12
13
|
import '../../Dropdown/utils/DropdownStyle.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"InfiniteListScroll.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/InfiniteList/components/InfiniteListScroll.vue"],"names":[],"mappings":"AAKA;
|
1
|
+
{"version":3,"file":"InfiniteListScroll.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/InfiniteList/components/InfiniteListScroll.vue"],"names":[],"mappings":"AAKA;AAgIA,iBAAS,cAAc;WA0BT,OAAO,IAA6B;;yBAXrB,GAAG;;;;;;EAgB/B;AAQD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;kBASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -11,26 +11,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
11
|
const containerRef = useTemplateRef("container");
|
12
12
|
const scrollingElement = inject(wScrollingElement, null);
|
13
13
|
const element = computed(() => scrollingElement?.value ?? document);
|
14
|
-
const
|
15
|
-
if (
|
14
|
+
const checkIsScrollUp = () => {
|
15
|
+
if (!containerRef.value) return;
|
16
16
|
if (getIsScrollUp(scrollingElement?.value ?? document.scrollingElement, containerRef.value.offsetTop)) {
|
17
17
|
emit("scroll:up");
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
if (getIsScrollDown(scrollingElement?.value ?? document.scrollingElement)) {
|
21
|
-
emit("scroll:down");
|
22
|
-
}
|
23
|
-
};
|
24
|
-
const checkIsScrollUp = () => {
|
25
|
-
if (getIsScrollDown(scrollingElement?.value ?? document.scrollingElement)) {
|
26
|
-
emit("scroll:down");
|
27
18
|
}
|
28
19
|
};
|
29
20
|
const checkIsScrollDown = () => {
|
21
|
+
if (!containerRef.value) return;
|
30
22
|
if (getIsScrollDown(scrollingElement?.value ?? document.scrollingElement)) {
|
31
23
|
emit("scroll:down");
|
32
24
|
}
|
33
25
|
};
|
26
|
+
const listener = (event) => {
|
27
|
+
if (event.target !== element.value || !containerRef.value) return;
|
28
|
+
checkIsScrollUp();
|
29
|
+
checkIsScrollDown();
|
30
|
+
};
|
34
31
|
watch(element, (newValue, oldValue) => {
|
35
32
|
oldValue?.removeEventListener("scroll", listener);
|
36
33
|
newValue?.addEventListener("scroll", listener);
|