The API reference of @playcanvas/pcui 6.1.4: the UI components of browser-based tools such as the PlayCanvas Editor, and the bindings that connect them to observer data.
The same pages as Markdown, for AI agents: llms-full.txt.
Class · extends Element · implements IFocusable, IBindable<unknown[]>
Element that allows editing an array of values.
new ArrayInput(args?: Readonly<ArrayInputArgs>)
Creates a new ArrayInput.
Parameters
args (Readonly<ArrayInputArgs>, optional, default {}): The arguments.get binding(): BindingBase
set binding(value: BindingBase)
Sets the Binding object for the element.
get renderChanges(): boolean
set renderChanges(value: boolean)
Gets whether array elements should flash when their values change.
get value(): unknown[]
set value(value: unknown[])
Gets the value of the ArrayInput as an array.
set values(values: unknown[][])
Sets multiple array values on the ArrayInput.
blur(): void
Unfocus the element
destroy(): void
Destroys the Element and its events.
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
forEachArrayElement(fn: (element: Element, index: number) => false | void): void
Executes the specified function for each array element.
Parameters
fn ((element: Element, index: number) => false | void): The function with signature (element, index) => bool to execute. If the function
returns false then the iteration will early out.link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers and paths to the Element's data binding.
Parameters
observers (Observer | Observer[]): An array of observers or a single observer.paths (string | string[]): A path for the observer(s) or an array of paths that maps to each separate observer.unlink(): void
Unlinks the Element from its observers.
static readonly EVENT_LINK_ELEMENT: "linkElement" = 'linkElement'
Fired when an array element is linked to observers.
Example
arrayInput.on('linkElement', (element: Element, index: number, path: string) => {
console.log(`Element ${index} is now linked to ${path}`);
});
static readonly EVENT_UNLINK_ELEMENT: "unlinkElement" = 'unlinkElement'
Fired when an array element is unlinked from observers.
Example
arrayInput.on('unlinkElement', (element: Element, index: number) => {
console.log(`Element ${index} is now unlinked`);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Events
Base class for data binding between IBindable Elements and Observers.
new BindingBase(args: Readonly<BindingBaseArgs>)
Creates a new binding.
Parameters
args (Readonly<BindingBaseArgs>): The arguments.get applyingChange(): boolean
set applyingChange(value: boolean)
Gets whether the binding is currently applying a change, either to the observers or the element.
get element(): IBindable<unknown>
set element(value: IBindable<unknown>)
Gets the element.
get historyCombine(): boolean
set historyCombine(value: boolean)
Gets whether to combine history actions when applying changes to observers.
get historyEnabled(): boolean
set historyEnabled(value: boolean)
Gets whether history is enabled for the binding.
get historyName(): string
set historyName(value: string)
Gets the name of the history action when applying changes to observers.
get historyPostfix(): string
set historyPostfix(value: string)
Gets the string to postfix historyName with.
get historyPrefix(): string
set historyPrefix(value: string)
Gets the string to prefix historyName with.
get linked(): boolean
Gets whether the binding is linked to observers.
get observers(): Observer[]
Gets the linked observers.
get paths(): string[]
Gets the linked paths.
addValue(value: unknown): void
Adds (inserts) a value to the linked observers at the linked paths.
Parameters
value (unknown): The value.addValues(values: unknown[]): void
Adds (inserts) multiple values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.clone(): BindingBase
Clones the binding. To be implemented by derived classes.
Returns BindingBase
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers to the specified paths.
Parameters
observers (Observer | Observer[]): The observer(s).paths (string | string[]): The path(s). The behavior of the binding depends on how many paths are passed.
If an equal amount of paths and observers are passed then the binding will map each path to each observer at each index.
If more observers than paths are passed then the path at index 0 will be used for all observers.
If one observer and multiple paths are passed then all of the paths will be used for the observer (e.g. for curves).removeValue(value: unknown): void
Removes a value from the linked observers at the linked paths.
Parameters
value (unknown): The value.removeValues(values: unknown[]): void
Removes multiple values from the linked observers from the linked paths.
Parameters
values (unknown[]): The values.setValue(value: unknown): void
Sets a value to the linked observers at the linked paths.
Parameters
value (unknown): The valuesetValues(values: unknown[]): void
Sets an array of values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.unlink(): void
Unlinks the observers and paths.
Class · extends BindingBase
Provides one way binding between an IBindable element and Observers. Any changes from the element will be propagated to the observers.
addValue(value: unknown): void
Adds (inserts) a value to the linked observers at the linked paths.
Parameters
value (unknown): The value.addValues(values: unknown[]): void
Adds (inserts) multiple values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.clone(): BindingElementToObservers
Clone the binding and return a new instance.
Returns BindingElementToObservers
removeValue(value: unknown): void
Removes a value from the linked observers at the linked paths.
Parameters
value (unknown): The value.removeValues(values: unknown[]): void
Removes multiple values from the linked observers from the linked paths.
Parameters
values (unknown[]): The values.setValue(value: unknown): void
Sets a value to the linked observers at the linked paths.
Parameters
value (unknown): The valuesetValues(values: unknown[]): void
Sets an array of values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.new BindingElementToObservers(args: Readonly<BindingBaseArgs>)get element(): IBindable<unknown> · set element(value: IBindable<unknown>)get historyEnabled(): boolean · set historyEnabled(value: boolean)get historyName(): string · set historyName(value: string)get historyPrefix(): string · set historyPrefix(value: string)get linked(): booleanget observers(): Observer[]get paths(): string[]link(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidget applyingChange(): boolean · set applyingChange(value: boolean)get historyCombine(): boolean · set historyCombine(value: boolean)get historyPostfix(): string · set historyPostfix(value: string)Class · extends BindingBase
Provides one way binding between Observers and an IBindable element and Observers. Any changes from the observers will be propagated to the element.
new BindingObserversToElement(args?: Readonly<BindingObserversToElementArgs>)
Creates a new BindingObserversToElement instance.
Parameters
args (Readonly<BindingObserversToElementArgs>, optional, default {}): The arguments.clone(): BindingObserversToElement
Clone the BindingObserversToElement instance.
Returns BindingObserversToElement
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers to the specified paths.
Parameters
observers (Observer | Observer[]): The observer(s).paths (string | string[]): The path(s). The behavior of the binding depends on how many paths are passed.
If an equal amount of paths and observers are passed then the binding will map each path to each observer at each index.
If more observers than paths are passed then the path at index 0 will be used for all observers.
If one observer and multiple paths are passed then all of the paths will be used for the observer (e.g. for curves).unlink(): void
Unlink the binding from its set of observers.
get applyingChange(): boolean · set applyingChange(value: boolean)get element(): IBindable<unknown> · set element(value: IBindable<unknown>)get historyCombine(): boolean · set historyCombine(value: boolean)get historyEnabled(): boolean · set historyEnabled(value: boolean)get historyName(): string · set historyName(value: string)get historyPostfix(): string · set historyPostfix(value: string)get historyPrefix(): string · set historyPrefix(value: string)get linked(): booleanget observers(): Observer[]get paths(): string[]addValue(value: unknown): voidaddValues(values: unknown[]): voidremoveValue(value: unknown): voidremoveValues(values: unknown[]): voidsetValue(value: unknown): voidsetValues(values: unknown[]): voidClass · extends BindingBase
Provides two way data binding between Observers and IBindable elements. This means that when the value of the Observers changes the IBindable will be updated and vice versa.
new BindingTwoWay(args?: Readonly<BindingTwoWayArgs>)
Creates a new BindingTwoWay instance.
Parameters
args (Readonly<BindingTwoWayArgs>, optional, default {}): The arguments.get applyingChange(): boolean
set applyingChange(value: boolean)
Sets whether the binding is currently applying a change, either to the observers or the element.
get element(): IBindable<unknown>
set element(value: IBindable<unknown>)
Sets the element.
get historyCombine(): boolean
set historyCombine(value: boolean)
Sets whether to combine history actions when applying changes to observers. This is assuming a history module is being used.
get historyEnabled(): boolean
set historyEnabled(value: boolean)
Sets whether history is enabled for the binding. A valid history object must have been provided first.
get historyPostfix(): string
set historyPostfix(value: string)
Sets the string to postfix historyName with.
get historyPrefix(): string
set historyPrefix(value: string)
Sets the string to prefix historyName with.
addValue(value: unknown): void
Adds (inserts) a value to the linked observers at the linked paths.
Parameters
value (unknown): The value.addValues(values: unknown[]): void
Adds (inserts) multiple values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.clone(): BindingTwoWay
Clones the binding. To be implemented by derived classes.
Returns BindingTwoWay
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers to the specified paths.
Parameters
observers (Observer | Observer[]): The observer(s).paths (string | string[]): The path(s). The behavior of the binding depends on how many paths are passed.
If an equal amount of paths and observers are passed then the binding will map each path to each observer at each index.
If more observers than paths are passed then the path at index 0 will be used for all observers.
If one observer and multiple paths are passed then all of the paths will be used for the observer (e.g. for curves).removeValue(value: unknown): void
Removes a value from the linked observers at the linked paths.
Parameters
value (unknown): The value.removeValues(values: unknown[]): void
Removes multiple values from the linked observers from the linked paths.
Parameters
values (unknown[]): The values.setValue(value: unknown): void
Sets a value to the linked observers at the linked paths.
Parameters
value (unknown): The valuesetValues(values: unknown[]): void
Sets an array of values to the linked observers at the linked paths.
Parameters
values (unknown[]): The values.unlink(): void
Unlinks the observers and paths.
get historyName(): string · set historyName(value: string)get linked(): booleanget observers(): Observer[]get paths(): string[]Class · extends Element · implements IBindable<boolean>, IFocusable
A checkbox element.
new BooleanInput(args?: Readonly<BooleanInputArgs>)
Creates a new BooleanInput.
Parameters
args (Readonly<BooleanInputArgs>, optional, default {}): The arguments.get renderChanges(): boolean
set renderChanges(value: boolean)
Sets whether the input should flash on changes.
get value(): boolean
set value(value: boolean)
Sets the value of the Element.
set values(values: boolean[])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
blur(): void
Unfocus the element
destroy(): void
Destroys the Element and its events.
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Element
User input with click interaction.
new Button(args?: Readonly<ButtonArgs>)
Creates a new Button.
Parameters
args (Readonly<ButtonArgs>, optional, default {}): The arguments.get icon(): string
set icon(value: string)
Gets the CSS code for an icon for the button.
get size(): string
set size(value: string)
Gets the 'size' type of the button.
get text(): string
set text(value: string)
Gets the text of the button.
blur(): void
Unfocuses (blurs) the button.
destroy(): void
Destroys the Element and its events.
focus(): void
Focuses the button.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)get parent(): Element · set parent(value: Element)Class · extends Element
Represents a Canvas.
new Canvas(args?: Readonly<CanvasArgs>)
Creates a new Canvas.
Parameters
args (Readonly<CanvasArgs>, optional, default {}): The arguments.get height(): number
set height(value: number)
Gets the height of the canvas.
get pixelHeight(): number
Gets the pixel height of the canvas.
get pixelRatio(): number
Gets the pixel ratio of the canvas.
get pixelWidth(): number
Gets the pixel height of the canvas.
get width(): number
set width(value: number)
Gets the width of the canvas.
resize(width: number, height: number): void
Resize the canvas using the given width and height parameters.
Parameters
width (number): The new width of the canvas.height (number): The new height of the canvas.get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)destroy(): voidflash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
Represents a code block.
new Code(args?: Readonly<CodeArgs>)
Creates a new Code.
Parameters
args (Readonly<CodeArgs>, optional, default {}): The arguments.get text(): string
set text(value: string)
Gets the text to display in the code block.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voiddestroy(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Element · implements IBindable<number[]>
Represents a color picker.
new ColorPicker(args?: Readonly<ColorPickerArgs>)
Creates a new ColorPicker.
Parameters
args (Readonly<ColorPickerArgs>, optional, default {}): The arguments.get renderChanges(): boolean
set renderChanges(value: boolean)
Sets whether the input should flash on changes.
get value(): number[]
set value(value: number[])
Sets the value of the Element.
set values(values: number[][])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
destroy(): void
Destroys the Element and its events.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element
A container is the basic building block for Elements that are grouped together. A container can contain any other element including other containers.
new Container(args?: Readonly<ContainerArgs>)
Creates a new Container.
Parameters
args (Readonly<ContainerArgs>, optional, default {}): The arguments.get domContent(): HTMLElement
set domContent(value: HTMLElement)
Gets the internal DOM element used as a the container of all children.
get flex(): boolean
set flex(value: boolean)
Gets whether the Element supports flex layout.
get grid(): boolean
set grid(value: boolean)
Gets whether the Element supports the grid layout.
get resizable(): string
set resizable(value: string)
Gets whether the Element is resizable and where the resize handle is located.
get resizeMax(): number
set resizeMax(value: number)
Gets the maximum size the Element can take when resized in pixels.
get resizeMin(): number
set resizeMin(value: number)
Gets the minimum size the Element can take when resized in pixels.
get scrollable(): boolean
set scrollable(value: boolean)
Gets whether the Element should be scrollable.
protected _buildDomNode(node: DomNode): Element
If the current node contains a root, recursively append its children to this node and return it. Otherwise return the current node. Also add each child to the parent under its keyed name.
Parameters
node (DomNode): The current element in the dom structure which must be recursively
traversed and appended to its parent.Returns Element: The recursively appended element node.
append(element: Child): void
Appends an element to the container.
Parameters
element (Child): The element to append.appendAfter(element: Child, referenceElement: Child): void
Appends an element to the container just after the specified reference element.
Parameters
element (Child): The element to append.referenceElement (Child): The element after which the element will be appended.appendBefore(element: Child, referenceElement: Child): void
Appends an element to the container before the specified reference element.
Parameters
element (Child): The element to append.referenceElement (Child): The element before which the element will be appended.buildDom(dom: DomNode[]): void
Takes an array of pcui elements, each of which can contain their own child elements, and appends them to this container. These child elements are traversed recursively using _buildDomNode.
Parameters
dom (DomNode[]): An array of child pcui elements to append to this container.Example
buildDom([
{
child1: pcui.Label()
},
{
root: {
container1: pcui.Container()
},
children: [
{
child2: pcui.Label()
},
{
child3: pcui.Label()
}
]
}
]);
clear(): void
Clears all children from the container.
destroy(): void
Destroys the Element and its events.
forEachChild(fn: (child: Element, index: number) => false | void): void
Iterate over each child element using the supplied function. To early out of the iteration,
return false from the function.
Parameters
fn ((child: Element, index: number) => false | void): The function to call for each child element.move(element: Element, index: number): void
Moves the specified child at the specified index.
Parameters
element (Element): The element to move.index (number): The index to move the element to.prepend(element: Child): void
Inserts an element in the beginning of the container.
Parameters
element (Child): The element to prepend.remove(element: Element): void
Removes the specified child element from the container.
Parameters
element (Element): The element to remove.resize(x?: number, y?: number): void
Resize the container.
Parameters
x (number, optional, default 0): The number of pixels to resize the width.y (number, optional, default 0): The number of pixels to resize the height.static readonly EVENT_APPEND: "append" = 'append'
Fired when a child Element gets added to the Container.
Example
const container = new Container();
container.on('append', (element: Element) => {
console.log('Element added to container:', element);
});
static readonly EVENT_REMOVE: "remove" = 'remove'
Fired when a child Element gets removed from the Container.
Example
const container = new Container();
container.on('remove', (element: Element) => {
console.log('Element removed from container:', element);
});
static readonly EVENT_RESIZE: "resize" = 'resize'
Fired when the container gets resized using the resize handle.
Example
const container = new Container();
container.on('resize', () => {
console.log('Container resized to:', container.width, container.height, 'px');
});
static readonly EVENT_SCROLL: "scroll" = 'scroll'
Fired when the container is scrolled. The native DOM scroll event is passed to the event handler.
Example
const container = new Container();
container.on('scroll', (event: Event) => {
console.log('Container scrolled:', event);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)get parent(): Element · set parent(value: Element)Class · extends Element
Represents a vertical division between two elements.
new Divider(args?: Readonly<ElementArgs>)
Creates a new Divider.
Parameters
args (Readonly<ElementArgs>, optional, default {}): The arguments.get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)destroy(): voidflash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Events
The base class for all UI elements.
new Element(args?: Readonly<ElementArgs>)
Creates a new Element.
Parameters
args (Readonly<ElementArgs>, optional, default {}): The arguments.get alignItems(): string
set alignItems(value: string)
Gets the align-items CSS property.
get alignSelf(): string
set alignSelf(value: string)
Gets the align-self CSS property.
get binding(): BindingBase
set binding(value: BindingBase)
Gets the Binding object for the element.
get class(): DOMTokenList
Get the DOMTokenList of the underlying DOM element. This is essentially a shortcut to
element.dom.classList.
get dom(): HTMLElement
Gets the root DOM node for this Element.
get enabled(): boolean
set enabled(value: boolean)
Gets whether the Element or its parent chain is enabled or not.
get error(): boolean
set error(value: boolean)
Gets whether the Element is in an error state.
get flexBasis(): string
set flexBasis(value: string | number)
Gets the flex-basis CSS property.
get flexDirection(): string
set flexDirection(value: string)
Gets the flex-direction CSS property.
get flexGrow(): string
set flexGrow(value: string | number)
Gets the flex-grow CSS property.
get flexShrink(): string
set flexShrink(value: string | number)
Gets the flex-shrink CSS property.
get flexWrap(): string
set flexWrap(value: string)
Gets the flex-wrap CSS property.
get height(): number
set height(value: string | number)
Gets the height of the Element in pixels.
get hidden(): boolean
set hidden(value: boolean)
Gets whether the Element is hidden.
get hiddenToRoot(): boolean
Gets whether the Element is hidden all the way up to the root. If the Element itself or any of its parents are hidden then this is true.
get ignoreParent(): boolean
set ignoreParent(value: boolean)
Gets whether the Element will ignore parent events & variable states.
get justifyContent(): string
set justifyContent(value: string)
Gets the justify-content CSS property.
get justifySelf(): string
set justifySelf(value: string)
Gets the justify-self CSS property.
get parent(): Element
set parent(value: Element)
Gets the parent Element.
get readOnly(): boolean
set readOnly(value: boolean)
Gets whether the Element is read only.
get style(): CSSStyleDeclaration
Shortcut to Element.dom.style.
get tabIndex(): number
set tabIndex(value: number)
Gets the tabIndex of the Element.
get width(): number
set width(value: string | number)
Gets the width of the Element in pixels.
destroy(): void
Destroys the Element and its events.
flash(): void
Triggers a flash animation on the Element.
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers and paths to the Element's data binding.
Parameters
observers (Observer | Observer[]): An array of observers or a single observer.paths (string | string[]): A path for the observer(s) or an array of paths that maps to each separate observer.unlink(): void
Unlinks the Element from its observers.
static create<Type extends Element>(type: string, args: ElementArgs): Type
Creates a new Element of the desired type.
Parameters
type (string): The type of the Element (registered by Element#register).args (ElementArgs): Arguments for the Element.Returns Type: The new Element or undefined if type is not found.
static register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): void
Parameters
type (string): The type we want to reference this Element by.cls (Object): The actual class of the Element.defaultArguments (object, optional): Default arguments when creating this type.static unregister(type: string): void
Parameters
type (string): The type we want to unregister.static readonly EVENT_CLICK: "click" = 'click'
Fired when the mouse is clicked on the Element but only if the Element is enabled. The native DOM MouseEvent is passed as a parameter to the event handler.
Example
const element = new Element();
element.on('click', (evt: MouseEvent) => {
console.log('Element clicked');
});
static readonly EVENT_DESTROY: "destroy" = 'destroy'
Fired after the element has been destroyed. Both the DOM element and the owner Element instance are passed as parameters to the event handler.
Example
const element = new Element();
element.on('destroy', (dom: HTMLElement, element: Element) => {
console.log('Element destroyed');
});
static readonly EVENT_DISABLE: "disable" = 'disable'
Fired when the Element gets disabled.
Example
const element = new Element();
element.on('disable', () => {
console.log('Element disabled');
});
static readonly EVENT_ENABLE: "enable" = 'enable'
Fired when the Element gets enabled.
Example
const element = new Element();
element.on('enable', () => {
console.log('Element enabled');
});
static readonly EVENT_HIDE: "hide" = 'hide'
Fired when the Element gets hidden.
Example
const element = new Element();
element.on('hide', () => {
console.log('Element hidden');
});
static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'
Fired when the Element or any of its parent get hidden.
Example
const element = new Element();
element.on('hideToRoot', () => {
console.log('Element or one of its parents hidden');
});
static readonly EVENT_HOVER: "hover" = 'hover'
Fired when the mouse starts hovering on the Element. The native DOM MouseEvent is passed as a parameter to the event handler.
Example
const element = new Element();
element.on('hover', (evt: MouseEvent) => {
console.log('Element hovered');
});
static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'
Fired when the mouse stops hovering on the Element. The native DOM MouseEvent is passed as a parameter to the event handler.
Example
const element = new Element();
element.on('hoverend', (evt: MouseEvent) => {
console.log('Element hover ended');
});
static readonly EVENT_PARENT: "parent" = 'parent'
Fired when the Element's parent gets set.
Example
const element = new Element();
element.on('parent', (parent: Element) => {
console.log(`Element's parent is now ${parent}`);
});
static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'
Fired when the readOnly property of an Element changes.
Example
const element = new Element();
element.on('readOnly', (readOnly: boolean) => {
console.log(`Element is now ${readOnly ? 'read only' : 'editable'}`);
});
static readonly EVENT_SHOW: "show" = 'show'
Fired when the Element stops being hidden.
Example
const element = new Element();
element.on('show', () => {
console.log('Element shown');
});
static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'
Fired when the Element and all of its parents become visible.
Example
const element = new Element();
element.on('showToRoot', () => {
console.log('Element and all of its parents shown');
});
Class · extends Element
Represents a gradient picker.
new GradientPicker(args?: Readonly<GradientPickerArgs>)
Creates a new GradientPicker.
Parameters
args (Readonly<GradientPickerArgs>, optional, default {}): The arguments. Extends the Element arguments. Any settable property can also
be set through the constructor.destroy(): void
Destroys the Element and its events.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container
Represents a container that shows a flexible wrappable list of items that looks like a grid. Contains GridViewItems.
new GridView(args?: Readonly<GridViewArgs>)
Creates a new GridView.
Parameters
args (Readonly<GridViewArgs>, optional, default {}): The arguments.get selected(): GridViewItem[]
Gets the selected GridViewItems.
get vertical(): boolean
Gets whether the grid layout is vertical or not.
deselect(): void
Deselects all selected grid view items.
filter(): void
Filters grid view items with the filter function provided in the constructor.
filterAsync(batchLimit?: number): void
Filters grid view items asynchronously by only allowing up to the specified number of grid view item operations. Fires the following events:
Parameters
batchLimit (number, optional, default 100): The maximum number of items to show before requesting another animation frame.filterAsyncCancel(): void
Cancels asynchronous filtering.
static readonly EVENT_ACTIVATE: "activate" = 'activate'
Fired when user activates a GridViewItem by pressing Enter or double-clicking.
Example
const gridView = new GridView();
gridView.on('activate', (item: GridViewItem) => {
console.log(`Activated item ${item.text}`);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container · implements IFocusable
Represents a grid view item used in GridView.
new GridViewItem(args?: Readonly<GridViewItemArgs>)
Creates a new GridViewItem.
Parameters
args (Readonly<GridViewItemArgs>, optional, default {}): The arguments.allowSelect: boolean = true
Determines whether the item can be selected. Defaults to true.
get nextSibling(): GridViewItem
Gets the next visible sibling grid view item.
get previousSibling(): GridViewItem
Gets the previous visible sibling grid view item.
get selected(): boolean
set selected(value: boolean)
Gets whether the item is selected.
get text(): string
set text(value: string)
Gets the text of the item.
blur(): void
Unfocus the element
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers and paths to the Element's data binding.
Parameters
observers (Observer | Observer[]): An array of observers or a single observer.paths (string | string[]): A path for the observer(s) or an array of paths that maps to each separate observer.unlink(): void
Unlinks the Element from its observers.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container
Represents an information box.
new InfoBox(args?: Readonly<InfoBoxArgs>)
Creates a new InfoBox.
Parameters
args (Readonly<InfoBoxArgs>, optional, default {}): The arguments.get icon(): string
set icon(value: string)
Gets the icon of the info box.
get text(): string
set text(value: string)
Gets the text of the info box.
get title(): string
set title(value: string)
Gets the title of the info box.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voiddestroy(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element · implements IBindable, IFocusable, IPlaceholder
The InputElement is an abstract class that manages an input DOM element. It is the superclass of TextInput and NumericInput. It is not intended to be used directly.
blurOnEnter: boolean = true
Determines whether the input should blur when the enter key is pressed.
blurOnEscape: boolean = true
Determines whether the input should blur when the escape key is pressed.
get input(): HTMLInputElement
Gets the input DOM element.
get keyChange(): boolean
set keyChange(value: boolean)
Gets the method to call when keyup is called on the input DOM element.
get placeholder(): string
set placeholder(value: string)
Sets the placeholder text of the input.
get renderChanges(): boolean
set renderChanges(value: boolean)
Sets whether the input should flash on changes.
abstract get value(): unknown
abstract set value(value: unknown)
Sets the value of the Element.
abstract get values(): unknown[]
abstract set values(value: unknown[])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
blur(): void
Unfocuses (blurs) the input element.
destroy(): void
Destroys the Element and its events.
focus(select?: boolean): void
Focuses the input element. If the input contains text and select is true, the text will be
selected on focus.
Parameters
select (boolean, optional): If true, the input text will be selected.get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Element · implements IPlaceholder, IBindable<string>
The Label is a simple span element that displays some text.
new Label(args?: Readonly<LabelArgs>)
Creates a new Label.
Parameters
args (Readonly<LabelArgs>, optional, default {}): The arguments.get placeholder(): string
set placeholder(value: string)
Gets the placeholder text of the Label.
get renderChanges(): boolean
set renderChanges(value: boolean)
Gets whether the Label should flash when its value changes.
get text(): string
set text(value: string)
Gets the text of the Label.
get value(): string
set value(value: string)
Gets the value of the Label. This is an alias for Label#text.
set values(values: string[])
Sets multiple values on the Label. If all values are the same, the Label will display that value. Otherwise, it will be empty and display a "multiple values" state.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)destroy(): voidflash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
Represents a group of an Element and a Label. Useful for rows of labeled fields.
new LabelGroup(args?: Readonly<LabelGroupArgs>)
Creates a new LabelGroup.
Parameters
args (Readonly<LabelGroupArgs>, optional, default {}): The arguments.get field(): Element
The field element.
get label(): Label
The label element.
get labelAlignTop(): boolean
set labelAlignTop(value: boolean)
Gets whether to align the label at the top of the group.
get text(): string
set text(value: string)
Gets the text of the label.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voiddestroy(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container · implements IFocusable
A Menu is a list of MenuItems which can contain child MenuItems. Useful to show context menus and nested menus. Note that a Menu must be appended to the root Element and then positioned accordingly.
new Menu(args?: Readonly<MenuArgs>)
Creates a new Menu.
Parameters
args (Readonly<MenuArgs>, optional, default {}): The arguments.blur(): void
Unfocus the element
clear(): void
Remove all the current menu items from the menu.
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
position(x: number, y: number): void
Positions the top-left corner of the menu at the specified coordinates.
Parameters
x (number): The x coordinate.y (number): The y coordinate.Example
// open a context menu at the mouse position
window.addEventListener('contextmenu', (event) => {
event.stopPropagation();
event.preventDefault();
menu.hidden = false;
menu.position(event.clientX, event.clientY);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container · implements IBindable<string>
The MenuItem is a selectable option that is appended to a Menu. A MenuItem can also contain child MenuItems (by appending them to the MenuItem). This can be useful to show nested Menus.
new MenuItem(args?: Readonly<MenuItemArgs>)
Creates a new MenuItem.
Parameters
args (Readonly<MenuItemArgs>, optional, default {}): The arguments.onIsEnabled: () => boolean
The function that determines whether the MenuItem should be enabled when the Menu is shown.
onIsVisible: () => boolean
The function that determines whether the MenuItem should be visible when the Menu is shown.
onSelect: (evt?: MouseEvent) => void
The function called when the MenuItem is selected.
get binding(): BindingBase
set binding(value: BindingBase)
Gets the binding for the MenuItem label.
get hasChildren(): boolean
Returns whether the MenuItem has children.
get icon(): string
set icon(value: string)
Gets the CSS code for an icon for the MenuItem.
get menu(): Menu
set menu(value: Menu)
Gets the menu.
get renderChanges(): boolean
set renderChanges(value: boolean)
Sets whether the input should flash on changes.
get shortcut(): string
set shortcut(value: string)
Gets the keyboard shortcut displayed on the MenuItem.
get text(): string
set text(value: string)
Gets the text shown on the MenuItem.
get value(): string
set value(value: string)
Sets the value of the Element.
set values(values: string[])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers and paths to the Element's data binding.
Parameters
observers (Observer | Observer[]): An array of observers or a single observer.paths (string | string[]): A path for the observer(s) or an array of paths that maps to each separate observer.select(): void
Selects the MenuItem which also happens automatically when the user clicks on the MenuItem.
unlink(): void
Unlinks the Element from its observers.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends InputElement
The NumericInput represents an input element that holds numbers.
NumericInput accepts number values. It also accepts strings that contain mathematical
expressions which are then evaluated to a number. Here are some examples:
| Input String | Evaluated Number Value |
|---|---|
"10 + 20" |
30 |
"10 - 20" |
-10 |
"10 * 20" |
200 |
"10 / 20" |
0.5 |
"10 * (20 + 30)" |
500 |
By default, a NumericInput displays a slider input that can be used to quickly change the value
via a click and drag. The slider can be disabled by setting the hideSlider argument to true.
new NumericInput(args?: Readonly<NumericInputArgs>)
Creates a new NumericInput.
Parameters
args (Readonly<NumericInputArgs>, optional, default {}): The arguments.get max(): number
set max(value: number)
Gets the maximum value this field can take.
get min(): number
set min(value: number)
Gets the minimum value this field can take.
get precision(): number
set precision(value: number)
Gets the precision of the input.
get step(): number
set step(value: number)
Gets the amount that the value will be increased or decreased when using the arrow keys and the slider input.
get value(): number
set value(value: string | number)
Gets the value of the NumericInput.
set values(values: number[])
Sets multiple values on the input. If all values are the same, the input will display that value. Otherwise, it will be empty and display a "multiple values" state.
static readonly EVENT_CHANGE: "change" = 'change'
Fired when the value of the NumericInput changes.
Example
const numericInput = new NumericInput();
numericInput.on('change', (value: number) => {
console.log('Value changed to:', value);
});
static readonly EVENT_SLIDER_MOUSEDOWN: "slider:mousedown" = 'slider:mousedown'
Fired when the user starts dragging the slider.
Example
const numericInput = new NumericInput();
numericInput.on('slider:mousedown', (evt: MouseEvent) => {
console.log('Slider drag started');
});
static readonly EVENT_SLIDER_MOUSEUP: "slider:mouseup" = 'slider:mouseup'
Fired when the user stops dragging the slider.
Example
const numericInput = new NumericInput();
numericInput.on('slider:mouseup', () => {
console.log('Slider drag ended');
});
blurOnEnter: boolean = trueblurOnEscape: boolean = trueget alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get input(): HTMLInputElementget justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get keyChange(): boolean · set keyChange(value: boolean)get parent(): Element · set parent(value: Element)get placeholder(): string · set placeholder(value: string)get readOnly(): boolean · set readOnly(value: boolean)get renderChanges(): boolean · set renderChanges(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)blur(): voidflash(): voidfocus(select?: boolean): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
An overlay element.
new Overlay(args?: Readonly<OverlayArgs>)
Creates a new Overlay.
Parameters
args (Readonly<OverlayArgs>, optional, default {}): The arguments.get clickable(): boolean
set clickable(value: boolean)
Gets whether the overlay can be hidden by clicking on it.
get transparent(): boolean
set transparent(value: boolean)
Gets whether the overlay is transparent or not.
position(x: number, y: number): void
Position the overlay at specific x, y coordinates.
Parameters
x (number): The x coordinate.y (number): The y coordinate.get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
The Panel is a Container that itself contains a header container and a content container. The respective Container functions work using the content container. One can also append elements to the header of the Panel.
new Panel(args?: Readonly<PanelArgs>)
Creates a new Panel.
Parameters
args (Readonly<PanelArgs>, optional, default {}): The arguments. Extends the Container constructor arguments. All settable
properties can also be set through the constructor.get collapsed(): boolean
set collapsed(value: boolean)
Gets whether the Element should be collapsed.
get collapseHorizontally(): boolean
set collapseHorizontally(value: boolean)
Gets whether the panel collapses horizontally.
get collapsible(): boolean
set collapsible(value: boolean)
Gets whether the Element is collapsible.
get content(): Container
Gets the content container.
get header(): Container
Gets the header container.
get headerSize(): number
set headerSize(value: number)
Gets the height of the header in pixels.
get headerText(): string
set headerText(value: string)
Gets the header text of the panel.
get removable(): boolean
set removable(value: boolean)
Gets whether the panel can be removed
get sortable(): boolean
set sortable(value: boolean)
Gets whether the panel can be reordered.
static readonly EVENT_COLLAPSE: "collapse" = 'collapse'
Fired when the panel gets collapsed.
Example
const panel = new Panel();
panel.on('collapse', () => {
console.log('Panel collapsed');
});
static readonly EVENT_EXPAND: "expand" = 'expand'
Fired when the panel gets expanded.
Example
const panel = new Panel();
panel.on('expand', () => {
console.log('Panel expanded');
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
Represents a bar that can highlight progress of an activity.
new Progress(args?: Readonly<ProgressArgs>)
Creates a new Progress.
Parameters
args (Readonly<ProgressArgs>, optional, default {}): The arguments.get value(): number
set value(val: number)
Gets the value of the progress bar.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voiddestroy(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element · implements IBindable<boolean>, IFocusable
A radio button element.
new RadioButton(args?: Readonly<RadioButtonArgs>)
Creates a new RadioButton.
Parameters
args (Readonly<RadioButtonArgs>, optional, default {}): The arguments.get renderChanges(): boolean
set renderChanges(renderChanges: boolean)
Sets whether the input should flash on changes.
get value(): boolean
set value(value: boolean)
Sets the value of the Element.
set values(values: boolean[])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
blur(): void
Unfocus the element
destroy(): void
Destroys the Element and its events.
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element · implements IBindable<unknown>, IFocusable
An input that allows selecting from a dropdown or entering tags.
new SelectInput(args?: Readonly<SelectInputArgs>)
Creates a new SelectInput.
Parameters
args (Readonly<SelectInputArgs>, optional, default {}): The arguments.set disabledOptions(value: Record<string, string>)
Sets the options that should be disabled. The keys are the option values and the values are the text to show when the option is disabled.
set disabledValue(value: string)
Sets the value that is currently disabled (shown but not selectable).
set fallbackOrder(value: string[])
Sets the order in which options should be checked for a valid fallback when the current value becomes disabled.
get invalidOptions(): unknown[]
set invalidOptions(value: unknown[])
Gets the array of invalid options.
get multiSelect(): boolean
Gets whether the SelectInput allows selecting multiple options.
get options(): { t: string; v: string | number | boolean }[]
set options(value: { t: string; v: string | number | boolean }[])
Gets the dropdown options.
get placeholder(): string
set placeholder(value: string)
Gets the placeholder text for the input field.
get renderChanges(): boolean
set renderChanges(value: boolean)
Gets whether the SelectInput should flash when its value changes.
get value(): unknown
set value(value: unknown)
Gets the value of the SelectInput. For multi-select inputs, this returns an array.
set values(values: unknown[])
Sets multiple values on the SelectInput. If all values are the same, the SelectInput will display that value. Otherwise, it will display a "multiple values" state.
protected _onDocumentPointerDown(evt: PointerEvent): void
Handles pointer down events on the document. It has to be the document instead of the window
because otherwise pointerdown is not fired when the PCUI app is running in an iframe.
Parameters
evt (PointerEvent): Pointer event.blur(): void
Unfocuses (blurs) the SelectInput.
close(): void
Closes the dropdown menu.
destroy(): void
Destroys the Element and its events.
focus(): void
Focuses the SelectInput.
open(): void
Opens the dropdown menu.
toggle(): void
Toggles the dropdown menu.
unlink(): void
Unlinks the Element from its observers.
static readonly EVENT_BLUR: "blur" = 'blur'
Fired when the SelectInput loses focus.
Example
const selectInput = new SelectInput();
selectInput.on('blur', () => {
console.log('SelectInput blurred');
});
static readonly EVENT_CHANGE: "change" = 'change'
Fired when the value of the SelectInput changes.
Example
const selectInput = new SelectInput();
selectInput.on('change', (value) => {
console.log('Value changed to:', value);
});
static readonly EVENT_FOCUS: "focus" = 'focus'
Fired when the SelectInput receives focus.
Example
const selectInput = new SelectInput();
selectInput.on('focus', () => {
console.log('SelectInput focused');
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element · implements IBindable<number>, IFocusable, IPlaceholder
The SliderInput shows a NumericInput and a slider widget next to it. It acts as a proxy of the NumericInput.
new SliderInput(args?: Readonly<SliderInputArgs>)
Creates a new SliderInput.
Parameters
args (Readonly<SliderInputArgs>, optional, default {}): The arguments.get max(): number
set max(value: number)
Gets the maximum value that the numeric input field can take.
get min(): number
set min(value: number)
Gets the minimum value that the numeric input field can take.
get placeholder(): string
set placeholder(value: string)
Sets the placeholder text of the input.
get precision(): number
set precision(value: number)
Gets the maximum number of decimals a value can take.
get renderChanges(): boolean
set renderChanges(value: boolean)
Sets whether the input should flash on changes.
get sliderMax(): number
set sliderMax(value: number)
Gets the maximum value that the slider field can take.
get sliderMin(): number
set sliderMin(value: number)
Gets the minimum value that the slider field can take.
get step(): number
set step(value: number)
Gets the amount that the value will be increased or decreased when using the arrow keys.
get value(): number
set value(value: number)
Sets the value of the Element.
set values(values: number[])
Sets multiple values on the Element. It is up to the Element to determine how to display them.
blur(): void
Unfocus the element
destroy(): void
Destroys the Element and its events.
focus(): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)flash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element
Represents a spinning icon.
new Spinner(args?: Readonly<SpinnerArgs>)
Creates a new Spinner.
Parameters
args (Readonly<SpinnerArgs>, optional, default {}): The arguments.get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)destroy(): voidflash(): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends TextInput
The TextAreaInput wraps a textarea element. It has the same interface as TextInput.
new TextAreaInput(args?: Readonly<TextAreaInputArgs>)
Creates a new TextAreaInput.
Parameters
args (Readonly<TextAreaInputArgs>, optional, default {}): The arguments.blurOnEnter: boolean = trueblurOnEscape: boolean = trueonValidate: (value: string) => booleanget alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get input(): HTMLInputElementget justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get keyChange(): boolean · set keyChange(value: boolean)get parent(): Element · set parent(value: Element)get placeholder(): string · set placeholder(value: string)get readOnly(): boolean · set readOnly(value: boolean)get renderChanges(): boolean · set renderChanges(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)set values(values: string[])get width(): number · set width(value: string | number)blur(): voiddestroy(): voidflash(): voidfocus(select?: boolean): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends InputElement
The TextInput is an input element of type text.
new TextInput(args?: Readonly<TextInputArgs>)
Creates a new TextInput.
Parameters
args (Readonly<TextInputArgs>, optional, default {}): The arguments.onValidate: (value: string) => boolean
A function that validates the value that is entered into the input and returns true if it
is valid or false otherwise. If false then the input will be set in an error state and
the value will not propagate to the binding.
set values(values: string[])
Sets multiple values on the input. If all values are the same, the input will display that value. Otherwise, it will be empty and display a "multiple values" state.
blurOnEnter: boolean = trueblurOnEscape: boolean = trueget alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get input(): HTMLInputElementget justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get keyChange(): boolean · set keyChange(value: boolean)get parent(): Element · set parent(value: Element)get placeholder(): string · set placeholder(value: string)get readOnly(): boolean · set readOnly(value: boolean)get renderChanges(): boolean · set renderChanges(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)blur(): voiddestroy(): voidflash(): voidfocus(select?: boolean): voidlink(observers: Observer | Observer[], paths: string | string[]): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'get error(): boolean · set error(value: boolean)Class · extends Container
A container that can show a TreeView like a hierarchy. The TreeView contains a hierarchy of TreeViewItems.
new TreeView(args?: Readonly<TreeViewArgs>)
Creates a new TreeView.
Parameters
args (Readonly<TreeViewArgs>, optional, default {}): The arguments.allowRenaming: boolean = false
Determines whether renaming TreeViewItems is allowed by double clicking on them.
allowReordering: boolean = true
Determines whether reordering TreeViewItems is allowed.
get allowDrag(): boolean
set allowDrag(value: boolean)
Gets whether dragging a TreeViewItem is allowed.
get filter(): string
set filter(value: string)
Gets the filter that searches TreeViewItems and only shows the ones that are relevant to the filter.
get isDragging(): boolean
set isDragging(value: boolean)
Gets whether a TreeViewItem is currently being dragged.
get pressedArrow(): boolean
Gets whether the selection was triggered by arrow key navigation.
get pressedCtrl(): boolean
Gets whether Ctrl is currently pressed.
get pressedShift(): boolean
Gets whether Shift is currently pressed.
get selected(): TreeViewItem[]
Gets all of the currently selected TreeViewItems.
protected _applyFilter(filter: string): void
Searches the treeview.
Parameters
filter (string): The search filter.protected _clearFilter(): void
Clears search filter.
protected _findLastVisibleChildTreeItem(currentItem: TreeViewItem): TreeViewItem
Finds the last visible child tree item of the specified tree item.
Parameters
currentItem (TreeViewItem): The current item.Returns TreeViewItem: The last child item.
protected _findNextVisibleTreeItem(currentItem: TreeViewItem): TreeViewItem
Finds the next tree item that is not currently hidden.
Parameters
currentItem (TreeViewItem): The current tree item.Returns TreeViewItem: The next visible tree item.
protected _findPreviousVisibleTreeItem(currentItem: TreeViewItem): TreeViewItem
Finds the previous visible tree item of the specified tree item.
Parameters
currentItem (TreeViewItem): The current tree item.Returns TreeViewItem: The previous item.
protected _getChildrenRange(startChild: TreeViewItem, endChild: TreeViewItem): TreeViewItem[]
Gets the visible tree items between the specified start and end tree items.
Parameters
startChild (TreeViewItem): The start tree item.endChild (TreeViewItem): The end tree item.Returns TreeViewItem[]
protected _getTreeOrder(): Map<TreeViewItem, number>
Do a depth first traversal of all tree items and assign an order to them so that we know which one is above the other. Performance wise this means it traverses all tree items every time however seems to be pretty fast even with 15 - 20 K entities.
Returns Map<TreeViewItem, number>
protected _onChildDeselected(item: TreeViewItem): void
Called when a child tree view item is deselected.
Parameters
item (TreeViewItem): The tree view item.protected _onChildRename(item: TreeViewItem, newName: string): void
Called when a child tree view item is renamed.
Parameters
item (TreeViewItem): The tree view item.newName (string): The new name.protected _onChildSelected(item: TreeViewItem): void
Called when a child tree view item is selected.
Parameters
item (TreeViewItem): The tree view item.protected _openHierarchy(endItem: TreeViewItem): void
Opens all the parents of the specified item.
Parameters
endItem (TreeViewItem): The end tree view item.protected _selectSingleItem(item: TreeViewItem): void
Selects a tree view item.
Parameters
item (TreeViewItem): The tree view item.protected _traverseDepthFirst(fn: (item: TreeViewItem) => void): void
Call specified function on every child TreeViewItem by traversing the hierarchy depth first.
Parameters
fn ((item: TreeViewItem) => void): The function to call. The function takes the TreeViewItem as an argument.clearTreeItems(): void
Removes all child tree view items.
collapseAll(): void
Collapses all tree view items.
deselect(): void
Deselects all selected tree view items.
expandAll(): void
Expands all tree view items.
showDragHandle(treeItem: TreeViewItem): void
Show the drag handle on the given tree item.
Parameters
treeItem (TreeViewItem): The tree item.traverse(fn: (item: TreeViewItem) => void): void
Traverses all child TreeViewItems using depth first search and calls the supplied function for each item.
Parameters
fn ((item: TreeViewItem) => void): The function to call. The function takes the TreeViewItem as an argument.Example
treeView.traverse((item: TreeViewItem) => {
console.log(item.text);
});
static readonly EVENT_DESELECT: "deselect" = 'deselect'
Fired when user deselects a TreeViewItem.
Example
const treeView = new TreeView();
treeView.on('deselect', (item: TreeViewItem) => {
console.log(`Deselected item ${item.text}`);
});
static readonly EVENT_DRAGEND: "dragend" = 'dragend'
Fired when user stops dragging selected TreeViewItems.
Example
const treeView = new TreeView({
allowDrag: true // this is the default but we're showing it here for clarity
});
treeView.on('dragend', () => {
console.log('Drag ended');
});
static readonly EVENT_DRAGSTART: "dragstart" = 'dragstart'
Fired when user starts dragging selected TreeViewItems.
Example
const treeView = new TreeView({
allowDrag: true // this is the default but we're showing it here for clarity
});
treeView.on('dragstart', (items: TreeViewItem[]) => {
console.log(`Drag started of ${items.length} items`);
});
static readonly EVENT_RENAME: "rename" = 'rename'
Fired when user renames a TreeViewItem.
Example
const treeView = new TreeView();
treeView.on('rename', (item: TreeViewItem, name: string) => {
console.log(`Renamed item to ${name}`);
});
static readonly EVENT_REPARENT: "reparent" = 'reparent'
Fired when user reparents TreeViewItems.
Example
const treeView = new TreeView();
treeView.on('reparent', (reparented: ReparentedItem[]) => {
console.log(`Reparented ${reparented.length} items`);
});
static readonly EVENT_SELECT: "select" = 'select'
Fired when user selects a TreeViewItem.
Example
const treeView = new TreeView();
treeView.on('select', (item: TreeViewItem) => {
console.log(`Selected item ${item.text}`);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Container
A TreeViewItem is a single node in a hierarchical TreeView control.
new TreeViewItem(args?: Readonly<TreeViewItemArgs>)
Creates a new TreeViewItem.
Parameters
args (Readonly<TreeViewItemArgs>, optional, default {}): The arguments.allowDrag: boolean = true
Determines whether this tree item can be dragged. Only considered if the parent
TreeView has TreeView#allowDrag set to true.
allowDrop: boolean = true
Determines whether dropping is allowed on the tree item.
allowSelect: boolean = true
Determines whether the item can be selected.
get content(): Container
Gets the container that holds the icon and text for this tree view item. Useful for positioning calculations or appending custom content alongside the item row.
get firstChild(): TreeViewItem
Gets the first child item.
get icon(): string
set icon(value: string)
Gets the icon shown before the text in the TreeViewItem.
get iconLabel(): Label
Gets the internal label that shows the icon.
get lastChild(): TreeViewItem
Gets the last child item.
get nextSibling(): TreeViewItem
Gets the next sibling item.
get numChildren(): number
Gets the number of direct children.
get open(): boolean
set open(value: boolean)
Gets whether the item is expanded and showing its children.
get parentsOpen(): boolean
set parentsOpen(value: boolean)
Gets whether the ancestors of the item are open or closed.
get previousSibling(): TreeViewItem
Gets the previous sibling item.
get selected(): boolean
set selected(value: boolean)
Gets whether the item is selected.
get text(): string
set text(value: string)
Gets the text shown by the TreeViewItem.
get textLabel(): Label
Gets the internal label that shows the text.
get treeView(): TreeView
set treeView(value: TreeView)
Gets the parent TreeView.
static readonly EVENT_CLOSE: "close" = 'close'
Fired when user closes the TreeViewItem.
Example
treeViewItem.on('close', (item: TreeViewItem) => {
console.log('TreeViewItem closed', item);
});
static readonly EVENT_DESELECT: "deselect" = 'deselect'
Fired when user deselects the TreeViewItem.
Example
treeViewItem.on('deselect', (item: TreeViewItem) => {
console.log('TreeViewItem deselected', item);
});
static readonly EVENT_OPEN: "open" = 'open'
Fired when user opens the TreeViewItem.
Example
treeViewItem.on('open', (item: TreeViewItem) => {
console.log('TreeViewItem opened', item);
});
static readonly EVENT_SELECT: "select" = 'select'
Fired when user selects the TreeViewItem.
Example
treeViewItem.on('select', (item: TreeViewItem) => {
console.log('TreeViewItem selected', item);
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get binding(): BindingBase · set binding(value: BindingBase)get class(): DOMTokenListget dom(): HTMLElementget domContent(): HTMLElement · set domContent(value: HTMLElement)get enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flex(): boolean · set flex(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get grid(): boolean · set grid(value: boolean)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get resizable(): string · set resizable(value: string)get resizeMax(): number · set resizeMax(value: number)get resizeMin(): number · set resizeMin(value: number)get scrollable(): boolean · set scrollable(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)protected _buildDomNode(node: DomNode): Elementappend(element: Child): voidappendAfter(element: Child, referenceElement: Child): voidappendBefore(element: Child, referenceElement: Child): voidbuildDom(dom: DomNode[]): voidclear(): voidflash(): voidforEachChild(fn: (child: Element, index: number) => false | void): voidlink(observers: Observer | Observer[], paths: string | string[]): voidmove(element: Element, index: number): voidprepend(element: Child): voidremove(element: Element): voidresize(x?: number, y?: number): voidunlink(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_APPEND: "append" = 'append'static readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_REMOVE: "remove" = 'remove'static readonly EVENT_RESIZE: "resize" = 'resize'static readonly EVENT_SCROLL: "scroll" = 'scroll'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Class · extends Element · implements IBindable<number[] | string>, IFocusable, IMultiPlaceholder
A vector input. The vector can have 2 to 4 dimensions with each dimension being a NumericInput.
new VectorInput(args?: Readonly<VectorInputArgs>)
Creates a new VectorInput.
Parameters
args (Readonly<VectorInputArgs>, optional, default {}): The arguments.get binding(): BindingBase
set binding(value: BindingBase)
Gets the Binding object for the VectorInput.
get inputs(): NumericInput[]
Gets the array of NumericInput elements owned by this vector.
get max(): number
set max(value: number)
Gets the maximum value accepted by all inputs of the vector.
get min(): number
set min(value: number)
Gets the minimum value accepted by all inputs of the vector.
get placeholder(): string[]
set placeholder(value: string | string[])
Gets the placeholder text of all inputs as an array.
get precision(): number
set precision(value: number)
Gets the maximum number of decimal places supported by all inputs of the vector.
get renderChanges(): boolean
set renderChanges(value: boolean)
Gets whether inputs should flash when their values change.
get step(): number
set step(value: number)
Gets the amount that the value will be increased or decreased when using the arrow keys and the slider input for all inputs of the vector.
get value(): number[]
set value(value: number[])
Gets the value of the VectorInput as an array of numbers.
set values(values: number[][])
Sets multiple values on the VectorInput. Each value should be an array representing the vector dimensions. If all values are the same, the VectorInput will display that value. Otherwise, it will display a "multiple values" state.
blur(): void
Unfocuses (blurs) all input elements.
focus(): void
Focuses the first input element.
link(observers: Observer | Observer[], paths: string | string[]): void
Links the specified observers and paths to the Element's data binding.
Parameters
observers (Observer | Observer[]): An array of observers or a single observer.paths (string | string[]): A path for the observer(s) or an array of paths that maps to each separate observer.unlink(): void
Unlinks the Element from its observers.
static readonly EVENT_BLUR: "blur" = 'blur'
Fired when the VectorInput loses focus.
Example
const vectorInput = new VectorInput();
vectorInput.on('blur', () => {
console.log('VectorInput blurred');
});
static readonly EVENT_CHANGE: "change" = 'change'
Fired when the value of the VectorInput changes.
Example
const vectorInput = new VectorInput({ dimensions: 3 });
vectorInput.on('change', (value: number[]) => {
console.log('Value changed to:', value);
});
static readonly EVENT_FOCUS: "focus" = 'focus'
Fired when the VectorInput receives focus.
Example
const vectorInput = new VectorInput();
vectorInput.on('focus', () => {
console.log('VectorInput focused');
});
get alignItems(): string · set alignItems(value: string)get alignSelf(): string · set alignSelf(value: string)get class(): DOMTokenListget dom(): HTMLElementget enabled(): boolean · set enabled(value: boolean)get error(): boolean · set error(value: boolean)get flexBasis(): string · set flexBasis(value: string | number)get flexDirection(): string · set flexDirection(value: string)get flexGrow(): string · set flexGrow(value: string | number)get flexShrink(): string · set flexShrink(value: string | number)get flexWrap(): string · set flexWrap(value: string)get height(): number · set height(value: string | number)get hidden(): boolean · set hidden(value: boolean)get hiddenToRoot(): booleanget ignoreParent(): boolean · set ignoreParent(value: boolean)get justifyContent(): string · set justifyContent(value: string)get justifySelf(): string · set justifySelf(value: string)get parent(): Element · set parent(value: Element)get readOnly(): boolean · set readOnly(value: boolean)get style(): CSSStyleDeclarationget tabIndex(): number · set tabIndex(value: number)get width(): number · set width(value: string | number)destroy(): voidflash(): voidstatic create<Type extends Element>(type: string, args: ElementArgs): Typestatic register<Type extends Element>(type: string, cls: Object, defaultArguments?: object): voidstatic unregister(type: string): voidstatic readonly EVENT_CLICK: "click" = 'click'static readonly EVENT_DESTROY: "destroy" = 'destroy'static readonly EVENT_DISABLE: "disable" = 'disable'static readonly EVENT_ENABLE: "enable" = 'enable'static readonly EVENT_HIDE: "hide" = 'hide'static readonly EVENT_HIDE_TO_ROOT: "hideToRoot" = 'hideToRoot'static readonly EVENT_HOVER: "hover" = 'hover'static readonly EVENT_HOVER_END: "hoverend" = 'hoverend'static readonly EVENT_PARENT: "parent" = 'parent'static readonly EVENT_READ_ONLY: "readOnly" = 'readOnly'static readonly EVENT_SHOW: "show" = 'show'static readonly EVENT_SHOW_TO_ROOT: "showToRoot" = 'showToRoot'Interface · extends IBindableArgs<unknown[]>
The arguments for the ArrayInput constructor.
elementArgs?: ElementConfig
Arguments for each array Element.
fixedSize?: boolean
If true then editing the number of elements that the array has will not be allowed.
getDefaultFn?: () => unknown
Used to specify the default values for each element in the array. Defaults to null.
type?: "string" | "number" | "boolean" | "vec2" | "vec3" | "vec4"
The type of values that the array can hold. Can be one of the following:
booleannumberstringvec2vec3vec4Defaults to string.
usePanels?: boolean
If true then the array will be rendered using panels. Defaults to false.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown[]) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberrenderChanges?: booleanvalue?: unknown[]values?: unknown[][]Interface
The interface for arguments for the BindingBase constructor.
element?: IBindable
The IBindable element.
history?: History
The history object which will be used to record undo / redo actions. If none is provided then no history will be recorded.
historyCombine?: boolean
Whether to combine history actions.
historyName?: string
The name of each history action.
historyPostfix?: string
A postfix that will be used for the name of every history action.
historyPrefix?: string
A prefix that will be used for the name of every history action.
Interface · extends BindingBaseArgs
The interface for arguments for the BindingObserversToElement constructor.
customUpdate?: (element: IBindable, observers: Observer[], paths: string[]) => void
Custom update function.
element?: IBindablehistory?: HistoryhistoryCombine?: booleanhistoryName?: stringhistoryPostfix?: stringhistoryPrefix?: stringInterface · extends BindingBaseArgs
The interface for arguments for the BindingTwoWay constructor.
bindingElementToObservers?: BindingElementToObservers
BindingElementToObservers instance.
bindingObserversToElement?: BindingObserversToElement
BindingObserversToElement instance.
element?: IBindablehistory?: HistoryhistoryCombine?: booleanhistoryName?: stringhistoryPostfix?: stringhistoryPrefix?: stringInterface · extends IBindableArgs<boolean>
The arguments for the BooleanInput constructor.
tabIndex?: number
Sets the tabIndex of the BooleanInput. Defaults to 0.
type?: string
The type of checkbox. Currently can be null or 'toggle'.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: boolean) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringwidth?: numberrenderChanges?: booleanvalue?: booleanvalues?: boolean[]Interface
The arguments for the Button constructor.
icon?: string
The CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\' character). Defaults to ''.
size?: "small"
Sets the 'size' type of the button. Can be 'small' or null. Defaults to null.
text?: string
Sets the text of the button. Defaults to ''.
unsafe?: boolean
If true, the innerHTML property will be
used to set the text. Otherwise, textContent
will be used instead. Defaults to false.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface
The arguments for the Canvas constructor.
useDevicePixelRatio?: boolean
Whether the canvas should use the devicePixelRatio.
Defaults to false.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the Code constructor.
text?: string
Sets the text to display in the code block.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends IBindableArgs<number[]>
The arguments for the ColorPicker constructor.
channels?: number
Number of color channels. Defaults to 3. Changing to 4 adds the option to change the alpha value.
value?: number[]
An array of 4 integers containing the RGBA values the picker should be initialized to. Defaults to [0, 0, 255, 1].
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: number[]) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberrenderChanges?: booleanvalues?: number[][]Interface · extends IParentArgs
The arguments for the Container constructor.
flex?: boolean
Sets whether the Container uses flex layout.
grid?: boolean
Sets whether the Container supports the grid layout.
onResize?: () => void
Called when the Container has been resized.
resizable?: string
Sets whether the Container is resizable and where the resize handle is located. Can
be one of 'top', 'bottom', 'right', 'left'. Defaults to null which disables resizing.
resizeMax?: number
Sets the maximum size the Container can take when resized in pixels.
resizeMin?: number
Sets the minimum size the Container can take when resized in pixels.
scrollable?: boolean
Sets whether the Container should be scrollable.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberchildren?: ReactNodeInterface
The arguments for the GradientPicker constructor.
channels?: number
Number of color channels. Defaults to 3. Changing to 4 adds the option to change the alpha value.
renderChanges?: boolean
If true, the picker will render changes to the gradient as they happen. Defaults to true.
value?: number[]
An array of 4 integers containing the RGBA values the picker should be initialized to.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the GridView constructor.
allowDeselect?: boolean
If true and multiSelect is set to false, the layout will allow options to be deselected. Defaults to true.
filterFn?: (item: GridViewItem) => boolean
A filter function to filter GridViewItems with signature (GridViewItem) => boolean.
multiSelect?: boolean
If true, the layout will allow for multiple options to be selected. Defaults to true.
vertical?: boolean
If true the GridView layout will be vertical.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the GridViewItem constructor.
allowSelect?: boolean
If true, allow selecting the item. Defaults to true.
selected?: boolean
Whether the item is selected.
tabIndex?: number
Sets the tabIndex of the GridViewItem. Defaults to 0.
text?: string
The text of the item. Defaults to ''.
type?: string
The type of the GridViewItem. Can be null or 'radio'.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringwidth?: numberInterface
The interface for bindable elements.
get renderChanges(): boolean
set renderChanges(value: boolean)
Gets whether the input should flash on changes.
get value(): T
set value(values: T)
Gets the value of the Element.
get values(): T[]
set values(values: T[])
Gets multiple values on the Element.
Interface
The interface for arguments for bindable elements.
renderChanges?: boolean
If true each input will flash on changes.
value?: T
Sets the value of the Element.
values?: T[]
Sets multiple values to the Element. It is up to the Element to determine how to display them.
Interface
The interface for flex-related CSS properties available on elements.
These properties do not themselves enable display: flex; flex layout is
configured separately (for example via Container#flex).
alignItems?: string
Sets the element's alignItems CSS property.
alignSelf?: string
Sets the element's alignSelf CSS property.
flexBasis?: string | number
Sets the element's flexBasis CSS property.
flexDirection?: string
Sets the element's flexDirection CSS property.
flexGrow?: string | number
Sets the element's flexGrow CSS property.
flexShrink?: string | number
Sets the element's flexShrink CSS property.
flexWrap?: string
Sets the element's flexWrap CSS property.
justifyContent?: string
Sets the element's justifyContent CSS property.
justifySelf?: string
Sets the element's justifySelf CSS property.
Interface
The interface for elements that can be focused.
blur(): void
Unfocus the element
focus(select?: boolean): void
Focus on the element. If the input contains text and select is provided, the text will be selected on focus.
Parameters
select (boolean, optional)Interface · extends ContainerArgs
The arguments for the InfoBox constructor.
icon?: string
The CSS code for an icon for the InfoBox. e.g. 'E401' (notice we omit the '\' character). Defaults to ''. Useful icon values for InfoBox are:
text?: string
Sets the 'text' of the InfoBox. Defaults to ''.
title?: string
Sets the 'title' of the InfoBox. Defaults to ''.
unsafe?: boolean
If true, the innerHTML property will be
used to set the text. Otherwise, textContent
will be used instead. Defaults to false.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends IBindableArgs<T>, IPlaceholderArgs
The arguments for the InputElement constructor.
blurOnEnter?: boolean
Sets whether pressing Enter will blur (unfocus) the field. Defaults to true.
blurOnEscape?: boolean
Sets whether pressing Escape will blur (unfocus) the field. Defaults to true.
input?: HTMLInputElement
The input element to associate this InputElement with. If not supplied one will be created instead.
keyChange?: boolean
Sets whether any key up event will cause a change event to be fired.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: T) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberplaceholder?: stringrenderChanges?: booleanvalue?: Tvalues?: T[]Interface
The interface for arguments for elements that have children.
children?: ReactNode
The children of the current component.
Interface
The interface for elements that have placeholder text.
get placeholder(): string
set placeholder(value: string)
Gets the placeholder text of the input.
Interface
The interface for arguments for elements that have placeholder text.
placeholder?: string
Sets the placeholder label that appears on the right of the input.
Interface · extends IBindableArgs<string>, IPlaceholderArgs
The arguments for the Label constructor.
allowTextSelection?: boolean
If true then the label can be clicked to select text. Defaults to false.
dom?: string | HTMLElement
The DOM element or its type to use for this component. Defaults to 'span'.
nativeTooltip?: boolean
If true then use the text of the label as the native HTML tooltip. Defaults to false.
text?: string
Sets the text of the Label. Defaults to ''.
unsafe?: boolean
If true, the innerHTML property will be
used to set the text. Otherwise, textContent
will be used instead. Defaults to false.
value?: string
Sets the value of the Label. Defaults to ''.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]enabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: string) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberplaceholder?: stringrenderChanges?: booleanvalues?: string[]Interface · extends ContainerArgs
The arguments for the LabelGroup constructor.
field?: Element
The Element to be wrapped by the label group.
labelAlignTop?: boolean
Whether to align the label at the top of the group. Defaults to false which aligns it at the center.
nativeTooltip?: boolean
Add a native tooltip to the label.
text?: string
The label text. Defaults to 'Label'.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the Menu constructor.
hidden?: boolean
Sets whether this Menu is hidden. Defaults to true.
items?: MenuItemArgs[]
An array of MenuItemArgs. If these are passed then new MenuItems will be created and appended to the menu.
tabIndex?: number
Sets the tabIndex of the Menu. Defaults to 1.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringwidth?: numberInterface · extends ContainerArgs
The arguments for the MenuItem constructor.
hasChildren?: boolean
Whether the MenuItem has any child MenuItems.
icon?: string
Sets the CSS code for an icon for the MenuItem. e.g. 'E401' (notice we omit the '\' character).
items?: MenuItemArgs[]
An array of MenuItem constructor data. If defined then child MenuItems will be created and added to the MenuItem.
menu?: Menu
Sets the parent Menu Element.
onIsEnabled?: () => boolean
Sets the function that determines whether the MenuItem should be enabled when the Menu is shown.
onIsVisible?: () => boolean
Sets the function that determines whether the MenuItem should be visible when the Menu is shown.
onSelect?: (evt?: MouseEvent) => void
Sets the function called when we select the MenuItem.
shortcut?: string
Sets the keyboard shortcut to display on the MenuItem (e.g., 'Ctrl+C').
text?: string
Sets the text shown on the MenuItem.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends InputElementArgs<number | string>
The arguments for the NumericInput constructor.
allowNull?: boolean
Sets whether the value can be null. If not then it will be 0 instead of null.
hideSlider?: boolean
Hide the input mouse drag slider.
max?: number
Sets the maximum value this field can take.
min?: number
Sets the minimum value this field can take.
precision?: number
Sets the decimal precision of this field. Defaults to 7.
step?: number
Sets the amount that the value will be increased or decreased when using the arrow keys and the slider input.
stepPrecision?: number
Sets the amount that the value will be increased or decreased when holding shift using the arrow keys and the slider input. Defaults to NumericInput#step * 0.1.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseblurOnEnter?: booleanblurOnEscape?: booleanclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleaninput?: HTMLInputElementisRoot?: booleanjustifyContent?: stringjustifySelf?: stringkeyChange?: booleanlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: string | number) => voidonClick?: () => voidonRemove?: () => voidparent?: Elementplaceholder?: stringreadOnly?: booleanrenderChanges?: booleanstyle?: stringtabIndex?: numbervalue?: string | numbervalues?: (string | number)[]width?: numberInterface
The arguments for the Overlay constructor.
clickable?: boolean
Whether the overlay can be hidden by clicking on it.
transparent?: boolean
Whether the overlay is transparent or not.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the Panel constructor.
collapsed?: boolean
Sets whether the Element should be collapsed.
collapseHorizontally?: boolean
Sets whether the panel collapses horizontally - this would be the case for side panels. Defaults to false.
collapsible?: boolean
Sets whether the Element is collapsible.
content?: HTMLElement
A DOM element to use for the content container.
header?: HTMLElement
A DOM element to use for the header container.
headerSize?: number
The height of the header in pixels. Defaults to 32.
headerText?: string
The header text of the panel. Defaults to the empty string.
panelType?: "normal"
Sets the panel type.
removable?: boolean
Sets whether the panel can be removed.
sortable?: boolean
Sets whether the panel can be reordered.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the Progress constructor.
value?: number
Sets the value of the progress bar (between 0 and 100).
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends IBindableArgs<boolean>
The arguments for the RadioButton constructor.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: boolean) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberrenderChanges?: booleanvalue?: booleanvalues?: boolean[]Interface
Represents an item that has been reparented in a TreeView drag operation.
item: TreeViewItem
The reparented tree view item.
newChildIndex?: number
The new child index of the item within its new parent.
newParent?: Element
The new parent of the item.
oldParent: Element
The old parent of the item.
Interface · extends IBindableArgs<unknown>, IPlaceholderArgs
The arguments for the SelectInput constructor.
allowCreate?: boolean
If true then the input allows creating new values from the text field. Only used when allowInput is true. Defaults to false.
allowInput?: boolean
If true then a text field is shown for the user to search for values or enter new ones. Defaults to false.
allowNull?: boolean
If true then null is a valid input value. Defaults to false.
createFn?: (value: string) => void
A function to be executed when the user selects to create a new value. The function takes the new value as a parameter.
createLabelText?: string
The placeholder text to show when creating a new value. Used when allowInput and allowCreate are both true.
defaultValue?: unknown
Default value for the input.
disabledOptions?: Record<string, string>
All the option values that should be disabled. The keys of the object are the values of the options and the values are the text to show when the option is disabled.
fallbackOrder?: string[]
The order that the options should be checked in to find a valid fallback option that isn't included in the disabledOptions object.
invalidOptions?: unknown[]
An array of values against which new values are checked before they are created. If a value is in the array it will not be created.
multiSelect?: boolean
If true then the input value becomes an array allowing the selection of multiple options. Defaults to false.
onSelect?: (value: unknown) => void
If provided, this function will be called each time an option is selected.
options?: { t: string; v: string | number | boolean }[]
The dropdown options of the input. Contains an array of objects with the following format {v: Any, t: String} where v is the value and t is the text of the option.
optionsFn?: () => { t: string; v: OptionValue }[]
Used to map the options.
prefix?: string
Text to display in the SelectInput before the selected option.
type?: "string" | "number" | "boolean"
The type of each value. Can be one of 'string', 'number' or 'boolean'. Defaults to 'string'.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberplaceholder?: stringrenderChanges?: booleanvalue?: unknownvalues?: unknown[]Interface · extends IBindableArgs<number>, IPlaceholderArgs
The arguments for the SliderInput constructor.
allowNull?: boolean
Sets whether the value can be null. If not then it will be 0 instead of null.
keyChange?: boolean
Sets whether any key up event will cause a change event to be fired.
max?: number
Sets the maximum value that the numeric input field can take.
min?: number
Sets the minimum value that the numeric input field can take.
precision?: number
Sets the maximum number of decimals a value can take. Defaults to 2.
sliderMax?: number
Sets the maximum value that the slider field can take. Defaults to 1.
sliderMin?: number
Sets the minimum value that the slider field can take. Defaults to 0.
step?: number
Sets the amount that the value will be increased or decreased when using the arrow keys. Holding Shift will use 10x the step.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: number) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberplaceholder?: stringrenderChanges?: booleanvalue?: numbervalues?: number[]Interface
The arguments for the Spinner constructor.
size?: string | number
Sets the pixel size of the spinner. Defaults to 12.
type?: "small-thick"
Can be 'small-thick'. Defaults to 'small-thick'.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends TextInputArgs
The arguments for the TextAreaInput constructor.
resizable?: "none" | "vertical" | "horizontal" | "both"
Sets which directions the text area can be resized in. One of 'both', 'horizontal', 'vertical' or 'none'. Defaults to 'none'.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseblurOnEnter?: booleanblurOnEscape?: booleanclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleaninput?: HTMLInputElementisRoot?: booleanjustifyContent?: stringjustifySelf?: stringkeyChange?: booleanlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: string) => voidonClick?: () => voidonRemove?: () => voidonValidate?: (value: string) => booleanparent?: Elementplaceholder?: stringreadOnly?: booleanrenderChanges?: booleanstyle?: stringtabIndex?: numbervalue?: stringvalues?: string[]width?: numberInterface · extends InputElementArgs<string>, IPlaceholderArgs
The arguments for the TextInput constructor.
onValidate?: (value: string) => boolean
A function that validates the value that is entered into the input and returns true if it
is valid or false otherwise. If false then the input will be set in an error state and
the value will not propagate to the binding.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseblurOnEnter?: booleanblurOnEscape?: booleanclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleaninput?: HTMLInputElementisRoot?: booleanjustifyContent?: stringjustifySelf?: stringkeyChange?: booleanlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: string) => voidonClick?: () => voidonRemove?: () => voidparent?: Elementplaceholder?: stringreadOnly?: booleanrenderChanges?: booleanstyle?: stringtabIndex?: numbervalue?: stringvalues?: string[]width?: numberInterface · extends ContainerArgs
The arguments for the TreeView constructor.
allowDrag?: boolean
Whether dragging a TreeViewItem is allowed. Defaults to true.
allowRenaming?: boolean
Whether renaming TreeViewItems is allowed by double clicking on them. Defaults to false.
allowReordering?: boolean
Whether reordering TreeViewItems is allowed. Defaults to true.
dragScrollElement?: Element
The element to scroll on drag. Defaults to this TreeView's element.
filter?: string
A filter that searches TreeViewItems and only shows the ones that are relevant to the filter.
onContextMenu?: (evt: MouseEvent, item: TreeViewItem) => void
A function to be called when we right click on a TreeViewItem.
onReparent?: (reparented: ReparentedItem[]) => void
A function to be called when we try to reparent tree items. If a function is provided then the tree items will not be reparented by the TreeView but instead will rely on the function to reparent them as it sees fit.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends ContainerArgs
The arguments for the TreeViewItem constructor.
allowDrag?: boolean
Whether this TreeViewItem can be dragged. Only considered if the parent TreeView
has allowDrag set to true. Defaults to true.
allowDrop?: boolean
Whether dropping is allowed on the TreeViewItem. Defaults to true.
allowSelect?: boolean
Whether the item can be selected. Defaults to true.
icon?: string
The icon shown before the text in the TreeViewItem. Defaults to 'E360'.
onDeselect?: () => void
Method to be called when the TreeViewItem is deselected.
onSelect?: (deselect: () => void) => void
Method to be called when the TreeViewItem is selected.
open?: boolean
Whether the item is open (showing its children). Defaults to false.
selected?: boolean
Whether the item is selected.
text?: string
The text shown by the TreeViewItem.
alignItems?: stringalignSelf?: stringbinding?: BindingBasechildren?: ReactNodeclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflex?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringgrid?: booleanheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: unknown) => voidonClick?: () => voidonRemove?: () => voidonResize?: () => voidparent?: ElementreadOnly?: booleanresizable?: stringresizeMax?: numberresizeMin?: numberscrollable?: booleanstyle?: stringtabIndex?: numberwidth?: numberInterface · extends IBindableArgs<number[] | string>, IMultiPlaceholderArgs
The arguments for the VectorInput constructor.
dimensions?: 2 | 3 | 4
The number of dimensions in the vector. Can be between 2 to 4. Defaults to 3.
max?: number
The maximum value of each vector element.
min?: number
The minimum value of each vector element.
precision?: number
The decimal precision of each vector element. Defaults to 7.
step?: number
The incremental step when using arrow keys or dragger for each vector element.
stepPrecision?: number
The incremental step when holding Shift and using arrow keys or dragger for each vector element.
alignItems?: stringalignSelf?: stringbinding?: BindingBaseclass?: string | string[]dom?: string | HTMLElementenabled?: booleanerror?: booleanflexBasis?: string | numberflexDirection?: stringflexGrow?: string | numberflexShrink?: string | numberflexWrap?: stringheight?: numberhidden?: booleanid?: stringignoreParent?: booleanisRoot?: booleanjustifyContent?: stringjustifySelf?: stringlink?: { observer: Observer | Observer[]; path: string | string[] }onChange?: (value: number[]) => voidonClick?: () => voidonRemove?: () => voidparent?: ElementreadOnly?: booleanstyle?: stringtabIndex?: numberwidth?: numberplaceholder?: string | string[]renderChanges?: booleanvalue?: string | number[]values?: (string | number[])[]Variable
Source: https://github.com/playcanvas/pcui/blob/77ed2b8ba8660c9644049b0d1942652721e7a6c4/src/index.ts#L23
The git revision of the PCUI library. This is a string of the git commit hash.
const revision: "PACKAGE_REVISION" = 'PACKAGE_REVISION'
Variable
Source: https://github.com/playcanvas/pcui/blob/77ed2b8ba8660c9644049b0d1942652721e7a6c4/src/index.ts#L18
The version of the PCUI library. This is a string in semantic version format of major.minor.patch.
const version: "PACKAGE_VERSION" = 'PACKAGE_VERSION'