@logicflow/core
Advanced tools
Comparing version 0.2.9 to 0.3.0-alpha.0
@@ -6,2 +6,29 @@ # Change Log | ||
# [0.3.0-alpha.0](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.2.9...@logicflow/core@0.3.0-alpha.0) (2021-03-18) | ||
### Bug Fixes | ||
* 🐛 beforeClone is not be triggered by ctrl+v ([969ab8d](https://github.com/didi/LogicFlow/commit/969ab8d3e1f00bfaba2124389d5d48ce21c6f58f)), closes [#66](https://github.com/didi/LogicFlow/issues/66) | ||
* 🐛 the incorrect way of anchor choice ([4811f65](https://github.com/didi/LogicFlow/commit/4811f6522ee7a817220ed472b1eb972dad562630)) | ||
* **core:** invalid style setting of snapline in setTheme function ([dc963d5](https://github.com/didi/LogicFlow/commit/dc963d5cb3480e2e469ce5cb46cc4fbf8975f73b)) | ||
* **core:** remove outline in container & copy incomplete elements ([370bbf5](https://github.com/didi/LogicFlow/commit/370bbf578416be6199fa4d4d424cb55fdb5c844c)) | ||
* **core:** select edge after mouseup event ([f24aafd](https://github.com/didi/LogicFlow/commit/f24aafdafbdb5ee3d9617df4600e71b70dda876e)) | ||
* **core:** trigger the edge:click and edge:dbclick with mousedown and mouseup ([b267188](https://github.com/didi/LogicFlow/commit/b267188c712e4ab363c958c4327d219634582641)) | ||
### Features | ||
* 🎸 add anchorsOffset API ([f23317b](https://github.com/didi/LogicFlow/commit/f23317bf535222d3770ae39892071ca7d154df41)) | ||
* add mini-map extension ([fa621da](https://github.com/didi/LogicFlow/commit/fa621daf2cc6a05cd5265bfe5245f5424f97ae7e)) | ||
* custom active plugin & add updateText function ([c974e75](https://github.com/didi/LogicFlow/commit/c974e7521d8eb1395c9df63c5c5da8933e8a849a)) | ||
* extension add destroy property ([23e59e5](https://github.com/didi/LogicFlow/commit/23e59e5902976fced92ad67ddd72f74938113c96)) | ||
* resize node ([2bc595e](https://github.com/didi/LogicFlow/commit/2bc595eadea58e1597f730520b830efc41a0dac5)) | ||
* **core:** add disable extension config & extension need name ([8bd9355](https://github.com/didi/LogicFlow/commit/8bd93555b7f82eb30a4813c986e3e642c86578fb)) | ||
* **core:** add drap event ([746f5db](https://github.com/didi/LogicFlow/commit/746f5db4e5dcfd362f57524f2bfb40db2279030f)) | ||
## [0.2.9](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.2.8...@logicflow/core@0.2.9) (2021-03-10) | ||
@@ -8,0 +35,0 @@ |
{ | ||
"name": "@logicflow/core", | ||
"version": "0.2.9", | ||
"version": "0.3.0-alpha.0", | ||
"description": "LogicFlow core, to quickly build flowchart editor", | ||
@@ -94,3 +94,3 @@ "main": "dist/logic-flow.js", | ||
}, | ||
"gitHead": "e6c42a36e48bdb15f1692f687a837bf85fc5d3e3" | ||
"gitHead": "ac6be887f220f91a6c3fe76b8296042e2db39102" | ||
} |
@@ -39,2 +39,5 @@ export declare enum ElementState { | ||
NODE_MOUSEDOWN = "node:mousedown", | ||
NODE_DRAGSTART = "node:dragstart", | ||
NODE_DRAG = "node:drag", | ||
NODE_DROP = "node:drop", | ||
NODE_MOUSEUP = "node:mouseup", | ||
@@ -53,2 +56,5 @@ NODE_MOUSEMOVE = "node:mousemove", | ||
BLANK_MOUSEDOWN = "blank:mousedown", | ||
BLANK_DRAGSTART = "blank:dragstart", | ||
BLANK_DRAG = "blank:drag", | ||
BLANK_DROP = "blank:drop", | ||
BLANK_MOUSEMOVE = "blank:mousemove", | ||
@@ -55,0 +61,0 @@ BLANK_MOUSEUP = "blank:mouseup", |
import LogicFlow from './LogicFlow'; | ||
export declare function observer<P>(props: P): any; | ||
export { LogicFlow, }; | ||
@@ -3,0 +4,0 @@ export * from './type/index'; |
@@ -54,3 +54,3 @@ import { h } from 'preact'; | ||
snaplineModel: SnaplineModel; | ||
static extensions: Extension[]; | ||
static extensions: Map<string, Extension>; | ||
components: ComponentRender[]; | ||
@@ -67,6 +67,8 @@ adapterIn: (data: unknown) => GraphConfigData; | ||
* 添加扩展, 待讨论,这里是不是静态方法好一些? | ||
* 重复添加插件的时候,把上一次添加的插件的销毁。 | ||
* @param plugin 插件 | ||
*/ | ||
static use(extension: Extension): void; | ||
installPlugins(): void; | ||
installPlugins(activePlugins: any): void; | ||
__installPlugin(extension: any): void; | ||
register(type: string, fn: RegisterElementFn): void; | ||
@@ -97,2 +99,11 @@ defaultRegister(): void; | ||
/** | ||
* 获取缩放的值和平移的值。 | ||
*/ | ||
getTransform(): { | ||
SCALE_X: number; | ||
SCALE_Y: number; | ||
TRANSLATE_X: number; | ||
TRANSLATE_Y: number; | ||
}; | ||
/** | ||
* 平移图形 | ||
@@ -131,3 +142,3 @@ * @param x 向x轴移动距离 | ||
*/ | ||
addElements({ nodes, edges }: GraphConfigData): GraphConfigModel; | ||
cloneElements({ nodes, edges }: GraphConfigData): GraphConfigModel; | ||
clearSelectElements(): void; | ||
@@ -169,2 +180,8 @@ setProperties(id: string, properties: Object): void; | ||
}): void; | ||
/** | ||
* 更新节点或连线文案 | ||
* @param id 节点或者连线id | ||
* @param value 文案内容 | ||
*/ | ||
updateText(id: string, value: string): void; | ||
getEdge(config: EdgeFilter): BaseEdgeModel[]; | ||
@@ -171,0 +188,0 @@ /** |
import { IBaseModel } from '../BaseModel'; | ||
import GraphModel from '../GraphModel'; | ||
import { Point, AdditionData, EdgeAttribute, EdgeData, MenuConfig } from '../../type/index'; | ||
import { Point, AdditionData, EdgeAttribute, EdgeData, MenuConfig, EdgeConfig } from '../../type/index'; | ||
import { ElementState, ModelType, ElementType } from '../../constant/constant'; | ||
@@ -40,3 +40,5 @@ declare class BaseEdgeModel implements IBaseModel { | ||
draggable: boolean; | ||
constructor(data: any, graphModel: GraphModel); | ||
constructor(data: EdgeConfig, graphModel: GraphModel, type: any); | ||
initEdgeData(data: any): void; | ||
setAttributes(): void; | ||
get sourceNode(): import("..").BaseNodeModel; | ||
@@ -47,3 +49,3 @@ get targetNode(): import("..").BaseNodeModel; | ||
getBeginAnchor(sourceNode: any, targetNode: any): Point; | ||
getEndAnchor(sourceNode: any, targetNode: any): Point; | ||
getEndAnchor(targetNode: any): Point; | ||
getProperties(): {}; | ||
@@ -69,4 +71,5 @@ getData(): EdgeData; | ||
setZIndex(zindex?: number): void; | ||
initPoints(): void; | ||
} | ||
export { BaseEdgeModel }; | ||
export default BaseEdgeModel; |
@@ -9,3 +9,2 @@ import BaseEdgeModel from './BaseEdgeModel'; | ||
path: string; | ||
pointsList: Point[]; | ||
constructor(data: any, graphModel: any); | ||
@@ -15,4 +14,4 @@ get textPosition(): Point; | ||
pointsList: { | ||
x: number; | ||
y: number; | ||
x: any; | ||
y: any; | ||
}[]; | ||
@@ -19,0 +18,0 @@ id: string; |
@@ -10,4 +10,2 @@ import { ModelType } from '../../constant/constant'; | ||
draginngPointList: any; | ||
points: string; | ||
pointsList: Point[]; | ||
dbClickPosition: Point; | ||
@@ -23,4 +21,4 @@ constructor(data: any, graphModel: GraphModel); | ||
pointsList: { | ||
x: number; | ||
y: number; | ||
x: any; | ||
y: any; | ||
}[]; | ||
@@ -42,4 +40,4 @@ id: string; | ||
dragAppend(appendInfo: any, dragInfo: any): { | ||
start: Point; | ||
end: Point; | ||
start: any; | ||
end: any; | ||
startIndex: any; | ||
@@ -46,0 +44,0 @@ endIndex: any; |
@@ -93,5 +93,7 @@ import BaseNodeModel from './node/BaseNodeModel'; | ||
getElement(id: string): IBaseModel | undefined; | ||
getNodeEdges(nodeId: any): BaseEdgeModel[]; | ||
/** | ||
* 获取选中的元素数据 | ||
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的连线。默认包括。复制的时候不能包括此类连线 | ||
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的连线,默认包括。 | ||
* 复制的时候不能包括此类连线, 因为复制的时候不允许悬空的连线 | ||
*/ | ||
@@ -107,3 +109,2 @@ getSelectElements(isIgnoreCheck?: boolean): { | ||
toFront(id: any): void; | ||
showMenu(id: any): void; | ||
deleteNode(id: any): void; | ||
@@ -110,0 +111,0 @@ addNode(nodeConfig: NodeConfig): any; |
import { ElementState, ModelType, ElementType } from '../../constant/constant'; | ||
import { AdditionData, NodeData, MenuConfig, NodeAttribute } from '../../type'; | ||
import { AdditionData, NodeData, MenuConfig, NodeAttribute, NodeConfig } from '../../type'; | ||
import GraphModel from '../GraphModel'; | ||
import { IBaseModel } from '../BaseModel'; | ||
@@ -42,6 +43,5 @@ export declare type ConnectRule = { | ||
isHitable: boolean; | ||
isContextMenu: boolean; | ||
zIndex: number; | ||
anchors: any[]; | ||
activeAnchor: number; | ||
anchorsOffset: any[]; | ||
state: number; | ||
@@ -56,4 +56,6 @@ text: { | ||
draggable: boolean; | ||
constructor(data: any); | ||
constructor(data: NodeConfig, graphModel: GraphModel, type: any); | ||
initNodeData(data: any): void; | ||
formatText(data: any): void; | ||
setAttributes(): void; | ||
/** | ||
@@ -77,2 +79,3 @@ * 保存时获取的数据 | ||
getConnectedTargetRules(): ConnectRule[]; | ||
get anchors(): any[]; | ||
move(deltaX: any, deltaY: any): void; | ||
@@ -87,3 +90,2 @@ moveTo(x: any, y: any): void; | ||
setElementState(state: ElementState, additionStateData?: AdditionData): void; | ||
showMenu(flag?: boolean): void; | ||
updateStroke(color: any): void; | ||
@@ -90,0 +92,0 @@ updateData(nodeAttribute: NodeAttribute): void; |
@@ -7,6 +7,5 @@ import { Point } from '../../type'; | ||
modelType: ModelType; | ||
width: number; | ||
height: number; | ||
radius: number; | ||
constructor(data: any, graphModel: GraphModel); | ||
setAttributes(): void; | ||
get anchors(): Point[]; | ||
@@ -13,0 +12,0 @@ } |
@@ -18,4 +18,4 @@ import GraphModel from './GraphModel'; | ||
position: SnaplinePosition; | ||
stroke: string; | ||
strokeWidth: number; | ||
get stroke(): string; | ||
get strokeWidth(): number; | ||
constructor(graphModel: any); | ||
@@ -22,0 +22,0 @@ private getCenterSnapLine; |
@@ -18,2 +18,3 @@ import { DndOptions } from './view/behavior/DnD'; | ||
isSilentMode?: boolean; | ||
activePlugins?: string[]; | ||
edgeType?: EdgeType; | ||
@@ -25,2 +26,3 @@ snapline?: boolean; | ||
stopZoomGraph?: boolean; | ||
stopMoveGraph?: boolean; | ||
guards?: GuardsTypes; | ||
@@ -27,0 +29,0 @@ hideAnchors?: boolean; |
@@ -24,2 +24,3 @@ import mobx from 'mobx'; | ||
import EllipseNodeModel from '../model/node/EllipseNodeModel'; | ||
import * as Options from '../options'; | ||
export declare type PointTuple = [number, number]; | ||
@@ -55,3 +56,2 @@ export declare type Point = { | ||
properties: Record<string, unknown>; | ||
baseType?: 'node' | 'edge' | 'graph'; | ||
}; | ||
@@ -62,3 +62,3 @@ export declare type NodeAttribute = { | ||
x?: number; | ||
y: number; | ||
y?: number; | ||
text?: TextConfig; | ||
@@ -233,4 +233,7 @@ properties?: Record<string, unknown>; | ||
export interface Extension { | ||
install: (lf: LogicFlow) => void; | ||
name: string; | ||
install?: (lf: LogicFlow, LogicFlow: LogicFlowContractor) => void; | ||
render?: ComponentRender; | ||
destroy?: () => void; | ||
[props: string]: any; | ||
} | ||
@@ -257,2 +260,5 @@ export declare type Direction = 'vertical' | 'horizontal'; | ||
} | ||
export interface LogicFlowContractor { | ||
new (option: Options.Definition): LogicFlow; | ||
} | ||
export declare type RegisterBack = { | ||
@@ -259,0 +265,0 @@ view: Function; |
@@ -25,2 +25,3 @@ import EventEmitter from '../event/eventEmitter'; | ||
model?: BaseNodeModel | BaseEdgeModel; | ||
startTime?: number; | ||
constructor({ onDragStart, onDraging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: { | ||
@@ -27,0 +28,0 @@ onDragStart?: (...args: any[]) => void; |
import BaseNode from '../model/node/BaseNodeModel'; | ||
import { Point, Direction } from '../type/index'; | ||
import { Point, Direction, EdgeConfig } from '../type/index'; | ||
export declare const setupEdgeModel: (edge: any, graphModel: any) => any; | ||
@@ -95,2 +95,8 @@ declare type PolyPoint = { | ||
export declare const getClosestPointOfPolyline: (point: Point, points: string) => Point; | ||
export declare const pickEdgeConfig: (data: any) => EdgeConfig; | ||
declare type Position = { | ||
x: number; | ||
y: number; | ||
}; | ||
export declare const twoPointDistance: (p1: Position, p2: Position) => number; | ||
export {}; |
@@ -12,2 +12,6 @@ import { h, Component } from 'preact'; | ||
export default class BaseEdge extends Component<IProps> { | ||
startTime: number; | ||
preStartTime: number; | ||
contextMenuTime: number; | ||
clickTimer: number; | ||
getAttributes(): { | ||
@@ -40,7 +44,7 @@ stroke: string; | ||
setHoverOFF: (ev: any) => void; | ||
handleDbClick: (e: MouseEvent) => void; | ||
handleClick: (e: any) => void; | ||
handleContextMenu: (ev: MouseEvent) => void; | ||
handleMouseDown: (e: any) => void; | ||
handleMouseUp: (e: MouseEvent) => void; | ||
render(): h.JSX.Element; | ||
} | ||
export {}; |
@@ -23,3 +23,3 @@ import { h } from 'preact'; | ||
onDragEnd: () => void; | ||
beforeDragStart(e: any, appendInfo: any): void; | ||
beforeDragStart: (e: any, appendInfo: any) => void; | ||
getAttributes(): { | ||
@@ -26,0 +26,0 @@ points: string; |
@@ -1,2 +0,2 @@ | ||
declare const _default: import("mobx-react/dist/types/IReactComponent").IReactComponent<any>; | ||
declare const _default: any; | ||
export default _default; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
546865
3069