Class MetaViewColumnCollection

The 'MetaView Column Collection' class defines the collection that manages the meta-view column. This class provides the ability to add meta columns, to serialize and manage reference collections.

Hierarchy (view full)

Constructors

  • Creates a 'MetaView ColumnCollection' object. This object creates a collection that manages columns in the meta view.

    Parameters

    • owner: object

    Returns MetaViewColumnCollection

    • Specifies the owner object of this collection.

Properties

_baseType: BaseColumn

Save the default column type.

_elemTypes: any[]

Defines the type constraints for the collection element.

_guid: string

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

_list: any[]

An array that stores a list of elements in a collection. This array contains actual data from the collection.

_owner: object

Owned object of the collection.

_refEntities: BaseEntity[]

List of entities referenced by this collection. Each entity is of type 'BaseEntity'.

constructions = collection._refEntities; // Get list of entities
_type: Function

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

$keys: string[]

Stores the key values of the collection element in an array.

count: number

Returns the number of elements in the current collection.

length: number

Returns the number of elements in the current collection.

_NS: string

Indicates the namespace.

'Meta'
_PARAM: []

List of parameters used for the constructor.

_UNION: []

List of implemented interfaces.

[IObject, IMarshal]

Methods

  • Protected

    Default descriptor set when adding elements to a collection.

    Parameters

    • idx: number

      Index of the element to which the technician will be imported.

    Returns object

  • Generates an 'onAdd' event.

    Parameters

    • idx: number

      Index of the element to be added.

    • elem: any

      The element to add.

    Returns void

    BaseCollection#onAdd

  • Generates an 'onAdd' event.

    Parameters

    • idx: number

      Index of added elements.

    • elem: any

      Added element.

    Returns void

    BaseCollection#onAdded

  • Generates an 'onChanged' event.

    Parameters

    • idx: number

      Index of the changed element.

    • elem: any

      Changed element.

    Returns any

    BaseCollection#onChanged

  • Generates an 'onChanging' event.

    Parameters

    • idx: number

      Index of the element to be changed.

    • elem: any

      The element to be changed.

    Returns any

    BaseCollection#onChanging

  • Generates an 'onClear' event.

    Returns any

    BaseCollection#onClear

  • Generates an 'onCheared' event.

    Returns any

    BaseCollection#onCleared

  • Create an 'onRemove' event.

    Parameters

    • idx: number

      Index of the element to be deleted.

    • elem: any

    Returns void

    BaseCollection#onRemove

  • Generates an 'onRemoved' event.

    Parameters

    • idx: number

      Index of the element to be deleted.

    • elem: any

      The element to delete.

    Returns void

    BaseCollection#onRemoved

  • Protected

    Verify that this._owner is an entity.

    Returns boolean

    Bullion value indicating whether the entity exists.

  • Deletes an element in a specified location in the collection. Use the template method pattern to perform the deletion.

    Parameters

    • pos: number

      Index of the element to be deleted.

    Returns boolean

    This is a Boolean value that indicates whether element deletion is successful or not.

    const success = myCollection._remove(1);
    console.log(`Delete element successful: ${success}`);
  • Adds or sets a column to the collection. When a column is added, actions related to the reference collection are performed.

    • When adding a column with 'entity': a reference is added.
    • If you add a column without 'entity', register yourself as the owner.
    • If a column exists in the collection: 'columns' object is ignored and registers a reference to the returned object.
    • If there is no column in the collection: Set 'entity' in the collection; only the top is registered when a reference recursive call is made.

    Parameters

    • column: string | MetaColumn

      The column to be added. You can receive the 'MetaColumn' object or column name (string).

    • refCollection: BaseColumnCollection

      Reference collection. Object of type 'BaseColumnCollection'.

    Returns number

    The index of the added column. The index represents the location of the column within the collection.

    const index = collection.add(new MetaColumn("price"), refCollection); // `MetaColumn` 객체로 컬럼 추가
    const index = collection.add("quantity", refCollection); // Add column with string (column name)
  • Adds all columns of a given entity to the collection.

    Parameters

    • entity: BaseEntity

      The entity to be added to the collection. The object of type 'BaseEntity'.

    Returns void

    collection.addEntity(entity); // Add all columns of a given entity
    
  • Creates a new column with a name and value and adds it to the collection.

    Parameters

    • name: string

      The name of the column you want to add.

    • value: string | number | boolean

      Default value for the column. You can receive string, numeric, or Boolean values.

    • refCollection: BaseColumnCollection

      Reference collection. Object of type 'BaseColumnCollection'.

    Returns number

    Index of the newly added column.

    const index = collection.addValue ("discount", 10, refCollection"); // Add column with name and value
    
  • Obtain column objects for aliases.

    Parameters

    • key: string

      alias name.

    Returns BaseColumn

    The column object corresponding to the alias, if it does not exist, is 'undefined'.

  • Initialize the property collection. This method initializes the array '$elements', '$descriptors', and '$keys'. The event is not initialized.

    Returns void

    myCollection.clear();
    console.log(myCollection.count); // 0
  • Verify that the element exists in the collection.

    Parameters

    • elem: any

      This is the element to check.

    Returns boolean

    This is a Boolean value indicating the presence or absence of an element.

    const exists = myCollection.contains(someElement);
    console.log(`element exists: ${exists}`);
  • 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.

  • Test that all elements pass the test implemented with the provided function.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns boolean

    True if you return a true value for all array elements, otherwise false.

  • Verify that the specified key exists in the property collection.

    Parameters

    • key: string

      Key to check. Bulian value indicating the presence or absence of the

    Returns boolean

    key.

  • Examine whether an alias name (key) exists in the collection.

    Parameters

    • key: string

      alias name.

    Returns boolean

    Alias name exists.

  • Examine whether a column name (key) exists in the collection.

    Parameters

    • key: string

      the name of the column.

    Returns boolean

    column name exists.

  • Filter only to elements that have passed the test implemented by the provided function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다.(currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any[]

    Returns a new array of results.

  • Returns the first element that satisfies the provided test function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      This is the callback function. (currentValue, index, array) => any

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any

    The first element in the array that satisfies the test function. If no element satisfies the test function, undefined is returned.

  • Returns the first element that satisfies the provided test function

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function. Index of the first element that passes the @returns{number} test. If no match exists, return -1.

    Returns any

  • Run the function provided for each element once.

    Parameters

    • callback: ((value: any, index: number, array: this) => void)

      This is the callback function. (currentValue, index, array) => void

        • (value, index, array): void
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns void

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns void

  • Converts the current 'MetaView ColumnCollection' object to a serialized object. In the serialization process, the cyclic reference is replaced by the value '$ref'.

    Parameters

    • OptionalvOpt: number

      Specifies the import option.

      • '0': Convert to a reference structure (including '_guid' and '$ref')
      • '1': Converting to a redundant structure (including '_guid' and '$ref')
      • '2': Conversion to non-coordinated structure (excluding '_guid' and '$ref')
    • Optionalowned: object | object[]

      The parent objects that currently own the object. You can receive an object or array of objects.

    Returns object

    Serialized object.

    const serialized = collection.getObject(2); // Get objects serialized in a non-coordinated structure
    
  • 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]
  • Look up an element in the collection.

    Parameters

    • Optionalelem: any

      The element to look up.

    Returns number

    Index of element. If element does not exist, return -1.

    const index = myCollection.indexOf(someElement);
    console.log (index of element: ${index});
  • Returns the key corresponding to the index of the property collection.

    Parameters

    • idx: number

      Index value to query.

    Returns string

    Key corresponding to index. You can return 'undefined' if the index is out of range.

    const key = myCollection.indexToKey(0);
    console.log(key for index 0: ${key}');
  • Initializes all column values in the collection to their default values.

    Returns void

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

  • Returns the index of the key or element specified in the property collection.

    Parameters

    • key: string

      key This is the key to look up.

    Returns number

    Index of element . Returns '-1' if element does not exist.

    const index = myCollection.keyToIndex("key1");
    console.log(`Index of key: ${index}`);
  • Collects the results of calling a given function for each element and returns a new array.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      This is the callback function (currentValue, index, array) => any[]

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns any[]

    Returns a new array of results.

  • Run the given reducer function for each element and return one result.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (accumulator, currentValue, index, array) => any

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalinitialValue: any

      Use the first element of the array if it does not provide an initial value.

    Returns any

    Returns a new array of results.

  • Delete an element in the collection.

    Parameters

    • elem: any

      The element to delete.

    Returns number

    Index of deleted elements.

    const removedIndex = myCollection.remove(someElement);
    console.log(`Index of deleted element: ${removedIndex}`);
  • Deletes the column for the specified index from the collection.

    Parameters

    • index: number

      Index of the column to be deleted.

    Returns boolean

    Deletion successful.

  • Initialize the property collection object using serialized objects. During this process, the object is initialized.

    Parameters

    • oGuid: object

      serialized object.

    • Optionalorigin: object

      Original object. Default is 'oGuid'.

    Returns void

  • Test that at least one element passes through a given discriminant function.

    Parameters

    • callback: ((value: any, index: number, array: this) => any)

      콜백함수 입니다. (currentValue, index, array) => boolean

        • (value, index, array): any
        • Parameters

          • value: any
          • index: number
          • array: this

          Returns any

    • OptionalthisArg: any

      The value to use as this when executing the callback function.

    Returns boolean

    Returns true if you return a true value for one element, or false.

Events

onAdd: ((idx: number, elem: any, _this: object) => void)

Events that occur before adding an element to a collection.

BaseCollection#onAdd

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the element to be added.

      • elem: any

        The element to add.

      • _this: object

        current collection object.

      Returns void

myCollection.onAdd = function(idx, elem, _this) {
console.log(`Before adding elements: index ${idx}, element ${elem}`);
};
onAdded: ((idx: number, elem: any, _this: object) => void)

Events that occur after you add an element to a collection.

BaseCollection#onAdded

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of added elements.

      • elem: any

        Added element.

      • _this: object

        current collection object.

      Returns void

myCollection.onAdded = function(idx, elem, _this) {
console.log ('After adding elements: index ${idx}, element ${elem}');
};
onChanged: ((idx: number, elem: any, _this: object) => void)

Events that occur after you change an element in a collection.

BaseCollection#onChanged

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the changed element.

      • elem: any

        Changed element.

      • _this: object

        current collection object.

      Returns void

myCollection.onChanged = function(idx, elem, _this) {
console.log ('After element change: index ${idx}, element ${elem}');
};
onChanging: ((idx: number, elem: any, _this: object) => void)

An event that occurs before you change an element in a collection.

BaseCollection#onChanging

Type declaration

    • (idx, elem, _this): void
    • Parameters

      • idx: number

        Index of the element to be changed.

      • elem: any

        The element to be changed.

      • _this: object

        current collection object.

      Returns void

myCollection.onChanging = function(idx, elem, _this) {
console.log(`Before element change: index ${idx}, element ${elem}`);
};
onClear: ((_this: object) => {})

Events that occur before the collection is initialized.

BaseCollection#onClear

Type declaration

    • (_this): {}
    • Parameters

      • _this: object

        current collection object.

      Returns {}

    myCollection.onClear = function(_this) {
    console.log ('Before collection initialization);
    };
    onCleared: ((_this: object) => {})

    Events that occur after the collection is initialized.

    BaseCollection#onCleared

    Type declaration

      • (_this): {}
      • Parameters

        • _this: object

          current collection object.

        Returns {}

      myCollection.onCleared = function(_this) {
      console.log ('After collection initialization');
      };
      onRemove: ((idx: number, elem: any, _this: object) => void)

      An event that occurs before an element is deleted from the collection.

      BaseCollection#onRemove

      Type declaration

        • (idx, elem, _this): void
        • Parameters

          • idx: number

            Index of the element to be deleted.

          • elem: any

            The element to delete.

          • _this: object

            current collection object.

          Returns void

      myCollection.onRemove = function(idx, elem, _this) {
      console.log(`Before element deletion: index ${idx}, element ${elem}`);
      };
      onRemoved: ((idx: number, elem: any, _this: object) => void)

      Events that occur after you delete an element from a collection.

      BaseCollection#onRemoved

      Type declaration

        • (idx, elem, _this): void
        • Parameters

          • idx: number

            Index of deleted elements.

          • elem: any

            Deleted element.

          • _this: object

            current collection object.

          Returns void

      myCollection.onRemoved = function(idx, elem, _this) {
      console.log(`After element deletion: index ${idx}, element ${elem}`);
      };