UNPKG

@ray-js/smart-ui

Version:

轻量、可靠的智能小程序 UI 组件库

74 lines (73 loc) 1.81 kB
/// <reference types="react" /> /// <reference types="miniprogram-api-typings" /> import { SmartComponent, SmartEventHandler } from '../base'; export interface SmartSwipeCellProps { /** * 标识符,可以在 `close` 事件的参数中获取到 */ name?: string | number; /** * 左侧滑动区域宽度 * * @default 0 */ leftWidth?: number; /** * 右侧滑动区域宽度 * * @default 0 */ rightWidth?: number; /** * 是否异步关闭 * * @default false */ asyncClose?: boolean; /** * 是否禁用滑动 * * @default false */ disabled?: boolean; /** * 左右侧的按钮 */ slot: { left?: React.ReactNode; right?: React.ReactNode; }; } export type SmartSwipeCellPosition = 'left' | 'right'; export type SmartSwipeCellClickPosition = SmartSwipeCellPosition | 'cell' | 'outside'; /** * @deprecated */ export interface SmartSwipeCellClickEvent extends WechatMiniprogram.BaseEvent { detail: SmartSwipeCellClickPosition; } export interface SmartSwipeCellBaseEventDetail { name: string | number; position: SmartSwipeCellPosition; } export interface SmartSwipeCellCloseEventDetail extends SmartSwipeCellBaseEventDetail { /** * SwipeCell 实例 */ instance: Record<string, any>; } export interface SmartSwipeCellEvents { /** * 点击时触发 */ onClick?: SmartEventHandler<SmartSwipeCellClickPosition>; /** * 关闭时触发 */ onClose?: SmartEventHandler<SmartSwipeCellCloseEventDetail>; /** * 打开时触发 */ onOpen?: SmartEventHandler<SmartSwipeCellBaseEventDetail>; } export type SmartSwipeCell = SmartComponent<SmartSwipeCellProps, SmartSwipeCellEvents>;