Skip to main content

ValueComponent

@combeenation/custom-code-utils


Class: ValueComponent<TName, TValue, TInput>

Represents a component of type Value

Extended by

Type Parameters

TName

TName extends string = string

TValue

TValue extends Cbn.CustomCode.CmpValue = Cbn.CustomCode.CmpValue

TInput

TInput extends Cbn.CustomCode.CmpValue = TValue

Implements

  • ValueComponent

Constructors

Constructor

new ValueComponent<TName, TValue, TInput>(name, zodObj): ValueComponent<TName, TValue, TInput>

Parameters

name

TName

zodObj

ZodType<unknown>

Returns

ValueComponent<TName, TValue, TInput>

Properties

name

readonly name: TName

Implementation of

Cbn.CustomCode.ValueComponent.name

Methods

getValue()

getValue(): Promise<TValue | undefined>

Function for receiving the value of a component.

Returns

Promise<TValue | undefined>

Implementation of

Cbn.CustomCode.ValueComponent.getValue


onValueChanged()

onValueChanged(listener, callImmediately, condition?): void

Parameters

listener

CmpValueChangedListener<TValue>

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<TValue>

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


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