Commit 5af6835b authored by Jacob Durrant's avatar Jacob Durrant
Browse files

Added docstrings.

parent 141a4ebc
......@@ -5,24 +5,47 @@
declare var Vue;
/**
* Setup the check-box Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('check-box', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
"val": {
get() {
/**
* Get the value from the vinaParams object.
* @returns any
*/
get(): any {
return this.$store.state["vinaParams"][this["id"]];
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
this.$store.commit("setVinaParam", {
name: this["id"],
val: val
});
}
},
"desc"() {
/**
* Generates a description string.
* @returns string The description.
*/
"desc"(): string {
return this["description"] + (this["required"] !== true ? " (Leave blank to use default value.)" : "");
}
},
......
......@@ -5,9 +5,17 @@
declare var Vue;
/**
* Setup the file-input Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('file-input', {
"data": function() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"(): any {
return {
"file": false
}
......@@ -49,10 +57,20 @@ export function setup(): void {
},
"computed": {
"val": {
get() {
/**
* Get the file.
* @returns any A blob?
*/
get(): any {
return this["file"]
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
if (val === null) {
// Reseting the value. Nothing to do here.
return;
......@@ -116,11 +134,21 @@ export function setup(): void {
fr.readAsArrayBuffer(val);
}
},
/**
* Determine whether the component value is valid.
* @returns boolean True if it is valid, false otherwise.
*/
"isValid"(): boolean {
return (this["file"] !== false) && (this["file"] !== null);
}
},
"mounted"() {
/**
* Runs when the vue component is mounted.
* @returns void
*/
"mounted"(): void {
// Make default validation entry.
if (this.$store.state["validation"][this["id"]] === undefined) {
this.$store.commit("setValidationParam", {
......
......@@ -5,12 +5,24 @@
declare var Vue;
/**
* Setup the form-button Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('form-button', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
/**
* Determine which class to add to this buttno.
* @returns string The classes.
*/
"classToUse"(): string {
let classes = [this["cls"]];
if (this["small"] === true) {
......@@ -18,6 +30,11 @@ export function setup(): void {
}
return classes.join(" ");
},
/**
* Determine which button size to use.
* @returns string The size.
*/
"sizeToUse"(): string {
if (this["small"] === true) {
return "sm";
......
......@@ -5,18 +5,40 @@
declare var Vue;
/**
* Setup the form-group Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('form-group', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
/**
* Determines whether this component has a label.
* @returns boolean True if it does, false otherwise.
*/
hasLabel(): boolean {
return this["label"] !== "" && this["label"] !== undefined;
},
/**
* Determines if label should be placed to the left or above.
* @returns number Returns 3 if it has a label, 0 otherwise.
*/
"labelCols"(): number {
return ((this.hasLabel === true) && (this["labelToLeft"] === true)) ? 3 : 0;
},
/**
* Determines if label should be placed to the left or above.
* @returns number Returns 2 if it has a label, 0 otherwise.
*/
"labelColsLg"(): number {
return ((this.hasLabel === true) && (this["labelToLeft"] === true)) ? 2 : 0;
}
......
......@@ -5,8 +5,16 @@
declare var Vue;
/**
* Setup the numeric-input Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('numeric-input', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {
"invalidMsg": "This field is required."
......@@ -14,10 +22,20 @@ export function setup(): void {
},
"computed": {
"val": {
get() {
/**
* Get the value from the vinaParams object.
* @returns any
*/
get(): any {
return this.$store.state["vinaParams"][this["id"]];
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
// Save the value to the store
val = (val === "") ? undefined : +val;
if (isNaN(val)) {
......@@ -54,6 +72,11 @@ export function setup(): void {
});
}
},
/**
* Generates a description string.
* @returns string The description.
*/
"desc"(): string {
let toAdd = "";
if ((this["required"] !== true) && (this["default"] === undefined)) {
......@@ -61,6 +84,11 @@ export function setup(): void {
}
return this["description"] + toAdd;
},
/**
* Determine whether the component value is valid.
* @returns boolean True if it is valid, false otherwise.
*/
"isValid"(): boolean {
let val = this.$store.state["validation"][this["id"]];
return val;
......@@ -108,7 +136,12 @@ export function setup(): void {
"default": undefined
}
},
"mounted"() {
/**
* Runs when the vue component is mounted.
* @returns void
*/
"mounted"(): void {
// Always start by assuming it validates fine.
if (this.$store.state["validation"][this["id"]] === undefined) {
this.$store.commit("setValidationParam", {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,18 +2,34 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
declare var Vue;
/**
* Setup the vina-commandline Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('vina-commandline', {
"data": function() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"() {
return {}
},
"computed": {
/**
* Determines whether the provided vina parameters validate.
* @returns boolean True if the validate, false otherwise.
*/
"vinaParamsValidate"(): boolean {
return this.$store.state["vinaParamsValidates"];
},
/**
* Generates a mock vina command line.
* @returns string The mock command line.
*/
"commandlineStr"(): string {
if (this.vinaParamsValidate === false) {
return "First fix parameter problems above..."
......
This diff is collapsed.
......@@ -2,5 +2,4 @@
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
export let VERSION = "1.0.0";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment