import {createEnum} from "@peryl/utils/createEnum"; import {ThemeStatus} from "../../uses/useStyle"; import {anonymousEffects, createHooks, RenderNode, SimpleFunction} from "@peryl/react-compose"; import {createCounter} from "@peryl/utils/createCounter"; /** * 通知方向 * @author 韦胜健 * @date 2022.5.6 18:31 */ export const NoticeDirection = createEnum(['start', 'end'] as const); /** * 创建notice服务id * @author 韦胜健 * @date 2022.5.6 18:35 */ export const nextNoticeId = createCounter('notice-service'); /** * 关闭消息通知服务观察者对象 * @author 韦胜健 * @date 2022.5.6 18:53 */ export const closeNoticeServiceHook = createHooks<(id?: null | string) => void>(anonymousEffects); /** * 消息通知服务配置对象类型 * @author 韦胜健 * @date 2022.5.6 18:32 */ export interface iNoticeServiceOption { id?: string | null, title?: string | null | (() => any), // 标题 message?: string, // 通知消息 time?: number | null, // 停留时间 status?: typeof ThemeStatus.TYPE | null, // 状态 icon?: string, // 显示图标 noClose?: boolean, // 不显示关闭按钮 renderHead?: () => RenderNode, // 自定义头部内容 renderContent?: () => RenderNode, // 自定义内容 renderFoot?: () => RenderNode, // 自定义底部内容 onClick?: SimpleFunction, // 点击事件处理函数 onClose?: SimpleFunction, // 关闭处理函数 vertical?: typeof NoticeDirection.TYPE, // 纵向位置 horizontal?: typeof NoticeDirection.TYPE, // 横向位置 }