@logicflow/core 2.1.5 → 2.1.7
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/.turbo/turbo-build$colon$dev.log +2 -2
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/view/edge/BaseEdge.js +9 -0
- package/es/view/node/BaseNode.js +9 -1
- package/lib/view/edge/BaseEdge.js +9 -0
- package/lib/view/node/BaseNode.js +8 -0
- package/package.json +1 -1
- package/src/view/edge/BaseEdge.tsx +10 -0
- package/src/view/node/BaseNode.tsx +10 -1
- package/stats.html +1 -1
package/es/view/edge/BaseEdge.js
CHANGED
|
@@ -43,6 +43,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
43
43
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
44
44
|
import { Component, createRef } from 'preact/compat';
|
|
45
45
|
import { Circle } from '../shape';
|
|
46
|
+
import { isNil, isFunction } from 'lodash-es';
|
|
46
47
|
import { LineText } from '../text';
|
|
47
48
|
import { ElementState, EventType, ModelType, TextMode } from '../../constant';
|
|
48
49
|
import { isMultipleSelect, getClosestPointOfPolyline, degrees, getThetaOfVector, } from '../../util';
|
|
@@ -193,6 +194,14 @@ var BaseEdge = /** @class */ (function (_super) {
|
|
|
193
194
|
e: e,
|
|
194
195
|
position: position,
|
|
195
196
|
});
|
|
197
|
+
// 会偶现边点击后会马上失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
198
|
+
var el_1 = e.currentTarget;
|
|
199
|
+
var rAF = !isNil(window) && isFunction(window.requestAnimationFrame)
|
|
200
|
+
? window.requestAnimationFrame.bind(window)
|
|
201
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
202
|
+
rAF(function () {
|
|
203
|
+
el_1.focus();
|
|
204
|
+
});
|
|
196
205
|
}
|
|
197
206
|
var editConfigModel = graphModel.editConfigModel;
|
|
198
207
|
graphModel.selectEdgeById(model.id, isMultipleSelect(e, editConfigModel));
|
package/es/view/node/BaseNode.js
CHANGED
|
@@ -54,7 +54,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
54
54
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
55
55
|
import { Component } from 'preact/compat';
|
|
56
56
|
import { reaction } from 'mobx';
|
|
57
|
-
import { map } from 'lodash-es';
|
|
57
|
+
import { map, isNil, isFunction } from 'lodash-es';
|
|
58
58
|
import Anchor from '../Anchor';
|
|
59
59
|
import { BaseText } from '../text';
|
|
60
60
|
import { ElementState, EventType, TextMode } from '../../constant';
|
|
@@ -239,6 +239,14 @@ var BaseNode = /** @class */ (function (_super) {
|
|
|
239
239
|
else {
|
|
240
240
|
graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, eventOptions);
|
|
241
241
|
graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions);
|
|
242
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
243
|
+
var el_1 = e.currentTarget;
|
|
244
|
+
var rAF = !isNil(window) && isFunction(window.requestAnimationFrame)
|
|
245
|
+
? window.requestAnimationFrame.bind(window)
|
|
246
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
247
|
+
rAF(function () {
|
|
248
|
+
el_1.focus();
|
|
249
|
+
});
|
|
242
250
|
}
|
|
243
251
|
};
|
|
244
252
|
_this.handleContextMenu = function (ev) {
|
|
@@ -69,6 +69,7 @@ exports.BaseEdge = void 0;
|
|
|
69
69
|
var jsx_runtime_1 = require("preact/jsx-runtime");
|
|
70
70
|
var compat_1 = require("preact/compat");
|
|
71
71
|
var shape_1 = require("../shape");
|
|
72
|
+
var lodash_es_1 = require("lodash-es");
|
|
72
73
|
var text_1 = require("../text");
|
|
73
74
|
var constant_1 = require("../../constant");
|
|
74
75
|
var util_1 = require("../../util");
|
|
@@ -219,6 +220,14 @@ var BaseEdge = /** @class */ (function (_super) {
|
|
|
219
220
|
e: e,
|
|
220
221
|
position: position,
|
|
221
222
|
});
|
|
223
|
+
// 会偶现边点击后会马上失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
224
|
+
var el_1 = e.currentTarget;
|
|
225
|
+
var rAF = !(0, lodash_es_1.isNil)(window) && (0, lodash_es_1.isFunction)(window.requestAnimationFrame)
|
|
226
|
+
? window.requestAnimationFrame.bind(window)
|
|
227
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
228
|
+
rAF(function () {
|
|
229
|
+
el_1.focus();
|
|
230
|
+
});
|
|
222
231
|
}
|
|
223
232
|
var editConfigModel = graphModel.editConfigModel;
|
|
224
233
|
graphModel.selectEdgeById(model.id, (0, util_1.isMultipleSelect)(e, editConfigModel));
|
|
@@ -243,6 +243,14 @@ var BaseNode = /** @class */ (function (_super) {
|
|
|
243
243
|
else {
|
|
244
244
|
graphModel.eventCenter.emit(constant_1.EventType.ELEMENT_CLICK, eventOptions);
|
|
245
245
|
graphModel.eventCenter.emit(constant_1.EventType.NODE_CLICK, eventOptions);
|
|
246
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
247
|
+
var el_1 = e.currentTarget;
|
|
248
|
+
var rAF = !(0, lodash_es_1.isNil)(window) && (0, lodash_es_1.isFunction)(window.requestAnimationFrame)
|
|
249
|
+
? window.requestAnimationFrame.bind(window)
|
|
250
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
251
|
+
rAF(function () {
|
|
252
|
+
el_1.focus();
|
|
253
|
+
});
|
|
246
254
|
}
|
|
247
255
|
};
|
|
248
256
|
_this.handleContextMenu = function (ev) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createElement as h, Component, createRef } from 'preact/compat'
|
|
2
2
|
import { Circle } from '../shape'
|
|
3
|
+
import { isNil, isFunction } from 'lodash-es'
|
|
3
4
|
import { LineText } from '../text'
|
|
4
5
|
import LogicFlow from '../../LogicFlow'
|
|
5
6
|
import { GraphModel, BaseEdgeModel, PolylineEdgeModel } from '../../model'
|
|
@@ -550,6 +551,15 @@ export abstract class BaseEdge<P extends IProps> extends Component<
|
|
|
550
551
|
e,
|
|
551
552
|
position,
|
|
552
553
|
})
|
|
554
|
+
// 会偶现边点击后会马上失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
555
|
+
const el = e.currentTarget as HTMLElement
|
|
556
|
+
const rAF =
|
|
557
|
+
!isNil(window) && isFunction(window.requestAnimationFrame)
|
|
558
|
+
? window.requestAnimationFrame.bind(window)
|
|
559
|
+
: (fn: () => void) => setTimeout(fn, 0)
|
|
560
|
+
rAF(() => {
|
|
561
|
+
el.focus()
|
|
562
|
+
})
|
|
553
563
|
}
|
|
554
564
|
const { editConfigModel } = graphModel
|
|
555
565
|
graphModel.selectEdgeById(model.id, isMultipleSelect(e, editConfigModel))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement as h, Component } from 'preact/compat'
|
|
2
2
|
import { reaction, IReactionDisposer } from 'mobx'
|
|
3
|
-
import { map } from 'lodash-es'
|
|
3
|
+
import { map, isNil, isFunction } from 'lodash-es'
|
|
4
4
|
import Anchor from '../Anchor'
|
|
5
5
|
import { BaseText } from '../text'
|
|
6
6
|
import LogicFlow from '../../LogicFlow'
|
|
@@ -403,6 +403,15 @@ export abstract class BaseNode<P extends IProps = IProps> extends Component<
|
|
|
403
403
|
} else {
|
|
404
404
|
graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, eventOptions)
|
|
405
405
|
graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions)
|
|
406
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
407
|
+
const el = e.currentTarget as HTMLElement
|
|
408
|
+
const rAF =
|
|
409
|
+
!isNil(window) && isFunction(window.requestAnimationFrame)
|
|
410
|
+
? window.requestAnimationFrame.bind(window)
|
|
411
|
+
: (fn: () => void) => setTimeout(fn, 0)
|
|
412
|
+
rAF(() => {
|
|
413
|
+
el.focus()
|
|
414
|
+
})
|
|
406
415
|
}
|
|
407
416
|
}
|
|
408
417
|
|