Class: TypedVariableModal
Defined in: TypedVariableModal.js:19
Class for displaying a modal used for creating typed variables.
Extends
unknown
Properties index
| Property | Description |
|---|---|
| firstTypeInput_ | The first type input. |
| shouldCloseOnOverlayClick | If true close the modal when the user clicks outside the modal. Otherwise, only close when user hits the 'X' button or escape. |
| types_ | An array holding arrays with the name of the type and the display name for the type. Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']]. |
| variableNameInput_ | The input div holding the name of the variable. |
| variableTypesDiv_ | The div holding the list of variable types. |
Methods index
| Method | Description |
|---|---|
| createCancelBtn_ | Create button in charge of cancelling. |
| createConfirmBtn_ | Create button in charge of creating the variable. |
| createVariableTypeContainer_ | Creates an unordered list containing all the types. |
| createVarNameContainer_ | Create the div that holds the text input and label for the variable name input. |
| dispose | Dispose of the typed variable modal. |
| getSelectedType_ | Get the selected type. |
| init | Create a typed variable modal and display it on the given button name. |
| onConfirm_ | Get the function to be called when the user tries to create a variable. |
| renderContent_ | Render content for the modal content div. |
| renderFooter_ | Render content for the modal footer. |
| resetModalInputs_ | Check the first type in the list. |
| setLocale | Set the messages for the typed variable modal. Used to change the location. |
| widgetDispose_ | Disposes of any events or dom-references belonging to the editor and resets the inputs. |
Constructors
Constructor
new TypedVariableModal(
workspace,
btnCallbackName,
types,
optMessages
): TypedVariableModal;
Defined in: TypedVariableModal.js:32
Constructor for creating a typed variable modal.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | WorkspaceSvg | The workspace that the modal will be registered on. |
btnCallbackName | string | The name used to register the button callback. |
types | string[][] | An array holding arrays with the display name as the first value and the type as the second. Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']]. |
optMessages | TypedVarModalMessages | The messages for a typed variable modal. |
Returns
TypedVariableModal
Overrides
Modal.constructor
Properties
firstTypeInput_
protected firstTypeInput_: HTMLInputElement;
Defined in: TypedVariableModal.js:64
The first type input.
shouldCloseOnOverlayClick
shouldCloseOnOverlayClick: boolean;
Defined in: TypedVariableModal.js:101
If true close the modal when the user clicks outside the modal. Otherwise, only close when user hits the 'X' button or escape.
types_
protected types_: string[][];
Defined in: TypedVariableModal.js:79
An array holding arrays with the name of the type and the display name for the type. Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']].
variableNameInput_
protected variableNameInput_: HTMLInputElement;
Defined in: TypedVariableModal.js:50
The input div holding the name of the variable.
variableTypesDiv_
protected variableTypesDiv_: HTMLElement;
Defined in: TypedVariableModal.js:57
The div holding the list of variable types.
Methods
createCancelBtn_()
protected createCancelBtn_(): HTMLButtonElement;
Defined in: TypedVariableModal.js:288
Create button in charge of cancelling.
Returns
HTMLButtonElement
The button in charge of cancelling.
createConfirmBtn_()
protected createConfirmBtn_(): HTMLButtonElement;
Defined in: TypedVariableModal.js:275
Create button in charge of creating the variable.
Returns
HTMLButtonElement
The button in charge of creating a variable.
createVariableTypeContainer_()
protected createVariableTypeContainer_(types): HTMLElement;
Defined in: TypedVariableModal.js:314
Creates an unordered list containing all the types.
Parameters
| Parameter | Type | Description |
|---|---|---|
types | string[][] | An array holding arrays with the display name as the first value and the type as the second. Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']]. |
Returns
HTMLElement
The list of types.
createVarNameContainer_()
protected createVarNameContainer_(): HTMLDivElement;
Defined in: TypedVariableModal.js:349
Create the div that holds the text input and label for the variable name input.
Returns
HTMLDivElement
The div holding the text input and label for text input.
dispose()
dispose(): void;
Defined in: TypedVariableModal.js:142
Dispose of the typed variable modal.
Returns
void
getSelectedType_()
protected getSelectedType_(): string | null;
Defined in: TypedVariableModal.js:152
Get the selected type.
Returns
string | null
The selected type.
init()
init(): void;
Defined in: TypedVariableModal.js:119
Create a typed variable modal and display it on the given button name.
Returns
void
onConfirm_()
protected onConfirm_(): void;
Defined in: TypedVariableModal.js:170
Get the function to be called when the user tries to create a variable.
Returns
void
renderContent_()
renderContent_(contentContainer): void;
Defined in: TypedVariableModal.js:243
Render content for the modal content div.
Parameters
| Parameter | Type | Description |
|---|---|---|
contentContainer | HTMLDivElement | The modal's content div. |
Returns
void
renderFooter_()
renderFooter_(footerContainer): void;
Defined in: TypedVariableModal.js:265
Render content for the modal footer.
Parameters
| Parameter | Type | Description |
|---|---|---|
footerContainer | HTMLElement | The modal's footer div. |
Returns
void
resetModalInputs_()
protected resetModalInputs_(): void;
Defined in: TypedVariableModal.js:300
Check the first type in the list.
Returns
void
setLocale()
setLocale(messages): void;
Defined in: TypedVariableModal.js:132
Set the messages for the typed variable modal. Used to change the location.
Parameters
| Parameter | Type | Description |
|---|---|---|
messages | TypedVarModalMessages | The messages needed to create a typed modal. |
Returns
void
widgetDispose_()
widgetDispose_(): void;
Defined in: TypedVariableModal.js:161
Disposes of any events or dom-references belonging to the editor and resets the inputs.
Returns
void