|
|
@ -3,24 +3,51 @@ import React, { Fragment, Ref } from 'react' |
|
|
|
import { Dropdown } from 'react-bootstrap' |
|
|
|
import { Dropdown } from 'react-bootstrap' |
|
|
|
import { UmlFileType } from '../utilities/UmlDownloadStrategy' |
|
|
|
import { UmlFileType } from '../utilities/UmlDownloadStrategy' |
|
|
|
|
|
|
|
|
|
|
|
const _paq = window._paq = window._paq || [] |
|
|
|
const _paq = (window._paq = window._paq || []) |
|
|
|
|
|
|
|
|
|
|
|
export const Markup = React.forwardRef(({ children, onClick, icon, className = '' }: { children: React.ReactNode,
|
|
|
|
export const Markup = React.forwardRef( |
|
|
|
onClick: (e) => void, icon: string, className: string }, ref: Ref<HTMLButtonElement>) => ( |
|
|
|
( |
|
|
|
<button |
|
|
|
{ |
|
|
|
ref={ref} |
|
|
|
children, |
|
|
|
onClick={(e) => { |
|
|
|
onClick, |
|
|
|
e.preventDefault() |
|
|
|
icon, |
|
|
|
onClick(e) |
|
|
|
className = "", |
|
|
|
}} |
|
|
|
}: { |
|
|
|
className={className.replace('dropdown-toggle', '')} |
|
|
|
children: React.ReactNode |
|
|
|
> |
|
|
|
onClick: (e) => void |
|
|
|
<i className={icon}></i> |
|
|
|
icon: string |
|
|
|
</button> |
|
|
|
className: string |
|
|
|
)) |
|
|
|
}, |
|
|
|
|
|
|
|
ref: Ref<HTMLButtonElement> |
|
|
|
|
|
|
|
) => ( |
|
|
|
|
|
|
|
<button |
|
|
|
|
|
|
|
ref={ref} |
|
|
|
|
|
|
|
onClick={(e) => { |
|
|
|
|
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
onClick(e) |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
className={className.replace("dropdown-toggle", "")} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<i className={icon}></i> |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
export const UmlCustomMenu = React.forwardRef( |
|
|
|
export const UmlCustomMenu = React.forwardRef( |
|
|
|
({ children, style, className, 'aria-labelledby': labeledBy }: { children: React.ReactNode, style?: React.CSSProperties, className: string, 'aria-labelledby'?: string }, ref: Ref<HTMLDivElement>) => { |
|
|
|
( |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
children, |
|
|
|
|
|
|
|
style, |
|
|
|
|
|
|
|
className, |
|
|
|
|
|
|
|
"aria-labelledby": labeledBy, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
children: React.ReactNode |
|
|
|
|
|
|
|
style?: React.CSSProperties |
|
|
|
|
|
|
|
className: string |
|
|
|
|
|
|
|
"aria-labelledby"?: string |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
ref: Ref<HTMLDivElement> |
|
|
|
|
|
|
|
) => { |
|
|
|
const height = window.innerHeight * 0.6 |
|
|
|
const height = window.innerHeight * 0.6 |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
@ -29,14 +56,15 @@ export const UmlCustomMenu = React.forwardRef( |
|
|
|
className={className} |
|
|
|
className={className} |
|
|
|
aria-labelledby={labeledBy} |
|
|
|
aria-labelledby={labeledBy} |
|
|
|
> |
|
|
|
> |
|
|
|
<ul className="overflow-auto list-unstyled mb-0" style={{ maxHeight: height+'px' }}> |
|
|
|
<ul |
|
|
|
{ |
|
|
|
className="overflow-auto list-unstyled mb-0" |
|
|
|
children |
|
|
|
style={{ maxHeight: height + "px" }} |
|
|
|
} |
|
|
|
> |
|
|
|
|
|
|
|
{children} |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
interface UmlDownloadProps { |
|
|
|
interface UmlDownloadProps { |
|
|
@ -44,74 +72,72 @@ interface UmlDownloadProps { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default function UmlDownload(props: UmlDownloadProps) { |
|
|
|
export default function UmlDownload(props: UmlDownloadProps) { |
|
|
|
|
|
|
|
return ( |
|
|
|
return( |
|
|
|
|
|
|
|
<Fragment> |
|
|
|
<Fragment> |
|
|
|
<Dropdown id="solUmlMenuDropdown"> |
|
|
|
<Dropdown id="solUmlMenuDropdown"> |
|
|
|
<Dropdown.Toggle |
|
|
|
<Dropdown.Toggle |
|
|
|
icon="far fa-arrow-to-bottom align-item-center d-flex justify-content-center" |
|
|
|
icon="far fa-arrow-to-bottom uml-btn-icon" |
|
|
|
as={Markup} |
|
|
|
as={Markup} |
|
|
|
className="badge badge-info remixui_no-shadow p-2 rounded-circle mr-2" |
|
|
|
className="badge badge-info remixui_no-shadow p-2 rounded-circle mr-2" |
|
|
|
> |
|
|
|
></Dropdown.Toggle> |
|
|
|
</Dropdown.Toggle> |
|
|
|
|
|
|
|
<Dropdown.Menu as={UmlCustomMenu} className="custom-dropdown-items"> |
|
|
|
<Dropdown.Menu as={UmlCustomMenu} className="custom-dropdown-items"> |
|
|
|
<Dropdown.Item |
|
|
|
<Dropdown.Item |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
_paq.push(['trackEvent', 'solidityumlgen', 'download', 'downloadAsPng']) |
|
|
|
_paq.push([ |
|
|
|
props.download('png') |
|
|
|
"trackEvent", |
|
|
|
|
|
|
|
"solidityumlgen", |
|
|
|
|
|
|
|
"download", |
|
|
|
|
|
|
|
"downloadAsPng", |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
props.download("png") |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<CustomTooltip |
|
|
|
<CustomTooltip |
|
|
|
placement="left-start" |
|
|
|
placement="left-start" |
|
|
|
tooltipId="solUmlgenDownloadAsPngTooltip" |
|
|
|
tooltipId="solUmlgenDownloadAsPngTooltip" |
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
tooltipText={'Download UML diagram as a PNG file'} |
|
|
|
tooltipText={"Download UML diagram as a PNG file"} |
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div data-id="umlPngDownload"> |
|
|
|
data-id='umlPngDownload' |
|
|
|
<span |
|
|
|
> |
|
|
|
id="umlPngDownloadBtn" |
|
|
|
<span |
|
|
|
data-id="umlPngDownload" |
|
|
|
id='umlPngDownloadBtn' |
|
|
|
className="far fa-image pl-2" |
|
|
|
data-id='umlPngDownload' |
|
|
|
></span> |
|
|
|
className='far fa-image pl-2' |
|
|
|
<span className="pl-1">Download as PNG</span> |
|
|
|
> |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
</CustomTooltip> |
|
|
|
<span className="pl-1"> |
|
|
|
</Dropdown.Item> |
|
|
|
Download as PNG |
|
|
|
<Dropdown.Divider /> |
|
|
|
</span> |
|
|
|
<Dropdown.Item |
|
|
|
</div> |
|
|
|
onClick={() => { |
|
|
|
</CustomTooltip> |
|
|
|
_paq.push([ |
|
|
|
</Dropdown.Item> |
|
|
|
"trackEvent", |
|
|
|
<Dropdown.Divider /> |
|
|
|
"solUmlgen", |
|
|
|
<Dropdown.Item onClick={() => { |
|
|
|
"download", |
|
|
|
_paq.push(['trackEvent', 'solUmlgen', 'download', 'downloadAsPdf']) |
|
|
|
"downloadAsPdf", |
|
|
|
props.download('pdf') |
|
|
|
]); |
|
|
|
}} |
|
|
|
props.download("pdf") |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<CustomTooltip |
|
|
|
|
|
|
|
placement="left-start" |
|
|
|
|
|
|
|
tooltipId="solUmlgenDownloadAsPdfTooltip" |
|
|
|
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
|
|
|
tooltipText={"Download UML diagram as a PDF file"} |
|
|
|
> |
|
|
|
> |
|
|
|
<CustomTooltip |
|
|
|
<div data-id="umlPdfDownload"> |
|
|
|
placement="left-start" |
|
|
|
<span |
|
|
|
tooltipId="solUmlgenDownloadAsPdfTooltip" |
|
|
|
id="umlPdfDownloadBtn" |
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
data-id="umlPdfDownload" |
|
|
|
tooltipText={'Download UML diagram as a PDF file'} |
|
|
|
className="far fa-file-pdf pl-2" |
|
|
|
> |
|
|
|
></span> |
|
|
|
<div |
|
|
|
<span className="pl-2">Download as PDF</span> |
|
|
|
data-id='umlPdfDownload' |
|
|
|
</div> |
|
|
|
> |
|
|
|
</CustomTooltip> |
|
|
|
<span |
|
|
|
</Dropdown.Item> |
|
|
|
id='umlPdfDownloadBtn' |
|
|
|
|
|
|
|
data-id='umlPdfDownload' |
|
|
|
|
|
|
|
className='far fa-file-pdf pl-2' |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
<span className="pl-2"> |
|
|
|
|
|
|
|
Download as PDF |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</CustomTooltip> |
|
|
|
|
|
|
|
</Dropdown.Item> |
|
|
|
|
|
|
|
</Dropdown.Menu> |
|
|
|
</Dropdown.Menu> |
|
|
|
</Dropdown> |
|
|
|
</Dropdown> |
|
|
|
</Fragment> |
|
|
|
</Fragment> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|