File

projects/ng-dynamic-forms/core/src/lib/model/dynamic-input-control.model.ts

Extends

DynamicFormValueControlModelConfig

Index

Properties

Properties

autoComplete
autoComplete: string
Type : string
Optional
autoFocus
autoFocus: boolean
Type : boolean
Optional
maxLength
maxLength: number
Type : number
Optional
minLength
minLength: number
Type : number
Optional
placeholder
placeholder: string
Type : string
Optional
prefix
prefix: string
Type : string
Optional
readOnly
readOnly: boolean
Type : boolean
Optional
spellCheck
spellCheck: boolean
Type : boolean
Optional
suffix
suffix: string
Type : string
Optional
import { DynamicFormValueControlModel, DynamicFormValueControlModelConfig } from "./dynamic-form-value-control.model";
import { DynamicFormControlLayout } from "./misc/dynamic-form-control-layout.model";
import { serializable } from "../decorator/serializable.decorator";
import { isBoolean, isNumber } from "../utils/core.utils";

export interface DynamicInputControlModelConfig<T> extends DynamicFormValueControlModelConfig<T> {

    autoComplete?: string;
    autoFocus?: boolean;
    maxLength?: number;
    minLength?: number;
    placeholder?: string;
    prefix?: string;
    readOnly?: boolean;
    spellCheck?: boolean;
    suffix?: string;
}

export abstract class DynamicInputControlModel<T> extends DynamicFormValueControlModel<T> {

    @serializable() autoComplete: string;
    @serializable() autoFocus: boolean;
    @serializable() maxLength: number | null;
    @serializable() minLength: number | null;
    @serializable() placeholder: string;
    @serializable() prefix: string | null;
    @serializable() readOnly: boolean;
    @serializable() spellCheck: boolean;
    @serializable() suffix: string | null;

    protected constructor(config: DynamicInputControlModelConfig<T>, layout?: DynamicFormControlLayout) {

        super(config, layout);

        this.autoComplete = config.autoComplete || "on";
        this.autoFocus = isBoolean(config.autoFocus) ? config.autoFocus : false;
        this.maxLength = isNumber(config.maxLength) ? config.maxLength : null;
        this.minLength = isNumber(config.minLength) ? config.minLength : null;
        this.placeholder = config.placeholder || "";
        this.prefix = config.prefix || null;
        this.readOnly = isBoolean(config.readOnly) ? config.readOnly : false;
        this.spellCheck = isBoolean(config.spellCheck) ? config.spellCheck : false;
        this.suffix = config.suffix || null;
    }
}

result-matching ""

    No results matching ""