mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-10-29 16:07:26 +08:00
feat: improve typings for mouse events
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 6.4.1
|
||||||
|
|
||||||
|
* Improve typings for mouse event params.
|
||||||
|
|
||||||
## 6.4.0
|
## 6.4.0
|
||||||
|
|
||||||
* Delay the disposal of the ECharts instance to the moment the element is disconnected from the DOM if possible (#433).
|
* Delay the disposal of the ECharts instance to the moment the element is disconnected from the DOM if possible (#433).
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-echarts",
|
"name": "vue-echarts",
|
||||||
"version": "6.4.0",
|
"version": "6.4.1",
|
||||||
"description": "Vue.js component for Apache ECharts.",
|
"description": "Vue.js component for Apache ECharts.",
|
||||||
"author": "GU Yiling <justice360@gmail.com>",
|
"author": "GU Yiling <justice360@gmail.com>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
29
src/types.ts
29
src/types.ts
@ -20,7 +20,7 @@ export type EventTarget = EChartsType | ZRenderType;
|
|||||||
type SetOptionType = EChartsType["setOption"];
|
type SetOptionType = EChartsType["setOption"];
|
||||||
export type Option = Parameters<SetOptionType>[0];
|
export type Option = Parameters<SetOptionType>[0];
|
||||||
|
|
||||||
type EChartsEventName =
|
type EChartsMouseEventName =
|
||||||
| "click"
|
| "click"
|
||||||
| "dblclick"
|
| "dblclick"
|
||||||
| "mousedown"
|
| "mousedown"
|
||||||
@ -29,7 +29,8 @@ type EChartsEventName =
|
|||||||
| "mouseover"
|
| "mouseover"
|
||||||
| "mouseout"
|
| "mouseout"
|
||||||
| "globalout"
|
| "globalout"
|
||||||
| "contextmenu"
|
| "contextmenu";
|
||||||
|
type EChartsOtherEventName =
|
||||||
| "highlight"
|
| "highlight"
|
||||||
| "downplay"
|
| "downplay"
|
||||||
| "selectchanged"
|
| "selectchanged"
|
||||||
@ -77,7 +78,25 @@ type ZRenderEventName =
|
|||||||
| "dragover"
|
| "dragover"
|
||||||
| "drop"
|
| "drop"
|
||||||
| "globalout";
|
| "globalout";
|
||||||
type EventName = EChartsEventName | `zr:${ZRenderEventName}`;
|
type OtherEventName = EChartsOtherEventName | `zr:${ZRenderEventName}`;
|
||||||
export type Emits = {
|
|
||||||
[key in EventName]: null;
|
// See https://echarts.apache.org/en/api.html#events.Mouse%20events
|
||||||
|
interface MouseEventParams {
|
||||||
|
componentType: string;
|
||||||
|
seriesType: string;
|
||||||
|
seriesIndex: number;
|
||||||
|
seriesName: string;
|
||||||
|
name: string;
|
||||||
|
dataIndex: number;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type MouseEmits = {
|
||||||
|
[k in EChartsMouseEventName]: (params: MouseEventParams) => boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type OtherEmits = {
|
||||||
|
[key in OtherEventName]: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Emits = MouseEmits & OtherEmits;
|
||||||
|
|||||||
Reference in New Issue
Block a user