Documentation
    Preparing search index...

    Class BaseProperty

    The core foundation class for all Quatrain properties. It manages the state, immutability (protected), change tracking, and events of a data field.

    const myProp = new BaseProperty({
    name: 'status',
    defaultValue: 'active',
    protected: false,
    onChange: (dao) => console.log('Status changed on', dao.id)
    });

    myProp.set('inactive');
    console.log(myProp.val()); // "inactive"

    Hierarchy (View Summary)

    Implements

    • PropertyClassType
    Index

    Constructors

    Properties

    _allows: string[] = []
    _defaultValue: any
    _events: { [key: string]: Function } = {}
    _hasChanged: boolean
    _htmlType: PropertyHTMLType = 'off'
    _id: string
    _mandatory: boolean = false
    _name: string
    _parent: DataObjectClass<any> | undefined
    _protected: boolean = false
    _value: any = 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 = 'any'

    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 mandatory(): boolean

      Returns boolean

    • 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.

    • Sets a new value for the property and triggers the onChange event if modified.

      Parameters

      • value: any

        The new value to assign.

      • setChanged: boolean = true

        Whether to mark the property as modified (defaults to true).

      Returns BaseProperty

      The current property instance for chaining.

      If the property is marked as protected and already has a value.

    • Serializes the property for JSON stringification.

      Returns any

      The raw internal value of the property.

    • 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.