Namespace: VComponentBinding

Oracle® JavaScript Extension Toolkit (JET)
10.1.0

F37996-01

Since:
  • 10.0.0
Module:
  • ojvcomponent-binding

QuickNav

Description

JET VComponentBinding

The namespace contains VComponent property binding decorators.

These decorators are designed to be used on VComponent properties when a particular property value has to propagate to the descendant components or a particular property value should be received from a parent component, if the property is provided by the parent.

Note that the property binding decorators can only be used by VComponents that have Knockout binding applied to them.

Example:

class Props {
  // Indicate that the component will consume the 'containerlabelEdge' property value provided by the parent
  @consumeBinding({name: 'containerlabelEdge'})

  // Provide the 'labelEdge' property value under two different keys using different transform logic for different consumers.
  @provideBinding({name: 'containerlabelEdge', default: 'inside'})
  @provideBinding({name: 'labelEdge', default: 'inside', transform: {top: 'provided', start: 'provided'}})
  labelEdge?: 'inside' | 'start' | 'top' = 'inside';
}


Usage

Typescript Import Format
//To import this namespace, use the format below.
import {VComponentBinding} from "ojs/ojvcomponent-binding";

//This module also exports compiler decorators. To import a decorator use the named import format, for example:
import {consumeBinding} from "ojs/ojvcomponent-binding";

For additional information visit:


Decorators

@consumeBinding(consume)

Property decorator for VComponent that allows the property to consume a value provided by an ancestor component. The value will be consumed only if the property's attribute has not been set, i.e. the provided value is used as a default. The 'name' property should be set to the name of the variable published by an ancestor component.
Parameters:
Name Type Description
consume {name: string} Options object that contains a name of the variable published by an ancestor component.

@provideBinding(provide)

Property decorator for VComponent that allows the property to provide a value to be consumed by descendant components. Use multiple provideBinding decorators to provide more than one value to the descendants. See example above. The provided value will come from the literal attribute value, explicit expression binding or an implicit (consumed) binding provided by an ancestor component.
Parameters:
Name Type Description
provide MetadataTypes.ProvideProperty Options object.