import React from "react"; import { FormInstance, Modal } from "antd"; import { DtmplData, FieldGroupConfig } from "../../tmpl/interface"; import FieldGroupForm from "../../form/field-group-form"; import { LocaleContext } from "../../locale/LocaleProvider"; import DraggableModal from "../../module/draggable-modal"; interface ModalRowEditorProps { serverKey?: string; height?: any; open: boolean; onOk: (value: DtmplData) => void; onCancel: () => void; fieldGroupConfig: FieldGroupConfig; dtmplData?: DtmplData; } interface ModalRowEditorState {} export default class ModalRowEdit extends React.PureComponent< ModalRowEditorProps, ModalRowEditorState > { formRef = React.createRef(); static defaultProps = { forceRender: true, style: { maxWidth: "calc(100vw - 60px)", maxHeight: "calc(100vh - 50px)" }, }; state = {}; static contextType = LocaleContext; context: React.ContextType; async componentDidMount() {} async componentDidUpdate() { if (this.formRef.current) { this.formRef.current.resetFields(); } } onOk = () => { this.formRef.current.submit(); }; getTitle = () => { const { fieldGroupConfig, dtmplData } = this.props; const { translate } = this.context; let title = ""; title = fieldGroupConfig.title; if (dtmplData) { title = title + translate("[${行编辑}]"); } else { title = title + translate("[${新建一行}]"); } return title; }; render() { const { height, onOk, onCancel, fieldGroupConfig, open, dtmplData, serverKey, } = this.props; const {} = this.state; const { translate } = this.context; return ( ); } }