@enum-plus/plugin-antd
Version:
A plugin for enum-plus that provides functionality to bind enums to Ant Design
32 lines (31 loc) • 1.28 kB
TypeScript
import type { EnumInit, EnumKey, EnumValue, PluginFunc, ValueTypeFromSingleInit } from 'enum-plus';
export interface ToValueMapPluginOptions {
}
declare const toValueMapPlugin: PluginFunc<ToValueMapPluginOptions>;
export default toValueMapPlugin;
declare module 'enum-plus/extension' {
interface EnumExtension<T extends EnumInit<K, V>, K extends EnumKey<T> = EnumKey<T>, V extends EnumValue = ValueTypeFromSingleInit<T[K], K>> {
/**
* - **EN:** Generate a mapping object that can be used to bind Select, Checkbox and other form
* components, following the data specification of AntDesignPro library
* - **CN:** 生成一个映射对象,可以用来绑定Select、Checkbox等表单组件,遵循 AntDesignPro 的数据规范
*
* @example
* {
* "0": { "text": "Sunday" },
* "1": { "text": "Monday" }
* }
*
* @see https://procomponents.ant.design/components/schema#valueenum-1
* @see https://procomponents.ant.design/components/field-set#proformselect
*/
toValueMap(): ValueMap;
}
}
export type ValueMap = Record<string, {
/**
* - **EN:** The display text
* - **CN:** 显示文本
*/
text: string;
}>;