Home Reference Source
import ModalViewController from '~/controllers/ModalViewController.js'
public class | source

ModalViewController

Extends:

ViewController → ModalViewController

This is like ModalController but better. This uses ModalTemplate

Constructor Summary

Public Constructor
public

constructor(context: HTMLElement, opts: Object, bumpAnimation: boolean)

Creates controller for context

Method Summary

Public Methods
public

bind(node: string | HTMLElement, template: ModalViewTemplate)

Binds an element to trigger to show a modal.

public

async hide(opts: Object, bumpAnimation: boolean)

Hides the current template if there is one

public

async present(template: ModalViewTemplate, opts: Object)

Presents a template.

Inherited Summary

From class ViewController
public static

forClass(className: string, predicate: Function, root: HTMLElement)

Creates a view controller directly for all members of a class.

public static

of(elem: string | Element): ViewController

Returns a canolical VC of an element if it exists

Public Constructors

public constructor(context: HTMLElement, opts: Object, bumpAnimation: boolean) source

Creates controller for context

Override:

ViewController#constructor

Params:

NameTypeAttributeDescription
context HTMLElement

you prob want to use .shared

opts Object
opts.baseZIndex number
  • optional
  • default: 0
bumpAnimation boolean

If should default show bump anim

Public Methods

public bind(node: string | HTMLElement, template: ModalViewTemplate) source

Binds an element to trigger to show a modal. If the ID does NOT exist this will not do any binding.

Params:

NameTypeAttributeDescription
node string | HTMLElement

ID of node or the node itself

template ModalViewTemplate

The modal template to show

public async hide(opts: Object, bumpAnimation: boolean) source

Hides the current template if there is one

Params:

NameTypeAttributeDescription
opts Object
bumpAnimation boolean
  • optional
  • default: true

show a little bump when animating

public async present(template: ModalViewTemplate, opts: Object) source

Presents a template.

Params:

NameTypeAttributeDescription
template ModalViewTemplate

The modal template

opts Object
opts.bumpAnimation boolean
  • optional
  • default: true

show a little bump when animating

opts.alignmentClass string
  • optional
  • default: ""

class to align with