UIComponent
This is the base class of all UI (view) components.
class UIComponent abstract
extends
Component
implements
UIRenderable
Represents a visible part of the user interface.
Note: This class should not be instantiated on its own. Instead, use one of the predefined UI components such as
UIButton
andUILabel
, or create your own view component using theViewComponent
class.
Constructor
(): UIComponent
.propagateComponentEvent() deprecated
(name: string, inner?:
ManagedEvent
, event?: any): void
Create and emit a UI event with given name and a reference to this component, as well as an optional platform event.
Deprecated: in v3.1.
.delegateEvent() protected
(e:
ManagedEvent
, propertyName: string): true
Override event delegation, to also propagate events of type UIComponentEvent
.
.render()
(callback: RenderCallback<Output<
UIRenderable
, any>>): void
Trigger asynchronous rendering for this component, and all contained components (if any). Rendered output is passed to given callback (from the application level UIRenderContext
, or from a containing UI component).
.isFocusable()
(): boolean
Returns true if this component can be focused directly using mouse or touch, or manually using UIComponent.requestFocus
. This method may be overridden by derived component classes, but the return value must be constant for each instance.
.isKeyboardFocusable()
(): boolean
Returns true if this component can be focused using the keyboard as well as using other methods (rather than direct manipulation only). This method may be overridden by derived component classes, but the return value must be constant for each instance.
.requestFocus()
(): void
Request input focus on this component.
Note: Not all components can be focused. Components can only be focused after they are rendered, so consider using this method inside of a Rendered
event handler.
.requestFocusNext()
(): void
Request input focus for the next sibling component.
.requestFocusPrevious()
(): void
Request input focus for the previous sibling component.
.applyStyle() protected
(style?:
UIStyle
): void
Applies given style set to individual style objects (e.g. UIComponent.dimensions
). This method is overridden by derived classes to copy only applicable styles.
.style
Combined style set, as an instance of UIStyle
; individual style object properties can be overridden, which will not affect the style
property.
Note: When this property is preset (using .with(...)
), the preset value is mixed in to the current style set, rather than replacing it altogether. The result is always applied before individual style objects such as dimensions
and position
. However, setting this property directly on a component instance will completely remove existing styles.
.hidden
boolean
Set to true to hide this component from view (does not stop the component from being rendered).
.dimensions
Readonly<Dimensions>
Options for the dimensions of this component.
.position
Readonly<Position>
Options for the positioning of this component within parent component(s).
.accessibleRole
string
WAI-ARIA role for this component, if applicable.
.accessibleLabel
string
WAI-ARIA label text for this component (not tooltip), if applicable.
.lastRenderOutput
Output<this, any>
Last rendered output, if any; set by the renderer.
.isPresetComponent() protected
(): boolean
Inherited from Component.isPresetComponent
.
.getParentComponent()
<TParent extends Component = Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getParentComponent
.
.getBoundParentComponent()
<TParent extends Component>(ParentClass?:
ComponentConstructor
<TParent>): TParent
Inherited from Component.getBoundParentComponent
.
.emitAction()
(name: string, inner?:
ManagedEvent
, context?:
ManagedObject
): void
Inherited from Component.emitAction
.
.managedId
number
Inherited from ManagedObject.managedId
.
.managedState
Inherited from ManagedObject.managedState
.
.getReferenceCount() protected
(): number
Inherited from ManagedObject.getReferenceCount
.
.getManagedReferrers() protected
():
ManagedObject
[]
Inherited from ManagedObject.getManagedReferrers
.
.getManagedParent() protected
<TParent extends ManagedObject = ManagedObject>(ParentClass?:
ManagedObjectConstructor
<TParent>): TParent
Inherited from ManagedObject.getManagedParent
.
.emit()
<TEvent extends ManagedEvent = ManagedEvent, TConstructorArgs extends any[] = any[]>(e: string | TEvent | (new (...args: TConstructorArgs) => TEvent), ...constructorArgs: TConstructorArgs): this
Inherited from ManagedObject.emit
.
.emitChange()
(name?: string): void
Inherited from ManagedObject.emitChange
.
.propagateChildEvents() protected deprecated
(...types: ((new (...args: any[]) =>
ManagedEvent
) | ((e:
ManagedEvent
) => any))[]): this
Inherited from ManagedObject.propagateChildEvents
.
.activateManagedAsync() protected
(): Promise<any>
Inherited from ManagedObject.activateManagedAsync
.
.deactivateManagedAsync() protected
(): Promise<void>
Inherited from ManagedObject.deactivateManagedAsync
.
.destroyManagedAsync() protected
(): Promise<void>
Inherited from ManagedObject.destroyManagedAsync
.
.onManagedStateActivatingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateActivatingAsync
.
.onManagedStateActiveAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateActiveAsync
.
.onManagedStateDeactivatingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateDeactivatingAsync
.
.onManagedStateInactiveAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateInactiveAsync
.
.onManagedStateDestroyingAsync() protected
(): Promise<void>
Inherited from ManagedObject.onManagedStateDestroyingAsync
.
UIComponent.Presets
UIComponent base presets type, for use with Component.with
.
.style
string |
UIStyle
Style set (either an instance of UIStyle
or the name of a style set defined in UITheme.current
), which is mixed into the current style set on the component, before setting any other style properties.
.hidden
boolean
Set to true to hide this component from view (does not stop the component from being rendered).
.dimensions
Partial<{} | Dimensions>
Options for the dimensions of this component (overrides).
.position
Partial<{} | Position>
Options for the positioning of this component within parent component(s) (overrides).
.accessibleRole
string
WAI-ARIA role for this component, if applicable.
.accessibleLabel
string
WAI-ARIA label text for this component (not tooltip), if applicable.
.requestFocus
boolean
Set to true to request focus immediately after rendering for the first time; cannot be used together with onRendered
.
UIComponent.DynamicRendererWrapper
Stateful renderer for dynamic content (used by UIRenderableController
, ViewComponent
, etc.).
Constructor
.render()
(content?:
UIRenderable
, callback?: RenderCallback<Output<
UIRenderable
, any>>): void
Render given content using given callback, or previously stored callback.
.removeAsync()
(): Promise<unknown>
Remove previously rendered output.