import React from 'react'; import PropTypes from 'prop-types'; declare const _default: OperationAuth; /** 按钮操作权限的单例;维护一份 uuid -> 是否有权限的映射,供 Button 组件的鉴权逻辑查询 */ declare class OperationAuth { /** @type {OperationAuth} */ static "__#private@#instance": OperationAuth; /** @returns {OperationAuth} 单例实例 */ static getInstance: () => OperationAuth; /** * 用一批权限数据初始化/覆盖内部映射 * @param {Iterable<[string, boolean]>} data uuid 到权限布尔值的键值对集合 */ init: (data: Iterable<[string, boolean]>) => Map; /** * 判断某个操作是否有权限;没有记录该 uuid 时默认视为有权限 * @param {string} uuid 操作标识 * @returns {boolean} 是否有权限 */ check: (uuid: string) => boolean; #private; } /** * Button 组件点击行为的核心 hook;按 widgetType 把点击行为分发到对应的处理器 * (跳转/自定义函数/弹窗组件/表单弹窗/数据列表弹窗/删除请求等) * @param {Object} config * @param {*} config.widget 目标(组件/函数名/表达式/路由等,含义随 widgetType 而定) * @param {'redirect'|'func'|'component'|'fsdpf-component'|'grid-layout-form'|'data-list'|'destroy'} [config.widgetType] 行为类型 * @param {*} [config.widgetData] 触发时附带的数据 * @param {Object} [config.widgetProps] 触发前解析的 props 配置(经 getWidgetPropsData) * @param {Object} [config.widgetSetting] 传给目标(弹窗/表单/请求)的配置 * @param {Object} [config.widgetContainerProps] 传给弹窗容器的 props * @param {Object} [handlers] * @param {(result: *) => void} [handlers.onAfterClick] 动作完成后的回调 * @param {(data: *) => void} [handlers.onBeforeClick] 动作开始前的回调 * @returns {[(data: *) => void, {loading?: boolean, disabled?: boolean}]} [点击处理函数(已做 300ms 防抖), 当前 loading/disabled 状态] */ declare function useButton({ widget, widgetType, widgetData, widgetProps, widgetSetting, widgetContainerProps, }: { widget: any; widgetType?: "redirect" | "func" | "component" | "fsdpf-component" | "grid-layout-form" | "data-list" | "destroy"; widgetData?: any; widgetProps?: any; widgetSetting?: any; widgetContainerProps?: any; }, { onAfterClick, onBeforeClick }?: { onAfterClick?: (result: any) => void; onBeforeClick?: (data: any) => void; }): [(data: any) => void, { loading?: boolean; disabled?: boolean; }]; declare function Button({ className, variant, children, name, icon, type, iconPosition, noAuthType, onAfterClick, onBeforeClick, data, loading: customLoading, disabled: customDisabled, tooltip, confirm, widget, widgetType, widgetData, widgetProps, widgetSetting, widgetContainerProps, ...props }: { [x: string]: any; className: any; variant: any; children: any; name: any; icon: any; type?: string; iconPosition?: string; noAuthType: any; onAfterClick: any; onBeforeClick: any; data: any; loading: any; disabled: any; tooltip: any; confirm: any; widget?: () => void; widgetType: any; widgetData: any; widgetProps: any; widgetSetting: any; widgetContainerProps: any; }): React.JSX.Element; declare namespace Button { namespace propTypes { let type: PropTypes.Requireable; let size: PropTypes.Requireable; let name: PropTypes.Requireable; let icon: PropTypes.Requireable; let iconPosition: PropTypes.Requireable; let data: PropTypes.Requireable; let widget: PropTypes.Requireable; let widgetType: PropTypes.Requireable; let widgetData: PropTypes.Requireable; let widgetProps: PropTypes.Requireable; let widgetSetting: PropTypes.Requireable; let widgetContainerProps: PropTypes.Requireable; let tooltip: PropTypes.Requireable; placement: PropTypes.Requireable; enabled: PropTypes.Requireable>; getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>; }>>>; let confirm: PropTypes.Requireable; cancelText: PropTypes.Requireable; okText: PropTypes.Requireable; okType: PropTypes.Requireable; placement: PropTypes.Requireable; enabled: PropTypes.Requireable>; getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>; arrow: PropTypes.Requireable; }>>>>; }>>>; } } export { _default as auth, Button as default, useButton };