import { MantineSize, MantineSpacing, TooltipProps } from "@mantine/core"; import React from "react"; import { FormTab } from "./FormTab"; import { ReactiveForm } from "./ReactiveForm"; export type ColSpan = number | "auto" | "content"; export type ColumnSize = ColSpan | Partial>; export type HintOptions = { position: TooltipProps["position"]; w?: number | string; }; export declare class InputBuilder { /** * Auto translate label and placeholder */ protected autoTranslate: boolean; /** * Reactive form instance */ form: ReactiveForm; /** * Prepared props */ protected preparedProps: any; /** * Input id */ id: string; /** * Wrapper props */ wrapperProps: any; /** * Input data */ data: any; /** * Component props */ componentProps: any; /** * Default col size */ protected defaultColSize: ColSpan; /** * cache rendered content */ content: any; /** * Form input tab that might belong to */ tab?: FormTab; /** * Reading value from query string */ protected valueFromQueryString: string; /** * Previous record */ protected record: any; /** * Input default value */ protected inputDefaultValue: any; /** * Input description */ protected _description?: React.ReactNode; /** * Input hint */ protected _hint: React.ReactNode; /** * Hint configurations */ protected _hintOptions: HintOptions; /** * Re-render handler */ protected reRenderer: any; /** * Label style */ protected labelStyle: { height: number; }; /** * Form input key */ _key: string; /** * Input wrapper */ wrapper: React.ComponentType; /** * Form input callbacks */ protected callbacks: any; /** * Constructor */ constructor(name: string); /** * Set input wrapper */ setWrapper(wrapper: React.ComponentType): this; /** * Add event when input is rendered */ onRendered(callback: (input: InputBuilder) => void): this; /** * Boot */ protected boot(): void; /** * Wether to mark component as readOnly */ readOnly(readOnly?: boolean): this; /** * Set the length that the user must enter for the input */ length(length: number): this; /** * Determine if input is default checked * * Works only with `radio` `checkbox` and `switch` types */ defaultChecked(isChecked?: boolean): this; /** * Get Form control instance */ get formControl(): any; /** * Set input description */ description(description: React.ReactNode): this; /** * Set re-render handler */ setReRenderHandler(handler: any): this; /** * Trigger re render */ reRender(): void; /** * Set form tab */ setTab(tab: FormTab): this; /** * Set reactive form */ setForm(form: ReactiveForm): this; /** * Trigger that the input is rendered */ rendered(): void; /** * Triggered when form is closed */ protected onFormClose(): void; /** * Add on change callback */ onChange(callback: (value: any, options: any, inputBuilder: InputBuilder) => void): this; /** * Set input hint */ hint(hint: React.ReactNode): this; /** * Set hint position */ hintPosition(position: HintOptions["position"]): this; /** * Set hint width */ hintWidth(width: HintOptions["w"]): this; /** * Set all hint options */ hintOptions(options: HintOptions): this; /** * Set input default value */ defaultValue(value: any): this; /** * Read value from query string as default value */ readValueFromQueryString(key: string): this; /** * Check if input has col value */ hasCol(): boolean; /** * Enable or disable autoComplete */ autoComplete(autoComplete?: boolean): this; /** * Auto focus on component */ autoFocus(autoFocus?: boolean): this; /** * Check if component is auto focused */ isAutoFocused(): boolean; /** * Trigger focus on component */ focus(): void; /** * Auto translate label and placeholder */ autoTrans(autoTranslate?: boolean): this; /** * Required if exists key */ requiredIfExists(key: string, exists?: boolean): this; /** * Required if not exists */ requiredIfNotExists(key: string): this; /** * Determine whether to auto transform the name into placeholder or label */ autoTransform(key: "placeholder" | "label", autoTransform?: boolean): this; /** * Determine whether the label should be displayed */ shouldDisplay(key: "placeholder" | "label", display?: boolean): this; /** * Set input default value key */ setDefaultValueKey(key?: string): this; /** * Mark input as required */ required(required?: boolean): this; /** * Set margin top */ mt(size: MantineSpacing): this; /** * Set margin bottom */ mb(size: MantineSpacing): this; /** * Set margin left */ ml(size: MantineSpacing): this; /** * Set margin right */ mr(size: MantineSpacing): this; /** * Set margin */ m(size: MantineSpacing): this; /** * Set margin x */ mx(size: MantineSpacing): this; /** * Set margin y */ my(size: MantineSpacing): this; /** * Set component type */ type(type: string): this; /** * Set input size */ col(col: ColumnSize): this; /** * Get input name */ name(): any; /** * Set input name */ setName(name: string): this; /** * Determine whether the label or placeholder should be translated */ shouldAutoTranslate(key: "placeholder" | "label"): any; /** * Update component props */ updateComponentProps(props: any): this; /** * Set component props */ setComponentProps(props: any): this; /** * Set label */ label(label: React.ReactNode, translate?: boolean): this; /** * Set placeholder */ placeholder(placeholder: string, translate?: boolean): this; /** * Set input component */ component(component: any, componentProps?: any): this; /** * Generate new random key to current input */ generateNewKey(): this; /** * Set record */ setRecord(record: any): this; /** * Get label */ getLabel(): any; /** * Clear cached content */ clearCache(): this; /** * Cache content * If content is not cached, then call the given callback and cache the result */ protected cacheContent(callback: () => React.ReactNode): any; /** * Render the input */ render(): any; /** * Render content */ protected renderContent(): any; /** * Prepare rendering */ protected prepareRendering(): { props: any; Component: any; wrapperProps: any; }; /** * Get Wrapper props */ getWrapperProps(): any; /** * Update wrapper props */ updateWrapperProps(props: any): this; /** * Wrapper style */ wrapperStyle(style: any): this; /** * Get col size */ getColSize(): any; /** * Called when preparing props */ protected preparingProps(): void; /** * Prepare props */ protected prepareProps(): any; /** * Parse default value */ protected parseDefaultValue(): any; /** * Parse default checked */ protected parseDefaultChecked(): any; /** * Clone current input builder */ clone(): any; } //# sourceMappingURL=InputBuilder.d.ts.map