Skip to content

Commit

Permalink
fix: fix type for autoresize, closes #800
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Aug 3, 2024
1 parent b366b31 commit beec263
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 7.0.1

* Fixed type for `autoresize`.

## 7.0.0

> Other prerelease changes:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-echarts",
"version": "7.0.0",
"version": "7.0.1",
"description": "Vue.js component for Apache ECharts™.",
"license": "MIT",
"repository": "https://github.com/ecomfe/vue-echarts.git",
Expand Down
13 changes: 3 additions & 10 deletions src/composables/autoresize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@ import { watch } from "vue-demi";
import { throttle } from "echarts/core";

import type { Ref, PropType } from "vue-demi";
import type { EChartsType } from "../types";

type AutoresizeProp =
| boolean
| {
throttle?: number;
onResize?: () => void;
};
import type { EChartsType, AutoResize } from "../types";

export function useAutoresize(
chart: Ref<EChartsType | undefined>,
autoresize: Ref<AutoresizeProp | undefined>,
autoresize: Ref<AutoResize | undefined>,
root: Ref<HTMLElement | undefined>
): void {
watch(
Expand Down Expand Up @@ -63,5 +56,5 @@ export function useAutoresize(
}

export const autoresizeProps = {
autoresize: [Boolean, Object] as PropType<AutoresizeProp>
autoresize: [Boolean, Object] as PropType<AutoResize>
};
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export type EventTarget = EChartsType | ZRenderType;
type SetOptionType = EChartsType["setOption"];
export type Option = Parameters<SetOptionType>[0];

export type AutoResize =
| boolean
| {
throttle?: number;
onResize?: () => void;
};

export type LoadingOptions = {
text?: string;
textColor?: string;
Expand Down

0 comments on commit beec263

Please sign in to comment.