Gestion de la mise à jour de la valeur d'un <select> a chaque changement
This commit is contained in:
parent
934bff5828
commit
0e25d6d033
|
@ -1,26 +1,28 @@
|
||||||
var ref=function(a,b){for(var c=null;null==c||a.hasOwnProperty(c);)c="$"+(268435456+Math.floor(4026531839*Math.random())).toString(16)+"$";a[c]=b;return c},FormBuilder=function(a){this.form_object=a;this.observer=new MutationObserver(FormBuilder.DOMUpdates)};FormBuilder.prototype={form_object:this.form_object,defs_object:{},parent_element:null,built_form:null,root_element:null,ref_table:{$00000000$:null},ref_assoc:{NULL:"$00000000$"},observer:this.observer,scope:{}};
|
var ref=function(a,b){for(var d=null;null==d||a.hasOwnProperty(d);)d="$"+(268435456+Math.floor(4026531839*Math.random())).toString(16)+"$";a[d]=b;return d},FormBuilder=function(a){this.form_object=a;this.observer=new MutationObserver(FormBuilder.DOMUpdates)};FormBuilder.prototype={form_object:this.form_object,defs_object:{},parent_element:null,built_form:null,root_element:null,ref_table:{$00000000$:null},ref_assoc:{NULL:"$00000000$"},observer:this.observer,scope:{}};
|
||||||
FormBuilder.regex={reg_in_key:/^\/\^(.+)\$\/$/,reg_out_val:/\{(\$[1-9])\}/,pri_out_val:/\{([a-z_]+)\}/g,pri_in_key:/^\$([a-z_]+)$/,arr_out_set:/^\{([a-z_]+)\[\]\}$/,arr_out_val:/\{([a-z_]+)([\.:])([a-z_]+)\}/g,arr_in_key:/^\$([a-z_]+)$/,fun_out_val:/^\{([a-z_]+)\(\)\}$/,ref_pri:/^\$[a-f0-9]{8}\$$/};FormBuilder.spread_attr="children next_nodes prev_nodes attributes node_link listeners repeat browse funcs".split(" ");FormBuilder.debug_time=!1;FormBuilder.debug_time_details=!1;
|
FormBuilder.regex={reg_in_key:/^\/\^(.+)\$\/$/,reg_out_val:/\{(\$[1-9])\}/,pri_out_val:/\{([a-z_]+)\}/g,pri_in_key:/^\$([a-z_]+)$/,arr_out_set:/^\{([a-z_]+)\[\]\}$/,arr_out_val:/\{([a-z_]+)([\.:])([a-z_]+)\}/g,arr_in_key:/^\$([a-z_]+)$/,fun_out_val:/^\{([a-z_]+)\(\)\}$/,ref_pri:/^\$[a-f0-9]{8}\$$/};FormBuilder.spread_attr="children next_nodes prev_nodes attributes node_link listeners repeat browse funcs".split(" ");
|
||||||
FormBuilder.debugStart=function(a,b){if(1!=b||!FormBuilder.debug_time)if(2!=b||!FormBuilder.debug_time_details)return{type:0};var c="["+parseInt(64424509439*Math.random()).toString(16)+"]";console.time(c);console.group(a);return{type:b,time_r:c,group:a}};FormBuilder.debug=function(a,b){if(1!=b||!FormBuilder.debug_time)if(2!=b||!FormBuilder.debug_time_details)return{type:0};console.debug(a)};
|
FormBuilder.observe={attributes:{attributes:!0,attributeOldValue:!0,childList:!1,characterData:!1,subtree:!1,characterDataOldValue:!1},characterData:{attributes:!1,attributeOldValue:!1,childList:!1,characterData:!0,subtree:!1,characterDataOldValue:!0}};FormBuilder.debug_time=!1;FormBuilder.debug_time_details=!1;
|
||||||
FormBuilder.debugStop=function(a){if(1!=a.type||!FormBuilder.debug_time)if(2!=a.type||!FormBuilder.debug_time_details)return null;console.timeEnd(a.time_r);console.groupEnd(a.group)};FormBuilder.prototype.add_definition=function(a){var b=FormBuilder.debugStart("FormBuilder.add_definition",1),c;for(c in a)this.defs_object[c]=a[c];FormBuilder.debugStop(b)};
|
FormBuilder.debugStart=function(a,b){if(1!=b||!FormBuilder.debug_time)if(2!=b||!FormBuilder.debug_time_details)return{type:0};var d="["+parseInt(64424509439*Math.random()).toString(16)+"]";console.time(d);console.group(a);return{type:b,time_r:d,group:a}};FormBuilder.debug=function(a,b){if(1!=b||!FormBuilder.debug_time)if(2!=b||!FormBuilder.debug_time_details)return{type:0};console.debug(a)};
|
||||||
FormBuilder.prototype.build=function(a){var b=FormBuilder.debugStart("FormBuilder.build",1);a=null==a?{}:a;for(var c in a)a[c]=ref(this.ref_table,a[c]),this.ref_assoc[c]=a[c],this.scope["$"+c]=this.ref_assoc[c],this.__defineGetter__("$"+c,function(a,b){return function(){console.log("get: "+c);return a.ref_table[a.scope["$"+b]]}}(this,c)),this.__defineSetter__("$"+c,function(a,b){return function(g){console.log("set: "+c);a.ref_table[a.scope["$"+b]]=g;a.attach()}}(this,c));this.built_form=JSON.parse(JSON.stringify(this.form_object));
|
FormBuilder.debugStop=function(a){if(1!=a.type||!FormBuilder.debug_time)if(2!=a.type||!FormBuilder.debug_time_details)return null;console.timeEnd(a.time_r);console.groupEnd(a.group)};FormBuilder.prototype.add_definition=function(a){var b=FormBuilder.debugStart("FormBuilder.add_definition",1),d;for(d in a)this.defs_object[d]=a[d];FormBuilder.debugStop(b)};
|
||||||
this.built_form=FormBuilder.replaceStatements(this.built_form,a,this.defs_object,this.ref_table,this.ref_assoc);FormBuilder.debugStop(b)};FormBuilder.prototype.update=function(a){var b=FormBuilder.debugStart("FormBuilder.update",1);a=null==a?{}:a;for(var c in a)this.ref_assoc.hasOwnProperty(c)&&(this.ref_table[this.ref_assoc[c]]=a[c]);FormBuilder.debugStop(b)};
|
FormBuilder.prototype.build=function(a){var b=FormBuilder.debugStart("FormBuilder.build",1);a=null==a?{}:a;for(var d in a)a[d]=ref(this.ref_table,a[d]),this.ref_assoc[d]=a[d],this.scope["$"+d]=this.ref_assoc[d],this.__defineGetter__("$"+d,function(a,b){return function(){return a.ref_table[a.scope["$"+b]]}}(this,d)),this.__defineSetter__("$"+d,function(a,b){return function(d){a.ref_table[a.scope["$"+b]]=d;a.attach()}}(this,d));this.built_form=JSON.parse(JSON.stringify(this.form_object));this.built_form=
|
||||||
|
FormBuilder.replaceStatements(this.built_form,a,this.defs_object,this.ref_table,this.ref_assoc);FormBuilder.debugStop(b)};FormBuilder.prototype.update=function(a){var b=FormBuilder.debugStart("FormBuilder.update",1);a=null==a?{}:a;for(var d in a)this.ref_assoc.hasOwnProperty(d)&&(this.ref_table[this.ref_assoc[d]]=a[d]);FormBuilder.debugStop(b)};
|
||||||
FormBuilder.prototype.attach=function(a){var b=FormBuilder.debugStart("FormBuilder.attach",1);if(!(a instanceof Element)&&null===this.parent_element)return!1;this.parent_element=a instanceof Element?a:this.parent_element;this.built_form.hasOwnProperty("dom")&&(this.observer.disconnect(),FormBuilder.detachElements(this.parent_element,this.built_form.dom));FormBuilder.createElements(this.built_form,this.ref_table,this.ref_assoc);FormBuilder.attachElements(this.parent_element,this.built_form.dom);this.observer.observe(this.parent_element,
|
FormBuilder.prototype.attach=function(a){var b=FormBuilder.debugStart("FormBuilder.attach",1);if(!(a instanceof Element)&&null===this.parent_element)return!1;this.parent_element=a instanceof Element?a:this.parent_element;this.built_form.hasOwnProperty("dom")&&(this.observer.disconnect(),FormBuilder.detachElements(this.parent_element,this.built_form.dom));FormBuilder.createElements(this.built_form,this.ref_table,this.ref_assoc);FormBuilder.attachElements(this.parent_element,this.built_form.dom);this.observer.observe(this.parent_element,
|
||||||
{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0});FormBuilder.debugStop(b)};FormBuilder.prototype.getter=function(a){return this.ref_table[this.scope[a]]};FormBuilder.prototype.setter=function(a,b){this.ref_table[this.scope[a]]=b};
|
FormBuilder.observe.attributes);FormBuilder.debugStop(b)};
|
||||||
FormBuilder.fetchNodeDefinition=function(a,b){var c=FormBuilder.debugStart("FormBuilder::fetchNodeDefinition",2);FormBuilder.debug('node = "'+a+'"',2);var e,f;r=FormBuilder.regex.reg_in_key;if("undefined"!=typeof b&&b.hasOwnProperty(a))return FormBuilder.debugStop(c),{def:b[a]};for(e in b)if(r.test(e)&&(f=new RegExp(e.slice(1,-1)),f.test(a))){matches={};for(f=1;f<RegExp.length&&10>f;f++)matches["$"+f]=RegExp["$"+f];FormBuilder.debugStop(c);return{def:b[e],scope:matches}}FormBuilder.debugStop(c);return{}};
|
FormBuilder.fetchNodeDefinition=function(a,b){var d=FormBuilder.debugStart("FormBuilder::fetchNodeDefinition",2);FormBuilder.debug('node = "'+a+'"',2);var e,f;r=FormBuilder.regex.reg_in_key;if("undefined"!=typeof b&&b.hasOwnProperty(a))return FormBuilder.debugStop(d),{def:b[a]};for(e in b)if(r.test(e)&&(f=new RegExp(e.slice(1,-1)),f.test(a))){matches={};for(f=1;f<RegExp.length&&10>f;f++)matches["$"+f]=RegExp["$"+f];FormBuilder.debugStop(d);return{def:b[e],scope:matches}}FormBuilder.debugStop(d);return{}};
|
||||||
FormBuilder.replaceStatements=function(a,b,c,e,f){var g=FormBuilder.debugStart("FormBuilder::replaceStatements",2);a=a instanceof Object?a:{};b=b instanceof Object?JSON.parse(JSON.stringify(b)):{};var d,h;if(a.hasOwnProperty("scope")&&a.scope instanceof Object)for(d in a.scope)b[d]=a.scope[d];if(a.hasOwnProperty("node")&&"string"==typeof a.node&&(h=FormBuilder.fetchNodeDefinition(a.node,c),h.hasOwnProperty("def")&&(a.node_link=JSON.parse(JSON.stringify(h.def)),h.hasOwnProperty("scope"))))for(d in h.scope)b[d]=
|
FormBuilder.replaceStatements=function(a,b,d,e,f){var g=FormBuilder.debugStart("FormBuilder::replaceStatements",2);a=a instanceof Object?a:{};b=b instanceof Object?JSON.parse(JSON.stringify(b)):{};var c,h;if(a.hasOwnProperty("scope")&&a.scope instanceof Object)for(c in a.scope)b[c]=a.scope[c];if(a.hasOwnProperty("node")&&"string"==typeof a.node&&(h=FormBuilder.fetchNodeDefinition(a.node,d),h.hasOwnProperty("def")&&(a.node_link=JSON.parse(JSON.stringify(h.def)),h.hasOwnProperty("scope"))))for(c in h.scope)b[c]=
|
||||||
h.scope[d];a.hasOwnProperty("browse")&&(a.browse.hasOwnProperty("array")&&FormBuilder.regex.arr_out_set.test(a.browse.array)?a.browse.id=RegExp.$1:delete a.browse);for(d in a)"string"==typeof a[d]?(a[d]=[a[d]],h=FormBuilder.replaceStatementsFunction(a[d][0],b,e),!1!==h?a[d]=h:(h=FormBuilder.replaceStatementsArray(a[d][0],b,e),!1!==h?a[d]=h:(a[d]=FormBuilder.replaceStatementsRegex(a[d],b),a[d]=FormBuilder.replaceStatementsPrimary(a[d],b),a[d]=FormBuilder.replaceStatementsArrayValue(a[d],b,e,f)))):
|
h.scope[c];a.hasOwnProperty("browse")&&(a.browse.hasOwnProperty("array")&&FormBuilder.regex.arr_out_set.test(a.browse.array)?a.browse.id=RegExp.$1:delete a.browse);for(c in a)"string"==typeof a[c]?(a[c]=[a[c]],h=FormBuilder.replaceStatementsFunction(a[c][0],b,e),!1!==h?a[c]=h:(h=FormBuilder.replaceStatementsArray(a[c][0],b,e),!1!==h?a[c]=h:(a[c]=FormBuilder.replaceStatementsRegex(a[c],b),a[c]=FormBuilder.replaceStatementsPrimary(a[c],b),a[c]=FormBuilder.replaceStatementsArrayValue(a[c],b,e,f)))):
|
||||||
"number"===typeof a[d]&&(a[d]=[ref(e,a[d])]);for(d in a)FormBuilder.regex.pri_in_key.test(d)?b[d.substring(1)]=ref(e,a[d]):FormBuilder.regex.arr_in_key.test(d)&&(b[d.substring(2)]=ref(e,a[d]));b=JSON.parse(JSON.stringify(b));for(d in a)if(-1<FormBuilder.spread_attr.indexOf(d))if(a[d]instanceof Array)for(var k in a[d])FormBuilder.debug("**"+d+"["+k+"]",2),FormBuilder.replaceStatements(a[d][k],b,c,e,f);else a[d]instanceof Object&&(FormBuilder.debug("**"+d,2),FormBuilder.replaceStatements(a[d],b,c,e,
|
"number"===typeof a[c]&&(a[c]=[ref(e,a[c])]);for(c in a)FormBuilder.regex.pri_in_key.test(c)?b[c.substring(1)]=ref(e,a[c]):FormBuilder.regex.arr_in_key.test(c)&&(b[c.substring(2)]=ref(e,a[c]));b=JSON.parse(JSON.stringify(b));for(c in a)if(-1<FormBuilder.spread_attr.indexOf(c))if(a[c]instanceof Array)for(var k in a[c])FormBuilder.debug("**"+c+"["+k+"]",2),FormBuilder.replaceStatements(a[c][k],b,d,e,f);else a[c]instanceof Object&&(FormBuilder.debug("**"+c,2),FormBuilder.replaceStatements(a[c],b,d,e,
|
||||||
f));FormBuilder.debugStop(g);return a};FormBuilder.replaceStatementsFunction=function(a,b,c){var e=null,e=FormBuilder.regex.fun_out_val.exec(a);if(null===e)return!1;b.hasOwnProperty(e[1])||(b[e[1]]=ref(c,function(){}));return b[e[1]]};FormBuilder.replaceStatementsArray=function(a,b,c){var e=null,e=FormBuilder.regex.arr_out_set.exec(a);if(null===e)return!1;b.hasOwnProperty(e[1])||(b[e[1]]=ref(c,[]));return b[e[1]]};
|
f));FormBuilder.debugStop(g);return a};FormBuilder.replaceStatementsFunction=function(a,b,d){var e=null,e=FormBuilder.regex.fun_out_val.exec(a);if(null===e)return!1;b.hasOwnProperty(e[1])||(b[e[1]]=ref(d,function(){}));return b[e[1]]};FormBuilder.replaceStatementsArray=function(a,b,d){var e=null,e=FormBuilder.regex.arr_out_set.exec(a);if(null===e)return!1;b.hasOwnProperty(e[1])||(b[e[1]]=ref(d,[]));return b[e[1]]};
|
||||||
FormBuilder.replaceStatementsRegex=function(a,b){var c=FormBuilder.regex.reg_out_val,e=null,f=[],g,d,h,k;for(h=0;h<a.length;h++){m=null;f=[];g=-1;for(d=[];null!==(e=c.exec(a[h]))&&!(g>=c.lastIndex);)g=c.lastIndex,f.push(e);for(e=g=0;e<f.length;e++)k=f[e][1],(0<g||0<f[e].index)&&d.push(a[h].substr(g,f[e].index-g)),b.hasOwnProperty(k)||(b[k]=""),d.push(b[k]),g=f[e].index+f[e][0].length;g<a[h].length&&d.push(a[h].substr(g,a[h].length));a=a.slice(0,h).concat(d).concat(a.slice(h+1))}return a};
|
FormBuilder.replaceStatementsRegex=function(a,b){var d=FormBuilder.regex.reg_out_val,e=null,f=[],g,c,h,k;for(h=0;h<a.length;h++){m=null;f=[];g=-1;for(c=[];null!==(e=d.exec(a[h]))&&!(g>=d.lastIndex);)g=d.lastIndex,f.push(e);for(e=g=0;e<f.length;e++)k=f[e][1],(0<g||0<f[e].index)&&c.push(a[h].substr(g,f[e].index-g)),b.hasOwnProperty(k)||(b[k]=""),c.push(b[k]),g=f[e].index+f[e][0].length;g<a[h].length&&c.push(a[h].substr(g,a[h].length));a=a.slice(0,h).concat(c).concat(a.slice(h+1))}return a};
|
||||||
FormBuilder.replaceStatementsPrimary=function(a,b){var c=FormBuilder.regex.pri_out_val,e=null,f=[],g,d,h,k;for(h=0;h<a.length;h++){m=null;f=[];g=0;for(d=[];null!==(e=c.exec(a[h]));)f.push(e);for(e=0;e<f.length;e++)k=f[e][1],(0<g||0<f[e].index)&&d.push(a[h].substr(g,f[e].index-g)),b.hasOwnProperty(k)||(b[k]=""),d.push(b[k]),g=f[e].index+f[e][0].length;g<a[h].length&&d.push(a[h].substr(g,a[h].length));a=a.slice(0,h).concat(d).concat(a.slice(h+1))}return a};
|
FormBuilder.replaceStatementsPrimary=function(a,b){var d=FormBuilder.regex.pri_out_val,e=null,f=[],g,c,h,k;for(h=0;h<a.length;h++){m=null;f=[];g=0;for(c=[];null!==(e=d.exec(a[h]));)f.push(e);for(e=0;e<f.length;e++)k=f[e][1],(0<g||0<f[e].index)&&c.push(a[h].substr(g,f[e].index-g)),b.hasOwnProperty(k)||(b[k]=""),c.push(b[k]),g=f[e].index+f[e][0].length;g<a[h].length&&c.push(a[h].substr(g,a[h].length));a=a.slice(0,h).concat(c).concat(a.slice(h+1))}return a};
|
||||||
FormBuilder.replaceStatementsArrayValue=function(a,b,c,e){b=FormBuilder.regex.arr_out_val;var f=null,g=[],d,h,k,l;for(k=0;k<a.length;k++){m=null;g=[];d=0;for(h=[];null!==(f=b.exec(a[k]));)g.push(f);for(f=0;f<g.length;f++)l=g[f][1]+g[f][2]+g[f][3],(0<d||0<g[f].index)&&h.push(a[k].substr(d,g[f].index-d)),e.hasOwnProperty(l)||(e[l]=ref(c)),h.push(e[l]),d=g[f].index+g[f][0].length;d<a[k].length&&h.push(a[k].substr(d,a[k].length));a=a.slice(0,k).concat(h).concat(a.slice(k+1))}return a};
|
FormBuilder.replaceStatementsArrayValue=function(a,b,d,e){b=FormBuilder.regex.arr_out_val;var f=null,g=[],c,h,k,l;for(k=0;k<a.length;k++){m=null;g=[];c=0;for(h=[];null!==(f=b.exec(a[k]));)g.push(f);for(f=0;f<g.length;f++)l=g[f][1]+g[f][2]+g[f][3],(0<c||0<g[f].index)&&h.push(a[k].substr(c,g[f].index-c)),e.hasOwnProperty(l)||(e[l]=ref(d)),h.push(e[l]),c=g[f].index+g[f][0].length;c<a[k].length&&h.push(a[k].substr(c,a[k].length));a=a.slice(0,k).concat(h).concat(a.slice(k+1))}return a};
|
||||||
FormBuilder.readRef=function(a,b){var c,e="";if("string"==typeof b&&FormBuilder.regex.ref_pri.test(b)){for(;"string"==typeof b&&FormBuilder.regex.ref_pri.test(b);)b=a[b],b instanceof Array&&1==b.length&&(b=b[0]);return b}for(c in b)e=FormBuilder.regex.ref_pri.test(b[c])&&a.hasOwnProperty(b[c])?a[b[c]]instanceof Array?e+FormBuilder.readRef(a,a[b[c]]):e+a[b[c]]:e+b[c].toString();return e};
|
FormBuilder.readRef=function(a,b){var d,e="";if("string"==typeof b&&FormBuilder.regex.ref_pri.test(b)){for(;"string"==typeof b&&FormBuilder.regex.ref_pri.test(b);)b=a[b],b instanceof Array&&1==b.length&&(b=b[0]);return b}for(d in b)e=FormBuilder.regex.ref_pri.test(b[d])&&a.hasOwnProperty(b[d])?a[b[d]]instanceof Array?e+FormBuilder.readRef(a,a[b[d]]):e+a[b[d]]:e+b[d].toString();return e};
|
||||||
FormBuilder.createElements=function(a,b,c){var e=FormBuilder.debugStart("FormBuilder::createElements",2),f=[],g,d,h,k,l,n=["NULL"],p,q;if(a.hasOwnProperty("repeat")&&(l=FormBuilder.readRef(b,a.repeat.n),!isNaN(l)))for(n=[],c.hasOwnProperty(a.repeat.id+":i")||(c[a.repeat.id+":i"]=ref(0)),c.hasOwnProperty(a.repeat.id+":n")||(c[a.repeat.id+":n"]=ref(l)),g=0;g<l;g++)n[g]={},n[g][a.repeat.id+":i"]=g,n[g][a.repeat.id+":n"]=l;if(a.hasOwnProperty("browse")&&(l=FormBuilder.readRef(b,a.browse.array),l instanceof
|
FormBuilder.createElements=function(a,b,d){var e=FormBuilder.debugStart("FormBuilder::createElements",2),f=[],g,c,h,k,l,n=["NULL"],p,q;if(a.hasOwnProperty("repeat")&&(l=FormBuilder.readRef(b,a.repeat.n),!isNaN(l)))for(n=[],d.hasOwnProperty(a.repeat.id+":i")||(d[a.repeat.id+":i"]=ref(0)),d.hasOwnProperty(a.repeat.id+":n")||(d[a.repeat.id+":n"]=ref(l)),g=0;g<l;g++)n[g]={},n[g][a.repeat.id+":i"]=g,n[g][a.repeat.id+":n"]=l;if(a.hasOwnProperty("browse")&&(l=FormBuilder.readRef(b,a.browse.array),l instanceof
|
||||||
Array)){n=[];p=[];q={};h=new RegExp(a.browse.id+".(.+)");for(g in c)h.test(g)&&p.push(RegExp.$1);if(a.browse.hasOwnProperty("funcs"))for(g in a.browse.funcs)h.test(g)&&(q[RegExp.$1]=FormBuilder.readRef(b,a.browse.funcs[g]));c.hasOwnProperty(a.browse.id+":i")||(c[a.browse.id+":i"]=ref(0));c.hasOwnProperty(a.browse.id+":n")||(c[a.browse.id+":n"]=ref(l));for(g=0;g<l.length;g++){n[g]={};for(d in p)q.hasOwnProperty(p[d])?n[g][a.browse.id+"."+p[d]]=q[p[d]](l[g]):l[g].hasOwnProperty(p[d])&&(n[g][a.browse.id+
|
Array)){n=[];p=[];q={};h=new RegExp(a.browse.id+".(.+)");for(g in d)h.test(g)&&p.push(RegExp.$1);if(a.browse.hasOwnProperty("funcs"))for(g in a.browse.funcs)h.test(g)&&(q[RegExp.$1]=FormBuilder.readRef(b,a.browse.funcs[g]));d.hasOwnProperty(a.browse.id+":i")||(d[a.browse.id+":i"]=ref(0));d.hasOwnProperty(a.browse.id+":n")||(d[a.browse.id+":n"]=ref(l));for(g=0;g<l.length;g++){n[g]={};for(c in p)q.hasOwnProperty(p[c])?n[g][a.browse.id+"."+p[c]]=q[p[c]](l[g]):l[g].hasOwnProperty(p[c])&&(n[g][a.browse.id+
|
||||||
"."+p[d]]=l[g][p[d]]);n[g][a.browse.id+":i"]=g;n[g][a.browse.id+":n"]=l.length}}for(d=0;d<n.length;d++){f[d]={prev:[],node:[],next:[]};if(n[d]instanceof Object)for(g in n[d])b[c[g]]=n[d][g];if(a.hasOwnProperty("prev_nodes"))for(g in a.prev_nodes)f[d].prev=FormBuilder.createElements(a.prev_nodes[g],b,c);if(a.hasOwnProperty("next_nodes"))for(g in a.next_nodes)f[d].next=FormBuilder.createElements(a.next_nodes[g],b,c);if(a.hasOwnProperty("node_link"))for(g in l=FormBuilder.createElements(a.node_link,
|
"."+p[c]]=l[g][p[c]]);n[g][a.browse.id+":i"]=g;n[g][a.browse.id+":n"]=l.length}}for(c=0;c<n.length;c++){f[c]={prev:[],node:[],next:[]};if(n[c]instanceof Object)for(g in n[c])b[d[g]]=n[c][g];if(a.hasOwnProperty("prev_nodes"))for(g in a.prev_nodes)f[c].prev=FormBuilder.createElements(a.prev_nodes[g],b,d);if(a.hasOwnProperty("next_nodes"))for(g in a.next_nodes)f[c].next=FormBuilder.createElements(a.next_nodes[g],b,d);if(a.hasOwnProperty("node_link"))for(g in l=FormBuilder.createElements(a.node_link,
|
||||||
b,c),l)f[d].prev=f[d].prev.concat(l[g].prev),f[d].node=f[d].node.concat(l[g].node),f[d].next=l[g].next.concat(f[d].next);else a.hasOwnProperty("node_type")&&f[d].node.push(document.createElement(FormBuilder.readRef(b,a.node_type)));if(a.hasOwnProperty("attributes"))for(g in a.attributes)for(k in f[d].node)f[d].node[k].setAttribute(g,FormBuilder.readRef(b,a.attributes[g]));if(a.hasOwnProperty("css"))for(k in f[d].node)FormBuilder.applyCSS(f[d].node[k],a.css);if(a.hasOwnProperty("text"))for(k in f[d].node)f[d].node[k].innerHTML=
|
b,d),l)f[c].prev=f[c].prev.concat(l[g].prev),f[c].node=f[c].node.concat(l[g].node),f[c].next=l[g].next.concat(f[c].next);else a.hasOwnProperty("node_type")&&(l=f[c].node.push(document.createElement(FormBuilder.readRef(b,a.node_type)))-1,h=(h=(h="input"===a.node_type)&&a.hasOwnProperty("attributes")&&a.attributes.hasOwnProperty("type"))&&-1<["radio","checkbox"].indexOf(a.attributes.type),"select"==a.node_type&&a.hasOwnProperty("selected")&&(console.log("bla",f[c].node[l]),f[c].node[l].addEventListener("change",
|
||||||
FormBuilder.readRef(b,a.text);if(a.hasOwnProperty("listeners"))for(g in a.listeners)for(k in f[d].node)f[d].node[k].addEventListener(g,FormBuilder.readRef(b,a.listeners[g]),!1);if(a.hasOwnProperty("children"))for(g in a.children)for(k in l=FormBuilder.createElements(a.children[g],b,c),f[d].node)FormBuilder.attachElements(f[d].node[k],l)}b=a.hasOwnProperty("node")?a.node:a.node_type;FormBuilder.debug("<"+b+">",2);FormBuilder.debugStop(e);return a.dom=f};
|
function(d){var c=a.selected[0];for(d=c;FormBuilder.regex.ref_pri.test(c);)d=c,c=b[c],c instanceof Array&&(c=c[0]);b[d]=this.value},!1)));if(a.hasOwnProperty("attributes"))for(g in a.attributes)for(k in f[c].node)f[c].node[k].setAttribute(g,FormBuilder.readRef(b,a.attributes[g]));if(a.hasOwnProperty("css"))for(k in f[c].node)FormBuilder.applyCSS(f[c].node[k],a.css);if(a.hasOwnProperty("text"))for(k in f[c].node)f[c].node[k].innerHTML=FormBuilder.readRef(b,a.text);if(a.hasOwnProperty("listeners"))for(g in a.listeners)for(k in f[c].node)f[c].node[k].addEventListener(g,
|
||||||
FormBuilder.attachElements=function(a,b){var c=FormBuilder.debugStart("FormBuilder::attachElements",2),e,f;for(e in b){for(f in b[e].prev)b[e].prev[f]instanceof Element&&a.appendChild(b[e].prev[f]),b[e].prev[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].prev[f]]);for(f in b[e].node)b[e].node[f]instanceof Element&&a.appendChild(b[e].node[f]),b[e].node[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].node[f]]);for(f in b[e].next)b[e].next[f]instanceof Element&&a.appendChild(b[e].next[f]),
|
FormBuilder.readRef(b,a.listeners[g]),!1);if(a.hasOwnProperty("children"))for(g in a.children)for(k in l=FormBuilder.createElements(a.children[g],b,d),f[c].node)FormBuilder.attachElements(f[c].node[k],l)}d=a.hasOwnProperty("node")?a.node:a.node_type;FormBuilder.debug("<"+d+">",2);FormBuilder.debugStop(e);return a.dom=f};
|
||||||
b[e].next[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].next[f]])}FormBuilder.debugStop(c)};
|
FormBuilder.attachElements=function(a,b){var d=FormBuilder.debugStart("FormBuilder::attachElements",2),e,f;for(e in b){for(f in b[e].prev)b[e].prev[f]instanceof Element&&a.appendChild(b[e].prev[f]),b[e].prev[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].prev[f]]);for(f in b[e].node)b[e].node[f]instanceof Element&&a.appendChild(b[e].node[f]),b[e].node[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].node[f]]);for(f in b[e].next)b[e].next[f]instanceof Element&&a.appendChild(b[e].next[f]),
|
||||||
FormBuilder.detachElements=function(a,b){var c,e;for(c in b){for(e in b[c].prev)b[c].prev[e]instanceof Element&&a.removeChild(b[c].prev[e]),b[c].prev[e]instanceof Object&&FormBuilder.detachElements(a,[b[c].prev[e]]);for(e in b[c].node)b[c].node[e]instanceof Element&&a.removeChild(b[c].node[e]),b[c].node[e]instanceof Object&&FormBuilder.detachElements(a,[b[c].node[e]]);for(e in b[c].next)b[c].next[e]instanceof Element&&a.removeChild(b[c].next[e]),b[c].next[e]instanceof Object&&FormBuilder.detachElements(a,
|
b[e].next[f]instanceof Object&&FormBuilder.attachElements(a,[b[e].next[f]])}FormBuilder.debugStop(d)};
|
||||||
[b[c].next[e]])}};FormBuilder.applyCSS=function(a,b){for(var c in b)a.style[c]=b[c]};FormBuilder.DOMUpdates=function(a){console.log(a)};
|
FormBuilder.detachElements=function(a,b){var d,e;for(d in b){for(e in b[d].prev)b[d].prev[e]instanceof Element&&a.removeChild(b[d].prev[e]),b[d].prev[e]instanceof Object&&FormBuilder.detachElements(a,[b[d].prev[e]]);for(e in b[d].node)b[d].node[e]instanceof Element&&a.removeChild(b[d].node[e]),b[d].node[e]instanceof Object&&FormBuilder.detachElements(a,[b[d].node[e]]);for(e in b[d].next)b[d].next[e]instanceof Element&&a.removeChild(b[d].next[e]),b[d].next[e]instanceof Object&&FormBuilder.detachElements(a,
|
||||||
|
[b[d].next[e]])}};FormBuilder.applyCSS=function(a,b){for(var d in b)a.style[d]=b[d]};FormBuilder.DOMUpdates=function(a){for(var b in a)console.log(a[b]),console.log(a[b].target),console.log(a[b].type)};
|
||||||
|
|
|
@ -112,6 +112,26 @@ FormBuilder.spread_attr = [ // Liste des attributs diffusant le scope
|
||||||
'funcs'
|
'funcs'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Configuration des observers
|
||||||
|
FormBuilder.observe = {
|
||||||
|
attributes: {
|
||||||
|
attributes: true,
|
||||||
|
attributeOldValue: true,
|
||||||
|
childList: false,
|
||||||
|
characterData: false,
|
||||||
|
subtree: false,
|
||||||
|
characterDataOldValue: false
|
||||||
|
},
|
||||||
|
characterData: {
|
||||||
|
attributes: false,
|
||||||
|
attributeOldValue: false,
|
||||||
|
childList: false,
|
||||||
|
characterData: true,
|
||||||
|
subtree: false,
|
||||||
|
characterDataOldValue: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// DEBUG des performances
|
// DEBUG des performances
|
||||||
FormBuilder.debug_time = false;
|
FormBuilder.debug_time = false;
|
||||||
FormBuilder.debug_time_details = false;
|
FormBuilder.debug_time_details = false;
|
||||||
|
@ -218,7 +238,6 @@ FormBuilder.prototype.build = function(scope){
|
||||||
/* (1) On définit le getter */
|
/* (1) On définit le getter */
|
||||||
this.__defineGetter__('$'+key, (function(o, k){ return function(){
|
this.__defineGetter__('$'+key, (function(o, k){ return function(){
|
||||||
|
|
||||||
console.log('get: '+key);
|
|
||||||
return o.ref_table[ o.scope['$'+k] ];
|
return o.ref_table[ o.scope['$'+k] ];
|
||||||
|
|
||||||
}; })(this, key) );
|
}; })(this, key) );
|
||||||
|
@ -226,7 +245,6 @@ FormBuilder.prototype.build = function(scope){
|
||||||
/* (2) On définit le setter */
|
/* (2) On définit le setter */
|
||||||
this.__defineSetter__('$'+key, (function(o, k){ return function(v){
|
this.__defineSetter__('$'+key, (function(o, k){ return function(v){
|
||||||
|
|
||||||
console.log('set: '+key);
|
|
||||||
o.ref_table[ o.scope['$'+k] ] = v;
|
o.ref_table[ o.scope['$'+k] ] = v;
|
||||||
o.attach();
|
o.attach();
|
||||||
|
|
||||||
|
@ -319,41 +337,11 @@ FormBuilder.prototype.attach = function(parent){
|
||||||
FormBuilder.attachElements(this.parent_element, this.built_form.dom);
|
FormBuilder.attachElements(this.parent_element, this.built_form.dom);
|
||||||
|
|
||||||
/* (3) On lance l'observer */
|
/* (3) On lance l'observer */
|
||||||
this.observer.observe(this.parent_element, {
|
this.observer.observe(this.parent_element, FormBuilder.observe.attributes);
|
||||||
childList: true,
|
|
||||||
attributes: true,
|
|
||||||
characterData: true,
|
|
||||||
subtree: true,
|
|
||||||
attributeOldValue: true,
|
|
||||||
characterDataOldValue: true
|
|
||||||
});
|
|
||||||
|
|
||||||
FormBuilder.debugStop(dbg);
|
FormBuilder.debugStop(dbg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* CUSTOM GETTER DE VARIABLE
|
|
||||||
*
|
|
||||||
* @varName<String> Nom de la variable
|
|
||||||
*
|
|
||||||
* @return varValue<mixed> Retourne la valeur de la variable
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
FormBuilder.prototype.getter = function(varName){
|
|
||||||
return this.ref_table[ this.scope[varName] ];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* CUSTOM SETTER DE VARIABLE
|
|
||||||
*
|
|
||||||
* @varName<String> Nom de la variable
|
|
||||||
* @newValue<mixed> Nouvelle valeur de la variable
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
FormBuilder.prototype.setter = function(varName, newValue){
|
|
||||||
this.ref_table[ this.scope[varName] ] = newValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* ____ _____ _ _____ ___ ____ */
|
/* ____ _____ _ _____ ___ ____ */
|
||||||
/* / ___|_ _|/ \|_ _|_ _/ ___| */
|
/* / ___|_ _|/ \|_ _|_ _/ ___| */
|
||||||
|
@ -1157,10 +1145,49 @@ FormBuilder.createElements = function(definition, ref_table, ref_assoc){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (2) Si on a le type de <tag> hmtl */
|
/* (2) Si on a le type de <tag> hmtl */
|
||||||
else if( definition.hasOwnProperty('node_type') ){
|
else if( definition.hasOwnProperty('node_type') ){
|
||||||
|
|
||||||
built[b].node.push( document.createElement( FormBuilder.readRef(ref_table, definition.node_type) ) );
|
// {1} Création de l'élément //
|
||||||
|
var created = built[b].node.push( document.createElement( FormBuilder.readRef(ref_table, definition.node_type) ) ) - 1;
|
||||||
|
|
||||||
|
// {2} Determination du type //
|
||||||
|
var checkable = definition.node_type === 'input';
|
||||||
|
checkable = checkable && definition.hasOwnProperty('attributes') && definition.attributes.hasOwnProperty('type');
|
||||||
|
checkable = checkable && ['radio', 'checkbox'].indexOf(definition.attributes.type) > -1;
|
||||||
|
|
||||||
|
var notCheckable = definition.node_type === 'input' && !checkable;
|
||||||
|
|
||||||
|
var select = definition.node_type == 'select' && definition.hasOwnProperty('selected');
|
||||||
|
|
||||||
|
// {3} Si <select> //
|
||||||
|
if( select ){
|
||||||
|
console.log('bla', built[b].node[created]);
|
||||||
|
|
||||||
|
// On met à jour la valeur
|
||||||
|
built[b].node[created].addEventListener('change', function(e){
|
||||||
|
// on lit selected (on suppose qu'il ne contient qu'une reference)
|
||||||
|
var selected_ref = definition.selected[0];
|
||||||
|
|
||||||
|
// On recupere la derniere reference
|
||||||
|
var last = selected_ref,
|
||||||
|
curr = selected_ref;
|
||||||
|
|
||||||
|
// On var jusqu'a la valeur
|
||||||
|
while( FormBuilder.regex.ref_pri.test(curr) ){
|
||||||
|
last = curr;
|
||||||
|
curr = ref_table[ curr ];
|
||||||
|
|
||||||
|
if( curr instanceof Array )
|
||||||
|
curr = curr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// On attribut la valeur modifiee
|
||||||
|
ref_table[ last ] = this.value;
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,6 +1424,19 @@ FormBuilder.applyCSS = function(element, css){
|
||||||
|
|
||||||
|
|
||||||
FormBuilder.DOMUpdates = function(events){
|
FormBuilder.DOMUpdates = function(events){
|
||||||
// TODO
|
var e;
|
||||||
console.log(events);
|
|
||||||
|
|
||||||
|
/* [1] On parcourt chaque évènement
|
||||||
|
=========================================================*/
|
||||||
|
for( e in events){
|
||||||
|
|
||||||
|
console.log( events[e] );
|
||||||
|
console.log( events[e].target );
|
||||||
|
console.log( events[e].type );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
document.body.innerHTML="";"use strict";
|
document.body.innerHTML="";"use strict";
|
||||||
var default_definition={input:{node_type:"input"},"/^h([1-6])$/":{node_type:"h{$1}"},br:{node_type:"br"},option:{node_type:"option"},select:{node_type:"select"},span:{node_type:"span"},"/^br([0-9]+)$/":{node:"br",repeat:{n:"{$1}",id:"brs"}}},custom_definition={"/^input.([a-z]+)$/":{node:"input",attributes:{type:"{$1}","data-name":"{name}",value:"{value}",placeholder:"{placeholder}"},listeners:{click:"{click_listener()}"}},"custom-select":{node:"span",attributes:{"class":"select-container nobold"},children:[{node:"select",
|
var default_definition={input:{node_type:"input"},"/^h([1-6])$/":{node_type:"h{$1}"},br:{node_type:"br"},option:{node_type:"option"},select:{node_type:"select",selected:"{selected}"},span:{node_type:"span"},"/^br([0-9]+)$/":{node:"br",repeat:{n:"{$1}",id:"brs"}}},custom_definition={"/^input.([a-z]+)$/":{node:"input",attributes:{type:"{$1}","data-name":"{name}",value:"{value}",placeholder:"{placeholder}"},listeners:{click:"{click_listener()}"}},"custom-select":{node:"span",attributes:{"class":"select-container nobold"},
|
||||||
attributes:{"data-name":"{name}"},children:[{node:"option",attributes:{value:"{options:i}"},text:"{options.value}",browse:{array:"{options[]}",funcs:{"options.value":"{getoptval()}"}}}],listeners:{change:"{listener()}"}}]}},contactForm={node:"h4",attributes:{"data-icon":"o","class":"new-contact colo2"},children:[{node:"input.hidden",$name:"uid",$value:"{uid}"},{node:"input.hidden",$name:"call",$value:"{call}"},{node:"input.hidden",$name:"sms",$value:"{sms}"},{node:"input.hidden",$name:"countcall",
|
children:[{node:"select",attributes:{"data-name":"{name}"},children:[{node:"option",attributes:{value:"{options:i}"},text:"{options.value}",browse:{array:"{options[]}",funcs:{"options.value":"{getoptval()}"}}}],listeners:{change:"{listener()}"},$selected:"{selected}"}]}},contactForm={node:"h4",attributes:{"data-icon":"o","class":"new-contact colo2"},children:[{node:"input.hidden",$name:"uid",$value:"{uid}"},{node:"input.hidden",$name:"call",$value:"{call}"},{node:"input.hidden",$name:"sms",$value:"{sms}"},
|
||||||
$value:"{count_call}",$click_listener:"{my_listener()}"},{node:"input.hidden",$name:"countsms",$value:"{count_sms}"},{node:"input.text",$name:"number",$value:"{number}"},{node:"custom-select",$name:"existing",$options:"{existing[]}",$listener:"{existingsel()}"},{node:"input.text",$name:"username",$placeholder:"{username_ph}",$value:"{username}"},{node:"input.submit",$value:"Enregistrer",attributes:{"class":"primary sub-number"}}],next_nodes:[{node:"br"}]},a="<h4 data-icon='o' class='new-contact color2'> \n\t<input type='hidden' data-name='uid' value='@uid'>\n\t<input type='hidden' data-name='call' value='@call'>\n\t<input type='hidden' data-name='sms' value='@sms'>\n\t<input type='hidden' data-name='countcall' value='@countcall'>\n\t<input type='hidden' data-name='countsms' value='@countsms'>\n\t<input type='text' data-name='number' placeholder='Num\u00e9ro de t\u00e9l\u00e9phone' value='@number' > \n\t<span class='select-container nobold'><select data-name='existing'>\n\t\t<option value='.'>Utiliser pseudo</option>\n@contacts\t</select></span>\n\t ou \n\t<input type='text' data-name='username' placeholder='Pseudo' value='@username' > \n\t<input type='submit' class='primary sub-number' value='Enregistrer'>\n</h4>\n\n",
|
{node:"input.hidden",$name:"countcall",$value:"{count_call}",$click_listener:"{my_listener()}"},{node:"input.hidden",$name:"countsms",$value:"{count_sms}"},{node:"input.text",$name:"number",$value:"{number}"},{node:"custom-select",$name:"existing",$options:"{existing[]}",$listener:"{existingsel()}",$selected:"{s}"},{node:"input.text",$name:"username",$placeholder:"{username_ph}",$value:"{username}"},{node:"input.submit",$value:"Enregistrer",attributes:{"class":"primary sub-number"}}],next_nodes:[{node:"br"}]},
|
||||||
fb=new FormBuilder(contactForm);fb.add_definition(default_definition);fb.add_definition(custom_definition);fb.build({uid:1,call:2,sms:3,count_call:4,count_sms:5,number:"01 02 03 04 05",existing:["Jean","Archibald","Daniel","Maurice"],username:"moi-meme",username_ph:"Pseudo",my_listener:function(b){console.log("clicked",b)},existingsel:function(b){console.log("selected",b)},getoptval:function(b){return b}});fb.attach(document.body);
|
a="<h4 data-icon='o' class='new-contact color2'> \n\t<input type='hidden' data-name='uid' value='@uid'>\n\t<input type='hidden' data-name='call' value='@call'>\n\t<input type='hidden' data-name='sms' value='@sms'>\n\t<input type='hidden' data-name='countcall' value='@countcall'>\n\t<input type='hidden' data-name='countsms' value='@countsms'>\n\t<input type='text' data-name='number' placeholder='Num\u00e9ro de t\u00e9l\u00e9phone' value='@number' > \n\t<span class='select-container nobold'><select data-name='existing'>\n\t\t<option value='.'>Utiliser pseudo</option>\n@contacts\t</select></span>\n\t ou \n\t<input type='text' data-name='username' placeholder='Pseudo' value='@username' > \n\t<input type='submit' class='primary sub-number' value='Enregistrer'>\n</h4>\n\n",
|
||||||
|
fb=new FormBuilder(contactForm);fb.add_definition(default_definition);fb.add_definition(custom_definition);fb.build({s:1,uid:1,call:2,sms:3,count_call:4,count_sms:5,number:"01 02 03 04 05",existing:["Jean","Archibald","Daniel","Maurice"],username:"moi-meme",username_ph:"Pseudo",my_listener:function(b){console.log("clicked",b)},existingsel:function(b){console.log("selected",b)},getoptval:function(b){return b}});fb.attach(document.body);
|
||||||
|
|
|
@ -10,7 +10,7 @@ var default_definition = {
|
||||||
'/^h([1-6])$/': { node_type: 'h{$1}' },
|
'/^h([1-6])$/': { node_type: 'h{$1}' },
|
||||||
'br': { node_type: 'br' },
|
'br': { node_type: 'br' },
|
||||||
'option': { node_type: 'option' },
|
'option': { node_type: 'option' },
|
||||||
'select': { node_type: 'select' },
|
'select': { node_type: 'select', selected: '{selected}' },
|
||||||
'span': { node_type: 'span' },
|
'span': { node_type: 'span' },
|
||||||
'/^br([0-9]+)$/': { node: 'br', repeat: { n: '{$1}', id: 'brs' } }
|
'/^br([0-9]+)$/': { node: 'br', repeat: { n: '{$1}', id: 'brs' } }
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,8 @@ var custom_definition = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
listeners: { 'change': '{listener()}' }
|
listeners: { 'change': '{listener()}' },
|
||||||
|
$selected: '{selected}'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,7 @@ var contactForm = {
|
||||||
|
|
||||||
{ node: 'input.text', $name: 'number', $value: '{number}' },
|
{ node: 'input.text', $name: 'number', $value: '{number}' },
|
||||||
|
|
||||||
{ node: 'custom-select', $name: 'existing', $options: '{existing[]}', $listener: '{existingsel()}' },
|
{ node: 'custom-select', $name: 'existing', $options: '{existing[]}', $listener: '{existingsel()}', $selected: '{s}' },
|
||||||
|
|
||||||
{ node: 'input.text', $name: 'username', $placeholder: '{username_ph}', $value: '{username}'},
|
{ node: 'input.text', $name: 'username', $placeholder: '{username_ph}', $value: '{username}'},
|
||||||
{ node: 'input.submit', $value: 'Enregistrer', attributes: { class: 'primary sub-number'} }
|
{ node: 'input.submit', $value: 'Enregistrer', attributes: { class: 'primary sub-number'} }
|
||||||
|
@ -108,6 +109,7 @@ var fb = new FormBuilder(contactForm);
|
||||||
fb.add_definition(default_definition);
|
fb.add_definition(default_definition);
|
||||||
fb.add_definition(custom_definition);
|
fb.add_definition(custom_definition);
|
||||||
fb.build({
|
fb.build({
|
||||||
|
s: 1,
|
||||||
uid: 1,
|
uid: 1,
|
||||||
call: 2,
|
call: 2,
|
||||||
sms: 3,
|
sms: 3,
|
||||||
|
|
Loading…
Reference in New Issue