77 lines
1.8 KiB
JavaScript
77 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
/**
|
|
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP
|
|
*/
|
|
|
|
/**
|
|
* @class
|
|
* @constructor
|
|
* @param {!AnP} anp
|
|
* @returns {void}
|
|
* @access public
|
|
*/
|
|
export const FormsComponent = (function(){
|
|
|
|
/**
|
|
* @constructs BaseComponent
|
|
* @param {!AnP} anp
|
|
* @returns {void}
|
|
* @access private
|
|
*/
|
|
const FormsComponent = function(anp){
|
|
|
|
/** @type {FormsComponent} */
|
|
const self = this;
|
|
/** @type {boolean} */
|
|
let started = false;
|
|
|
|
/**
|
|
* @returns {void}
|
|
* @access private
|
|
*/
|
|
const constructor = () => {};
|
|
|
|
/**
|
|
* @param {?anp_start_callback} callback
|
|
* @returns {boolean}
|
|
* @access public
|
|
*/
|
|
this.start = (callback = null) => {
|
|
|
|
/** @type {!anp_start_callback} */
|
|
const end = ok => {
|
|
Utils.execute(callback, ok);
|
|
return ok;
|
|
};
|
|
|
|
if(started)
|
|
return end(false);
|
|
return end(started = true);
|
|
};
|
|
|
|
/**
|
|
* @param {!(Object.<string, any|null>|Array.<any|null>)} inputs
|
|
* @returns {string}
|
|
* @access public
|
|
*/
|
|
this.build = inputs => {
|
|
return anp.comp.set(["form", {}, [
|
|
["fieldset", null, [
|
|
["legend", null, "LEGEND"],
|
|
["p", null, "PARAGRAPH"],
|
|
["div", {class : "structure"}, Utils.get_value("structure", inputs, []).reduce((structure, item) => {
|
|
return structure;
|
|
}, [])],
|
|
["ul", {class : "errors"}],
|
|
anp.comp.buttons()
|
|
]]
|
|
]]);
|
|
};
|
|
|
|
constructor();
|
|
|
|
};
|
|
|
|
return FormsComponent;
|
|
})(); |