@flowgram.ai/renderer 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2995 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +592 -0
- package/dist/index.d.ts +592 -0
- package/dist/index.js +2941 -0
- package/dist/index.js.map +1 -0
- package/index.module.less +162 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import { LABEL_SIDE_TYPE, FlowNodeTransitionData, FlowNodeEntity, FlowNodeTransformData, FlowDocument, FlowDocumentTransformerEntity, FlowNodeRenderData, FlowDragService, FlowRendererStateEntity } from '@flowgram.ai/document';
|
|
2
|
+
import { ConfigEntity, EntityOpts, PlaygroundDragEvent, PositionSchema, SizeSchema, Layer, PipelineRegistry, LayerRegistry, PlaygroundConfigEntity, PlaygroundDrag, EditorStateConfigEntity, LayerOptions, ContextMenuService, SelectionService, PlaygroundConfig, CommandRegistry } from '@flowgram.ai/core';
|
|
3
|
+
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
4
|
+
import { Rectangle, Disposable, CacheOriginItem, ScrollSchema } from '@flowgram.ai/utils';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import * as lodash from 'lodash';
|
|
7
|
+
import { ContainerModule } from 'inversify';
|
|
8
|
+
|
|
9
|
+
interface FlowDragEntityConfig extends EntityOpts {
|
|
10
|
+
}
|
|
11
|
+
declare enum ScrollDirection {
|
|
12
|
+
TOP = 0,
|
|
13
|
+
BOTTOM = 1,
|
|
14
|
+
LEFT = 2,
|
|
15
|
+
RIGHT = 3
|
|
16
|
+
}
|
|
17
|
+
interface CollisionRetType {
|
|
18
|
+
hasCollision: boolean;
|
|
19
|
+
labelOffsetType?: LABEL_SIDE_TYPE;
|
|
20
|
+
}
|
|
21
|
+
declare class FlowDragEntity extends ConfigEntity<FlowDragEntityConfig> {
|
|
22
|
+
private playgroundConfigEntity;
|
|
23
|
+
static type: string;
|
|
24
|
+
private containerDom;
|
|
25
|
+
private containerX;
|
|
26
|
+
private containerY;
|
|
27
|
+
private _scrollXInterval;
|
|
28
|
+
private _scrollYInterval;
|
|
29
|
+
get hasScroll(): boolean;
|
|
30
|
+
constructor(conf: any);
|
|
31
|
+
isCollision(transition: FlowNodeTransitionData, rect: Rectangle, isBranch: boolean): CollisionRetType;
|
|
32
|
+
isNodeCollision(transition: FlowNodeTransitionData, rect: Rectangle, scale: number): CollisionRetType;
|
|
33
|
+
isBranchCollision(transition: FlowNodeTransitionData, rect: Rectangle, scale: number): CollisionRetType;
|
|
34
|
+
private _startScrollX;
|
|
35
|
+
private _stopScrollX;
|
|
36
|
+
private _startScrollY;
|
|
37
|
+
private _stopScrollY;
|
|
38
|
+
stopAllScroll(): void;
|
|
39
|
+
setDomStyle(): void;
|
|
40
|
+
scrollDirection(e: MouseEvent, containerDom: HTMLDivElement, x: number, y: number): ScrollDirection | undefined;
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface FlowSelectConfigEntityData {
|
|
45
|
+
selectedNodes: FlowNodeEntity[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 圈选节点相关数据存储
|
|
49
|
+
*/
|
|
50
|
+
declare class FlowSelectConfigEntity extends ConfigEntity<FlowSelectConfigEntityData> {
|
|
51
|
+
static type: string;
|
|
52
|
+
boundsPadding: number;
|
|
53
|
+
getDefaultConfig(): FlowSelectConfigEntityData;
|
|
54
|
+
get selectedNodes(): FlowNodeEntity[];
|
|
55
|
+
/**
|
|
56
|
+
* 选中节点
|
|
57
|
+
* @param nodes
|
|
58
|
+
*/
|
|
59
|
+
set selectedNodes(nodes: FlowNodeEntity[]);
|
|
60
|
+
/**
|
|
61
|
+
* 清除选中节点
|
|
62
|
+
*/
|
|
63
|
+
clearSelectedNodes(): void;
|
|
64
|
+
/**
|
|
65
|
+
* 通过选择框选中节点
|
|
66
|
+
* @param rect
|
|
67
|
+
* @param transforms
|
|
68
|
+
*/
|
|
69
|
+
selectFromBounds(rect: Rectangle, transforms: FlowNodeTransformData[]): void;
|
|
70
|
+
/**
|
|
71
|
+
* 获取选中节点外围的最大边框
|
|
72
|
+
*/
|
|
73
|
+
getSelectedBounds(): Rectangle;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface SelectorBoxConfigData extends PlaygroundDragEvent {
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 选择框配置
|
|
81
|
+
*/
|
|
82
|
+
declare class SelectorBoxConfigEntity extends ConfigEntity<SelectorBoxConfigData> {
|
|
83
|
+
static type: string;
|
|
84
|
+
get dragInfo(): PlaygroundDragEvent;
|
|
85
|
+
setDragInfo(info: PlaygroundDragEvent): void;
|
|
86
|
+
get disabled(): boolean;
|
|
87
|
+
set disabled(disabled: boolean);
|
|
88
|
+
get isStart(): boolean;
|
|
89
|
+
get isMoving(): boolean;
|
|
90
|
+
get position(): PositionSchema;
|
|
91
|
+
get size(): SizeSchema;
|
|
92
|
+
get collapsed(): boolean;
|
|
93
|
+
collapse(): void;
|
|
94
|
+
toRectangle(scale: number): Rectangle;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 监听 dom 元素的 size 变化,用于画布节点的大小变化重新计算
|
|
99
|
+
*/
|
|
100
|
+
declare class FlowRendererResizeObserver {
|
|
101
|
+
/**
|
|
102
|
+
* 监听元素 size,并同步到 transform
|
|
103
|
+
* @param el
|
|
104
|
+
* @param transform
|
|
105
|
+
*/
|
|
106
|
+
observe(el: HTMLElement, transform: FlowNodeTransformData): Disposable;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface TransformRenderCache {
|
|
110
|
+
updateBounds(): void;
|
|
111
|
+
}
|
|
112
|
+
interface FlowNodesTransformLayerOptions {
|
|
113
|
+
renderElement?: HTMLElement | (() => HTMLElement | undefined);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 渲染节点位置
|
|
117
|
+
*/
|
|
118
|
+
declare class FlowNodesTransformLayer extends Layer<FlowNodesTransformLayerOptions> {
|
|
119
|
+
readonly document: FlowDocument;
|
|
120
|
+
readonly resizeObserver: FlowRendererResizeObserver;
|
|
121
|
+
readonly documentTransformer: FlowDocumentTransformerEntity;
|
|
122
|
+
_transforms: FlowNodeTransformData[];
|
|
123
|
+
node: HTMLDivElement;
|
|
124
|
+
get transformVisibles(): FlowNodeTransformData[];
|
|
125
|
+
/**
|
|
126
|
+
* 监听缩放,目前采用整体缩放
|
|
127
|
+
* @param scale
|
|
128
|
+
*/
|
|
129
|
+
onZoom(scale: number): void;
|
|
130
|
+
dispose(): void;
|
|
131
|
+
protected renderCache: _flowgram_ai_utils.CacheManager<TransformRenderCache, FlowNodeTransformData>;
|
|
132
|
+
onReady(): void;
|
|
133
|
+
get visibeBounds(): _flowgram_ai_utils.Rectangle[];
|
|
134
|
+
/**
|
|
135
|
+
* 更新节点的 bounds 数据
|
|
136
|
+
*/
|
|
137
|
+
updateNodesBounds(): void;
|
|
138
|
+
autorun(): void;
|
|
139
|
+
private get renderElement();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
declare enum FlowRendererComponentType {
|
|
143
|
+
REACT = 0,
|
|
144
|
+
DOM = 1,
|
|
145
|
+
TEXT = 2
|
|
146
|
+
}
|
|
147
|
+
declare enum FlowRendererKey {
|
|
148
|
+
NODE_RENDER = "node-render",
|
|
149
|
+
ADDER = "adder",
|
|
150
|
+
COLLAPSE = "collapse",
|
|
151
|
+
BRANCH_ADDER = "branch-adder",
|
|
152
|
+
TRY_CATCH_COLLAPSE = "try-catch-collapse",
|
|
153
|
+
DRAG_NODE = "drag-node",
|
|
154
|
+
DRAGGABLE_ADDER = "draggable-adder",
|
|
155
|
+
DRAG_HIGHLIGHT_ADDER = "drag-highlight-adder",
|
|
156
|
+
DRAG_BRANCH_HIGHLIGHT_ADDER = "drag-branch-highlight-adder",
|
|
157
|
+
SELECTOR_BOX_POPOVER = "selector-box-popover",
|
|
158
|
+
CONTEXT_MENU_POPOVER = "context-menu-popover",
|
|
159
|
+
SUB_CANVAS = "sub-canvas",
|
|
160
|
+
MARKER_ARROW = "marker-arrow",
|
|
161
|
+
MARKER_ACTIVATE_ARROW = "marker-active-arrow"
|
|
162
|
+
}
|
|
163
|
+
declare enum FlowTextKey {
|
|
164
|
+
LOOP_END_TEXT = "loop-end-text",
|
|
165
|
+
LOOP_TRAVERSE_TEXT = "loop-traverse-text",
|
|
166
|
+
LOOP_WHILE_TEXT = "loop-while-text",
|
|
167
|
+
TRY_START_TEXT = "try-start-text",
|
|
168
|
+
TRY_END_TEXT = "try-end-text",
|
|
169
|
+
CATCH_TEXT = "catch-text"
|
|
170
|
+
}
|
|
171
|
+
interface FlowRendererComponent {
|
|
172
|
+
type: FlowRendererComponentType;
|
|
173
|
+
renderer: (props?: any) => any;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 命令分类
|
|
177
|
+
*/
|
|
178
|
+
declare enum FlowRendererCommandCategory {
|
|
179
|
+
SELECTOR_BOX = "SELECTOR_BOX"
|
|
180
|
+
}
|
|
181
|
+
declare class FlowRendererRegistry {
|
|
182
|
+
private componentsMap;
|
|
183
|
+
private textMap;
|
|
184
|
+
private contribs;
|
|
185
|
+
readonly pipeline: PipelineRegistry;
|
|
186
|
+
init(): void;
|
|
187
|
+
/**
|
|
188
|
+
* 注册 组件数据
|
|
189
|
+
*/
|
|
190
|
+
registerRendererComponents(renderKey: FlowRendererKey | string, comp: FlowRendererComponent): void;
|
|
191
|
+
registerReactComponent(renderKey: FlowRendererKey | string, renderer: (props: any) => any): void;
|
|
192
|
+
/**
|
|
193
|
+
* 注册文案
|
|
194
|
+
*/
|
|
195
|
+
registerText(configs: Record<FlowTextKey | string, string>): void;
|
|
196
|
+
getText(textKey: string): string | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* TODO: support memo
|
|
199
|
+
*/
|
|
200
|
+
getRendererComponent(renderKey: FlowRendererKey | string): FlowRendererComponent;
|
|
201
|
+
tryToGetRendererComponent(renderKey: FlowRendererKey | string): FlowRendererComponent | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* 注册画布层
|
|
204
|
+
*/
|
|
205
|
+
registerLayers(...layerRegistries: LayerRegistry[]): void;
|
|
206
|
+
/**
|
|
207
|
+
* 根据配置注册画布
|
|
208
|
+
* @param layerRegistry
|
|
209
|
+
* @param options
|
|
210
|
+
*/
|
|
211
|
+
registerLayer<P extends Layer = Layer>(layerRegistry: LayerRegistry<Layer>, options?: P['options']): void;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface NodePortal extends CacheOriginItem {
|
|
215
|
+
id: string;
|
|
216
|
+
Portal: () => JSX.Element;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 渲染节点内容
|
|
220
|
+
*/
|
|
221
|
+
declare class FlowNodesContentLayer extends Layer {
|
|
222
|
+
readonly document: FlowDocument;
|
|
223
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
224
|
+
readonly documentTransformer: FlowDocumentTransformerEntity;
|
|
225
|
+
_renderStates: FlowNodeRenderData[];
|
|
226
|
+
get renderStatesVisible(): FlowNodeRenderData[];
|
|
227
|
+
private renderMemoCache;
|
|
228
|
+
node: HTMLDivElement;
|
|
229
|
+
getPortalRenderer(data: FlowNodeRenderData): (props: any) => JSX.Element;
|
|
230
|
+
/**
|
|
231
|
+
* 监听缩放,目前采用整体缩放
|
|
232
|
+
* @param scale
|
|
233
|
+
*/
|
|
234
|
+
onZoom(scale: number): void;
|
|
235
|
+
dispose(): void;
|
|
236
|
+
protected reactPortals: _flowgram_ai_utils.CacheManager<NodePortal, FlowNodeRenderData>;
|
|
237
|
+
onReady(): void;
|
|
238
|
+
/**
|
|
239
|
+
* 监听readonly和 disabled 状态 并刷新layer, 并刷新节点
|
|
240
|
+
*/
|
|
241
|
+
onReadonlyOrDisabledChange(): void;
|
|
242
|
+
getPortals(): NodePortal[];
|
|
243
|
+
render(): React.JSX.Element;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
declare class FlowLinesLayer extends Layer {
|
|
247
|
+
readonly document: FlowDocument;
|
|
248
|
+
protected readonly dragService: FlowDragService;
|
|
249
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
250
|
+
node: HTMLDivElement;
|
|
251
|
+
readonly documentTransformer: FlowDocumentTransformerEntity;
|
|
252
|
+
readonly flowRenderState: FlowRendererStateEntity;
|
|
253
|
+
/**
|
|
254
|
+
* 监听 transition 变化
|
|
255
|
+
*/
|
|
256
|
+
_transitions: FlowNodeTransitionData[];
|
|
257
|
+
get transitions(): FlowNodeTransitionData[];
|
|
258
|
+
/**
|
|
259
|
+
* 可视区域变化
|
|
260
|
+
*/
|
|
261
|
+
onViewportChange: lodash.DebouncedFuncLeading<() => void>;
|
|
262
|
+
onZoom(): void;
|
|
263
|
+
onReady(): void;
|
|
264
|
+
get viewBox(): string;
|
|
265
|
+
render(): JSX.Element;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare class FlowLabelsLayer extends Layer {
|
|
269
|
+
readonly document: FlowDocument;
|
|
270
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
271
|
+
node: HTMLDivElement;
|
|
272
|
+
readonly documentTransformer: FlowDocumentTransformerEntity;
|
|
273
|
+
readonly flowRenderState: FlowRendererStateEntity;
|
|
274
|
+
/**
|
|
275
|
+
* 监听 transition 变化
|
|
276
|
+
*/
|
|
277
|
+
_transitions: FlowNodeTransitionData[];
|
|
278
|
+
get transitions(): FlowNodeTransitionData[];
|
|
279
|
+
/**
|
|
280
|
+
* 监听缩放,目前采用整体缩放
|
|
281
|
+
* @param scale
|
|
282
|
+
*/
|
|
283
|
+
onZoom(scale: number): void;
|
|
284
|
+
/**
|
|
285
|
+
* 可视区域变化
|
|
286
|
+
*/
|
|
287
|
+
onViewportChange: lodash.DebouncedFuncLeading<() => void>;
|
|
288
|
+
onReady(): void;
|
|
289
|
+
/**
|
|
290
|
+
* 监听readonly和 disabled 状态 并刷新layer, 并刷新
|
|
291
|
+
*/
|
|
292
|
+
onReadonlyOrDisabledChange(): void;
|
|
293
|
+
render(): React.JSX.Element;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* 调试用,会绘出所有节点的边界
|
|
298
|
+
*/
|
|
299
|
+
declare class FlowDebugLayer extends Layer {
|
|
300
|
+
readonly document: FlowDocument;
|
|
301
|
+
readonly documentTransformer: FlowDocumentTransformerEntity;
|
|
302
|
+
_transforms: FlowNodeTransformData[];
|
|
303
|
+
get transforms(): FlowNodeTransformData[];
|
|
304
|
+
node: HTMLElement;
|
|
305
|
+
viewport: HTMLDivElement;
|
|
306
|
+
boundsNodes: HTMLDivElement;
|
|
307
|
+
pointsNodes: HTMLDivElement;
|
|
308
|
+
versionNodes: HTMLDivElement;
|
|
309
|
+
/**
|
|
310
|
+
* ?debug=xxxx, 则返回 xxxx
|
|
311
|
+
*/
|
|
312
|
+
filterKey: string;
|
|
313
|
+
protected originLine: HTMLDivElement;
|
|
314
|
+
domCache: WeakMap<FlowNodeTransformData, {
|
|
315
|
+
color: string;
|
|
316
|
+
bbox: HTMLDivElement;
|
|
317
|
+
version: HTMLDivElement;
|
|
318
|
+
input: HTMLDivElement;
|
|
319
|
+
output: HTMLDivElement;
|
|
320
|
+
}>;
|
|
321
|
+
onReady(): void;
|
|
322
|
+
onScroll(): void;
|
|
323
|
+
onResize(): void;
|
|
324
|
+
onZoom(scale: number): void;
|
|
325
|
+
createBounds(transform: FlowNodeTransformData, color: string, depth: number): void;
|
|
326
|
+
/**
|
|
327
|
+
* 显示 viewport 可滚动区域
|
|
328
|
+
*/
|
|
329
|
+
renderScrollViewportBounds(): void;
|
|
330
|
+
autorun(): void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* 滚动条点击事件监听
|
|
335
|
+
*/
|
|
336
|
+
declare const ScrollBarEvents: unique symbol;
|
|
337
|
+
interface ScrollBarEvents {
|
|
338
|
+
dragStart: () => void;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
declare enum ScrollBarVisibility {
|
|
342
|
+
Show = "show",
|
|
343
|
+
Hidden = "hidden"
|
|
344
|
+
}
|
|
345
|
+
interface ScrollBarOptions {
|
|
346
|
+
/**
|
|
347
|
+
* 显示滚动条的时机,可选常驻或滚动时显示
|
|
348
|
+
*/
|
|
349
|
+
showScrollBars: 'whenScrolling' | 'always';
|
|
350
|
+
getBounds(): Rectangle;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* 渲染滚动条 layer
|
|
354
|
+
*/
|
|
355
|
+
declare class FlowScrollBarLayer extends Layer<ScrollBarOptions> {
|
|
356
|
+
readonly events?: ScrollBarEvents;
|
|
357
|
+
flowDocument?: FlowDocument;
|
|
358
|
+
protected playgroundConfigEntity: PlaygroundConfigEntity;
|
|
359
|
+
readonly rightScrollBar: HTMLDivElement;
|
|
360
|
+
readonly rightScrollBarBlock: HTMLDivElement;
|
|
361
|
+
readonly bottomScrollBar: HTMLDivElement;
|
|
362
|
+
readonly bottomScrollBarBlock: HTMLDivElement;
|
|
363
|
+
private mostLeft;
|
|
364
|
+
private mostRight;
|
|
365
|
+
private mostTop;
|
|
366
|
+
private mostBottom;
|
|
367
|
+
private viewportWidth;
|
|
368
|
+
private viewportHeight;
|
|
369
|
+
private width;
|
|
370
|
+
private height;
|
|
371
|
+
private scrollBottomWidth;
|
|
372
|
+
private scrollRightHeight;
|
|
373
|
+
private scale;
|
|
374
|
+
private sum;
|
|
375
|
+
private initialScrollX;
|
|
376
|
+
private initialScrollY;
|
|
377
|
+
private hideTimeout;
|
|
378
|
+
get clientViewportWidth(): number;
|
|
379
|
+
get clientViewportHeight(): number;
|
|
380
|
+
get viewportFullWidth(): number;
|
|
381
|
+
get viewportFullHeight(): number;
|
|
382
|
+
get viewportMoveWidth(): number;
|
|
383
|
+
get viewportMoveHeight(): number;
|
|
384
|
+
getToLeft(scrollX: number): number;
|
|
385
|
+
getToTop(scrollY: number): number;
|
|
386
|
+
clickRightScrollBar(e: MouseEvent): void;
|
|
387
|
+
clickBottomScrollBar(e: MouseEvent): void;
|
|
388
|
+
onBoardingToast(): void;
|
|
389
|
+
protected bottomGrabDragger: PlaygroundDrag<undefined>;
|
|
390
|
+
protected rightGrabDragger: PlaygroundDrag<undefined>;
|
|
391
|
+
protected changeScrollBarVisibility(scrollBar: HTMLDivElement, status: ScrollBarVisibility): void;
|
|
392
|
+
onReady(): void;
|
|
393
|
+
autorun(): void;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
interface FlowDragOptions {
|
|
397
|
+
onDrop?: (opts: {
|
|
398
|
+
dragNodes: FlowNodeEntity[];
|
|
399
|
+
dropNode: FlowNodeEntity;
|
|
400
|
+
}) => void;
|
|
401
|
+
canDrop?: (opts: {
|
|
402
|
+
dragNodes: FlowNodeEntity[];
|
|
403
|
+
dropNode: FlowNodeEntity;
|
|
404
|
+
isBranch?: boolean;
|
|
405
|
+
}) => boolean;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* 监听节点的激活状态
|
|
409
|
+
*/
|
|
410
|
+
declare class FlowDragLayer extends Layer<FlowDragOptions> {
|
|
411
|
+
readonly document: FlowDocument;
|
|
412
|
+
readonly service: FlowDragService;
|
|
413
|
+
transforms: FlowNodeTransformData[];
|
|
414
|
+
protected editorStateConfig: EditorStateConfigEntity;
|
|
415
|
+
protected playgroundConfigEntity: PlaygroundConfigEntity;
|
|
416
|
+
protected flowDragConfigEntity: FlowDragEntity;
|
|
417
|
+
protected flowRenderStateEntity: FlowRendererStateEntity;
|
|
418
|
+
protected selectConfigEntity: FlowSelectConfigEntity;
|
|
419
|
+
private initialPosition;
|
|
420
|
+
private dragOffset;
|
|
421
|
+
get transitions(): FlowNodeTransitionData[];
|
|
422
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
423
|
+
get dragStartEntity(): FlowNodeEntity | undefined;
|
|
424
|
+
set dragStartEntity(entity: FlowNodeEntity | undefined);
|
|
425
|
+
get dragEntities(): FlowNodeEntity[];
|
|
426
|
+
set dragEntities(entities: FlowNodeEntity[]);
|
|
427
|
+
private dragNodeComp;
|
|
428
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
429
|
+
draggingNodeMask: HTMLDivElement;
|
|
430
|
+
protected isGrab(): boolean;
|
|
431
|
+
setDraggingStatus(status: boolean): void;
|
|
432
|
+
dragEnable(e: MouseEvent): boolean;
|
|
433
|
+
handleMouseMove(event: MouseEvent): void;
|
|
434
|
+
handleMouseUp(): void;
|
|
435
|
+
protected _dragger: PlaygroundDrag<undefined>;
|
|
436
|
+
/**
|
|
437
|
+
* 开始拖拽事件
|
|
438
|
+
* @param e
|
|
439
|
+
*/
|
|
440
|
+
startDrag(e: {
|
|
441
|
+
clientX: number;
|
|
442
|
+
clientY: number;
|
|
443
|
+
}, { dragStartEntity: startEntityFromProps, dragEntities, }: {
|
|
444
|
+
dragStartEntity: FlowNodeEntity;
|
|
445
|
+
dragEntities?: FlowNodeEntity[];
|
|
446
|
+
}, options?: {
|
|
447
|
+
dragOffsetX?: number;
|
|
448
|
+
dragOffsetY?: number;
|
|
449
|
+
}): Promise<void>;
|
|
450
|
+
onReady(): void;
|
|
451
|
+
render(): React.JSX.Element;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface FlowSelectorBoxOptions extends LayerOptions {
|
|
455
|
+
/**
|
|
456
|
+
* 默认不提供则为点击空白地方可以框选
|
|
457
|
+
* @param e
|
|
458
|
+
* @param entity
|
|
459
|
+
*/
|
|
460
|
+
canSelect?: (e: MouseEvent, entity: SelectorBoxConfigEntity) => boolean;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* 流程选择框
|
|
464
|
+
*/
|
|
465
|
+
declare class FlowSelectorBoxLayer extends Layer<FlowSelectorBoxOptions> {
|
|
466
|
+
protected flowDocument: FlowDocument;
|
|
467
|
+
readonly contextMenuService: ContextMenuService;
|
|
468
|
+
protected playgroundConfigEntity: PlaygroundConfigEntity;
|
|
469
|
+
readonly selectionService: SelectionService;
|
|
470
|
+
protected selectorBoxConfigEntity: SelectorBoxConfigEntity;
|
|
471
|
+
protected selectConfigEntity: FlowSelectConfigEntity;
|
|
472
|
+
protected editorStateConfig: EditorStateConfigEntity;
|
|
473
|
+
readonly node: HTMLDivElement;
|
|
474
|
+
/**
|
|
475
|
+
* 选择框
|
|
476
|
+
*/
|
|
477
|
+
protected selectorBox: _flowgram_ai_utils.CacheManager<_flowgram_ai_utils.DOMCache, _flowgram_ai_utils.CacheOriginItem>;
|
|
478
|
+
/**
|
|
479
|
+
* 用于遮挡鼠标,避免触发 hover
|
|
480
|
+
*/
|
|
481
|
+
protected selectorBoxBlock: _flowgram_ai_utils.CacheManager<_flowgram_ai_utils.DOMCache, _flowgram_ai_utils.CacheOriginItem>;
|
|
482
|
+
protected transformVisibles: FlowNodeTransformData[];
|
|
483
|
+
/**
|
|
484
|
+
* 拖动选择框
|
|
485
|
+
*/
|
|
486
|
+
protected selectboxDragger: PlaygroundDrag<undefined>;
|
|
487
|
+
onReady(): void;
|
|
488
|
+
isEnabled(): boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Destroy
|
|
491
|
+
*/
|
|
492
|
+
dispose(): void;
|
|
493
|
+
protected updateSelectorBox(selector: SelectorBoxConfigEntity): void;
|
|
494
|
+
private nodeSelectable;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
interface SelectorBoxPopoverProps {
|
|
498
|
+
bounds: Rectangle;
|
|
499
|
+
config: PlaygroundConfig;
|
|
500
|
+
flowSelectConfig: FlowSelectConfigEntity;
|
|
501
|
+
commandRegistry: CommandRegistry;
|
|
502
|
+
children?: React.ReactNode;
|
|
503
|
+
}
|
|
504
|
+
interface FlowSelectorBoundsLayerOptions extends LayerOptions {
|
|
505
|
+
ignoreOneSelect?: boolean;
|
|
506
|
+
boundsPadding?: number;
|
|
507
|
+
disableBackground?: boolean;
|
|
508
|
+
backgroundClassName?: string;
|
|
509
|
+
foregroundClassName?: string;
|
|
510
|
+
SelectorBoxPopover?: React.FC<SelectorBoxPopoverProps>;
|
|
511
|
+
CustomBoundsRenderer?: React.FC<SelectorBoxPopoverProps>;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* 流程节点被框选后的边界区域渲染
|
|
515
|
+
*/
|
|
516
|
+
declare class FlowSelectorBoundsLayer extends Layer<FlowSelectorBoundsLayerOptions> {
|
|
517
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
518
|
+
readonly commandRegistry: CommandRegistry;
|
|
519
|
+
protected flowSelectConfigEntity: FlowSelectConfigEntity;
|
|
520
|
+
protected editorStateConfig: EditorStateConfigEntity;
|
|
521
|
+
protected selectorBoxConfigEntity: SelectorBoxConfigEntity;
|
|
522
|
+
/**
|
|
523
|
+
* 需要监听节点的展开和收起状态,重新绘制边框
|
|
524
|
+
*/
|
|
525
|
+
renderStates: FlowNodeRenderData[];
|
|
526
|
+
_transforms: FlowNodeTransformData[];
|
|
527
|
+
readonly node: HTMLDivElement;
|
|
528
|
+
readonly selectBoundsBackground: HTMLDivElement;
|
|
529
|
+
onReady(): void;
|
|
530
|
+
onZoom(scale: number): void;
|
|
531
|
+
onViewportChange(): void;
|
|
532
|
+
isEnabled(): boolean;
|
|
533
|
+
render(): JSX.Element;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* 流程右键菜单
|
|
538
|
+
*/
|
|
539
|
+
declare class FlowContextMenuLayer extends Layer {
|
|
540
|
+
readonly commandRegistry: CommandRegistry;
|
|
541
|
+
readonly rendererRegistry: FlowRendererRegistry;
|
|
542
|
+
readonly contextMenuService: ContextMenuService;
|
|
543
|
+
protected flowSelectConfigEntity: FlowSelectConfigEntity;
|
|
544
|
+
readonly selectionService: SelectionService;
|
|
545
|
+
protected playgroundConfigEntity: PlaygroundConfigEntity;
|
|
546
|
+
protected editorStateConfig: EditorStateConfigEntity;
|
|
547
|
+
protected selectorBoxConfigEntity: SelectorBoxConfigEntity;
|
|
548
|
+
readonly node: HTMLDivElement;
|
|
549
|
+
readonly nodeRef: React.RefObject<{
|
|
550
|
+
setVisible: (v: boolean) => void;
|
|
551
|
+
}>;
|
|
552
|
+
isEnabled(): boolean;
|
|
553
|
+
onReady(): void;
|
|
554
|
+
onScroll(): void;
|
|
555
|
+
onZoom(): void;
|
|
556
|
+
/**
|
|
557
|
+
* Destroy
|
|
558
|
+
*/
|
|
559
|
+
dispose(): void;
|
|
560
|
+
/**
|
|
561
|
+
* 渲染工具栏
|
|
562
|
+
*/
|
|
563
|
+
renderCommandMenus(): JSX.Element[];
|
|
564
|
+
render(): JSX.Element;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* 控制滚动边界
|
|
569
|
+
*/
|
|
570
|
+
declare class FlowScrollLimitLayer extends Layer {
|
|
571
|
+
readonly document: FlowDocument;
|
|
572
|
+
getInitScroll(): ScrollSchema;
|
|
573
|
+
onReady(): void;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
declare const FlowRendererContribution: unique symbol;
|
|
577
|
+
interface FlowRendererContribution {
|
|
578
|
+
registerRenderer?(registry: FlowRendererRegistry): void;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
declare const FlowRendererContainerModule: ContainerModule;
|
|
582
|
+
|
|
583
|
+
declare const MARK_ARROW_ID = "line-marker-arrow";
|
|
584
|
+
|
|
585
|
+
declare const MARK_ACTIVATED_ARROW_ID = "line-marker-arrow-activated";
|
|
586
|
+
|
|
587
|
+
declare function useBaseColor(): {
|
|
588
|
+
baseColor: string;
|
|
589
|
+
baseActivatedColor: string;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
export { type CollisionRetType, FlowContextMenuLayer, FlowDebugLayer, FlowDragEntity, FlowDragLayer, type FlowDragOptions, FlowLabelsLayer, FlowLinesLayer, FlowNodesContentLayer, FlowNodesTransformLayer, type FlowNodesTransformLayerOptions, FlowRendererCommandCategory, type FlowRendererComponent, FlowRendererComponentType, FlowRendererContainerModule, FlowRendererContribution, FlowRendererKey, FlowRendererRegistry, FlowScrollBarLayer, FlowScrollLimitLayer, FlowSelectConfigEntity, FlowSelectorBoundsLayer, type FlowSelectorBoundsLayerOptions, FlowSelectorBoxLayer, type FlowSelectorBoxOptions, FlowTextKey, MARK_ACTIVATED_ARROW_ID, MARK_ARROW_ID, ScrollBarEvents, type ScrollBarOptions, type SelectorBoxConfigData, SelectorBoxConfigEntity, type SelectorBoxPopoverProps, useBaseColor };
|