react-antd-admin-panel
Version:
Modern TypeScript-first React admin panel builder with Ant Design 6
68 lines • 1.85 kB
TypeScript
import React from 'react';
import { BaseBuilder } from './BaseBuilder';
import type { FormFieldConfig, ValidationRule, FieldValue } from '../types';
export interface FormFieldBuilderConfig extends FormFieldConfig {
}
/**
* Base class for all form field builders
* Extends BaseBuilder with form-specific functionality
*/
export declare abstract class FormFieldBuilder<TConfig extends FormFieldBuilderConfig = FormFieldBuilderConfig, TValue extends FieldValue = FieldValue> extends BaseBuilder<TConfig> {
protected _value?: TValue;
protected _onChange?: (value: TValue) => void;
protected _fieldId: string;
constructor();
/**
* Set the field label
*/
label(text: string): this;
/**
* Set the field placeholder
*/
placeholder(text: string): this;
/**
* Mark field as required
*/
required(value?: boolean): this;
/**
* Set the field tooltip
*/
tooltip(text: string): this;
/**
* Set validation rules
*/
rules(rules: ValidationRule[]): this;
/**
* Add a single validation rule
*/
rule(rule: ValidationRule): this;
/**
* Set default value
*/
defaultValue(value: TValue): this;
/**
* Set the field value
*/
value(val: TValue): this;
/**
* Get the current field value
*/
getValue(): TValue | undefined;
/**
* Set onChange handler
*/
onChange(handler: (value: TValue) => void): this;
/**
* Handle value change
*/
protected handleChange(value: TValue): void;
/**
* Get the field ID for accessibility
*/
getFieldId(): string;
/**
* Wrap field with label (with proper accessibility association)
*/
protected wrapWithLabel(field: React.ReactNode): React.ReactNode;
}
//# sourceMappingURL=FormFieldBuilder.d.ts.map