nuxt-echarts 0.0.10 → 0.0.11
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/module.json
CHANGED
|
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7
7
|
loadingOptions: PropType<import("../types").LoadingOptions>;
|
|
8
8
|
autoresize: PropType<boolean | {
|
|
9
9
|
throttle?: number;
|
|
10
|
-
onResize?:
|
|
10
|
+
onResize?: ResizeObserverCallback;
|
|
11
11
|
}>;
|
|
12
12
|
option: PropType<Option>;
|
|
13
13
|
theme: {
|
|
@@ -165,10 +165,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
165
165
|
root: import("vue").ShallowRef<EChartsElement | undefined>;
|
|
166
166
|
inner: import("vue").ShallowRef<HTMLElement | undefined>;
|
|
167
167
|
setOption: (option: Option, updateOptions?: UpdateOptions) => void;
|
|
168
|
-
|
|
168
|
+
realAttrs: import("vue").ComputedRef<{
|
|
169
169
|
[x: string]: any;
|
|
170
170
|
}>;
|
|
171
|
-
nativeListeners: Record<string, unknown
|
|
171
|
+
nativeListeners: import("vue").Ref<Record<string, unknown>>;
|
|
172
172
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
173
173
|
click: (params: import("echarts/core").ECElementEvent) => boolean;
|
|
174
174
|
dblclick: (params: import("echarts/core").ECElementEvent) => boolean;
|
|
@@ -235,7 +235,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
235
235
|
loadingOptions: PropType<import("../types").LoadingOptions>;
|
|
236
236
|
autoresize: PropType<boolean | {
|
|
237
237
|
throttle?: number;
|
|
238
|
-
onResize?:
|
|
238
|
+
onResize?: ResizeObserverCallback;
|
|
239
239
|
}>;
|
|
240
240
|
option: PropType<Option>;
|
|
241
241
|
theme: {
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
defineComponent,
|
|
3
3
|
shallowRef,
|
|
4
4
|
toRefs,
|
|
5
|
+
ref,
|
|
5
6
|
unref,
|
|
6
7
|
watch,
|
|
7
8
|
computed,
|
|
@@ -66,24 +67,27 @@ export default defineComponent({
|
|
|
66
67
|
// @ts-expect-error unknown computed type error
|
|
67
68
|
() => props.updateOptions || unref(defaultUpdateOptions) || {}
|
|
68
69
|
);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
70
|
+
const nativeListeners = ref({});
|
|
71
|
+
const realAttrs = computed(() => ({
|
|
72
|
+
...omitOn(attrs),
|
|
73
|
+
...nativeListeners.value
|
|
74
|
+
}));
|
|
71
75
|
const realListeners = {};
|
|
72
|
-
Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
|
|
73
|
-
let event = key.charAt(2).toLowerCase() + key.slice(3);
|
|
74
|
-
if (event.indexOf("native:") === 0) {
|
|
75
|
-
const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
|
|
76
|
-
8
|
|
77
|
-
)}`;
|
|
78
|
-
nativeListeners[nativeKey] = attrs[key];
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (event.substring(event.length - 4) === "Once") {
|
|
82
|
-
event = `~${event.substring(0, event.length - 4)}`;
|
|
83
|
-
}
|
|
84
|
-
realListeners[event] = attrs[key];
|
|
85
|
-
});
|
|
86
76
|
function init(option) {
|
|
77
|
+
Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
|
|
78
|
+
let event = key.charAt(2).toLowerCase() + key.slice(3);
|
|
79
|
+
if (event.indexOf("native:") === 0) {
|
|
80
|
+
const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
|
|
81
|
+
8
|
|
82
|
+
)}`;
|
|
83
|
+
nativeListeners.value[nativeKey] = attrs[key];
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (event.substring(event.length - 4) === "Once") {
|
|
87
|
+
event = `~${event.substring(0, event.length - 4)}`;
|
|
88
|
+
}
|
|
89
|
+
realListeners[event] = attrs[key];
|
|
90
|
+
});
|
|
87
91
|
if (!inner.value) {
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
@@ -224,13 +228,13 @@ export default defineComponent({
|
|
|
224
228
|
root,
|
|
225
229
|
inner,
|
|
226
230
|
setOption,
|
|
227
|
-
|
|
231
|
+
realAttrs,
|
|
228
232
|
nativeListeners,
|
|
229
233
|
...publicApi
|
|
230
234
|
};
|
|
231
235
|
},
|
|
232
236
|
render() {
|
|
233
|
-
const attrs =
|
|
237
|
+
const attrs = this.realAttrs;
|
|
234
238
|
attrs.ref = "root";
|
|
235
239
|
attrs.class = attrs.class ? ["echarts"].concat(attrs.class) : "echarts";
|
|
236
240
|
return h(TAG_NAME, attrs, [
|
|
@@ -2,7 +2,7 @@ import { type Ref, type PropType } from 'vue';
|
|
|
2
2
|
import { type EChartsType } from '../types.js';
|
|
3
3
|
type AutoresizeProp = boolean | {
|
|
4
4
|
throttle?: number;
|
|
5
|
-
onResize?:
|
|
5
|
+
onResize?: ResizeObserverCallback;
|
|
6
6
|
};
|
|
7
7
|
export declare function useAutoresize(chart: Ref<EChartsType | undefined>, autoresize: Ref<AutoresizeProp | undefined>, root: Ref<HTMLElement | undefined>): void;
|
|
8
8
|
export declare const autoresizeProps: {
|
|
@@ -10,19 +10,22 @@ export function useAutoresize(chart, autoresize, root) {
|
|
|
10
10
|
const autoresizeOptions = autoresize2 === true ? {} : autoresize2;
|
|
11
11
|
const { throttle: wait = 100, onResize } = autoresizeOptions;
|
|
12
12
|
let initialResizeTriggered = false;
|
|
13
|
-
const callback = () => {
|
|
13
|
+
const callback = (entry, ob) => {
|
|
14
14
|
chart2.resize({ height: "auto", width: "auto" });
|
|
15
|
-
onResize?.();
|
|
15
|
+
onResize?.(entry, ob);
|
|
16
16
|
};
|
|
17
|
-
const resizeCallback = wait ?
|
|
18
|
-
|
|
17
|
+
const resizeCallback = wait ? (
|
|
18
|
+
// @ts-expect-error callback can accept params
|
|
19
|
+
throttle(callback, wait)
|
|
20
|
+
) : callback;
|
|
21
|
+
ro = new ResizeObserver((entry, observer) => {
|
|
19
22
|
if (!initialResizeTriggered) {
|
|
20
23
|
initialResizeTriggered = true;
|
|
21
24
|
if (root2.offsetWidth === offsetWidth && root2.offsetHeight === offsetHeight) {
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
resizeCallback();
|
|
28
|
+
resizeCallback(entry, observer);
|
|
26
29
|
});
|
|
27
30
|
ro.observe(root2);
|
|
28
31
|
}
|