UNPKG

@light-sheet/react

Version:

FortuneSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets

35 lines 1.12 kB
import { api } from "@light-sheet/core"; import React, { useCallback, useContext } from "react"; import SVGIcon from "../SVGIcon"; import WorkbookContext from "../../context"; var SheetHiddenButton = function SheetHiddenButton(_ref) { var style = _ref.style, sheet = _ref.sheet; var _useContext = useContext(WorkbookContext), context = _useContext.context, setContext = _useContext.setContext; var showSheet = useCallback(function () { if (context.allowEdit === false) return; if (!sheet) return; setContext(function (ctx) { api.showSheet(ctx, sheet.id); }); }, [context.allowEdit, setContext, sheet]); return /*#__PURE__*/React.createElement("div", { style: style, onClick: function onClick(e) { e.stopPropagation(); showSheet(); }, tabIndex: 0, className: "fortune-sheet-hidden-button" }, (sheet === null || sheet === void 0 ? void 0 : sheet.hide) === 1 ? /*#__PURE__*/React.createElement(SVGIcon, { name: "hidden", width: 16, height: 16, style: { marginTop: "7px" } }) : ""); }; export default SheetHiddenButton;