refactor: advance collapse

This commit is contained in:
jialin
2025-10-13 14:40:26 +08:00
parent a5c1b8e15f
commit 46ecc2467b
18 changed files with 423 additions and 177 deletions
+4 -2
View File
@@ -6,7 +6,7 @@ import { PageActionType } from '@/config/types';
import { useIntl } from '@umijs/max';
import { Segmented, Tabs } from 'antd';
import _ from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
import React, { useEffect, useId, useRef, useState } from 'react';
import styled from 'styled-components';
import ColumnWrapper from '../../_components/column-wrapper';
import { backendFields, json2Yaml } from '../config';
@@ -46,6 +46,7 @@ interface AddModalProps {
const AddModal: React.FC<AddModalProps> = (props) => {
const { action, currentData, onClose, onSubmit, onSubmitYaml, open, title } =
props;
const uid = useId();
const formRef = useRef<any>(null);
const editorRef = useRef<any>(null);
const intl = useIntl();
@@ -121,7 +122,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
setYamlContent(yaml);
setFormContent(formData);
formRef.current?.setFieldsValue?.(formData);
editorRef.current?.setValue?.(yaml);
editorRef.current?.setContent?.(yaml);
}
}, [action, currentData]);
@@ -129,6 +130,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
<GSDrawer
title={title}
open={open}
key={uid}
onClose={onClose}
destroyOnHidden={true}
closeIcon={false}