react-antd-admin-panel
Version:
Modern TypeScript-first React admin panel builder with Ant Design 6
64 lines • 1.77 kB
TypeScript
import React from 'react';
import { FormFieldBuilder, FormFieldBuilderConfig } from '../base/FormFieldBuilder';
export interface SelectOption<T = any> {
label: string;
value: T;
disabled?: boolean;
}
export interface SelectConfig<T = any> extends FormFieldBuilderConfig {
options?: SelectOption<T>[];
mode?: 'multiple' | 'tags';
showSearch?: boolean;
allowClear?: boolean;
loading?: boolean;
maxTagCount?: number;
filterOption?: boolean | ((input: string, option?: SelectOption<T>) => boolean);
}
/**
* Select Field Builder
* Wrapper for Ant Design Select component with builder pattern and generics
* @template T - The type of option values
*/
export declare class Select<T = any> extends FormFieldBuilder<SelectConfig<T>, T | T[]> {
/**
* Set select options
*/
options(opts: SelectOption<T>[]): this;
/**
* Add a single option
*/
option(label: string, value: T, disabled?: boolean): this;
/**
* Enable multiple selection
*/
multiple(value?: boolean): this;
/**
* Enable tags mode (user can create new options)
*/
tags(value?: boolean): this;
/**
* Enable search functionality
*/
showSearch(value?: boolean): this;
/**
* Enable clear button
*/
allowClear(value?: boolean): this;
/**
* Set loading state
*/
loading(value?: boolean): this;
/**
* Set maximum number of tags to display
*/
maxTagCount(count: number): this;
/**
* Set custom filter function
*/
filterOption(fn: boolean | ((input: string, option?: SelectOption<T>) => boolean)): this;
/**
* Render the select component
*/
render(): React.ReactNode;
}
//# sourceMappingURL=Select.d.ts.map