@blueking/flow-canvas 0.0.9 → 0.0.11

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/index.d.ts CHANGED
@@ -224,6 +224,8 @@ interface CanvasHistory {
224
224
  clear(): void;
225
225
  createSnapshot(): FlowModel;
226
226
  replaceFlowModel(model: FlowModel): void;
227
+ /** 更新 FlowModel,同时保留历史栈(当前状态入 undo 栈)。 */
228
+ updateFlowModel(model: FlowModel, label?: string): void;
227
229
  }
228
230
  interface CanvasHistoryOptions {
229
231
  maxHistorySize?: number;
@@ -267,9 +269,20 @@ interface NodeDecoration {
267
269
  };
268
270
  borderColor?: string;
269
271
  }
272
+ interface EdgeGradientStop {
273
+ offset: number;
274
+ color: string;
275
+ opacity?: number;
276
+ }
277
+ interface EdgeStrokeGradient {
278
+ type: 'linearGradient';
279
+ stops: EdgeGradientStop[];
280
+ attrs?: Record<string, unknown>;
281
+ }
270
282
  interface EdgeDecoration {
271
283
  className?: string;
272
- strokeColor?: string;
284
+ strokeColor?: string | EdgeStrokeGradient;
285
+ targetMarkerColor?: string;
273
286
  }
