nuxt-echarts 0.3.1 → 0.3.3
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 +1 -1
- package/dist/runtime/components/VChart.d.ts +6 -149
- package/dist/runtime/components/VChart.js +37 -42
- package/dist/runtime/components/VChartServer.vue +16 -16
- package/dist/runtime/composables/api.d.ts +1 -1
- package/dist/runtime/composables/autoresize.js +3 -0
- package/dist/runtime/composables/loading.d.ts +2 -2
- package/dist/runtime/composables/loading.js +3 -3
- package/dist/runtime/server-plugin.d.ts +1 -1
- package/dist/runtime/types.d.ts +4 -5
- package/dist/runtime/utils/injection.js +3 -3
- package/dist/runtime/utils/wc.js +2 -4
- package/package.json +12 -11
package/dist/module.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropType } from 'vue';
|
|
2
2
|
import type { Option, Theme, InitOptions, UpdateOptions } from '../types.js';
|
|
3
|
+
import { type PublicMethods } from '../composables/index.js';
|
|
3
4
|
import { type EChartsElement } from '../utils/wc.js';
|
|
4
5
|
import '#build/echarts.mjs';
|
|
5
6
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -18,157 +19,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
18
19
|
group: StringConstructor;
|
|
19
20
|
manualUpdate: BooleanConstructor;
|
|
20
21
|
}>, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
getDom: () => HTMLElement;
|
|
25
|
-
getOption: () => import("echarts/core").EChartsCoreOption;
|
|
26
|
-
dispatchAction: (payload: import("echarts/core").Payload, opt?: boolean | {
|
|
27
|
-
silent?: boolean;
|
|
28
|
-
flush?: boolean | undefined;
|
|
29
|
-
}) => void;
|
|
30
|
-
convertToPixel: {
|
|
31
|
-
(finder: string | {
|
|
32
|
-
seriesIndex?: number | false | number[] | "none" | "all";
|
|
33
|
-
seriesId?: (string | number) | (string | number)[];
|
|
34
|
-
seriesName?: (string | number) | (string | number)[];
|
|
35
|
-
geoIndex?: number | false | number[] | "none" | "all";
|
|
36
|
-
geoId?: (string | number) | (string | number)[];
|
|
37
|
-
geoName?: (string | number) | (string | number)[];
|
|
38
|
-
bmapIndex?: number | false | number[] | "none" | "all";
|
|
39
|
-
bmapId?: (string | number) | (string | number)[];
|
|
40
|
-
bmapName?: (string | number) | (string | number)[];
|
|
41
|
-
xAxisIndex?: number | false | number[] | "none" | "all";
|
|
42
|
-
xAxisId?: (string | number) | (string | number)[];
|
|
43
|
-
xAxisName?: (string | number) | (string | number)[];
|
|
44
|
-
yAxisIndex?: number | false | number[] | "none" | "all";
|
|
45
|
-
yAxisId?: (string | number) | (string | number)[];
|
|
46
|
-
yAxisName?: (string | number) | (string | number)[];
|
|
47
|
-
gridIndex?: number | false | number[] | "none" | "all";
|
|
48
|
-
gridId?: (string | number) | (string | number)[];
|
|
49
|
-
gridName?: (string | number) | (string | number)[];
|
|
50
|
-
dataIndex?: number;
|
|
51
|
-
dataIndexInside?: number;
|
|
52
|
-
}, value: Date | (string | number)): number;
|
|
53
|
-
(finder: string | {
|
|
54
|
-
seriesIndex?: number | false | number[] | "none" | "all";
|
|
55
|
-
seriesId?: (string | number) | (string | number)[];
|
|
56
|
-
seriesName?: (string | number) | (string | number)[];
|
|
57
|
-
geoIndex?: number | false | number[] | "none" | "all";
|
|
58
|
-
geoId?: (string | number) | (string | number)[];
|
|
59
|
-
geoName?: (string | number) | (string | number)[];
|
|
60
|
-
bmapIndex?: number | false | number[] | "none" | "all";
|
|
61
|
-
bmapId?: (string | number) | (string | number)[];
|
|
62
|
-
bmapName?: (string | number) | (string | number)[];
|
|
63
|
-
xAxisIndex?: number | false | number[] | "none" | "all";
|
|
64
|
-
xAxisId?: (string | number) | (string | number)[];
|
|
65
|
-
xAxisName?: (string | number) | (string | number)[];
|
|
66
|
-
yAxisIndex?: number | false | number[] | "none" | "all";
|
|
67
|
-
yAxisId?: (string | number) | (string | number)[];
|
|
68
|
-
yAxisName?: (string | number) | (string | number)[];
|
|
69
|
-
gridIndex?: number | false | number[] | "none" | "all";
|
|
70
|
-
gridId?: (string | number) | (string | number)[];
|
|
71
|
-
gridName?: (string | number) | (string | number)[];
|
|
72
|
-
dataIndex?: number;
|
|
73
|
-
dataIndexInside?: number;
|
|
74
|
-
}, value: (Date | (string | number))[]): number[];
|
|
75
|
-
};
|
|
76
|
-
convertFromPixel: {
|
|
77
|
-
(finder: string | {
|
|
78
|
-
seriesIndex?: number | false | number[] | "none" | "all";
|
|
79
|
-
seriesId?: (string | number) | (string | number)[];
|
|
80
|
-
seriesName?: (string | number) | (string | number)[];
|
|
81
|
-
geoIndex?: number | false | number[] | "none" | "all";
|
|
82
|
-
geoId?: (string | number) | (string | number)[];
|
|
83
|
-
geoName?: (string | number) | (string | number)[];
|
|
84
|
-
bmapIndex?: number | false | number[] | "none" | "all";
|
|
85
|
-
bmapId?: (string | number) | (string | number)[];
|
|
86
|
-
bmapName?: (string | number) | (string | number)[];
|
|
87
|
-
xAxisIndex?: number | false | number[] | "none" | "all";
|
|
88
|
-
xAxisId?: (string | number) | (string | number)[];
|
|
89
|
-
xAxisName?: (string | number) | (string | number)[];
|
|
90
|
-
yAxisIndex?: number | false | number[] | "none" | "all";
|
|
91
|
-
yAxisId?: (string | number) | (string | number)[];
|
|
92
|
-
yAxisName?: (string | number) | (string | number)[];
|
|
93
|
-
gridIndex?: number | false | number[] | "none" | "all";
|
|
94
|
-
gridId?: (string | number) | (string | number)[];
|
|
95
|
-
gridName?: (string | number) | (string | number)[];
|
|
96
|
-
dataIndex?: number;
|
|
97
|
-
dataIndexInside?: number;
|
|
98
|
-
}, value: number): number;
|
|
99
|
-
(finder: string | {
|
|
100
|
-
seriesIndex?: number | false | number[] | "none" | "all";
|
|
101
|
-
seriesId?: (string | number) | (string | number)[];
|
|
102
|
-
seriesName?: (string | number) | (string | number)[];
|
|
103
|
-
geoIndex?: number | false | number[] | "none" | "all";
|
|
104
|
-
geoId?: (string | number) | (string | number)[];
|
|
105
|
-
geoName?: (string | number) | (string | number)[];
|
|
106
|
-
bmapIndex?: number | false | number[] | "none" | "all";
|
|
107
|
-
bmapId?: (string | number) | (string | number)[];
|
|
108
|
-
bmapName?: (string | number) | (string | number)[];
|
|
109
|
-
xAxisIndex?: number | false | number[] | "none" | "all";
|
|
110
|
-
xAxisId?: (string | number) | (string | number)[];
|
|
111
|
-
xAxisName?: (string | number) | (string | number)[];
|
|
112
|
-
yAxisIndex?: number | false | number[] | "none" | "all";
|
|
113
|
-
yAxisId?: (string | number) | (string | number)[];
|
|
114
|
-
yAxisName?: (string | number) | (string | number)[];
|
|
115
|
-
gridIndex?: number | false | number[] | "none" | "all";
|
|
116
|
-
gridId?: (string | number) | (string | number)[];
|
|
117
|
-
gridName?: (string | number) | (string | number)[];
|
|
118
|
-
dataIndex?: number;
|
|
119
|
-
dataIndexInside?: number;
|
|
120
|
-
}, value: number[]): number[];
|
|
22
|
+
setOption: {
|
|
23
|
+
<Opt extends import("echarts/core").EChartsCoreOption>(option: Opt, notMerge?: boolean, lazyUpdate?: boolean): void;
|
|
24
|
+
<Opt extends import("echarts/core").EChartsCoreOption>(option: Opt, opts?: import("echarts/core").SetOptionOpts): void;
|
|
121
25
|
};
|
|
122
|
-
containPixel: (finder: string | {
|
|
123
|
-
seriesIndex?: number | false | number[] | "none" | "all";
|
|
124
|
-
seriesId?: (string | number) | (string | number)[];
|
|
125
|
-
seriesName?: (string | number) | (string | number)[];
|
|
126
|
-
geoIndex?: number | false | number[] | "none" | "all";
|
|
127
|
-
geoId?: (string | number) | (string | number)[];
|
|
128
|
-
geoName?: (string | number) | (string | number)[];
|
|
129
|
-
bmapIndex?: number | false | number[] | "none" | "all";
|
|
130
|
-
bmapId?: (string | number) | (string | number)[];
|
|
131
|
-
bmapName?: (string | number) | (string | number)[];
|
|
132
|
-
xAxisIndex?: number | false | number[] | "none" | "all";
|
|
133
|
-
xAxisId?: (string | number) | (string | number)[];
|
|
134
|
-
xAxisName?: (string | number) | (string | number)[];
|
|
135
|
-
yAxisIndex?: number | false | number[] | "none" | "all";
|
|
136
|
-
yAxisId?: (string | number) | (string | number)[];
|
|
137
|
-
yAxisName?: (string | number) | (string | number)[];
|
|
138
|
-
gridIndex?: number | false | number[] | "none" | "all";
|
|
139
|
-
gridId?: (string | number) | (string | number)[];
|
|
140
|
-
gridName?: (string | number) | (string | number)[];
|
|
141
|
-
dataIndex?: number;
|
|
142
|
-
dataIndexInside?: number;
|
|
143
|
-
}, value: number[]) => boolean;
|
|
144
|
-
getDataURL: (opts?: {
|
|
145
|
-
type?: "png" | "jpeg" | "svg";
|
|
146
|
-
pixelRatio?: number;
|
|
147
|
-
backgroundColor?: import("echarts/core").Color;
|
|
148
|
-
excludeComponents?: string[];
|
|
149
|
-
}) => string;
|
|
150
|
-
getConnectedDataURL: (opts?: {
|
|
151
|
-
type?: "png" | "jpeg" | "svg";
|
|
152
|
-
pixelRatio?: number;
|
|
153
|
-
backgroundColor?: import("echarts/core").Color;
|
|
154
|
-
connectedBackgroundColor?: import("echarts/core").Color;
|
|
155
|
-
excludeComponents?: string[];
|
|
156
|
-
}) => string;
|
|
157
|
-
appendData: (params: {
|
|
158
|
-
seriesIndex: number;
|
|
159
|
-
data: any;
|
|
160
|
-
}) => void;
|
|
161
|
-
clear: () => void;
|
|
162
|
-
isDisposed: () => boolean;
|
|
163
|
-
dispose: () => void;
|
|
164
|
-
chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined, import("echarts/core").ECharts | undefined>;
|
|
165
26
|
root: import("vue").ShallowRef<EChartsElement | undefined, EChartsElement | undefined>;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
[x: string]: any;
|
|
169
|
-
}>;
|
|
170
|
-
nativeListeners: import("vue").ShallowRef<Record<string, unknown>, Record<string, unknown>>;
|
|
171
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined, import("echarts/core").ECharts | undefined>;
|
|
28
|
+
} & PublicMethods, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
172
29
|
click: (params: import("echarts/core").ECElementEvent) => void;
|
|
173
30
|
dblclick: (params: import("echarts/core").ECElementEvent) => void;
|
|
174
31
|
mouseout: (params: import("echarts/core").ECElementEvent) => void;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
defineComponent,
|
|
3
3
|
shallowRef,
|
|
4
4
|
toRefs,
|
|
5
|
-
|
|
5
|
+
toValue,
|
|
6
6
|
watch,
|
|
7
7
|
computed,
|
|
8
8
|
inject,
|
|
@@ -44,7 +44,7 @@ export default defineComponent({
|
|
|
44
44
|
},
|
|
45
45
|
emits: {},
|
|
46
46
|
inheritAttrs: false,
|
|
47
|
-
setup(props, { attrs }) {
|
|
47
|
+
setup(props, { attrs, expose }) {
|
|
48
48
|
const root = shallowRef();
|
|
49
49
|
const chart = shallowRef();
|
|
50
50
|
const manualOption = shallowRef();
|
|
@@ -55,36 +55,43 @@ export default defineComponent({
|
|
|
55
55
|
const realOption = computed(
|
|
56
56
|
() => manualOption.value || props.option || null
|
|
57
57
|
);
|
|
58
|
-
const realTheme = computed(() => props.theme ||
|
|
58
|
+
const realTheme = computed(() => props.theme || toValue(defaultTheme) || {});
|
|
59
59
|
const realInitOptions = computed(
|
|
60
|
-
() => props.initOptions ||
|
|
60
|
+
() => props.initOptions || toValue(defaultInitOptions) || {}
|
|
61
61
|
);
|
|
62
62
|
const realUpdateOptions = computed(
|
|
63
|
-
() => props.updateOptions ||
|
|
63
|
+
() => props.updateOptions || toValue(defaultUpdateOptions) || {}
|
|
64
64
|
);
|
|
65
65
|
const nativeListeners = shallowRef({});
|
|
66
66
|
const realAttrs = computed(() => ({
|
|
67
67
|
...omitOn(attrs),
|
|
68
68
|
...nativeListeners.value
|
|
69
69
|
}));
|
|
70
|
-
const
|
|
71
|
-
function
|
|
70
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
71
|
+
function collectListeners() {
|
|
72
72
|
const _nativeListeners = {};
|
|
73
73
|
Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
|
|
77
|
-
8
|
|
78
|
-
)}`;
|
|
74
|
+
if (key.indexOf("Native:") === 2) {
|
|
75
|
+
const nativeKey = `on${key.charAt(9).toUpperCase()}${key.slice(10)}`;
|
|
79
76
|
_nativeListeners[nativeKey] = attrs[key];
|
|
80
77
|
return;
|
|
81
78
|
}
|
|
79
|
+
let event = key.charAt(2).toLowerCase() + key.slice(3);
|
|
80
|
+
let zr;
|
|
81
|
+
if (event.indexOf("zr:") === 0) {
|
|
82
|
+
zr = true;
|
|
83
|
+
event = event.substring(3);
|
|
84
|
+
}
|
|
85
|
+
let once;
|
|
82
86
|
if (event.substring(event.length - 4) === "Once") {
|
|
83
|
-
|
|
87
|
+
once = true;
|
|
88
|
+
event = event.substring(0, event.length - 4);
|
|
84
89
|
}
|
|
85
|
-
|
|
90
|
+
listeners.set({ event, zr, once }, attrs[key]);
|
|
86
91
|
});
|
|
87
92
|
nativeListeners.value = _nativeListeners;
|
|
93
|
+
}
|
|
94
|
+
function init(option) {
|
|
88
95
|
if (!root.value) {
|
|
89
96
|
return;
|
|
90
97
|
}
|
|
@@ -96,23 +103,12 @@ export default defineComponent({
|
|
|
96
103
|
if (props.group) {
|
|
97
104
|
instance.group = props.group;
|
|
98
105
|
}
|
|
99
|
-
|
|
100
|
-
let handler = realListeners[key];
|
|
106
|
+
listeners.forEach((handler, { zr, once, event }) => {
|
|
101
107
|
if (!handler) {
|
|
102
108
|
return;
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
event = event.substring(1);
|
|
107
|
-
handler.__once__ = true;
|
|
108
|
-
}
|
|
109
|
-
let target = instance;
|
|
110
|
-
if (event.indexOf("zr:") === 0) {
|
|
111
|
-
target = instance.getZr();
|
|
112
|
-
event = event.substring(3);
|
|
113
|
-
}
|
|
114
|
-
if (handler.__once__) {
|
|
115
|
-
delete handler.__once__;
|
|
110
|
+
const target = zr ? instance.getZr() : instance;
|
|
111
|
+
if (once) {
|
|
116
112
|
const raw = handler;
|
|
117
113
|
handler = (...args) => {
|
|
118
114
|
raw(...args);
|
|
@@ -141,7 +137,8 @@ export default defineComponent({
|
|
|
141
137
|
commit();
|
|
142
138
|
}
|
|
143
139
|
}
|
|
144
|
-
|
|
140
|
+
const setOption = (option, notMerge, lazyUpdate) => {
|
|
141
|
+
const updateOptions = typeof notMerge === "boolean" ? { notMerge, lazyUpdate } : notMerge;
|
|
145
142
|
if (props.manualUpdate) {
|
|
146
143
|
manualOption.value = option;
|
|
147
144
|
}
|
|
@@ -150,7 +147,7 @@ export default defineComponent({
|
|
|
150
147
|
} else {
|
|
151
148
|
chart.value.setOption(option, updateOptions || {});
|
|
152
149
|
}
|
|
153
|
-
}
|
|
150
|
+
};
|
|
154
151
|
function cleanup() {
|
|
155
152
|
if (chart.value) {
|
|
156
153
|
chart.value.dispose();
|
|
@@ -210,6 +207,7 @@ export default defineComponent({
|
|
|
210
207
|
useLoading(chart, loading, loadingOptions);
|
|
211
208
|
useAutoresize(chart, autoresize, root);
|
|
212
209
|
onMounted(async () => {
|
|
210
|
+
collectListeners();
|
|
213
211
|
if (!root.value) await nextTick();
|
|
214
212
|
init();
|
|
215
213
|
});
|
|
@@ -220,19 +218,16 @@ export default defineComponent({
|
|
|
220
218
|
cleanup();
|
|
221
219
|
}
|
|
222
220
|
});
|
|
223
|
-
|
|
224
|
-
chart,
|
|
225
|
-
root,
|
|
221
|
+
const exposed = {
|
|
226
222
|
setOption,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
...publicApi
|
|
223
|
+
root,
|
|
224
|
+
chart
|
|
230
225
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
226
|
+
expose({ ...exposed, ...publicApi });
|
|
227
|
+
return () => h(TAG_NAME, {
|
|
228
|
+
...realAttrs.value,
|
|
229
|
+
ref: root,
|
|
230
|
+
class: ["echarts", realAttrs.value.class]
|
|
231
|
+
});
|
|
237
232
|
}
|
|
238
233
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, inject, ref, toValue } from "vue";
|
|
3
3
|
import { THEME_KEY, INIT_OPTIONS_KEY } from "../utils/injection";
|
|
4
4
|
const defaultTheme = inject(THEME_KEY, null);
|
|
5
5
|
const defaultInitOptions = inject(INIT_OPTIONS_KEY, null);
|
|
@@ -9,9 +9,9 @@ const props = defineProps({
|
|
|
9
9
|
initOptions: { type: null, required: false }
|
|
10
10
|
});
|
|
11
11
|
const emits = defineEmits(["error"]);
|
|
12
|
-
const realTheme = computed(() => props.theme ||
|
|
12
|
+
const realTheme = computed(() => props.theme || toValue(defaultTheme) || {});
|
|
13
13
|
const realInitOptions = computed(
|
|
14
|
-
() => props.initOptions ||
|
|
14
|
+
() => props.initOptions || toValue(defaultInitOptions) || {}
|
|
15
15
|
);
|
|
16
16
|
function onError(e) {
|
|
17
17
|
if (e instanceof TypeError && e.message === "Cannot read properties of undefined (reading 'link')") {
|
|
@@ -23,17 +23,17 @@ const root = ref(null);
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
|
-
<div class="vue-echarts-server">
|
|
27
|
-
<VChartIsland
|
|
28
|
-
ref="root"
|
|
29
|
-
:theme="realTheme"
|
|
30
|
-
:option="option"
|
|
31
|
-
:init-options="realInitOptions"
|
|
32
|
-
@error="onError"
|
|
33
|
-
>
|
|
34
|
-
<template #fallback>
|
|
35
|
-
<slot name="fallback" />
|
|
36
|
-
</template>
|
|
37
|
-
</VChartIsland>
|
|
38
|
-
</div>
|
|
26
|
+
<div class="vue-echarts-server">
|
|
27
|
+
<VChartIsland
|
|
28
|
+
ref="root"
|
|
29
|
+
:theme="realTheme"
|
|
30
|
+
:option="option"
|
|
31
|
+
:init-options="realInitOptions"
|
|
32
|
+
@error="onError"
|
|
33
|
+
>
|
|
34
|
+
<template #fallback>
|
|
35
|
+
<slot name="fallback" />
|
|
36
|
+
</template>
|
|
37
|
+
</VChartIsland>
|
|
38
|
+
</div>
|
|
39
39
|
</template>
|
|
@@ -2,6 +2,6 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { EChartsType } from '../types.js';
|
|
3
3
|
declare const METHOD_NAMES: readonly ["getWidth", "getHeight", "getDom", "getOption", "resize", "dispatchAction", "convertToPixel", "convertFromPixel", "containPixel", "getDataURL", "getConnectedDataURL", "appendData", "clear", "isDisposed", "dispose"];
|
|
4
4
|
type MethodName = (typeof METHOD_NAMES)[number];
|
|
5
|
-
type PublicMethods = Pick<EChartsType, MethodName>;
|
|
5
|
+
export type PublicMethods = Pick<EChartsType, MethodName>;
|
|
6
6
|
export declare function usePublicAPI(chart: Ref<EChartsType | undefined>): PublicMethods;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref, type InjectionKey, type PropType } from 'vue';
|
|
2
|
-
import type { EChartsType, LoadingOptions } from '../types.js';
|
|
3
|
-
export declare const LOADING_OPTIONS_KEY: InjectionKey<
|
|
2
|
+
import type { EChartsType, LoadingOptions, LoadingOptionsInjection } from '../types.js';
|
|
3
|
+
export declare const LOADING_OPTIONS_KEY: InjectionKey<LoadingOptionsInjection>;
|
|
4
4
|
export declare function useLoading(chart: Ref<EChartsType | undefined>, loading: Ref<boolean>, loadingOptions: Ref<LoadingOptions | undefined>): void;
|
|
5
5
|
export declare const loadingProps: {
|
|
6
6
|
loading: BooleanConstructor;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
toValue,
|
|
3
3
|
inject,
|
|
4
4
|
computed,
|
|
5
5
|
watchEffect
|
|
6
6
|
} from "vue";
|
|
7
|
-
export const LOADING_OPTIONS_KEY =
|
|
7
|
+
export const LOADING_OPTIONS_KEY = Symbol();
|
|
8
8
|
export function useLoading(chart, loading, loadingOptions) {
|
|
9
9
|
const defaultLoadingOptions = inject(LOADING_OPTIONS_KEY, {});
|
|
10
10
|
const realLoadingOptions = computed(() => ({
|
|
11
|
-
...
|
|
11
|
+
...toValue(defaultLoadingOptions) || {},
|
|
12
12
|
...loadingOptions?.value
|
|
13
13
|
}));
|
|
14
14
|
watchEffect(() => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
|
|
2
2
|
export default _default;
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { init, SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts/core';
|
|
2
|
-
import type {
|
|
3
|
-
export type Injection<T> =
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
export type Injection<T> = MaybeRefOrGetter<T | null>;
|
|
4
4
|
type InitType = typeof init;
|
|
5
5
|
export type InitParameters = Parameters<InitType>;
|
|
6
6
|
export type Theme = NonNullable<InitParameters[1]>;
|
|
@@ -10,9 +10,7 @@ export type InitOptionsInjection = Injection<InitOptions>;
|
|
|
10
10
|
export type UpdateOptions = SetOptionOpts;
|
|
11
11
|
export type UpdateOptionsInjection = Injection<UpdateOptions>;
|
|
12
12
|
export type EChartsType = ReturnType<InitType>;
|
|
13
|
-
type
|
|
14
|
-
export type EventTarget = EChartsType | ZRenderType;
|
|
15
|
-
type SetOptionType = EChartsType['setOption'];
|
|
13
|
+
export type SetOptionType = EChartsType['setOption'];
|
|
16
14
|
export type Option = Parameters<SetOptionType>[0];
|
|
17
15
|
export type LoadingOptions = {
|
|
18
16
|
text?: string;
|
|
@@ -28,6 +26,7 @@ export type LoadingOptions = {
|
|
|
28
26
|
lineWidth?: number;
|
|
29
27
|
zlevel?: number;
|
|
30
28
|
};
|
|
29
|
+
export type LoadingOptionsInjection = Injection<LoadingOptions>;
|
|
31
30
|
type MouseEventName = 'click' | 'dblclick' | 'mouseout' | 'mouseover' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu' | 'globalout';
|
|
32
31
|
type ElementEventName = MouseEventName | 'mousewheel' | 'drag' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'drop';
|
|
33
32
|
type ZRenderEventName = `zr:${ElementEventName}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const THEME_KEY =
|
|
2
|
-
export const INIT_OPTIONS_KEY =
|
|
3
|
-
export const UPDATE_OPTIONS_KEY =
|
|
1
|
+
export const THEME_KEY = Symbol();
|
|
2
|
+
export const INIT_OPTIONS_KEY = Symbol();
|
|
3
|
+
export const UPDATE_OPTIONS_KEY = Symbol();
|
|
4
4
|
export { LOADING_OPTIONS_KEY } from "../composables/index.js";
|
package/dist/runtime/utils/wc.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
let registered = null;
|
|
2
2
|
export const TAG_NAME = "x-vue-echarts";
|
|
3
|
-
if (
|
|
3
|
+
if (typeof HTMLElement === "undefined") {
|
|
4
4
|
globalThis.HTMLElement = Object;
|
|
5
|
+
registered = false;
|
|
5
6
|
}
|
|
6
7
|
export class EChartsElement extends HTMLElement {
|
|
7
8
|
__dispose = null;
|
|
@@ -16,9 +17,6 @@ export function register() {
|
|
|
16
17
|
if (registered != null) {
|
|
17
18
|
return registered;
|
|
18
19
|
}
|
|
19
|
-
if (typeof HTMLElement === "undefined" || typeof customElements === "undefined") {
|
|
20
|
-
return registered = false;
|
|
21
|
-
}
|
|
22
20
|
try {
|
|
23
21
|
if (customElements.get(TAG_NAME) == null) {
|
|
24
22
|
customElements.define(TAG_NAME, EChartsElement);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-echarts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Nuxt Module for Apache ECharts™",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"repository": "kingyue737/nuxt-echarts",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"type": "module",
|
|
17
|
-
"packageManager": "pnpm@10.
|
|
17
|
+
"packageManager": "pnpm@10.11.0",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
20
|
"types": "./dist/types.d.mts",
|
|
@@ -43,23 +43,24 @@
|
|
|
43
43
|
"test:types": "vue-tsc --noEmit && nuxi typecheck playground"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@nuxt/kit": "^3.17.
|
|
47
|
-
"echarts": "^5.6.0"
|
|
46
|
+
"@nuxt/kit": "^3.17.4"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@nuxt/eslint-config": "^1.
|
|
49
|
+
"@nuxt/eslint-config": "^1.4.1",
|
|
51
50
|
"@nuxt/module-builder": "^1.0.1",
|
|
52
|
-
"@nuxt/schema": "^3.17.
|
|
53
|
-
"@nuxt/test-utils": "^3.
|
|
54
|
-
"@types/node": "^22.15.
|
|
51
|
+
"@nuxt/schema": "^3.17.4",
|
|
52
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
53
|
+
"@types/node": "^22.15.24",
|
|
55
54
|
"changelogen": "^0.6.1",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
55
|
+
"echarts": "^5.6.0",
|
|
56
|
+
"echarts-gl": "^2.0.9",
|
|
57
|
+
"eslint": "^9.27.0",
|
|
58
|
+
"nuxt": "^3.17.4",
|
|
58
59
|
"prettier": "^3.5.3",
|
|
59
60
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
60
61
|
"typescript": "^5.8.3",
|
|
61
62
|
"vite": "^6.3.5",
|
|
62
|
-
"vitest": "^3.1.
|
|
63
|
+
"vitest": "^3.1.4",
|
|
63
64
|
"vue-tsc": "^2.2.10"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|