feat(editor): Add support for fallback nodes and new addNodes node render type in new canvas (no-changelog) (#10004)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { CanvasNodeKey } from '@/constants';
|
||||
import { ref } from 'vue';
|
||||
import type { CanvasElement, CanvasElementData } from '@/types';
|
||||
import type { CanvasNode, CanvasNodeData } from '@/types';
|
||||
import { CanvasNodeRenderType } from '@/types';
|
||||
|
||||
export function createCanvasNodeData({
|
||||
id = 'node',
|
||||
@@ -15,10 +16,10 @@ export function createCanvasNodeData({
|
||||
pinnedData = { count: 0, visible: false },
|
||||
runData = { count: 0, visible: false },
|
||||
render = {
|
||||
type: 'default',
|
||||
type: CanvasNodeRenderType.Default,
|
||||
options: { configurable: false, configuration: false, trigger: false },
|
||||
},
|
||||
}: Partial<CanvasElementData> = {}): CanvasElementData {
|
||||
}: Partial<CanvasNodeData> = {}): CanvasNodeData {
|
||||
return {
|
||||
execution,
|
||||
issues,
|
||||
@@ -41,9 +42,7 @@ export function createCanvasNodeElement({
|
||||
label = 'Node',
|
||||
position = { x: 100, y: 100 },
|
||||
data,
|
||||
}: Partial<
|
||||
Omit<CanvasElement, 'data'> & { data: Partial<CanvasElementData> }
|
||||
> = {}): CanvasElement {
|
||||
}: Partial<Omit<CanvasNode, 'data'> & { data: Partial<CanvasNodeData> }> = {}): CanvasNode {
|
||||
return {
|
||||
id,
|
||||
type,
|
||||
@@ -58,7 +57,7 @@ export function createCanvasNodeProps({
|
||||
label = 'Test Node',
|
||||
selected = false,
|
||||
data = {},
|
||||
}: { id?: string; label?: string; selected?: boolean; data?: Partial<CanvasElementData> } = {}) {
|
||||
}: { id?: string; label?: string; selected?: boolean; data?: Partial<CanvasNodeData> } = {}) {
|
||||
return {
|
||||
id,
|
||||
label,
|
||||
@@ -72,7 +71,7 @@ export function createCanvasNodeProvide({
|
||||
label = 'Test Node',
|
||||
selected = false,
|
||||
data = {},
|
||||
}: { id?: string; label?: string; selected?: boolean; data?: Partial<CanvasElementData> } = {}) {
|
||||
}: { id?: string; label?: string; selected?: boolean; data?: Partial<CanvasNodeData> } = {}) {
|
||||
const props = createCanvasNodeProps({ id, label, selected, data });
|
||||
return {
|
||||
[`${CanvasNodeKey}`]: {
|
||||
@@ -85,8 +84,8 @@ export function createCanvasNodeProvide({
|
||||
}
|
||||
|
||||
export function createCanvasConnection(
|
||||
nodeA: CanvasElement,
|
||||
nodeB: CanvasElement,
|
||||
nodeA: CanvasNode,
|
||||
nodeB: CanvasNode,
|
||||
{ sourceIndex = 0, targetIndex = 0 } = {},
|
||||
) {
|
||||
const nodeAOutput = nodeA.data?.outputs[sourceIndex];
|
||||
|
||||
Reference in New Issue
Block a user