@logicflow/core
Advanced tools
Comparing version 0.7.6 to 0.7.7
@@ -6,2 +6,14 @@ # Change Log | ||
## [0.7.7](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.7.6...@logicflow/core@0.7.7) (2021-11-19) | ||
### Features | ||
* add context menu plugin ([8c5d7a8](https://github.com/didi/LogicFlow/commit/8c5d7a84309ba8d07fbbb99dcebcae81b521bd06)) | ||
* set textheight ([29e9738](https://github.com/didi/LogicFlow/commit/29e97388e765d17faaa17c8633b0408681435e06)) | ||
## [0.7.6](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.7.5...@logicflow/core@0.7.6) (2021-11-11) | ||
@@ -8,0 +20,0 @@ |
{ | ||
"name": "@logicflow/core", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"description": "LogicFlow core, to quickly build flowchart editor", | ||
@@ -95,3 +95,3 @@ "main": "dist/logic-flow.js", | ||
], | ||
"gitHead": "c19052d9d6004fe852d410a511ceea4db0d70c87" | ||
"gitHead": "35db5cdb1daedef9a82083ee0b0f388002f37c44" | ||
} |
@@ -18,7 +18,7 @@ import { EventArgs } from '../type'; | ||
/** | ||
* 监听一个事件一次 | ||
* @param evt | ||
* @param callback | ||
*/ | ||
once(evt: string, callback: CallbackType): this; | ||
* 监听一个事件一次 | ||
* @param evt | ||
* @param callback | ||
*/ | ||
once(evt: string, callback: CallbackType): void; | ||
/** | ||
@@ -29,3 +29,3 @@ * 触发一个事件 | ||
*/ | ||
emit(evt: string, eventArgs: EventArgs): void; | ||
emit(evts: string, eventArgs: EventArgs): void; | ||
/** | ||
@@ -36,4 +36,4 @@ * 取消监听一个事件,或者一个channel | ||
*/ | ||
off(evt?: string, callback?: CallbackType): this; | ||
off(evts?: string, callback?: CallbackType): this; | ||
getEvents(): Record<string, EventType[]>; | ||
} |
@@ -9,3 +9,3 @@ import GraphModel from './model/GraphModel'; | ||
import Keyboard from './keyboard'; | ||
import { EdgeConfig, EdgeFilter, NodeConfig, NodeAttribute, Extension, ComponentRender, FocusOnArgs, EdgeAttribute, EdgeData, GraphConfigData, RegisterElementFn, RegisterConfig } from './type'; | ||
import { EdgeConfig, EdgeFilter, NodeConfig, NodeAttribute, Extension, ComponentRender, FocusOnArgs, EdgeAttribute, EdgeData, GraphConfigData, RegisterElementFn, RegisterConfig, ZoomParam, PointTuple } from './type'; | ||
import SnaplineModel from './model/SnaplineModel'; | ||
@@ -56,6 +56,7 @@ import { EditConfigInterface } from './model/EditConfigModel'; | ||
* 放大缩小图形 | ||
* isZoomIn 是否放大,默认false, 表示缩小。 | ||
* @param zoomSize 放大缩小的值,支持传入0-n之间的数字。小于1表示缩小,大于1表示放大。也支持传入true和false按照内置的刻度放大缩小 | ||
* @param point 缩放的原点 | ||
* @returns {string} -放大缩小的比例 | ||
*/ | ||
zoom(isZoomIn?: boolean): string; | ||
zoom(zoomSize?: ZoomParam, point?: PointTuple): string; | ||
/** | ||
@@ -79,6 +80,6 @@ * 还原图形 | ||
getTransform(): { | ||
SCALE_X: any; | ||
SCALE_Y: any; | ||
TRANSLATE_X: any; | ||
TRANSLATE_Y: any; | ||
SCALE_X: number; | ||
SCALE_Y: number; | ||
TRANSLATE_X: number; | ||
TRANSLATE_Y: number; | ||
}; | ||
@@ -119,2 +120,7 @@ /** | ||
/** | ||
* 删除元素,在不确定当前id是节点还是连线时使用 | ||
* @param id 元素id | ||
*/ | ||
deleteElement(id: any): boolean; | ||
/** | ||
* 修改指定节点类型 | ||
@@ -140,3 +146,3 @@ * @param id 节点id | ||
*/ | ||
deleteNode(nodeId: string): void; | ||
deleteNode(nodeId: string): boolean; | ||
/** | ||
@@ -157,3 +163,9 @@ * 显示节点文本编辑框 | ||
*/ | ||
deleteEdge(edgeId: string): void; | ||
deleteEdge(edgeId: string): boolean; | ||
/** | ||
* 删除指定类型的边 | ||
* todo: API一致 | ||
* @param config.sourceNodeId 边的起点节点ID | ||
* @param config.targetNodeId 边的终点节点ID | ||
*/ | ||
removeEdge(config: { | ||
@@ -248,4 +260,4 @@ sourceNodeId: string; | ||
canvasOverlayPosition: { | ||
x: any; | ||
y: any; | ||
x: number; | ||
y: number; | ||
}; | ||
@@ -258,6 +270,3 @@ }; | ||
*/ | ||
getSelectElements(isIgnoreCheck?: boolean): { | ||
nodes: any[]; | ||
edges: any[]; | ||
}; | ||
getSelectElements(isIgnoreCheck?: boolean): GraphConfigData; | ||
/** | ||
@@ -290,3 +299,3 @@ * 动态修改 id 对应元素 model 中的属性 | ||
*/ | ||
getAreaElement(leftTopPoint: any, rightBottomPoint: any): any[]; | ||
getAreaElement(leftTopPoint: PointTuple, rightBottomPoint: PointTuple): any[]; | ||
removeNodeSnapLine(): void; | ||
@@ -293,0 +302,0 @@ setView(type: string, component: any): void; |
import BaseNodeModel from './node/BaseNodeModel'; | ||
import BaseEdgeModel from './edge/BaseEdgeModel'; | ||
import EditConfigModel from './EditConfigModel'; | ||
import TransfromModel from './TransformModel'; | ||
import { IBaseModel } from './BaseModel'; | ||
@@ -35,3 +36,3 @@ import { ElementState, ModelType, ElementType } from '../constant/constant'; | ||
background: any; | ||
transformMatrix: any; | ||
transformMatrix: TransfromModel; | ||
editConfig: EditConfigModel; | ||
@@ -77,4 +78,4 @@ gridSize: number; | ||
canvasOverlayPosition: { | ||
x: any; | ||
y: any; | ||
x: number; | ||
y: number; | ||
}; | ||
@@ -81,0 +82,0 @@ }; |
import EventEmitter from '../event/eventEmitter'; | ||
import { PointTuple } from '../type'; | ||
import { PointTuple, ZoomParam } from '../type'; | ||
export interface TransfromInterface { | ||
@@ -13,6 +13,9 @@ SCALE_X: number; | ||
MAX_SCALE_SIZE: number; | ||
zoom: (isZoomout: boolean) => boolean; | ||
zoom: (isZoomout: ZoomParam) => boolean; | ||
HtmlPointToCanvasPoint: (point: PointTuple) => PointTuple; | ||
CanvasPointToHtmlPoint: (point: PointTuple) => PointTuple; | ||
moveCanvasPointByHtml: (point: PointTuple, x: number, y: number) => PointTuple; | ||
getTransformStyle: () => { | ||
transform: string; | ||
}; | ||
} | ||
@@ -57,3 +60,9 @@ export default class TransfromModel implements TransfromInterface { | ||
fixDeltaXY(deltaX: number, deltaY: number): PointTuple; | ||
zoom(isZoomIn?: boolean, point?: PointTuple): boolean; | ||
/** | ||
* 基于当前的缩放,获取画布渲染样式transform值 | ||
*/ | ||
getTransformStyle(): { | ||
transform: string; | ||
}; | ||
zoom(zoomSize?: ZoomParam, point?: PointTuple): boolean; | ||
private emitGraphTransform; | ||
@@ -60,0 +69,0 @@ resetZoom(): void; |
@@ -355,2 +355,3 @@ import { h } from 'preact'; | ||
export declare type NodeMoveRule = (model: BaseNodeModel, deltaX: number, deltaY: number) => Boolean; | ||
export declare type ZoomParam = boolean | number; | ||
export {}; |
@@ -1,2 +0,30 @@ | ||
declare const _default: any; | ||
export default _default; | ||
import { h, Component } from 'preact'; | ||
import GraphModel from '../../model/GraphModel'; | ||
import { StepDrag } from '../../util/drag'; | ||
import EventEmitter from '../../event/eventEmitter'; | ||
import Dnd from '../behavior/DnD'; | ||
declare type IProps = { | ||
graphModel: GraphModel; | ||
eventCenter: EventEmitter; | ||
dnd: Dnd; | ||
}; | ||
declare type Istate = { | ||
isDraging: boolean; | ||
}; | ||
declare class CanvasOverlay extends Component<IProps, Istate> { | ||
stepDrag: StepDrag; | ||
stepScrollX: number; | ||
stepScrollY: number; | ||
constructor(props: IProps); | ||
onDraging: ({ deltaX, deltaY }: { | ||
deltaX: any; | ||
deltaY: any; | ||
}) => void; | ||
onDragEnd: () => void; | ||
zoomHandler: (ev: WheelEvent) => void; | ||
clickHandler: (ev: MouseEvent) => void; | ||
handleContextMenu: (ev: MouseEvent) => void; | ||
mouseDownHandler: (ev: MouseEvent) => void; | ||
render(): h.JSX.Element; | ||
} | ||
export default CanvasOverlay; |
@@ -7,51 +7,10 @@ /** | ||
*/ | ||
import { h } from 'preact'; | ||
import { h, Component } from 'preact'; | ||
import GraphModel from '../../model/GraphModel'; | ||
import { GraphTransform } from '../../type'; | ||
declare type IProps = { | ||
graphModel: GraphModel; | ||
}; | ||
declare const _default: { | ||
new (props?: { | ||
graphModel: GraphModel; | ||
} & IProps, context?: any): { | ||
getMatrixString(): GraphTransform; | ||
render(): h.JSX.Element; | ||
componentWillMount?(): void; | ||
componentDidMount?(): void; | ||
componentWillUnmount?(): void; | ||
getChildContext?(): object; | ||
componentWillReceiveProps?(nextProps: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>, nextContext: any): void; | ||
shouldComponentUpdate?(nextProps: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
componentWillUpdate?(nextProps: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>, nextState: Readonly<{}>, nextContext: any): void; | ||
getSnapshotBeforeUpdate?(oldProps: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>, oldState: Readonly<{}>): any; | ||
componentDidUpdate?(previousProps: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>, previousState: Readonly<{}>, snapshot: any): void; | ||
componentDidCatch?(error: any, errorInfo: any): void; | ||
state: Readonly<{}>; | ||
props: import("preact").RenderableProps<{ | ||
graphModel: GraphModel; | ||
} & IProps, any>; | ||
context: any; | ||
base?: Element | Text; | ||
setState<K extends never>(state: Partial<{}> | ((prevState: Readonly<{}>, props: Readonly<{ | ||
graphModel: GraphModel; | ||
} & IProps>) => Partial<{}> | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; | ||
forceUpdate(callback?: () => void): void; | ||
}; | ||
displayName?: string; | ||
defaultProps?: any; | ||
contextType?: import("preact").Context<any>; | ||
getDerivedStateFromProps?(props: object, state: object): object; | ||
getDerivedStateFromError?(error: any): object; | ||
}; | ||
export default _default; | ||
declare class HtmlOverlay extends Component<IProps> { | ||
render(): h.JSX.Element; | ||
} | ||
export default HtmlOverlay; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
644169
96
4140