@visactor/taro-vchart 1.6.0-alpha.0 → 1.6.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 CHANGED
@@ -10,15 +10,15 @@ VChart 基于 [Taro](https://docs.taro.zone/docs/) 封装的图表组件。
10
10
 
11
11
  ## 支持环境
12
12
 
13
- 目前组件支持的环境有:**微信小程序**('weapp'),**字节小程序**('tt'),**飞书小程序**('lark'),**浏览器**('h5', 'web')。
13
+ 目前组件支持的环境有:**微信小程序**('weapp'),**字节小程序**('tt'),**飞书小程序**('lark'),**浏览器**('web'),**h5 移动端**('h5')。
14
14
 
15
15
  以上环境通过 `type` 属性进行声明,`type` 属性值及对应环境如下:
16
16
 
17
17
  - `weapp` 微信小程序。
18
18
  - `tt` 字节小程序。
19
19
  - `lark` 飞书小程序。
20
- - `h5` 浏览器环境, 与`web`等价。
21
- - `web` 浏览器环境, 与`h5`等价。
20
+ - `h5` h5 移动端环境。
21
+ - `web` 浏览器环境。
22
22
 
23
23
  ### 跨端支持
24
24
 
@@ -80,17 +80,17 @@ import VChart from '@visactor/taro-vchart';
80
80
  />;
81
81
  ```
82
82
 
83
- | API | 类型 | 说明 |
84
- | ------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
- | type | String | 配置的环境,目前组件支持的环境有:**字节小程序**('tt'),**飞书小程序**('lark'),**浏览器**('h5', 'web') ,如果没有声明,则会通过 `Taro.getEnv()` 自动获取 |
86
- | canvasId | String | 图表 id, 必确唯一 |
87
- | spec | Object | 图表配置项, 请参考[VChart 配置项](https://www.visactor.io/vchart/option/) |
88
- | style | Object | 图表容器样式 |
89
- | events | Object[] | 事件绑定配置,具体配置为定义[如下](#事件配置) |
90
- | options | Object | 初始化 VChart 实例传入的额外配置项,同 [VChart 实例化配置项](https://www.visactor.io/vchart/api/API/vchart#options) |
91
- | onChartInit | Function | 图表初始化完后触发的回调 |
92
- | onChartReady | Function | 图表渲染完毕后触发的回调 |
93
- | onChartUpdate | Function | 图表更新完毕后触发的回调 |
83
+ | API | 类型 | 说明 |
84
+ | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | type | String | 配置的环境,目前组件支持的环境有:**字节小程序**('tt'),**飞书小程序**('lark'),**浏览器**('web'),**h5 移动端**('h5'),如果没有声明,则会通过 `Taro.getEnv()` 自动获取 |
86
+ | canvasId | String | 图表 id, 必确唯一 |
87
+ | spec | Object | 图表配置项, 请参考[VChart 配置项](https://www.visactor.io/vchart/option/) |
88
+ | style | Object | 图表容器样式 |
89
+ | events | Object[] | 事件绑定配置,具体配置为定义[如下](#事件配置) |
90
+ | options | Object | 初始化 VChart 实例传入的额外配置项,同 [VChart 实例化配置项](https://www.visactor.io/vchart/api/API/vchart#options) |
91
+ | onChartInit | Function | 图表初始化完后触发的回调 |
92
+ | onChartReady | Function | 图表渲染完毕后触发的回调 |
93
+ | onChartUpdate | Function | 图表更新完毕后触发的回调 |
94
94
 
95
95
  ### 事件配置
96
96
 
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
- import { IChartProps } from '../../typings';
3
- export declare class WebChart extends React.Component<IChartProps> {
2
+ import { IChartProps, RenderMode } from '../../typings';
3
+ export interface WebChartProps extends IChartProps {
4
+ /**
5
+ * vchart 的环境参数
6
+ */
7
+ mode?: RenderMode;
8
+ }
9
+ export declare class WebChart extends React.Component<WebChartProps> {
4
10
  private vchart;
5
11
  constructor(props: IChartProps);
6
12
  componentDidMount(): void;
package/lib/src/index.js CHANGED
@@ -45,8 +45,8 @@ class WebChart extends React.Component {
45
45
  super(props);
46
46
  }
47
47
  componentDidMount() {
48
- const { onChartInit, onChartReady } = this.props;
49
- this.vchart = new VChart$1(this.props.spec, Object.assign({ dom: `${this.props.canvasId}` }, this.props.options));
48
+ const { onChartInit, onChartReady, mode } = this.props;
49
+ this.vchart = new VChart$1(this.props.spec, Object.assign({ dom: `${this.props.canvasId}`, mode }, this.props.options));
50
50
  onChartInit && onChartInit(this.vchart);
51
51
  this.vchart
52
52
  .renderAsync()
@@ -312,7 +312,7 @@ function VChart(_a) {
312
312
  return React.createElement(WebChart, Object.assign({}, args));
313
313
  },
314
314
  h5: () => {
315
- return React.createElement(WebChart, Object.assign({}, args));
315
+ return React.createElement(WebChart, Object.assign({}, args, { mode: "mobile-browser" }));
316
316
  }
317
317
  };
318
318
  if (env && strategies[env] !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/taro-vchart",
3
- "version": "1.6.0-alpha.0",
3
+ "version": "1.6.0",
4
4
  "description": "Taro VChart 图表组件",
5
5
  "sideEffects": false,
6
6
  "main": "lib/src/index.js",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@visactor/vchart": "1.6.0-alpha.0"
34
+ "@visactor/vchart": "1.6.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rushstack/eslint-patch": "~1.1.4",