@flowgram.ai/free-layout-core 0.5.3 → 0.5.5
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 +34 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/typings/index.d.mts +1 -1
- package/dist/typings/index.d.ts +1 -1
- package/dist/typings/workflow-drag.d.mts +1 -1
- package/dist/typings/workflow-drag.d.ts +1 -1
- package/dist/typings/workflow-json.d.mts +1 -1
- package/dist/typings/workflow-json.d.ts +1 -1
- package/dist/typings/workflow-line.d.mts +1 -1
- package/dist/typings/workflow-line.d.ts +1 -1
- package/dist/typings/workflow-node.d.mts +1 -1
- package/dist/typings/workflow-node.d.ts +1 -1
- package/dist/typings/workflow-operation.d.mts +1 -1
- package/dist/typings/workflow-operation.d.ts +1 -1
- package/dist/typings/workflow-registry.d.mts +1 -1
- package/dist/typings/workflow-registry.d.ts +1 -1
- package/dist/typings/workflow-sub-canvas.d.mts +1 -1
- package/dist/typings/workflow-sub-canvas.d.ts +1 -1
- package/dist/{workflow-node-entity-DgQT-wl9.d.mts → workflow-node-entity-DH5qlw7I.d.mts} +25 -4
- package/dist/{workflow-node-entity-kGsp2Roz.d.ts → workflow-node-entity-DWVtlA2a.d.ts} +25 -4
- package/package.json +9 -9
package/dist/esm/index.js
CHANGED
|
@@ -183,6 +183,27 @@ import {
|
|
|
183
183
|
PlaygroundConfigEntity,
|
|
184
184
|
TransformData as TransformData3
|
|
185
185
|
} from "@flowgram.ai/core";
|
|
186
|
+
|
|
187
|
+
// src/utils/location-config-to-point.ts
|
|
188
|
+
function locationConfigToPoint(bounds, config, _offset = { x: 0, y: 0 }) {
|
|
189
|
+
const offset = { ..._offset };
|
|
190
|
+
if (config.left !== void 0) {
|
|
191
|
+
offset.x += typeof config.left === "string" ? parseFloat(config.left) * 0.01 * bounds.width : config.left;
|
|
192
|
+
} else if (config.right !== void 0) {
|
|
193
|
+
offset.x += bounds.width - (typeof config.right === "string" ? parseFloat(config.right) * 0.01 * bounds.width : config.right);
|
|
194
|
+
}
|
|
195
|
+
if (config.top !== void 0) {
|
|
196
|
+
offset.y += typeof config.top === "string" ? parseFloat(config.top) * 0.01 * bounds.height : config.top;
|
|
197
|
+
} else if (config.bottom !== void 0) {
|
|
198
|
+
offset.y += bounds.height - (typeof config.bottom === "string" ? parseFloat(config.bottom) * 0.01 * bounds.height : config.bottom);
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
x: bounds.x + offset.x,
|
|
202
|
+
y: bounds.y + offset.y
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// src/entities/workflow-port-entity.ts
|
|
186
207
|
var PORT_SIZE = 24;
|
|
187
208
|
var WorkflowPortEntity = class extends Entity {
|
|
188
209
|
constructor(opts) {
|
|
@@ -195,6 +216,7 @@ var WorkflowPortEntity = class extends Entity {
|
|
|
195
216
|
this.portType = opts.type;
|
|
196
217
|
this._disabled = opts.disabled;
|
|
197
218
|
this._offset = opts.offset;
|
|
219
|
+
this._locationConfig = opts.locationConfig;
|
|
198
220
|
this._location = opts.location;
|
|
199
221
|
this._size = opts.size;
|
|
200
222
|
this.node = opts.node;
|
|
@@ -242,7 +264,7 @@ var WorkflowPortEntity = class extends Entity {
|
|
|
242
264
|
return "right";
|
|
243
265
|
}
|
|
244
266
|
get point() {
|
|
245
|
-
const { targetElement } = this;
|
|
267
|
+
const { targetElement, _locationConfig } = this;
|
|
246
268
|
const { bounds } = this.node.getData(FlowNodeTransformData);
|
|
247
269
|
const location2 = this.location;
|
|
248
270
|
if (targetElement) {
|
|
@@ -257,8 +279,14 @@ var WorkflowPortEntity = class extends Entity {
|
|
|
257
279
|
location: location2
|
|
258
280
|
};
|
|
259
281
|
}
|
|
260
|
-
|
|
282
|
+
if (_locationConfig) {
|
|
283
|
+
return {
|
|
284
|
+
...locationConfigToPoint(bounds, _locationConfig, this._offset),
|
|
285
|
+
location: location2
|
|
286
|
+
};
|
|
287
|
+
}
|
|
261
288
|
const offset = this._offset || { x: 0, y: 0 };
|
|
289
|
+
let point = { x: 0, y: 0 };
|
|
262
290
|
switch (location2) {
|
|
263
291
|
case "left":
|
|
264
292
|
point = bounds.leftCenter;
|
|
@@ -371,6 +399,10 @@ var WorkflowPortEntity = class extends Entity {
|
|
|
371
399
|
this._offset = data.offset;
|
|
372
400
|
changed = true;
|
|
373
401
|
}
|
|
402
|
+
if (Compare.isChanged(data.locationConfig, this._locationConfig)) {
|
|
403
|
+
this._locationConfig = data.locationConfig;
|
|
404
|
+
changed = true;
|
|
405
|
+
}
|
|
374
406
|
if (Compare.isChanged(data.size, this._size)) {
|
|
375
407
|
this._size = data.size;
|
|
376
408
|
changed = true;
|