@flowgram.ai/free-layout-core 0.2.10 → 0.2.12
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 +106 -34
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +99 -33
- 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-registry.d.mts +1 -1
- package/dist/typings/workflow-registry.d.ts +1 -1
- package/dist/{workflow-line-entity-BGD6_sdy.d.mts → workflow-line-entity-B34FWw9W.d.mts} +9 -2
- package/dist/{workflow-line-entity-OFVYg40b.d.ts → workflow-line-entity-B4Mfa03B.d.ts} +9 -2
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
|
|
|
2
2
|
export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
|
|
3
3
|
import { NodeFormProps } from '@flowgram.ai/node';
|
|
4
4
|
import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
|
|
5
|
-
import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-
|
|
6
|
-
export { C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY,
|
|
5
|
+
import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-B34FWw9W.mjs';
|
|
6
|
+
export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-B34FWw9W.mjs';
|
|
7
7
|
import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.mjs';
|
|
8
8
|
export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.mjs';
|
|
9
9
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
@@ -182,10 +182,20 @@ declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceI
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
interface NodeRenderReturnType {
|
|
185
|
+
id: string;
|
|
186
|
+
type: string | number;
|
|
185
187
|
/**
|
|
186
188
|
* 当前节点
|
|
187
189
|
*/
|
|
188
190
|
node: FlowNodeEntity;
|
|
191
|
+
/**
|
|
192
|
+
* 节点 data 数据
|
|
193
|
+
*/
|
|
194
|
+
data: any;
|
|
195
|
+
/**
|
|
196
|
+
* 更新节点 data 数据
|
|
197
|
+
*/
|
|
198
|
+
updateData: (newData: any) => void;
|
|
189
199
|
/**
|
|
190
200
|
* 节点选中
|
|
191
201
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
|
|
|
2
2
|
export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, usePlaygroundLatest, useRefresh, useService } from '@flowgram.ai/core';
|
|
3
3
|
import { NodeFormProps } from '@flowgram.ai/node';
|
|
4
4
|
import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
|
|
5
|
-
import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-
|
|
6
|
-
export { C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY,
|
|
5
|
+
import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowPortEntity, g as WorkflowLineEntity, O as OnDragLineEnd, h as WorkflowPorts, i as WorkflowPortType, j as WorkflowPort, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-line-entity-B4Mfa03B.js';
|
|
6
|
+
export { J as HoverPosition, C as LINE_HOVER_DISTANCE, v as LineColor, w as LineColors, u as LineType, z as NodesDragEndEvent, y as NodesDragStartEvent, A as NodesDraggingEvent, P as POINT_RADIUS, G as PORT_SIZE, o as WORKFLOW_LINE_ENTITY, K as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, Q as WorkflowDocumentOptionsDefault, M as WorkflowDocumentProvider, I as WorkflowEntityHoverable, q as WorkflowJSON, E as WorkflowLineEntityOpts, F as WorkflowLineInfo, D as WorkflowLinePortInfo, x as WorkflowLineRenderContributionFactory, t as WorkflowNodeMeta, H as WorkflowPortEntityOpts, p as domReactToBounds, n as getPortEntityId, B as onDragLineEndParams } from './workflow-line-entity-B4Mfa03B.js';
|
|
7
7
|
import { W as WorkflowNodeEntity } from './workflow-sub-canvas-DOVla1mw.js';
|
|
8
8
|
export { a as WorkflowSubCanvas } from './workflow-sub-canvas-DOVla1mw.js';
|
|
9
9
|
import * as _flowgram_ai_utils from '@flowgram.ai/utils';
|
|
@@ -182,10 +182,20 @@ declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceI
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
interface NodeRenderReturnType {
|
|
185
|
+
id: string;
|
|
186
|
+
type: string | number;
|
|
185
187
|
/**
|
|
186
188
|
* 当前节点
|
|
187
189
|
*/
|
|
188
190
|
node: FlowNodeEntity;
|
|
191
|
+
/**
|
|
192
|
+
* 节点 data 数据
|
|
193
|
+
*/
|
|
194
|
+
data: any;
|
|
195
|
+
/**
|
|
196
|
+
* 更新节点 data 数据
|
|
197
|
+
*/
|
|
198
|
+
updateData: (newData: any) => void;
|
|
189
199
|
/**
|
|
190
200
|
* 节点选中
|
|
191
201
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1094,7 +1094,9 @@ var import_core10 = require("@flowgram.ai/core");
|
|
|
1094
1094
|
var WorkflowHoverService = class {
|
|
1095
1095
|
constructor() {
|
|
1096
1096
|
this.onHoveredChangeEmitter = new import_utils11.Emitter();
|
|
1097
|
+
this.onUpdateHoverPositionEmitter = new import_utils11.Emitter();
|
|
1097
1098
|
this.onHoveredChange = this.onHoveredChangeEmitter.event;
|
|
1099
|
+
this.onUpdateHoverPosition = this.onUpdateHoverPositionEmitter.event;
|
|
1098
1100
|
// 当前鼠标 hover 位置
|
|
1099
1101
|
this.hoveredPos = { x: 0, y: 0 };
|
|
1100
1102
|
/**
|
|
@@ -1114,6 +1116,13 @@ var WorkflowHoverService = class {
|
|
|
1114
1116
|
this.onHoveredChangeEmitter.fire(hoveredKey);
|
|
1115
1117
|
}
|
|
1116
1118
|
}
|
|
1119
|
+
updateHoverPosition(position, target) {
|
|
1120
|
+
this.hoveredPos = position;
|
|
1121
|
+
this.onUpdateHoverPositionEmitter.fire({
|
|
1122
|
+
position,
|
|
1123
|
+
target
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1117
1126
|
/**
|
|
1118
1127
|
* 清空 hover 内容
|
|
1119
1128
|
*/
|
|
@@ -2444,7 +2453,8 @@ var WorkflowDragService = class {
|
|
|
2444
2453
|
});
|
|
2445
2454
|
}
|
|
2446
2455
|
});
|
|
2447
|
-
|
|
2456
|
+
const { clientX, clientY } = import_core15.MouseTouchEvent.getEventCoord(triggerEvent);
|
|
2457
|
+
return dragger.start(clientX, clientY, this.playgroundConfig)?.then(() => dragSuccess);
|
|
2448
2458
|
}
|
|
2449
2459
|
/**
|
|
2450
2460
|
* 通过拖入卡片添加
|
|
@@ -2854,7 +2864,8 @@ var WorkflowDragService = class {
|
|
|
2854
2864
|
}
|
|
2855
2865
|
}
|
|
2856
2866
|
});
|
|
2857
|
-
|
|
2867
|
+
const { clientX, clientY } = import_core15.MouseTouchEvent.getEventCoord(event);
|
|
2868
|
+
await dragger.start(clientX, clientY, config);
|
|
2858
2869
|
return deferred.promise;
|
|
2859
2870
|
}
|
|
2860
2871
|
/**
|
|
@@ -3080,6 +3091,9 @@ function useNodeRender(nodeFromProps) {
|
|
|
3080
3091
|
const dragService = (0, import_core21.useService)(WorkflowDragService);
|
|
3081
3092
|
const selectionService = (0, import_core21.useService)(WorkflowSelectService);
|
|
3082
3093
|
const isDragging = (0, import_react2.useRef)(false);
|
|
3094
|
+
const [formValueVersion, updateFormValueVersion] = (0, import_react2.useState)(0);
|
|
3095
|
+
const formValueDependRef = (0, import_react2.useRef)(false);
|
|
3096
|
+
formValueDependRef.current = false;
|
|
3083
3097
|
const nodeRef = (0, import_react2.useRef)(null);
|
|
3084
3098
|
const [linkingNodeId, setLinkingNodeId] = (0, import_react2.useState)("");
|
|
3085
3099
|
(0, import_react2.useEffect)(() => {
|
|
@@ -3096,12 +3110,14 @@ function useNodeRender(nodeFromProps) {
|
|
|
3096
3110
|
}, []);
|
|
3097
3111
|
const startDrag = (0, import_react2.useCallback)(
|
|
3098
3112
|
(e) => {
|
|
3099
|
-
|
|
3113
|
+
import_core21.MouseTouchEvent.preventDefault(e);
|
|
3100
3114
|
if (!selectionService.isSelected(node.id)) {
|
|
3101
3115
|
selectNode(e);
|
|
3102
3116
|
}
|
|
3103
|
-
if (!
|
|
3104
|
-
|
|
3117
|
+
if (!import_core21.MouseTouchEvent.isTouchEvent(e)) {
|
|
3118
|
+
if (!checkTargetDraggable(e.target) || !checkTargetDraggable(document.activeElement)) {
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
3105
3121
|
}
|
|
3106
3122
|
isDragging.current = true;
|
|
3107
3123
|
dragService.startDragSelectedNodes(e)?.finally(
|
|
@@ -3153,36 +3169,86 @@ function useNodeRender(nodeFromProps) {
|
|
|
3153
3169
|
const toggleExpand = (0, import_react2.useCallback)(() => {
|
|
3154
3170
|
renderData.toggleExpand();
|
|
3155
3171
|
}, [renderData]);
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
if (!form) return void 0;
|
|
3175
|
-
return {
|
|
3176
|
-
...form,
|
|
3177
|
-
get values() {
|
|
3172
|
+
const selected = selectionService.isSelected(node.id);
|
|
3173
|
+
const activated = selectionService.isActivated(node.id);
|
|
3174
|
+
const expanded = renderData.expanded;
|
|
3175
|
+
(0, import_react2.useEffect)(() => {
|
|
3176
|
+
const toDispose = form?.onFormValuesChange(() => {
|
|
3177
|
+
if (formValueDependRef.current) {
|
|
3178
|
+
updateFormValueVersion((v) => v + 1);
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
return () => toDispose?.dispose();
|
|
3182
|
+
}, [form]);
|
|
3183
|
+
return (0, import_react2.useMemo)(
|
|
3184
|
+
() => ({
|
|
3185
|
+
id: node.id,
|
|
3186
|
+
type: node.flowNodeType,
|
|
3187
|
+
get data() {
|
|
3188
|
+
if (form) {
|
|
3189
|
+
formValueDependRef.current = true;
|
|
3178
3190
|
return form.values;
|
|
3179
|
-
},
|
|
3180
|
-
get state() {
|
|
3181
|
-
return formState;
|
|
3182
3191
|
}
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3192
|
+
return getExtInfo();
|
|
3193
|
+
},
|
|
3194
|
+
updateData(values) {
|
|
3195
|
+
if (form) {
|
|
3196
|
+
form.updateFormValues(values);
|
|
3197
|
+
} else {
|
|
3198
|
+
updateExtInfo(values);
|
|
3199
|
+
}
|
|
3200
|
+
},
|
|
3201
|
+
node,
|
|
3202
|
+
selected,
|
|
3203
|
+
activated,
|
|
3204
|
+
expanded,
|
|
3205
|
+
startDrag,
|
|
3206
|
+
get ports() {
|
|
3207
|
+
return portsData.allPorts;
|
|
3208
|
+
},
|
|
3209
|
+
deleteNode,
|
|
3210
|
+
selectNode,
|
|
3211
|
+
readonly,
|
|
3212
|
+
linkingNodeId,
|
|
3213
|
+
nodeRef,
|
|
3214
|
+
onFocus,
|
|
3215
|
+
onBlur,
|
|
3216
|
+
getExtInfo,
|
|
3217
|
+
updateExtInfo,
|
|
3218
|
+
toggleExpand,
|
|
3219
|
+
get form() {
|
|
3220
|
+
if (!form) return void 0;
|
|
3221
|
+
return {
|
|
3222
|
+
...form,
|
|
3223
|
+
get values() {
|
|
3224
|
+
formValueDependRef.current = true;
|
|
3225
|
+
return form.values;
|
|
3226
|
+
},
|
|
3227
|
+
get state() {
|
|
3228
|
+
return formState;
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
}
|
|
3232
|
+
}),
|
|
3233
|
+
[
|
|
3234
|
+
node,
|
|
3235
|
+
selected,
|
|
3236
|
+
activated,
|
|
3237
|
+
expanded,
|
|
3238
|
+
startDrag,
|
|
3239
|
+
deleteNode,
|
|
3240
|
+
selectNode,
|
|
3241
|
+
readonly,
|
|
3242
|
+
linkingNodeId,
|
|
3243
|
+
nodeRef,
|
|
3244
|
+
onFocus,
|
|
3245
|
+
onBlur,
|
|
3246
|
+
getExtInfo,
|
|
3247
|
+
updateExtInfo,
|
|
3248
|
+
toggleExpand,
|
|
3249
|
+
formValueVersion
|
|
3250
|
+
]
|
|
3251
|
+
);
|
|
3186
3252
|
}
|
|
3187
3253
|
|
|
3188
3254
|
// src/hooks/use-current-dom-node.ts
|