/** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ import React from 'react'; import { I18n } from '@flowgram.ai/editor'; import { Button } from '@douyinfe/semi-ui'; import { IconPlus } from '@douyinfe/semi-icons'; import { FlowValueUtils, IFlowValue, IInputsValues } from '@/shared'; import { useObjectList } from '@/hooks'; import { PropsType } from './types'; import './styles.css'; import { InputValueRow } from './row'; export function InputsValuesTree(props: PropsType) { const { value, onChange, readonly, hasError, constantProps } = props; const { list, updateKey, updateValue, remove, add } = useObjectList< IInputsValues | IFlowValue | undefined >({ value, onChange: (v) => onChange?.(v as IInputsValues), sortIndexKey: (value) => (FlowValueUtils.isFlowValue(value) ? 'extra.index' : ''), }); return (
{list.map((item) => ( updateKey(item.id, key)} onUpdateValue={(value) => updateValue(item.id, value)} onRemove={() => remove(item.id)} readonly={readonly} hasError={hasError} constantProps={constantProps} /> ))}
); }