/** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ import { DEFAULT_INITIAL_DATA, defaultInitialDataTs, fieldWrapperCss, fieldWrapperTs, } from '@flowgram.ai/demo-node-form'; import { Editor } from '../editor.tsx'; import { PreviewEditor } from '../../preview-editor.tsx'; import { nodeRegistry } from './node-registry.tsx'; const nodeRegistryFile = { code: `import { Field, FieldRenderProps, FormMeta, WorkflowNodeRegistry, FormRenderProps, } from '@flowgram.ai/free-layout-editor'; import { FieldWrapper } from '@flowgram.ai/demo-node-form'; import { Input } from '@douyinfe/semi-ui'; import '../index.css'; interface FormData { country: string; city: string; } const render = ({ form }: FormRenderProps) => (
Visibility Examples
{({ field }: FieldRenderProps) => ( )} {({ field }: FieldRenderProps) => form.getValueIn('country') ? ( ) : ( <> ) }
); const formMeta: FormMeta = { render, }; export const nodeRegistry: WorkflowNodeRegistry = { type: 'custom', meta: {}, defaultPorts: [{ type: 'output' }, { type: 'input' }], formMeta, }; `, active: true, }; export const NodeFormDynamicPreview = () => { const files = { 'node-registry.tsx': nodeRegistryFile, 'initial-data.ts': { code: defaultInitialDataTs, active: true }, 'field-wrapper.tsx': { code: fieldWrapperTs, active: true }, 'field-wrapper.css': { code: fieldWrapperCss, active: true }, }; return ( ); };