UNPKG

@uiw-admin/components

Version:
76 lines 2.3 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; var _excluded = ["path", "children"], _excluded2 = ["visible", "title", "onClose", "width", "buttons", "children"], _excluded3 = ["label", "show", "path", "disabled"]; import React, { memo } from 'react'; import { Drawer, Button } from 'uiw'; import { AuthBtn } from '@uiw-admin/authorized'; /** * ProDrawer 组件继承于https://uiwjs.github.io/#/components/drawer * @param {boolean} visible 显示隐藏 * @param {string} title 标题 * @param {()=>void} onClose 关闭事件 * @param {number} width Drawer宽 * @param {Array<{label?:string,onPress?:()=>void,show?:boolean,loading?:boolean}>} buttons 按钮集合(label:"文本",onPress:点击事件,show:是否展示) * @param {React.ReactNode} children * @returns */ import { jsx as _jsx } from "react/jsx-runtime"; import { Fragment as _Fragment } from "react/jsx-runtime"; // button权限 function BtnAuth(_ref) { var { path, children } = _ref, others = _objectWithoutPropertiesLoose(_ref, _excluded); if (path) return /*#__PURE__*/_jsx(AuthBtn, _extends({ path: path }, others, { children: children })); return /*#__PURE__*/_jsx(_Fragment, { children: children }); } function ProDrawer(props) { var { visible, title = '', onClose = null, width = 800, buttons = [], children } = props, others = _objectWithoutPropertiesLoose(props, _excluded2); return /*#__PURE__*/_jsx(Drawer, _extends({ title: title, isOpen: visible, onClose: onClose && onClose, size: width, bodyStyle: { padding: '0 10px 45px 10px' }, footer: buttons.map((_ref2, idx) => { var { label = '', show = true, path, disabled = false } = _ref2, others = _objectWithoutPropertiesLoose(_ref2, _excluded3); return show && /*#__PURE__*/_jsx(BtnAuth, { path: path, children: /*#__PURE__*/_jsx(Button, _extends({ disabled: disabled }, others, { children: label })) }, idx); }) }, others, { children: children })); } export default /*#__PURE__*/memo(ProDrawer);