@logicflow/extension 2.1.5 → 2.1.6

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.
@@ -9,7 +9,6 @@ var __values = (this && this.__values) || function(o) {
9
9
  };
10
10
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
11
  };
12
- import { createTeleportContainer, destroyTeleportContainer, } from '@logicflow/vue-node-registry';
13
12
  var MiniMap = /** @class */ (function () {
14
13
  function MiniMap(_a) {
15
14
  var lf = _a.lf, LogicFlow = _a.LogicFlow, options = _a.options;
@@ -107,8 +106,6 @@ var MiniMap = /** @class */ (function () {
107
106
  */
108
107
  this.hide = function () {
109
108
  if (_this.isShow) {
110
- // 隐藏小地图时摧毁实例
111
- destroyTeleportContainer(_this.lfMap.graphModel.flowId);
112
109
  _this.lf.off('graph:resize', _this.onGraphResize);
113
110
  _this.lfMap.destroy();
114
111
  // 保证重新创建实例时,小地图中内容偏移正确
@@ -279,12 +276,11 @@ var MiniMap = /** @class */ (function () {
279
276
  history: false,
280
277
  snapline: false,
281
278
  disabledPlugins: this.disabledPlugins,
279
+ isMiniMap: true,
282
280
  });
283
281
  // minimap中禁用adapter。
284
282
  // this.lfMap.adapterIn = (a) => a
285
283
  // this.lfMap.adapterOut = (a) => a
286
- // 创建teleport容器(vue3中生效)
287
- createTeleportContainer(miniMapWrap, this.lfMap.graphModel.flowId);
288
284
  this.miniMapWrap = miniMapWrap;
289
285
  this.createViewPort();
290
286
  miniMapWrap.addEventListener('click', this.mapClick);
@@ -526,7 +522,6 @@ var MiniMap = /** @class */ (function () {
526
522
  this.viewport = div;
527
523
  };
528
524
  MiniMap.prototype.destroy = function () {
529
- destroyTeleportContainer(this.lfMap.graphModel.flowId);
530
525
  this.lf.off('graph:resize', this.onGraphResize);
531
526
  };
532
527
  MiniMap.pluginName = 'miniMap';
@@ -12,6 +12,7 @@ export declare class SelectionSelect {
12
12
  private disabled;
13
13
  private isWholeNode;
14
14
  private isWholeEdge;
15
+ private originStatusSaved;
15
16
  exclusiveMode: boolean;
16
17
  private mouseDownInfo;
17
18
  private originalStopMoveGraph;
@@ -32,6 +32,7 @@ var SelectionSelect = /** @class */ (function () {
32
32
  this.disabled = true;
33
33
  this.isWholeNode = true;
34
34
  this.isWholeEdge = true;
35
+ this.originStatusSaved = false;
35
36
  this.exclusiveMode = false; // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
36
37
  // 用于区分选区和点击事件
37
38
  this.mouseDownInfo = null;
@@ -73,6 +74,11 @@ var SelectionSelect = /** @class */ (function () {
73
74
  }
74
75
  };
75
76
  this.drawOff = function (e) {
77
+ // 恢复原始的 stopMoveGraph 设置
78
+ _this.lf.updateEditConfig({
79
+ stopMoveGraph: _this.originalStopMoveGraph,
80
+ });
81
+ _this.originStatusSaved = false;
76
82
  // 处理鼠标抬起事件
77
83
  // 首先判断是否是点击,如果是,则清空框选
78
84
  if (_this.mouseDownInfo) {
@@ -92,10 +98,6 @@ var SelectionSelect = /** @class */ (function () {
92
98
  if (!_this.exclusiveMode) {
93
99
  document.removeEventListener('mouseup', _this.drawOff);
94
100
  }
95
- // 恢复原始的 stopMoveGraph 设置
96
- _this.lf.updateEditConfig({
97
- stopMoveGraph: _this.originalStopMoveGraph,
98
- });
99
101
  if (curStartPoint && curEndPoint) {
100
102
  var x = curStartPoint.x, y = curStartPoint.y;
101
103
  var x1 = curEndPoint.x, y1 = curEndPoint.y;
@@ -270,7 +272,11 @@ var SelectionSelect = /** @class */ (function () {
270
272
  time: Date.now(),
271
273
  };
272
274
  // 记录原始设置并临时禁止画布移动
273
- this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
275
+ if (!this.originStatusSaved) {
276
+ // 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
277
+ this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
278
+ this.originStatusSaved = true;
279
+ }
274
280
  this.lf.updateEditConfig({
275
281
  stopMoveGraph: true,
276
282
  });
@@ -12,7 +12,6 @@ var __values = (this && this.__values) || function(o) {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.MiniMap = void 0;
15
- var vue_node_registry_1 = require("@logicflow/vue-node-registry");
16
15
  var MiniMap = /** @class */ (function () {
17
16
  function MiniMap(_a) {
18
17
  var lf = _a.lf, LogicFlow = _a.LogicFlow, options = _a.options;
@@ -110,8 +109,6 @@ var MiniMap = /** @class */ (function () {
110
109
  */
111
110
  this.hide = function () {
112
111
  if (_this.isShow) {
113
- // 隐藏小地图时摧毁实例
114
- (0, vue_node_registry_1.destroyTeleportContainer)(_this.lfMap.graphModel.flowId);
115
112
  _this.lf.off('graph:resize', _this.onGraphResize);
116
113
  _this.lfMap.destroy();
117
114
  // 保证重新创建实例时,小地图中内容偏移正确
@@ -282,12 +279,11 @@ var MiniMap = /** @class */ (function () {
282
279
  history: false,
283
280
  snapline: false,
284
281
  disabledPlugins: this.disabledPlugins,
282
+ isMiniMap: true,
285
283
  });
286
284
  // minimap中禁用adapter。
287
285
  // this.lfMap.adapterIn = (a) => a
288
286
  // this.lfMap.adapterOut = (a) => a
289
- // 创建teleport容器(vue3中生效)
290
- (0, vue_node_registry_1.createTeleportContainer)(miniMapWrap, this.lfMap.graphModel.flowId);
291
287
  this.miniMapWrap = miniMapWrap;
292
288
  this.createViewPort();
293
289
  miniMapWrap.addEventListener('click', this.mapClick);
@@ -529,7 +525,6 @@ var MiniMap = /** @class */ (function () {
529
525
  this.viewport = div;
530
526
  };
531
527
  MiniMap.prototype.destroy = function () {
532
- (0, vue_node_registry_1.destroyTeleportContainer)(this.lfMap.graphModel.flowId);
533
528
  this.lf.off('graph:resize', this.onGraphResize);
534
529
  };
535
530
  MiniMap.pluginName = 'miniMap';
@@ -12,6 +12,7 @@ export declare class SelectionSelect {
12
12
  private disabled;
13
13
  private isWholeNode;
14
14
  private isWholeEdge;
15
+ private originStatusSaved;
15
16
  exclusiveMode: boolean;
16
17
  private mouseDownInfo;
17
18
  private originalStopMoveGraph;
@@ -35,6 +35,7 @@ var SelectionSelect = /** @class */ (function () {
35
35
  this.disabled = true;
36
36
  this.isWholeNode = true;
37
37
  this.isWholeEdge = true;
38
+ this.originStatusSaved = false;
38
39
  this.exclusiveMode = false; // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
39
40
  // 用于区分选区和点击事件
40
41
  this.mouseDownInfo = null;
@@ -76,6 +77,11 @@ var SelectionSelect = /** @class */ (function () {
76
77
  }
77
78
  };
78
79
  this.drawOff = function (e) {
80
+ // 恢复原始的 stopMoveGraph 设置
81
+ _this.lf.updateEditConfig({
82
+ stopMoveGraph: _this.originalStopMoveGraph,
83
+ });
84
+ _this.originStatusSaved = false;
79
85
  // 处理鼠标抬起事件
80
86
  // 首先判断是否是点击,如果是,则清空框选
81
87
  if (_this.mouseDownInfo) {
@@ -95,10 +101,6 @@ var SelectionSelect = /** @class */ (function () {
95
101
  if (!_this.exclusiveMode) {
96
102
  document.removeEventListener('mouseup', _this.drawOff);
97
103
  }
98
- // 恢复原始的 stopMoveGraph 设置
99
- _this.lf.updateEditConfig({
100
- stopMoveGraph: _this.originalStopMoveGraph,
101
- });
102
104
  if (curStartPoint && curEndPoint) {
103
105
  var x = curStartPoint.x, y = curStartPoint.y;
104
106
  var x1 = curEndPoint.x, y1 = curEndPoint.y;
@@ -273,7 +275,11 @@ var SelectionSelect = /** @class */ (function () {
273
275
  time: Date.now(),
274
276
  };
275
277
  // 记录原始设置并临时禁止画布移动
276
- this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
278
+ if (!this.originStatusSaved) {
279
+ // 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
280
+ this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph;
281
+ this.originStatusSaved = true;
282
+ }
277
283
  this.lf.updateEditConfig({
278
284
  stopMoveGraph: true,
279
285
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicflow/extension",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "LogicFlow Extensions",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -20,8 +20,8 @@
20
20
  "author": "Logicflow-Team",
21
21
  "license": "Apache-2.0",
22
22
  "peerDependencies": {
23
- "@logicflow/vue-node-registry": "1.1.4",
24
- "@logicflow/core": "2.1.3"
23
+ "@logicflow/core": "2.1.4",
24
+ "@logicflow/vue-node-registry": "1.1.5"
25
25
  },
26
26
  "dependencies": {
27
27
  "@antv/hierarchy": "^0.6.11",
@@ -32,8 +32,8 @@
32
32
  "preact": "^10.17.1",
33
33
  "rangy": "^1.3.1",
34
34
  "vanilla-picker": "^2.12.3",
35
- "@logicflow/core": "2.1.3",
36
- "@logicflow/vue-node-registry": "1.1.4"
35
+ "@logicflow/core": "2.1.4",
36
+ "@logicflow/vue-node-registry": "1.1.5"
37
37
  },
38
38
  "devDependencies": {
39
39
  "less": "^4.1.1",
@@ -1,8 +1,4 @@
1
1
  import LogicFlow from '@logicflow/core'
2
- import {
3
- createTeleportContainer,
4
- destroyTeleportContainer,
5
- } from '@logicflow/vue-node-registry'
6
2
 
7
3
  import Position = LogicFlow.Position
8
4
  import MiniMapOption = MiniMap.MiniMapOption
@@ -240,8 +236,6 @@ export class MiniMap {
240
236
  */
241
237
  public hide = () => {
242
238
  if (this.isShow) {
243
- // 隐藏小地图时摧毁实例
244
- destroyTeleportContainer(this.lfMap.graphModel.flowId)
245
239
  this.lf.off('graph:resize', this.onGraphResize)
246
240
  this.lfMap.destroy()
247
241
  // 保证重新创建实例时,小地图中内容偏移正确
@@ -363,14 +357,12 @@ export class MiniMap {
363
357
  history: false,
364
358
  snapline: false,
365
359
  disabledPlugins: this.disabledPlugins,
360
+ isMiniMap: true,
366
361
  })
367
362
  // minimap中禁用adapter。
368
363
  // this.lfMap.adapterIn = (a) => a
369
364
  // this.lfMap.adapterOut = (a) => a
370
365
 
371
- // 创建teleport容器(vue3中生效)
372
- createTeleportContainer(miniMapWrap, this.lfMap.graphModel.flowId)
373
-
374
366
  this.miniMapWrap = miniMapWrap
375
367
  this.createViewPort()
376
368
  miniMapWrap.addEventListener('click', this.mapClick)
@@ -687,7 +679,6 @@ export class MiniMap {
687
679
  }
688
680
 
689
681
  destroy() {
690
- destroyTeleportContainer(this.lfMap.graphModel.flowId)
691
682
  this.lf.off('graph:resize', this.onGraphResize)
692
683
  }
693
684
  }
@@ -18,6 +18,7 @@ export class SelectionSelect {
18
18
  private disabled = true
19
19
  private isWholeNode = true
20
20
  private isWholeEdge = true
21
+ private originStatusSaved = false
21
22
  exclusiveMode = false // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
22
23
  // 用于区分选区和点击事件
23
24
  private mouseDownInfo: {
@@ -97,7 +98,6 @@ export class SelectionSelect {
97
98
 
98
99
  private addEventListeners() {
99
100
  if (!this.container) return
100
-
101
101
  if (this.exclusiveMode) {
102
102
  // 独占模式:监听 container 的 mousedown 事件
103
103
  this.container.style.pointerEvents = 'auto'
@@ -143,9 +143,12 @@ export class SelectionSelect {
143
143
  y: e.clientY,
144
144
  time: Date.now(),
145
145
  }
146
-
147
146
  // 记录原始设置并临时禁止画布移动
148
- this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph!
147
+ if (!this.originStatusSaved) {
148
+ // 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
149
+ this.originalStopMoveGraph = this.lf.getEditConfig().stopMoveGraph!
150
+ this.originStatusSaved = true
151
+ }
149
152
  this.lf.updateEditConfig({
150
153
  stopMoveGraph: true,
151
154
  })
@@ -249,6 +252,11 @@ export class SelectionSelect {
249
252
  }
250
253
  }
251
254
  private drawOff = (e: MouseEvent) => {
255
+ // 恢复原始的 stopMoveGraph 设置
256
+ this.lf.updateEditConfig({
257
+ stopMoveGraph: this.originalStopMoveGraph,
258
+ })
259
+ this.originStatusSaved = false
252
260
  // 处理鼠标抬起事件
253
261
  // 首先判断是否是点击,如果是,则清空框选
254
262
  if (this.mouseDownInfo) {
@@ -271,11 +279,6 @@ export class SelectionSelect {
271
279
  document.removeEventListener('mouseup', this.drawOff)
272
280
  }
273
281
 
274
- // 恢复原始的 stopMoveGraph 设置
275
- this.lf.updateEditConfig({
276
- stopMoveGraph: this.originalStopMoveGraph,
277
- })
278
-
279
282
  if (curStartPoint && curEndPoint) {
280
283
  const { x, y } = curStartPoint
281
284
  const { x: x1, y: y1 } = curEndPoint