@ucloud-pccl/react-components
Version:
UCloud pccl react components
102 lines (101 loc) • 3.81 kB
TypeScript
import React, { ReactNode } from 'react';
import { Moment } from 'moment';
import { TDate } from '@z-r/calendar/types/interface';
import LOCALE from './locale/zh_CN';
import { TShortcut } from './Footer';
interface RangeProps {
/** 当前值,受控 */
value?: [TDate | null, TDate | null];
/** 默认值,非受控 */
defaultValue?: [TDate | null, TDate | null];
/** 修改回调,返回 moment 对象数组 */
onChange?: (v: [Moment | null, Moment | null]) => void;
/** 初始化回调函数,传入 option 的情况下会输出 option 对应的值,配合 option 或者 defaultOption 使用 */
onInitialChange?: (v: [Moment | null, Moment | null]) => void;
/** 选项 */
options?: {
label: ReactNode;
value: string;
disabled?: boolean;
range?: {
start?: TDate;
end?: TDate;
};
}[];
/** 当前选项,受控 */
option?: string;
/** 默认选项,非受控 */
defaultOption?: string;
/** 选项变化回调 */
onOptionChange?: (option: string) => void;
/**
* @deprecated 不传入 options 即可隐藏
* 隐藏快捷选项
*/
hideOptions?: boolean;
/** 是否可为空 */
nullable?: [boolean | undefined, boolean | undefined] | [boolean | undefined] | [];
/** 输入和展示的字符串格式,为数组时,第一个用作展示 */
format?: string | string[];
/**
* @deprecated 使用 format 替换
* 展示格式,会传入 DatePicker 和 Month 中(按照 type)
*/
display?: {
date?: {
/** @deprecated 设置日期展示格式,使用 format 替换 */
format?: string;
/** @deprecated 是否展示日期选择,仅时间选择需求使用 TimePicker 替换 */
show?: boolean;
};
/** 设置为 false,隐藏时 */
hour?: boolean;
/** 设置为 false,隐藏分 */
minute?: boolean;
/** 设置为 false,隐藏秒 */
second?: boolean;
range?: {
/** @deprecated 新版无用 */
format?: string;
};
};
/** 自定义规则 */
rules?: {
range?: [TDate | void, TDate | void];
maxRange?: any;
minRange?: any;
};
/** 状态 */
status?: 'default' | 'error';
/** placeholder */
placeholder?: [string | undefined, string | undefined] | [string | undefined] | [];
/** picker 类型 */
type?: 'date' | 'month';
/** 面板快捷内容 */
shortcuts?: [TShortcut[] | null, TShortcut[] | null] | [TShortcut[] | null];
/** 控件尺寸 */
size?: 'sm' | 'md' | 'lg';
/** 是否禁用 */
disabled?: boolean;
/** 弹出层的 z-index */
zIndex?: number;
/** 自定义默认选项 props */
selectProps?: any;
/** 自定义时间选择框弹出层props */
popoverProps?: any;
/** 自定义渲染 */
customRender?: {
/** 自定义渲染只读时(非自定义选项)的展示内容(时间区域) */
readonlyDisplay?: (value: [TDate | null, TDate | null]) => ReactNode;
};
/**
* @ignore
* 自定义 datePicker 的 props
*/
/** 提示信息,展示在时间选择弹窗中 */
rangeTip?: ReactNode;
/** @ignore */
locale?: typeof LOCALE;
}
declare const _default: React.MemoExoticComponent<({ options: _options, option: _option, defaultOption, onOptionChange: _onOptionChange, hideOptions, value: _value, defaultValue, onChange: _onChange, onInitialChange, nullable, size, display, format, rules, type, disabled, zIndex, locale: _locale, selectProps, popoverProps, rangeTip, status, placeholder, shortcuts, customRender, ...rest }: RangeProps) => React.JSX.Element>;
export default _default;