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

Added docstrings.

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