Documentation
    Preparing search index...

    Class ArrayProperty

    A property type that validates and manages arrays of primitive values. Allows enforcement of minimum and maximum element counts, as well as primitive type restrictions.

    const tags = new ArrayProperty({
    name: 'tags',
    minLength: 1,
    maxLength: 5,
    allowNumbers: false // Only string tags allowed
    });

    tags.set(['typescript', 'quatrain']); // OK
    tags.set([123]); // Throws Error: Numbers are not allowed in value

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _allows: string[] = []
    _defaultValue: any
    _events: { [key: string]: Function } = {}
    _hasChanged: boolean
    _htmlType: PropertyHTMLType = 'off'
    _id: string
    _mandatory: boolean = false
    _maxLength: number = 0
    _minLength: number = 0
    _name: string
    _parent: DataObjectClass<any> | undefined
    _protected: boolean = false
    _value: any[] | undefined = undefined
    EVENT_ONCHANGE: string = 'onChange'

    Event name triggered when the property value changes.

    EVENT_ONDELETE: string = 'onDelete'

    Event name triggered when the property is deleted.

    TYPE: string = 'array'

    The string literal type identifier for this property.

    Accessors

    • get allows(): string[]

      Returns string[]

    • get hasChanged(): boolean

      Returns boolean

    • set hasChanged(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get htmlType(): PropertyHTMLType

      Returns PropertyHTMLType

    • set htmlType(type: PropertyHTMLType): void

      Parameters

      Returns void

    • get mandatory(): boolean

      Returns boolean

    • get maxLength(): number

      Returns number

    • set maxLength(max: number): void

      Parameters

      • max: number

      Returns void

    • get minLength(): number

      Returns number

    • set minLength(min: number): void

      Parameters

      • min: number

      Returns void

    • get name(): string

      Returns string

    • get protected(): boolean

      Returns boolean

    Methods

    • Parameters

      • value: boolean | undefined

      Returns value is true | undefined

    • Creates a deep clone of the current property instance, preserving its prototype chain.

      Returns any

      A new independent instance of the property.

    • Retrieves the array, optionally applying a mapping/transformation function.

      Parameters

      • transform: Function | undefined = undefined

        A custom function to apply to the array before returning it.

      Returns any

      The raw or transformed array.

    • Assigns a new array value while enforcing length constraints and content type rules.

      Parameters

      • value: any[]

        The array to assign. Null values are cast to empty arrays [].

      • setChanged: boolean = true

        Whether to mark the property as modified.

      Returns ArrayProperty

      The property instance for chaining.

      If the value is not an array, violates length bounds, or contains forbidden types.

    • Serializes the array for JSON stringification.

      Returns any[] | undefined

      The raw internal array.

    • Retrieves the current value of the property, or its default value if currently undefined.

      Parameters

      • transform: any = undefined

        An optional transformation function applied to the value before returning it.

      Returns any

      The raw or transformed property value.