Classes representing HTML columns. This class defines the columns that can interact with HTML DOM elements.

Hierarchy (view full)

Constructors

Properties

_entity: BaseEntity

Indicates the entity to which this column belongs. Object of type 'BaseEntity'.

_guid: string

Unique identifier of the object (GUID). Uniquely identifies the object.

_name: string

The name of the element, which acts as a unique identifier for the MetaElement.

_type: Function

The generator function of the object. The function used when the object was created.

_valueTypes: any

Defines the value type for the column. This property is used to set the value type for the column.

$alias: string

Indicates the alias for the column. The alias is used as another name for the column.

$event: EventEmitter

An event object that handles events, such as changing the column value.

$key: string

Indicates the unique key for this column.

$value: any

Limits direct access to values in a column. This property controls the setting and change of values inside.

alias: string

Sets or imports aliases for columns. Aliases are used to transfer data and set low values. Where to use (default = columnName)

  • Bind-command-ajax._execBind(): When transmitting data
  • BaseBind.setValue(row): When setting a low value to an entity
  • getValue(): Used for row
caption: string

Provides a description of the column.

columnName: string

Indicates the name of the column. Same as '_name'.

constraints: (object | Function)[]

Sets the constraints for the column. Constraints can be set in the form of objects or functions.

default: string | number | boolean

Sets the default value for the column.

domType: object

Defines the item DOM type.

element: HTMLElement

Indicates the DOM element.

getFilter: ((sVal: any) => any)

Function that filters the value.

Type declaration

    • (sVal): any
    • Parameters

      • sVal: any

        value obtained from selector when selector exists.

      Returns any

      Filtered value.

getter: (() => ValueType)

Getter function of column value.

value of the column.

const value = column.getter(); // get column values
isHide: boolean

Indicates whether it is hidden or not.

isReadOnly: boolean

Indicates whether read-only is enabled.

required: boolean

Sets whether a column value is required. If the value must exist, it is 'true', otherwise it is 'false'.

selector: {
    key: string;
    type: string;
}

Defines a selector. type

  • 'value' or 'value': Value attribute value of element
  • 'text': Text value of element
  • 'html': HTML value of element
  • 'css.synonymous': Attribute value of CSS (object)
  • 'prop.': Attribute name value of element (based on initial state)
  • 'attr. fast name': Attribute name value of element (current state)
  • 'none': perform no action, purpose of expression exam: 'value', 'text', 'css.color', 'prop.disabled'
setFilter: ((val: any) => any)

Function that filters the value.

Type declaration

    • (val): any
    • Parameters

      • val: any

        Value to apply as filter.

      Returns any

      If the filtering result is present, set the selector's value.

setter: ((value: ValueType) => void)

Setter function of column value.

Type declaration

    • (value): void
    • Parameters

      • value: ValueType

        This is the value to set.

      Returns void

column.setter ('newValue'); // set column value
value: any

Sets or imports the value of the item.

_NS: string

Indicates the namespace.

'Meta'
_PARAM: []

List of parameters used for the constructor.

['name']
_UNION: []

List of implemented interfaces.

[IElement]

Methods

  • Load the properties of the column.

    Parameters

    • property: object

      Property object to load.

    Returns void

    column._load({ required: true, constraints: [...] });
    
  • Internal method called when the value changes.

    Parameters

    • nVal: ValueType

      New value.

    • oVal: ValueType

      Existing value.

    Returns void

    MetaColumn#onChanged

  • Add constraints.

    Parameters

    • regex: RegExp

      Regular expression to apply.

    • msg: string

      Message to display when regular expression fails.

    • Optionalcode: string

      Code for failure of regular expression. (Optional)

    • Optionalcondition: boolean

      The condition that determines whether a constraint is successful/failed. Default is 'false'.

    Returns void

    column.addConstraint(/^\d+$/, 'Value must be a number');
    
  • Compare the current object with the specified object.

    Parameters

    • target: object

      the object to be compared to.

    Returns boolean

    Returns whether the two objects are the same.

  • Obtain the current object as a serialized object. The cyclic reference is replaced by the value '$ref'.

    Parameters

    • OptionalvOpt: number

      Import option.

      • '0': Reference structure ('_guid: Yes', '$ref: Yes')
      • '1': Redundant structure ('_guid: Yes', '$ref: Yes')
      • '2': Non-coordinated structure ('_guid: No', '$ref: No')
    • Optionalowned: object | object[]

    Returns object

    serialized object.

    const serialized = a.getObject(2);
    const sameObject = b.getObject(2);
  • Returns the creators of the current object and all the creators of the prototype chain to the array.

    Returns Function[]

    Returns the array of generator functions.

    const types = obj.getTypes();
    console.log(types); // [Function: MetaObject]
  • Verify that the current object is an instance of the specified type (including _UNION)

    Parameters

    • target: string | object

      The type of object to be checked (object or string).

    Returns boolean

    Returns whether it is an instance of the specified type.

  • Sets the serialized object to the current object.
    The object is initialized.

    Parameters

    • oGuid: object

      serialized GUID object.

    • Optionalorigin: object

      The source object setting the current object.

    Returns void

  • Check that the value of the property is valid. Validates based on 'required' and 'constructions'.

    Parameters

    • value: ValueType

      This is the value to be inspected.

    Returns object

    Returns the object if it is invalid, and returns 'undefined' if it is valid.

    const validationResult = column.valid('valueToCheck');
    

Events

onChanged: ((newVal: ValueType, oldVal: ValueType, _this: this) => void)

The event that occurs when the column value changes.

MetaColumn#onChanged

Type declaration

    • (newVal, oldVal, _this): void
    • Parameters

      • newVal: ValueType

        New value.

      • oldVal: ValueType

        Previous value.

      • _this: this

        The object that caused the event.

      Returns void

column.onChanged = function(newVal, oldVal, _this) { 
console.log('Value changed');
};