mobile-more
Version:
基于 antd-mobile v5 扩展移动端 UI 组件
93 lines (92 loc) • 2.33 kB
TypeScript
import React, { HtmlHTMLAttributes, ReactNode } from 'react';
import { TagProps } from 'antd-mobile';
type AliasType = {
alias?: ReactNode;
};
export type EnumData<ValueType = any> = {
/**
* 标签
*/
label?: React.ReactNode;
/**
* 值。
*/
value?: ValueType;
/**
* 自定义组件属性。
* @deprecated 即将废弃,请使用 `text` `tag` 替代。
*/
props?: Record<string, any>;
/**
* 标签属性。
*/
tag?: TagProps & AliasType;
/**
* 文本属性。
*/
text?: HtmlHTMLAttributes<HTMLSpanElement> & AliasType;
[k: string]: any;
}[];
export interface BaseDictionaryProps<ValueType = any> {
/**
* @description 枚举数据。
*/
valueEnum: EnumData;
/**
* @description 当前值。
*/
value: ValueType;
/**
* @description 展示类型。
* @default 'text'
*/
type?: 'text' | 'tag';
/**
* @description 没有匹配到值时默认展示内容。
* @default '-'
*/
defaultLabel?: React.ReactNode;
/**
* @description 自定义字段名。
*/
fieldNames?: {
label?: string;
value?: string;
/**
* @deprecated
*/
props?: string;
};
/**
* @description 自定义 value 匹配方法。
* @param itemValue 遍历枚举项的值。
* @param value 当前值。
* @returns
*/
match?: (itemValue: ValueType, value: ValueType) => boolean;
/**
* @description 自定义类名。
* @deprecated 即将废弃,请使用 `textProps` `tagProps` 替代。
*/
className?: string;
/**
* @description 自定义样式。
* @deprecated 即将废弃,请使用 `textProps` `tagProps` 替代。
*/
style?: React.CSSProperties;
/**
* @description 文本属性。
*/
textProps?: HtmlHTMLAttributes<HTMLSpanElement>;
/**
* @description 标签属性。
*/
tagProps?: TagProps;
/**
* @deprecated 即将废弃,请使用 `type` 指定类型。
* @description 自定义包裹组件。
*/
component?: keyof HTMLElement | Parameters<typeof React.cloneElement>[0] | null;
}
declare const BaseDictionary: React.FC<BaseDictionaryProps>;
export default BaseDictionary;