import React from "react"; import { observer } from "mobx-react"; import { dialog, getCurrentWindow } from "@electron/remote"; import { guid } from "eez-studio-shared/guid"; import { PropertyEnclosure } from "eez-studio-ui/properties"; export const FileInputProperty = observer( class FileInputProperty extends React.Component< { id?: string; name?: string; value: string; onChange: (value: string) => void; advanced?: boolean; errors?: string[]; }, {} > { onSelectFile = async (event: any) => { event.preventDefault(); const result = await dialog.showOpenDialog(getCurrentWindow(), { properties: ["openFile"], filters: [{ name: "All Files", extensions: ["*"] }] }); const filePaths = result.filePaths; if (filePaths && filePaths[0]) { this.props.onChange(filePaths[0]); } }; render() { let id = this.props.id || guid(); let input = (