import type { BaseSelectProps, SelectOption } from '@pisell/utils'; /** * PisellSingleSelect 组件 Props 类型定义 * * 继承 BaseSelectProps,添加单选特有的配置 * @template T 选项值的类型,默认为 string | number */ export interface PisellSingleSelectProps extends BaseSelectProps { /** * 受控模式:当前选中值 */ value?: T | null; /** * 非受控模式:默认选中值 */ defaultValue?: T; /** * 值变化回调 * @param value 新的选中值 * @param option 选中的选项对象(如果值为 null 则 option 也为 null) */ onChange?: (value: T | null, option: SelectOption | null) => void; /** * ARIA 标签 */ 'aria-label'?: string; /** * ARIA 是否必填 */ 'aria-required'?: boolean; /** * ARIA 是否无效 */ 'aria-invalid'?: boolean; /** * ARIA 描述关联 ID */ 'aria-describedby'?: string; } /** * PisellSingleSelect 组件 Ref 方法 * @template T 选项值的类型 */ export interface SingleSelectRef { /** * 聚焦到组件 */ focus: () => void; /** * 失焦 */ blur: () => void; /** * 获取当前选中值 */ getValue: () => T | null; /** * 设置选中值 */ setValue: (value: T | null) => void; /** * 清空选中值 */ clearValue: () => void; } /** * EditView 组件 Props * @template T 选项值的类型 */ export interface EditViewProps extends PisellSingleSelectProps { /** * 内部状态管理对象(从 useSelectState Hook 传入) */ state?: { value: T | null | undefined; setValue: (value: T | null) => void; clearValue: () => void; }; } /** * DisabledView 组件 Props * @template T 选项值的类型 */ export interface DisabledViewProps extends PisellSingleSelectProps { } /** * ReadOnlyView 组件 Props * @template T 选项值的类型 */ export interface ReadOnlyViewProps extends PisellSingleSelectProps { } export type { SelectOption, FilterOptionFunc, SortDirection, SelectState, } from '@pisell/utils';