274
287
  interface ContextMenuItem {
275
288
  id: string;
@@ -352,11 +365,12 @@ interface InsertNodeOptions {
352
365
  label?: string;
353
366
  direction?: InsertDirection;
354
367
  }
368
+ type ZoomToFitOptions = Parameters<Graph['zoomToFit']>[0];
355
369
  interface CanvasApi {
356
370
  zoomIn(): void;
357
371
  zoomOut(): void;
358
372
  zoomTo(value: number): void;
359
- zoomToFit(): void;
373
+ zoomToFit(options?: ZoomToFitOptions): void;
360
374
  getZoom(): number;
361
375
  centerContent(): void;
362
376
  scrollToOrigin(): void;
@@ -414,6 +428,10 @@ interface QuickAddConfig {
414
428
  getPort?: QuickAddPortResolver;
415
429
  /** 点击 quick-add 插入节点时使用的方向;默认跟随绑定 port 的标准方向,不可推断时回退为 'right' */
416
430
  insertDirection?: InsertDirection | QuickAddInsertDirectionResolver;
431
+ /** 弹出 quick-add 面板时,如右侧超出浏览器可视区,则自动左移画布,默认 true */
432
+ autoPanOnOpen?: boolean;
433
+ /** autoPanOnOpen 生效时,弹层与浏览器右边缘保留的安全间距,默认 16px */
434
+ autoPanPadding?: number;
417
435
  }
418
436
  interface EdgeDropConfig {
419
437
  /** 全局开关,默认 false */
@@ -628,6 +646,8 @@ interface CanvasEditorContext {
628
646
  idGenerator: IdGenerator;
629
647
  executeCommand(envelope: CommandEnvelope): CommandExecutionResult;
630
648
  replaceFlowModel(model: FlowModel): void;
649
+ /** 更新 FlowModel,同时保留历史栈(当前状态入 undo 栈),支持撤销。 */
650
+ updateFlowModel(model: FlowModel, label?: string): void;
631
651
  setMode(mode: CanvasMode): void;
632
652
  /** 框选模式:开启后左键拖拽画布空白区域为框选,关闭时为画布平移 */
633
653
  selectionMode: Ref<boolean>;
@@ -769,6 +789,8 @@ declare const _default$1: typeof __VLS_export$1;
769
789
  type __VLS_Props = {
770
790
  node: FlowNodeModel;
771
791
  portPosition: ScreenPosition;
792
+ autoPanOnOpen?: boolean;
793
+ autoPanPadding?: number;
772
794
  };
773
795
  declare function closePopover(): void;
774
796
  declare var __VLS_7: {};
@@ -783,12 +805,14 @@ declare const __VLS_base: vue.DefineComponent<__VLS_Props, {
783
805
  mouseleave: () => any;
784
806
  open: (nodeId: string) => any;
785
807
  "start-drag": (nodeId: string) => any;
808
+ "viewport-overflow-right": (overflowRight: number) => any;
786
809
  }, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{
787
810
  onClose?: (() => any) | undefined;
788
811
  onMouseenter?: (() => any) | undefined;
789
812
  onMouseleave?: (() => any) | undefined;
790
813
  onOpen?: ((nodeId: string) => any) | undefined;
791
814
  "onStart-drag"?: ((nodeId: string) => any) | undefined;
815
+ "onViewport-overflow-right"?: ((overflowRight: number) => any) | undefined;
792
816
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
793
817
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
794
818
  declare const _default: typeof __VLS_export;
@@ -877,7 +901,6 @@ interface SearchNodeMeta {
877
901
  }
878
902
  interface SearchPluginOptions {
879
903
  placeholder?: string;
880
- emptyText?: string;
881
904
  maxResults?: number;
882
905
  getNodeMeta?: (node: FlowNodeModel) => SearchNodeMeta | null | undefined;
883
906
  }
@@ -901,4 +924,4 @@ declare function minimapPlugin(options?: MinimapPluginOptions): CanvasPlugin;
901
924
  declare function clipboardPlugin(): CanvasPlugin;
902
925
 
903
926
  export { CanvasConstraintError, _default$5 as CanvasLayout, _default$3 as CanvasNodePalette, _default$6 as CanvasRuntime, CanvasSchemaError, _default$4 as CanvasToolbar, _default$2 as DefaultNode, _default$1 as NodeActionsToolbar, _default as NodeQuickAddPopover, applyCanvasCommand, clipboardPlugin, connectionValidatorPlugin, createBuiltinEdgeTypes, createCanvasHistory, createDefaultSchema, createDefaultToolbarItems, createEmptyFlowModel, generateId, minimapPlugin, searchPlugin, selectionPlugin, snaplinePlugin, useCanvasEditor };
904
- export type { BuiltinEdgeType, BuiltinToolbarType, CanvasApi, CanvasCallbackContext, CanvasCommand, CanvasEdgeDefinition, CanvasEditorContext, CanvasEditorOptions, CanvasHistory, CanvasHistoryOptions, CanvasMode, CanvasNodeDefinition, CanvasPlugin, CanvasPosition, CanvasSchema, CanvasSelection, CanvasToolbarItem, CanvasUiEvent, CommandEnvelope, CommandExecutionError, CommandExecutionResult, CommandPreview, CommandRejection, CommandSource, ConnectionValidateContext, ConnectionValidateResult, ConnectionValidator, ContextMenuItem, CoreToolbarType, DefaultNodeTypeConfig, DefaultSchemaOptions, DefaultSchemaResult, DefaultToolbarItemsOptions, DeleteSelectionOptions, EdgeDecoration, EdgeDropConfig, EdgeRenderState, EdgeStyle, EditorPluginContext, ExportOptions, FlowEdgeLabelModel, FlowEdgeModel, FlowModel, FlowModelChangeEvent, FlowNodeModel, FlowPortModel, GraphWithSelection, IdGenerator, InsertDirection, InsertNodeOptions, MinimapPluginOptions, NodeActionsConfig, NodeBehaviorConfig, NodeDecoration, NodePaletteItem, OverlayManager, PluginManagedToolbarType, QuickAddConfig, QuickAddInsertDirectionResolver, QuickAddPortResolver, RuntimePluginContext, ScreenPosition, SearchNodeMeta, SearchPluginOptions, SelectionPluginOptions, SnaplinePluginOptions };
927
+ export type { BuiltinEdgeType, BuiltinToolbarType, CanvasApi, CanvasCallbackContext, CanvasCommand, CanvasEdgeDefinition, CanvasEditorContext, CanvasEditorOptions, CanvasHistory, CanvasHistoryOptions, CanvasMode, CanvasNodeDefinition, CanvasPlugin, CanvasPosition, CanvasSchema, CanvasSelection, CanvasToolbarItem, CanvasUiEvent, CommandEnvelope, CommandExecutionError, CommandExecutionResult, CommandPreview, CommandRejection, CommandSource, ConnectionValidateContext, ConnectionValidateResult, ConnectionValidator, ContextMenuItem, CoreToolbarType, DefaultNodeTypeConfig, DefaultSchemaOptions, DefaultSchemaResult, DefaultToolbarItemsOptions, DeleteSelectionOptions, EdgeDecoration, EdgeDropConfig, EdgeRenderState, EdgeStyle, EditorPluginContext, ExportOptions, FlowEdgeLabelModel, FlowEdgeModel, FlowModel, FlowModelChangeEvent, FlowNodeModel, FlowPortModel, GraphWithSelection, IdGenerator, InsertDirection, InsertNodeOptions, MinimapPluginOptions, NodeActionsConfig, NodeBehaviorConfig, NodeDecoration, NodePaletteItem, OverlayManager, PluginManagedToolbarType, QuickAddConfig, QuickAddInsertDirectionResolver, QuickAddPortResolver, RuntimePluginContext, ScreenPosition, SearchNodeMeta, SearchPluginOptions, SelectionPluginOptions, SnaplinePluginOptions, ZoomToFitOptions };