Props for the IDictField component.

interface IDictFieldProps<Data = IAnything, Payload = IAnything> {
    description?: string;
    dictCreateButton?: any;
    dictDelay?: number;
    dictLimit?: number;
    dictOnAppend?: (
        search: string,
        data: Data,
        payload: Payload,
        onValueChange: (value: null | string) => void,
        onChange: (value: Data) => void,
    ) => void;
    dictOnItem?: (
        value: null | string,
        data: Data,
        payload: Payload,
        onValueChange: (value: null | string) => void,
        onChange: (data: Data) => void,
    ) => void;
    dictOnText?: (
        text: string,
        data: Data,
        payload: Payload,
        onValueChange: (value: null | string) => void,
        onChange: (data: Data) => void,
    ) => void;
    dictSearch?: (
        dto: {
            data: Data;
            initial: boolean;
            limit: number;
            offset: number;
            payload: Payload;
            rows: ISearchItem<any>[];
            search: string;
        },
    ) => ISearchItem<any>[]
    | Promise<ISearchItem<any>[]>;
    dictSearchItem?: any;
    dictSearchText?: (data: Data, payload: Payload) => string | Promise<string>;
    dictValue?: (
        value: string,
        data: Data,
        payload: Payload,
    ) => ISearchItem<any> | Promise<ISearchItem<any>>;
    disabled?: boolean;
    groupRef?: (element?: null | HTMLDivElement) => void;
    inputAutocomplete?: "new-password" | "on" | "off" | "false";
    inputFormatter?: (input: string) => string;
    inputFormatterAllowed?: RegExp | (char: string, idx: number) => boolean;
    inputFormatterReplace?: (char: string) => null | string;
    inputFormatterSymbol?: string;
    inputFormatterTemplate?: string;
    inputMode?:
        | "search"
        | "text"
        | "email"
        | "tel"
        | "url"
        | "none"
        | "numeric"
        | "decimal";
    inputPattern?: string;
    inputRef?: (element?: null | HTMLInputElement) => void;
    inputType?:
        | "number"
        | "color"
        | "search"
        | "text"
        | "date"
        | "email"
        | "month"
        | "password"
        | "tel"
        | "time"
        | "url"
        | "week";
    leadingIcon?: any;
    leadingIconClick?: (
        value: Value,
        data: Data,
        payload: Payload,
        onValueChange: (v: Value) => void,
        onChange: (data: Data) => void,
    ) => void;
    leadingIconRipple?: boolean;
    leadingIconTabIndex?: number;
    outlined?: boolean;
    placeholder?: string;
    readonly?: boolean;
    title?: string;
    trailingIcon?: any;
    trailingIconClick?: (
        value: Value,
        data: Data,
        payload: Payload,
        onValueChange: (v: Value) => void,
        onChange: (data: Data) => void,
    ) => void;
    trailingIconRipple?: boolean;
    trailingIconTabIndex?: number;
    validation?: IValidation;
}

Type Parameters

  • Data = IAnything

    The data type of the field.

  • Payload = IAnything

    The payload type of the field.

Properties

description?: string

The description of the field.

dictCreateButton?: any

The button to create a new item in the dictionary.

dictDelay?: number

The delay between input and dictionary search.

dictLimit?: number

The limit of items shown in the dictionary.

dictOnAppend?: (
    search: string,
    data: Data,
    payload: Payload,
    onValueChange: (value: null | string) => void,
    onChange: (value: Data) => void,
) => void

The function called when an item is appended to the dictionary.

dictOnItem?: (
    value: null | string,
    data: Data,
    payload: Payload,
    onValueChange: (value: null | string) => void,
    onChange: (data: Data) => void,
) => void

The function called when a dictionary item is selected.

dictOnText?: (
    text: string,
    data: Data,
    payload: Payload,
    onValueChange: (value: null | string) => void,
    onChange: (data: Data) => void,
) => void

The function called when the text of a dictionary item is updated.

dictSearch?: (
    dto: {
        data: Data;
        initial: boolean;
        limit: number;
        offset: number;
        payload: Payload;
        rows: ISearchItem<any>[];
        search: string;
    },
) => ISearchItem<any>[]
| Promise<ISearchItem<any>[]>

The search function for the dictionary.

dictSearchItem?: any

The item being searched in the dictionary.

dictSearchText?: (data: Data, payload: Payload) => string | Promise<string>

The text being searched in the dictionary.

dictValue?: (
    value: string,
    data: Data,
    payload: Payload,
) => ISearchItem<any> | Promise<ISearchItem<any>>

The selected value from the dictionary.

disabled?: boolean

Whether the field should be disabled.

groupRef?: (element?: null | HTMLDivElement) => void

The ref for the group element.

inputAutocomplete?: "new-password" | "on" | "off" | "false"

The autocomplete option for the input.

inputFormatter?: (input: string) => string

The function to format the input value.

inputFormatterAllowed?: RegExp | (char: string, idx: number) => boolean

The allowed characters for formatting.

inputFormatterReplace?: (char: string) => null | string

The replace option for formatting.

inputFormatterSymbol?: string

The symbol used for formatting.

inputFormatterTemplate?: string

The template for formatting.

inputMode?:
    | "search"
    | "text"
    | "email"
    | "tel"
    | "url"
    | "none"
    | "numeric"
    | "decimal"

The input mode.

inputPattern?: string

The regex pattern for input validation.

inputRef?: (element?: null | HTMLInputElement) => void

The ref for the input element.

inputType?:
    | "number"
    | "color"
    | "search"
    | "text"
    | "date"
    | "email"
    | "month"
    | "password"
    | "tel"
    | "time"
    | "url"
    | "week"

The type of input element.

leadingIcon?: any

The icon element for the leading icon.

leadingIconClick?: (
    value: Value,
    data: Data,
    payload: Payload,
    onValueChange: (v: Value) => void,
    onChange: (data: Data) => void,
) => void

The function to call when the leading icon is clicked.

leadingIconRipple?: boolean

Whether the leading icon should have ripple effect.

leadingIconTabIndex?: number
outlined?: boolean

Whether the field should be outlined.

placeholder?: string

The placeholder text for the input.

readonly?: boolean

Whether the field should be read-only.

title?: string

The title of the field.

trailingIcon?: any

The icon element for the trailing icon.

trailingIconClick?: (
    value: Value,
    data: Data,
    payload: Payload,
    onValueChange: (v: Value) => void,
    onChange: (data: Data) => void,
) => void

The function to call when the trailing icon is clicked.

trailingIconRipple?: boolean

Whether the trailing icon should have ripple effect.

trailingIconTabIndex?: number
validation?: IValidation

Validation factory config

Type representing the field object.

Type representing the data object.

Type representing the payload object.

The value of the "validation" property.