@visactor/taro-vchart 1.11.1-alpha.2 → 1.11.1-alpha.4

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.
Files changed (2) hide show
  1. package/lib/src/index.js +17 -10
  2. package/package.json +4 -4
package/lib/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { View, Canvas } from '@tarojs/components';
3
3
  import Taro from '@tarojs/taro';
4
- import { VChart as VChart$1, registerLarkEnv, registerWXEnv } from '@visactor/vchart/build/es5';
4
+ import { VChart as VChart$1, registerLarkEnv, registerTTEnv, registerWXEnv } from '@visactor/vchart/build/es5';
5
5
 
6
6
  /*! *****************************************************************************
7
7
  Copyright (c) Microsoft Corporation.
@@ -250,8 +250,8 @@ class GeneralChart extends React.Component {
250
250
  console.error(`未找到 #${this.props.canvasId} 组件`);
251
251
  return;
252
252
  }
253
- if (this.props.mode === 'wx') {
254
- // 微信小程序环境特殊处理
253
+ if (this.props.mode === 'wx' || this.props.mode === 'tt') {
254
+ // 微信小程序和TT小程序环境特殊处理
255
255
  const canvasIdLists = [
256
256
  `${this.props.canvasId}_draw_canvas`,
257
257
  `${this.props.canvasId}_tooltip_canvas`,
@@ -260,7 +260,13 @@ class GeneralChart extends React.Component {
260
260
  const { chartConstructor } = this.props;
261
261
  const { vglobal } = chartConstructor;
262
262
  if (vglobal) {
263
- yield vglobal.setEnv('wx', { domref, force: true, canvasIdLists, freeCanvasIdx: 2, component: undefined });
263
+ yield vglobal.setEnv(this.props.mode, {
264
+ domref,
265
+ force: true,
266
+ canvasIdLists,
267
+ freeCanvasIdx: 2,
268
+ component: undefined
269
+ });
264
270
  }
265
271
  }
266
272
  domref.id = this.props.canvasId;
@@ -299,10 +305,11 @@ class GeneralChart extends React.Component {
299
305
  }
300
306
  };
301
307
  const { canvasId, style = {} } = this.props;
308
+ const type = this.props.mode === 'wx' || this.props.mode === 'tt' ? '2d' : undefined;
302
309
  return (React.createElement(View, { key: canvasId, style: Object.assign(Object.assign(Object.assign({}, style_container), style), { padding: 0 }) },
303
- React.createElement(Canvas, { type: this.props.mode === 'wx' ? '2d' : undefined, style: Object.assign({}, style_cs_tooltip_canvas), id: `${canvasId}_tooltip_canvas`, canvasId: `${canvasId}_tooltip_canvas` }),
304
- React.createElement(Canvas, { type: this.props.mode === 'wx' ? '2d' : undefined, onTouchStart: handleEvent, onTouchMove: handleEvent, onTouchEnd: handleEvent, style: style_cs_canvas, id: `${canvasId}_draw_canvas`, canvasId: `${canvasId}_draw_canvas` }),
305
- React.createElement(Canvas, { type: this.props.mode === 'wx' ? '2d' : undefined, style: Object.assign(Object.assign({}, style_cs_canvas), style_cs_canvas_hidden), id: `${canvasId}_hidden_canvas`, canvasId: `${canvasId}_hidden_canvas` })));
310
+ React.createElement(Canvas, { type: type, style: Object.assign({}, style_cs_tooltip_canvas), id: `${canvasId}_tooltip_canvas`, canvasId: `${canvasId}_tooltip_canvas` }),
311
+ React.createElement(Canvas, { type: type, onTouchStart: handleEvent, onTouchMove: handleEvent, onTouchEnd: handleEvent, style: style_cs_canvas, id: `${canvasId}_draw_canvas`, canvasId: `${canvasId}_draw_canvas` }),
312
+ React.createElement(Canvas, { type: type, style: Object.assign(Object.assign({}, style_cs_canvas), style_cs_canvas_hidden), id: `${canvasId}_hidden_canvas`, canvasId: `${canvasId}_hidden_canvas` })));
306
313
  }
307
314
  }
308
315
 
@@ -314,7 +321,7 @@ function VChartSimple(_a) {
314
321
  return React.createElement(GeneralChart, Object.assign({}, args, { mode: "miniApp" }));
315
322
  },
316
323
  tt: () => {
317
- return React.createElement(GeneralChart, Object.assign({}, args, { mode: "miniApp" }));
324
+ return React.createElement(GeneralChart, Object.assign({}, args, { mode: "tt" }));
318
325
  },
319
326
  weapp: () => {
320
327
  return React.createElement(GeneralChart, Object.assign({}, args, { mode: "wx" }));
@@ -344,8 +351,8 @@ function VChart(_a) {
344
351
  return React.createElement(GeneralChart, Object.assign({}, props, { mode: "miniApp" }));
345
352
  },
346
353
  tt: () => {
347
- registerLarkEnv();
348
- return React.createElement(GeneralChart, Object.assign({}, props, { mode: "miniApp" }));
354
+ registerTTEnv();
355
+ return React.createElement(GeneralChart, Object.assign({}, props, { mode: "tt" }));
349
356
  },
350
357
  weapp: () => {
351
358
  registerWXEnv();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/taro-vchart",
3
- "version": "1.11.1-alpha.2",
3
+ "version": "1.11.1-alpha.4",
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.11.1-alpha.2"
34
+ "@visactor/vchart": "1.11.1-alpha.4"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rushstack/eslint-patch": "~1.1.4",
@@ -72,8 +72,8 @@
72
72
  "stylelint": "9.3.0",
73
73
  "tslib": "2.3.1",
74
74
  "rimraf": "3.0.2",
75
- "@internal/eslint-config": "0.0.1",
76
- "@internal/ts-config": "0.0.1"
75
+ "@internal/ts-config": "0.0.1",
76
+ "@internal/eslint-config": "0.0.1"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public",