|
|
|
|
@ -2,12 +2,27 @@ import { ExportButton } from "./ExportButton";
|
|
|
|
|
import { Button, Tooltip } from "antd";
|
|
|
|
|
import { useTable } from "../../stores/useTable";
|
|
|
|
|
import { FullscreenExitOutlined, FullscreenOutlined } from "@ant-design/icons";
|
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
|
|
|
|
|
const ToggleFullScreenButton = () => {
|
|
|
|
|
const {
|
|
|
|
|
tableState: { fullScreen },
|
|
|
|
|
toggleFullScreen,
|
|
|
|
|
} = useTable();
|
|
|
|
|
const [hover, setHover] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const timer = setTimeout(() => setHover(false), 1500);
|
|
|
|
|
|
|
|
|
|
return () => clearTimeout(timer);
|
|
|
|
|
}, [hover]);
|
|
|
|
|
|
|
|
|
|
const handleMouseEnter = () => {
|
|
|
|
|
setHover(true);
|
|
|
|
|
};
|
|
|
|
|
const handleMouseLeave = () => {
|
|
|
|
|
setHover(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleClick = (e) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
@ -15,8 +30,16 @@ const ToggleFullScreenButton = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Tooltip title="Раскрыть на полный экран" placement={"topRight"}>
|
|
|
|
|
<Button onClick={handleClick}>
|
|
|
|
|
<Tooltip
|
|
|
|
|
title={fullScreen ? "Свернуть" : "Раскрыть на полный экран"}
|
|
|
|
|
placement={"topRight"}
|
|
|
|
|
open={hover}
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleClick}
|
|
|
|
|
onMouseEnter={handleMouseEnter}
|
|
|
|
|
onMouseLeave={handleMouseLeave}
|
|
|
|
|
>
|
|
|
|
|
{fullScreen ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|