/* @license webix UI v.5.4.3 This software is covered by Webix Commercial License. Usage without proper license is prohibited. (c) XB Software Ltd. */ window.webix||(webix={}),webix.version="5.4.3",webix.codebase="./",webix.name="core",webix.cdn="//cdn.webix.com",webix.clone=function(t){var e=webix.clone.a;return e.prototype=t,new e},webix.clone.a=function(){},webix.extend=function(t,e,i){if(t.$protoWait)return webix.PowerArray.insertAt.call(t.$protoWait,e,1), t;for(var s in e)s in t&&!i||(t[s]=e[s]);return e.defaults&&webix.extend(t.defaults,e.defaults),e.$init&&e.$init.call(t),t},webix.copy=function(t){var e,i=webix.env.esModern&&!!window.Map&&!!window.Set&&!!window.WeakMap&&!!window.WeakSet;arguments.length>1?(e=arguments[0],t=arguments[1]):e=webix.isArray(t)?[]:{}; for(var s in t){var n=t[s];!n||"object"!=typeof n||n instanceof RegExp?e[s]=n:webix.isDate(n)?e[s]=new Date(n):i&&(n instanceof Map||n instanceof Set||n instanceof WeakMap||n instanceof WeakSet)?e[s]=n:(e[s]=webix.isArray(n)?[]:{},webix.copy(e[s],n))}return e},webix.single=function(t){var e=null,i=function(i){ return e||(e=new t({})),e.c&&e.c.apply(e,arguments),e};return i},webix.protoUI=function(){var t=arguments,e=t[0].name,i=function(t){if(!i)return webix.ui[e].prototype;var s=i.$protoWait;if(s){for(var n=[s[0]],a=1;a0;n--){ if("function"==typeof t[n]&&(t[n]=t[n].prototype),t[n].$init&&s.push(t[n].$init),t[n].defaults){var a=t[n].defaults;e.defaults||(e.defaults={});for(var r in a)webix.isUndefined(e.defaults[r])&&(e.defaults[r]=a[r])}if(t[n].type&&e.type)for(var r in t[n].type)e.type[r]||(e.type[r]=t[n].type[r]);for(var h in t[n])e[h]||e[h]===!1||(e[h]=t[n][h]); }i&&s.push(e.$init),e.$init=function(){for(var t=0;t");-1!==s?this[e.substr(0,s)].attachEvent(e.substr(s+2),webix.bind(i,this)):this.attachEvent(e,i)}},callEvent:function(t,e){if(this.i.l)return!0;t=t.toLowerCase(); var i=this.i[t.toLowerCase()],s=!0;if(i)for(var n=0;n=0&&this.splice(t,e||1)},remove:function(t){this.removeAt(this.find(t))},insertAt:function(t,e){ if(e||0===e){var i=this.splice(e,this.length-e);this[e]=t,this.push.apply(this,i)}else this.push(t)},find:function(t){for(var e=0;e-1){webix.env.cssPrefix=n[i];var o=webix.env.jsPrefix=s[i];webix.env.transform=o?o+"Transform":"transform",webix.env.transition=o?o+"Transition":"transition",webix.env.transitionDuration=o?o+"TransitionDuration":"transitionDuration", a.style[webix.env.transform]="translate3d(0,0,0)",webix.env.translate=a.style[webix.env.transform]?"translate3d":"translate",webix.env.transitionEnd="-Moz-"==webix.env.cssPrefix?"transitionend":o?o+"TransitionEnd":"transitionend"}webix.env.pointerevents=!webix.env.isIE||null!==new RegExp("Trident/.*rv:11").exec(t); }(),webix.env.svg=function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),webix.env.svganimation=function(){return document.implementation.hasFeature("https://www.w3.org/TR/SVG11/feature#SVG-animation","1.1")}(),webix.html={m:0,ky:{},denySelect:function(){ webix.m||(webix.m=document.onselectstart),document.onselectstart=webix.html.stopEvent},allowSelect:function(){0!==webix.m&&(document.onselectstart=webix.m||null),webix.m=0},index:function(t){for(var e=0;t=t.previousSibling;)e++;return e},n:{},createCss:function(t,e){var i="";e=e||"";for(var s in t)i+=s+":"+t[s]+";"; var n=this.n[i+e];return n||(n="s"+webix.uid(),this.addStyle("."+n+(e||"")+"{"+i+"}"),this.n[i+e]=n),n},addStyle:function(t,e){var i=e?this.ky[e]:this.ky["default"];i||(i=document.createElement("style"),i.setAttribute("type","text/css"),i.setAttribute("media","screen,print"),document.getElementsByTagName("head")[0].appendChild(i), e?this.ky[e]=i:this.ky["default"]=i),i.styleSheet?i.styleSheet.cssText+=t:i.appendChild(document.createTextNode(t))},removeStyle:function(t){var e=this.ky[t||"default"];e&&(e.innerHTML="")},create:function(t,e,i){e=e||{};var s=document.createElement(t);for(var n in e)s.setAttribute(n,e[n]);return e.style&&(s.style.cssText=e.style), e["class"]&&(s.className=e["class"]),i&&(s.innerHTML=i),s},getValue:function(t){return t=webix.toNode(t),t?webix.isUndefined(t.value)?t.innerHTML:t.value:""},remove:function(t){if(t instanceof Array)for(var e=0;e":">",'"':""","'":"'","`":"`"},r=/[&<>"'`]/g,h=function(t){return a[t]||"&"};webix.template=function(a){if("function"==typeof a)return a;if(t[a])return t[a];if(a=(a||"").toString(),-1!=a.indexOf("->")){var r=a.split("->");switch(r[0]){case"html":a=webix.html.getValue(r[1]); break;case"http":a=(new webix.ajax).sync().get(r[1],{uid:webix.uid()}).responseText}}if(a=(a||"").toString(),webix.env.strict){if(!e[a]){e[a]=[];var h=[];if(a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,function(t,e,i,s,n){h.push({pos:n,str:t,fn:function(t,n){return t[e]?i:s}})}),a.replace(/\{common\.([^}\(]*)\}/g,function(t,e,i){ h.push({pos:i,str:t,fn:function(t,i){return i[e]||""}})}),a.replace(/\{common\.([^\}\(]*)\(\)\}/g,function(t,e,i){h.push({pos:i,str:t,fn:function(t,i){return i[e]?i[e].apply(this,arguments):""}})}),a.replace(/\{obj\.([^:}]*)\}/g,function(t,e,i){h.push({pos:i,str:t,fn:function(t,i){return t[e]}})}),a.replace("{obj}",function(t,e,i){ h.push({pos:i,str:t,fn:function(t,e){return t}})}),a.replace(/#([^#'";, ]+)#/gi,function(t,e,i){"!"==e.charAt(0)?(e=e.substr(1),h.push({pos:i,str:t,fn:function(t,i){return-1!=e.indexOf(".")&&(t=webix.CodeParser.collapseNames(t)),webix.template.escape(t[e])}})):h.push({pos:i,str:t,fn:function(t,i){return-1!=e.indexOf(".")&&(t=webix.CodeParser.collapseNames(t)), t[e]}})}),h.sort(function(t,e){return t.pos>e.pos?1:-1}),h.length){for(var o=0,l=function(t,i,s){e[t].push(function(){return t.slice(i,s)})},c=0;c")){ var e=t.split("->");return webix.proxy(e[0],e[1])}return t},webix.proxy.post={$proxy:!0,load:function(t,e,i){i=webix.extend(i||{},this.params||{},!0),webix.ajax().bind(t).post(this.source,i,e)}},webix.proxy.sync={$proxy:!0,load:function(t,e){webix.ajax().sync().bind(t).get(this.source,null,e)}},webix.proxy.connector={ $proxy:!0,connectorName:"!nativeeditor_status",load:function(t,e){webix.ajax(this.source,e,t)},saveAll:function(t,e,i,s){for(var n=this.source,a={},r=[],h=0;h=400||0===r.status;"blob"==r.responseType||"arraybuffer"==r.responseType?(t="",e=r.response):(t=r.responseText||"",e=p.J(r)),webix.ajax.$callback(s,i,t,e,r,a)}p&&(p.master=null),i=p=n=null}},this.qh&&(r.timeout=this.qh),this.H?r.send(e||null):setTimeout(function(){r.aborted||(-1!=webix.ly.find(r)?webix.ly.remove(r):r.send(e||null)); },1),this.master&&this.master.Ve&&this.master.Ve.push(r),this.H?r:a}},J:function(t){return{xml:function(){try{return webix.DataDriver.xml.tagToObject(webix.DataDriver.xml.toObject(t.responseText,this))}catch(e){}},rawxml:function(){return window.XPathResult?t.responseXML:webix.DataDriver.xml.fromString(t.responseText); },text:function(){return t.responseText},json:function(){return webix.DataDriver.json.toObject(t.responseText,!1)}}},get:function(t,e,i){return this.G(t,e,i,"GET")},post:function(t,e,i){return this.G(t,e,i,"POST")},put:function(t,e,i){return this.G(t,e,i,"PUT")},del:function(t,e,i){return this.G(t,e,i,"DELETE"); },patch:function(t,e,i){return this.G(t,e,i,"PATCH")},sync:function(){return this.H=!0,this},timeout:function(t){return this.qh=t,this},response:function(t){return this.Tw=t,this},header:function(t){return this.I=t,this},headers:function(t){return this.I=webix.extend(this.I||{},t),this},bind:function(t){ return this.master=t,this}},webix.ajax.$callback=function(t,e,i,s,n,a){if(!t.$destructed){if(-1===n&&s&&"function"==typeof s.json&&(s=s.json()),a&&webix.callEvent("onAjaxError",[n]),webix.isArray(e)||(e=[e]),!a)for(var r=0;rs&&(e.value=e.value||this.nodeValue(t))}return e},nodeValue:function(t){return t.firstChild?t.firstChild.wholeText||t.firstChild.data:""},fromString:function(t){try{if(window.DOMParser)return(new DOMParser).parseFromString(t,"text/xml");if(window.ActiveXObject){var e=new ActiveXObject("Microsoft.xmlDOM"); return e.loadXML(t),e}}catch(i){return null}}},webix.BaseBind={bind:function(t,e,i){this.attachEvent||webix.extend(this,webix.EventSystem),"string"==typeof t&&(t=webix.$$(t)),t.W&&t.W(),this.W&&this.W(),t.getBindData||webix.extend(t,webix.BindSource),this.X(),t.addBind(this.s.id,e,i),this.Os=t.s.id;var s=this.s.id; this.Ps=this.attachEvent(this.touchable?"onAfterRender":"onBindRequest",function(){return t.getBindData(s)}),this.refresh&&this.isVisible(this.s.id)&&this.refresh()},unbind:function(){if(this.Os){var t=webix.$$(this.Os);t&&t.removeBind(this.s.id),this.detachEvent(this.Ps),this.Os=null}},X:function(){ var t=this.s;if(this.filter){var e=t.id;this.data.Y=webix.bind(function(){webix.$$(this.Os).Z[e]=!1},this)}var i=this.render;this.render=function(){if(!this.$){this.$=!0;var t=this.callEvent("onBindRequest");return this.$=!1,i.apply(this,t===!1?arguments:[])}},(this.getValue||this.getValues)&&(this.save=function(t){ var e=webix.$$(this.Os);if(t)e.setBindData(t);else{if(this.validate&&!this.validate())return!1;var i=this.getValue?this.getValue:this.getValues();e.setBindData(i,this.s.id),this.setDirty&&this.setDirty(!1)}}),this.X=function(){}}},webix.BindSource={$init:function(){this.bb={},this.Z={},this.cb={},this.db(this); },saveBatch:function(t){this.eb=!0,t.call(this),this.eb=!1,this.fb()},setBindData:function(t,e){if(e&&(this.cb[e]=!0),this.setValue)this.setValue(t);else if(this.setValues)this.setValues(t);else{var i=this.getCursor();i?this.updateItem(i,t):this.add(t)}this.callEvent("onBindUpdate",[t,e]),this.save&&this.save(), e&&(this.cb[e]=!1)},getBindData:function(t,e){if(this.Z[t])return!1;var i=webix.$$(t);i.isVisible(i.s.id)&&(this.Z[t]=!0,this.gb(i,this.bb[t][0],this.bb[t][1]),e&&i.filter&&i.refresh())},addBind:function(t,e,i){this.bb[t]=[e,i]},removeBind:function(t){delete this.bb[t],delete this.Z[t],delete this.cb[t]; },db:function(t){t.filter?webix.extend(this,webix.CollectionBind):t.setValue?webix.extend(this,webix.ValueBind):webix.extend(this,webix.RecordBind)},fb:function(){if(!this.eb)for(var t in this.bb)this.cb[t]||(this.Z[t]=!1,this.getBindData(t,!0))},hb:function(t,e,i){t.setValue?t.setValue(i&&e?i[e]:i):t.filter?t.data.silent(function(){ this.filter(e,i)}):!i&&t.clear?t.clear():t.O(i)&&t.setValues(webix.clone(i)),t.callEvent("onBindApply",[i,e,this])}},webix.DataValue=webix.proto({name:"DataValue",isVisible:function(){return!0},$init:function(t){(!t||webix.isUndefined(t.value))&&(this.data=t||"");var e=t&&t.id?t.id:webix.uid();this.s={ id:e},webix.ui.views[e]=this},setValue:function(t){this.data=t,this.callEvent("onChange",[t])},getValue:function(){return this.data},refresh:function(){this.callEvent("onBindRequest")}},webix.EventSystem,webix.BaseBind),webix.DataRecord=webix.proto({name:"DataRecord",isVisible:function(){return!0},$init:function(t){ this.data=t||{};var e=t&&t.id?t.id:webix.uid();this.s={id:e},webix.ui.views[e]=this},getValues:function(){return this.data},setValues:function(t,e){this.data=e?webix.extend(this.data,t,!0):t,this.callEvent("onChange",[t])},refresh:function(){this.callEvent("onBindRequest")}},webix.EventSystem,webix.BaseBind,webix.AtomDataLoader,webix.Settings), webix.ValueBind={$init:function(){this.attachEvent("onChange",this.fb)},gb:function(t,e,i){e=e||"value";var s=this.getValue()||"";if(i&&(s=i(s)),t.setValue)t.setValue(s);else if(t.filter)t.data.silent(function(){this.filter(e,s)});else{var n={};n[e]=s,t.O(s)&&t.setValues(n)}t.callEvent("onBindApply",[s,e,this]); }},webix.RecordBind={$init:function(){this.attachEvent("onChange",this.fb)},gb:function(t,e,i){var s=this.getValues()||null;i&&(s=i(s)),this.hb(t,e,s)}},webix.CollectionBind={$init:function(){this.ib=null,this.attachEvent("onSelectChange",function(t){var e=this.getSelectedId();this.setCursor(e?e.id||e:null); }),this.attachEvent("onAfterCursorChange",this.fb),this.attachEvent("onAfterDelete",function(t){t==this.getCursor()&&this.setCursor(null)}),this.data.attachEvent("onStoreUpdated",webix.bind(function(t,e,i){t&&t==this.getCursor()&&"paint"!=i&&"delete"!=i&&this.fb()},this)),this.data.attachEvent("onClearAll",webix.bind(function(){ this.ib=null},this)),this.data.attachEvent("onIdChange",webix.bind(function(t,e){this.ib==t&&(this.ib=e,this.fb())},this))},refreshCursor:function(){this.ib&&this.callEvent("onAfterCursorChange",[this.ib])},setCursor:function(t){t==this.ib||null!==t&&!this.getItem(t)||(this.callEvent("onBeforeCursorChange",[this.ib]), this.ib=t,this.callEvent("onAfterCursorChange",[t]))},getCursor:function(){return this.ib},gb:function(t,e,i){if("$level"==e&&this.data.getBranch)return(t.data||t).importData(this.data.getBranch(this.getCursor()));var s=this.getItem(this.getCursor())||this.s.defaultData||null;"$data"==e?("function"==typeof i?i.call(t,s,this):t.data.importData(s?s[i]:[]), t.callEvent("onBindApply",[s,e,this])):(i&&(s=i(s)),this.hb(t,e,s))}},webix.AtomRender={jb:function(t){return t.$empty?"":this.s.template(t,this)},render:function(){var t=this.s;return this.isVisible(t.id)?((!this.callEvent||this.callEvent("onBeforeRender",[this.data]))&&(this.data&&!t.content&&(this.y.innerHTML="", this.y.innerHTML=this.jb(this.data)),this.callEvent&&this.callEvent("onAfterRender",[])),!0):!1},sync:function(t){this.kb=!1,"DataStore"!=t.name&&(t.data&&"DataStore"==t.name?t=t.data:this.kb=!0),this.kb?t.bind("change",webix.bind(function(t){t.id==this.data.id&&(this.data=t.attributes,this.refresh()); },this)):t.attachEvent("onStoreUpdated",webix.bind(function(e){e&&e!=this.data.id||(this.data=t.pull[e],this.refresh())},this))},template_setter:webix.template},webix.SingleRender=webix.proto({template_setter:function(t){this.type.template=webix.template(t)},jb:function(t){var e=this.type;return(e.templateStart?e.templateStart(t,e):"")+e.template(t,e)+(e.templateEnd?e.templateEnd(t,e):""); },customize:function(t){webix.type(this,t)}},webix.AtomRender),webix.UIManager={A:null,lb:{},mb:0,XE:0,lH:0,nb:{enter:13,tab:9,esc:27,escape:27,up:38,down:40,left:37,right:39,pgdown:34,pagedown:34,pgup:33,pageup:33,end:35,home:36,insert:45,"delete":46,backspace:8,space:32,meta:91,win:91,mac:91,multiply:106, add:107,subtract:109,decimal:110,divide:111,scrollock:145,pausebreak:19,numlock:144,"5numlocked":12,shift:16,capslock:20},wD:{input:1,button:1,textarea:1,select:1},ob:function(){webix.event(document.body,"click",webix.bind(this.pb,this)),webix.event(document,"keydown",webix.bind(this.qb,this)),webix.UE(document.body,"mousedown",webix.bind(function(){ this.lH=new Date},this)),document.body.addEventListener&&webix.event(document.body,"focus",this.rb,{capture:!0,bind:this}),webix.destructors.push({obj:this})},destructor:function(){webix.UIManager.A=null},getFocus:function(){return this.A},sb:function(t){this.tb=this.tb||t.s.id},setFocus:function(t,e){ return t=webix.$$(t),t&&!t.$view&&(t=null),this.mb=webix.mb=new Date,this.A===t?!0:(this.A&&this.A.callEvent&&this.A.callEvent("onBlur",[this.A]),t&&t.callEvent&&t.callEvent("onFocus",[t,this.A]),webix.callEvent("onFocusChange",[t,this.A]),this.A&&this.A.blur&&!e&&this.A.blur(),this.A=t,t&&t.focus&&!e&&t.focus(), !0)},applyChanges:function(t){var e=this.getFocus();e&&e!=t&&e.Xy&&e.Xy(t)},hasFocus:function(t){return t===this.A?!0:!1},ub:function(t,e){var i=webix.html.locate(t,"view_id")||this.tb;return i=webix.$$(i),this.tb=null,webix.mb=new Date,i!=this.A?(e||(this.tb=null),i?(i=webix.$$(i),this.canFocus(i)&&(i.getNode&&i.getNode(t), this.setFocus(i))):e||this.setFocus(null),!0):void 0},pb:function(t){return new Date-this.mb<100?(this.tb=null,!1):this.ub(t)},rb:function(t){return this.wD[t.target.nodeName.toLowerCase()]?this.ub(t,!0):!1},canFocus:function(t){return t.isVisible()&&t.isEnabled()},vb:function(t){var e=this.getFocus(); return t&&!this.wb(t,e)?!1:void(this.xb("getPrev",t)||(this.A=null))},Xz:{},wb:function(t,e){if(!t)return!1;if(!e)return!1;for(;e;){if(e===t)return!0;e=e.getParentView()}return!1},yb:function(){this&&this.callEvent&&this.callEvent("onTimedKeyPress",[])},BA:function(t){return 112>t&&t>105},qb:function(t){ var e=t.which||t.keyCode;e>95&&106>e&&(e-=48),e=this.Xz[e]||e;var i=t.ctrlKey,s=t.shiftKey,n=t.altKey,a=t.metaKey,r=this.zb(e,i,s,n,a),h=this.getFocus();h&&h.callEvent&&(h.callEvent("onKeyPress",[e,t])===!1&&webix.html.preventEvent(t),h.hasEvent("onTimedKeyPress")&&(clearTimeout(h.Ab),h.Ab=webix.delay(this.yb,h,[],h.s.keyPressTimeout||250))), this.BA(e)||(r=this.zb(String.fromCharCode(e),i,s,n,a));var o=!i&&!n&&!a&&9!=e&&27!=e&&13!=e;return this.Bb(r,o,t)===!1?(webix.html.preventEvent(t),!1):void 0},xb:function(t){if(!this.getFocus())return null;t=t||"getNext";for(var e=this.getFocus(),i=e,s=webix.uid();;){if(e=this[t](e),e&&this.canFocus(e))return this.setFocus(e); if(e===i||e.$fmarker==s)return null;e.$fmarker=s}},WE:function(t,e){var i=!e.shiftKey;if(webix.UIManager.XE=new Date,t&&t.Gb&&!t.Gb(i,e))return!1;if(t&&t.Eb){if(t.editNext)return t.editNext(i);if(t.editStop)return t.editStop(),!0}else webix.delay(function(){webix.UIManager.setFocus(webix.$$(document.activeElement),!0); },1)},getTop:function(t){for(var e,i=webix.$$(t);i&&(e=i.getParentView());)i=e;return i},getNext:function(t,e){var i=t.getChildViews();if(i.length&&!e)return i[0];var s=t.getParentView();if(!s)return t;var n=s.getChildViews();if(n.length)for(var a=webix.PowerArray.find.call(n,t)+1;a=0;){if(this.canFocus(n[a]))return this.getPrev(n[a],!0); a--}return s},addHotKey:function(t,e,i){var s=this.Cb(t);i||(i=null),s.handler=e,s.view=i;var n=this.zb(s.letter,s.ctrl,s.shift,s.alt,s.meta);return this.lb[n]||(this.lb[n]=[]),this.lb[n].push(s),t},removeHotKey:function(t,e,i){var s=this.Cb(t),n=this.zb(s.letter,s.ctrl,s.shift,s.alt,s.meta);if(e||i){ var a=this.lb[n];if(a){for(var r=a.length-1;r>=0;r--)i&&a[r].view!==i||e&&a[r].handler!==e||a.splice(r,1);a.length||delete this.lb[n]}}else delete this.lb[n]},zb:function(t,e,i,s,n){return t+"_"+["",e?"1":"0",i?"1":"0",s?"1":"0",n?"1":"0"].join("")},Bb:function(t,e,i){var s=this.getFocus();return this.lb[t]?this.Db(this.lb[t],s,i):e&&this.lb.ANY_0000?this.Db(this.lb.ANY_0000,s,i):!0; },Db:function(t,e,i){for(var s=0;s=0;e--)delete webix.ui.views[t[e].config.id],t[e].config.id="x"+webix.uid(),webix.ui.views[t[e].config.id]=t[e], a(t[e].getChildViews())}}webix.ui.animate=function(t,e,i){var s=webix.$$(e);if(s){var n=i||{type:"slide",direction:"left"},a=s.x.cloneNode(!0),r=webix.ui(t,e);r.x.parentNode.appendChild(a);var h=webix.animate.formLine(r.x,a,n);return n.callback=function(){webix.animate.breakLine(h)},webix.animate(h,n), r}},webix.ui.animateView=function(t,e,i){if(t=webix.$$(t)){i=i||{type:"slide",direction:"left"};for(var s=function(t){var e=t.x,i=e.className,s=e.innerHTML;return"
"+s+"
"},n=[],a=0;a=0;e--)t[e].obj&&t[e].obj.resize(); webix.ui.QG=!1},webix.ui.each=function(t,e,i,s){if(t)for(var n=s?[t]:t.getChildViews(),a=0;at&&(t=i[0]),i[2]>e&&(e=i[2]),(!s||this.s.width)&&t>i[1]&&(t=i[1]), (!s||this.s.height)&&e>i[3]&&(e=i[3]),this.$setSize(t,e),webix.ED&&(webix.ED=!1,this.adjust())},resize:function(){if(!(webix.gc||webix.ui.PG||webix.ot)){var t=this.getParentView();t?t.resizeChildren?t.resizeChildren():t.resize():(this.adjust(),webix.callEvent("onResize",[]))}}},webix.Settings,webix.Destruction,webix.BaseBind,webix.UIExtension), webix.protoUI({name:"view",$init:function(t){this.hc(t)},hc:function(t){var e=webix.isUndefined(t.borderless);e&&!this.setPosition&&t.$topView&&(t.borderless=!0,e=!1),e&&this.defaults.borderless||t.borderless?t.Ob={top:!0,left:!0,bottom:!0,right:!0}:(t.Ob||(t.Ob={}),this.w.style.borderWidth="1px")},$getSize:function(t,e){ var i=this.s.Ob;i&&(t+=(i.left?0:1)+(i.right?0:1),e+=(i.top?0:1)+(i.bottom?0:1));var s=webix.ui.baseview.prototype.$getSize.call(this,t,e);return s},$setSize:function(t,e){var i=this.s.Ob;return i&&(t-=(i.left?0:1)+(i.right?0:1),e-=(i.top?0:1)+(i.bottom?0:1)),webix.ui.baseview.prototype.$setSize.call(this,t,e); }},webix.ui.baseview)}(),webix.ui.view.call(webix),webix.protoUI({name:"spacer",defaults:{borderless:!0},$init:function(){this.x.className+=" webix_spacer"}},webix.ui.view),webix.protoUI({name:"baselayout",restore:function(t,e,i){var s=this.mH(webix.copy(t),e);return i?s:void webix.ui(s.cols||s.rows,this); },mH:function(t,e){if(!t.$layout)return e.call(this,t);for(var i=t.cols||t.rows,s=0;se||e>this.q.length)&&(e=this.q.length);var n=(this.q[e]||{}).x;webix.PowerArray.insertAt.call(this.q,t,e),t.s.hidden||webix.html.insertBefore(t.x,n,this.y)}else{s=webix.$$(e),e=webix.PowerArray.find.call(this.q,s);var a=s.x.parentNode;a&&!t.s.hidden&&a.insertBefore(t.x,s.x), s.destructor(),this.q[e]=t}this.mc||this.oc(t)}this.resizeChildren(!0);var r=this.elements?this:this.getFormView();r&&r.Qs(),webix.callEvent("onReconstruct",[this])},oc:function(t){t.x.style.display="inline-block",t.x.style.verticalAlign="top"},addView:function(t,e){webix.isUndefined(e)&&(e=this.q.length); var i=this.$$?this:this.getTopParentView();i=i&&i.ui?i:webix,webix.Xb=this;var s=i.ui(t,this,e).s.id;return webix.Xb=null,s},removeView:function(t){var e;e="object"!=typeof t?webix.$$(t)||(this.$$?this.$$(t):null):t;var i=webix.PowerArray.find.call(this.q,e);if(i>=0){this.Vx&&this.Vx(i,e);var s=this.elements?this:this.getFormView(); this.q.splice(i,1),s&&webix.ui.each(e,function(t){t.name&&delete s.getCleanValues()[t.config.name]},s,!0),e.destructor(),this.resizeChildren(!0),s&&s.Qs()}webix.callEvent("onReconstruct",[this])},reconstruct:function(){this.qc=0,this.Qb(this.nc)},Fb:function(t,e,i){t.s.hidden||(t.s.hidden=!0,webix.html.remove(t.x), this.qc++,i||webix.Nb||this.resizeChildren(!0))},Lw:function(t){t.callEvent&&t.callEvent("onViewShow",[])},resizeChildren:function(){if(!webix.ui.PG&&this.lc){var t=this.getParentView();if(t)return t.resizeChildren?t.resizeChildren():t.resize();var e,i,s,n,a=this.$getSize(0,0);if(s=e=this.lc[0]||0,n=i=this.lc[1]||0, (a[1]>=1e5||a[3]>=1e5)&&this.x.parentNode&&(s=e=Math.max(a[0],this.s.width||this.x.parentNode.offsetWidth||e||0),n=i=Math.max(a[2],this.s.height||this.x.parentNode.offsetHeight||i||0)),t)this.rc(e,i);else{a[0]>e&&(s=a[0]),a[2]>i&&(n=a[2]);var r=this.x.parentNode==document.body&&!this.setPosition;!r&&e>a[1]&&(s=a[1]), !r&&i>a[3]&&(n=a[3]),this.$setSize(s,n)}webix.ED&&(webix.ED=!1,this.resizeChildren()),webix.callEvent("onResize",[])}},getChildViews:function(){return this.q},index:function(t){t.s&&(t=t.s.id);for(var e=0;ei&&(i=c[0]),c[1]a&&(a=c[2]),c[3]n&&(n=a),i>s&&(s=i),this.vc=[r,this.q.length-h,o],this.ng=[i+t,a+e];var u=webix.ui.baseview.prototype.$getSize.call(this,0,0);return u[1]>=1e5&&(u[1]=0),u[3]>=1e5&&(u[3]=0),u[0]=(u[0]||i)+t,u[1]=Math.max(u[0],(u[1]||s)+t),u[2]=(u[2]||a)+e,u[3]=Math.max(u[2],(u[3]||n)+e),!this.mc&&this.s.responsive&&(u[0]=0), u},$setSize:function(t,e){this.lc=[t,e],webix.ui.baseview.prototype.$setSize.call(this,t,e),this.rc(t,e)},wc:function(t,e,i){e=t[e],i=t[i];var s=e;if(e!=i){var n=this.xc*t[4]/this.yc;if(e>n)s=e,this.yc-=t[4],this.xc-=s;else{if(!(n>i))return-1;s=i,this.yc-=t[4],this.xc-=s}}return s},it:function(t,e){var i=webix.$$(e); "hide"!==i&&i?(i||(i=webix.ui({view:"popup",body:[{}]})),t.jt=t.s.width,t.kt=t.s.height,t.lt=i.s.id,t.s.width=0,t.s.height||(t.s.autoheight=!0),webix.ui(t,i,this.ht.length)):(t.hide(),t.lt="hide"),this.ht.push(t)},mt:function(t){var e=t.lt;if(t.lt=0,"hide"!==e&&e){t.s.width=t.jt,t.s.height=t.kt,delete t.s.autoheight; for(var i=0;this.q[i]&&this.q[i].s.responsiveCell===!1;)i++;webix.ui(t,this,i)}else t.show();this.ht.pop()},nt:function(t,e){if(webix.ot=!0,t+2*this.Dc+this.Cc*(this.q.length-1)s;s++){var n=this.q[s];if(!n.lt){if(n.s.responsiveCell!==!1){this.it(n,this.s.responsive), webix.callEvent("onResponsiveHide",[n.s.id]),webix.ED=!0;break}i=this.q.length}}else if(this.ht.length){var n=this.ht[this.ht.length-1],a="hide"==n.lt?0:n.jt,r=n.$getSize(a,0);r[0]+this.ng[0]+this.Cc+20<=t&&(this.mt(n),webix.callEvent("onResponsiveShow",[n.s.id]),webix.ED=!0)}webix.ot=!1},rc:function(t,e){ webix.gc=(webix.gc||0)+1,!this.mc&&this.s.responsive&&this.nt(t,e),this.xc=(this.mc?e:t)-this.vc[0],this.yc=this.vc[2];for(var i=t,s=e,n=[],a=0;as){n.push(a);continue}}else{var i=this.wc(r,0,1); if(0>i){n.push(a);continue}}this.q[a].$setSize(i,s)}for(var a=0;a0&&!this.Xx},Hc:function(t){if(!this.Wx()||this.s.borderless&&"space"!=this.s.type){for(var e=0;ee;e++)t[e].Ob.top=t[e].Ob.bottom=i;if(s>1){for("head"!=this.s.type&&(t[0].Ob.bottom=i);t[s-1].hidden&&s>1;)s--; s>0&&(t[s-1].Ob.top=i)}}else{for(var e=1;s-1>e;e++)t[e].Ob.left=t[e].Ob.right=i;if(s>1){for("head"!=this.s.type&&(t[0].Ob.right=i),t[s-1].Ob.left=i;s>1&&t[s-1].hidden;)s--;s>0&&(t[s-1].Ob.left=i)}}}else for(var e=0;e
", this.w=this.x,this.bd=this.w.childNodes[0],t.header||(this.bd.style.display="none"),this.cd=this.w.childNodes[0].childNodes[1],this.dd=this.w.childNodes[0].childNodes[0],this.ed=this.w.childNodes[1],this.x.className+=" webix_accordionitem",this.fd=this.gd=null,this.q=!0,this.ed.setAttribute("role","tabpanel"), this.bd.setAttribute("role","tab"),this.attachEvent("onKeyPress",this.DD)},Rb:function(){this.gd={destructor:function(){}}},Qb:function(t){this.gd.destructor(),this.gd=t,this.ed.appendChild(this.gd.x),this.resize()},ad:"webix_ai_id",getChildViews:function(){return[this.gd]},body_setter:function(t){return"object"!=typeof t&&(t={ template:t}),t.Ob={top:!0,left:!0,right:!0,bottom:!0},webix.Xb=this,this.gd=webix.ui.A(t),this.gd.$view.style.border="0px solid red",this.ed.appendChild(this.gd.x),t},header_setter:function(t){return t&&(t=webix.template(t)),t},headerAlt_setter:function(t){return t&&(t=webix.template(t)),t},$getSize:function(t,e){ var i=this.gd.$getSize(0,0),s=this.s.Ob;s&&(t+=(s.left?0:1)+(s.right?0:1),e+=(s.top?0:1)+(s.bottom?0:1));var n=0,a=webix.ui.baseview.prototype.$getSize.call(this,0,0);a[0]=(a[0]||i[0])+t,a[1]>=1e5&&(a[1]=i[1]),a[1]+=t,a[2]=(a[2]||i[2])+e;var r=a[3]<1e5;return r||(a[3]=i[3]),a[3]+=e,this.getParentView().mc?this.s.collapsed?a[2]=a[3]=this.hd():this.s.header&&(n=this.s.headerHeight):(this.s.collapsed&&(a[0]=a[1]=this.hd()), this.s.header&&(n=this.s.headerHeight)),r||(a[2]+=n,a[3]+=n),a},on_click:{webix_accordionitem_header:function(t,e){return this.id(t),!1},webix_accordionitem_header_v:function(t,e){return this.id(t),!1}},id:function(t){this.define("collapsed",!this.s.collapsed)},collapsed_setter:function(t){if(this.s.header!==!1){ var e=this.getParentView();if(e){if(t)if(e.jd(this))this.kd();else{var i=0;if(e.q.length>1)for(var s=0;s=0&&!s;i--)this.q[i].s.hidden||(this.q[i].od=!0,s=!0); },md:function(t){if(this.s.multi===!1&&this.nd!==!0)for(var e=0;ee&&(e=this.pd.length,this.pd.push(t)),e},UB:function(t){var e=webix.DragControl,i=this.VB();if(i&&i.WB){e.v||e.createDrag(t);var s=e.Gd;e.v.style.left=t.x+e.left+(s.x_offset||0)+"px", e.v.style.top=t.y+e.top+(s.y_offset||0)+"px"}},addDrag:function(t,e){t=webix.toNode(t),t.webix_drag=this.qd(e),webix.UE(t,webix.env.mouse.down,this.rd,{bind:t}),webix.UE(t,"dragstart",webix.html.preventEvent)},rd:function(t){if(webix.DragControl.sd){if(webix.DragControl.td==t)return;webix.DragControl.ud(), webix.DragControl.destroyDrag(t)}webix.DragControl.sd=this;var e=webix.env.mouse.context(t);webix.DragControl.vd=e,webix.DragControl.td=t,webix.DragControl.wd=webix.event(document.body,webix.env.mouse.move,webix.DragControl.xd),webix.DragControl.yd=webix.event(document,webix.env.mouse.up,webix.DragControl.ud), webix.html.addCss(document.body,"webix_noselect",1)},ud:function(){webix.DragControl.zd()},xd:function(t){var e=webix.env.mouse.context(t),i=webix.DragControl.VB(),s=i&&webix.env.touch&&i.WB&&!webix.Touch.qm;return s||Math.abs(e.x-webix.DragControl.vd.x)<5&&Math.abs(e.y-webix.DragControl.vd.y)<5||(webix.DragControl.zd(!0), !webix.DragControl.v&&!webix.DragControl.createDrag(webix.DragControl.td))?void 0:(webix.DragControl.sendSignal("start"),webix.DragControl.wd=webix.event(document.body,webix.env.mouse.move,webix.DragControl.Ad),webix.DragControl.yd=webix.event(document,webix.env.mouse.up,webix.DragControl.Bd),webix.DragControl.Ad(t), webix.env.touch?webix.html.preventEvent(t):void 0)},Bd:function(t){webix.DragControl.zd(),webix.DragControl.td=null,webix.DragControl.Cd&&(webix.DragControl.$drop(webix.DragControl.sd,webix.DragControl.Cd,t),webix.DragControl.$dragOut(webix.DragControl.sd,webix.DragControl.Cd,null,t)),webix.DragControl.destroyDrag(t), webix.DragControl.sendSignal("stop")},zd:function(t){this.wd=webix.eventRemove(this.wd),this.yd=webix.eventRemove(this.yd),t||webix.html.removeCss(document.body,"webix_noselect")},Ad:function(t){var e=webix.DragControl,i=webix.html.pos(t),s=webix.env.mouse.context(t),n=e.$dragPos(i,t),a=e.Gd;if(e.v.style.top=i.y+e.top+(n||!a.y_offset?0:a.y_offset)+"px", e.v.style.left=i.x+e.left+(n||!a.x_offset?0:a.x_offset)+"px",e.Ed)e.Ed=!1;else{var r=s.target=webix.env.touch?document.elementFromPoint(s.x,s.y):s.target,h=webix.env.touch?s:t;e.Fd(r,h)}return webix.html.preventEvent(t)},Fd:function(t,e){for(;t&&"BODY"!=t.tagName;){if(t.webix_drop){if(this.Cd&&(this.Cd!=t||t.webix_master)&&this.$dragOut(this.sd,this.Cd,t,e), !this.Cd||this.Cd!=t||t.webix_master)return this.Cd=null,this.Dd=this.$dragIn(webix.DragControl.sd,t,e),void(this.Dd&&(this.Cd=t));return}t=t.parentNode}this.Cd&&(this.Cd=this.Dd=this.$dragOut(this.sd,this.Cd,null,e))},sendSignal:function(t){webix.DragControl.active="start"==t},getMaster:function(t){ return this.pd[t.webix_drag||t.webix_drop]},getContext:function(){return this.Gd},getNode:function(){return this.v},createDrag:function(t){var e=webix.DragControl,i=e.sd;e.Gd={};var s,n=this.pd[i.webix_drag];if(n.$dragCreate){if(s=n.$dragCreate(i,t),!s)return!1;this.ZB(t),s.style.position="absolute"}else{ var a=e.$drag(i,t);if(e.ZB(t),!a)return!1;s=document.createElement("DIV"),s.innerHTML=a,s.className="webix_drag_zone",document.body.appendChild(s);var r=e.Gd;r.html&&webix.env.pointerevents&&(r.x_offset=-Math.round(.5*s.offsetWidth),r.y_offset=-Math.round(.75*s.offsetHeight))}return s.style.zIndex=Math.max(s.style.zIndex,webix.ui.zIndex()), webix.DragControl.Hd=webix.event(s,webix.env.mouse.move,webix.DragControl.Id),webix.DragControl.Gd.from||(webix.DragControl.Gd={source:i,from:i}),webix.DragControl.v=s,!0},Id:function(){webix.DragControl.Ed=!0},destroyDrag:function(t){var e=webix.DragControl.sd,i=this.pd[e.webix_drag];i&&i.$dragDestroy?(webix.DragControl.Hd=webix.eventRemove(webix.DragControl.Hd), webix.DragControl.v&&i.$dragDestroy(e,webix.DragControl.v,t)):webix.html.remove(webix.DragControl.v),webix.DragControl.Dd=webix.DragControl.sd=webix.DragControl.Cd=webix.DragControl.v=null},VB:function(){return webix.DragControl.pd[webix.DragControl.sd.webix_drag]},top:5,left:5,ZB:function(t){var e=webix.DragControl,i=e.vd,s=e.Gd; if("undefined"!=typeof s.x_offset&&"undefined"!=typeof s.y_offset)return null;if(s.x_offset=s.y_offset=0,webix.env.pointerevents){var n=webix.DragControl.VB();if(n.WB&&n!==this){var a=n.WB(i,t);a&&(s.x_offset=a.x-i.x,s.y_offset=a.y-i.y)}}},$dragPos:function(t,e){var i=this.pd[webix.DragControl.sd.webix_drag]; return i.$dragPos&&i!=this?(i.$dragPos(t,e,webix.DragControl.v),!0):void 0},$dragIn:function(t,e,i){var s=this.pd[e.webix_drop];return s.$dragIn&&s!=this?s.$dragIn(t,e,i):(e.className=e.className+" webix_drop_zone",e)},$dragOut:function(t,e,i,s){var n=this.pd[e.webix_drop];return n.$dragOut&&n!=this?n.$dragOut(t,e,i,s):(e.className=e.className.replace("webix_drop_zone",""), null)},$drop:function(t,e,i){var s=this.pd[e.webix_drop];return webix.DragControl.Gd.from=webix.DragControl.getMaster(t),s.$drop&&s!=this?s.$drop(t,e,i):void e.appendChild(t)},$drag:function(t,e){var i=this.pd[t.webix_drag];return i.$drag&&i!=this?i.$drag(t,e):"
"+t.innerHTML+"
"; }},webix.attachEvent("onLongTouch",function(t){webix.DragControl.sd&&webix.DragControl.UB(t)}),webix.DataMove={copy:function(t,e,i,s){s=s||{};var n=s.newId||t;i=i||this;var a=this.getItem(t);return i&&(a=i.Jd(a)),i.data.add(i.Jd(a,n),e,s.parent||0)},Kd:function(t,e,i){if(e&&t){var s=this.getIndexById(t); return s+(i==this&&i.getIndexById(e)3&&(this.$blockRender=i.$blockRender=!0);for(var a=0;a3&&(this.refresh(),i!=this&&i.refresh()))}var r=t,h=this.getItem(t);return i&&i!=this?(r=i.data.add(i.Jd(h,n),e,s.parent||0),this.data.remove(t)):(0>e&&(e=this.data.order.length-1),this.data.move(this.getIndexById(t),e),this.data.callEvent("onDataMove",[t,e,null,this.data.order[e+1]])), r}},moveUp:function(t,e){return this.move(t,this.getIndexById(t)-(e||1))},moveDown:function(t,e){return this.moveUp(t,-1*(e||1))},moveTop:function(t){return this.move(t,0)},moveBottom:function(t){return this.move(t,this.data.count()-1)},Jd:function(t,e){var i=webix.extend({},t);return i.id=!e||this.data.pull[e]?webix.uid():e, i.$template=null,this.s.externalData&&(i=this.s.externalData.call(this,i,e,t)),i}},webix.Movable={move_setter:function(t){return t&&(this.Ld=webix.clone(this.Ld),this.Ld.master=this,webix.DragControl.addDrag(this.bd?this.bd:this.$view,this.Ld)),t},Ld:{$dragCreate:function(t,e){if(this.master.config.move){ var i=webix.html.offset(t),s=webix.html.pos(e);return webix.DragControl.top=i.y-s.y,webix.DragControl.left=i.x-s.x,webix.toNode(this.master.x)}},$dragDestroy:function(t,e){var i=this.master;i.s&&(i.s.top=parseInt(e.style.top,10),i.s.left=parseInt(e.style.left,10)),webix.DragControl.top=webix.DragControl.left=5, this.master.callEvent("onViewMoveEnd",[])},$dragPos:function(t,e){this.master.callEvent("onViewMove",[t,e])}}},webix.Modality={Md:function(t){if(t){if(!this.Nd){this.Nd=webix.html.create("div",{"class":"webix_modal"});var e=this.s.zIndex||webix.ui.zIndex();this.Od=webix.Pd,webix.Pd=e,this.Nd.style.zIndex=e-1, this.x.style.zIndex=e,document.body.appendChild(this.Nd),document.body.style.overflow="hidden",webix.UE(this.Nd,"click",webix.bind(this.Vw,this))}}else if(this.Nd){webix.html.remove(this.Nd),document.body.style.overflow="";var i=this.Od;setTimeout(function(){webix.Pd=i},1),this.Nd=null}return t}},webix.protoUI({ name:"window",$init:function(t){this.x.innerHTML="
",this.w=this.x.firstChild,this.bd=this.w.childNodes[0],this.y=this.ed=this.w.childNodes[1],this.x.className+=" webix_window",this.x.setAttribute("role","dialog"), this.x.setAttribute("tabindex","0"),this.fd=this.gd=null,this.s.Ob={top:!1,left:!1,right:!1,bottom:!1},t.id||(t.id=webix.uid()),webix.UE(this.w,"click",webix.bind(this.Vw,this)),this.w.addEventListener&&webix.UE(this.w,"click",function(){!this.s.zIndex&&this.s.toFront&&(this.x.style.zIndex=webix.ui.zIndex()); },{bind:this,capture:!0}),t.modal&&(this.my=!0),this.attachEvent("onViewMoveEnd",function(){this.s.position&&delete this.s.position})},Vw:function(t){var e=webix.ui.et,i=e.find(this);-1==i&&(i=e.length-1),t.click_view=i,webix.env.isIE8&&(t.srcElement.click_view=i)},getChildViews:function(){return this.fd?[this.fd,this.gd]:[this.gd]; },zIndex_setter:function(t){return this.x.style.zIndex=t,t},Rb:function(){this.gd={destructor:function(){}}},Qb:function(t){this.gd.destructor(),this.gd=t,this.ed.appendChild(this.gd.x);var e=this.gd.x.style;e.borderTopWidth=e.borderBottomWidth=e.borderLeftWidth=e.borderRightWidth="1px",this.gd.s.Ob=webix.clone(this.s.Ob), this.resize(!0)},show:function(t,e,i){if(t===!0){if(!this.s.hidden)return;t=null}if(!this.callEvent("onBeforeShow",arguments))return!1;this.s.hidden=!1,this.x.style.zIndex=this.s.zIndex||webix.ui.zIndex(),(this.s.modal||this.my)&&(this.Md(!0),this.my=null);var s,n,a;if(e=e||{},e.pos||(e.pos=this.s.relative), t){"object"!=typeof t||t.tagName?(t=webix.toNode(t),s=webix.html.offset(t)):t.target||t.srcElement?(s=webix.html.pos(t),n=20,a=5):s=t;var r=Math.max(window.innerWidth||0,document.body.offsetWidth),h=Math.max(window.innerHeight||0,document.body.offsetHeight);n=n||t.offsetWidth||0,a=a||t.offsetHeight||0; var o=this.ac,l=s.x,c=s.y,u=0,d=0,f=0,b=0,p=this.s.autofit;if(p){var x="node"===p,w=6,g=6,v=6;i="top",c=0,l=0,f=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,r-s.x-no[0]?s.x:r+f-w-o[0],d=Math.round(s.x+n/2),d=Math.min(d,l+o[0]-3*v)),b=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,(!o[1]||h+b-a-s.y-g>o[1]||x)&&"top"!=e.pos?(c=a+s.y+g-4, u||(i="top",u=c-v)):(c=s.y-g-o[1],0>c?(c=0,"top"==i&&(i=!1)):u||(i="bottom",c--,u=c+o[1]+1))}var m=e.x||0,y=e.y||0,$=this.jG();$&&(c-=b,u-=b),this.setPosition(l+m,c+y),this.Rd&&(i&&this.s.point?this.Rd(i,d+m,u+y,$):this.Sd())}else this.Td(this.s.left,this.s.top);this.x.style.display="block",this.Ww=1, webix.delay(function(){this.Ww=0},this,[],webix.env.touch?400:100),this.Qd(),this.config.autofocus&&(this.Vd=webix.UIManager.getFocus(),webix.UIManager.setFocus(this)),-1==webix.ui.et.find(this)&&webix.ui.et.push(this),this.callEvent("onShow",[])},Fb:function(t){if(!(this.s.hidden||this.s.modal||this.Ww||t&&t.showpopup||webix.Pd&&this.s.zIndex<=webix.Pd)){ if(t){var e=webix.env.isIE8?t.srcElement.click_view:t.click_view;e||0===e||(e=-1);var i=webix.ui.et.find(this);if(e>=i)return}this.hide()}},hidden_setter:function(t){return t?this.hide():this.show(),!!t},hide:function(t){if(!this.$destructed&&(t||!this.s.hidden)){if(this.s.modal&&this.Md(!1),"top"==this.s.position?webix.animate(this.x,{ type:"slide",x:0,y:-(this.dc+20),duration:300,callback:this.Wd,master:this}):this.Wd(),this.s.autofocus){var e=document.activeElement;e&&this.x&&(this.x.contains(e)||e===document.body)&&(webix.UIManager.setFocus(this.Vd),this.Vd=null)}this.ny()}},ny:function(){var t=webix.ui.et,e=t.find(this),i=t.length-1; if(e>-1)for(var s=i;s>e;s--)t[s].Sd&&t[s].hide();t.removeAt(e)},destructor:function(){this.Md(!1),webix.html.remove(this.x),this.s.autofocus&&(webix.B||webix.UIManager.setFocus(this.Vd),this.Vd=null),this.ny(),this.Sd&&this.Sd(),webix.Destruction.destructor.apply(this,[])},Wd:function(){this.$destructed||(this.x.style.display="none", this.s.hidden=!0,this.callEvent("onHide",[]))},close:function(){this.destructor()},Xd:function(t){t.borderless=!0},body_setter:function(t){return"object"!=typeof t&&(t={template:t}),this.Xd(t),webix.Xb=this,this.gd=webix.ui.A(t),this.ed.appendChild(this.gd.x),t},head_setter:function(t){return t===!1?t:("object"!=typeof t&&(this.x.setAttribute("aria-label",t), t={template:t,padding:0}),t.borderless=!0,webix.Xb=this,this.fd=webix.ui.A(t),this.bd.appendChild(this.fd.x),t)},getBody:function(){return this.gd},getHead:function(){return this.fd},adjust:function(){return this.resize()},resizeChildren:function(){this.gd&&this.resize()},resize:function(){webix.ui.baseview.prototype.adjust.call(this), this.isVisible()&&this.Td(this.s.left,this.s.top)},jG:function(){if(this.s.master){var t=webix.$$(this.s.master).getTopParentView().$view;return t&&"fixed"===t.style.position}return!1},Td:function(t,e){if(this.s.position||this.jG()){this.$view.style.position="fixed";var i=this.bc,s=this.dc;if(0>=i||0>=s)return; var n=window.innerWidth||document.documentElement.offsetWidth,a=window.innerHeight||document.documentElement.offsetHeight,r=Math.round((n-i)/2),h=Math.round((a-s)/2);if("function"==typeof this.s.position){var o={left:r,top:h,width:i,height:s,maxWidth:n,maxHeight:a};this.s.position.call(this,o),(o.width!=i||o.height!=s)&&this.$setSize(o.width,o.height), this.setPosition(o.left,o.top)}else"top"==this.s.position&&(h=webix.animate.isSupported()?-1*s:10),this.s.position||(r=this.s.left||r,h=this.s.top||h),this.setPosition(r,h);"top"==this.s.position&&webix.animate(this.x,{type:"slide",x:0,y:s-2*(this.s.padding||0),duration:300,callback:this.Yd,master:this })}else this.setPosition(t,e)},Yd:function(t){webix.animate.clear(t),this.s.top=-(2*(this.s.padding||0)),this.setPosition(this.s.left,this.s.top)},setPosition:function(t,e){this.x.style.top=e+"px",this.x.style.left=t+"px",this.s.left=t,this.s.top=e},$getSize:function(t,e){var i=this.s.Ob;i&&(t+=(i.left?0:1)+(i.right?0:1), e+=(i.top?0:1)+(i.bottom?0:1)),this.s.head&&(e+=1);var s=this.gd.$getSize(0,0),n=0;if(this.fd){var a=this.fd.$getSize(0,0);a[3]==a[2]&&(this.s.headHeight=a[3]),e+=this.s.headHeight,n=a[0]}if(this.s.fullscreen){var r=window.innerWidth||document.body.clientWidth,h=window.innerHeight||document.body.clientHeight; return[r,r,h,h]}var o=webix.ui.view.prototype.$getSize.call(this,0,0);return n&&s[1]>1e5&&(s[0]=Math.max(n,s[0])),o[1]=Math.min(o[1],(s[1]>=1e5&&o[1]>=1e5?Math.max(s[0],o[0]):s[1])+t),o[3]=Math.min(o[3],(s[3]>=1e5&&o[3]>=1e5?Math.max(s[2],o[2]):s[3])+e),o[0]=Math.min(Math.max(o[0],s[0]+t),o[1]),o[2]=Math.min(Math.max(o[2],s[2]+e),o[3]), o},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e),t=this.bc,e=this.dc,this.s.head===!1?(this.bd.style.display="none",this.gd.$setSize(t,e)):(this.fd.$setSize(t,this.s.headHeight),this.gd.$setSize(t,e-this.s.headHeight))},$skin:function(){this.defaults.headHeight=webix.skin.$active.barHeight; },defaults:{top:0,left:0,autofit:!0,relative:"bottom",body:"",head:"",hidden:!0,autofocus:!0,minWidth:300,minHeight:200}},webix.ui.view,webix.Movable,webix.Modality,webix.EventSystem),webix.protoUI({name:"popup",defaults:{point:!0},$init:function(){this.s.head=!1,this.$view.className+=" webix_popup", webix.attachEvent("onClick",webix.bind(this.Fb,this)),this.attachEvent("onHide",this.Sd)},$skin:function(){this.defaults.headHeight=webix.skin.$active.barHeight,this.defaults.padding=webix.skin.$active.popupPadding},close:function(){webix.html.remove(this.$d),webix.ui.window.prototype.close.call(this); },$getSize:function(t,e){return webix.ui.window.prototype.$getSize.call(this,t+2*this.s.padding,e+2*this.s.padding)},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e),t=this.bc-2*this.s.padding,e=this.dc-2*this.s.padding,this.w.style.padding=this.s.padding+"px",this.bd.style.display="none", this.gd.$setSize(t,e)},Xd:function(){},head_setter:function(){},Rd:function(t,e,i,s){this.Sd(),document.body.appendChild(this.$d=webix.html.create("DIV",{"class":"webix_point_"+t},"")),this.$d.style.zIndex=webix.ui.zIndex(),this.$d.style.position=s?"fixed":"absolute",this.$d.style.top=i+"px",this.$d.style.left=e+"px"; },Sd:function(){this.$d=webix.html.remove(this.$d)}},webix.ui.window),webix.ui.et=webix.toArray(),webix.ResizeArea={resize_setter:function(t){return t&&!this.Yz&&this.Zz(),t},Zz:function(){if(!this.$z){var t=this.x;t.firstChild&&(t=t.firstChild,t.style.position="relative"),this.$z=webix.html.create("DIV",{ "class":"webix_resize_handle",webix_disable_drag:"true"}),t.appendChild(this.$z),webix.UE(this.$z,webix.env.mouse.down,this._z,{bind:this})}},aA:function(t,e){if(!this.bA){this.bA=webix.html.create("div",{"class":"webix_resize_frame"},""),document.body.appendChild(this.bA);var i=webix.html.offset(this.x); this.bA.style.left=i.x+"px",this.bA.style.top=i.y+"px",this.bA.style.zIndex=webix.ui.zIndex()}this.bA.style.width=t+"px",this.bA.style.height=e+"px"},_z:function(t){this.config.resize&&(webix.html.addCss(document.body,"webix_noselect webix_resize_cursor"),this.cA=webix.html.offset(this.x),this.dA=webix.event(document.body,webix.env.mouse.move,this.eA,{ bind:this}),this.fA=webix.event(document.body,webix.env.mouse.up,this.gA,{bind:this}))},eA:function(t){if(this.cA!==!1){var e=webix.html.pos(t),i={x:e.x-this.cA.x+10,y:e.y-this.cA.y+10};if(this.$resizeMove)this.$resizeMove(i);else if(Math.abs(this.cA.x-e.x)<(this.config.minWidth||100)||Math.abs(this.cA.y-e.y)<(this.config.minHeight||100))return; this.hA=i,this.aA(i.x,i.y)}},gA:function(){this.bA&&(this.bA=webix.html.remove(this.bA)),webix.html.removeCss(document.body,"webix_resize_cursor"),webix.html.removeCss(document.body,"webix_noselect"),webix.eventRemove(this.dA),webix.eventRemove(this.fA),this.hA&&(this.$resizeEnd?this.$resizeEnd(this.hA):(this.config.width=this.hA.x, this.config.height=this.hA.y,this.resize())),this.cA=this.hA=!1,this.callEvent("onViewResize",[])}},webix.extend(webix.ui.window,webix.ResizeArea),webix.protoUI({name:"suggest",defaults:{autofocus:!1,type:"list",keyPressTimeout:1,body:{yCount:10,autoheight:!0,body:!0,select:!0,borderless:!0,navigation:!0 },filter:function(t,e){return 0===t.value.toString().toLowerCase().indexOf(e.toLowerCase())?!0:!1}},template_setter:webix.template,filter_setter:function(t){return webix.toFunctor(t,this.$scope)},$init:function(t){var e={};webix.extend(e,webix.copy(this.defaults.body)),e.view=t.type||this.defaults.type; var i=this.Jt(e);t.body&&webix.extend(i,t.body,!0),t.data&&(i.data=t.data),t.url&&(i.url=t.url),t.datatype&&(i.datatype=t.datatype),t.id&&(e.id=e.id||t.id+"_"+e.view),t.body=e,this.$ready.push(this._d),this.attachEvent("onShow",function(){if(this.s.master){var t=webix.$$(this.s.master);if(t){var e=t.JA?t.JA():t.getInputNode(); e.setAttribute("aria-expanded","true")}}this.ke()}),this.attachEvent("onHide",function(){if(this.s.master){var t=webix.$$(this.s.master);if(t){var e=t.JA?t.JA():t.getInputNode();e.setAttribute("aria-expanded","false")}}}),this.oy={}},Jt:function(t){return t},Rs:function(t){var e,i,s="";t&&this.s.master&&(e=webix.$$(this.s.master), i=e.getInputNode(),i&&e.$setValueHere?e.$setValueHere(t.value):i&&(e.options_setter?s=this.getItemText(t.id):t.value&&(s=e.YE?e.YE(t.value):t.value.toString()),webix.isUndefined(i.value)?i.innerHTML=s:i.value=s.replace(/<[^>]*>/g,""))),i=i||this.ae,i&&i.focus()},setMasterValue:function(t,e){var i=t.id?this.getItemText(t.id):t.text||t.value; if(this.s.master){var s=webix.$$(this.s.master);e&&t.id?s.refresh():s.options_setter?s.setValue(t.$empty?"":t.id):s.setValueHere?s.setValueHere(i):s.setValue(i)}else this.ae&&(this.ae.value=i);e||(this.hide(!0),this.ae&&this.ae.focus()),this.callEvent("onValueSuggest",[t,i]),webix.delay(function(){webix.callEvent("onEditEnd",[]); })},getMasterValue:function(){return this.s.master?webix.$$(this.s.master).getValue():null},getItemId:function(t){var e=this.getList();e.type;for(var i in e.data.pull){var s=e.getItem(i);if(this.s.filter.call(this,s,t))return s.id}},getItemText:function(t){var e=this.getList().getItem(t);if(!e)return this.oy[t]||""; if(this.s.template)return this.s.template.call(this,e,this.type);if(this.s.textValue)return""+e[this.s.textValue];var i=this.getList().type,s=i.template.call(i,e,i);return this.oy[t]=s},getSuggestion:function(t){var e,i=this.getList(),s=i.data.order;return i.getSelectedId&&(e=i.getSelectedId()),t&&s.length&&(!e||s.find(e)<0)&&(e=s[0], !i.config.dataFeed&&!this.config.filter.call(this,i.data.pull[e],t))?null:(e&&"object"==typeof e&&(e+=""),e)},getList:function(){return this.gd},_d:function(){var t=this.getList(),e=this.s.type;t.count?(t.attachEvent("onItemClick",webix.bind(function(e){this.setMasterValue(t.getItem(e))},this)),t.data.attachEvent("onstoreupdated",webix.bind(function(t,e,i){ "delete"==i&&t==this.getMasterValue()?this.setMasterValue({id:"",text:""},1):"update"==i&&t==this.getMasterValue()&&this.setMasterValue(e,1)},this)),t.data.attachEvent("onAfterFilter",webix.bind(this.be,this)),t.data.attachEvent("onStoreLoad",webix.bind(this.be,this)),webix.isUndefined(this.s.fitMaster)&&(this.s.fitMaster=!0)):"calendar"==e?(t.attachEvent("onDateSelect",function(e){ this.getParentView().setMasterValue({value:t.getSelectedDate()},t.config.multiselect)}),t.attachEvent("onTodaySet",function(t){this.getParentView().setMasterValue({value:t})}),t.attachEvent("onDateClear",function(t){this.getParentView().setMasterValue({value:t})})):"colorboard"==e&&t.attachEvent("onItemClick",function(t){ this.getParentView().setMasterValue({value:t})})},input_setter:function(t){return this.linkInput(t),0},linkInput:function(t){var e;t.getInputNode?(e=t.getInputNode(),e.webix_master_id=t.s.id):e=webix.toNode(t),webix.UE(e,"keydown",function(i){e==document.body&&!this.isVisible()||(t.config?t.config.readonly:e.getAttribute("readonly"))||this.ce(i); },{bind:this}),t.JA&&(e=t.JA()),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-expanded","false"),"DIV"===e.tagName&&(e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true")),this.pt=!0},ce:function(t){t=t||event;var e=this.getList(),i=t.target||t.srcElement;if((i!=document.body||this.isVisible())&&"webix_clipbuffer"!=i.className){ this.ae=i,this.s.master=i.webix_master_id,window.clearTimeout(this.de);var s=t.keyCode;if(16!=s&&17!=s)return 9==s?this.ee(this,e):27==s?this.fe(this,e):13==s?this.$enterKey(this,e):this.he(t)?(webix.html.preventEvent(t),!1):void(webix.isUndefined(i.value)||(clearTimeout(this.dt),this.dt=webix.delay(function(){ if(this.pt||webix.UIManager.getFocus()==webix.$$(this.s.master)){this.ie=!0;var t=i.value;e.config.dataFeed?e.filter("value",t):e.filter&&e.filter(webix.bind(function(e){return this.s.filter.call(this,e,t)},this))}},this,[],this.s.keyPressTimeout)))}},be:function(){if(!this.ie)return!0;this.ie=!1;var t=this.getList(); t.count()>0?(this.adjust(),this.isVisible()||(this.je=!0),this.show(this.ae,null,!0),this.je=!1):(this.hide(!0),this.ae=null)},show:function(t){if(!this.isVisible()){var e=this.getList();e.filter&&!this.je&&e.filter(""),this.$customWidth&&(this.s.fitMaster||!this.s.width||webix.isUndefined(this.s.fitMaster))&&this.$customWidth(t), t.tagName&&this.s.fitMaster&&(this.s.width=t.offsetWidth-2),e.Np&&e.render(),this.adjust(),"INPUT"==t.tagName&&(this.ae=t)}webix.ui.popup.prototype.show.apply(this,arguments)},ke:function(t){t=t||this.getList();var e=this.getMasterValue();t.select&&t.showItem?e&&t.exists&&t.exists(e)?(t.select(e),t.showItem(e)):(t.unselect(), t.showItem(t.getFirstId())):t.setValue&&(this.s.master&&(e=webix.$$(this.s.master).$prepareValue(e)),t.setValue(e))},$enterKey:function(t,e){var i;t.isVisible()?(e.count&&e.count()?(i=e.getSelectedId(!1,!0),1==e.count()&&e.getFirstId()!=i&&(i=e.getFirstId()),i&&(i=e.getItem(i))):e.getSelectedDate&&e.getSelectedDate()?i={ value:e.getSelectedDate()}:e.getValue&&e.getValue()&&(i={value:e.getValue()}),i&&this.setMasterValue(i),t.hide(!0)):t.show(this.ae)},fe:function(t,e){return t.hide(!0)},ee:function(t,e){return t.hide(!0)},he:function(t){var e,i=this.getList(),s=t.keyCode;if(i.moveSelection&&41>s&&s>32&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey&&!t.altKey){ if(40===s){var n=this.isVisible();n||this.show(this.ae),i.moveSelection("down",!1,!1)}else{if(i.count&&38!==s||!i.count&&!i.isVisible())return!1;var a;33==s&&(a="pgup"),34==s&&(a="pgdown"),35==s&&(a="bottom"),36==s&&(a="top"),37==s&&(a="left"),38==s&&(a="up"),39==s&&(a="right"),i.moveSelection(a,!1,!1); }return i.count?e=i.getSelectedItem():i.getSelectedDate?e={value:i.getVisibleDate()}:i.getValue&&(e={value:i.getValue()}),this.Rs(e),!0}return!1},getValue:function(){var t=this.getList(),e=(t.getValue?t.getValue():t.getSelectedId())||"";if(e=e.id||e,t.getItem){var i=t.getItem(e);if(i&&i.$empty)return""; }return e},setValue:function(t){var e=this.getList();t?e.exists(t)&&(e.select(t),e.showItem(t)):(e.unselect(),e.showItem(e.getFirstId()))}},webix.ui.popup),webix.HTMLOptions={$init:function(t){(webix.skin.$active.customRadio||this.addOption)&&webix.UE(this.$view,"keydown",this.ID,{bind:this})},ub:function(){ if(!this.s.disabled&&!this.queryView({disabled:!0},"parent")){var t=this.Ie();if(t)for(var e=0;ei&&41>e){webix.html.preventEvent(t);var s,n=this.Ie();if(35==e)s=n.length-1;else if(36===e)s=0;else for(var a=37===e||38===e?-1:1,r=0;rs?s=n.length-1:s>=n.length&&(s=0);break}if(!webix.isUndefined(s)){var h=n[s].getAttribute("button_id"); this.setValue(h),n[s].focus()}}}},webix.attachEvent("onClick",function(t){var e=webix.$$(t);if(e&&e.touchable){webix.UIManager.applyChanges(e),e.getNode(t);var i=t.target||t.srcElement;if("webix_disabled"==i.className)return;var s="";if(i.className&&0===i.className.toString().indexOf("webix_view"))return; for(e&&webix.UIManager.sb(e);i&&i.parentNode;){if(i.getAttribute){if(i.getAttribute("view_id"))break;if(s=i.className){s=s.toString().split(" ");for(var n=0;n",""+t.badge+"")), "
"+i+"
"},label:"",borderless:!0},$renderInput:function(t){var e="class='webixtype_"+(t.type||"base")+"' ";return""; },$init:function(t){this.x.className+=" webix_control webix_el_"+(this.$cssName||this.name),this.data=this.s,this.y=this.x,this.$B(t)},hotkey_setter:function(t){var e=this;this.Bt(t,function(t,i){if(e.isVisible()){var s=e.$view.firstChild;webix.html.triggerEvent(s,"MouseEvents","click"),webix.html.preventEvent(i); }})},Bt:function(t,e,i){var s=webix.UIManager.addHotKey(t,e,i);this.attachEvent("onDestruct",function(){webix.UIManager.removeHotKey(s,e,i)})},tooltip_setter:function(t){var e=this.re()||this.$view.firstChild;return e&&(e.title=t),t},type_setter:function(t){return this.ne[t]&&(this.$renderInput=webix.template(this.ne[t])), "prev"==t||"next"==t?this.oe=this.pe:this.oe=!1,t},ne:{htmlbutton:"",prev:"
",next:"
", imageButton:"",imageButtonTop:"", image:"",imageTop:"", icon:"",iconButton:"", iconTop:"",iconButtonTop:"" },qe:function(){for(var t=[],e=["input","select","textarea","button"],i=0;i=0)return this.y.childNodes[t]; return null},ue:Math.sqrt(2),pe:function(){var t=this.s,e=this.re().childNodes[1],i=e.previousSibling,s="next"==t.type?"right":"left",n=t.aheight-2*webix.skin.$active.inputPadding-2*this.ZE,a=n*this.ue/2;e.style.width=a+"px",e.style.height=a+"px",e.style.top=(n-a)/2+webix.skin.$active.inputPadding+"px", e.style[s]=(n-a)/2+this.ue/2+"px",i.style.width=t.awidth-n/2-2+"px",i.style.height=n+2+"px",i.style[s]=n/2+2+"px",i.style.top=webix.skin.$active.inputPadding+"px"},$B:function(t){t=t||this.s,t.autowidth&&(t.width=webix.html.getTextSize(t.value||t.label||"","webixbutton").width+(t.badge?15:0)+("iconButton"===t.type?30:0)+("icon"===t.type?20:0)); },ve:function(){this.we=this.s.inputWidth||(this.bc-this.s.width>2?this.s.width:0)||this.bc,this.xe=this.s.inputHeight||this.zy||0},resize:function(){return this.$B(),webix.ui.view.prototype.resize.apply(this,arguments)},render:function(){if(this.ve(),this.s.awidth=this.we||this.bc,this.s.aheight=this.xe||this.dc, this.s.bheight=this.s.aheight+2,this.s.cheight=this.s.aheight-2*webix.skin.$active.inputPadding,this.s.dheight=this.s.cheight-2,webix.AtomRender.render.call(this)){if(this.se=!0,this.oe&&this.oe(),this.s.align){var t=this.y.firstChild;switch("top"==this.s.labelPosition&&t.nextSibling&&(t=t.nextSibling), this.s.align){case"right":t.style.cssFloat="right";break;case"center":t.style.display="inline-block",t.parentNode.style.textAlign="center";break;case"middle":t.style.marginTop=Math.round((this.dc-this.xe)/2)+"px";break;case"bottom":t.style.marginTop=this.dc-this.xe+"px";break;case"left":t.style.cssFloat="left"; }}this.$render&&this.$render(this.data),this.s.disabled&&this.disable(),this.s.tooltip&&this.define("tooltip",this.s.tooltip),this.ze&&(this.ze(this.data),this.ze=0)}},refresh:function(){this.render()},on_click:{Ae:function(t,e){var i=webix.html.locate(t,"button_id");i&&this.callEvent("onBeforeTabClick",[i,t])&&(this.setValue(i), this.callEvent("onAfterTabClick",[i,t]))},webix_all_segments:function(t,e){this.on_click.Ae.call(this,t,e)},webix_all_tabs:function(t,e){this.on_click.Ae.call(this,t,e)},webix_inp_counter_next:function(t,e,i){this.s.readonly||this.next()},webix_inp_counter_prev:function(t,e,i){this.s.readonly||this.prev(); },webix_input_icon:function(t,e,i){this.getInputNode().focus()},webix_inp_checkbox_border:function(t,e,i){this.s.disabled||"DIV"==(t.target||t.srcElement).tagName||this.s.readonly||this.toggle()},webix_inp_checkbox_label:function(t,e,i){this.s.readonly||this.toggle()},webix_inp_radio_border:function(t,e,i){ var s=webix.html.locate(t,"radio_id");this.setValue(s),this.focus()},webix_inp_radio_label:function(t,e,i){return i=i.parentNode.getElementsByTagName("input")[0],this.on_click.webix_inp_radio_border.call(this,i,e,i)},webix_tab_more_icon:function(t,e,i){this.getPopup().resize(),this.getPopup().show(i,null,!0); },webix_tab_close:function(t,e,i){var s=webix.html.locate(t,"button_id");s&&this.callEvent("onBeforeTabClose",[s,t])&&this.removeOption(s)}},Be:function(t){for(var e=0;e"+e+"":""}},webix.ui.view,webix.AtomRender,webix.Settings,webix.EventSystem),webix.protoUI({name:"label",defaults:{template:"
#label#
" },$skin:function(){this.defaults.height=webix.skin.$active.inputHeight},focus:function(){return!1},re:function(){return this.y.firstChild},setHTML:function(t){this.s.template=function(){return t},this.refresh()},setValue:function(t){this.s.label=t,webix.ui.button.prototype.setValue.apply(this,arguments); },$setValue:function(t){this.y.firstChild.innerHTML=t},oe:function(){},$B:function(t){t=t||this.s,t.autowidth&&(t.width=webix.html.getTextSize(t.value||t.label,"webix_el_label").width)}},webix.ui.button),webix.protoUI({name:"icon",$skin:function(){this.defaults.height=webix.skin.$active.inputHeight}, defaults:{template:function(t){return""},width:33},oe:function(){},$setValue:function(){} },webix.ui.button),webix.protoUI({name:"text",$allowsClear:!0,De:function(){this.$allowsClear&&(this._E||webix.UE(this.getInputNode(),"change",this.Xy,{bind:this}),this.s.suggest&&webix.$$(this.s.suggest).linkInput(this))},Xy:function(){var t=this.getValue();t!=this.s.value?this.setValue(t,!0):this.nH&&this.$setValue(t); },$skin:function(){this.defaults.height=webix.skin.$active.inputHeight,this.defaults.inputPadding=webix.skin.$active.inputPadding,this.$E=webix.skin.$active.inputSpacing},$init:function(t){"top"==t.labelPosition&&webix.isUndefined(t.height)&&this.defaults.height&&(t.height=this.defaults.height+this.le), this.Ns=[],this.attachEvent("onAfterRender",this.De),this.attachEvent("onBlur",function(){this._E&&this._E()})},$renderIcon:function(){var t=this.s;if(t.icon){var e=t.aheight-2*t.inputPadding,i=(e-18)/2-1,s=this.addSection?"role='button' tabindex='0' aria-label='"+webix.i18n.aria["multitext"+(t.mode||"")+"Section"]+"'":""; return""}return""},relatedView_setter:function(t){return this.attachEvent("onChange",function(){var t=this.getValue(),e=this.s.relatedAction,i=this.s.relatedView,s=webix.$$(i);if(!s){ var n=this.getTopParentView();n&&n.$$&&(s=n.$$(i))}"enable"==e?t?s.enable():s.disable():t?s.show():s.hide()}),t},validateEvent_setter:function(t){return"blur"==t&&this.attachEvent("onBlur",this.validate),"key"==t&&this.attachEvent("onTimedKeyPress",this.validate),t},validate:function(){var t=this.s.validate; !t&&this.s.required&&(t=webix.rules.isNotEmpty);var e=this.getFormView(),i=this.s.name,s=this.getValue(),n={};return n[i]=s,t&&!e.Se(t,s,n,i)?!1:!0},bottomLabel_setter:function(t){return this.s.bottomPadding||(this.s.bottomPadding=18),t},py:function(){var t=this.s.invalidMessage;return"function"==typeof t&&t.call(this), t},setBottomText:function(t,e){var i=this.s;if("undefined"!=typeof t){if(i.bottomLabel==t)return;i.bottomLabel=t}var s=(i.invalid?i.invalidMessage:"")||i.bottomLabel;s||i.bottomPadding||(i.inputHeight=0),s&&!i.bottomPadding?(this.ry=1,i.bottomPadding=i.bottomPadding||e||18,this.render(),this.resize()):!s&&this.ry?(i.bottomPadding=this.ry=0, i.height||this.render(),this.resize()):this.render()},$getSize:function(){var t=webix.ui.view.prototype.$getSize.apply(this,arguments),e=this.config.bottomPadding;return e&&(t[2]+=e,t[3]+=e),t},$setSize:function(t,e){var i=this.s;if(webix.ui.view.prototype.$setSize.call(this,t,e)){if(!t||!e)return;"top"==i.labelPosition?(i.inputHeight||(this.zy=this.dc-this.le-(this.config.bottomPadding||0)), i.labelWidth=0):i.bottomPadding&&(i.inputHeight=this.dc-this.config.bottomPadding),this.render()}},Ee:function(t){var e=(this.we||0)-(t.label?this.s.labelWidth:0)-this.$E-(t.iconWidth||0);return 0>e?0:e},Fe:function(t,e){var i="x"+webix.uid(),s=e.Ee(t),n=t.inputAlign||"left",a=(this.$renderIcon?this.$renderIcon(t):"", this.s.aheight-2*webix.skin.$active.inputPadding-2*this.ZE),r=t.text||t.value||this.Yx(t),h="
"+r+"
"; return e.$renderInput(t,h,i)},qt:function(t){var e="<"+t+(this.s.placeholder?" placeholder='"+this.s.placeholder+"' ":" ");this.s.readonly&&(e+="readonly='true' aria-readonly=''"),this.s.required&&(e+="aria-required='true'"),this.s.invalid&&(e+="aria-invalid='true'");var i=this.s.attributes;if(i)for(var s in i)e+=s+"='"+i[s]+"' "; return e},$renderLabel:function(t,e){var i=t.labelAlign||"left",s="top"==this.s.labelPosition,n=s?"display:block;":"width: "+this.s.labelWidth+"px;",a="",r=s?this.le-2*this.ZE:this.s.aheight-2*this.s.inputPadding;return t.label&&(a=""), a},$renderInput:function(t,e,i){var s=t.inputAlign||"left",n="top"==t.labelPosition,a=this.Ee(t);i=i||webix.uid();var r=this.$renderLabel(t,i),h="";if(e)h+=e;else{var o=webix.template.escape(t.text||this.VC(t.value)||(0===t.value?"0":""));h+=this.qt("input")+"id='"+i+"' type='"+(t.type||this.name)+"'"+(t.editable?" role='combobox'":"")+" value='"+o+"' style='width: "+a+"px; text-align: "+s+";'"; var l=t.attributes;if(l)for(var c in l)h+=" "+c+"='"+l[c]+"'";h+=" />"}var u=this.$renderIcon?this.$renderIcon(t):"";h+=u;var d="";d=n?r+"
"+h+"
":"
"+r+h+"
"; var f=t.awidth-a-2*webix.skin.$active.inputPadding,b=(t.invalid?t.invalidMessage:"")||t.bottomLabel;return b&&(d+="
"+b+"
"), d},defaults:{template:function(t,e){return e.$renderInput(t)},label:"",labelWidth:80},type_setter:function(t){return t},oe:!1,$setValue:function(t){this.getInputNode().value=this.VC(t)},$getValue:function(){return this.VC(this.getInputNode().value,!1)},suggest_setter:function(t){if(t){if("string"==typeof t){ var e=webix.$$(t);if(e)return webix.$$(t).s.id;t={body:{url:t,dataFeed:t}}}else webix.isArray(t)?t={body:{data:this.Be(t)}}:t.body||(t.body={});webix.extend(t,{view:"suggest"});var i=webix.ui(t);return this.Ns.push(i),i.s.id}return!1}},webix.ui.button),webix.protoUI({name:"segmented",$allowsClear:!1, $init:function(){this.attachEvent("onChange",function(t){this.s.multiview&&this.aF(t)}),this.attachEvent("onAfterRender",webix.once(function(){this.s.multiview&&this.s.value&&this.aF(this.s.value)}))},aF:function(t){var e=this.getTopParentView(),i=null;e&&e.$$&&(i=e.$$(t)),i||(i=webix.$$(t)),i&&i.show&&i.show(); },defaults:{template:function(t,e){!t.options;var i=t.options;e.Be(i),i=e.yC(i);var s=e.Ee(t),n=webix.uid(),a="
",r=t.optionWidth||Math.floor(s/i.length);t.value||(t.value=i[0].id);for(var h=0;h0?1:0)+(t.value==i[h].id?" webix_selected ":"")+"' button_id='"+i[h].id+"' "+(i[h].tooltip?"title='"+i[h].tooltip+"'":"")+">",a+=i[h].value+"";return e.$renderInput(t,a+"
",n)}},Ie:function(){return this.$view.getElementsByTagName("BUTTON"); },focus:function(){this.ub()},blur:function(){this.JD()},$setValue:function(t){for(var e=this.Ie(),i=0;i=0&&webix.PowerArray.removeAt.call(s,i),this.s.value==t&&this.zC(s,i), this.refresh(),this.callEvent("onOptionRemove",[t,this.s.value])},zC:function(t,e){var i=t.length;if(i){e=Math.min(e,i-1);for(var s=e;i>s;s++)if(!t[s].hidden)return this.setValue(t[s].id);for(var s=e;s>=0;s--)if(!t[s].hidden)return this.setValue(t[s].id)}this.setValue("")},yC:function(t){for(var e=[],i=0;i"+e.$renderInput(t,e)+"";return n=n.replace(/(button)\s*(?=\w)/,"$1"+(" aria-pressed='"+(i?"true":"false")+"' "))}},oe:!1},webix.ui.button),webix.protoUI({name:"select", defaults:{template:function(t,e){var i=e.Be(t.options),s="x"+webix.uid(),n=e.qt("select")+"id='"+s+"' style='width:"+e.Ee(t)+"px;'>",a=webix.$$(i);if(a&&a.data&&a.data.each)a.data.each(function(e){n+=""+e.value+""});else for(var r=0;r"+i[r].value+""; return n+="",e.$renderInput(t,n,s)}},options_setter:function(t){if(t){if("string"==typeof t){var e=new webix.DataCollection({url:t});return e.data.attachEvent("onStoreLoad",webix.bind(this.refresh,this)),e}return t}},getInputNode:function(){return this.y.getElementsByTagName("select")[0]}},webix.ui.text), webix.protoUI({name:"textarea",defaults:{template:function(t,e){var i=t.name||t.id,s="x"+webix.uid(),n=e.qt("textarea")+"style='width:"+e.Ee(t)+"px;'";return n+=" id='"+s+"' name='"+i+"' class='webix_inp_textarea'>"+e.VC(t.value||(0===t.value?"0":""))+"",e.$renderInput(t,n,s)},height:0,minHeight:60 },$skin:function(){this.defaults.inputPadding=webix.skin.$active.inputPadding,this.$E=webix.skin.$active.inputSpacing},Dt:!0,$renderLabel:function(t,e){var i=t.labelAlign||"left",s="top"==this.s.labelPosition,n=s?"display:block;":"width: "+this.s.labelWidth+"px;",a="";s?this.le-2*this.ZE:(webix.skin.$active.inputHeight||this.s.aheight)-2*this.s.inputPadding; return t.label&&(a=""),a},getInputNode:function(){return this.y.getElementsByTagName("textarea")[0]}},webix.ui.text),webix.protoUI({name:"counter", defaults:{template:function(t,e){var i=t.value||0,s="x"+webix.uid(),n="
";return n+="", n+=e.qt("input")+" id='"+s+"' type='text' class='webix_inp_counter_value' aria-live='assertive' value='"+i+"'>",n+="
",e.$renderInput(t,n,s)},min:0,max:1/0,step:1}, $init:function(){webix.UE(this.$view,"keydown",this.LD,{bind:this})},LD:function(t){var e=t.which||t.keyCode,i=this.s,s=i.value||i.min;e>32&&41>e&&(35===e?s=i.min:36===e?s=i.max===1/0?1e6:i.max:33===e?this.next():34===e?this.prev():s+=37===e||40===e?-1:1,e>34&&s>=i.min&&s<=i.max&&this.setValue(s))},$setValue:function(t){ this.getInputNode().value=t},getInputNode:function(){return this.y.getElementsByTagName("input")[0]},getValue:function(t){return 1*webix.ui.button.prototype.getValue.apply(this,arguments)},next:function(t){t=this.s.step,this.shift(t)},prev:function(t){t=-1*this.s.step,this.shift(t)},shift:function(t){ var e=this.s.min,i=this.s.max,s=this.getValue()+t;s>=e&&i>=s&&this.setValue(s)}},webix.ui.text),webix.protoUI({name:"checkbox",defaults:{checkValue:1,uncheckValue:0,template:function(t,e){var i="x"+webix.uid(),s="";t.labelRight&&(s="",t.labelWidth&&(t.label=t.label||" ")); var n=t.checkValue==t.value,a=Math.floor((e.s.aheight-16)/2),r=e.qt("input")+"style='margin-top:"+a+"px;"+(t.customCheckbox?"display:none":"")+"' id='"+i+"' type='checkbox' "+(n?"checked='1'":"")+(t.labelRight?" aria-label='"+webix.template.escape(t.labelRight)+"'":"")+"/>",h="webix_inp_checkbox_border webix_el_group webix_checkbox_"+(n?"1":"0"),o=t.customCheckbox||""; o&&(o=o.replace(/(aria-checked=')\w*(?=')/,"$1"+(t.value==t.checkValue?"true":"false")),o=o.replace(/(aria-label=')\w*(?=')/,"$1"+webix.template.escape(t.labelRight||t.label)),o=o.replace(/(aria-invalid=')\w*(?=')/,"$1"+(t.invalid?"true":"false")));var l="
"+r+o+s+"
"; return e.$renderInput(t,l,i)}},customCheckbox_setter:function(t){return t===!0&&webix.skin.$active.customCheckbox&&(t=""), t},blur:function(){var t=this.getInputNode();t&&t.blur()},De:function(){},$setValue:function(t){var e=t==this.s.checkValue,i=this.$view.getElementsByTagName("input")[0],s=i?i.parentNode:null;if(s&&this.s.customCheckbox){var n=s.getElementsByTagName("BUTTON");n[0]&&n[0].setAttribute("aria-checked",e?"true":"false"); }s&&(s.className=s.className.replace(/(webix_checkbox_)\d/,"$1"+(e?1:0))),i.checked=e},toggle:function(){var t=this.getValue()!=this.s.checkValue?this.s.checkValue:this.s.uncheckValue;this.setValue(t)},getValue:function(){var t=this.s.value;return t==this.s.checkValue?this.s.checkValue:this.s.uncheckValue; },getInputNode:function(){return this.$view.getElementsByTagName(this.s.customCheckbox?"button":"input")[0]},$skin:function(){this.defaults.customCheckbox=!!webix.skin.$active.customCheckbox}},webix.ui.text),webix.protoUI({name:"radio",defaults:{template:function(t,e){for(var i,s=e.Be(t.options),n=[],a=0;a");var h=s[a].id==t.value,o=s[a].value||"",l=t.customRadio||"";if(l){var c=(0===a?t.label+" ":"")+o;l=l.replace(/(aria-label=')\w*(?=')/,"$1"+webix.template.escape(c)),l=l.replace(/(aria-checked=')\w*(?=')/,"$1"+(h?"true":"false")), l=l.replace(/(tabindex=')\w*(?=')/,"$1"+(h||0===a&&!t.value?"0":"-1")),l=l.replace(/(aria-invalid=')\w*(?=')/,"$1"+(t.invalid?"true":"false")),l=l.replace(/(button_id=')\w*(?=')/,"$1"+s[a].id)}var u=e.qt("input")+" name='"+(t.name||t.id)+"' type='radio' "+(h?"checked='1'":"")+"tabindex="+(h||0===a&&!t.value?"0":"-1")+" value='"+s[a].id+"' id='"+r+"' style='"+(l?"display:none":"")+"' />",d=""; o&&(o=""),n.push("")}return n="
"+n.join("")+"
",e.$renderInput(t,n,i)}},refresh:function(){ this.render(),this.ac&&this.$getSize(0,0)[2]!=this.ac[1]&&this.resize()},$getSize:function(t,e){var i=webix.ui.button.prototype.$getSize.call(this,t,e);if(this.s.options){for(var s=this.s.vertical?0:1,n=0;n"), t},$skin:function(){this.defaults.customRadio=!!webix.skin.$active.customRadio,webix.skin.$active.optionHeight&&(this.defaults.optionHeight=webix.skin.$active.optionHeight)}},webix.HTMLOptions,webix.ui.text),webix.protoUI({name:"richselect",defaults:{template:function(t,e){return e.Fe(t,e)},popupWidth:200, icon:"angle-down"},_E:function(){if(this.s.text!=this.getText()&&(!webix.isUndefined(this.s.text)||this.getText())){var t=this.getPopup(),e=this.getInputNode().value,i=t.getSuggestion(e),s=this.getValue();t.getList().getItem(i);!i||i==s||""===e&&""!==t.getItemText(i)?""===e?this.setValue(""):this.bF&&this.bF():this.setValue(i); }},suggest_setter:function(t){return this.options_setter(t)},options_setter:function(t){t=this.Kt?this.Kt(t):t;var e=this.s.popup=this.s.suggest=webix.ui.text.prototype.suggest_setter.call(this,t),i=webix.$$(e).getList();return i&&i.attachEvent("onAfterLoad",webix.bind(this.Ss,this)),e},getList:function(){ var t=webix.$$(this.s.suggest);return t.getList()},Ss:function(){var t=this.s.value;webix.isUndefined(t)||this.getPopup().isVisible()||this.s.text||!this.y.firstChild||this.$setValue(t)},$skin:function(){this.defaults.inputPadding=webix.skin.$active.inputPadding},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value); },getInputNode:function(){return this.y.getElementsByTagName("DIV")[1]},getPopup:function(){return webix.$$(this.s.popup)},getText:function(){var t=this.s.value,e=this.getInputNode();return e?"undefined"==typeof e.value?e.firstChild&&"webix_placeholder"===e.firstChild.className?"":e.innerHTML:e.value:t?this.getPopup().getItemText(t):""; },$setValue:function(t){if(this.se){var e=t,i=this.getPopup();if(i)var e=this.getPopup().getItemText(t);!e&&t&&t.id&&(this.getPopup().getList().add(t),e=this.getPopup().getItemText(t.id),this.s.value=t.id);var s=this.getInputNode();webix.isUndefined(s.value)?s.innerHTML=e||this.Yx():s.value=e=e.replace(/<[^>]*>/g,""), this.s.text=e}},getValue:function(){return this.s.value||""}},webix.ui.text),webix.protoUI({name:"combo",getInputNode:function(){return this.y.getElementsByTagName("input")[0]},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value)},bF:function(){if(!this.s.editable){var t=this.getValue(); this.$setValue(webix.isUndefined(t)?"":t)}},Xy:function(){var t=this.getInputNode(),e="",i=this.getPopup();t.value&&(e=this.s.value,i.getItemText(e)!=this.getText()&&(e=i.getSuggestion()||e)),e!=this.s.value?this.setValue(e,!0):this.$setValue(e)},defaults:{template:function(t,e){return e.$renderInput(t).replace(/( '; }},webix.ui.datepicker),webix.RenderStack={$init:function(){this.v=document.createElement("DIV"),this.data.attachEvent("onIdChange",webix.bind(this.Ke,this)),this.attachEvent("onItemClick",this.Le),this.types||(this.types={"default":this.type},this.type.name="default"),this.type=webix.clone(this.type); },customize:function(t){webix.type(this,t)},item_setter:function(t){return this.type_setter(t)},type_setter:function(t){return this.types[t]?(this.type=webix.clone(this.types[t]),this.type.css&&(this.w.className+=" "+this.type.css)):this.customize(t),this.type.on_click&&webix.extend(this.on_click,this.type.on_click), t},template_setter:function(t){this.type.template=webix.template(t)},jb:function(t){var e=this.data.Me[t.id];return this.callEvent("onItemRender",[t]),this.type.templateStart(t,this.type,e)+(t.$template?this.type["template"+t.$template]:this.type.template)(t,this.type,e)+this.type.templateEnd(t,this.type,e); },Ne:function(t){return this.v.innerHTML=this.jb(t),this.v.firstChild},Ke:function(t,e){var i=this.getItemNode(t);i&&(i.setAttribute(this.ad,e),this.t[e]=this.t[t],delete this.t[t])},Le:function(){if(this.s.click){var t=webix.toFunctor(this.s.click,this.$scope);t&&t.call&&t.apply(this,arguments)}},getItemNode:function(t){ if(this.t)return this.t[t];this.t={};for(var e=this.y.childNodes,i=0;ii||h+this.bcn||o+this.dc=0;e--)this.VA[e].id==t&&("id"==this.VA[e].action&&(t=this.VA[e].data),this.VA.removeAt(e));this.WA=this.VA.length-1; },undo:function(t){if(t)this.ignoreUndo(function(){var e,i;for(i=this.VA.length-1;!e&&i>=0;i--)this.VA[i].id==t&&(e=this.VA[i]);e&&(this.cB(e),this.VA.removeAt(i+1),this.WA=this.VA.length-1)});else{var e=this.VA[this.WA];e&&(this.ignoreUndo(function(){this.cB(e),this.VA.removeAt(this.WA)}),this.WA--); }},cB:function(t){if("delete"==t.action){var e=null,i=t.data.$parent;t.data.$branch&&(e={parent:t.id,data:webix.copy(t.data.$branch)},delete t.data.$branch,i&&!this.data.branch[i]&&(i=0)),this.add(t.data,t.data.$index,i),e&&this.parse(e)}else"add"==t.action?this.remove(t.id):"update"==t.action?this.updateItem(t.id,t.data):"move"==t.action&&(t.data.$parent?this.getItem(t.data.$parent)&&this.move(t.id,t.data.$index,null,{ parent:t.data.$parent}):this.move(t.id,t.data.$index))}},webix.DataLoader=webix.proto({$init:function(t){t=t||"",this.Ve=webix.toArray(),this.$e={},this.data=new webix.DataStore,this.data.attachEvent("onClearAll",webix.bind(this.We,this)),this.data.attachEvent("onServerConfig",webix.bind(this.Xe,this)), this.attachEvent("onDestruct",this.We),this.data.feed=this.Ye,this.data.owner=t.id},Ye:function(t,e,i){return this.Ze?this.Ze=[t,e,i]:(this.Ze=!0,this.$e.from=t,this.$e.count=e,void this._e.call(this,t,e,i))},_e:function(t,e,i,s,n){var a=null,s=s||this.data.url,r=[{success:this.af,error:this.af},i];if(0>t&&(t=0), n||(n={start:t,count:e}),this.count()&&(n["continue"]="true"),this.getState&&(a=this.getState()),s&&"string"!=typeof s)a&&(a.sort&&(n.sort=a.sort),a.filter&&(n.filter=a.filter)),this.load(s,r,n);else{s+=-1==s.indexOf("?")?"?":"&";var h=[];for(var o in n)h.push(o+"="+n[o]);if(a&&(a.sort&&h.push("sort["+a.sort.id+"]="+encodeURIComponent(a.sort.dir)), a.filter))for(var l in a.filter){var c=a.filter[l];"object"==typeof c&&(c=webix.ajax().stringify(c)),h.push("filter["+l+"]="+encodeURIComponent(c))}s+=h.join("&"),this.$e.url!==s?(this.$e.url=s,this.load(s,r)):this.Ze=!1}},af:function(){var t=this.Ze;this.Ze=!1,"object"==typeof t&&this.data.feed.apply(this,t); },load:function(t,e){var t=webix.proxy.$parse(t),i=webix.AtomDataLoader.load.apply(this,arguments);return this.data.url||(this.data.url=t),i},loadNext:function(t,e,i,s,n){var a=this.s;return a.datathrottle&&!n?(this.bf&&window.clearTimeout(this.bf),void(this.bf=webix.delay(function(){this.loadNext(t,e,i,s,!0); },this,0,a.datathrottle))):(e||0===e||(e=this.count()),t||(t=a.datafetch||this.count()),this.data.url=this.data.url||s,void(this.callEvent("onDataRequest",[e,t,i,s])&&this.data.url&&this.data.feed.call(this,e,t,i)))},cf:function(t,e){var i=this.$e;return this.Ze&&i.url&&i.from<=e&&i.count+i.from>=t+e?!0:!1; },removeMissed_setter:function(t){return this.data.ff=t},gf:function(){var t=this.s.save;t===!0&&(t=this.s.save=this.s.url);var e={master:this};t&&t.url?webix.extend(e,t):e.url=t,webix.dp(e)},save_setter:function(t){return t&&this.$ready.push(this.gf),t},scheme_setter:function(t){this.data.scheme(t)}, dataFeed_setter:function(t){return t=webix.proxy.$parse(t),this.data.attachEvent("onBeforeFilter",webix.bind(function(t,e){if("function"==typeof t)return!0;if(this.s.dataFeed&&(t||e)){t=t||"id",e&&"object"==typeof e&&(e=e.id),this.clearAll();var i=this.s.dataFeed;if("function"==typeof i){var s={};s[t]=e, i.call(this,e,s)}else if(i.$proxy){if(i.load){var n={};n[t]=e,i.load(this,{success:this.M,error:this.N},{filter:n})}}else{var a="filter["+t+"]="+encodeURIComponent(e);this.load(i+(i.indexOf("?")<0?"?":"&")+a,this.s.datatype)}return!1}},this)),t},ef:function(){if(this.s.ready&&!this.hf){var t=webix.toFunctor(this.s.ready,this.$scope); t&&webix.delay(t,this,arguments),this.callEvent&&webix.delay(this.callEvent,this,["onReady",[]]),this.hf=!0}},We:function(t){for(var e=0;ee&&(e=0)),t>e){var i=e;e=t,t=i}return this.getIndexRange(t,e)},getIndexRange:function(t,e){e=Math.min(0===e?0:e||1/0,this.count()-1);for(var i=webix.toArray(),s=t||0;e>=s;s++)i.push(this.getItem(this.order[s])); return i},count:function(){return this.order.length},exists:function(t){return!!this.pull[t]},move:function(t,e){if(t!=e){var i=this.getIdByIndex(t),s=this.getItem(i);this.jf&&this.sf(this.jf,0,0,this.getIdByIndex(t),this.getIdByIndex(e)),this.sf(this.order,t,e),this.callEvent("onStoreUpdated",[i,s,"move"]); }},sf:function(t,e,i,s,n){if(s||n){e=i=-1;for(var a=0;ae&&(e=a),t[a]==n&&0>i&&(i=a)}var r=t[e];t.removeAt(e),t.insertAt(r,Math.min(t.length,i))},scheme:function(t){this.tf={},this.uf=t.$save,this.qf=t.$init||t.$change,this.pf=t.$update||t.$change,this.vf=t.$serialize,this.lf=t.$group, this.of=t.$sort;for(var e in t)"$"!=e.substr(0,1)&&(this.tf[e]=t[e])},importData:function(t,e){var i=t?t.data||t:[];if(this.jf=null,"function"==typeof i.serialize){if(this.order=webix.toArray([].concat(i.order)),this.OF){this.OF=!1;var s=this.pull;this.pull={};for(var n in i.pull){var a=s[n];this.pull[n]=webix.copy(i.pull[n]), a&&a.open&&(this.pull[n].open=!0)}}else this.pull=i.pull;i.branch&&this.branch&&(this.branch=webix.copy(i.branch),this.Mg=null)}else{this.order=webix.toArray(),this.pull={};var r,h;if(webix.isArray(t))for(var n=0;ne)&&(e=a),e>a&&(e=Math.min(n.length,e)),this.callEvent("onBeforeAdd",[s,t,e])===!1)return!1;if(this.pull[s]=t,n.insertAt(s,e),this.jf){var r=this.jf.length;this.order.length&&(r=Math.min(e||0,r)),this.jf.insertAt(s,r)}return this.callEvent("onStoreUpdated",[s,t,"add"]),this.callEvent("onAfterAdd",[s,e]), t.id},remove:function(t){if(webix.isArray(t))for(var e=0;e=0;a--)n[a]=this.pull[e[a]];return n.sort(i),webix.toArray(s.concat(n.map(function(t){return this.id(t)},this)))}return e},Af:function(t){this.jf&&!t&&(this.order=this.jf,delete this.jf); },Bf:function(t,e,i){for(var s=webix.toArray(),n=this.$freeze||0,a=0;aa||t(this.getItem(r),e))&&s.push(r)}i&&this.jf||(this.jf=this.order),this.order=s},find:function(t,e){var i=[];for(var s in this.pull){var n=this.pull[s],a=!0;if("object"==typeof t){for(var r in t)if(n[r]!=t[r]){ a=!1;break}}else t(n)||(a=!1);if(a&&i.push(n),e&&i.length)return i[0]}return i},filter:function(t,e,i){if((t||this.jf||this.Mg)&&this.callEvent("onBeforeFilter",[t,e])&&(this.Af(i),this.order.length)){if(t){var s=t;e=e||"","string"==typeof t&&(t=t.replace(/#/g,""),"function"==typeof e?s=function(i){return e(i[t]); }:(e=e.toString().toLowerCase(),s=function(e,i){return-1!=(e[t]||"").toString().toLowerCase().indexOf(i)})),this.Bf(s,e,i,this.Cf)}this.refresh(),this.callEvent("onAfterFilter",[])}},Df:function(){for(var t=[],e=this.order.length-1;e>=0;e--)t[e]=this.pull[this.order[e]];return t},each:function(t,e,i){ var s=this.order;i&&(s=this.jf||s);for(var n=0;ne?1:e>t?-1:0},"int":function(t,e){return t=1*t,e=1*e,t>e?1:e>t?-1:0},string_strict:function(t,e){return t=t.toString(), e=e.toString(),t>e?1:e>t?-1:0},string:function(t,e){return e?t?(t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t>e?1:e>t?-1:0):-1:1},raw:function(t,e){return t>e?1:e>t?-1:0}},Gf:function(t,e){return t?("function"!=typeof e&&(e=this.as[e||"string"]),function(i,s){return e(i[t],s[t])}):e},Ff:function(t,e){ return"asc"!=t&&t?function(t,i){return-1*e(t,i)}:e}}},webix.DataCollection=webix.proto({name:"DataCollection",isVisible:function(){return this.data.order.length||this.data.jf||this.s.dataFeed?!0:!1},$init:function(t){this.data.provideApi(this,!0);var e=t&&t.id?t.id:webix.uid();this.s.id=e,webix.ui.views[e]=this, this.data.attachEvent("onStoreLoad",webix.bind(function(){this.callEvent("onBindRequest",[])},this))},refresh:function(){this.callEvent("onBindRequest",[])}},webix.DataMove,webix.CollectionBind,webix.BindSource,webix.ValidateCollection,webix.DataLoader,webix.MapCollection,webix.EventSystem,webix.BaseBind,webix.Destruction,webix.Settings), webix.Scrollable={$init:function(t){return t&&!t.scroll&&this.If?this.y=this.y||this.w:((this.y||this.w).appendChild(webix.html.create("DIV",{"class":"webix_scroll_cont"},"")),this.y=(this.y||this.w).firstChild,void(webix.env.touch&&"native"!==webix.env.touch||webix.UE(this.x,"scroll",webix.bind(function(t){ this.callEvent&&webix.delay(function(){this.callEvent("onAfterScroll",[])},this)},this))))},scroll_setter:function(t){if(!t)return!1;var e="x"==t?"x":"xy"==t?"xy":"a"==t?"xy":"y";if(webix.Touch&&webix.Touch.$active&&"native"!=webix.env.touch)this.y.setAttribute("touch_scroll",e),this.attachEvent&&this.attachEvent("onAfterRender",webix.bind(this.Jf,this)), this.Kf=!0;else if(webix.env.$customScroll)webix.CustomScroll.enable(this,e);else{var i=this.y.parentNode.style;-1!=t.toString().indexOf("a")?i.overflowX=i.overflowY="auto":(-1!=e.indexOf("x")&&(this.ec=!0,i.overflowX="scroll"),-1!=e.indexOf("y")&&(this.cc=!0,i.overflowY="scroll"))}return e},Lf:function(t){ if(!!this.s.scroll!=!!t){if(!webix.env.$customScroll){var e=this.y.parentNode.style;e.overflowX=e.overflowY=t?"auto":"hidden"}this.ec=this.cc=!!t,this.s.scroll=!!t}},getScrollState:function(){if(webix.Touch&&webix.Touch.$active){var t=webix.Touch.Mf(this.y);return{x:-t.e,y:-t.f}}return{x:this.y.parentNode.scrollLeft, y:this.y.parentNode.scrollTop}},scrollTo:function(t,e){webix.Touch&&webix.Touch.$active&&"native"!=webix.env.touch?(e=Math.max(0,Math.min(e,this.y.offsetHeight-this.dc)),t=Math.max(0,Math.min(t,this.y.offsetWidth-this.bc)),webix.Touch.Nf(this.y,-t,-e,this.s.scrollSpeed||"100ms")):(this.y.parentNode.scrollLeft=t, this.y.parentNode.scrollTop=e)},Jf:function(){if(-1!=this.s.scroll.toString().indexOf("x")){var t=this.y.scrollWidth;t&&(this.y.style.width="100%",this.y.style.width=this.y.scrollWidth+"px")}if(webix.Touch&&webix.Touch.$active&&this.Kf){webix.Touch.Of(),webix.Touch.Pf();var e=this.getScrollState(),i=this.y.offsetWidth-this.$width-e.x,s=this.y.offsetHeight-this.$height-e.y; if(0>i||0>s){var t=0>i?Math.min(-i-e.x,0):-e.x,n=0>s?Math.min(-s-e.y,0):-e.y;webix.Touch.Nf(this.y,t,n,0)}}}},webix.protoUI({defaults:{size:10,page:0,group:5,template:"{common.pages()}",maxWidth:1e5,height:30,borderless:!0},name:"pager",on_click:{webix_pager_item:function(t,e){this.select(e)}},$init:function(t){ this.data=this.s,this.y=this.x,this.x.className+=" webix_pager"+(t.autowidth?" webix_pager_auto":""),(t.master===!1||0===t.master)&&this.$ready.push(this.wt)},wt:function(){this.refresh(),this.$master={refresh:function(){},select:function(){}}},select:function(t){if(this.$master&&"pager"==this.$master.name)return this.$master.select(t); switch(t){case"next":t=this.s.page+1;break;case"prev":t=this.s.page-1;break;case"first":t=0;break;case"last":t=this.s.limit-1}0>t&&(t=0),t>=this.data.limit&&(t=this.data.limit-1);var e=this.data.page;this.callEvent("onBeforePageChange",[t,e])&&(this.data.page=1*t,this.refresh()&&(this.s.animate&&this.Qf(e,1*t,this.s.animate)||this.$master.refresh()), this.callEvent("onAfterPageChange",[t]))},ad:"webix_p_id",template_setter:webix.template,type:{template:function(t,e){return t.template.call(this,t,e)},pages:function(t){var e="";if(-1==t.page)return"";t.$min=t.page-Math.round((t.group-1)/2),t.$max=t.$min+1*t.group-1,t.$min<0&&(t.$max+=-1*t.$min,t.$min=0), t.$max>=t.limit&&(t.$min-=Math.min(t.$min,t.$max-t.limit+1),t.$max=t.limit-1);for(var i=t.$min||0;i<=t.$max;i++)e+=this.button({id:i,index:i+1,selected:i==t.page?"_selected":"",label:webix.i18n.aria.page+" "+(i+1)});return e},page:function(t){return t.page+1},first:function(){return this.button({id:"first", index:webix.locale.pager.first,selected:"",label:webix.i18n.aria.pages[0]})},last:function(){return this.button({id:"last",index:webix.locale.pager.last,selected:"",label:webix.i18n.aria.pages[3]})},prev:function(){return this.button({id:"prev",index:webix.locale.pager.prev,selected:"",label:webix.i18n.aria.pages[1] })},next:function(){return this.button({id:"next",index:webix.locale.pager.next,selected:"",label:webix.i18n.aria.pages[2]})},button:webix.template("")},clone:function(t){t.$view||(t.view="pager", t=webix.ui(t)),this.Rf=t,t.$master=this,this.Sf()},refresh:function(){var t=this.s;if(t.count){t.limit=Math.ceil(t.count/t.size);var e=Math.min(t.limit-1,t.page);return e!=t.page?this.$master.setPage(e):(t.page=e,e>=0&&e!=t.old_page||t.limit!=t.old_limit||t.old_count!=t.count?(this.render(),this.Sf(), t.old_limit=t.limit,t.old_page=t.page,t.old_count=t.count,!0):void 0)}},apiOnly_setter:function(t){return this.$apiOnly=t},Sf:function(){this.Rf&&(this.Rf.s.count=this.s.count,this.Rf.s.page=this.s.page,this.Rf.refresh())},Qf:function(t,e,i){if(t==e)return!1;if(this.Tf)return this.Uf&&window.clearTimeout(this.Uf), this.Uf=webix.delay(this.Qf,this,[t,e,i],100);var s=e>t?"left":"right";("top"==i.direction||"bottom"==i.direction)&&(s=e>t?"top":"bottom"),i.flip&&(s="");var n=0,a=this.$master.y,r=!!this.$master.Vf;r&&(a=this.$master.Vf,n=a.offsetTop,webix.html.addCss(this.$master.$view,"webix_animation"));var h=a.cloneNode(!0); h.style.width=a.style.width="100%",this.$master.refresh(),webix.html.insertBefore(h,a.nextSibling,a.parentNode),r&&(h.childNodes[1].scrollLeft=a.childNodes[1].scrollLeft);var o,l=i!==!0?i:{},c=webix.extend({direction:s,callback:webix.bind(function(){c.callback=null,webix.animate.breakLine(o),this.Tf=!1, this.$master.Vf&&webix.html.removeCss(this.$master.$view,"webix_animation")},this),top:n,keepViews:r},l);o=webix.animate.formLine(a,h,c),webix.animate([a,h],c),this.Tf=!0}},webix.MouseEvents,webix.SingleRender,webix.ui.view,webix.EventSystem),webix.locale.pager={first:" << ",last:" >> ",next:" > ", prev:" < "},webix.PagingAbility={pager_setter:function(t){function e(i){if(t.config.autosize&&this.getVisibleCount){var s=this.getVisibleCount();isNaN(s)?(t.config.size=1,webix.delay(e,this,[!0])):s!=t.config.size&&(t.config.size=s,t.refresh(),i===!0&&this.refresh())}var n=this.s.pager;return-1==n.page?!1:(this.data.$min=this.sy(0,n.page*n.size), this.data.$max=this.sy(this.data.$min,n.size),this.data.$pagesize=this.data.$max-this.data.$min,!0)}if("string"==typeof t){var i=webix.$$(t);if(!i)return this.$blockRender=!0,webix.delay(function(){var e=webix.$$(t);this.s.pager=this.pager_setter(e);var i=e.s;i.count=this.data.ty(i.level),e.refresh(), this.$blockRender=!1,this.render()},this),null;t=i}return this.attachEvent("onBeforeRender",e),t.$view||(t.view="pager",t=webix.ui(t)),this.Wf=t,t.$master=this,this.data.attachEvent("onStoreUpdated",function(){var e=t.s;e.count=this.ty(e.level),t.refresh()}),this.data.ty=this.ty,t.s},ty:function(t){if(t&&0!==t){ var e=0;return this.each(function(i){i.$level==t&&e++}),e}return this.count()},sy:function(t,e){var i=this.s.pager;if(i.level&&0!==i.level){var s=t,n=this.data.order.length;if(e)for(;n>s;){if(this.data.order[s]&&this.data.getItem(this.data.order[s]).$level==i.level){if(0===e)break;e--}s++}return s}return t+e; },setPage:function(t){this.Wf&&this.Wf.select(t)},getPage:function(){return this.Wf.s.page},getPager:function(){return this.Wf}},webix.protoUI({name:"tooltip",defaults:{dy:0,dx:20},$init:function(t){"string"==typeof t&&(t={template:t}),this.type=webix.extend({},this.type),this.$view=this.x=this.w=this.y=webix.html.create("DIV",{ role:"alert","aria-atomic":"true"}),this.w.className="webix_tooltip",webix.html.insertBefore(this.w,document.body.firstChild,document.body),this.PF=webix.attachEvent("onClick",webix.bind(function(t){this.gz&&webix.$$(t)!=this&&this.hide()},this)),this.attachEvent("onDestruct",function(){webix.detachEvent(this.PF); })},adjust:function(){},isVisible:function(){return!0},show:function(t,e){if(!this.Xf){if(this.data!=t&&(this.data=webix.extend({},t),this.render(t)),this.y.firstChild){var i=Math.max(document.documentElement.clientWidth,window.innerWidth||0),s=Math.max(document.documentElement.clientHeight,window.innerHeight||0),n=i-e.x,a=s-e.y; this.w.style.display="block",n-this.s.dx>this.w.offsetWidth?n=e.x:(n=e.x-2*this.s.dx-this.w.offsetWidth,0>=n&&(n=0)),a=a-this.s.dy>this.w.offsetHeight?e.y:e.y-this.s.dy-this.w.offsetHeight,this.w.style.left=n+this.s.dx+"px",this.w.style.top=a+this.s.dy+"px"}this.gz=!0}},hide:function(){this.data=null, this.w.style.display="none",this.gz=!1},disable:function(){this.Xf=!0},enable:function(){this.Xf=!1},type:{template:webix.template("{obj.id}"),templateStart:webix.template.empty,templateEnd:webix.template.empty}},webix.SingleRender,webix.Settings,webix.EventSystem,webix.ui.view),webix.AutoTooltip={tooltip_setter:function(t){ if(t){"function"==typeof t&&(t={template:t});var e=!t.template,i=new webix.ui.tooltip(t);this.Vc();var s=this.attachEvent("onMouseMove",function(t,s){if(this.DA=s.clientX,this.EA=s.clientY,this.getColumnConfig){var n=i.type.column=this.getColumnConfig(t.column);if(e){if(!n.tooltip&&n.tooltip!=webix.undefined)return; var a=s.target||s.srcElements;if(a.getAttribute("webix_area")&&n.tooltip){var r=a.getAttribute("webix_area");i.type.template=function(t,e){var i=t[e.column.id];return webix.template(n.tooltip).call(this,t,e,i[r],r)}}else if(n.tooltip)i.type.template=n.tooltip=webix.template(n.tooltip);else{var h=this.getText(t.row,t.column); i.type.template=function(){return h}}}}webix.DragControl.active||i.show(this.getItem(t.row||t),webix.html.pos(s))}),n=webix.event(document.body,"mousemove",webix.bind(function(t){t=t||event,(this.DA!=t.clientX||this.EA!=t.clientY)&&i.hide()},this));return this.attachEvent("onDestruct",function(){this.config.tooltip&&this.config.tooltip.destructor(); }),this.attachEvent("onAfterScroll",function(){i.hide()}),i.attachEvent("onDestruct",webix.bind(function(){this.detachEvent(s),webix.eventRemove(n)},this)),i}}},webix.protoUI({name:"proto",$init:function(){this.data.provideApi(this,!0),this.y=this.y||this.w,this.data.attachEvent("onStoreUpdated",webix.bind(function(){ this.render.apply(this,arguments)},this))},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)&&this.render()},ad:"webix_item",on_mouse_move:{},type:{}},webix.PagingAbility,webix.DataMarks,webix.AutoTooltip,webix.ValidateCollection,webix.RenderStack,webix.DataLoader,webix.ui.view,webix.EventSystem,webix.Settings), webix.CodeParser={collapseNames:function(t,e,i){if(i=i||{},e=e||"",!t||"object"!=typeof t)return null;for(var s in t)!t[s]||"object"!=typeof t[s]||webix.isDate(t[s])||webix.isArray(t[s])?i[e+s]=t[s]:webix.CodeParser.collapseNames(t[s],e+s+".",i);return i},expandNames:function(t){var e,i,s,n,a,r={};for(a in t){ for(s=a.split("."),i=s.length-1,n=r,e=0;i>e;e++)n[s[e]]||(n[s[e]]={}),n=n[s[e]];n[s[i]]=t[a]}return r}},webix.Values={$init:function(){this.elements={}},focus:function(t){if(t)this.ub(this.elements[t]);else for(var e in this.elements)if(this.ub(this.elements[e]))return!0},ub:function(t){return t&&t.focus?(t.focus(), !0):void 0},setValues:function(t,e){this.s.complexData&&(t=webix.CodeParser.collapseNames(t)),this.Zf(t,e)},Zf:function(t,e){this.Yf=e,this.blockEvent(),e&&this.$f||(this.$f={});for(var i in t)this.elements[i]||(this.$f[i]=t[i]);for(var i in this.elements){var s=this.elements[i];s&&(webix.isUndefined(t[i])?!e&&s.$allowsClear&&s.setValue(""):s.setValue(t[i]), this.$f[i]=s.getValue())}this.unblockEvent(),this.callEvent("onValues",[])},isDirty:function(){return this.Yf?!0:1===this.getDirtyValues(1)?!0:!1},setDirty:function(t){this.Yf=t,t||(this.$f=this.hz())},getDirtyValues:function(){var t={};if(this.$f)for(var e in this.elements){var i=this.elements[e].getValue(); if(this.$f[e]!=i&&(t[e]=i,arguments[0]))return 1}return t},getCleanValues:function(){return this.$f},getValues:function(t){var e=this.hz(t);return this.s.complexData&&(e=webix.CodeParser.expandNames(e)),e},hz:function(t){var e,i=null,s=this.$f?webix.copy(this.$f):{};for(var n in this.elements)i=this.elements[n], e=!0,t&&("object"==typeof t?(t.hidden===!1&&(e=i.isVisible()),e&&t.disabled===!1&&(e=i.isEnabled())):e=t.call(this,i)),e?s[n]=i.getValue():delete s[n];return s},clear:function(){this.Yf=!1;var t={};for(var e in this.elements)this.elements[e].$allowsClear&&(t[e]="");this.Zf(t)},markInvalid:function(t,e){ if(e===!1)this.Qe(t);else{if("string"==typeof e){var i=this.elements[t];i&&(i.s.invalidMessage=e)}this.Te(t)}},Te:function(t){var e=this.elements[t];if(t&&e){this.Qe(t,!0),webix.html.addCss(e.x,"webix_invalid"),e.s.invalid=!0;var i=e.s.invalidMessage;"string"==typeof i&&e.setBottomText&&e.setBottomText(); }},Qe:function(t,e){var i=this.elements[t];if(t&&i&&i.$view&&i.s.invalid){webix.html.removeCss(i.x,"webix_invalid"),i.s.invalid=!1;var s=i.s.invalidMessage;"string"==typeof s&&!e&&i.setBottomText&&i.setBottomText()}}},webix.protoUI({name:"toolbar",defaults:{type:"toolbar"},Gc:!0,_f:"webix_toolbar",ag:!1, $init:function(t){t.borderless||(this.w.style.borderWidth="1px"),this.w.className+=" "+this._f,this.x.setAttribute("role","toolbar")},Qs:function(){var t=this;t.elements={},webix.ui.each(this,function(e){return e.s.name&&e.getValue&&e.setValue&&(t.elements[e.s.name]=e,e.mapEvent&&e.mapEvent({onbeforetabclick:t, onaftertabclick:t,onitemclick:t,onchange:t})),e.setValues?!1:void 0});var e=this.$f;if(this.setDirty(!1),e){var i=this.$f;for(var s in t.elements)e[s]&&i[s]!=e[s]&&(i[s]=e[s],this.setDirty(!0))}},sc:function(){this.Qs()},Bc:function(t){var e=this.s;return e.elements&&!t&&(this.nc=t=e.elements,this.mc=this.ag, delete e.elements),this.s.elementsConfig&&this.eg(this.nc,e.elementsConfig),t},eg:function(t,e){for(var i=0;i"; },load:function(t){this.src_setter(t)},src_setter:function(t){return this.callEvent("onBeforeLoad",[])?(this.getIframe().src=t,t):""},getIframe:function(){return this.w.getElementsByTagName("iframe")[0]},getWindow:function(){return this.getIframe().contentWindow}},webix.ui.view,webix.EventSystem),webix.OverlayBox={ showOverlay:function(t){this.mg?this.mg.innerHTML=t:(this.mg=webix.html.create("DIV",{"class":"webix_overlay"},t||""),webix.html.insertBefore(this.mg,this.x.firstChild,this.x),this.x.style.position="relative")},hideOverlay:function(){this.mg&&(webix.html.remove(this.mg),this.mg=null)}},webix.protoUI({ name:"scrollview",defaults:{scroll:"y",scrollSpeed:"0ms"},$init:function(){this.x.className+=" webix_scrollview"},body_setter:function(t){t.borderless=!0,webix.Xb=this,this.gd=webix.ui.A(t),this.y.appendChild(this.gd.x)},getChildViews:function(){return[this.gd]},getBody:function(){return this.gd},resizeChildren:function(){ this.gd&&(this.ng=this.gd.$getSize(0,0),this.og(),webix.callEvent("onResize",[]))},og:function(){var t=(this.Mw||webix.ui.scrollSize,Math.max(this.bc,this.ng[0])),e=Math.max(this.dc,this.ng[2]);if(this.gd.$setSize(t,e),this.y.style.width=this.gd.bc+"px",this.y.style.height=this.gd.dc+"px",webix.env.touch){ var i=this.getScrollState(),s=this.gd.dc-this.dc;s"+this.pg(t);return t.open&&(e+=this.rg(t.id)),e+=""},rg:function(t){var e="",i=this.data.branch[t];if(i){e+=""}return e},render:function(t,e,i){if(webix.TreeRenderStack.tg=this,this.isVisible(this.s.id)&&!this.$blockRender){if(t){var s,n=this.getItem(t);if("add"!=i&&(s=this.getItemNode(t),!s))return; switch(i){case"branch":var a=s.parentNode,r=this.Ne(n);webix.html.insertBefore(r,a),webix.html.remove(a),this.t=null;break;case"paint":case"update":var r=this.t[t]=this.qg(n);webix.html.insertBefore(r,s),webix.html.remove(s);break;case"delete":webix.html.remove(s.parentNode);break;case"add":var h;if(0==n.$parent)h=this.y.firstChild;else if(this.getItem(n.$parent).open&&(h=this.getItemNode(n.$parent))){ if(!h.nextSibling){var o=webix.html.create("DIV",{"class":"webix_tree_leaves"},"");h.parentNode.appendChild(o)}h=h.nextSibling}if(h){var l=this.data.getNextSiblingId(t);l=this.getItemNode(l),l&&(l=l.parentNode);var r=this.Ne(n);this.t[t]=r.firstChild,webix.html.insertBefore(r,l,h)}break;default:return!1; }this.callEvent("onPartialRender",[t,e,i])}else this.callEvent("onBeforeRender",[this.data])&&(this.type.sg=[],this.y.innerHTML=this.rg(0),this.t=null,this.callEvent("onAfterRender",[]));return this.type.sg=0,webix.TreeRenderStack.tg=null,!0}},getItemNode:function(t){if(this.t)return this.t[t];this.t={}; for(var e=this.y.getElementsByTagName("DIV"),i=0;i=0;i--)this.wg[i]==t&&(this.wg[i]=e)},zg:function(){for(var t=this.wg.length-1;t>=0;t--)if(this.data.getIndexById(this.wg[t])<0){var e=this.wg[t];this.removeCss(e,"webix_selected",!0), this.wg.splice(t,1),this.callEvent("onSelectChange",[e])}},xg:function(t,e,i){"delete"==i?this.loadBranch?this.qF():this.wg.remove(t):t||this.data.count()||this.data.jf||(this.wg=webix.toArray())},yg:function(){this.s.select&&this.data.each(function(t){t&&t.$selected&&this.select(t.id)},this)},qF:function(){ for(var t=this.wg.length-1;t>=0;t--)this.exists(this.wg[t])||this.wg.splice(t,1)},Bg:function(t,e,i,s){var n=e?"onBeforeSelect":"onBeforeUnSelect";if(!this.callEvent(n,[t,e]))return!1;s&&(this.Dg=!0,this.unselectAll(),this.Dg=!1),e?this.addCss(t,"webix_selected",!0):this.removeCss(t,"webix_selected",!0), i?i.push(t):(e?this.wg.push(t):this.wg.remove(t),this.Cg(t));var n=e?"onAfterSelect":"onAfterUnSelect";return this.callEvent(n,[t]),!0},select:function(t,e){var i=arguments[2],s=arguments[3];if(!t)return this.selectAll();if(!webix.isArray(t)){if(s&&this.wg.length)return this.selectAll(this.wg[this.wg.length-1],t); var n=!1;return i||e||1==this.wg.length&&this.wg[0]==t||(n=!0),!n&&this.isSelected(t)?void(i&&this.unselect(t)):void this.Bg(t,!0,null,n)}for(var a=0;a1||t){for(var i=e.length-1;i>=0;i--)e[i]=this.getItem(e[i]); return e}return e.length?this.getItem(e[0]):void 0},Eg:function(t){return t.length>100||t.length>this.data.count/2},Cg:function(t){if("object"!=typeof t&&(t=[t]),t.length){if(this.Eg(t))this.data.refresh();else for(var e=0;ee&&(e=l.length),c===l&&e===u)return;if(webix.PowerArray.removeAt.call(c,u), webix.PowerArray.insertAt.call(l,t,Math.min(l.length,e)),c.length||delete this.data.branch[o.$parent],o.$parent&&"0"!=o.$parent&&this.getItem(o.$parent).$count--,a&&"0"!=a){var d=i.getItem(a);d.$count++,this.Fg(o,d.$level+1)}else this.Fg(o,1);o.$parent=a,i.data.callEvent("onDataMove",[t,e,a,l[e+1]])} return this.refresh(),n}for(var f=0;f=0&&(t[e][r]=s)}},changeId:function(t,e){if(t!=e){var i=this.getItem(t).$parent;return this.kG(this.branch,i,t,e),this.Mg&&this.kG(this.Mg,i,t,e),webix.DataStore.prototype.changeId.call(this,t,e); }},clearAll:function(t){this.branch={0:[]},webix.DataStore.prototype.clearAll.call(this,t)},getPrevSiblingId:function(t){var e=this.branch[this.getItem(t).$parent],i=webix.PowerArray.find.call(e,t)-1;return i>=0?e[i]:null},getNextSiblingId:function(t){var e=this.branch[this.getItem(t).$parent],i=webix.PowerArray.find.call(e,t)+1; return i0)for(var s=this.branch[t],n=0;n";return i},icon:function(t,e){return t.$count?t.open?"
":"
":"
"},checkbox:function(t,e){return t.nocheckbox?"":""; },folder:function(t,e){return t.icon?"
":t.$count?t.open?"
":"
":"
"}},webix.TreeAPI={open:function(t,e){if(t){var i=this.getItem(t);i.$count&&!i.open&&(this.callEvent("onBeforeOpen",[t])&&(i.open=!0, this.data.callEvent("onStoreUpdated",[t,0,"branch"]),this.callEvent("onAfterOpen",[t])),e&&"0"!=t&&this.open(this.getParentId(t),e))}},close:function(t){if(t){var e=this.getItem(t);e.open&&this.callEvent("onBeforeClose",[t])&&(e.open=!1,this.data.callEvent("onStoreUpdated",[t,0,"branch"]),this.callEvent("onAfterClose",[t])); }},openAll:function(t){this.data.eachSubItem(t||0,function(t,e){e&&(t.open=!0)}),this.data.refresh()},closeAll:function(t){this.data.eachSubItem(t||0,function(t,e){e&&(t.open=!1)}),this.data.refresh()},Sg:function(t,e,i){if(this.s.threeState)return this.Tg(t,null!==e?e:"");var s,n=this.getItem(t),a=i?i.target||i.srcElement:null; s=a&&"checkbox"==a.type?a.checked?!0:!1:null!==e?e:!n.checked,n.checked=s,this.callEvent("onItemCheck",[t,n.checked,i])},isBranchOpen:function(t){if("0"==t)return!0;var e=this.getItem(t);return e.open?this.isBranchOpen(e.$parent):!1},getOpenItems:function(){var t=[];for(var e in this.data.branch)this.exists(e)&&this.getItem(e).open&&t.push(e); return t},getState:function(){return{open:this.getOpenItems(),select:this.getSelectedId(!0)}},Ug:function(t,e){var i=this.data.attachEvent("onStoreLoad",function(){t.setState.call(t,e),t.data.detachEvent(i),t=null})},setState:function(t){if(t.open){this.closeAll();for(var e=t.open,i=0;io-d&&(this.WC(n.x,n.y+2*d,t),u=!0)}s&&(t.xc-d&&(this.WC(n.x+2*d,n.y,t),u=!0)),u&&(this.bh=webix.delay(this.ch,this,[t],100)); },WC:function(t,e,i){this.callEvent("onBeforeAutoScroll",[i])&&this.scrollTo(t,e)}},webix.DragOrder={Vg:!0,$drag:function(t,e){var i=webix.DragItem.$drag.call(this,t,e);if(i){var s=webix.DragControl.getContext();this.getBranchIndex&&(this.Wg=this.Xg?16*this.getItem(s.start).$level:0),s.fragile||this.addCss(s.start,"webix_transparent"); }return i},WB:function(t,e){return webix.DragItem.WB(t,e)},$dragPos:function(t,e,i){var s=webix.html.offset(this.$view),n=s.x+(this.Xg?1+this.Wg:1),a=t.y,r=this.s,h="x"==r.layout;h&&(a=s.y+(this.Xg?+s.height-webix.ui.scrollSize-1:1),n=t.x),i.style.display="none";var o=document.elementFromPoint(n,a);if(o!=this.Yg){ var l=webix.$$(o);if(l&&l==this){var c=this.locate(o,!0);!c&&webix.DragControl.td&&(c=this.locate(webix.DragControl.td,!0));var u=webix.DragControl.getContext().start;if(this.XC=!0,c){if(c!=this.Yg){if(c!=u){var d,f;this.getBranchIndex?(d={parent:this.getParentId(c)},f=this.getBranchIndex(c)):(d={},f=this.getIndexById(c)), this.callEvent("onBeforeDropOrder",[u,f,e,d])&&(this.move(u,f,this,d),this.Yg=c)}webix.DragControl.Cd=this.w}}else if(c="$webix-last",this.Yg!=c){if(!this.callEvent("onBeforeDropOrder",[u,-1,e,{parent:0}]))return;this.Yg=c}}}if(i.style.display="block",h)if(t.y=s.y,t.x=t.x-18,t.xb&&(t.x=b)}else if(s.y+=this.$g,t.x=this.Wg||s.x,t.y=t.y-18,t.yb&&(t.y=b)}this.bh&&(this.bh=window.clearTimeout(this.bh)),this.bh=webix.delay(this.ch,this,[webix.html.pos(e),this.locate(e)||null],250),webix.DragControl.Ed=!0},$dragIn:function(){ return!1},$drop:function(t,e,i){this.bh&&(this.XC=null,this.bh=window.clearTimeout(this.bh));var s=webix.DragControl.getContext(),n=s.start;this.removeCss(n,"webix_transparent");var a=this.getIndexById(n);this.callEvent("onAfterDropOrder",[n,a,i]),s.fragile&&this.refresh()}},webix.DragItem={_g:function(t,e,i){ e||webix.DragControl.addDrop(t.w,t,!0),i||webix.DragControl.addDrag(t.w,t),this.attachEvent("onDragOut",function(t,e){this.$dragMark(t,e)}),this.attachEvent("onBeforeAutoScroll",function(){var t=webix.DragControl.getContext();return!(!webix.DragControl.sd||!t||t.to!==this&&!this.XC)})},drag_setter:function(t){ return t&&(webix.extend(this,webix.AutoScroll,!0),"order"==t&&webix.extend(this,webix.DragOrder,!0),"inner"==t&&(this.ah=!0),this._g(this,"source"==t,"target"==t),delete this.drag_setter),t},$dragIn:function(t,e,i){var s=this.locate(i)||null,n=webix.DragControl.Gd;if((this.ah||n.from.ah)&&n.from!==this)return!1; var a=webix.DragControl.getMaster(e),r=this.getItemNode(s,i)||this.y;return r==webix.DragControl.Dd?r:(n.target=s,n.to=a,this.bh&&(this.bh=window.clearTimeout(this.bh)),this.bh=webix.delay(function(t,e){this.Gg(e),this.ch(t,e)},this,[webix.html.pos(i),s],250),this.$dropAllow(n,i)&&this.callEvent("onBeforeDragIn",[n,i])?(this.$dragMark(n,i), r):(n.to=n.target=null,this.bh&&(this.bh=window.clearTimeout(this.bh)),null))},$dropAllow:function(){return!0},Gg:function(t){},_B:function(t){return t&&"object"==typeof t?t.toString():t},$dragOut:function(t,e,i,s){var n=(this.x.contains(i)?this.locate(s):null)||null,a=webix.DragControl.Gd;return(a.target||"").toString()==(n||"").toString()?null:(this.bh&&(this.XC=null, this.bh=window.clearTimeout(this.bh)),a.target=a.to=null,this.callEvent("onDragOut",[a,s]),null)},$drop:function(t,e,i){this.bh&&(this.bh=window.clearTimeout(this.bh));var s=webix.DragControl.Gd;s.to=this;var n=this._B(s.target);this.getBranchIndex?n&&(s.parent=this.getParentId(n),s.index=this.getBranchIndex(n)):s.index=n?this.getIndexById(n):this.count(), this.$dragMark({},i),s.from&&s.from!=s.to&&s.from.callEvent&&s.from.callEvent("onBeforeDropOut",[s,i]),this.callEvent("onBeforeDrop",[s,i])&&(this.dh(s,i),this.callEvent("onAfterDrop",[s,i]))},dh:function(t,e){if(t.from&&t.from.move){var i={parent:t.parent,mode:t.pos};t.from.move(t.source,t.index,t.to,i); }},WB:function(t,e){if(this.getItemNode){var i=this.locate(e,!0),s=i?this.getItemNode(i):null;return s?webix.html.offset(s):s}},$drag:function(t,e){var i=this.locate(e,!0);if(i){var s=[i];if(this.getSelectedId&&!this.Vg){var n=this.getSelectedId(!0,!0);if(n&&n.length>1&&-1!=webix.PowerArray.find.call(n,i)){ for(var a={},s=[],r=0;ri&&(i=1*t(e[s]));return 1*i},count:function(t,e){ for(var i=0,s=0;s=0;a--)this.pull[s[a]].$footer&&s.splice(a,1);this.mh(s,0,1),t||this.callEvent("onStoreUpdated",[])}},mh:function(t,e,i){e&&(this.getItem(e).$count=t.length);for(var s=0;s1&&this.y&&this.data.order[0]!=t){var e=this.y.querySelector("["+this.ad+"]");e&&e.setAttribute("tabindex","-1")}})))},cF:function(){var t=this.getSelectedId(!0);if(!t.length||!this.getItemNode(t[0])){var e=this.y.querySelector("["+this.ad+"]");e&&e.setAttribute("tabindex","0")}},sh:function(t){ return function(e,i){var s=i.srcElement||i.target;if(!s.getAttribute("webixignore")){var n=s.tagName;if("INPUT"==n||"TEXTAREA"==n||"SELECT"==n)return!0}return e&&e.moveSelection&&e.config.navigation&&!e.Eb?(webix.html.preventEvent(i),e.moveSelection(t,{shift:i.shiftKey,ctrl:i.ctrlKey})):!0}},moveSelection:function(t,e,i){ var s=this.s;if(!s.disabled){var n=this.getSelectedId(!0),a=this.count&&("x"==s.layout||s.xCount>1);if(("right"==t||"left"==t)&&this.ar){var r=webix.$$(this.ar);return r.Uq(!0),void("x"===r.config.layout?r.moveSelection(t):webix.UIManager.setFocus(r))}if(!n.length&&this.count()){if("down"==t||"right"==t&&a)t="top";else{ if(!("up"==t||"left"==t&&a))return;t="bottom"}n=[this.getFirstId()]}if(1==n.length){n=n[0];var h=n;if("left"==t&&this.close)return this.close(n);if("right"==t&&this.open)return this.open(n);if("top"==t)n=this.getFirstId();else if("bottom"==t)n=this.getLastId();else if("up"==t||"left"==t||"pgup"==t){var o=this.getIndexById(n),l="pgup"==t?10:1; n=this.getIdByIndex(Math.max(0,o-l))}else{if("down"!=t&&"right"!=t&&"pgdown"!=t)return;var o=this.getIndexById(n),l="pgdown"==t?10:1;n=this.getIdByIndex(Math.min(this.count()-1,o+l))}if(this.OD&&(n=this.OD(n,h,t)),this.showItem(n),this.select(n),this.getSubMenu&&this.getSubMenu(n)&&this.Yq(n,this.getItemNode(n)), !this.config.clipboard&&i!==!1){var c=this.getItemNode(n);c&&c.focus()}}return!1}},navigation_setter:function(t){return t&&!webix.UIManager.th&&(webix.UIManager.th=!0,webix.UIManager.addHotKey("up",this.sh("up")),webix.UIManager.addHotKey("down",this.sh("down")),webix.UIManager.addHotKey("right",this.sh("right")), webix.UIManager.addHotKey("left",this.sh("left")),webix.UIManager.addHotKey("shift+up",this.sh("up")),webix.UIManager.addHotKey("shift+down",this.sh("down")),webix.UIManager.addHotKey("shift+right",this.sh("right")),webix.UIManager.addHotKey("shift+left",this.sh("left")),webix.UIManager.addHotKey("ctrl+shift+up",this.sh("up")), webix.UIManager.addHotKey("ctrl+shift+down",this.sh("down")),webix.UIManager.addHotKey("ctrl+shift+right",this.sh("right")),webix.UIManager.addHotKey("ctrl+shift+left",this.sh("left")),webix.UIManager.addHotKey("pageup",this.sh("pgup")),webix.UIManager.addHotKey("pagedown",this.sh("pgdown")),webix.UIManager.addHotKey("home",this.sh("top")), webix.UIManager.addHotKey("end",this.sh("bottom"))),t}},webix.protoUI({name:"tree",defaults:{scroll:"a",navigation:!0},$init:function(){this.x.className+=" webix_tree",webix.extend(this.data,webix.TreeStore,!0),webix.extend(this.on_click,webix.TreeClick),this.attachEvent("onAfterRender",this.Jf),this.attachEvent("onPartialRender",this.Jf), this.data.provideApi(this,!0),this.x.setAttribute("role","tree")},ad:"webix_tm_id",on_context:{},on_dblclick:{webix_tree_checkbox:function(){return this.on_click.webix_tree_checkbox?this.on_click.webix_tree_checkbox.apply(this,arguments):void 0}},$fixEditor:function(t){var e=this.getItemNode(t.id).querySelector("span"); if(e){""===e.innerHTML&&(e.innerHTML=" ");var i=10,s=e.offsetLeft;t.node.style.width=this.$view.scrollWidth-s-i+"px",t.node.style.marginLeft=s+"px",t.node.style.left="0px"}},on_click:{webix_tree_item:function(t,e,i){if(this.s.activeTitle){var s=this.getItem(e);s.open?this.close(e):this.open(e)}if(this.s.select)if("multiselect"==this.s.select||this.s.multiselect){ var n=t.ctrlKey||t.metaKey||"touch"==this.s.multiselect;if("level"==this.s.multiselect&&(n||t.shiftKey)){var a=this.getSelectedId(!0)[0];if(a&&this.getParentId(e)!=this.getParentId(a))return}this.select(e,!1,n,t.shiftKey)}else this.select(e)}},rh:{insert:function(t){var e=this.getSelectedId()||"0";this.add({ value:t},null,e)},modify:function(t){for(var e=this.getSelectedId(!0),i=0;i"+this.type.template(t,this.type)+""},type:webix.extend({template:function(t,e){ var i=e["template"+t.level]||e.templateCommon;return i.apply(this,arguments)},classname:function(t,e,i){var s="webix_tree_item";return t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css),i&&i.$css&&(s+=" "+i.$css),s},aria:function(t,e,i){return'role="treeitem"'+(i&&i.webix_selected?' aria-selected="true" tabindex="0"':' tabindex="-1"')+(t.$count?'aria-expanded="'+(t.open?"true":"false")+'"':"")+'aria-level="'+t.$level+'"'; },templateCommon:webix.template("{common.icon()} {common.folder()} #value#"),templateStart:webix.template('
'),templateEnd:webix.template("
"),templateCopy:webix.template("#value#")},webix.TreeType)},webix.AutoTooltip,webix.Group,webix.TreeAPI,webix.DragItem,webix.TreeDataMove,webix.SelectionModel,webix.KeysNavigation,webix.MouseEvents,webix.Scrollable,webix.TreeDataLoader,webix.ui.proto,webix.TreeRenderStack,webix.CopyPaste,webix.EventSystem), webix.TreeStateCheckbox={uh:function(){if(this.vg){var t=this.render;this.render=function(e,i,s){var n=t.apply(this,arguments);this.s.threeState&&n&&"checkbox"!=i&&this.vh.apply(this,arguments)},this.uh=function(){}}},threeState_setter:function(t){return t&&this.uh(),t},vh:function(t){var e,i,s,n,a;if(s=[], a=this,t&&!a.data.pull[t]&&(t=0),!t||a.data.pull[t].$count)for(i=this.wh(t),i.sort(function(t,e){return a.data.pull[e].$level-a.data.pull[t].$level}),e=0;e0||h>0)&&(s=!0),(s||s!=l.indeterminate)&&(o=!0),l.indeterminate=s,(e||l.checked!=e)&&(o=!0),l.checked=e,o?(a.push(n),n=this.getParentId(n)):n=0}return a; },getChecked:function(){var t=[],e=this;return this.data.eachSubItem(0,function(i){e.isChecked(i.id)&&t.push(i.id)}),t},Tg:function(t,e){var i=this.getItem(t);if(i&&(""===e&&(e=!i.checked),i.checked!=e||i.indeterminate)){i.checked=e,this.zh(t);var s=this.xh(t);if(this.vg&&s.length<5)for(var n=0;n")}return i},Bh:function(t,e,i){var s=e.sg,n=webix.TreeRenderStack.tg;if(0===s&&n){var a=t.$level,r=t.id;for(s=[];a;){var h=n.getParentId(r),o=n.data.branch[h]; o[o.length-1]==r&&(s[a]=!0),r=h,a--}e.sg=s}if(!s)return 0;if(i==t.$level){var l=3;return t.$parent||0===t.$index&&(l=4),s[t.$level]&&(l=2),t.$count?t.open?"minus"+l:"plus"+l:"line"+l}return s[i]?"blank":"line1"}}),webix.NavigationButtons={$init:function(){this.$ready.push(function(){this.attachEvent("onKeyPress",this.DD); })},PD:function(t,e){if(37===t||39===t){webix.html.preventEvent(e),this.Kh(37===t?-1:1);var i=this.Dh.querySelector("[tabindex='0']");i&&i.focus()}},Ch:function(){webix.html.remove(this.Dh),this.Dh=webix.html.create("DIV",{"class":"webix_nav_panel webix_nav_panel_"+this.s.navigation.type,role:"tablist" },""),this.x.appendChild(this.Dh),this.Eh(),this.Fh(),this.Gh()},Gh:function(){var t=[];this.Dh&&(t[0]=webix.event(this.Dh,"click",webix.bind(function(t){for(var e=t.srcElement||t.target,i=!1;e!=this.Dh&&!i;){var s=e.getAttribute(this.Hh);s&&(i=!0,this.Ih(s)),e=e.parentNode}},this))),this.Jh&&(t[1]=webix.event(this.Jh,"click",webix.bind(function(t){ this.Kh(-1)},this))),this.Lh&&(t[1]=webix.event(this.Lh,"click",webix.bind(function(t){this.Kh(1)},this))),this.attachEvent("onDestruct",function(){for(var e=0;e=this.q.length||0>e)&&(e=0>e?this.q.length-1:0), this.setActiveIndex(e)}},Ih:function(t){this.q&&webix.$$(t).show()},Eh:function(){var t,e;if(e=this.s.navigation,e.items){this.Hh=e.linkAttr||"bind_id",this.Dh?this.Nh():this.Ch();var i=this.q?this.q:this.data.order;if(i.length>1)for(var s=0;s");var n=this.q?this.q[s].s.id:i[s];n&&t.setAttribute(this.Hh,n),this.Dh.appendChild(t)}}},Nh:function(){if(this.Dh)for(var t=this.Dh.childNodes,e=t.length-1;e>=0;e--)webix.html.remove(t[e])},Fh:function(){var t;t=this.s.navigation,t.buttons&&(this.Jh&&webix.html.remove(this.Jh), this.Jh&&webix.html.remove(this.Lh),this.Jh=webix.html.create("DIV",{"class":"webix_nav_button_"+t.type+" webix_nav_button_prev ",role:"button",tabindex:"0","aria-label":webix.i18n.aria.prevTab},'
'),this.x.appendChild(this.Jh),this.Lh=webix.html.create("DIV",{ "class":"webix_nav_button_"+t.type+" webix_nav_button_next ",role:"button",tabindex:"0","aria-label":webix.i18n.aria.nextTab},'
'),this.x.appendChild(this.Lh))}},webix.VRenderStack={$init:function(){this.t={},webix.UE(this.x,"scroll",webix.bind(function(){this.render(null,null,"paint"); },this))},getItemNode:function(t){return this.t&&this.t[t]},showItem:function(t){var e=this.data.getIndexById(t);if(e>-1){var i=e*this.type.height,s=i+this.type.height,n=this.getScrollState(),a=webix.html.offset(this.$view);in.y+a.height&&this.scrollTo(0,s-a.height)}},render:function(t,e,i){ if(this.isVisible(this.s.id)&&!this.$blockRender){var s=this.Pe||this.y;if(!t||"paint"!=i&&"update"!=i){if("paint"!=i&&(this.t={},s.innerHTML=""),this.callEvent("onBeforeRender",[this.data])){var n=this.data.count(),a=this.getScrollState(),r=webix.html.offset(this.x),h=Math.floor(a.y/this.type.height)-2,o=Math.ceil((a.y+r.height)/this.type.height)+2; h=Math.max(0,h),o=Math.min(this.data.count()-1,o);for(var l=[],c=h;o>=c;c++){var u=this.data.order[c];if(this.t[u])l.push("
");else{var d=this.data.getItem(u);if(!d){this.Ik({count:o-c+(this.s.loadahead||0),start:c});break}l.push(this.jb(d))}}this.v.innerHTML=l.join(""),s.style.position="relative", s.style.height=n*this.type.height+"px";for(var f=this.v.childNodes,c=f.length-1;c>=0;c--){var b=f[c],t=b.getAttribute(this.ad);t&&(b.style.position="absolute",b.style.top=(h+c)*this.type.height+"px",b.style.left=0,b.style.width="100%",s.appendChild(b),this.t[t]=b)}this.callEvent("onAfterRender",[])}}else{ var p=this.getItemNode(t);if(p){var x=this.t[t]=this.Ne(e);return x.style.top=p.style.top,x.style.position="absolute",x.style.left=0,x.style.width="100%",webix.html.insertBefore(x,p),void webix.html.remove(p)}}}},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)&&this.render(null,null,"paint"); },Ik:function(t){var e=Math.max(t.count,this.s.datafetch||this.s.loadahead||0);this.cf(t.count,t.start)||this.loadNext(e,t.start)}},function(){function t(t){return t=t||{},t.paper=r[(t.paper||"").toLowerCase()]||"A4",t.mode=o[t.mode]?t.mode:"portrait",t.fit=h[t.fit]?t.fit:"page",t.scroll=t.scroll||!1, t.size=l[t.paper],t.margin=t.margin||0===t.margin?t.margin:{},a=isNaN(1*t.margin)?a:t.margin,t.margin={top:t.margin.top||0===t.margin.top?t.margin.top:a,bottom:t.margin.bottom||0===t.margin.bottom?t.margin.bottom:a,right:t.margin.right||0===t.margin.right?t.margin.right:a,left:t.margin.left||0===t.margin.left?t.margin.left:a },t}function e(t){webix.html.addCss(document.body,"webix_print"),t.docHeader&&n("Header",t),t.docFooter&&n("Footer",t);var e="@media print { @page{ size:"+t.paper+" "+t.mode+";margin-top:"+t.margin.top+"px;margin-bottom:"+t.margin.bottom+"px;margin-right:"+t.margin.right+"px;margin-left:"+t.margin.left+"px;}}"; webix.html.addStyle(e,"print")}function i(t){webix.html.removeCss(document.body,"webix_print"),webix.html.removeStyle("print"),t.docHeader&&webix.html.remove(t.docHeader),t.docFooter&&webix.html.remove(t.docFooter)}function s(t,e){var i=t.$view.cloneNode(!0),s=t.$view.getElementsByTagName("canvas");if(s.length)for(var n=s.length-1;n>=0;n--){ var a=i.getElementsByTagName("canvas")[n].getContext("2d");a.drawImage(s[n],0,0)}webix.html.insertBefore(i,e.docFooter,document.body),webix.html.addCss(i,"webix_ui_print"),!e.scroll&&(t.y&&t.data&&t.data.pull||t.getBody)&&webix.html.addCss(i,"webix_print_noscroll"),window.print(),webix.html.remove(i); }function n(t,e){var i=webix.html.create("div",{"class":"webix_view webix_print_"+t.toLowerCase(),style:"height:0px;visibility:hidden;"},e["doc"+t]);"Header"===t?webix.html.insertBefore(i,document.body.firstChild):document.body.appendChild(i),e["doc"+t]=i}webix.env.printPPI=96,webix.env.printMargin=.75*webix.env.printPPI; var a=(webix.env.printPPI,webix.env.printMargin),r={a4:"A4",a3:"A3",letter:"letter"},h={page:!0,data:!0},o={portrait:!0,landscape:!0},l={A3:{width:11.7,height:16.5},A4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};webix.print=function(n,a){var r=webix.$$(n);r&&r.$printView&&(r=r.$printView()), r&&(r.callEvent&&r.callEvent("onBeforePrint",[a]),a=t(a),e(a),r.$customPrint&&r.$customPrint(a)!==!0||s(r,a),i(a))}}(),webix.CustomPrint={$customPrint:function(t,e){if(this.UF(t,e))return!0;var i=this.VF(t),s=this.WF(i,t);if(e)return s;var n=webix.html.create("div",{"class":"webix_ui_print"});n.appendChild(s), webix.html.insertBefore(n,t.docFooter,document.body),window.print(),webix.html.remove(n)},UF:function(t,e){return!e&&("y"==this.config.layout||t.scroll||this.config.prerender||this.config.autoheight)?!0:void("x"==this.config.layout&&webix.extend(t||{},{xCount:this.count(),nobreaks:!0},!0))},XF:function(t){ if("page"==t.fit)return 1/0;var e=t.size,i=e["portrait"==t.mode?"width":"height"];return Math.min(i*webix.env.printPPI-2*webix.env.printMargin)},VF:function(t,e,i){var s,n,a,r=this.XF(t),h=t.xCount||this.Ci().Di,o=[],l=[],c=0;i=i||0,e=e||[];for(var u=0;u=i){if(c+=this.type.width,c>r&&a>i){s=l.length+i,o.push(l),u+=h-l.length,l=[],c=0;continue}var f=this.type.template(d,this.type),b=this.YF,p={display:"table-cell",height:this.type.height+"px",width:this.type.width+"px"};l.push({txt:f,className:b+" "+(d.$css||""),style:p }),(u+1)%h===0&&(o.push(l),l=[],c=0)}u++}return e.push(o),s&&this.VF(t,e,s),e},WF:function(t,e){var i=webix.html.create("div");return t.forEach(webix.bind(function(s,n){var a=webix.html.create("table",{"class":"webix_table_print "+this.$view.className,style:"border-collapse:collapse"});if(s.forEach(function(t){ var e=webix.html.create("tr");t.forEach(function(t){var i=webix.html.create("td");if(t.txt&&(i.innerHTML=t.txt),t.className&&(i.className=t.className),t.style){var s=Object.keys(t.style);s.forEach(function(e){t.style[e]&&(i.style[e]=t.style[e])})}t.span&&(t.span.colspan>1&&(i.colSpan=t.span.colspan), t.span.rowspan>1&&(i.rowSpan=t.span.rowspan)),e.appendChild(i)}),a.appendChild(e)}),i.appendChild(a),!e.nobreaks&&n+1t),this.s.autoheight&&(t||1/0)>e&&(t=e);var i=this.QF()*t+(this.type.margin||0);return this.getUnits&&(i+=this.getUnits().length*this.type.headerHeight),Math.max(i,this.s.minHeight||0); },QF:function(){return this.type.height+(this.type.margin||0)},Sh:function(t){var e=this.data.$pagesize||this.count();return this.Lf(t&&e>t),this.s.autowidth&&(t||1/0)>e&&(t=e),this.type.width*t},hg:function(){"x"==this.s.layout&&(this.y.style.width="auto"!=this.type.width?this.type.width*this.count()+"px":"auto"); },$getSize:function(t,e){return"y"==this.s.layout?("auto"!=this.type.width&&(this.s.width=this.type.width+(this.cc?webix.ui.scrollSize:0)),(this.s.yCount||this.s.autoheight)&&(this.s.height=this.Rh(this.s.yCount)||1)):("auto"!=this.type.height&&(this.s.height=this.QF()+(this.ec?webix.ui.scrollSize:0)), (this.s.xCount||this.s.autowidth)&&(this.s.width=this.Sh(this.s.xCount)||1)),webix.ui.view.prototype.$getSize.call(this,t,e)},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)},type:{css:"",widthSize:function(t,e){return e.width+(e.width>-1?"px":"")},heightSize:function(t,e){ return e.height+(e.height>-1?"px":"")},classname:function(t,e,i){var s="webix_list_item";return t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css),i&&i.$css&&(s+=" "+i.$css),s},aria:function(t,e,i){return'role="option"'+(i&&i.webix_selected?' aria-selected="true" tabindex="0"':' tabindex="-1"')+(t.$count&&t.$template?'aria-expanded="true"':""); },template:function(t){return(t.icon?" ":"")+t.value+(t.badge?"
"+t.badge+"
":"")},width:"auto",templateStart:webix.template('
'), templateEnd:webix.template("
")},$skin:function(){this.type.height=webix.skin.$active.listItemHeight}},webix.CustomPrint,webix.KeysNavigation,webix.DataMove,webix.DragItem,webix.MouseEvents,webix.SelectionModel,webix.Scrollable,webix.ui.proto,webix.CopyPaste),webix.protoUI({name:"grouplist",defaults:{ animate:{}},Oh:"webix_grouplist",$init:function(){webix.extend(this.data,webix.TreeStore,!0),this.data.count=function(){return this.order.length},this.data.provideApi(this,!0),this.data.attachEvent("onClearAll",webix.bind(this.Th,this)),this.Th()},Th:function(){this.Uh=[],this.Vh=[]},$setSize:function(){ webix.ui.view.prototype.$setSize.apply(this,arguments)&&(this.y.style.width=this.bc)},on_click:{webix_list_item:function(t,e){if(this.Wh)return!1;for(var i=0;i'), templateBack:webix.template("#value#"),templateItem:webix.template("#value#"),templateGroup:webix.template("#value#"),templateEnd:function(t,e){var i="";return t.$count&&(i+="
"),i+=""}},showItem:function(t){var e,i;for(t&&(e=this.getItem(t),i=e.$parent,e.$count&&(i=e.id)), this.Uh=this.data.branch[i||0],this.Vh=[];i;)this.getItem(i).$template="Back",this.Vh.unshift(i),i=this.getItem(i).$parent;this.Qh=!0,this.render(),this.Qh=!1,webix.RenderStack.showItem.call(this,t)}},webix.Group,webix.ui.list),webix.type(webix.ui.grouplist,{}),webix.protoUI({name:"unitlist",ad:"webix_item_id", uniteBy_setter:webix.template,render:function(t,e,i,s){var n=this.s;if(this.isVisible(n.id)){if(!n.uniteBy)return!1;if(t){var a=this.getItemNode(t);if(a&&"update"==i&&this.s.uniteBy.call(this,e)==this.getItem(t).$unitValue){var r=this.t[t]=this.Ne(e);return webix.html.insertBefore(r,a),void webix.html.remove(a); }}this.callEvent("onBeforeRender",[this.data])&&(this.units=null,this.$h(),this.units&&(this.y.innerHTML=this._h().map(this.jb,this).join(""),this.t=null),this.callEvent("onAfterRender",[]))}},getUnits:function(){var t=[];if(this.units)for(var e in this.units)t.push(e);return t},getUnitList:function(t){ return this.units?this.units[t]:null},jb:function(t){var e=this.data.Me[t.id];return this.callEvent("onItemRender",[t]),t.$unit?this.type.templateStartHeader(t,this.type)+this.type.templateHeader.call(this,t.$unit)+this.type.templateEnd(t,this.type):this.type.templateStart(t,this.type,e)+(t.$template?this.type["template"+t.$template]:this.type.template)(t,this.type)+this.type.templateEnd(t,this.type); },_h:function(){var t,e,i,s;t=[];var n=this.data.$min||0,a=this.data.$max||1/0,r=0;for(i in this.units)for(t.push({$unit:i}),s=this.units[i],e=0;e"+t+""},templateStart:function(t,e,i){if(t.$unit)return e.templateStartHeader.apply(this,arguments); var s="webix_list_item webix_list_"+e.css+"_item"+(i&&i.webix_selected?" webix_selected":"")+(t.$css?t.$css:""),n="width:"+e.widthSize(t,e,i)+"; height:"+e.heightSize(t,e,i)+"; overflow:hidden;"+(e.layout&&"x"==e.layout?"float:left;":"");return'
"; },templateStartHeader:function(t,e,i){var s="webix_unit_header webix_unit_"+e.css+"_header"+(t.$selected?"_selected":""),n="width:"+e.widthSize(t,e,i)+"; height:"+e.headerHeight+"px; overflow:hidden;";return'
'}},$skin:function(){this.type.headerHeight=webix.skin.$active.unitHeaderHeight||20; }},webix.ui.list),webix.EditAbility={defaults:{editaction:"click"},$init:function(t){this.ai={},this.Eb=0,this.bi=0,this.w.style.position="relative",t&&(t.onDblClick=t.onDblClick||{}),this.attachEvent("onAfterRender",this.$s),this.s.editable&&this.ci(),webix.extend(this,webix.Undo)},Ux:function(t){try{ if("number"==typeof t.selectionStart)t.selectionStart=t.selectionEnd=t.value.length;else if("undefined"!=typeof t.createTextRange){var e=t.createTextRange();e.collapse(!1),e.select()}}catch(i){}},$s:function(){var t=this.getEditor();if(t&&t.$inline&&!t.getPopup){var e=this.mi(t);if(e&&e!=t.node){var i=t.node.value; t.node=e,e.value=i,e.focus(),this.Ux(e)}else this.editStop()}},editable_setter:function(t){return t&&this.ci(),t},ci:function(){webix.attachEvent("onEditEnd",webix.bind(function(){this.Eb&&this.editStop()},this)),webix.attachEvent("onClick",webix.bind(function(t){this.Eb&&new Date-this.bi>200&&(this.di&&!this.di.popupType&&t&&this.di.node&&this.di.node.contains(t.target||t.srcElement)||this.editStop()); },this)),this.data.attachEvent&&this.data.attachEvent("onIdChange",webix.bind(function(t,e){this.ei(t,e)},this)),this.attachEvent("onItemClick",function(t){this.s.editable&&"click"==this.s.editaction&&this.edit(t)}),this.attachEvent("onItemDblClick",function(t){this.s.editable&&"dblclick"==this.s.editaction&&this.edit(t); }),this.fi=webix.bind(function(){this.bi=new Date},this),this.ci=function(){},this.gi&&this.gi()},Vs:function(){webix.delay(function(){var t=this.getEditor();if(t&&t.config.liveEdit){var e={value:t.getValue(),old:t.value};if(e.value==e.old)return;t.value=e.value,this.ti(t,e.value,!1),this.callEvent("onLiveEdit",[e,t]); }},this)},hi:function(t){var e=this.s.form;"string"!=typeof e&&(this.s.form=e=webix.ui(e).config.id);var e=webix.$$(e),i=e.setValues?e:e.getChildViews()[0];i.setValues(this.getItem(t.row||t)),e.config.master=this.config.id,e.show(this.getItemNode(t));var s=i.getChildViews()[0];s.focus&&s.focus()},edit:function(t,e,i){ if(this.s.editable&&this.callEvent("onBeforeEditStart",[t])){if(this.s.form)return this.hi(t);var s=this.ii(t);if(s){if(this.getEditor(t))return;e||this.editStop();var n=webix.extend({},webix.editors[s]),a=this.ji(t,n,i);n.config.liveEdit&&(this.Ws=this.attachEvent("onKeyPress",this.Vs));var r=n.getPopup?n.getPopup(a).x:a; return r&&webix.UE(r,"click",this.fi),a&&webix.UE(a,"change",this.ki,{bind:{view:this,id:t}}),i!==!1&&n.focus(),this.$fixEditor&&this.$fixEditor(n),this.bi=webix.edit_open_time=new Date,webix.UIManager.setFocus(this,!0),this.callEvent("onAfterEditStart",[t]),n}return null}},getEditor:function(t){return t?this.ai[t]:this.di; },ei:function(t,e){var i=this.ai[t];i&&(this.ai[e]=i,i.id=e,delete this.ai[t])},ki:function(t){this.view.hasEvent("onEditorChange")&&this.view.callEvent("onEditorChange",[this.id,this.view.getEditorValue(this.id)])},li:function(t){return this.s},ji:function(t,e,i){var s=(e.config=this.li(t),e.render()); e.$inline&&(s=this.mi(t)),e.node=s;var n=this.getItem(t),a=n[this.s.editValue||"value"];return webix.isUndefined(a)&&(a=""),e.setValue(a,n),e.value=a,this.ni(t,e),i!==!1&&this.showItem(t),e.$inline||this.oi(t,s,!0),e.afterRender&&e.afterRender(),s},pi:function(t){return this.getItemNode(t)},mi:function(t){ var e=this.pi(t);return e&&(e=e.getElementsByTagName("input")[0]||e),e},ii:function(t){return this.s.editor},ni:function(t,e){e.id=t,this.ai[t]=this.di=e,this.Eb++},qi:function(t){this.di==t&&(this.di=0),t.destroy&&t.destroy(),delete t.popup,delete t.node,delete this.ai[t.id],this.Eb--},focusEditor:function(t){ var e=this.getEditor.apply(this,arguments);e&&e.focus&&e.focus()},editCancel:function(){this.editStop(null,null,!0)},Xy:function(t){if(t){var e=this.getEditor();if(e&&e.getPopup&&e.getPopup()==t.getTopParentView())return}this.editStop()},editStop:function(t){if(!this.Zx){this.Zx=1;var e=arguments[2],i=1; return t?i=this.ri(this.ai[t],e):this.si(function(t){i*=this.ri(t,e)}),this.Zx=0,i}},ug:function(t){var e=this.getItemNode(t);return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,parent:this.w}},oi:function(t,e,i){if(e.style){var s=this.ug(t);e.style.top=s.top+"px",e.style.left=s.left+"px", e.style.width=s.width-1+"px",e.style.height=s.height-1+"px",e.top=s.top,i&&s.parent.appendChild(e)}},si:function(t){for(var e in this.ai)t.call(this,this.ai[e])},ri:function(t,e){if(t&&!webix.B){var i={value:t.getValue(),old:t.value};if(this.callEvent("onBeforeEditStop",[i,t,e])){if(!e){var s=i.old;if("string"==typeof i.value&&(s+=""), s!=i.value||t.config.liveEdit){var n=this.ti(t,i.value,!0);this.updateItem(t.row||t.id,n)}}t.$inline?t.node=null:webix.html.remove(t.node);var a=t.config.suggest;return a&&"string"==typeof a&&webix.$$(a).hide(),this.qi(t),this.Ws&&this.detachEvent(this.Ws),this.callEvent("onAfterEditStop",[i,t,e]),1} return 0}},validateEditor:function(t){var e=!0;if(this.s.rules){var i=this.getEditor(t),s=i.column||this.s.editValue||"value",n=this.s.rules[s],a=this.s.rules.$all;if(n||a){var r=this.data.getItem(i.row||i.id),h=i.getValue(),o=i.getInputNode();n&&(e=n.call(this,h,r,s)),a&&(e=a.call(this,h,r,s)&&e),e?webix.html.removeCss(o,"webix_invalid"):webix.html.addCss(o,"webix_invalid"), webix.callEvent("onLiveValidation",[i,e,r,h])}}return e},getEditorValue:function(t){var e;return e=0===arguments.length?this.di:this.getEditor(t),e?e.getValue():void 0},getEditState:function(){return this.di||!1},editNext:function(t,e){if(t=t!==!1,1==this.Eb||e){var i=this.ui(this.di||e,function(t){return this.ii(t)?!0:!1; },t);if(this.editStop())return i&&(this.edit(i),this.vi(i)),!1}},vi:function(){},ui:function(t,e,i){var s=this.getIndexById(t.id),n=this.data.order;if(i){for(var a=s+1;a=0;a--)if(e.call(this,n[a]))return n[a];return null},ti:function(t,e,i){ var s=i?{}:this.getItem(t.id);return s[this.s.editValue||"value"]=e,s}},function(){function t(t,i){var s=t.config.suggest;if(s){var n=t.config.suggest=e(s),a=webix.$$(n);a&&i&&a.linkInput(i)}}function e(t){if("string"==typeof t)return t;if(t.linkInput)return t.s.id;"object"==typeof t?(webix.isArray(t)&&(t={ data:t}),t.view=t.view||"suggest"):t===!0&&(t={view:"suggest"});var e=webix.ui(t);return e.config.id}function i(t){var e=t.header&&t.header[0]?t.header[0].text:t.editValue||t.label;return(e||"").toString().replace(/<[^>]*>/g,"")}webix.editors={text:{focus:function(){this.getInputNode(this.node).focus(), this.getInputNode(this.node).select()},getValue:function(){return this.getInputNode(this.node).value},setValue:function(e){var i=this.getInputNode(this.node);i.value=e,t(this,i)},getInputNode:function(){return this.node.firstChild},render:function(){return webix.html.create("div",{"class":"webix_dt_editor" },"")}},"inline-checkbox":{render:function(){return{}},getValue:function(){return this.node.checked},setValue:function(){},focus:function(){this.node.focus()},getInputNode:function(){},$inline:!0},"inline-text":{render:function(){return{}},getValue:function(){ return this.node.value},setValue:function(){},focus:function(){try{this.node.select(),this.node.focus()}catch(t){}},getInputNode:function(){},$inline:!0},checkbox:{focus:function(){this.getInputNode().focus()},getValue:function(){return this.getInputNode().checked},setValue:function(t){this.getInputNode().checked=!!t; },getInputNode:function(){return this.node.firstChild.firstChild},render:function(){return webix.html.create("div",{"class":"webix_dt_editor"},"
")}},select:{focus:function(){this.getInputNode().focus()},getValue:function(){return this.getInputNode().value; },setValue:function(t){this.getInputNode().value=t},getInputNode:function(){return this.node.firstChild},render:function(){var t="",e=this.config.options||this.config.collection;if(e.data&&e.data.each)e.data.each(function(e){t+=""});else if(webix.isArray(e))for(var s=0;s"+h+""}else for(var o in e)t+="";return webix.html.create("div",{"class":"webix_dt_editor"},"")}},popup:{focus:function(){ this.getInputNode().focus()},destroy:function(){this.getPopup().hide()},getValue:function(){return this.getInputNode().getValue()||""},setValue:function(t){this.getPopup().show(this.node),this.getInputNode().setValue(t)},getInputNode:function(){return this.getPopup().getChildViews()[0]},getPopup:function(){ return this.config.$popup||(this.config.$popup=this.createPopup()),webix.$$(this.config.$popup)},createPopup:function(){var t=this.config.popup||this.config.suggest;if(t){var e;return"object"!=typeof t||t.name?e=webix.$$(t):(t.view=t.view||"suggest",e=webix.ui(webix.copy(t))),e.mG||(e.linkInput?e.linkInput(document.body):this.linkInput&&this.linkInput(document.body), e.mG=!0),e}var i=webix.editors.$popup[this.popupType];return"string"==typeof i||i.name||(i=webix.editors.$popup[this.popupType]=webix.ui(i),this.popupInit(i),i.linkInput||this.linkInput(document.body)),i.s.id},linkInput:function(t){webix.UE(webix.toNode(t),"keydown",webix.bind(function(t){if(this.config.$popup){ var e=t.which||t.keyCode,i=this.getInputNode();if(i.isVisible())if(i.moveSelection&&41>e&&e>32){var s;33==e&&(s="pgup"),34==e&&(s="pgdown"),35==e&&(s="bottom"),36==e&&(s="top"),37==e&&(s="left"),38==e&&(s="up"),39==e&&(s="right"),40==e&&(s="down"),i.moveSelection(s)}else 13!==e||"TEXTAREA"===t.target.nodeName&&t.shiftKey||webix.callEvent("onEditEnd",[]); }},this))},popupInit:function(t){},popupType:"text",render:function(){return{}},$inline:!0}},webix.editors.color=webix.extend({focus:function(){},popupType:"color",popupInit:function(t){t.getChildViews()[0].attachEvent("onItemClick",function(t){webix.callEvent("onEditEnd",[t])})}},webix.editors.popup), webix.editors.date=webix.extend({focus:function(){},popupType:"date",setValue:function(t){this.wi=this.config.stringResult||t&&"string"==typeof t,webix.editors.popup.setValue.call(this,t)},getValue:function(){return this.getInputNode().getValue(this.wi?webix.i18n.parseFormatStr:"")||""},popupInit:function(t){ t.getChildViews()[0].attachEvent("onDateSelect",function(t){webix.callEvent("onEditEnd",[t])})}},webix.editors.popup),webix.editors.combo=webix.extend({xi:function(t){return this.config.popup?this.config.popup.config.id:t?e(t):this.rt(t)},rt:function(){var t=webix.editors.combo;return t.st=t.st||this.xi(!0); },render:function(){var t=webix.html.create("div",{"class":"webix_dt_editor"},""),e=this.config.suggest=this.xi(this.config.suggest);return e&&(webix.$$(e).linkInput(t.firstChild,!0),webix.UE(t.firstChild,"click",webix.bind(this.showPopup,this))), t},getPopup:function(){return webix.$$(this.config.suggest)},showPopup:function(){var t=this.getPopup(),e=t.getList(),i=this.getInputNode(),s=this.yi;t.show(i),i.setAttribute("aria-expanded","true"),s?e.exists(s)&&(e.select(s),e.showItem(s)):(e.unselect(),e.showItem(e.getFirstId())),t.ae=i},afterRender:function(){ this.showPopup()},setValue:function(t){if(this.yi=t,this.config.suggest){var e=webix.$$(this.config.suggest),i=this.config.collection||this.config.options;i&&e.getList().data.importData(i),this.getInputNode(this.node).value=e.getItemText(t)}},getValue:function(){var t=this.getInputNode().value;if(this.config.suggest){ var e=webix.$$(this.config.suggest),i=e.getList();(t||i.getSelectedId&&i.getSelectedId())&&(t=e.getSuggestion(t))}return t}},webix.editors.text),webix.editors.richselect=webix.extend({focus:function(){},getValue:function(){return this.getPopup().getValue()},setValue:function(t){var e=this.config.collection||this.config.options; this.getInputNode();e&&this.getPopup().getList().data.importData(e),this.getPopup().show(this.node),this.getPopup().setValue(t)},getInputNode:function(){return this.getPopup().getList()},popupInit:function(t){t.linkInput(document.body)},popupType:"richselect"},webix.editors.popup),webix.editors.password=webix.extend({ render:function(){return webix.html.create("div",{"class":"webix_dt_editor"},"")}},webix.editors.text),webix.editors.$popup={text:{view:"popup",width:250,height:150,body:{view:"textarea"}},color:{view:"popup",body:{view:"colorboard"}},date:{view:"popup", width:250,height:250,padding:0,body:{view:"calendar",icons:!0,borderless:!0}},richselect:{view:"suggest",body:{view:"list",select:!0}}}}(),webix.VirtualRenderStack={$init:function(){this.t={},webix.UE(this.x,"scroll",webix.bind(this.Ai,this)),webix.env.touch&&this.attachEvent("onAfterScroll",webix.bind(this.Ai,this)), this.Bi=[]},getItemNode:function(t){return this.t[t]},showItem:function(t){var e=this.Ci(),i=this.data.getIndexById(t),s=Math.floor(i/e.Di)*e.Ei,n=this.getScrollState();(s=n.y+this.dc)&&this.scrollTo(0,s)},render:function(t,e,i){if(this.isVisible(this.s.id)&&!this.$blockRender)if(t){ var s=this.getItemNode(t);switch(i){case"update":if(!s)return;var n=this.t[t]=this.Ne(e);webix.html.insertBefore(n,s),webix.html.remove(s);break;default:this.Fi()}}else this.callEvent("onBeforeRender",[this.data])&&(this.t={},this.Ai(null,!0),this.Gi=!1,this.callEvent("onAfterRender",[]))},Fi:function(){ this.Gi||(this.Gi=!0,window.setTimeout(webix.bind(function(){this.render()},this),1))},Hi:function(t){webix.env.maxHTMLElementSize&&(t=Math.min(webix.env.maxHTMLElementSize,t));var e=document.createElement("DIV");return e.style.cssText="height:"+t+"px; width:100%; overflow:hidden;",e},Ai:function(t,e){ this.Bi=[];var i=this.Ci();(!this.y.firstChild||e)&&(this.y.innerHTML="",this.y.appendChild(this.Hi(i.Ii)),this.u=[this.y.firstChild]);for(var s=i.R;s<=i.Ji;){for(;this.u[s]&&this.u[s].Ki&&s<=i.Ji;)s++;if(s>i.Ji)break;for(var n=s;!this.u[n];)n--;var a=this.u[n],r=s*i.Di+(this.data.$min||0);if(r>(this.data.$max||1/0))break; var h=Math.min(r+i.Di-1,this.data.$max?this.data.$max-1:1/0),o=this.Hi(i.Ei),l=this.data.getIndexRange(r,h);if(!l.length)break;for(var c={$template:"Loading"},u=0;u=f&&b>0)a.style.height=b+"px",this.u[s+1]=a;else if(0>f?webix.html.remove(a):a.style.height=f+"px",b>0){var p=this.u[s+1]=this.Hi(b);webix.html.insertBefore(p,o.nextSibling,this.y); }s++}if(this.Bi.length){var x=this.Bi[0],w=this.Bi.pop()+1;if(w>x){var g=w-x;if(this.cf(g,x))return;g=Math.max(g,this.s.datafetch||this.s.loadahead||0),this.loadNext(g,x)}}},Ci:function(){var t=this.getScrollState(),e=Math.max(0,t.y),i=this.bc,s=this.dc,n=this.type,a=Math.floor(i/n.width)||1,r=Math.floor(e/n.height),h=Math.ceil((s+e)/n.height)-1,o=this.data.$max?this.data.$max-this.data.$min:this.data.count(),l=Math.ceil(o/a)*n.height; return{R:r,Ji:h,Li:e,Ii:l,Ei:n.height,Di:a}},ug:function(t){var e=this.getItemNode(t);return e||(this.showItem(t),this.Ai(),e=this.getItemNode(t)),{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,parent:this.w}}},webix.protoUI({name:"dataview",$init:function(t){t.sizeToContent&&this.$ready.unshift(this.Mi); var e=t.prerender||this.defaults.prerender||t.type&&"auto"==t.type.width;(e===!1||e!==!0&&!t.autoheight)&&webix.extend(this,webix.VirtualRenderStack,!0),t.autoheight&&(t.scroll=!1),this.w.className+=" webix_dataview",this.x.setAttribute("role","listbox")},Mi:function(){var t=webix.html.create("DIV",0,this.type.template({})); t.style.position="absolute",document.body.appendChild(t),this.type.width=t.offsetWidth,this.type.height=t.offsetHeight,webix.html.remove(t)},defaults:{scroll:!0,datafetch:50,navigation:!0},ad:"webix_l_id",YF:"webix_dataview_item",on_click:{webix_dataview_item:function(t,e){this.s.select&&("multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,"touch"==this.s.multiselect||t.ctrlKey||t.metaKey,t.shiftKey):this.select(e)); }},on_dblclick:{},on_mouse_move:{},type:{template:webix.template("#value#"),templateLoading:webix.template("Loading..."),width:160,height:50,classname:function(t,e,i){var s="webix_dataview_item ";return e.css&&(s+=e.css+" "),t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=t.$css+" "), i&&i.$css&&(s+=i.$css+" "),s},aria:function(t,e,i){return'role="option"'+(i&&i.webix_selected?' aria-selected="true" tabindex="0"':' tabindex="-1"')},templateStart:webix.template('
'), templateEnd:webix.template("
")},Ni:function(t){return this.s.height=this.type.height*Math.ceil(this.data.count()/Math.floor(t/this.type.width))},autoheight_setter:function(t){return t&&(this.data.attachEvent("onStoreLoad",webix.bind(this.resize,this)),this.w.style.overflowY="hidden"),t},$getSize:function(t,e){ this.s.xCount>0&&"auto"!=this.type.width&&!this.Nw&&(this.s.width=this.type.width*this.s.xCount+(this.cc?webix.ui.scrollSize:0)),this.s.yCount&&"auto"!=this.type.height&&(this.s.height=this.type.height*this.s.yCount);var i=this.s.width||this.bc;return this.s.autoheight&&i&&(this.Ni(i),this.scroll_setter(!1)), webix.ui.view.prototype.$getSize.call(this,t,e)},iz:function(){var t=!1;return this.s.yCount&&"auto"==this.type.height&&(this.type.height=Math.floor(this.dc/this.s.yCount),t=!0),this.s.xCount&&("auto"==this.type.width||this.Nw)?(this.Nw=!0,this.type.width=Math.floor(this.bc/this.s.xCount),t=!0):this.Nw=!1, t},$setSize:function(t,e){if(webix.ui.view.prototype.$setSize.call(this,t,e)){if(this.s.autoheight&&this.Ni()!=this.dc)return webix.delay(this.resize,this);(this.iz()||this.Ai)&&this.render()}}},webix.DataMove,webix.DragItem,webix.MouseEvents,webix.KeysNavigation,webix.SelectionModel,webix.Scrollable,webix.CustomPrint,webix.ui.proto), webix.DataDriver.htmltable={toObject:function(t){t=webix.toNode(t);var e=t.rows;return webix.html.remove(t),e},getRecords:function(t){for(var e=[],i=t[0]&&t[0].Oi?1:0;i15e5?(this.s.zoom=t/1e6,t=1e6):this.s.zoom=1,t},scrollWidth_setter:function(t){return t=this.Ti(t),this.x.firstChild.style.width=t+"px",t},scrollHeight_setter:function(t){return t=this.Ti(t),this.x.firstChild.style.height=t+"px",t},sizeTo:function(t,e,i){t=t-(e||0)-(i||0);var s=this.s.scrollSize; webix.env.isIE&&s&&(s+=1),s||!this.s.scrollVisible||webix.env.$customScroll||(this.x.style.pointerEvents="none",s=14),s?(this.x.style.display="block",e&&(this.x.style.marginTop=e+"px"),this.x.style["x"==this.s.scroll?"width":"height"]=Math.max(0,t)+"px",this.x.style["x"==this.s.scroll?"height":"width"]=s+"px"):this.x.style.display="none", this.Si=t},getScroll:function(){return Math.round(this.s.scrollPos*this.s.zoom)},getSize:function(){return Math.round((this.s.scrollWidth||this.s.scrollHeight)*this.s.zoom)},scrollTo:function(t){0>t&&(t=0);var e=this.s;return t/=e.zoom,0>t&&(t=0),t!=this.s.scrollPos?(this.x["x"==e.scroll?"scrollLeft":"scrollTop"]=t, this.Vi(t,!0),!0):void 0},Ri:function(){var t=this.x["x"==this.s.scroll?"scrollLeft":"scrollTop"];Math.floor(t)!=Math.floor(this.s.scrollPos)&&this.Vi(t,!1)},Vi:function(t,e){var i=this.s.scrollWidth||this.s.scrollHeight;t>=i-this.Si/(e?this.s.zoom:1)&&(t=Math.max(0,i-this.Si/this.s.zoom)),this.s.scrollPos=t||0, this.callEvent("onScroll",[this.getScroll()])},activeArea:function(t,e){this.Xi=e,webix.UE(t,webix.env.isIE8?"mousewheel":"wheel",this.Yi,{bind:this}),this.uB(t)},uB:function(t){!webix.env.touch&&window.navigator.pointerEnabled&&(webix.html.addCss(t,"webix_scroll_touch_ie",!0),webix.UE(t,"pointerdown",function(t){ ("touch"==t.pointerType||"pen"==t.pointerType)&&(this.km=webix.Touch.hm(t),this.vB=this.getScroll())},{bind:this}),webix.event(document.body,"pointermove",function(t){var e;this.km&&(this.lm=webix.Touch.hm(t),"x"==this.s.scroll?e=this.lm.x-this.km.x:"y"==this.s.scroll&&(e=this.lm.y-this.km.y),e&&Math.abs(e)>5&&this.scrollTo(this.vB-e)); },{bind:this}),webix.event(window,"pointerup",function(t){this.km&&(this.km=this.lm=null)},{bind:this}))},Yi:function(t){var e=0,i=0===t.deltaMode?30:1;return webix.env.isIE8&&(e=t.detail=-t.wheelDelta/30),t.deltaX&&Math.abs(t.deltaX)>Math.abs(t.deltaY)?this.Xi&&this.s.scrollVisible&&(e=t.deltaX/i):!this.Xi&&this.s.scrollVisible&&(e=webix.isUndefined(t.deltaY)?t.detail:t.deltaY/i), webix.env.isSafari&&(this.Yy=t.target||t.srcElement),e&&this.scrollTo(this.getScroll()+e*this.s.scrollStep)?webix.html.preventEvent(t):void 0}},webix.EventSystem,webix.Settings),webix.Number={getConfig:function(t){var e={decimalSize:0,groupSize:999,prefix:"",sufix:""},i=t.split(/[0-9].*[0-9]/g);i[0].length&&(e.prefix=i[0]), i[1].length&&(e.sufix=i[1]),(e.prefix||e.sufix)&&(t=t.substr(e.prefix.length,t.length-e.prefix.length-e.sufix.length));var s=t.indexOf("1");s>0&&(e.prefix=t.substr(0,s),t=t.substr(s));var n=t.indexOf("0");n>0&&(e.decimalSize=t.length-n,e.decimalDelimiter=t[n-1],t=t.substr(0,n-1));var a=t.match(/[^0-9]/); return a&&(e.groupSize=t.length-a.index-1,e.groupDelimiter=t[a.index]),e},parse:function(t,e){if(!t||"string"!=typeof t)return t;e.prefix&&(t=t.toLowerCase().replace(e.prefix.toLowerCase()||"","")),e.sufix&&(t=t.toLowerCase().replace(e.sufix.toLowerCase()||"",""));var i="";if(e.decimalDelimiter){var s=t.indexOf(e.decimalDelimiter); s>-1&&(i=t.substr(s+1).replace(/[^0-9]/g,""),i=i.substr(0,Math.min(i.length,e.decimalSize)),t=t.substr(0,s))}var n="-"===t[0]?-1:1;return t=t.replace(/[^0-9]/g,""),t||(t="0"),i&&(t+="."+i),parseFloat(t)*n},format:function(t,e){if(""===t||"undefined"==typeof t)return t;e=e||webix.i18n,t=parseFloat(t);var i=0>t?"-":""; t=Math.abs(t),e.decimalOptional||(t=t.toFixed(e.decimalSize));var s=t.toString();s=s.split(".");var n="";if(e.groupSize){var a=e.groupSize,r=s[0].length;do{r-=a;var h=r>0?s[0].substr(r,a):s[0].substr(0,a+r);n=h+(n?e.groupDelimiter+n:"")}while(r>0)}else n=s[0];var s;return s=e.decimalSize?i+n+(s[1]?e.decimalDelimiter+s[1]:""):i+n, e.prefix||e.sufix?e.prefix+s+e.sufix:s},numToStr:function(t){return function(e){return webix.Number.format(e,t)}}},webix.Date={startOnMonday:!1,toFixed:function(t,e){return 10>t&&(t="0"+t),e&&100>t&&(t="0"+t),t},weekStart:function(t){t=this.copy(t);var e=t.getDay();return this.startOnMonday&&(0===e?e=6:e--), this.datePart(this.add(t,-1*e,"day"))},monthStart:function(t){return t=this.copy(t),t.setDate(1),this.datePart(t)},yearStart:function(t){return t=this.copy(t),t.setMonth(0),this.monthStart(t)},dayStart:function(t){return this.datePart(t,!0)},dateToStr:function(t,e){return"function"==typeof t?t:webix.env.strict?function(e){ var i="",s=0;return t.replace(/%[a-zA-Z]/g,function(n,a){i+=t.slice(s,a);var r=function(t){if("%d"==n)return webix.Date.toFixed(t.getDate());if("%m"==n)return webix.Date.toFixed(t.getMonth()+1);if("%j"==n)return t.getDate();if("%n"==n)return t.getMonth()+1;if("%y"==n)return webix.Date.toFixed(t.getFullYear()%100); if("%Y"==n)return t.getFullYear();if("%D"==n)return webix.i18n.calendar.dayShort[t.getDay()];if("%l"==n)return webix.i18n.calendar.dayFull[t.getDay()];if("%M"==n)return webix.i18n.calendar.monthShort[t.getMonth()];if("%F"==n)return webix.i18n.calendar.monthFull[t.getMonth()];if("%h"==n)return webix.Date.toFixed((t.getHours()+11)%12+1); if("%g"==n)return(t.getHours()+11)%12+1;if("%G"==n)return t.getHours();if("%H"==n)return webix.Date.toFixed(t.getHours());if("%i"==n)return webix.Date.toFixed(t.getMinutes());if("%a"==n)return t.getHours()>11?webix.i18n.pm[0]:webix.i18n.am[0];if("%A"==n)return t.getHours()>11?webix.i18n.pm[1]:webix.i18n.am[1]; if("%s"==n)return webix.Date.toFixed(t.getSeconds());if("%S"==n)return webix.Date.toFixed(t.getMilliseconds(),!0);if("%W"==n)return webix.Date.toFixed(webix.Date.getISOWeek(t));if("%c"==n){var e=t.getFullYear();return e+="-"+webix.Date.toFixed(t.getMonth()+1),e+="-"+webix.Date.toFixed(t.getDate()),e+="T", e+=webix.Date.toFixed(t.getHours()),e+=":"+webix.Date.toFixed(t.getMinutes()),e+=":"+webix.Date.toFixed(t.getSeconds())}return n};i+=r(e),s=a+2}),i+=t.slice(s,t.length)}:(t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+webix.Date.toFixed(date.getDate())+"';case"%m":return'"+webix.Date.toFixed((date.getMonth()+1))+"'; case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+webix.Date.toFixed(date.getFullYear()%100)+"';case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+webix.i18n.calendar.dayShort[date.getDay()]+"';case"%l":return'"+webix.i18n.calendar.dayFull[date.getDay()]+"'; case"%M":return'"+webix.i18n.calendar.monthShort[date.getMonth()]+"';case"%F":return'"+webix.i18n.calendar.monthFull[date.getMonth()]+"';case"%h":return'"+webix.Date.toFixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+webix.Date.toFixed(date.getHours())+"'; case"%i":return'"+webix.Date.toFixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?webix.i18n.pm[0]:webix.i18n.am[0])+"';case"%A":return'"+(date.getHours()>11?webix.i18n.pm[1]:webix.i18n.am[1])+"';case"%s":return'"+webix.Date.toFixed(date.getSeconds())+"';case"%S":return'"+webix.Date.toFixed(date.getMilliseconds(), true)+"'; case"%W":return'"+webix.Date.toFixed(webix.Date.getISOWeek(date))+"';case"%c":var i='"+date.getFullYear()+"';return i+='-"+webix.Date.toFixed((date.getMonth()+1))+"',i+='-"+webix.Date.toFixed(date.getDate())+"',i+="T",i+='"+webix.Date.toFixed(date.getHours())+"',i+=':"+webix.Date.toFixed(date.getMinutes())+"', i+=':"+webix.Date.toFixed(date.getSeconds())+"',e===!0&&(i+="Z"),i;default:return t}}),e===!0&&(t=t.replace(/date\.get/g,"date.getUTC")),new Function("date","if (!date) return ''; if (!date.getMonth) date=webix.i18n.parseFormatDate(date); return \""+t+'";'))},strToDate:function(t,e){if("function"==typeof t)return t; var i,s,n,a=t.match(/%[a-zA-Z]/g),r="var temp=date.split(/[^0-9a-zA-Z]+/g);";if(!webix.i18n.calendar.monthShort_hash){for(n=webix.i18n.calendar.monthShort,s=webix.i18n.calendar.monthShort_hash={},i=0;i30?1900:2e3);else if("%Y"==r)n[0]=1*(s[i]||0),n[0]<30&&(n[0]+=2e3);else if("%n"==r||"%m"==r)n[1]=(s[i]||1)-1;else if("%M"==r)n[1]=webix.i18n.calendar.monthShort_hash[s[i]]||0;else if("%F"==r)n[1]=webix.i18n.calendar.monthFull_hash[s[i]]||0;else if("%j"==r||"%d"==r)n[2]=s[i]||1;else if("%g"==r||"%G"==r||"%h"==r||"%H"==r)n[3]=s[i]||0;else if("%a"==r)n[3]=n[3]%12+((s[i]||"")==webix.i18n.am[0]?0:12);else if("%A"==r)n[3]=n[3]%12+((s[i]||"")==webix.i18n.am[1]?0:12);else if("%i"==r)n[4]=s[i]||0;else if("%s"==r)n[5]=s[i]||0;else if("%S"==r)n[6]=s[i]||0;else if("%c"==r){ var h=/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)(\+.*|)/g,o=h.exec(t);n[0]=1*(o[1]||0),n[0]<30&&(n[0]+=2e3),n[1]=(o[2]||1)-1,n[2]=o[3]||1,n[3]=o[4]||0,n[4]=o[5]||0,n[5]=o[6]||0}}return e?new Date(Date.UTC(n[0],n[1],n[2],n[3],n[4],n[5],n[6])):new Date(n[0],n[1],n[2],n[3],n[4],n[5],n[6])};for(i=0;i30?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":r+="set[3]=temp["+i+"]||0;";break;case"%i":r+="set[4]=temp["+i+"]||0;";break;case"%Y":r+="set[0]=(temp["+i+"]||0)*1; if (set[0]<30) set[0]+=2000;"; break;case"%a":r+="set[3]=set[3]%12+(temp["+i+"]==webix.i18n.am[0]?0:12);";break;case"%A":r+="set[3]=set[3]%12+(temp["+i+"]==webix.i18n.am[1]?0:12);";break;case"%s":r+="set[5]=temp["+i+"]||0;";break;case"%S":r+="set[6]=temp["+i+"]||0;";break;case"%M":r+="set[1]=webix.i18n.calendar.monthShort_hash[temp["+i+"]]||0;"; break;case"%F":r+="set[1]=webix.i18n.calendar.monthFull_hash[temp["+i+"]]||0;";break;case"%c":r+="var res = date.split('T');",r+="if(res[0]){ var d = res[0].split('-');",r+="set[0]= (d[0]||0)*1; if (set[0]<30) set[0]+=2000;",r+="set[1]= (d[1]||1)-1;",r+="set[2]= d[2]||1;}",r+="if(res[1]){ var t = res[1].split(':');", r+="set[3]= t[0]||0;",r+="set[4]= t[1]||0;",r+="set[5]= parseInt(t[2])||0;}"}var h="set[0],set[1],set[2],set[3],set[4],set[5], set[6]";return e&&(h=" Date.UTC("+h+")"),new Function("date","if (!date) return ''; if (typeof date == 'object') return date; var set=[0,0,1,0,0,0,0]; "+r+" return new Date("+h+");"); },getISOWeek:function(t){if(!t)return!1;var e=t.getDay();0===e&&(e=7);var i=new Date(t.valueOf());i.setDate(t.getDate()+(4-e));var s=i.getFullYear(),n=Math.floor((i.getTime()-new Date(s,0,1).getTime())/864e5),a=1+Math.floor(n/7);return a},getUTCISOWeek:function(t){return this.getISOWeek(t)},Jv:function(t,e,i,s){ if(i){var n=s(t,e);if(n)for(var a=i>0?1:-1;n;)t.setHours(t.getHours()+a),n=s(t,e),a+=i>0?1:-1}},add:function(t,e,i,s){s&&(t=this.copy(t));var n=webix.Date.copy(t);switch(i){case"day":t.setDate(t.getDate()+e),this.Jv(t,n,e,function(t,e){return webix.Date.datePart(e,!0).valueOf()==webix.Date.datePart(t,!0).valueOf(); });break;case"week":t.setDate(t.getDate()+7*e),this.Jv(t,n,7*e,function(t,e){return webix.Date.datePart(e,!0).valueOf()==webix.Date.datePart(t,!0).valueOf()});break;case"month":t.setMonth(t.getMonth()+e),this.Jv(t,n,e,function(t,e){return e.getMonth()==t.getMonth()&&e.getYear()==t.getYear()});break;case"year": t.setYear(t.getFullYear()+e),this.Jv(t,n,e,function(t,e){return e.getFullYear()==t.getFullYear()});break;case"hour":t.setHours(t.getHours()+e),this.Jv(t,n,e,function(t,e){return e.getHours()==t.getHours()&&webix.Date.datePart(e,!0)==webix.Date.datePart(t,!0)});break;case"minute":t.setMinutes(t.getMinutes()+e); break;default:webix.Date.add[i](t,e,i)}return t},datePart:function(t,e){e&&(t=this.copy(t));var i=this.copy(t);return i.setHours(0),i.getDate()!=t.getDate()?t.setHours(1):t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},timePart:function(t,e){return e&&(t=this.copy(t)),(t.valueOf()/1e3-60*t.getTimezoneOffset())%86400; },copy:function(t){return new Date(t.valueOf())},equal:function(t,e){return t&&e?t.valueOf()===e.valueOf():!1},isHoliday:function(t){return t=t.getDay(),0===t||6==t?"webix_cal_event":void 0}},webix.i18n={Zi:["fullDateFormat","timeFormat","dateFormat","longDateFormat","parseFormat","parseTimeFormat"], parseFormat:"%Y-%m-%d %H:%i",parseTimeFormat:"%H:%i",numberFormat:webix.Number.format,priceFormat:function(t){return webix.i18n.$i(webix.i18n.numberFormat(t,webix.i18n._i))},setLocale:function(t){var e=function(t,i){for(var s in i)"object"!=typeof i[s]||webix.isArray(i[s])?t[s]=i[s]:(t[s]||(t[s]={}), e(t[s],i[s]))};"string"==typeof t&&(t=this.locales[t]),t&&(t.priceSettings=webix.copy(t.priceSettings||t),e(this,t));for(var i=webix.i18n.Zi,s=0;s=this.s.leftSplit&&tr;r++)s+=this.fj[i+r]?this.fj[i+r].width:this.config.columnWidth;var h=webix.html.getTextSize([t.text],a,s);return(t.rotate?h.width:h.height)+1},Mj:function(t,e){for(var i=0,s=0;s=0;s--)e[s]=e[s]||this.s.headerRowHeight,e.Ot+=1*e[s];for(var s=0;sa;a++)n[a]=null}}return i},Pj:function(t,e){for(var i=t.getElementsByTagName("TD"),s=0;se;e++)s+=t[e]+1;return s; },Qj:function(t,e,i,s,n){if(t==e)return"";for(var a="",r=t;e>r;r++){a+="";for(var r=t;e>r;r++)a+="";a+=""}for(var h=this.fj[0][s].length,o=0;h>o;o++){ a+="";for(var r=t;e>r;r++){var l=this.fj[r][s][o];if(null!==l){l.content&&(l.contentId=l.contentId||webix.uid(),l.columnId=this.fj[r].id,l.format=this.fj[r].format,l.text=webix.ui.datafilter[l.content].render(this,l),this.hj[l.contentId]=l,this.Rj=!0),a+=""}}a+=""}return a+="
=e-1&&(c+=" webix_last"),c&&(a+=' class="'+c+'"');var d=n[o],f="";l.contentId&&(a+=" active_id='"+l.contentId+"'"),l.colspan&&(a+=" colspan='"+l.colspan+"'"),l.rowspan&&(a+=" rowspan='"+l.rowspan+"'",d=this.Pt(this.Mt,o,l.rowspan)), d!=this.s.headerRowHeight&&(f=" style='line-height:"+d+"px; height:"+d+"px;'");var b="webix_hcell",p=l.css;p&&("object"==typeof p&&(l.css=p=webix.html.createCss(p)),b+=" "+p),this.fj[r].$selected&&(b+=" webix_sel_hcell"),a+=">
";var x=""===l.text?" ":l.text; l.rotate&&(x="
"+x+"
"),a+=x+"
"},showItemByIndex:function(t,e){var i=this.s.pager;if(i){var s=Math.floor(t/i.size); s!=i.page&&webix.$$(i.id).select(s)}if(-1!=t){var n=this.Sj();if(t=n[1]-1){var a=this.Tj(i?this.data.$min:0,t);t0&&(a+=this.Uj(t-1)-1)),this.Wj.scrollTo(a)}}if(-1!=e){if(e=this.Fj)return;var n=this.Xj(); if(e=n[1]-1){for(var a=0,r=this.s.leftSplit;e>r;r++)a+=this.fj[r].width;e=this.s.topSplit?a+this.fj[i].qk-this.s.topSplit:a); return{rind:s,cind:i,span:n}},ZF:function(){for(var t=-this.Yj,e=0;et)){var n=this.fj[t];n.minWidth&&e=this.s.leftSplit&&tt;t++)i+=this.Uj(t);return i}, ug:function(t,e){var i;1==arguments.length&&(e=t.column,t=t.row);for(var s=this.getItem(t),n=this.getColumnConfig(e),a=0,r=0,h=0;h=this.Fj?2:1;r=this.Vf.childNodes[l].firstChild;break; }a+=o.width}return i=this.getIndexById(t)0&&this.fj.length-1>i;)e-=this.fj[i].width,i++;var s=i;for(e&&i>0&&i--,e+=this.Yj;e>0&&s0;)e-=this.Uj(a),a++;var l=a>0&&e?-(this.Uj(a-1)+e):0,c=a;if(e&&a--,e+=(this.Vj||this.dc)-(this.xD||0),h){var o=Math.ceil(e/h);e-=o*h,c+=o}else for(;e>0&&s>c;)e-=this.Uj(c),c++;return c>s&&(c=s),[a,c,l]},Kv:function(t){var e=this.getItem(t),i=this.getIndexById(t),s=this.Sj(),n=this.config.topSplit,a=""; if(i>=n){if(i=s[1])return;i-=s[0]-n}else a=i==n-1?" webix_topcell webix_last_topcell":" webix_topcell";for(var r=this.Xj(),h=0;h=this.s.leftSplit&&(hr[1])&&(o.qk=-999),o.attached&&o.node){var l=o.node.childNodes[i];if(!l)continue; var c=this.Ek(e,this.fj[h],0);l.innerHTML=c,l.className=this.Mv(this.fj[h],c,e,t)+a}}},vj:function(t,e){if(this.fj.length){e&&this.uk();var i=this.Xj(this.s.prerender),s=this.Sj(this.s.prerender===!0);if(t){for(var n=this.s.leftSplit;n=this.Fk;if(this.Fk=t[0],this.Gk){if(e&&(!i||i>=e.size)&&this.Hk([0,e.size*e.page],Math.max(i,e.size),!0))return this.Gk=null;this.Ik(this.Gk,s),this.Gk=null; }else if(this.s.loadahead){this.Hk(t,this.s.loadahead,s)}},Hk:function(t,e,i){var s=t[1],n=s+e;i||(s=t[0]-e,n=t[0]),0>s&&(s=0),n=Math.min(n,this.data.order.length-1);for(var a=!1,r=s;n>r;r++)this.data.order[r]||(a?(a.last=r,a.count=r-s):a={start:r,count:n-s});return a?(this.Ik(a,i),!0):void 0},Ik:function(t,e){ var i=Math.max(t.count,this.s.datafetch||this.s.loadahead||0),s=e?t.start:t.last-i+1;this.cf(t.count,t.start)||this.loadNext(i,s)},Zy:function(t){if(webix.env.isSafari){var e,i,s,n,a=[this.Zj,this.Wj];for(e=0;2>e;e++)n=a[e],n&&n.Yy&&n.Yy.parentNode==t&&(i=n.Yy);i&&(this.$y&&webix.html.remove(this.$y), this.$y=i,s=i.cloneNode(!0),i.parentNode.insertBefore(s,i),this.$y.style.display="none",this.Vf.appendChild(this.$y))}},vk:function(t){var e=this.fj[t];this.Zy(e.node),webix.html.remove(e.node),e.attached=!1},uk:function(){for(var t=0;t"},radio:function(t,e,i,s){var n=i==s.checkValue?'checked="true"':"";return""},editIcon:function(){return""},trashIcon:function(){ return""}},type_setter:function(t){return this.types&&this.types[t]?(this.type=webix.clone(this.types[t]),this.type.css&&(this.w.className+=" "+this.type.css)):webix.type(this,t),this.type.on_click&&webix.extend(this.on_click,this.type.on_click), t},xk:function(t,e,i,s){var n=this.fj[t];if(!n.attached){var a=t=this.Fj?2:1;this.Vf.childNodes[a].firstChild.appendChild(n.node),n.attached=!0,n.split=a}if(this.ak=e[0],this.ck=0,this.aC=e[2],this.s.scrollAlignY?e[1]==this.data.order.length||this.data.$pagesize&&e[1]%this.data.$pagesize===0?n.node.style.top=(this.ck=e[2])+"px":n.Jk&&(n.node.style.top="0px"):(this.ck=e[2], n.node.style.top=e[2]+"px"),!(i||n.qk!=e[0]||n.Kk!=e[1]||this.s.topSplit&&n.ck!=this.ck))return 0;for(var r="",h=this.s.columns[t],o={row:this.s.rowHeight,total:0,single:s},l=0;l
"}var a=this.Ek(h,e,t),u=this.Mv(e,a,h,r);-1!==u.indexOf("select")&&(l+=" aria-selected='true' tabindex='0'");var d=!!h.$subopen,f=d?"margin-bottom:"+h.$subHeight+"px;":""; n>=0&&(n>0&&(f+="top:"+n+"px;'"),u="webix_topcell "+u,t==this.s.topSplit-1&&(u="webix_last_topcell "+u)),h.$height?(o=""+a+"
",s.total+=h.$height-s.row):o=""+a+"",d&&(s.total+=h.$subHeight); }else o="
",this.Gk?this.Gk.last=t:this.Gk={start:t,count:i[1]-t};return s.total+=s.row,o},yj:function(){if(this.fj.length&&!isNaN(1*this.dc)){var t=this.wj+(this.nj?this.nj:0);if(!this.s.autoheight&&!this.s.yCount||!this.resize()){this.Wj.sizeTo(this.dc,this.$g,this.jj), this.Wj.define("scrollHeight",t),this.xD=this.s.topSplit?this.Tj(0,this.s.topSplit):0,this.Vj=Math.max(0,this.dc-this.nj-this.$g-this.jj);for(var e=0;3>e;e++)this.Vf.childNodes[e].style.height=this.Vj+"px",this.s.prerender?this.Vf.childNodes[e].firstChild.style.height=this.wj+"px":this.Vf.childNodes[e].firstChild.style.height=this.Vj+"px"; this.I.style.height=this.$g+"px"}}},Jj:function(){if(this.fj.length){var t=0;for(this.dk=0,this.ek=0,this.Yj=0;t=this.Fj;)this.ek+=this.fj[t].width,t--;if(this.bc&&(!this.s.autowidth||!this.resize())){this.Yj=this.bc-this.ek-this.dk-this.oj, this.Vf.childNodes[1].firstChild.style.width=this.Gj+"px",this.Vf.childNodes[0].style.width=this.dk+"px",this.Vf.childNodes[1].style.width=this.Yj+"px",this.Vf.childNodes[2].style.width=this.ek+"px",this.I.childNodes[0].style.width=this.dk+"px",this.I.childNodes[1].style.width=this.Yj+"px",this.I.childNodes[2].style.width=this.ek+"px", this.cj.childNodes[0].style.width=this.dk+"px",this.cj.childNodes[1].style.width=this.Yj+"px",this.cj.childNodes[2].style.width=this.ek+"px";var e=this.Yj-this.Gj;if(0>e&&(e=0),e!=this.Lj&&(this.Lj=e,this.Oj()),webix.env.isWebKit){var i=this.Vf.childNodes[0].offsetWidth;i=this.Vf.childNodes[1].offsetWidth, i=this.Vf.childNodes[1].firstChild.offsetWidth,i=this.Vf.childNodes[2].offsetWidth}this.Zj.sizeTo(this.bc-this.oj),this.Zj.define("scrollWidth",this.Gj+this.dk+this.ek)}}},$getSize:function(t,e){if((this.s.autoheight||this.s.yCount)&&this.s.columns){var i=(this.s.yCount||0)*this.s.rowHeight;i||(i=this.isVisible()?this.wj:this.count()*this.s.rowHeight), this.s.height=Math.max(i+(this.nj?this.nj:0)-1,this.s.minHeight||0)+this.$g+this.jj}this.s.autowidth&&this.s.columns&&(this.s.width=Math.max(this.Gj+this.dk+this.ek+this.oj,this.s.minWidth||0));var s=this.dk+this.ek+this.oj,n=webix.ui.view.prototype.$getSize.call(this,t,e);return n[0]=Math.max(n[0]||s), n},Ow:function(){if(this.Zj&&!webix.env.touch){var t=this.getScrollState();this.Zj.Wi=this.Wj.Wi=-1,this.scrollTo(t.x,t.y)}},$setSize:function(t,e){var i=this.bc,s=this.dc;webix.ui.view.prototype.$setSize.apply(this,arguments)&&(this.tj&&(this.callEvent("onResize",[this.bc,this.dc,i,s]),this.Jj(),this.yj()), this.render())},Mk:function(t){var e=this.getColumnConfig(t);if(e.sort){var i="asc";e.id==this.Nk&&(i="asc"==this.Ok?"desc":"asc"),this.zf(e.id,i,e.sort)}},markSorting:function(t,e){this.Pk||(this.Pk=webix.html.create("DIV"));var i=this.Pk.parentNode;if(i&&(i.removeAttribute("aria-sort"),i.removeAttribute("tabindex")), webix.html.remove(this.Pk),e){var s=this.Qk(this.getColumnIndex(t));s&&(this.Pk.className="webix_ss_sort_"+e,s.style.position="relative",s.appendChild(this.Pk),s.setAttribute("aria-sort",e+"ending"),s.setAttribute("tabindex","0")),this.Nk=t,this.Ok=e}else this.Nk=this.Ok=null},scroll_setter:function(t){ return"string"==typeof t?(this.s.scrollX=-1!=t.indexOf("x"),this.s.scrollY=-1!=t.indexOf("y"),t):this.s.scrollX=this.s.scrollY=t},Qk:function(t){for(var e=this.I.getElementsByTagName("TD"),i=null,s=0;s=0;u--)e[r[u]]&&h.push(e[r[u]])}if(n.parentNode.getAttribute&&!l){ var d=n.parentNode.getAttribute("column")||n.getAttribute("column");if(d){var f="DIV"==n.parentNode.tagName;if(!this.fj[d])return;if(o=!0,f){var b=n.parentNode.getAttribute("row")||n.getAttribute("row");if(!b){if(n.getAttribute("column"))return;b=webix.html.index(n),b>=this.s.topSplit&&(b+=this.fj[d].qk-this.s.topSplit); }this.Qc=l={row:this.data.order[b],column:this.fj[d].id},l.toString=this.ok}else this.Qc=l={column:this.fj[d].id};if(a=this.iA(h,t,l,n),a===!1)return;if(f)this.callEvent("on"+i,[l,t,n])&&s&&this.callEvent("on"+s,[l,t,n]);else if("ItemClick"==i){var p="header"==n.parentNode.parentNode.getAttribute("section"); p&&this.callEvent("onHeaderClick",[l,t,n])&&this.Mk(l.column)}h=[]}}n=n.parentNode}return this.iA(h,t,l,this.$view),o}},showOverlay:function(t){if(!this.Rk){var e=webix.html.create("DIV",{"class":"webix_overlay"},"");this.Vf.appendChild(e),this.Rk=e}this.Rk.innerHTML=t},hideOverlay:function(){this.Rk&&(webix.html.remove(this.Rk), this.Rk=null)},mapCells:function(t,e,i,s,n,a){if(null===t&&this.data.order.length>0&&(t=this.data.order[0]),null===e&&(e=this.columnId(0)),null===i&&(i=this.data.order.length),null===s&&(s=this.s.columns.length),this.exists(t)&&(t=this.getIndexById(t),e=this.getColumnIndex(e),null!==e))for(var r=0;i>r&&t+rc&&e+c"}},textFilter:{getInputNode:function(t){return t.firstChild?t.firstChild.firstChild:{value:null}},getValue:function(t){return this.getInputNode(t).value},setValue:function(t,e){this.getInputNode(t).value=e; },refresh:function(t,e,i){e.component=t.s.id,t.registerFilter(e,i,this),e.Sk=t.s.id,i.value&&this.getValue(e)!=i.value&&this.setValue(e,i.value),e.onclick=webix.html.preventEvent,webix.UE(e,"keydown",this.Tk)},render:function(t,e){return this.init&&this.init(e),e.css="webix_ss_filter",""; },Tk:function(t,e,i){var s=this.Sk;9!=(t.which||t.keyCode)&&(this.Uk&&window.clearTimeout(this.Uk),this.Uk=window.setTimeout(function(){var t=webix.$$(s);t&&t.filterByAll()},webix.ui.datafilter.textWaitDelay))}},selectFilter:{getInputNode:function(t){return t.firstChild?t.firstChild.firstChild:{value:null }},getValue:function(t){return this.getInputNode(t).value},setValue:function(t,e){this.getInputNode(t).value=e},refresh:function(t,e,i){i.compare=i.compare||function(t,e){return t==e},e.component=t.s.id,t.registerFilter(e,i,this);var s,n=i.options;n?"string"==typeof n?(s=i.options=[],webix.ajax(n).then(webix.bind(function(s){ i.options=s.json(),this.refresh(t,e,i)},this))):s=n:(s=t.collectValues(i.columnId),s.unshift({id:"",value:""}));var a=webix.$$(n);a&&a.data&&a.data.getRange&&(s=a.data.getRange());for(var r=document.createElement("select"),h=0;h=33&&40>=n||(this.Uk&&window.clearTimeout(this.Uk),this.Uk=window.setTimeout(function(){webix.$$(s).filterByAll()},webix.ui.datafilter.textWaitDelay))}},webix.ui.datafilter.textFilter), webix.ui.datafilter.serverSelectFilter=webix.extend({$server:!0,Vk:function(t,e,i){var s=this.Sk;webix.$$(s).filterByAll()}},webix.ui.datafilter.selectFilter),webix.ui.datafilter.numberFilter=webix.extend({init:function(t){t.prepare=function(e,i){var s=-1!=e.indexOf("=")?1:0,n=this.format(e);return""===n?"":(-1!=e.indexOf(">")?t.compare=this.Wk:-1!=e.indexOf("<")?(t.compare=this.Xk, s*=-1):(t.compare=this.Yk,s=0),n-s)}},format:function(t){return t.replace(/[^\-\.0-9]/g,"")},Wk:function(t,e){return 1*t>e},Xk:function(t,e){return""!==t&&e>1*t},Yk:function(t,e){return 1*t==e}},webix.ui.datafilter.textFilter),webix.ui.datafilter.dateFilter=webix.extend({format:function(t){if(""===t)return""; var e=new Date;if(-1!=t.indexOf("today"))e=webix.Date.dayStart(e);else if(-1==t.indexOf("now")){var i=t.match(/[0-9]+/g);if(!i||!i.length)return"";i.length<3?(i.reverse(),e=new Date(i[0],(i[1]||1)-1,1)):e=webix.i18n.dateFormatDate(t.replace(/^[>< =]+/,""))}return e.valueOf()}},webix.ui.datafilter.numberFilter), webix.extend(webix.ui.datatable,{filterByAll:function(){var t=!1;this.data.silent(function(){this.filter();var e=!1;for(var i in this.ij)if(this.isColumnVisible(i)){var s=this.ij[i],n=s[2].getValue(s[0]),a=n;s[1].prepare&&(a=s[1].prepare.call(s[2],a,s[1],this)),s[1].value=n;var r=s[1].compare;if(this.callEvent("onBeforeFilter",[i,a,s[1]]))if(s[2].$server||t)t=!0;else{ if(""===a)continue;r?(r=this.fC(i,r),this.filter(webix.bind(function(t,e){return t?r(t[i],e,t):!1},this),a,e)):this.filter(i,a,e),e=!0}}t&&this.jA()},this),t||(this.refresh(),this.callEvent("onAfterFilter",[]))},fC:function(t,e){var i=this.getColumnConfig(t),s=i?i.optionslist:null;return s?("string"!=typeof s&&(s=","), function(t,i,n){if(!t)return!0;for(var a=t.split(s),r=0;r=0;t--){var e=this.el[t].row;this.exists(e)||(this.el.splice(t,1),delete this.gl[e])}},al:function(){this.el=[],this.gl={},this.dl=[]},isSelected:function(t,e){var i;return i=webix.isUndefined(e)?"object"==typeof t?this.fl(t):t:this.fl({row:t,column:e}),this.gl[i]; },getSelectedId:function(t,e){var i;if(this.el.length>1||t){if(i=[].concat(this.el),e)for(var s=0;sn){var a=s;s=n,n=a}this.Dg=!0;for(var r=s;n>=r;r++){var h=this.getIdByIndex(r);if(!h){t&&this.select(t);break}this.select(h,i)}this.Dg=!1,this.jl()}},cell:{fl:function(t){return t.column?t.row+"_"+t.column:null},select:function(t,e,i){this.hl({row:t,column:e},i)},kl:function(t){var e=this.nl(t.row); return e.$count++,e[t.column]=!0,t.row},unselect:function(t,e){this.ll({row:t,column:e})},ml:function(t){var e=this.nl(t.row);return e.$count--,e[t.column]=!1,e.$count<=0&&this.data.removeMark(t.row,"webix_selected"),t.row},mapSelection:function(t){return this.pl(t,!1,!1)},ol:function(t,e){return this.selectRange(t.row,t.column,e.row,e.column); },selectRange:function(t,e,i,s,n){webix.isUndefined(n)&&(n=!0);var a=t?this.getIndexById(t):0,r=i?this.getIndexById(i):this.data.order.length-1,h=e?this.getColumnIndex(e):0,o=s?this.getColumnIndex(s):this.fj.length-1;if(a>r){var l=a;a=r,r=l}if(h>o){var l=h;h=o,o=l}this.Dg=!0;for(var c=a;r>=c;c++)for(var u=h;o>=u;u++)this.select(this.getIdByIndex(c),this.columnId(u),n); this.Dg=!1,this.jl()}},column:{Lk:" webix_column_select",fl:function(t){return t.column},ok:function(){return this.column},select:function(t,e){this.hl({column:t},e)},kl:function(t){this.s.columns[this.getColumnIndex(t.column)].$selected=!0,this.Dg||this.Kj()},unselect:function(t){this.ll({column:t}); },ml:function(t){this.s.columns[this.getColumnIndex(t.column)].$selected=null,this.Kj()},mapSelection:function(t){return this.pl(t,!0,!1)},ol:function(t,e){return this.selectRange(t.column,e.column)},selectRange:function(t,e,i){webix.isUndefined(i)&&(i=!0);var s=t?this.getColumnIndex(t):0,n=e?this.getColumnIndex(e):this.fj.length-1; if(s>n){var a=s;s=n,n=a}this.Dg=!0;for(var r=s;n>=r;r++)this.select(this.columnId(r),i);this.Dg=!1,this.Kj(),this.jl()},rF:function(){}},area:{fl:function(t){return t.row+"_"+t.column},getSelectedId:function(t){var e=this.getSelectArea(),i=[];if(e)if(!t||e.start.row==e.end.row&&e.start.column==e.end.column)i.push(e.end);else{ var s=this.getIndexById(e.start.row),n=this.getIndexById(e.end.row);if(-1==s||-1==n)return i;for(var a=this.getColumnIndex(e.start.column),r=this.getColumnIndex(e.end.column),h=s;n>=h;h++)for(var o=a;r>=o;o++)i.push({row:this.getIdByIndex(h),column:this.columnId(o)})}return t?i:i[0]},unselect:function(t){ this.ll()},ll:function(){this.removeSelectArea(),this.callEvent("onSelectChange",[])},mapSelection:function(t){var e=this.getSelectArea();if(e)for(var i=this.getColumnIndex(e.start.column),s=this.getColumnIndex(e.end.column),n=this.getIndexById(e.start.row),a=this.getIndexById(e.end.row),r=n;a>=r;r++)for(var h=this.data.order[r],o=this.getItem(h),l=i;s>=l;l++){ var c=this.fj[l].id;if(!t)return{row:h,column:c};o[c]=t(o[c]||"",h,c,r-n,l-i)}},select:function(t,e,i){this.hl({row:t,column:e},i)},ol:function(t,e){this.gC(t,e)},hl:function(t,e){return this.addSelectArea(t,t,!1),!0},rF:function(){this.el.length&&this.refreshSelectArea()}}}}),webix.extend(webix.ui.datatable,{ blockselect_setter:function(t){return t&&this.ql&&(webix.UE(this.x,webix.env.mouse.move,this.rl,{bind:this}),webix.UE(this.x,webix.env.mouse.down,this.sl,{bind:this}),webix.event(document.body,webix.env.mouse.up,this.tl,{bind:this}),this.ql=this.ul=this.vl=!1,this.attachEvent("onAfterScroll",function(){ this.ZC()}),webix.extend(this,webix.AutoScroll,!0),this.attachEvent("onBeforeAutoScroll",function(){return this.vl})),t},ql:!0,wl:function(t,e){for(var i=t.target||t.srcElement;i;){if(i.getAttribute&&i.getAttribute("webixignore"))return!1;if(i==e)return!0;i=i.parentNode}return!1},sl:function(t){if((!this.s.subview||this==webix.$$(t.target||t.srcElement))&&this.wl(t,this.Vf)){ if(t.target&&"INPUT"==t.target.tagName||this.Pl)return;this.xl=webix.html.offset(this.Vf);var e=webix.html.pos(t);this.ul=[e.x-this.xl.x,e.y-this.xl.y],webix.html.preventEvent(t)}},tl:function(t){this.yl&&(this.jz("select",!0,t),this.yl=webix.html.remove(this.yl)),webix.html.removeCss(document.body,"webix_noselect"), this.ul=this.vl=!1,this.bh&&(this.bh=window.clearTimeout(this.bh))},ZC:function(){this.vl&&this.jz(!1,!1)},jz:function(t,e,i){var s=null;this.ul[2]||(this.ul[2]=this.zl.apply(this,this.ul)),s=this.ul[2];var n=this.zl.apply(this,this.vl);if(this.callEvent("onBeforeBlockSelect",[s,n,e,i])){if((!this.wB||this.wB(s,n,e,i)!==!1)&&s.row&&n.row)if("select"===t)this.il(), this.ol(s,n);else{var a,r,h,o;if("box"===t)a=Math.min(this.ul[0],this.vl[0]),h=Math.max(this.ul[0],this.vl[0]),r=Math.min(this.ul[1],this.vl[1]),o=Math.max(this.ul[1],this.vl[1]);else{var l=this.ug(s.row,s.column),c=this.ug(n.row,n.column),u=this.getScrollState(),d=l.width,f=c.width;this.ek&&this.ul[0]>this.dk+this.Yj?l.left+=this.dk+this.Yj:this.dk?this.ul[0]>this.dk&&(l.leftthis.dk+this.Yj?c.left+=this.dk+this.Yj:this.dk?this.vl[0]>this.dk&&(c.leftthis.dk+this.Yj?t+=this.Zj.getSize()-this.Yj-this.dk-this.ek:(!this.dk||t>this.dk)&&(t+=this.Zj.getScroll()),this.s.topSplit&&this.ak>this.s.topSplit){var a=this.ug(this.getIdByIndex(this.s.topSplit-1),this.columnId(0)); a.top+a.height>e&&(i=!0)}i||(e+=this.getScrollState().y),0>t&&(t=0),0>e&&(e=0);for(var r=this.s.columns,h=this.data.order,o=0,l=0;l=t){n=r[l].id;break}n||(n=r[r.length-1].id),o=0;var c=this.data.$min||0;if(this.s.fixedRowHeight)s=h[c+Math.floor(e/this.s.rowHeight)];else for(var l=c;l=e){s=h[l];break}return s||(s=h[h.length-1]),{row:s,column:n}},zD:function(t,e){var i=0,s=this.getIndexById(t.row);if(s>=this.s.topSplit){var n=this.ug(this.getIdByIndex(s),t.column),a=this.ug(this.getIdByIndex(this.s.topSplit-1),t.column);a.top+a.height-n.top>0&&(i=a.top+a.height-(n.top>0||!e?n.top:0)); }return i}}),webix.protoUI({name:"resizearea",defaults:{dir:"x"},$init:function(t){var e=t.dir||"x",i=webix.toNode(t.container),s="x"==e?"width":"height",n=t.margin?t.margin+"px":0;this.Cl="x"==e?"left":"top",this.x=webix.html.create("DIV",{"class":"webix_resize_area webix_dir_"+e}),webix.UE(this.x,webix.env.mouse.down,webix.html.stopEvent), n&&(n="x"==e?n+" 0 "+n:"0 "+n+" 0 "+n),this.Dl=webix.html.create("DIV",{"class":"webix_resize_handle_"+e,style:n?"padding:"+n:""},"
"),this.El=webix.html.create("DIV",{"class":"webix_resize_origin_"+e}),t[s]&&(this.El.style[s]=t[s]+(t.border?1:0)+"px",this.Dl.style[s]=t[s]+"px"), t.cursor&&(this.Dl.style.cursor=this.El.style.cursor=this.x.style.cursor=t.cursor),this.Fl=webix.event(i,webix.env.mouse.move,this.Gl,{bind:this}),this.Hl=webix.event(document.body,webix.env.mouse.up,this.Il,{bind:this}),this.Dl.style[this.Cl]=this.El.style[this.Cl]=t.start+"px",i.appendChild(this.x), i.appendChild(this.Dl),i.appendChild(this.El)},Il:function(){this.callEvent("onResizeEnd",[this.Jl]),webix.eventRemove(this.Fl),webix.eventRemove(this.Hl),webix.html.remove(this.x),webix.html.remove(this.Dl),webix.html.remove(this.El),this.x=this.Dl=this.El=null},Gl:function(t){var e=webix.html.pos(t); this.Jl=("x"==this.s.dir?e.x:e.y)+this.s.start-this.s.eventPos,this.Dl.style[this.Cl]=this.Jl+"px",this.callEvent("onResize",[this.Jl])}},webix.EventSystem,webix.Settings),webix.extend(webix.ui.datatable,{resizeRow_setter:function(t){return this.s.scrollAlignY=!1,this.s.fixedRowHeight=!1,this.resizeColumn_setter(t); },resizeColumn_setter:function(t){return t&&this.Kl&&(webix.UE(this.x,"mousemove",this.Ll,{bind:this}),webix.UE(this.x,"mousedown",this.Ml,{bind:this}),webix.UE(this.x,"mouseup",this.Nl,{bind:this}),this.Kl=!1),t},Kl:!0,Ml:function(t){this.s.subview&&this!=webix.$$(t.target||t.srcElement)||this.Ol&&(this.Pl=[webix.html.pos(t),this.Ol[2]], webix.html.addCss(document.body,"webix_noselect"),webix.html.denySelect())},Nl:function(){this.Pl=!1,webix.html.removeCss(document.body,"webix_noselect"),webix.html.allowSelect()},Ql:function(t){if(t=t||event,!this.Rl){var e=this.Ol[0],i=this.Pl[1],s=this.pk(i);if(s){var n,a=this.Pl[0];if("x"==e?(n=webix.html.offset(i).x+this.Ol[1]-webix.html.offset(this.Vf).x, a=a.x,this.Ol[1]||(s.cind-=i.parentNode.colSpan||1)):(n=webix.html.offset(i).y+this.Ol[1]-webix.html.offset(this.Vf).y+this.$g,a=a.y,this.Ol[1]||s.rind--),s.cind>=0&&s.rind>=0){this.Rl=[e,s,n];var r=new webix.ui.resizearea({container:this.x,dir:e,eventPos:a,start:n,cursor:("x"==e?"col":"row")+"-resize" });r.attachEvent("onResizeEnd",webix.bind(this.Sl,this))}this.Ml=this.Ol=!1}}},Sl:function(t){if(this.Rl){var e=this.Rl[0],i=this.Rl[1],s=t-this.Rl[2];if("x"==e){this.s.rightSplit&&i.cind+1>=this.Fj&&i.cind!==this.fj.length-1&&(i.cind++,s*=-1);var n=this.fj[i.cind],a=n.width;delete n.fillspace,delete n.adjust, this.Xs(i.cind,a+s,!0,!0),this.rk()}else{var r=this.getIdByIndex(i.rind),h=this.FA(this.getItem(r));this.setRowHeight(r,h+s)}this.Nl()}this.Rl=null},Ll:function(t){var e=null,i=this.s;if(this.Ol&&this.Pl)return this.Ql(t);t=t||event;var s=t.target||t.srcElement,n=!1;if("TD"!=s.tagName&&"TABLE"!=s.tagName){ var a=s.className||"",r="string"==typeof a&&-1!=a.indexOf("webix_cell");if(!r||!i.drag){var h="string"==typeof a&&-1!=a.indexOf("webix_hcell");if(this.Ol=!1,r||h){var o=s.offsetWidth,l=s.offsetHeight,c=webix.html.posRelative(t),u=i.resizeRow;"object"==typeof u&&u.headerOnly&&(e=this.pk(s),e.cind>0&&(u=!1)), r&&u&&(u="object"==typeof u&&u.size?u.size:3,c.ya?t[n][a]:e}),this.render())},selection:function(t){this.mapSelection(function(e,i,s,n,a){return t[n]&&t[n].length>a?t[n][a]:e}),this.render()},repeat:function(t){this.mapSelection(function(e,i,s,n,a){return i=t[n%t.length], e=i[a%i.length]}),this.render()},custom:function(t){}}},webix.extend(webix.ui.datatable,webix.TablePaste),webix.storage||(webix.storage={}),webix.storage.prefix=function(t,e){return t+=".",{put:function(i,s){return e.put(t+i,s)},get:function(i){return e.get(t+i)},remove:function(i){return e.remove(t+i); }}},webix.storage.local={put:function(t,e){t&&window.JSON&&window.localStorage&&window.localStorage.setItem(t,webix.stringify(e))},get:function(t){if(t&&window.JSON&&window.localStorage){var e=window.localStorage.getItem(t);return e?webix.DataDriver.json.toObject(e):null}return null},remove:function(t){ t&&window.JSON&&window.localStorage&&window.localStorage.removeItem(t)},clear:function(){window.localStorage.clear()}},webix.storage.session={put:function(t,e){t&&window.JSON&&window.sessionStorage&&window.sessionStorage.setItem(t,webix.stringify(e))},get:function(t){if(t&&window.JSON&&window.sessionStorage){ var e=window.sessionStorage.getItem(t);return e?webix.DataDriver.json.toObject(e):null}return null},remove:function(t){t&&window.JSON&&window.sessionStorage&&window.sessionStorage.removeItem(t)},clear:function(){window.sessionStorage.clear()}},webix.storage.cookie={put:function(t,e,i,s){t&&window.JSON&&(document.cookie=t+"="+escape(webix.stringify(e))+(s&&s instanceof Date?";expires="+s.toUTCString():"")+(i?";domain="+i:"")+(webix.env.https?";secure":"")); },getRaw:function(t){for(var e=document.cookie.split(";"),i="",s="",n="",a=!1,r=0;r1&&(n=unescape(i[1].replace(/^\s+|\s+$/g,""))),n;i=null,s=""}return null},get:function(t){if(t&&window.JSON){var e=this.getRaw(t); return e?webix.DataDriver.json.toObject(unescape(e)):null}return null},remove:function(t,e){t&&this.getRaw(t)&&(document.cookie=t+"="+(e?";domain="+e:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT")},clear:function(t){for(var e=document.cookie.split(";"),i=0;is;s++){var n=e[s];i.ids.push(n.id),i.size.push(n.fillspace||n.adjust?-1:n.width)}if(i.order=[].concat(this.bm.length?this.bm:i.ids), this.Nk&&(i.sort={id:this.Nk,dir:this.Ok}),this.ij&&this.tj){var a={},r=0;for(var h in this.ij)if(!this.am[h]){var o=this.ij[h];o[1].value=a[h]=o[2].getValue(o[0]),r=1}r&&(i.filter=a)}i.hidden=[];for(var h in this.am)i.hidden.push(h);return i},setState:function(t){var e=this.config.columns;if(t){if(this.Nk=null, this.blockEvent(),t.order&&t.order.length&&(this.bm=[].concat(t.order)),t.hidden){for(var i={},s=0;ss;s++){var o=e[s];o&&t.size[s]>0&&o.width!=t.size[s]&&(delete o.fillspace, delete o.adjust,this.Xs(s,t.size[s],!0))}this.unblockEvent();var l=!(this.s.leftSplit||this.s.rightSplit);if(this.rk(l),this.callEvent("onStructureUpdate",[]),t.sort){var c=e[this.getColumnIndex(t.sort.id)];c&&this.zf(t.sort.id,t.sort.dir,c.sort)}if(t.filter){var u=this.filterByAll;this.filterByAll=function(){}; for(var d in t.filter){var f=t.filter[d];if(f&&this.ij[d]){var b=this.ij[d];b[2].setValue(b[0],f);var p=b[1].contentId;p&&(this.hj[p].value=f)}}for(var d in this.ij)if(!t.filter[d]){var b=this.ij[d];b[2].setValue(b[0],"")}this.filterByAll=u,this.filterByAll()}if(t.select&&this.select){var x=t.select;this.unselect(); for(var s=0;s4){webix.env.touch=!0,e(s),t();for(var a in webix.ui.views){var r=webix.ui.views[a];r&&r.$touch&&r.$touch()}}webix.eventRemove(n); },{capture:!0})}function e(t){t.down="touchstart",t.move="touchmove",t.up="touchend",t.context=i.gm}var i=webix.Touch={config:{longTouchDelay:1e3,scrollDelay:150,gravity:500,deltaStep:30,speed:"0ms",finish:1500,ellastic:!0,fastClick:!0},limit:function(t){i.cm=t!==!1},disable:function(){i.Xf=!0},enable:function(){ i.Xf=!1},$init:function(){i.$init=function(){},webix.event(document.body,s.down,i.dm),webix.event(document.body,s.move,i.em),webix.event(document.body,s.up,i.fm),webix.event(document.body,"dragstart",function(t){return i.Xf||i.cm?void 0:webix.html.preventEvent(t)}),webix.event(document.body,"touchstart",function(t){ if(!i.Xf&&!i.cm&&i.config.fastClick&&webix.env.isSafari){var e=t.srcElement.tagName.toLowerCase();return"input"==e||"textarea"==e||"select"==e||"label"==e?!0:(i.im=!0,webix.html.preventEvent(t))}}),i.Of(),i.jm=[null,null],i.$active=!0},Of:function(){i.km=i.lm=i.mm=i.bC=null,i.nm=i.om=i.pm=this.qm=null, i.rm={sm:0,tm:0,um:0},i.vm&&(webix.html.removeCss(i.vm,"webix_touch"),i.vm=null),window.clearTimeout(i.wm),i.xm=!0,i.ym=!0,i.zm=!0,i.Am||i.Pf()},fm:function(t){if(i.km){if(i.nm){var e=i.Mf(i.om),s=e.e,n=e.f,a=i.config.finish,r=i.Bm(t,!0),h=webix.$$(i.om),o=h&&h.$scroll?h.$scroll.gravity:i.config.gravity; if(r.um){var l=s+o*r.sm/r.um,c=n+o*r.tm/r.um,u=i.jm[0]?i.Cm(l,!1,!1,i.pm.dx,i.pm.px):s,d=i.jm[1]?i.Cm(c,!1,!1,i.pm.dy,i.pm.py):n,f=Math.max(Math.abs(u-s),Math.abs(d-n));150>f&&(a=a*f/150),(u!=s||d!=n)&&(a=Math.round(a*Math.max((u-s)/(l-s),(d-n)/(c-n))));var b={e:u,f:d},h=webix.$$(i.om);h&&h.adjustScroll&&h.adjustScroll(b), a=Math.max(100,a),s!=b.e||n!=b.f?(i.Nf(i.om,b.e,b.f,a+"ms"),i.Dm&&i.Dm.Em(b.e,b.f,a+"ms"),i.Fm(b.e,b.f,a+"ms")):i.Pf()}else i.Pf()}else if(!this.qm)if(i.zm&&!i.ym)i.Gm("onSwipeX");else if(i.ym&&!i.zm)i.Gm("onSwipeY");else if(webix.env.isSafari&&i.im){i.im=!1;var p=i.km.target;webix.delay(function(){var t=document.createEvent("MouseEvents"); t.initEvent("click",!0,!0),p.dispatchEvent(t)})}i.Gm("onTouchEnd"),i.Of()}},em:function(t){if(i.bC&&i.km){var e=i.Bm(t);if(i.Gm("onTouchMove"),i.nm)i.Hm(e);else if(i.ym=i.Im(e.Jm,"x",i.ym),i.zm=i.Im(e.Ei,"y",i.zm),i.nm){var s=i.Km("onBeforeScroll",!0);if(s){var n={};s.callEvent("onBeforeScroll",[n]), n.update&&(i.config.speed=n.speed,i.config.scale=n.scale)}i.Lm(e)}return webix.html.preventEvent(t)}},Hm:function(){if(i.om){var t=i.Mf(i.om),e=(t.e,t.f,i.mm||i.km),s=webix.$$(i.om),n=s&&s.$scroll?s.$scroll.ellastic:i.config.ellastic;i.jm[0]&&(t.e=i.Cm(t.e-e.x+i.lm.x,n,t.e,i.pm.dx,i.pm.px)),i.jm[1]&&(t.f=i.Cm(t.f-e.y+i.lm.y,n,t.f,i.pm.dy,i.pm.py)), i.Nf(i.om,t.e,t.f,"0ms"),i.Dm&&i.Dm.Em(t.e,t.f,"0ms"),i.Fm(t.e,t.f,"0ms")}},Fm:function(t,e,s){var n=i.pm.px/i.pm.dx*-t,a=i.pm.py/i.pm.dy*-e;i.jm[0]&&i.Nf(i.jm[0],n,0,s),i.jm[1]&&i.Nf(i.jm[1],0,a,s)},scrollTo:function(t,e,s,n){i.Nf(t,e,s,n)},Nf:function(t,e,s,n){if(!i.tt&&window.setAnimationFrame&&window.setAnimationFrame(function(){ return i.tt=!0,i.Nf(t,e,s,n)}),i.tt=null,i.Am=!0,t){var a=i.config.translate||webix.env.translate;t.style[webix.env.transform]=a+"("+Math.round(e)+"px, "+Math.round(s)+"px"+("translate3d"==a?", 0":"")+")",t.style[webix.env.transitionDuration]=n}},Mf:function(t){var e,s=window.getComputedStyle(t)[webix.env.transform]; if("none"==s)e={e:0,f:0};else if(window.WebKitCSSMatrix)e=new WebKitCSSMatrix(s);else if(window.MSCSSMatrix)e=new MSCSSMatrix(s);else{var n=s.replace(/(matrix\()(.*)(\))/gi,"$2");n=n.replace(/\s/gi,""),n=n.split(",");for(var e={},a=["a","b","c","d","e","f"],r=0;r0)return e?i+r*Math.sqrt(a):0;var h=s-n;return 0>h+t?e?i-Math.sqrt(-(t-i)):-h:t},Nm:function(t){if(!t.scroll_enabled){t.scroll_enabled=!0,t.parentNode.style.position="relative";var e=webix.env.cssPrefix; t.style.cssText+=e+"transition: "+e+"transform; "+e+"user-select:none; "+e+"transform-style:flat;",t.addEventListener(webix.env.transitionEnd,i.Pf,!1)}},Lm:function(t){-1!=i.nm.indexOf("x")&&(i.jm[0]=i.Om("x",i.pm.dx,i.pm.px,"width")),-1!=i.nm.indexOf("y")&&(i.jm[1]=i.Om("y",i.pm.dy,i.pm.py,"height")), i.Nm(i.om),window.setTimeout(i.Hm,1)},Om:function(t,e,s,n){if(2>e-s){var a=i.Mf(i.om),r="y"==t?a.e:0,h="y"==t?0:a.f;return i.Dm||i.Nf(i.om,r,h,"0ms"),i.nm=i.nm.replace(t,""),""}var o=webix.html.create("DIV",{"class":"webix_scroll_"+t},"");return o.style[n]=Math.max(s*s/e-7,10)+"px",i.pm.left&&("x"===t?o.style.left=i.pm.left+"px":o.style.right=-i.pm.left+"px"), i.pm.hidden&&(o.style.visibility="hidden"),i.om.parentNode.appendChild(o),o},Im:function(t,e,s){return t>i.config.deltaStep?(i.xm&&(i.Pm(e),i.pk(e),-1==(i.nm||"").indexOf(e)&&(i.nm="")),!1):s},Pf:function(){var t,e,s;s=webix.$$(i.om||this),s&&(i.om?t=i.Mf(i.om):s.getScrollState&&(e=s.getScrollState(), t={e:e.x,f:e.y}),webix.callEvent("onAfterScroll",[t]),s.callEvent&&s.callEvent("onAfterScroll",[t])),i.nm||(webix.html.remove(i.jm),i.jm=[null,null]),i.Am=!1},Pm:function(t){window.clearTimeout(i.wm),i.xm=!1},Qm:function(t){return i.jm[0]||i.jm[1]?void i.Rm(t,i.jm[0]?"x":"y"):!0},dm:function(t){var e=t.target||event.srcElement; if(!(i.Xf||e.tagName&&"textarea"==e.tagName.toLowerCase()&&e.offsetHeight0){for(var a=0;ar;r++)a[r]=a[r]?this.Ek(this.getItem(a[r]),i,0):""; s=Math.max(s,webix.html.getTextSize(a,"webix_table_cell webix_cell").width)}if("data"!=e)for(var r=0;r=0){var s=this.dn(t,e);return this.Xs(t,s,i)}},adjustColumn:function(t,e){this.bn(this.getColumnIndex(t),e)},adjustRowHeight:function(t,e){if(t){var i,s=this.getColumnConfig(t),n=webix.html.create("DIV",{ "class":"webix_table_cell webix_measure_size webix_cell"},"");n.style.cssText="width:"+s.width+"px; height:1px; visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;",this.$view.appendChild(n),n.offsetHeight<1&&(i=this.$view.cloneNode(!0),document.body.appendChild(i),i.appendChild(n)), this.data.each(function(t){n.innerHTML=this.Ek(t,s,0),t.$height=Math.max(n.scrollHeight,this.s.rowHeight)},this),n=webix.html.remove(n),i&&webix.html.remove(i)}else{var a=new Array(this.data.order.length),r=this.config.columns,h=0;for(var o in this.data.pull)a[h]=0,h++;for(var l=0;la[h]&&(a[h]=t.$height),t.$height=a[h],h++})}}e||this.refresh()}}),webix.extend(webix.ui.datatable,{math_setter:function(t){return t&&this.en(),t},fn:"$",en:function(){webix.env.strict||(this.data.attachEvent("onStoreUpdated",webix.bind(this.gn,this)),this.data.attachEvent("onStoreLoad",webix.bind(this.hn,this)), this.attachEvent("onStructureLoad",this.hn))},gn:function(t,e,i){if(t&&"delete"!=i&&"paint"!=i){"add"==i&&this.pn(e);for(var s=0;s0&&"="===s.substr(0,1)?(n[this.fn+e]&&i===!0||(n[this.fn+e]=n[e]), n[e]=this.ln(s,t,e)):("undefined"!=typeof n[this.fn+e]&&delete n[this.fn+e],this.mn(n,e)),"undefined"!=typeof n.depends&&"undefined"!=typeof n.depends[e]))for(var a in n.depends[e]){var r=n.depends[e][a][0]+"__"+n.depends[e][a][1];"undefined"==typeof this.kn[r]&&(this.kn[r]=!0,this.jn(n.depends[e][a][0],n.depends[e][a][1],!0)); }},nn:function(t,e){var i=this.getItem(t);"undefined"!=typeof i[this.fn+e]&&(i[e]=i[this.fn+e])},hn:function(){if(this.fj&&this.count()){this.pn();for(var t=0;t0?i[0]:!1}}),webix.extend(webix.ui.datatable,{ii:function(t){return this.getColumnConfig(t.column).editor},getEditor:function(t,e){return t?(1==arguments.length&&(e=t.column,t=t.row),(this.ai[t]||{})[e]):this.di; },si:function(t){for(var e in this.ai){var i=this.ai[e];for(var s in i)"$count"!=s&&t.call(this,i[s])}},ji:function(t,e,i){var s=t.row,n=t.column,a=e.config=this.getColumnConfig(n);i!==!1&&this.showCell(s,n);var r=e.render();e.$inline&&(r=this.mi(t)),e.node=r;var h,o=this.getItem(s),l=a.editFormat;return this.s.editMath&&(h=o["$"+n]), h=h||o[n],webix.isUndefined(h)&&(h=""),e.setValue(l?l(h):h,o),e.value=o[n],this.ni(t,e),e.$inline||this.oi(t,r,!0),e.afterRender&&e.afterRender(),this.s.liveValidation&&(webix.UE(e.node,"keyup",this.Gn(t,this)),this.validateEditor(t)),r},Gn:function(t,e){return function(){e.validateEditor(t)}},ti:function(t,e,i){ var s=this.getColumnConfig(t.column).editParse,n=i?{}:this.getItem(t.row);return n[t.column]=s?s(e):e,this.s.editMath&&(n["$"+t.column]=null),n},ni:function(t,e,i){var s=this.ai[t.row]=this.ai[t.row]||{};s.$count=(s.$count||0)+1,e.row=t.row,e.column=t.column,this.di=s[t.column]=e,this.Eb++,this.Hn=this.getScrollState(); },qi:function(t){this.di==t&&(this.di=0),t.destroy&&t.destroy();var e=this.ai[t.row];delete e[t.column],e.$count--,e.$count||delete this.ai[t.row],this.Eb--},ei:function(t,e){var i=this.ai[t];if(i){this.ai[e]=i,delete this.ai[t];for(var s in i)i[s].row=e}},pi:function(t){var e,i,s,n,a,r,h=this.getColumnConfig(t.column),o=0; if(h&&h.node&&h.attached){if(s=this.getIndexById(t.row),this.Rt&&(r=this.getSpan(t.row,t.column)))for(i=0;3>i;i++)for(e=this.St[i],n=0;!o&&n=h.qk-this.s.topSplit&&s=0;h--){ for(var o=n-1;o>=0;o--){var l={row:a[h],column:r[o].id};if(e.call(this,l))return l}n=r.length}return null},In:function(){this.Eb&&(this.Jn?this.Jn=!1:(this.Wj.scrollTo(this.getScrollState().y+this.Vf.childNodes[1].firstChild.scrollTop),this.Vf.childNodes[1].firstChild.scrollTop=0,this.Jn=!0))},Kn:function(){ this.Eb&&this.Zj.scrollTo(this.Vf.childNodes[1].scrollLeft)},gi:function(){this.attachEvent("onScrollY",this.Ln),this.attachEvent("onScrollX",this.Ln),this.attachEvent("onScrollY",this.$s),this.attachEvent("onColumnResize",function(){this.editStop()}),this.attachEvent("onAfterFilter",function(){this.editStop(); }),this.attachEvent("onRowResize",function(){this.editStop()}),this.attachEvent("onAfterScroll",function(){this.s.topSplit&&this.editStop()}),this.Vf.childNodes[1].firstChild.onscroll=webix.bind(this.In,this),this.Vf.childNodes[1].onscroll=webix.bind(this.Kn,this)},Ln:function(){if(this.Eb){var t=this.Hn; this.Hn=this.getScrollState();var e=this.Hn.y-t.y;this.si(function(t){if(t.getPopup){var i=this.getItemNode(t);i?t.getPopup().show(i):t.getPopup().show({x:-1e4,y:-1e4})}else t.$inline||(t.node.top-=e,t.node.style.top=t.node.top+"px")})}}}),webix.extend(webix.ui.datatable,webix.EditAbility),webix.extend(webix.ui.datatable,{ $init:function(){this.kz(),this.attachEvent("onStructureLoad",this.Nn)},kz:function(){this.am={},this.bm=webix.toArray(),this.Mn=[0,0]},Nn:function(){for(var t=this.fj,e=0;e=0;e--)t[e].hidden?this.hideColumn(t[e].id,{},!0,!0):t[e].batch&&this.config.visibleBatch&&t[e].batch!=this.config.visibleBatch&&this.hideColumn(t[e].id,{},!0,!0); },xB:function(t,e){for(var i=0;ii?1:0);webix.PowerArray.insertAt.call(s,n[0],a);var r=this.bm;if(r.length){r=webix.toArray(r); var h=r.find(t);r.removeAt(h),0===a?r.unshift(t):r.insertAt(t,r.find(s[a-1].id)+1)}this.On()}},rz:function(){var t=this.bm,e=this.s.columns;if(!t.length){for(var i=0;i=this.Fj?this.s.rightSplit-=o:this.Fj-=o;for(var u=l+o-1;u>=l;u--)this.vk(l),n=a.splice(l,1)[0],h[n.id]=n,n.qk=-1,delete this.Aj[n.id];this.callEvent("onAfterColumnHide",[t])}else{if(n=h[t],!n||!this.callEvent("onBeforeColumnShow",[t]))return;for(var d=null,u=0,f=0;u=f;u--){var n=h[r[u]];n?(webix.PowerArray.insertAt.call(a,n,l), delete n.hidden,delete h[n.id],this.Aj[n.id]=n):o--}f=this.Mn[1]?this.s.rightSplit+=o:this.Fj+=o,this.callEvent("onAfterColumnShow",[t])}n.header&&this.xt(n,s!==!1?0:1,"header"),n.footer&&this.xt(n,s!==!1?0:1,"footer"),i||this.On()},xt:function(t,e,i){for(var s=t[i].length-1;s>=0;s--)for(var n,a=this.bm,r=!1,h=0,o=0;o0&&n&&n.colspan>0?(l=t[i][s]=n,n=l):l&&l.$colspan&&0>=h&&(h=l.colspan=l.$colspan,n=l),r=null):(l&&l.$colspan&&0>=h&&(h=l.colspan=l.$colspan,r=n=l),n&&h>0&&n.colspan--),h--}},refreshColumns:function(t,e){(t&&t!=this.config.columns||e)&&(this.kz(), this.ij={},t&&(this.Fj=t.length-(this.config.rightSplit||0))),this.Aj={};for(var i=0;ii;i++)this.I.childNodes[i].innerHTML="",this.Vf.childNodes[i].firstChild.innerHTML="";this.fj=this.config.columns=t||this.config.columns, this.Fj=this.fj.length-this.s.rightSplit,this.tj=0,this.rj(),this.callEvent("onStructureUpdate"),this.sk(),this.render()},On:function(){this.tj=0,this.callEvent("onStructureUpdate"),this.uj(),this.render()},showColumn:function(t,e,i){return this.hideColumn(t,e,i,!1)},showColumnBatch:function(t,e){var i="undefined"!=typeof e; e=e!==!1,this.eachColumn(function(s,n){if(n.batch){var a=this.am[n.id];e||(a=!a),n.batch==t&&a?this.hideColumn(n.id,{spans:!0},!0,!e):i||n.batch==t||a||this.hideColumn(n.id,{spans:!0},!0,e)}},!0),this.On()}}),webix.extend(webix.ui.datatable,{$init:function(){this.attachEvent("onAfterScroll",this.cF)}, cF:function(){var t=this.eF();if(!t){var e=this.y.querySelector(".webix_cell");e&&e.setAttribute("tabindex","0")}},eF:function(){for(var t=this.getSelectedId(!0),e=0;e1&&"cell"!==this.s.select&&(s=s.sort(webix.bind(function(t,e){return this.getIndexById(t.row)>this.getIndexById(e.row)||this.getColumnIndex(t.column)>this.getColumnIndex(e.column)?1:-1},this)), ("up"==t||"left"==t||"top"==t||"pgup"==t)&&(n=0)),0>n&&this.count()){if("down"==t||"right"==t)t="top";else{if("up"!=t&&"left"!=t)return;t="bottom"}n=0,s=[{row:1,column:1}]}if(n>=0){var r=s[n].row,h=s[n].column;if("top"==t||"bottom"==t)r&&("top"==t?r=this.data.getFirstId():"bottom"==t&&(r=this.data.getLastId())), h&&(n=0,"bottom"==t&&(n=this.config.columns.length-1),h=this.columnId(n));else if("up"==t||"down"==t||"pgup"==t||"pgdown"==t){if(r){var n=this.getIndexById(r),o="pgup"==t||"pgdown"==t?Math.round(this.Vj/this.s.rowHeight):1;"up"==t||"pgup"==t?n-=o:("down"==t||"pgdown"==t)&&(n+=o),0>n&&(n=0),n>=this.data.order.length&&(n=this.data.order.length-1), r=this.getIdByIndex(n),!r&&this.s.pager&&this.showItemByIndex(n)}}else{if("right"!=t&&"left"!=t)return;if(h&&"row"!=this.config.select){var n=this.getColumnIndex(h);"right"==t?n++:"left"==t&&n--,0>n&&(n=0),n>=this.config.columns.length&&(n=this.config.columns.length-1),h=this.columnId(n)}else{if((this.open||this.oA)&&"right"==t)return this.open?this.open(r):this.openSub(r); if((this.close||this.oA)&&"left"==t)return this.close?this.close(r):this.closeSub(r)}}if(r){this.showCell(r,h),this.select||(webix.extend(this,this._k.$k,!0),this.s.select=this.open||this.oA?"row":"cell",webix.extend(this,this._k[this.s.select],!0));var l={row:r,column:h};if(a&&"area"==this.s.select){ var c=this.el[this.el.length-1];this.gC(l,c,t,e)}else this.hl(l,a);if(!this.s.clipboard&&i!==!1){var u=this.getItemNode(l);u&&u.focus()}}}return!1}}}),webix.extend(webix.ui.datatable,webix.KeysNavigation),webix.extend(webix.ui.datatable,webix.DataMove),webix.extend(webix.ui.datatable,{drag_setter:function(t){ return this.attachEvent("onBeforeDrag",function(t){return this.RD(t.source)}),this.attachEvent("onBeforeDragIn",function(t){return this.RD(t.target)}),this.attachEvent("onBeforeDropOrder",function(t,e){return 0>e||e>=this.s.topSplit}),webix.DragItem.drag_setter.call(this,t)},RD:function(t){var e,i,s=!1; if(this.s.topSplit&&t)for(webix.isArray(t)||(t=[t]),e=0;!s&&e",n=this.s.columns,a=0;a"+r+""; }return s+""},getHeaderNode:function(t,e){return this.nG(t,e,this.I)},getFooterNode:function(t,e){return this.nG(t,e,this.cj)},nG:function(t,e,i){if(this.isColumnVisible(t)){var s=this.getColumnIndex(t),n=this.s.leftSplit>s?0:this.Fj<=s?2:1;e=e||0;var a=i.childNodes[n].getElementsByTagName("TR"); if(a.length)for(var r=a[e+1].childNodes,h=0;hs&&s>n[1])return;var r=this.Xj(),h=this.s.leftSplit?0:r[0]; if(t.column&&(h=this.getColumnIndex(t.column),h=this.s.leftSplit&&(hr[1])))return;var o=this.s.columns[h];if(o.attached&&o.node){var l=s"+(n.header[0].text||" ")+""; },this),$dragPos:webix.bind(function(t,e,i){var s=webix.DragControl.getContext(),n=webix.html.offset(this.$view);i.style.display="none";var a=document.elementFromPoint(t.x,n.y+1),r=a?this.locate(a):null,h=webix.DragControl.getContext().start.column;if(r&&r.column!=h&&(!this.Sn||r.column!=this.Yg)&&"column_dnd"==s.custom&&webix.$$(a)==this){ if(!this.callEvent("onBeforeColumnDropOrder",[h,r.column,e]))return;var o=this.getColumnIndex(h),l=this.getColumnIndex(r.column);e.touches&&(this.wy=e.target,this.wy.style.display="none",this.$view.parentNode.appendChild(this.wy)),this.moveColumn(h,l+(l>o?1:0)),this.Yg=r.column,this.Sn=!0}if(r&&r.column==h&&(this.Sn=!1), i.style.display="block",t.x=t.x-this.Qn.x,t.y=n.y,t.xc&&(t.x=c)}webix.DragControl.Ed=!0},this),$dragDestroy:webix.bind(function(t,e){webix.html.remove(e),this.wy&&webix.html.remove(this.wy);var i=webix.DragControl.getContext().start; this.callEvent("onAfterColumnDropOrder",[i.column,this.Yg,t])},this),$drop:function(){}}:t&&(e={ah:!0,$drag:webix.bind(function(t,i){var s=this.locate(i);if(this.Pl||!s||!this.callEvent("onBeforeColumnDrag",[s.column,i]))return!1;webix.DragControl.Gd={from:e,start:s,custom:"column_dnd"};for(var n=this.getColumnConfig(s.column).header,a=" ",r=0;r"+a+""},this),$drop:webix.bind(function(t,e,i){var s=i;i.touches&&this.Tn&&(s=this.Tn);var n=this.locate(s);if(!n)return!1;var a=webix.DragControl.getContext().start.column;if(a!=n.column){if(!this.callEvent("onBeforeColumnDrop",[a,n.column,i]))return; var r=this.getColumnIndex(a),h=this.getColumnIndex(n.column);this.moveColumn(a,h+(h>r?1:0)),this.callEvent("onAfterColumnDrop",[a,n.column,i])}},this),$dragIn:webix.bind(function(t,i,s){var n=webix.DragControl.getContext();if("column_dnd"!=n.custom||n.from!=e)return!1;for(var a=s.target||s.srcElement;-1==(a.className||"").indexOf("webix_hcell");)if(a=a.parentNode, !a)return;return a!=this.Tn&&(this.Tn&&webix.html.removeCss(this.Tn,"webix_dd_over_column"),webix.html.addCss(a,"webix_dd_over_column")),this.Tn=a},this),$dragDestroy:webix.bind(function(t,e){this.Tn&&webix.html.removeCss(this.Tn,"webix_dd_over_column"),webix.html.remove(e)},this)}),t&&(webix.DragControl.addDrag(this.I,e), webix.DragControl.addDrop(this.I,e,!0))}}),webix.extend(webix.ui.datatable,webix.DragItem),webix.extend(webix.ui.datatable,{clearValidation:function(){for(var t in this.data.Me)this.Un(t);this.data.clearMark("webix_invalid",!0)},Te:function(t,e){this.Un(t);for(var i in e)this.addCellCss(t,i,"webix_invalid_cell"); this.addCss(t,"webix_invalid")},Qe:function(t){this.Un(t),this.removeCss(t,"webix_invalid")},Un:function(t){var e=(this.getItem(t),this.data.getMark(t,"$cellCss"));if(e)for(var i in e)e[i]=e[i].replace("webix_invalid_cell","").replace(" "," ")},addRowCss:function(t,e,i){this.addCss(t,e,i)},removeRowCss:function(t,e,i){ this.removeCss(t,e,i)},addCellCss:function(t,e,i,s){var n=this.data.getMark(t,"$cellCss"),a=n||{},r=a[e]||"";a[e]=r.replace(i,"").replace(" "," ")+" "+i,n||this.data.addMark(t,"$cellCss",!1,a,!0),s||this.refresh(t)},removeCellCss:function(t,e,i,s){var n=this.data.getMark(t,"$cellCss");if(n){var a=n[e]||""; a&&(n[e]=a.replace(i,"").replace(" "," ")),s||this.refresh(t)}}}),webix.extend(webix.ui.datatable,webix.ValidateCollection),function(){function t(t){for(var e=[],i=t.length-1;i>=0;i--){var s=t[i];e[i]="object"==typeof s?s.value:s}return e}var e=webix.Sparklines=function(){};e.types={},e.getTemplate=function(t){ var e=t||{};"string"==typeof t&&(e={type:t}),webix.extend(e,{type:"line"});var i=this.types[e.type];return webix.bind(this.BC,new i(e))},e.BC=function(e,i,s,n){return n?this.draw(t(s),n.width,33):this.draw(e.data||e,i.width,i.height)}}(),webix.attachEvent("onDataTable",function(t){t.type.sparklines=webix.Sparklines.getTemplate(); }),function(){function t(t){var e=" ";if(t)for(var i in t)e+=i+'="'+t[i]+'" ';return e}var e={};e.draw=function(e,i,s,n){var a={xmlns:"http://www.w3.org/2000/svg",version:"1.1",height:"100%",width:"100%",viewBox:"0 0 "+i+" "+s,"class":n||""};return""+e+""},e.styleMap={lineColor:"stroke", color:"fill"},e.group=function(t){return""+t+""},e.z={M:function(t){return" M "+t.x+" "+t.y},L:function(t){return" L "+t.x+" "+t.y},C:function(t,e,i){return" C "+t.x+" "+t.y+" "+e.x+" "+e.y+" "+i.x+" "+i.y},A:function(t,e,i,s){var n=t.x+Math.cos(s)*e,a=t.y+Math.sin(s)*e,r=s-i>=Math.PI;return" A "+e+" "+e+" 0 "+(r?1:0)+" 1 "+n+" "+a; }},e.definePath=function(t,e){for(var i="",s=0;s"},e.getSector=function(i,s,n,a,r,h){h=t(h); var o=i.x+Math.cos(n)*s,l=i.y+Math.sin(n)*s,c=[["M",i],["L",{x:o,y:l}],["A",i,s,n,a],["L",i]];return'"},e.getCurve=function(e,i,s){s=t(s);var n=this.definePath(this.DC(e));return'"; },e.getLine=function(t,e,i,s){return this.getPath(this.definePath(this.CC([t,e]),!0),i,s)},e.getCircle=function(e,i,s,n){return n=t(n),'"},e.getRect=function(e,i,s,n,a,r){return r=t(r),'"; },webix.EC=e}(),function(){function t(t){this.config=webix.extend(webix.copy(e),t||{},!0)}var e={paddingX:3,paddingY:4,radius:1,minHeight:4,eventRadius:8};t.prototype.draw=function(t,e,i){var s,n,a,r,h,o=this.config,l=webix.Sparklines.types.line.prototype,c=webix.EC;return r=this.getPoints(t,e,i),a=c.definePath(l.FC(r),!0), o.color&&(h=this.GC(c,o.color)),n=c.group(c.getPath(a,"webix_sparklines_area"+(h?" "+h.area:""))),r.splice(r.length-3,3),a=c.definePath(l.FC(r)),n+=c.group(c.getPath(a,"webix_sparklines_line"+(h?" "+h.line:""))),n+=l.HC(c,r,o.radius,"webix_sparklines_item"+(h?" "+h.item:"")),s=Math.min(t.length?(e-2*(o.paddingX||0))/t.length:0,o.eventRadius), n+=l.IC(c,r,s),c.draw(n,e,i,"webix_sparklines_area_chart"+(o.css?" "+o.css:""))},t.prototype.GC=function(t,e){var i={area:{},line:{},item:{}},s=t.styleMap;if(e){i.area[s.color]=t.setOpacity(e,.2),i.line[s.lineColor]=e,i.item[s.color]=e;for(var n in i)i[n]=webix.html.createCss(i[n])}return i},t.prototype.getPoints=function(t,e,i){ var s=webix.Sparklines.types.line.prototype,n=s.getPoints.call(this,t,e,i),a=this.config.paddingX||0,r=this.config.paddingY||0;return n.push({x:e-a,y:i-r},{x:a,y:i-r},{x:a,y:n[0].y}),n},webix.Sparklines.types.area=t}(),function(){function t(t){this.config=webix.extend(webix.copy(e),t||{},!0)}var e={paddingX:3, paddingY:4,width:20,margin:4,minHeight:4,eventRadius:8,origin:0,itemCss:function(t){return t<(this.config.origin||0)?" webix_sparklines_bar_negative":""}};t.prototype.draw=function(t,e,i){var s,n,a,r,h,o=this.config,l="",c=[],u=this.getPoints(t,e,i),d=webix.EC;for(s=0;s=h)a=n;else if(o>r){var l=i/(h-r);a-=l*(o-r)}}return a},t.prototype.KC=function(t,e,i){var s=[],n=this.config.paddingX||0,a=this.config.paddingY||0; if(e=(e||100)-2*n,i=(i||100)-2*a,t.length)for(var r=e/t.length,h=0;hn?p=s.origin||0:b=s.minHeight;for(var x=(i-b)/(f?f:1),w=0;w=p?g:0)-b,height:Math.abs(g)+b, width:c})}}return r},webix.Sparklines.types.bar=t}(),function(){function t(t){this.config=webix.extend(webix.copy(e),t||{},!0)}var e={paddingX:6,paddingY:6,radius:2,minHeight:4,eventRadius:8};t.prototype.draw=function(t,e,i){var s=this.getPoints(t,e,i),n=this.config,a=webix.EC,r=n.color?this.GC(a,n.color):null,h=a.definePath(this.FC(s)),o=a.group(a.getPath(h,"webix_sparklines_line"+(r?" "+r.line:""))); o+=this.HC(a,s,n.radius,"webix_sparklines_item"+(r?" "+r.item:""));var l=Math.min(t.length?(e-2*(n.paddingX||0))/t.length:0,n.eventRadius);return o+=this.IC(a,s,l),a.draw(o,e,i,"webix_sparklines_line_chart"+(n.css?" "+n.css:""))},t.prototype.GC=function(t,e){var i={line:{},item:{}},s=t.styleMap;if(e){ i.line[s.lineColor]=e,i.item[s.color]=e;for(var n in i)i[n]=webix.html.createCss(i[n])}return i},t.prototype.HC=function(t,e,i,s,n){for(var a=[],r=0;ri?(t&&(t=s-i>t?this.rC+2:this.rC+1),this.rC=t):t%=s,this.qC[t]},t.prototype.draw=function(t,e,i){var s,n,a,r,h=this.config,o=h.color||this.xv,l=this.getAngles(t),c=webix.EC,u=h.paddingY||0,d=i/2-u,f=e/2,b=i/2;for("function"!=typeof o&&(o=function(){return o}),r="",a=0;ae;e++)s[e]=1, n[e]=4,a[e]=1,r[e]=4*t[e]+2*t[e+1];for(s[l-1]=2,n[l-1]=7,a[l-1]=0,r[l-1]=8*t[l-1]+t[l],e=1;l>e;e++)i=s[e]/n[e-1],n[e]=n[e]-i*a[e-1],r[e]=r[e]-i*r[e-1];for(h[l-1]=r[l-1]/n[l-1],e=l-2;e>=0;--e)h[e]=(r[e]-a[e]*h[e+1])/n[e];for(e=0;l-1>e;e++)o[e]=2*t[e+1]-h[e+1];return o[l-1]=.5*(t[l]+h[l-1]),[h,o]},webix.Sparklines.types.spline=t; var s={paddingX:3,paddingY:6,radius:1,minHeight:4,eventRadius:8};e.prototype=webix.copy(t.prototype),e.prototype.draw=function(t,e,i){var s=this.config,n=webix.Sparklines.types.line.prototype,a=webix.EC,r=s.color?this.GC(a,s.color):null,h=this.getPoints(t,e,i),o=h.splice(h.length-3,3),l=a.CC(o);l[0][0]="L"; var c=a.DC(h).concat(l),u=a.group(a.getPath(a.definePath(c),"webix_sparklines_area"+(r?" "+r.area:""),!0));u+=a.group(a.getPath(a.definePath(a.DC(h)),"webix_sparklines_line"+(r?" "+r.line:"")));var d=n.getPoints.call(this,t,e,i);u+=n.HC(a,d,s.radius,"webix_sparklines_item"+(r?" "+r.item:""));var f=Math.min(t.length?(e-2*(s.paddingX||0))/t.length:0,s.eventRadius); return u+=n.IC(a,d,f),a.draw(u,e,i,"webix_sparklines_splinearea_chart"+(s.css?" "+s.css:""))},e.prototype.GC=function(t,e){var i={area:{},line:{},item:{}},s=t.styleMap;if(e){i.area[s.color]=t.setOpacity(e,.2),i.line[s.lineColor]=e,i.item[s.color]=e;for(var n in i)i[n]=webix.html.createCss(i[n])}return i; },e.prototype.getPoints=function(e,i,s){var n=t.prototype.getPoints.call(this,e,i,s),a=this.config.paddingX||0,r=this.config.paddingY||0;return n.push({x:i-a,y:s-r},{x:a,y:s-r},{x:a,y:n[0][0].y}),n},webix.Sparklines.types.splineArea=e}(),webix.extend(webix.ui.datatable,{UF:function(t,e){return t.scroll&&!e?!0:(t.header=webix.isUndefined(t.header)?this.config.header?!0:!1:t.header, t.footer=webix.isUndefined(t.footer)?this.config.footer?!0:!1:t.footer,void(t.xCorrection=t.xCorrection||0))},sq:function(t,e){for(var i=-1,s=0;0>i&&sa&&p>i){l=p;break}if("selection"!==t.data||"selection"==t.data&&-1!==this.sq(n,function(t){return t.column==x&&t.row==e})){var g;if(this.getSpan&&(g=this.getSpan(e,x)), g&&this.getColumnIndex(x)===i){var v=this.getColumnIndex(g[1]);i>v&&(g[2]=g[2]-(i-v),g[4]=g[4]?g[4]:u[g[1]]?this.getText(e,g[1]):null,g[1]=x)}if(!g||g&&g[0]==e&&g[1]==x){var m=g&&g[4]?g[4]:this.Aj[x]?this.getText(e,x):"",y=this.getCss(e,x)+" "+(s[p].css||"")+(g?" webix_dtable_span "+(g[5]||""):""),$={ height:g&&g[3]>1?"auto":(u.$height||this.config.rowHeight)+"px",width:g&&g[2]>1?"auto":s[p].width+"px"};f.push({txt:m,className:y,style:$,span:g?{colspan:g[2],spanStart:this.getColumnIndex(g[1]),rowspan:g[3]}:null}),m&&(r=Math.max(w+1,r),h=Math.max(d+1,h)),b=b||!!m}else g&&(f.push({$inspan:!0}),r=Math.max(w+1,r), h=Math.max(d+1,h))}}}(!t.skiprows||b)&&o.push(f)},this)),h&&r&&(t.trim&&(o.length=h,o=o.map(function(t){for(var e=t.length-1;e>=0;e--)if(t[e].span&&t[e].span.colspan){t[e].span.colspan=Math.min(t[e].span.colspan,t.length-e);break}return t.length=r,t})),e.push(o)),l?this.VF(t,e,l):(t.footer&&(e=this.$F(e,s,"footer")), t.header&&(e=this.$F(e,s,"header"))),e},WF:function(t,e){var i=webix.html.create("div");return t.forEach(webix.bind(function(s,n){var a=webix.html.create("table",{"class":"webix_table_print "+this.$view.className+(e.borderless?" borderless":""),style:"border-collapse:collapse",id:this.$view.getAttribute("id") });if(s.forEach(function(t){var e=webix.html.create("tr");t.forEach(function(t,i){if(!t.$inspan){var s=webix.html.create("td");s.innerHTML=t.txt,s.className=t.className;for(var n in t.style)s.style[n]=t.style[n];t.span&&(s.colSpan=t.span.colspan,s.rowSpan=t.span.rowspan),e.appendChild(s)}}),a.appendChild(e); }),i.appendChild(a),n+1=h&&p+f.rowspan>=a&&(r[h]=n[d][3])}}i[i.length]=r; }return i},sG:function(t,e){if(this.pG[e])return this.pG[e];var i=this.tG(t),s={font:{},alignment:{},border:{}};s.font.name=i["font-family"].replace(/,.*$/,""),s.font.sz=.75*i["font-size"].replace("px",""),s.font.color={rgb:webix.color.rgbToHex(i.color)},"normal"!==i["font-weight"]&&(s.font.bold=!0), "underline"===i["text-decoration-line"]&&(s.font.underline=!0),"italic"===i["font-style"]&&(s.font.italic=!0),"line-through"===i["text-decoration-line"]&&(s.font.strike=!0),s.alignment.horizontal=i["text-align"],s.alignment.vertical=i.height==i["line-height"]?"center":"top","normal"==i["white-space"]&&(s.alignment.wrapText=!0), t.firstChild&&t.firstChild.className&&-1!==t.firstChild.className.indexOf("webix_rotate")&&(s.alignment.textRotation=90);var n=webix.color.rgbToHex(i["background-color"]);return n&&(s.fill={fgColor:{rgb:n}}),-1!==i["background-image"].indexOf("gradient")&&(s.fill={fgColor:{rgb:webix.color.rgbToHex(i["background-image"].substring(i["background-image"].lastIndexOf("("))) }}),t.parentNode&&"TD"==t.parentNode.nodeName&&(i=this.tG(t.parentNode)),"0px"!==i["border-right-width"]&&(s.border.right={style:"thin",color:{rgb:webix.color.rgbToHex(i["border-right-color"])}}),"0px"!==i["border-bottom-width"]&&(s.border.bottom={style:"thin",color:{rgb:webix.color.rgbToHex(i["border-bottom-color"]) }}),"0px"!==i["border-left-width"]&&(s.border.left={style:"thin",color:{rgb:webix.color.rgbToHex(i["border-left-color"])}}),"0px"!==i["border-top-width"]&&(s.border.top={style:"thin",color:{rgb:webix.color.rgbToHex(i["border-top-color"])}}),this.pG[e]=s,s},qG:function(t){t=webix.extend(t||{},{visibility:"hidden", "white-space":"nowrap","text-align":"left"});var e="";for(var i in t)e+=i+":"+t[i]+";";var s=webix.html.create("div",{style:e});this.Vf.appendChild(s);var n=this.sG(s,e);return webix.html.remove(s),n},tG:function(t){var e={};return e=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle}}), webix.extend(webix.ui.datatable,{topSplit_setter:function(t){return this.data&&(this.data.$freeze=t),t},freezeRow:function(t,e){function i(t,e,i,s,a){var r;if(i&&t>=n){for(a||n++,r=t;r>=n;r--)s[r]=s[r-1];s[n-1]=e}if(!i&&n>t){for(a||n--,r=t;n>r;r++)s[r]=s[r+1];s[n]=e}}var s,n=this.s.topSplit,a=this.data.order,r=this.data.jf; t?(s=this.getIndexById(t),t=t.toString(),i(s,t,e,a),r&&i(r.find(t),t,e,r,!0)):e||(n=0),this.define("topSplit",n),this.refresh()}}),webix.TreeTableClick={},webix.TreeTablePaste={insert:function(t){for(var e=this.getSelectedId(!0,!0),i=0;i":webix.TreeType.checkbox.apply(this,arguments)},this.data.provideApi(this,!0), this.x.setAttribute("role","treegrid")},Xg:!1,Vn:function(t){return function(e,i){return i=i.row,t.call(this,e,i)}},getState:function(){var t=webix.DataState.getState.call(this);return webix.extend(t,webix.TreeAPI.getState.call(this)),t},setState:function(t){webix.TreeAPI.setState.call(this,t)&&webix.DataState.setState.call(this,t); },clipboard_setter:function(t){return webix.extend(this.rh,webix.TreeTablePaste),webix.TablePaste.clipboard_setter.call(this,t)},Ik:function(t,e){for(var i=0;is;s++)webix.Touch.Nf(this.St[s],1==s?t:0,e,i)}),this.attachEvent("onScrollY",this.Tt),this.attachEvent("onScrollX",this.Tt),this.attachEvent("onAfterRender",this.Ut),this.attachEvent("onColumnResize",this.Ut),this.attachEvent("onSelectChange",this.Vt); },addSpan:function(t,e,i,s,n,a){if("object"!=typeof t)s=s||1,i=i||1,this.Rt[t]||(this.Rt[t]={}),this.Rt[t][e]=[i,s,n,a];else for(var r=0;rs+r[1]-1||s>i||n>a+r[0]-1||a>n))return[t,e].concat(r);return null},Ut:function(){var t,e,i=this.fj.length-this.s.rightSplit;for(webix.html.remove(this.St), e=0;3>e;e++)t=this.St[e]=webix.html.create("DIV",{"class":"webix_span_layer"}),this.Vf.childNodes[e].appendChild(t);this.Tt(),this.s.leftSplit&&this.Wt(this.St[0],0,this.s.leftSplit),this.s.rightSplit&&this.Wt(this.St[2],i,this.fj.length),this.Wt(this.St[1],this.s.leftSplit,i),this.s.topSplit&&!webix.env.touch&&this.DG(); },EG:function(){for(var t,e=0,i=0,s=0,n=0;e=t;)n+=this.fj[e].width,e--;for(e=this.s.leftSplit;ee;e++)t=this.St[e]=webix.html.create("DIV",{"class":"webix_span_layer_top"}),this.Vf.childNodes[e-3].appendChild(t);i=this.EG(),this.s.leftSplit&&(this.St[3].style.width=i[0]+"px",this.Wt(this.St[3],0,this.s.leftSplit,!0)),this.s.rightSplit&&(this.St[5].style.width=i[2]+"px",this.Wt(this.St[5],s,this.fj.length,!0)), this.St[4].style.width=i[1]+"px",this.Wt(this.St[4],this.s.leftSplit,s,!0)},Wt:function(t,e,i,s){for(var n=0,a=this.data.$min||0,r=this.data.$max||this.data.order.length,h=a;r>h;h++){var o=this.data.order[h];if(o){var l=this.Rt[o];if(l&&(!s||hc;c++){var u=this.fj[c].id; l[u]&&this.Xt(t,h,c,l,n,e,o,u)}n+=this.FA(this.getItem(o))}}},Vt:function(){for(var t=this.config.select,e="cell"==t||"column"==t,i=this.getSelectedId(!0),s=[],n=this.Yt||[],a=webix.uid()+"",r=!1,h=0;hs;s++){var n=this.fj[s];i+=n?n.width:0}return i},$t:function(t,e){for(var i=0,s=t;e>s;s++){var n=this.getItem(this.data.order[s]); i+=n?this.FA(n):this.s.rowHeight}return i},Xt:function(t,e,i,s,n,a,r,h){var o=s[h],l=o[2]||this.getText(r,h),c="";!s.$selected||"row"!==this.s.select&&s.$selected.column!==h||(c="webix_selected ");var u={column:i,row:e,"class":c+"webix_cell webix_table_cell webix_dtable_span "+(o[3]||""),"aria-colindex":i+1, "aria-rowindex":e+1};o[0]>1&&(u["aria-colspan"]=o[0]),o[1]>1&&(u["aria-rowspan"]=o[1]);var d=webix.html.create("DIV",u,""+l);d.style.top=n+"px",d.style.left=this.Zt(a,i)+"px",d.style.width=this.Zt(i,i+o[0])+"px",d.style.height=this.$t(e,e+o[1])+"px",t.appendChild(d)},Tt:function(){if(!this.s.prerender)for(var t=this.getScrollState(),e=0;3>e;e++)this.St[e].style.top="-"+(t.y||0)+"px"; },QD:function(t,e){var i,s,n=!1;return this.Rt&&(i=this.getSpan(t.row,t.column),s=this.getSpan(e.row,e.column),i&&s&&i[0]==s[0]&&i[1]==s[1]&&(n=!0)),n},getSpanNode:function(t){for(var e=this.St,i=this.getIndexById(t.row),s=this.getColumnIndex(t.column),n=0;n")),t},defaults:{subRowHeight:35},lA:function(){this.data.each(function(t){t&&(t.$sub=this.s.subrow(t,this.type)); },this),this.pC()},pC:function(t){if("auto"===this.s.subRowHeight&&this.bc&&this.mA(),t&&this.s.subview)for(var e in this.oA){var i=webix.$$(this.oA[e]);i.s.hidden||i.adjust()}},nA:function(t){var e=this.getItem(t);e.$sub=this.s.subrow(e,this.type),"auto"===this.s.subRowHeight&&this.mA(e.id,e.$sub)}, $init:function(){this.kA=webix.once(function(){var t="#"+this.bj+" .webix_cell.webix_dtable_subview { line-height:normal;}";this.s.fixedRowHeight&&(t+="#"+this.bj+" .webix_column .webix_cell { white-space: nowrap;}"),webix.html.addStyle(t),this.oA={},this.attachEvent("onSubViewRender",this.pA),this.data.attachEvent("onStoreUpdated",webix.bind(function(t,e,i){ t?("update"==i||"add"==i)&&this.nA(t):this.lA()},this)),this.attachEvent("onResize",function(t,e,i){i!=t&&this.pC(!0)})}),this.type.subrow=function(t){return t.$sub?t.$subopen?"
":"
":"
"; },this.on_click.webix_sub_open=function(t,e){return this.closeSub(e),!1},this.on_click.webix_sub_close=function(t,e){return this.openSub(e),!1}},openSub:function(t){var e=this.getItem(t);if(!e.$subopen){e.$row=this.s.subrow,e.$subHeight=e.$subHeight||this.s.subRowHeight,e.$subopen=!0;var i=this.oA[e.$subContent]; i&&(i.repaintMe=!0),this.refresh(t),this.callEvent("onSubViewOpen",[t])}},getSubView:function(t){var e=this.getItem(t);if(e){var i=this.oA[e.$subContent];if(i)return webix.$$(i)}return null},resizeSubView:function(t){var e=this.getSubView(t);e&&this.qA(this.getItem(t),e)},qA:function(t,e){var i=e.$getSize(0,0)[2],s=t.$subHeight||this.s.subRowHeight,n=Math.abs(i-(s||0)); n>2&&(t.$subHeight=i,this.refresh(t.id))},wC:function(t){var e=t.$width;if(t.lc){var i=t.q.length-t.qc;e-=t.mc?2*t.Dc+2:t.Cc*(i-1)+2*t.Dc+2*i}return e>0},pA:function(t,e){var i,s=this.oA[t.$subContent];if(s)e.firstChild.appendChild(s),i=webix.$$(t.$subContent),this.wC(i)||i.adjust(),s.repaintMe&&(delete s.repaintMe, i.config.hidden=!1,i.Qd());else{var n,a=this.s.subview;"function"==typeof a?i=a.call(this,t,e.firstChild):(n=webix.copy(a),n.$scope=this.$scope,i=webix.ui(n,e.firstChild)),i.getMasterView=webix.bind(function(){return this},this),t.$subContent=i.config.id,this.oA[t.$subContent]=i.$view,i.attachEvent("onResize",webix.bind(function(e,i,s,n){ i&&i!=n&&this.refresh(t.id)},this)),this.callEvent("onSubViewCreate",[i,t])}this.qA(t,i||webix.$$(s))},rA:function(t){var e=this.getItem(t),i=this.oA[e.$subContent];if(i){delete e.$subContent;var s=webix.$$(i);s&&s!=this&&s.destructor()}},mA:function(t,e){var i=webix.html.create("DIV",{"class":"webix_measure_size webix_cell webix_dtable_subrow" },"");i.style.cssText="width:"+this.bc+"px; height:auto; visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;",this.$view.appendChild(i),this.data.each(function(s){(s&&!t||s.id==t&&s.$sub)&&(i.innerHTML=e||this.s.subrow(s,this.type),s.$subHeight=i.offsetHeight)},this),i=webix.html.remove(i); },closeSub:function(t){var e=this.getItem(t);if(e.$subopen){e.$row=!1,e.$subopen=!1;var i=this.oA[e.$subContent];i&&(webix.$$(i).config.hidden=!0),this.refresh(t),this.callEvent("onSubViewClose",[t])}}}),webix.extend(webix.ui.datatable,{headermenu_setter:function(t){return t&&(t.data&&(this.Xw=!0),t=this._t(t)), t},_t:function(t){var e={view:"contextmenu",template:"   #value#",type:{hidden:function(t){return t.hidden?webix.skin.icon+"empty":webix.skin.icon+"eye"}},on:{onMenuItemClick:webix.bind(function(e,i){var s=webix.$$(this.s.headermenu),n=s.getItem(e).hidden; s.getItem(e).hidden=!n,s.refresh(e),s.$blockRender=!0;var a={spans:"object"==typeof t&&t.spans};return n?this.showColumn(e,a):this.hideColumn(e,a),s.$blockRender=!1,!1},this)},data:[]};"object"==typeof t&&webix.extend(e,t,!0);var i=webix.ui(e);return i.attachTo(this.I),this.Ns.push(i),this.attachEvent("onStructureLoad",this.au), this.attachEvent("onStructureUpdate",this.au),this._t=function(t){return t},i.s.id},au:function(){var t=webix.$$(this.s.headermenu),e=this.am;if(!t.$blockRender){if(this.Xw)return t.data.each(function(t){t.hidden=!!e[t.id]}),void t.refresh();var i=[],s=this.bm;s.length||(s=this.fj);for(var n=0;n"}},webix.ui.datafilter.richSelectFilter={getInputNode:function(t){return webix.$$(t.$webix)||null; },getValue:function(t){var e=this.getInputNode(t);return e?e.getValue():""},setValue:function(t,e){var i=this.getInputNode(t);return i?i.setValue(e):""},compare:function(t,e){return t==e},refresh:function(t,e,i){if(!t.$destructed){var s=webix.$$(i.richselect);if(!s.$view.parentNode){var n=webix.html.create("div",{ "class":"webix_richfilter"});n.appendChild(s.$view)}e.$webix=i.richselect,e.style.marginLeft="-10px",i.compare=i.compare||this.compare,i.prepare=i.prepare||this.prepare,t.registerFilter(e,i,this);var a,r=i.options;r?"string"==typeof r?(a=i.options=[],webix.ajax(r).then(webix.bind(function(e){i.options=e.json(); var s=document.body.contains(s)?s:document.body.querySelector('[active_id="'+i.contentId+'"]');this.refresh(t,s,i)},this))):a=r:a=t.collectValues(i.columnId);var h=s.getPopup().getList(),o=webix.$$(r);if(o&&o.data&&o.data.getRange&&(a=o.data.getRange()),e.firstChild.appendChild(s.$view.parentNode),h.parse&&(h.clearAll(), h.parse(a),!this.$noEmptyOption&&i.emptyOption!==!1||i.emptyOption)){var l={id:"",value:i.emptyOption||"",$empty:!0};h.add(l,0)}i.value&&this.setValue(e,i.value),s.render(),webix.delay(s.resize,s)}},render:function(t,e){if(!e.richselect){var i=webix.html.create("div",{"class":"webix_richfilter"}),s={ container:i,view:this.inputtype,options:[]},n=webix.extend(this.inputConfig||{},e.inputConfig||{},!0);webix.extend(s,n),e.separator&&(s.separator=e.separator),e.suggest&&(s.suggest=e.suggest);var a=webix.ui(s);a.attachEvent("onChange",function(){t.filterByAll()}),e.richselect=a.s.id,t.Ns.push(a)}return e.css="webix_div_filter", " "},inputtype:"richselect"},webix.ui.datafilter.serverRichSelectFilter=webix.extend({$server:!0},webix.ui.datafilter.richSelectFilter),webix.ui.datafilter.multiSelectFilter=webix.extend({$noEmptyOption:!0,inputtype:"multiselect",prepare:function(t,e){if(!t)return t;for(var i={},s=t.toString().split(e.separator||","),n=0;n "+(e.groupText||""); }},webix.ui.datafilter.dateRangeFilter=webix.extend({prepare:function(t){return t.start||t.end?webix.ui.daterange.prototype.SD(t):""},compare:function(t,e){return(!e.start||t>=e.start)&&(!e.end||t<=e.end)},inputtype:"daterangepicker"},webix.ui.datafilter.richSelectFilter),webix.ui.datafilter.serverDateRangeFilter=webix.extend({ $server:!0},webix.ui.datafilter.dateRangeFilter),webix.editors.$popup.multiselect={view:"multisuggest",suggest:{button:!0}},webix.Canvas=webix.proto({$init:function(t){this.Wn=[],this.AE=webix.isUndefined(t.series)?t.name:t.series,this.tg=webix.toNode(t.container||t);var e=t.width*(window.devicePixelRatio||1),i=t.height*(window.devicePixelRatio||1),s=t.style||""; s+=";width:"+t.width+"px;height:"+t.height+"px;",this.Yn(t.name,s,e,i,t.title)},Yn:function(t,e,i,s,n){return this.Zn=webix.html.create("canvas",{title:n,width:i,height:s,canvas_id:t,style:e||""}),this.tg.appendChild(this.Zn),this.Zn.getContext||webix.env.isIE&&(webix.require("legacy/excanvas/excanvas.js",!0), G_vmlCanvasManager.init_(document),G_vmlCanvasManager.initElement(this.Zn)),this.Zn},getCanvas:function(t){var e=(this.Zn||this.Yn(this.w)).getContext(t||"2d");return this.$n||(this.$n=!0,e.scale(window.devicePixelRatio||1,window.devicePixelRatio||1)),e},_n:function(t,e){this.Zn&&(this.Zn.setAttribute("width",t*(window.devicePixelRatio||1)), this.Zn.setAttribute("height",e*(window.devicePixelRatio||1)),this.Zn.style.width=t+"px",this.Zn.style.height=e+"px",this.$n=!1)},renderText:function(t,e,i,s,n){if(i){n&&(n=Math.max(n,0)),e&&(e=Math.max(e,0));var a=webix.html.create("DIV",{"class":"webix_canvas_text"+(s?" "+s:""),style:"left:"+t+"px; top:"+e+"px;", "aria-hidden":"true"},i);return this.tg.appendChild(a),this.Wn.push(a),n&&(a.style.width=n+"px"),a}},renderTextAt:function(t,e,i,s,n,a,r){var h=this.renderText.call(this,i,s,n,a,r);return h&&(t&&("middle"==t?h.style.top=parseInt(s-h.offsetHeight/2,10)+"px":h.style.top=s-h.offsetHeight+"px"),e&&("left"==e?h.style.left=i-h.offsetWidth+"px":h.style.left=parseInt(i-h.offsetWidth/2,10)+"px")), h},clearCanvas:function(t){var e=[];if(webix.html.remove(this.Wn),this.Wn=[],!t&&this.tg.t){for(e=this.ao();e.length;)e[0].parentNode.removeChild(e[0]),e.splice(0,1);e=null,this.tg.t.getElementsByTagName("AREA").length||(this.tg.t.parentNode.removeChild(this.tg.t),this.tg.t=null)}this.getCanvas().clearRect(0,0,this.Zn.offsetWidth||Math.floor(this.Zn.width/(window.devicePixelRatio||1)),this.Zn.offsetHeight||Math.floor(this.Zn.height/(window.devicePixelRatio||1))); },toggleCanvas:function(){this.bo("none"==this.Zn.style.display)},showCanvas:function(){this.bo(!0)},hideCanvas:function(){this.bo(!1)},bo:function(t){var e,i;for(i=0;i0;)i=this.co[t%16]+i,t=Math.floor(t/16);for(;i.lengthe||e>255)&&(e=0),(0>i||i>255)&&(i=0),(0>s||s>255)&&(s=0),[e,i,s]},hsvToRgb:function(t,e,i){var s,n,a,r,h,o,l,c;switch(s=Math.floor(t/60)%6,n=t/60-s,a=i*(1-e),r=i*(1-n*e),h=i*(1-(1-n)*e), o=0,l=0,c=0,s){case 0:o=i,l=h,c=a;break;case 1:o=r,l=i,c=a;break;case 2:o=a,l=i,c=h;break;case 3:o=a,l=r,c=i;break;case 4:o=h,l=a,c=i;break;case 5:o=i,l=a,c=r}return o=Math.floor(255*o),l=Math.floor(255*l),c=Math.floor(255*c),[o,l,c]},rgbToHsv:function(t,e,i){var s,n,a,r,h,o,l,c;return s=t/255,n=e/255, a=i/255,r=Math.min(s,n,a),h=Math.max(s,n,a),l=0,o=0===h?0:1-r/h,c=h,h==r?l=0:h==s&&n>=a?l=60*(n-a)/(h-r)+0:h==s&&a>n?l=60*(n-a)/(h-r)+360:h==n?l=60*(a-s)/(h-r)+120:h==a&&(l=60*(s-n)/(h-r)+240),[l,o,c]}},webix.HtmlMap=webix.proto({$init:function(t){this.ad="map_"+webix.uid(),this.U=t,this.eo=[],this.sA=[]; },addRect:function(t,e,i){this.fo(t,"RECT",e,i)},addPoly:function(t,e,i){this.fo(t,"POLY",e,i)},fo:function(t,e,i,s){var n="";4==arguments.length&&(n="userdata='"+s+"'"),this.eo.push(""),this.sA.push({index:s,points:i})},addSector:function(t,e,i,s,n,a,r,h){ var o=[];o.push(s),o.push(Math.floor(n*r));for(var l=e;i>l;l+=Math.PI/18)o.push(Math.floor(s+a*Math.cos(l))),o.push(Math.floor((n+a*Math.sin(l))*r));return o.push(Math.floor(s+a*Math.cos(i))),o.push(Math.floor((n+a*Math.sin(i))*r)),o.push(s),o.push(Math.floor(n*r)),this.addPoly(t,o,h)},hide:function(t,e,i){ if(t.querySelectorAll)for(var s=t.querySelectorAll('area[userdata="'+e+'"]'),n=0;n"+this.eo.join("\n")+"",t.t=e,this.eo=[]}}),webix.protoUI({name:"chart",$init:function(t){if(this.go=[this.s],this.ho=[],this.w.className+=" webix_chart",this.$ready.push(this.Mi),t.preset&&this.io(t), t.series){var e=t.series;delete t.series,t.series=e}this.attachEvent("onMouseMove",this.tA),this.data.provideApi(this,!0)},Mi:function(){this.data.attachEvent("onStoreUpdated",webix.bind(function(){this.render.apply(this,arguments)},this))},defaults:{ariaLabel:"chart",color:"default",alpha:"1",label:!1, value:"{obj.value}",padding:{},type:"pie",lineColor:"#ffffff",cant:.5,barWidth:30,line:{width:2,color:"#1293f8"},item:{radius:3,borderColor:"#636363",borderWidth:1,color:"#ffffff",alpha:1,type:"r",shadow:!1},shadow:!0,gradient:!1,border:!0,labelOffset:20,origin:"auto",scale:"linear"},ad:"webix_area_id", on_click:{webix_chart_legend_item:function(t,e,i){var s=i.getAttribute("series_id");if(this.callEvent("onLegendClick",[t,s,i])&&"undefined"!=typeof s&&this.go.length>1){var n=this.s,a=n.legend.values,r=a&&a[s].toggle||n.legend.toggle;r&&(-1!=i.className.indexOf("hidden")?this.showSeries(s):this.hideSeries(s)); }}},on_dblclick:{},on_mouse_move:{},locate:function(t){return webix.html.locate(t,this.ad)},$setSize:function(t,e){var i=webix.ui.view.prototype.$setSize.call(this,t,e);if(i){for(var s in this.canvases)this.canvases[s]._n(this.bc,this.dc);this.render()}return i},type_setter:function(t){return"undefined"==typeof this.s.offset&&(this.s.offset=!(-1!=t.toLowerCase().indexOf("area"))), "radar"!=t||this.s.yAxis||this.define("yAxis",{}),"scatter"==t&&(this.s.yAxis||this.define("yAxis",{}),this.s.xAxis||this.define("xAxis",{})),t},destructor:function(){this.removeAllSeries(),webix.Destruction.destructor.apply(this,arguments)},removeAllSeries:function(){this.clearCanvas(),this.ko&&(this.ko.innerHTML="", this.ko.parentNode.removeChild(this.ko),this.ko=null),this.canvases&&(this.canvases={}),this.w.innerHTML="";for(var t=0;te?(s&&(s=i-e>s?this.rC+2:this.rC+1),this.rC=s):s%=i,this.qC[s]}},color_setter:function(t){return this.colormap[t]||webix.template(t)},fill_setter:function(t){return t&&"0"!=t?webix.template(t):!1},io:function(t){this.define("preset",t.preset), delete t.preset},preset_setter:function(t){var e,i,s;if(this.defaults=webix.extend({},this.defaults),s=this.presets[t],"object"==typeof s){for(e in s)if("object"==typeof s[e])if(this.defaults[e]&&"object"==typeof this.defaults[e]){this.defaults[e]=webix.extend({},this.defaults[e]);for(i in s[e])this.defaults[e][i]=s[e][i]; }else this.defaults[e]=webix.extend({},s[e]);else this.defaults[e]=s[e];return t}return!1},legend_setter:function(t){return t?("object"!=typeof t&&(t={template:t}),this.E(t,{width:150,height:18,layout:"y",align:"left",valign:"bottom",template:"",toggle:-1!=this.s.type.toLowerCase().indexOf("stacked")?"":"hide", marker:{type:"square",width:15,height:15,radius:3},margin:4,padding:3}),t.template=webix.template(t.template),t):(this.ko&&(this.ko.innerHTML="",this.ko=null),!1)},item_setter:function(t){"object"!=typeof t&&(t={color:t,borderColor:t}),this.E(t,webix.extend({},this.defaults.item));var e=["alpha","borderColor","color","radius","type"]; return this.ro(e,t),t},line_setter:function(t){return"object"!=typeof t&&(t={color:t}),t=webix.extend(t,this.defaults.line),t.color=webix.template(t.color),t},padding_setter:function(t){return"object"!=typeof t&&(t={left:t,right:t,top:t,bottom:t}),this.E(t,{left:50,right:20,top:35,bottom:40}),t},xAxis_setter:function(t){ if(!t)return!1;"object"!=typeof t&&(t={template:t}),this.E(t,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:!0});var e=["lineColor","template","lines"];return this.ro(e,t),this.so=webix.extend({},t),t},yAxis_setter:function(t){this.E(t,{title:"",color:"#000000",lineColor:"#cfcfcf", template:"{obj}",lines:!0,bg:"#ffffff"});var e=["lineColor","template","lines","bg"];return this.ro(e,t),this.to=webix.extend({},t),t},ro:function(t,e){for(var i=0;i=b;b+=r){var p=this.Bo?Math.pow(10,b):b;h.fixNum&&(p=parseFloat(p).toFixed(h.fixNum));var x=Math.floor(l-f*d)+.5;if(b==n&&"auto"==this.s.origin||!this.s.yAxis.lines.call(this,b)||this.zo(t,o,x,s.x,x,this.s.yAxis.lineColor.call(this,b),1), b==this.s.origin&&(u=x),1>r&&!this.Bo){var w=Math.min(Math.floor(this.Do(r)),0>=n?0:Math.floor(this.Do(n))),g=Math.pow(10,-w);p=Math.round(p*g)/g,b=p}this.canvases.y.renderText(0,x-5,this.s.yAxis.template(p.toString()),"webix_axis_item_y",i.x-5),f++}return this.zo(t,o,l+1,o,c,this.s.yAxis.color,1),u} }},Co:function(t,e){var i="webix_axis_title_y"+(webix.Eo&&9!=webix.Eo?" webix_ie_filter":""),s=this.canvases.y.renderTextAt("middle",!1,0,parseInt((e.y-t.y)/2+t.y,10),this.s.yAxis.title,i);s&&(s.style.left=(webix.env.transform?(s.offsetHeight-s.offsetWidth)/2:0)+"px")},Fo:function(t,e){var i=Math.floor(this.Do(t)),s=Math.ceil(this.Do(e)); return{start:i,step:1,end:s}},uG:function(t){var e=Math.floor(this.Do(t)),i=Math.pow(10,e),s=t/i;return s=s>5?10:5,parseInt(s,10)*i},Ao:function(t,e){if(this.Bo=!1,"logarithmic"==this.s.scale){var i=Math.floor(this.Do(t)),s=Math.ceil(this.Do(e));if(t>0&&e>0&&s-i>1)return this.Bo=!0,this.Fo(t,e)}"auto"!=this.s.origin&&this.s.originMath.abs(t))a=0>t?-n:0;else{var h=Math.abs(t),o=Math.floor(this.Do(h)),l=h/Math.pow(10,o);for(a=Math.ceil(10*l)/10*Math.pow(10,o)-n,h>1&&n>.1&&(a=Math.ceil(a));0>t?t>=a:a>=t;)a-=n;0>t&&(a=-a-2*n)}e-a>10&&(n=this.uG((e-a)/8||1)),r=a;for(var c=Math.floor(this.Do(n));e>r;)r+=n, r=parseFloat((1*r).toFixed(Math.abs(c)));return{start:a,end:r,step:n,fixNum:0>c?Math.abs(c):0}},Go:function(t,e){var i,s,n=this.data.Df(),a=arguments.length&&"h"==t?this.so:this.to;if(e=e||"value",a&&"undefined"!=typeof a.end&&"undefined"!=typeof a.start&&a.step)i=parseFloat(a.end),s=parseFloat(a.start);else if(i=webix.GroupMethods.max(this.go[0][e],n), s=a&&"undefined"!=typeof a.start?parseFloat(a.start):webix.GroupMethods.min(this.go[0][e],n),this.go.length>1)for(var r=1;ri&&(i=h),s>o&&(s=o)}return{max:i,min:s}},Do:function(t){var e="log"; return Math[e](t)/Math.LN10},xo:function(t,e,i,s,n){if(this.s.xAxis){var a=this.canvases.x.renderTextAt(n,s,t,e-(n?2:0),this.s.xAxis.template(i));a&&(a.className+=" webix_axis_item_x")}},yo:function(t,e,i,s,n){this.s.xAxis&&this.s.xAxis.lines&&this.zo(t,e,i,e,s,this.s.xAxis.lineColor.call(this,n),1)}, zo:function(t,e,i,s,n,a,r){t.strokeStyle=a,t.lineWidth=r,t.beginPath(),t.moveTo(e,i),t.lineTo(s,n),t.stroke(),t.lineWidth=1},Ho:function(t,e){var i,s=1;return i=e!=t?e-t:t,[i,s]},qo:[function(t){return"#FF"+webix.color.toHex(t/2,2)+"00"},function(t){return"#FF"+webix.color.toHex(t/2+128,2)+"00"},function(t){ return"#"+webix.color.toHex(255-t,2)+"FF00"},function(t){return"#00FF"+webix.color.toHex(t,2)},function(t){return"#00"+webix.color.toHex(255-t,2)+"FF"},function(t){return"#"+webix.color.toHex(t,2)+"00FF"}],qC:["#f55b50","#ff6d3f","#ffa521","#ffc927","#ffee54","#d3e153","#9acb61","#63b967","#21a497","#21c5da","#3ea4f5","#5868bf","#7b53c0","#a943ba","#ec3b77","#9eb0b8"], rC:0,addSeries:function(t){var e=webix.extend({},this.s);this.s=webix.extend({},e),this.e(t,{}),this.go.push(this.s),this.s=e},tA:function(t,e,i){var s;if(i.getAttribute("userdata")&&(this.Io=1==this.go.length?this.uA(e):i.getAttribute("userdata"),this.go[this.Io])){for(var n=0;n=e[0]&&o<=e[3]&&o>=e[1]&&(r?i[s].index>r.index&&(r=i[s]):r=i[s]); return r?r.index:0},hideSeries:function(t){this.canvases[t].hideCanvas();var e=this.s.legend;e&&e.values&&e.values[t]&&(e.values[t].$hidden=!0,this.mo()),this.eo.hide(this.w,t,!0)},showSeries:function(t){this.canvases[t].showCanvas();var e=this.s.legend;e&&e.values&&e.values[t]&&(delete e.values[t].$hidden, this.mo()),this.eo.hide(this.w,t,!1)},mo:function(t,e){var i,s,n,a,r,h,o,l,c,u,d,f=0,b=0;if(t=t||[],e=e||this.bc,l=this.canvases.legend.getCanvas(),s=this.s.legend,o="x"!=this.s.legend.layout?"width:"+s.width+"px":"",this.ko&&(this.ko.innerHTML="",this.ko.parentNode.removeChild(this.ko)),this.canvases.legend.clearCanvas(!0), n=webix.html.create("DIV",{"class":"webix_chart_legend",style:"left:"+f+"px; top:"+b+"px;"+o},""),s.padding&&(n.style.padding=s.padding+"px"),this.ko=n,this.w.appendChild(n),r=[],s.values)for(i=0;ih&&("x"==s.layout&&"center"==s.align&&(f=(e-h)/2),"right"==s.align&&(f=e-h),s.margin&&"center"!=s.align&&(f+=("left"==s.align?1:-1)*s.margin)),a2&&a.setAttribute("series_id",i),t.appendChild(a),a},Ko:function(t,e,i,s,n,a,r){var h=[],o=this.s.legend.marker,l=this.s.legend.values,c=l&&l[r].markerType?l[r].markerType:o.type;if(s&&(t.strokeStyle=t.fillStyle=s), "round"!=c&&o.radius)if("item"==c){if(this.s.line&&"scatter"!=this.s.type&&!this.s.disableLines){t.beginPath(),t.lineWidth=this.go[r].line.width,t.strokeStyle=a?s:this.go[r].line.color.call(this,{});var u=e+5,d=i+n/2;t.moveTo(u,d);var f=u+o.width;t.lineTo(f,d),t.stroke()}var b=this.go[r].item,p=parseInt(b.radius.call(this,{}),10)||0,x=b.type.call(this,{}); p&&(t.beginPath(),a?(t.lineWidth=b.borderWidth,t.strokeStyle=s,t.fillStyle=s):(t.lineWidth=b.borderWidth,t.fillStyle=b.color.call(this,{}),t.strokeStyle=b.borderColor.call(this,{}),t.globalAlpha=b.alpha.call(this,{})),t.beginPath(),e+=o.width/2+5,i+=n/2,this.Lo(t,e,i,p+1,x),t.fill(),t.stroke()),t.globalAlpha=1; }else t.beginPath(),t.lineWidth=1,e+=5,i+=n/2-o.height/2,h=[[e+o.radius,i+o.radius,o.radius,Math.PI,3*Math.PI/2,!1],[e+o.width-o.radius,i],[e+o.width-o.radius,i+o.radius,o.radius,-Math.PI/2,0,!1],[e+o.width,i+o.height-o.radius],[e+o.width-o.radius,i+o.height-o.radius,o.radius,0,Math.PI/2,!1],[e+o.radius,i+o.height],[e+o.radius,i+o.height-o.radius,o.radius,Math.PI/2,Math.PI,!1],[e,i+o.radius]], this.Mo(t,h),t.stroke(),t.fill();else{t.beginPath(),t.lineWidth=o.height,t.lineCap=o.type,e+=t.lineWidth/2+5,i+=n/2,t.moveTo(e,i);var f=e+o.width-o.height+1;t.lineTo(f,i),t.stroke(),t.fill()}},no:function(t,e){var i,s,n,a;if(i=this.s.padding.left,s=this.s.padding.top,n=t-this.s.padding.right,a=e-this.s.padding.bottom, this.s.legend){var r=this.s.legend,h=this.s.legend.width,o=this.s.legend.height;"x"==r.layout?"center"==r.valign?"right"==r.align?n-=h:"left"==r.align&&(i+=h):"bottom"==r.valign?a-=o:s+=o:"right"==r.align?n-=h:"left"==r.align&&(i+=h)}return{start:{x:i,y:s},end:{x:n,y:a}}},No:function(t){var e,i,s,n,a; if(this.s.yAxis&&"undefined"!=typeof this.s.yAxis.end&&"undefined"!=typeof this.s.yAxis.start&&this.s.yAxis.step)s=parseFloat(this.s.yAxis.end),n=parseFloat(this.s.yAxis.start);else{for(e=0;es&&(s=t[e].$sum),t[e].$min0&&(n=0)}return{max:s,min:n}},Oo:function(t,e,i,s,n,a,r,h){var o,l,c,u,d,f;return"light"==a?(o="x"==h?t.createLinearGradient(e,i,s,i):t.createLinearGradient(e,i,e,n), f=[[0,"#FFFFFF"],[.9,r],[1,r]],l=2):"falling"==a||"rising"==a?(o="x"==h?t.createLinearGradient(e,i,s,i):t.createLinearGradient(e,i,e,n),c=webix.color.toRgb(r),u=webix.color.rgbToHsv(c[0],c[1],c[2]),u[1]*=.5,d="rgb("+webix.color.hsvToRgb(u[0],u[1],u[2])+")","falling"==a?f=[[0,d],[.7,r],[1,r]]:"rising"==a&&(f=[[0,r],[.3,r],[1,d]]), l=0):(t.globalAlpha=.37,l=0,o="x"==h?t.createLinearGradient(e,n,e,i):t.createLinearGradient(e,i,s,i),f=[[0,"#9d9d9d"],[.3,"#e8e8e8"],[.45,"#ffffff"],[.55,"#ffffff"],[.7,"#e8e8e8"],[1,"#9d9d9d"]]),this.Po(o,f),{gradient:o,offset:l}},Qo:function(t,e,i,s){return t*=-1,e+=Math.cos(t)*s,i-=Math.sin(t)*s,{ x:e,y:i}},Po:function(t,e){for(var i=0;i2&&(s="arc"),t[s].apply(t,e[i])},Ro:function(t,e,i,s,n){t.addRect(e,[i[0].x-s.x,i[0].y-s.y,i[1].x-s.x,i[1].y-s.y],n)}},webix.Group,webix.AutoTooltip,webix.DataLoader,webix.MouseEvents,webix.EventSystem,webix.ui.view), webix.extend(webix.ui.chart,{$render_pie:function(t,e,i,s,n,a){this.So(t,e,i,s,1,a,n)},So:function(t,e,i,s,n,a,r){if(e.length){var h=this.To(i,s),o=this.s.radius?this.s.radius:h.radius;if(!(0>o)){var l=this.Uo(e),c=this.Vo(l),u=this.Wo(l,c),d=this.s.x?this.s.x:h.x,f=this.s.y?this.s.y:h.y;1==n&&this.s.shadow&&this.Xo(t,d,f,o), f/=n;var b=-Math.PI/2,p=[];if(t.scale(1,n),this.s.gradient){var x=1!=n?d+o/3:d,w=1!=n?f+o/3:f;this.Yo(t,d,f,o,x,w)}for(var g=0;g=s&&n>=0||s>=0&&n<=Math.PI||Math.abs(s-Math.PI)>.003&&s<=Math.PI&&n>=Math.PI){0>=s&&n>=0&&(s=0,r=!1,this._o(t,e,i,a,s,n)),s<=Math.PI&&n>=Math.PI&&(n=Math.PI,r=!1,this._o(t,e,i,a,s,n));var h=(this.s.pieHeight||Math.floor(a/4))/this.s.cant;t.beginPath(), t.arc(e,i,a,s,n,!1),t.lineTo(e+a*Math.cos(n),i+a*Math.sin(n)+h),t.arc(e,i+h,a,n,s,!0),t.lineTo(e+a*Math.cos(s),i+a*Math.sin(s)),t.fill(),r&&t.stroke()}},_o:function(t,e,i,s,n,a){t.beginPath(),t.arc(e,i,s,n,a,!1),t.stroke()},Xo:function(t,e,i,s){t.globalAlpha=.5;for(var n=["#c4c4c4","#c6c6c6","#cacaca","#dcdcdc","#dddddd","#e0e0e0","#eeeeee","#f5f5f5","#f8f8f8"],a=n.length-1;a>-1;a--)t.beginPath(), t.fillStyle=n[a],t.arc(e+1,i+1,s+a,0,2*Math.PI,!0),t.fill();t.globalAlpha=1},ap:function(t){return t.addColorStop(0,"#ffffff"),t.addColorStop(.7,"#7a7a7a"),t.addColorStop(1,"#000000"),t},Yo:function(t,e,i,s,n,a){t.beginPath();var r;"function"!=typeof this.s.gradient?(r=t.createRadialGradient(n,a,s/4,e,i,s), r=this.ap(r)):r=this.s.gradient(r),t.fillStyle=r,t.arc(e,i,s,0,2*Math.PI,!0),t.fill(),t.globalAlpha=.7},Zo:function(t,e,i,s,n,a,r,h){var o=this.canvases[0].renderText(0,0,r,0,1);if(o){var l=o.scrollWidth;o.style.width=l+"px",l>t&&(l=t);var c=.2>n-s?4:8;h&&(c=l/1.8);var u=s+(n-s)/2;i-=(c-8)/2;var d=-c,f=-8,b="right"; (u>=Math.PI/2&&u=Math.PI)&&(d=-l-d+1,b="left");var p=0;!h&&1>a&&u>0&&u=Math.PI/2&&u=Math.PI)&&(w+=l/3):w=Math.min(w,t-l), o.style.top=x+"px",o.style.left=w+"px",o.style.width=l+"px",o.style.textAlign=b,o.style.whiteSpace="nowrap"}},$render_pie3D:function(t,e,i,s,n,a){this.So(t,e,i,s,this.s.cant,a)},$render_donut:function(t,e,i,s,n,a){if(e.length){this.So(t,e,i,s,1,a,n);var r=this.s,h=this.To(i,s),o=r.radius?r.radius:h.radius,l=r.innerRadius&&r.innerRadiusu&&this.wo(t,e,i,s,h,s.y-x*(this.s.origin-u)),r=parseInt(this.s.barWidth,10);var m=0,y=0;for(o=0;oh&&(r=parseInt(h/m-4,10));var $=(h-r*m)/2,_="undefined"!=typeof this.s.radius?parseInt(this.s.radius,10):Math.round(r/5),C=!1,S=this.s.gradient;for(S&&"function"!=typeof S?(C=S,S=!1):S&&(S=t.createLinearGradient(0,s.y,0,i.y),this.s.gradient(S)),w||this.zo(t,i.x,s.y+.5,s.x,s.y+.5,"#000000",1), o=0;oc&&(k=c),k-=u,k*=f;var I=i.x+$+o*h+(r+1)*y,E=s.y,M=S||this.s.color.call(this,e[o]),A=this.s.border?1:0,D=this.s.label(e[o]);k==this.s.origin||"auto"==this.s.origin&&this.s.value(e[o])==u?(A=0,D=""):0>k||this.s.yAxis&&0===k&&!("auto"!=this.s.origin&&this.s.origin>u)?(k=A=0, D=""):g||"auto"!=this.s.origin&&w||(k+=p/x),t.globalAlpha=this.s.alpha.call(this,e[o]);var N=this.bp(t,i,I,E,r,u,_,x,k,M,S,C,A);C&&this.cp(t,I,E,r,u,_,x,k,M,C,A),A&&this.dp(t,I,E,r,u,_,x,k,M),t.globalAlpha=1,N[0]!=I?this.canvases[n].renderTextAt(!1,!0,I+Math.floor(r/2),N[1],D):this.canvases[n].renderTextAt(!0,!0,I+Math.floor(r/2),N[3],D), a.addRect(e[o].id,[I-i.x,N[3]-i.y,N[2]-i.x,N[1]-i.y],n)}},ep:function(t,e,i,s,n,a,r){var h=this.s.xAxis,o=i;return h&&"auto"!=this.s.origin&&this.s.origin>r&&(i-=(this.s.origin-r)*n,o=i,s-=this.s.origin-r,0>s&&(s*=-1,t.translate(e+a,i),t.rotate(Math.PI),e=0,i=0),i-=.5),{value:s,x0:e,y0:i,start:o}},bp:function(t,e,i,s,n,a,r,h,o,l,c,u,d){ t.save(),t.fillStyle=l;var f=this.ep(t,i,s,o,h,n,a),b=this.fp(t,f.x0,f.y0,n,r,h,f.value,d);c&&!u&&t.lineTo(f.x0+d,e.y),t.fill(),t.restore();var p=f.x0,x=f.x0!=i?i+b[0]:b[0],w=f.x0!=i?f.start-b[1]-f.y0:f.y0,g=f.x0!=i?f.start-f.y0:b[1];return[p,w,x,g]},gp:function(t,e){var i,s;s=webix.color.toRgb(e),i=webix.color.rgbToHsv(s[0],s[1],s[2]), i[2]/=1.4,e="rgb("+webix.color.hsvToRgb(i[0],i[1],i[2])+")",t.strokeStyle=e,1==t.globalAlpha&&(t.globalAlpha=.9)},dp:function(t,e,i,s,n,a,r,h,o){var l;t.save(),l=this.ep(t,e,i,h,r,s,n),this.gp(t,o),this.fp(t,l.x0,l.y0,s,a,r,l.value,t.lineWidth/2,1),t.stroke(),t.restore()},cp:function(t,e,i,s,n,a,r,h,o,l,c){ t.save();var u=this.ep(t,e,i,h,r,s,n),d=this.Oo(t,u.x0,u.y0,u.x0+s,u.y0-r*u.value+2,l,o,"y");t.fillStyle=d.gradient,this.fp(t,u.x0+d.offset,u.y0,s-2*d.offset,a,r,u.value,d.offset+c),t.fill(),t.restore()},fp:function(t,e,i,s,n,a,r,h,o){t.beginPath();var l=0;if(n>a*r){var c=(n-a*r)/n;1>=c&&c>=-1&&(l=-Math.acos(c)+Math.PI/2); }t.moveTo(e+h,i);var u=i-Math.floor(a*r)+n+(n?0:h);a*r>n&&t.lineTo(e+h,u);var d=e+n;n&&n>0&&t.arc(d,u,Math.max(n-h,0),-Math.PI+l,-Math.PI/2,!1);var f=e+s-n-h,b=u-n+(n?h:0);t.lineTo(f,b),n&&n>0&&t.arc(f+h,u,Math.max(n-h,0),-Math.PI/2,0-l,!1);var p=e+s-h;return t.lineTo(p,i),o||t.lineTo(e+h,i),[p,b]}}), webix.extend(webix.ui.chart,{$render_line:function(t,e,i,s,n,a){var r,h,o,l,c,u,d,f,b,p,x,w;if(l=this.hp(t,e,i,s,n),r=this.s,e.length){for(c=r.offset?i.x+.5*l.cellWidth:i.x,o=[],h=0;h=0;d--)t.globalAlpha=u[d], t.strokeStyle="#d0d0d0",t.beginPath(),this.Lo(t,e,i+2*o/3,o+d+1,c),t.stroke();t.beginPath(),t.globalAlpha=.3,t.fillStyle="#bdbdbd",this.Lo(t,e,i+2*o/3,o+1,c),t.fill()}t.restore(),t.lineWidth=h.borderWidth,t.fillStyle=h.color.call(this,s),t.strokeStyle=h.borderColor.call(this,s),t.globalAlpha=h.alpha.call(this,s), t.beginPath(),this.Lo(t,e,i,o+1,c),t.fill(),t.stroke(),t.globalAlpha=1}if(n&&this.canvases[a].renderTextAt(!1,!0,e,i-o-this.s.labelOffset,this.s.label.call(this,s)),r){var f=this.s.eventRadius||o+1;r.addRect(s.id,[e-f-l.x,i-f-l.y,e+f-l.x,i+f-l.y],a)}},Lo:function(t,e,i,s,n){var a=[];if(!n||"square"!=n&&"s"!=n)if(!n||"diamond"!=n&&"d"!=n)a=!n||"triangle"!=n&&"t"!=n?[[e,i,s,0,2*Math.PI,!0]]:[[e,i-s],[e+Math.sqrt(3)*s/2,i+s/2],[e-Math.sqrt(3)*s/2,i+s/2],[e,i-s]];else{ var r=t.lineWidth>1?t.lineWidth*Math.sqrt(2)/4:0;a=[[e,i-s],[e+s,i],[e,i+s],[e-s,i],[e+r,i-s-r]]}else s*=Math.sqrt(2)/2,a=[[e-s-t.lineWidth/2,i-s],[e+s,i-s],[e+s,i+s],[e-s,i+s],[e-s,i-s]];this.Mo(t,a)},ip:function(t,e,i,s){var n=s.minValue,a=s.maxValue,r=s.unit,h=s.valueFactor,o=this.s.value(t);this.Bo&&(o=this.Do(o)); var l=(parseFloat(o||0)-n)*h;this.s.yAxis||(l+=s.startValue/r);var c=i.y-r*l;return!this.s.fixOverflow||"line"!=this.s.type&&"area"!=this.s.type?(o>a&&(c=e.y),(0>l||n>o)&&(c=i.y)):o>a?c={y:e.y,y0:c,out:"max"}:(0>l||n>o)&&(c={y:i.y,y0:c,out:"min"}),c},hp:function(t,e,i,s,n){var a,r={};r.totalHeight=s.y-i.y, this.s.cellWidth?r.cellWidth=Math.min(s.x-i.x,this.s.cellWidth):r.cellWidth=(s.x-i.x)/(this.s.offset?e.length:e.length-1);var h=!!this.s.yAxis,o=-1!=this.s.type.indexOf("stacked")?this.No(e):this.Go();r.maxValue=o.max,r.minValue=o.min,n||this.uo(e,i,s,r.minValue,r.maxValue,r.cellWidth),h&&(r.maxValue=parseFloat(this.s.yAxis.end), r.minValue=parseFloat(this.s.yAxis.start));var l=this.Ho(r.minValue,r.maxValue);return a=l[0],r.valueFactor=l[1],r.unit=a?r.totalHeight/a:10,r.startValue=0,h||(r.startValue=10,r.unit!=r.totalHeight&&(r.unit=a?(r.totalHeight-r.startValue)/a:10)),r}}),webix.extend(webix.ui.chart,{$render_barH:function(t,e,i,s,n,a){ var r,h,o,l,c,u,d,f,b,p,x,w,g,v,m,y,$,_,C,S,k;for(o=(s.y-i.y)/e.length,d=this.Go("h"),f=d.max,b=d.min,y=s.x-i.x,k=!!this.s.xAxis,n||this.mp(t,e,i,s,b,f,o),k&&(f=parseFloat(this.s.xAxis.end),b=parseFloat(this.s.xAxis.start)),v=this.Ho(b,f),w=v[0],x=v[1],_=w?y/w:10,k||(m=10,_=w?(y-m)/w:10),h=parseInt(this.s.barWidth,10), h*this.go.length+4>o&&(h=o/this.go.length-4),r=Math.floor((o-h*this.go.length)/2),g="undefined"!=typeof this.s.radius?parseInt(this.s.radius,10):Math.round(h/5),p=!1,c=this.s.gradient,c&&"function"!=typeof c?(p=c,c=!1):c&&(c=t.createLinearGradient(i.x,i.y,s.x,i.y),this.s.gradient(c)),k||this.zo(t,i.x-.5,i.y,i.x-.5,s.y,"#000000",1), u=0;uf&&($=f),$-=b,$*=x,C=i.x,S=i.y+r+u*o+(h+1)*n,0>$&&"auto"==this.s.origin||this.s.xAxis&&0===$&&!("auto"!=this.s.origin&&this.s.origin>b))this.canvases[n].renderTextAt("middle","right",C+10,S+h/2+r,this.s.label(e[u]));else{ 0>$&&"auto"!=this.s.origin&&this.s.origin>b&&($=0),k||($+=m/_),l=c||this.s.color.call(this,e[u]),this.s.border&&this.np(t,C,S,h,b,g,_,$,l),t.globalAlpha=this.s.alpha.call(this,e[u]);var I=this.op(t,s,C,S,h,b,g,_,$,l,c,p);p&&this.pp(t,C,S,h,b,g,_,$,l,p),t.globalAlpha=1,I[3]==S?(this.canvases[n].renderTextAt("middle","left",I[0]-5,I[3]+Math.floor(h/2),this.s.label(e[u])), a.addRect(e[u].id,[I[0]-i.x,I[3]-i.y,I[2]-i.x,I[3]+h-i.y],n)):(this.canvases[n].renderTextAt("middle",!1,I[2]+5,I[1]+Math.floor(h/2),this.s.label(e[u])),a.addRect(e[u].id,[I[0]-i.x,S-i.y,I[2]-i.x,I[3]-i.y],n))}},qp:function(t,e,i,s,n,a,r,h,o){var l=0;if(n>a*r){var c=(n-a*r)/n;l=-Math.asin(c)+Math.PI/2; }t.moveTo(e,i+h);var u=e+a*r-n-(n?0:h);u=Math.max(e,u),a*r>n&&t.lineTo(u,i+h);var d=i+n;n&&n>0&&t.arc(u,d,n-h,-Math.PI/2+l,0,!1);var f=i+s-n-(n?0:h),b=u+n-(n?h:0);t.lineTo(b,f),n&&n>0&&t.arc(u,f,n-h,0,Math.PI/2-l,!1);var p=i+s-h;return t.lineTo(e,p),o||t.lineTo(e,i+h),[b,p]},mp:function(t,e,i,s,n,a,r){ var h=0;this.s.xAxis&&(this.canvases.x||(this.canvases.x=this.lo("axis_x")),h=this.rp(this.canvases.x.getCanvas(),e,i,s,n,a)),this.s.yAxis&&(this.canvases.y||(this.canvases.y=this.lo("axis_y")),this.sp(this.canvases.y.getCanvas(),e,i,s,r,h))},sp:function(t,e,i,s,n,a){if(this.s.yAxis){var r,h=parseInt(a?a:i.x,10)-.5,o=s.y+.5,l=i.y; this.zo(t,h,o,h,l,this.s.yAxis.color,1);for(var c=0;c=p;p+=r){var x=this.Bo?Math.pow(10,p):p;h.fixNum&&(x=parseFloat(x).toFixed(h.fixNum));var w=Math.floor(c+b*f)+.5;if(p==n&&"auto"==this.s.origin||!o.lines.call(this,p)||this.zo(t,w,l,w,i.y,this.s.xAxis.lineColor.call(this,p),1), p==this.s.origin&&(d=w+1),1>r&&!this.Bo){var g=Math.min(Math.floor(this.Do(r)),0>=n?0:Math.floor(this.Do(n))),v=Math.pow(10,-g);x=Math.round(x*v)/v,p=x}this.canvases.x.renderTextAt(!1,!0,w,l+2,o.template(x.toString()),"webix_axis_item_x"),b++}return this.canvases.x.renderTextAt(!0,!1,c,s.y+this.s.padding.bottom-3,this.s.xAxis.title,"webix_axis_title_x",s.x-i.x), o.lines.call(this,{})||this.zo(t,c,i.y-.5,u,i.y-.5,this.s.xAxis.color,.2),d}}},tp:function(t,e,i,s,n,a,r){var h=this.s.yAxis,o=e;return h&&"auto"!=this.s.origin&&this.s.origin>r&&(e+=(this.s.origin-r)*n,o=e,s-=this.s.origin-r,0>s&&(s*=-1,t.translate(e,i+a),t.rotate(Math.PI),e=.5,i=0),e+=.5),{value:s, x0:e,y0:i,start:o}},op:function(t,e,i,s,n,a,r,h,o,l,c,u){t.save();var d=this.tp(t,i,s,o,h,n,a);t.fillStyle=l,t.beginPath();var f=this.qp(t,d.x0,d.y0,n,r,h,d.value,this.s.border?1:0);c&&!u&&t.lineTo(e.x,d.y0+(this.s.border?1:0)),t.fill(),t.restore();var b=d.y0,p=d.y0!=s?s:f[1],x=d.y0!=s?d.start-f[0]:d.start,w=d.y0!=s?d.start:f[0]; return[x,b,w,p]},np:function(t,e,i,s,n,a,r,h,o){t.save();var l=this.tp(t,e,i,h,r,s,n);t.beginPath(),this.gp(t,o),t.globalAlpha=.9,this.qp(t,l.x0,l.y0,s,a,r,l.value,t.lineWidth/2,1),t.stroke(),t.restore()},pp:function(t,e,i,s,n,a,r,h,o,l){t.save();var c=this.tp(t,e,i,h,r,s,n),u=this.Oo(t,c.x0,c.y0+s,c.x0+r*c.value,c.y0,l,o,"x"); t.fillStyle=u.gradient,t.beginPath(),this.qp(t,c.x0,c.y0+u.offset,s-2*u.offset,a,r,c.value,u.offset),t.fill(),t.globalAlpha=1,t.restore()}}),webix.extend(webix.ui.chart,{$render_stackedBar:function(t,e,i,s,n,a){var r,h,o,l,c,u,d,f=this.s,b=s.y-i.y,p=!!f.yAxis,x=!!f.xAxis,w=this.No(e),g=0===f.origin;r=w.max, h=w.min;var v=Math.floor((s.x-i.x)/e.length);n||(o=this.uo(e,i,s,h,r,v)),p&&(r=parseFloat(f.yAxis.end),h=parseFloat(f.yAxis.start));var m=this.Ho(h,r);d=m[0],u=m[1];var y=d?b/d:10,$=parseInt(f.barWidth,10);$+4>v&&($=v-4);var _=Math.floor((v-$)/2),C=f.gradient?f.gradient:!1;x||this.zo(t,i.x,s.y+.5,s.x,s.y+.5,"#000000",1); for(var S=0;Sk;if(n?c=I?e[S].$startYN:e[S].$startY:(c=o-1,e[S].$startY=c,g&&(I&&(c=o+1),e[S].$startYN=o+1)),k&&!isNaN(k)&&(n||g||(k-=h),k*=u,!(cn&&(n=r),t.lineTo(e,n);var o=e+s,l=n;t.lineTo(o,l);var c=e+s;return t.lineTo(c,i),h||t.lineTo(e,i),[c,l]}}),webix.extend(webix.ui.chart,{$render_stackedBarH:function(t,e,i,s,n,a){ var r,h,o,l,c=s.x-i.x,u=!!this.s.yAxis,d=this.No(e);r=d.max,h=d.min;var f=Math.floor((s.y-i.y)/e.length);n||this.mp(t,e,i,s,h,r,f),u&&(r=parseFloat(this.s.xAxis.end),h=parseFloat(this.s.xAxis.start));var b=this.Ho(h,r);l=b[0],o=b[1];var p=l?c/l:10,x=0;u||(x=10,p=l?(c-x)/l:10);var w=parseInt(this.s.barWidth,10); w+4>f&&(w=f-4);var g=(f-w)/2,v=0,m=!1,y=this.s.gradient;y&&(m=!0),u||this.zo(t,i.x-.5,i.y,i.x-.5,s.y,"#000000",1);var $=0,_=0;for(C=0;Cr&&(S=r),S-=h,S*=o;var k=i.x,I=i.y+g+C*f;if(_?k=e[C].$startX:e[C].$startX=k,S&&!isNaN(S)){u||(S+=x/p);var E=this.s.color.call(this,e[C]);t.globalAlpha=this.s.alpha.call(this,e[C]),t.fillStyle=this.s.color.call(this,e[C]),t.beginPath();var M=this.qp(t,k,I,w,v,p,S,0);if(y&&!m&&t.lineTo(i.x+c,I+(this.s.border?1:0)), t.fill(),m){var A=this.Oo(t,k,I+w,k,I,m,E,"x");t.fillStyle=A.gradient,t.beginPath(),M=this.qp(t,k,I,w,v,p,S,0),t.fill()}this.s.border&&this.np(t,k,I,w,h,v,p,S,E),t.globalAlpha=1,this.canvases[n].renderTextAt("middle",!0,e[C].$startX+(M[0]-e[C].$startX)/2-1,I+(M[1]-I)/2,this.s.label(e[C])),a.addRect(e[C].id,[e[C].$startX-i.x,I-i.y,M[0]-i.x,M[1]-i.y],n), e[C].$startX=M[0]}}}}),webix.extend(webix.ui.chart,{$render_spline:function(t,e,i,s,n,a){var r,h,o,l,c,u,d,f,b,p,x,w,g;if(c=this.hp(t,e,i,s,n),r=this.s,this.kp=i,o=[],e.length){for(f=r.offset?i.x+.5*c.cellWidth:i.x,h=0;hl;l++){var v=this.wp(l,b,h,u.a,u.b,u.c,u.d);vs.y&&(v=s.y);var m=this.wp(l+1,b,h,u.a,u.b,u.c,u.d);ms.y&&(m=s.y),this.zo(t,l,v,l+1,m,r.line.color(e[h]),r.line.width); }this.zo(t,p-1,this.wp(l,b,h,u.a,u.b,u.c,u.d),p,g,r.line.color(e[h]),r.line.width)}this.lp(t,b,w,e[o[h].index],r.label(e[o[h].index]),n,a)}}},vp:function(t){var e,i,s,n,a,r,h,o,l=[],c=[],u=t.length;for(a=0;u-1>a;a++)l[a]=t[a+1].x-t[a].x,c[a]=(t[a+1].y-t[a].y)/l[a];for(h=[],o=[],h[0]=0,h[1]=2*(l[0]+l[1]), o[0]=0,o[1]=6*(c[1]-c[0]),a=2;u-1>a;a++)h[a]=2*(l[a-1]+l[a])-l[a-1]*l[a-1]/h[a-1],o[a]=6*(c[a]-c[a-1])-l[a-1]*o[a-1]/h[a-1];for(r=[],r[u-1]=r[0]=0,a=u-2;a>=1;a--)r[a]=(o[a]-l[a]*r[a+1])/h[a];for(e=[],i=[],s=[],n=[],a=0;u-1>a;a++)e[a]=t[a].y,i[a]=-l[a]*r[a+1]/6-l[a]*r[a]/3+(t[a+1].y-t[a].y)/l[a],s[a]=r[a]/2, n[a]=(r[a+1]-r[a])/(6*l[a]);for(a=0;a0;c--)w-=p.cellWidth,g=e[c].$startY,g&&x.push([w,g]);for(x.push([x[0][0],x[0][1]]),t.globalAlpha=this.s.alpha.call(this,e[0]),t.fillStyle=this.s.color.call(this,e[0]), t.beginPath(),this.Mo(t,x),t.fill(),c=0;c2&&this.Bp(t,x,a),(!c.disableItems||a.length<3)&&this.Cp(t,x,a,r,h),x=null},Cp:function(t,e,i,s,n){for(var a=0;al&&(x=Math.min(this.Do(l),0>=h?0:this.Do(h)),w=Math.pow(10,-x));var y=[];this.canvases.scale||(this.canvases.scale=this.lo("radar_scale"));var $=this.canvases.scale.getCanvas();for(f=o;f>=h;f-=l){var _=this.Bo?Math.pow(10,f):f; c.fixNum&&(_=parseFloat(f).toFixed(c.fixNum)),g.push(Math.floor(v*m)+.5),w&&!this.Bo&&(_=Math.round(_*w)/w,f=_);var C=i-s+g[g.length-1];if(this.canvases.scale.renderTextAt("middle","left",e,C,a.template(_.toString()),"webix_axis_item_y webix_radar"),t.length<2)return void this.Dp($,"arc",e,i,s-g[g.length-1],-Math.PI/2,3*Math.PI/2,f); var S,k=-Math.PI/2,I=k;for(b=0;b2?u.lineShape||"line":"arc",e,i,s-g[g.length-1],I,S,f,b,n[f]),I=S;v++}for(f=0;fn)return!1;l=this.Qo(a,i,s,n),c=this.Qo(r,i,s,n);var u=this.s.yAxis;u.bg&&(t.beginPath(),t.moveTo(i,s),"arc"==e?t.arc(i,s,n,a,r,!1):(t.lineTo(l.x,l.y),t.lineTo(c.x,c.y)),t.fillStyle=u.bg(h,o),t.moveTo(i,s),t.fill(),t.closePath()),u.lines.call(this,h)&&(t.lineWidth=1, t.beginPath(),"arc"==e?t.arc(i,s,n,a,r,!1):(t.moveTo(l.x,l.y),t.lineTo(c.x,c.y)),t.strokeStyle=u.lineColor.call(this,h),t.stroke())},Ep:function(t,e,i,s,n,a){if(!a)return!1;var r=this.canvases.scale.renderText(0,0,a,"webix_axis_radar_title",1),h=r.scrollWidth,o=r.offsetHeight,l=.001,c=this.Qo(n,e,i,s+5),u=0,d=0; (0>n||n>Math.PI)&&(d=-o),n>Math.PI/2&&(u=-h),Math.abs(n+Math.PI/2)2&&(this.zo(t,w,g,u[0].x,u[0].y,m,r.line.width),r.disableItems||this.Gp(t,a,u[0],e[0],n),r.fill&&this.sH(t,u,e)):(w=u[d+1].x,g=u[d+1].y,this.zo(t,p,x,w,g,m,r.line.width))}!r.disableItems&&u[d]&&this.Gp(t,a,u[d],e[v],n); }},sH:function(t,e,i){var s,n;t.globalAlpha=this.s.alpha.call(this,{}),t.beginPath();for(var a=0;ao&&(c=i[a.toLowerCase()]),r>s.max&&(c=e[a.toLowerCase()]),rl;l++){var $=this.wp(l,p,h,d.a,d.b,d.c,d.d);$s.y&&($=s.y);var _=this.wp(l+1,p,h,d.a,d.b,d.c,d.d);_s.y&&(_=s.y),y.push([l,$]),y.push([l+1,_])}y.push([x,v])}r=this.s.color.call(this,e[0]), y.length&&(y.push([x,s.y]),y.push([y[0][0],s.y])),t.globalAlpha=this.s.alpha.call(this,e[0]),t.fillStyle=r,t.beginPath(),this.Mo(t,y),t.fill(),t.lineWidth=1,t.globalAlpha=1,m.border&&(t.lineWidth=m.borderWidth||1,m.borderColor?t.strokeStyle=m.borderColor.call(this,e[0]):this.gp(t,r),t.beginPath(),y.splice(y.length-3), this.Mo(t,y),t.stroke())}}}),function(){function t(t){if(!t.BE){var i=t.s;i.cellWidth||(i.cellWidth=d),i.animateDuration||(i.animateDuration=u),i.offset=!1,t.BE=t.attachEvent("onBeforeRender",function(s,n){var a=t.no(t.bc,t.dc);o(t),r(s,a.start,a.end,i.cellWidth),"add"==n&&e(t)}),t.CE=t.attachEvent("onBeforeXAxis",function(e,i,s,n,a,r){ return c(t,e,i,s,n,a,r),!1})}}function e(t){var e=t.s.cellWidth;t.DE!=e&&(t.DE=e,t.render()),t.DE=0,t.EE=null,window.requestAnimationFrame&&!document.hidden&&window.requestAnimationFrame(function(e){i(t,e)}),t.FE||(t.FE=t.attachEvent("onAfterRender",function(e){s(t,e)}))}function i(t,e){var s,n=t.s.animateDuration,a=t.s.cellWidth; a&&t.count()>1&&(t.EE||(t.EE=e),s=e-t.EE,t.DE=Math.min(Math.max(s/n*a,1),a),t.render(),n>s&&window.requestAnimationFrame(function(e){i(t,e)}))}function s(t,e){function i(t,i,r,h){var l=t.getCanvas(),u=t.Zn,d=t.Wn,f=t.AE;if(c&&(e.lengthr-i)?(u.style.left=-c+"px",e.length>1&&(a(d,c,f), l.clearRect(0,0,i+c,u.offsetHeight),l.clearRect(r+c,0,u.offsetWidth,u.offsetHeight))):(u.style.left="0px",h||c==o||l.clearRect(i+(e.length-1)*o-o+c,0,u.offsetWidth,u.offsetHeight)),d.length>1&&c&&c!=o){var b=d.length-1;n(f,d[b])&&(b-=1),d[b].style.display="none"}}var s=t.count(),r=t.no(t.bc,t.dc),o=t.s.cellWidth,c=t.DE||0,u=e.lengthr.end.x-r.start.x; h(t,function(t,e){i(e,r.start.x,r.end.x,"x"==t)}),l(t,r,u?c:0)}function n(t,e){return"axis_x"===t&&-1!==e.className.indexOf("webix_axis_title_x")}function a(t,e,i){if(t.length){webix.html.remove(t[0]);for(var s=1;sn+1&&t.splice(0,t.length-n-1)}}function h(t,e){if(t.canvases){for(var i=0;ib-d||i.length1:!!o,c=Math.ceil(c)-.5,t.xo(c,f,i[o],h),o&&u.xAxis.lines.call(t,i[o])&&t.yo(e,c,n.y,s.y,i[o]); t.canvases.x.renderTextAt(!0,!1,d,n.y+u.padding.bottom-3,u.xAxis.title,"webix_axis_title_x",n.x-s.x),t.zo(e,d,f,b+(l?t.DE:0),f,u.xAxis.color,1)}var u=400,d=30;webix.extend(webix.ui.chart,{dynamic_setter:function(e){return e&&t(this),e}})}(),webix.protoUI({name:"calendar",defaults:{date:new Date,select:!1, navigation:!0,monthSelect:!0,weekHeader:!0,weekNumber:!1,skipEmptyWeeks:!1,calendarHeader:"%F %Y",calendarWeekHeader:"W#",events:webix.Date.isHoliday,minuteStep:5,icons:!1,timepickerHeight:30,headerHeight:70,dayTemplate:function(t){return t.getDate()},width:260,height:250},dayTemplate_setter:webix.template, calendarHeader_setter:webix.Date.dateToStr,calendarWeekHeader_setter:webix.Date.dateToStr,calendarTime_setter:function(t){return this._w=t,webix.Date.dateToStr(t)},date_setter:function(t){return this.Jp(t)},maxDate_setter:function(t){return this.Jp(t)},minDate_setter:function(t){return this.Jp(t)},minTime_setter:function(t){ return"string"==typeof t&&(t=webix.i18n.parseTimeFormatDate(t),t=[t.getHours(),t.getMinutes()]),t},maxTime_setter:function(t){return"string"==typeof t&&(t=webix.i18n.parseTimeFormatDate(t),t=[t.getHours(),t.getMinutes()]),t},fF:function(){var t="focus"+(webix.env.isIE?"in":"");webix.env.touch||webix.UE(this.$view,t,webix.bind(function(t){ var e=t.target.className,i=-1!==e.indexOf("webix_cal_day")?"webix_cal_day":-1!==e.indexOf("webix_cal_block")?"webix_cal_block":"";if(new Date-webix.UIManager.XE>300&&new Date-webix.UIManager.lH>100&&i){var s=t.relatedTarget;if(s&&!webix.isUndefined(s.className)){var n="webix_cal_day"==i?this.gF(t.target):this.hF(t.target); this.ID(n)}}},this),{capture:!webix.env.isIE})},$init:function(){this.x.className+=" webix_calendar",this.x.setAttribute("role","region"),this.x.setAttribute("aria-label",webix.i18n.aria.calendar),this.Kp={},this.UG={},this.Np=0,this.fF(),this.attachEvent("onKeyPress",this.DD),this.attachEvent("onAfterZoom",function(t){ t>=0&&this.$view.querySelector(".webix_cal_month_name").blur()})},type_setter:function(t){return"time"==t?(this.jq=!0,this.Np=-1):"year"==t&&(this.NC=!0),t},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()},$getSize:function(t,e){if(this.s.cellHeight){var i=this.Op(this.s.date); this.s.height=this.s.cellHeight*i.Sp+(webix.skin.$active.calendarHeight||70)}return webix.ui.view.prototype.$getSize.call(this,t,e)},moveSelection:function(t,e,i){if(!this.config.master){var s=this.getSelectedDate();this.config.multiselect&&(s=s[0]);var n=webix.Date.copy(s||this.getVisibleDate());this.ID(n,t,i); }},ID:function(t,e,i){var s=this.aq[this.Np].LD(t,e,this);if(i!==!1){var n=this.x.querySelector("."+s+"[tabindex='0']");n&&n.focus()}},Op:function(t,e){if(!this.Pp||e){var i=t.getMonth(),s=t.getFullYear(),n=new Date(s,i+1,1),a=webix.Date.weekStart(new Date(s,i,1)),r=Math.round((n.valueOf()-a.valueOf())/864e5),h=this.s.skipEmptyWeeks?Math.ceil(r/7):6; this.Pp={Qp:i,Rp:a,zc:n,Sp:h}}return this.Pp},$skin:function(){webix.skin.$active.calendar&&(webix.skin.$active.calendar.width&&(this.defaults.width=webix.skin.$active.calendar.width),webix.skin.$active.calendar.height&&(this.defaults.height=webix.skin.$active.calendar.height),webix.skin.$active.calendar.headerHeight&&(this.defaults.headerHeight=webix.skin.$active.calendar.headerHeight), webix.skin.$active.calendar.timepickerHeight&&(this.defaults.timepickerHeight=webix.skin.$active.calendar.timepickerHeight))},Tp:function(t){for(var e=this.Op(t),i=this.s,s=[],n=[],a=this.bc-36,r=this.dc-this.s.headerHeight-10-(this.s.timepicker||this.ax?this.s.timepickerHeight:0),h=i.weekNumber?8:7,o=0;h>o;o++)n[o]=Math.ceil(a/(h-o)), a-=n[o];for(var l=e.Sp,c=0;l>c;c++)s[c]=Math.ceil(r/(l-c)),r-=s[c];return[n,s]},icons_setter:function(t){t?"object"==typeof t?this.ax=t:this.ax=this.Sx:this.ax=null},ax:[],Sx:[{template:function(){return""+webix.i18n.calendar.today+""; },on_click:{webix_cal_icon_today:function(){var t=new Date;this.s.timepicker||(t=webix.Date.datePart(t)),this.setValue(t),this.callEvent("onTodaySet",[this.getSelectedDate()])}}},{template:function(){return""+webix.i18n.calendar.clear+""; },on_click:{webix_cal_icon_clear:function(){this.setValue(""),this.callEvent("onDateClear",[this.getSelectedDate()])}}}],refresh:function(){this.render()},render:function(){this.Np=0,this.Up=!1;var t=this.s;if(this.isVisible(t.id)){this.Vp=webix.Date.datePart(new Date),this.callEvent("onBeforeRender",[]); var e=this.s.date,i=this.Op(e,!0),s=this.Tp(e),n=s[0],a=s[1],r="
"+t.calendarHeader(e)+"";if(t.navigation&&(r+="
"), r+="
",t.weekHeader&&(r+=""),r+="
"+this.Xp(n,a,i)+"
",(this.s.timepicker||this.ax)&&(r+=""),this.w.innerHTML=r, "time"==this.s.type){var h=this.s.date;h&&("string"==typeof h?e=webix.i18n.parseTimeFormatDate(h):webix.isArray(h)&&(e.setHours(h[0]),e.setMinutes(h[1]))),this.yt(-1,e)}else"month"==this.s.type?this.yt(1,e):"year"==this.s.type&&this.yt(2,e);this.callEvent("onAfterRender",[])}},bx:function(t){for(var e="
",i=this.ax,s=0;s "+e(s[n])+"
"}else i="
"+e(t)+"
"; return i},Wp:function(t){var e=this.s,i="",s=0;e.weekNumber&&(s=1,i+="
"+e.calendarWeekHeader()+"
");for(var n=webix.Date.startOnMonday?1:0,a=0;7>a;a++){var r=(n+a)%7,h=webix.i18n.calendar.dayShort[r];i+="
"+h+"
"; }return i},blockDates_setter:function(t){return webix.toFunctor(t,this.$scope)},Zp:function(t,e){var i="";return webix.Date.equal(t,this.Vp)&&(i+=" webix_cal_today"),this.sz(t)||(i+=" webix_cal_day_disabled"),this.VG(t)&&(i+=" webix_cal_select"),t.getMonth()!=e.Qp&&(i+=" webix_cal_outside"),this.s.events&&(i+=" "+(this.s.events(t)||"")), i+=" webix_cal_day"},Xp:function(t,e,i){for(var s=this.s,n="",a=webix.Date.datePart(webix.Date.copy(i.Rp)),r=s.weekNumber?1:0,h=webix.Date.getISOWeek(webix.Date.add(a,2,"day",!0)),o=(this.s.minDate||new Date(1,1,1),this.s.maxDate||new Date(9999,1,1),0);o", r&&(!a.getMonth()&&a.getDate()<7&&(h=webix.Date.getISOWeek(webix.Date.add(a,2,"day",!0))),n+="");for(var l=r;l", a=webix.Date.add(a,1,"day"),a.getHours()&&(a=webix.Date.datePart(a))}n+="",h++}return n},$p:function(t,e,i){var s=this.s.date;e||(e=this.aq[this.Np]._p),this.Np||(s=webix.Date.copy(s),s.setDate(1));var n=webix.Date.add(s,t*e,"month",!0);this.bq(s,n)},bq:function(t,e){this.callEvent("onBeforeMonthChange",[t,e])&&(this.Np?this.cq(e):this.showCalendar(e), this.callEvent("onAfterMonthChange",[e,t]))},aq:{"-2":{lz:function(t){var e=this.s,i=e.date,s=!1,n=e.minTime?e.minTime[0]:0,a=e.maxTime?e.maxTime[0]+(e.maxTime[1]?1:0):24,r=e.minTime&&i.getHours()==n?e.minTime[1]:0,h=e.maxTime&&e.maxTime[1]&&i.getHours()==a-1?e.maxTime[1]:60;if(this.s.blockTime){var o=webix.Date.copy(i); o.setMinutes(t),s=this.s.blockTime(o)}return r>t||t>=h||s},dq:function(t,e){t.setMinutes(e)},TD:function(t,e,i){if(!this.lz.call(i,t.getMinutes()))return t;var s=i.s.minuteStep,n=webix.Date.add(t,"right"==e?s:-s,"minute",!0);return t.getHours()===n.getHours()?this.TD(n,e,i):void 0}},"-1":{lz:function(t){ var e=this.s,i=e.date,s=e.minTime?e.minTime[0]:0,n=e.maxTime?e.maxTime[0]+(e.maxTime[1]?1:0):24;if(s>t||t>=n)return!0;if(e.blockTime){var a=webix.Date.copy(i);a.setHours(t);for(var r=e.minTime&&t==s?e.minTime[1]:0,h=e.maxTime&&e.maxTime[1]&&t==n-1?e.maxTime[1]:60,o=r;h>o;o+=e.minuteStep)if(a.setMinutes(o), !e.blockTime(a))return!1;return!0}},dq:function(t,e){t.setHours(e)},LD:function(t,e,i){var s,n,a=i.s.minuteStep;return"bottom"===e||"top"===e?(t.setHours("bottom"===e?23:0),t.setMinutes("bottom"===e?55:0),t.setSeconds(0),t.setMilliseconds(0),s=t):"left"===e||"right"===e?(n="right"===e?a:-a,"left"===e&&t.getMinutes()=60-a&&(n=a-60),n-=t.getMinutes()%a,s=i.aq[-2].TD(webix.Date.add(t,n,"minute"),e,i)):"up"===e||"down"===e?(n="down"===e?1:-1,"down"===e&&23===t.getHours()&&(n=-23),"up"===e&&0===t.getHours()&&(n=23),s=this.TD(webix.Date.add(t,n,"hour"),e,i)):e===!1&&(s=this.TD(t,e,i)),i.selectDate(s,!1), s&&(i.cq(s),i.selectDate(s,!1)),"webix_cal_block"+("left"===e||"right"===e?"_min":"")},TD:function(t,e,i){if(!this.lz.call(i,t.getHours()))return t;var s=webix.Date.add(t,"down"==e?1:-1,"hour",!0);return t.getDate()===s.getDate()?this.TD(s,e,i):void 0}},0:{_p:1,LD:function(t,e,i){var s=t;return"pgup"===e||"pgdown"===e?s=webix.Date.add(t,"pgdown"===e?1:-1,"month"):"bottom"===e?s=new Date(t.getFullYear(),t.getMonth()+1,0):"top"===e?s=new Date(t.setDate(1)):"left"===e||"right"===e?s=webix.Date.add(t,"right"===e?1:-1,"day"):("up"===e||"down"===e)&&(s=webix.Date.add(t,"down"===e?1:-1,"week")), i.sz(s)||(s=i.TD(t,e)),s&&i.selectDate(s,!0),"webix_cal_day"}},1:{lz:function(t,e){var i,s,n=!1,a=e.s.minDate||null,r=e.s.maxDate||null,h=e.s.date.getFullYear();return a&&r&&(i=a.getFullYear(),s=r.getFullYear(),(i>h||h==i&&a.getMonth()>t||h>s||h==s&&r.getMonth()e.s.maxDate&&(t=webix.Date.copy(e.s.maxDate)), t},eq:function(t){return t.getFullYear()},fq:function(t){return webix.i18n.calendar.monthShort[t]},dq:function(t,e){e!=t.getMonth()&&t.setDate(1),t.setMonth(e)},_p:12,LD:function(t,e,i){var s=t;return"pgup"===e||"pgdown"===e?s=webix.Date.add(t,"pgdown"===e?1:-1,"year"):"bottom"===e?s=new Date(t.setMonth(11)):"top"===e?s=new Date(t.setMonth(0)):"left"===e||"right"===e?s=webix.Date.add(t,"right"===e?1:-1,"month"):("up"===e||"down"===e)&&(s=webix.Date.add(t,"down"===e?4:-4,"month")), i.sz(s)||(s=i.TD(t,e)),s&&(i.cq(s),i.selectDate(s,!1)),"webix_cal_block"}},2:{lz:function(t,e){t+=e.gq;var i=!1,s=e.s.minDate,n=e.s.maxDate;return s&&n&&(s.getFullYear()>t||n.getFullYear()e.s.maxDate&&(t=webix.Date.copy(e.s.maxDate)), t},eq:function(t,e){var i=t.getFullYear();return e.gq=i=i-i%10-1,i+" - "+(i+10+1)},fq:function(t,e){return e.gq+t},dq:function(t,e,i){t.setFullYear(i.gq+e)},_p:120,LD:function(t,e,i){var s=t;return"pgup"===e||"pgdown"===e?s=webix.Date.add(t,"pgdown"===e?10:-10,"year"):"bottom"===e?s=new Date(t.setYear(i.gq+10)):"top"===e?s=new Date(t.setYear(i.gq)):"left"===e||"right"===e?s=webix.Date.add(t,"right"===e?1:-1,"year"):("up"===e||"down"===e)&&(s=webix.Date.add(t,"down"===e?4:-4,"year")), i.sz(s)||(s=i.TD(t,e)),s&&(i.cq(s),i.selectDate(s,!1)),"webix_cal_block"}}},mz:function(){var t,e,i;if(e=this.aq[-1].lz.call(this,this.s.date.getHours()))for(t=0;24>t;t++)if(!this.aq[-1].lz.call(this,t)){this.s.date.setHours(t);break}if(i=this.aq[-2].lz.call(this,this.s.date.getMinutes()))for(t=0;60>t;t+=this.s.minuteStep)if(!this.aq[-2].lz.call(this,t)){ this.s.date.setMinutes(t);break}},cq:function(t){var e,i,s,n,a,r,h,o,l,c,u,d="";if(e=this.s,a=e.weekHeader?2:1,c=this.aq[this.Np],r=this.w.childNodes,t&&(e.date=t),o=e.type,this.Up||(this.hq=this.w.offsetHeight-e.headerHeight,"year"!=o&&"month"!=o?this.hq-=e.timepickerHeight:this.ax&&(this.hq-=10),this.iq=r[a].offsetWidth, this.Up=1),this.jq){s=this.hq/6;var f=6,b=this._w||webix.i18n.timeFormat,p=b.match(/%([a,A])/);for(p&&f++,l=parseInt((this.iq-3)/f,10),d+="
"+this.kq(l,p)+"
",d+="
",this.mz(),d+="
",h=e.date.getHours(), u=webix.Date.copy(e.date),n=0;24>n;n++){if(i="",p&&n%4===0){var x=n?12==n?webix.i18n.pm[0]:"":webix.i18n.am[0];d+="
"+x+"
"}this.aq[-1].lz.call(this,n)?i+=" webix_cal_day_disabled":h==n&&(i+=" webix_selected"),u.setHours(n), d+="
"+webix.Date.toFixed(p?n&&12!=n?n%12:12:n)+"
"; }for(d+="
",d+="
",h=e.date.getMinutes(),u=webix.Date.copy(e.date),n=0;60>n;n+=e.minuteStep)i="",this.aq[-2].lz.call(this,n)?i=" webix_cal_day_disabled":h==n&&(i=" webix_selected"),u.setMinutes(n),d+="
"+webix.Date.toFixed(n)+"
"; d+="
",d+="
",d+="",this.w.innerHTML=d}else{var w=r[0].childNodes,g=webix.i18n.aria["nav"+(1==this.Np?"Year":"Decade")];for(w[0].innerHTML=c.eq(e.date,this),w[1].setAttribute("aria-label",g[0]),w[2].setAttribute("aria-label",g[1]),s=this.hq/3, l=this.iq/4,this.sz(e.date)&&(h=1==this.Np?e.date.getMonth():e.date.getFullYear()),n=0;12>n;n++){i=h==(1==this.Np?n:c.fq(n,this))?" webix_selected":"",c.lz(n,this)&&(i+=" webix_cal_day_disabled");var v=webix.i18n.aria[(1==this.Np?"month":"year")+"Format"];d+="
"+c.fq(n,this)+"
"; }a-1&&(r[a-1].style.display="none"),r[a].innerHTML=d,"year"!=o&&"month"!=o&&(r[a+1]?r[a+1].innerHTML=this.mq():this.w.innerHTML+=""),r[a].style.height=this.hq+"px"}},lq:function(t,e){return"width:"+t+"px; height:"+e+"px; line-height:"+e+"px;"},mq:function(){ return""},kq:function(t,e){var i=t*(e?5:4),s=2*t;return"
"+webix.i18n.calendar.hours+"
"+webix.i18n.calendar.minutes+"
"; },yt:function(t,e){var i=this.Np;this.callEvent("onBeforeZoom",[t,i])&&(this.Np=t,t?this.cq(e):this.showCalendar(e),this.callEvent("onAfterZoom",[t,i]))},Jv:function(t){return!this.sz(t)&&this.aq[this.Np].Jv&&(t=this.aq[this.Np].Jv(t,this)),t},nq:function(t){var e=this.hF(t),i=this.Np-(this.NC?0:1);if(e=this.Jv(e), this.sz(e)){this.yt(i,e);var s=this.s.type;("month"==s||"year"==s)&&this.zt(e)}},zt:function(t,e){this.callEvent("onBeforeDateSelect",[t])&&(this.selectDate(t,!0,e),this.callEvent("onDateSelect",[t]),this.callEvent("onAfterDateSelect",[t]))},gF:function(t){var e=webix.html.index(t)-(this.s.weekNumber?1:0),i=webix.html.index(t.parentNode),s=webix.Date.add(this.Op().Rp,e+7*i,"day",!0); return this.s.timepicker&&(s.setHours(this.s.date.getHours()),s.setMinutes(this.s.date.getMinutes())),s},hF:function(t){var e=1*t.getAttribute("data-value"),i=-1!=t.className.indexOf("webix_cal_block_min")?this.Np-1:this.Np,s=this.s.date,n=webix.Date.copy(s);return this.aq[i].dq(n,e,this),n},on_click:{ webix_cal_prev_button:function(t,e,i){this.$p(-1)},webix_cal_next_button:function(t,e,i){this.$p(1)},webix_cal_day_disabled:function(){return!1},webix_cal_outside:function(){return this.s.navigation?void 0:!1},webix_cal_day:function(t,e,i){var s=this.gF(i),n="touch"===this.s.multiselect||t.ctrlKey||t.metaKey; this.zt(s,n)},webix_cal_time:function(t){if(this.aq[this.Np-1]){this.jq=!0;var e=this.Np-1;this.yt(e)}},webix_range_time_start:function(){webix.$$(this.s.master).UD="start"},webix_range_time_end:function(){webix.$$(this.s.master).UD="end"},webix_cal_done:function(t){var e=webix.Date.copy(this.s.date); e=this.Jv(e),this.zt(e)},webix_cal_month_name:function(t){if(this.jq=!1,2!=this.Np&&this.s.monthSelect){var e=Math.max(this.Np,0)+1;this.yt(e)}},webix_cal_block:function(t,e,i){if(this.jq){if(-1!==i.className.indexOf("webix_cal_day_disabled"))return!1;var s=this.hF(i);this.cq(s)}else-1==i.className.indexOf("webix_cal_day_disabled")&&this.nq(i); }},Jp:function(t,e){return t?("string"==typeof t&&(t=e?webix.Date.strToDate(e)(t):webix.i18n.parseFormatDate(t)),t):webix.Date.datePart(new Date)},sz:function(t){var e=this.s.blockDates&&this.s.blockDates.call(this,t),i=this.s.minDate,s=this.s.maxDate,n=i>t||t>s;return!e&&!n},TD:function(t,e){var i="top"===e||"left"===e||"pgup"===e||"up"===e?-1:1,s=webix.Date.add(t,i,"day",!0); if(this.sz(s))return s;var n;return 0===this.Np?n=t.getMonth()===s.getMonth():1===this.Np?n=t.getFullYear()===s.getFullYear():2===this.Np&&(n=s.getFullYear()>this.gq&&s.getFullYear()"},color:function(t,e){return'
'+t+"
"; }},on_edit:{label:!1},ad:"webix_f_id",on_click:{webix_property_check:function(t){var e=this.locate(t);return this.getItem(e).value=!this.getItem(e).value,this.callEvent("onCheck",[e,this.getItem(e).value]),!1}},on_dblclick:{},registerType:function(t,e){if(e.template&&(this.on_render[t]=e.template),e.editor&&(this.on_edit[t]=e.editor), e.click)for(var i in e.click)this.on_click[i]=e.click[i]},elements_setter:function(t){this.oq={};for(var e=0;e=0;a--)if(e.call(this,n[a].id))return n[a].id;return null},updateItem:function(t,e){ e=e||{};var i=this.getItem(t);i&&webix.extend(i,e,!0),this.refresh()},ug:function(t){var e=this.getItemNode(t);return{left:e.offsetLeft+this.s.nameWidth,top:e.offsetTop,height:e.firstChild.offsetHeight,width:this.pq,parent:this.w}},qq:function(){for(var t=this.s.elements,e=0;e';if("label"==s.type)t[i]=n+"
"+s.label+"
";else{var a,r=this.on_render[s.type],h="
"+s.label+"
"; a=s.collection||s.options?s.template(s,s.value):s.format?s.format(s.value):s.value,r&&(a=r.call(this,s.value,s)),t[i]=n+h+a+"
"}}return t.join("")},type:{height:24,templateStart:webix.template(""),templateEnd:webix.template("")},$skin:function(){this.type.height=webix.skin.$active.propertyItemHeight||24; }},webix.AutoTooltip,webix.EditAbility,webix.MapCollection,webix.MouseEvents,webix.Scrollable,webix.SingleRender,webix.AtomDataLoader,webix.EventSystem,webix.ui.view),webix.protoUI({name:"colorboard",defaults:{template:'
',palette:null, height:220,width:220,cols:12,rows:10,minLightness:.15,maxLightness:1,navigation:!0},$init:function(t){webix.UE(this.x,"click",webix.bind(function(t){var e=webix.html.locate(t,"webix_val");this.setValue(e),this.callEvent("onItemClick",[this.s.value,t]),this.callEvent("onSelect",[this.s.value])},this)), this.$view.setAttribute("role","grid"),this.x.setAttribute("aria-readonly","true")},sq:function(t){var e=this.s.palette;t=(t||"").toUpperCase();for(var i=0,s=e.length;s>i;i++)for(var n=0,a=e[i].length;a>n;n++)if(e[i][n].toUpperCase()==t)return{row:i,col:n};return null},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render(); },getValue:function(){return this.s.value},re:function(){return this.x.firstChild},setValue:function(t){t&&"#"!=t.toString().charAt(0)&&(t="#"+t);var e=this.s.value;return this.s.value=t,this.$setValue(t,e),t},uq:null,vq:function(){if(this.uq&&this.uq.parentNode)return this.uq;var t=this.uq=document.createElement("div"); return t.className="webix_color_selector",this.x.lastChild.appendChild(t),t},$setValue:function(t,e){if(this.isVisible(this.s.id)){var i,s,n,a,r,h=0,o=0;if(e&&(n=this.sq(e)),n||(n={row:0,col:0}),this.x.lastChild.childNodes[n.row].childNodes[n.col].setAttribute("tabindex","-1"),n=this.sq(t),n&&(i=this.x.lastChild.childNodes[n.row].childNodes[n.col]), !(i&&i.parentNode&&i.parentNode.parentNode))return this.uq&&(this.uq.style.left="-100px"),void this.x.lastChild.childNodes[0].childNodes[0].setAttribute("tabindex","0");a=i.parentNode,h=i.offsetLeft-a.offsetLeft,o=-(this.$height-(i.offsetTop-a.parentNode.offsetTop)),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected","true"), i.setAttribute("tabindex","0"),i.setAttribute("aria-selected","true"),s=this.vq(),r=["left:"+h+"px","top:"+o+"px","width:"+i.style.width,"height:"+i.style.height].join(";"),"undefined"!=typeof s.style.cssText?s.style.cssText=r:s.setAttribute("style",r)}},wq:function(t){function e(t){return webix.color.toHex(t,2); }function i(t,i,s){return"#"+e(Math.floor(t))+e(Math.floor(i))+e(Math.floor(s))}function s(t,e,i){var s,a,r;if(e){var h=.5>i?i*(1+e):i+e-i*e,o=2*i-h;s=n(o,h,t+1/3),a=n(o,h,t),r=n(o,h,t-1/3)}else s=a=r=i;return{r:255*s,g:255*a,b:255*r}}function n(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>=i?e:2/3>i?t+(e-t)*(2/3-i)*6:t; }function a(t){for(var e=[],s=255,n=s/t,a=0;t>a;a++)s=Math.round(s>0?s:0),e.push(i(s,s,s)),s-=n;return e[e.length-1]="#000000",e}var r=[],h=t.rows-1,o=1/t.cols,l=(t.maxLightness-t.minLightness)/h,c=null;r.push(a(t.cols));for(var u=0,d=t.minLightness;h>u;u++){c=[];for(var f=0,b=0;f=0&&(n=this.x.lastChild.childNodes[s.row].childNodes[s.col]),n&&(a=n.getAttribute("webix_val"),this.setValue(a),this.callEvent("onSelect",[this.s.value]),i!==!1))){var r=this.x.querySelector("div[tabindex='0']");r&&r.focus()}},render:function(){ function t(t,e,i){for(var a='
',r=0;r'+(i.template||"")+"
"),n={ width:0,height:0,val:0},a=this.$width,r=this.$height,h=[],o='
',l="object"==typeof e[0]?e[0]:e,c=0;c",this.x.innerHTML=o,this.uq=null,this.s.value?this.$setValue(this.s.value):this.x.lastChild.childNodes[0].childNodes[0].setAttribute("tabindex","0"),this.callEvent("onAfterRender",[])}},refresh:function(){this.render()}},webix.KeysNavigation,webix.ui.view,webix.EventSystem), webix.protoUI({name:"daterange",defaults:{button:!1,icons:!1,calendarCount:2,borderless:!1},$init:function(t){t.calendar=t.calendar||{},t.value=this.SD(t.value),delete t.calendar.type,this.x.className+=" webix_daterange",this.Np=this.ne[t.calendar.type]||0;for(var e=[],i=webix.skin.$active.calendar,s=i&&i.height?i.height:250,n=i&&i.width?i.width:250,a=webix.extend({ view:"calendar",width:n,height:s},t.calendar||{},!0),r=t.calendarCount=0===this.Np?t.calendarCount||this.defaults.calendarCount:this.defaults.calendarCount,h=(a.css?a.css+" ":"")+"webix_range_",o=t.value.start||new Date,l=0;r>l;l++){var c=webix.Date.add(o,this.VD[this.Np]*l,"month",!0);webix.extend(a,{ events:webix.bind(this.WD,this),css:h+(1===r?"":0===l?"0":l+1==r?"N":"1"),timepicker:0===this.Np?t.timepicker:!1,borderless:!0,date:c},!0),e.push(webix.copy(a))}t.rows=[{type:"clean",cols:e},this.XD(t,n*r)],t.height=t.height||a.height+(t.icons||t.button?35:0),t.type="line",this.$ready.push(this.av),webix.event(this.$view,"keydown",webix.bind(function(t){ this.DD(t.which||t.keyCode,t)},this))},value_setter:function(t){return this.SD(t)},getValue:function(){return this.s.value},setValue:function(t,e){t=this.SD(t),this.s.value=t;var i=t.start||t.end||new Date;if(!e){this.YD[0].showCalendar(t.start);for(var s=1;s"+webix.i18n.calendar.today+""},on_click:{webix_cal_icon_today:function(){var t=new Date;this.s.timepicker||(t=webix.Date.datePart(t)),this.addToRange(t),this.callEvent("onTodaySet",[this.getValue()]); }}},{template:function(){return""+webix.i18n.calendar.clear+""},on_click:{webix_cal_icon_clear:function(){this.setValue(""),this.callEvent("onDateClear",[])}}}],bx:function(t){if(t){t="object"==typeof t?t:this.ax;for(var e={ css:"webix_cal_footer ",borderless:!0,height:30,template:"
",onClick:{}},i=0;ie&&(n.cols[0].width=0),n.cols.push(t.button?i:{}),n.cols.push(s),n},ne:{time:-1,month:1,year:2},VD:{0:1,1:12,2:120},SD:function(t){return t||(t={start:null,end:null}),t.start||t.end||(t={start:t}),t.end=this.Jp(t.end)||null, t.start=this.Jp(t.start)||null,(t.end&&t.end=i&&s&&s>=n&&(a="webix_cal_range"),webix.Date.equal(n,i)&&(a="webix_cal_range_start"),webix.Date.equal(n,s)&&(a="webix_cal_range_end");var r=webix.Date.isHoliday(t)+" "||"";return a+" "+r},av:function(){var t=this.YD=this.getChildViews()[0].getChildViews(),e=this,i=this.config.id;this.aE={};for(var s=0;s=0&&i>0&&i!==this.YD.length-1)return!1;if(-1===e){var s=this.$D(t.getVisibleDate());s.start&&s.end&&(t.s.date=s[this.UD])}return!0},dE:function(t,e){var i=t>e?1:-1,s=t>e?this.YD[this.YD.length-1]:this.YD[0],n=s.aq[s.Np]._p; this.gE(i,n,s),this.refresh()},eE:function(t,e,i){var s=t.aq[t.Np]._p,n=this.fE(t.config.id),a=0===n?1:-1;if(this.YD[n+a]){var r=this.YD[n+a].s.date;if(i>e&&e>=0){var h=0;if(1===e){var o=r.getFullYear();(this.Np||-1===a&&11===r.getMonth()||1===a&&0===r.getMonth())&&(o-=a),h=t.s.date.getFullYear()-o}else if(0===e){ var l=r.getMonth()-a;(12===l||-1==l)&&(l=-1===l?11:0),h=t.s.date.getMonth()-l}this.gE(h,s,t),this.refresh()}}},ZD:function(t,e,i){t.blockEvent(),t.Np>=0&&t.$p(e,i),t.unblockEvent()},fE:function(t){return this.aE[t]},gE:function(t,e,i){for(var s=0;sa?1:-1;this.gE(h,1); }i=this._D(e,r)}t.Np!==this.Np&&t.showCalendar(e),this.setValue(i,!0),this.callEvent("onAfterDateSelect",[this.getValue()])}return!1}},webix.ui.layout),webix.protoUI({name:"daterangesuggest",defaults:{type:"daterange",body:{view:"daterange",icons:!0,button:!0,borderless:!0}},getValue:function(){return this.getRange().getValue(); },setValue:function(t){this.getRange().setValue(webix.copy(t))},getRange:function(){return this.getBody()},getButton:function(){return this.getBody().getChildViews()[1].getChildViews()[1]},iE:function(t,e){var i=webix.$$(this.s.master);i?(i.setValue(t),e&&this.hide()):this.setValue(t)},_d:function(){ var t=this.getRange();t.attachEvent("onAfterDateSelect",webix.bind(function(t){this.iE(t)},this)),t.attachEvent("onDateClear",webix.bind(function(t){this.iE(t)},this)),t.attachEvent("onTodaySet",webix.bind(function(t){this.iE(t)},this))}},webix.ui.suggest),webix.protoUI({$cssName:"datepicker",name:"daterangepicker", $init:function(t){this.s.value={},delete t.type},Je:function(){var t=this.s;t.suggest?t.popup=t.suggest:t.popup||(t.popup=t.suggest=this.suggest_setter({view:"daterangesuggest",body:{timepicker:t.timepicker,calendarCount:t.calendarCount,height:250+(t.button||t.icons?30:0)}})),this.ze=function(){}},$prepareValue:function(t){ t=t||{},t.start=webix.ui.datepicker.prototype.$prepareValue.call(this,t.start?t.start:null),t.end=webix.ui.datepicker.prototype.$prepareValue.call(this,t.end?t.end:null);var e=webix.$$(this.s.popup).getRange();return webix.copy(e.SD(t))},$compareValue:function(t,e){var i=webix.ui.datepicker.prototype.$compareValue,s=i.call(this,t.start,e.start),n=i.call(this,t.end,e.end); return s&&n},$setValue:function(t){t=t||{},this.s.text=(t.start?this.YE(t.start):"")+(t.end?" - "+this.YE(t.end):""),this.ND()},$render:function(t){t.value=this.$prepareValue(t.value),this.$setValue(t.value)},getValue:function(){var t=this.s.value;if(this.s.stringResult){var e=webix.i18n.parseFormatStr; return this.kE(e,t)}return t||null},kE:function(t,e){return e.start&&(e.start=t(e.start)),e.end&&(e.end=t(e.end)),e}},webix.ui.datepicker),webix.protoUI({name:"resizer",defaults:{width:7,height:7},$init:function(t){this.x.className+=" webix_resizer";var e=this.getParentView().Cc;webix.UE(this.x,webix.env.mouse.down,this.xq,{ bind:this}),webix.event(document.body,webix.env.mouse.up,this.yq,{bind:this});var i=this.zq();this.Aq=!1,this.Bq=i,this.Cq="x"==i?"width":"height","x"==i?t.height=0:t.width=0,e>0?(this.x.className+=" webix_resizer_v"+i,this.x.style.marginRight="-"+e+"px","x"==i?t.width=e:t.height=e,this.$nospace=!0):this.x.className+=" webix_resizer_"+i, this.x.innerHTML="
","y"==i&&e>0&&(this.x.style.marginBottom="-"+(t.height||this.defaults.height)+"px"),this.x.setAttribute("tabindex","-1"),this.x.setAttribute("aria-grabbed","false")},xq:function(t){var e=this.Dq();if(e&&!this.s.disabled){t=t||event,this.Aq=!0, this.Pl=webix.html.pos(t),this.Eq=[],this.x.setAttribute("aria-grabbed","true");for(var i=0;2>i;i++)e[i].$view.setAttribute("aria-dropeffect","move");this.x.setAttribute("aria-dropeffect","move"),this.Fq(t,e[0])}},yq:function(){this.Aq=!1,this.Pl=!1},Fq:function(t,e){var i,s,n,a,r;t=t||event,i=this.Bq, this.getParentView().x.style.position="relative",n=webix.html.offset(this.x),a=webix.html.offset(this.getParentView().x),r=n[i]-a[i],s=webix.html.offset(e.$view)[i]-webix.html.offset(this.getParentView().$view)[i],this.Rl=[i,e,r,s],this.Gq=new webix.ui.resizearea({container:this.getParentView().x,dir:i, eventPos:this.Pl[i],start:r-1,height:this.$height,width:this.$width,border:1,margin:this.getParentView()["_padding"+i.toUpperCase()]}),this.Gq.attachEvent("onResizeEnd",webix.bind(this.Hq,this)),this.Gq.attachEvent("onResize",webix.bind(this.Iq,this)),webix.html.addCss(document.body,"webix_noselect",1); },zq:function(){return this.getParentView().mc?"y":"x"},Iq:function(){var t,e,i,s,n,a,r,h,o,l;if(this.Rl)for(t=this.Dq(),n=this.Rl[0],s=this.Gq.Jl-this.Rl[2],o=this.Jq(t,n,s),l=t[0]["$"+this.Cq]+t[1]["$"+this.Cq],r="y"==n?["minHeight","maxHeight"]:["minWidth","maxWidth"],a=0;2>a;a++){e=t[a].s,i=a?-s:s; var c=e[r[0]],u=e[r[1]];if(i>0&&u&&u<=o[a]||0>i&&(c||3)>=o[a])return this.Eq[a]=i>0?u:c||3,h=this.Kq(t,n),void(this.Gq.Dl.style["y"==n?"top":"left"]=this.Rl[3]+h[0]+"px");o[a]<3?this.Gq.Dl.style["y"==n?"top":"left"]=this.Rl[3]+a*l+1+"px":this.Eq[a]=null}},Dq:function(){var t,e,i;for(t=this.getParentView().q, e=0;en;n++){var h=e[n].$getSize(0,0);if(r?h[2]==h[3]:Math.abs(h[1]-h[0])<3)e[n].s[this.Cq]=a[n],e[n].tc&&e[n].tc(this.Cq,a[n],r);else{var o=e[n].$view[r?"offsetHeight":"offsetWidth"];e[n].s.gravity=a[n]/o*e[n].s.gravity; }}e[0].resize();for(var n=0;2>n;n++)e[n].callEvent&&e[n].callEvent("onViewResize",[]),e[n].$view.removeAttribute("aria-dropeffect");webix.callEvent("onLayoutResize",[e])}this.Rl=!1}this.Rl=!1,this.Aq=!1,this.Eq=null,webix.html.removeCss(document.body,"webix_noselect"),this.x.setAttribute("aria-grabbed","false"), this.x.removeAttribute("aria-dropeffect")}},Kq:function(t){var e,i,s;return s=t[0]["$"+this.Cq]+t[1]["$"+this.Cq],this.Eq[0]?(e=this.Eq[0],i=s-e):this.Eq[1]&&(i=this.Eq[1],e=s-i),[e,i]},Jq:function(t,e,i){for(var s=[],n="height"==this.Cq?"offsetHeight":"offsetWidth",a=0;2>a;a++)s[a]=t[a].$view[n]+(a?-1:1)*i; return s},Mq:function(t,e,i){var s,n,a;if(this.Eq[0]||this.Eq[1])n=this.Kq(t,e);else for(n=this.Jq(t,e,i),s=0;2>s;s++)n[s]<0&&(a=n[0]+n[1],n[s]=1,n[1-s]=a-1);return n}},webix.MouseEvents,webix.Destruction,webix.ui.view),webix.protoUI({name:"multiview",defaults:{animate:{}},setValue:function(t){webix.$$(t).show(); },getValue:function(){return this.getActiveId()},$init:function(){this.Mh=0,this.mc=1,this.x.style.position="relative",this.x.className+=" webix_multiview",this.Nq=[]},Oq:function(t,e){var i=webix.$$(t);i.Pq||(i.Qq=[],i.Pq={}),i.Pq[e]||(i.Pq[e]=!0,i.Qq.push(e))},Rq:function(t){var e=webix.$$(t);if(this.s.keepViews&&(e.x.style.display=""), this.Nq[this.Nq.length-2]!=t?(10==this.Nq.length&&this.Nq.splice(0,1),this.Nq.push(t)):this.Nq.splice(this.Nq.length-1,1),e.Pq){for(var i=0;it?s?"bottom":"right":s?"top":"left"},fc:function(t,e){var i=this.getParentView(); if(i&&i.getTabbar&&i.getTabbar().setValue(t.s.$id||t.s.id),this.Wh)return webix.delay(this.fc,this,[t,e],100);for(var s=-1,n=0;ns||s==this.Mh)){var a=this.q[this.Mh],r=this.q[s];a.$getSize(0,0);if((e||"undefined"==typeof e)&&webix.animate.isSupported()&&this.s.animate){ var h=webix.extend({},this.s.animate);this.s.keepViews&&(h.keepViews=!0),h.direction=this.Sq(s,this.Mh),h=webix.Settings.E(e||{},h);var o=webix.animate.formLine(r.x,a.x,h);r.$getSize(0,0),r.$setSize(this.bc,this.dc);var l=h.callback;h.callback=function(){webix.animate.breakLine(o,this.s.keepViews),this.Wh=!1, l&&l.call(this),l=h.master=h.callback=null,this.resize()},h.master=this,this.Mh=s,this.Rq(this.getActiveId()),webix.animate(o,h),this.Wh=!0}else this.s.keepViews?a.x.style.display="none":(webix.html.remove(a.x),this.x.appendChild(this.q[n].x)),this.Mh=s,a.resize(),this.Rq(this.getActiveId());r.callEvent&&(r.callEvent("onViewShow",[]), webix.ui.each(r,this.Lw)),this.callEvent("onViewChange",[a.s.id,r.s.id])}},$getSize:function(t,e){if(!this.q.length)return webix.ui.baseview.prototype.$getSize.call(this,0,0);var i=this.q[this.Mh].$getSize(0,0);if(this.s.fitBiggest)for(var s=0;sa;a++)i[a]=Math.max(i[a],n[a]); var r=webix.ui.baseview.prototype.$getSize.call(this,0,0);return r[1]>=1e5&&(r[1]=0),r[3]>=1e5&&(r[3]=0),r[0]=(r[0]||i[0])+t,r[1]=(r[1]||i[1])+t,r[2]=(r[2]||i[2])+e,r[3]=(r[3]||i[3])+e,r},$setSize:function(t,e){this.q.length&&(this.lc=[t,e],webix.ui.baseview.prototype.$setSize.call(this,t,e),this.q[this.Mh].$setSize(t,e)); },isVisible:function(t,e){return e&&e!=this.getActiveId()?(t&&this.Oq(e,t),!1):webix.ui.view.prototype.isVisible.call(this,t,this.s.id)},getActiveId:function(){return this.q.length?this.q[this.Mh].s.id:null},back:function(t){if(t=t||1,this.callEvent("onBeforeBack",[this.getActiveId(),t])){if(this.Nq.length>t){ var e=this.Nq[this.Nq.length-t-1];return webix.$$(e).show(),e}return null}return null}},webix.ui.baselayout),webix.protoUI({name:"form",defaults:{type:"form",autoheight:!0},Tq:-1,_f:"webix_form",ag:!0,$init:function(){this.x.setAttribute("role","form")},$getSize:function(t,e){this.cc&&!this.s.width&&(t+=webix.ui.scrollSize); var i=webix.ui.layout.prototype.$getSize.call(this,t,e);return(this.s.scroll||!this.s.autoheight)&&(i[2]=this.s.height||this.s.minHeight||0,i[3]+=1e5),i}},webix.ui.toolbar),function(){var t={};for(var e in webix.UIManager.nb)t[webix.UIManager.nb[e]]=e;var i={9:"tab",38:"up",40:"down",37:"left",39:"right" };webix.patterns={phone:{mask:"+# (###) ###-####",allow:/[0-9]/g},card:{mask:"#### #### #### ####",allow:/[0-9]/g},date:{mask:"####-##-## ##:##",allow:/[0-9]/g}},webix.extend(webix.ui.text,{$init:function(e){if((e.pattern||e.format&&!this.format_setter)&&(this.attachEvent("onKeyPress",function(e,s){if(!(s.ctrlKey||s.altKey||this.nH)){ if(e>105&&112>e&&(e-=64),t[e]&&8!==e&&46!==e)return void(i[e]||webix.html.preventEvent(s));webix.html.preventEvent(s),this.$C(s,e)}}),this.attachEvent("onAfterRender",this.ye),this.getText=function(){return this.getInputNode().value},this.VC=function(t,e){return e===!1?this._C(t):this.aD(t)},e.format))if("object"==typeof e.format)this.nH=e.format;else{ var s=webix.Number.getConfig(e.format);this.nH={parse:function(t){return webix.Number.parse(t,s)},edit:function(t){return webix.Number.format(t,s)}}}},pattern_setter:function(t){var e=webix.patterns[t]||t;return"string"==typeof e&&(e={mask:e}),e.allow=e.allow||/[A-Za-z0-9]/g,this.bD(e),e},cD:function(){ this.config.validate=this.config.validate||webix.bind(function(){var t=this.getText(),e=t.replace(this.dD,""),i=(t.toString().match(this.eD)||[]).join("");return i.length==e.length&&t.length==this.s.pattern.mask.length},this)},ye:function(){var t=webix.env.isIE8?"propertychange":"input";this.nH||webix.UE(this.getInputNode(),t,function(t){ var e=(new Date).valueOf();this.$view.offsetWidth;(!this.fD||e-this.fD>100)&&(this.fD=e,this.$setValue(this.getText()))},{bind:this}),webix.UE(this.getInputNode(),"blur",function(t){this.Xy()},{bind:this})},bD:function(t){for(var e=t.mask,i={},s="",n=0,a=0;a0&&(i+=n)} return i},jD:function(t,e){var i=t-1*(46!==e);return this.gD[i]===!1?(t+=8==e?-1:1,this.jD(t,e)):this.gD[t]===!1&&8!==e?this.jD(t+1,e)-1:t},_C:function(t){if(this.nH)return this.nH.parse(t);t=t||"";var e=t.toString().match(this.eD)||[];return e.join("").replace(this.dD,"")},aD:function(t){if(this.nH)return this.nH.edit(this.nH.parse(t)); var e=this._C(t),i=this.s.pattern.mask,s=this.s.pattern.mask,n=this.gD,a=!1,r=0,h=0,o=0;for(var l in n)if(n[l]!==!1){if(!a){r=1*l,h=n[l];var c=e[h]||"",u=e[h+1];i=(c?i.substr(0,r):"")+c+(c&&u?i.substr(r+1):""),u||(a=!0)}o++}var d=this.iD;if(d&&8!==d||!d&&o-1===h&&i.lengthb&&(b=s.length),i+=s.substr(f,b-f)}}else 46!==d&&(i+=s.substr(0,s.indexOf("#")));return this.iD=null,i}})}(),webix.protoUI({name:"gridsuggest",defaults:{type:"datatable",fitMaster:!1,width:0,body:{navigation:!0,autoheight:!0,autowidth:!0,select:!0},filter:function(t,e){var i=this.config.template(t); return 0===i.toString().toLowerCase().indexOf(e.toLowerCase())?!0:!1}},$init:function(t){t.body.columns||(t.body.autoConfig=!0),t.template||(t.template=webix.bind(this.bu,this))},bu:function(t,e){var i=this.getBody(),s=this.config.textValue||i.config.columns[0].id;return i.getText(t.id,s)}},webix.ui.suggest), webix.protoUI({name:"datasuggest",defaults:{type:"dataview",fitMaster:!1,width:0,body:{xCount:3,autoheight:!0,select:!0}}},webix.ui.suggest),webix.protoUI({name:"multiselect",$cssName:"richselect",defaults:{separator:","},Kt:function(t){var e=!webix.isArray(t)&&"object"==typeof t&&!t.name,i={view:"checksuggest", separator:this.config.separator,buttonText:this.config.buttonText,button:this.config.button};this.s.optionWidth?i.width=this.s.optionWidth:i.fitMaster=!0,e&&webix.extend(i,t,!0);var s=webix.ui(i),n=s.getList();return"string"==typeof t?n.load(t):e||n.parse(t),s.attachEvent("onShow",function(t,e,i){s.setValue(webix.$$(s.s.master).config.value); }),s},$setValue:function(t){if(this.se){var e=this.getPopup(),i="";e&&(i=e.setValue(t),"object"==typeof i&&(i=i.join(this.config.separator+" "))),this.s.text=i;var s=this.getInputNode();s.innerHTML=i||this.Yx()}},getValue:function(){return this.s.value||""}},webix.ui.richselect),webix.editors.multiselect=webix.extend({ popupType:"multiselect"},webix.editors.richselect),webix.type(webix.ui.list,{name:"multilist",templateStart:webix.template('
')},"default"),webix.type(webix.ui.list,{ name:"checklist",templateStart:webix.template('
{common.checkbox()}'),checkbox:function(t,e){var i=webix.skin.icon+(t.$checked?"check-square":"square-o"); return""},aria:function(t){return"role='option' tabindex='-1' "+(t.$checked?"aria-selected='true'":"")},template:webix.template("#value#")},"default"),webix.protoUI({name:"multisuggest", defaults:{separator:",",type:"layout",button:!0,width:0,filter:function(t,e){var i=this.getItemText(t.id);return i.toString().toLowerCase().indexOf(e.toLowerCase())>-1},body:{rows:[{view:"list",type:"multilist",borderless:!0,autoheight:!0,yCount:5,multiselect:"touch",select:!0,on:{onItemClick:function(t){ var e=this.getParentView().getParentView();webix.delay(function(){e._y(t)})}}},{view:"button",click:function(){var t=this.getParentView().getParentView();t.setMasterValue({id:t.getValue()}),t.hide()}}]}},_y:function(t,e,i){var s=this.getValue(),n=i||webix.toArray(s?this.getValue().split(this.s.separator):[]),a=webix.$$(this.s.master); if(i||(n.find(t)<0?n.push(t):n.remove(t)),a)a.setValue(n.join(this.s.separator));else{var r=this.setValue(n);this.ae&&(this.ae.value=r.join(this.s.separator))}if(e){var h=this.getList().getItemNode(t).getElementsByTagName("SPAN");h&&h.length&&h[0].focus()}},Jt:function(t){return t.rows[0]},_d:function(){ var t=this.getButton(),e=this.s.button?this.s.buttonText||webix.i18n.combo.select:0;if(t&&(e?(t.s.value=e,t.refresh()):t.hide()),this.s.selectAll)return this.getBody().getChildViews()[0].show();var i=this.getList();i.data.attachEvent("onAfterFilter",webix.bind(function(){return this.be()},this))},ke:function(){ var t=this.getList(),e=this.getMasterValue();if(e&&(e=e.toString().split(this.config.separator),e[0]))for(var i=0;i100&&this.HA(t),this.s.keepText||(this.xy=""),this.refresh()},Ay:function(t){var e=this.s.value,i=webix.$$(this.config.suggest);"string"==typeof e&&(e=e.split(this.s.separator)),e=webix.toArray(webix.copy(e)), e.remove(t),this.setValue(e.join(this.s.separator)),i&&i.s.selectAll&&i.getBody().q[0].setValue(0)},az:function(t){var e=webix.$$(this.config.suggest),i=e.getList(),s=i.getItem(t);if(s){var n=e.getValue();n&&"string"==typeof n&&(n=n.split(e.config.separator)),n=webix.toArray(n||[]),n.find(t)<0&&(n.push(t), e.setValue(n),this.setValue(e.getValue()))}},HA:function(t){var e,i=webix.$$(this.config.suggest),s=i.getList();if(t=t.replace(/^\s+|\s+$/g,""))for(var n in s.data.pull)i.getItemText(n)==t&&(e=n);!e&&t&&(e=s.add({id:t,value:t})),this.az(e)},Kt:function(t){var e=!webix.isArray(t)&&"object"==typeof t&&!t.name,i={ view:"checksuggest",separator:this.config.separator,buttonText:this.config.buttonText,button:this.config.button},s=this;this.s.optionWidth&&(i.width=this.s.optionWidth),e&&webix.extend(i,t,!0);var n=webix.ui(i);this.s.optionWidth||(n.$customWidth=function(t){this.config.width=s.Ee(s.s)}),n.attachEvent("onBeforeShow",function(t,e,i){ return this.s.master&&(this.setValue(webix.$$(this.s.master).config.value),webix.$$(this.s.master).getInputNode().value||this.isVisible()?(this.getList().refresh(),this.je=!0):this.getList().filter(),t.tagName&&"input"==t.tagName.toLowerCase())?(webix.ui.popup.prototype.show.apply(this,[t.parentNode,e,i]), !1):void 0});var a=n.getList();return"string"==typeof t?a.load(t):e||a.parse(t),n.be=function(){},n},yy:function(t,e){var i,s,n,a,r,h,o,l,c,u,d,f,b,p,x="",w="top"==this.s.labelPosition;return i="x"+webix.uid(),p=e.Ee(t),n=t.inputAlign||"left",o=this.zy-2*webix.skin.$active.inputPadding-2,r=this.xy||"", u="
    ",h=Math.min(p,e.By||7),a="width: "+h+"px;height:"+o+"px;max-width:"+(p-20)+"px",b=t.readonly?" readonly ":"",s="", l="
    "+u+s+"
    ",c=e.$renderLabel(t,i),f=this.s.awidth-p-2*webix.skin.$active.inputPadding,d=(t.invalid?t.invalidMessage:"")||t.bottomLabel,d&&(x="
    "+d+"
    "), w?c+"
    "+l+x+"
    ":"
    "+c+l+x+"
    "},Cy:function(){return this.re().getElementsByTagName("UL")[0]},oe:function(){var t=this.getPopup();if(t){var e=t?t.setValue(this.s.value):null; t.fB&&(this.s.value=t.fB(this.s.value));var i="",s=this.Cy(),n=e&&e.length;if(n){var a=this.zy-2*webix.skin.$active.inputPadding-8,r=this.s.value;if("string"==typeof r&&(r=r.split(this.s.separator)),this.s.tagMode)for(var h=0;hx"; i+="
  • "+o+"
  • "}else i+="
  • "+this.s.tagTemplate(r)+"
  • "}s.innerHTML=i;var l=this.getInputNode();this.s.placeholder&&(n?(l.placeholder="",!l.value&&l.offsetWidth>20&&(l.style.width="20px")):l.value||(l.placeholder=this.s.placeholder, l.style.width=this.Ee(this.s)+"px")),!this.s.tagMode&&s.firstChild&&(l.style.width=this.lE()+"px")}this.Dy()},Ey:function(t){if(t=t||this.getInputNode())if(t.value.length){if(t.createTextRange){var e=t.createTextRange();e.moveStart("character",t.value.length),e.collapse(),e.select()}else if(t.selectionStart||"0"==t.selectionStart){ var i=t.value.length;t.selectionStart=i,t.selectionEnd=i,t.focus()}}else t.focus()},Dy:function(){var t="top"==this.s.labelPosition,e=this.JA(),i=Math.max(e.offsetHeight+2*webix.skin.$active.inputPadding,this.zy);t&&(i+=this.le),i+=this.s.bottomPadding||0;var s=this.$getSize(0,0);if(i!=s[2]){var n=e.offsetHeight+(t?this.le:0); if(n==this.Fy?this.IA++:this.IA=0,this.IA>10)return!1;this.Fy=n;var a=this.getTopParentView();clearTimeout(a.kg),a.kg=webix.delay(function(){this.config.height=this.Fy+2*webix.skin.$active.inputPadding,this.resize(),this.Hy&&(this.Ey(this.getInputNode()),this.Hy=!1),this.bz&&(this.s.keepText?this.getInputNode().select():this.getInputNode().value="", this.bz=!1),(this.getPopup().isVisible()||this.Hy)&&this.getPopup().show(this.JA())},this)}this.bz&&this.getInputNode().select()},JA:function(){for(var t=this.re(),e=t.childNodes,i=0;i/g,">"),document.body.appendChild(e);var i=e.offsetWidth+10;return document.body.removeChild(e),i},lE:function(){var t=this.Cy();return t.offsetWidth-t.firstChild.offsetWidth-17},De:function(){webix.UE(this.re(),"click",function(){ this.getInputNode().focus()},{bind:this}),webix.UE(this.getInputNode(),"focus",function(){-1==this.re().className.indexOf("webix_focused")&&(this.re().className+=" webix_focused")},{bind:this}),webix.UE(this.getInputNode(),"blur",function(){this.re().className=this.re().className.replace(" webix_focused",""); },{bind:this}),webix.UE(this.getInputNode(),"input",function(){!this.getInputNode().value&&this.xy&&(this.getInputNode().style.width="20px",this.By=20,this.xy="",this.Hy=!0,this.getPopup().show(this.JA()),this.Dy())},{bind:this}),webix.UE(this.getInputNode(),"keyup",function(t){var e,i,s=this.getInputNode(); if(t=t||event,!this.s.placeholder||this.s.value||s.value?(i=e=this.Iy(s.value)+10,!this.s.tagMode&&this.Cy().firstChild&&(i=this.lE())):i=this.Ee(this.s),s.style.width=i+"px",e!=this.By?(this.s.keepText||13!=t.keyCode?this.xy=s.value:this.xy=!1,this.Hy=!0,this.By&&this.getPopup().show(this.JA()),this.By=e||i, this.Dy()):this.vA!=this.getPopup().$height&&this.getPopup().show(this.JA()),s.value.indexOf(this.s.separator)>-1&&this.s.tagMode){var n=s.value.replace(this.s.separator,"");if(n)if(this.s.newValues)this.HA(n);else{var a=this.getPopup().getItemId(n);a&&this.az(a)}this.s.keepText?(this.xy=n,s.value=n, this.bz=!0,this.Hy=!0,this.Dy()):s.value=""}},{bind:this}),webix.UE(this.getInputNode(),"keydown",function(t){if(this.bz=!1,this.isVisible()){t=t||event;var e=this.Cy().lastChild;if(this.vA=this.getPopup().$height,8==t.keyCode&&e&&(!this.getInputNode().value&&(new Date).valueOf()-(this.Jy||0)>100?(this.Hy=!0, this.Ay(e.getAttribute("optvalue"))):this.Jy=(new Date).valueOf()),13==t.keyCode||9==t.keyCode){var i=this.getInputNode(),s="",n=webix.$$(this.s.suggest),a=n.getList();a.getSelectedId()||(i.value&&(s=n.getSuggestion(i.value)),this.s.newValues?(13==t.keyCode&&(this.bz=!0),this.HA(i.value),this.s.keepText?this.xy=i.value:i.value=""):s&&(9==t.keyCode?(this.Hy=!1, this.xy="",this.By=10,i.value="",this.az(s)):(this.bz=!0,this.az(s),this.s.keepText?this.xy=i.value:i.value=""))),13==t.keyCode&&(this.bz=!0,this.Hy=!0,this.s.keepText?this.xy=i.value:i.value="")}}},{bind:this}),webix.$$(this.s.suggest).linkInput(this)}},webix.ui.richselect),webix.protoUI({name:"menu", Oh:"webix_menu",$init:function(t){this.data.qf=webix.bind(function(t){t.disabled&&this.data.addMark(t.id,"webix_disabled",!0,1,!0)},this),t.autowidth&&(this.KA=!0,delete t.autowidth),this.data.attachEvent("onStoreUpdated",webix.bind(function(){this.Uq()},this)),this.attachEvent("onMouseMove",this.Vq), this.attachEvent("onMouseOut",function(t){this.Wq()&&"click"==this.s.openAction||!this.Xq&&t.relatedTarget&&this.Uq()}),this.attachEvent("onItemClick",function(t,e,i){var s=this.getItem(t);if(s){if(s.$template)return;var n=this.getTopMenu();if(!this.data.getMark(t,"webix_disabled")){if(!n.callEvent("onMenuItemClick",[t,e,i]))return void(e.showpopup=!0); this!=n&&n.Le(t,e,i),s.submenu||n.uH?(this!==n&&!webix.env.touch||"click"!=n.s.openAction||this.Yq(t,i),e.showpopup=!0):(n.Uq(!0),n.$q&&n.hide())}}}),this.attachEvent("onKeyPress",function(t,e){if(9===t)this.getTopMenu().Uq();else if(13===t||32===t){var i,s=this.getSelectedId();s&&(i=this.getItemNode(s)), i&&webix.html.triggerEvent(i,"MouseEvents","click")}}),this.data.attachEvent("onClearAll",function(){this._q=[]}),this.data._q=[],this.x.setAttribute("role","menubar"),this.Ns=[]},sizeToContent:function(){if("y"==this.s.layout){var t=[],e=!1;this.data.each(function(i){t.push(this.jb(i)),i.submenu&&(e=!0); },this),this.config.width=webix.html.getTextSize(t,this.$view.className).width+16+2+(e?15:0),this.resize()}},getTopMenu:function(){for(var t=this;t.ar;)t=webix.$$(t.ar);return t},Rh:function(t){this.s.autoheight&&(t=this.count());for(var e=this.count(),i=0,s=0;t>s;s++){var n=this.data.pull[this.data.order[s]]; n&&"Separator"==n.$template?(i+=4,this.s.autoheight||t++):i+=this.type.height}return this.Lf(t&&e>t),i},on_mouse_move:{},type:{css:"menu",width:"auto",aria:function(t,e,i){return'role="menuitem"'+(i&&i.webix_selected?' aria-selected="true" tabindex="0"':'tabindex="-1"')+(t.submenu||t.data?'aria-haspopup="true"':"")+(i&&i.webix_disabled?' aria-disabled="true"':""); },templateStart:function(t,e,i){if("Separator"===t.$template||"Spacer"===t.$template)return'":""},templateSeparator:webix.template("
    "),templateSpacer:webix.template("
    ")},getMenu:function(t){if(this.data.pull[t])return this;for(var e in this.data.pull){var i=this.getItem(e); if(i.submenu){var s=this.br(i).getMenu(t);if(s)return s}}},getSubMenu:function(t){var e=this.getMenu(t),i=e.getItem(t);return i.submenu?e.br(i):null},getMenuItem:function(t){return this.getMenu(t).getItem(t)},br:function(t){var e=webix.$$(t.submenu);return e||(t.submenu=this.cr(t),e=webix.$$(t.submenu)), e},Vq:function(t,e,i){this.Wq()&&this.Yq(t,i)},Wq:function(){var t=this.getTopMenu();if("click"==t.s.openAction){if(webix.env.touch)return!1;var e=t.dr;return e&&webix.$$(e).isVisible()?!0:!1}return!0},Yq:function(t,e){var i=this.getItem(t);if(i&&(this.Xq=null,this.dr&&i.submenu!=this.dr&&this.Uq(!0), i.submenu||i.data&&!this.config.hidden)){var s=this.br(i);if(this.data.getMark(t,"webix_disabled"))return;s.show(e,{pos:this.s.subMenuPos}),s.ar=this.s.id,this.dr=i.submenu}},disableItem:function(t){this.getMenu(t).addCss(t,"webix_disabled")},enableItem:function(t){this.getMenu(t).removeCss(t,"webix_disabled"); },er:function(t,e){var i=this.data;i._q[t]!=e&&(i._q[t]=e,i.filter(function(t){return!i._q[t.id]}),this.resize())},hideItem:function(t){var e=this.getMenu(t);e&&e.er(t,!0)},showItem:function(t){var e=this.getMenu(t);return e?(e.er(t,!1),webix.ui.list.prototype.showItem.call(e,t)):void 0},Uq:function(t){ if(this.dr){var e=webix.$$(this.dr);e.Uq&&e.Uq(t),(t||!e.gr)&&(e.hide(),this.dr=null)}},cr:function(t){var e={view:"submenu",data:t.submenu||t.data},i=this.getTopMenu().s.submenuConfig;i&&webix.extend(e,i,!0);var s=this.getMenuItem(t.id);s&&s.config&&webix.extend(e,s.config,!0);var n=webix.ui(e);return this.Ns.push(n), n.ar=this,n.s.id},OD:function(t,e,i){var s=this.getItem(t);if("Separator"==s.$template||"Spacer"==s.$template||this.data.getMark(t,"webix_disabled")){var n=this.getIndexById(t)+("up"==i?-1:1);return t=n>=0?this.getIdByIndex(n):null,t?this.OD(t,e,i):e}return t},$skin:function(){webix.ui.list.prototype.$skin.call(this), this.type.height=webix.skin.$active.menuHeight},defaults:{scroll:"",layout:"x",mouseEventDelay:100,subMenuPos:"bottom"}},webix.ui.list),webix.protoUI({name:"submenu",$init:function(){this.gd=webix.clone(this.hr),this.gd.A=this,this.attachEvent("onMouseOut",function(t){"click"!=this.getTopMenu().s.openAction&&(this.Xq||this.gr||!t.relatedTarget||this.hide()); }),this.attachEvent("onMouseMoving",function(){this.ar&&(webix.$$(this.ar).Xq=!0)}),this.attachEvent("onBeforeShow",function(){this.getTopMenu().KA&&this.sizeToContent&&!this.isVisible()&&this.sizeToContent()}),this.y.setAttribute("role","menu")},$skin:function(){webix.ui.menu.prototype.$skin.call(this), webix.ui.popup.prototype.$skin.call(this),this.type.height=webix.skin.$active.menuHeight},hr:{$getSize:function(t,e){var i=1*this.A.s.height,s=1*this.A.s.width,n=webix.ui.menu.prototype.$getSize.call(this.A,t,e);return this.A.s.height=i,this.A.s.width=s,n},$setSize:function(t,e){this.A.s.scroll&&(this.A.ed.style.height=e+"px"); },destructor:function(){this.A=null}},body_setter:function(){},getChildViews:function(){return[]},defaults:{width:150,subMenuPos:"right",layout:"y",autoheight:!0},type:{height:webix.skin.menuHeight,subsign:!0}},webix.ui.menu,webix.ui.popup),webix.ContextHelper={defaults:{padding:"4",hidden:!0},body_setter:function(t){ return t=webix.ui.window.prototype.body_setter.call(this,t),this.gd.x.style.borderWidth="0px",t},attachTo:function(t){var e;e=t.on_context?t.attachEvent("onAfterContextMenu",webix.bind(this.ir,this)):webix.event(t,"contextmenu",this.jr,{bind:this}),this.attachEvent("onDestruct",function(){t.callEvent?t.detachEvent(e):webix.eventRemove(e), t=null})},getContext:function(){return this.nh},setContext:function(t){this.nh=t},jr:function(t){return this.nh=webix.toNode(t||event),this.kr(t)},ir:function(t,e,i){return this.nh={obj:webix.$$(e),id:t},this.kr(e)},kr:function(t){var e=this.show(t,null,!0);return e===!1?e:(webix.callEvent("onClick",[]), webix.html.preventEvent(t))},gr:!0,master_setter:function(t){return this.attachTo(t),null}},webix.protoUI({name:"context"},webix.ContextHelper,webix.ui.popup),webix.protoUI({name:"contextmenu",$q:!0,$init:function(t){t.submenuConfig&&webix.extend(t,t.submenuConfig)}},webix.ContextHelper,webix.ui.submenu), webix.protoUI({name:"tabbar",$init:function(){this.attachEvent("onKeyPress",this.DD)},$skin:function(){var t=webix.skin.$active,e=this.defaults;e.topOffset=t.tabTopOffset||0,e.tabOffset="undefined"!=typeof t.tabOffset?t.tabOffset:10,e.bottomOffset=t.tabBottomOffset||0,e.height=t.tabbarHeight,e.tabMargin=t.tabMargin, e.inputPadding=t.inputPadding,e.tabMinWidth=t.tabMinWidth||100,e.tabMoreWidth=t.tabMoreWidth||40},ut:function(){var t,e,i=this.s,s=this.OC||i.options,n=this.we-2*i.tabOffset,a=i.optionWidth||i.tabMinWidth;if(e=s.length,i.tabMinWidth&&a>n/e)return{max:parseInt(n/a,10)||1};if(!i.optionWidth)for(t=0;e>t;t++)s[t].width&&(n-=s[t].width+(t||i.type?0:i.tabMargin), e--);return{width:e?n/e:i.tabMinWidth}},Je:function(){var t=this.s;if(!t.tabbarPopup){var e={view:"popup",width:t.popupWidth||200,body:{view:"list",borderless:!0,select:!0,css:"webix_tab_list",autoheight:!0,yCount:t.yCount,type:{template:t.popupTemplate}}},i=webix.ui(e);i.getBody().attachEvent("onBeforeSelect",webix.bind(function(t){ return t&&this.callEvent("onBeforeTabClick",[t])?(this.setValue(t),webix.$$(this.s.tabbarPopup).hide(),this.callEvent("onAfterTabClick",[t]),!0):void 0},this)),i.getBody().attachEvent("onAfterSelect",webix.bind(function(t){this.refresh()},this)),t.tabbarPopup=i.s.id,this.Ns.push(i)}this.Je=function(){}; },getPopup:function(){return this.Je(),webix.$$(this.s.tabbarPopup)},moreTemplate_setter:webix.template,popupTemplate_setter:webix.template,defaults:{popupWidth:200,popupTemplate:"#value#",yCount:7,moreTemplate:'',template:function(t,e){var i,s,n,a,r,h,o,l,c,u; if(e.OC=l=e.yC(t.options),l.length){e.Be(l),!t.value&&l.length&&(t.value=l[0].id),s="",t.tabOffset&&(s+="
     
    "),i=e.we-2*t.tabOffset-(t.type?0:t.tabMargin*(l.length-1)),c=t.topOffset+t.bottomOffset;var d=e.ut();if(d.max&&d.maxd.max)){var x=l.splice(n,1),w=l.splice(0,d.max-1).concat(x);l=w.concat(l)}b.clearAll(),b.parse(l.slice(d.max))}else b.clearAll()}else e.s.tabbarPopup&&webix.$$(e.s.tabbarPopup).hide(); o=t.tabOffset;var g=!1;for(n=0;n1?t.tabMargin*(d.max-1):0),u=(i-t.tabMoreWidth)/d.max):u=d.width,u=l[n].width||t.optionWidth||u,o+=u+(n&&!t.type?t.tabMargin:0),t.tabMargin>0&&n&&!t.type&&(s+="
    "), s+=e.vt(l[n],u),g&&(s+='
    '+t.moreTemplate(t,e)+"
    ",o+=t.tabMoreWidth);a=e.bc-o,a>0&&!t.type&&(s+="
     
    "); }else s="
    ";return r="",h=c&&!t.type?"height:"+(e.dc-c)+"px":"",t.topOffset&&!t.type&&(r+="
    "),r+="
    "+s+"
    ", t.bottomOffset&&!t.type&&(r+="
    "),r}},Ie:function(){return this.$view.querySelectorAll(".webix_item_tab")},vt:function(t,e){var i,s="",n=this.config;if(t.id==n.value&&(s=" webix_selected"),t.css&&(s+=" "+t.css),e=t.width||e, i='"},ne:{image:"
    #value#
    ", icon:"
    #value#
    ",iconTop:"
    #value#
    " },type_setter:function(t){return this.s.tabOffset=0,this.ne[t]&&(this.lr=webix.template(this.ne[t])),t}},webix.ui.segmented),webix.protoUI({name:"tabview",defaults:{type:"clean"},setValue:function(t){this.q[0].setValue(t)},getValue:function(){return this.q[0].getValue()},getTabbar:function(){return this.q[0]; },getMultiview:function(){return this.q[1]},addView:function(t){var e=this.getMultiview().addView(t.body);t.id=e,t.value=t.header,delete t.body,delete t.header;var i=this.getTabbar();return i.addOption(t),e},removeView:function(t){var e=this.getTabbar();e.removeOption(t),e.refresh()},$init:function(t){ this.$ready.push(this.Nv);for(var e=t.cells,i=[],s=e.length-1;s>=0;s--){var n=e[s].body||e[s];n.id||(n.id="view"+webix.uid()),i[s]={value:e[s].header,id:n.id,close:e[s].close,width:e[s].width,hidden:!!e[s].hidden},e[s]=n}var a={view:"tabbar",multiview:!0},r={view:"multiview",cells:e,animate:!!t.animate };t.value&&(a.value=t.value),t.tabbar&&webix.extend(a,t.tabbar,!0),t.multiview&&webix.extend(r,t.multiview,!0),a.options=a.options||i,t.rows=[a,r],delete t.cells,delete t.tabs},Nv:function(){this.getTabbar().attachEvent("onOptionRemove",function(t){var e=webix.$$(t);if(e){var i=e.getParentView();i&&i.removeView(e); }})}},webix.ui.layout),webix.protoUI({name:"fieldset",defaults:{borderless:!0,$cssName:"webix_fieldset",paddingX:18,paddingY:30},$init:function(t){this.x.className+=" "+this.defaults.$cssName,this.x.innerHTML="
    "; },label_setter:function(t){return this.x.firstChild.childNodes[0].innerHTML=t,t},getChildViews:function(){return[this.os]},body_setter:function(t){return webix.Xb=this,this.os=webix.ui(t,this.x.firstChild.childNodes[1]),t},getBody:function(){return this.os},resizeChildren:function(){if(this.os){var t=this.$width-this.s.paddingX,e=this.$height-this.s.paddingY,i=this.os.$getSize(0,0); i[0]>t&&(t=i[0]),i[2]>e&&(e=i[2]),this.os.$setSize(t,e),this.resize()}},$getSize:function(t,e){t+=this.s.paddingX,e+=this.s.paddingY;var i=this.os.$getSize(t,e),s=this.ps=webix.ui.view.prototype.$getSize.call(this,t,e);return s[0]i[1]&&(s[1]=i[1]),s[3]>i[3]&&(s[3]=i[3]), s[1]"+e+""},BF:function(t,e,i,s){var n={view:"list", select:"multiselect",multiselect:"touch",id:t,action:e,drag:!0,type:{margin:3,id:t},on:{onBeforeDrop:function(t){var e=t.from,i=t.to,s=e.getTopParentView();if(s===this.getTopParentView()){var n="select_one"!=i.s.action;s.select(t.source,n)}return!1},onItemDblClick:function(){return this.getTopParentView().AF(this.config.action); }}};return this.s.list&&webix.extend(n,this.s.list,!0),i&&(n={rows:[{view:"label",label:i},n]}),s?{rows:[n,{view:"label",height:20,label:s,css:"bottom_label"}]}:n},HE:function(){var t=[{margin:10,type:"clean",cols:[this.BF("left","select_one",this.s.labelLeft,this.s.labelBottomLeft),this.yF(),this.BF("right","deselect_one",this.s.labelRight,this.s.labelBottomRight)] }];this.cols_setter(t)},AF:function(t){var e=this,i=null,s=!1;"select_all"===t?(i=e.$$("left").data.order,s=!0):"select_one"===t?(i=e.$$("left").getSelectedId(!0),s=!0):"deselect_all"===t?(i=e.$$("right").data.order,s=!1):"deselect_one"===t&&(i=e.$$("right").getSelectedId(!0),s=!1),e.select(i,s)},select:function(t,e){ var i;if("object"!=typeof t&&(t=[t]),e)for(i=0;i",selectOne:"", deselectAll:"",deselectOne:""},function(){function t(t){return t.tagName?t.tagName.toLowerCase():null}function e(t,e){if(!t.getAttribute)return null;var i=t.getAttribute(e); return i?i.toLowerCase():null}function i(){var e=t(this);return n[e]?n[e](this):n.other(this)}function s(e){var i=t(this);return a[i]?a[i](this,e):a.other(this,e)}var n={radio:function(t){for(var e=0;e1;)this.x.childNodes[0].appendChild(t.childNodes[0]);else this.x.childNodes[0].appendChild(t);return this.pc(),!0},render:function(){webix.ui.template.prototype.render.apply(this,arguments),this.pc()},pc:function(){var n=this.x.querySelectorAll("[name]"); this.elements={};for(var a=0;a");i.length>1&&(t=i[1],e=i[0])}else t&&t.mode&&(e=t.mode,t=t.url);return e?webix.proxy(e,t):t},master_setter:function(t){var e=t;return"DataStore"!=t.name&&(e=t.data),this.s.store=e, t},Mi:function(){this.s.store.attachEvent("onStoreUpdated",webix.bind(this.Ar,this)),this.s.store.attachEvent("onDataMove",webix.bind(this.Br,this))},ignore:function(t,e){var i=this.vr;this.vr=!0,t.call(e||this),this.vr=i},off:function(){this.vr=!0},on:function(){this.vr=!1},Cr:function(t){var e={};for(var i in t)0!==i.indexOf("$")&&(e[i]=t[i]); return e},save:function(t,e,i){e=e||"update",this.Dr(t,i||this.s.store.getItem(t),e)},Dr:function(t,e,i){if("object"==typeof t&&(t=t.toString()),!t||this.vr===!0||!i||"paint"==i)return!0;var s=this.s.store;s&&s.vf&&(e=s.vf(e));var n={id:t,data:this.Cr(e),operation:i};if(webix.isUndefined(e.$parent)||(n.data.parent=e.$parent), "delete"!=n.operation){var a=this.s.master;a&&a.data&&a.data.getMark&&a.data.getMark(t,"webix_invalid")&&(n.Er=!0),this.validate(null,n.data)||(n.Er=!0)}return this.Fr(n)&&this.zr.push(n),this.s.autoupdate&&this.send(),!0},Br:function(t,e,i,s){if(this.s.trackMove){var n=webix.copy(this.s.store.getItem(t)); this.s.store.order;n.webix_move_index=e,n.webix_move_id=s,n.webix_move_parent=i,this.Dr(t,n,"order")}},Ar:function(t,e,i){switch(i){case"save":i="update";break;case"update":i="update";break;case"add":i="insert";break;case"delete":i="delete";break;default:return!0}return this.Dr(t,e,i)},Fr:function(t){ for(var e=0;e=0;t--)if(this.zr[t].Hr)return"saving"; return!0},getItemState:function(t){var e=this.bt(t);return this.zr[e]||null},setItemState:function(t,e){if(e)this.save(t,e);else{var i=this.bt(t);i>-1&&this.zr.splice(i,1)}},bt:function(t){for(var e=-1,i=0;i=0;h--)s[h]=n[h];for(var h=0;h0?!1:!0},$r:{body:1,head:1, data:1,rows:1,cols:1,cells:1,elements:1,ui:1,column:1,config:1},Vr:function(t,e,i){var s=this.Xr(t,{});s.name?(e[s.name]=s,delete s.name):s.stack?e[s.stack]=[]:e=s;for(var n=t.childNodes,a=0;a
    "+t+"
    "}function n(t){f.area||(f.area=document.createElement("DIV"), f.area.className="webix_message_area",f.area.style[f.position]="5px",document.body.appendChild(f.area)),f.area.setAttribute("role","alert"),f.area.setAttribute("aria-atomic",!0),f.hide(t.id);var e=document.createElement("DIV");return e.innerHTML="
    "+t.text+"
    ",e.className="webix_info webix_"+t.type, e.onclick=function(){f.hide(t.id),t=null},webix.$testmode&&(e.className+=" webix_no_transition"),"bottom"==f.position&&f.area.firstChild?f.area.insertBefore(e,f.area.firstChild):f.area.appendChild(e),t.expire>0&&(f.timers[t.id]=window.setTimeout(function(){f.hide(t.id)},t.expire)),e.style.height=e.offsetHeight-2+"px", f.pull[t.id]=e,e=null,t.id}function a(e,i,n){var a=document.createElement("DIV");a.className=" webix_modal_box webix_"+e.type,a.setAttribute("webixbox",1),a.setAttribute("role","alertdialog"),a.setAttribute("aria-label",e.title||""),a.setAttribute("tabindex","0");var r="";if(e.width&&(a.style.width=e.width+(webix.rules.isNumber(e.width)?"px":"")), e.height&&(a.style.height=e.height+(webix.rules.isNumber(e.height)?"px":"")),e.title&&(r+='
    '+e.title+"
    "),r+='
    '+(e.content?"":e.text)+'
    ',(i||e.ok)&&(r+=s(e.ok||webix.i18n.message.ok,!0,"confirm")), (n||e.cancel)&&(r+=s(e.cancel||webix.i18n.message.cancel,!1)),e.buttons)for(var h=0;h",a.innerHTML=r,e.content){var o=e.content;"string"==typeof o&&(o=document.getElementById(o)),"none"==o.style.display&&(o.style.display=""),a.childNodes[e.title?1:0].appendChild(o); }return a.onclick=function(i){i=i||event;var s=i.target||i.srcElement;if(s.className||(s=s.parentNode),-1!=s.className.indexOf("webix_popup_button")){var n=s.getAttribute("result");n="true"==n||("false"==n?!1:n),t(e,n)}i.cancelBubble=!0},e.box=a,(i||n||e.buttons)&&(d=e),a}function r(t,s,n){var r=t.tagName?t:a(t,s,n); t.hidden||i(!0),webix.toNode(t.container||document.body).appendChild(r);var h=t.left||Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-r.offsetWidth)/2)),o=t.top||Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-r.offsetHeight)/2));return"top"==t.position?r.style.top="-3px":r.style.top=o+"px", r.style.left=h+"px",r.onkeydown=e,r.focus(),t.hidden&&webix.modalbox.hide(r),r}function h(t){return r(t,!0,!1)}function o(t){return r(t,!0,!0)}function l(t){return r(t)}function c(t,e,i){return"object"!=typeof t&&("function"==typeof e&&(i=e,e=""),t={text:t,type:e,callback:i}),t}function u(t,e,i,s){return"object"!=typeof t&&(t={ text:t,type:e,expire:i,id:s}),t.id=t.id||f.uid(),t.expire=t.expire||f.expire,t}var d=null;webix.event(document,"keydown",e,{capture:!0}),webix.alert=function(){var t=c.apply(this,arguments);return t.type=t.type||"confirm",h(t)},webix.confirm=function(){var t=c.apply(this,arguments);return t.type=t.type||"alert", o(t)},webix.modalbox=function(){var t=c.apply(this,arguments);return t.type=t.type||"alert",l(t)},webix.modalbox.hide=function(t){if(t){for(;t&&t.getAttribute&&!t.getAttribute("webixbox");)t=t.parentNode;t&&t.parentNode.removeChild(t)}i(!1),d=null};var f=webix.message=function(t,e,i,s){t=u.apply(this,arguments), t.type=t.type||"info";var a=t.type.split("-")[0];switch(a){case"alert":return h(t);case"confirm":return o(t);case"modalbox":return l(t);default:return n(t)}};f.seed=(new Date).valueOf(),f.uid=function(){return f.seed++},f.expire=4e3,f.keyboard=!0,f.position="top",f.pull={},f.timers={},f.hideAll=function(){ for(var t in f.pull)f.hide(t)},f.hide=function(t){var e=f.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.style.height=0,e.className+=" hidden",f.area.removeAttribute("role"),f.timers[t]&&window.clearTimeout(f.timers[t]),delete f.pull[t])}}(),webix.protoUI({ name:"carousel",defaults:{scrollSpeed:"300ms",type:"clean",navigation:{},animate:!0},$init:function(t){this.x.className+=" webix_carousel",this.Ft=null,this.y=null,this.Mh=0,this.$ready.unshift(this.Gt),this.$ready.push(this.Mi)},addView:function(t,e){var i=this.Ft.addView(t,e);return this.bG(),i},removeView:function(t){ this.Ft.removeView(t),this.bG()},Qb:function(t,e){this.Ft.Qb(t,e),this.bG()},bG:function(){this.q=this.Ft.q,this.Ch(),this.setActiveIndex(Math.min(this.Mh,this.q.length-1))},Gt:function(){this.Ft&&this.Ft.destructor&&this.Ft.destructor();var t="";this.config.cols?(t="cols",this.mc=0):(t="rows",this.mc=1); var e={borderless:!0,type:"clean"};e[t]=webix.copy(this.s[t]);for(var i=["type","margin","marginX","marginY","padding","paddingX","paddingY"],s={},n=0;ns||s==this.Mh||(this.Mh=s,n=i.mc?this.dc:this.bc,a=-(i.mc?0:s*n),r=-(i.mc?s*n:0),this.scrollTo(a,r),this.callEvent("onShow",[i.q[this.Mh].s.id]),this.s.navigation&&this.Ch())},scrollTo:function(t,e){webix.Touch&&webix.animate.isSupported()&&this.s.animate?webix.Touch.Nf(this.w,t,e,this.s.scrollSpeed||"100ms"):(this.w.style.marginLeft=t+"px", this.w.style.marginTop=e+"px")},navigation_setter:function(t){return this.E(t,{type:"corner",buttons:!0,items:!0}),t},showNext:function(){this.Mh0&&this.setActiveIndex(this.Mh-1)},setActiveIndex:function(t){var e=this.Ft.q[t].s.id; webix.$$(e).show()},getActiveIndex:function(){return this.Mh},$getSize:function(t,e){var i=this.Ft.$getSize(0,0),s=webix.ui.view.prototype.$getSize.call(this,t,e);return this.Ft.mc?(s[0]=Math.max(s[0],i[0]),s[1]=Math.min(s[1],i[1])):(s[2]=Math.max(s[2],i[2]),s[3]=Math.min(s[3],i[3])),s},$setSize:function(t,e){ var i=this.Ft,s=i.q.length,n=webix.ui.view.prototype.$setSize.call(this,t,e),a=this.dc*(i.mc?s:1),r=this.bc*(i.mc?1:s);n?(this.w.style.height=a+"px",this.w.style.width=r+"px",i.$setSize(r,a),this.Ht()):i.$setSize(r,a)},Ht:function(){var t=this.Ft,e=this.Mh||0,i=t.mc?this.dc:this.bc,s=-(t.mc?0:e*i),n=-(t.mc?e*i:0); this.scrollTo(s,n),this.s.navigation&&this.Ch()},getActiveId:function(){var t=this.Ft.q[this.Mh];return t?t.s.id:null},setActive:function(t){webix.$$(t).show()}},webix.EventSystem,webix.NavigationButtons,webix.ui.view),webix.type(webix.ui.list,{name:"uploader",template:"#name# {common.removeIcon()}{common.percent()}
    #sizetext#
    ", percent:function(t){return"transfer"==t.status?"
    "+t.percent+"%
    ":"
    "},removeIcon:function(t){return"
    "; },on_click:{webix_remove_upload:function(t,e){webix.$$(this.config.uploader).files.remove(e)}}}),webix.UploadDriver={flash:{$render:function(t){window.swfobject||webix.require("legacy/swfobject.js",!0);var e=this.s;e.swfId=e.swfId||"webix_swf_"+webix.uid(),this.re().innerHTML+="
    ", this._r=this.re().lastChild,swfobject.embedSWF(webix.codebase+"/legacy/uploader.swf",e.swfId,"100%","100%","9",null,{uploaderId:e.id,ID:e.swfId,enableLogs:e.enableLogs?"1":"",paramName:e.inputName,multiple:e.multiple?"Y":""},{wmode:"transparent"});swfobject.getFlashPlayerVersion();webix.UE(this.x,"click",webix.bind(function(){ var t=new Date;t-(this.ds||0)>250&&this.fileDialog()},this)),this.files.attachEvent("onBeforeDelete",webix.bind(this.as,this))},$applyFlash:function(t,e){return this[t].apply(this,e)},getSwfObject:function(){return swfobject.getObjectById(this.s.swfId)},fileDialog:function(){this.getSwfObject()&&this.getSwfObject().showDialog(); },send:function(t){if("function"==typeof t&&(this.fs=t,t=0),!t){var e=this.files.data.order,i=!0;if(e.length)for(var s=0;s250&&this.fileDialog()},this)),webix.UE(this.x,"dragenter",webix.html.preventEvent),webix.UE(this.x,"dragexit",webix.html.preventEvent), webix.UE(this.x,"dragover",webix.html.preventEvent)},kF:function(t){return t.isDirectory},lF:function(t,e,i){if(t.isFile)t.file(function(t){e.addFile(t,null,null,{name:i+"/"+t.name})});else if(t.isDirectory){var s=t.createReader();s.readEntries(function(s){for(var n=0;n1024;)e++,t/=1024;return Math.round(100*t)/100+" "+webix.i18n.fileSize[e]},js:function(t,e){var i=this.files.getItem(t);webix.extend(i,e,!0),i.status="server",i.progress=100,this.callEvent("onFileUpload",[i,e]),this.callEvent("onChange",[]),this.files.updateItem(t),this.isUploaded()&&this.gs(e); },gs:function(t){this.callEvent("onUploadComplete",[t]),this.fs&&(this.fs.call(this,t),this.fs=0)},isUploaded:function(){for(var t=this.files.data.order,e=0;e
    ",a="
     
    ",r="
    ",h="
     
    "; return s=t.vertical?"
    "+r+a+h+"
    "+n:n+"
    "+a+r+h+"
    ",e.$renderInput(t,s,i)}},type_setter:function(t){this.x.className+=" webix_slider_"+t},title_setter:function(t){return"string"==typeof t?webix.template(t):t},rs:function(){return this.$view.querySelector(".webix_slider_handle"); },oe:function(){var t=this.rs(),e=this.s;if(t){var i=e.vertical?this.dc:this.Ee(e),s=e.value%e.step?Math.round(e.value/e.step)*e.step:e.value,n=e.max-e.min;s=Math.max(Math.min(s,e.max),e.min),s=e.vertical?n-(s-e.min):s-e.min;var a=Math.ceil((i-2*this.mF)*s/n),r=i-2*this.mF-a,h=e.vertical?"top":"left",o=e.vertical?"height":"width"; t.style[h]=this.mF+a-this.nF/2+"px",t.parentNode.style[o]=i+"px",r=Math.min(Math.max(r,2*this.oF),i-2*this.mF-2*this.oF),a=Math.min(Math.max(a,2*this.oF),i-2*this.mF-2*this.oF);var l=t.previousSibling;l.style[o]=r+"px";var c=l.previousSibling;c.style[o]=a+"px",this.BG(t,a,r,h)}},BG:function(t,e,i,s){ var n=this.s;if(this.s.title){var a=t.parentNode[n.vertical?"nextSibling":"previousSibling"];if(a.innerHTML=this.s.title(this.s,this),this.s.moveTitle){var r=0;if(n.vertical)r=e+2*this.oF-this.nF/2;else{var h=a.clientWidth/2,o=h>e?h-e-2*this.oF:0,l=h>i?h-i-2*this.oF-this.nF/2:0;r=this.mF+e-h+o-l}a.style[s]=r+"px"; }}},sE:function(){this.rs().setAttribute("aria-valuenow",this.s.value)},refresh:function(){var t=this.rs();t&&(this.sE(),this.s.title&&t.setAttribute("aria-label",this.s.label+" "+this.s.title(this.s,this)),this.oe())},$setValue:function(){this.refresh()},$getValue:function(){return this.s.value},$init:function(t){ webix.env.touch?this.attachEvent("onTouchStart",webix.bind(this.ss,this)):webix.UE(this.x,"mousedown",webix.bind(this.ss,this)),webix.UE(this.$view,"keydown",webix.bind(this.tE,this)),t.vertical&&(t.height=t.height||webix.skin.$active.vSliderHeight,this.x.className+=" webix_slider_vertical",this.mF=webix.skin.$active.vSliderPadding); },$skin:function(){this.nF=webix.skin.$active.sliderHandleWidth,this.mF=webix.skin.$active.sliderPadding,this.oF=webix.skin.$active.sliderBorder},tE:function(t){var e=t.keyCode,i=this.s,s=i.value;if(e>32&&41>e){webix.html.preventEvent(t);var n=t.target||t.srcElement,a=/webix_slider_handle_(\d)/.exec(n.className); if(this.My=a?parseInt(a[1],10):-1,a&&(s=i.value[this.My]),s=si.max?i.max:s,35===e)s=i.min;else if(36===e)s=i.max;else{var r=37===e||40===e||34===e?-1:1;(33===e||34===e||i.step>1)&&(r*=i.step),s=1*s+r}if(a){var h=i.value[this.My?0:1];s=this.My&&h>=s||!this.My&&s>=h?h:s}if(s>=i.min&&s<=i.max){ if(a){for(var o=[],l=0;l 
    "; n+="
     
    ";var a="
    "; t.moveTitle&&(a="
    "+(a+a)+"
    ");var r="
     
    ",h="";return h=t.vertical?"
    "+r+n+"
    "+a:a+"
    "+r+n+"
    ",e.$renderInput(t,h,i); }},value_setter:function(t){return webix.isArray(t)||(t=t.toString().split(this.s.separator)),t.length<2&&(t[1]=t[0]),t[0]=parseFloat(t[0]),t[1]=parseFloat(t[1]),t},rs:function(t){return t=t&&t>=0?t:0,this.$view.querySelector(".webix_slider_handle_"+(t||0))},Ly:function(t,e){var i,s,n;return i=this.s, s=i.max-i.min,n=i.value[e]%i.step?Math.round(i.value[e]/i.step)*i.step:i.value[e],n=Math.max(Math.min(n,i.max),i.min),Math.ceil((t-2*this.mF)*(n-i.min)/s)},vH:function(t,e,i){var s=this.mF+e-this.nF/2*(i?-1:1);return s=i?t-s:s,s+"px"},wH:function(t,e,i,s){var n=e+this.mF+2*this.oF;return s&&(n=t-n-i), n+"px"},oe:function(){var t,e,i,s,n,a,r,h,o,l,c;e=this.rs(0),i=this.rs(1),t=this.s,webix.isArray(t.value)||this.define("value",t.value),e&&(o=t.vertical?"height":"width",c=t.vertical?"top":"left",l=t.vertical?this.dc:this.Ee(t),a=l-2*this.mF-2*this.oF,s=this.Ly(l,0),n=this.Ly(l,1),r=n-s,e.style[c]=this.vH(l,s,t.vertical), i.style[c]=this.vH(l,n,t.vertical),h=e.parentNode,h.style[o]=l+"px",h.firstChild.style[o]=a+"px",h.childNodes[1].style[o]=r+"px",h.childNodes[1].style[c]=this.wH(l,s,r,t.vertical),this.BG(e,[s,n],a,c))},xH:0,yH:function(t,e){webix.isUndefined(this.xH)||(t[this.xH].style.visibility="visible"),webix.isUndefined(e)||(t[e].style.visibility="hidden", this.xH=e)},BG:function(t,e,i,s){var n=this.s;if(this.s.title){var a=t.parentNode,r=n.vertical?"nextSibling":"previousSibling";if(n.moveTitle){for(var h=a[r].childNodes,o=[],l=0;2>l;l++)o.push(this.zH(h[l],n.value[l],e[l],i,s,l));var c=n.vertical?o[0]-o[1]-this.nF:o[1]-o[0],u=n.vertical?"clientHeight":"clientWidth"; h[0][u]/2+h[1][u]/2>c?this.yH(h,webix.isUndefined(this.My)?0:this.My?0:1):this.yH(h);for(var l=0;2>l;l++)h[l].style[s]=o[l]+"px"}else a[r].innerHTML=this.s.title(this.s,this)}},zH:function(t,e,i,s,n,a){t.innerHTML=this.s.title({value:e},this);var r=t.clientWidth/2,h=0;return this.s.vertical?h=s-i-this.nF/2-(a?this.mF+this.config.inputPadding:0)+2*this.oF:(h=i+this.nF/2+2*this.oF-r, h=!a&&r>i?r-i+h:h,h=a&&r+i>s?h-r+(s-i):h),h},sE:function(){for(var t=0;2>t;t++)this.rs(t).setAttribute("aria-valuenow",this.s.value[t])},Ky:function(t){var e=t.target||t.srcElement,i=/webix_slider_handle_(\d)/.exec(e.className);this.My=i?parseInt(i[1],10):-1,i&&this.Ny(this.My)},setValue:function(t){ var e=this.s.value,i="object"==typeof t?t.join(this.s.separator):t;return e.join(this.s.separator)==i?!1:(this.s.value=t,this.se&&this.$setValue(t),void this.callEvent("onChange",[t,e]))},$getValue:function(){var t=this.s.value;return this.s.stringResult?t.join(this.s.separator):t},Ny:function(t){var e=this.rs(t),i=this.rs(1-t); -1==e.className.indexOf("webix_slider_active")&&(e.className+=" webix_slider_active"),i.className=i.className.replace(" webix_slider_active","")},ys:function(t){var e=this.s,i=e.value,s=e.max-e.min,n=e.vertical?"y":"x",a=webix.html.offset(this.rs().parentNode)[n],r=Math.ceil((t-a)*s/(e.vertical?this.dc:this.Ee(e))); r=Math.round((r+e.min)/e.step)*e.step,e.vertical&&(r=s-r);var h=null,o=webix.html.offset(this.rs(0))[n],l=webix.html.offset(this.rs(1))[n];if(o!=l||e.value[0]!=e.min&&e.value[0]!=e.max)if(this.My>=0)h=this.My;else if(o==l)h=o>t?0:1;else{var c=Math.abs(o-t),u=Math.abs(l-t);h=u>c?0:1,this.My=h}else h=e.value[0]==e.min?1:0, this.Ny(h);return h?i[h]=Math.max(Math.min(r,e.max),i[0]):i[h]=Math.max(Math.min(r,i[1]),e.min),i}},webix.ui.slider),webix.proxy.offline={$proxy:!0,storage:webix.storage.local,cache:!1,data:"",zs:function(){this.cache||webix.env.offline||(webix.callEvent("onOfflineMode",[]),webix.env.offline=!0)},As:function(){ !this.cache&&webix.env.offline&&(webix.env.offline=!1,webix.callEvent("onOnlineMode",[]))},load:function(t,e){var i={error:function(){var i=this.getCache()||this.data,s={responseText:i},n=webix.ajax.prototype.J(s);this.zs(),webix.ajax.$callback(t,e,i,n,s)},success:function(i,s,n){this.As(),webix.ajax.$callback(t,e,i,s,n), this.setCache(i)}};this.cache&&this.getCache()?i.error.call(this):this.source.$proxy?this.source.load(this,i):webix.ajax(this.source,i,this)},getCache:function(){return this.storage.get(this.Bs())},clearCache:function(){this.storage.remove(this.Bs())},setCache:function(t){this.storage.put(this.Bs(),t); },Bs:function(){return this.source.$proxy?this.source.source+"_$proxy$_data":this.source+"_$proxy$_data"},save:function(t,e,i,s){webix.env.offline||(this.source.$proxy?this.source.save(t,e,i,s):webix.ajax().post(this.source,e.data,s))},saveAll:function(t,e,i,s){this.setCache(t.serialize()),webix.env.offline&&webix.ajax.$callback(t,s,"",e); },result:function(t,e,i,s,n){for(var a=0;a
    "),this.setPosition||(this.x.style.position="relative"),webix.html.insertBefore(this.cu,this.x.firstChild,this.x), this.x.setAttribute("aria-busy","true"),!webix.Touch.$active&&this.getScrollState){var i=this.getScrollState();this.x.scrollWidth!=this.$width&&(this.cu.style.left=i.x+"px"),this.x.scrollHeight!=this.$height&&("bottom"!=t.type?this.cu.style.top=i.y+"px":this.cu.style.top=i.y+this.$height-this.cu.offsetHeight+"px"); }this.du=1}t&&"icon"!=t.type?webix.delay(function(){if(this.cu){var e=t.position||1;if(this.cu.style[webix.env.transitionDuration]===webix.undefined&&t.delay){var i=0,s=0,n=e/t.delay*30,a=this;this.Oy&&(window.clearInterval(this.Oy),s=this.cu.firstChild.offsetWidth/this.cu.offsetWidth*100),this.Oy=window.setInterval(function(){ 30*i==t.delay?window.clearInterval(a.Oy):(a.cu&&a.cu.firstChild&&(a.cu.firstChild.style.width=s+i*n*e*100+"%"),i++)},30)}else this.cu.firstChild.style.width=100*e+"%",t.delay&&(this.cu.firstChild.style[webix.env.transitionDuration]=t.delay+"ms");t.hide&&webix.delay(this.hideProgress,this,[1],t.delay); }this.du=0},this):t&&"icon"==t.type&&t.hide&&webix.delay(this.hideProgress,this,[1],t.delay)},hideProgress:function(t){this.du&&(t=!0),this.cu&&(t?(this.Oy&&window.clearInterval(this.Oy),webix.html.remove(this.cu),this.cu=null,this.x.removeAttribute("aria-busy")):this.showProgress({position:1.1,delay:300, hide:!0}))}},webix.protoUI({name:"multitext",$cssName:"text",defaults:{icon:"plus-circle",iconWidth:25,separator:", "},getValueHere:function(){return webix.ui.text.prototype.getValue.call(this)},setValueHere:function(t){return webix.ui.text.prototype.$setValue.call(this,t)},getValue:function(){if("extra"==this.config.mode)return this.getValueHere(); if(this.rH)return this.rH;for(var t=[this.getValueHere(this)],e=0;e=0;i--){var s=e.eu[i];t&&s!=t||(e.eu.removeAt(i), this.getParentView().removeView(s),e.callEvent("onSectionRemove",[s,i+1]))}},on_click:{webix_input_icon:function(t,e,i){if("extra"==this.config.mode){this.removeSection(this.config.id);var s=this.getParentView().getChildViews();s[s.length-1].focus(),this.yB()}else webix.$$(this.addSection()).focus();return!1; }},$init:function(){this.eu=webix.toArray([]),this.attachEvent("onKeyPress",this.DD)},$render:function(t){this.$setValue(t.value)}},webix.ui.text),webix.protoUI({name:"organogram",defaults:{scroll:"auto",ariaLabel:"lines"},$init:function(){this.x.className+=" webix_organogram",this.v=document.createElement("DIV"), this.$ready.push(this.Av),webix.extend(this.data,webix.TreeStore,!0),this.data.provideApi(this,!0)},ad:"webix_dg_id",on_click:{webix_organogram_item:function(t,e){this.s.select&&("multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,t.ctrlKey||t.metaKey||"touch"==this.s.multiselect,t.shiftKey):this.select(e), this.Qh=!1)}},on_context:{},on_dblclick:{},Av:function(){this.y.style.position="relative",this.data.attachEvent("onStoreUpdated",webix.bind(this.render,this))},pg:function(t){var e=this.data.Me[t.id];return this.callEvent("onItemRender",[t]),this.type.templateStart.call(this,t,this.type,e)+(t.$template?this.type["template"+t.$template].call(this,t,this.type,e):this.type.template.call(this,t,this.type,e))+this.type.templateEnd.call(this); },jb:function(t){var e=this.pg(t);return this.data.branch[t.id]&&(e+=this._x(t.id)),e},LA:function(){return this.type.listMarginX||this.type.listMarginY},_x:function(t,e){var i,s,n,a,r="",h=this.data.branch[t],o=this.data.Me[t],l=this.getItem(t),c=l?l.$type:!1;if(e=e||0,"list"===c&&(e+=this.type.listMarginX), t||(this.ay=[],this.$xy={},a=this.$width-2*this.type.padding,this.$xy[0]={totalWidth:a,start:this.type.padding,width:0,height:0,left:a/2,top:this.type.padding||0}),h){n=this.$xy[t],"list"!=c||this.LA()||(r+=this.type.templateListStart.call(this,l,this.type,o));var u=0,d=0;for(i=0;ie&&!s?webix.ui.scrollSize:0)),s&&(e=this.y.offsetHeight+(this.y.offsetWidth>t&&!i?webix.ui.scrollSize:0)), webix.ui.view.prototype.$getSize.call(this,t,e)},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&(this.y.style.width=this.$width+"px",this.y.style.height=this.$height+"px",this.render())},type:{width:120,height:"auto",padding:20,marginX:20,marginY:20,listMarginX:0,listMarginY:0, lineColor:"#90caf9",classname:function(t,e,i){var s="webix_organogram_item ";return t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css),i&&i.list_item&&(s+=" webix_organogram_list_item "),i&&i.$css&&(s+=i.$css),s+=" webix_organogram_level_"+t.$level},listClassName:function(t){ var e="webix_organogram_list webix_organogram_list_"+t.$level;return t.$listCss&&("object"==typeof t.$listCss&&(t.$listCss=webix.html.createCss(t.$listCss)),e+=" "+t.$listCss),e},template:webix.template("#value#"),templateStart:function(t,e,i){var s="";if((!i||!i.list_item||e.listMarginX||e.listMarginY)&&this.$xy){ var n=this.$xy[t.id];s+="width: "+n.width+"px; height: "+n.height+"px;",s+="top: "+n.top+"px; left: "+n.left+"px;"}return'
    '},templateEnd:webix.template("
    "),templateListStart:function(t,e,i){var s="";if(this.$xy){ var n=this.$xy[t.id];s+="width: "+n.width+"px;",s+="top: "+(n.top+n.height+e.marginY)+"px; left: "+n.left+"px;"}return'
    '},templateListEnd:webix.template("
    ")}},webix.AutoTooltip,webix.Group,webix.TreeAPI,webix.DataMarks,webix.SelectionModel,webix.MouseEvents,webix.Scrollable,webix.RenderStack,webix.TreeDataLoader,webix.DataLoader,webix.ui.view,webix.EventSystem), webix.protoUI({name:"barcode",defaults:{type:"ean13",height:160,width:220,paddingY:10,paddingX:20,textHeight:20,color:"#000",ariaLabel:"bars"},$init:function(){this.$view.className+=" webix_barcode",this.types||(this.types={"default":this.type},this.type.name="default")},type:{},render:function(){this.isVisible(this.s.id)&&(this.canvas&&this.canvas.clearCanvas(!0), this.$view.innerHTML="",this.fy())},fy:function(){this.canvas=new webix.Canvas({container:this.$view,name:this.name,title:this.s.ariaLabel,width:this.$width,height:this.$height}),this.hy()},hy:function(){var t,e,i,s,n=this.s.value,a=this.s.type;if(!a||!this.types[a]||!n)return!1;if(t=this.type.encode(n), s=t.length,e=this.canvas.getCanvas(),s){var r=(this.$width-2*this.config.paddingX)/s,h=0;for(i=0;s>i;i++){var o=parseInt(t.charAt(i),10);o?(h++,i==s-1&&this.bp(e,i+1,r,h,s)):h&&(this.bp(e,i,r,h,s),h=0)}this.iy(n,r)}},bp:function(t,e,i,s,n){var a,r,h,o;r=parseInt(e*i+this.config.paddingX,10),a=parseInt(r-s*i,10), h=this.config.paddingY,o=this.$height-this.config.paddingY-this.config.textHeight,this.jy()&&(4>e||e>n-4||n/2+2>e&&e>n/2-2)&&(o+=this.config.textHeight/2),t.fillStyle=this.config.color,t.beginPath(),t.moveTo(a,h),t.lineTo(r,h),t.lineTo(r,o),t.lineTo(a,o),t.lineTo(a,h),t.fill()},iy:function(t,e){var i,s,n; if(this.type.template&&(t=this.type.template(t)),this.jy()){if(this.type.firstDigit&&(this.canvas.renderTextAt(!0,"left",this.config.paddingX,this.$height-this.config.paddingY,t.charAt(0)),t=t.slice(1)),s=t.length,this.type.lastDigit&&s--,s){var a=(this.$width-2*this.config.paddingX-11*e)/s;for(i=0;s>i;i++)n=this.config.paddingX+i*a+(s/2>i?3:8)*e+a/2, this.canvas.renderTextAt(!0,!0,n,this.$height-this.config.paddingY,t.charAt(i));this.type.lastDigit&&(n=this.config.paddingX+s*a+11*e,this.canvas.renderTextAt(!0,!1,n,this.$height-this.config.paddingY,t.charAt(s)))}}else this.canvas.renderTextAt(!0,!0,this.$width/2,this.$height-this.config.paddingY,t); },setValue:function(t){return this.s.value=t,this.render(),t},getValue:function(){var t=this.s.value;return this.type.template?this.type.template(t):t},type_setter:function(t){return this.types[t]?(this.type=webix.clone(this.types[t]),this.type.css&&(this.w.className+=" "+this.type.css)):this.customize(t), t},jy:function(){var t=this.config.type;return 0===t.indexOf("ean")||-1!=t.indexOf("upcA")},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()}},webix.ui.view),webix.type(webix.ui.barcode,{name:"ean8",encodings:[["0001101","1110010"],["0011001","1100110"],["0010011","1101100"],["0111101","1000010"],["0100011","1011100"],["0110001","1001110"],["0101111","1010000"],["0111011","1000100"],["0110111","1001000"],["0001011","1110100"]], encode:function(t){var e,i;if(t=t.replace(/[^0-9]/g,"").substring(0,7),7!=t.length)return"";for(t+=this.checksum(t),e="101",i=0;4>i;i++)e+=this.encodings[parseInt(t.charAt(i),10)][0];for(e+="01010",i=4;8>i;i++)e+=this.encodings[parseInt(t.charAt(i),10)][1];return e+="101"},template:function(t){return t.replace(/[^0-9]/g,"").substring(0,7)+this.checksum(t); },checksum:function(t){t=t.substring(0,7);var e,i=!0,s=0;for(e=0;7>e;e++)s+=(i?3:1)*parseInt(t.charAt(e),10),i=!i;return((10-s%10)%10).toString()}}),webix.type(webix.ui.barcode,{name:"ean13",firstDigit:!0,encodings:[["0001101","0100111","1110010","000000"],["0011001","0110011","1100110","001011"],["0010011","0011011","1101100","001101"],["0111101","0100001","1000010","001110"],["0100011","0011101","1011100","010011"],["0110001","0111001","1001110","011001"],["0101111","0000101","1010000","011100"],["0111011","0010001","1000100","010101"],["0110111","0001001","1001000","010110"],["0001011","0010111","1110100","011010"]], encode:function(t){var e,i,s;if(t=t.replace(/[^0-9]/g,"").substring(0,12),12!=t.length)return"";for(t+=this.checksum(t),e="101",i=this.encodings[parseInt(t.charAt(0),10)][3],s=1;7>s;s++)e+=this.encodings[parseInt(t.charAt(s),10)][parseInt(i.charAt(s-1),10)];for(e+="01010",s=7;13>s;s++)e+=this.encodings[parseInt(t.charAt(s),10)][2]; return e+="101"},template:function(t){return t.replace(/[^0-9]/g,"").substring(0,12)+this.checksum(t)},checksum:function(t){var e,i=!1,s=0;for(t=t.substring(0,12),e=0;12>e;e++)s+=(i?3:1)*parseInt(t.charAt(e),10),i=!i;return((10-s%10)%10).toString()}}),webix.type(webix.ui.barcode,{name:"upcA",firstDigit:!0, lastDigit:!0,encode:function(t){return t.length<12&&(t="0"+t),webix.ui.barcode.prototype.types.ean13.encode(t)},template:function(t){return t.replace(/[^0-9]/g,"").substring(0,11)+this.checksum(t)},checksum:function(t){return t.length<12&&(t="0"+t),webix.ui.barcode.prototype.types.ean13.checksum(t)}}), webix.protoUI({name:"abslayout",$init:function(){this.$view.className+=" webix_abslayout",delete this.rows_setter,delete this.cols_setter,this.nc=[]},cells_setter:function(t){this.nc=t},kc:function(){webix.ui.baselayout.prototype.kc.call(this,this.nc)},$getSize:function(t,e){for(var i=webix.ui.baseview.prototype.$getSize.call(this,0,0),s=null,n=0;n=1e5&&(i[1]=0),i[3]>=1e5&&(i[3]=0),i[0]=Math.max(i[0],s[0]),i[1]=Math.max(i[1],s[1]),i[2]=Math.max(i[2],s[2]),i[3]=Math.max(i[3],s[3])),i},$setSize:function(t,e){this.lc=[t,e],webix.ui.baseview.prototype.$setSize.call(this,t,e),this.rc(t,e)},rc:function(t,e){for(var i=0;ia;a++)this.sC(this.q[n*s+a],e);else{ for(var r=this.nc=[],h=this.data.order,a=0;ao;o++)r.push(webix.copy(this.cC[o]));else r.push(this.getItem(h[a]));if(r.length||r.push({}),this.reconstruct(),s)for(var a=0;ao;o++){var c=this.q[a*s+o];this.sC(c,l)}}}},webix.DataLoader,webix.ui.layout), webix.protoUI({$init:function(){webix.extend(this,webix.FlexLayout,!0)},name:"flexdatalayout"},webix.ui.datalayout),webix.protoUI({name:"gridlayout",defaults:{autoplace:!0,gridColumns:2,gridRows:2,margin:10,padding:10},gridRows_setter:function(t){return this.WG=t},kc:function(){for(var t=0;t0&&(t.dx-=n)},Qb:function(t,e){this.XG(t.config),this.q.push(t),this.$view.appendChild(t.x),this.$G(t.config,t.config.id),this.pH(!0),this._G||this.callEvent("onChange",[])},ZG:function(t,e,i,s,n){for(var a=e;s>a;a++)for(var r=i;n>r;r++)if(!t[a]||t[a][r])return!1; return!0},aH:function(t,e,i){for(var s=0;s=0;s--)if(this.ZG(t,s,i.y,s+i.dx,i.y+i.dy))return i.x-s; return 0},dH:function(t,e,i){for(var s=e.y-i.dy;s>=0;s--)if(this.ZG(t,i.x,s,i.x+i.dx,s+i.dy))return i.y-s;return 0},YG:function(t){for(var e=[],i=0;i=0;n--){for(var a=t-1;a>=0;a--)if(i[a][n])continue t;s=!0;for(var r=0;r=n&&(h.y-=1)}}return s},$G:function(t,e){if(t.x-=Math.max(0,t.x+t.dx-this.s.gridColumns), !this.s.autoplace)return void(t.y-=Math.max(0,t.y+t.dy-this.s.gridRows));for(var i=[],s=this.YG(e),n=0;nt.y&&a.xt.x&&i.push(a)}for(var r=[],n=0;n=0;s--)i[this.q[s].config.id]||(this.q[s].destructor(),this.q.splice(s,1));this.eH(),this._G=!1},$getSize:function(t,e){for(var i=webix.ui.baseview.prototype.$getSize.call(this,0,0),s=0;s");e!=this&&(e.$view.style.position="relative"),e.$view.appendChild(i); }},body_setter:function(t){return this.rows_setter(webix.isArray(t)?t:[t])},$resizeEnd:function(t){var e=this.getParentView();if(e&&e.jH){var i=e.jH(t.x,t.y),s=(this.s,Math.max(i.x,1)),n=Math.max(i.y,1);e.moveView(this.s.id,{dx:s,dy:n})}},$resizeMove:function(t){var e=this.getParentView();if(e&&e.jH){ var i=e.jH(t.x,t.y);t.x=i.width*i.x+i.margin*(i.x-1),t.y=i.height*i.y+i.margin*(i.y-1)}}},webix.ui.layout,webix.ResizeArea),webix.protoUI({name:"video",$init:function(t){t.id||(t.id=webix.uid()),this.$ready.push(this.Ms)},Ms:function(){var t=this.s;if(this.w=webix.html.create("video",{"class":"webix_view_video", style:"width:100%;height:100%;",autobuffer:"autobuffer"},""),t.poster&&(this.w.poster=t.poster),t.src){"object"!=typeof t.src&&(t.src=[t.src]);for(var e=0;e'}t.controls&&(this.w.controls=!0),t.autoplay&&(this.w.autoplay=!0),this.x.appendChild(this.w); },getVideo:function(){return this.w},defaults:{src:"",controls:!0}},webix.ui.view),webix.protoUI({name:"sidemenu",defaults:{animate:!0,position:"left",width:200,borderless:!0},$init:function(){this.$view.className+=" webix_sidemenu"},$skin:function(){this.defaults.padding=0},position_setter:function(t){ var e=this.s.position;return e&&webix.html.removeCss(this.$view," webix_sidemenu_"+e),webix.html.addCss(this.$view," webix_sidemenu_"+t),t},$getSize:function(){var t=webix.ui.window.prototype.$getSize.apply(this,arguments);return this.MA=t,t},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e), t=this.bc-2*this.s.padding,e=this.dc-2*this.s.padding,this.w.style.padding=this.s.padding+"px",this.bd.style.display="none",this.ed.style.height=e+"px",this.gd.$setSize(t,e)},show:function(){return this.callEvent("onBeforeShow",arguments)?(this.s.hidden=!1,this.x.style.zIndex=this.s.zIndex||webix.ui.zIndex(), (this.s.modal||this.my)&&(this.Md(!0),this.my=null),this.x.style.display="block",this.Qd(),this.s.position&&this.Td(),this.Ww=1,webix.delay(function(){this.Ww=0},this,[],webix.env.touch?400:100),this.config.autofocus&&(this.Vd=webix.UIManager.getFocus(),webix.UIManager.setFocus(this)),-1==webix.ui.et.find(this)&&webix.ui.et.push(this), void this.callEvent("onShow",[])):!1},Td:function(t){var e,i,s,n,a,r=0,h=0,o={};this.$view.style.position="fixed",s=window.innerWidth||document.documentElement.offsetWidth,n=window.innerHeight||document.documentElement.offsetHeight,e=this.MA[0]||s,i=this.MA[2]||n,a=this.s.position,"top"==a?e=s:"right"==a?(i=n, r=s-e):"bottom"==a?(e=s,h=n-i):i=n,o={left:r,top:h,width:e,height:i,maxWidth:s,maxHeight:n},"function"==typeof this.s.state&&this.s.state.call(this,o),this.NA=o,this.$setSize(o.width,o.height),"undefined"==typeof t&&this.OA()?(webix.html.removeCss(this.$view,"webix_animate",!0),this.Qf[this.s.position].beforeShow.call(this,o), webix.delay(function(){webix.html.addCss(this.$view,"webix_animate",!0)},this,null,1),webix.delay(function(){this.Qf[this.s.position].show.call(this,o)},this,null,10)):("right"===this.s.position&&(o.left=o.right?s-o.width-o.right:s-o.width),this.setPosition(o.left,o.top))},OA:function(){return webix.animate.isSupported()&&this.s.animate&&!(webix.env.isIE&&-1!=navigator.appVersion.indexOf("MSIE 9")); },hidden_setter:function(t){return t?this.hide(!0):this.show(),!!t},Qf:{left:{beforeShow:function(t){this.$view.style.left=-t.width+"px",this.$view.style.top=t.top+"px"},show:function(t){this.$view.style.left=t.left?t.left+"px":"0px"},hide:function(t){this.$view.style.left=-t.width+"px"}},right:{beforeShow:function(t){ this.$view.style.left="auto",this.$view.style.right=-t.width+"px",this.$view.style.top=t.top+"px"},show:function(t){this.$view.style.right=t.right?t.right+"px":"0px"},hide:function(t){this.$view.style.right=-t.width+"px"}},top:{beforeShow:function(t){this.setPosition(t.left,t.top),this.$view.style.height="0px", this.ed.style.height="0px"},show:function(t){this.$view.style.height=t.height+"px",this.ed.style.height=t.height+"px"},hide:function(){this.$view.style.height="0px",this.ed.style.height="0px"}},bottom:{beforeShow:function(t){this.$view.style.left=t.left+"px",this.$view.style.top="auto";var e=t.bottom!=webix.undefined?t.bottom:t.maxHeight-t.top-t.height; this.$view.style.bottom=e+"px",this.$view.style.height="0px"},show:function(t){this.$view.style.height=t.height+"px"},hide:function(){this.$view.style.height="0px"}}},hide:function(t){if(!this.$destructed){this.s.modal&&this.Md(!1);var e=window.innerWidth||document.documentElement.offsetWidth,i=window.innerHeight||document.documentElement.offsetHeight; if(!t&&this.OA()&&e==this.NA.maxWidth&&i==this.NA.maxHeight){this.Qf[this.s.position].hide.call(this,this.NA);var s=webix.event(this.$view,webix.env.transitionEnd,webix.bind(function(t){this.Wd(),webix.eventRemove(s)},this))}else this.Wd();if(this.s.autofocus){var n=document.activeElement;n&&this.x&&this.x.contains(n)&&(webix.UIManager.setFocus(this.Vd), this.Vd=null)}this.ny()}}},webix.ui.popup),webix.protoUI({name:"sidebar",defaults:{titleHeight:40,type:"sideBar",activeTitle:!0,select:!0,scroll:!1,collapsed:!1,collapsedWidth:41,position:"left",width:250,mouseEventDelay:10},$init:function(t){this.$ready.push(this.AH),this.$ready.push(this.BH),this.data.qf=function(t){ t.data&&(t.menu=webix.copy(t.data))}},on_context:{},on_mouse_move:{},AH:function(){this.CH=this.config.width,this.attachEvent("onBeforeOpen",function(t){if(!this.config.multipleOpen)for(var e=this.getOpenItems(),i=0;i
    ':""; return e+t.value},r={view:"popup",css:"webix_sidebar_popup "+s,autofit:!1,width:this.CH-this.config.collapsedWidth,borderless:!0,padding:0,body:{rows:[{view:"template",borderless:!0,css:"webix_sidebar_popup_title",template:"#value#",height:this.config.titleHeight+2,onClick:{webix_template:function(){ var t=this.masterId;e.getItem(t).$count||e.select(t)}}},{view:"menu",submenu:"data",layout:"y",subMenuPos:n,select:!0,borderless:!0,autoheight:!0,css:"webix_sidebar_popup_list "+s,template:a,type:{subsign:!1},submenuConfig:{padding:0,subMenuPos:n,template:a,select:!0,type:{subsign:!1},css:"webix_sidebar_popup_list "+s, on:{onShow:function(){this.clearCss("webix_sidebar_selected"),this.unselectAll();var t=e.getSelectedId();t&&this.exists(t)?this.select(t):t&&e.EH(this,t)},onBeforeSelect:function(t){return this.getSubMenu(t)?!1:void 0},onAfterSelect:function(t){for(var i=e.getPopup().queryView({view:"menu"}),s=e.getParentId(t);s;){ var n=i.getMenu(s);n&&(n.unselectAll(),e.EH(n,t)),s=e.getParentId(s)}e.EH(this,t)}}},on:{onBeforeSelect:function(t){return this.getSubMenu(t)?!1:void 0},onMenuItemClick:function(t){this.getSubMenu(t)||e.select(t)}}}]}};webix.extend(r,i.popup||{},!0),t=webix.ui(r),t.FH=function(t){e&&e.getParentId(t)==this.masterId&&webix.html.addCss(this.$view,"webix_sidebar_selected",!0), e.config.collapsed&&1==e.getItem(t).$level&&webix.html.addCss(this.$view,"webix_selected",!0)},t.queryView({view:"menu"}).uH=!0}t.attachEvent("onBeforeShow",function(){return i.collapsed}),this.Ns=[t],i.popupId=t.config.id,webix.UE(document.body,"mousemove",function(e){var i=e.target||e.srcElement;t.config.hidden||t.$view.contains(i)||this.$view.firstChild.contains(i)||t.queryView({ view:"menu"}).dr||t.hide()},{bind:this})},EH:function(t,e,i){var s="webix_sidebar_selected";t.data.each(function(n){!this.IH(e,n.id)||i&&"0"!=this.getParentId(n.id)?t.hasCss(n.id,s)&&t.removeCss(n.id,s):t.addCss(n.id,s)},this)},IH:function(t,e){var i=this.getParentId(t);return e==i?!0:i?this.IH(i,e):!1; },getPopup:function(){return webix.$$(this.config.popupId)},position_setter:function(t){var e=t,i="left"==t?"right":"left";webix.html.removeCss(this.$view,"webix_sidebar_"+i),webix.html.addCss(this.$view,"webix_sidebar_"+e,!0);var s=this.getPopup();if(s){var n=s.$view;webix.html.removeCss(n,"webix_sidebar_popup_"+i), webix.html.addCss(n,"webix_sidebar_popup_"+e,!0)}return t},collapse:function(){this.define("collapsed",!0)},expand:function(){this.define("collapsed",!1)},toggle:function(){var t=!this.config.collapsed;this.define("collapsed",t)},collapsed_setter:function(t){var e;return t?(e=this.config.collapsedWidth, this.closeAll(),this.type.collapsed=!0,webix.html.removeCss(this.$view,"webix_sidebar_expanded")):(e=this.CH,this.type.collapsed=!1,webix.html.addCss(this.$view,"webix_sidebar_expanded",!0)),this.define("width",e),this.resize(),t}},webix.ui.tree),webix.type(webix.ui.tree,{name:"sideBar",height:"auto", css:"webix_sidebar",template:function(t,e){return e.collapsed?e.icon(t,e):e.arrow(t,e)+e.icon(t,e)+""+t.value+""},arrow:function(t,e){for(var i="",s=1;s<=t.$level;s++)if(s==t.$level&&t.$count){var n="webix_sidebar_dir_icon webix_icon "+webix.skin.icon+"angle-"+(t.open?"down":"left");i+=""; }return i},icon:function(t,e){var i="";return t.$level>2&&(i='style="padding-left:'+40*(t.$level-2)+'px"'),t.icon?"":""}}),function(){var t=webix.CustomScroll={scrollStep:40,init:function(){this.ze(), webix.env.$customScroll=!0,webix.ui.scrollSize=0,webix.destructors.push({obj:{destructor:function(){this.gu=null}}}),webix.attachEvent("onReconstruct",t.hu),webix.attachEvent("onResize",t.hu),webix.attachEvent("onClick",t.hu)},resize:function(){this.hu()},mk:function(e){e.Vf.iu=e.s.id,e.attachEvent("onAfterRender",function(){ var e=t.ju(this),i=Math.max(e.dy-e.py,0),s=Math.max(e.dx-e.px,0);this.Wj&&this.jk>i?this.Wj.scrollTo(i):this.Zj&&this.bk>s&&this.Zj.scrollTo(s),t.gu==this.Vf&&t.hu()}),webix.UE(e.Vf,"mouseover",t.ku),webix.UE(e.Vf,"mouseout",t.lu)},enable:function(e,i){if(t.ze(),e.mapCells)return this.mk(e);var s=e;e.y&&(s=e.y.parentNode), s.mu=i||"xy",webix.UE(s,"mouseover",t.ku),webix.UE(s,"mouseout",t.lu),webix.UE(s,"mousewheel",t.nu),webix.UE(s,"DOMMouseScroll",t.nu),this.wE(e)},hu:function(){var e=t.gu;e&&e.ou&&(t.pu.call(e),t.ku.call(e))},ze:function(e){webix.event(document.body,"mousemove",function(e){t.qu&&t.ru(t.qu,t.qu.su,webix.html.pos(e)); }),t.ze=function(){}},ku:function(e){if(t.gu=this,clearTimeout(this.tu),!this.ou&&!t.qu){var i=webix.$$(e);if(!i||i.isEnabled()){var s;if(this.iu){var i=webix.$$(this.iu);if(!i)return;s=t.ju(i)}else s={dx:this.scrollWidth,dy:this.scrollHeight,px:this.clientWidth,py:this.clientHeight},s.ec=s.dx>s.px&&-1!=this.mu.indexOf("x"), s.cc=s.dy>s.py&&-1!=this.mu.indexOf("y");this.ou=s,s.ec&&(s.uu=t.Om(this,"x",s.dx,s.px,"width","height"),s.vu=s.px-s.uu.offsetWidth-4,s.wu=s.dx-s.px,t.trackBar&&(s.wA=t.xA(this,"x"))),s.cc&&(s.xu=t.Om(this,"y",s.dy,s.py,"height","width"),s.yu=s.py-s.xu.offsetHeight-4,s.zu=s.dy-s.py,t.trackBar&&(s.yA=t.xA(this,"y"))), t.sk(this)}}},xA:function(t,e){var i=webix.html.create("DIV",{webixignore:"1","class":"webix_c_scroll_bar_"+e},"");return t.appendChild(i),i},ru:function(e,i,s){var n=e.ou,a=e.iu;if(a&&(a=webix.$$(a)),n.uu==e.Au){var r=(s.x-i.x)*n.wu/n.vu;a?a.Zj.scrollTo(a.bk+r):t.Bu(e,"scrollLeft",r)}if(n.xu==e.Au){ var r=(s.y-i.y)*n.zu/n.yu;a?a.Wj.scrollTo(a.jk+r):t.Bu(e,"scrollTop",r)}e.su=s,t.sk(e)},ju:function(t){var e={};return t.Zj&&t.s.scrollX&&(e.dx=t.Zj.getSize(),e.px=t.Zj.Si||1,e.ec=e.dx-e.px>1),t.Wj&&t.s.scrollY&&(e.dy=t.Wj.getSize(),e.py=t.Wj.Si||1,e.cc=e.dy-e.py>1),e},lu:function(){clearTimeout(this.tu), this.tu=webix.delay(t.pu,this,[],200)},Cu:function(t){t&&(webix.html.remove(t),t.Du&&(webix.eventRemove(t.Du),webix.eventRemove(t.Eu)))},pu:function(){if(this.ou){if(this.Au)return void(this.Fu=!0);var e=this.ou;t.Cu(e.uu),t.Cu(e.xu),webix.html.removeCss(document.body,"webix_noselect"),e.wA&&webix.html.remove(e.wA), e.yA&&webix.html.remove(e.yA),this.ou=null}},nu:function(e){var i=this.ou,s=e.wheelDelta/-40,n=!0;if(!s&&e.detail&&webix.isUndefined(e.wheelDelta)&&(s=e.detail),i)if(i.uu&&(e.wheelDeltaX||s&&!i.xu)){var a=e.wheelDeltaX/-40||s;n=t.Bu(this,"scrollLeft",a*t.scrollStep)}else s&&i.xu&&(n=t.Bu(this,"scrollTop",s*t.scrollStep)); return t.sk(this),n!==!1?webix.html.preventEvent(e):void 0},Bu:function(e,i,s){var n=e.ou,a="scrollLeft"==i?n.dx-n.px:n.dy-n.py,r=e[i];return r+s>a&&(s=a-r),!s||0>r+s&&0===r?!1:(webix.env.isIE?(t.sk(e,i,s+r),e[i]+=s):e[i]+=s,!0)},Om:function(e,i,s,n,a,r){var h=webix.html.create("DIV",{webixignore:"1", "class":"webix_c_scroll_"+i},"
    ");return h.style[a]=Math.max(n*n/s-7,40)+"px",e.style.position="relative",e.appendChild(h),e.Du=webix.event(h,"mousedown",t.Gu(e)),e.Eu=webix.event(document.body,"mouseup",webix.bind(t.Hu,e)),h},Gu:function(e){return function(i){webix.html.addCss(document.body,"webix_noselect",1), this.className+=" webix_scroll_active",t.qu=e,e.Au=this,e.su=webix.html.pos(i)}},Hu:function(e){this.Au&&(webix.html.removeCss(document.body,"webix_noselect"),this.Au.className=this.Au.className.toString().replace(" webix_scroll_active",""),this.Au=!1,t.qu=0,this.Fu&&(t.pu.call(this),this.Fu=!1))},sk:function(t,e,i){ var s=t.ou;if(s&&(s.uu||s.xu)){var n=t.iu,a="scrollLeft"==e?i:t.scrollLeft,r=n?webix.$$(n).bk:a,h=n?0:r,o="scrollTop"==e?i:t.scrollTop,l=n?webix.$$(n).jk:o,c=n?0:l;s.uu&&(s.uu.style.bottom=1-c+"px",s.uu.style.left=Math.round(s.vu*r/(s.dx-s.px))+h+1+"px",s.wA&&(s.wA.style.bottom=1-c+"px",s.wA.style.left=h+"px")), s.xu&&(s.xu.style.right=0-h+"px",s.xu.style.top=Math.round(s.yu*l/(s.dy-s.py))+c+1+"px",s.yA&&(s.yA.style.right=0-h+"px",s.yA.style.top=c+"px"))}},wE:function(e){e.data&&e.data.attachEvent&&e.data.attachEvent("onStoreUpdated",function(){var i=t.gu;i&&e.$view.contains(i)&&t.resize()})}}}(),webix.protoUI({ name:"portlet",defaults:{layoutType:"wide",icon:"bars"},$init:function(t){this.x.style.position="relative",t.header&&t.body&&(t.body=[{template:t.header,type:"header"},t.body]),this.$ready.push(this.Py),webix.attachEvent("onAfterPortletMove",this.xC)},xC:function(t){webix.ui.each(t,function(t){t.Ow&&t.Ow(); })},Py:function(){var t=this.getChildViews();if(t.length>1)webix.DragControl.addDrag(t[0].$view,this);else if(this.s.icon){var e=webix.html.create("div",{"class":"portlet_drag"},"");this.x.appendChild(e),webix.DragControl.addDrag(e,this); }else webix.DragControl.addDrag(this.$view,this)},body_setter:function(t){return this.rows_setter(webix.isArray(t)?t:[t])},markDropArea:function(t,e){return t?(t=webix.$$(t),this.Qy||(this.Qy=webix.html.create("div",null," ")),t.$view.appendChild(this.Qy),void(this.Qy.className="portlet_marker"+e)):webix.html.remove(this.Qy); },movePortlet:function(t,e){var i=t.getParentView(),s=this.getParentView(),n=i.index(t),a=s.index(this);if(webix.callEvent("onBeforePortletMove",[s,i,this,t,e])){webix.ui.PG=!0;var r=s!=i?1:0,h=i.mc;"top"==e||"bottom"==e?(1!==h&&(i=webix.ui({type:t.s.layoutType,rows:[]},i,n+r),webix.ui(t,i,0),n=0,r=1), "bottom"==e&&(r+=1)):("left"==e||"right"==e)&&(0!==h&&(i=webix.ui({type:t.s.layoutType,cols:[]},i,n+r),webix.ui(t,i,0),n=0,r=1),"right"==e&&(r+=1)),n>a&&(r-=1),webix.ui(this,i,n+r),"replace"==e&&webix.ui(t,s,a),this.Ry(s),webix.ui.PG=!1;s.getTopParentView();t.resize(),s.resize(),webix.callEvent("onAfterPortletMove",[s,i,this,t,e]); }},Ry:function(t){for(var e,i=0;t.getChildViews().length<=i;)e=t,t=t.getParentView(),i=1;i&&t.removeView(e)},$drag:function(t,e){return webix.html.addCss(this.x,"portlet_in_drag"),webix.DragControl.Gd={source:t,from:t},this.x.innerHTML},$dragDestroy:function(t,e,i){webix.html.removeCss(this.x,"portlet_in_drag"), webix.html.remove(e),this.Sy&&(this.movePortlet(this.Sy,this.Ty),this.markDropArea(),this.Sy=null)},WB:function(){return webix.html.offset(this.$view)},$dragPos:function(t,e,i){i.style.left="-10000px";var s=webix.env.mouse.context(e),n=document.body.scrollTop||document.documentElement.scrollTop||0,a=document.body.scrollLeft||document.documentElement.scrollLeft||0,r=document.elementFromPoint(s.x-a,s.y-n),h=null; r&&(h=webix.$$(r)),this.Sy=this.Uy(h),this.Ty=this.Vy(this.Sy,e),t.x=t.x-this.bc+10,t.y=t.y-20,webix.DragControl.Ed=!0},Vy:function(t,e){var i="",s="";if(e&&t){var n=webix.html.offset(t.$view),a=webix.html.pos(e),r=a.x-n.x-n.width/2,h=a.y-n.y-n.height/2;s=t.s.mode,s||(s=Math.abs(r)*(n.height/n.width)>Math.abs(h)?"cols":"rows"), "cols"==s?i=r>=0?"right":"left":"rows"==s&&(i=h>=0?"bottom":"top"),this.markDropArea(t,i)}return this.markDropArea(t,i),i||s},Uy:function(t){for(;t;){if(t.movePortlet)return t;t=t.getParentView()}}},webix.ui.layout),webix.UIManager.getState=function(t,e){e=e||!1,t=webix.$$(t);var i={id:t.config.id,width:t.config.width, height:t.config.height,gravity:t.config.gravity};if(webix.isUndefined(t.config.collapsed)||(i.collapsed=t.config.collapsed),("tabs"===t.name||"tabbar"===t.name)&&(i.activeCell=t.getValue()),e&&(i=[i],t.q))for(var s=0;s=0;d--)i.ignore[h[d].id]&&h.splice(d,1);if(i.id&&s.push({id:"id",width:50,header:" ",template:function(t){return t.id; }}),i.flatTree){for(var f=i.flatTree.id,b=[].concat(i.flatTree.columns),p=[],x=!!i.flatTree.fill,d=1;d<=b.length;d++)b[d-1].template=function(t,e){return function(e){return e.$level==t?p[t]=e[f]:x&&t=0;d--)h[d].id===f&&(w=d);h=[].concat(h.slice(0,w)).concat(b).concat(h.slice(w+1)); }for(var g=0;g_;_++)s[d].header.push("");if(t.s.footer){$=a-s[d].footer.length; for(var _=0;$>_;_++)s[d].footer.push("")}}return s}function s(t,e,i){var s,n,a=!!e.filterHTML,r=/<[^>]*>/gi,h=[];if("excel"===e.export_mode&&e.docHeader&&(h=[[(e.docHeader.text||e.docHeader).toString()],[""]],e.docHeader.height&&(i.heights[0]=e.docHeader.height)),e.header!==!1&&i.length)for(var o=0;o<\/div>/,u)),d=d.replace(r,"")),"string"==typeof d&&"csv"===e.export_mode&&(d=d.trim()), "string"!=typeof d||"excel"!==e.export_mode&&"csv"!==e.export_mode||(d=d.replace(//gm,"\n"))),n.push(d)}"excel"==e.export_mode&&t.fj&&e.heights!==!1&&(s.$height&&s.$height!==webix.skin.$active.rowHeight||"all"==e.heights)&&(i.heights[h.length]=s.$height||this.config.rowHeight),h.push(n)}},t), e.footer!==!1)for(var d=i[0].footer?i[0].footer.length:0,f=0;d>f;f++){for(var b=[],l=0;lc&&(h.s.r=c),h.s.c>u&&(h.s.c=u), h.e.r=e[0].header.length&&"="!=d.v.toString().charAt(0)){var b=e[u];b.type&&(d.t=p[b.type]||""),b.format&&(d.z=b.format)}d.v instanceof Date?(d.t=d.t||"n",d.z=d.z||XLSX.SSF[x][14],d.v=a(d.v)):d.t||("boolean"==typeof d.v?d.t="b":"number"==typeof d.v||d.v&&!isNaN(1*d.v)?(d.v=1*d.v, d.t="n"):"="==d.v.charAt(0)?(d.t="n",d.f=d.v,delete d.v):d.t="s"),s&&(d.s=o(c,u,s)),r[f]=d}}return h.s.c<1e7&&(r["!ref"]=XLSX.utils.encode_range(h)),r["!rows"]=l(e.heights),r["!cols"]=n(e),i.length&&(r["!merges"]=i),r}function u(t){for(var e=new ArrayBuffer(t.length),i=new Uint8Array(e),s=0;s!=t.length;++s)i[s]=255&t.charCodeAt(s); return e}function d(t,e,i,s){i.header=webix.isUndefined(i.header)||i.header===!0?{}:i.header,i.footer=webix.isUndefined(i.footer)||i.footer===!0?{}:i.footer,i.table=i.table||{};var n=i.width||595.296,a=i.height||841.896;if(i.orientation&&"landscape"===i.orientation&&(a=[n,n=a][0]),i.autowidth){n=80;for(var r=0;rr;r++)for(var b=d.tr(f),p=0;pr;r++)for(var m=d.tr(v),p=0;p$.text&&h.header({ paddingBottom:10}).text(i.docHeader.text,i.docHeader),i.docHeaderImage)pdfjs.load(i.docHeaderImage.url,function(t,e){if(!t){var n=new pdfjs.Image(e);h.header({paddingBottom:10}).image(n,i.docHeaderImage),i.docHeader&&$.image<$.text&&h.header({paddingBottom:10}).text(i.docHeader.text,i.docHeader)}var a=h.render(); s(a,i)});else{var _=h.render();s(_,i)}}var f="non-existing view for export";webix.toPNG=function(t,e){var i=webix.promise.defer();return webix.require(webix.cdn+"/extras/html2canvas.min.js").then(function(){"string"==typeof e&&(e={filename:e}),e=e||{};var s=webix.$$(t);if(s&&s.$exportView&&(s=s.$exportView(e)), !s)return i.reject(f);var n=s?s.$view:webix.toNode(t),a=(e.filename||"Data")+".png";return window.html2canvas(n).then(function(t){var s=function(s){e.download!==!1&&webix.html.download(s,a),t.remove(),i.resolve(s)};t.msToBlob?s(t.msToBlob()):t.toBlob(s,"image/png")}),i})},webix.toExcel=function(t,e){ e=e||{},e.export_mode="excel",t=webix.isArray(t)?t:[t];for(var n=[],a=0;athis.xE?this.zoomIn():this.zoomOut(),this.xE=!1)},this)),this.attachEvent("onSwipeX",function(t,e){this.$view.scrollLeft=this.$view.scrollLeft-(e.x-t.x)}),this.attachEvent("onSwipeY",function(t,e){ var i=this.$view.clientHeight,s=this.$view.scrollHeight,n=this.$view.offsetHeight,a=this.$view.scrollTop,r=e.y-t.y;if(i===s||0>r&&a>s-n||r>0&&0===a){var h=this.$pageNum+(r>0?-1:1);h>0&&h<=this.$numPages&&(this.$pageNum=h,this.Mz(this.$pageNum),this.$view.scrollTop=r>0?s:0)}else this.$view.scrollTop=a-r; });else{var t=webix.env.isFF?"DOMMouseScroll":"mousewheel";webix.event(window,t,webix.bind(function(t){var e="DOMMouseScroll"===t.type?-t.detail:t.wheelDelta,i=0>e?"out":"in";t.ctrlKey&&(webix.html.preventEvent(t),"in"==i?this.zoomIn():this.zoomOut())},this))}},yE:function(t){if(t.name){var e=new FileReader; e.onload=webix.bind(function(t){this.yE({data:t.target.result})},this),e.readAsArrayBuffer(t)}else PDFJS.getDocument({data:t.data}).then(webix.bind(function(t){this.clear(),this.$pdfDoc=t,this.$numPages=this.$pdfDoc.numPages,this.$pageNum=1,this.Jz(this.$pageNum).then(webix.bind(function(){this.callEvent("onDocumentReady"); },this))},this))},$onLoad:function(t){return window.PDFJS?this.yE(t):webix.require([webix.cdn+"/extras/pdfjs/compatibility.min.js",webix.cdn+"/extras/pdfjs/pdf.min.js"],function(){PDFJS.workerSrc=webix.cdn+"/extras/pdfjs/pdf.worker.min.js",this.yE(t)},this),!0},Kz:function(t,e){var i=t.getViewport(e); return this.Zn.height=i.height,this.Zn.width=i.width,this.gt.style.width=i.width+"px",this.gt.style.height=i.height+"px",i},Jz:function(t){var e=this;return e.vz=!0,this.$pdfDoc.getPage(t).then(function(t){var i=isNaN(parseFloat(e.s.scale))?e.zz:e.s.scale,s=e.Kz(t,i);i!==e.s.scale&&(i=e.Lz(e.s.scale), s=e.Kz(t,i),e.s.scale=i);var n={canvasContext:e.xz,viewport:s};return t.cleanupAfterRender=!0,t.render(n).promise.then(function(){e.callEvent("onPageRender",[e.$pageNum]),e.vz=!1,null!==e.wz&&(e.Jz(e.wz),e.wz=null)})})},Mz:function(t){this.vz?this.wz=t:this.Jz(t)},renderPage:function(t){!this.$pdfDoc||0>t||t>this.$numPages||(this.$pageNum=t, this.Mz(this.$pageNum))},prevPage:function(){this.$pageNum<=1||(this.$pageNum--,this.Mz(this.$pageNum))},nextPage:function(){this.$pageNum>=this.$numPages||(this.$pageNum++,this.Mz(this.$pageNum))},zoomIn:function(){var t=this.s.scale;t=(t*this.Az).toFixed(2),t=Math.ceil(10*t)/10,t=Math.min(this.Cz,t), this.setScale(t,!0)},zoomOut:function(){var t=this.s.scale;t=(t/this.Az).toFixed(2),t=Math.floor(10*t)/10,t=Math.max(this.Bz,t),this.setScale(t,!0)},Lz:function(t){if(!isNaN(parseFloat(t)))return t;isNaN(parseFloat(this.s.scale))&&(this.s.scale=this.zz);var e=1,i=((this.uz.clientWidth-this.Ez)*this.s.scale/this.Zn.clientWidth).toFixed(2),s=((this.uz.clientHeight-this.Fz)*this.s.scale/this.Zn.clientHeight).toFixed(2); switch(t){case"page-actual":e=1;break;case"page-width":e=i;break;case"page-height":e=s;break;case"page-fit":e=Math.min(i,s);break;case"auto":var n=this.uz.clientWidth>this.uz.clientHeight,a=n?Math.min(s,i):i;e=Math.min(this.Dz,a)}return e},setScale:function(t,e){if(isNaN(parseFloat(t))){var i=this.Lz(t); this.Nz(i,e)}else this.Nz(t,e)},Nz:function(t,e){this.s.scale=t,this.renderPage(this.$pageNum),this.callEvent("onScaleChange",[t,e])},download:function(){if(this.$pdfDoc){var t=(this.s.downloadName||"document")+".pdf";this.$pdfDoc.getData().then(function(e){var i=PDFJS.createBlob(e,"application/pdf"); webix.html.download(i,t)})}},clear:function(){this.$pdfDoc&&(this.xz.clearRect(0,0,this.Zn.width,this.Zn.height),this.gt.style.height=this.gt.style.width=this.Zn.width=this.Zn.height=0,this.s.scale="auto",this.$pageNum=this.$numPages=0,this.$pdfDoc.transport.startCleanup(),this.$pdfDoc.destroy(),this.$pdfDoc=null, this.s.toolbar&&webix.$$(this.s.toolbar)&&webix.$$(this.s.toolbar).reset())}},webix.EventSystem,webix.AtomDataLoader,webix.ui.view),webix.protoUI({name:"pdfbar",reset:function(){this.setPage(0),this.setValues(0,"auto")},$init:function(t){this.$view.className+=" pdf_bar",t.cols=[{view:"button",type:"icon", icon:"arrow-left",width:35,click:function(){this.getParentView().he("prev")}},{view:"text",width:70,value:"0",on:{onBlur:function(){this.getParentView().he(this.getValue())},onKeyPress:function(t){13===t&&this.getParentView().he(this.getValue())}}},{template:webix.i18n.PDFviewer.of+" #limit#",width:70, data:{limit:0},borderless:!0},{view:"button",type:"icon",icon:"arrow-right",width:35,click:function(){this.getParentView().he("next")}},{},{view:"button",type:"icon",icon:"minus",width:35,click:function(){this.getParentView().zoom("out")}},{view:"richselect",options:[],maxWidth:195,suggest:{padding:0, css:"pdf_opt_list",borderless:!0,body:{type:{height:25},scroll:!1,yCount:13}},on:{onChange:function(){this.getParentView().setMasterScale(this.getValue())}}},{view:"button",type:"icon",icon:"plus",width:35,click:function(){this.getParentView().zoom("in")}},{view:"button",type:"icon",icon:"download",width:35, click:function(){this.getParentView().download()}}],this.$ready.push(this.Oz)},Oz:function(){var t=this.getChildViews()[6].getPopup().getBody();t.clearAll(),t.parse([{id:"auto",value:webix.i18n.PDFviewer.automaticZoom},{id:"page-actual",value:webix.i18n.PDFviewer.actualSize},{id:"page-fit",value:webix.i18n.PDFviewer.pageFit },{id:"page-width",value:webix.i18n.PDFviewer.pageWidth},{id:"page-height",value:webix.i18n.PDFviewer.pageHeight},{id:"0.5",value:"50%"},{id:"0.75",value:"75%"},{id:"1",value:"100%"},{id:"1.25",value:"125%"},{id:"1.5",value:"150%"},{id:"2",value:"200%"},{id:"3",value:"300%"},{id:"4",value:"400%"}]);var e=0; t.data.each(function(t){e=Math.max(webix.html.getTextSize(t.value,"webixbutton").width,e)}),this.getChildViews()[6].define("width",e+20),this.getChildViews()[6].resize()},he:function(t){this.setMasterPage(t),this.setPage(this.$master.$pageNum)},setScale:function(t){var e=this.getChildViews()[6];e.blockEvent(), e.getPopup().getList().exists(t)?e.setValue(t):(e.setValue(""),e.getInputNode().innerHTML=(100*t).toFixed(0)+"%"),e.unblockEvent()},setMasterScale:function(t){this.$master&&this.$master.setScale(t)},setMasterPage:function(t){this.$master&&("prev"===t?this.$master.prevPage():"next"===t?this.$master.nextPage():isNaN(parseInt(t))||this.$master.renderPage(parseInt(t))); },zoom:function(t){this.$master&&("out"===t?this.$master.zoomOut():"in"===t&&this.$master.zoomIn())},setPage:function(t){this.getChildViews()[1].setValue(t)},setValues:function(t,e){this.getChildViews()[2].data.limit=t,this.getChildViews()[2].refresh(),this.setScale(e)},download:function(){this.$master&&this.$master.download(); }},webix.ui.toolbar),webix.protoUI({name:"excelbar",defaults:{padding:0,type:"line"},$init:function(t){t.cols=[{view:"tabbar",options:[""],optionWidth:200,on:{onaftertabclick:function(){this.getParentView().callEvent("onExcelSheetSelect",[this.getValue()])}}}]},getValue:function(){return this.getInput().getValue(); },setValue:function(t){return this.getInput().setValue(t)},getInput:function(){return this.getChildViews()[0]},setSheets:function(t){var e=this.getInput();e.config.options=t,e.refresh()}},webix.ui.toolbar),webix.protoUI({name:"excelviewer",$init:function(){this.$ready.push(function(){this.s.toolbar&&webix.$$(this.s.toolbar).attachEvent("onExcelSheetSelect",webix.bind(this.showSheet,this)); })},defaults:{datatype:"excel"},$onLoad:function(t){if(t.sheets){this.zA=t,this.s.toolbar&&webix.$$(this.s.toolbar).setSheets(t.names);var e=t.names[0];return this.showSheet(e.id||e),!0}return!1},$exportView:function(t){if("excel"!==t.export_mode||t.dataOnly)return this;t.sheets===!0?t.sheets=this.getSheets():t.sheets&&t.sheets.length?"string"==typeof t.sheets&&(t.sheets=[t.sheets]):t.sheets=[this.IG], t.dataOnly=!0,t.heights=webix.isUndefined(t.heights)&&t.styles?"all":t.heights;for(var e=[],i=this.IG,s=0;s=0){var a=this.getIdByIndex(n);if(this.exists(a)){var r=this.getItem(a),h=this.columnId(t[s][1]);h&&(e.length&&this.LG(e,a,h,t[s][2])||(r.$cellCss=r.$cellCss||{}, r.$cellCss[h]=this.MG(t[s][2])),i++)}}}return i}return!1},NG:function(t){return t=t||"000000",8===t.length&&(t=t.substring(2)),"#"+t},MG:function(t){var e={};if(t.fill&&t.fill.fgColor&&(e["background-color"]=this.NG(t.fill.fgColor.rgb)),t.font){var i=t.font;i.name&&(e["font-family"]=i.name),i.sz&&(e["font-size"]=i.sz/.75+"px"), i.color&&i.color.rgb&&(e.color=this.NG(i.color.rgb)),i.bold&&(e["font-weight"]="bold"),i.underline&&(e["text-decoration"]="underline"),i.italic&&(e["font-style"]="italic"),i.strike&&(e["text-decoration"]="line-through")}if(t.alignment){var s=t.alignment;s.vertical&&"center"==s.vertical&&(e.display="flex", e["justify-content"]="flex-start",e["align-items"]="center"),s.vertical&&"bottom"==s.vertical&&(e.display="flex",e["justify-content"]="flex-end",e["align-items"]="flex-end"),s.horizontal&&(!s.vertical||"center"!=s.vertical&&"bottom"!=s.vertical?e["text-align"]=s.horizontal:e["justify-content"]="center"), s.wrapText&&(e["white-space"]="normal")}if(t.border){var n=t.border;n.top&&(e["border-top"]="1px solid "+this.NG(n.top.color.rgb)),n.bottom&&(e["border-bottom"]="1px solid "+this.NG(n.bottom.color.rgb)+" !important"),n.left&&(e["border-left"]="1px solid "+this.NG(n.left.color.rgb)),n.right&&(e["border-right"]="1px solid "+this.NG(n.right.color.rgb)+" !important"); }return e},JG:function(t){var e=0;for(var i in t){var s=this.config.excelHeader?i-1:i;if(s>=0){var n=this.getIdByIndex(s);this.exists(n)&&(this.getItem(n).$height=t[i],e++)}}return this.config.fixedRowHeight=!e,e},eG:function(t){var e=[];if(this.s.spans&&t&&t.length){this.Rt={};for(var i=0;i=0&&(t[i][0]=this.getIdByIndex(t[i][0]),t[i][1]="data"+t[i][1],e.push(t[i]));return this.addSpan(e),e}return!1}},webix.ui.datatable),webix.DataDriver.excel=webix.extend({toObject:function(t){if(!t.excel){var e=t.options||{};e.dataurl&&webix.extend(e,this.zB(e.dataurl)),t=t.data||t;var i=webix.promise.defer(); if(t.name){e.ext=t.name.split(".").pop();var s=new FileReader;s.onload=webix.bind(function(t){i.resolve(this.parseData(t.target.result,e))},this),s.readAsArrayBuffer(t)}else i.resolve(this.parseData(t,e));return i}return t},parseData:function(t,e){t=new Uint8Array(t);for(var i=[],s=0;s!=t.length;++s)i[s]=String.fromCharCode(t[s]); var n=(e.ext||e).toLowerCase();return"xls"!=n&&(n="xlsx"),webix.require(webix.cdn+"/extras/xlsx.core.styles.min.js").then(webix.bind(function(){var t="xls"==n?XLS.read(i.join(""),{type:"binary",cellStyles:!0,cellDates:!0}):XLSX.read(i.join(""),{type:"binary",cellStyles:!0,cellDates:!0}),s={sheets:t.Sheets, names:t.SheetNames,options:e,ranges:t.Workbook?t.Workbook.Names||[]:[]};return webix.extend(this.getSheet(s,e),s)},this))},getSheet:function(t,e){var i=e.name||t.names[0];return t=this.sheetToArray(t.sheets[i],e),e.rows&&e.rows.length&&(t.data=t.data.splice(e.rows[0],Math.min(e.rows[1],t.data.length)-e.rows[0])), t},sheetToArray:function(t,e){var i=[],s=[],n=[],a=[];if(t&&t["!ref"]){var r,h,o,l,c=XLS.utils.decode_range(t["!ref"]),u=c.s.c,d=c.s.r+(e.rows?e.rows[0]:0);for(r=c.s.r;r<=c.e.r;r++){var f=[];for(h=c.s.c;h<=c.e.c;h++)if(o=XLS.utils.encode_cell({r:r,c:h}),l=t[o]){var b="";b=e.math&&l.f?"="==l.f.charAt(0)?l.f:"="+l.f:"d"==l.t&&webix.isDate(l.v)?webix.i18n.dateFormatStr(l.v):l.v, f.push(b),l.s&&n.push([r-d,h-u,l.s])}else f.push("");i.push(f)}if(t["!merges"])for(var p=t["!merges"],x=0;x=0&&g.r-d<=e.rows[1])&&s.push([w.r-d,w.c-u,g.c-w.c+1,g.r-w.r+1])}if(t["!cols"])for(var v=t["!cols"],x=0;x";return s+=this.type.header.call(this,e,this.type),s+=""},_x:function(t){var e,i,s,n,a,r=[];if(!this.$width||!this.count())return this.v="",!1;if(t||(t=this.config.branch||0, this.v="",this.$values={},this.$xy={},this.$xy[t]={width:this.$width,height:this.$height,top:0,left:0},t&&this.s.header&&(this.$xy[t].height-=this.s.headerHeight,this.$xy[t].top=this.s.headerHeight,this.v+=this.QA(t)),a=0,this.data.each(function(t){var e=this.getParentId(t.id);if(!this.data.branch[t.id]&&(n=1*this.config.value.call(this,t), !isNaN(n)&&n))for(this.$values[t.id]=n,a+=n;e;)this.$values[e]||(this.$values[e]=0),this.$values[e]+=n,e=this.getParentId(e)},this,!1,t)),this.data.eachChild(t,function(t){this.$values[t.id]&&r.push(webix.copy(t))},this),a=a||this.$values[t],r.length&&a){i=this.$xy[t],s={top:i.top,left:i.left,dx:i.width, dy:i.height,set:[],sum:0},s.dim=Math.min(s.dx,s.dy);var h=s.dx*s.dy/a;for(e=0;ee.$value?-1:1});for(var o=1/0,e=0;r[e];){var l=this.RA(s,r[e]);if(o>l)s.sum+=r[e].$value,s.set.push(r[e]),o=l,e++;else{this.SA(s);var c={ top:s.top,left:s.left,dx:s.dx,dy:s.dy,set:[],sum:0},h=s.sum/s.dim;s.dx>s.dy?(c.left+=h,c.dx-=h):(c.top+=h,c.dy-=h),s=c,s.dim=Math.min(s.dx,s.dy),o=1/0}}}s&&this.SA(s)},SA:function(t){var e,i,s,n,a=t.top,r=t.left;for(t.mode=t.dy1?s:1/s},Ne:function(t){return this.PA.innerHTML=this.pg(t),this.PA.firstChild},showBranch:function(t){this.s.branch=t,this.refresh()},render:function(t,e,i){if(this.isVisible(this.s.id)&&!this.$blockRender){if("update"==i){var s=this.getItemNode(t); if(s){var n=this.t[t]=this.Ne(e);webix.html.insertBefore(n,s),webix.html.remove(s)}}else!this.data.branch||this.s.branch&&!this.data.branch[this.s.branch]||(this.t=null,this.callEvent("onBeforeRender",[]),this._x(),this.y.innerHTML=this.v,this.callEvent("onAfterRender",[]));return!0}},ad:"webix_dm_id", on_click:{webix_treemap_item:function(t,e){this.s.select&&("multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,t.ctrlKey||t.metaKey||"touch"==this.s.multiselect,t.shiftKey):this.select(e)),this.s.activeItem&&this.isBranch(e)&&this.showBranch(e)},webix_treemap_header_item:function(t){var e=webix.html.locate(t,"webix_dm_header_id"); this.define("branch",e),this.refresh()},webix_treemap_reset:function(t){this.define("branch",0),this.refresh()}},on_dblclick:{},on_mouse_move:{},TA:function(t){var e="";for(var i in t)e+=i+":"+t[i]+";";return e},type:{template:webix.template("#value#"),header:function(t,e){for(var i=t.id,s="
    ",n=[];i;)t=this.getItem(i), n.push(e.headerItem.call(this,t,e)),i=this.getParentId(i);return n.reverse(),s+n.join("")},headerItem:function(t){var e=this.config.headerTemplate(t),i=''; return i+=e,i+=""},classname:function(t,e,i){var s="webix_treemap_item";e.css&&(s+=e.css+" "),t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css);var n=this.$xy[t.id];i&&i.$css&&(s+=" "+i.$css),s+=" webix_treemap_level_"+this.getItem(t.id).$level;var a=this.getParentId(t.id); if(a&&a!=this.s.branch||(s+=" webix_treemap_level_top"),this.$height-n.top-n.height<1&&(s+=" webix_treemap_item_bottom"),this.$width-n.left-n.width<1&&(s+=" webix_treemap_item_right"),e.cssClass){var r=e.cssClass.call(this,t,e,i);r&&(s+="object"==typeof r?" "+webix.html.createCss(r):" "+r)}return s}, templateStart:function(t,e,i){var s="";if(this.$xy){var n=this.$xy[t.id];s+="width: "+n.width+"px; height: "+n.height+"px;",s+="top: "+n.top+"px; left: "+n.left+"px;"}return'
    '; },templateEnd:webix.template("
    ")}},webix.AutoTooltip,webix.Group,webix.TreeAPI,webix.SelectionModel,webix.KeysNavigation,webix.MouseEvents,webix.Scrollable,webix.TreeDataLoader,webix.ui.proto,webix.TreeRenderStack,webix.CopyPaste,webix.EventSystem),webix.extend(webix.ui.datatable,{iB:function(){ this.jB=!0,this.kB={},this.define("select","area"),this.attachEvent("onAfterScroll",function(){this.refreshSelectArea()}),this.attachEvent("onAfterRender",function(){this.refreshSelectArea()}),this.attachEvent("onBeforeColumnHide",function(t){this.tC=this.getColumnIndex(t)}),this.attachEvent("onAfterColumnHide",function(){ this.uC(this.tC)}),this.attachEvent("onAfterRender",function(){this.qH()}),this.wB=function(t,e,i,s){if(t.row&&e.row){if(i)return this.addSelectArea(t,e,!0),this.jB=!0,!1;if(!this.callEvent("onAreaDrag",[t,e,s]))return!1;this.mB?this.nB(this.mB):!this.jB||this.s.multiselect&&s&&s.ctrlKey||(this.removeSelectArea(), this.jB=!1)}},this.attachEvent("onBeforeAreaAdd",this.oB),webix.UE(this.Vf,"mousedown",this.pB,{bind:this})},ql:!0,uC:function(t){var e=this.kB;for(var i in e){var s=e[i];if(this.getColumnIndex(s.start.column)<0)if(s.start.column==s.end.column)this.removeSelectArea(s.name);else{var n=this.columnId(t+1); n&&this.vC(s.name,{row:s.start.row,column:n},null)}else if(this.getColumnIndex(s.end.column)<0){var n=this.columnId(t-1);n&&this.vC(s.name,null,{row:s.end.row,column:n})}}},gC:function(t,e,i,s){var n,a,r,h,o,l,c,u;if(e){n=this.getColumnIndex(e.start.column),a=this.getColumnIndex(e.end.column),r=this.getIndexById(e.start.row), h=this.getIndexById(e.end.row),o=this.getColumnIndex(t.column),l=this.getIndexById(t.row),c=this.getIndexById(e.init.row),u=this.getColumnIndex(e.init.column),n>o||"left"==i?"left"===i&&s.ctrl?(n=this.OG(c,n,i),a=u):"left"===i&&a>u?a--:n=o:(o>=a||"right"==i)&&("right"==i&&s.ctrl?(a=this.OG(c,a,i),n=u):"right"==i&&u>n?n++:a=o), r>l||"up"==i?"up"==i&&s.ctrl?(r=this.OG(r,u,i),h=c):"up"==i&&h>c?h--:r=l:(l>h||"down"==i)&&("down"==i&&s.ctrl?(h=this.OG(h,u,i),r=c):"down"==i&&c>r?r++:h=l);var d={row:this.getIdByIndex(r),column:this.columnId(n)},f={row:this.getIdByIndex(h),column:this.columnId(a)};this.callEvent("onBeforeBlockSelect",[d,f,!0])&&(this.vC(e.name,d,f), this.callEvent("onSelectChange",[]),this.callEvent("onAfterBlockSelect",[d,f]))}},OG:function(t,e,i){var s=this.config.columns,n=this.data.order,a=this.data.pull[n[t]],r=s[e].id,h=0;if("right"==i)for(var o=e+1;o=0;o--)if(a[s[o].id]){ h=o;break}}else if("down"==i)for(var o=t+1;o=0;o--)if(this.getItem(n[o])[r]){h=o;break}return h},vC:function(t,e,i,s){var n=this.kB[t];if(!n)return!1;var a=webix.copy(n),r={start:e||n.start,end:i||n.end};this.oB(r), webix.extend(n,r,!0),this.refreshSelectArea(),this.qH(a),s&&this.callEvent("onSelectChange",[])},areaselect_setter:function(t){return t&&(this.iB(),this.iB=function(){}),this.define("blockselect",t),t},addSelectArea:function(t,e,i,s,n,a){var r,h,o,l,c;r=this.getIndexById(t.row),h=this.getIndexById(e.row), o=this.getColumnIndex(t.column),l=this.getColumnIndex(e.column),r>h&&(c=r,r=h,h=c),o>l&&(c=o,o=l,l=c),s=s||this.mB||webix.uid(),this.mB=null;var u={start:{row:this.getIdByIndex(r),column:this.columnId(o)},end:{row:this.getIdByIndex(h),column:this.columnId(l)}};return n&&(u.css=n),(a||a===!1)&&(u.handle=a), this.kB[s]?this.vC(s,u.start,u.end,!0):(u.handle=!0,u.name=s,u.init=u.start,void(this.callEvent("onBeforeAreaAdd",[u])&&(this.qB=s,i||this.removeSelectArea(),this.kB[u.name]=u,this.el.push(u),this.refreshSelectArea(),this.qH(),this.callEvent("onAfterAreaAdd",[u]),this.callEvent("onSelectChange",[])))); },PC:function(){var t=webix.html.create("DIV");return t.className="webix_area_selection_layer",t.style.top=this.ck+"px",t},refreshSelectArea:function(){var t,e,i,s,n,a,r=null,h=null,o=null,l=this.s.prerender;if(this.wk){t=this.Xj(l),e=this.Sj(l===!0),this.rB||(this.rB=this.PC(),this.Vf.childNodes[1].appendChild(this.rB), this.QC=this.PC(),this.Vf.childNodes[0].appendChild(this.QC),this.RC=this.PC(),this.Vf.childNodes[2].appendChild(this.RC)),this.rB.innerHTML="",this.QC.innerHTML="",this.RC.innerHTML="";var c=this.s.leftSplit,u=this.s.rightSplit;for(i in this.kB){s=this.kB[i];var d=this.BD(s,t,e);if(null!==d){var f=this.getColumnIndex(s.start.column),b=this.getColumnIndex(s.end.column); if(d.r0<=d.r1){if(this.s.topSplit&&n>=this.s.topSplit&&af&&(h=this.SC(d.r0,f,d.r1,Math.min(b,c-1))),d.c0<=d.c1&&(r=this.SC(d.r0,d.c0,d.r1,d.c1)),u&&b>=this.Fj&&(o=this.SC(d.r0,Math.max(f,this.Fj),d.r1,b)),(h||r||o)&&this.sB(h,r,o,i,s.css,s.handle)}}else this.removeSelectArea(i)}}}, BD:function(t,e,i){var s,n,a,r,h=this.getIndexById(t.start.row),o=this.getIndexById(t.end.row),l=this.getColumnIndex(t.start.column),c=this.getColumnIndex(t.end.column);if(-1===l||-1===c)return null;if(-1===h||-1===o)return null;if(n=Math.min(i[1],o),this.s.topSplit){if(s=h,s>=this.s.topSplit&&(s=Math.max(i[0]-this.s.topSplit,h)), n>=this.s.topSplit){var u=this.ug(this.getIdByIndex(o),t.end.column),d=this.ug(this.getIdByIndex(this.s.topSplit-1),t.end.column);d.top+d.height>u.top+u.height&&(n=this.s.topSplit-1)}}else s=Math.max(i[0],this.getIndexById(t.start.row));return a=Math.max(e[0],l),r=Math.min(this.Fj?e[1]-1:e[1],c),{r0:s, r1:n,c0:a,c1:r}},SC:function(t,e,i,s){var n=this.ug(this.getIdByIndex(t),this.columnId(e)),a=this.ug(this.getIdByIndex(i),this.columnId(s));return[n,a]},sB:function(t,e,i,s,n,a){var r,h,o=this.kB[s],l=0;this.s.topSplit&&(l=this.zD(o.start,!0));var c=function(t,e,i,a,r){var h,o,c,u,d,f,b={top:1,right:1, bottom:1,left:1};a&&delete b.left,r&&delete b.right,o=i.top-e.top+i.height-1,c=i.left-e.left+i.width;for(h in b){u=e.top+l,"bottom"==h&&(u=i.top+i.height),d=e.left,"right"==h&&(d=i.left+i.width),f="top"==h||"bottom"==h,t.appendChild(webix.html.create("DIV",{"class":"webix_area_selection webix_area_selection_"+h+(n?" "+n:""), style:"left:"+d+"px;top:"+u+"px;"+(f?"width:"+c+"px;":"height:"+(o-l)+"px;"),webix_area_name:s},""));var p=t.lastChild;"right"==h&&(p.style.left=d-p.offsetWidth+"px"),"bottom"==h&&(p.style.top=u-p.offsetHeight+"px"),l&&("top"==h&&(p.style.display="none"),i.height==l&&"bottom"==h&&(p.style.display="none")); }};i&&c(this.RC,i[0],i[1],!!e,!1),e&&c(this.rB,e[0],e[1],!!t,!!i),t&&c(this.QC,t[0],t[1],!1,!!e),a&&(h=i?i[1]:e?e[1]:t[1],r=i?this.RC:e?this.rB:this.QC,r.appendChild(webix.html.create("DIV",{"class":"webix_area_selection_handle"+(n?" "+n:""),style:"left:"+(h.left+h.width)+"px;top:"+(h.top+h.height)+"px;", webix_area_name:s},"")),l&&h.height==l&&(r.lastChild.style.display="none"))},nB:function(t){if(t){var e=function(e){for(var i=e.childNodes,s=i.length-1;s>=0;s--)i[s].getAttribute("webix_area_name")==t&&e.removeChild(i[s])};e(this.rB),e(this.QC),e(this.RC)}},removeSelectArea:function(t){if(t&&this.kB[t]){ if(this.callEvent("onBeforeAreaRemove",[t])){this.qH(webix.copy(this.kB[t]),!0),delete this.kB[t],this.nB(t),this.el=[];for(var e in this.kB)this.el.push(this.kB[e]);this.callEvent("onAfterAreaRemove",[t])}}else for(var i in this.kB)this.removeSelectArea(i)},pB:function(t){var e=t.target||t.srcElement,i=webix.html.TC(e); if(i&&-1!=i.indexOf("webix_area_selection_handle")){var s=e.getAttribute("webix_area_name");this.mB=s;var n=this.kB[s],a=this.ug(n.start.row,n.start.column),r=this.ug(n.end.row,n.end.column),h=this.s.prerender,o=this.getColumnIndex(n.start.column)=i;i++){var g=this.getItem(this.getIdByIndex(i));if(g.$row&&!e)p=!0,b=this.fj.length-1;else if(this.config.spans)for(s=n;a>=s;s++)o=this.getSpan(this.getIdByIndex(i),this.columnId(s)), o&&(l=this.getIndexById(o[0]),c=this.getColumnIndex(o[1]),u>l&&(u=l,p=!0),d>c&&(p=!0,d=c),l+o[3]-1>f&&(p=!0,f=l+o[3]-1),c+o[2]-1>b&&(p=!0,b=c+o[2]-1))}p&&(t.start={row:this.getIdByIndex(u),column:this.columnId(d)},t.end={row:this.getIdByIndex(f),column:this.columnId(b)},this.oB(t,!0))},qH:function(t,e){ if(t){var i=this.getIndexById(t.end.row)-this.getIndexById(t.start.row)+1,s=this.getColumnIndex(t.end.column)-this.getColumnIndex(t.start.column)+1;this.mapCells(t.start.row,t.start.column,i,s,webix.bind(function(t,e,i){var s=this.getItemNode({row:e,column:i});s&&s.removeAttribute("tabindex")},this),!0); }!e&&this.el.length&&this.mapSelection(webix.bind(function(t,e,i){var s=this.getItemNode({row:e,column:i});return s&&s.setAttribute("tabindex","1"),t},this))}}),webix.protoUI({name:"rangechart",$init:function(){this.attachEvent("onAfterRender",this.AB),this.BB()},AB:function(){return!this.eo.sA.length||this.CB?void this.pF(!0):(this.TE(), this.EB=(this.eo.sA[0].points[2]-this.eo.sA[0].points[0])/2,this.FB=webix.html.create("div",{"class":"webix_chart_resizer right",tabindex:"0",role:"button","aria-label":webix.i18n.aria.resizeChart}),this.GB=webix.html.create("div",{"class":"webix_chart_resizer left",tabindex:"0",role:"button","aria-label":webix.i18n.aria.resizeChart }),this.CB=webix.html.create("div",{"class":"webix_chart_frame"}),this.x.appendChild(this.GB),this.x.appendChild(this.CB),this.x.appendChild(this.FB),this.pF(),webix.UE(this.FB,webix.env.mouse.down,this.IB,{bind:this}),webix.UE(this.GB,webix.env.mouse.down,this.IB,{bind:this}),webix.UE(this.CB,webix.env.mouse.down,this.IB,{ bind:this}),webix.UE(webix.toNode(this.FB),"keydown",this.zE,{bind:this}),webix.UE(webix.toNode(this.GB),"keydown",this.zE,{bind:this}),this.JB&&(this.s.range=this.BB(this.JB)),this.KB(),this.callEvent("onAfterRangeChange",[this.JB]),void this.data.attachEvent("onStoreUpdated",webix.bind(this.KB,this))); },$setSize:function(t,e){webix.ui.chart.prototype.$setSize.call(this,t,e)&&(this.TE(),this.KB())},pF:function(t){this.FB&&!this.HB&&(this.HB=this.FB.clientWidth/2,t&&this.KB())},TE:function(){var t=this.no(this.bc,this.dc);this.kp=t.start,this.DB=t.end},removeAllSeries:function(){this.CB=this.FB=this.GB=null, webix.ui.chart.prototype.removeAllSeries.apply(this,arguments)},zE:function(t){var e=t.which||t.keyCode;if(37===e||39===e){webix.html.preventEvent(t);var i=-1!==t.target.className.indexOf("right")?"eindex":"sindex",s=-1!==t.target.className.indexOf("right")?"end":"start",n=this.JB;n[i]=n[i]+(37===e?-1:1), this.eo.sA[n[i]]&&(n[s]=this.SB(n[i]),this.setFrameRange(n))}},IB:function(t){if(-1!==t.target.className.indexOf("webix_chart_resizer"))this.LB=t.target;else if(this.eo.sA.length){var e=this.eo.sA[this.JB.sindex].points[2]-this.EB,i=this.eo.sA[this.JB.eindex].points[2]-this.EB;this.MB={ex:webix.html.pos(t).x, fx:e+this.kp.x,fw:i-e}}webix.html.addCss(this.x,"webix_noselect webix_wresize_cursor"),this.GE(),this.NB=webix.event(document.body,webix.env.mouse.move,this.OB,{bind:this}),this.PB=webix.event(document.body,webix.env.mouse.up,this.QB,{bind:this})},GE:function(){webix.h[this.NB]&&(webix.eventRemove(this.NB), webix.eventRemove(this.PB))},OB:function(t){if(this.LB){var e=webix.html.pos(t).x-webix.html.offset(this.$view).x;e>=this.kp.x&&e<=this.DB.x&&(-1!==this.LB.className.indexOf("left")?ethis.GB.offsetLeft+this.HB&&(this.LB.style.left=e-this.HB+"px", this.CB.style.width=this.FB.offsetLeft-this.GB.offsetLeft-1+"px"))}else if(this.MB){var i=webix.html.pos(t).x-this.MB.ex,s=this.MB.fx+i,n=s+this.MB.fw;this.kp.x<=s&&this.DB.x>=n&&(webix.extend(this.MB,{lx:s,rx:n},!0),this.GB.style.left=s-this.HB+"px",this.FB.style.left=n-this.HB+"px",this.CB.style.left=s+"px"); }},QB:function(t){if(this.GE(),webix.html.removeCss(this.x,"webix_noselect"),webix.html.removeCss(this.x,"webix_wresize_cursor"),this.count()){if(this.LB){var e=webix.env.touch?t.changedTouches[0].pageX:webix.html.pos(t).x;e-=webix.html.offset(this.$view).x+this.kp.x;var i=this.RB(e),s=this.SB(i);this.LB===this.GB?(i>=this.JB.eindex&&(i=this.JB.eindex, s=this.SB(i)),this.JB.start=s,this.JB.sindex=i):(i<=this.JB.sindex&&(i=this.JB.sindex,s=this.SB(i)),this.JB.end=s,this.JB.eindex=i),this.LB=null}else if(this.MB&&this.MB.lx){var n=this.JB.sindex=this.RB(this.MB.lx-this.kp.x),a=this.JB.eindex=this.RB(this.MB.rx-this.kp.x);this.JB.start=this.SB(n),this.JB.end=this.SB(a), this.MB=null}this.KB(),this.callEvent("onAfterRangeChange",[this.JB.start,this.JB.end])}},SB:function(t){return t>=this.data.order.length&&(t=this.data.order.length-1),this.getItem(this.data.order[t])[this.s.frameId||"id"]},RB:function(t){for(var e=this.eo.sA,i=0;i"+this.getValue()+"", on:{onAfterRender:function(){t.se=!0,webix.UE(t.getInputNode(),"blur",function(){t.CG(this.innerHTML)}),webix.UE(t.getInputNode(),"keyup",function(){t.KE()})}},onClick:{webix_richtext_editor:function(){t.KE()}}},i={view:"toolbar",id:"toolbar",elements:[this.IE("underline"),this.IE("bold"),this.IE("italic"),{}] },s=[i,e];"top"!==this.config.labelPosition&&this.config.labelWidth?(this.config.borderless=!0,this.cols_setter([{template:this.config.label||" ",width:this.config.labelWidth},{rows:s}])):(i.elements.push({view:"label",label:this.config.label,align:"right"}),this.rows_setter(s))},KE:function(){var t,e=this,i=e.$$("toolbar"); i.setValues({italic:!1,underline:!1,bold:!1}),t=window.getSelection?window.getSelection():document.selection.createRange();for(var s=0;s0)for(var n=0;n'+(this.config.label||"")+'
    '+this.config.minRange+'
    '+this.config.maxRange+'
    '+this.config.value+'
    '+(this.config.placeholder||"")+"
    ", this.NE=this.$view.querySelector(".webix_gage_gradient"),this.OE=this.$view.querySelector(".webix_gage_gradient_point"),this.PE=this.$view.querySelector(".webix_gage"),this.isVisible()===!0&&this.config.smoothFlow===!0&&webix.env.svganimation&&!webix.env.isEdge&&(this.NE.setAttribute("class","webix_gage_gradient webix_gage_animated"), this.OE.setAttribute("class","webix_gage_gradient_point webix_gage_gradient_point_animated"))},refresh:function(){var t=this.config.value;this.config.smoothFlow&&t!=this.JB&&(this.config.value=this.JB),this.ME(),this.QE(),this.JB!=t&&this.x.parentNode.clientHeight&&this.setValue(t)},setValue:function(t){ this.config.value=t,this.SE(),this.QE()},getValue:function(){return this.config.value}},webix.EventSystem,webix.ui.view),webix.protoUI({name:"bullet",defaults:{color:"#394646",marker:!1,layout:"x",barWidth:40,flowTime:500,labelWidth:150,minRange:0,maxRange:100,stroke:8,value:0,smoothFlow:!0,tickSize:10, bands:[{value:100,color:"#5be5d6"},{value:80,color:"#fff07e"},{value:60,color:"#fd8b8c"}],scale:{step:10}},label_setter:webix.template,placeholder_setter:webix.template,$init:function(t){var e="undefined"!=typeof t.tickSize?t.tickSize:this.defaults.tickSize;t&&(t.layout&&"x"!==t.layout||t.height||(t.height=t.scale===!1?60:e?76+e:74), "y"!==t.layout||t.width||(t.width=t.scale===!1?60:e?87+e:87))},scale_setter:function(t){return t.step=t.step||10,t.template=webix.template(t.template||"#value#"),t},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&(this.ME("y"===this.s.layout?e:t),(this.s.value||0===this.s.value)&&this.Qf(0,this.s.value)); },sF:function(t){return Math.min(Math.max(t,this.s.minRange),this.s.maxRange)},CF:function(t){this.DF=t-(this.um||t),this.um=t;var e;e=this.s.flowTime>this.DF?this.s.flowTime/this.DF:this.s.flowTime,(e>1e3||5>e)&&(e=30);var i=(this.s.value-this.EF)/e;this.FF+=i,Math.abs(this.FF-this.s.value)"+t.labelRight+"",t.labelWidth&&(t.label=t.label||" "));var n=t.checkValue==t.value,a='aria-label="'+(t.label||t.labelRight||"")+'" role="checkbox" tabindex="0" aria-checked="'+(n?"true":"false")+'" '+(t.readonly?"aria-readonly='true'":"")+'"',r='
    '+((n?t.onLabel:t.offLabel)||"")+'
    "+s; return e.$renderInput(t,r,i)}},$skin:function(){this.LH=webix.skin.$active.switchHeight,this.KH=webix.skin.$active.switchWidth},$setValue:function(t){var e=this.s,i=t==e.checkValue,s=this.$view.querySelector(".webix_switch_box");if(s){var n=s.childNodes[1],a=(i?e.onLabel:e.offLabel)||"";i?webix.html.addCss(s,"webix_switch_on"):webix.html.removeCss(s,"webix_switch_on"), n.style.left=(i?this.KH-this.LH:0)+"px",n.firstChild.checked=i,n.setAttribute("aria-checked",i?"true":"false"),a&&(s.childNodes[0].innerHTML=a)}},JH:function(){var t=this.s;if(t.onLabel||t.offLabel){var e=t.onLabel?webix.html.getTextSize(t.onLabel,"webix_switch_text").width:0,i=t.onLabel?webix.html.getTextSize(t.offLabel,"webix_switch_text").width:0; this.KH=Math.max(e,i)+this.LH}},on_click:{webix_switch_box:function(){this.s.readonly||this.toggle()},webix_label_right:function(){this.s.readonly||this.toggle()}}},webix.ui.checkbox),function(){function t(t){if(!t||Array.isArray(t))return t;var e="",i=0;for(var s in t){if(i++,2==i)return t;e=s}return t[e]; }webix.proxy.GraphQL={$proxy:!0,save:function(t){return this.load(t)},load:function(e,i,s){var s={query:this.source};return 1===arguments.length&&(s.variables=e,e=webix),webix.ajax().bind(e).headers({"Content-type":"application/json"}).post(this.url,s).then(function(s){var n=t(s.json().data);return i&&webix.ajax.$callback(e,i,"",n,-1), n})}}}(); //# sourceMappingURL=./webix.js.map