Modal: Difference between revisions
Appearance
No edit summary |
Fix Modal documentation error (getTabData) |
||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 35: | Line 35: | ||
Set each form label on its own line. | Set each form label on its own line. | ||
==== modal.addEntry(label: <code>String</code>, type: <code>"text" | "color"</code>, validation): <code>EntryObj</code> ==== | ==== modal.addEntry(label: <code>String</code>, type?: <code>"text" | "color"</code>, validation?: <code>"number" | "required"</code>): <code>EntryObj</code> ==== | ||
Add an input entry to the form. | Add an input entry to the form. | ||
label: The label to be shown next to the input. | label: The label to be shown next to the input. | ||
type (optional): 'text' or 'color'. | type (optional): 'text' or 'color'. The type of input. | ||
validation (optional): 'number'. Check if the entry contains a valid value. | validation (optional): 'number' or 'required'. Check if the entry contains a valid value. | ||
==== modal.setSize(width: <code>Number</code>, height: <code>Number</code>): <code>void</code> ==== | ==== modal.setSize(width: <code>Number</code>, height: <code>Number</code>): <code>void</code> ==== | ||
| Line 65: | Line 65: | ||
Setting either dimension to zero will reset that dimension. | Setting either dimension to zero will reset that dimension. | ||
==== modal.setFormTitle(title: <code>String</code>, opts: <code> | ==== modal.setFormTitle(title: <code>String</code>, opts?: <code>{ bold?: Boolean, center?: Boolean }</code>): <code>void</code> ==== | ||
Set a title or description at the top of the modal. | Set a title or description at the top of the modal. | ||
| Line 76: | Line 76: | ||
Removes the footer from the modal. | Removes the footer from the modal. | ||
==== modal.setFooterCheckbox(labelName: <code>String</code>, callback: <code>Function</code>, defaultState: <code>Boolean</code>): <code>void</code> ==== | ==== modal.setFooterCheckbox(labelName: <code>String</code>, callback: <code>Function<any></code>, defaultState: <code>Boolean</code>): <code>void</code> ==== | ||
Adds a checkbox to the left section of the footer. | Adds a checkbox to the left section of the footer. | ||
| Line 101: | Line 101: | ||
Clears a section of the footer. | Clears a section of the footer. | ||
==== modal.onSubmit(callback: <code>Function</code>): <code>void</code> ==== | ==== modal.onSubmit(callback: <code>Function<any></code>): <code>void</code> ==== | ||
Set event callback. | Set event callback. | ||
This will be called whenever the form is submitted. | This will be called whenever the form is submitted. | ||
==== modal.onOpen(callback: <code>Function</code>): <code>void</code> ==== | ==== modal.onOpen(callback: <code>Function<any></code>): <code>void</code> ==== | ||
Set event callback. | Set event callback. | ||
This will be called whenever the form is opened. | This will be called whenever the form is opened. | ||
==== modal.onClose(callback: <code>Function</code>): <code>void</code> ==== | ==== modal.onClose(callback: <code>Function<any></code>): <code>void</code> ==== | ||
Set event callback. | Set event callback. | ||
This will be called whenever the form is closed. | This will be called whenever the form is closed. | ||
==== modal.onTabChange(callback: <code>Function</code>): <code>void</code> ==== | ==== modal.onTabChange(callback: <code>Function<any></code>): <code>void</code> ==== | ||
Set event callback. | Set event callback. | ||
This will be called whenever the tab is changed. | This will be called whenever the tab is changed. | ||
==== modal.checkboxFieldOnInput(callback: <code>Function</code>): <code>void</code> ==== | ==== modal.checkboxFieldOnInput(callback: <code>Function<any></code>): <code>void</code> ==== | ||
Set event callback. | Set event callback. | ||
| Line 167: | Line 167: | ||
Show tab on the tab bar. | Show tab on the tab bar. | ||
==== modal.getTabData(id: <code>Number</code>): <code> | ==== modal.getTabData(id: <code>Number</code>): <code>TabContext | null</code> ==== | ||
Return raw tab data. | Return raw tab data. | ||
| Line 177: | Line 177: | ||
=== Interfaces === | === Interfaces === | ||
EntryObj: < | ==== CheckboxObj ==== | ||
<syntaxhighlight lang="typescript"> | |||
Object { | |||
elm: HTMLLabelElement, | |||
cbElm: Function, | |||
children: Array<CheckboxObj> | |||
} | |||
</syntaxhighlight> | |||
==== EntryObj ==== | |||
<syntaxhighlight lang="typescript"> | |||
Object { | |||
input: HTMLInputElement | |||
} | |||
</syntaxhighlight> | |||
==== FormInputObj ==== | |||
<syntaxhighlight lang="typescript"> | |||
Object { | |||
input: HTMLInputElement, | |||
value: String, | |||
validation: "number" | "required", | |||
validationFailed: Boolean, | |||
type: "text" | "color", | |||
label: HTMLLabelElement | |||
} | |||
</syntaxhighlight> | |||
==== TabContext ==== | |||
<syntaxhighlight lang="typescript"> | |||
Object { | |||
id: Number, | |||
tabButton: HTMLElement, | |||
client: HTMLElement, | |||
inputField: HTMLElement, | |||
formTitle: HTMLElement, | |||
formField: HTMLElement, | |||
formInputs: Array<FormInputObj>, | |||
hasSubmitted: Boolean, | |||
cbField: HTMLElement, | |||
cbList: Array<CheckboxObj>, | |||
cbCallback: Function<any> | |||
} | |||
</syntaxhighlight> | |||
=== Static functions === | === Static functions === | ||
| Line 211: | Line 251: | ||
modal.open(); | modal.open(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Documentation]] | |||