Element: <oj-highlight-text>

Oracle® JavaScript Extension Toolkit (JET)
9.2.0

F30740-01

Signature:

class ojHighlightText

QuickNav

Attributes

JET Custom Elements

JET components are implemented as custom HTML elements. In addition to the component attributes documented in this page, JET components also support standard HTML global attributes like id and aria-label.

The JET data binding syntax can be used to define both component and global attributes through the use of dynamically evaluated expressions. All attributes (component and global) support attribute-level binding by prefixing the attribute name with ":" (e.g. :id="[...]"). When using attribute-level binding, all expression values are treated as strings. Additionally, component attributes support property-level binding by using the attribute name directly with no ":" prefix. When using property-level binding, the expressions should evaluate to the types documented by the corresponding attributes. Property-level binding is strongly recommended over attribute-level binding for component attributes.

A detailed description of working with custom HTML elements can be found in: JET Custom Element Usage.


Version:
  • 9.2.0
Since:
  • 9.1.0
Module:
  • ojhighlighttext

Module usage

See JET Module Loading for an overview of module usage within JET.

Typescript Import Format
//To typecheck the element APIs, import as below.
import {HighlightTextElement} from "ojs/ojhighlighttext";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojhighlighttext";

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.


JET Highlight Text

Description: JET Highlight Text renders text with highlighting applied.

JET Highlight Text renders a text string with highlighting applied to the given text to match.

A Highlight Text can be created with the following markup.


<oj-highlight-text
  text='My text to apply highlighting to.'
  match-text='igh'>
</oj-highlight-text>

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.

Attributes

match-text :string

The text string to match.
Default Value:
  • ''
Names
Item Name
Property matchText
Property change event matchTextChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-match-text-changed

text :string

The text string to apply highlighting to.
Default Value:
  • ''
Names
Item Name
Property text
Property change event textChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-text-changed

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Since:
  • 4.0.0
Returns:
Type
any
Example

Get a single subproperty of a complex property:

let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');

setProperties(properties) : {void}

Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a batch of properties:

myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});

setProperty(property, value) : {void}

Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a single subproperty of a complex property:

myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");