@logicflow/core
Advanced tools
Comparing version 0.2.4 to 0.2.6
@@ -6,2 +6,24 @@ # Change Log | ||
## [0.2.6](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.2.4...@logicflow/core@0.2.6) (2021-03-01) | ||
### Bug Fixes | ||
* **core:** immutable redo data ([7a5dac6](https://github.com/didi/LogicFlow/commit/7a5dac6d89b0b248a9055cacaa22dc423dc6c299)) | ||
* **extension:** 🐛fix undo error when custom text position ([fc6e7d7](https://github.com/didi/LogicFlow/commit/fc6e7d767889e8bbdd542a3c8006e352a86121c4)) | ||
* 🐛 add the type of diamond class ([90f70b5](https://github.com/didi/LogicFlow/commit/90f70b5dd378af9f7c6ee3abca0c2ebf5cb8e4b3)) | ||
### Features | ||
* new plugin Selection & example ([2e4b489](https://github.com/didi/LogicFlow/commit/2e4b48958dff21617b6f7b08c9840deac0a178f0)) | ||
* **core:** add edit config update function ([695894c](https://github.com/didi/LogicFlow/commit/695894c4db9fa328d358be1d3917166b33aae990)) | ||
* **core:** copy paste and delete multiple selected elements ([4a5be86](https://github.com/didi/LogicFlow/commit/4a5be86c63c90b7c1c88e08e9d084e708307a80d)) | ||
* **core:** multiple elements drag moving ([a59065f](https://github.com/didi/LogicFlow/commit/a59065f7cebd745e2ba0e147c8356849384be9f9)) | ||
* **core:** support use meta key select multiple element ([e137f9f](https://github.com/didi/LogicFlow/commit/e137f9fdbdb6bf3f85c3f7ac9323785e445844c8)) | ||
## [0.2.4](https://github.com/didi/LogicFlow/compare/@logicflow/core@0.2.3...@logicflow/core@0.2.4) (2021-02-20) | ||
@@ -8,0 +30,0 @@ |
{ | ||
"name": "@logicflow/core", | ||
"version": "0.2.4", | ||
"version": "0.2.6", | ||
"description": "LogicFlow core, to quickly build flowchart editor", | ||
@@ -96,3 +96,3 @@ "main": "dist/logic-flow.js", | ||
}, | ||
"gitHead": "9d62a857ecf3b2789fddefc20dbe0f9ca2df1d7d" | ||
"gitHead": "63ab75859dea96ecd1fe495a23b342926e786834" | ||
} |
@@ -31,2 +31,3 @@ import { h } from 'preact'; | ||
import SnaplineModel from './model/SnaplineModel'; | ||
import { EditConfigInterface } from './model/EditConfigModel'; | ||
declare type GraphConfigData = { | ||
@@ -36,2 +37,6 @@ nodes: NodeConfig[]; | ||
}; | ||
declare type GraphConfigModel = { | ||
nodes: BaseNodeModel[]; | ||
edges: BaseEdgeModel[]; | ||
}; | ||
export default class LogicFlow { | ||
@@ -59,2 +64,3 @@ container: HTMLElement; | ||
off(evt: string, callback: CallbackType): void; | ||
emit(evt: string, arg: Record<string, string | number | object>): void; | ||
getEvents(): void; | ||
@@ -103,4 +109,6 @@ /** | ||
* 将图形选中 | ||
* @param id 选择元素ID | ||
* @param multiple 是否允许多选,如果为true,不会将上一个选中的元素重置 | ||
*/ | ||
select(id: string): void; | ||
select(id: string, multiple?: boolean): void; | ||
/** | ||
@@ -121,2 +129,7 @@ * 将图形定位到画布中心 | ||
addNode(nodeConfig: NodeConfig): BaseNodeModel; | ||
/** | ||
* 添加多个元素, 包括连线和节点。 | ||
*/ | ||
addElements({ nodes, edges }: GraphConfigData): GraphConfigModel; | ||
clearSelectElements(): void; | ||
setProperties(id: string, properties: Object): void; | ||
@@ -182,2 +195,16 @@ getProperties(id: string): Object; | ||
setNodeSnapLine(data: any): void; | ||
/** | ||
* 更新流程图编辑相关设置 | ||
*/ | ||
updateEditConfig(config: EditConfigInterface): void; | ||
/** | ||
* 获取 | ||
*/ | ||
getEditConfig(): Partial<import("./model/EditConfigModel").default>; | ||
/** | ||
* 获取指定区域坐标,此区域必须是DOM层,也就是可视区域。 | ||
* @param leftTopPoint 区域左上角坐标, dom层坐标 | ||
* @param rightBottomPoint 区域右下角坐标,dom层坐标 | ||
*/ | ||
getAreaElement(leftTopPoint: any, rightBottomPoint: any): any[]; | ||
removeNodeSnapLine(): void; | ||
@@ -184,0 +211,0 @@ /** |
export interface EditConfigInterface { | ||
stopZoomGraph: boolean; | ||
stopScrollGraph: boolean; | ||
stopMoveGraph: boolean; | ||
adjustEdge: boolean; | ||
adjustNodePosition: boolean; | ||
hideAnchors: boolean; | ||
nodeTextEdit: boolean; | ||
edgeTextEdit: boolean; | ||
nodeTextDraggable: boolean; | ||
edgeTextDraggable: boolean; | ||
stopZoomGraph?: boolean; | ||
stopScrollGraph?: boolean; | ||
stopMoveGraph?: boolean; | ||
adjustEdge?: boolean; | ||
adjustNodePosition?: boolean; | ||
hideAnchors?: boolean; | ||
nodeTextEdit?: boolean; | ||
edgeTextEdit?: boolean; | ||
nodeTextDraggable?: boolean; | ||
edgeTextDraggable?: boolean; | ||
extraConf?: Record<string, string | number | object | boolean>; | ||
} | ||
@@ -28,4 +29,9 @@ /** | ||
edgeTextDraggable: boolean; | ||
metaKeyMultipleSelected: boolean; | ||
extraConf: {}; | ||
keys: string[]; | ||
constructor(data: any); | ||
updateEditConfig(config: any): void; | ||
getConfig(): Partial<this>; | ||
} | ||
export { EditConfigModel }; |
@@ -22,2 +22,4 @@ import BaseNodeModel from './node/BaseNodeModel'; | ||
selectElement: BaseNodeModel | BaseEdgeModel; | ||
selectElements: Map<string, BaseNodeModel | BaseEdgeModel>; | ||
selectElementSize: number; | ||
edgeType: string; | ||
@@ -57,2 +59,6 @@ nodes: BaseNodeModel[]; | ||
get textEditElement(): BaseNodeModel | BaseEdgeModel; | ||
/** | ||
* 获取指定区域内的所有元素 | ||
*/ | ||
getAreaElement(leftTopPoint: any, rightBottomPoint: any): any[]; | ||
getModel(type: string): any; | ||
@@ -75,3 +81,9 @@ getNodeModel(nodeId: BaseNodeModelId): BaseNodeModel; | ||
}; | ||
isElementVisible(element: any): boolean; | ||
/** | ||
* 判断一个元素是否在指定矩形区域内。 | ||
* @param element 节点或者连线 | ||
* @param lt 左上角点 | ||
* @param rb 右下角点 | ||
*/ | ||
isElementInArea(element: any, lt: any, rb: any, wholeEdge?: boolean): boolean; | ||
graphDataToModel(graphData: any): void; | ||
@@ -84,2 +96,10 @@ modelToGraphData(): { | ||
getElement(id: string): IBaseModel | undefined; | ||
/** | ||
* 获取选中的元素数据 | ||
* @param isIgnoreCheck 是否包括sourceNode和targetNode没有被选中的连线。默认包括。复制的时候不能包括此类连线 | ||
*/ | ||
getSelectElements(isIgnoreCheck?: boolean): { | ||
nodes: any[]; | ||
edges: any[]; | ||
}; | ||
setFakerNode(nodeModel: BaseNodeModel): void; | ||
@@ -106,3 +126,3 @@ removeFakerNode(): void; | ||
setTextEditable(id: ElementModeId): void; | ||
createEdge(edgeConfig: EdgeConfig): void; | ||
createEdge(edgeConfig: EdgeConfig): EdgeConfig; | ||
moveEdge(nodeId: BaseNodeModelId, deltaX: number, deltaY: number): void; | ||
@@ -117,5 +137,12 @@ removeEdge(sourceNodeId: any, targetNodeId: any): void; | ||
resetElementState(): void; | ||
selectNodeById(id: any): void; | ||
selectEdgeById(id: any): void; | ||
selectElementById(id: string): void; | ||
selectNodeById(id: string, multiple?: boolean): void; | ||
selectEdgeById(id: string, multiple?: boolean): void; | ||
selectElementById(id: string, multiple?: boolean): void; | ||
clearSelectElements(): void; | ||
/** | ||
* 批量移动元素 | ||
*/ | ||
moveElements(elements: { | ||
nodes: NodeConfig[]; | ||
}, deltaX: number, deltaY: number): void; | ||
changeEdgeType(type: string): void; | ||
@@ -122,0 +149,0 @@ setTheme(style: Style): void; |
@@ -12,2 +12,4 @@ import mobx from 'mobx'; | ||
import CircleNodeModel from '../model/node/CircleNodeModel'; | ||
import DiamondNode from '../view/node/DiamondNode'; | ||
import DiamondNodeModel from '../model/node/DiamondNodeModel'; | ||
import PolygonNode from '../view/node/PolygonNode'; | ||
@@ -255,2 +257,4 @@ import PolygonNodeModel from '../model/node/PolygonNodeModel'; | ||
CircleNodeModel: typeof CircleNodeModel; | ||
DiamondNode: typeof DiamondNode; | ||
DiamondNodeModel: typeof DiamondNodeModel; | ||
PolygonNode: typeof PolygonNode; | ||
@@ -257,0 +261,0 @@ PolygonNodeModel: typeof PolygonNodeModel; |
@@ -24,3 +24,3 @@ import EventEmitter from '../event/eventEmitter'; | ||
eventCenter: EventEmitter | null; | ||
model: BaseNodeModel | BaseEdgeModel; | ||
model?: BaseNodeModel | BaseEdgeModel; | ||
constructor({ onDragStart, onDraging, onDragEnd, eventType, eventCenter, step, isStopPropagation, model, }: { | ||
@@ -34,3 +34,3 @@ onDragStart?: (...args: any[]) => void; | ||
isStopPropagation?: boolean; | ||
model: any; | ||
model?: any; | ||
}); | ||
@@ -37,0 +37,0 @@ setStep(step: number): void; |
export declare function snapToGrid(distance: number, gridSize: number): number; | ||
export declare function getGridOffset(distance: number, gridSize: number): number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
537667
87
3009