提交 fc4c8b37 编写于 作者: P pissang

ts: bug fixes

上级 b9637180
......@@ -15,6 +15,7 @@
"scripts": {
"prepublish": "node build/build.js --prepublish",
"build": "node build/build.js",
"build:full": "node build/build.js --clean",
"watch": "node build/build.js --watch",
"release": "node build/build.js --release",
"help": "node build/build.js --help",
......
......@@ -948,6 +948,6 @@ function toIntTimes(times: number) {
: Math.ceil(times);
}
ComponentView.registerClass(PictorialBarView);
ChartView.registerClass(PictorialBarView);
export default PictorialBarView;
\ No newline at end of file
......@@ -465,4 +465,6 @@ class GaugeView extends ChartView {
}
}
ChartView.registerClass(GaugeView);
export default GaugeView;
......@@ -37,7 +37,10 @@ class HeatmapLayer {
private _brushCanvas: HTMLCanvasElement
private _gradientPixels: Record<ColorState, Uint8ClampedArray>
private _gradientPixels: Record<ColorState, Uint8ClampedArray> = {
inRange: null,
outOfRange: null
}
constructor() {
var canvas = zrUtil.createCanvas();
......
......@@ -129,7 +129,7 @@ class EffectLine extends graphic.Group {
// Ignore when updating
symbol.ignore = true;
this._updateAnimationPoints(symbol, points);
this.updateAnimationPoints(symbol, points);
if (constantSpeed > 0) {
period = this._getLineLength(symbol) / constantSpeed * 1000;
......@@ -176,7 +176,7 @@ class EffectLine extends graphic.Group {
+ vec2.dist(symbol.__cp1, symbol.__p2));
}
private _updateAnimationPoints(symbol: ECSymbolOnEffectLine, points: number[][]) {
protected updateAnimationPoints(symbol: ECSymbolOnEffectLine, points: number[][]) {
symbol.__p1 = points[0];
symbol.__p2 = points[1];
symbol.__cp1 = points[2] || [
......
......@@ -38,7 +38,7 @@ class EffectPolyline extends EffectLine {
};
// Override
updateAnimationPoints(symbol: ECSymbolOnEffectLine, points: number[][]) {
protected updateAnimationPoints(symbol: ECSymbolOnEffectLine, points: number[][]) {
this._points = points;
var accLenArr = [0];
var len = 0;
......
......@@ -86,7 +86,7 @@ class ECLinePath extends graphic.Path<ECLineProps> {
var shape = this.shape;
var p = isStraightLine(shape)
? [shape.x2 - shape.x1, shape.y2 - shape.y1]
: bezierCurveProto.tangentAt(t);
: bezierCurveProto.tangentAt.call(this, t);
return vec2.normalize(p, p);
}
......
......@@ -340,4 +340,6 @@ class ThemeRiverSeriesModel extends SeriesModel<ThemeRiverSeriesOption> {
}
}
SeriesModel.registerClass(ThemeRiverSeriesModel);
export default ThemeRiverSeriesModel;
\ No newline at end of file
......@@ -27,6 +27,7 @@ import SingleAxisModel from '../../coord/single/AxisModel';
import GlobalModel from '../../model/Global';
import ExtensionAPI from '../../ExtensionAPI';
import { Payload } from '../../util/types';
import ComponentView from '../../view/Component';
var axisBuilderAttrs = [
'axisLine', 'axisTickLabel', 'axisName'
......@@ -158,4 +159,6 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu
}
};
ComponentView.registerClass(SingleAxisView);
export default SingleAxisView;
......@@ -76,6 +76,7 @@ function updateMarkerLayout(
class MarkPointView extends MarkerView {
static type = 'markPoint'
type = MarkPointView.type
markerGroupMap: HashMap<SymbolDraw>
......
......@@ -430,7 +430,7 @@ class PiecewiseModel extends VisualMapModel<PiecewiseVisualMapOption> {
};
type ResetMethod = (pieceList: InnerVisualPiece[]) => void;
type ResetMethod = (outPieceList: InnerVisualPiece[]) => void;
/**
* Key is this._mode
* @type {Object}
......@@ -438,7 +438,7 @@ type ResetMethod = (pieceList: InnerVisualPiece[]) => void;
*/
var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
splitNumber(pieceList) {
splitNumber(outPieceList) {
var thisOption = this.option;
var precision = Math.min(thisOption.precision, 20);
var dataExtent = this.getExtent();
......@@ -457,7 +457,7 @@ var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
var index = 0;
if (thisOption.minOpen) {
pieceList.push({
outPieceList.push({
index: index++,
interval: [-Infinity, dataExtent[0]],
close: [0, 0]
......@@ -471,7 +471,7 @@ var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
) {
var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
pieceList.push({
outPieceList.push({
index: index++,
interval: [curr, max],
close: [1, 1]
......@@ -479,36 +479,36 @@ var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
}
if (thisOption.maxOpen) {
pieceList.push({
outPieceList.push({
index: index++,
interval: [dataExtent[1], Infinity],
close: [0, 0]
});
}
reformIntervals(pieceList as Required<InnerVisualPiece>[]);
reformIntervals(outPieceList as Required<InnerVisualPiece>[]);
zrUtil.each(pieceList, function (piece) {
zrUtil.each(outPieceList, function (piece) {
piece.text = this.formatValueText(piece.interval);
}, this);
},
categories(pieceList) {
categories(outPieceList) {
var thisOption = this.option;
zrUtil.each(thisOption.categories, function (cate) {
// FIXME category模式也使用pieceList,但在visualMapping中不是使用pieceList。
// 是否改一致。
pieceList.push({
outPieceList.push({
text: this.formatValueText(cate, true),
value: cate
});
}, this);
// See "Order Rule".
normalizeReverse(thisOption, pieceList);
normalizeReverse(thisOption, outPieceList);
},
pieces(pieceList) {
pieces(outPieceList) {
var thisOption = this.option;
zrUtil.each(thisOption.pieces, function (pieceListItem, index) {
......@@ -531,7 +531,7 @@ var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
else {
// `min` `max` is legacy option.
// `lt` `gt` `lte` `gte` is recommanded.
var interval = item.interval = [0, 0];
var interval = item.interval = [] as unknown as [number, number];
var close: typeof item.close = item.close = [0, 0];
var closeList = [1, 0, 1] as const;
......@@ -568,16 +568,16 @@ var resetMethods: Dictionary<ResetMethod> & ThisType<PiecewiseModel> = {
item.visual = VisualMapping.retrieveVisuals(pieceListItem);
pieceList.push(item);
outPieceList.push(item);
}, this);
// See "Order Rule".
normalizeReverse(thisOption, pieceList);
normalizeReverse(thisOption, outPieceList);
// Only pieces
reformIntervals(pieceList as Required<InnerVisualPiece>[]);
reformIntervals(outPieceList as Required<InnerVisualPiece>[]);
zrUtil.each(pieceList, function (piece) {
zrUtil.each(outPieceList, function (piece) {
var close = piece.close;
var edgeSymbols = [['<', ''][close[1]], ['>', ''][close[0]]];
piece.text = piece.text || this.formatValueText(
......
......@@ -23,9 +23,11 @@ import Cartesian from './Cartesian';
import { ScaleDataValue } from '../../util/types';
import Axis2D from './Axis2D';
import { CoordinateSystem } from '../CoordinateSystem';
import Grid, {cartesian2DDimensions} from './Grid';
import Grid from './Grid';
import GridModel from './GridModel';
export const cartesian2DDimensions = ['x', 'y'];
class Cartesian2D extends Cartesian<Axis2D> implements CoordinateSystem {
readonly type = 'cartesian2d';
......
......@@ -32,7 +32,7 @@ import {
niceScaleExtent,
estimateLabelUnionRect
} from '../../coord/axisHelper';
import Cartesian2D from './Cartesian2D';
import Cartesian2D, {cartesian2DDimensions} from './Cartesian2D';
import Axis2D from './Axis2D';
import CoordinateSystemManager from '../../CoordinateSystem';
import {getStackedDimension} from '../../data/helper/dataStackHelper';
......@@ -50,7 +50,6 @@ import List from '../../data/List';
import SeriesModel from '../../model/Series';
export const cartesian2DDimensions = ['x', 'y'];
type Cartesian2DDimensionName = 'x' | 'y';
type FinderAxisIndex = {xAxisIndex?: number, yAxisIndex?: number};
......
......@@ -105,7 +105,7 @@ ComponentModel.registerClass(SingleAxisModel);
interface SingleAxisModel extends AxisModelCommonMixin<SingleAxisOption>,
AxisModelExtendedInCreator<SingleAxisOption> {}
zrUtil.mixin(SingleAxisModel, {AxisModelCommonMixin});
zrUtil.mixin(SingleAxisModel, AxisModelCommonMixin.prototype);
axisModelCreator('single', SingleAxisModel, SingleAxisModel.defaultOption);
......
......@@ -147,7 +147,8 @@ export interface CheckableConstructor {
isInstance: (ins: any) => boolean;
}
var classBase = 0;
// A random offset.
var classBase = Math.round(Math.random() * 10);
/**
* Implements `CheckableConstructor` for `target`.
......@@ -163,7 +164,7 @@ var classBase = 0;
* ```
*/
export function enableClassCheck(target: CheckableConstructor): void {
var classAttr = ['__\0is_clz', classBase++, Math.random().toFixed(3)].join('_');
var classAttr = ['__\0is_clz', classBase++].join('_');
target.prototype[classAttr] = true;
if (__DEV__) {
......
......@@ -22,7 +22,9 @@ import {parseClassType, ClassManager} from './clazz';
import { ComponentOption, ComponentMainType, ComponentSubType, ComponentFullType } from './types';
import { Dictionary } from 'zrender/src/core/types';
var base = 0;
// A random offset
var base = Math.round(Math.random() * 10);
/**
* @public
......@@ -32,7 +34,7 @@ var base = 0;
export function getUID(type: string): string {
// Considering the case of crossing js context,
// use Math.random to make id as unique as possible.
return [(type || ''), base++, Math.random().toFixed(5)].join('_');
return [(type || ''), base++].join('_');
}
export interface SubTypeDefaulter {
......
......@@ -70,13 +70,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/chart/bar',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('mainH');
......@@ -179,12 +172,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('mainZ');
......@@ -286,12 +273,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('mainX0');
......@@ -376,12 +357,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('mainX');
......@@ -462,12 +437,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('mainX2');
......@@ -550,12 +519,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('main0');
......@@ -650,12 +613,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('main1');
......@@ -740,12 +697,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('main2');
......@@ -839,12 +790,6 @@ under the License.
require([
'echarts'
// 'echarts/chart/line',
// 'echarts/component/legend',
// 'echarts/component/grid',
// 'echarts/component/tooltip',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (echarts) {
var main = document.getElementById('main4');
......
......@@ -178,6 +178,7 @@ function startTests(testsNameList, socket, {
function checkPuppeteer() {
try {
const packageConfig = require('puppeteer/package.json');
console.log(`puppeteer version: ${packageConfig.version}`)
return semver.satisfies(packageConfig.version, '>=1.19.0');
}
catch (e) {
......
......@@ -126,11 +126,11 @@ module.exports.buildRuntimeCode = async function () {
}
]
});
const output = await bundle.generate({
const { output } = await bundle.generate({
format: 'iife',
name: 'autorun'
});
return output.code;
return output[0].code;
};
module.exports.waitTime = function (time) {
......
......@@ -305,7 +305,9 @@ under the License.
inverse: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorSaturation'
inRange: {
colorSaturation: [0.3, 1]
}
});
makeChart({
right: 0,
......@@ -315,7 +317,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorLightness'
inRange: {
colorLightness: [0.9, 0.5]
}
});
makeChart({
top: 40,
......@@ -324,7 +328,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorAlpha'
inRange: {
colorAlpha: [0.3, 1]
}
});
makeChart({
left: 'center',
......@@ -334,7 +340,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorAlpha'
inRange: {
colorAlpha: [0.3, 1]
}
});
......@@ -392,7 +400,9 @@ under the License.
inverse: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorSaturation'
inRange: {
colorSaturation: [0.3, 1]
}
});
makeChart({
right: 0,
......@@ -404,7 +414,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorLightness'
inRange: {
colorLightness: [0.9, 0.5]
}
});
makeChart({
top: 40,
......@@ -414,7 +426,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorAlpha'
inRange: {
colorAlpha: [0.3, 1]
}
});
makeChart({
left: 'center',
......@@ -425,7 +439,9 @@ under the License.
calculable: true,
dimension: 3,
backgroundColor: '#eee',
inRange: 'colorAlpha'
inRange: {
colorAlpha: [0.3, 1]
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册