Skip to main content

RecordComponent

@combeenation/custom-code-utils


Class: RecordComponent<TName, TKey, TRecord, TInput>

Represents a component of type Record

Extends

Type Parameters

TName

TName extends string = string

TKey

TKey extends Cbn.CustomCode.CmpSimpleValue = Cbn.CustomCode.CmpSimpleValue

TRecord

TRecord extends Cbn.model.plancmps.Record.RecordValue = Cbn.model.plancmps.Record.RecordValue

TInput

TInput extends Cbn.model.plancmps.Record.RecordValue = TRecord

Implements

  • ValueComponent

Constructors

Constructor

new RecordComponent<TName, TKey, TRecord, TInput>(name, zodObj): RecordComponent<TName, TKey, TRecord, TInput>

Parameters

name

TName

zodObj

ZodType<unknown>

Returns

RecordComponent<TName, TKey, TRecord, TInput>

Inherited from

ValueComponent.constructor

Properties

name

readonly name: TName

Implementation of

Cbn.CustomCode.ValueComponent.name

Inherited from

ValueComponent.name

Methods

getAllRecords()

getAllRecords(): Promise<TRecord[] | undefined>

Returns

Promise<TRecord[] | undefined>


getRecordByKey()

getRecordByKey(key): Promise<TRecord | undefined>

Returns the data of a specific record

Parameters

key

TKey

The key value of the wanted record

Returns

Promise<TRecord | undefined>

The record (key-value-pair) or undefined if no record with the given key was found


getSelectedKey()

getSelectedKey(): Promise<TKey | undefined>

Get the key of the currently selected record

Returns

Promise<TKey | undefined>


getValue()

getValue(): Promise<TRecord | undefined>

Function for receiving the value of a component.

Returns

Promise<TRecord | undefined>

Implementation of

Cbn.CustomCode.ValueComponent.getValue

Inherited from

ValueComponent.getValue


onRecordsChanged()

onRecordsChanged(listener, callImmediately): void

With this function a listener can be assigned which is executed whenever the data of a record component changes

Parameters

listener

CmpRecordsChangedListener<TRecord[]>

Called whenever the records of the given record cmp has changed

callImmediately

boolean = false

True: The listener is immediately called with the current records of the record cmp at the time, the listener is added
False: The listener will be called for the first time when the records of the cmp actually change

Returns

void


onSelectedKeyChanged()

onSelectedKeyChanged(listener, callImmediately, condition?): void

With this function a listener can be assigned which is executed whenever the selected key of a record component changes

Parameters

listener

CmpRecordKeyChangedListener<TKey, TRecord>

Called whenever the selected key of the given record component has changed

callImmediately

boolean = false

True: The listener is immediately called with the current key and value of the cmp at the time, the listener is added
False: The listener will be called for the first time when the key of the cmp actually changes

condition?

CmpRecordKeyChangedCondition<TKey, TRecord>

A predicate function which is given the new cmp key and value.
The function can decide on whether the listener is called or not by returning true or false.

Returns

void


onValueChanged()

onValueChanged(listener, callImmediately, condition?): void

Parameters

listener

CmpValueChangedListener<TRecord>

Called whenever the value of the given cmp has changed

callImmediately

boolean = false

True: The listener is immediately called with the current value of the cmp at the time, the listener is added
False: The listener will be called for the first time when the value of the cmp actually changes

condition?

CmpValueChangedCondition<TRecord>

A predicate function which is given the new cmp value.
The function can decide on whether the listener is called or not by returning true or false.

Returns

void

Inherited from

ValueComponent.onValueChanged


setInput()

setInput(value, defer): Promise<void>

Sends the ChangeConfigurationValue request to the server

Parameters

value

TInput | undefined

defer

boolean = true

Defers the actual request after the current execution context.
All values from subsequent calls to setCmpInput within the same execution context will be sent as 1 batch request if defer = true.

Returns

Promise<void>

Implementation of

Cbn.CustomCode.ValueComponent.setInput

Inherited from

ValueComponent.setInput


setSelectedKey()

setSelectedKey(key, defer): Promise<void>

Parameters

key

TKey

defer

boolean = true

Returns

Promise<void>