mirror of
https://gitee.com/antv/g6.git
synced 2024-12-04 04:38:55 +08:00
Merge branch 'master' of https://github.com/antvis/g6 into dev3.1.0
This commit is contained in:
commit
8984d308ad
@ -1,7 +1,7 @@
|
||||
# Contribution Guide
|
||||
|
||||
If you have any comment or advice, please report your [issue](https://github.com/antvis/g2/issues),
|
||||
or make any change as you wish and submit an [PR](https://github.com/antvis/g2/pulls).
|
||||
If you have any comment or advice, please report your [issue](https://github.com/antvis/g6/issues),
|
||||
or make any change as you wish and submit an [PR](https://github.com/antvis/g6/pulls).
|
||||
|
||||
## Reporting New Issues
|
||||
|
||||
@ -30,14 +30,14 @@ $ git commit -m "fix(role): role.use must xxx"
|
||||
$ git push origin branch-name
|
||||
```
|
||||
|
||||
Then you can create a Pull Request at [g2](https://github.com/antvis/g2/pulls).
|
||||
Then you can create a Pull Request at [g6](https://github.com/antvis/g6/pulls).
|
||||
|
||||
No one can guarantee how much will be remembered about certain PR after some time. To make sure we can easily recap what happened previously, please provide the following information in your PR.
|
||||
|
||||
1. Need: What function you want to achieve (Generally, please point out which issue is related).
|
||||
2. Updating Reason: Different with issue. Briefly describe your reason and logic about why you need to make such modification.
|
||||
3. Related Testing: Briefly describe what part of testing is relevant to your modification.
|
||||
4. User Tips: Notice for g2 users. You can skip this part, if the PR is not about update in API or potential compatibility problem.
|
||||
4. User Tips: Notice for g6 users. You can skip this part, if the PR is not about update in API or potential compatibility problem.
|
||||
|
||||
### Style Guide
|
||||
|
||||
@ -95,7 +95,7 @@ Older IEs serialize html uppercased, but IE9 does not...
|
||||
Would be better to expect case insensitive, unfortunately jasmine does
|
||||
not allow to user regexps for throw expectations.
|
||||
|
||||
Document change on antvis/g2#123
|
||||
Document change on antvis/g6#123
|
||||
|
||||
Closes #392
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 代码贡献规范
|
||||
|
||||
有任何疑问,欢迎提交 [issue](https://github.com/antvis/g2/issues),
|
||||
或者直接修改提交 [PR](https://github.com/antvis/g2/pulls)!
|
||||
有任何疑问,欢迎提交 [issue](https://github.com/antvis/g6/issues),
|
||||
或者直接修改提交 [PR](https://github.com/antvis/g6/pulls)!
|
||||
|
||||
## 提交 issue
|
||||
|
||||
@ -31,7 +31,7 @@ $ git commit -m "fix(role): role.use must xxx"
|
||||
$ git push origin branch-name
|
||||
```
|
||||
|
||||
提交后就可以在 [g2](https://github.com/antvis/g2/pulls) 创建 Pull Request 了。
|
||||
提交后就可以在 [g6](https://github.com/antvis/g6/pulls) 创建 Pull Request 了。
|
||||
|
||||
由于谁也无法保证过了多久之后还记得多少,为了后期回溯历史的方便,请在提交 MR 时确保提供了以下信息。
|
||||
|
||||
@ -97,7 +97,7 @@ Older IEs serialize html uppercased, but IE9 does not...
|
||||
Would be better to expect case insensitive, unfortunately jasmine does
|
||||
not allow to user regexps for throw expectations.
|
||||
|
||||
Document change on antvis/g2#12
|
||||
Document change on antvis/g6#12
|
||||
|
||||
Closes #392
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
"version": "3.1.3",
|
||||
"description": "graph visualization frame work",
|
||||
"main": "build/g6.js",
|
||||
"types": "types/index.d.ts",
|
||||
"homepage": "https://github.com/antvis/g6",
|
||||
"author": "https://github.com/orgs/antvis/people",
|
||||
"repository": {
|
||||
|
256
types/g.d.ts
vendored
Normal file
256
types/g.d.ts
vendored
Normal file
@ -0,0 +1,256 @@
|
||||
export namespace G {
|
||||
export type ShapeType =
|
||||
| 'arc'
|
||||
| 'circle'
|
||||
| 'dom'
|
||||
| 'ellipse'
|
||||
| 'fan'
|
||||
| 'image'
|
||||
| 'line'
|
||||
| 'marker'
|
||||
| 'path'
|
||||
| 'polygon'
|
||||
| 'polyline'
|
||||
| 'rect'
|
||||
| 'text';
|
||||
type Item = Shape | Group;
|
||||
type Cfg = { [k in string]: any };
|
||||
type Attrs = { [k in string]: any };
|
||||
interface Box {
|
||||
x: number;
|
||||
y: number;
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
}
|
||||
export interface Group extends Element {
|
||||
new (cfg: Cfg): Group;
|
||||
isGroup: true;
|
||||
type: 'group';
|
||||
canFill: boolean;
|
||||
canStroke: boolean;
|
||||
|
||||
getDefaultCfg(): Cfg;
|
||||
|
||||
addShape(type: ShapeType, cfg: Cfg): Shape;
|
||||
|
||||
/** 添加图组
|
||||
* @param {Function|Object|undefined} param 图组类
|
||||
* @param {Object} cfg 配置项
|
||||
* @return {Object} rst 图组
|
||||
*/
|
||||
addGroup(param: Function | Cfg | undefined, cfg: Cfg): Group;
|
||||
|
||||
/** 绘制背景
|
||||
* @param {Array} padding 内边距
|
||||
* @param {Attrs} attrs 图形属性
|
||||
* @return {Object} 背景层对象
|
||||
*/
|
||||
renderBack(padding: [number, number, number, number], attrs: Attrs): Shape;
|
||||
|
||||
removeChild(item: Item, destroy: boolean): this;
|
||||
|
||||
/**
|
||||
* 向组中添加shape或者group
|
||||
* @param {Object} items 图形或者分组
|
||||
* @return {Object} group 本尊
|
||||
*/
|
||||
add(items: Item[]): this;
|
||||
|
||||
contain(item: Item): boolean;
|
||||
|
||||
getChildByIndex(index: number): any;
|
||||
|
||||
getFirst(): Item;
|
||||
|
||||
getLast(): Item;
|
||||
|
||||
getBBox(): Box;
|
||||
|
||||
getCount(): number;
|
||||
|
||||
sort(): this;
|
||||
|
||||
findById(): Item;
|
||||
|
||||
/**
|
||||
* 根据查找函数查找分组或者图形
|
||||
* @param {Function} fn 匹配函数
|
||||
* @return {Canvas.Base} 分组或者图形
|
||||
*/
|
||||
find(fn: Function | string): Item;
|
||||
|
||||
/**
|
||||
* @param {Function} fn filter mathod
|
||||
* @return {Array} all the matching shapes and groups
|
||||
*/
|
||||
findAll(fn: (...args: any[]) => boolean): Item[];
|
||||
|
||||
/**
|
||||
* @Deprecated
|
||||
*/
|
||||
findBy: Function;
|
||||
/**
|
||||
* @Deprecated
|
||||
*/
|
||||
findAllBy: Function;
|
||||
|
||||
getShape(x: any, y: any): Shape;
|
||||
|
||||
clearTotalMatrix(): void;
|
||||
|
||||
clear(delayRemove?: boolean): this;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
clone(): Group;
|
||||
}
|
||||
export interface Shape extends Element {
|
||||
new (cfg: Cfg): Shape;
|
||||
isPointInPath(x: number, y: number): boolean;
|
||||
isShape: true;
|
||||
|
||||
drawInner(context: any): void;
|
||||
|
||||
/**
|
||||
* 击中图形时是否进行包围盒判断
|
||||
* @return {Boolean} [description]
|
||||
*/
|
||||
isHitBox(): boolean;
|
||||
|
||||
/**
|
||||
* 节点是否能够被击中
|
||||
* @param {Number} x x坐标
|
||||
* @param {Number} y y坐标
|
||||
* @return {Boolean} 是否在图形中
|
||||
*/
|
||||
isHit(x: number, y: number): boolean;
|
||||
|
||||
/**
|
||||
* 获取拾取时线的宽度,需要考虑附加的线的宽度
|
||||
*/
|
||||
getHitLineWidth(): number;
|
||||
|
||||
/**
|
||||
* 清除当前的矩阵
|
||||
*/
|
||||
clearTotalMatrix(): void;
|
||||
|
||||
clearBBox(): void;
|
||||
|
||||
getBBox(): Box;
|
||||
|
||||
clone(): Shape;
|
||||
}
|
||||
|
||||
interface Element extends Attribute, Transform, Animate, AdvancedEventEmitter {
|
||||
new (): Element;
|
||||
init(): void;
|
||||
getParent(): Element;
|
||||
/**
|
||||
* 获取默认的配置信息
|
||||
* @protected
|
||||
* @return {Object} 默认的属性
|
||||
*/
|
||||
getDefaultCfg(): Cfg;
|
||||
set(name: string, value: any): this;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
setSilent: Function;
|
||||
get(name: string): any;
|
||||
show(): this;
|
||||
hide(): this;
|
||||
remove(destroy: boolean | undefined, delayRemove?: boolean): this;
|
||||
destroy(): void;
|
||||
toFront(): void;
|
||||
toBack(): void;
|
||||
setZIndex(zIndex: number): number;
|
||||
clone(): Element;
|
||||
getBBox(): any;
|
||||
}
|
||||
|
||||
interface Attribute {
|
||||
canFill: boolean;
|
||||
canStroke: boolean;
|
||||
initAttrs(attrs: Attrs): this;
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
getDefaultAttrs(): any;
|
||||
/**
|
||||
* 设置或者设置属性,有以下 4 种情形:
|
||||
* - name 不存在, 则返回属性集合
|
||||
* - name 为字符串,value 为空,获取属性值
|
||||
* - name 为字符串,value 不为空,设置属性值,返回 this
|
||||
* - name 为键值对,value 为空,设置属性值
|
||||
*
|
||||
* @param {String | Object} name 属性名
|
||||
* @param {*} value 属性值
|
||||
* @return {*} 属性值
|
||||
*/
|
||||
attr(): Attrs;
|
||||
attr(name: string): any;
|
||||
attr(name: string, value: any): this;
|
||||
attr(attrs: Attrs): this;
|
||||
clearBBox(): void;
|
||||
hasFill(): boolean;
|
||||
hasStroke(): boolean;
|
||||
}
|
||||
|
||||
interface Transform {
|
||||
initTransform(): void;
|
||||
resetMatrix(): void;
|
||||
translate(tx: number, ty: number): this;
|
||||
rotate(radian: number): this;
|
||||
scale(s1: number, s2: number): this;
|
||||
rotateAtStart(rotate: number): this;
|
||||
move(x: number, y: number): this;
|
||||
transform(ts: [string, number, number?]): this;
|
||||
setTransform(ts: [string, number, number?]): this;
|
||||
getMatrix(): any;
|
||||
setMatrix(m: any): this;
|
||||
apply(v: any, root: any): this;
|
||||
getTotalMatrix(): any;
|
||||
clearTotalMatrix: Function;
|
||||
invert(v: any): this;
|
||||
resetTransform(context: any): void;
|
||||
}
|
||||
|
||||
interface Animate {
|
||||
/**
|
||||
* 执行动画
|
||||
* @param {Object} toProps 动画最终状态
|
||||
* @param {Number} duration 动画执行时间
|
||||
* @param {String} easing 动画缓动效果
|
||||
* @param {Function} callback 动画执行后的回调
|
||||
* @param {Number} delay 动画延迟时间
|
||||
*/
|
||||
animate(
|
||||
toProps: { onFrame?: any; repeat?: any },
|
||||
duration: number,
|
||||
easing: string,
|
||||
callback: Function,
|
||||
delay: number,
|
||||
): void;
|
||||
stopAnimate(): void;
|
||||
pauseAnimate(): this;
|
||||
resumeAnimate(): this;
|
||||
}
|
||||
|
||||
interface AdvancedEventEmitter extends EventEmitter {
|
||||
new (): AdvancedEventEmitter;
|
||||
emit(evt: string, e?: Event): void;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
new (): EventEmitter;
|
||||
on(evt: string, callback: Function, one: any): this;
|
||||
one(evt: string, callback: Function): this;
|
||||
emit(evt: string): void;
|
||||
trigger(): void;
|
||||
off(evt: string, callback: Function): this | undefined;
|
||||
removeEvent(): this;
|
||||
}
|
||||
}
|
1160
types/index.d.ts
vendored
Normal file
1160
types/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user