NxTIC/js/lib/form-builder/main-min.js

5 lines
1.3 KiB
JavaScript

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"}},custom_definition={"/^input.([a-z]+)$/":{node:"input",attributes:{type:"{$1}","data-name":"{name}",value:"{value}",placeholder:"{placeholder}"},next_nodes:[{node:"br"}]},"custom-select":{node:"span",attributes:{"class":"select-container nobold"},children:[{node:"select",attributes:{"data-name":"{name}"},children:[{node:"option",
attribute:{value:"{options.value}"},text:"{options.value}",repeat:"{{options}}"}]}],next_nodes:[{node:"br"}]}},form={node:"h4",attributes:{"data-icon":"o","class":"new-contact color2"},children:[{node:"input.a",$name:"uid",$value:"{uid}"},{node:"input.b",$name:"call",$value:"{call}"},{node:"input.c",$name:"sms",$value:"{sms}"},{node:"input.d",$name:"countcall",$value:"{countcall}"},{node:"input.e",$name:"countsms",$value:"{countsms}"},{node:"input.f",$name:"total",$value:"{countcall} calls + {countsms} sms to {number}"},
{node:"input.g",$name:"number",$value:"{number}"},{node:"custom-select",$name:"existing",$$options:"{{options}}"}]},fb=new FormBuilder(document.body,form);fb.add_definition(default_definition);fb.add_definition(custom_definition);fb.build({});