mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-10-28 23:48:21 +08:00
types: improve typings for vue 2
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 6.0.3
|
||||||
|
|
||||||
|
* Improved typings for Vue 2 version.
|
||||||
|
|
||||||
## 6.0.2
|
## 6.0.2
|
||||||
|
|
||||||
* Make `notMerge` option still respect `update-options`.
|
* Make `notMerge` option still respect `update-options`.
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-echarts",
|
"name": "vue-echarts",
|
||||||
"version": "6.0.2",
|
"version": "6.0.3",
|
||||||
"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": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "npm run docs && rimraf dist && rollup -c rollup.config.js && cp src/index.vue2.d.ts dist",
|
"build": "npm run docs && rimraf dist && rollup -c rollup.config.js",
|
||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
"build:demo": "vue-cli-service build",
|
"build:demo": "vue-cli-service build",
|
||||||
"docs": "node -r esm ./scripts/docs.js",
|
"docs": "node -r esm ./scripts/docs.js",
|
||||||
|
|||||||
@ -97,6 +97,14 @@ const options = [
|
|||||||
file: "dist/index.d.ts",
|
file: "dist/index.d.ts",
|
||||||
format: "es"
|
format: "es"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "src/index.vue2.d.ts",
|
||||||
|
plugins: [dts()],
|
||||||
|
output: {
|
||||||
|
file: "dist/index.vue2.d.ts",
|
||||||
|
format: "es"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
51
src/index.vue2.d.ts
vendored
51
src/index.vue2.d.ts
vendored
@ -1,10 +1,55 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
|
import { DefineComponent } from "@vue/runtime-dom";
|
||||||
|
import { Ref } from "@vue/composition-api";
|
||||||
|
import { Option, InitOptions, UpdateOptions, EChartsType } from "./types";
|
||||||
|
|
||||||
declare const LOADING_OPTIONS_KEY = "ecLoadingOptions";
|
declare const LOADING_OPTIONS_KEY = "ecLoadingOptions";
|
||||||
declare const THEME_KEY = "ecTheme";
|
declare const THEME_KEY = "ecTheme";
|
||||||
declare const INIT_OPTIONS_KEY = "ecInitOptions";
|
declare const INIT_OPTIONS_KEY = "ecInitOptions";
|
||||||
declare const UPDATE_OPTIONS_KEY = "ecUpdateOptions";
|
declare const UPDATE_OPTIONS_KEY = "ecUpdateOptions";
|
||||||
|
|
||||||
declare const _default: any;
|
declare type ChartProps = {
|
||||||
|
loading?: boolean;
|
||||||
|
loadingOptions?: Record<string, unknown>;
|
||||||
|
autoresize?: boolean;
|
||||||
|
option?: Option;
|
||||||
|
theme?: string | Record<string, unknown>;
|
||||||
|
initOptions?: InitOptions;
|
||||||
|
updateOptions?: UpdateOptions;
|
||||||
|
group?: string;
|
||||||
|
manualUpdate?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export default _default;
|
type MethodNames =
|
||||||
|
| "getWidth"
|
||||||
|
| "getHeight"
|
||||||
|
| "getDom"
|
||||||
|
| "getOption"
|
||||||
|
| "resize"
|
||||||
|
| "dispatchAction"
|
||||||
|
| "convertToPixel"
|
||||||
|
| "convertFromPixel"
|
||||||
|
| "containPixel"
|
||||||
|
| "getDataURL"
|
||||||
|
| "getConnectedDataURL"
|
||||||
|
| "appendData"
|
||||||
|
| "clear"
|
||||||
|
| "isDisposed"
|
||||||
|
| "dispose"
|
||||||
|
| "setOption";
|
||||||
|
|
||||||
|
declare type ChartMethods = Pick<EChartsType, MethodNames>;
|
||||||
|
|
||||||
|
declare const Chart: DefineComponent<
|
||||||
|
ChartProps,
|
||||||
|
{
|
||||||
|
root: Ref<HTMLElement | undefined>;
|
||||||
|
chart: Ref<EChartsType | undefined>;
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
ChartMethods
|
||||||
|
>;
|
||||||
|
|
||||||
|
export default Chart;
|
||||||
export { INIT_OPTIONS_KEY, LOADING_OPTIONS_KEY, THEME_KEY, UPDATE_OPTIONS_KEY };
|
export { INIT_OPTIONS_KEY, LOADING_OPTIONS_KEY, THEME_KEY, UPDATE_OPTIONS_KEY };
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
import { init, SetOptionOpts } from "echarts/core";
|
import { init, SetOptionOpts } from "echarts/core";
|
||||||
import { Ref } from "vue";
|
import { Ref } from "vue";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user