react-antd-admin-panel
Version:
Modern TypeScript-first React admin panel builder with Ant Design 6
72 lines • 1.81 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Input } from 'antd';
import { FormFieldBuilder } from '../base/FormFieldBuilder';
const { TextArea: AntTextArea } = Input;
/**
* TextArea Field Builder
* Wrapper for Ant Design TextArea component
*/
export class TextArea extends FormFieldBuilder {
/**
* Set number of rows
*/
rows(value) {
this._config.rows = value;
return this;
}
/**
* Set maximum length
*/
maxLength(value) {
this._config.maxLength = value;
return this;
}
/**
* Set minimum length
*/
minLength(value) {
this._config.minLength = value;
return this;
}
/**
* Enable auto-size (height adjusts to content)
*/
autoSize(value = true) {
this._config.autoSize = value;
return this;
}
/**
* Show character count
*/
showCount(value = true) {
this._config.showCount = value;
return this;
}
/**
* Enable clear button
*/
allowClear(value = true) {
this._config.allowClear = value;
return this;
}
/**
* Render the textarea component
*/
render() {
if (this._config.hidden) {
return null;
}
const props = {
placeholder: this._config.placeholder,
disabled: this._config.disabled,
rows: this._config.rows,
maxLength: this._config.maxLength,
autoSize: this._config.autoSize,
showCount: this._config.showCount,
allowClear: this._config.allowClear,
onChange: (e) => this.handleChange(e.target.value),
};
return this.wrapWithLabel(_jsx(AntTextArea, { ...props }));
}
}
//# sourceMappingURL=TextArea.js.map