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

ModalTemplate

Extends:

Template → ModalTemplate

A presentable modal view.

Static Member Summary

Static Public Members
public static get

shared: Modal

Returns shared instance, only applicable for subclasses

Constructor Summary

Public Constructor
public

constructor(title: string, root: HTMLElement, type: TemplateType)

Creates a modal given a reference element.

Member Summary

Public Members
public get

Obtains subtitle or nil

public set

Sets the subtitle (note: may not update until re-created)

public get

Returns the modal title

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

Static Public Members

public static get shared: Modal source

Returns shared instance, only applicable for subclasses

Public Constructors

public constructor(title: string, root: HTMLElement, type: TemplateType) source

Creates a modal given a reference element. Use Modal.shared with a subclass to get a canolical reference

Override:

Template#constructor

Params:

NameTypeAttributeDescription
title string

title of modal

root HTMLElement

Root view of the template

type TemplateType

Type of the template to reference.

Public Members

public get subtitle: string source

Obtains subtitle or nil

public set subtitle: string source

Sets the subtitle (note: may not update until re-created)

public get title: string source

Returns the modal title