nuxt-echarts 0.1.0 → 0.2.0
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/README.md +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/VChart.d.ts +83 -84
- package/dist/runtime/components/VChart.js +4 -10
- package/dist/runtime/components/VChartIsland.server.vue +34 -34
- package/dist/runtime/components/VChartLight.vue.d.ts +87 -3
- package/dist/runtime/components/VChartServer.vue +48 -49
- package/dist/runtime/composables/autoresize.d.ts +1 -1
- package/dist/runtime/style.css +1 -1
- package/dist/runtime/types.d.ts +7 -9
- package/dist/runtime/utils/wc.js +1 -1
- package/package.json +16 -19
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Nuxt Module for Apache ECharts™
|
|
|
11
11
|
|
|
12
12
|
> [!IMPORTANT]
|
|
13
13
|
>
|
|
14
|
-
> Nuxt ECharts is
|
|
14
|
+
> Nuxt ECharts SSR is based on [experimental `<NuxtIsland>`](https://nuxt.com/docs/api/components/nuxt-island). If you found any issue, design flaw, or have ideas to improve it, please open an [issue](https://github.com/kingyue737/nuxt-echarts/issues) or a [Discussion](https://github.com/kingyue737/nuxt-echarts/discussions).
|
|
15
15
|
|
|
16
16
|
- [📖 Documentation](https://echarts.nuxt.dev)
|
|
17
17
|
|
package/dist/module.json
CHANGED
|
@@ -163,73 +163,72 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
163
163
|
dispose: () => void;
|
|
164
164
|
chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined>;
|
|
165
165
|
root: import("vue").ShallowRef<EChartsElement | undefined>;
|
|
166
|
-
inner: import("vue").ShallowRef<HTMLElement | undefined>;
|
|
167
166
|
setOption: (option: Option, updateOptions?: UpdateOptions) => void;
|
|
168
167
|
realAttrs: import("vue").ComputedRef<{
|
|
169
168
|
[x: string]: any;
|
|
170
169
|
}>;
|
|
171
|
-
nativeListeners: import("vue").Ref<Record<string, unknown>>;
|
|
170
|
+
nativeListeners: import("vue").Ref<Record<string, unknown>, Record<string, unknown>>;
|
|
172
171
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
173
|
-
click: (params: import("echarts/core").ECElementEvent) =>
|
|
174
|
-
dblclick: (params: import("echarts/core").ECElementEvent) =>
|
|
175
|
-
mouseout: (params: import("echarts/core").ECElementEvent) =>
|
|
176
|
-
mouseover: (params: import("echarts/core").ECElementEvent) =>
|
|
177
|
-
mouseup: (params: import("echarts/core").ECElementEvent) =>
|
|
178
|
-
mousedown: (params: import("echarts/core").ECElementEvent) =>
|
|
179
|
-
mousemove: (params: import("echarts/core").ECElementEvent) =>
|
|
180
|
-
contextmenu: (params: import("echarts/core").ECElementEvent) =>
|
|
181
|
-
globalout: (params: import("echarts/core").ECElementEvent) =>
|
|
172
|
+
click: (params: import("echarts/core").ECElementEvent) => void;
|
|
173
|
+
dblclick: (params: import("echarts/core").ECElementEvent) => void;
|
|
174
|
+
mouseout: (params: import("echarts/core").ECElementEvent) => void;
|
|
175
|
+
mouseover: (params: import("echarts/core").ECElementEvent) => void;
|
|
176
|
+
mouseup: (params: import("echarts/core").ECElementEvent) => void;
|
|
177
|
+
mousedown: (params: import("echarts/core").ECElementEvent) => void;
|
|
178
|
+
mousemove: (params: import("echarts/core").ECElementEvent) => void;
|
|
179
|
+
contextmenu: (params: import("echarts/core").ECElementEvent) => void;
|
|
180
|
+
globalout: (params: import("echarts/core").ECElementEvent) => void;
|
|
182
181
|
} & {
|
|
183
|
-
highlight:
|
|
184
|
-
downplay:
|
|
185
|
-
selectchanged:
|
|
186
|
-
legendselectchanged:
|
|
187
|
-
legendselected:
|
|
188
|
-
legendunselected:
|
|
189
|
-
legendselectall:
|
|
190
|
-
legendinverseselect:
|
|
191
|
-
legendscroll:
|
|
192
|
-
datazoom:
|
|
193
|
-
datarangeselected:
|
|
194
|
-
graphroam:
|
|
195
|
-
georoam:
|
|
196
|
-
treeroam:
|
|
197
|
-
timelinechanged:
|
|
198
|
-
timelineplaychanged:
|
|
199
|
-
restore:
|
|
200
|
-
dataviewchanged:
|
|
201
|
-
magictypechanged:
|
|
202
|
-
geoselectchanged:
|
|
203
|
-
geoselected:
|
|
204
|
-
geounselected:
|
|
205
|
-
axisareaselected:
|
|
206
|
-
brush:
|
|
207
|
-
brushEnd:
|
|
208
|
-
brushselected:
|
|
209
|
-
globalcursortaken:
|
|
182
|
+
highlight: (params: any) => void;
|
|
183
|
+
downplay: (params: any) => void;
|
|
184
|
+
selectchanged: (params: any) => void;
|
|
185
|
+
legendselectchanged: (params: any) => void;
|
|
186
|
+
legendselected: (params: any) => void;
|
|
187
|
+
legendunselected: (params: any) => void;
|
|
188
|
+
legendselectall: (params: any) => void;
|
|
189
|
+
legendinverseselect: (params: any) => void;
|
|
190
|
+
legendscroll: (params: any) => void;
|
|
191
|
+
datazoom: (params: any) => void;
|
|
192
|
+
datarangeselected: (params: any) => void;
|
|
193
|
+
graphroam: (params: any) => void;
|
|
194
|
+
georoam: (params: any) => void;
|
|
195
|
+
treeroam: (params: any) => void;
|
|
196
|
+
timelinechanged: (params: any) => void;
|
|
197
|
+
timelineplaychanged: (params: any) => void;
|
|
198
|
+
restore: (params: any) => void;
|
|
199
|
+
dataviewchanged: (params: any) => void;
|
|
200
|
+
magictypechanged: (params: any) => void;
|
|
201
|
+
geoselectchanged: (params: any) => void;
|
|
202
|
+
geoselected: (params: any) => void;
|
|
203
|
+
geounselected: (params: any) => void;
|
|
204
|
+
axisareaselected: (params: any) => void;
|
|
205
|
+
brush: (params: any) => void;
|
|
206
|
+
brushEnd: (params: any) => void;
|
|
207
|
+
brushselected: (params: any) => void;
|
|
208
|
+
globalcursortaken: (params: any) => void;
|
|
210
209
|
} & {
|
|
211
210
|
rendered: (params: {
|
|
212
211
|
elapsedTime: number;
|
|
213
|
-
}) =>
|
|
214
|
-
finished: () =>
|
|
212
|
+
}) => void;
|
|
213
|
+
finished: () => void;
|
|
215
214
|
} & {
|
|
216
|
-
"zr:mousewheel": (params: import("echarts/core").ElementEvent) =>
|
|
217
|
-
"zr:drag": (params: import("echarts/core").ElementEvent) =>
|
|
218
|
-
"zr:dragstart": (params: import("echarts/core").ElementEvent) =>
|
|
219
|
-
"zr:dragend": (params: import("echarts/core").ElementEvent) =>
|
|
220
|
-
"zr:dragenter": (params: import("echarts/core").ElementEvent) =>
|
|
221
|
-
"zr:dragleave": (params: import("echarts/core").ElementEvent) =>
|
|
222
|
-
"zr:dragover": (params: import("echarts/core").ElementEvent) =>
|
|
223
|
-
"zr:drop": (params: import("echarts/core").ElementEvent) =>
|
|
224
|
-
"zr:click": (params: import("echarts/core").ElementEvent) =>
|
|
225
|
-
"zr:dblclick": (params: import("echarts/core").ElementEvent) =>
|
|
226
|
-
"zr:mouseout": (params: import("echarts/core").ElementEvent) =>
|
|
227
|
-
"zr:mouseover": (params: import("echarts/core").ElementEvent) =>
|
|
228
|
-
"zr:mouseup": (params: import("echarts/core").ElementEvent) =>
|
|
229
|
-
"zr:mousedown": (params: import("echarts/core").ElementEvent) =>
|
|
230
|
-
"zr:mousemove": (params: import("echarts/core").ElementEvent) =>
|
|
231
|
-
"zr:contextmenu": (params: import("echarts/core").ElementEvent) =>
|
|
232
|
-
"zr:globalout": (params: import("echarts/core").ElementEvent) =>
|
|
215
|
+
"zr:mousewheel": (params: import("echarts/core").ElementEvent) => void;
|
|
216
|
+
"zr:drag": (params: import("echarts/core").ElementEvent) => void;
|
|
217
|
+
"zr:dragstart": (params: import("echarts/core").ElementEvent) => void;
|
|
218
|
+
"zr:dragend": (params: import("echarts/core").ElementEvent) => void;
|
|
219
|
+
"zr:dragenter": (params: import("echarts/core").ElementEvent) => void;
|
|
220
|
+
"zr:dragleave": (params: import("echarts/core").ElementEvent) => void;
|
|
221
|
+
"zr:dragover": (params: import("echarts/core").ElementEvent) => void;
|
|
222
|
+
"zr:drop": (params: import("echarts/core").ElementEvent) => void;
|
|
223
|
+
"zr:click": (params: import("echarts/core").ElementEvent) => void;
|
|
224
|
+
"zr:dblclick": (params: import("echarts/core").ElementEvent) => void;
|
|
225
|
+
"zr:mouseout": (params: import("echarts/core").ElementEvent) => void;
|
|
226
|
+
"zr:mouseover": (params: import("echarts/core").ElementEvent) => void;
|
|
227
|
+
"zr:mouseup": (params: import("echarts/core").ElementEvent) => void;
|
|
228
|
+
"zr:mousedown": (params: import("echarts/core").ElementEvent) => void;
|
|
229
|
+
"zr:mousemove": (params: import("echarts/core").ElementEvent) => void;
|
|
230
|
+
"zr:contextmenu": (params: import("echarts/core").ElementEvent) => void;
|
|
231
|
+
"zr:globalout": (params: import("echarts/core").ElementEvent) => void;
|
|
233
232
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
234
233
|
loading: BooleanConstructor;
|
|
235
234
|
loadingOptions: PropType<import("../types").LoadingOptions>;
|
|
@@ -272,33 +271,33 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
272
271
|
"onZr:mousemove"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
|
|
273
272
|
"onZr:contextmenu"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
|
|
274
273
|
"onZr:globalout"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
|
|
275
|
-
onHighlight?: ((
|
|
276
|
-
onDownplay?: ((
|
|
277
|
-
onSelectchanged?: ((
|
|
278
|
-
onLegendselectchanged?: ((
|
|
279
|
-
onLegendselected?: ((
|
|
280
|
-
onLegendunselected?: ((
|
|
281
|
-
onLegendselectall?: ((
|
|
282
|
-
onLegendinverseselect?: ((
|
|
283
|
-
onLegendscroll?: ((
|
|
284
|
-
onDatazoom?: ((
|
|
285
|
-
onDatarangeselected?: ((
|
|
286
|
-
onGraphroam?: ((
|
|
287
|
-
onGeoroam?: ((
|
|
288
|
-
onTreeroam?: ((
|
|
289
|
-
onTimelinechanged?: ((
|
|
290
|
-
onTimelineplaychanged?: ((
|
|
291
|
-
onRestore?: ((
|
|
292
|
-
onDataviewchanged?: ((
|
|
293
|
-
onMagictypechanged?: ((
|
|
294
|
-
onGeoselectchanged?: ((
|
|
295
|
-
onGeoselected?: ((
|
|
296
|
-
onGeounselected?: ((
|
|
297
|
-
onAxisareaselected?: ((
|
|
298
|
-
onBrush?: ((
|
|
299
|
-
onBrushEnd?: ((
|
|
300
|
-
onBrushselected?: ((
|
|
301
|
-
onGlobalcursortaken?: ((
|
|
274
|
+
onHighlight?: ((params: any) => any) | undefined;
|
|
275
|
+
onDownplay?: ((params: any) => any) | undefined;
|
|
276
|
+
onSelectchanged?: ((params: any) => any) | undefined;
|
|
277
|
+
onLegendselectchanged?: ((params: any) => any) | undefined;
|
|
278
|
+
onLegendselected?: ((params: any) => any) | undefined;
|
|
279
|
+
onLegendunselected?: ((params: any) => any) | undefined;
|
|
280
|
+
onLegendselectall?: ((params: any) => any) | undefined;
|
|
281
|
+
onLegendinverseselect?: ((params: any) => any) | undefined;
|
|
282
|
+
onLegendscroll?: ((params: any) => any) | undefined;
|
|
283
|
+
onDatazoom?: ((params: any) => any) | undefined;
|
|
284
|
+
onDatarangeselected?: ((params: any) => any) | undefined;
|
|
285
|
+
onGraphroam?: ((params: any) => any) | undefined;
|
|
286
|
+
onGeoroam?: ((params: any) => any) | undefined;
|
|
287
|
+
onTreeroam?: ((params: any) => any) | undefined;
|
|
288
|
+
onTimelinechanged?: ((params: any) => any) | undefined;
|
|
289
|
+
onTimelineplaychanged?: ((params: any) => any) | undefined;
|
|
290
|
+
onRestore?: ((params: any) => any) | undefined;
|
|
291
|
+
onDataviewchanged?: ((params: any) => any) | undefined;
|
|
292
|
+
onMagictypechanged?: ((params: any) => any) | undefined;
|
|
293
|
+
onGeoselectchanged?: ((params: any) => any) | undefined;
|
|
294
|
+
onGeoselected?: ((params: any) => any) | undefined;
|
|
295
|
+
onGeounselected?: ((params: any) => any) | undefined;
|
|
296
|
+
onAxisareaselected?: ((params: any) => any) | undefined;
|
|
297
|
+
onBrush?: ((params: any) => any) | undefined;
|
|
298
|
+
onBrushEnd?: ((params: any) => any) | undefined;
|
|
299
|
+
onBrushselected?: ((params: any) => any) | undefined;
|
|
300
|
+
onGlobalcursortaken?: ((params: any) => any) | undefined;
|
|
302
301
|
onRendered?: ((params: {
|
|
303
302
|
elapsedTime: number;
|
|
304
303
|
}) => any) | undefined;
|
|
@@ -47,7 +47,6 @@ export default defineComponent({
|
|
|
47
47
|
inheritAttrs: false,
|
|
48
48
|
setup(props, { attrs }) {
|
|
49
49
|
const root = shallowRef();
|
|
50
|
-
const inner = shallowRef();
|
|
51
50
|
const chart = shallowRef();
|
|
52
51
|
const manualOption = shallowRef();
|
|
53
52
|
const defaultTheme = inject(THEME_KEY, null);
|
|
@@ -59,11 +58,9 @@ export default defineComponent({
|
|
|
59
58
|
);
|
|
60
59
|
const realTheme = computed(() => props.theme || unref(defaultTheme) || {});
|
|
61
60
|
const realInitOptions = computed(
|
|
62
|
-
// @ts-expect-error unknown computed type error
|
|
63
61
|
() => props.initOptions || unref(defaultInitOptions) || {}
|
|
64
62
|
);
|
|
65
63
|
const realUpdateOptions = computed(
|
|
66
|
-
// @ts-expect-error unknown computed type error
|
|
67
64
|
() => props.updateOptions || unref(defaultUpdateOptions) || {}
|
|
68
65
|
);
|
|
69
66
|
const nativeListeners = ref({});
|
|
@@ -87,11 +84,11 @@ export default defineComponent({
|
|
|
87
84
|
}
|
|
88
85
|
realListeners[event] = attrs[key];
|
|
89
86
|
});
|
|
90
|
-
if (!
|
|
87
|
+
if (!root.value) {
|
|
91
88
|
return;
|
|
92
89
|
}
|
|
93
90
|
const instance = chart.value = initChart(
|
|
94
|
-
|
|
91
|
+
root.value,
|
|
95
92
|
realTheme.value,
|
|
96
93
|
realInitOptions.value
|
|
97
94
|
);
|
|
@@ -210,7 +207,7 @@ export default defineComponent({
|
|
|
210
207
|
});
|
|
211
208
|
const publicApi = usePublicAPI(chart);
|
|
212
209
|
useLoading(chart, loading, loadingOptions);
|
|
213
|
-
useAutoresize(chart, autoresize,
|
|
210
|
+
useAutoresize(chart, autoresize, root);
|
|
214
211
|
onMounted(async () => {
|
|
215
212
|
if (!root.value) await nextTick();
|
|
216
213
|
init();
|
|
@@ -225,7 +222,6 @@ export default defineComponent({
|
|
|
225
222
|
return {
|
|
226
223
|
chart,
|
|
227
224
|
root,
|
|
228
|
-
inner,
|
|
229
225
|
setOption,
|
|
230
226
|
realAttrs,
|
|
231
227
|
nativeListeners,
|
|
@@ -236,8 +232,6 @@ export default defineComponent({
|
|
|
236
232
|
const attrs = this.realAttrs;
|
|
237
233
|
attrs.ref = "root";
|
|
238
234
|
attrs.class = attrs.class ? ["echarts"].concat(attrs.class) : "echarts";
|
|
239
|
-
return h(TAG_NAME, attrs
|
|
240
|
-
h("div", { ref: "inner", class: "vue-echarts-inner" })
|
|
241
|
-
]);
|
|
235
|
+
return h(TAG_NAME, attrs);
|
|
242
236
|
}
|
|
243
237
|
});
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import * as echarts from 'echarts'
|
|
3
|
-
import { ref } from 'vue'
|
|
4
|
-
import type { Option, InitOptions, Theme } from '../types'
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
option?: Option
|
|
8
|
-
initOptions?: InitOptions
|
|
9
|
-
theme?: Theme
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const svgStr = ref('')
|
|
13
|
-
const initOptions: InitOptions = echarts.util.merge(
|
|
14
|
-
{ renderer: 'svg', ssr: true } satisfies InitOptions,
|
|
15
|
-
props.initOptions || {},
|
|
16
|
-
)
|
|
17
|
-
let chart = echarts.init(null, props.theme, initOptions)
|
|
18
|
-
chart.setOption(props.option || {})
|
|
19
|
-
svgStr.value = chart.renderToSVGString()
|
|
20
|
-
|
|
21
|
-
chart.dispose()
|
|
22
|
-
|
|
23
|
-
// @ts-expect-error release memory
|
|
24
|
-
chart = null
|
|
25
|
-
|
|
26
|
-
defineSlots<{ fallback: any }>()
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<div class="vue-echarts-container">
|
|
31
|
-
<!--eslint-disable-next-line vue/no-v-html-->
|
|
32
|
-
<div class="vue-echarts-inner" v-html="svgStr" />
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import * as echarts from 'echarts'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
import type { Option, InitOptions, Theme } from '../types'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
option?: Option
|
|
8
|
+
initOptions?: InitOptions
|
|
9
|
+
theme?: Theme
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const svgStr = ref('')
|
|
13
|
+
const initOptions: InitOptions = echarts.util.merge(
|
|
14
|
+
{ renderer: 'svg', ssr: true } satisfies InitOptions,
|
|
15
|
+
props.initOptions || {},
|
|
16
|
+
)
|
|
17
|
+
let chart = echarts.init(null, props.theme, initOptions)
|
|
18
|
+
chart.setOption(props.option || {})
|
|
19
|
+
svgStr.value = chart.renderToSVGString()
|
|
20
|
+
|
|
21
|
+
chart.dispose()
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error release memory
|
|
24
|
+
chart = null
|
|
25
|
+
|
|
26
|
+
defineSlots<{ fallback: any }>()
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div class="vue-echarts-container">
|
|
31
|
+
<!--eslint-disable-next-line vue/no-v-html-->
|
|
32
|
+
<div class="vue-echarts-inner" v-html="svgStr" />
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -13,9 +13,93 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13
13
|
$: import("vue").ComponentInternalInstance;
|
|
14
14
|
$data: {};
|
|
15
15
|
$props: Partial<{}> & Omit<{
|
|
16
|
-
readonly option?: Option;
|
|
17
|
-
readonly initOptions?: InitOptions;
|
|
18
|
-
readonly theme?: Theme;
|
|
16
|
+
readonly option?: Option | undefined;
|
|
17
|
+
readonly initOptions?: InitOptions | undefined;
|
|
18
|
+
readonly theme?: Theme | undefined;
|
|
19
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
20
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
option: {
|
|
22
|
+
type: PropType<import("echarts/core").EChartsCoreOption>;
|
|
23
|
+
};
|
|
24
|
+
theme: {
|
|
25
|
+
type: PropType<Theme>;
|
|
26
|
+
};
|
|
27
|
+
initOptions: {
|
|
28
|
+
type: PropType<import("echarts/core").EChartsInitOpts>;
|
|
29
|
+
};
|
|
30
|
+
}>> & {
|
|
31
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
32
|
+
}, never>;
|
|
33
|
+
$attrs: {
|
|
34
|
+
[x: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
$refs: {
|
|
37
|
+
[x: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
$slots: Readonly<{
|
|
40
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
43
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
44
|
+
$emit: (event: "error", error: unknown) => void;
|
|
45
|
+
$el: any;
|
|
46
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
option: {
|
|
48
|
+
type: PropType<import("echarts/core").EChartsCoreOption>;
|
|
49
|
+
};
|
|
50
|
+
theme: {
|
|
51
|
+
type: PropType<Theme>;
|
|
52
|
+
};
|
|
53
|
+
initOptions: {
|
|
54
|
+
type: PropType<import("echarts/core").EChartsInitOpts>;
|
|
55
|
+
};
|
|
56
|
+
}>> & {
|
|
57
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
58
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
+
error: (error: unknown) => void;
|
|
60
|
+
}, string, {}, {}, string, {}> & {
|
|
61
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
62
|
+
created?: (() => void) | (() => void)[];
|
|
63
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
64
|
+
mounted?: (() => void) | (() => void)[];
|
|
65
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
66
|
+
updated?: (() => void) | (() => void)[];
|
|
67
|
+
activated?: (() => void) | (() => void)[];
|
|
68
|
+
deactivated?: (() => void) | (() => void)[];
|
|
69
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
70
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
71
|
+
destroyed?: (() => void) | (() => void)[];
|
|
72
|
+
unmounted?: (() => void) | (() => void)[];
|
|
73
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
74
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
75
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
76
|
+
};
|
|
77
|
+
$forceUpdate: () => void;
|
|
78
|
+
$nextTick: typeof nextTick;
|
|
79
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, (cleanupFn: () => void) => void]) => any : (...args: [any, any, (cleanupFn: () => void) => void]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
80
|
+
} & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
81
|
+
option: {
|
|
82
|
+
type: PropType<import("echarts/core").EChartsCoreOption>;
|
|
83
|
+
};
|
|
84
|
+
theme: {
|
|
85
|
+
type: PropType<Theme>;
|
|
86
|
+
};
|
|
87
|
+
initOptions: {
|
|
88
|
+
type: PropType<import("echarts/core").EChartsInitOpts>;
|
|
89
|
+
};
|
|
90
|
+
}>> & {
|
|
91
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
92
|
+
}, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
93
|
+
$slots: {
|
|
94
|
+
fallback?(_: {}): any;
|
|
95
|
+
};
|
|
96
|
+
}) | null, ({
|
|
97
|
+
$: import("vue").ComponentInternalInstance;
|
|
98
|
+
$data: {};
|
|
99
|
+
$props: Partial<{}> & Omit<{
|
|
100
|
+
readonly option?: Option | undefined;
|
|
101
|
+
readonly initOptions?: InitOptions | undefined;
|
|
102
|
+
readonly theme?: Theme | undefined;
|
|
19
103
|
onError?: ((error: unknown) => any) | undefined;
|
|
20
104
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
21
105
|
option: {
|
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, unref, inject, ref } from 'vue'
|
|
3
|
-
import type { InitOptions, Option, Theme } from '../types'
|
|
4
|
-
import { THEME_KEY, INIT_OPTIONS_KEY } from '../utils/injection'
|
|
5
|
-
import type { VChartIsland } from '#components'
|
|
6
|
-
|
|
7
|
-
const defaultTheme = inject(THEME_KEY, null)
|
|
8
|
-
const defaultInitOptions = inject(INIT_OPTIONS_KEY, null)
|
|
9
|
-
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
option?: Option
|
|
12
|
-
theme?: Theme
|
|
13
|
-
initOptions?: InitOptions
|
|
14
|
-
}>()
|
|
15
|
-
const emits = defineEmits<{ (event: 'error', error: unknown): void }>()
|
|
16
|
-
|
|
17
|
-
const realTheme = computed(() => props.theme || unref(defaultTheme) || {})
|
|
18
|
-
const realInitOptions = computed(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
e
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, unref, inject, ref } from 'vue'
|
|
3
|
+
import type { InitOptions, Option, Theme } from '../types'
|
|
4
|
+
import { THEME_KEY, INIT_OPTIONS_KEY } from '../utils/injection'
|
|
5
|
+
import type { VChartIsland } from '#components'
|
|
6
|
+
|
|
7
|
+
const defaultTheme = inject(THEME_KEY, null)
|
|
8
|
+
const defaultInitOptions = inject(INIT_OPTIONS_KEY, null)
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
option?: Option
|
|
12
|
+
theme?: Theme
|
|
13
|
+
initOptions?: InitOptions
|
|
14
|
+
}>()
|
|
15
|
+
const emits = defineEmits<{ (event: 'error', error: unknown): void }>()
|
|
16
|
+
|
|
17
|
+
const realTheme = computed(() => props.theme || unref(defaultTheme) || {})
|
|
18
|
+
const realInitOptions = computed(
|
|
19
|
+
() => props.initOptions || unref(defaultInitOptions) || {},
|
|
20
|
+
)
|
|
21
|
+
function onError(e: unknown) {
|
|
22
|
+
// https://github.com/nuxt/nuxt/issues/27491
|
|
23
|
+
if (
|
|
24
|
+
e instanceof TypeError &&
|
|
25
|
+
e.message === "Cannot read properties of undefined (reading 'link')"
|
|
26
|
+
) {
|
|
27
|
+
root.value?.refresh()
|
|
28
|
+
}
|
|
29
|
+
emits('error', e)
|
|
30
|
+
}
|
|
31
|
+
const root = ref<InstanceType<typeof VChartIsland> | null>(null)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="vue-echarts-server">
|
|
36
|
+
<VChartIsland
|
|
37
|
+
ref="root"
|
|
38
|
+
:theme="realTheme"
|
|
39
|
+
:option="option"
|
|
40
|
+
:init-options="realInitOptions"
|
|
41
|
+
@error="onError"
|
|
42
|
+
>
|
|
43
|
+
<template #fallback>
|
|
44
|
+
<slot name="fallback" />
|
|
45
|
+
</template>
|
|
46
|
+
</VChartIsland>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
package/dist/runtime/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.vue-echarts-container,x-vue-echarts{display:
|
|
1
|
+
.vue-echarts-container,x-vue-echarts{display:block;height:100%;min-width:0;width:100%}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { init, SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts/core';
|
|
2
|
-
import type {
|
|
3
|
-
export type Injection<T> =
|
|
4
|
-
value: T | null;
|
|
5
|
-
};
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
export type Injection<T> = MaybeRef<T | null>;
|
|
6
4
|
type InitType = typeof init;
|
|
7
5
|
export type InitParameters = Parameters<InitType>;
|
|
8
6
|
export type Theme = NonNullable<InitParameters[1]>;
|
|
@@ -35,18 +33,18 @@ type ElementEventName = MouseEventName | 'mousewheel' | 'drag' | 'dragstart' | '
|
|
|
35
33
|
type ZRenderEventName = `zr:${ElementEventName}`;
|
|
36
34
|
type OtherEventName = 'highlight' | 'downplay' | 'selectchanged' | 'legendselectchanged' | 'legendselected' | 'legendunselected' | 'legendselectall' | 'legendinverseselect' | 'legendscroll' | 'datazoom' | 'datarangeselected' | 'graphroam' | 'georoam' | 'treeroam' | 'timelinechanged' | 'timelineplaychanged' | 'restore' | 'dataviewchanged' | 'magictypechanged' | 'geoselectchanged' | 'geoselected' | 'geounselected' | 'axisareaselected' | 'brush' | 'brushEnd' | 'brushselected' | 'globalcursortaken';
|
|
37
35
|
type MouseEmits = {
|
|
38
|
-
[key in MouseEventName]: (params: ECElementEvent) =>
|
|
36
|
+
[key in MouseEventName]: (params: ECElementEvent) => void;
|
|
39
37
|
};
|
|
40
38
|
type ZRenderEmits = {
|
|
41
|
-
[key in ZRenderEventName]: (params: ElementEvent) =>
|
|
39
|
+
[key in ZRenderEventName]: (params: ElementEvent) => void;
|
|
42
40
|
};
|
|
43
41
|
type OtherEmits = {
|
|
44
|
-
[key in OtherEventName]:
|
|
42
|
+
[key in OtherEventName]: (params: any) => void;
|
|
45
43
|
};
|
|
46
44
|
export type Emits = MouseEmits & OtherEmits & {
|
|
47
45
|
rendered: (params: {
|
|
48
46
|
elapsedTime: number;
|
|
49
|
-
}) =>
|
|
50
|
-
finished: () =>
|
|
47
|
+
}) => void;
|
|
48
|
+
finished: () => void;
|
|
51
49
|
} & ZRenderEmits;
|
|
52
50
|
export {};
|
package/dist/runtime/utils/wc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-echarts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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@9.
|
|
17
|
+
"packageManager": "pnpm@9.6.0",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
20
|
"types": "./dist/types.d.ts",
|
|
@@ -41,38 +41,35 @@
|
|
|
41
41
|
"format": "prettier . --write",
|
|
42
42
|
"test": "vitest run",
|
|
43
43
|
"test:watch": "vitest watch",
|
|
44
|
-
"test:types": "
|
|
44
|
+
"test:types": "vue-tsc --noEmit && nuxi typecheck playground"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@nuxt/kit": "^3.12.
|
|
47
|
+
"@nuxt/kit": "^3.12.4",
|
|
48
48
|
"echarts": "^5.5.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@nuxt/devtools": "^1.3.9",
|
|
52
|
-
"@nuxt/eslint-config": "^0.
|
|
52
|
+
"@nuxt/eslint-config": "^0.5.0",
|
|
53
53
|
"@nuxt/module-builder": "^0.8.1",
|
|
54
|
-
"@nuxt/schema": "^3.12.
|
|
55
|
-
"@nuxt/test-utils": "^3.
|
|
56
|
-
"@types/node": "^20.14.
|
|
54
|
+
"@nuxt/schema": "^3.12.4",
|
|
55
|
+
"@nuxt/test-utils": "^3.14.0",
|
|
56
|
+
"@types/node": "^20.14.14",
|
|
57
57
|
"changelogen": "^0.5.5",
|
|
58
|
-
"eslint": "^9.
|
|
59
|
-
"nuxt": "^3.12.
|
|
60
|
-
"prettier": "^3.3.
|
|
58
|
+
"eslint": "^9.8.0",
|
|
59
|
+
"nuxt": "^3.12.4",
|
|
60
|
+
"prettier": "^3.3.3",
|
|
61
61
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
62
|
-
"typescript": "^5.5.
|
|
63
|
-
"vite": "^5.3.
|
|
64
|
-
"vitest": "^
|
|
65
|
-
"vue-tsc": "^2.0.
|
|
62
|
+
"typescript": "^5.5.4",
|
|
63
|
+
"vite": "^5.3.5",
|
|
64
|
+
"vitest": "^2.0.5",
|
|
65
|
+
"vue-tsc": "^2.0.29"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"echarts": "^5.5.
|
|
68
|
+
"echarts": "^5.5.1"
|
|
69
69
|
},
|
|
70
70
|
"pnpm": {
|
|
71
71
|
"peerDependencyRules": {
|
|
72
72
|
"allowedVersions": {
|
|
73
|
-
"@typescript-eslint/eslint-plugin>eslint": "^9.0.0",
|
|
74
|
-
"@typescript-eslint/parser>eslint": "^9.0.0",
|
|
75
|
-
"@typescript-eslint/type-utils>eslint": "^9.0.0",
|
|
76
73
|
"@typescript-eslint/utils>eslint": "^9.0.0"
|
|
77
74
|
},
|
|
78
75
|
"ignoreMissing": [
|