@flowgram.ai/document 0.1.0-alpha.12 → 0.1.0-alpha.14
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 +14 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -131,7 +131,8 @@ var DEFAULT_SPACING = {
|
|
|
131
131
|
// block 底部留白
|
|
132
132
|
INLINE_BLOCKS_PADDING_TOP: 30,
|
|
133
133
|
// block list 上部留白间距
|
|
134
|
-
|
|
134
|
+
// JS 浮点数有误差,1046.6 -1006.6 = 39.9999999,会导致 间距/20 < 2 导致布局计算问题,因此需要额外增加 0.1 像素
|
|
135
|
+
[DefaultSpacingKey.INLINE_BLOCKS_PADDING_BOTTOM]: 40.1,
|
|
135
136
|
// block lit 下部留白间距,因为有两个拐弯,所以翻一倍
|
|
136
137
|
MIN_INLINE_BLOCK_SPACING: 200,
|
|
137
138
|
// 分支间最小边距 (垂直布局)
|
|
@@ -479,6 +480,11 @@ var _FlowNodeTransformData = class _FlowNodeTransformData extends EntityData2 {
|
|
|
479
480
|
y: position.y
|
|
480
481
|
};
|
|
481
482
|
}
|
|
483
|
+
set position(position) {
|
|
484
|
+
this.transform.update({
|
|
485
|
+
position
|
|
486
|
+
});
|
|
487
|
+
}
|
|
482
488
|
set size(size) {
|
|
483
489
|
const { width, height } = this.data.size;
|
|
484
490
|
if (this.isContainer) return;
|
|
@@ -1171,7 +1177,7 @@ var FlowDocumentTransformerEntity = class extends ConfigEntity {
|
|
|
1171
1177
|
FlowDocumentTransformerEntity.type = "FlowDocumentTransformerEntity";
|
|
1172
1178
|
|
|
1173
1179
|
// src/entities/flow-renderer-state-entity.ts
|
|
1174
|
-
import { debounce } from "lodash";
|
|
1180
|
+
import { debounce } from "lodash-es";
|
|
1175
1181
|
import { ConfigEntity as ConfigEntity2 } from "@flowgram.ai/core";
|
|
1176
1182
|
var FlowRendererStateEntity = class extends ConfigEntity2 {
|
|
1177
1183
|
getDefaultConfig() {
|
|
@@ -1232,7 +1238,7 @@ var FlowRendererStateEntity = class extends ConfigEntity2 {
|
|
|
1232
1238
|
FlowRendererStateEntity.type = "FlowRendererStateEntity";
|
|
1233
1239
|
|
|
1234
1240
|
// src/flow-document.ts
|
|
1235
|
-
import { omit } from "lodash";
|
|
1241
|
+
import { omit } from "lodash-es";
|
|
1236
1242
|
import { inject as inject2, injectable as injectable2, multiInject, optional as optional2, postConstruct } from "inversify";
|
|
1237
1243
|
import { Emitter as Emitter5 } from "@flowgram.ai/utils";
|
|
1238
1244
|
import { EntityManager } from "@flowgram.ai/core";
|
|
@@ -1979,6 +1985,11 @@ var FlowDocument = class {
|
|
|
1979
1985
|
* 导出数据,可以重载
|
|
1980
1986
|
*/
|
|
1981
1987
|
toJSON() {
|
|
1988
|
+
if (this.disposed) {
|
|
1989
|
+
throw new Error(
|
|
1990
|
+
"The FlowDocument has been disposed and it is no longer possible to call toJSON."
|
|
1991
|
+
);
|
|
1992
|
+
}
|
|
1982
1993
|
return {
|
|
1983
1994
|
nodes: this.root.toJSON().blocks
|
|
1984
1995
|
};
|