Documentation
    Preparing search index...

    Class NumberProperty

    A property type strictly validating and formatting numeric values. Allows enforcement of integers, positive-only limits, and boundary checking.

    const price = new NumberProperty({
    name: 'price',
    type: NumberProperty.TYPE_FLOAT,
    sign: NumberProperty.TYPE_UNSIGNED,
    prefix: '$',
    minVal: 0
    });

    price.set(19.99);
    console.log(price.val(NumberProperty.TRANSFORM_FORMATTED)); // "$ 19.99"
    price.set(-5); // Throws Error: Value must be unsigned

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _allows: string[] = []
    _defaultValue: any
    _events: { [key: string]: Function } = {}
    _hasChanged: boolean
    _htmlType: PropertyHTMLType = 'off'
    _id: string
    _mandatory: boolean = false
    _maxVal: number | undefined = undefined
    _minVal: number | undefined = undefined
    _name: string
    _parent: DataObjectClass<any> | undefined
    _precision: number = 0
    _prefix: string = ''
    _protected: boolean = false
    _sign: string = NumberProperty.TYPE_SIGNED
    _suffix: string = ''
    _type: string = NumberProperty.TYPE_INTEGER
    _value: number | 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.

    SEPARATOR: string = ' '

    Default separator used for string formatting.

    TRANSFORM_FORMATTED: string = 'formatted'

    Transformation identifier to return the number as a formatted string.

    TYPE: string = 'number'

    The string literal type identifier for this property.

    TYPE_FLOAT: string = 'float'

    Type flag indicating a floating-point value.

    TYPE_INTEGER: string = 'integer'

    Type flag indicating an integer value.

    TYPE_SIGNED: string = 'signed'

    Constraint flag for signed numbers (positive and negative).

    TYPE_UNSIGNED: string = 'unsigned'

    Constraint flag for unsigned numbers (positive only).

    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 maxVal(): number | undefined

      Returns number | undefined

    • set maxVal(max: number | undefined): void

      Parameters

      • max: number | undefined

      Returns void

    • get minVal(): number | undefined

      Returns number | undefined

    • set minVal(min: number | undefined): void

      Parameters

      • min: number | undefined

      Returns void

    • get name(): string

      Returns string

    • get protected(): boolean

      Returns boolean

    • get type(): string

      Returns string

    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.

    • Assigns a new numeric value while strictly enforcing boundary, sign, and type constraints. If configured as an integer, the input is floored.

      Parameters

      • value: number

        The number to assign.

      • setChanged: boolean = true

        Whether to mark the property as modified.

      Returns NumberProperty

      The property instance for chaining.

      If the number violates the min, max, or sign constraints.

    • Serializes the property for JSON stringification.

      Returns any

      The raw internal value of the property.

    • Retrieves the numeric value, optionally applying UI string formatting.

      Parameters

      • transform: string | undefined = undefined

        Use TRANSFORM_FORMATTED to return a string with the configured prefix and suffix.

      Returns string | number | undefined

      The raw number or the formatted string representation.