Skip to content

Commit

Permalink
fix(src): require 引入方式切换成import
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Mar 1, 2019
1 parent 3745540 commit 988afc1
Show file tree
Hide file tree
Showing 68 changed files with 295 additions and 934 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
bundler/
coverage/
lib/
dist/
Expand All @@ -7,3 +8,5 @@ node_modules/
demos/assets/
demos/index.html
demos/*
rollup/*
webpack/*
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"G2": true,
"_": true,
"mapboxgl":true,
"dat" : true
"dat" : true,
},
"env": {
"browser": true,
"node": true
},
"parser": "babel-eslint",
"parserOptions": {
Expand Down
8 changes: 4 additions & 4 deletions src/attr/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @fileOverview the Attribute base class
* @author huangtonger@aliyun.com
*/
const ColorUtil = require('./color-util');
const Util = require('../util');
import ColorUtil from './color-util';
import Util from '../util';

function toScaleString(scale, value) {
if (Util.isString(value)) {
Expand Down Expand Up @@ -171,7 +171,7 @@ class AttributeBase {
}
if (this.type === 'color' && !Util.isArray(values)) {
values = ColorUtil.toRGB(values).map(e => e / 255);
// values[3] = values[3] * 255;
// values[3] = values[3] * 255;
}
if (!Util.isArray(values)) {
values = [ values ];
Expand All @@ -196,4 +196,4 @@ class AttributeBase {
}
}

module.exports = AttributeBase;
export default AttributeBase;
7 changes: 3 additions & 4 deletions src/attr/color-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* @fileOverview 颜色计算的辅助方法
* @author dxq613@gmail.com
*/

const Util = require('../util');
import Util from '../util';
const RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
// const RGBA_REG = /rgba\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(\d+)\s*\)/;

Expand Down Expand Up @@ -80,7 +79,7 @@ const ColorUtil = {
}
return rst;
},
// 转成 WebGl color buffer
// 转成 WebGl color buffer
color2Arr(str) {
const rgba = this.toRGB(str);
return rgba.map(v => v / 255);
Expand Down Expand Up @@ -112,4 +111,4 @@ const ColorUtil = {
}
};

module.exports = ColorUtil;
export default ColorUtil;
9 changes: 4 additions & 5 deletions src/attr/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
* @fileOverview the color attribute of core
* @author huangtonger@aliyun.com
*/

const ColorUtil = require('./color-util');
const Base = require('./base');
const Util = require('../util');
import ColorUtil from './color-util';
import Base from './base';
import Util from '../util';

/**
* 视觉通道 color
Expand Down Expand Up @@ -38,4 +37,4 @@ class Color extends Base {
}
}

module.exports = Color;
export default Color;
2 changes: 1 addition & 1 deletion src/attr/colorscales.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/attr/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @Last Modified time: 2018-07-15 17:26:40
*/

const Base = require('./base');
import Base from './base';

/**
* 视觉通道 symbol
Expand All @@ -19,4 +19,4 @@ class Filter extends Base {
this.gradient = null;
}
}
module.exports = Filter;
export default Filter;
27 changes: 18 additions & 9 deletions src/attr/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@

const Base = require('./base');
Base.Color = require('./color');
Base.Size = require('./size');
Base.Opacity = require('./opacity');
Base.Shape = require('./shape');
Base.Position = require('./position');
Base.Symbol = require('./symbol');
Base.Filter = require('./filter');
module.exports = Base;
import Base from './base';
import Color from './color';
import Size from './size';
import Opacity from './opacity';
import Shape from './shape';
import Position from './position';
import Symbol from './symbol';
import Filter from './filter';

Base.Color = Color;
Base.Size = Size;
Base.Opacity = Opacity;
Base.Shape = Shape;
Base.Position = Position;
Base.Symbol = Symbol;
Base.Filter = Filter;

export default Base;
4 changes: 2 additions & 2 deletions src/attr/opacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author huangtonger@aliyun.com
*/

const Base = require('./base');
import Base from './base';

/**
* 视觉通道 Opacity
Expand All @@ -18,4 +18,4 @@ class Opacity extends Base {
}
}

module.exports = Opacity;
export default Opacity;
6 changes: 3 additions & 3 deletions src/attr/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/


const Util = require('../util');
const Base = require('./base');
import Base from './base';
import Util from '../util';

class Position extends Base {
constructor(cfg) {
Expand Down Expand Up @@ -88,4 +88,4 @@ class Position extends Base {
}
}

module.exports = Position;
export default Position;
6 changes: 3 additions & 3 deletions src/attr/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/


const Base = require('./base');
import Base from './base';

/**
* 视觉通道 Shape
Expand All @@ -26,7 +26,7 @@ class Shape extends Base {
const index = Math.round((values.length - 1) * percent);
return values[index];
}
/**
/**
* @override
*/
_getAttrValue(scale, value) {
Expand All @@ -41,4 +41,4 @@ class Shape extends Base {
}
}

module.exports = Shape;
export default Shape;
8 changes: 4 additions & 4 deletions src/attr/size.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @author huangtonger@aliyun.com
*/

const Base = require('./base');
const Util = require('../util');
import Base from './base';
import Util from '../util';

/**
* 视觉通道 size
Expand All @@ -20,7 +20,7 @@ class Size extends Base {
}

mapping() {
// 重构
// 重构
const self = this;
const outputs = [];
const scales = self.scales;
Expand Down Expand Up @@ -62,4 +62,4 @@ class Size extends Base {

}

module.exports = Size;
export default Size;
4 changes: 2 additions & 2 deletions src/attr/symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @Last Modified time: 2018-07-02 18:24:58
*/

const Base = require('./base');
import Base from './base';

/**
* 视觉通道 symbol
Expand All @@ -19,4 +19,4 @@ class Symbol extends Base {
this.gradient = null;
}
}
module.exports = Symbol;
export default Symbol;
12 changes: 0 additions & 12 deletions src/component/index.js

This file was deleted.

Loading

0 comments on commit 988afc1

Please sign in to comment.