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

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