feat(demo): remove formInputs readonly (#259)

This commit is contained in:
xiamidaxia 2025-05-23 11:21:31 +08:00 committed by GitHub
parent 5b56be0ec2
commit 32e953a675
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 10 deletions

View File

@ -4,10 +4,10 @@ import { Field } from '@flowgram.ai/fixed-layout-editor';
import { FormItem } from '../form-item';
import { Feedback } from '../feedback';
import { JsonSchema } from '../../typings';
import { useIsSidebar } from '../../hooks';
import { useNodeRenderContext } from '../../hooks';
export function FormInputs() {
const readonly = !useIsSidebar();
const { readonly } = useNodeRenderContext();
return (
<Field<JsonSchema> name="inputs">
{({ field: inputsField }) => {

View File

@ -1,7 +1,7 @@
import { BatchVariableSelector, IFlowRefValue } from '@flowgram.ai/form-materials';
import { FormRenderProps, FlowNodeJSON, Field } from '@flowgram.ai/fixed-layout-editor';
import { useIsSidebar } from '../../hooks';
import { useIsSidebar, useNodeRenderContext } from '../../hooks';
import { FormHeader, FormContent, FormOutputs, FormItem, Feedback } from '../../form-components';
interface LoopNodeJSON extends FlowNodeJSON {
@ -12,7 +12,7 @@ interface LoopNodeJSON extends FlowNodeJSON {
export const LoopFormRender = ({ form }: FormRenderProps<LoopNodeJSON>) => {
const isSidebar = useIsSidebar();
const readonly = !isSidebar;
const { readonly } = useNodeRenderContext();
const batchFor = (
<Field<IFlowRefValue> name={`batchFor`}>

View File

@ -4,10 +4,10 @@ import { DynamicValueInput } from '@flowgram.ai/form-materials';
import { FormItem } from '../form-item';
import { Feedback } from '../feedback';
import { JsonSchema } from '../../typings';
import { useIsSidebar } from '../../hooks';
import { useNodeRenderContext } from '../../hooks';
export function FormInputs() {
const readonly = !useIsSidebar();
const { readonly } = useNodeRenderContext();
return (
<Field<JsonSchema> name="inputs">
{({ field: inputsField }) => {

View File

@ -4,7 +4,7 @@ import { IFlowValue, VariableSelector } from '@flowgram.ai/form-materials';
import { Button } from '@douyinfe/semi-ui';
import { IconPlus, IconCrossCircleStroked } from '@douyinfe/semi-icons';
import { useIsSidebar } from '../../../hooks';
import { useNodeRenderContext } from '../../../hooks';
import { FormItem } from '../../../form-components';
import { Feedback } from '../../../form-components';
import { ConditionPort } from './styles';
@ -15,7 +15,7 @@ interface ConditionValue {
}
export function ConditionInputs() {
const readonly = !useIsSidebar();
const { readonly } = useNodeRenderContext();
return (
<FieldArray name="conditions">
{({ field }) => (

View File

@ -2,7 +2,7 @@ import { FormRenderProps, FlowNodeJSON, Field } from '@flowgram.ai/free-layout-e
import { SubCanvasRender } from '@flowgram.ai/free-container-plugin';
import { BatchVariableSelector, IFlowRefValue } from '@flowgram.ai/form-materials';
import { useIsSidebar } from '../../hooks';
import { useIsSidebar, useNodeRenderContext } from '../../hooks';
import { FormHeader, FormContent, FormOutputs, FormItem, Feedback } from '../../form-components';
interface LoopNodeJSON extends FlowNodeJSON {
@ -13,7 +13,7 @@ interface LoopNodeJSON extends FlowNodeJSON {
export const LoopFormRender = ({ form }: FormRenderProps<LoopNodeJSON>) => {
const isSidebar = useIsSidebar();
const readonly = !isSidebar;
const { readonly } = useNodeRenderContext();
const batchFor = (
<Field<IFlowRefValue> name={`batchFor`}>