1
This commit is contained in:
parent
0accb8d53b
commit
d8cc3c0983
@ -65,7 +65,8 @@ const FormRenderer: React.FC<{
|
|||||||
schema: any;
|
schema: any;
|
||||||
path?: string;
|
path?: string;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
}> = ({schema, path = '', readOnly = false}) => {
|
currentTab?: any;
|
||||||
|
}> = ({schema, path = '', readOnly = false, currentTab}) => {
|
||||||
if (!schema || !schema.properties) return null;
|
if (!schema || !schema.properties) return null;
|
||||||
const renderPortConfig = (portSchema: any, portPath: string) => {
|
const renderPortConfig = (portSchema: any, portPath: string) => {
|
||||||
if (!portSchema || !portSchema.properties) return null;
|
if (!portSchema || !portSchema.properties) return null;
|
||||||
@ -85,6 +86,12 @@ const FormRenderer: React.FC<{
|
|||||||
required={portSchema.required?.includes('position')}
|
required={portSchema.required?.includes('position')}
|
||||||
initialValue={'default' in position ? position.default : undefined}
|
initialValue={'default' in position ? position.default : undefined}
|
||||||
style={{marginBottom: 16}}
|
style={{marginBottom: 16}}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: portSchema.required?.includes('position'),
|
||||||
|
message: `请${position.type === 'string' ? '输入' : '选择'}${position.title}`
|
||||||
|
}
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
{readOnly ? (
|
{readOnly ? (
|
||||||
<span style={{color: '#666'}}>{position.default || '-'}</span>
|
<span style={{color: '#666'}}>{position.default || '-'}</span>
|
||||||
@ -112,6 +119,7 @@ const FormRenderer: React.FC<{
|
|||||||
schema={attrs}
|
schema={attrs}
|
||||||
path={`${portPath}.attrs`}
|
path={`${portPath}.attrs`}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
|
currentTab={currentTab}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
@ -192,6 +200,7 @@ const FormRenderer: React.FC<{
|
|||||||
schema={value}
|
schema={value}
|
||||||
path={fieldPath}
|
path={fieldPath}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
|
currentTab={currentTab}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
@ -207,9 +216,15 @@ const FormRenderer: React.FC<{
|
|||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
tooltip={value.description}
|
tooltip={value.description}
|
||||||
required={schema.required?.includes(key)}
|
required={currentTab?.schemaKey === 'uiVariables' && schema.required?.includes(key)}
|
||||||
initialValue={'default' in value ? value.default : undefined}
|
initialValue={'default' in value ? value.default : undefined}
|
||||||
style={{marginBottom: 16}}
|
style={{marginBottom: 16}}
|
||||||
|
rules={currentTab?.schemaKey === 'uiVariables' ? [
|
||||||
|
{
|
||||||
|
required: schema.required?.includes(key),
|
||||||
|
message: `请${value.type === 'string' ? '输入' : '选择'}${value.title}`
|
||||||
|
}
|
||||||
|
] : undefined}
|
||||||
>
|
>
|
||||||
{readOnly ? (
|
{readOnly ? (
|
||||||
<span style={{color: '#666'}}>{value.default || '-'}</span>
|
<span style={{color: '#666'}}>{value.default || '-'}</span>
|
||||||
@ -638,6 +653,7 @@ const NodeDesignForm: React.FC = () => {
|
|||||||
<FormRenderer
|
<FormRenderer
|
||||||
schema={getCurrentSchema()}
|
schema={getCurrentSchema()}
|
||||||
readOnly={tab.readonly}
|
readOnly={tab.readonly}
|
||||||
|
currentTab={tab}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null
|
) : null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user