import React from 'react'; /** * 通用业务类型定义 */ /** * 状态映射项 */ interface StatusMapItem { /** 显示文本 */ text: string; /** 标签颜色 */ color: string; /** 可选图标 (React 节点) */ icon?: React.ReactNode; } /** * 状态映射表 * * @example * ```ts * const STATUS_MAP: StatusMap<'active' | 'inactive'> = { * active: { text: '启用', color: 'green' }, * inactive: { text: '禁用', color: 'red' }, * }; * ``` */ type StatusMap = Record; /** * 下拉选择项 */ interface SelectOption { /** 显示文本 */ label: string; /** 值 */ value: V; /** 是否禁用 */ disabled?: boolean; /** 子选项 (级联选择) */ children?: SelectOption[]; } /** * 树节点 */ interface TreeNode { /** 节点 key */ key: string | number; /** 显示标题 */ title: string; /** 节点数据 */ data?: T; /** 子节点 */ children?: TreeNode[]; /** 是否叶子节点 */ isLeaf?: boolean; /** 是否禁用 */ disabled?: boolean; } /** * 键值对 */ interface KeyValue { key: string; value: V; } /** * 排序方向 */ type SortOrder = 'ascend' | 'descend' | null; /** * 排序信息 */ interface SortInfo { field: string; order: SortOrder; } export type { KeyValue as K, SelectOption as S, TreeNode as T, SortInfo as a, SortOrder as b, StatusMap as c, StatusMapItem as d };