blob: 1cab293a8eb4510902bcb9a770027b317b8977ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  | 
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Tooltip } from "@material-ui/core";
import { action, computed, observable } from "mobx";
import { observer } from "mobx-react";
import * as React from "react";
import { DocumentButtonBar } from "../DocumentButtonBar";
import { DocumentView } from "../nodes/DocumentView";
const higflyout = require("@hig/flyout");
export const { anchorPoints } = higflyout;
export const Flyout = higflyout.default;
@observer
export class CollectionDockingViewMenu extends React.Component<{ views: () => DocumentView[], Stack: any }> {
    customStylesheet(styles: any) {
        return {
            ...styles,
            panel: {
                ...styles.panel,
                minWidth: "100px"
            },
        };
    }
    _ref = React.createRef<HTMLDivElement>();
    @computed get flyout() {
        return (
            <div className="dockingViewButtonSelector-flyout" title=" " ref={this._ref}>
                <DocumentButtonBar views={this.props.views} stack={this.props.Stack} />
            </div>
        );
    }
    @observable _tooltipOpen: boolean = false;
    render() {
        return <Tooltip open={this._tooltipOpen} onClose={action(() => this._tooltipOpen = false)} title={<><div className="dash-tooltip">Tap for toolbar, drag to create alias in another pane</div></>} placement="bottom">
            <span className="dockingViewButtonSelector"
                onPointerEnter={action(() => !this._ref.current?.getBoundingClientRect().width && (this._tooltipOpen = true))}
                onPointerDown={action(e => {
                    this.props.views()[0]?.select(false);
                    this._tooltipOpen = false;
                })} >
                <Flyout anchorPoint={anchorPoints.LEFT_TOP} content={this.flyout} stylesheet={this.customStylesheet}>
                    <FontAwesomeIcon icon={"arrows-alt"} size={"sm"} />
                </Flyout>
            </span>
        </Tooltip >;
    }
}
 
  |