Home Reference Source
import ButtonTemplate from '~/template/ButtonTemplate.js'
public class | source

ButtonTemplate

Extends:

Template → ButtonTemplate

Direct Subclass:

ProgressButtonTemplate

A button

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

If should have little padding on sides

public

If should have little bit of padding on top

public

If has shadow

public

If the button is active.

public

If should be 'small'

public

If should be full width

public

The label of the button.

Method Summary

Public Methods
public

observeClick(): Observable

Observes the click of the button

public

setIsDisabled(isDisabled: Boolean, message: string)

Sets if disabled.

public

async trigger()

Called when loading

Inherited Summary

From class Template
public static get

An empty template

public static

Performs a move TemplateType for a given HTML id to return a template based on the id's root.

public static

fromInnerHTML(wrapper: HTMLElement, innerHTML: string, type: TemplateType): Template

From innerHTML will wrap in div

public static

Creates template <div> with text.

public get

underlyingNode: HTMLElement

Returns the underlying element

public

defineLinkedClass(name: string, className: string, node: HTMLElement)

Defines a linked class

public

defineLinkedInput(name: string, input: HTMLElement)

Defines a linked input

public

defineLinkedText(name: string, defaultValue: string): Text

Creates a field w/ updating text

public abstract

async didInitialLoad()

Called when loaded the first time

public abstract

Called when the view has loaded

public

Called when disappeared

public

getParent(defaultElement: HTMLElement): HTMLElement

Gets the original parent or else a default

public

loadBeforeContext(elem: HTMLElement): HTMLElement

Loads before an element

public

loadInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement

Loads the template in a context

public

loadReplacingContext(source: HTMLElement): HTMLElement

Loads and replaces

public

prependInContext(parent: HTMLElement, allowDupliacte: boolean): HTMLElement

Prepends the template in a context

public

Removes from the context.

public

unique(): HTMLElement

Returns a unique instance of the template as an HTMLElement.

public

async willInitialLoad()

Called before loaded the first time

public

Called right before the view will appear on screen

public

Called before disappearing

Public Constructors

public constructor(opts: Object) source

Creates a template from some form of HTML fragment. This can be from the DOM or a JS-based HTMLElement

Override:

Template#constructor

Params:

NameTypeAttributeDescription
opts Object
options.text string

The text of the button

options.icon Element
  • nullable: true

The icon node

options.color ButtonColor
options.style ButtonStyle
  • optional
  • default: default

Public Members

public delegate: ActionControllerDelegate source

public hasPaddedHorizontal: Boolean source

If should have little padding on sides

public hasPaddedTop: Boolean source

If should have little bit of padding on top

public hasShadow: Boolean source

If has shadow

public isActive: Boolean source

If the button is active. Only applies to those colors which have this preference set.

public isSmall: Boolean source

If should be 'small'

public isWide: Boolean source

If should be full width

public text: string source

The label of the button. Reactive

Public Methods

public observeClick(): Observable source

Observes the click of the button

Return:

Observable

public setIsDisabled(isDisabled: Boolean, message: string) source

Sets if disabled. Will stop click events from firing

Params:

NameTypeAttributeDescription
isDisabled Boolean
message string
  • nullable: true

optional message to display

public async trigger() source

Called when loading