test-nut-ui
Version:
<p align="center"> <img alt="logo" src="https://img11.360buyimg.com/imagetools/jfs/t1/211965/25/7152/22022/61b16785E433119bb/aa41d7a9f7e823f3.png" width="150" style="margin-bottom: 10px;"> </p>
128 lines (127 loc) • 2.97 kB
TypeScript
import React, { RefObject } from 'react';
import { PickerOption } from './types';
import { BasicComponent } from '../../utils/typings';
export type PickerActions = {
open: () => void;
close: () => void;
};
export interface PickerProps extends Omit<BasicComponent, 'children'> {
/**
* 是否可见
* @default false
*/
visible?: boolean | undefined
/**
* 设置标题
* @default -
*/
title?: string
titles: string[];
/**
* 列表数据
* @default []
*/
options: any
options2: (PickerOption | PickerOption[] | PickerOption[][])[];
/**
* 选中值,受控
* @default []
*/
value?: (number | string)[]
/**
* 默认选中
* @default []
*/
defaultValue?: (number | string)[]
defaultValue2?: (number | string)[][];
/**
* 是否开启3D效果
* @default true
*/
threeDimensional?: boolean
/**
* 快速滑动时惯性滚动的时长,单位 ms
* @default 1000
*/
duration: number | string
borderRadius?: string | number;
isTabs: boolean;
tabsTitle: string[];
cellHeight: number;
/**
* 确认按钮文案
* @default -
*/
confirmText?: string
/**
* 取消按钮文案
* @default -
*/
cancelText?: string
withSeparator?: boolean;
tabsWithSeparator: boolean[];
/**
* 选项最大选择数量 >1 为复选
* @default 1
*/
limitNumber: number
/**
* 复选框选中前图标
* @default null
*/
icon: React.ReactNode
/**
* 复选框选中后图标
* @default null
*/
activeIcon: React.ReactNode
/**
* 复选框半选状态图标
* @default null
*/
indeterminateIcon: React.ReactNode
/**
* 禁用状态
* @default false
*/
disabled: boolean
/**
* 是否显示全选按钮
* @default true
*/
showSelectAll: boolean
/**
* 多选状态下弹框的最大高度
* @default 85vh
*/
maxHeight: string
loading: boolean;
/**
* 自定义选项回调,返回值是一个元素节点
* @default -
*/
option?: (item: any, active: boolean) => React.ReactNode
/**
* 点击确认按钮时候回调
* @default -
*/
onConfirm?: (selectedOptions: any, selectedValue: any) => void
/**
* 关闭时触发
* @default -
*/
onClose?: (selectedOptions: any, selectedValue: any) => void
/**
* 联动时,关闭时回调
* @default -
*/
afterClose?: (selectedOptions: any, selectedValue: any, pickerRef: RefObject<HTMLDivElement>) => void
/**
* 每一列值变更时调用
* @default -
*/
onChange?: (selectedOptions: any, selectedValue: any, columnIndex: number, tabValue: number) => void
children?: any;
}
declare const Picker: React.ForwardRefExoticComponent<Partial<PickerProps> & React.RefAttributes<unknown>>;
export default Picker;