import { Upload, Checkbox, Banner } from "@douyinfe/semi-ui"; import { STATUS } from "../../../data/constants"; export default function ImportSource({ importData, setImportData, error, setError, }) { return (
{ const f = fileList[0].fileInstance; if (!f) { return; } const reader = new FileReader(); reader.onload = async (e) => { setImportData((prev) => ({ ...prev, src: e.target.result })); }; reader.readAsText(f); return { autoRemove: false, fileInstance: file.fileInstance, status: "success", shouldUpload: false, }; }} draggable={true} dragMainText="Drag and drop the file here or click to upload." dragSubText="Upload an sql file to autogenerate your tables and columns." accept=".sql" onRemove={() => { setError({ type: STATUS.NONE, message: "", }); setImportData((prev) => ({ ...prev, src: "" })); }} onFileChange={() => setError({ type: STATUS.NONE, message: "", }) } limit={1} />
* For the time being loading only MySQL scripts is supported.
setImportData((prev) => ({ ...prev, overwrite: e.target.checked, })) } > Overwrite existing diagram
{error.type === STATUS.ERROR ? ( {error.message}
} /> ) : error.type === STATUS.OK ? ( {error.message}
} /> ) : ( error.type === STATUS.WARNING && ( {error.message}
} /> ) )} ); }