{"version":3,"file":"webix.min.js","sources":["../sources/core/state.js","../sources/webix/env.js","../sources/services.js","../sources/webix/debug.js","../sources/webix/helpers.js","../sources/core/eventsystem.js","../sources/webix/customevents.js","../sources/webix/html.js","../sources/webix/i18n.js","../sources/webix/stringify.js","../sources/thirdparty/promiz.js","../sources/load/drivers/xml.js","../sources/load/drivers/json.js","../sources/load/ajax.js","../sources/core/codeparser.js","../sources/webix/template.js","../sources/webix/type.js","../sources/ui/core.js","../sources/webix/htmlevents.js","../sources/core/activecontent.js","../sources/load/proxy/binary.js","../sources/load/proxy/connector.js","../sources/load/proxy/debug.js","../sources/load/proxy/faye.js","../sources/load/proxy/indexdb.js","../sources/load/proxy/rest.js","../sources/load/proxy/json.js","../sources/load/proxy/post.js","../sources/load/proxy/sync.js","../sources/load/drivers/jsarray.js","../sources/load/drivers/html.js","../sources/load/drivers/htmltable.js","../sources/load/require.js","../sources/load/drivers/excel.js","../sources/load/drivers/index.js","../sources/load/drivers/csv.js","../sources/webix/storage.js","../sources/load/proxy/offline.js","../sources/load/proxy/cache.js","../sources/load/proxy/local.js","../sources/load/proxy/graphql.js","../sources/load/proxy.js","../sources/core/atomdataloader.js","../sources/core/atomrender.js","../sources/core/autoscroll.js","../sources/webix/ready.js","../sources/core/touch.js","../sources/ui/helpers.js","../sources/core/dragcontrol.js","../sources/core/uimanager.js","../sources/core/settings.js","../sources/core/destruction.js","../sources/core/collectionbind.js","../sources/core/valuebind.js","../sources/core/recordbind.js","../sources/core/bindsource.js","../sources/core/basebind.js","../sources/views/baseview.js","../sources/views/view.js","../sources/core/singlerender.js","../sources/views/tooltip.js","../sources/core/autotooltip.js","../sources/core/canvas.js","../sources/webix/animate.js","../sources/css/skins/material/config.js","../sources/webix/skin.js","../sources/css/skins/mini/config.js","../sources/css/skins/flat/config.js","../sources/css/skins/compact/config.js","../sources/css/skins/contrast/config.js","../sources/core/movable.js","../sources/core/modality.js","../sources/core/resizearea.js","../sources/views/window.js","../sources/core/contexthelper.js","../sources/webix/clipbuffer.js","../sources/core/copypaste.js","../sources/core/customprint.js","../sources/core/customscroll.js","../sources/core/datamarks.js","../sources/core/datamove.js","../sources/webix/rules.js","../sources/core/validatedata.js","../sources/load/dataprocessor.js","../sources/core/datastore.js","../sources/core/dataloader.js","../sources/core/datastate.js","../sources/core/dragitem.js","../sources/core/dragorder.js","../sources/core/undo.js","../sources/webix/editors.js","../sources/core/editability.js","../sources/core/flexlayout.js","../sources/core/groupmethods.js","../sources/core/groupstore.js","../sources/core/group.js","../sources/core/htmloptions.js","../sources/core/htmlmap.js","../sources/core/idspace.js","../sources/core/keysnavigation.js","../sources/core/mapcollection.js","../sources/core/mouseevents.js","../sources/core/navigationbuttons.js","../sources/core/overlaybox.js","../sources/core/pagingability.js","../sources/core/progressbar.js","../sources/core/renderstack.js","../sources/core/scrollable.js","../sources/core/selectionmodel.js","../sources/webix/color.js","../sources/core/sparklines/svg.js","../sources/core/sparklines/line.js","../sources/core/sparklines/area.js","../sources/core/sparklines/bar.js","../sources/core/sparklines/pie.js","../sources/core/sparklines/spline.js","../sources/core/sparklines/splinearea.js","../sources/core/sparklines.js","../sources/webix/csv.js","../sources/webix/export.js","../sources/core/tablepaste.js","../sources/core/treeapi.js","../sources/core/treeclick.js","../sources/core/treedataloader.js","../sources/core/treedatamove.js","../sources/core/treerenderstack.js","../sources/core/treestatecheckbox.js","../sources/core/treestore.js","../sources/core/treetablepaste.js","../sources/core/treetype.js","../sources/core/uploaddriver.js","../sources/core/validatecollection.js","../sources/core/values.js","../sources/core/virtualrenderstack.js","../sources/core/vrenderstack.js","../sources/webix/message.js","../sources/i18n/en.js","../sources/core/date.js","../sources/core/number.js","../sources/webix/locale.js","../sources/webix/history.js","../sources/webix/markup.js","../sources/webix/print.js","../sources/webix/patterns.js","../sources/load/jsonp.js","../sources/load/remote.js","../sources/ui/fullscreen.js","../sources/ui/datafilter.js","../sources/ui/detect.js","../sources/ui/index.js","../sources/ui/animate.js","../sources/i18n/index.js","../sources/i18n/de.js","../sources/i18n/es.js","../sources/i18n/fr.js","../sources/i18n/it.js","../sources/i18n/ja.js","../sources/i18n/pt.js","../sources/i18n/zh.js","../sources/i18n/ru.js","../sources/i18n/be.js","../sources/views/baselayout.js","../sources/views/template.js","../sources/views/spacer.js","../sources/views/scrollview.js","../sources/views/layout.js","../sources/views/iframe.js","../sources/views/accordion.js","../sources/views/accordionitem.js","../sources/views/headerlayout.js","../sources/views/resizearea.js","../sources/views/resizer.js","../sources/views/align.js","../sources/views/multiview.js","../sources/views/tabview.js","../sources/views/carousel.js","../sources/views/proxy.js","../sources/views/portlet.js","../sources/views/dashboard.js","../sources/views/panel.js","../sources/views/abslayout.js","../sources/views/gridlayout.js","../sources/views/flexlayout.js","../sources/views/flexdatalayout.js","../sources/views/popup.js","../sources/views/toolbar.js","../sources/views/form.js","../sources/views/fieldset.js","../sources/views/forminput.js","../sources/views/htmlform.js","../sources/views/property.js","../sources/views/calendar.js","../sources/views/colorboard.js","../sources/views/button.js","../sources/views/label.js","../sources/core/textpattern.js","../sources/views/text.js","../sources/core/datacollection.js","../sources/views/select.js","../sources/views/checkbox.js","../sources/views/radio.js","../sources/views/datepicker.js","../sources/views/colorpicker.js","../sources/views/richselect.js","../sources/views/combo.js","../sources/views/counter.js","../sources/views/icon.js","../sources/views/search.js","../sources/views/segmented.js","../sources/views/textarea.js","../sources/views/toggle.js","../sources/views/multitext.js","../sources/views/multiselect.js","../sources/views/multicombo.js","../sources/views/slider.js","../sources/views/rangeslider.js","../sources/views/switch.js","../sources/views/tabbar.js","../sources/views/richtext.js","../sources/views/proto.js","../sources/views/list.js","../sources/views/uploader.js","../sources/views/suggest.js","../sources/views/multisuggest.js","../sources/views/checksuggest.js","../sources/views/datasuggest.js","../sources/views/gridsuggest.js","../sources/views/daterange.js","../sources/views/daterangesuggest.js","../sources/views/daterangepicker.js","../sources/views/excelbar.js","../sources/views/excelviewer.js","../sources/views/pdfbar.js","../sources/views/pdfviewer.js","../sources/views/video.js","../sources/views/geochart.js","../sources/views/gage.js","../sources/views/barcode.js","../sources/views/bulletgraph.js","../sources/views/googlemap.js","../sources/views/organogram.js","../sources/views/chart/pie.js","../sources/views/chart/bar.js","../sources/views/chart/line.js","../sources/views/chart/barh.js","../sources/views/chart/stackedbar.js","../sources/views/chart/stackedbarh.js","../sources/views/chart/area.js","../sources/views/chart/radar.js","../sources/views/chart/scatter.js","../sources/views/chart/splinearea.js","../sources/views/chart/dynamic.js","../sources/views/chart.js","../sources/views/chart/spline.js","../sources/views/chart/presets.js","../sources/views/rangechart.js","../sources/views/grouplist.js","../sources/views/unitlist.js","../sources/views/dbllist.js","../sources/views/tree.js","../sources/views/treemap.js","../sources/views/dataview.js","../sources/views/pager.js","../sources/views/menu.js","../sources/views/submenu.js","../sources/views/sidemenu.js","../sources/views/sidebar.js","../sources/views/context.js","../sources/views/contextmenu.js","../sources/views/vscroll.js","../sources/views/datatable/filter.js","../sources/views/datatable/selection.js","../sources/views/datatable/blockselect.js","../sources/views/datatable/resize.js","../sources/views/datatable/touch.js","../sources/views/datatable/size.js","../sources/views/datatable/math.js","../sources/views/datatable/edit.js","../sources/views/datatable/columns.js","../sources/views/datatable/keynav.js","../sources/views/datatable/dnd.js","../sources/views/datatable/print.js","../sources/views/datatable/export.js","../sources/views/datatable.js","../sources/views/datatable/areaselect.js","../sources/views/datatable/validation.js","../sources/views/datatable/hmenu.js","../sources/views/datatable/subs.js","../sources/views/datatable/freeze.js","../sources/views/datatable/spans.js","../sources/views/treetable.js","../sources/core/datarecord.js","../sources/core/datavalue.js","../sources/core/treecollection.js","../sources/webix/consts.js","../sources/webix/api.js","../sources/load/send.js"],"sourcesContent":["const state = {\n\tcodebase:\"./\",\n\tcdn:\"//cdn.webix.com\",\n\ttop_views:[],\n\n\t_global_collection:null,\n\t_child_sizing_active:null,\n\t_responsive_exception:null,\n\t_responsive_tinkery:null,\n\t_freeze_resize:null,\n\t_parent_cell:null,\n\t_focus_time:null,\n\t_ui_creation:0,\n\t_edit_open_time:null,\n\n\t_final_destruction:null,\n\t_events:[],\n\n\tdestructors:[],\n\tsecurityKey:\"\",\n\n\t_noselect_element:null,\n\n\t_modality:0,\n\n\t_wait_animate:null,\n\tnoanimate:false\n};\n\nexport default state;","const env = {};\n\nenv.cdn = \"//cdn.webix.com/\";\nenv.codebase = \"\";\nenv.zIndexBase = 100;\nenv.scrollSize = 17;\nenv.strict = !!window.webix_strict;\nenv.https = document.location.protocol === \"https:\";\n\nvar agent = navigator.userAgent;\nenv.isMac = agent.indexOf(\"Mac\")!=-1;\n\nif (agent.indexOf(\"Mobile\")!=-1 || agent.indexOf(\"Windows Phone\")!=-1)\n\tenv.mobile = true;\nif (env.mobile || agent.indexOf(\"iPad\")!=-1 || agent.indexOf(\"Android\")!=-1)\n\tenv.touch = true;\nif (agent.indexOf(\"Opera\")!=-1)\n\tenv.isOpera=true;\nelse{\n\t//very rough detection, but it is enough for current goals\n\tenv.isIE=!!document.all || (agent.indexOf(\"Trident\") !== -1);\n\tif (env.isIE){\n\t\tvar version = parseFloat(navigator.appVersion.split(\"MSIE\")[1]);\n\t\tif (version == 8)\n\t\t\tenv.isIE8 = true;\n\t}\n\tenv.isEdge=(agent.indexOf(\"Edge\")!=-1);\n\tenv.isFF=(agent.indexOf(\"Firefox\")!=-1);\n\tenv.isWebKit=(agent.indexOf(\"KHTML\")!=-1);\n\tenv.isSafari=env.isWebKit && env.isMac && (agent.indexOf(\"Chrome\")==-1);\n\n\t//maximum height/width for HTML elements in pixels (rough), bigger values will be ignored by browser\n\tif(env.isIE || env.isEdge || env.isFF)\n\t\tenv.maxHTMLElementSize = 10000000;\n\tif(env.isSafari)\n\t\tenv.maxHTMLElementSize = 100000000;\n}\n\nif(agent.toLowerCase().indexOf(\"android\")!=-1){\n\tenv.isAndroid = true;\n\tif(agent.toLowerCase().indexOf(\"trident\")!=-1){\n\t\tenv.isAndroid = false;\n\t\tenv.isIEMobile = true;\n\t}\n}\n\nenv.transform = false;\nenv.transition = false;\n\nvar found_index = -1;\nvar js_list = [\"\", \"webkit\", \"Moz\", \"O\", \"ms\"];\nvar css_list = [\"\", \"-webkit-\", \"-Moz-\", \"-o-\", \"-ms-\"];\n\n\nvar d = document.createElement(\"DIV\");\nfor (var j=0; j < js_list.length; j++) {\n\tvar name = js_list[j] ? (js_list[j]+\"Transform\") : \"transform\";\n\tif(typeof d.style[name] != \"undefined\"){\n\t\tfound_index = j;\n\t\tbreak;\n\t}\n}\n\n\nif (found_index > -1){\n\tenv.cssPrefix = css_list[found_index];\n\tvar jp = env.jsPrefix = js_list[found_index];\n\n\tenv.transform = jp ? jp+\"Transform\" : \"transform\";\n\tenv.transition = jp ? jp+\"Transition\" : \"transition\";\n\tenv.transitionDuration = jp ? jp+\"TransitionDuration\" : \"transitionDuration\";\n\n\td.style[env.transform] = \"translate3d(0,0,0)\";\n\tenv.translate = (d.style[env.transform])?\"translate3d\":\"translate\";\n\tenv.transitionEnd = ((env.cssPrefix == \"-Moz-\")?\"transitionend\":(jp ? jp+\"TransitionEnd\" : \"transitionend\"));\n}\n\nenv.pointerevents = (!env.isIE ||(new RegExp(\"Trident/.*rv:11\")).exec(agent) !== null);\n\n//touch events that can be prevented\nenv.passiveEventListeners = false;\ntry {\n\tvar opts = Object.defineProperty({}, \"passive\", {\n\t\tget: function() { // eslint-disable-line\n\t\t\tenv.passiveEventListeners = true;\n\t\t}\n\t});\n\twindow.addEventListener(\"testPassive\", null, opts);\n\twindow.removeEventListener(\"testPassive\", null, opts);\n} catch (e) {} // eslint-disable-line\n\nenv.svg = (function(){\n\treturn document.implementation.hasFeature(\"http://www.w3.org/TR/SVG11/feature#BasicStructure\", \"1.1\");\n})();\n\nenv.svganimation = (function(){\n\treturn document.implementation.hasFeature(\"https://www.w3.org/TR/SVG11/feature#SVG-animation\", \"1.1\");\n})();\n\nexport default env;","// resolves circular dependencies\n// quick solution, must be removed in the next versions\n\nconst services = {};\nexport function define(name, value){\n\tservices[name] = value;\n}\n\nexport function use(name){\n\treturn services[name];\n}","// debugger helpers\n// assert and log calls are removed in min versions\n\nimport { use } from \"../services\";\n\n//check some rule, show message as error if rule is not correct\nexport function assert(test, msg){\n\tif (!test){\n\t\tlog(\"error\",msg);\n\t\tlet message = use(\"message\");\n\t\tif (message && typeof msg == \"string\")\n\t\t\tmessage({ type:\"debug\", text:msg, expire:-1 });\n\t\t\tdebugger; // eslint-disable-line\n\t}\n}\n\n//show log message\nexport function log(type,message,details){\n\tif (arguments.length == 1){\n\t\tmessage = type;\n\t\ttype = \"log\";\n\t}\n\tif (window.console && window.console.log){\n\t\ttype=type.toLowerCase();\n\t\tif (window.console[type])\n\t\t\twindow.console[type](message||\"unknown error\");\n\t\telse\n\t\t\twindow.console.log(type +\": \"+message);\n\n\t\tif (details) \n\t\t\twindow.console.log(details);\n\t}\n}\n\nexport var debug_mode = {};\n\nexport function debug(mode){\n\tif (!mode)\n\t\tdebug_mode = {};\n\telse if (typeof mode !== \"object\")\n\t\tdebug_mode = { events: true };\n\telse \n\t\tfor (var key in mode) debug_mode[key] = mode[key];\n}\n\nlet debug_size_indent = 0;\nfunction debug_size_step(){\n\tvar str = \"\";\n\tfor (let i=0; i1){\n\t\ttarget = arguments[0];\n\t\tsource = arguments[1];\n\t} else \n\t\ttarget = (isArray(source)?[]:{});\n\n\tfor (var method in source){\n\t\tvar from = source[method];\n\t\tif(from && typeof from == \"object\" && !(from instanceof RegExp)){\n\t\t\tif (isDate(from))\n\t\t\t\ttarget[method] = new Date(from);\n\t\t\t/* jshint ignore:start */\n\t\t\telse if (esModern && (from instanceof Map || from instanceof Set || from instanceof WeakMap || from instanceof WeakSet))\n\t\t\t\ttarget[method] = from;\n\t\t\t/* jshint ignore:end */\n\t\t\telse {\n\t\t\t\ttarget[method] = (isArray(from)?[]:{});\n\t\t\t\tcopy(target[method],from);\n\t\t\t}\n\t\t} else {\n\t\t\ttarget[method] = from;\n\t\t}\n\t}\n\n\tif (DEBUG) level_out();\n\treturn target;\t\n}\n\nexport function single(source){ \n\tvar instance = null;\n\tvar t = function(){\n\t\tif (!instance)\n\t\t\tinstance = new source({});\n\t\t\t\n\t\tif (instance._reinit)\n\t\t\tinstance._reinit.apply(instance, arguments);\n\t\treturn instance;\n\t};\n\treturn t;\n}\n\n\n//creates function with specified \"this\" pointer\nexport function bind(functor, object){ \n\treturn function(){ return functor.apply(object,arguments); }; \n}\n\n\n//evaluate javascript code in the global scoope\nexport function exec(code){\n\tif (window.execScript)\t//special handling for IE\n\t\twindow.execScript(code);\n\telse window.eval(code);\n}\n\nexport function wrap(code, wrap){\n\tif (!code) return wrap;\n\treturn function(){\n\t\tvar result = code.apply(this, arguments);\n\t\twrap.apply(this,arguments);\n\t\treturn result;\n\t};\n}\n\n//check === undefined\nexport function isUndefined(a){\n\treturn typeof a == \"undefined\";\n}\n//delay call to after-render time\nexport function delay(method, obj, params, delay){\n\treturn window.setTimeout(function(){\n\t\tif(!(obj&&obj.$destructed)){\n\t\t\tvar ret = method.apply(obj,(params||[]));\n\t\t\tmethod = obj = params = null;\n\t\t\treturn ret;\n\t\t}\n\t},delay||1);\n}\n\nexport function once(method){\n\tvar flag = true;\n\treturn function(){\n\t\tif (flag){\n\t\t\tflag = false;\n\t\t\tmethod.apply(this, arguments);\n\t\t}\n\t};\n}\n\n//common helpers\n\n//generates unique ID (unique per window, nog GUID)\nlet _seed = (new Date()).valueOf();\nexport function uid(){\n\t_seed++;\n\treturn _seed;\n}\n//resolve ID as html object\nexport function toNode(node){\n\tif (typeof node == \"string\") return document.getElementById(node);\n\treturn node;\n}\n//adds extra methods for the array\nexport function toArray(array){ \n\treturn extend((array||[]),PowerArray, true);\n}\n//resolve function name\nexport function toFunctor(str, scope){ \n\tif (typeof(str)==\"string\"){\n\t\tvar method = str.replace(\"()\",\"\");\n\t\tif (scope && scope[method]) return scope[method];\n\t\treturn window[method] || window.eval(str);\n\t}\n\treturn str;\n}\n/*checks where an object is instance of Array*/\nexport function isArray(obj) {\n\treturn Array.isArray?Array.isArray(obj):(Object.prototype.toString.call(obj) === \"[object Array]\");\n}\nexport function isDate(obj){\n\treturn obj instanceof Date;\n}\n\n//can be used by toArray()\nexport const PowerArray={\n\t//remove element at specified position\n\tremoveAt:function(pos,len){\n\t\tif (pos>=0) this.splice(pos,(len||1));\n\t},\n\t//find element in collection and remove it \n\tremove:function(value){\n\t\tthis.removeAt(this.find(value));\n\t},\t\n\t//add element to collection at specific position\n\tinsertAt:function(data,pos){\n\t\tif (!pos && pos!==0)\t//add to the end by default\n\t\t\tthis.push(data);\n\t\telse {\t\n\t\t\tvar b = this.splice(pos,(this.length-pos));\n\t\t\tthis[pos] = data;\n\t\t\tthis.push.apply(this,b); //reconstruct array without loosing this pointer\n\t\t}\n\t},\n\t//return index of element, -1 if it doesn't exists\n\tfind:function(data){ \n\t\tfor (var i=0; i handler\n\t\t\tthis._evs_handlers = {};\t//hash of event handlers, ID => handler\n\t\t\tthis._evs_map = {};\n\t\t}\n\t},\n\t//temporary block event triggering\n\tblockEvent : function(){\n\t\tthis._evs_events._block = true;\n\t},\n\t//re-enable event triggering\n\tunblockEvent : function(){\n\t\tthis._evs_events._block = false;\n\t},\n\tmapEvent:function(map){\n\t\textend(this._evs_map, map, true);\n\t},\n\ton_setter:function(config){\n\t\tif(config){\n\t\t\tfor(var i in config){\n\t\t\t\tvar method = toFunctor(config[i], this.$scope);\n\t\t\t\tvar sub = i.indexOf(\"->\");\n\t\t\t\tif (sub !== -1){\n\t\t\t\t\tthis[i.substr(0,sub)].attachEvent(i.substr(sub+2), bind(method, this));\n\t\t\t\t} else\n\t\t\t\t\tthis.attachEvent(i, method);\n\t\t\t}\n\t\t}\n\t},\n\t//trigger event\n\tcallEvent:function(type,params){\n\t\tconst master = this._event_master || this;\n\t\tif (this._evs_events._block) return true;\n\t\t\n\t\ttype = type.toLowerCase();\n\t\tvar event_stack =this._evs_events[type.toLowerCase()];\t//all events for provided name\n\t\tvar return_value = true;\n\n\t\tif (DEBUG)\n\t\t\tif ((debug_mode.events || this.debug) && type !== \"onmousemoving\" )\t//can slowdown a lot\n\t\t\t\tlog(\"info\",\"[\"+this.name+\"@\"+((this._settings||{}).id)+\"] event:\"+type,params);\n\t\t\n\t\tif (event_stack)\n\t\t\tfor(var i=0; i evs.callEvent(a, b);\nexport const attachEvent = (a,b,c,d) => evs.attachEvent(a, b, c, d);\nexport const detachEvent = (a) => evs.detachEvent(a);\nexport const blockEvent = () => evs.blockEvent();\nexport const unblockEvent = () => evs.unblockEvent();\nexport const mapEvent = map => evs.mapEvent(map);\nexport const hasEvent = type => evs.hasEvent(type);\n","import {delay, uid, toNode, isUndefined} from \"./helpers.js\";\nimport env from \"./env.js\";\n\nlet _native_on_selectstart = 0;\nconst _style_element = {};\nconst _style_cache = {};\n\nexport function denySelect(){\n\tif (!_native_on_selectstart)\n\t\t_native_on_selectstart = document.onselectstart;\n\tdocument.onselectstart = stopEvent;\n}\n\nexport function allowSelect(){\n\tif (_native_on_selectstart !== 0){\n\t\tdocument.onselectstart = _native_on_selectstart||null;\n\t}\n\t_native_on_selectstart = 0;\n\n}\n\nexport function index(node){\n\tvar k=0;\n\t//must be =, it is not a comparation!\n\twhile ((node = node.previousSibling)) k++;\n\treturn k;\n}\n\nexport function createCss(rule, sufix){\n\tvar text = \"\";\n\tsufix = sufix || \"\";\n\n\tfor (var key in rule)\n\t\ttext+= key+\":\"+rule[key]+\";\";\n \n\tvar name = _style_cache[text+sufix];\n\tif (!name){\n\t\tname = \"s\"+uid();\n\t\taddStyle(\".\"+name+(sufix||\"\")+\"{\"+text+\"}\");\n\t\t_style_cache[text+sufix] = name;\n\t}\n\treturn name;\n}\n\nexport function addStyle(rule, group){\n\tvar style = group ? _style_element[group] :_style_element[\"default\"];\n\tif(!style){\n\t\tstyle = document.createElement(\"style\");\n\t\tstyle.setAttribute(\"type\", \"text/css\");\n\t\tstyle.setAttribute(\"media\", \"screen,print\");\n\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(style);\n\n\t\tif (group)\n\t\t\t_style_element[group] = style;\n\t\telse\n\t\t\t_style_element[\"default\"] = style;\n\t}\n\t/*IE8*/\n\tif (style.styleSheet)\n\t\tstyle.styleSheet.cssText += rule;\n\telse\n\t\tstyle.appendChild(document.createTextNode(rule));\n}\n\nexport function removeStyle(group){\n\tvar box = _style_element[group||\"default\"];\n\tif (box)\n\t\tbox.innerHTML = \"\";\n}\n\nexport function create(name,attrs,html){\n\tattrs = attrs || {};\n\tvar node = document.createElement(name);\n\tfor (var attr_name in attrs)\n\t\tnode.setAttribute(attr_name, attrs[attr_name]);\n\tif (attrs.style)\n\t\tnode.style.cssText = attrs.style;\n\tif (attrs[\"class\"])\n\t\tnode.className = attrs[\"class\"];\n\tif (html)\n\t\tnode.innerHTML=html;\n\treturn node;\n}\n\n//return node value, different logic for different html elements\nexport function getValue(node){\n\tnode = toNode(node);\n\tif (!node) return \"\";\n\treturn isUndefined(node.value)?node.innerHTML:node.value;\n}\n\n//remove html node, can process an array of nodes at once\nexport function remove(node){\n\tif (node instanceof Array)\n\t\tfor (var i=0; i < node.length; i++)\n\t\t\tremove(node[i]);\n\telse if (node && node.parentNode)\n\t\tnode.parentNode.removeChild(node);\n}\n\n//insert new node before sibling, or at the end if sibling doesn't exist\nexport function insertBefore(node,before,rescue){\n\tif (!node) return;\n\tif (before && before.parentNode)\n\t\tbefore.parentNode.insertBefore(node, before);\n\telse\n\t\trescue.appendChild(node);\n}\n\n//return custom ID from html element \n//will check all parents starting from event's target\nexport function locate(e,id){\n\tvar trg;\n\tif (e.tagName)\n\t\ttrg = e;\n\telse {\n\t\te=e||event;\n\t\ttrg=e.target||e.srcElement;\n\t}\n \n\twhile (trg){\n\t\tif (trg.getAttribute){\t//text nodes has not getAttribute\n\t\t\tvar test = trg.getAttribute(id);\n\t\t\tif (test) return test;\n\t\t}\n\t\ttrg=trg.parentNode;\n\t}\t\n\treturn null;\n}\n\n//returns position of html element on the page\nexport function offset(elem) {\n\tif (elem.getBoundingClientRect) { //HTML5 method\n\t\tconst box = elem.getBoundingClientRect();\n\t\tconst body = document.body;\n\t\tconst docElem = document.documentElement;\n\t\tconst scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;\n\t\tconst scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;\n\t\tconst clientTop = docElem.clientTop || body.clientTop || 0;\n\t\tconst clientLeft = docElem.clientLeft || body.clientLeft || 0;\n\t\tconst top = box.top + scrollTop - clientTop;\n\t\tconst left = box.left + scrollLeft - clientLeft;\n\t\treturn { y: Math.round(top), x: Math.round(left), width:elem.offsetWidth, height:elem.offsetHeight };\n\t} else { //fallback to naive approach\n\t\tlet top=0, left=0;\n\t\twhile(elem) {\n\t\t\ttop = top + parseInt(elem.offsetTop,10);\n\t\t\tleft = left + parseInt(elem.offsetLeft,10);\n\t\t\telem = elem.offsetParent;\n\t\t}\n\t\treturn { y: top, x: left, width:elem.offsetHeight, height:elem.offsetWidth };\n\t}\n}\n\n//returns relative position of event\nexport function posRelative(ev){\n\tev = ev || event;\n\tif (!isUndefined(ev.offsetX))\n\t\treturn { x:ev.offsetX, y:ev.offsetY };\t//ie, webkit\n\telse\n\t\treturn { x:ev.layerX, y:ev.layerY };\t//firefox\n}\n\n//returns position of event\nexport function pos(ev){\n\tev = ev || event;\n\tif (ev.touches && ev.touches[0])\n\t\tev = ev.touches[0];\n\n\tif(ev.pageX || ev.pageY)\t//FF, KHTML\n\t\treturn {x:ev.pageX, y:ev.pageY};\n\t//IE\n\tvar d = ((env.isIE)&&(document.compatMode != \"BackCompat\"))?document.documentElement:document.body;\n\treturn {\n\t\tx:ev.clientX + d.scrollLeft - d.clientLeft,\n\t\ty:ev.clientY + d.scrollTop - d.clientTop\n\t};\n}\n\n//prevent event action\nexport function preventEvent(e){\n\tif(e && e.preventDefault) e.preventDefault();\n\tif(e) e.returnValue = false;\n\treturn stopEvent(e);\n}\n\n//stop event bubbling\nexport function stopEvent(e){\n\te = (e||event);\n\tif(e.stopPropagation) e.stopPropagation();\n\te.cancelBubble=true;\n\treturn false;\n}\n\nexport function triggerEvent(node, type, name){\n\tif(document.createEventObject){\n\t\tconst ev = document.createEventObject();\n\t\tif (node.fireEvent)\n\t\t\tnode.fireEvent(\"on\"+name, ev);\n\t} else{\n\t\tconst ev = document.createEvent(type);\n\t\tev.initEvent(name, true, true);\n\t\tif (node.dispatchEvent)\n\t\t\tnode.dispatchEvent(ev);\n\t}\n}\n\n//add css class to the node\nexport function addCss(node,name,check){\n\tif (!check || node.className.indexOf(name) === -1)\n\t\tnode.className+=\" \"+name;\n}\n\n//remove css class from the node\nexport function removeCss(node,name){\n\tnode.className=node.className.replace(RegExp(\" \"+name,\"g\"),\"\");\n}\n\nexport function getTextSize(text, css, basewidth){\n\tvar d = create(\"DIV\",{\"class\":\"webix_view webix_measure_size \"+(css||\"\")},\"\");\n\td.style.cssText = \"height:auto;visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;\"+(basewidth?(\"width:\"+basewidth+\"px;\"):\"width:auto;white-space:nowrap;\");\n\tdocument.body.appendChild(d);\n\n\tvar all = (typeof text !== \"object\") ? [text] : text;\n\tvar width = 0;\n\tvar height = 0;\n\n\tfor (var i = 0; i < all.length; i++) {\n\t\td.innerHTML = all[i];\n\t\twidth = Math.max(width, d.offsetWidth);\n\t\theight = Math.max(height, d.offsetHeight);\n\t}\n \n\tremove(d);\n\treturn { width:width, height:height };\n}\n\nexport function download(data, filename){\n\tvar objUrl = false;\n\n\tif(typeof data ==\"object\"){//blob\n\t\tif(window.navigator.msSaveBlob)\n\t\t\treturn window.navigator.msSaveBlob(data, filename);\n\t\telse {\n\t\t\tdata = window.URL.createObjectURL(data);\n\t\t\tobjUrl = true;\n\t\t}\n\t}\n\t//data url or blob url\n\tvar link = document.createElement(\"a\");\n\tlink.href = data;\n\tlink.download = filename;\n\tdocument.body.appendChild(link);\n\tlink.click(); \n\n\tdelay(function(){\n\t\tif(objUrl) window.URL.revokeObjectURL(data);\n\t\tdocument.body.removeChild(link);\n\t\tlink.remove();\n\t});\n}\n\nexport function _getClassName(node){\n\tif(!node) return \"\";\n\n\tvar className = node.className || \"\";\n\tif(className.baseVal)//'className' exist but not a string - IE svg element in DOM\n\t\tclassName = className.baseVal;\n\n\tif(!className.indexOf)\n\t\tclassName = \"\";\n\n\treturn className;\n}\n\nexport function setSelectionRange(node, start, end){\n\tstart = start || 0;\n\tend = end || start;\n\n\tnode.focus();\n\tif(node.setSelectionRange)\n\t\tnode.setSelectionRange(start, end);\n\telse{\n\t\t//ie8\n\t\tvar textRange = node.createTextRange();\n\t\ttextRange.collapse(true);\n\t\ttextRange.moveEnd(\"character\", end);\n\t\ttextRange.moveStart(\"character\", start);\n\t\ttextRange.select();\n\t}\n}\n\nexport function getSelectionRange(node){\n\tif(\"selectionStart\" in node)\n\t\treturn {start:node.selectionStart || 0, end:node.selectionEnd || 0};\n\telse{\n\t\t//ie8\n\t\tnode.focus();\n\t\tvar selection = document.selection.createRange();\n\t\tvar bookmark = selection.getBookmark();\n\t\tvar textRange = node.createTextRange();\n\n\t\ttextRange.moveToBookmark(bookmark);\n\t\tvar length = textRange.text.length;\n \n\t\ttextRange.collapse(true);\n\t\ttextRange.moveStart(\"character\", -node.value.length);\n\n\t\tvar start = textRange.text.length;\n\t\treturn {start:start, end: start + length};\n\t}\n}\n\nexport function addMeta(name, value){\n\tdocument.getElementsByTagName(\"head\").item(0).appendChild(create(\"meta\",{\n\t\tname:name,\n\t\tcontent:value\n\t}));\t\n}\n\n","const i18n = {\n\tparseFormat:\"%Y-%m-%d %H:%i\",\n\tparseTimeFormat:\"%H:%i\",\n};\n\n\nexport default i18n;","import i18n from \"./i18n.js\";\n\n// converts an object into a string with respect to dates\nexport function stringify(obj){\n\tvar origin = Date.prototype.toJSON;\n\tDate.prototype.toJSON = function(){\n\t\treturn i18n.parseFormatStr(this);\n\t};\n\n\tvar result;\n\tif (obj instanceof Date)\n\t\tresult = obj.toJSON();\n\telse\n\t\tresult = JSON.stringify(obj);\n\n\tDate.prototype.toJSON = origin;\n\treturn result;\n}","var global = window;\n\nvar queueId = 1;\nvar queue = {};\nvar isRunningTask = false;\n\nif (!global.setImmediate && global.addEventListener)\n\tglobal.addEventListener(\"message\", function (e) {\n\t\tif (e.source == global){\n\t\t\tif (isRunningTask)\n\t\t\t\tnextTick(queue[e.data]);\n\t\t\telse {\n\t\t\t\tisRunningTask = true;\n\t\t\t\ttry {\n\t\t\t\t\tqueue[e.data]();\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// eslint-disable-line\n\t\t\t\t}\n\n\t\t\t\tdelete queue[e.data];\n\t\t\t\tisRunningTask = false;\n\t\t\t}\n\t\t}\n\t});\n\nfunction nextTick(fn) {\n\tif (global.setImmediate) global.setImmediate(fn);\n\t// if inside of web worker\n\telse if (global.importScripts || !global.addEventListener) setTimeout(fn);\n\telse {\n\t\tqueueId++;\n\t\tqueue[queueId] = fn;\n\t\tglobal.postMessage(queueId, \"*\");\n\t}\n}\n\nDeferred.resolve = function (value) {\n\tif (!(this._d == 1))\n\t\tthrow TypeError();\n\n\tif (value instanceof Deferred)\n\t\treturn value;\n\n\treturn new Deferred(function (resolve) {\n\t\tresolve(value);\n\t});\n};\n\nDeferred.reject = function (value) {\n\tif (!(this._d == 1))\n\t\tthrow TypeError();\n\n\treturn new Deferred(function (resolve, reject) {\n\t\treject(value);\n\t});\n};\n\nDeferred.all = function (arr) {\n\tif (!(this._d == 1))\n\t\tthrow TypeError();\n\n\tif (!(arr instanceof Array))\n\t\treturn Deferred.reject(TypeError());\n\n\tvar d = new Deferred();\n\n\tfunction done(e, v) {\n\t\tif (v)\n\t\t\treturn d.resolve(v);\n\n\t\tif (e)\n\t\t\treturn d.reject(e);\n\n\t\tvar unresolved = arr.reduce(function (cnt, v) {\n\t\t\tif (v && v.then)\n\t\t\t\treturn cnt + 1;\n\t\t\treturn cnt;\n\t\t}, 0);\n\n\t\tif(unresolved == 0)\n\t\t\td.resolve(arr);\n\n\n\t\tarr.map(function (v, i) {\n\t\t\tif (v && v.then)\n\t\t\t\tv.then(function (r) {\n\t\t\t\t\tarr[i] = r;\n\t\t\t\t\tdone();\n\t\t\t\t\treturn r;\n\t\t\t\t}, done);\n\t\t});\n\t}\n\n\tdone();\n\n\treturn d;\n};\n\nDeferred.race = function (arr) {\n\tif (!(this._d == 1))\n\t\tthrow TypeError();\n\n\tif (!(arr instanceof Array))\n\t\treturn Deferred.reject(TypeError());\n\n\tif (arr.length == 0)\n\t\treturn new Deferred();\n\n\tvar d = new Deferred();\n\n\tfunction done(e, v) {\n\t\tif (v)\n\t\t\treturn d.resolve(v);\n\n\t\tif (e)\n\t\t\treturn d.reject(e);\n\n\t\tvar unresolved = arr.reduce(function (cnt, v) {\n\t\t\tif (v && v.then)\n\t\t\t\treturn cnt + 1;\n\t\t\treturn cnt;\n\t\t}, 0);\n\n\t\tif(unresolved == 0)\n\t\t\td.resolve(arr);\n\n\t\tarr.map(function (v) {\n\t\t\tif (v && v.then)\n\t\t\t\tv.then(function (r) {\n\t\t\t\t\tdone(null, r);\n\t\t\t\t}, done);\n\t\t});\n\t}\n\n\tdone();\n\n\treturn d;\n};\n\nDeferred._d = 1;\n\n\n/**\n * @constructor\n */\nfunction Deferred(resolver) {\n\t\"use strict\";\n\tif (typeof resolver != \"function\" && resolver != undefined)\n\t\tthrow TypeError();\n\t\t\n\tif (typeof this != \"object\" || (this && this.then))\n\t\tthrow TypeError();\n\n\t// states\n\t// 0: pending\n\t// 1: resolving\n\t// 2: rejecting\n\t// 3: resolved\n\t// 4: rejected\n\tvar self = this,\n\t\tstate = 0,\n\t\tval = 0,\n\t\tnext = [],\n\t\tfn, er;\n\n\tself[\"promise\"] = self;\n\n\tself[\"resolve\"] = function (v) {\n\t\tfn = self.fn;\n\t\ter = self.er;\n\t\tif (!state) {\n\t\t\tval = v;\n\t\t\tstate = 1;\n\n\t\t\tnextTick(fire);\n\t\t}\n\t\treturn self;\n\t};\n\n\tself[\"reject\"] = function (v) {\n\t\tfn = self.fn;\n\t\ter = self.er;\n\t\tif (!state) {\n\t\t\tval = v;\n\t\t\tstate = 2;\n\n\t\t\tnextTick(fire);\n\n\t\t}\n\t\treturn self;\n\t};\n\n\tself[\"_d\"] = 1;\n\n\tself[\"then\"] = function (_fn, _er) {\n\t\tif (!(this._d == 1))\n\t\t\tthrow TypeError();\n\n\t\tvar d = new Deferred();\n\n\t\td.fn = _fn;\n\t\td.er = _er;\n\t\tif (state == 3) {\n\t\t\td.resolve(val);\n\t\t}\n\t\telse if (state == 4) {\n\t\t\td.reject(val);\n\t\t}\n\t\telse {\n\t\t\tnext.push(d);\n\t\t}\n\n\t\treturn d;\n\t};\n\n\tself[\"catch\"] = function (_er) {\n\t\treturn self[\"then\"](null, _er);\n\t};\n\n\t//compatibility with old version of promiz lib\n\tself[\"fail\"] = function (_er) {\n\t\treturn self[\"then\"](null, _er);\n\t};\n\n\tvar finish = function (type) {\n\t\tstate = type || 4;\n\t\tfor (var i=0; i= 400 || x.status === 0;\n\t\t\t\t\tvar text, data;\n\t\t\t\t\tif (x.responseType == \"blob\" || x.responseType == \"arraybuffer\"){\n\t\t\t\t\t\ttext = \"\";\n\t\t\t\t\t\tdata = x.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttext = x.responseText||\"\";\n\t\t\t\t\t\tdata = self._data(x);\n\t\t\t\t\t}\n\n\t\t\t\t\tajax.$callback(owner, call, text, data, x, is_error);\n\t\t\t\t}\n\t\t\t\tif (self) self.master=null;\n\t\t\t\tcall=self=master=null;\t//anti-leak\n\t\t\t}\n\t\t};\n\n\t\tif (this._timeout)\n\t\t\tx.timeout = this._timeout;\n\n\t\t//IE can use sync mode sometimes, fix it\n\t\tif (!this._sync)\n\t\t\tsetTimeout(function(){\n\t\t\t\tif (!x.aborted){\n\t\t\t\t\t//abort handling in IE9\n\t\t\t\t\tif (_xhr_aborted.find(x) != -1)\n\t\t\t\t\t\t_xhr_aborted.remove(x);\n\t\t\t\t\telse\n\t\t\t\t\t\tx.send(params||null);\n\t\t\t\t}\n\t\t\t}, 1);\n\t\telse\n\t\t\tx.send(params||null);\n\n\t\tif (this.master && this.master._ajax_queue)\n\t\t\tthis.master._ajax_queue.push(x);\n\n\t\treturn this._sync?x:defer; //return XHR, which can be used in case of sync. mode\n\t},\n\t_data:function(x){\n\t\treturn {\n\t\t\txml:function(){ \n\t\t\t\ttry{\n\t\t\t\t\treturn xml.tagToObject(xml.toObject(x.responseText, this));\n\t\t\t\t}\n\t\t\t\tcatch(e){\n\t\t\t\t\tlog(x.responseText);\n\t\t\t\t\tlog(e.toString()); assert(0, \"Invalid xml data for parsing\"); \n\t\t\t\t}\n\t\t\t},\n\t\t\trawxml:function(){ \n\t\t\t\tif (!window.XPathResult)\n\t\t\t\t\treturn xml.fromString(x.responseText);\n\t\t\t\treturn x.responseXML;\n\t\t\t},\n\t\t\ttext:function(){ return x.responseText; },\n\t\t\tjson:function(){\n\t\t\t\treturn json.toObject(x.responseText, false);\n\t\t\t}\n\t\t};\n\t},\n\t//GET request\n\tget:function(url,params,call){\n\t\treturn this._send(url,params,call,\"GET\");\n\t},\n\t//POST request\n\tpost:function(url,params,call){\n\t\treturn this._send(url,params,call,\"POST\");\n\t},\n\t//PUT request\n\tput:function(url,params,call){\n\t\treturn this._send(url,params,call,\"PUT\");\n\t},\n\t//DELETE request\n\tdel:function(url,params,call){\n\t\treturn this._send(url,params,call,\"DELETE\");\n\t},\n\t//PATCH request\n\tpatch:function(url,params,call){\n\t\treturn this._send(url,params,call,\"PATCH\");\n\t},\n\n\tsync:function(){\n\t\tthis._sync = true;\n\t\treturn this;\n\t},\n\ttimeout:function(num){\n\t\tthis._timeout = num;\n\t\treturn this;\n\t},\n\tresponse:function(value){\n\t\tthis._response = value;\n\t\treturn this;\n\t},\n\t//deprecated, remove in 3.0\n\t//[DEPRECATED]\n\theader:function(header){\n\t\tassert(false, \"ajax.header is deprecated in favor of ajax.headers\");\n\t\tthis._header = header;\n\t\treturn this;\n\t},\n\theaders:function(header){\n\t\tthis._header = extend(this._header||{},header);\n\t\treturn this;\n\t},\n\tbind:function(master){\n\t\tthis.master = master;\n\t\treturn this;\n\t}\n};\najax.$callback = function(owner, call, text, data, x, is_error){\n\tif (owner.$destructed) return;\n\tif (x === -1 && data && typeof data.json == \"function\")\n\t\tdata = data.json();\n\n\tif (is_error)\n\t\tcallEvent(\"onAjaxError\", [x]);\n\n\tif (!isArray(call))\n\t\tcall = [call];\n\n\tif (!is_error)\n\t\tfor (let i=0; i < call.length; i++){\n\t\t\tif (call[i]){\n\t\t\t\tvar before = call[i].before;\n\t\t\t\tif (before)\n\t\t\t\t\tbefore.call(owner, text, data, x);\n\t\t\t}\n\t\t}\n\n\tfor (let i=0; i < call.length; i++)\t//there can be multiple callbacks\n\t\tif (call[i]){\n\t\t\tvar method = (call[i].success||call[i]);\n\t\t\tif (is_error)\n\t\t\t\tmethod = call[i].error;\n\t\t\tif (method && method.call)\n\t\t\t\tmethod.call(owner,text,data,x);\n\t\t}\n};","import {isDate, isArray} from \"../webix/helpers\";\n\nconst CodeParser = {\n\t//converts a complex object into an object with primitives properties\n\tcollapseNames:function(base, prefix, data){\n\t\tdata = data || {};\n\t\tprefix = prefix || \"\";\n\n\t\tif(!base || typeof base != \"object\")\n\t\t\treturn null;\n\n\t\tfor(var prop in base){\n\t\t\tif(base[prop] && typeof base[prop] == \"object\" && !isDate(base[prop]) && !isArray(base[prop])){\n\t\t\t\tCodeParser.collapseNames(base[prop], prefix+prop+\".\", data);\n\t\t\t} else {\n\t\t\t\tdata[prefix+prop] = base[prop];\n\t\t\t}\n\t\t}\n\t\treturn data;\n\t},\n\n\t//converts an object with primitive properties into an object with complex properties\n\texpandNames:function(base){\n\t\tvar data = {},\n\t\t\ti, lastIndex, name, obj, prop;\n\n\t\tfor(prop in base){\n\t\t\tname = prop.split(\".\");\n\t\t\tlastIndex = name.length-1;\n\t\t\tobj = data;\n\t\t\tfor( i =0; i < lastIndex; i++ ){\n\t\t\t\tif(!obj[name[i]])\n\t\t\t\t\tobj[name[i]] = {};\n\t\t\t\tobj = obj[name[i]];\n\t\t\t}\n\t\t\tobj[name[lastIndex]] = base[prop];\n\t\t}\n\n\t\treturn data;\n\t}\n};\n\nexport default CodeParser;","/*\n\tTemplate - handles html templates\n*/\n\nimport {uid} from \"./helpers\";\nimport {getValue} from \"./html\";\nimport env from \"./env\";\nimport {ajax} from \"../load/ajax\";\nimport {assert} from \"./debug\";\n\nimport CodeParser from \"../core/codeparser\";\n\nvar _cache = {};\nvar _csp_cache = {};\nvar newlines = new RegExp(\"(\\\\r\\\\n|\\\\n)\",\"g\");\nvar quotes = new RegExp(\"(\\\\\\\")\",\"g\");\nvar slashes = new RegExp(\"(\\\\\\\\)\",\"g\");\nvar escape = {\n\t\"&\": \"&\",\n\t\"<\": \"<\",\n\t\">\": \">\",\n\t\"\\\"\": \""\",\n\t\"'\": \"'\",\n\t\"`\": \"`\"\n};\nvar badChars = /[&<>\"'`]/g;\nvar escapeChar = function(chr) {\n\treturn escape[chr] || \"&\";\n};\n\n\nfunction template(str){\n\tif (typeof str == \"function\") return str;\n\tif (_cache[str])\n\t\treturn _cache[str];\n\t\t\n\tstr=(str||\"\").toString();\t\t\t\n\tif (str.indexOf(\"->\")!=-1){\n\t\tvar teststr = str.split(\"->\");\n\t\tswitch(teststr[0]){\n\t\t\tcase \"html\": \t//load from some container on the page\n\t\t\t\tstr = getValue(teststr[1]);\n\t\t\t\tbreak;\n\t\t\tcase \"http\": \t//load from external file\n\t\t\t\tstr = new ajax().sync().get(teststr[1],{uid:uid()}).responseText;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t//do nothing, will use template as is\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\t\n\t//supported idioms\n\t// {obj.attr} => named attribute or value of sub-tag in case of xml\n\tstr=(str||\"\").toString();\t\t\n\n\t// Content Security Policy enabled\n\tif(env.strict){\n\t\tif (!_csp_cache[str]){\n\t\t\t_csp_cache[str] = [];\n\n\t\t\t// get an array of objects (not sorted by position)\n\t\t\tvar temp_res = [];\n\t\t\tstr.replace(/\\{obj\\.([^}?]+)\\?([^:]*):([^}]*)\\}/g,function(search,s1,s2,s3,pos){\n\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj){\n\t\t\t\t\treturn obj[s1]?s2:s3;\n\t\t\t\t}});\n\t\t\t});\n\t\t\tstr.replace(/\\{common\\.([^}(]*)\\}/g,function(search,s,pos){\n\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(_,common){\n\t\t\t\t\treturn common[s]||\"\";\n\t\t\t\t}});\n\t\t\t});\n\t\t\tstr.replace(/\\{common\\.([^}(]*)\\(\\)\\}/g,function(search,s,pos){\n\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj,common){\n\t\t\t\t\treturn (common[s]?common[s].apply(this, arguments):\"\");\n\t\t\t\t}});\n\t\t\t});\n\t\t\tstr.replace(/\\{obj\\.([^:}]*)\\}/g,function(search,s,pos){\n\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj){\n\t\t\t\t\treturn obj[s];\n\t\t\t\t}});\n\t\t\t});\n\t\t\tstr.replace(\"{obj}\",function(search,s,pos){\n\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj){\n\t\t\t\t\treturn obj;\n\t\t\t\t}});\n\t\t\t});\n\t\t\tstr.replace(/#([^#'\";, ]+)#/gi,function(search,s,pos){\n\t\t\t\tif(s.charAt(0)==\"!\"){\n\t\t\t\t\ts = s.substr(1);\n\t\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj){\n\t\t\t\t\t\tif(s.indexOf(\".\")!= -1)\n\t\t\t\t\t\t\tobj = CodeParser.collapseNames(obj); // apply complex properties\n\t\t\t\t\t\treturn template.escape(obj[s]);\n\t\t\t\t\t}});\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttemp_res.push({pos: pos, str: search, fn: function(obj){\n\t\t\t\t\t\tif(s.indexOf(\".\")!= -1)\n\t\t\t\t\t\t\tobj = CodeParser.collapseNames(obj); // apply complex properties\n\t\t\t\t\t\treturn obj[s];\n\t\t\t\t\t}});\n\t\t\t\t}\n\n\t\t\t});\n\n\t\t\t// sort template parts by position\n\t\t\ttemp_res.sort(function(a,b){\n\t\t\t\treturn (a.pos > b.pos)?1:-1;\n\t\t\t});\n\n\t\t\t// create an array of functions that return parts of html string\n\t\t\tif(temp_res.length){\n\t\t\t\tvar lastPos = 0;\n\t\t\t\tvar addStr = function(str,n0,n1){\n\t\t\t\t\t_csp_cache[str].push(function(){\n\t\t\t\t\t\treturn str.slice(n0,n1);\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tfor(var i = 0; i< temp_res.length; i++){\n\t\t\t\t\tvar pos = temp_res[i].pos;\n\t\t\t\t\taddStr(str,lastPos,pos);\n\t\t\t\t\t_csp_cache[str].push(temp_res[i].fn);\n\t\t\t\t\tlastPos = pos + temp_res[i].str.length;\n\t\t\t\t}\n\t\t\t\taddStr(str,lastPos,str.length);\n\t\t\t}\n\t\t\telse\n\t\t\t\t_csp_cache[str].push(function(){return str;});\n\t\t}\n\t\treturn function(){\n\t\t\tvar s = \"\";\n\t\t\tfor(var i=0; i < _csp_cache[str].length;i++){\n\t\t\t\ts += _csp_cache[str][i].apply(this,arguments);\n\t\t\t}\n\t\t\treturn s;\n\t\t};\n\t}\n\n\tlet helpers = false;\n\tstr=str.replace(slashes,\"\\\\\\\\\");\n\tstr=str.replace(newlines,\"\\\\n\");\n\tstr=str.replace(quotes,\"\\\\\\\"\");\n\n\tstr=str.replace(/\\{obj\\.([^}?]+)\\?([^:]*):([^}]*)\\}/g,\"\\\"+(obj.$1?\\\"$2\\\":\\\"$3\\\")+\\\"\");\n\tstr=str.replace(/\\{common\\.([^}(]*)\\}/g,\"\\\"+(common.$1||'')+\\\"\");\n\tstr=str.replace(/\\{common\\.([^}(]*)\\(\\)\\}/g,\"\\\"+(common.$1?common.$1.apply(this, arguments):\\\"\\\")+\\\"\");\n\tstr=str.replace(/\\{obj\\.([^}]*)\\}/g,\"\\\"+(obj.$1)+\\\"\");\n\tstr=str.replace(\"{obj}\",\"\\\"+obj+\\\"\");\n\tstr=str.replace(/#([^#'\";, ]+)#/gi,function(str, key){\n\t\tif (key.charAt(0)==\"!\"){\n\t\t\thelpers = true;\n\t\t\treturn \"\\\"+template.escape(obj.\"+key.substr(1)+\")+\\\"\";\n\t\t} else\n\t\t\treturn \"\\\"+(obj.\"+key+\")+\\\"\";\n\t});\n\n\ttry {\n\t\tif (helpers){\n\t\t\tconst temp = Function(\"obj\",\"common\",\"marks\", \"value\", \"template\", \"return \\\"\"+str+\"\\\";\");\n\t\t\t_cache[str] = function(a,b,c,d){ \n\t\t\t\treturn temp(a,b,c,d,template);\n\t\t\t};\n\t\t} else {\n\t\t\t_cache[str] = Function(\"obj\",\"common\",\"return \\\"\"+str+\"\\\";\");\n\t\t}\n\t} catch(e){\n\t\tassert(0, \"Invalid template:\"+str);\n\t}\n\n\treturn _cache[str];\n}\n\n\n\ntemplate.escape = function(str){\n\tif (str === undefined || str === null) return \"\";\n\treturn (str.toString() || \"\" ).replace(badChars, escapeChar);\n};\ntemplate.empty=function(){\treturn \"\";\t};\n\nexport default template;","import template from \"./template\";\nimport {clone} from \"./helpers\";\n\n/*\n\tadds new template-type\n\tobj - object to which template will be added\n\tdata - properties of template\n*/\nexport default function type(obj, data){ \n\tif (obj.$protoWait){\n\t\tif (!obj._webix_type_wait)\n\t\t\tobj._webix_type_wait = [];\n\t\tobj._webix_type_wait.push(data);\n\t\treturn;\n\t}\n\t\t\n\t//auto switch to prototype, if name of class was provided\n\tif (typeof obj == \"function\")\n\t\tobj = obj.prototype;\n\tif (!obj.types){\n\t\tobj.types = { \"default\" : obj.type };\n\t\tobj.type.name = \"default\";\n\t}\n\t\n\tvar name = data.name;\n\tvar type = obj.type;\n\tif (name)\n\t\ttype = obj.types[name] = clone(data.baseType?obj.types[data.baseType]:obj.type);\n\t\n\tfor(var key in data){\n\t\tif (key.indexOf(\"template\")===0)\n\t\t\ttype[key] = template(data[key]);\n\t\telse\n\t\t\ttype[key]=data[key];\n\t}\n\n\treturn name;\n}","import {assert} from \"../webix/debug\";\n\nimport {uid, isArray, toNode, isUndefined, toFunctor} from \"../webix/helpers\";\nimport {attachEvent} from \"../webix/customevents\";\nimport {locate} from \"../webix/html\";\nimport {use} from \"../services\";\n\nimport type from \"../webix/type\";\nimport state from \"../core/state\";\n\n//global click events for UI\nimport \"./click\";\n\nconst views = {};\n\nfunction ui(config, parent, id){\n\tvar res;\n\tstate._ui_creation++;\n\ttry {\n\t\tres = _ui_creator(config, parent, id);\n\t} finally {\n\t\tstate._ui_creation--;\n\t}\n\treturn res;\n}\nui.views = views;\n\n\nfunction _ui_creator(config, parent, id){\n\tvar multiset = isArray(config);\n\tvar node = toNode((config.container||parent)||document.body);\n\n\t// solve problem with non-unique ids\n\tif(node._settings)\n\t\tid = _correctId(node, multiset, id);\n\n\tvar top_node;\n\tvar moving = false;\n\tvar body_child = (node == document.body);\n\tif (config._settings || (node && multiset)){\n\t\ttop_node = config;\n\t\tmoving = true;\n\t} else {\n\t\tif (node && body_child)\n\t\t\tconfig.$topView = true;\n\t\tif (!config._inner)\n\t\t\tconfig._inner = {};\n\n\t\tif (parent && parent.getParentView){\n\t\t\tstate._parent_cell = (!id && id!==0) ? parent.getParentView() : parent;\n\t\t}\n\n\t\ttop_node = _view(config);\n\t}\n\n\tif (body_child && !top_node.setPosition && !top_node.$apiOnly)\n\t\tuse(\"_fixHeight\")();\n\n\tif (top_node._settings && top_node._settings._hidden && !node.$view){\n\t\ttop_node._settings._container = node;\n\t} else if (!top_node.$apiOnly){\n\t\tif (node.appendChild)\n\t\t\t_appendDom(node, top_node, config);\n\t\telse if (node.destructor){\n\t\t\tvar target = node;\n\n\t\t\t//addView or view moving with target id\n\t\t\tif (!id && id!==0 && !isArray(top_node)){\n\t\t\t\tid = node;\n\t\t\t\tnode = node.getParentView();\n\t\t\t}\n\n\t\t\t//if target supports view adding\n\t\t\tif (node && node._replace){\n\t\t\t\tif (moving && top_node.getParentView){\n\t\t\t\t\t//if source supports view removing\n\t\t\t\t\tlet parent = top_node.getParentView();\n\t\t\t\t\tif (parent && parent._remove){\n\t\t\t\t\t\tparent._remove(top_node);\n\t\t\t\t\t}\n\t\t\t\t\t//adjust parent link and scope\n\t\t\t\t\ttop_node._parent_cell = node;\n\t\t\t\t\ttop_node.$scope = node.$scope;\n\t\t\t\t}\n\n\t\t\t\tnode._replace(top_node, id);\n\t\t\t} else {\n\t\t\t\tlet parent = target.$view.parentNode;\n\t\t\t\ttarget.destructor();\n\t\t\t\t_appendDom(parent, top_node, config);\n\t\t\t}\n\t\t} else\n\t\t\tassert(0, \"Not existing parent:\"+config.container);\n\t}\n\n\treturn top_node;\n}\n\nfunction _appendDom(node, top_node, config){\n\tnode.appendChild(top_node._viewobj);\n\tif (top_node.getParentView()) return;\n\n\t//resize window with position center or top\n\t//do not resize other windows and elements\n\t// which are attached to custom html containers\n\tif (((!top_node.setPosition || top_node._settings.fullscreen) && node == document.body) || top_node._settings.position )\n\t\tstate.top_views.push(top_node._destructor_handler);\n\tif (!config.skipResize)\n\t\ttop_node.adjust();\n}\n\nfunction _correctId(target, multiset, id){\n\t//replace view\n\tvar views = [target];\n\t//replace content of layout\n\tif (multiset)\n\t\tviews = target.getChildViews();\n\t//replace content of window\n\telse if (target._body_cell)\n\t\tviews = [target._body_cell];\n\t//add cell in layout by number\n\telse if (typeof id == \"number\"){\n\t\treturn id;\n\t//replace cell in layout by id\n\t} else if (id){\n\t\tviews = [$$(id)];\n\t\t_deleteIds(views);\n\t\treturn views[0].config.id;\n\t}\n\n\t_deleteIds(views);\n\treturn id;\n}\n\nfunction _deleteIds(uis){\n\tfor (var i = uis.length - 1; i >= 0; i--){\n\t\tlet current = uis[i];\n\t\t//remove original id\n\t\tdelete views[current.config.id];\n\t\t//create temp id\n\t\tcurrent.config.id = \"x\"+uid();\n\t\tviews[current.config.id] = current;\n\t\t//process childs\n\t\t_deleteIds(current.getChildViews());\n\t}\n}\n\nfunction hasMethod(view, method){\n\tvar obj = ui[view];\n\tif (!obj) return false;\n\n\tif (obj.$protoWait)\n\t\tobj = obj.call(-1);\n\n\treturn !!ui[view].prototype[method];\n}\n\n\nfunction _view(config){\n\n\tif (DEBUG){\n\t\t// check for trailing comma\n\t\tvar coll = config.cells || config.rows || config.elements || config.cols;\n\t\tif (coll)\n\t\t\tfor (let i=0; i0; i--) {\n\t\tassert(origins[i],\"Invalid mixing source\");\n\t\tif (typeof origins[i]== \"function\")\n\t\t\torigins[i]=origins[i].prototype;\n\t\tif (origins[i].$init) \n\t\t\tconstruct.push(origins[i].$init);\n\t\tif (origins[i].defaults){ \n\t\t\tvar defaults = origins[i].defaults;\n\t\t\tif (!compilation.defaults)\n\t\t\t\tcompilation.defaults = {};\n\t\t\tfor (let def in defaults)\n\t\t\t\tif (isUndefined(compilation.defaults[def]))\n\t\t\t\t\tcompilation.defaults[def] = defaults[def];\n\t\t}\n\t\tif (origins[i].type && compilation.type){\n\t\t\tfor (let def in origins[i].type)\n\t\t\t\tif (!compilation.type[def])\n\t\t\t\t\tcompilation.type[def] = origins[i].type[def];\n\t\t}\n\t\t\t\n\t\tfor (var key in origins[i]){\n\t\t\tif (!compilation[key] && compilation[key] !== false)\n\t\t\t\tcompilation[key] = origins[i][key];\n\t\t}\n\t}\n\t\n\tif (has_constructor)\n\t\tconstruct.push(compilation.$init);\n\t\n\t\n\tcompilation.$init = function(){\n\t\tfor (var i=0; i \"+u.operation, u.data);\n\t\t\tvar data = {\n\t\t\t\tid:u.data.id,\n\t\t\t\tnewid:u.data.id,\n\t\t\t\tstatus:u.data.operation\n\t\t\t};\n\t\t\td.processResult(data, data);\n\t\t});\n\t}\n};\n\nexport default proxy;","import {extend, uid} from \"../../webix/helpers\";\nimport {use} from \"../../services\";\n\nconst proxy = {\n\t$proxy:true,\n\tinit:function(){\n\t\tthis.clientId = this.clientId || uid();\n\t},\n\tload:function(view){\n\t\tvar selfid = this.clientId;\n\n\t\tthis.client.subscribe(this.source, function(update){\n\t\t\tif (update.clientId == selfid) return;\n\n\t\t\tuse(\"dp\")(view).ignore(function(){\n\t\t\t\tif (update.operation == \"delete\")\n\t\t\t\t\tview.remove(update.data.id);\n\t\t\t\telse if (update.operation == \"insert\")\n\t\t\t\t\tview.add(update.data);\n\t\t\t\telse if (update.operation == \"update\"){\n\t\t\t\t\tvar item = view.getItem(update.data.id);\n\t\t\t\t\tif (item){\n\t\t\t\t\t\textend(item, update.data, true);\n\t\t\t\t\t\tview.refresh(item.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t},\n\tsave:function(view, update){\n\t\tupdate.clientId = this.clientId;\n\t\tthis.client.publish(this.source, update);\n\t}\n};\n\nexport default proxy;","import {bind, delay} from \"../../webix/helpers\";\nimport {ajax} from \"../ajax\";\n\nconst indexdb = {\n\t$proxy:true,\n\tcreate:function(db, config, version, callback){\n\t\tthis.source = db + \"/\";\n\t\tthis._get_db(callback, version, function(e){\n\t\t\tvar db = e.target.result;\n\t\t\tfor (var key in config){\n\t\t\t\tvar data = config[key];\n\t\t\t\tvar store = db.createObjectStore(key, { keyPath: \"id\", autoIncrement:true });\n\t\t\t\tfor (var i = 0; i < data.length; i++)\n\t\t\t\t\tstore.put(data[i]);\n\t\t\t}\n\t\t});\n\t},\n\t_get_db:function(callback, version, upgrade){\n\t\tif (this.source.indexOf(\"/\") != -1){\n\t\t\tvar parts = this.source.split(\"/\");\n\t\t\tthis.source = parts[1];\n\t\t\tversion = version || parts[2];\n\n\t\t\tvar _index = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;\n\n\t\t\tvar db;\n\t\t\tif (version)\n\t\t\t\tdb = _index.open(parts[0], version);\n\t\t\telse\n\t\t\t\tdb = _index.open(parts[0]);\n\n\t\t\tif (upgrade)\n\t\t\t\tdb.onupgradeneeded = upgrade;\n\t\t\tdb.onerror = function(){ };\n\t\t\tdb.onblocked = function(){ };\n\t\t\tdb.onsuccess = bind(function(e){\n\t\t\t\tthis.db = e.target.result;\n\t\t\t\tif (callback)\n\t\t\t\t\tcallback.call(this);\n\t\t\t},this);\n\t\t} else if (this.db)\n\t\t\tcallback.call(this);\n\t\telse \n\t\t\tdelay(this._get_db, this, [callback], 50);\n\t},\n\n\tload:function(view, callback){\n\t\tthis._get_db(function(){\n\t\t\tvar store = this.db.transaction(this.source).objectStore(this.source);\n\t\t\tvar data = [];\n\n\t\t\tstore.openCursor().onsuccess = function(e) {\n\t\t\t\tvar result = e.target.result;\n\t\t\t\tif(result){\n\t\t\t\t\tdata.push(result.value);\n\t\t\t\t\tresult[\"continue\"]();\n\t\t\t\t} else {\n\t\t\t\t\tview.parse(data);\n\t\t\t\t\tajax.$callback(view, callback, \"[]\", data);\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t},\n\tsave:function(view, update, dp){\n\t\tthis._get_db(function(){\n\t\t\tvar mode = update.operation;\n\t\t\tvar data = update.data;\n\t\t\tvar id = update.id;\n\n\t\t\tvar store = this.db.transaction([this.source], \"readwrite\").objectStore(this.source);\n\n\t\t\tvar req;\n\t\t\tif (mode == \"delete\")\n\t\t\t\treq = store[\"delete\"](id);\n\t\t\telse if (mode == \"update\")\n\t\t\t\treq = store.put(data);\n\t\t\telse if (mode == \"insert\"){\n\t\t\t\tdelete data.id;\n\t\t\t\treq = store.add(data);\n\t\t\t}\n\n\t\t\treq.onsuccess = function(e) {\n\t\t\t\tvar result = { status: mode, id:update.id };\n\t\t\t\tif (mode == \"insert\")\n\t\t\t\t\tresult.newid = e.target.result;\n\t\t\t\tdp.processResult(result, result);\n\t\t\t};\n\t\t});\n\t}\n};\n\nexport default indexdb;","import {ajax} from \"../ajax\";\n\nconst proxy = {\n\t$proxy:true,\n\tload:function(view, callback){\n\t\tajax(this.source, callback, view);\n\t},\n\tsave:function(view, update, dp, callback){\n\t\treturn proxy._save_logic.call(this, view, update, dp, callback, ajax());\n\t},\n\t_save_logic:function(view, update, dp, callback, ajax){\n\t\tvar url = this.source;\n\t\tvar query = \"\";\n\t\tvar mark = url.indexOf(\"?\");\n\n\t\tif (mark !== -1){\n\t\t\tquery = url.substr(mark);\n\t\t\turl = url.substr(0, mark);\n\t\t}\n\n\t\turl += url.charAt(url.length-1) == \"/\" ? \"\" : \"/\";\n\t\tvar mode = update.operation;\n\n\n\t\tvar data = update.data;\n\t\tif (mode == \"insert\") delete data.id;\n\n\t\t//call rest URI\n\t\tif (mode == \"update\"){\n\t\t\tajax.put(url + data.id + query, data, callback);\n\t\t} else if (mode == \"delete\") {\n\t\t\tajax.del(url + data.id + query, data, callback);\n\t\t} else {\n\t\t\tajax.post(url + query, data, callback);\n\t\t}\n\t}\n};\n\nexport default proxy;\n","import {ajax} from \"../ajax\";\nimport rest from \"./rest\";\n\nconst proxy = {\n\t$proxy:true,\n\tload:function(view, callback){\n\t\tajax(this.source, callback, view);\n\t},\n\tsave:function(view, update, dp, callback){\n\t\tvar xhr = ajax().headers({ \"Content-Type\":\"application/json\" });\n\t\treturn rest._save_logic.call(this, view, update, dp, callback, xhr);\n\t}\n};\n\nexport default proxy;","import {extend} from \"../../webix/helpers\";\n\nimport {ajax} from \"../ajax\";\n\nconst proxy = {\n\t$proxy:true,\n\tload:function(view, callback, params){\n\t\tparams = extend(params||{}, this.params || {}, true);\n\t\tajax().bind(view).post(this.source, params, callback);\n\t}\n};\n\nexport default proxy;","import {ajax} from \"../ajax\";\n\nconst proxy = {\n\t$proxy:true,\n\tload:function(view, callback){\n\t\tajax().sync().bind(view).get(this.source, null, callback);\n\t}\n};\n\nexport default proxy;\n","const jsarray={\n\t//parse jsarray string to jsarray object if necessary\n\ttoObject:function(data){\n\t\tif (typeof data == \"string\")\n\t\t\treturn JSON.parse(data);\n\t\treturn data;\n\t},\n\t//get array of records\n\tgetRecords:function(data){\n\t\tif (data && data.data)\n\t\t\tdata = data.data;\n\t\treturn data;\n\t},\n\t//get hash of properties for single record, in case of array they will have names as \"data{index}\"\n\tgetDetails:function(data){\n\t\tvar result = {};\n\t\tfor (var i=0; i < data.length; i++)\n\t\t\tresult[\"data\"+i]=data[i];\n\t\tif (this.idColumn !== null)\n\t\t\tresult.id = data[this.idColumn];\n\n\t\treturn result;\n\t},\n\tgetOptions:function(){ return false; },\n\t//dyn loading is not supported by js-array data source\n\tgetInfo:function(){\n\t\treturn {\n\t\t\tsize:0\n\t\t};\n\t},\n\tidColumn:null\n};\n\nexport default jsarray;","import { toNode } from \"../../webix/helpers.js\";\nimport xml from \"./xml.js\";\n\nconst html = {\n\t/*\n\t\tincoming data can be\n\t\t - ID of parent container\n\t\t - HTML text\n\t*/\n\ttoObject:function(data){\n\t\tif (typeof data == \"string\"){\n\t\t\tvar t=null;\n\t\t\tif (data.indexOf(\"<\")==-1)\t//if no tags inside - probably its an ID\n\t\t\t\tt = toNode(data);\n\t\t\tif (!t){\n\t\t\t\tt=document.createElement(\"DIV\");\n\t\t\t\tt.innerHTML = data;\n\t\t\t}\n\t\t\n\t\t\treturn t.firstChild;\n\t\t}\n\t\treturn data;\n\t},\n\t//get array of records\n\tgetRecords:function(node){\n\t\treturn node.getElementsByTagName(this.tag);\n\t},\n\t//get hash of properties for single record\n\tgetDetails:function(data){\n\t\treturn xml.tagToObject(data);\n\t},\n\tgetOptions:function(){ \n\t\treturn false;\n\t},\n\t//dyn loading is not supported by HTML data source\n\tgetInfo:function(){\n\t\treturn {\n\t\t\tsize:0\n\t\t};\n\t},\n\ttag: \"LI\"\n};\n\nexport default html;","import {assert} from \"../../webix/debug\";\nimport {toNode, extend} from \"../../webix/helpers\";\nimport {remove} from \"../../webix/html\";\n\nconst htmltable={\n\n\t//convert json string to json object if necessary\n\ttoObject:function(data){\n\t\tdata = toNode(data);\n\t\tassert(data, \"table is not found\");\n\t\tassert(data.tagName.toLowerCase() === \"table\", \"Incorrect table object\");\n\n\t\tvar tr = data.rows;\n\t\tremove(data);\n\t\treturn tr;\n\t},\n\t//get array of records\n\tgetRecords:function(data){\n\t\tvar new_data = [];\n\t\t//skip header rows if necessary\n\t\tvar i = (data[0] && data[0]._webix_skip)?1:0;\n\n\t\tfor (; i < data.length; i++)\n\t\t\tnew_data.push(data[i]);\n\t\treturn new_data;\n\t},\n\t//get hash of properties for single record\n\tgetDetails:function(data){\n\t\tvar td = data.getElementsByTagName(\"td\");\n\t\tdata = {};\n\t\t//get hash of properties for single record, data named as \"data{index}\"\n\t\tfor (var i=0; i < td.length; i++) {\n\t\t\tdata[\"data\" + i] = td[i].innerHTML;\n\t\t}\n\t\treturn data;\n\t},\n\t//get count of data and position at which new data need to be inserted\n\tgetInfo:function(){\n\t\t// dyn loading is not supported for htmltable\n\t\treturn { \n\t\t\tsize:0\n\t\t};\n\t},\n\tgetOptions:function(){},\n\n\t/*! gets header from first table row\n\t **/\n\tgetConfig: function(data) {\n\t\tvar columns = [];\n\t\tvar td = data[0].getElementsByTagName(\"th\");\n\t\tif (td.length) data[0]._webix_skip = true;\n\t\tfor (var i = 0; i < td.length; i++) {\n\t\t\tvar col = {\n\t\t\t\tid: \"data\" + i,\n\t\t\t\theader: this._de_json(td[i].innerHTML)\n\t\t\t};\n\t\t\tvar attrs = this._get_attrs(td[i]);\n\t\t\tcol = extend(col, attrs);\n\t\t\tcolumns.push(col);\n\t\t}\n\t\treturn columns;\n\t},\n\n\t_de_json:function(str){\n\t\tvar pos = str.indexOf(\"json://\");\n\t\t\n\t\tif (pos != -1)\n\t\t\tstr = JSON.parse(str.substr(pos+7));\n\t\treturn str;\n\t},\n\t\n\t/*! gets hash of html-element attributes\n\t **/\n\t_get_attrs: function(el) {\n\t\tvar attr = el.attributes;\n\t\tvar hash = {};\n\t\tfor (var i = 0; i < attr.length; i++) {\n\t\t\thash[attr[i].nodeName] = this._de_json(attr[i].nodeValue);\n\t\t}\n\t\thash.width = parseInt(hash.width, 10);\n\t\treturn hash;\n\t}\n};\n\nexport default htmltable;","import {create} from \"../webix/html.js\";\nimport {exec} from \"../webix/helpers.js\";\nimport {ajax} from \"./ajax.js\";\n\nimport Promise from \"../thirdparty/promiz\";\n\nconst _modules = {};\t//hash of already loaded modules\n\n//loads module from external js file\nexport default function require(module, callback, master){\n\tvar promise = Promise.defer();\n\n\tif (callback && callback !== true)\n\t\tpromise = promise.then(function(){ callback.call(master || this); });\n\n\tif (require.disabled){\n\t\tpromise.resolve();\n\t\treturn promise;\n\t}\n\n\t//multiple files required at once\n\tif (typeof module != \"string\"){\n\t\tvar count = module.length||0;\n\t\t\n\t\tif (!count){\n\t\t\t// { file: true, other: true }\n\t\t\tfor (let file in module) count++; // eslint-disable-line\n\t\t\tlet callback2 = function(){\n\t\t\t\tcount--;\n\t\t\t\tif (count === 0)\n\t\t\t\t\tpromise.resolve();\n\t\t\t};\n\t\t\tfor (let file in module)\n\t\t\t\trequire(file, callback2, master);\n\t\t} else {\n\t\t\t// [ file, other ]\n\t\t\tlet callback2 = function(){\n\t\t\t\tif (count){\n\t\t\t\t\tcount--;\n\t\t\t\t\trequire(module[module.length - count - 1], callback2, master);\n\t\t\t\t} else {\n\t\t\t\t\tpromise.resolve();\n\t\t\t\t}\n\t\t\t};\n\t\t\tcallback2();\n\t\t}\n\t\treturn promise;\n\t}\n\n\tif (_modules[module] !== true){\n\t\tvar fullpath = module;\n\n\t\t//css, async, no waiting\n\t\tif (module.substr(module.length-4) == \".css\") {\n\t\t\tvar link = create(\"LINK\",{ type:\"text/css\", rel:\"stylesheet\", href:fullpath});\n\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(link);\n\t\t\tpromise.resolve();\n\t\t\treturn promise;\n\t\t}\n\n\t\t//js, async, waiting\n\t\tif (callback === true){\n\t\t\t//sync mode\n\t\t\texec( ajax().sync().get(fullpath).responseText );\n\t\t\t_modules[module]=true;\n\n\t\t} else {\n\n\t\t\tif (!_modules[module]){\t//first call\n\t\t\t\t_modules[module] = [promise];\n\n\t\t\t\tvar newScript = document.createElement(\"script\");\n\t\t\t\tvar calls = _modules[module];\t//callbacks\n\n\t\t\t\tnewScript.onerror = function(){\n\t\t\t\t\t_modules[module] = false;\n\t\t\t\t\tfor (var i=0; i=0 && e.r-yCorrection<=options.rows[1]))\n\t\t\t\t\t\tspans.push([s.r-yCorrection, s.c-xCorrection, e.c-s.c+1, e.r-s.r+1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(sheet[\"!cols\"]){\n\t\t\t\tvar widths = sheet[\"!cols\"];\n\t\t\t\tfor(let i = 0; i 1 ){\n\t\t\t\t\tcookie_value = unescape( a_temp_cookie[1].replace(/^\\s+|\\s+$/g, \"\") );\n\t\t\t\t}\n\t\t\t\t// note that in cases where cookie is initialized but no value, null is returned\n\t\t\t\treturn cookie_value;\n\t\t\t}\n\t\t\ta_temp_cookie = null;\n\t\t\tcookie_name = \"\";\n\t\t}\n\t\tif ( !b_cookie_found ){\n\t\t\treturn null;\n\t\t}\n\t\treturn null;\n\t},\n\tget:function(name){\n\t\tif(name && window.JSON){\n\t\t\tvar json = this.getRaw(name);\n\t\t\tif(!json)\n\t\t\t\treturn null;\n\t\t\treturn DataDriver.json.toObject(unescape(json));\n\t\t}else\n\t\t\treturn null;\n\t},\n\tremove:function(name, domain){\n\t\tif(name && this.getRaw(name)) \n\t\t\tdocument.cookie = name + \"=\" + (( domain ) ? \";domain=\" + domain : \"\") + \";expires=Thu, 01-Jan-1970 00:00:01 GMT\";\n\t},\n\tclear:function(domain){\n\t\tvar cookies = document.cookie.split(\";\");\n\t\tfor (var i = 0; i < cookies.length; i++)\n\t\t\tdocument.cookie = /^[^=]+/.exec(cookies[i])[0] + \"=\" + (( domain ) ? \";domain=\" + domain : \"\") + \";expires=Thu, 01-Jan-1970 00:00:01 GMT\";\t\t\n\t}\n};\n\nexport default storage;","import env from \"../../webix/env\";\nimport storage from \"../../webix/storage\";\n\nimport {callEvent} from \"../../webix/customevents\";\nimport {ajax} from \"../ajax\";\n\n\nconst proxy = {\n\t$proxy:true,\n\n\tstorage: storage.local,\n\tcache:false,\n\tlocal:false,\n\tdata:\"\",\n\n\t_is_offline : function(){\n\t\tif (!this.cache && !env.offline){\n\t\t\tcallEvent(\"onOfflineMode\",[]);\n\t\t\tenv.offline = true;\n\t\t}\n\t},\n\t_is_online : function(){\n\t\tif (!this.cache && env.offline){\n\t\t\tenv.offline = false;\n\t\t\tcallEvent(\"onOnlineMode\", []);\n\t\t}\n\t},\n\n\tload:function(view, callback){\n\t\tvar mycallback = {\n\t\t\terror:function(){\n\t\t\t\t//assuming offline mode\n\t\t\t\tvar text = this.getCache() || this.data;\n\n\t\t\t\tvar loader = { responseText: text };\n\t\t\t\tvar data = ajax.prototype._data(loader);\n\n\t\t\t\tthis._is_offline();\n\t\t\t\tajax.$callback(view, callback, text, data, loader);\n\t\t\t},\n\t\t\tsuccess:function(text, data, loader){\n\t\t\t\tthis._is_online();\n\t\t\t\tajax.$callback(view, callback, text, data, loader);\n\n\t\t\t\tthis.setCache(text);\n\t\t\t}\n\t\t};\n\n\t\t//in cache mode - always load data from cache\n\t\tif (this.cache && this.getCache())\n\t\t\tmycallback.error.call(this);\n\t\telse {\n\t\t\t//else try to load actual data first\n\t\t\tif (this.source.$proxy)\n\t\t\t\tthis.source.load(this, mycallback);\n\t\t\telse\n\t\t\t\tajax(this.source, mycallback, this);\n\t\t}\n\t},\n\tgetCache:function(){\n\t\treturn this.storage.get(this._data_name());\n\t},\n\tclearCache:function(){\n\t\tthis.storage.remove(this._data_name());\n\t},\n\tsetCache:function(text){\n\t\tthis.storage.put(this._data_name(), text);\n\t},\n\t_data_name:function(){\n\t\tif (this.source.$proxy)\n\t\t\treturn this.source.source + \"_$proxy$_data\";\n\t\telse \n\t\t\treturn this.source + \"_$proxy$_data\";\n\t},\n\tsave:function(master, data, view, callback){\n\t\tif (!env.offline && !this.cache){\n\t\t\tif (this.source.$proxy){\n\t\t\t\tthis.source.save(master, data, view, callback);\n\t\t\t} else {\n\t\t\t\tajax().post(this.source, data.data, callback);\n\t\t\t}\n\t\t}\n\t},\n\tsaveAll:function(view, update, dp, callback){\n\t\tthis.setCache(view.serialize());\n\t\tif (this.cache || env.offline){\n\t\t\tajax.$callback(view, callback, \"\", update);\n\t\t}\n\t},\n\tresult:function(id, master, dp, text, data){\n\t\tfor (var i = 0; i < data.length; i++)\n\t\t\tdp.processResult({ id: data[i].id, status: data[i].operation }, {}, {});\n\t}\n};\n\nexport default proxy;","import {extend} from \"../../webix/helpers\";\nimport offline from \"./offline\";\n\nconst proxy = {\n\tinit:function(){\n\t\textend(this, offline);\n\t},\n\tcache:true\n};\n\nexport default proxy;","import {extend} from \"../../webix/helpers\";\nimport offline from \"./offline\";\n\nconst proxy = {\n\tinit:function(){\n\t\textend(this, offline);\n\t},\n\tcache:true,\n\tlocal:true,\n\tdata:[]\n};\n\nexport default proxy;","import {ajax} from \"../ajax\";\n\nfunction unbox(data){\n\tif (!data || !typeof data === \"object\" || Array.isArray(data))\n\t\treturn data;\n\n\tvar lkey =\"\";\n\tvar count = 0;\n\tfor (var key in data){\n\t\tcount++;\n\t\tif (count == 2) return data;\n\t\tlkey = key;\n\t}\n\n\treturn data[lkey];\n}\n\nconst GraphQL = {\n\t$proxy:true,\n\tsave:function(data){\n\t\treturn this.load(data);\n\t},\n\tload:function(view, callback){\n\n\t\tvar params = {\n\t\t\tquery: this.source\n\t\t};\n\n\t\tif (arguments.length === 1){\n\t\t\tparams.variables = view;\n\t\t\tview = this;\n\t\t}\n\n\n\t\treturn ajax().bind(view)\n\t\t\t.headers({ \"Content-type\": \"application/json\" })\n\t\t\t.post(this.url, params)\n\t\t\t.then(function(data){\n\t\t\t\tvar flat = unbox(data.json().data);\n\t\t\t\tif (callback)\n\t\t\t\t\tajax.$callback(view, callback, \"\", flat, -1);\n\n\t\t\t\treturn flat;\n\t\t\t});\n\t}\n};\n\nexport default GraphQL;","import {assert} from \"../webix/debug\";\nimport {extend, copy as makeCopy} from \"../webix/helpers\";\n\nimport binary from \"./proxy/binary\";\nimport connector from \"./proxy/connector\";\nimport debug from \"./proxy/debug\";\nimport faye from \"./proxy/faye\";\nimport indexdb from \"./proxy/indexdb\";\nimport json from \"./proxy/json\";\nimport post from \"./proxy/post\";\nimport rest from \"./proxy/rest\";\nimport sync from \"./proxy/sync\";\nimport offline from \"./proxy/offline\";\nimport cache from \"./proxy/cache\";\nimport local from \"./proxy/local\";\nimport graphql from \"./proxy/graphql\";\n\nfunction proxy(name, source, extra){\n\tassert(proxy[name], \"Invalid proxy name: \"+name);\n\n\tvar copy = makeCopy(proxy[name]);\n\tcopy.source = source;\n\n\tif (extra)\n\t\textend(copy, extra, true);\n\n\tif (copy.init) copy.init();\n\treturn copy;\n}\n\nproxy.$parse = function(value){\n\tif (typeof value == \"string\" && value.indexOf(\"->\") != -1){\n\t\tvar parts = value.split(\"->\");\n\t\treturn proxy(parts[0], parts[1]);\n\t}\n\treturn value;\n};\n\nproxy.binary = binary;\nproxy.connector = connector;\nproxy.debug = debug;\nproxy.faye = faye;\nproxy.indexdb = indexdb;\nproxy.json = json;\nproxy.post = post;\nproxy.rest = rest;\nproxy.sync = sync;\nproxy.offline = offline;\nproxy.cache = cache;\nproxy.local = local;\nproxy.local = local;\nproxy.GraphQL = graphql;\n\nexport default proxy;","import promise from \"../thirdparty/promiz\";\nimport proxy from \"../load/proxy\";\nimport DataDriver from \"../load/drivers/index\";\n\n\nimport {ajax} from \"../load/ajax\";\n\nimport {bind, isArray} from \"../webix/helpers\";\nimport {callEvent} from \"../webix/customevents\";\n\nconst AtomDataLoader={\n\t$init:function(config){\n\t\t//prepare data store\n\t\tthis.data = {};\n\t\tthis.waitData = promise.defer();\n\n\t\tif (config)\n\t\t\tthis._settings.datatype = config.datatype||\"json\";\n\t\tthis.$ready.push(this._load_when_ready);\n\t},\n\t_load_when_ready:function(){\n\t\tthis._ready_for_data = true;\n\t\t\n\t\tif (this._settings.url)\n\t\t\tthis.url_setter(this._settings.url);\n\t\tif (this._settings.data)\n\t\t\tthis.data_setter(this._settings.data);\n\t},\n\turl_setter:function(value){\n\t\tvalue = proxy.$parse(value);\n\n\t\tif (!this._ready_for_data) return value;\n\t\tthis.load(value, this._settings.datatype);\t\n\t\treturn value;\n\t},\n\tdata_setter:function(value){\n\t\tif (!this._ready_for_data) return value;\n\t\tthis.parse(value, this._settings.datatype);\n\t\treturn true;\n\t},\n\t//loads data from external URL\n\tload:function(url,call){\n\t\tvar details = arguments[2] || null;\n\n\t\tif(!this.callEvent(\"onBeforeLoad\",[]))\n\t\t\treturn promise.reject();\t\t\n\n\t\tif (typeof call == \"string\"){\t//second parameter can be a loading type or callback\n\t\t\t//we are not using setDriver as data may be a non-datastore here\n\t\t\tthis.data.driver = DataDriver[call];\n\t\t\tcall = arguments[2];\n\t\t} else if (!this.data.driver)\n\t\t\tthis.data.driver = DataDriver.json;\n\n\t\t//load data by async ajax call\n\t\t//loading_key - can be set by component, to ignore data from old async requests\n\t\tvar callback = [{\n\t\t\tsuccess: this._onLoad,\n\t\t\terror: this._onLoadError\n\t\t}];\n\t\t\n\t\tif (call){\n\t\t\tif (isArray(call))\n\t\t\t\tcallback.push.apply(callback,call);\n\t\t\telse\n\t\t\t\tcallback.push(call);\n\t\t}\n\t\t\n\t\t//proxy\t\n\t\turl = proxy.$parse(url);\n\t\tif (url.$proxy && url.load)\n\t\t\treturn url.load(this, callback, details);\n\n\t\t//promize\n\t\tif (typeof url === \"function\"){\n\t\t\treturn url(details).then(\n\t\t\t\tbind(function(data){\n\t\t\t\t\tajax.$callback(this, callback, \"\", data, -1);\n\t\t\t\t}, this),\n\t\t\t\tbind(function(x){\n\t\t\t\t\tajax.$callback(this, callback, \"\", null, x, true);\n\t\t\t\t}, this)\n\t\t\t);\n\t\t}\n\n\t\t//normal url\n\t\treturn ajax(url,callback,this);\n\t},\n\t//loads data from object\n\tparse:function(data,type){\n\t\tif (data && data.then && typeof data.then == \"function\"){\n\t\t\treturn data.then(bind(function(data){ \n\t\t\t\tif (data && typeof data.json == \"function\")\n\t\t\t\t\tdata = data.json();\n\t\t\t\tthis.parse(data, type); \n\t\t\t}, this));\n\t\t}\n\n\t\t//loading data from other component\n\t\tif (data && data.sync && this.sync)\n\t\t\treturn this._syncData(data);\n\n\t\tif(!this.callEvent(\"onBeforeLoad\",[]))\n\t\t\treturn promise.reject();\n\n\t\tthis.data.driver = DataDriver[type||\"json\"];\n\t\tthis._onLoad(data,null);\n\t},\n\t_syncData: function(data){\n\t\tif(this.data)\n\t\t\tthis.data.attachEvent(\"onSyncApply\",bind(function(){\n\t\t\t\tif(this._call_onready)\n\t\t\t\t\tthis._call_onready();\n\t\t\t},this));\n\n\t\tthis.sync(data);\n\t},\n\t_parse:function(data){\n\t\tvar parsed, record,\n\t\t\tdriver = this.data.driver;\n\n\t\trecord = driver.getRecords(data)[0];\n\t\tparsed = record?driver.getDetails(record):{};\n\n\t\tif (this.setValues)\n\t\t\tthis.setValues(parsed);\n\t\telse\n\t\t\tthis.data = parsed;\n\t},\n\t_onLoadContinue:function(data, text, response, loader){\n\t\tif (data){\n\t\t\tif(!this.$onLoad || !this.$onLoad(data, this.data.driver)){\n\t\t\t\tif(this.data && this.data._parse)\n\t\t\t\t\tthis.data._parse(data); //datastore\n\t\t\t\telse\n\t\t\t\t\tthis._parse(data);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tthis._onLoadError(text, response, loader);\n\n\t\t//data loaded, view rendered, call onready handler\n\t\tif(this._call_onready)\n\t\t\tthis._call_onready();\n\n\t\tthis.callEvent(\"onAfterLoad\",[]);\n\t\tthis.waitData.resolve();\n\t},\n\t//default after loading callback\n\t_onLoad:function(text, response, loader){\n\t\tvar driver = this.data.driver;\n\t\tvar data;\n\n\t\tif (loader === -1)\n\t\t\tdata = driver.toObject(response);\n\t\telse{\n\t\t\t//ignore data loading command if data was reloaded \n\t\t\tif(this._ajax_queue)\n\t\t\t\tthis._ajax_queue.remove(loader);\n\t\t\tdata = driver.toObject(text, response);\n\t\t}\n\t\t\t\n\t\tif(!data || !data.then)\n\t\t\tthis._onLoadContinue(data);\n\t\telse if(data.then && typeof data.then == \"function\")\n\t\t\tdata.then(bind(this._onLoadContinue, this));\n\t},\n\t_onLoadError:function(text, xml, xhttp){\n\t\tthis.callEvent(\"onAfterLoad\",[]);\n\t\tthis.callEvent(\"onLoadError\",arguments);\n\t\tcallEvent(\"onLoadError\", [text, xml, xhttp, this]);\n\t},\n\t_check_data_feed:function(data){\n\t\tif (!this._settings.dataFeed || this._ignore_feed || !data) return true;\n\t\tvar url = this._settings.dataFeed;\n\t\tif (typeof url == \"function\")\n\t\t\treturn url.call(this, (data.id||data), data);\n\t\turl = url+(url.indexOf(\"?\")==-1?\"?\":\"&\")+\"action=get&id=\"+encodeURIComponent(data.id||data);\n\t\tif(!this.callEvent(\"onBeforeLoad\",[])) \n\t\t\treturn false;\n\t\tajax(url, function(text,xml,loader){\n\t\t\tthis._ignore_feed=true;\n\t\t\tvar driver = DataDriver.json;\n\t\t\tvar data = driver.toObject(text, xml);\n\t\t\tif (data)\n\t\t\t\tthis.setValues(driver.getDetails(driver.getRecords(data)[0]));\n\t\t\telse\n\t\t\t\tthis._onLoadError(text,xml,loader);\n\t\t\tthis._ignore_feed=false;\n\t\t\tthis.callEvent(\"onAfterLoad\",[]);\n\t\t}, this);\n\t\treturn false;\n\t}\n};\n\nexport default AtomDataLoader;","import {bind} from \"../webix/helpers\";\nimport template from \"../webix/template\";\n\n\nconst AtomRender={\n\t//convert item to the HTML text\n\t_toHTML:function(obj){\n\t\tif (obj.$empty )\n\t\t\treturn \"\";\n\t\treturn this._settings.template(obj, this);\n\t},\n\t//render self, by templating data object\n\trender:function(){\n\t\tvar cfg = this._settings;\n\t\tif (this.isVisible(cfg.id)){\n\t\t\tif (!this.callEvent || this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\t\tif (this.data && !cfg.content){\n\t\t\t\t\t//it is critical to have this as two commands\n\t\t\t\t\t//its prevent destruction race in Chrome\n\t\t\t\t\tthis._dataobj.innerHTML = \"\";\n\t\t\t\t\tthis._dataobj.innerHTML = this._toHTML(this.data);\n\t\t\t\t}\n\t\t\t\tif (this.callEvent) this.callEvent(\"onAfterRender\",[]);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t},\n\tsync:function(source){\n\t\tthis._backbone_sync = false;\n\t\tif (source.name != \"DataStore\"){\n\t\t\tif (source.data && source.name == \"DataStore\"){\n\t\t\t\tsource = source.data;\n\t\t\t} else {\n\t\t\t\tthis._backbone_sync = true;\n\t\t\t}\n\t\t}\n\t\t\t\n\n\t\tif (this._backbone_sync)\n\t\t\tsource.bind(\"change\", bind(function(data){\n\t\t\t\tif (data.id == this.data.id){\n\t\t\t\t\tthis.data = data.attributes;\n\t\t\t\t\tthis.refresh();\n\t\t\t\t}\n\t\t\t}, this));\n\t\telse\n\t\t\tsource.attachEvent(\"onStoreUpdated\", bind(function(id){\n\t\t\t\tif (!id || id == this.data.id){\n\t\t\t\t\tthis.data = source.pull[id];\n\t\t\t\t\tthis.refresh();\n\t\t\t\t}\n\t\t\t}, this));\n\t},\n\ttemplate_setter:template\n};\n\nexport default AtomRender;","import {offset} from \"../webix/html\";\nimport {delay} from \"../webix/helpers\";\n\n\nconst AutoScroll = {\n\t_auto_scroll:function(pos){\n\t\tvar yscroll = 1;\n\t\tvar xscroll = 0;\n\n\t\tvar mode = this._settings.dragscroll;\n\t\tif (typeof mode == \"string\"){\n\t\t\txscroll = mode.indexOf(\"x\") != -1;\n\t\t\tyscroll = mode.indexOf(\"y\") != -1;\n\t\t}\n\n\t\tvar data = this._body || this.$view;\n\t\tvar box = offset(data);\n\n\t\tvar top = box.y;\n\t\tvar bottom = top + data.offsetHeight;\n\t\tvar left = box.x;\n\t\tvar right = left + data.offsetWidth;\n\n\t\tvar scroll = this.getScrollState();\n\t\tvar reset = false;\n\t\tvar sense = Math.max(this.type&&!isNaN(parseFloat(this.type.height))?this.type.height+5:0,40); //dnd auto-scroll sensivity\n\n\t\tif (yscroll){\n\t\t\tvar config = this._settings;\n\t\t\tif(config.topSplit){\n\t\t\t\tvar topSplitPos = this._cellPosition(this.getIdByIndex(config.topSplit-1), this.columnId(0));\n\t\t\t\ttop += topSplitPos.top + topSplitPos.height;\n\t\t\t}\n\n\t\t\tif (pos.y < (top + sense)){\n\t\t\t\tthis._auto_scrollTo(scroll.x, scroll.y-sense*2, pos);\n\t\t\t\treset = true;\n\t\t\t} else if (pos.y > bottom - sense){\n\t\t\t\tthis._auto_scrollTo(scroll.x, scroll.y+sense*2, pos);\n\t\t\t\treset = true;\n\t\t\t}\n\t\t}\n\n\t\tif (xscroll){\n\t\t\tif (pos.x < (left + sense)){\n\t\t\t\tthis._auto_scrollTo(scroll.x-sense*2, scroll.y, pos);\n\t\t\t\treset = true;\n\t\t\t} else if (pos.x > right - sense){\n\t\t\t\tthis._auto_scrollTo(scroll.x+sense*2, scroll.y, pos);\n\t\t\t\treset = true;\n\t\t\t}\n\t\t}\n\n\t\tif (reset)\n\t\t\tthis._auto_scroll_delay = delay(this._auto_scroll, this, [pos], 100);\n\n\t},\n\t_auto_scrollTo: function(x,y,pos){\n\t\tif(this.callEvent(\"onBeforeAutoScroll\",[pos]))\n\t\t\tthis.scrollTo(x,y);\n\t}\n};\n\nexport default AutoScroll;","import {assert} from \"./debug\";\nimport {event} from \"./htmlevents\";\nimport env from \"./env.js\";\nimport {isArray, delay} from \"./helpers.js\";\n\nimport {callEvent, attachEvent} from \"./customevents.js\";\n\nfunction ready(code){\n\tif (_ready) code.call();\n\telse _ready_code.push(code);\n}\nlet _ready = false;\nlet _ready_code = [];\n\n//autodetect codebase folder\nvar temp = document.getElementsByTagName(\"SCRIPT\");\t//current script, most probably\nassert(temp.length,\"Can't locate codebase\");\nif (temp.length){\n\t//full path to script\n\ttemp = (temp[temp.length-1].getAttribute(\"src\")||\"\").split(\"/\");\n\t//get folder name\n\ttemp.splice(temp.length-1, 1);\n\tenv.codebase = temp.slice(0, temp.length).join(\"/\")+\"/\";\n}\n\nvar handler = function(){\n\tif(env.isIE)\n\t\tdocument.body.className += \" webix_ie\";\n\tcallEvent(\"onReady\",[]);\n};\n\nvar doit = function(){\n\t_ready = true;\n\n\t/* global webix_ready */ \n\tif (window.webix_ready && isArray(webix_ready))\n\t\t_ready_code = webix_ready.concat(_ready_code);\n\n\tfor (var i=0; i < _ready_code.length; i++)\n\t\t_ready_code[i].call();\n\t_ready_code=[];\n};\n\nattachEvent(\"onReady\", function(force){\n\tif (force) \n\t\tdoit();\n\telse \n\t\tdelay(doit);\n});\n\nif (document.readyState == \"complete\") handler();\nelse event(window, \"load\", handler);\n\nready(function(){\n\tevent(document.body,\"click\", function(e){\n\t\tcallEvent(\"onClick\",[e||event]);\n\t});\n});\n\n\nexport default ready;","import env from \"../webix/env\";\nimport ready from \"../webix/ready\";\n\nimport {event, eventRemove} from \"../webix/htmlevents\";\nimport {delay} from \"../webix/helpers\";\nimport {callEvent} from \"../webix/customevents\";\nimport {preventEvent, removeCss, create, remove, addCss, addStyle} from \"../webix/html\";\n\n//late binding\nimport {ui, $$} from \"../ui/core\";\n\nconst Touch = {\n\tconfig:{\n\t\tlongTouchDelay:1000,\n\t\tscrollDelay:150,\n\t\tgravity:500,\n\t\tdeltaStep:30,\n\t\tspeed:\"0ms\",\n\t\tfinish:1500,\n\t\tellastic:true,\n\t\tfastClick:true\n\t},\n\tlimit:function(value){\n\t\tTouch._limited = value !== false;\t\n\t},\n\tdisable:function(){\n\t\tTouch._disabled = true;\n\t},\n\tenable:function(){\n\t\tTouch._disabled = false;\n\t},\n\t$init:function(){\n\t\tTouch.$init = function(){};\n\n\t\tevent(document.body, mouse.down,\tTouch._touchstart, {passive:false});\n\t\tevent(document.body, mouse.move, \tTouch._touchmove, {passive:false});\n\t\tevent(document.body, mouse.up, \tTouch._touchend);\n\n\t\tevent(document.body,\"dragstart\",function(e){\n\t\t\tif(Touch._disabled || Touch._limited) return;\n\t\t\treturn preventEvent(e);\n\t\t});\n\t\tevent(document.body,\"touchstart\",function(e){\n\t\t\tif (Touch._disabled || Touch._limited || (!Touch.config.fastClick) ) return;\n\t\t\t//fast click mode for iOS\n\t\t\t//To have working form elements Android must not block event - so there are no fast clicks for Android\n\t\t\t//Selects still don't work with fast clicks\n\t\t\tif (env.isSafari) {\n\t\t\t\tvar tag = e.srcElement.tagName.toLowerCase();\n\t\t\t\tif (tag == \"input\" || tag == \"textarea\" || tag == \"select\" || tag==\"label\")\n\t\t\t\t\treturn true;\n\n\t\t\t\tTouch._fire_fast_event = true;\n\t\t\t\treturn preventEvent(e);\n\t\t\t}\n\t\t}, {passive:false});\n\n\t\tTouch._clear_artefacts();\n\t\tTouch._scroll = [null, null];\n\t\tTouch.$active = true;\n\t},\n\t_clear_artefacts:function(){\n\t\tTouch._start_context = Touch._current_context = Touch._prev_context = Touch._scroll_context = null;\n\t\tTouch._scroll_mode = Touch._scroll_node = Touch._scroll_stat = this._long_touched = null;\n\t\t//remove(Touch._scroll);\n\t\t//Touch._scroll = [null, null];\n\t\tTouch._delta = \t{ _x_moment:0, _y_moment:0, _time:0 };\n\n\t\tif (Touch._css_button_remove){\n\t\t\tremoveCss(Touch._css_button_remove,\"webix_touch\");\n\t\t\tTouch._css_button_remove = null;\n\t\t}\n\t\t\n\t\twindow.clearTimeout(Touch._long_touch_timer);\n\t\tTouch._was_not_moved = true;\n\t\tTouch._axis_x = true;\n\t\tTouch._axis_y = true;\n\t\tif (!Touch._active_transion)\n\t\t\tTouch._scroll_end();\n\t},\n\t_touchend:function(e){\n\t\tif (Touch._start_context) {\n\t\t\tif (!Touch._scroll_mode) {\n\t\t\t\tif (!this._long_touched) {\n\t\t\t\t\tif (Touch._axis_y && !Touch._axis_x) {\n\t\t\t\t\t\tTouch._translate_event(\"onSwipeX\");\n\t\t\t\t\t} else if (Touch._axis_x && !Touch._axis_y) {\n\t\t\t\t\t\tTouch._translate_event(\"onSwipeY\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (env.isSafari && Touch._fire_fast_event) { //need to test for mobile ff and blackbery\n\t\t\t\t\t\t\tTouch._fire_fast_event = false;\n\t\t\t\t\t\t\tvar target = Touch._start_context.target;\n\n\t\t\t\t\t\t\t//dark iOS magic, without delay it can skip repainting\n\t\t\t\t\t\t\tdelay(function () {\n\t\t\t\t\t\t\t\tvar click_event = document.createEvent(\"MouseEvents\");\n\t\t\t\t\t\t\t\tclick_event.initEvent(\"click\", true, true);\n\t\t\t\t\t\t\t\ttarget.dispatchEvent(click_event);\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\n\n\t\t\t\tvar temp = Touch._get_matrix(Touch._scroll_node);\n\t\t\t\tvar x = temp.e;\n\t\t\t\tvar y = temp.f;\n\t\t\t\tvar finish = Touch.config.finish;\n\n\t\t\t\tvar delta = Touch._get_delta(e, true);\n\t\t\t\tvar view = $$(Touch._scroll_node);\n\n\t\t\t\tvar gravity = (view && view.$scroll ? view.$scroll.gravity : Touch.config.gravity);\n\t\t\t\tif (delta._time) {\n\t\t\t\t\tvar nx = x + gravity * delta._x_moment / delta._time;\n\t\t\t\t\tvar ny = y + gravity * delta._y_moment / delta._time;\n\n\t\t\t\t\tvar cnx = Touch._scroll[0] ? Touch._correct_minmax(nx, false, false, Touch._scroll_stat.dx, Touch._scroll_stat.px) : x;\n\t\t\t\t\tvar cny = Touch._scroll[1] ? Touch._correct_minmax(ny, false, false, Touch._scroll_stat.dy, Touch._scroll_stat.py) : y;\n\n\n\t\t\t\t\tvar size = Math.max(Math.abs(cnx - x), Math.abs(cny - y));\n\t\t\t\t\tif (size < 150)\n\t\t\t\t\t\tfinish = finish * size / 150;\n\n\t\t\t\t\tif (cnx != x || cny != y)\n\t\t\t\t\t\tfinish = Math.round(finish * Math.max((cnx - x) / (nx - x), (cny - y) / (ny - y)));\n\n\t\t\t\t\tvar result = {e: cnx, f: cny};\n\n\n\t\t\t\t\tview = $$(Touch._scroll_node);\n\t\t\t\t\tif (view && view.adjustScroll)\n\t\t\t\t\t\tview.adjustScroll(result);\n\n\n\t\t\t\t\t//finish = Math.max(100,(Touch._fast_correction?100:finish));\n\t\t\t\t\tfinish = Math.max(100, finish);\n\n\n\t\t\t\t\tif (x != result.e || y != result.f) {\n\t\t\t\t\t\tTouch._set_matrix(Touch._scroll_node, result.e, result.f, finish + \"ms\");\n\t\t\t\t\t\tif (Touch._scroll_master)\n\t\t\t\t\t\t\tTouch._scroll_master._sync_scroll(result.e, result.f, finish + \"ms\");\n\t\t\t\t\t\tTouch._set_scroll(result.e, result.f, finish + \"ms\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tTouch._scroll_end();\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t\tTouch._scroll_end();\n\t\t\t}\n\t\t\tTouch._translate_event(\"onTouchEnd\");\n\t\t\tTouch._clear_artefacts();\n\t\t}\n\t},\n\t_touchmove:function(e){\n\t\tif (!Touch._scroll_context || !Touch._start_context) return;\n\n\t\tvar\tdelta = Touch._get_delta(e);\n\t\tTouch._translate_event(\"onTouchMove\");\n\n\t\tif (Touch._scroll_mode){\n\t\t\tTouch._set_scroll_pos(delta);\n\t\t} else {\n\t\t\tTouch._axis_x = Touch._axis_check(delta._x, \"x\", Touch._axis_x);\n\t\t\tTouch._axis_y = Touch._axis_check(delta._y, \"y\", Touch._axis_y);\n\t\t\tif (Touch._scroll_mode){\n\t\t\t\tvar view = Touch._get_event_view(\"onBeforeScroll\", true);\n\t\t\t\tif (view){\n\t\t\t\t\tvar data = {};\n\t\t\t\t\tview.callEvent(\"onBeforeScroll\",[data]);\n\t\t\t\t\tif (data.update){\n\t\t\t\t\t\tTouch.config.speed = data.speed;\n\t\t\t\t\t\tTouch.config.scale = data.scale;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tTouch._init_scroller(delta); //apply scrolling\n\t\t\t}\n\t\t}\n\n\t\treturn preventEvent(e);\n\t},\n\t_set_scroll_pos:function(){\n\t\tif (!Touch._scroll_node) return;\n\t\tvar temp = Touch._get_matrix(Touch._scroll_node);\n\t\tvar prev = Touch._prev_context || Touch._start_context;\n\n\t\tvar view = $$(Touch._scroll_node);\n\t\tvar ellastic = (view&&view.$scroll)?view.$scroll.ellastic: Touch.config.ellastic;\n\t\tif (Touch._scroll[0])\n\t\t\ttemp.e = Touch._correct_minmax( temp.e - prev.x + Touch._current_context.x , ellastic, temp.e, Touch._scroll_stat.dx, Touch._scroll_stat.px);\n\t\tif (Touch._scroll[1])\n\t\t\ttemp.f = Touch._correct_minmax( temp.f - prev.y + Touch._current_context.y , ellastic, temp.f, Touch._scroll_stat.dy, Touch._scroll_stat.py);\n\n\t\tTouch._set_matrix(Touch._scroll_node, temp.e, temp.f, \"0ms\");\n\t\tif (Touch._scroll_master)\n\t\t\tTouch._scroll_master._sync_scroll(temp.e, temp.f, \"0ms\");\n\t\tTouch._set_scroll(temp.e, temp.f, \"0ms\");\n\t},\n\t_set_scroll:function(dx, dy, speed){\n\t\t\n\t\tvar edx = Touch._scroll_stat.px/Touch._scroll_stat.dx * -dx;\n\t\tvar edy = Touch._scroll_stat.py/Touch._scroll_stat.dy * -dy;\n\t\tif (Touch._scroll[0])\n\t\t\tTouch._set_matrix(Touch._scroll[0], edx, 0 ,speed);\n\t\tif (Touch._scroll[1])\n\t\t\tTouch._set_matrix(Touch._scroll[1], 0, edy ,speed);\n\t},\n\tscrollTo:function(node, x, y, speed){\n\t\tTouch._set_matrix(node,x,y,speed);\n\t},\n\t_set_matrix:function(node, xv, yv, speed){\n\t\tif(!Touch._in_anim_frame && window.setAnimationFrame){\n\t\t\twindow.setAnimationFrame(function(){\n\t\t\t\tTouch._in_anim_frame = true;\n\t\t\t\treturn Touch._set_matrix(node, xv, yv, speed);\n\t\t\t});\n\t\t}\n\t\tTouch._in_anim_frame = null;\n\t\tTouch._active_transion = true;\n\t\tif (node){\n\t\t\tvar trans = Touch.config.translate || env.translate;\n\t\t\tnode.style[env.transform] = trans+\"(\"+Math.round(xv)+\"px, \"+Math.round(yv)+\"px\"+((trans==\"translate3d\")?\", 0\":\"\")+\")\";\n\t\t\tnode.style[env.transitionDuration] = speed;\n\t\t}\n\t},\n\t_get_matrix:function(node){\n\t\tvar matrix = window.getComputedStyle(node)[env.transform];\n\t\tvar tmatrix;\n\n\t\tif (matrix == \"none\")\n\t\t\ttmatrix = {e:0, f:0};\n\t\telse {\n\t\t\tif(window.WebKitCSSMatrix)\n\t\t\t\t/* global WebKitCSSMatrix */\n\t\t\t\ttmatrix = new WebKitCSSMatrix(matrix);\n\t\t\telse if (window.MSCSSMatrix)\n\t\t\t\t/* global MSCSSMatrix */\n\t\t\t\ttmatrix = new MSCSSMatrix(matrix);\n\t\t\telse {\n\t\t\t\t// matrix(1, 0, 0, 1, 0, 0) --> 1, 0, 0, 1, 0, 0\n\t\t\t\tvar _tmatrix = matrix.replace(/(matrix\\()(.*)(\\))/gi, \"$2\");\n\t\t\t\t// 1, 0, 0, 1, 0, 0 --> 1,0,0,1,0,0\n\t\t\t\t_tmatrix = _tmatrix.replace(/\\s/gi, \"\");\n\t\t\t\t_tmatrix = _tmatrix.split(\",\");\n\n\t\t\t\ttmatrix = {};\n\t\t\t\tvar tkey = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n\t\t\t\tfor(var i=0; i0) return allow?(current + sign*Math.sqrt(delta)):0;\n\t\t\n\t\tvar max = dx - px;\n\t\tif (max + value < 0)\t\n\t\t\treturn allow?(current - Math.sqrt(-(value-current))):-max;\n\t\t\t\n\t\t//\tTouch._fast_correction = false;\n\t\treturn value;\n\t},\t\n\t_init_scroll_node:function(node){\n\t\tif (!node.scroll_enabled){ \n\t\t\tnode.scroll_enabled = true;\t\n\t\t\tnode.parentNode.style.position=\"relative\";\n\t\t\tvar prefix = env.cssPrefix;\n\t\t\tnode.style.cssText += prefix+\"transition: \"+prefix+\"transform; \"+prefix+\"user-select:none; \"+prefix+\"transform-style:flat;\";\n\t\t\tnode.addEventListener(env.transitionEnd,Touch._scroll_end,false);\n\t\t}\n\t},\n\t_init_scroller:function(){\n\t\tif (Touch._scroll_mode.indexOf(\"x\") != -1)\n\t\t\tTouch._scroll[0] = Touch._create_scroll(\"x\", Touch._scroll_stat.dx, Touch._scroll_stat.px, \"width\");\n\t\tif (Touch._scroll_mode.indexOf(\"y\") != -1)\n\t\t\tTouch._scroll[1] = Touch._create_scroll(\"y\", Touch._scroll_stat.dy, Touch._scroll_stat.py, \"height\");\n\t\t\t\n\t\tTouch._init_scroll_node(Touch._scroll_node);\n\t\twindow.setTimeout(Touch._set_scroll_pos,1);\n\t},\n\t_create_scroll:function(mode, dy, py, dim){\n\t\tif (dy - py <2){\n\t\t\tvar matrix = Touch._get_matrix(Touch._scroll_node);\n\t\t\tvar e = (mode==\"y\"?matrix.e:0);\n\t\t\tvar f = (mode==\"y\"?0:matrix.f);\n\t\t\tif (!Touch._scroll_master)\n\t\t\t\tTouch._set_matrix(Touch._scroll_node, e, f, \"0ms\");\n\t\t\tTouch._scroll_mode = Touch._scroll_mode.replace(mode,\"\");\n\t\t\treturn \"\";\n\t\t}\n\n\t\tvar scroll = create(\"DIV\", {\n\t\t\t\"class\":\"webix_scroll_\"+mode\n\t\t},\"\");\n\n\t\tscroll.style[dim] = Math.max((py*py/dy-7),10) +\"px\";\n\t\tif (Touch._scroll_stat.left) \n\t\t\tif (mode === \"x\")\n\t\t\t\tscroll.style.left = Touch._scroll_stat.left+\"px\";\n\t\t\telse\n\t\t\t\tscroll.style.right = (-Touch._scroll_stat.left)+\"px\";\n\t\tif (Touch._scroll_stat.hidden)\n\t\t\tscroll.style.visibility = \"hidden\";\n\n\t\tTouch._scroll_node.parentNode.appendChild(scroll);\n\t\t\n\t\treturn scroll;\n\t},\n\t_axis_check:function(value, mode, old){\n\t\tif (value > Touch.config.deltaStep){\n\t\t\tif (Touch._was_not_moved){\n\t\t\t\tTouch._long_move(mode);\n\t\t\t\tTouch._locate(mode);\n\t\t\t\tif ((Touch._scroll_mode||\"\").indexOf(mode) == -1) Touch._scroll_mode = \"\";\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn old;\n\t},\n\t_scroll_end:function(){\n\t\t//sending event to the owner of the scroll only\n\t\tvar result,state,view;\n\t\tview = $$(Touch._scroll_node||this);\n\t\tif (view){\n\t\t\tif (Touch._scroll_node)\n\t\t\t\tresult = Touch._get_matrix(Touch._scroll_node);\n\t\t\telse if(view.getScrollState){\n\t\t\t\tstate = view.getScrollState();\n\t\t\t\tresult = {e:state.x, f:state.y};\n\t\t\t}\n\t\t\tcallEvent(\"onAfterScroll\", [result]);\n\t\t\tif (view.callEvent)\n\t\t\t\tview.callEvent(\"onAfterScroll\",[result]);\n\t\t}\n\t\tif (!Touch._scroll_mode){\n\t\t\tremove(Touch._scroll);\n\t\t\tTouch._scroll = [null, null];\n\t\t}\n\t\tTouch._active_transion = false;\n\t},\n\t_long_move:function(){\n\t\twindow.clearTimeout(Touch._long_touch_timer);\n\t\tTouch._was_not_moved = false;\t\n\t},\t\n\t_stop_old_scroll:function(e){\n\t\tif (Touch._scroll[0] || Touch._scroll[1]){\n\t\t\tTouch._stop_scroll(e, Touch._scroll[0]?\"x\":\"y\");\n\t\t}else\n\t\t\treturn true;\n\t},\n\t_touchstart :function(e){\n\t\tvar target = e.target || event.srcElement;\n\n\t\tif (Touch._disabled || (target.tagName&&target.tagName.toLowerCase() == \"textarea\" && target.offsetHeight 4){\n\t\t\t\tenv.touch = true;\n\t\t\t\tsetMouse(mouse);\n\t\t\t\ttouchInit();\n\t\t\t\tfor (var key in ui.views){\n\t\t\t\t\tvar view = ui.views[key];\n\t\t\t\t\tif (view && view.$touch)\n\t\t\t\t\t\tview.$touch();\n\t\t\t\t}\n\t\t\t}\n\t\t\teventRemove(id);\n\t\t}, { capture: true });\n\t}\n}\n\nfunction setMouse(mouse){\n\tmouse.down = \"touchstart\";\n\tmouse.move = \"touchmove\";\n\tmouse.up = \"touchend\";\n\tmouse.context = Touch._get_context;\n}\n\nready(touchInit);\n\n\nvar mouse = env.mouse = { down:\"mousedown\", up:\"mouseup\", \n\tmove:\"mousemove\", context:Touch._get_context_m };\n\nif (window.navigator.pointerEnabled){\n\tmouse.down = \"pointerdown\";\n\tmouse.move = \"pointermove\";\n\tmouse.up = \"pointerup\";\n} else if (window.navigator.msPointerEnabled){\n\tmouse.down = \"MSPointerDown\";\n\tmouse.move = \"MSPointerMove\";\n\tmouse.up = \"MSPointerUp\";\n} else if (env.touch)\n\tsetMouse(mouse);\n\t\n\nexport default Touch;","import env from \"../webix/env\";\nimport state from \"../core/state\";\n\nimport {event} from \"../webix/htmlevents\";\nimport {callEvent} from \"../webix/customevents\";\n\nimport {use} from \"../services\";\n\nexport function _uid(name){\n\treturn \"$\"+name+(_namecount[name] = (_namecount[name]||0)+1);\n}\nconst _namecount = {};\n\nvar _freeze_resize = false;\nexport function freeze(handler, trigger){\n\t_freeze_resize = true;\n\tvar res = handler();\n\tif (res && res.then){\n\t\tres = res.then(function(any){\n\t\t\t_freeze_resize = false;\n\t\t\tif (trigger !== false)\n\t\t\t\tresize();\n\t\t\treturn any;\n\t\t});\n\t} else {\n\t\t_freeze_resize = false;\n\t\tif (trigger !== false)\n\t\t\tresize();\n\t}\n\treturn res;\n}\n\nexport function resize(){\n\tuse(\"UIManager\").applyChanges();\n\tcallEvent(\"onClick\",[]);\n\tstate._force_resize = true;\n\tif (!_freeze_resize)\n\t\tfor (var i=state.top_views.length - 1; i>=0; i--){\n\t\t\tif (state.top_views[i].obj)\n\t\t\t\tstate.top_views[i].obj.resize();\n\t\t}\n\tstate._force_resize = false;\n}\n\nexport function each(parent, logic, master, include){\n\tif (parent){\n\t\tvar children = include ? [parent] : parent.getChildViews();\n\t\tfor (var i = 0; i < children.length; i++){\n\t\t\tif (logic.call((master), children[i]) !== false)\n\t\t\t\teach(children[i], logic, master);\n\t\t}\n\t}\n}\n\nexport function zIndex(){\n\treturn env.zIndexBase++;\n}\n\nevent(window, \"resize\", function() {\n\t// check for virtual keyboard\n\tif(env.touch && ( state._edit_open_time && (new Date())-state._edit_open_time < 1000 || state._focus_time && (new Date())-state._focus_time < 1000)){\n\t\treturn;\n\t} else {\n\t\tresize();\n\t}\n});","import {preventEvent, addCss, removeCss, pos as getPos, remove} from \"../webix/html\";\nimport env from \"../webix/env\";\nimport Touch from \"../core/touch\";\nimport {zIndex} from \"../ui/helpers\";\nimport {toArray, toNode} from \"../webix/helpers\";\nimport {_event, event, eventRemove} from \"../webix/htmlevents\";\nimport {attachEvent} from \"../webix/customevents\";\n\n\n/*\n\tBehavior:DND - low-level dnd handling\n\t@export\n\t\tgetContext\n\t\taddDrop\n\t\taddDrag\n\t\t\n\tDND master can define next handlers\n\t\tonCreateDrag\n\t\tonDragIng\n\t\tonDragOut\n\t\tonDrag\n\t\tonDrop\n\tall are optional\n*/\n\nconst DragControl ={\n\t//has of known dnd masters\n\t_drag_masters : toArray([\"dummy\"]),\n\t/*\n\t\tregister drop area\n\t\t@param node \t\t\thtml node or ID\n\t\t@param ctrl \t\t\toptions dnd master\n\t\t@param master_mode \t\ttrue if you have complex drag-area rules\n\t*/\n\taddDrop:function(node,ctrl,master_mode){\n\t\tnode = toNode(node);\n\t\tnode.webix_drop=this._getCtrl(ctrl);\n\t\tif (master_mode) node.webix_master=true;\n\t},\n\t//return index of master in collection\n\t//it done in such way to prevent dnd master duplication\n\t//probably useless, used only by addDrop and addDrag methods\n\t_getCtrl:function(ctrl){\n\t\tctrl = ctrl||DragControl;\n\t\tvar index = this._drag_masters.find(ctrl);\n\t\tif (index<0){\n\t\t\tindex = this._drag_masters.length;\n\t\t\tthis._drag_masters.push(ctrl);\n\t\t}\n\t\treturn index;\n\t},\n\t_createTouchDrag: function(e){\n\t\tvar dragCtrl = DragControl;\n\t\tvar master = this._getActiveDragMaster();\n\t\t// for data items only\n\t\tif(master && master._getDragItemPos){\n\n\t\t\tif(!dragCtrl._html)\n\t\t\t\tdragCtrl.createDrag(e);\n\t\t\tvar ctx = dragCtrl._drag_context;\n\t\t\tdragCtrl._html.style.left= e.x+dragCtrl.left+ (ctx.x_offset||0)+\"px\";\n\t\t\tdragCtrl._html.style.top= e.y+dragCtrl.top+ (ctx.y_offset||0) +\"px\";\n\t\t}\n\t},\n\t/*\n\t\tregister drag area\n\t\t@param node \thtml node or ID\n\t\t@param ctrl \toptions dnd master\n\t*/\n\taddDrag:function(node,ctrl){\n\t\tnode = toNode(node);\n\t\tnode.webix_drag=this._getCtrl(ctrl);\n\t\t_event(node,env.mouse.down,this._preStart,{ bind:node });\n\t\t_event(node,\"dragstart\",preventEvent);\n\t},\n\t//logic of drag - start, we are not creating drag immediately, instead of that we hears mouse moving\n\t_preStart:function(e){\n\t\tif (DragControl._active){\n\t\t\t//if we have nested drag areas, use the top one and ignore the inner one\n\t\t\tif (DragControl._saved_event == e) return;\n\t\t\tDragControl._preStartFalse();\n\t\t\tDragControl.destroyDrag(e);\n\t\t}\n\t\tDragControl._active=this;\n\n\t\tvar evobj = env.mouse.context(e);\n\t\tDragControl._start_pos=evobj;\n\t\tDragControl._saved_event = e;\n\n\t\tDragControl._webix_drag_mm = event(document.body,env.mouse.move,DragControl._startDrag);\n\t\tDragControl._webix_drag_mu = event(document,env.mouse.up,DragControl._preStartFalse);\n\n\t\t//need to run here, or will not work in IE\n\t\taddCss(document.body,\"webix_noselect\", 1);\n\t},\n\t//if mouse was released before moving - this is not a dnd, remove event handlers\n\t_preStartFalse:function(){\n\t\tDragControl._clean_dom_after_drag();\n\t},\n\t//mouse was moved without button released - dnd started, update event handlers\n\t_startDrag:function(e){\n\t\t//prevent unwanted dnd\n\t\tvar pos = env.mouse.context(e);\n\t\tvar master = DragControl._getActiveDragMaster();\n\t\t// only long-touched elements can be dragged\n\n\t\tvar longTouchLimit = (master && env.touch && master._getDragItemPos && !Touch._long_touched);\n\t\tif (longTouchLimit || Math.abs(pos.x-DragControl._start_pos.x)<5 && Math.abs(pos.y-DragControl._start_pos.y)<5)\n\t\t\treturn;\n\n\t\tDragControl._clean_dom_after_drag(true);\n\t\tif(!DragControl._html)\n\t\t\tif (!DragControl.createDrag(DragControl._saved_event)) return;\n\t\t\n\t\tDragControl.sendSignal(\"start\"); //useless for now\n\t\tDragControl._webix_drag_mm = event(document.body,env.mouse.move,DragControl._moveDrag);\n\t\tDragControl._webix_drag_mu = event(document,env.mouse.up,DragControl._stopDrag);\n\t\tDragControl._moveDrag(e);\n\n\t\tif (env.touch)\n\t\t\treturn preventEvent(e);\n\t},\n\t//mouse was released while dnd is active - process target\n\t_stopDrag:function(e){\n\t\tDragControl._clean_dom_after_drag();\n\t\tDragControl._saved_event = null;\n\n\t\tif (DragControl._last){\t//if some drop target was confirmed\n\t\t\tDragControl.$drop(DragControl._active, DragControl._last, e);\n\t\t\tDragControl.$dragOut(DragControl._active,DragControl._last,null,e);\n\t\t}\n\t\tDragControl.destroyDrag(e);\n\t\tDragControl.sendSignal(\"stop\");\t//useless for now\n\t},\n\t_clean_dom_after_drag:function(still_drag){\n\t\tthis._webix_drag_mm = eventRemove(this._webix_drag_mm);\n\t\tthis._webix_drag_mu = eventRemove(this._webix_drag_mu);\n\t\tif (!still_drag)\n\t\t\tremoveCss(document.body,\"webix_noselect\");\n\t},\n\t//dnd is active and mouse position was changed\n\t_moveDrag:function(e){\n\t\tvar dragCtrl = DragControl;\n\t\tvar pos = getPos(e);\n\t\tvar evobj = env.mouse.context(e);\n\n\t\t//give possibility to customize drag position\n\t\tvar customPos = dragCtrl.$dragPos(pos, e);\n\t\t//adjust drag marker position\n\t\tvar ctx = dragCtrl._drag_context;\n\t\tdragCtrl._html.style.top=pos.y+dragCtrl.top+(customPos||!ctx.y_offset?0:ctx.y_offset) +\"px\";\n\t\tdragCtrl._html.style.left=pos.x+dragCtrl.left+(customPos||!ctx.x_offset?0:ctx.x_offset)+\"px\";\n\n\t\tif (dragCtrl._skip)\n\t\t\tdragCtrl._skip=false;\n\t\telse {\n\t\t\tvar target = evobj.target = env.touch ? document.elementFromPoint(evobj.x, evobj.y) : evobj.target;\n\t\t\tvar touch_event = env.touch ? evobj : e;\n\t\t\tdragCtrl._checkLand(target, touch_event);\n\t\t}\n\t\t\n\t\treturn preventEvent(e);\n\t},\n\t//check if item under mouse can be used as drop landing\n\t_checkLand:function(node,e){\n\t\twhile (node && node.tagName!=\"BODY\"){\n\t\t\tif (node.webix_drop){\t//if drop area registered\n\t\t\t\tif (this._last && (this._last!=node || node.webix_master))\t//if this area with complex dnd master\n\t\t\t\t\tthis.$dragOut(this._active,this._last,node,e);\t\t\t//inform master about possible mouse-out\n\t\t\t\tif (!this._last || this._last!=node || node.webix_master){\t//if this is new are or area with complex dnd master\n\t\t\t\t\tthis._last=null;\t\t\t\t\t\t\t\t\t\t//inform master about possible mouse-in\n\t\t\t\t\tthis._landing=this.$dragIn(DragControl._active,node,e);\n\t\t\t\t\tif (this._landing)\t//landing was rejected\n\t\t\t\t\t\tthis._last=node;\n\t\t\t\t\treturn;\t\t\t\t\n\t\t\t\t} \n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnode=node.parentNode;\n\t\t}\n\t\tif (this._last)\t//mouse was moved out of previous landing, and without finding new one \n\t\t\tthis._last = this._landing = this.$dragOut(this._active,this._last,null,e);\n\t},\n\t//mostly useless for now, can be used to add cross-frame dnd\n\tsendSignal:function(signal){\n\t\tDragControl.active=(signal==\"start\");\n\t},\n\t\n\t//return master for html area\n\tgetMaster:function(t){\n\t\treturn this._drag_masters[t.webix_drag||t.webix_drop];\n\t},\n\t//return dhd-context object\n\tgetContext:function(){\n\t\treturn this._drag_context;\n\t},\n\tgetNode:function(){\n\t\treturn this._html;\n\t},\n\t//called when dnd is initiated, must create drag representation\n\tcreateDrag:function(e){ \n\t\tvar dragCtl = DragControl;\n\t\tvar a=dragCtl._active;\n\n\t\tdragCtl._drag_context = {};\n\t\tvar master = this._drag_masters[a.webix_drag];\n\t\tvar drag_container;\n\n\t\t//if custom method is defined - use it\n\t\tif (master.$dragCreate){\n\t\t\tdrag_container=master.$dragCreate(a,e);\n\t\t\tif (!drag_container) return false;\n\t\t\tthis._setDragOffset(e);\n\t\t\tdrag_container.style.position = \"absolute\";\n\t\t} else {\n\t\t//overvise use default one\n\t\t\tvar text = dragCtl.$drag(a,e);\n\t\t\tdragCtl._setDragOffset(e);\n\n\t\t\tif (!text) return false;\n\t\t\tdrag_container = document.createElement(\"DIV\");\n\t\t\tdrag_container.innerHTML=text;\n\t\t\tdrag_container.className=\"webix_drag_zone\";\n\t\t\tdocument.body.appendChild(drag_container);\n\n\t\t\tvar context = dragCtl._drag_context;\n\t\t\tif (context.html && env.pointerevents){\n\t\t\t\tcontext.x_offset = -Math.round(drag_container.offsetWidth * 0.5);\n\t\t\t\tcontext.y_offset = -Math.round(drag_container.offsetHeight * 0.75);\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t\tdragged item must have topmost z-index\n\t\t\tin some cases item already have z-index\n\t\t\tso we will preserve it if possible\n\t\t*/\n\t\tdrag_container.style.zIndex = Math.max(drag_container.style.zIndex,zIndex());\n\n\t\tDragControl._skipDropH = event(drag_container,env.mouse.move,DragControl._skip_mark);\n\n\t\tif (!DragControl._drag_context.from)\n\t\t\tDragControl._drag_context = {source:a, from:a};\n\t\t\n\t\tDragControl._html=drag_container;\n\t\treturn true;\n\t},\n\t//helper, prevents unwanted mouse-out events\n\t_skip_mark:function(){\n\t\tDragControl._skip=true;\n\t},\n\t//after dnd end, remove all traces and used html elements\n\tdestroyDrag:function(e){\n\t\tvar a=DragControl._active;\n\t\tvar master = this._drag_masters[a.webix_drag];\n\n\t\tif (master && master.$dragDestroy){\n\t\t\tDragControl._skipDropH = eventRemove(DragControl._skipDropH);\n\t\t\tif(DragControl._html)\n\t\t\t\tmaster.$dragDestroy(a,DragControl._html,e);\n\t\t}\n\t\telse{\n\t\t\tremove(DragControl._html);\n\t\t}\n\t\tDragControl._landing=DragControl._active=DragControl._last=DragControl._html=null;\n\t\t//DragControl._x_offset = DragControl._y_offset = null;\n\t},\n\t_getActiveDragMaster: function(){\n\t\treturn DragControl._drag_masters[DragControl._active.webix_drag];\n\t},\n\ttop:5,\t //relative position of drag marker to mouse cursor\n\tleft:5,\n\t_setDragOffset:function(e){\n\t\tvar dragCtl = DragControl;\n\t\tvar pos = dragCtl._start_pos;\n\t\tvar ctx = dragCtl._drag_context;\n\n\t\tif(typeof ctx.x_offset != \"undefined\" && typeof ctx.y_offset != \"undefined\")\n\t\t\treturn null;\n\n\t\tctx.x_offset = ctx.y_offset = 0;\n\t\tif(env.pointerevents){\n\t\t\tvar m=DragControl._getActiveDragMaster();\n\n\t\t\tif (m._getDragItemPos && m!==this){\n\t\t\t\tvar itemPos = m._getDragItemPos(pos,e);\n\n\t\t\t\tif(itemPos){\n\t\t\t\t\tctx.x_offset = itemPos.x - pos.x;\n\t\t\t\t\tctx.y_offset = itemPos.y - pos.y;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t},\n\t$dragPos:function(pos, e){\n\t\tvar m=this._drag_masters[DragControl._active.webix_drag];\n\t\tif (m.$dragPos && m!=this){\n\t\t\tm.$dragPos(pos, e, DragControl._html);\n\t\t\treturn true;\n\t\t}\n\t},\n\t//called when mouse was moved in drop area\n\t$dragIn:function(s,t,e){\n\t\tvar m=this._drag_masters[t.webix_drop];\n\t\tif (m.$dragIn && m!=this) return m.$dragIn(s,t,e);\n\t\tt.className=t.className+\" webix_drop_zone\";\n\t\treturn t;\n\t},\n\t//called when mouse was moved out drop area\n\t$dragOut:function(s,t,n,e){\n\t\tvar m=this._drag_masters[t.webix_drop];\n\t\tif (m.$dragOut && m!=this) return m.$dragOut(s,t,n,e);\n\t\tt.className=t.className.replace(\"webix_drop_zone\",\"\");\n\t\treturn null;\n\t},\n\t//called when mouse was released over drop area\n\t$drop:function(s,t,e){\n\t\tvar m=this._drag_masters[t.webix_drop];\n\t\tDragControl._drag_context.from = DragControl.getMaster(s);\n\t\tif (m.$drop && m!=this) return m.$drop(s,t,e);\n\t\tt.appendChild(s);\n\t},\n\t//called when dnd just started\n\t$drag:function(s,e){\n\t\tvar m=this._drag_masters[s.webix_drag];\n\t\tif (m.$drag && m!=this) return m.$drag(s,e);\n\t\treturn \"
\"+s.innerHTML+\"
\";\n\t}\t\n};\n\n//global touch-drag handler\nattachEvent(\"onLongTouch\", function(ev){\n\tif(DragControl._active)\n\t\tDragControl._createTouchDrag(ev);\n});\n\n\nexport default DragControl;","import ready from \"../webix/ready\";\n\nimport {assert} from \"../webix/debug\";\nimport {event, _event} from \"../webix/htmlevents\";\nimport {bind,delay,uid,PowerArray,isUndefined,isArray} from \"../webix/helpers\";\nimport {callEvent} from \"../webix/customevents\";\nimport {locate,preventEvent} from \"../webix/html\";\n\nimport {$$} from \"../ui/core\";\nimport state from \"../core/state\";\n\nimport {define} from \"../services\";\n\n\nconst UIManager = {\n\t_view: null,\n\t_hotkeys: {},\n\t_focus_time:0,\n\t_tab_time:0,\n\t_mouse_time:0,\n\t_controls: {\n\t\t\"enter\": 13,\n\t\t\"tab\": 9,\n\t\t\"esc\": 27,\n\t\t\"escape\": 27,\n\t\t\"up\": 38,\n\t\t\"down\": 40,\n\t\t\"left\": 37,\n\t\t\"right\": 39,\n\t\t\"pgdown\": 34,\n\t\t\"pagedown\": 34,\n\t\t\"pgup\": 33,\n\t\t\"pageup\": 33,\n\t\t\"end\": 35,\n\t\t\"home\": 36,\n\t\t\"insert\": 45,\n\t\t\"delete\": 46,\n\t\t\"backspace\": 8,\n\t\t\"space\": 32,\n\t\t\"meta\": 91,\n\t\t\"win\": 91,\n\t\t\"mac\": 91,\n\t\t\"multiply\": 106,\n\t\t\"add\": 107,\n\t\t\"subtract\": 109,\n\t\t\"decimal\": 110,\n\t\t\"divide\": 111,\n\t\t\"scrollock\":145,\n\t\t\"pausebreak\":19,\n\t\t\"numlock\":144,\n\t\t\"5numlocked\":12,\n\t\t\"shift\":16,\n\t\t\"capslock\":20\n\t},\n\t_inputs:{\n\t\t\"input\": 1,\n\t\t\"button\":1,\n\t\t\"textarea\":1,\n\t\t\"select\":1\n\t},\n\t_enable: function() {\n\t\t// attaching events here\n\t\tevent(document.body, \"click\", bind(this._focus_click, this));\n\t\tevent(document, \"keydown\", bind(this._keypress, this));\n\t\t_event(document.body, \"mousedown\", bind(function(){ this._mouse_time = new Date();}, this));\n\n\t\tif (document.body.addEventListener)\n\t\t\tevent(document.body, \"focus\", this._focus_tab, { capture:true, bind: this });\n\n\t\tstate.destructors.push({obj:this});\n\t},\n\tdestructor:function(){\n\t\tUIManager._view = null;\n\t},\n\tgetFocus: function() {\n\t\treturn this._view;\n\t},\n\t_focus_action:function(view){\n\t\tthis._focus_was_there = this._focus_was_there || view._settings.id;\n\t},\n\tsetFocus: function(view, only_api, tab){\n\t\t//view can be empty\n\t\tview = $$(view);\n\t\t//unfocus if view is hidden\n\t\tif (view && !view.$view) view = null;\n\n\t\t//store last click time, it is necessary to prevent refocusing\n\t\t//for example when user moves focus from onclick handler somewher\n\t\t//and we want to prevent autofocusing, when event will reach document.body\n\t\tthis._focus_time = state._focus_time = new Date();\n\n\t\tif (this._view === view) return true;\n\t\tif (this._view && this._view.callEvent)\n\t\t\tthis._view.callEvent(\"onBlur\", [this._view]);\n\n\t\tif (view && view.callEvent){\n\t\t\tview.callEvent(\"onFocus\", [view, this._view]);\n\t\t\tif(tab) view.callEvent(\"onTabFocus\", [view, this._view]);\n\t\t}\n\t\tcallEvent(\"onFocusChange\", [view, this._view]);\n\n\t\tif (this._view && this._view.blur && !only_api) this._view.blur();\n\t\tthis._view = view;\n\t\tif (view && view.focus && !only_api) view.focus();\n\t\treturn true;\n\t},\n\tapplyChanges: function(element){\n\t\tvar view = this.getFocus();\n\t\tif (view && view != element && view._applyChanges)\n\t\t\tview._applyChanges(element);\n\t},\n\thasFocus: function(view) {\n\t\treturn (view === this._view) ? true : false;\n\t},\n\t_focus: function(e, dont_clear) {\n\t\tvar view = locate(e, \"view_id\") || this._focus_was_there;\n\n\t\t//if html was repainted we can miss the view, so checking last processed one\n\t\tview = $$(view);\n\t\tthis._focus_was_there = null;\n\n\t\t//set timer, to fix issue with Android input focusin\n\t\tstate._focus_time = new Date();\n\n\t\tif (view == this._view) return;\n\n\t\tif (!dont_clear)\n\t\t\tthis._focus_was_there = null;\n\t\t\n\t\tif (view){\n\t\t\tview = $$(view);\n\t\t\tif (this.canFocus(view)){\n\t\t\t\t//[ACTIVECONTENT] focus operations for active content\n\t\t\t\tif (view.getNode) view.getNode(e);\n\t\t\t\tthis.setFocus(view);\n\t\t\t}\n\t\t} else if (!dont_clear)\n\t\t\tthis.setFocus(null);\n\n\t\treturn true;\n\t},\n\t_focus_click:function(e){\n\t\t// if it was onfocus/onclick less then 100ms behore then we ignore it\n\t\tif ((new Date())-this._focus_time < 100) {\n\t\t\tthis._focus_was_there = null;\n\t\t\treturn false;\n\t\t}\n\t\treturn this._focus(e);\n\t},\n\t_focus_tab: function(e) {\n\t\tif(!this._inputs[e.target.nodeName.toLowerCase()])\n\t\t\treturn false;\n\t\treturn this._focus(e, true);\n\t},\n\tcanFocus:function(view){\n\t\treturn view.isVisible() && view.isEnabled();\n\t},\n\n\t_moveChildFocus: function(check_view){\n\t\tvar focus = this.getFocus();\n\t\t//we have not focus inside of closing item\n\t\tif (check_view && !this._is_child_of(check_view, focus))\n\t\t\treturn false;\n\n\t\tif (!this._focus_logic(\"getPrev\", check_view))\n\t\t\tthis._view = null;\n\t},\n\t_translation_table:{\n\t},\n\t_is_child_of: function(parent, child) {\n\t\tif (!parent) return false;\n\t\tif (!child) return false;\n\t\twhile (child) {\n\t\t\tif (child === parent) return true;\n\t\t\tchild = child.getParentView();\n\t\t}\n\t\treturn false;\n\t},\n\t_keypress_timed:function(){\n\t\tif (this && this.callEvent)\n\t\t\tthis.callEvent(\"onTimedKeyPress\",[]);\n\t},\n\t_isNumPad: function(code){\n\t\treturn code < 112 && code>105;\n\t},\n\t_keypress: function(e) {\n\t\tvar code = e.which || e.keyCode;\n\t\tif(code>95 && code< 106)\n\t\t\tcode -= 48; //numpad support (numbers)\n\t\tcode = this._translation_table[code] || code;\n\t\t\n\t\tvar ctrl = e.ctrlKey;\n\t\tvar shift = e.shiftKey;\n\t\tvar alt = e.altKey;\n\t\tvar meta = e.metaKey;\n\t\tvar codeid = this._keycode(code, ctrl, shift, alt, meta);\n\t\tvar view = this.getFocus();\n\t\tif (view && view.callEvent) {\n\t\t\tif (view.callEvent(\"onKeyPress\", [code,e]) === false)\n\t\t\t\tpreventEvent(e);\n\t\t\tif (view.hasEvent(\"onTimedKeyPress\")){\n\t\t\t\tclearTimeout(view._key_press_timeout);\n\t\t\t\tview._key_press_timeout = delay(this._keypress_timed, view, [], (view._settings.keyPressTimeout||250));\n\t\t\t}\n\t\t}\n\n\t\tif(!this._isNumPad(code))\n\t\t\tcodeid = this._keycode(String.fromCharCode(code), ctrl, shift, alt, meta);\n\t\t//flag, that some non-special key was pressed\n\t\tvar is_any = !ctrl && !alt && !meta && (code!=9)&&(code!=27)&&(code!=13);\n\n\t\tif (this._check_keycode(codeid, is_any, e) === false) {\n\t\t\tpreventEvent(e);\n\t\t\treturn false;\n\t\t}\n\t},\n\n\t// dir - getNext or getPrev\n\t_focus_logic: function(dir) {\n\t\tif (!this.getFocus()) return null;\n\n\t\tdir = dir || \"getNext\";\n\t\tvar next = this.getFocus();\n\t\tvar start = next;\n\t\tvar marker = uid();\n\n\t\twhile (true) { // eslint-disable-line\n\t\t\tnext = this[dir](next);\n\t\t\t// view with focus ability\n\t\t\tif (next && this.canFocus(next))\n\t\t\t\treturn this.setFocus(next);\n\n\t\t\t// elements with focus ability not found\n\t\t\tif (next === start || next.$fmarker == marker)\n\t\t\t\treturn null;\n\t\t\t\n\t\t\t//prevents infinity loop\n\t\t\tnext.$fmarker = marker;\n\t\t}\n\t},\n\t_tab_logic:function(view, e){\n\t\tvar mode = !e.shiftKey;\n\t\tUIManager._tab_time = new Date();\n\t\tif (view && view._custom_tab_handler && !view._custom_tab_handler(mode, e))\n\t\t\treturn false;\n\n\t\tif (view && view._in_edit_mode){\n\t\t\tif (view.editNext)\n\t\t\t\treturn view.editNext(mode);\n\t\t\telse if (view.editStop){\n\t\t\t\tview.editStop();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else\n\t\t\tdelay(function(){\n\t\t\t\tUIManager.setFocus($$(document.activeElement), true, true);\n\t\t\t},1);\n\t},\n\tgetTop: function(id) {\n\t\tvar next, view = $$(id);\n\n\t\twhile (view && (next = view.getParentView()))\n\t\t\tview = next;\n\t\treturn view;\n\t},\n\n\tgetNext: function(view, _inner_call) {\n\t\tvar cells = view.getChildViews();\n\t\t//tab to first children\n\t\tif (cells.length && !_inner_call) return cells[0];\n\n\t\t//unique case - single view without child and parent\n\t\tvar parent = view.getParentView();\n\t\tif (!parent)\n\t\t\treturn view;\n\n\t\tvar p_cells = parent.getChildViews();\n\t\tif (p_cells.length){\n\t\t\tvar index = PowerArray.find.call(p_cells, view)+1;\n\t\t\twhile (index < p_cells.length) {\n\t\t\t\t//next visible child\n\t\t\t\tif (this.canFocus(p_cells[index])) \n\t\t\t\t\treturn p_cells[index];\n\n\t\t\t\tindex++;\n\t\t\t}\n\t\t} \n\n\t\t//sibling of parent\n\t\treturn this.getNext(parent, true);\n\t},\n\n\tgetPrev: function(view, _inner_call) {\n\t\tvar cells = view.getChildViews();\n\t\t//last child of last child\n\t\tif (cells.length && _inner_call) \n\t\t\treturn this.getPrev(cells[cells.length - 1], true);\n\t\tif (_inner_call) return view;\n\n\t\t//fallback from top to bottom\n\t\tvar parent = view.getParentView();\n\t\tif (!parent) return this.getPrev(view, true);\n\n\n\t\tvar p_cells = parent.getChildViews();\n\t\tif (p_cells) {\n\t\t\tvar index = PowerArray.find.call(p_cells, view)-1;\n\t\t\twhile (index >= 0) {\n\t\t\t\tif (this.canFocus(p_cells[index]))\n\t\t\t\t\treturn this.getPrev(p_cells[index], true);\n\t\t\t\tindex--;\n\t\t\t}\n\t\t}\n\n\t\treturn parent;\n\t},\n\taddHotKey: function(keys, handler, view) {\n\t\tassert(handler, \"Hot key handler is not defined\");\n\t\tvar pack = this._parse_keys(keys);\n\t\tassert(pack.letter, \"Unknown key code\");\n\t\tif (!view) view = null;\n\t\tpack.handler = handler;\n\t\tpack.view = view;\n\t\t\n\n\t\tvar code = this._keycode(pack.letter, pack.ctrl, pack.shift, pack.alt, pack.meta);\n\t\tif (!this._hotkeys[code]) this._hotkeys[code] = [];\n\t\tthis._hotkeys[code].push(pack);\n\n\t\treturn keys;\n\t},\n\tremoveHotKey: function(keys, func, view){\n\t\tvar pack = this._parse_keys(keys);\n\t\tvar code = this._keycode(pack.letter, pack.ctrl, pack.shift, pack.alt, pack.meta);\n\t\tif (!func && !view)\n\t\t\tdelete this._hotkeys[code];\n\t\telse {\n\t\t\tvar t = this._hotkeys[code];\n\t\t\tif (t){\n\t\t\t\tfor (var i = t.length - 1; i >= 0; i--) {\n\t\t\t\t\tif (view && t[i].view !== view) continue;\n\t\t\t\t\tif (func && t[i].handler !== func) continue;\n\t\t\t\t\tt.splice(i,1);\n\t\t\t\t}\n\t\t\t\tif (!t.length)\n\t\t\t\t\tdelete this._hotkeys[code];\n\t\t\t}\n\n\t\t}\n\t},\n\t_keycode: function(code, ctrl, shift, alt, meta) {\n\t\treturn code+\"_\"+[\"\", (ctrl ? \"1\" : \"0\"), (shift ? \"1\" : \"0\"), (alt ? \"1\" : \"0\"), (meta ? \"1\" : \"0\")].join(\"\");\n\t},\n\n\t_check_keycode: function(code, is_any, e){\n\t\tvar focus = this.getFocus();\n\t\tif (this._hotkeys[code])\n\t\t\treturn this._process_calls(this._hotkeys[code], focus, e);\n\t\telse if (is_any && this._hotkeys[\"ANY_0000\"])\n\t\t\treturn this._process_calls(this._hotkeys[\"ANY_0000\"], focus, e);\n\n\t\treturn true;\n\t},\n\t_process_calls:function(calls, focus, e){\n\t\tfor (var i = 0; i < calls.length; i++) {\n\t\t\tvar key = calls[i];\n\t\t\tif ((key.view !== null) &&\t\t//common hot-key\n\t\t\t\t(focus !== key.view) &&\t\t//hot-key for current view\n\t\t\t\t//hotkey for current type of view\n\t\t\t\t(typeof(key.view) !== \"string\" || !focus || focus.name !== key.view)) continue;\n\n\t\t\tvar temp_result = key.handler(focus, e);\n\t\t\tif (!!temp_result === temp_result) return temp_result;\n\t\t}\n\t\treturn true;\n\t},\n\t_parse_keys: function(keys) {\n\t\tvar controls = this._controls;\n\t\tvar parts = keys.toLowerCase().split(/[+\\-_]/);\n\t\tvar ctrl, shift, alt, meta;\n\t\tctrl = shift = alt = meta = 0;\n\t\tvar letter = \"\";\n\t\tfor (var i = 0; i < parts.length; i++) {\n\t\t\tif (parts[i] === \"ctrl\") ctrl = 1;\n\t\t\telse if (parts[i] === \"shift\") shift = 1;\n\t\t\telse if (parts[i] === \"alt\") alt = 1;\n\t\t\telse if (parts[i] === \"command\") meta = 1;\n\t\t\telse {\n\t\t\t\tif (controls[parts[i]]) {\n\t\t\t\t\tvar code = controls[parts[i]];\n\t\t\t\t\tif(this._isNumPad(code))\n\t\t\t\t\t\tletter = code.toString();\n\t\t\t\t\telse\n\t\t\t\t\t\tletter = String.fromCharCode(code);\n\t\t\t\t} else {\n\t\t\t\t\tletter = parts[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tletter: letter.toUpperCase(),\n\t\t\tctrl: ctrl,\n\t\t\tshift: shift,\n\t\t\talt: alt,\n\t\t\tmeta: meta,\n\t\t\tdebug:keys\n\t\t};\n\t},\n\tgetState:function(node, children) {\n\t\tchildren = (children||false);\n\t\tnode = $$(node);\n\t\tvar state = {\n\t\t\tid: node.config.id,\n\t\t\twidth: node.config.width,\n\t\t\theight: node.config.height,\n\t\t\tgravity: node.config.gravity\n\t\t};\n\t\tif (!isUndefined(node.config.collapsed)) state.collapsed = node.config.collapsed;\n\t\tif (node.name === \"tabs\" || node.name === \"tabbar\") state.activeCell = node.getValue();\n\t\t\n\t\tif (children) {\n\t\t\tstate = [state];\n\t\t\tif (node._cells) {\n\t\t\t\tfor (var i = 0; i < node._cells.length; i++)\n\t\t\t\t\tstate = state.concat(this.getState(node._cells[i], children));\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t},\n\tsetState:function(states) {\n\t\tif (!isArray(states)) states = [states];\n\t\n\t\tfor (var i = 0; i < states.length; i++) {\n\t\t\tvar state = states[i];\n\t\t\tvar node = $$(state.id);\n\t\t\tif (!node) continue;\n\t\n\t\t\tif (!isUndefined(state.collapsed)) node.define(\"collapsed\", state.collapsed);\n\t\t\tif (!isUndefined(state.activeCell)) node.setValue(state.activeCell);\n\t\n\t\t\tnode.define(\"width\", state.width);\n\t\t\tnode.define(\"height\", state.height);\n\t\t\tnode.define(\"gravity\", state.gravity);\n\t\t}\n\t\tvar top = $$(states[0].id);\n\t\tif (top) top.resize();\n\t}\n};\n\nready(function() {\n\tUIManager._enable();\n\n\tUIManager.addHotKey(\"enter\", function(view, ev){\n\t\tif (view && view.callEvent)\n\t\t\tview.callEvent(\"onEnter\", [ev]);\n\t\tif (view && view.editStop && view._in_edit_mode){\n\t\t\tview.editStop();\n\t\t\treturn true;\n\t\t} else if (view && view.touchable){\n\t\t\tvar form = view.getFormView();\n\t\t\tif (form && !view._skipSubmit)\n\t\t\t\tform.callEvent(\"onSubmit\",[view,ev]);\n\t\t}\n\t});\n\tUIManager.addHotKey(\"esc\", function(view){\n\t\tif (view){\n\t\t\tif (view.editCancel && view._in_edit_mode){\n\t\t\t\tview.editCancel();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tvar top = view.getTopParentView();\n\t\t\tif (top && top.setPosition)\n\t\t\t\ttop._hide();\n\t\t}\n\t});\n\tUIManager.addHotKey(\"shift+tab\", UIManager._tab_logic);\n\tUIManager.addHotKey(\"tab\", UIManager._tab_logic);\n});\n\ndefine(\"UIManager\", UIManager);\n\nexport default UIManager;","import {extend} from \"../webix/helpers\";\n\nconst Settings={\n\t$init:function(){\n\t\t/* \n\t\t\tproperty can be accessed as this.config.some\n\t\t\tin same time for inner call it have sense to use _settings\n\t\t\tbecause it will be minified in final version\n\t\t*/\n\t\tthis._settings = this.config= {}; \n\t},\n\tdefine:function(property, value){\n\t\tif (typeof property == \"object\")\n\t\t\treturn this._parseSeetingColl(property);\n\t\treturn this._define(property, value);\n\t},\n\t_define:function(property,value){\n\t\t//method with name {prop}_setter will be used as property setter\n\t\t//setter is optional\n\t\tvar setter = this[property+\"_setter\"];\n\t\treturn (this._settings[property]=setter?setter.call(this,value,property):value);\n\t},\n\t//process configuration object\n\t_parseSeetingColl:function(coll){\n\t\tif (coll){\n\t\t\tfor (var a in coll)\t\t\t\t//for each setting\n\t\t\t\tthis._define(a,coll[a]);\t\t//set value through config\n\t\t}\n\t},\n\t//helper for object initialization\n\t_parseSettings:function(obj,initial){\n\t\t//initial - set of default values\n\t\tvar settings = {}; \n\t\tif (initial)\n\t\t\tsettings = extend(settings,initial);\n\t\t\t\t\t\n\t\t//code below will copy all properties over default one\n\t\tif (typeof obj == \"object\" && !obj.tagName)\n\t\t\textend(settings,obj, true);\t\n\t\t//call config for each setting\n\t\tthis._parseSeetingColl(settings);\n\t},\n\t_mergeSettings:function(config, defaults){\n\t\tfor (var key in defaults)\n\t\t\tswitch(typeof config[key]){\n\t\t\t\tcase \"object\": \n\t\t\t\t\tconfig[key] = this._mergeSettings((config[key]||{}), defaults[key]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"undefined\":\n\t\t\t\t\tconfig[key] = defaults[key];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\t//do nothing\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\treturn config;\n\t}\n};\n\nexport default Settings;","import state from \"./state\";\n\nimport {toArray} from \"../webix/helpers\";\nimport {event, _events_final_destructor} from \"../webix/htmlevents\";\nimport {callEvent} from \"../webix/customevents\";\n\nimport {ui} from \"../ui/core\";\nimport UIManager from \"../core/uimanager\";\n\n\nconst Destruction = {\n\t$init:function(){\n\t\t//wrap in object to simplify removing self-reference\n\t\tvar t = this._destructor_handler = { obj: this};\n\n\t\t//register self in global list of destructors\n\t\tstate.destructors.push(t);\n\t},\n\t//will be called automatically on unload, can be called manually\n\t//simplifies job of GC\n\tdestructor:function(){\n\t\tvar config = this._settings;\n\n\t\tif (this._last_editor)\n\t\t\tthis.editCancel();\n\n\t\tif(this.callEvent)\n\t\t\tthis.callEvent(\"onDestruct\",[]);\n\n\t\t//destructor can be called only once\n\t\tthis.destructor=function(){};\n\t\t//remove self reference from global destructions collection\n\t\tthis._destructor_handler.obj = null;\n\n\t\t//destroy child and related cells\n\t\tif (this.getChildViews){\n\t\t\tvar cells = this.getChildViews();\n\t\t\tif (cells)\n\t\t\t\tfor (let i=0; i < cells.length; i++)\n\t\t\t\t\tcells[i].destructor();\n\n\t\t\tif (this._destroy_with_me)\n\t\t\t\tfor (let i=0; i < this._destroy_with_me.length; i++)\n\t\t\t\t\tthis._destroy_with_me[i].destructor();\n\t\t}\n\n\t\tdelete ui.views[config.id];\n\n\t\tif (config.$id){\n\t\t\tvar top = this.getTopParentView();\n\t\t\tif (top && top._destroy_child)\n\t\t\t\ttop._destroy_child(config.$id);\n\t\t}\n\n\t\t//html collection\n\t\tthis._htmlmap = null;\n\t\tthis._htmlrows = null;\n\t\tthis._html = null;\n\n\n\t\tif (this._contentobj) {\n\t\t\tthis._contentobj.innerHTML=\"\";\n\t\t\tthis._contentobj._htmlmap = null;\n\t\t}\n\n\t\t//removes view container\n\t\tif (this._viewobj&&this._viewobj.parentNode){\n\t\t\tthis._viewobj.parentNode.removeChild(this._viewobj);\n\t\t}\n\n\t\tif (this.data && this.data.destructor)\n\t\t\tthis.data.destructor();\n\n\t\tif (this.unbind)\n\t\t\tthis.unbind();\n\n\t\tthis.data = null;\n\t\tthis._viewobj = this.$view = this._contentobj = this._dataobj = null;\n\t\tthis._evs_events = this._evs_handlers = {};\n\n\t\t//remove focus from destructed view\n\t\tif (UIManager._view == this)\n\t\t\tUIManager._view = null;\n\n\t\tvar url = config.url;\n\t\tif (url && url.$proxy && url.release)\n\t\t\turl.release();\n\n\t\tthis.$scope = null;\n\t\t// this flag is checked in delay method\n\t\tthis.$destructed = true;\n\t}\n};\n//global list of destructors\nevent(window,\"unload\",function(){\n\tcallEvent(\"unload\", []);\n\tstate._final_destruction = true;\n\t\n\t//call all registered destructors\n\tfor (var i=0; ix) x = sizes[0];\n\t\t//minHeight\n\t\tif (sizes[2]>y) y = sizes[2];\n\n\t\t//maxWidth rule\n\t\tif ((!fullscreen || this._settings.width) && x>sizes[1]) x = sizes[1];\n\t\t//maxHeight rule\n\t\tif ((!fullscreen || this._settings.height) && y>sizes[3]) y = sizes[3];\n\n\t\tthis.$setSize(x,y);\n\t\tif (state._responsive_exception){\n\t\t\tstate._responsive_exception = false;\n\t\t\tthis.adjust();\n\t\t}\n\t},\n\tresize:function(){\n\t\tif (state._child_sizing_active || state._freeze_resize || state._responsive_tinkery ) return;\n\n\t\tvar parent = this.getParentView();\n\t\tif (parent){\n\t\t\tif (parent.resizeChildren)\n\t\t\t\tparent.resizeChildren();\n\t\t\telse\n\t\t\t\tparent.resize();\n\t\t} else {\n\t\t\tthis.adjust();\n\t\t\tcallEvent(\"onResize\",[]);\n\t\t}\n\t}\n};\n\nconst view = protoUI(api, Settings, Destruction, BaseBind, UIExtension);\nexport default { api, view };","import {isUndefined} from \"../webix/helpers\";\nimport {debug_size_box} from \"../webix/debug\";\nimport {protoUI} from \"../ui/core\";\n\nimport base from \"./baseview\";\n\nconst api = {\n\tname:\"view\",\n\t$init:function(config){\n\t\tthis._set_inner(config);\n\t},\n\n\t//deside, will component use borders or not\n\t_set_inner:function(config){\n\t\tvar border_not_set = isUndefined(config.borderless);\n\t\tif (border_not_set && !this.setPosition && config.$topView){\n\t\t\tconfig.borderless = true;\n\t\t\tborder_not_set = false;\n\t\t}\n\n\t\tif ((border_not_set && this.defaults.borderless) || config.borderless){\n\t\t\t//button and custom borderless\n\t\t\tconfig._inner = { top:true, left:true, bottom:true, right:true };\n\t\t} else {\n\t\t\t//default borders\n\t\t\tif (!config._inner)\n\t\t\t\tconfig._inner = {};\n\t\t\tthis._contentobj.style.borderWidth=\"1px\";\n\t\t}\n\t},\n\n\t$getSize:function(dx, dy){\n\n\t\tvar _borders = this._settings._inner;\n\t\tif (_borders){\n\t\t\tdx += (_borders.left?0:1)+(_borders.right?0:1);\n\t\t\tdy += (_borders.top?0:1)+(_borders.bottom?0:1);\n\t\t}\n\t\t\n\t\tvar size = base.api.$getSize.call(this, dx, dy);\n\t\t\n\t\tif (DEBUG) debug_size_box(this, size, true);\n\t\treturn size;\n\t},\n\t$setSize:function(x,y){\n\t\tif (DEBUG) debug_size_box(this, [x,y]);\n\t\t\t\n\t\tvar _borders = this._settings._inner;\n\t\tif (_borders){\n\t\t\tx -= (_borders.left?0:1)+(_borders.right?0:1);\n\t\t\ty -= (_borders.top?0:1)+(_borders.bottom?0:1);\n\t\t}\n\t\t\t\n\t\treturn base.api.$setSize.call(this,x,y);\n\t}\n};\n\nconst view = protoUI(api, base.view);\nexport default { api, view };\n\n//not necessary anymore\n//preserving for backward compatibility\nview.call(-1);\n","import AtomRender from \"../core/atomrender\";\nimport {proto} from \"../ui/core\";\nimport template from \"../webix/template\";\n\nimport type from \"../webix/type\";\n/*\n\tREnders single item. \n\tCan be used for elements without datastore, or with complex custom rendering logic\n\t\n\t@export\n\t\trender\n*/\n\nconst SingleRender = proto({\n\ttemplate_setter:function(value){\n\t\tthis.type.template=template(value);\n\t},\n\t//convert item to the HTML text\n\t_toHTML:function(obj){\n\t\tvar type = this.type;\n\t\treturn (type.templateStart?type.templateStart(obj,type):\"\") + type.template(obj,type) + (type.templateEnd?type.templateEnd(obj,type):\"\");\n\t},\n\tcustomize:function(obj){\n\t\ttype(this,obj);\n\t}\n}, AtomRender);\n\n\nexport default SingleRender;","import base from \"../views/view\";\nimport SingleRender from \"../core/singlerender\";\nimport Settings from \"../core/settings\";\nimport EventSystem from \"../core/eventsystem\";\nimport {create, insertBefore} from \"../webix/html\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {extend, bind} from \"../webix/helpers\";\nimport {attachEvent, detachEvent} from \"../webix/customevents\";\nimport template from \"../webix/template\";\n\n\n/*\n\tUI: Tooltip\n\t\n\t@export\n\t\tshow\n\t\thide\n*/\n\n// #include core/template.js\n// #include core/single_render.js\n\nconst api = {\n\tname:\"tooltip\",\n\tdefaults:{\n\t\tdy:0,\n\t\tdx:20\n\t},\n\t$init:function(container){\n\t\tif (typeof container == \"string\"){\n\t\t\tcontainer = { template:container };\n\t\t}\n\n\t\tthis.type = extend({}, this.type);\n\n\t\t//create container for future tooltip\n\t\tthis.$view = this._viewobj = this._contentobj = this._dataobj = create(\"DIV\", {role:\"alert\", \"aria-atomic\":\"true\"});\n\t\tthis._contentobj.className = \"webix_tooltip\";\n\t\tinsertBefore(this._contentobj,document.body.firstChild,document.body);\n\t\tthis._hideHandler = attachEvent(\"onClick\", bind(function(e){\n\t\t\tif (this._visible && $$(e) != this)\n\t\t\t\tthis.hide();\n\t\t}, this));\n\t\t\n\t\t//detach global event handler on destruction\n\t\tthis.attachEvent(\"onDestruct\", function(){\n\t\t\tdetachEvent(this._hideHandler);\n\t\t});\n\t},\n\tadjust:function(){ },\n\t//show tooptip\n\t//pos - object, pos.x - left, pox.y - top\n\tisVisible:function(){\n\t\treturn true;\n\t},\n\tshow:function(data,pos){\n\t\tif (this._disabled) return;\n\t\t//render sefl only if new data was provided\n\t\tif (this.data!=data){\n\t\t\tthis.data=extend({},data);\n\t\t\tthis.render(data);\n\t\t}\n\n\t\tif (this._dataobj.firstChild){\n\t\t\t//show at specified position\n\t\t\tvar w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n\t\t\tvar h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n\t\t\tvar positionX = w - pos.x;\n\t\t\tvar positionY = h - pos.y;\n\n\t\t\tthis._contentobj.style.display=\"block\";\n\t\t\t\n\t\t\tif(positionX - this._settings.dx > this._contentobj.offsetWidth)\n\t\t\t\tpositionX = pos.x;\n\t\t\telse {\n\t\t\t\tpositionX = (pos.x - (this._settings.dx * 2)) - this._contentobj.offsetWidth;\n\t\t\t\tif(positionX <= 0) positionX = 0;\n\t\t\t}\n\n\t\t\tif(positionY - this._settings.dy > this._contentobj.offsetHeight)\n\t\t\t\tpositionY = pos.y;\n\t\t\telse \n\t\t\t\tpositionY = (pos.y - this._settings.dy) - this._contentobj.offsetHeight;\n\t\t\tthis._contentobj.style.left = positionX+this._settings.dx+\"px\";\n\t\t\tthis._contentobj.style.top = positionY+this._settings.dy+\"px\";\n\t\t}\n\t\tthis._visible = true;\n\t},\n\t//hide tooltip\n\thide:function(){\n\t\tthis.data=null; //nulify, to be sure that on next show it will be fresh-rendered\n\t\tthis._contentobj.style.display=\"none\";\n\t\tthis._visible = false;\n\t},\n\tdisable:function(){\n\t\tthis._disabled = true;\n\t},\n\tenable:function(){\n\t\tthis._disabled = false;\n\t},\n\ttype:{\n\t\ttemplate:template(\"{obj.id}\"),\n\t\ttemplateStart:template.empty,\n\t\ttemplateEnd:template.empty\n\t}\n\n};\n\n\nconst view = protoUI(api, SingleRender, Settings, EventSystem, base.view);\nexport default {api, view};","import {pos} from \"../webix/html\";\nimport {ui} from \"../ui/core\";\nimport {bind} from \"../webix/helpers\";\nimport {event, eventRemove} from \"../webix/htmlevents\";\nimport template from \"../webix/template\";\nimport DragControl from \"../core/dragcontrol\";\n\n//indirect UI import\nimport \"../views/tooltip\";\n\n/*\n\tBehavior: AutoTooltip - links tooltip to data driven item\n*/\n\nconst AutoTooltip = {\n\ttooltip_setter:function(value){\n\t\tif (value){\n\t\t\tif (typeof value == \"function\")\n\t\t\t\tvalue = { template:value };\n\t\t\tif (typeof value !== \"object\")\n\t\t\t\tvalue = {};\n\n\t\t\tvar col_mode = !value.template;\n\t\t\tvar t = new ui.tooltip(value);\n\t\t\tthis._enable_mouse_move();\n\t\t\tvar showEvent = this.attachEvent(\"onMouseMove\",function(id,e){\t//show tooltip on mousemove\n\t\t\t\tthis._mouseEventX = e.clientX;\n\t\t\t\tthis._mouseEventY = e.clientY;\n\t\t\t\tif (this.getColumnConfig){\n\t\t\t\t\tvar config = t.type.column = this.getColumnConfig(id.column);\n\t\t\t\t\tif (col_mode){\n\t\t\t\t\t\t//empty tooltip - ignoring\n\t\t\t\t\t\tif (!config.tooltip && config.tooltip != undefined)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\tvar trg = e.target || e.srcElements;\n\n\t\t\t\t\t\tif(trg.getAttribute(\"webix_area\") && config.tooltip){\n\t\t\t\t\t\t\tvar area = trg.getAttribute(\"webix_area\");\n\t\t\t\t\t\t\tt.type.template = function(obj,common){\n\t\t\t\t\t\t\t\tvar values = obj[common.column.id];\n\t\t\t\t\t\t\t\treturn template(config.tooltip).call(this,obj,common,values[area],area);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tif (config.tooltip)\n\t\t\t\t\t\t\t\tt.type.template = config.tooltip = template(config.tooltip);\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tvar text = this.getText(id.row, id.column);\n\t\t\t\t\t\t\t\tt.type.template = function(){ return text; };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!DragControl.active)\n\t\t\t\t\tt.show(this.getItem(id.row || id),pos(e));\n\t\t\t});\n\t\t\t// [[IMPROVE]] As we can can have only one instance of tooltip per page \n\t\t\t//\t\t\t\tthis handler can be attached once per page, not once per component\n\t\t\tvar hideEvent = event(document.body, \"mousemove\", bind(function(e){\n\t\t\t\te = e||event;\n\t\t\t\tif(this._mouseEventX != e.clientX || this._mouseEventY != e.clientY)\n\t\t\t\t\tt.hide();\n\t\t\t},this));\n\t\t\tthis.attachEvent(\"onDestruct\",function(){\n\t\t\t\tif(this.config.tooltip)\n\t\t\t\t\tthis.config.tooltip.destructor();\n\t\t\t});\n\t\t\tthis.attachEvent(\"onAfterScroll\", function(){\n\t\t\t\tt.hide();\n\t\t\t});\n\t\t\tt.attachEvent(\"onDestruct\",bind(function(){\n\t\t\t\tthis.detachEvent(showEvent);\n\t\t\t\teventRemove(hideEvent);\n\t\t\t},this));\n\n\t\t\treturn t;\n\t\t}\n\t}\n};\n\nexport default AutoTooltip;","import env from \"../webix/env\";\n\nimport {create, remove} from \"../webix/html\";\nimport {isUndefined, toNode} from \"../webix/helpers\";\nimport {proto} from \"../ui/core\";\nimport {assert} from \"../webix/debug\";\n\nimport require from \"../load/require\";\n\n\nconst Canvas = proto({\n\t$init:function(container){\n\t\tthis._canvas_labels = [];\n\t\tthis._canvas_series = (!isUndefined(container.series)?container.series:container.name);\n\t\tthis._obj = toNode(container.container||container);\n\t\tvar width = container.width*(window.devicePixelRatio||1);\n\t\tvar height = container.height*(window.devicePixelRatio||1);\n\t\tvar style = container.style||\"\";\n\t\tstyle += \";width:\"+container.width+\"px;height:\"+container.height+\"px;\";\n\t\tthis._prepareCanvas(container.name, style ,width, height, container.title);\n\t},\n\t_prepareCanvas:function(name,style,x,y, title){\n\t\t//canvas has the same size as master object\n\t\tthis._canvas = create(\"canvas\",{ title:title, width:x, height:y, canvas_id:name, style:(style||\"\")});\n\t\tthis._obj.appendChild(this._canvas);\n\t\t//use excanvas in IE\n\t\tif (!this._canvas.getContext){\n\t\t\tif (env.isIE){\n\t\t\t\trequire(\"legacy/excanvas/excanvas.js\", true);\t//sync loading\n\t\t\t\t/* global G_vmlCanvasManager */\n\t\t\t\tG_vmlCanvasManager.init_(document);\n\t\t\t\tG_vmlCanvasManager.initElement(this._canvas);\n\t\t\t} else\t//some other not supported browser\n\t\t\t\tassert(this._canvas.getContext,\"Canvas is not supported in the browser\");\n\t\t}\n\t\treturn this._canvas;\n\t}, \n\tgetCanvas:function(context){\n\t\tvar ctx = (this._canvas||this._prepareCanvas(this._contentobj)).getContext(context||\"2d\");\n\t\tif(!this._webixDevicePixelRatio){\n\t\t\tthis._webixDevicePixelRatio = true;\n\t\t\tctx.scale(window.devicePixelRatio||1, window.devicePixelRatio||1);\n\t\t}\n\t\treturn ctx;\n\t},\n\t_resizeCanvas:function(x, y){\n\t\tif (this._canvas){\n\t\t\tthis._canvas.setAttribute(\"width\", x*(window.devicePixelRatio||1));\n\t\t\tthis._canvas.setAttribute(\"height\", y*(window.devicePixelRatio||1));\n\t\t\tthis._canvas.style.width = x+\"px\";\n\t\t\tthis._canvas.style.height = y+\"px\";\n\t\t\tthis._webixDevicePixelRatio = false;\n\t\t}\n\t},\n\trenderText:function(x,y,text,css,w){\n\t\tif (!text) return; //ignore empty text\n\t\tif (w) w = Math.max(w,0);\n\t\tif (y) y = Math.max(y,0);\n\t\tvar t = create(\"DIV\",{\n\t\t\t\"class\":\"webix_canvas_text\"+(css?(\" \"+css):\"\"),\n\t\t\t\"style\":\"left:\"+x+\"px; top:\"+y+\"px;\",\n\t\t\t\"aria-hidden\":\"true\"\n\t\t},text);\n\t\tthis._obj.appendChild(t);\n\t\tthis._canvas_labels.push(t); //destructor?\n\t\tif (w)\n\t\t\tt.style.width = w+\"px\";\n\t\treturn t;\n\t},\n\trenderTextAt:function(valign,align, x,y,t,c,w){\n\t\tvar text=this.renderText.call(this,x,y,t,c,w);\n\t\tif (text){\n\t\t\tif (valign){\n\t\t\t\tif(valign == \"middle\")\n\t\t\t\t\ttext.style.top = parseInt(y-text.offsetHeight/2,10) + \"px\";\n\t\t\t\telse\n\t\t\t\t\ttext.style.top = y-text.offsetHeight + \"px\";\n\t\t\t}\n\t\t\tif (align){\n\t\t\t\tif(align == \"left\")\n\t\t\t\t\ttext.style.left = x-text.offsetWidth + \"px\";\n\t\t\t\telse\n\t\t\t\t\ttext.style.left = parseInt(x-text.offsetWidth/2,10) + \"px\";\n\t\t\t}\n\t\t}\n\t\treturn text;\n\t},\n\tclearCanvas:function(skipMap){\n\t\tvar areas=[];\n\n\t\tremove(this._canvas_labels);\n\t\tthis._canvas_labels = [];\n\n\t\tif (!skipMap&&this._obj._htmlmap){\n\n\t\t\t//areas that correspond this canvas layer\n\t\t\tareas = this._getMapAreas();\n\t\t\t//removes areas of this canvas\n\t\t\twhile(areas.length){\n\t\t\t\tareas[0].parentNode.removeChild(areas[0]);\n\t\t\t\tareas.splice(0,1);\n\t\t\t}\n\t\t\tareas = null;\n\n\t\t\t//removes _htmlmap object if all its child nodes are removed\n\t\t\tif(!this._obj._htmlmap.getElementsByTagName(\"AREA\").length){\n\t\t\t\tthis._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap);\n\t\t\t\tthis._obj._htmlmap = null;\n\t\t\t}\n\t\t}\n\t\t//FF breaks, when we are using clear canvas and call clearRect without parameters\n\t\t//width|height are used insead of offsetWidth|offsetHeight for hidden canvas (series)\n\t\tthis.getCanvas().clearRect(0,0,\n\t\t\tthis._canvas.offsetWidth||Math.floor(this._canvas.width/(window.devicePixelRatio||1)), \n\t\t\tthis._canvas.offsetHeight||Math.floor(this._canvas.height/(window.devicePixelRatio||1))\n\t\t);\n\t},\n\ttoggleCanvas:function(){\n\t\tthis._toggleCanvas(this._canvas.style.display==\"none\");\n\t},\n\tshowCanvas:function(){\n\t\tthis._toggleCanvas(true);\n\t},\n\thideCanvas:function(){\n\t\tthis._toggleCanvas(false);\n\t},\n\t_toggleCanvas:function(show){\n\t\tvar areas, i;\n\n\t\tfor(i=0; i < this._canvas_labels.length;i++)\n\t\t\tthis._canvas_labels[i].style.display = (show?\"\":\"none\");\n\n\t\tif (this._obj._htmlmap){\n\t\t\tareas = this._getMapAreas();\n\t\t\tfor( i = 0; i < areas.length; i++){\n\t\t\t\tif(show)\n\t\t\t\t\tareas[i].removeAttribute(\"disabled\");\n\t\t\t\telse\n\t\t\t\t\tareas[i].setAttribute(\"disabled\",\"true\");\n\t\t\t}\n\t\t}\n\t\t//FF breaks, when we are using clear canvas and call clearRect without parameters\n\t\tthis._canvas.style.display = (show?\"\":\"none\");\n\t},\n\t_getMapAreas:function(){\n\t\tvar res = [], areas, i;\n\t\tareas = this._obj._htmlmap.getElementsByTagName(\"AREA\");\n\t\tfor(i = 0; i < areas.length; i++){\n\t\t\tif(areas[i].getAttribute(\"userdata\") == this._canvas_series){\n\t\t\t\tres.push(areas[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n});\n\nexport default Canvas;","import {insertBefore, remove} from \"../webix/html\";\nimport state from \"../core/state\";\nimport env from \"../webix/env\";\nimport {isArray, clone, toNode, delay} from \"../webix/helpers\";\nimport {event, eventRemove} from \"../webix/htmlevents\";\nimport Settings from \"../core/settings\";\n\n\nconst animate = function(html_element, config){\n\tvar animation = config;\n\tif (isArray(html_element)){\n\t\tfor (var i=0; i < html_element.length; i++) {\n\t\t\tif(isArray(config))\n\t\t\t\tanimation = config[i];\n\n\t\t\tif(animation.type == \"slide\"){\n\t\t\t\tif(animation.subtype == \"out\" && i===0) { // next\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(animation.subtype == \"in\" && i==1) { // current\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(animation.type == \"flip\"){\n\t\t\t\tvar animation_copy = clone(animation);\n\t\t\t\tif(i===0) { // next\n\t\t\t\t\tanimation_copy.type = \"flipback\";\n\t\t\t\t}\n\t\t\t\tif(i==1) { // current\n\t\t\t\t\tanimation_copy.callback = null;\n\t\t\t\t}\n\t\t\t\tanimate(html_element[i], animation_copy);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tanimate(html_element[i], animation);\n\t\t}\n\t\treturn;\n\t}\n\tvar node = toNode(html_element);\n\tif (node._has_animation)\n\t\tanimate.end(node, animation);\n\telse\n\t\tanimate.start(node, animation);\n};\nanimate.end = function(node, animation){\n\t//stop animation\n\tnode.style[env.transitionDuration] = \"1ms\";\n\tnode._has_animation = null;\n\t//clear animation wait order, if any\n\tif (state._wait_animate)\n\t\twindow.clearTimeout(state._wait_animate);\n\n\t//plan next animation, if any\n\tstate._wait_animate = delay(animate, this, [node,animation],10);\n};\nanimate.isSupported=function(){\n\treturn !state.$testmode && !state.noanimate && env.transform && env.transition && !env.isOpera;\n};\nanimate.formLine=function(next, current, animation){\n\tvar direction = animation.direction;\n\n\t//sometimes user can initiate animation multiple times ( fast clicking )\n\t//as result animation may be called against already removed from the dom node\n\tif(current.parentNode)\n\t\tcurrent.parentNode.style.position = \"relative\";\n\t\n\tcurrent.style.position = \"absolute\";\n\tnext.style.position = \"absolute\";\n\n\t//this is initial shift of second view in animation\n\t//normally we need to have this value as 0\n\t//but FF has bug with animation initially invisible elements\n\t//so we are adjusting this value, to make 1px of second view visible\n\tvar defAniPos = env.isFF ? ( direction == \"top\" || direction == \"left\" ? -1 : 1) : 0;\n\n\tif(direction==\"top\"||direction==\"bottom\"){\n\t\tnext.style.left=\"0px\";\n\t\tnext.style.top = (animation.top || defAniPos) + (direction==\"top\"?1:-1)*current.offsetHeight+\"px\";\n\t}\n\telse{\n\t\tnext.style.top = (animation.top || 0) + \"px\";\n\t\tnext.style.left = defAniPos + (direction==\"left\"?1:-1)*current.offsetWidth+\"px\";\n\t}\n\n\t// apply 'keepViews' mode, iframe, datatable with x scroll solution\n\t//( keepViews won't work in case of \"in\" and \"out\" subtypes )\n\tif(current.parentNode == next.parentNode && animation.keepViews)\n\t\tnext.style.display = \"\";\n\telse\n\t\tinsertBefore(next, current.nextSibling, current.parentNode);\n\n\tif(animation.type == \"slide\" && animation.subtype == \"out\") {\n\t\tnext.style.left = \"0px\";\n\t\tnext.style.top = (animation.top || 0)+\"px\";\n\t\tcurrent.parentNode.removeChild(current);\n\t\tinsertBefore(current, next.nextSibling, next.parentNode);\n\t}\n\treturn [next, current];\n};\nanimate.breakLine=function(line){\n\tif(arguments[1])\n\t\tline[1].style.display = \"none\"; // 'keepViews' multiview mode\n\telse\n\t\tremove(line[1]); // 1 = current\n\tanimate.clear(line[0]);\n\tanimate.clear(line[1]);\n\tline[0].style.position=\"\";\n};\nanimate.clear=function(node){\n\tnode.style[env.transform] = \"none\";\n\tnode.style[env.transition] = \"none\";\n\tnode.style.top = node.style.left = \"\";\n};\nanimate.defaults = {\n\ttype: \"slide\",\n\tdelay: \"0\",\n\tduration: \"500\",\n\ttiming: \"ease-in-out\",\n\tx: 0,\n\ty: 0\n};\nanimate.start = function(node, animation){\n\t//getting config object by merging specified and default options\n\tif (typeof animation == \"string\")\n\t\tanimation = {type: animation};\n\n\tanimation = Settings._mergeSettings(animation,animate.defaults);\n\n\tvar prefix = env.cssPrefix;\n\tvar settings = node._has_animation = animation;\n\tvar skew_options, scale_type;\n\n\t//jshint -W086:true\n\tswitch(settings.type == \"slide\" && settings.direction) { // getting new x, y in case it is slide with direction\n\t\tcase \"right\":\n\t\t\tsettings.x = node.offsetWidth;\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tsettings.x = -node.offsetWidth;\n\t\t\tbreak;\n\t\tcase \"top\":\n\t\t\tsettings.y = -node.offsetHeight;\n\t\t\tbreak;\n\t\tcase \"bottom\":\n\t\tdefault:\n\t\t\tsettings.y = settings.y||node.offsetHeight;\n\t\t\tbreak;\n\t}\n\n\tif(settings.type == \"flip\" || settings.type == \"flipback\") {\n\t\tskew_options = [0, 0];\n\t\tscale_type = \"scaleX\";\n\t\tif(settings.subtype == \"vertical\") {\n\t\t\tskew_options[0] = 20;\n\t\t\tscale_type = \"scaleY\";\n\t\t}\n\t\telse\n\t\t\tskew_options[1] = 20;\n\t\tif(settings.direction == \"right\" || settings.direction == \"bottom\") {\n\t\t\tskew_options[0] *= -1; skew_options[1] *= -1;\n\t\t}\n\t}\n\n\tvar duration = settings.duration + \"ms \" + settings.timing + \" \" + settings.delay+\"ms\";\n\tvar css_general = prefix+\"TransformStyle: preserve-3d;\"; // general css rules\n\tvar css_transition = \"\";\n\tvar css_transform = \"\";\n\n\tswitch(settings.type) {\n\t\tcase \"fade\": // changes opacity to 0\n\t\t\tcss_transition = \"opacity \" + duration;\n\t\t\tcss_general = \"opacity: 0;\";\n\t\t\tbreak;\n\t\tcase \"show\": // changes opacity to 1\n\t\t\tcss_transition = \"opacity \" + duration;\n\t\t\tcss_general = \"opacity: 1;\";\n\t\t\tbreak;\n\t\tcase \"flip\":\n\t\t\tduration = (settings.duration/2) + \"ms \" + settings.timing + \" \" + settings.delay+\"ms\";\n\t\t\tcss_transform = \"skew(\"+skew_options[0]+\"deg, \"+skew_options[1]+\"deg) \"+scale_type+\"(0.00001)\";\n\t\t\tcss_transition = \"all \"+(duration);\n\t\t\tbreak;\n\t\tcase \"flipback\":\n\t\t\tsettings.delay += settings.duration/2;\n\t\t\tduration = (settings.duration/2) + \"ms \" + settings.timing + \" \" + settings.delay+\"ms\";\n\t\t\tnode.style[env.transform] = \"skew(\"+(-1*skew_options[0])+\"deg, \"+(-1*skew_options[1])+\"deg) \"+scale_type+\"(0.00001)\";\n\t\t\tnode.style.left = \"0\";\n\n\t\t\tcss_transform = \"skew(0deg, 0deg) \"+scale_type+\"(1)\";\n\t\t\tcss_transition = \"all \"+(duration);\n\t\t\tbreak;\n\t\tcase \"slide\": // moves object to specified location\n\t\t\tvar x = settings.x +\"px\";\n\t\t\tvar y = settings.y +\"px\";\n\t\t\t// translate(x, y) OR translate3d(x, y, 0)\n\t\t\tcss_transform = env.translate+\"(\"+x+\", \"+y+((env.translate==\"translate3d\")?\", 0\":\"\")+\")\";\n\t\t\tcss_transition = prefix+\"transform \" + duration;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t//set styles only after applying transition settings\n\tdelay(function(){\n\t\tnode.style[env.transition] = css_transition;\n\t\tdelay(function(){\n\t\t\tif (css_general)\n\t\t\t\tnode.style.cssText += css_general;\n\t\t\tif (css_transform)\n\t\t\t\tnode.style[env.transform] = css_transform;\n\t\t\tvar transitionEnded = false;\n\t\t\tvar tid = event(node, env.transitionEnd, function(ev){\n\t\t\t\tnode._has_animation = null;\n\t\t\t\tif (settings.callback) settings.callback.call((settings.master||window), node,settings,ev);\n\t\t\t\ttransitionEnded = true;\n\t\t\t\teventRemove(tid);\n\t\t\t});\n\t\t\twindow.setTimeout(function(){\n\t\t\t\tif(!transitionEnded){\n\t\t\t\t\tnode._has_animation = null;\n\t\t\t\t\tif (settings.callback) settings.callback.call((settings.master||window), node,settings);\n\t\t\t\t\ttransitionEnded = true;\n\t\t\t\t\teventRemove(tid);\n\t\t\t\t}\n\t\t\t}, (settings.duration*1+settings.delay*1)*1.3);\n\t\t});\n\t});\n};\n\nexport default animate;","const skin = {\n\ttopLayout:\"space\",\n\t//bar in accordion\n\tbarHeight:44,\t\t\t//!!!Set the same in skin.less!!!\n\ttabbarHeight: 42,\n\tsidebarTitleHeight: 44,\n\trowHeight:36,\n\ttoolbarHeight:44,\n\tlistItemHeight:36,\t\t//list, grouplist, dataview, etc.\n\tinputHeight: 38,\n\tbuttonHeight: 38,\n\tinputPadding: 3,\n\tmenuHeight: 36,\n\tlabelTopHeight: 22,\n\tpropertyItemHeight: 28,\n\tunitHeaderHeight:36,\n\n\tinputSpacing: 4,\n\tborderWidth: 1,\n\n\tsliderHandleWidth: 14,\n\tsliderPadding: 10,\n\tsliderBorder: 1,\n\tvSliderPadding:15,\n\tvSliderHeight:100,\n\tswitchHeight:22,\n\tswitchWidth:50,\n\n\t//margin - distance between cells\n\tlayoutMargin:{ space:10, wide:10, clean:0, head:4, line:-1, toolbar:4, form:8, accordion: 2 },\n\t//padding - distance inside cell between cell border and cell content\n\tlayoutPadding:{ space:10, wide:0, clean:0, head:0, line:0, toolbar:2, form:17, accordion: 0 },\n\t//space between tabs in tabbar\n\ttabMargin: 0,\n\ttabOffset: 0,\n\ttabBottomOffset: 0,\n\ttabTopOffset:0,\n\ttabBorder: true,\n\n\tcustomCheckbox: true,\n\tcustomRadio: true,\n\tsidebarMarkAll: true,\n\tpopupNoPoint: true,\n\tborderlessPopup: true,\n\n\tpopupPadding: 0,\n\n\tcalendar:{ timepickerHeight:24 },\n\tcalendarHeight: 70,\n\tpadding:0,\n\taccordionType: \"accordion\",\n\n\toptionHeight: 32,\n\torganogramLineColor: \"#CCD7E6\"\n};\n\nexport default skin;\n","import {assert} from \"../webix/debug\";\nimport {ui} from \"../ui/core\";\n\nimport material from \"../css/skins/material/config\";\nimport mini from \"../css/skins/mini/config\";\nimport flat from \"../css/skins/flat/config\";\nimport compact from \"../css/skins/compact/config\";\nimport contrast from \"../css/skins/contrast/config\";\n\nconst skin = { material, mini, flat, compact, contrast };\n\nexport var $active, $name;\n\nexport function set(name){\n\tassert(skin[name], \"Incorrect skin name: \"+name);\n\tif ($name === name) return;\n\n\t$active = skin[name];\n\t$name = name;\n\n\tif (ui){\n\t\tfor (var key in ui){\n\t\t\tvar view = ui[key];\n\t\t\tif (view && view.prototype && view.prototype.$skin)\n\t\t\t\tview.prototype.$skin(view.prototype);\n\t\t}\n\t}\t\t\n}\n\nset(window.webix_skin || \"material\");\n\n//necessary for skin builder\nexport { material, mini, flat, compact, contrast };","const skin = {\n\ttopLayout:\"space\",\n\t//bar in accordion\n\tbarHeight:36,\t\t\t//!!!Set the same in skin.less!!!\n\ttabbarHeight: 34,\n\tsidebarTitleHeight: 36,\n\trowHeight:28,\n\ttoolbarHeight:36,\n\tlistItemHeight:28,\t//list, grouplist, dataview, etc.\n\tinputHeight: 30,\n\tbuttonHeight: 30,\n\tinputPadding: 3,\n\tmenuHeight: 28,\n\tlabelTopHeight: 16,\n\tpropertyItemHeight: 24,\n\tunitHeaderHeight:28,\n\n\tinputSpacing: 4,\n\tborderWidth: 1,\n\n\tsliderHandleWidth: 12,\n\tsliderPadding: 10,\n\tsliderBorder: 1,\n\tvSliderPadding:13,\n\tvSliderHeight:100,\n\tswitchHeight:20,\n\tswitchWidth:40,\n\n\t//margin - distance between cells\n\tlayoutMargin:{ space:5, wide:5, clean:0, head:4, line:-1, toolbar:4, form:8, accordion: 2 },\n\t//padding - distance inside cell between cell border and cell content\n\tlayoutPadding:{ space:5, wide:0, clean:0, head:0, line:0, toolbar:2, form:12, accordion: 0 },\n\t//space between tabs in tabbar\n\ttabMargin: 0,\n\ttabOffset: 0,\n\ttabBottomOffset: 0,\n\ttabTopOffset:0,\n\ttabBorder: true,\n\n\tcustomCheckbox: true,\n\tcustomRadio: true,\n\tsidebarMarkAll: true,\n\tpopupNoPoint: true,\n\tborderlessPopup: true,\n\n\tpopupPadding: 0,\n\n\tcalendar:{ timepickerHeight:24 },\n\tcalendarHeight: 70,\n\tpadding:0,\n\taccordionType: \"accordion\",\n\n\toptionHeight: 24,\n\torganogramLineColor: \"#CCD7E6\"\n};\n\nexport default skin;\n","const skin = {\n\ttopLayout:\"space\",\n\t//bar in accordion\n\tbarHeight:46,\t\t\t//!!!Set the same in skin.less!!!\n\ttabbarHeight: 46,\n\trowHeight:34,\n\ttoolbarHeight:46,\n\tsidebarTitleHeight:45,\n\tlistItemHeight:34,\t\t//list, grouplist, dataview, etc.\n\tinputHeight: 38,\n\tbuttonHeight: 38,\n\tinputPadding: 3,\n\tmenuHeight: 34,\n\tlabelTopHeight: 22,\n\tunitHeaderHeight:20,\n\tpropertyItemHeight: 28,\n\n\tinputSpacing: 4,\n\tborderWidth: 1,\n\n\tsliderHandleWidth: 14,\n\tsliderPadding: 10,\n\tsliderBorder: 1,\n\tvSliderPadding:15,\n\tvSliderHeight:100,\n\tswitchHeight:22,\n\tswitchWidth:50,\n\n\t//margin - distance between cells\n\tlayoutMargin:{ space:10, wide:10, clean:0, head:4, line:-1, toolbar:4, form:8, accordion: 10 },\n\t//padding - distance insede cell between cell border and cell content\n\tlayoutPadding:{ space:10, wide:0, clean:0, head:0, line:0, toolbar:4, form:17, accordion: 0 },\n\t//space between tabs in tabbar\n\ttabMargin:4,\n\ttabOffset: 0,\n\ttabBottomOffset: 6,\n\ttabTopOffset:1,\n\n\tcustomCheckbox: true,\n\tcustomRadio: true,\n\n\tpopupPadding: 8,\n\n\tcalendarHeight: 70,\n\tpadding:0,\n\taccordionType: \"accordion\",\n\n\toptionHeight: 32\n};\n\nexport default skin;","const skin = {\n\ttopLayout:\"space\",\n\t//bar in accordion\n\tbarHeight:34,\t\t\t//!!!Set the same in skin.less!!!\n\ttabbarHeight: 34,\n\tsidebarTitleHeight: 34,\n\trowHeight:24,\n\ttoolbarHeight:34,\n\tlistItemHeight:28,\t\t//list, grouplist, dataview, etc.\n\tunitHeaderHeight:20,\n\tpropertyItemHeight:24,\n\tinputHeight: 30,\n\tbuttonHeight: 30,\n\tinputPadding: 3,\n\tmenuHeight: 28,\n\tlabelTopHeight: 16,\n\n\tinputSpacing: 4,\n\tborderWidth: 1,\n\n\tsliderHandleWidth: 12,\n\tsliderPadding: 10,\n\tsliderBorder: 1,\n\tvSliderPadding:13,\n\tvSliderHeight:100,\n\tswitchHeight:20,\n\tswitchWidth:40,\n\n\t//margin - distance between cells\n\tlayoutMargin:{ space:5, wide:5, clean:0, head:4, line:-1, toolbar:4, form:4, accordion: 5 },\n\t//padding - distance inside cell between cell border and cell content\n\tlayoutPadding:{ space:5, wide:0, clean:0, head:0, line:0, toolbar:2, form:12, accordion: 0 },\n\t//space between tabs in tabbar\n\ttabMargin:3,\n\ttabOffset: 0,\n\ttabBottomOffset: 3,\n\ttabTopOffset:1,\n\n\tcustomCheckbox: true,\n\tcustomRadio: true,\n\n\tpopupPadding: 8,\n\n\tcalendarHeight: 70,\n\tpadding:0,\n\taccordionType: \"accordion\",\n\n\toptionHeight: 23\n};\n\nexport default skin;","const skin = {\n\ttopLayout:\"space\",\n\t//bar in accordion\n\tbarHeight:46,\t\t\t// !!!Set the same in skin.less!!!\n\ttabbarHeight: 46,\n\trowHeight:34,\n\ttoolbarHeight:46,\n\tsidebarTitleHeight:45,\n\tlistItemHeight:34,\t\t// list, grouplist, dataview, etc.\n\tunitHeaderHeight:20,\n\tinputHeight: 38,\n\tbuttonHeight: 38,\n\tinputPadding: 3,\n\tmenuHeight: 34,\n\tlabelTopHeight: 22,\n\tpropertyItemHeight: 28,\n\n\tinputSpacing: 4,\n\tborderWidth: 1,\n\n\tsliderHandleWidth: 14,\n\tsliderPadding: 10,\n\tsliderBorder: 1,\n\tvSliderPadding:15,\n\tvSliderHeight:100,\n\tswitchHeight:22,\n\tswitchWidth:50,\n\n\t//margin - distance between cells\n\tlayoutMargin:{ space:10, wide:10, clean:0, head:4, line:-1, toolbar:8, form:8, accordion: 10 },\n\t//padding - distance inside cell between cell border and cell content\n\tlayoutPadding:{ space:10, wide:0, clean:0, head:0, line:0, toolbar:4, form:17, accordion: 0 },\n\t//space between tabs in tabbar\n\ttabMargin:4,\n\ttabOffset: 0,\n\ttabBottomOffset: 6,\n\ttabTopOffset:1,\n\n\tcustomCheckbox: true,\n\tcustomRadio: true,\n\n\tpopupPadding: 8,\n\n\tcalendarHeight: 70,\n\tpadding:0,\n\taccordionType: \"accordion\",\n\n\toptionHeight: 32\n};\n\nexport default skin;","import {offset, pos as getPos} from \"../webix/html\";\nimport {toNode, clone} from \"../webix/helpers\";\nimport DragControl from \"../core/dragcontrol\";\n\nconst Movable = {\n\tmove_setter: function (value) {\n\t\tif (value){\n\t\t\tthis._move_admin = clone(this._move_admin);\n\t\t\tthis._move_admin.master = this;\n\t\t\tDragControl.addDrag(this._headobj?this._headobj:this.$view, this._move_admin);\n\t\t}\n\t\treturn value;\n\t},\n\t_move_admin: {\n\t\t$dragCreate:function(object, e){\n\t\t\tif(this.master.config.move){\n\t\t\t\tvar elOffset = offset(object);\n\t\t\t\tvar elPos = getPos(e);\n\t\t\t\tDragControl.top = elOffset.y - elPos.y;\n\t\t\t\tDragControl.left = elOffset.x - elPos.x;\n\n\t\t\t\treturn toNode(this.master._viewobj);\n\t\t\t}\n\t\t},\n\t\t$dragDestroy:function(node, drag){\n\t\t\tvar view = this.master;\n\t\t\tif (view._settings){\n\t\t\t\tview._settings.top = parseInt(drag.style.top,10);\n\t\t\t\tview._settings.left = parseInt(drag.style.left,10);\n\t\t\t}\n\n\t\t\tDragControl.top = DragControl.left = 5;\n\t\t\tthis.master.callEvent(\"onViewMoveEnd\", []);\n\t\t\treturn;\n\t\t},\n\t\t$dragPos:function(pos, e){\n\t\t\tthis.master.callEvent(\"onViewMove\", [pos, e]);\n\t\t}\n\t}\n};\n\nexport default Movable;","import {create, remove} from \"../webix/html\";\nimport {zIndex} from \"../ui/helpers\";\nimport {bind} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\n\nimport state from \"./state\";\n\nconst Modality = {\n\t_modal_set:function(value){\n\t\tif (value){\n\t\t\tif (!this._modal_cover){\n\t\t\t\tthis._modal_cover = create(\"div\",{\n\t\t\t\t\t\"class\":\"webix_modal\"\n\t\t\t\t});\n\t\t\t\t/*\twith below code we will have the same zIndex for modal layer as for the previous \n\t\t\t\t\tabs positioned element, but because of attaching order modal layer will be on top anyway\n\t\t\t\t*/\n\t\t\t\tvar index = this._settings.zIndex||zIndex();\n\n\t\t\t\t//set topmost modal layer\n\t\t\t\tthis._previous_modality = state._modality;\n\t\t\t\tstate._modality = index;\n\n\n\t\t\t\tthis._modal_cover.style.zIndex = index-1;\n\t\t\t\tthis._viewobj.style.zIndex = index;\n\t\t\t\tdocument.body.appendChild(this._modal_cover);\n\t\t\t\tdocument.body.style.overflow = \"hidden\";\n\t\t\t\t_event( this._modal_cover, \"click\", bind(this._ignore_clicks, this));\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif (this._modal_cover){\n\t\t\t\tremove(this._modal_cover);\n\t\t\t\tdocument.body.style.overflow = \"\";\n\n\t\t\t\t//restore topmost modal layer\n\t\t\t\t//set delay, as current window closing may have not finished click event\n\t\t\t\t//need to wait while it is not fully processed\n\t\t\t\tvar topmost = this._previous_modality;\n\t\t\t\tsetTimeout(function(){ state._modality = topmost; }, 1);\n\n\t\t\t\tthis._modal_cover = null;\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n};\n\n\nexport default Modality;","import {create, offset, addCss, pos as getPos, remove, removeCss} from \"../webix/html\";\nimport env from \"../webix/env\";\nimport {zIndex} from \"../ui/helpers\";\nimport {_event, event, eventRemove} from \"../webix/htmlevents\";\n\n\nconst ResizeArea = {\n\tresize_setter:function(value){\n\t\tif (value && !this._resizeHandlers)\n\t\t\tthis._renderResizeHandler();\n\n\t\treturn value;\n\t},\n\t_renderResizeHandler: function(){\n\t\tif(!this._rwHandle){\n\t\t\tvar rp = this._viewobj;\n\t\t\tif (rp.firstChild){\n\t\t\t\trp = rp.firstChild;\n\t\t\t\trp.style.position = \"relative\";\n\t\t\t}\n\n\t\t\tthis._rwHandle = create(\"DIV\",{\n\t\t\t\t\"class\"\t: \"webix_resize_handle\",\n\t\t\t\t\"webix_disable_drag\" : \"true\"\n\t\t\t});\n\t\t\trp.appendChild(this._rwHandle);\n\t\t\t_event(this._rwHandle, env.mouse.down, this._wrDown, {bind:this});\n\t\t}\n\t},\n\t_showResizeFrame: function(width,height){\n\t\tif(!this._resizeFrame){\n\t\t\tthis._resizeFrame = create(\"div\", {\"class\":\"webix_resize_frame\"},\"\");\n\t\t\tdocument.body.appendChild(this._resizeFrame);\n\t\t\tvar elPos = offset(this._viewobj);\n\t\t\tthis._resizeFrame.style.left = elPos.x+\"px\";\n\t\t\tthis._resizeFrame.style.top = elPos.y+\"px\";\n\t\t\tthis._resizeFrame.style.zIndex = zIndex();\n\t\t}\n\n\t\tthis._resizeFrame.style.width = width + \"px\";\n\t\tthis._resizeFrame.style.height = height + \"px\";\n\t},\n\t_wrDown:function(){\n\t\tif (this.config.resize){\n\t\t\taddCss(document.body,\"webix_noselect webix_resize_cursor\");\n\t\t\tthis._wsReady = offset(this._viewobj);\n\n\t\t\tthis._resizeHandlersMove = event(document.body, env.mouse.move, this._wrMove, {bind:this});\n\t\t\tthis._resizeHandlersUp = event(document.body, env.mouse.up, this._wrUp, {bind:this});\n\t\t}\n\t},\n\t_wrMove:function(e){\n\t\tif (this._wsReady !== false){\n\t\t\tvar elPos = getPos(e);\n\t\t\tvar progress = {x:elPos.x - this._wsReady.x+10, y: elPos.y - this._wsReady.y+10};\n\n\t\t\tif (this.$resizeMove)\n\t\t\t\tthis.$resizeMove(progress);\n\t\t\telse {\n\t\t\t\tif (Math.abs(this._wsReady.x - elPos.x) < (this.config.minWidth||100) || Math.abs(this._wsReady.y - elPos.y) < (this.config.minHeight||100))\n\t\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._wsProgress = progress;\n\t\t\tthis._showResizeFrame(progress.x,progress.y);\n\t\t}\n\t},\n\t_wrUp:function(){\n\t\t// remove resize frame and css styles\n\t\tif (this._resizeFrame)\n\t\t\tthis._resizeFrame = remove(this._resizeFrame);\n\t\t\n\t\tremoveCss(document.body,\"webix_resize_cursor\");\n\t\tremoveCss(document.body,\"webix_noselect\");\n\t\teventRemove(this._resizeHandlersMove);\n\t\teventRemove(this._resizeHandlersUp);\n\n\t\t// set Window sizes\n\t\tif (this._wsProgress){\n\t\t\tif (this.$resizeEnd)\n\t\t\t\tthis.$resizeEnd(this._wsProgress);\n\t\t\telse {\n\t\t\t\tthis.config.width = this._wsProgress.x;\n\t\t\t\tthis.config.height = this._wsProgress.y;\n\t\t\t\tthis.resize();\n\t\t\t}\n\t\t}\n\n\t\tthis._wsReady = this._wsProgress = false;\n\t\tthis.callEvent(\"onViewResize\",[]);\n\t}\n};\n\nexport default ResizeArea;","import {pos as getPos, offset, remove} from \"../webix/html\";\nimport {protoUI, ui, $$} from \"../ui/core\";\nimport animate from \"../webix/animate\";\nimport {$active} from \"../webix/skin\";\n\nimport state from \"../core/state\";\nimport env from \"../webix/env\";\nimport UIManager from \"../core/uimanager\";\nimport Destruction from \"../core/destruction\";\n\nimport {zIndex} from \"../ui/helpers\";\nimport {bind, toNode, delay, clone, uid, toArray} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\n\nimport EventSystem from \"../core/eventsystem\";\nimport Movable from \"../core/movable\";\nimport Modality from \"../core/modality\";\nimport ResizeArea from \"../core/resizearea\";\n\nimport baseview from \"./baseview\";\nimport base from \"./view\";\n\nstate._popups = toArray();\n\nconst api = {\n\tname:\"window\",\n\n\t$init:function(config){\n\t\tthis._viewobj.innerHTML = \"
\";\n\t\t\n\t\tthis._contentobj = this._viewobj.firstChild;\n\t\tthis._headobj = this._contentobj.childNodes[0];\n\t\tthis._dataobj = this._bodyobj = this._contentobj.childNodes[1];\n\t\tthis._viewobj.className +=\" webix_window\";\n\n\t\tthis._viewobj.setAttribute(\"role\", \"dialog\");\n\t\tthis._viewobj.setAttribute(\"tabindex\", \"0\");\n\t\t\n\t\tthis._head_cell = this._body_cell = null;\n\t\tthis._settings._inner = {top:false, left:false, right:false, bottom:false }; //set border flags\n\t\tif (!config.id) config.id = uid();\n\n\t\t_event(this._contentobj, \"click\", bind(this._ignore_clicks, this));\n\n\t\t// IE8 does not allow to define event capturing\n\t\tif(this._contentobj.addEventListener)\n\t\t\t_event(this._contentobj, \"click\", function(){\n\t\t\t\t// brings a window to the front of other windows\n\t\t\t\tif(!this._settings.zIndex && this._settings.toFront){\n\t\t\t\t\tthis._viewobj.style.zIndex = zIndex();\n\t\t\t\t}\n\t\t\t}, {bind:this, capture: true});\n\n\t\t// hidden_setter handling\n\t\tif(config.modal)\n\t\t\tthis._modal = true;\n\n\t\tthis.attachEvent(\"onViewMoveEnd\", function(){\n\t\t\tif(this._settings.position)\n\t\t\t\tdelete this._settings.position;\n\t\t});\n\t},\n\t_ignore_clicks:function(e){\n\t\tvar popups = state._popups;\n\t\tvar index = popups.find(this);\n\t\tif (index == -1)\n\t\t\tindex = popups.length - 1;\n\n\t\te.click_view = index;\n\t\tif (env.isIE8)\n\t\t\te.srcElement.click_view = index;\n\t},\n\tgetChildViews:function(){\n\t\tif (this._head_cell)\n\t\t\treturn [this._head_cell, this._body_cell];\n\t\telse\n\t\t\treturn [this._body_cell];\n\t},\n\tzIndex_setter:function(value){\n\t\tthis._viewobj.style.zIndex = value;\n\t\treturn value;\n\t},\n\t_remove:function(){ \n\t\tthis._body_cell = { destructor:function(){} };\t\n\t},\n\t_replace:function(new_view){\n\t\tthis._body_cell.destructor();\n\t\tthis._body_cell = new_view;\n\t\t\n\t\tthis._bodyobj.appendChild(this._body_cell._viewobj);\n\n\t\tvar cell = this._body_cell._viewobj.style;\n\t\tcell.borderTopWidth = cell.borderBottomWidth = cell.borderLeftWidth = cell.borderRightWidth = \"1px\";\n\t\tthis._body_cell._settings._inner = clone(this._settings._inner);\n\n\t\tthis.resize(true);\n\t},\n\tshow:function(node, mode, point){\n\t\tif (node === true){\n\t\t\t//recursive call from some child item\n\t\t\tif (!this._settings.hidden)\n\t\t\t\treturn;\n\t\t\tnode = null;\n\t\t}\n\n\t\tif(!this.callEvent(\"onBeforeShow\",arguments))\n\t\t\treturn false;\n\n\t\tthis._settings.hidden = false;\n\t\tthis._viewobj.style.zIndex = (this._settings.zIndex||zIndex());\n\t\tif (this._settings.modal || this._modal){\n\t\t\tthis._modal_set(true);\n\t\t\tthis._modal = null; // hidden_setter handling\n\t\t}\n\n\t\tvar elPos, dx, dy;\n\t\tmode = mode || {};\n\t\tif (!mode.pos)\n\t\t\tmode.pos = this._settings.relative;\n\n\t\t//get position of source html node\n\t\t//we need to show popup which pointing to that node\n\t\tif (node){\n\t\t\t//if event was provided - get node info from it\n\t\t\tif (typeof node == \"object\" && !node.tagName){\n\t\t\t\t/*below logic is far from ideal*/\n\t\t\t\tif (node.target || node.srcElement){\n\t\t\t\t\telPos = getPos(node);\n\t\t\t\t\tdx = 20;\n\t\t\t\t\tdy = 5;\n\t\t\t\t} else\n\t\t\t\t\telPos = node;\n\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tnode = toNode(node);\n\t\t\t\tassert(node,\"Not existing target for window:show\");\n\t\t\t\telPos = offset(node);\n\t\t\t}\t\n\n\t\t\t//size of body, we need to fit popup inside\n\t\t\tvar x = Math.max(window.innerWidth || 0, document.body.offsetWidth);\n\t\t\tvar y = Math.max(window.innerHeight || 0, document.body.offsetHeight);\n\n\t\t\t//size of node, near which popup will be rendered\n\t\t\tdx = dx || node.offsetWidth || 0;\n\t\t\tdy = dy || node.offsetHeight || 0;\n\t\t\t//size of popup element\n\t\t\tvar size = this._last_size;\n\n\t\t\tvar fin_x = elPos.x;\n\t\t\tvar fin_y = elPos.y;\n\t\t\tvar point_y=0;\n\t\t\tvar point_x = 0;\n\t\t\tvar scrollLeft = 0, scrollTop = 0;\n\t\t\tvar fit = this._settings.autofit;\n\t\t\tif (fit){\n\t\t\t\tvar nochange = (fit === \"node\");\n\t\t\t\tvar delta_x = 6; var delta_y=6; var delta_point = 6;\n\t\t\t\tif (!this._settings.point)\n\t\t\t\t\tdelta_x = delta_y = delta_point = 0;\n\n\t\t\t\t//default pointer position - top \n\t\t\t\tpoint = \"top\";\n\t\t\t\tfin_y=0; fin_x = 0;\n\n\t\t\t\tscrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;\n\t\t\t\t//if we want to place menu at righ, but there is no place move it to left instead\n\t\t\t\tif (x - elPos.x - dx < size[0] && mode.pos == \"right\" && !nochange)\n\t\t\t\t\tmode.pos = \"left\";\n\n\t\t\t\tif (mode.pos == \"right\"){\n\t\t\t\t\tfin_x = elPos.x+delta_x+dx; \n\t\t\t\t\tdelta_y = -dy;\n\t\t\t\t\tpoint = \"left\";\n\t\t\t\t\tpoint_y = Math.round(elPos.y+dy/2);\n\t\t\t\t\tpoint_x = fin_x - delta_point;\n\t\t\t\t} else if (mode.pos == \"left\"){\n\t\t\t\t\tfin_x = elPos.x-delta_x-size[0]-1;\n\t\t\t\t\tdelta_y = -dy;\n\t\t\t\t\tpoint = \"right\";\n\t\t\t\t\tpoint_y = Math.round(elPos.y+dy/2);\n\t\t\t\t\tpoint_x = fin_x + size[0]+1;\n\t\t\t\t} else {\n\t\t\t\t\t//left border of screen\n\t\t\t\t\tif (elPos.x < scrollLeft){\n\t\t\t\t\t\tfin_x = scrollLeft;\n\t\t\t\t\t//popup exceed the right border of screen\n\t\t\t\t\t} else if (x+scrollLeft-elPos.x > size[0]){\n\t\t\t\t\t\tfin_x = elPos.x; //aligned\n\t\t\t\t\t} else{\n\t\t\t\t\t\tfin_x = x+scrollLeft-delta_x-size[0]; //not aligned\n\t\t\t\t\t}\n\n\t\t\t\t\tpoint_x = Math.round(elPos.x+dx/2);\n\t\t\t\t\t//when we have a small popup, point need to be rendered at center of popup\n\t\t\t\t\tpoint_x = Math.min(point_x, fin_x + size[0] - delta_point*3);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//if height is not fixed - use default position\n\t\t\t\tscrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;\n\t\t\t\tif (((!size[1] || (y+scrollTop-dy-elPos.y-delta_y > size[1])) || nochange) && mode.pos != \"top\"){\n\t\t\t\t\t//bottom\t\n\t\t\t\t\tfin_y = dy+elPos.y+delta_y - (!this._settings.point ? 0: 4);\n\t\t\t\t\tif (!point_y){\n\t\t\t\t\t\tpoint = \"top\";\n\t\t\t\t\t\tpoint_y = fin_y-delta_point;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//top\n\t\t\t\t\tfin_y = elPos.y-delta_y - size[1];\n\t\t\t\t\tif (fin_y < 0){\n\t\t\t\t\t\tfin_y = 0; \n\t\t\t\t\t\t//left|right point can be used, but there is no place for top point\n\t\t\t\t\t\tif (point == \"top\") point = false;\n\t\t\t\t\t} else if (!point_y){\n\t\t\t\t\t\tpoint = \"bottom\";\n\t\t\t\t\t\tfin_y --;\n\t\t\t\t\t\tpoint_y = fin_y+size[1]+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar deltax = (mode.x || 0);\n\t\t\tvar deltay = (mode.y || 0);\n\n\t\t\tvar fixed = this._checkFixedPosition();\n\t\t\tif (fixed){\n\t\t\t\tfin_y = fin_y - scrollTop;\n\t\t\t\tpoint_y = point_y - scrollTop;\n\t\t\t}\n\n\t\t\tthis.setPosition(fin_x+deltax, fin_y+deltay);\n\t\t\tif (this._set_point){\n\t\t\t\tif (point && this._settings.point)\n\t\t\t\t\tthis._set_point(point,point_x+deltax, point_y+deltay, fixed);\n\t\t\t\telse\n\t\t\t\t\tthis._hide_point();\n\t\t\t}\n\t\t} else\n\t\t\tthis._setPosition(this._settings.left, this._settings.top);\n\n\t\tthis._viewobj.style.display = \"block\";\n\t\tthis._hide_timer = 1;\n\t\tdelay(function(){ this._hide_timer = 0; }, this, [], (env.touch ? 400 : 100 ));\n\t\t\n\t\tthis._render_hidden_views();\n\t\t\n\t\t\n\t\tif (this.config.autofocus){\n\t\t\tthis._prev_focus = UIManager.getFocus();\n\t\t\tUIManager.setFocus(this);\n\t\t}\n\n\t\tif (-1 == state._popups.find(this))\n\t\t\tstate._popups.push(this);\n\n\t\tthis.callEvent(\"onShow\",[]);\n\t}, \n\t_hide:function(e){\n\t\t//do not hide modal windows\n\t\tif (this._settings.hidden || this._settings.modal || this._hide_timer || (e && e.showpopup)) return;\n\t\t//do not hide popup, when we have modal layer above the popup\n\t\tif (state._modality && this._settings.zIndex <= state._modality) return;\n\n\t\t//ignore inside clicks and clicks in child-popups\n\n\t\tif (e){\n\t\t\tvar index = env.isIE8 ? e.srcElement.click_view : e.click_view;\n\t\t\tif (!index && index !== 0) index = -1;\n\n\t\t\tvar myindex = state._popups.find(this);\n\n\t\t\tif (myindex <= index) return;\n\t\t}\n\n\t\tthis.hide();\n\t},\n\thidden_setter:function(value){\n\t\tif(value) \n\t\t\tthis.hide();\n\t\telse\n\t\t\tthis.show();\n\t\treturn !!value;\n\t},\n\thide:function(force){\n\t\tif (this.$destructed) return;\n\n\t\tif (!force)\n\t\t\tif(this._settings.hidden) return;\n\n\t\tif (this._settings.modal)\n\t\t\tthis._modal_set(false);\n\t\t\t\n\t\tif (this._settings.position == \"top\"){\n\t\t\tanimate(this._viewobj, {type: \"slide\", x:0, y:-(this._content_height+20), duration: 300,\n\t\t\t\tcallback:this._hide_callback, master:this});\n\t\t}\n\t\telse \n\t\t\tthis._hide_callback();\n\n\t\tif (this._settings.autofocus){\n\t\t\tvar el = document.activeElement;\n\t\t\t//as result of hotkey, we can have a activeElement set to document.body\n\t\t\tif (el && this._viewobj && (this._viewobj.contains(el) || el === document.body)){\n\t\t\t\tUIManager.setFocus(this._prev_focus);\n\t\t\t\tthis._prev_focus = null;\n\t\t\t}\n\t\t}\n\n\t\tthis._hide_sub_popups();\n\t},\n\t//hide all child-popups\n\t_hide_sub_popups:function(){\n\t\tvar order = state._popups;\n\t\tvar index = order.find(this);\n\t\tvar size = order.length - 1;\n\n\t\tif (index > -1)\n\t\t\tfor (var i = size; i > index; i--)\n\t\t\t\tif (order[i]._hide_point)\t//hide only popups, skip windows\n\t\t\t\t\torder[i].hide();\n\t\t\n\t\torder.removeAt(index);\n\t},\n\tdestructor: function() {\n\t\tthis._modal_set(false);\n\t\tremove(this._viewobj);\n\t\t\n\t\tif (this._settings.autofocus){\n\t\t\tif (!state._final_destruction)\n\t\t\t\tUIManager.setFocus(this._prev_focus);\n\t\t\tthis._prev_focus = null;\n\t\t}\n\t\t\n\t\tthis._hide_sub_popups();\n\t\tif (this._hide_point)\n\t\t\tthis._hide_point();\n\t\tDestruction.destructor.apply(this, []);\n\t},\n\t_hide_callback:function(){\n\t\tif (!this.$destructed){\n\t\t\tthis._viewobj.style.display = \"none\";\n\t\t\tthis._settings.hidden = true;\n\t\t\tthis.callEvent(\"onHide\",[]);\n\t\t}\n\t},\n\tclose:function(){\n\t\tthis.destructor(); \n\t},\n\t_inner_body_set:function(value){\n\t\tif (typeof value.borderless == \"undefined\")\n\t\t\tvalue.borderless = true;\n\t},\n\tbody_setter:function(value){\n\t\tif (typeof value != \"object\")\n\t\t\tvalue = {template:value };\n\t\tthis._inner_body_set(value);\n\n\t\tstate._parent_cell = this;\n\t\tthis._body_cell = ui._view(value);\n\n\t\tthis._bodyobj.appendChild(this._body_cell._viewobj);\n\t\treturn value;\n\t},\n\thead_setter:function(value){\n\t\tif (value === false) return value;\n\t\tif (typeof value != \"object\"){\n\t\t\tthis._viewobj.setAttribute(\"aria-label\", value);\n\t\t\tvalue = { template:value, padding:0 };\n\t\t}\n\t\t\n\t\tvalue.borderless = true;\n\n\t\tstate._parent_cell = this;\n\t\tthis._head_cell = ui._view(value);\n\n\t\tthis._headobj.appendChild(this._head_cell._viewobj);\n\t\treturn value;\n\t},\n\tgetBody:function(){\n\t\treturn this._body_cell;\n\t},\n\tgetHead:function(){\n\t\treturn this._head_cell;\n\t},\n\tadjust:function(){ return this.resize(); },\n\tresizeChildren:function(){\n\t\tif (this._body_cell)\n\t\t\tthis.resize();\n\t},\n\tresize:function(){\n\t\tbaseview.api.adjust.call(this);\n\t\tif (this.isVisible()){\n\t\t\tthis._setPosition(this._settings.left, this._settings.top);\n\t\t}\n\t},\n\t_checkFixedPosition: function() {\n\t\tif(this._settings.master) {\n\t\t\tvar top = $$(this._settings.master).getTopParentView().$view;\n\t\t\treturn top && top.style.position === \"fixed\";\n\t\t}\n\t\treturn false;\n\t},\n\t_setPosition:function(x,y){\n\t\tif ((this._settings.position || this._checkFixedPosition())){\n\t\t\tthis.$view.style.position = \"fixed\";\n\n\t\t\tvar width = this._content_width;\n\t\t\tvar height = this._content_height;\n\t\t\tif (width <= 0 || height <= 0) return;\n\n\t\t\tvar maxWidth = (window.innerWidth||document.documentElement.offsetWidth);\n\t\t\tvar maxHeight = (window.innerHeight||document.documentElement.offsetHeight);\n\t\t\tvar left = Math.round((maxWidth-width)/2);\n\t\t\tvar top = Math.round((maxHeight-height)/2);\n\n\t\t\tif (typeof this._settings.position == \"function\"){\n\t\t\t\tvar state = { \tleft:left, top:top, \n\t\t\t\t\twidth:width, height:height, \n\t\t\t\t\tmaxWidth:maxWidth, maxHeight:maxHeight };\n\t\t\t\tthis._settings.position.call(this, state);\n\n\t\t\t\tif (state.width != width || state.height != height)\n\t\t\t\t\tthis.$setSize(state.width, state.height);\n\n\t\t\t\tthis.setPosition(state.left, state.top);\n\t\t\t} else {\n\t\t\t\tif (this._settings.position == \"top\"){\n\t\t\t\t\tif (animate.isSupported())\n\t\t\t\t\t\ttop = -1*height;\n\t\t\t\t\telse\n\t\t\t\t\t\ttop = 10;\n\t\t\t\t}\n\t\t\t\t//popup inside a fixed win\n\t\t\t\tif(!this._settings.position){\n\t\t\t\t\tleft = this._settings.left || left;\n\t\t\t\t\ttop = this._settings.top || top;\n\t\t\t\t}\n\t\t\t\tthis.setPosition(left, top);\n\t\t\t}\n\t\t\t\n\t\t\tif (this._settings.position == \"top\")\n\t\t\t\tanimate(this._viewobj, {type: \"slide\", x:0, y:height-((this._settings.padding||0)*2), duration: 300 ,callback:this._topPositionCallback, master:this});\n\t\t} else \n\t\t\tthis.setPosition(x,y);\n\t},\n\t_topPositionCallback:function(node){\n\t\tanimate.clear(node);\n\t\tthis._settings.top=-((this._settings.padding||0)*2);\n\t\tthis.setPosition(this._settings.left, this._settings.top);\n\t},\n\tsetPosition:function(x,y){\n\t\tthis._viewobj.style.top = y+\"px\";\n\t\tthis._viewobj.style.left = x+\"px\";\n\t\tthis._settings.left = x; this._settings.top=y;\n\t},\n\t$getSize:function(dx, dy){\n\t\tvar _borders = this._settings._inner;\n\t\tif (_borders){\n\t\t\tdx += (_borders.left?0:1)+(_borders.right?0:1);\n\t\t\tdy += (_borders.top?0:1)+(_borders.bottom?0:1);\n\t\t}\n\t\t//line between head and body\n\t\tif (this._settings.head)\n\t\t\tdy += 1;\n\n\t\tvar size = this._body_cell.$getSize(0,0);\n\t\tvar headMinWidth = 0;\n\t\tif (this._head_cell){\n\t\t\tvar head_size = this._head_cell.$getSize(0,0);\n\t\t\tif (head_size[3]==head_size[2])\n\t\t\t\tthis._settings.headHeight = head_size[3];\n\t\t\tdy += this._settings.headHeight;\n\t\t\theadMinWidth = head_size[0];\n\t\t}\n\n\t\tif (this._settings.fullscreen){\n\t\t\tvar width = window.innerWidth || document.body.clientWidth;\n\t\t\tvar height = window.innerHeight || document.body.clientHeight;\n\t\t\treturn [width, width, height, height];\n\t\t}\n\n\t\t//get layout sizes\n\t\tvar self_size = base.api.$getSize.call(this, 0, 0);\n\n\t\t//use child settings if layout's one was not defined\n\t\tif (headMinWidth && size[1] > 100000)\n\t\t\tsize[0] = Math.max(headMinWidth, size[0]);\n\n\t\tself_size[1] = Math.min(self_size[1],(size[1]>=100000&&self_size[1]>=100000?Math.max(size[0], self_size[0]):size[1])+dx);\n\t\tself_size[3] = Math.min(self_size[3],(size[3]>=100000&&self_size[3]>=100000?Math.max(size[2], self_size[2]):size[3])+dy);\n\n\t\tself_size[0] = Math.min(Math.max(self_size[0],size[0] + dx), self_size[1]);\n\t\tself_size[2] = Math.min(Math.max(self_size[2],size[2] + dy), self_size[3]);\n\n\t\treturn self_size;\n\t},\n\t$setSize:function(x,y){\n\t\tbase.api.$setSize.call(this,x,y);\n\t\tx = this._content_width;\n\t\ty = this._content_height;\n\t\tif (this._settings.head === false) {\n\t\t\tthis._headobj.style.display=\"none\";\n\t\t\tthis._body_cell.$setSize(x,y);\n\t\t} else { \n\t\t\tthis._head_cell.$setSize(x,this._settings.headHeight);\n\t\t\tthis._body_cell.$setSize(x,y-this._settings.headHeight);\n\t\t}\n\t},\n\t$skin:function(){\n\t\tthis.defaults.headHeight = $active.barHeight;\n\t},\n\tdefaults:{\n\t\ttop:0,\n\t\tleft:0,\n\t\tautofit:true,\n\t\trelative:\"bottom\",\n\t\tbody:\"\",\n\t\thead:\"\",\n\t\thidden: true,\n\t\tautofocus:true,\n\t\tminWidth:300,\n\t\tminHeight:200\n\t}\n};\n\nconst view = protoUI(api, base.view, Movable, Modality, EventSystem, ResizeArea);\nexport default {api, view};","import {preventEvent} from \"../webix/html\";\nimport {bind, toNode} from \"../webix/helpers\";\nimport window from \"../views/window\";\nimport {$$} from \"../ui/core\";\nimport {event, eventRemove} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\nimport {callEvent} from \"../webix/customevents\";\n\n\nconst ContextHelper = {\n\tdefaults:{\n\t\tpadding:\"4\",\n\t\thidden:true\n\t},\n\tbody_setter:function(value){\n\t\tvalue = window.api.body_setter.call(this, value);\n\t\tthis._body_cell._viewobj.style.borderWidth = \"0px\";\n\t\treturn value;\n\t},\n\tattachTo:function(obj){\n\t\tassert(obj, \"Invalid target for Context::attach\");\n\t\tvar id;\n\t\tif (obj.on_context)\n\t\t\tid = obj.attachEvent(\"onAfterContextMenu\", bind(this._show_at_ui, this));\n\t\telse \n\t\t\tid = event(obj, \"contextmenu\", this._show_at_node, {bind:this});\n\n\t\tthis.attachEvent(\"onDestruct\", function(){\n\t\t\tif (obj.callEvent)\n\t\t\t\tobj.detachEvent(id);\n\t\t\telse\n\t\t\t\teventRemove(id);\n\t\t\tobj = null;\t\t\t\n\t\t});\n\t},\n\tgetContext:function(){\n\t\treturn this._area;\n\t},\n\tsetContext:function(area){\n\t\tthis._area = area;\n\t},\n\t_show_at_node:function(e){\n\t\tthis._area = toNode(e||event);\n\t\treturn this._show_at(e);\n\t},\n\t_show_at_ui:function(id, e){\n\t\tthis._area = { obj:$$(e), id:id };\n\t\treturn this._show_at(e);\n\t},\n\t_show_at:function(e){\n\t\tvar result = this.show(e, null, true);\n\t\tif (result === false) return result;\n\n\t\t//event forced to close other popups|context menus\n\t\tcallEvent(\"onClick\", []);\t\t\n\t\treturn preventEvent(e);\n\t},\n\t_show_on_mouse_out:true,\n\tmaster_setter:function(value){\n\t\tthis.attachTo(value);\n\t\treturn null;\n\t}\n};\n\nexport default ContextHelper;","import state from \"../core/state\";\nimport UIManager from \"../core/uimanager\";\nimport {bind, delay} from \"../webix/helpers\";\nimport {event} from \"../webix/htmlevents\";\n\n\nconst clipbuffer = {\n\n\t_area: null,\n\t_blur_id: null,\n\t_ctrl: 0,\n\n\t/*! create textarea or returns existing\n\t **/\n\tinit: function() {\n\t\t// returns existing textarea\n\t\tif (this._area !== null)\n\t\t\treturn this._area;\n\n\t\tstate.destructors.push({ obj: this });\n\t\t// creates new textarea\n\t\tthis._area = document.createElement(\"textarea\");\n\t\tthis._area.className = \"webix_clipbuffer\";\n\t\tthis._area.setAttribute(\"webixignore\", 1);\n\t\tthis._area.setAttribute(\"spellcheck\", \"false\");\n\t\tthis._area.setAttribute(\"autocapitalize\", \"off\");\n\t\tthis._area.setAttribute(\"autocorrect\", \"off\");\n\t\tthis._area.setAttribute(\"autocomplete\", \"off\");\n\t\tdocument.body.appendChild(this._area);\n\n\t\tevent(document.body, \"keydown\", bind(function(e){\n\t\t\tvar key = e.keyCode;\n\t\t\tvar ctrl = !!(e.ctrlKey || e.metaKey);\n\t\t\tif (key === 86 && ctrl){\n\t\t\t\tthis._area.value = \"\";\n\t\t\t\tdelay(this._paste, this, [e], 100);\n\t\t\t}\n\t\t}, this));\n\n\t\treturn this._area;\n\t},\n\tdestructor: function(){\n\t\tthis._area = null;\n\t},\n\t/*! set text into buffer\n\t **/\n\tset: function(text) {\n\t\tthis.init();\n\t\ttext = text === \"\" ? \"\\n\" : text;\n\t\tthis._area.value = text;\n\t\tthis.focus();\n\t},\n\t/*! select text in textarea\n\t **/\n\tfocus: function() {\n\t\t// if there is native browser selection, skip focus\n\t\tif(!this._isSelectRange()){\n\t\t\tthis.init();\n\t\t\tthis._area.focus();\n\t\t\tthis._area.select();\n\t\t}\n\n\t},\n\t/*! checks document selection\n\t **/\n\t_isSelectRange: function() {\n\t\tvar text = \"\";\n\t\tif (typeof window.getSelection != \"undefined\") {\n\t\t\ttext = window.getSelection().toString();\n\t\t} else if (typeof document.selection != \"undefined\" && document.selection.type == \"Text\") {\n\t\t\ttext = document.selection.createRange().text;\n\t\t}\n\t\treturn !!text;\n\t},\n\t/*! process ctrl+V pressing\n\t **/\n\t_paste: function(e) {\n\t\tvar trg = e.target || e.srcElement;\n\t\tif (trg === this._area) {\n\t\t\tvar text = this._area.value;\n\t\t\tvar last_active = UIManager.getFocus();\n\t\t\tif (last_active && (!last_active.getEditor || !last_active.getEditor())){\n\t\t\t\tlast_active.callEvent(\"onPaste\", [text]);\n\t\t\t\tthis._area.select();\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default clipbuffer;","import UIManager from \"../core/uimanager\";\nimport {isUndefined} from \"../webix/helpers\";\nimport template from \"../webix/template\";\n\nimport clipbuffer from \"../webix/clipbuffer\";\n\nconst CopyPaste = {\n\tclipboard_setter: function(value) {\n\t\tif (value === true || value === 1) value = \"modify\";\n\t\tthis.attachEvent(\"onAfterSelect\", function(id) {\n\t\t\tvar item = this.getItem(id);\n\t\t\tvar text = this.type.templateCopy(item);\n\t\t\tclipbuffer.set(text, this);\n\t\t\tclipbuffer.focus();\n\t\t\tUIManager.setFocus(this);\n\t\t});\n\t\tthis.attachEvent(\"onPaste\", function(text) {\n\t\t\tif (!isUndefined(this._paste[this._settings.clipboard]))\n\t\t\t\tthis._paste[this._settings.clipboard].call(this, text);\n\t\t});\n\t\tthis.attachEvent(\"onFocus\", function() {\n\t\t\tclipbuffer.focus();\n\t\t});\n\t\t// solution for clicks on selected items\n\t\tthis.attachEvent(\"onItemClick\",function(id){\n\t\t\tif(!this._selected || this._selected.find(id)!==-1){\n\t\t\t\tclipbuffer.focus();\n\t\t\t\tUIManager.setFocus(this);\n\t\t\t}\n\t\t});\n\t\treturn value;\n\t},\n\t_paste: {\n\t\t// insert new item with pasted value\n\t\tinsert: function(text) {\n\t\t\tthis.add({ value: text });\n\t\t},\n\t\t// change value of each selected item\n\t\tmodify: function(text) {\n\t\t\tvar sel = this.getSelectedId(true);\n\t\t\tfor (var i = 0; i < sel.length; i++) {\n\t\t\t\tthis.getItem(sel[i]).value = text;\n\t\t\t\tthis.refresh(sel[i]);\n\t\t\t}\n\t\t},\n\t\t// do nothing\n\t\tcustom: function() {}\n\t},\n\ttemplateCopy_setter: function(value) {\n\t\tthis.type.templateCopy = template(value);\n\t},\n\ttype:{\n\t\ttemplateCopy: function(item) {\n\t\t\treturn this.template(item);\n\t\t}\n\t}\n};\n\nexport default CopyPaste;","import {create, insertBefore, remove} from \"../webix/html\";\nimport env from \"../webix/env\";\nimport {extend, bind} from \"../webix/helpers\";\n\n\nconst CustomPrint = {\n\t$customPrint:function(options, htmlOnly){\n\t\tif(this._prePrint(options, htmlOnly))\n\t\t\treturn true;\n\n\t\tvar tableData = this._getTableArray(options);\n\t\tvar table = this._getTableHTML(tableData, options);\n\n\t\tif(htmlOnly)\n\t\t\treturn table;\n\n\t\tvar doc = create(\"div\", { \"class\":\"webix_ui_print\"});\n\t\tdoc.appendChild(table);\n\n\t\tinsertBefore(doc, options.docFooter, document.body);\n\t\twindow.print();\n\t\t\n\t\tremove(doc);\n\t},\n\t_prePrint:function(options, htmlOnly){\n\t\tif(!htmlOnly && (this.config.layout ==\"y\" || options.scroll || this.config.prerender || this.config.autoheight)) return true;\n\t\t\n\t\tif(this.config.layout ==\"x\")\n\t\t\textend(options || {}, {xCount:this.count(), nobreaks:true}, true);\n\t},\n\t_getPageWidth:function(options){\n\t\tif(options.fit ==\"page\") return Infinity;\n\n\t\tvar size = options.size;\n\t\tvar width = size[options.mode == \"portrait\"?\"width\":\"height\"];\n\t\t\n\t\treturn Math.min(width*env.printPPI-2*env.printMargin);\n\t},\n\t_getTableArray:function(options, base, start){\n\t\tvar maxWidth = this._getPageWidth(options);\n\t\tvar xCount = options.xCount || this._getVisibleRange()._dx;\n\n\t\tvar tableArray = [];\n\t\tvar colrow = [];\n\t\tvar width = 0;\n\t\t\n\t\tvar newTableStart, rownum, colnum;\n\n\t\tstart = start || 0;\n\t\tbase = base || [];\n\n\t\tfor(var i = 0; i=start){\n\t\t\t\twidth += this.type.width;\n\t\t\t\t\n\t\t\t\t//start a new table, if cells do not fit page width\n\t\t\t\tif(width > maxWidth && colnum>start){ // 'colnum>start' ensures that a single long cell will have to fit the page\n\t\t\t\t\tnewTableStart = colrow.length+start;\n\t\t\t\t\ttableArray.push(colrow);\n\t\t\t\t\ti = i+(xCount-colrow.length);\n\t\t\t\t\tcolrow = [];\n\t\t\t\t\twidth = 0;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar cellValue = this.type.template(obj, this.type);\n\t\t\t\tvar className = this._itemClassName;\n\t\t\t\t\n\t\t\t\tvar style = {\n\t\t\t\t\tdisplay:\"table-cell\",\n\t\t\t\t\theight:this.type.height + \"px\",\n\t\t\t\t\twidth:this.type.width + \"px\"\n\t\t\t\t};\n\t\t\t\t//push a cell to a row\n\t\t\t\tcolrow.push({\n\t\t\t\t\ttxt: cellValue,\n\t\t\t\t\tclassName: className+\" \"+(obj.$css || \"\"),\n\t\t\t\t\tstyle: style\n\t\t\t\t});\n\t\t\t\t//push a row to a table and start a new row\n\t\t\t\tif((i+1)%xCount === 0){\n\t\t\t\t\ttableArray.push(colrow);\n\t\t\t\t\tcolrow = [];\n\t\t\t\t\twidth = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tbase.push(tableArray);\n\n\t\tif(newTableStart)\n\t\t\tthis._getTableArray(options, base, newTableStart);\t\n\n\t\treturn base;\n\t},\n\t_getTableHTML:function(tableData, options){\n\t\t\n\t\tvar container = create(\"div\");\n\n\t\ttableData.forEach(bind(function(table, i){\n\n\t\t\tvar tableHTML = create(\"table\", {\n\t\t\t\t\"class\":\"webix_table_print \"+this.$view.className,\n\t\t\t\t\"style\":\"border-collapse:collapse\"\n\t\t\t});\n\n\t\t\ttable.forEach(function(row){\n\t\t\t\tvar tr = create(\"tr\");\n\n\t\t\t\trow.forEach(function(column){\n\t\t\t\t\tvar td = create(\"td\");\n\n\n\t\t\t\t\tif (column.txt) td.innerHTML = column.txt;\n\t\t\t\t\tif (column.className) td.className = column.className;\n\t\t\t\t\tif (column.style) {\n\t\t\t\t\t\tvar keys = Object.keys(column.style);\n\t\t\t\t\t\tkeys.forEach(function(key){\n\t\t\t\t\t\t\tif (column.style[key])\n\t\t\t\t\t\t\t\ttd.style[key] = column.style[key];\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif(column.span){\n\t\t\t\t\t\tif(column.span.colspan > 1)\n\t\t\t\t\t\t\ttd.colSpan = column.span.colspan;\n\t\t\t\t\t\tif(column.span.rowspan > 1)\n\t\t\t\t\t\t\ttd.rowSpan = column.span.rowspan;\n\t\t\t\t\t}\n\t\t\t\t\ttr.appendChild(td);\n\t\t\t\t});\n\t\t\t\ttableHTML.appendChild(tr);\n\t\t\t});\n\t\t\tcontainer.appendChild(tableHTML);\n\n\t\t\tif(!options.nobreaks && i+1 < tableData.length){\n\t\t\t\tvar br = create(\"DIV\", {\"class\":\"webix_print_pagebreak\"});\n\t\t\t\tcontainer.appendChild(br);\n\t\t\t}\n\t\t\t\n\t\t}, this));\n\n\t\treturn container;\n\t}\n};\n\nexport default CustomPrint;","const temp = null; export default temp;","const DataMarks = {\n\taddCss:function(id, css, silent){\n\t\tif (!this.addRowCss && !silent){\n\t\t\tif (!this.hasCss(id, css)){\n\t\t\t\tvar node = this.getItemNode(id);\n\t\t\t\tif (node){\n\t\t\t\t\tnode.className += \" \"+css;\n\t\t\t\t\tsilent = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.data.addMark(id, css, 1, 1, silent);\n\t},\n\tremoveCss:function(id, css, silent){\n\t\tif (!this.addRowCss && !silent){\n\t\t\tif (this.hasCss(id, css)){\n\t\t\t\tvar node = this.getItemNode(id);\n\t\t\t\tif (node){\n\t\t\t\t\tnode.className = node.className.replace(css,\"\").replace(\" \",\" \");\n\t\t\t\t\tsilent = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.data.removeMark(id, css, 1, silent);\n\t},\n\thasCss:function(id, mark){\n\t\treturn this.data.getMark(id, mark);\n\t},\n\tclearCss:function(css, silent){\n\t\treturn this.data.clearMark(css, 1, silent);\n\t}\n};\n\nexport default DataMarks;","import {isArray, extend, uid} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\n\n\n/*\n\tBehavior:DataMove - allows to move and copy elements, heavily relays on DataStore.move\n\t@export\n\t\tcopy\n\t\tmove\n*/\nconst DataMove ={\n\t//creates a copy of the item\n\tcopy:function(sid,tindex,tobj, details){\n\t\tdetails = details || {};\n\t\tvar new_id = details.newId || sid;\n\t\ttobj = tobj||this;\n\n\t\tvar data = this.getItem(sid);\n\t\tassert(data,\"Incorrect ID in DataMove::copy\");\n\t\t\n\t\t//make data conversion between objects\n\t\tif (tobj)\n\t\t\tdata = tobj._externalData(data);\n\t\t\n\t\t//adds new element same as original\n\t\treturn tobj.data.add(tobj._externalData(data,new_id),tindex,(details.parent || 0));\n\t},\n\t_next_move_index:function(nid, next, source){\n\t\tif (next && nid){\n\t\t\tvar new_index = this.getIndexById(nid);\n\t\t\treturn new_index+(source == this && source.getIndexById(next) 3) //heuristic value, duplicated below\n\t\t\t\tthis.$blockRender = tobj.$blockRender = true;\n\n\t\t\tfor (var i=0; i < sid.length; i++) {\n\t\t\t\t//increase index for each next item in the set, so order of insertion will be equal to order in the array\n\t\t\t\tconst nid = this.move(sid[i], tindex, tobj, details);\n\t\t\t\ttindex = tobj._next_move_index(nid, sid[i+1], this);\n\t\t\t}\n\n\t\t\tthis.$blockRender = tobj.$blockRender = false;\n\t\t\tif (sid.length > 3){\n\t\t\t\t//repaint whole component\n\t\t\t\tthis.refresh();\n\t\t\t\tif (tobj != this)\n\t\t\t\t\ttobj.refresh();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlet nid = sid; //id after moving\n\n\t\tvar data = this.getItem(sid);\n\t\tassert(data,\"Incorrect ID in DataMove::move\");\n\t\t\n\t\tif (!tobj || tobj == this){\n\t\t\tif (tindex < 0) tindex = this.data.order.length - 1;\n\t\t\tthis.data.move(this.getIndexById(sid),tindex);\t//move inside the same object\n\t\t\tthis.data.callEvent(\"onDataMove\", [sid, tindex, null, this.data.order[tindex+1]]);\n\t\t} else {\n\t\t\t//copy to the new object\n\t\t\tnid = tobj.data.add(tobj._externalData(data,new_id),tindex, (details.parent || 0));\n\t\t\tthis.data.remove(sid);//delete in old object\n\t\t}\n\t\treturn nid;\t//return ID of item after moving\n\t},\n\t//move item on one position up\n\tmoveUp:function(id,step){\n\t\treturn this.move(id,this.getIndexById(id)-(step||1));\n\t},\n\t//move item on one position down\n\tmoveDown:function(id,step){\n\t\treturn this.moveUp(id, (step||1)*-1);\n\t},\n\t//move item to the first position\n\tmoveTop:function(id){\n\t\treturn this.move(id,0);\n\t},\n\t//move item to the last position\n\tmoveBottom:function(id){\n\t\treturn this.move(id,this.data.count()-1);\n\t},\n\t/*\n\t\tthis is a stub for future functionality\n\t\tcurrently it just makes a copy of data object, which is enough for current situation\n\t*/\n\t_externalData:function(data,id){\n\t\tvar newdata = extend({},data);\n\t\tnewdata.id = (!id || this.data.pull[id])?uid():id;\n\t\t\n\n\t\tnewdata.$template=null;\n\n\t\tif (this._settings.externalData)\n\t\t\tnewdata = this._settings.externalData.call(this, newdata, id, data);\n\t\treturn newdata;\n\t}\n};\n\nexport default DataMove;","const rules = {\n\tisEmail: function(value){\n\t\treturn (/\\S+@[^@\\s]+\\.[^@\\s]+$/).test((value || \"\").toString());\n\t},\n\tisNumber: function(value){\n\t\treturn (parseFloat(value) == value);\n\t},\n\tisChecked: function(value){\n\t\treturn (!!value) || value === \"0\";\n\t},\n\tisNotEmpty: function(value){\n\t\treturn (value === 0 || value);\n\t}\n};\n\nexport default rules;","import {assert} from \"../webix/debug\";\nimport CodeParser from \"../core/codeparser\";\nimport rules from \"../webix/rules\";\n\n\n\nconst ValidateData = {\n\t$init:function(){\n\t\tif(this._events)\n\t\t\tthis.attachEvent(\"onChange\",this.clearValidation);\n\t},\n\tclearValidation:function(){\n\t\tif(this.elements){\n\t\t\tfor(var id in this.elements){\n\t\t\t\tthis._clear_invalid(id);\n\t\t\t}\n\t\t}\n\t},\n\tvalidate:function(mode, obj) {\n\t\tassert(this.callEvent, \"using validate for eventless object\");\n\t\t\n\t\tthis.callEvent(\"onBeforeValidate\", []);\n\t\tvar failed = this._validate_details = {};\n\n\t\t//optimistic by default :) \n\t\tvar result =true;\n\t\tvar rules = this._settings.rules;\n\t\t\n\t\tvar isHidden = this.isVisible && !this.isVisible();\n\t\tvar validateHidden = mode && mode.hidden;\n\t\tvar validateDisabled = mode && mode.disabled;\n\n\t\t//prevent validation of hidden elements\n\t\tvar elements = {}, hidden = {};\n\t\tfor(var i in this.elements){\n\t\t\tvar name = this.elements[i].config.name;\n\t\t\t//we are ignoring hidden and disabled fields during validation\n\t\t\t//if mode doesn not instruct us otherwise\n\t\t\t//if form itself is hidden, we can't separate hidden fiels,\n\t\t\t//so we will vaidate all fields\n\t\t\tif((isHidden || this.elements[i].isVisible() || validateHidden) && (this.elements[i].isEnabled() || validateDisabled))\n\t\t\t\telements[name] = this.elements[i];\n\t\t\telse{\n\t\t\t\thidden[name]=true;\n\t\t\t}\n\t\t}\n\t\tif (rules || elements)\n\t\t\tif(!obj && this.getValues)\n\t\t\t\tobj = this.getValues();\n\n\t\tif (rules){\n\t\t\t//complex rule, which may chcek all properties of object\n\t\t\tif (rules.$obj)\n\t\t\t\tresult = this._validate(rules.$obj, obj, obj, \"\") && result;\n\t\t\t\n\t\t\t//all - applied to all fields\n\t\t\tvar all = rules.$all;\n\t\t\tvar data = obj;\n\n\t\t\tif (this._settings.complexData)\n\t\t\t\tdata = CodeParser.collapseNames(obj);\n\n\t\t\tif (all)\n\t\t\t\tfor (let key in obj){\n\t\t\t\t\tif(hidden[key]) continue;\n\t\t\t\t\tlet subresult = this._validate(all, data[key], obj, key);\n\t\t\t\t\tif (!subresult)\n\t\t\t\t\t\tfailed[key] = true;\n\t\t\t\t\tresult = subresult && result;\n\t\t\t\t}\n\n\n\t\t\t//per-field rules\n\t\t\tfor (let key in rules){\n\t\t\t\tif(hidden[key]) continue;\n\t\t\t\tif (key.indexOf(\"$\")!==0 && !failed[key]){\n\t\t\t\t\tassert(rules[key], \"Invalid rule for:\"+key);\n\t\t\t\t\tlet subresult = this._validate(rules[key], data[key], obj, key);\n\t\t\t\t\tif (!subresult)\n\t\t\t\t\t\tfailed[key] = true;\n\t\t\t\t\tresult = subresult && result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check personal validation rules\n\t\tif (elements){\n\t\t\tfor (var key in elements){\n\t\t\t\tif (failed[key]) continue;\n\n\t\t\t\tvar subview = elements[key];\n\t\t\t\tif (subview.validate){\n\t\t\t\t\tlet subresult = subview.validate();\n\t\t\t\t\tresult = subresult && result;\n\t\t\t\t\tif (!subresult)\n\t\t\t\t\t\tfailed[key] = true;\n\t\t\t\t} else {\n\t\t\t\t\tvar input = subview._settings;\n\t\t\t\t\tif (input){\t//ignore non webix inputs\n\t\t\t\t\t\tvar validator = input.validate;\n\t\t\t\t\t\tif (!validator && input.required)\n\t\t\t\t\t\t\tvalidator = rules.isNotEmpty;\n\n\t\t\t\t\t\tif (validator){\n\t\t\t\t\t\t\tlet subresult = this._validate(validator, obj[key], obj, key);\n\t\t\t\t\t\t\tif (!subresult)\n\t\t\t\t\t\t\t\tfailed[key] = true;\n\t\t\t\t\t\t\tresult = subresult && result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\tthis.callEvent(\"onAfterValidation\", [result, this._validate_details]);\n\t\treturn result;\n\t},\n\t_validate:function(rule, data, obj, key){\n\t\tif (typeof rule == \"string\")\n\t\t\trule = rules[rule];\n\t\tif (rule.call(this, data, obj, key)){\n\t\t\tif(this.callEvent(\"onValidationSuccess\",[key, obj]) && this._clear_invalid)\n\t\t\t\tthis._clear_invalid(key);\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\tif(this.callEvent(\"onValidationError\",[key, obj]) && this._mark_invalid)\n\t\t\t\tthis._mark_invalid(key);\n\t\t}\n\t\treturn false;\n\t}\n};\n\nexport default ValidateData;","import {assert} from \"../webix/debug\";\nimport {copy, isUndefined, bind} from \"../webix/helpers\";\nimport {callEvent} from \"../webix/customevents\";\nimport {define} from \"../services\";\n\nimport {$$, proto} from \"../ui/core\";\n\nimport {ajax} from \"../load/ajax\";\nimport proxy from \"../load/proxy\";\n\nimport Settings from \"../core/settings\";\nimport EventSystem from \"../core/eventsystem\";\nimport ValidateData from \"../core/validatedata\";\n\nconst _pull = {};\n\nexport function dp(name,getOnly){\n\tif (typeof name == \"object\" && name._settings)\n\t\tname = name._settings.id;\n\tif (_pull[name] || getOnly)\n\t\treturn _pull[name];\n\n\tif (typeof name == \"string\"||typeof name == \"number\")\n\t\tname = { master:$$(name) };\n\n\tvar dp = new DataProcessor(name);\n\tvar masterId = dp._settings.master._settings.id;\n\t_pull[masterId]=dp;\n\n\t$$(masterId).attachEvent(\"onDestruct\",function(){\n\t\t_pull[this._settings.id] = null;\n\t\tdelete _pull[this._settings.id];\n\t});\n\n\treturn dp;\n}\n\ndefine(\"dp\", dp);\n\ndp.$$ = function(id){\n\treturn _pull[id];\n};\n\n\nexport const DataProcessor = proto({\n\tdefaults: {\n\t\tautoupdate:true,\n\t\tupdateFromResponse:false,\n\t\tmode:\"post\",\n\t\toperationName:\"webix_operation\",\n\t\ttrackMove:false\n\t},\n\n\n\t/*! constructor\n\t **/\n\t$init: function() {\n\t\tthis.reset();\n\t\tthis._ignore = false;\n\t\tthis.name = \"DataProcessor\";\n\t\tthis.$ready.push(this._after_init_call);\n\t},\n\treset:function(){\n\t\tthis._updates = [];\n\t},\n\turl_setter:function(value){\n\t\t/*\n\t\t\twe can use simple url or mode->url\n\t\t*/\n\t\tvar mode = \"\";\n\t\tif (typeof value == \"string\"){\n\t\t\tvar parts = value.split(\"->\");\n\t\t\tif (parts.length > 1){\n\t\t\t\tvalue = parts[1];\n\t\t\t\tmode = parts[0];\n\t\t\t}\n\t\t} else if (value && value.mode){\n\t\t\tmode = value.mode;\n\t\t\tvalue = value.url;\n\t\t}\n\n\t\tif (mode)\n\t\t\treturn proxy(mode, value);\n\n\t\treturn value;\n\t},\n\tmaster_setter:function(value){\n\t\tvar store = value;\n\t\tif (value.name != \"DataStore\")\n\t\t\tstore = value.data;\n\n\t\tthis._settings.store = store;\n\t\treturn value;\n\t},\n\t/*! attaching onStoreUpdated event\n\t **/\n\t_after_init_call: function(){\n\t\tassert(this._settings.store, \"store or master need to be defined for the dataprocessor\");\n\t\tthis._settings.store.attachEvent(\"onStoreUpdated\", bind(this._onStoreUpdated, this));\n\t\tthis._settings.store.attachEvent(\"onDataMove\", bind(this._onDataMove, this));\n\t},\n\tignore:function(code,master){\n\t\tvar temp = this._ignore;\n\t\tthis._ignore = true;\n\t\tcode.call((master||this));\n\t\tthis._ignore = temp;\n\t},\n\toff:function(){\n\t\tthis._ignore = true;\n\t},\n\ton:function(){\n\t\tthis._ignore = false;\n\t},\n\n\t_copy_data:function(source){\n\t\tvar obj = {};\n\t\tfor (var key in source)\t\n\t\t\tif (key.indexOf(\"$\")!==0)\n\t\t\t\tobj[key]=source[key];\n\t\treturn obj;\n\t},\n\tsave:function(id, operation, obj){\n\t\toperation = operation || \"update\";\n\t\tthis._save_inner(id, (obj || this._settings.store.getItem(id)), operation);\n\t},\n\t_save_inner:function(id, obj, operation){\n\t\tif (typeof id == \"object\") id = id.toString();\n\t\tif (!id || this._ignore === true || !operation || operation == \"paint\") return true;\n\n\t\tvar store = this._settings.store;\n\t\tif (store && store._scheme_serialize)\n\t\t\tobj = store._scheme_serialize(obj);\n\n\t\tvar update = { id: id, data:this._copy_data(obj), operation:operation };\n\t\t//save parent id\n\t\tif (!isUndefined(obj.$parent)) update.data.parent = obj.$parent;\n\n\t\tif (update.operation != \"delete\"){\n\t\t\t//prevent saving of not-validated records\n\t\t\tvar master = this._settings.master;\n\t\t\tif (master && master.data && master.data.getMark && master.data.getMark(id, \"webix_invalid\"))\n\t\t\t\tupdate._invalid = true;\n\n\t\t\tif (!this.validate(null, update.data))\n\t\t\t\tupdate._invalid = true;\n\t\t}\n\n\t\tif (this._check_unique(update))\n\t\t\tthis._updates.push(update);\n\n\t\tif (this._settings.autoupdate)\n\t\t\tthis.send();\n\t\t\t\n\t\treturn true;\n\t},\n\t_onDataMove:function(sid, tindex, parent, targetid){\n\t\tif (this._settings.trackMove){\n\t\t\tvar obj = copy(this._settings.store.getItem(sid));\n\n\t\t\tobj.webix_move_index = tindex;\n\t\t\tobj.webix_move_id = targetid;\n\t\t\tobj.webix_move_parent = parent;\n\t\t\tthis._save_inner(sid, obj, \"order\");\n\t\t}\n\t},\n\t_onStoreUpdated: function(id, obj, operation){\n\t\tswitch (operation) {\n\t\t\tcase \"save\":\n\t\t\t\toperation = \"update\";\n\t\t\t\tbreak;\n\t\t\tcase \"update\":\n\t\t\t\toperation = \"update\";\n\t\t\t\tbreak;\n\t\t\tcase \"add\":\n\t\t\t\toperation = \"insert\";\n\t\t\t\tbreak;\n\t\t\tcase \"delete\":\n\t\t\t\toperation = \"delete\";\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn true;\n\t\t}\n\t\treturn this._save_inner(id, obj, operation);\n\t},\n\t_check_unique:function(check){\n\t\tfor (var i = 0; i < this._updates.length; i++){\n\t\t\tvar one = this._updates[i];\n\t\t\tif (one.id == check.id){\n\t\t\t\tif (check.operation == \"delete\"){\n\t\t\t\t\tif (one.operation == \"insert\")\n\t\t\t\t\t\tthis._updates.splice(i,1);\n\t\t\t\t\telse \n\t\t\t\t\t\tone.operation = \"delete\";\n\t\t\t\t}\n\t\t\t\tone.data = check.data;\n\t\t\t\tone._invalid = check._invalid;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t},\n\tsend:function(){\n\t\tthis._sendData();\n\t},\n\t_sendData: function(){\n\t\tif (!this._settings.url)\n\t\t\treturn;\n\n\t\tvar marked = this._updates;\n\t\tvar to_send = [];\n\t\tvar url = this._settings.url;\n\n\t\tfor (var i = 0; i < marked.length; i++) {\n\t\t\tvar tosave = marked[i];\n\n\t\t\tif (tosave._in_progress) continue;\n\t\t\tif (tosave._invalid) continue;\n\n\t\t\tvar id = tosave.id;\n\t\t\tvar operation = tosave.operation;\n\t\t\tvar precise_url = (typeof url == \"object\" && !url.$proxy) ? url[operation] : url;\n\t\t\tvar proxy = precise_url && (precise_url.$proxy || typeof precise_url === \"function\");\n\n\t\t\tif (!precise_url) continue;\n\n\t\t\tif (this._settings.store._scheme_save)\n\t\t\t\tthis._settings.store._scheme_save(tosave.data);\n\n\t\t\tif (!this.callEvent(\"onBefore\"+operation, [id, tosave]))\n\t\t\t\tcontinue;\n\t\t\ttosave._in_progress = true;\n\n\t\t\tif (!this.callEvent(\"onBeforeDataSend\", [tosave])) return;\n\n\t\t\ttosave.data = this._updatesData(tosave.data);\n\n\t\t\tvar callback = this._send_callback({ id:tosave.id, status:tosave.operation });\n\t\t\tif (precise_url.$proxy){\n\t\t\t\tif (precise_url.save)\n\t\t\t\t\tprecise_url.save(this.config.master, tosave, this, callback);\n\t\t\t\tto_send.push(tosave);\n\t\t\t} else {\n\t\t\t\tif (operation == \"insert\") delete tosave.data.id;\n\n\t\t\t\t\n\t\t\t\tif (proxy){\n\t\t\t\t\t//promise\n\t\t\t\t\tprecise_url(tosave.id, tosave.operation, tosave.data).then(\n\t\t\t\t\t\tfunction(data){\n\t\t\t\t\t\t\tif (data && typeof data.json == \"function\")\n\t\t\t\t\t\t\t\tdata = data.json();\n\t\t\t\t\t\t\tcallback.success(\"\", data, -1);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction(error){\n\t\t\t\t\t\t\tcallback.error(\"\", null, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t//normal url\n\t\t\t\t\ttosave.data[this._settings.operationName] = operation;\n\n\t\t\t\t\tthis._send(precise_url, tosave.data, this._settings.mode, operation, callback);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.callEvent(\"onAfterDataSend\", [tosave]);\n\t\t}\n\n\t\tif (url.$proxy && url.saveAll && to_send.length)\n\t\t\turl.saveAll(this.config.master, to_send, this, this._send_callback({}));\n\t},\n\n\n\t/*! process updates list to POST and GET params according dataprocessor protocol\n\t *\t@param updates\n\t *\t\tlist of objects { id: \"item id\", data: \"data hash\", operation: \"type of operation\"}\n\t *\t@return\n\t *\t\tobject { post: { hash of post params as name: value }, get: { hash of get params as name: value } }\n\t **/\n\n\n\n\t_updatesData:function(source){\n\t\tvar target = {};\n\t\tfor (var j in source){\n\t\t\tif (j.indexOf(\"$\")!==0)\n\t\t\t\ttarget[j] = source[j];\n\t\t}\n\t\treturn target;\n\t},\n\n\n\n\t/*! send dataprocessor query to server\n\t *\tand attach event to process result\n\t *\t@param url\n\t *\t\tserver url\n\t *\t@param get\n\t *\t\thash of get params\n\t *\t@param post\n\t *\t\thash of post params\n\t *\t@mode\n\t *\t\t'post' or 'get'\n\t **/\n\t_send: function(url, post, mode, operation, callback) {\n\t\tassert(url, \"url was not set for DataProcessor\");\n\n\t\tif (typeof url == \"function\")\n\t\t\treturn url(post, operation, callback);\n\n\t\tajax()[mode](url, post, callback);\n\t},\n\t_send_callback:function(id){\n\t\tvar self = this;\n\t\treturn {\n\t\t\tsuccess:function(t,d,l){ return self._processResult(id, t,d,l); },\n\t\t\terror :function(t,d,l){ return self._processError(id, t,d,l); }\n\t\t};\n\t},\n\tattachProgress:function(start, end, error){\n\t\tthis.attachEvent(\"onBeforeDataSend\", start);\n\t\tthis.attachEvent(\"onAfterSync\", end);\n\t\tthis.attachEvent(\"onAfterSaveError\", error);\n\t\tthis.attachEvent(\"onLoadError\", error);\n\t},\n\t_processError:function(id, text, data, loader){\n\t\tif (id)\n\t\t\tthis._innerProcessResult(true, id.id, false, id.status, false, {text:text, data:data, loader:loader});\n\t\telse {\n\t\t\tthis.callEvent(\"onLoadError\", arguments);\n\t\t\tcallEvent(\"onLoadError\", [text, data, loader, this]);\n\t\t}\n\t},\n\t_innerProcessResult:function(error, id, newid, status, obj, details){\n\t\tvar master = this._settings.master;\n\t\tvar update = this.getItemState(id);\n\t\tupdate._in_progress = false;\n\n\t\tif (error){\n\t\t\tif (this.callEvent(\"onBeforeSaveError\", [id, status, obj, details])){\n\t\t\t\tupdate._invalid = true;\n\t\t\t\tif(this._settings.undoOnError && master._settings.undo){\n\t\t\t\t\tthis.ignore(function(){\n\t\t\t\t\t\tmaster.undo(id);\n\t\t\t\t\t});\n\t\t\t\t\tthis.setItemState(id, false);\n\t\t\t\t}\n\t\t\t\tthis.callEvent(\"onAfterSaveError\", [id, status, obj, details]);\n\t\t\t}\n\t\t\treturn;\n\t\t} else\n\t\t\tthis.setItemState(id, false);\n\n\t\t//update from response\n\t\tif (newid && id != newid)\n\t\t\tthis._settings.store.changeId(id, newid);\n\n\t\tif (obj && status != \"delete\" && this._settings.updateFromResponse)\n\t\t\tthis.ignore(function(){\t\t\t\t\n\t\t\t\tthis._settings.store.updateItem(newid || id, obj);\n\t\t\t});\n\t\t\t\n\n\t\t//clean undo history, for the saved record\n\t\tif(this._settings.undoOnError && master._settings.undo)\n\t\t\tmaster.removeUndo(newid||id);\n\n\t\tthis.callEvent(\"onAfterSave\",[obj, id, details]);\n\t\tthis.callEvent(\"onAfter\"+status, [obj, id, details]);\n\t},\n\tprocessResult: function(state, hash, details){\n\t\t//compatibility with custom json response\n\t\tvar error = (hash && (hash.status == \"error\" || hash.status == \"invalid\"));\n\t\tvar newid = (hash ? ( hash.newid || hash.id ) : false);\n\n\t\tthis._innerProcessResult(error, state.id, newid, state.status, hash, details);\n\t},\n\t// process saving from result\n\t_processResult: function(state, text, data, loader){\n\t\tthis.callEvent(\"onBeforeSync\", [state, text, data, loader]);\n\n\t\tif (loader === -1){\n\t\t\t//callback from promise\n\t\t\tthis.processResult(state, data, {});\n\t\t} else {\n\t\t\tvar proxy = this._settings.url;\n\t\t\tif (proxy.$proxy && proxy.result)\n\t\t\t\tproxy.result(state, this._settings.master, this, text, data, loader);\n\t\t\telse {\n\t\t\t\tvar hash;\n\t\t\t\tif (text){\n\t\t\t\t\thash = data.json();\n\t\t\t\t\t//invalid response\n\t\t\t\t\tif (text && (hash === null || typeof hash == \"undefined\"))\n\t\t\t\t\t\thash = { status:\"error\" };\n\t\t\t\t}\n\t\t\t\tthis.processResult(state, hash, {text:text, data:data, loader:loader});\n\t\t\t}\n\t\t}\n\n\t\tthis.callEvent(\"onAfterSync\", [state, text, data, loader]);\n\t},\n\n\n\t/*! if it's defined escape function - call it\n\t *\t@param value\n\t *\t\tvalue to escape\n\t *\t@return\n\t *\t\tescaped value\n\t **/\n\tescape: function(value) {\n\t\tif (this._settings.escape)\n\t\t\treturn this._settings.escape(value);\n\t\telse\n\t\t\treturn encodeURIComponent(value);\n\t},\n\tgetState:function(){\n\t\tif (!this._updates.length) return false;\n\t\tfor (var i = this._updates.length - 1; i >= 0; i--)\n\t\t\tif (this._updates[i]._in_progress)\n\t\t\t\treturn \"saving\";\n\n\t\treturn true;\n\t},\n\tgetItemState:function(id){\n\t\tvar index = this._get_stack_index(id);\n\t\treturn this._updates[index] || null;\n\t},\n\tsetItemState:function(id, state){\n\t\tif (state)\n\t\t\tthis.save(id, state);\n\t\telse{\n\t\t\tvar index = this._get_stack_index(id);\n\t\t\tif (index > -1)\n\t\t\t\tthis._updates.splice(index, 1);\n\t\t}\n\t},\n\t_get_stack_index: function(id) {\n\t\tvar index = -1;\n\t\tfor (var i=0; i < this._updates.length; i++)\n\t\t\tif (this._updates[i].id == id) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\treturn index;\n\t}\n\n}, Settings, EventSystem, ValidateData);","import {extend, toArray, uid, isUndefined, copy, isArray, bind} from \"../webix/helpers\";\nimport {$$} from \"../ui/core\";\nimport {assert} from \"../webix/debug\";\nimport {callEvent} from \"../webix/customevents\";\n\n\nimport state from \"../core/state\";\nimport EventSystem from \"./eventsystem\";\nimport DataDriver from \"../load/drivers/index\";\n\n\n\n\n/*\n\tDataStore is not a behavior, it standalone object, which represents collection of data.\n\tCall provideAPI to map data API\n\n\t@export\n\t\texists\n\t\tgetIdByIndex\n\t\tgetIndexById\n\t\tget\n\t\tset\n\t\trefresh\n\t\tcount\n\t\tsort\n\t\tfilter\n\t\tnext\n\t\tprevious\n\t\tclearAll\n\t\tfirst\n\t\tlast\n*/\n\nfunction DataStore(){\n\tthis.name = \"DataStore\";\n\t\n\textend(this, EventSystem);\n\n\tthis.setDriver(\"json\");\t//default data source is an\n\tthis.pull = {};\t\t\t\t\t\t//hash of IDs\n\tthis.order = toArray();\t\t//order of IDs\n\tthis._marks = {};\n}\n\nDataStore.prototype={\n\t//defines type of used data driver\n\t//data driver is an abstraction other different data formats - xml, json, csv, etc.\n\tsetDriver:function(type){\n\t\tassert(DataDriver[type],\"incorrect DataDriver\");\n\t\tthis.driver = DataDriver[type];\n\t},\n\t//process incoming raw data\n\t_parse:function(data){\n\t\tthis.callEvent(\"onParse\", [this.driver, data]);\n\n\t\tif (this._filter_order)\n\t\t\tthis.filter();\n\t\n\t\t//get size and position of data\n\t\tvar info = this.driver.getInfo(data);\n\n\t\t//generated by connectors only\n\t\tif (info.key)\n\t\t\tstate.securityKey = info.key;\n\n\t\tif (info.config)\n\t\t\tthis.callEvent(\"onServerConfig\",[info.config]);\n\n\t\tvar options = this.driver.getOptions(data);\n\t\tif (options)\n\t\t\tthis.callEvent(\"onServerOptions\", [options]);\n\n\t\t//get array of records\n\t\tvar recs = this.driver.getRecords(data);\n\n\t\tthis._inner_parse(info, recs);\n\n\t\t//in case of tree store we may want to group data\n\t\tif (this._scheme_group && this._group_processing && !this._not_grouped_order)\n\t\t\tthis._group_processing(this._scheme_group);\n\n\t\t//optional data sorting\n\t\tif (this._scheme_sort){\n\t\t\tthis.blockEvent();\n\t\t\tthis.sort(this._scheme_sort);\n\t\t\tthis.unblockEvent();\n\t\t}\n\n\t\tthis.callEvent(\"onStoreLoad\",[this.driver, data]);\n\t\t//repaint self after data loading\n\t\tthis.refresh();\n\t},\n\t_inner_parse:function(info, recs){\n\t\tvar from = info.from;\n\t\tvar subload = true;\n\t\tvar marks = false;\n\n\t\t//some data is loaded and new data doesn't have \"pos\" - assuming update\n\t\tif (!from && from !== 0 && this.order[0]){\n\t\t\tif (this._removeMissed){\n\t\t\t\t//update mode, create kill list\n\t\t\t\tmarks = {};\n\t\t\t\tfor (let i=0; ito){ //can be in case of backward shift-selection\n\t\t\tvar a=to; to=from; from=a;\n\t\t}\n\n\t\treturn this.getIndexRange(from,to);\n\t},\n\t//converts range of indexes to array of all IDs between them\n\tgetIndexRange:function(from,to){\n\t\tto=Math.min((to === 0 ? 0 :(to||Infinity)),this.count()-1);\n\t\t\n\t\tvar ret=toArray(); //result of method is rich-array\n\t\tfor (var i=(from||0); i <= to; i++)\n\t\t\tret.push(this.getItem(this.order[i]));\n\t\treturn ret;\n\t},\n\t//returns total count of elements\n\tcount:function(){\n\t\treturn this.order.length;\n\t},\n\t//returns truy if item with such ID exists\n\texists:function(id){\n\t\treturn !!(this.pull[id]);\n\t},\n\t//nextmethod is not visible on component level, check DataMove.move\n\t//moves item from source index to the target index\n\tmove:function(sindex,tindex){\n\t\tassert(sindex>=0 && tindex>=0, \"DataStore::move\",\"Incorrect indexes\");\n\t\tif (sindex == tindex) return;\n\n\t\tvar id = this.getIdByIndex(sindex);\n\t\tvar obj = this.getItem(id);\n\n\t\tif (this._filter_order)\n\t\t\tthis._move_inner(this._filter_order, 0, 0, this.getIdByIndex(sindex), this.getIdByIndex(tindex));\n\n\t\tthis._move_inner(this.order, sindex, tindex);\n\t\t\n\t\t\n\t\t//repaint signal\n\t\tthis.callEvent(\"onStoreUpdated\",[id,obj,\"move\"]);\n\t},\n\t_move_inner:function(col, sindex, tindex, sid, tid){\n\t\tif (sid||tid){\n\t\t\tsindex = tindex = -1;\n\t\t\tfor (var i=0; i data_size){\n\t\t\tassert(0, \"Warning\",\"DataStore:add\",\"Index of out of bounds\");\n\t\t\tindex = Math.min(order.length,index);\n\t\t}\n\t\tif (this.callEvent(\"onBeforeAdd\", [id, obj, index]) === false) return false;\n\n\t\tassert(!this.exists(id), \"Not unique ID\");\n\t\t\n\t\tthis.pull[id]=obj;\n\t\torder.insertAt(id,index);\n\t\tif (this._filter_order){\t//adding during filtering\n\t\t\t//we can't know the location of new item in full dataset, making suggestion\n\t\t\t//put at end of original dataset by default\n\t\t\tvar original_index = this._filter_order.length;\n\t\t\t//if some data exists, put at the same position in original and filtered lists\n\t\t\tif (this.order.length)\n\t\t\t\toriginal_index = Math.min((index || 0), original_index);\n\n\t\t\tthis._filter_order.insertAt(id,original_index);\n\t\t}\n\t\t\n\t\t//repaint signal\n\t\tthis.callEvent(\"onStoreUpdated\",[id,obj,\"add\"]);\n\t\tthis.callEvent(\"onAfterAdd\",[id,index]);\n\n\t\treturn obj.id;\n\t},\n\t\n\t//removes element from datastore\n\tremove:function(id){\n\t\t//id can be an array of IDs - result of getSelect, for example\n\t\tif (isArray(id)){\n\t\t\tfor (var i=0; i < id.length; i++)\n\t\t\t\tthis.remove(id[i]);\n\t\t\treturn;\n\t\t}\n\t\tif (this.callEvent(\"onBeforeDelete\",[id]) === false) return false;\n\t\t\n\t\tassert(this.exists(id), \"Not existing ID in remove command\"+id);\n\n\t\tvar obj = this.getItem(id);\t//save for later event\n\t\t//clear from collections\n\t\tthis.order.remove(id);\n\t\tif (this._filter_order) \n\t\t\tthis._filter_order.remove(id);\n\t\t\t\n\t\tdelete this.pull[id];\n\t\tif (this._marks[id])\n\t\t\tdelete this._marks[id];\n\n\t\t//repaint signal\n\t\tthis.callEvent(\"onStoreUpdated\",[id,obj,\"delete\"]);\n\t\tthis.callEvent(\"onAfterDelete\",[id]);\n\t},\n\t//deletes all records in datastore\n\tclearAll:function(soft){\n\t\t//instead of deleting one by one - just reset inner collections\n\t\tthis.pull = {};\n\t\tthis._marks = {};\n\t\tthis.order = toArray();\n\t\t//this.feed = null;\n\t\tthis._filter_order = null;\n\t\tif (!soft)\n\t\t\tthis.url = null;\n\t\tthis.callEvent(\"onClearAll\",[soft]);\n\t\tthis.refresh();\n\t},\n\t//converts id to index\n\tgetIdByIndex:function(index){\n\t\tassert(index >= 0,\"DataStore::getIdByIndex Incorrect index\");\n\t\treturn this.order[index];\n\t},\n\t//converts index to id\n\tgetIndexById:function(id){\n\t\tif (!this.pull[id])\n\t\t\treturn -1;\n\t\telse\n\t\t\treturn this.order.find(id);\t//slower than getIdByIndex\n\t},\n\t//returns ID of next element\n\tgetNextId:function(id,step){\n\t\treturn this.order[this.getIndexById(id)+(step||1)];\n\t},\n\t//returns ID of first element\n\tgetFirstId:function(){\n\t\treturn this.order[0];\n\t},\n\t//returns ID of last element\n\tgetLastId:function(){\n\t\treturn this.order[this.order.length-1];\n\t},\n\t//returns ID of previous element\n\tgetPrevId:function(id,step){\n\t\treturn this.order[this.getIndexById(id)-(step||1)];\n\t},\n\t/*\n\t\tsort data in collection\n\t\t\tby - settings of sorting\n\t\t\n\t\tor\n\t\t\n\t\t\tby - sorting function\n\t\t\tdir - \"asc\" or \"desc\"\n\t\t\t\n\t\tor\n\t\t\n\t\t\tby - property\n\t\t\tdir - \"asc\" or \"desc\"\n\t\t\tas - type of sortings\n\t\t\n\t\tSorting function will accept 2 parameters and must return 1,0,-1, based on desired order\n\t*/\n\tsort:function(by, dir, as){\n\t\tvar sort = by;\t\n\t\tif (typeof by == \"function\")\n\t\t\tsort = {as:by, dir:dir};\n\t\telse if (typeof by == \"string\")\n\t\t\tsort = {by:by.replace(/#/g,\"\"), dir:dir, as:as};\n\n\t\t\n\t\tvar parameters = [sort.by, sort.dir, sort.as, sort];\n\t\tif (!this.callEvent(\"onBeforeSort\",parameters)) return;\t\n\t\t\n\t\tthis.order = this._sort_core(sort, this.order);\n\t\tif (this._filter_order && this._filter_order.length != this.order.length)\n\t\t\tthis._filter_order = this._sort_core(sort, this._filter_order);\n\t\t\n\t\t//repaint self\n\t\tthis.refresh();\n\t\t\n\t\tthis.callEvent(\"onAfterSort\",parameters);\n\t},\n\t_sort_core:function(sort, order){\n\t\tvar sorter = this.sorting.create(sort);\n\t\tif (this.order.length){\n\t\t\tvar pre = order.splice(0, this.$freeze);\n\t\t\t//get array of IDs\n\t\t\tvar neworder = toArray();\n\t\t\tfor (var i=order.length-1; i>=0; i--)\n\t\t\t\tneworder[i] = this.pull[order[i]];\n\t\t\t\n\t\t\tneworder.sort(sorter);\n\t\t\treturn toArray(pre.concat(neworder.map(function(obj){ \n\t\t\t\tassert(obj, \"Client sorting can't be used with dynamic loading\");\n\t\t\t\treturn this.id(obj);\n\t\t\t},this)));\n\t\t}\n\t\treturn order;\n\t},\n\t/*\n\t\tFilter datasource\n\t\t\n\t\ttext - property, by which filter\n\t\tvalue - filter mask\n\t\t\n\t\tor\n\t\t\n\t\ttext - filter method\n\t\t\n\t\tFilter method will receive data object and must return true or false\n\t*/\n\t_filter_reset:function(preserve){\n\t\t//remove previous filtering , if any\n\t\tif (this._filter_order && !preserve){\n\t\t\tthis.order = this._filter_order;\n\t\t\tdelete this._filter_order;\n\t\t}\n\t},\n\t_filter_core:function(filter, value, preserve){\n\t\tvar neworder = toArray();\n\t\tvar freeze = this.$freeze || 0;\n\t\t\n\t\tfor (var i=0; i < this.order.length; i++){\n\t\t\tvar id = this.order[i];\n\t\t\tif (i < freeze || filter(this.getItem(id),value))\n\t\t\t\tneworder.push(id);\n\t\t}\n\t\t//set new order of items, store original\n\t\tif (!preserve || !this._filter_order)\n\t\t\tthis._filter_order = this.order;\n\t\tthis.order = neworder;\n\t},\n\tfind:function(config, first){\n\t\tvar result = [];\n\n\t\tfor(var i in this.pull){\n\t\t\tvar data = this.pull[i];\n\n\t\t\tvar match = true;\n\t\t\tif (typeof config == \"object\"){\n\t\t\t\tfor (var key in config)\n\t\t\t\t\tif (data[key] != config[key]){\n\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t} else if (!config(data))\n\t\t\t\tmatch = false;\n\n\t\t\tif (match)\n\t\t\t\tresult.push(data);\n\t\t\t\n\t\t\tif (first && result.length)\n\t\t\t\treturn result[0];\n\t\t}\n\n\t\treturn result;\n\t},\n\tfilter:function(text,value,preserve){\n\t\t//unfilter call but we already in not-filtered state\n\t\tif (!text && !this._filter_order && !this._filter_branch) return;\n\t\tif (!this.callEvent(\"onBeforeFilter\", [text, value])) return;\n\t\t\n\t\tthis._filter_reset(preserve);\n\t\tif (!this.order.length) return;\n\t\t\n\t\t//if text not define -just unfilter previous state and exit\n\t\tif (text){\n\t\t\tvar filter = text;\n\t\t\tvalue = value||\"\";\n\t\t\tif (typeof text == \"string\"){\n\t\t\t\ttext = text.replace(/#/g,\"\");\n\t\t\t\tif (typeof value == \"function\")\n\t\t\t\t\tfilter = function(obj){\n\t\t\t\t\t\treturn value(obj[text]);\n\t\t\t\t\t};\n\t\t\t\telse{\n\t\t\t\t\tvalue = value.toString().toLowerCase();\n\t\t\t\t\tfilter = function(obj,value){\t//default filter - string start from, case in-sensitive\n\t\t\t\t\t\tassert(obj, \"Client side filtering can't be used with dynamic loading\");\n\t\t\t\t\t\treturn (obj[text]||\"\").toString().toLowerCase().indexOf(value)!=-1;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis._filter_core(filter, value, preserve, this._filterMode);\n\t\t}\n\t\t//repaint self\n\t\tthis.refresh();\n\t\t\n\t\tthis.callEvent(\"onAfterFilter\", []);\n\t},\n\t/*\n\t\tIterate through collection\n\t*/\n\t_obj_array:function(){\n\t\tvar data = [];\n\t\tfor (var i = this.order.length - 1; i >= 0; i--)\n\t\t\tdata[i]=this.pull[this.order[i]];\n\n\t\treturn data;\n\t},\n\teach:function(method, master, all){\n\t\tvar order = this.order;\n\t\tif (all)\n\t\t\torder = this._filter_order || order;\n\n\t\tfor (var i=0; ib?1:(ab?1:(ab?1:(ab?1:(ab?1:(a= count + from )) return true;\n\t\t}\n\t\treturn false;\n\t},\n\tremoveMissed_setter:function(value){\n\t\treturn (this.data._removeMissed = value);\n\t},\n\t//init of dataprocessor delayed after all settings processing\n\t//because it need to be the last in the event processing chain\n\t//to get valid validation state\n\t_init_dataprocessor:function(){\n\t\tvar url = this._settings.save;\n\n\t\tif (url === true)\n\t\t\turl = this._settings.save = this._settings.url;\n\n\t\tvar obj = { master: this };\n\t\t\n\t\tif (url && url.url)\n\t\t\textend(obj, url);\n\t\telse\n\t\t\tobj.url = url;\n\n\t\tdp(obj);\n\t},\n\tsave_setter:function(value){\n\t\tif (value)\n\t\t\tthis.$ready.push(this._init_dataprocessor);\n\n\t\treturn value;\n\t},\n\tscheme_setter:function(value){\n\t\tthis.data.scheme(value);\n\t},\n\tdataFeed_setter:function(value){\n\t\tvalue = proxy.$parse(value);\n\n\t\tthis.data.attachEvent(\"onBeforeFilter\", bind(function(text, filtervalue){\n\t\t\t//complex filtering, can't be routed to dataFeed\n\t\t\tif (typeof text == \"function\") return true;\n\n\t\t\t//we have dataFeed and some text\n\t\t\tif (this._settings.dataFeed && (text || filtervalue)){\n\t\t\t\ttext = text || \"id\";\n\t\t\t\tif (filtervalue && typeof filtervalue == \"object\")\n\t\t\t\t\tfiltervalue = filtervalue.id;\n\n\t\t\t\tthis.clearAll();\n\t\t\t\tvar url = this._settings.dataFeed;\n\n\t\t\t\t//js data feed\n\t\t\t\tif (typeof url == \"function\"){\n\t\t\t\t\tvar filter = {};\n\t\t\t\t\tfilter[text] = filtervalue;\n\t\t\t\t\turl.call(this, filtervalue, filter);\n\t\t\t\t} else if (url.$proxy) {\n\t\t\t\t\tif (url.load){\n\t\t\t\t\t\tvar filterobj = {}; filterobj[text] = filtervalue;\n\t\t\t\t\t\turl.load(this, {\n\t\t\t\t\t\t\tsuccess: this._onLoad,\n\t\t\t\t\t\t\terror: this._onLoadError\n\t\t\t\t\t\t}, { filter: filterobj });\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t//url data feed\n\t\t\t\t\tvar urldata = \"filter[\"+text+\"]=\"+encodeURIComponent(filtervalue);\n\t\t\t\t\tthis.load(url+(url.indexOf(\"?\")<0?\"?\":\"&\")+urldata, this._settings.datatype);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},this));\n\t\treturn value;\n\t},\n\t_call_onready:function(){\n\t\tif (this._settings.ready && !this._ready_was_used){\n\t\t\tvar code = toFunctor(this._settings.ready, this.$scope);\n\t\t\tif (code)\n\t\t\t\tdelay(code, this, arguments);\n\t\t\tif (this.callEvent)\n\t\t\t\tdelay(this.callEvent, this, [\"onReady\", []]);\n\t\t\tthis._ready_was_used = true;\n\t\t}\n\t},\n\t_call_onclearall:function(soft){\n\t\tfor (var i = 0; i < this._ajax_queue.length; i++){\n\t\t\tvar xhr = this._ajax_queue[i];\n\n\t\t\t//IE9 and IE8 deny extending of ActiveX wrappers\n\t\t\ttry { xhr.aborted = true; } catch(e){ \n\t\t\t\t_xhr_aborted.push(xhr);\n\t\t\t}\n\t\t\txhr.abort();\n\t\t}\n\t\tif (!soft){\n\t\t\tthis._load_count = false;\n\t\t\tthis._feed_last = {};\n\t\t\tthis._ajax_queue = toArray();\n\t\t\tthis.waitData = promise.defer();\n\t\t}\n\t},\n\t_call_on_config:function(config){\n\t\tthis._parseSeetingColl(config);\n\t}\n},AtomDataLoader);\n\n\n\nexport default DataLoader;","\n\nconst DataState = {\n\tgetState:function(){\n\t\tvar cols_n = this.config.columns.length;\n\t\tvar columns = this.config.columns;\n\t\tvar settings = { \n\t\t\tids:[],\n\t\t\tsize:[],\n\t\t\tselect:this.getSelectedId(true),\n\t\t\tscroll:this.getScrollState()\n\t\t};\n\t\tfor(var i = 0; i < cols_n; i++){\n\t\t\tvar col = columns[i];\n\t\t\tsettings.ids.push(col.id);\n\t\t\tsettings.size.push((col.fillspace || col.adjust) ? -1 : col.width);\n\t\t}\n\n\t\tsettings.order = [].concat(this._hidden_column_order.length ? this._hidden_column_order : settings.ids);\n\n\t\tif(this._last_sorted){\n\t\t\tsettings.sort={\n\t\t\t\tid:this._last_sorted,\n\t\t\t\tdir:this._last_order\n\t\t\t};\n\t\t}\n\n\t\t//this method will try to access the rendered values\n\t\t//just ignore it if grid is not rendered yet\n\t\tif (this._filter_elements && this._dtable_fully_ready) {\n\t\t\tvar filter = {};\n\t\t\tvar any_filter = 0;\n\t\t\tfor (let key in this._filter_elements) {\n\t\t\t\tif (this._hidden_column_hash[key]) continue;\n\n\t\t\t\tvar f = this._filter_elements[key];\n\t\t\t\tf[1].value = filter[key] = f[2].getValue(f[0]);\n\t\t\t\tany_filter = 1;\n\t\t\t}\n\t\t\tif (any_filter)\n\t\t\t\tsettings.filter=filter;\n\t\t}\n\n\t\tsettings.hidden = [];\n\t\tfor (let key in this._hidden_column_hash)\n\t\t\tsettings.hidden.push(key);\n\t\t\n\t\treturn settings;\n\t},\n\tsetState:function(obj){\n\t\tvar columns = this.config.columns;\n\t\tif(!obj) return;\n\n\t\tthis._last_sorted = null; \n\t\tthis.blockEvent();\n\n\t\tif (obj.order && obj.order.length)\n\t\t\tthis._hidden_column_order = [].concat(obj.order);\n\n\t\tif (obj.hidden){\n\t\t\tvar hihash = {};\n\t\t\tfor (let i=0; i 0 && col.width != obj.size[i]){\n\t\t\t\t\tdelete col.fillspace;\n\t\t\t\t\tdelete col.adjust;\n\t\t\t\t\tthis._setColumnWidth( i, obj.size[i], true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tthis.unblockEvent();\n\n\t\tvar silent = !(this._settings.leftSplit || this._settings.rightSplit);\n\t\tthis._updateColsSizeSettings(silent);\n\t\tthis.callEvent(\"onStructureUpdate\", []);\n\n\t\tif(obj.sort){\n\t\t\tvar column = columns[this.getColumnIndex(obj.sort.id)];\n\t\t\tif (column)\n\t\t\t\tthis._sort(obj.sort.id, obj.sort.dir, column.sort);\t\n\t\t}\n\t\t\t\t\n\t\tif (obj.filter){\n\t\t\t//temporary disable filtering \n\t\t\tlet temp = this.filterByAll;\n\t\t\tthis.filterByAll = function(){};\n\n\t\t\t//apply defined filters\n\t\t\tfor (let key in obj.filter) {\n\t\t\t\tlet value = obj.filter[key];\n\t\t\t\tif (!value) continue;\n\n\t\t\t\tif (!this._filter_elements[key]) continue;\n\t\t\t\tlet f = this._filter_elements[key];\n\t\t\t\tf[2].setValue(f[0], value);\n\t\t\t\tvar contentid = f[1].contentId;\n\t\t\t\tif (contentid)\n\t\t\t\t\tthis._active_headers[contentid].value = value;\n\t\t\t}\n\n\t\t\t//remove old filters\n\t\t\tfor (let key in this._filter_elements){\n\t\t\t\tif (!obj.filter[key]){\n\t\t\t\t\tlet f = this._filter_elements[key];\n\t\t\t\t\tf[2].setValue(f[0], \"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t//restore and apply filtering\n\t\t\tthis.filterByAll = temp;\n\t\t\tthis.filterByAll();\n\t\t}\n\n\t\tif (obj.select && this.select){\n\t\t\tlet select = obj.select;\n\t\t\tthis.unselect();\n\t\t\tfor (let i = 0; i < select.length; i++)\n\t\t\t\tif (!select[i].row || this.exists(select[i].row))\n\t\t\t\t\tthis._select(select[i], true);\n\t\t}\n\n\t\tif(obj.scroll)\n\t\t\tthis.scrollTo(obj.scroll.x, obj.scroll.y);\n\t}\n};\n\nexport default DataState;","import {pos, offset} from \"../webix/html\";\nimport {use} from \"../services\";\nimport env from \"../webix/env\";\nimport Touch from \"../core/touch\";\nimport {extend, delay, PowerArray} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport DragControl from \"../core/dragcontrol\";\nimport AutoScroll from \"../core/autoscroll\";\n\n\n/*\n\tBehavior:DragItem - adds ability to move items by dnd\n\t\n\tdnd context can have next properties\n\t\tfrom - source object\n\t\tto - target object\n\t\tsource - id of dragged item(s)\n\t\ttarget - id of drop target, null for drop on empty space\n\t\tstart - id from which DND was started\n*/\n\nconst DragItem ={\n\t//helper - defines component's container as active zone for dragging and for dropping\n\t_initHandlers:function(obj, source, target){\n\t\tif (!source) DragControl.addDrop(obj._contentobj,obj,true);\n\t\tif (!target) DragControl.addDrag(obj._contentobj,obj);\n\t\tthis.attachEvent(\"onDragOut\",function(a,b){ this.$dragMark(a,b); });\n\t\tthis.attachEvent(\"onBeforeAutoScroll\",function(){\n\t\t\tvar context = DragControl.getContext();\n\t\t\treturn !!(DragControl._active && context && (context.to === this || this._auto_scroll_force));\n\t\t});\n\t},\n\tdrag_setter:function(value){\n\t\tif (value){\n\t\t\textend(this, AutoScroll, true);\n\t\t\tif (value == \"order\")\n\t\t\t\textend(this, use(\"DragOrder\"), true);\n\t\t\tif (value == \"inner\")\n\t\t\t\tthis._inner_drag_only = true;\n\n\t\t\tthis._initHandlers(this, value == \"source\", value == \"target\");\n\t\t\tdelete this.drag_setter;\t//prevent double initialization\n\t\t}\n\t\treturn value;\n\t},\n\t/*\n\t\ts - source html element\n\t\tt - target html element\n\t\td - drop-on html element ( can be not equal to the target )\n\t\te - native html event \n\t*/\n\t//called when drag moved over possible target\n\t$dragIn:function(s,t,e){\n\t\tvar id = this.locate(e) || null;\n\t\tvar context = DragControl._drag_context;\n\n\t\t//in inner drag mode - ignore dnd from other components\n\t\tif ((this._inner_drag_only || context.from._inner_drag_only) && context.from !== this) return false;\n\n\t\tvar to = DragControl.getMaster(t);\n\t\t//previous target\n\t\tvar html = (this.getItemNode(id, e)||this._dataobj);\n\t\t//prevent double processing of same target\n\t\tif (html == DragControl._landing) return html;\n\t\tcontext.target = id;\n\t\tcontext.to = to;\n\n\t\tif (this._auto_scroll_delay)\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\n\t\tthis._auto_scroll_delay = delay(function(pos,id){\n\t\t\tthis._drag_pause(id);\n\t\t\tthis._auto_scroll(pos,id);\n\t\t}, this, [pos(e), id], 250);\n\n\t\tif (!this.$dropAllow(context, e) || !this.callEvent(\"onBeforeDragIn\",[context, e])){\n\t\t\tcontext.to = context.target = null;\n\t\t\tif (this._auto_scroll_delay)\n\t\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\t\t\treturn null;\n\t\t}\n\t\t//mark target only when landing confirmed\n\t\tthis.$dragMark(context,e);\n\t\treturn html;\n\t},\n\t$dropAllow:function(){\n\t\treturn true;\n\t},\n\t_drag_pause:function(){\n\t\t//may be reimplemented in some components\n\t\t// tree for example\n\t},\n\t_target_to_id:function(target){\n\t\treturn target && typeof target === \"object\" ? target.toString() : target;\n\t},\n\t//called when drag moved out from possible target\n\t$dragOut:function(s,t,n,e){ \n\t\tvar id = (this._viewobj.contains(n) ? this.locate(e): null) || null;\n\t\tvar context = DragControl._drag_context;\n\n\t\t//still over previous target\n\t\tif ((context.target||\"\").toString() == (id||\"\").toString()) return null;\n\t\tif (this._auto_scroll_delay){\n\t\t\tthis._auto_scroll_force = null;\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\t\t}\n\n\t\t//unmark previous target\n\t\tcontext.target = context.to = null;\n\t\tthis.callEvent(\"onDragOut\",[context,e]);\n\t\treturn null;\n\t},\n\t//called when drag moved on target and button is released\n\t$drop:function(s,t,e){ \n\t\tif (this._auto_scroll_delay)\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\n\t\tvar context = DragControl._drag_context;\n\t\t//finalize context details\n\t\tcontext.to = this;\n\t\tvar target = this._target_to_id(context.target);\n\n\t\tif (this.getBranchIndex){\n\t\t\tif (target){\n\t\t\t\tcontext.parent = this.getParentId(target);\n\t\t\t\tcontext.index = this.getBranchIndex(target);\n\t\t\t}\n\t\t} else\n\t\t\tcontext.index = target?this.getIndexById(target):this.count();\n\n\t\t//unmark last target\n\t\tthis.$dragMark({}, e);\n\n\t\tif( context.from && context.from != context.to && context.from.callEvent ){\n\t\t\tcontext.from.callEvent(\"onBeforeDropOut\", [context,e]);\n\t\t}\n\n\t\tif (!this.callEvent(\"onBeforeDrop\",[context,e])) return;\n\t\t//moving\n\t\tthis._context_to_move(context,e);\n\t\t\n\t\tthis.callEvent(\"onAfterDrop\",[context,e]);\n\t},\n\t_context_to_move:function(context){\n\t\tassert(context.from, \"Unsopported d-n-d combination\");\n\t\tif (context.from && context.from.move){\t//from different component with item dnd\n\t\t\tvar details = { parent: context.parent, mode: context.pos };\n\t\t\tcontext.from.move(context.source,context.index,context.to, details);\n\t\t}\n\t},\n\t_getDragItemPos: function(pos,e){\n\t\tif (this.getItemNode){\n\t\t\tvar id = this.locate(e, true);\n\t\t\t//in some case, node may be outiside of dom ( spans in datatable for example )\n\t\t\t//so getItemNode can return null\n\t\t\tvar node = id ? this.getItemNode(id) : null;\n\t\t\treturn node ? offset(node) : node;\n\t\t}\n\t},\n\t//called when drag action started\n\t$drag:function(s,e){\n\t\tvar id = this.locate(e, true);\n\t\tif (id){\n\t\t\tvar list = [id];\n\n\t\t\tif (this.getSelectedId && !this._do_not_drag_selection){ //has selection model\n\t\t\t\t//if dragged item is one of selected - drag all selected\n\t\t\t\tvar selection = this.getSelectedId(true, true);\t\n\n\t\t\t\tif (selection && selection.length > 1 && PowerArray.find.call(selection,id)!=-1){\n\t\t\t\t\tvar hash = {}; \n\t\t\t\t\tlist = [];\n\t\t\t\t\tfor (let i=0;i max)\n\t\t\t\t\tpos.x = max;\n\t\t\t}\n\t\t} else {\n\t\t\tbox.y += this._header_height;\n\t\t\tpos.x = this._drag_order_stored_left||box.x;\n\t\t\tpos.y = pos.y-18;\n\t\t\n\t\t\tif (pos.y < box.y)\n\t\t\t\tpos.y = box.y; \n\t\t\telse {\n\t\t\t\tlet max = box.y + this.$view.offsetHeight - 60;\n\t\t\t\tif (pos.y > max)\n\t\t\t\t\tpos.y = max;\n\t\t\t}\n\t\t}\n\n\t\tif (this._auto_scroll_delay)\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\n\t\tthis._auto_scroll_delay = delay(this._auto_scroll, this, [getPos(e), this.locate(e) || null],250);\n\n\t\t//prevent normal dnd landing checking\n\t\tDragControl._skip = true;\n\t},\n\t$dragIn:function(){\n\t\treturn false;\n\t},\n\t$drop:function(s,t,e){\n\t\tif (this._auto_scroll_delay){\n\t\t\tthis._auto_scroll_force = null;\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\t\t}\n\n\t\tvar context = DragControl.getContext();\n\t\tvar id = context.start;\n\t\tthis.removeCss(id, \"webix_transparent\");\n\n\t\tvar index = this.getIndexById(id);\n\t\tthis.callEvent(\"onAfterDropOrder\",[id, index , e]);\n\t\tif (context.fragile)\n\t\t\tthis.refresh();\n\t}\n};\n\ndefine(\"DragOrder\", DragOrder);\n\nexport default DragOrder;","import {extend, copy, PowerArray} from \"../webix/helpers\";\n\n\nconst Undo = {\n\t$init:function(){\n\t\tthis._undoHistory = extend([],PowerArray,true);\n\t\tthis._undoCursor = -1;\n\t},\n\tundo_setter: function(value){\n\t\tif(value){\n\t\t\tthis._init_undo();\n\t\t\tthis._init_undo = function(){};\n\t\t}\n\t\treturn value;\n\t},\n\t_init_undo: function(){\n\t\tvar view = this;\n\n\t\t// drag-n-drop\n\t\tthis.attachEvent(\"onBeforeDrop\", function(context){\n\t\t\tif(context.from == context.to){\n\t\t\t\tvar item = view._draggedItem = copy(this.getItem(context.start));\n\t\t\t\tif(this.data.branch){\n\t\t\t\t\titem.$index = this.getBranchIndex(item.id);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\titem.$index = this.getIndexById(item.id);\n\t\t\t}\n\t\t});\n\t\tthis.data.attachEvent(\"onDataMove\", function( sid ){\n\t\t\tif(view._draggedItem && view._draggedItem.id == sid){\n\t\t\t\tvar data = view._draggedItem;\n\t\t\t\tview._draggedItem = null;\n\t\t\t\tview._addToHistory(sid, data, \"move\");\n\t\t\t}\n\t\t});\n\n\t\t// add, remove\n\t\tthis.data.attachEvent(\"onBeforeDelete\", function(id){\n\t\t\tif(this.getItem(id)){\n\t\t\t\tvar item = view._deletedItem = copy(this.getItem(id));\n\t\t\t\tif(this.branch){\n\t\t\t\t\titem.$index = this.getBranchIndex(id);\n\t\t\t\t\tif(this.branch[id])\n\t\t\t\t\t\titem.$branch = copy(this.serialize(id));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\titem.$index = this.getIndexById(id);\n\t\t\t}\n\t\t});\n\t\tthis.data.attachEvent(\"onDataUpdate\", function(id, data, old){\n\t\t\tview._addToHistory(id+\"\", old, \"update\");\n\t\t});\n\t\tthis.data.attachEvent(\"onStoreUpdated\", function(id, item, mode){\n\t\t\tvar data = null;\n\t\t\tif(id){\n\t\t\t\tif(mode == \"add\"){\n\t\t\t\t\tdata = copy(item);\n\t\t\t\t}\n\t\t\t\telse if( mode == \"delete\") {\n\t\t\t\t\tdata = view._deletedItem;\n\t\t\t\t}\n\n\t\t\t\tif(data)\n\t\t\t\t\tview._addToHistory(id, data, mode);\n\t\t\t}\n\t\t});\n\n\t\t// id change\n\t\tthis.data.attachEvent(\"onIdChange\", function(oldId,newId){\n\t\t\tif(typeof oldId == \"object\")\n\t\t\t\toldId = oldId.row;\n\t\t\tfor(var i =0; i < view._undoHistory.length; i++){\n\t\t\t\tif(view._undoHistory[i].id == oldId){\n\t\t\t\t\tview._undoHistory[i].id = newId;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\t_addToHistory: function(id, data, action){\n\t\tif(!this._skipHistory && this._settings.undo){\n\t\t\tthis._undoHistory.push({id: id, action: action, data: data});\n\t\t\tif(this._undoHistory.length==20)\n\t\t\t\tthis._undoHistory.splice(0,1);\n\t\t\tif(!this._skipCursorInc)\n\t\t\t\tthis._undoCursor = this._undoHistory.length - 1;\n\t\t}\n\t},\n\tignoreUndo: function(func, master){\n\t\tthis._skipHistory = true;\n\t\tfunc.call(master||this);\n\t\tthis._skipHistory = false;\n\t},\n\tremoveUndo: function(id){\n\t\tfor( var i = this._undoHistory.length-1; i >=0; i--){\n\t\t\tif(this._undoHistory[i].id == id){\n\t\t\t\tif(this._undoHistory[i].action == \"id\"){\n\t\t\t\t\tid = this._undoHistory[i].data;\n\t\t\t\t}\n\t\t\t\tthis._undoHistory.removeAt(i);\n\t\t\t}\n\t\t}\n\t\tthis._undoCursor = this._undoHistory.length - 1;\n\t},\n\tundo: function(id){\n\t\tif(id){\n\t\t\tthis.ignoreUndo(function(){\n\t\t\t\tvar data, i;\n\t\t\t\tfor( i = this._undoHistory.length-1; !data && i >=0; i--){\n\t\t\t\t\tif(this._undoHistory[i].id == id)\n\t\t\t\t\t\tdata = this._undoHistory[i];\n\t\t\t\t}\n\n\t\t\t\tif(data){\n\t\t\t\t\t/*if(data.action == \"id\")\n\t\t\t\t\t\tid = data.data;*/\n\t\t\t\t\tthis._undoAction(data);\n\t\t\t\t\tthis._undoHistory.removeAt(i+1);\n\t\t\t\t\tthis._undoCursor = this._undoHistory.length - 1;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\telse{\n\t\t\tvar data = this._undoHistory[this._undoCursor];\n\t\t\tif(data){\n\t\t\t\tthis.ignoreUndo(function(){\n\t\t\t\t\tthis._undoAction(data);\n\t\t\t\t\tthis._undoHistory.removeAt(this._undoCursor);\n\t\t\t\t});\n\t\t\t\tthis._undoCursor--;\n\t\t\t\t/*if(data.action == \"id\")\n\t\t\t\t\tthis.undo();*/\n\t\t\t}\n\t\t}\n\t},\n\t_undoAction: function(obj){\n\t\tif(obj.action == \"delete\"){\n\t\t\tvar branch = null,\n\t\t\t\tparentId = obj.data.$parent;\n\n\t\t\tif(obj.data.$branch){\n\t\t\t\tbranch = {\n\t\t\t\t\tparent: obj.id,\n\t\t\t\t\tdata: copy(obj.data.$branch)\n\t\t\t\t};\n\t\t\t\tdelete obj.data.$branch;\n\t\t\t\tif(parentId && !this.data.branch[parentId])\n\t\t\t\t\tparentId = 0;\n\t\t\t}\n\n\t\t\tthis.add(obj.data, obj.data.$index, parentId);\n\t\t\tif(branch){\n\t\t\t\tthis.parse(branch);\n\t\t\t}\n\t\t}\n\t\telse if(obj.action == \"add\"){\n\t\t\tthis.remove(obj.id);\n\t\t}\n\t\telse if(obj.action == \"update\"){\n\t\t\tthis.updateItem(obj.id, obj.data);\n\t\t}\n\t\telse if(obj.action == \"move\"){\n\t\t\tif(obj.data.$parent){\n\t\t\t\tif(this.getItem(obj.data.$parent))\n\t\t\t\t\tthis.move(obj.id, obj.data.$index, null, {parent: obj.data.$parent});\n\t\t\t}\n\t\t\telse\n\t\t\t\tthis.move(obj.id, obj.data.$index);\n\t\t}\n\t\t/*else if(obj.action == \"id\"){\n\t\t\tthis.data.changeId(obj.id, obj.data);\n\t\t}*/\n\t}\n};\n\nexport default Undo;","\n\nimport {create} from \"../webix/html\";\nimport {isArray, isUndefined, copy, toNode, bind, extend} from \"../webix/helpers\";\nimport {ui, $$} from \"../ui/core\";\nimport i18n from \"../webix/i18n\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\nimport {callEvent} from \"../webix/customevents\";\n\n\nfunction init_suggest(editor, input){\n\tvar suggest = editor.config.suggest;\n\tif (suggest){\n\t\tvar box = editor.config.suggest = create_suggest(suggest);\n\t\tvar boxobj = $$(box);\n\t\tif (boxobj && input)\n\t\t\tboxobj.linkInput(input);\n\t}\n}\n\nfunction create_suggest(config){\n\tif (typeof config == \"string\") return config;\n\tif (config.linkInput) return config._settings.id;\n\n\n\tif (typeof config == \"object\"){\n\t\tif (isArray(config))\n\t\t\tconfig = { data: config };\n\t\tconfig.view = config.view || \"suggest\";\n\t} else if (config === true)\n\t\tconfig = { view:\"suggest\" };\n\n\tvar obj = ui(config);\n\treturn obj.config.id;\n}\n\nfunction getLabel(config){\n\tvar text = config.header && config.header[0]?config.header[0].text:config.editValue || config.label;\n\treturn (text || \"\").toString().replace(/<[^>]*>/g, \"\");\n}\n\n/*\nthis.node - html node, available after render call\nthis.config - editor config\nthis.value - original value\nthis.popup - id of popup \n*/\nconst editors = {\n\t\"text\":{\n\t\tfocus:function(){\n\t\t\tthis.getInputNode(this.node).focus();\n\t\t\tthis.getInputNode(this.node).select();\n\t\t},\n\t\tgetValue:function(){\n\t\t\treturn this.getInputNode(this.node).value;\n\t\t},\n\t\tsetValue:function(value){\n\t\t\tvar input = this.getInputNode(this.node);\n\t\t\tinput.value = value;\n\n\t\t\tinit_suggest(this, input);\n\t\t},\n\t\tgetInputNode:function(){\n\t\t\treturn this.node.firstChild;\n\t\t},\n\t\trender:function(){\n\t\t\treturn create(\"div\", {\n\t\t\t\t\"class\":\"webix_dt_editor\"\n\t\t\t}, \"\");\n\t\t}\n\t},\n\t\"inline-checkbox\":{\n\t\trender:function(){ return {}; },\n\t\tgetValue:function(){\n\t\t\treturn this.node.checked;\n\t\t},\n\t\tsetValue:function(){},\n\t\tfocus:function(){\n\t\t\tthis.node.focus();\n\t\t},\n\t\tgetInputNode:function(){},\n\t\t$inline:true\n\t},\n\t\"inline-text\":{\n\t\trender:function(){ return {}; },\n\t\tgetValue:function(){\n\t\t\treturn this.node.value;\n\t\t},\n\t\tsetValue:function(){},\n\t\tfocus:function(){\n\t\t\ttry{\t//IE9\n\t\t\t\tthis.node.select();\n\t\t\t\tthis.node.focus();\n\t\t\t} catch(e){} //eslint-disable-line\n\t\t},\n\t\tgetInputNode:function(){},\n\t\t$inline:true\n\t},\n\t\"checkbox\":{\n\t\tfocus:function(){\n\t\t\tthis.getInputNode().focus();\n\t\t},\n\t\tgetValue:function(){\n\t\t\treturn this.getInputNode().checked;\n\t\t},\n\t\tsetValue:function(value){\n\t\t\tthis.getInputNode().checked = !!value;\n\t\t},\n\t\tgetInputNode:function(){\n\t\t\treturn this.node.firstChild.firstChild;\n\t\t},\n\t\trender:function(){\n\t\t\treturn create(\"div\", {\n\t\t\t\t\"class\":\"webix_dt_editor\"\n\t\t\t}, \"
\");\n\t\t}\n\t},\n\t\"select\":{\n\t\tfocus:function(){\n\t\t\tthis.getInputNode().focus();\n\t\t},\n\t\tgetValue:function(){\n\t\t\treturn this.getInputNode().value;\n\t\t},\n\t\tsetValue:function(value){\n\t\t\tthis.getInputNode().value = value;\n\t\t},\n\t\tgetInputNode:function(){\n\t\t\treturn this.node.firstChild;\n\t\t},\n\t\trender:function(){\n\t\t\tvar html = \"\";\n\t\t\tvar options = this.config.options || this.config.collection;\n\t\t\tassert(options,\"options not defined for select editor\");\n\n\t\t\tif (options.data && options.data.each)\n\t\t\t\toptions.data.each(function(obj){\n\t\t\t\t\thtml +=\"\";\n\t\t\t\t});\n\t\t\telse {\n\t\t\t\tif (isArray(options)){\n\t\t\t\t\tfor (var i=0; i\"+label+\"\";\n\t\t\t\t\t}\n\t\t\t\t} else for (var key in options){\n\t\t\t\t\thtml +=\"\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn create(\"div\", {\n\t\t\t\t\"class\":\"webix_dt_editor\"\n\t\t\t}, \"\");\n\t\t}\n\t},\n\tpopup:{\n\t\tfocus:function(){\n\t\t\tthis.getInputNode().focus();\n\t\t},\n\t\tdestroy:function(){\n\t\t\tthis.getPopup().hide();\n\t\t},\n\t\tgetValue:function(){\n\t\t\treturn this.getInputNode().getValue()||\"\";\n\t\t},\n\t\tsetValue:function(value){\n\t\t\tthis.getPopup().show(this.node);\n\t\t\tthis.getInputNode().setValue(value);\n\t\t},\n\t\tgetInputNode:function(){\n\t\t\treturn this.getPopup().getChildViews()[0];\n\t\t},\n\t\tgetPopup:function(){\n\t\t\tif (!this.config.$popup)\n\t\t\t\tthis.config.$popup = this.createPopup();\n\n\t\t\treturn $$(this.config.$popup);\n\t\t},\n\t\tcreatePopup:function(){\n\t\t\tvar popup = this.config.popup || this.config.suggest;\n\t\t\tif (popup){\n\t\t\t\tvar pobj;\n\t\t\t\tif (typeof popup == \"object\" && !popup.name){\n\t\t\t\t\tpopup.view = popup.view || \"suggest\";\n\t\t\t\t\tpobj = ui(copy(popup));\n\t\t\t\t} else\n\t\t\t\t\tpobj = $$(popup);\n\n\t\t\t\t//custom popup may be linked already\n\t\t\t\tif(!pobj._linked){\n\t\t\t\t\tif (pobj.linkInput)\n\t\t\t\t\t\tpobj.linkInput(document.body);\n\t\t\t\t\telse if(this.linkInput)\n\t\t\t\t\t\tthis.linkInput(document.body);\n\t\t\t\t\tpobj._linked = true;\n\t\t\t\t}\n\n\t\t\t\treturn pobj;\n\t\t\t}\n\n\t\t\tvar type = editors.$popup[this.popupType];\n\t\t\tif (typeof type != \"string\" && !type.name){\n\t\t\t\ttype = editors.$popup[this.popupType] = ui(type);\n\t\t\t\tthis.popupInit(type);\n\n\t\t\t\tif(!type.linkInput)\n\t\t\t\t\tthis.linkInput(document.body);\n\t\t\t\n\t\t\t}\n\t\t\treturn type._settings.id;\n\t\t},\n\t\tlinkInput:function(node){\n\t\t\t_event(toNode(node), \"keydown\", bind(function(e){\n\t\t\t//abort, when editor was not initialized yet\n\t\t\t\tif (!this.config.$popup) return;\n\n\t\t\t\tvar code = e.which || e.keyCode, list = this.getInputNode();\n\t\t\t\tif(!list.isVisible()) return;\n\n\t\t\t\tif(list.moveSelection && code < 41 && code > 32){\n\t\t\t\t\tvar dir;\n\t\t\t\t\tif(code == 33) dir = \"pgup\";\n\t\t\t\t\tif(code == 34) dir = \"pgdown\";\n\t\t\t\t\tif(code == 35) dir = \"bottom\";\n\t\t\t\t\tif(code == 36) dir = \"top\";\n\t\t\t\t\tif(code == 37) dir = \"left\";\n\t\t\t\t\tif(code == 38) dir = \"up\";\n\t\t\t\t\tif(code == 39) dir = \"right\";\n\t\t\t\t\tif(code == 40) dir = \"down\";\n\n\t\t\t\t\tlist.moveSelection(dir);\n\t\t\t\t} \n\t\t\t\t// shift+enter support for 'popup' editor\n\t\t\t\telse if(code === 13 && ( e.target.nodeName !==\"TEXTAREA\" || !e.shiftKey))\n\t\t\t\t\tcallEvent(\"onEditEnd\", []);\n\t\t\t\n\t\t\t}, this));\n\t\t},\n\n\t\tpopupInit:function(){},\n\t\tpopupType:\"text\",\n\t\trender\t:function(){ return {}; },\n\t\t$inline:true\n\t}\n};\n\neditors.color = extend({\n\tfocus\t:function(){},\n\tpopupType:\"color\",\n\tpopupInit:function(popup){\n\t\tpopup.getChildViews()[0].attachEvent(\"onItemClick\", function(value){\n\t\t\tcallEvent(\"onEditEnd\",[value]);\n\t\t});\n\t}\n}, editors.popup);\n\neditors.date = extend({\n\tfocus\t:function(){},\n\tpopupType:\"date\",\n\tsetValue:function(value){\n\t\tthis._is_string = this.config.stringResult || (value && typeof value == \"string\");\n\t\teditors.popup.setValue.call(this, value);\n\t},\n\tgetValue:function(){\n\t\treturn this.getInputNode().getValue(this._is_string?i18n.parseFormatStr:\"\")||\"\";\n\t},\n\tpopupInit:function(popup){\n\t\tpopup.getChildViews()[0].attachEvent(\"onDateSelect\", function(value){\n\t\t\tcallEvent(\"onEditEnd\",[value]);\n\t\t});\n\t}\n}, editors.popup);\n\neditors.combo = extend({\n\t_create_suggest:function(config){\n\t\tif(this.config.popup){\n\t\t\treturn this.config.popup.config.id;\n\t\t}\n\t\telse if (config){\n\t\t\treturn create_suggest(config);\n\t\t} else\n\t\t\treturn this._shared_suggest(config);\n\t},\n\t_shared_suggest:function(){\n\t\tvar e = editors.combo;\n\t\treturn (e._suggest = e._suggest || this._create_suggest(true));\n\t},\n\trender:function(){\n\t\tvar node = create(\"div\", {\n\t\t\t\"class\":\"webix_dt_editor\"\n\t\t}, \"\");\n\n\t\t//save suggest id for future reference\t\t\n\t\tvar suggest = this.config.suggest = this._create_suggest(this.config.suggest);\n\n\t\tif (suggest){\n\t\t\t$$(suggest).linkInput(node.firstChild, true);\n\t\t\t_event(node.firstChild, \"click\",bind(this.showPopup, this));\n\t\t}\n\t\treturn node;\n\t},\n\tgetPopup:function(){\n\t\treturn $$(this.config.suggest);\n\t},\n\tshowPopup:function(){\n\t\tvar popup = this.getPopup();\n\t\tvar list = popup.getList();\n\t\tvar input = this.getInputNode();\n\t\tvar value = this._initial_value;\n\n\t\tpopup.show(input);\n\t\tinput.setAttribute(\"aria-expanded\", \"true\");\n\t\tif(value ){\n\t\t\tassert(list.exists(value), \"Option with ID \"+value+\" doesn't exist\");\n\t\t\tif(list.exists(value)){\n\t\t\t\tlist.select(value);\n\t\t\t\tlist.showItem(value);\n\t\t\t}\n\t\t}else{\n\t\t\tlist.unselect();\n\t\t\tlist.showItem(list.getFirstId());\n\t\t}\n\t\tpopup._last_input_target = input;\n\t},\n\tafterRender:function(){\n\t\tthis.showPopup();\n\t},\n\tsetValue:function(value){\n\t\tthis._initial_value = value;\n\t\tif (this.config.suggest){\n\t\t\tvar sobj = $$(this.config.suggest);\n\t\t\tvar data = this.config.collection || this.config.options;\n\t\t\tif (data)\n\t\t\t\tsobj.getList().data.importData(data);\n\n\t\t\tthis.getInputNode(this.node).value = sobj.getItemText(value);\n\t\t}\n\t},\n\tgetValue:function(){\n\t\tvar value = this.getInputNode().value;\n\t\tif (this.config.suggest){\n\t\t\tvar suggest = $$(this.config.suggest),\n\t\t\t\tlist = suggest.getList();\n\t\t\tif (value || (list.getSelectedId && list.getSelectedId()))\t\n\t\t\t\tvalue = suggest.getSuggestion(value);\n\t\t}\n\t\n\t\treturn value;\n\t}\n}, editors.text);\n\n\neditors.richselect = extend({\n\tfocus:function(){},\n\tgetValue:function(){\n\t\treturn this.getPopup().getValue();\n\t},\n\tsetValue:function(value){\n\t\tvar suggest = this.config.collection || this.config.options;\n\t\tthis.getInputNode();\n\t\tif (suggest)\n\t\t\tthis.getPopup().getList().data.importData(suggest);\n\n\t\tthis.getPopup().show(this.node);\n\t\tthis.getPopup().setValue(value);\n\t},\n\tgetInputNode:function(){\n\t\treturn this.getPopup().getList();\n\t},\n\tpopupInit:function(popup){\n\t\tpopup.linkInput(document.body);\n\t},\n\tpopupType:\"richselect\"\n}, editors.popup);\n\neditors.password = extend({\n\trender:function(){\n\t\treturn create(\"div\", {\n\t\t\t\"class\":\"webix_dt_editor\"\n\t\t}, \"\");\n\t}\n}, editors.text);\n\neditors.$popup = {\n\ttext:{\n\t\tview:\"popup\", width:250, height:150,\n\t\tbody:{ view:\"textarea\" }\n\t},\n\tcolor:{\n\t\tview:\"popup\",\n\t\tbody:{ view:\"colorboard\" }\n\t},\n\tdate:{\n\t\tview:\"popup\", width:250, height:250, padding:0,\n\t\tbody:{ view:\"calendar\", icons:true, borderless:true }\n\t},\n\trichselect:{\n\t\tview:\"suggest\",\n\t\tbody:{ view:\"list\", select:true }\n\t},\n\tmultiselect:{\n\t\tview:\"multisuggest\",\n\t\tsuggest:{\n\t\t\tbutton:true\n\t\t}\n\t}\n};\n\nexport default editors;","import {remove, removeCss, addCss} from \"../webix/html\";\nimport UIManager from \"../core/uimanager\";\nimport {extend, bind, delay, isUndefined} from \"../webix/helpers\";\nimport {ui, $$} from \"../ui/core\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\nimport {attachEvent, callEvent} from \"../webix/customevents\";\nimport Undo from \"../core/undo\";\n\n\nimport globalState from \"../core/state\";\nimport editors from \"../webix/editors\";\n/*\n\tBehavior:EditAbility - enables item operation for the items\n\t\n\t@export\n\t\tedit\n\t\tstopEdit\n*/\n\nconst EditAbility ={\n\tdefaults:{\n\t\teditaction:\"click\"\n\t},\n\t$init:function(config){\n\t\tthis._editors = {};\n\t\tthis._in_edit_mode = 0;\n\t\tthis._edit_open_time = 0;\n\t\tthis._contentobj.style.position = \"relative\";\n\t\tif (config)\n\t\t\tconfig.onDblClick = config.onDblClick || {};\n\n\t\tthis.attachEvent(\"onAfterRender\", this._refocus_inline_editor);\n\n\t\t//when we call extend the editable prop can be already set\n\t\tif (this._settings.editable)\n\t\t\tthis._init_edit_events_once();\n\n\t\textend(this,Undo);\n\t},\n\t_refocus_try:function(newnode){\n\t\ttry{ //Chrome throws an error if selectionStart is not accessible\n\t\t\tif (typeof newnode.selectionStart == \"number\") {\n\t\t\t\tnewnode.selectionStart = newnode.selectionEnd = newnode.value.length;\n\t\t\t} else if (typeof newnode.createTextRange != \"undefined\") {\n\t\t\t\tvar range = newnode.createTextRange();\n\t\t\t\trange.collapse(false);\n\t\t\t\trange.select();\n\t\t\t}\n\t\t} catch(e){} // eslint-disable-line\n\t},\n\t_refocus_inline_editor:function(){\n\t\tvar editor = this.getEditor();\n\t\tif (editor && editor.$inline && !editor.getPopup){\n\t\t\tvar newnode = this._locateInput(editor);\n\t\t\tif (newnode && newnode != editor.node){\n\t\t\t\tvar text = editor.node.value;\n\t\t\t\teditor.node = newnode;\n\t\t\t\tnewnode.value = text;\n\t\t\t\tnewnode.focus();\n\n\t\t\t\tthis._refocus_try(newnode);\n\t\t\t} else \n\t\t\t\tthis.editStop();\n\t\t}\n\t},\n\teditable_setter:function(value){\n\t\tif (value)\n\t\t\tthis._init_edit_events_once();\n\t\treturn value;\n\t},\n\t_init_edit_events_once:function(){\n\t\t//will close editor on any click outside\n\t\tattachEvent(\"onEditEnd\", bind(function(){\n\t\t\tif (this._in_edit_mode)\n\t\t\t\tthis.editStop();\n\t\t}, this));\n\t\tattachEvent(\"onClick\", bind(function(e){\n\t\t\t//but ignore click which opens editor\n\t\t\tif (this._in_edit_mode && (new Date())-this._edit_open_time > 200){\n\t\t\t\tif (!this._last_editor || this._last_editor.popupType || !e || ( !this._last_editor.node || !this._last_editor.node.contains(e.target || e.srcElement)))\n\t\t\t\t\tthis.editStop();\n\t\t\t}\n\t\t}, this));\n\t\t\n\t\t//property sheet has simple data object, without events\n\t\tif (this.data.attachEvent)\n\t\t\tthis.data.attachEvent(\"onIdChange\", bind(function(oldid, newid){\n\t\t\t\tthis._changeEditorId(oldid, newid);\n\t\t\t}, this));\n\n\t\t//when clicking on row - will start editor\n\t\tthis.attachEvent(\"onItemClick\", function(id){\n\t\t\tif (this._settings.editable && this._settings.editaction == \"click\")\n\t\t\t\tthis.edit(id);\n\t\t});\n\t\tthis.attachEvent(\"onItemDblClick\", function(id){\n\t\t\tif (this._settings.editable && this._settings.editaction == \"dblclick\")\n\t\t\t\tthis.edit(id);\n\t\t});\n\t\t//each time when we clicking on input, reset timer to prevent self-closing\n\t\tthis._reset_active_editor = bind(function(){\n\t\t\tthis._edit_open_time = new Date();\n\t\t},this);\n\n\t\tthis._init_edit_events_once = function(){};\n\n\t\tif (this._component_specific_edit_init)\n\t\t\tthis._component_specific_edit_init();\n\t},\n\t_handle_live_edits:function(){\n\t\tdelay(function(){\n\t\t\tvar editor = this.getEditor();\n\t\t\tif (editor && editor.config.liveEdit){\n\t\t\t\tvar state = { value:editor.getValue(), old: editor.value };\n\t\t\t\tif (state.value == state.old) return;\n\n\t\t\t\teditor.value = state.value;\n\t\t\t\tthis._set_new_value(editor, state.value, false);\n\t\t\t\tthis.callEvent(\"onLiveEdit\", [state, editor]);\n\t\t\t}\n\t\t}, this);\n\t},\n\t_show_editor_form:function(id){\n\t\tvar form = this._settings.form;\n\t\tif (typeof form != \"string\")\n\t\t\tthis._settings.form = form = ui(form).config.id;\n\n\t\tform = $$(form);\n\t\tvar realform = form.setValues?form:form.getChildViews()[0];\n\n\t\t\n\t\trealform.setValues(this.getItem(id.row || id));\n\t\tform.config.master = this.config.id;\n\t\tform.show( this.getItemNode(id) );\n\n\t\tvar first = realform.getChildViews()[0];\n\t\tif (first.focus)\n\t\t\tfirst.focus();\n\t},\n\tedit:function(id, preserve, show){\n\t\tif (!this._settings.editable || !this.callEvent(\"onBeforeEditStart\", [id])) return;\n\t\tif (this._settings.form)\n\t\t\treturn this._show_editor_form(id);\n\n\t\tvar editor = this._get_editor_type(id);\n\t\tif (editor){\n\t\t\tif (this.getEditor(id)) return;\n\t\t\tif (!preserve) this.editStop();\n\n\t\t\t//render html input\n\t\t\tassert(editors[editor], \"Invalid editor type: \"+editor);\n\t\t\tvar type = extend({}, editors[editor]);\n\t\t\t\n\t\t\tvar node = this._init_editor(id, type, show);\n\t\t\tif (type.config.liveEdit)\n\t\t\t\tthis._live_edits_handler = this.attachEvent(\"onKeyPress\", this._handle_live_edits);\n\n\t\t\tvar area = type.getPopup?type.getPopup(node)._viewobj:node;\n\n\t\t\tif (area)\n\t\t\t\t_event(area, \"click\", this._reset_active_editor);\n\t\t\tif (node)\n\t\t\t\t_event(node, \"change\", this._on_editor_change, { bind:{ view:this, id:id }});\n\t\t\tif (show !== false)\n\t\t\t\ttype.focus();\n\n\t\t\tif (this.$fixEditor)\n\t\t\t\tthis.$fixEditor(type);\n\n\t\t\t//save time of creation to prevent instant closing from the same click\n\t\t\tthis._edit_open_time = globalState.edit_open_time = new Date();\n\n\t\t\tUIManager.setFocus(this, true);\n\t\t\tthis.callEvent(\"onAfterEditStart\", [id]);\n\t\t\treturn type;\n\t\t}\n\t\treturn null;\n\t},\n\tgetEditor:function(id){\n\t\tif (!id)\n\t\t\treturn this._last_editor;\n\n\t\treturn this._editors[id];\n\t},\n\t_changeEditorId:function(oldid, newid)\t{\n\t\tvar editor = this._editors[oldid];\n\t\tif (editor){\n\t\t\tthis._editors[newid] = editor;\n\t\t\teditor.id = newid;\n\t\t\tdelete this._editors[oldid];\n\t\t}\n\t},\n\t_on_editor_change:function(){\n\t\tif (this.view.hasEvent(\"onEditorChange\"))\n\t\t\tthis.view.callEvent(\"onEditorChange\", [this.id, this.view.getEditorValue(this.id) ]);\n\t},\n\t_get_edit_config:function(){\n\t\treturn this._settings;\n\t},\n\t_init_editor:function(id, type, show){\n\t\ttype.config = this._get_edit_config(id);\n\t\tvar node = type.render();\n\n\t\tif (type.$inline)\n\t\t\tnode = this._locateInput(id);\n\t\ttype.node = node;\n\n\t\tvar item = this.getItem(id);\n\t\t//value can be configured by editValue option\n\t\tvar value = item[this._settings.editValue||\"value\"];\n\t\t//if property was not defined - use empty value\n\t\tif (isUndefined(value))\n\t\t\tvalue = \"\";\n\n\t\ttype.setValue(value, item);\n\t\ttype.value = value;\n\n\t\tthis._addEditor(id, type);\n\n\t\t//show it over cell\n\t\tif (show !== false)\n\t\t\tthis.showItem(id);\n\t\tif (!type.$inline)\n\t\t\tthis._sizeToCell(id, node, true);\n\n\t\tif (type.afterRender)\n\t\t\ttype.afterRender();\n\n\t\treturn node;\n\t},\n\t_locate_cell:function(id){\n\t\treturn this.getItemNode(id);\n\t},\n\t_locateInput:function(id){\n\t\tvar cell = this._locate_cell(id);\n\t\tif (cell)\n\t\t\tcell = cell.getElementsByTagName(\"input\")[0] || cell;\n\n\t\treturn cell;\n\t},\n\t_get_editor_type:function(){\n\t\treturn this._settings.editor;\n\t},\n\t_addEditor:function(id, type){\n\t\ttype.id = id;\n\t\tthis._editors[id]= this._last_editor = type;\n\t\tthis._in_edit_mode++;\n\t},\n\t_removeEditor:function(editor){\n\t\tif (this._last_editor == editor)\n\t\t\tthis._last_editor = 0;\n\t\t\n\t\tif (editor.destroy)\n\t\t\teditor.destroy();\n\n\t\tdelete editor.popup;\n\t\tdelete editor.node;\n\n\t\tdelete this._editors[editor.id];\n\t\tthis._in_edit_mode--;\n\t},\n\tfocusEditor:function(){\n\t\tvar editor = this.getEditor.apply(this, arguments);\n\t\tif (editor && editor.focus)\n\t\t\teditor.focus();\n\t},\n\teditCancel:function(){\n\t\tthis.editStop(null, null, true);\n\t},\n\t_applyChanges: function(el){\n\t\tif (el){\n\t\t\tvar ed = this.getEditor();\n\t\t\tif (ed && ed.getPopup && ed.getPopup() == el.getTopParentView()) return;\n\t\t}\n\t\tthis.editStop();\n\t},\n\teditStop:function(id){\n\t\tif (this._edit_stop) return;\n\t\tthis._edit_stop = 1;\n\n\n\t\tvar cancel = arguments[2];\n\t\tvar result = 1;\n\t\tif (!id){\n\t\t\tthis._for_each_editor(function(editor){\n\t\t\t\tresult = result * this._editStop(editor, cancel);\n\t\t\t});\n\t\t} else \n\t\t\tresult = this._editStop(this._editors[id], cancel);\n\n\t\tthis._edit_stop = 0;\n\t\treturn result;\n\t},\n\t_cellPosition:function(id){\n\t\tvar html = this.getItemNode(id);\n\t\treturn {\n\t\t\tleft:html.offsetLeft, \n\t\t\ttop:html.offsetTop,\n\t\t\theight:html.offsetHeight,\n\t\t\twidth:html.offsetWidth,\n\t\t\tparent:this._contentobj\n\t\t};\n\t},\n\t_sizeToCell:function(id, node, inline){\n\t\t//fake inputs\n\t\tif (!node.style) return;\n\n\t\tvar pos = this._cellPosition(id);\n\n\t\tnode.style.top = pos.top + \"px\";\n\t\tnode.style.left = pos.left + \"px\";\n\n\t\tnode.style.width = pos.width-1+\"px\";\n\t\tnode.style.height = pos.height-1+\"px\";\n\n\t\tnode.top = pos.top; //later will be used during y-scrolling\n\n\t\tif (inline) pos.parent.appendChild(node);\n\t},\n\t_for_each_editor:function(handler){\n\t\tfor (var editor in this._editors)\n\t\t\thandler.call(this, this._editors[editor]);\n\t},\n\t_editStop:function(editor, ignore){\n\t\tif (!editor || globalState._final_destruction) return;\n\t\tvar state = { \n\t\t\tvalue : editor.getValue(), \n\t\t\told : editor.value\n\t\t};\n\t\tif (this.callEvent(\"onBeforeEditStop\", [state, editor, ignore])){\n\t\t\tif (!ignore){\n\t\t\t\t//special case, state.old = 0, state.value = \"\"\n\t\t\t\t//we need to state.old to string, to detect the change\n\t\t\t\tvar old = state.old;\n\t\t\t\tif (typeof state.value == \"string\") old += \"\";\n\n\t\t\t\tif (old != state.value || editor.config.liveEdit){\n\t\t\t\t\tvar item = this._set_new_value(editor, state.value, true);\n\t\t\t\t\tthis.updateItem(editor.row || editor.id, item);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (editor.$inline)\n\t\t\t\teditor.node = null;\n\t\t\telse\n\t\t\t\tremove(editor.node);\n\n\t\t\tvar popup = editor.config.suggest;\n\t\t\tif (popup && typeof popup == \"string\")\n\t\t\t\t$$(popup).hide();\n\n\t\t\tthis._removeEditor(editor);\n\t\t\tif (this._live_edits_handler)\n\t\t\t\tthis.detachEvent(this._live_edits_handler);\n\n\t\t\tthis.callEvent(\"onAfterEditStop\", [state, editor, ignore]);\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t},\n\tvalidateEditor:function(id){\n\t\tvar result = true;\n\t\tif (this._settings.rules){\n\t\t\tvar editor = this.getEditor(id);\n\t\t\tvar key = editor.column||this._settings.editValue||\"value\";\n\t\t\tvar rule = this._settings.rules[key];\n\t\t\tvar all = this._settings.rules.$all;\n\n\t\t\tif (rule || all){\n\t\t\t\tvar obj = this.data.getItem(editor.row||editor.id);\n\t\t\t\tvar value = editor.getValue();\n\t\t\t\tvar input = editor.getInputNode();\n\n\t\t\t\tif (rule)\n\t\t\t\t\tresult = rule.call(this, value, obj, key);\n\t\t\t\tif (all)\n\t\t\t\t\tresult = all.call(this, value, obj, key) && result;\n\t\t\t\n\t\t\t\tif (result)\n\t\t\t\t\tremoveCss(input, \"webix_invalid\");\n\t\t\t\telse\n\t\t\t\t\taddCss(input, \"webix_invalid\");\n\n\t\t\t\tcallEvent(\"onLiveValidation\", [editor, result, obj, value]);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t},\n\tgetEditorValue:function(id){\n\t\tvar editor;\n\t\tif (arguments.length === 0)\n\t\t\teditor = this._last_editor;\n\t\telse\n\t\t\teditor = this.getEditor(id);\n\n\t\tif (editor)\n\t\t\treturn editor.getValue();\n\t},\n\tgetEditState:function(){\n\t\treturn this._last_editor || false;\n\t},\n\teditNext:function(next, from){ \n\t\tnext = next !== false; //true by default\n\t\tif (this._in_edit_mode == 1 || from){\n\t\t\t//only if one editor is active\n\t\t\tvar editor_next = this._find_cell_next((this._last_editor || from), function(id){\n\t\t\t\tif (this._get_editor_type(id))\n\t\t\t\t\treturn true;\n\t\t\t\treturn false;\n\t\t\t}, next);\n\n\t\t\tif (this.editStop()){\t//if we was able to close previous editor\n\t\t\t\tif (editor_next){\t//and there is a new target\n\t\t\t\t\tthis.edit(editor_next);\t//init new editor\n\t\t\t\t\tthis._after_edit_next(editor_next);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t},\n\t//stab, used in datatable\n\t_after_edit_next:function(){},\n\t_find_cell_next:function(start, check, direction){\n\t\tvar row = this.getIndexById(start.id);\n\t\tvar order = this.data.order;\n\t\t\n\t\tif (direction){\n\t\t\tfor (let i=row+1; i=0; i--){\n\t\t\t\tif (check.call(this, order[i]))\n\t\t\t\t\treturn order[i];\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\t_set_new_value:function(editor, new_value, copy){\n\t\tvar item = copy ? {} : this.getItem(editor.id);\n\t\titem[this._settings.editValue||\"value\"] = new_value;\n\t\treturn item;\n\t}\n};\n\nexport default EditAbility;","import {debug_size_box_start, debug_size_box_end} from \"../webix/debug\";\n\n\nconst FlexLayout = {\n\t$init:function(){\n\t\tthis.$view.className += \" webix_flexlayout\";\n\t},\n\t_fix_vertical_layout:function(){\n\n\t},\n\t_beforeResetBorders:function(){\n\n\t},\n\t_afterResetBorders:function(){\n\n\t},\n\t$getSize:function(){\n\t\tif (DEBUG) debug_size_box_start(this, true);\n\t\t\n\t\tvar w=0, h=0, g = this._settings.gravity;\n\t\tthis._sizes = [];\n\n\t\tfor (var i=0; i max) max = property(data[i])*1;\n\n\t\treturn max*1;\n\t},\n\tcount:function(property, data){\n\t\tvar count = 0;\n\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\tvar some = property(data[i]);\n\t\t\tif (some !== null && typeof some !== \"undefined\")\n\t\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t},\n\tany:function(property, data){\n\t\treturn property(data[0]);\n\t},\n\tstring:function(property){\n\t\treturn property.$name;\n\t}\n};\n\nexport default GroupMethods;","import {toArray} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport GroupMethods from \"../core/groupmethods\";\n\n\nconst GroupStore = {\n\t$init:function(){\n\t\tthis.attachEvent(\"onClearAll\", this._reset_groups);\n\t},\n\t_reset_groups:function(){\n\t\tthis._not_grouped_order = this._not_grouped_pull = null;\n\t\tthis._group_level_count = 0;\n\t},\n\tungroup:function(skipRender){\n\t\tif (this.getBranchIndex)\n\t\t\treturn this._ungroup_tree.apply(this, arguments);\n\n\t\tif (this._not_grouped_order){\n\t\t\tthis.order = this._not_grouped_order;\n\t\t\tthis.pull = this._not_grouped_pull;\n\t\t\tthis._not_grouped_pull = this._not_grouped_order = null;\n\t\t\tif(!skipRender)\n\t\t\t\tthis.callEvent(\"onStoreUpdated\",[]);\n\t\t}\n\n\t},\n\t_group_processing:function(scheme){\n\t\tthis.blockEvent();\n\t\tthis.group(scheme);\n\t\tthis.unblockEvent();\n\t},\n\t_group_prop_accessor:function(val){\n\t\tif (typeof val == \"function\")\n\t\t\treturn val;\n\t\tvar acc = function(obj){ return obj[val]; };\n\t\tacc.$name = val;\n\t\treturn acc;\n\t},\t\n\tgroup:function(stats){ \n\t\tif (this.getBranchIndex)\n\t\t\treturn this._group_tree.apply(this, arguments);\n\n\t\tif(typeof stats == \"string\")\n\t\t\tstats = { by:stats, map:{}};\n\t\tvar input = typeof stats.by == \"function\" ? \"value\" : stats.by;\n\t\tvar key = this._group_prop_accessor(stats.by);\n\n\t\tif (!stats.map[input])\n\t\t\tstats.map[input] = [input, this._any];\n\t\t\t\n\t\tvar groups = {};\n\t\tvar labels = [];\n\t\tthis.each(function(data){\n\t\t\tvar current = key(data);\n\t\t\tif (!groups[current]){\n\t\t\t\tlabels.push({ id:current, $group:true, $row:stats.row });\n\t\t\t\tgroups[current] = toArray();\n\t\t\t}\n\t\t\tgroups[current].push(data);\n\t\t});\n\t\tfor (var prop in stats.map){\n\t\t\tvar functor = (stats.map[prop][1]||\"any\");\n\t\t\tvar property = this._group_prop_accessor(stats.map[prop][0]);\n\t\t\tif (typeof functor != \"function\"){\n\t\t\t\tassert(GroupMethods[functor], \"unknown grouping rule: \"+functor);\n\t\t\t\tfunctor = GroupMethods[functor];\n\t\t\t}\n\n\t\t\tfor (let i=0; i < labels.length; i++) {\n\t\t\t\tlabels[i][prop]=functor.call(this, property, groups[labels[i].id]);\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tthis._not_grouped_order = this.order;\n\t\tthis._not_grouped_pull = this.pull;\n\t\t\n\t\tthis.order = toArray();\n\t\tthis.pull = {};\n\t\tfor (let i=0; i < labels.length; i++){\n\t\t\tvar id = this.id(labels[i]);\n\t\t\tthis.pull[id] = labels[i];\n\t\t\tthis.order.push(id);\n\t\t\tif (this._scheme_init)\n\t\t\t\tthis._scheme_init(labels[i]);\n\t\t}\n\t\t\n\t\tthis.callEvent(\"onStoreUpdated\",[]);\n\t},\n\t_group_tree:function(input, parent){\n\t\tthis._group_level_count = (this._group_level_count||0) + 1;\n\n\t\t//supports simplified group by syntax\n\t\tvar stats;\n\t\tif (typeof input == \"string\"){\n\t\t\tstats = { by:this._group_prop_accessor(input), map:{} };\n\t\t\tstats.map[input] = [input];\n\t\t} else if (typeof input == \"function\"){\n\t\t\tstats = { by:input, map:{} };\n\t\t} else\n\t\t\tstats = input;\n\t\t\n\t\t//prepare\n\t\tvar level;\n\t\tif (parent)\n\t\t\tlevel = this.getItem(parent).$level;\n\t\telse {\n\t\t\tparent = 0;\n\t\t\tlevel = 0;\n\t\t}\n\t\t\n\t\tvar order = this.branch[parent];\n\t\tvar key = this._group_prop_accessor(stats.by);\n\t\t\n\t\t//run\n\t\tvar topbranch = [];\n\t\tvar labels = [];\n\t\tfor (let i=0; i= 0; i--) {\n\t\t\tif (this.pull[order[i]].$footer)\n\t\t\t\torder.splice(i,1);\n\t\t}\n\t\tthis._fix_group_levels(order, 0, 1);\n\n\t\tif (!skipRender)\n\t\t\tthis.callEvent(\"onStoreUpdated\",[]);\n\t},\n\t_fix_group_levels:function(branch, parent, level){\n\t\tif (parent)\n\t\t\tthis.getItem(parent).$count = branch.length;\n\n\t\tfor (var i = 0; i < branch.length; i++) {\n\t\t\tvar item = this.pull[branch[i]];\n\t\t\titem.$level = level;\n\t\t\titem.$parent = parent;\n\t\t\tvar next = this.branch[item.id];\n\t\t\tif (next)\n\t\t\t\tthis._fix_group_levels(next, item.id, level+1);\n\t\t}\n\t}\n};\n\nexport default GroupStore;","import {extend, bind} from \"../webix/helpers\";\nimport GroupStore from \"../core/groupstore\";\n\n\nconst Group = {\n\t$init:function(){\n\t\textend(this.data, GroupStore);\n\t\t//in case of plain store we need to remove store original dataset\n\t\tthis.data.attachEvent(\"onClearAll\",bind(function(){\n\t\t\tthis.data._not_grouped_order = this.data._not_grouped_pull = null;\n\t\t\tthis._group_level_count = 0;\n\t\t},this));\n\t},\n\tgroup:function(config){\n\t\tthis.data.ungroup(true);\n\t\tthis.data.group(config);\n\t},\n\tungroup:function(skipRender){\n\t\tthis.data.ungroup(skipRender);\n\t}\n};\n\nexport default Group;","import {preventEvent} from \"../webix/html\";\nimport {$active} from \"../webix/skin\";\nimport {isUndefined} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\n\n\n/*aria-style handling for options of multiple-value controls (radio, segmented, tabbar)*/\n\nconst HTMLOptions = {\n\t$init:function(){\n\t\tif($active.customRadio || this.addOption)\n\t\t\t_event( this.$view, \"keydown\", this._moveSelection, {bind:this});\n\t},\n\t_focus: function(){\n\t\tif(!this._settings.disabled && !this.queryView({disabled:true}, \"parent\")){\n\t\t\tvar input = this._getInputNode();\n\t\t\tif(input)\n\t\t\t\tfor(var i=0; istartCode && code <41){\n\t\t\tpreventEvent(e);\n\t\t\tvar index;\n\t\t\tvar inp = this._getInputNode();\n\n\t\t\tif(code == 35) index = inp.length-1;\n\t\t\telse if(code === 36 ) index = 0;\n\t\t\telse{\n\t\t\t\tvar dir = (code === 37 || code ===38)?-1:1;\n\t\t\t\tfor(var i =0; i=inp.length) index = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!isUndefined(index)){\n\t\t\t\tvar id = inp[index].getAttribute(\"button_id\");\n\t\t\t\tthis.setValue(id);\n\t\t\t\tinp[index].focus();\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default HTMLOptions;","import {create} from \"../webix/html\";\nimport env from \"../webix/env\";\nimport {uid} from \"../webix/helpers\";\nimport {proto} from \"../ui/core\";\n\n\nconst HtmlMap = proto({\n\t$init:function(key){\n\t\tthis._id = \"map_\"+uid();\n\t\tthis._key = key;\n\t\tthis._map = [];\n\t\tthis._areas = [];\n\t},\n\taddRect: function(id,points,userdata) {\n\t\tthis._createMapArea(id,\"RECT\",points,userdata);\n\t},\n\taddPoly: function(id,points,userdata) {\n\t\tthis._createMapArea(id,\"POLY\",points,userdata);\n\t},\n\t_createMapArea:function(id,shape,coords,userdata){\n\t\tvar extra_data = \"\";\n\t\tif(arguments.length==4) \n\t\t\textra_data = \"userdata='\"+userdata+\"'\";\n\t\tthis._map.push(\"\");\n\t\tthis._areas.push({index: userdata, points:coords});\n\n\t},\n\taddSector:function(id,alpha0,alpha1,x,y,R,ky,userdata){\n\t\tvar points = [];\n\t\tpoints.push(x);\n\t\tpoints.push(Math.floor(y*ky)); \n\t\tfor(var i = alpha0; i < alpha1; i+=Math.PI/18){\n\t\t\tpoints.push(Math.floor(x+R*Math.cos(i)));\n\t\t\tpoints.push(Math.floor((y+R*Math.sin(i))*ky));\n\t\t}\n\t\tpoints.push(Math.floor(x+R*Math.cos(alpha1)));\n\t\tpoints.push(Math.floor((y+R*Math.sin(alpha1))*ky));\n\t\tpoints.push(x);\n\t\tpoints.push(Math.floor(y*ky)); \n\t\t\n\t\treturn this.addPoly(id,points,userdata);\n\t},\n\thide:function(obj, data, mode){\n\t\tif (obj.querySelectorAll){\n\t\t\tvar nodes = obj.querySelectorAll(\"area[userdata=\\\"\"+data+\"\\\"]\");\n\t\t\tfor (var i = 0; i < nodes.length; i++){\n\t\t\t\tvar nod = nodes[i];\n\t\t\t\tif (mode){\n\t\t\t\t\tif (nod.getAttribute(\"coords\")){\n\t\t\t\t\t\tnod.coordsdis = nod.getAttribute(\"coords\");\n\t\t\t\t\t\tnod.setAttribute(\"coords\", \"\");\n\t\t\t\t\t\tnod.coords = \"\";\n\t\t\t\t\t}\n\t\t\t\t} else if (!mode){\n\t\t\t\t\tif (nod.coordsdis){\n\t\t\t\t\t\tnod.setAttribute(\"coords\", nod.coordsdis);\n\t\t\t\t\t\tnod.coords = nod.coordsdis;\n\t\t\t\t\t\tnod.coordsdis = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnodes[i].style.display = mode?\"none\":\"\";\n\t\t\t}\n\t\t}\n\t},\n\trender:function(obj){\n\t\tvar d = create(\"DIV\");\n\t\td.style.cssText=\"position:absolute; width:100%; height:100%; top:0px; left:0px;\";\n\t\tobj.appendChild(d);\n\t\tvar src = env.isIE?\"\":\"src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='\";\n\t\td.innerHTML=\"\"+this._map.join(\"\\n\")+\"\";\n\t\t\n\t\tobj._htmlmap = d; //for clearing routine\n\t\t\n\t\tthis._map = [];\n\t}\n});\n\nexport default HtmlMap;","import {bind} from \"../webix/helpers\";\nimport {ui} from \"../ui/core\";\nimport state from \"./state\";\n\nconst IdSpace = {\n\t$init:function(){\n\t\tthis._elements = {};\n\t\tthis._translate_ids = {};\n\t\tthis.getTopParentView = this._get_self = bind(function(){ return this;}, this);\n\n\t\tthis._run_inner_init_logic();\n\t\tthis.$ready.push(this._run_after_inner_init_logic);\n\t},\n\t$$:function(id){\n\t\treturn this._elements[id];\n\t},\n\tinnerId:function(id){\n\t\treturn this._translate_ids[id];\n\t},\n\t_run_inner_init_logic:function(){\n\t\tthis._prev_global_col = state._global_collection;\n\t\tstate._global_collection = this;\n\t},\n\t_run_after_inner_init_logic:function(){\n\t\tfor (var name in this._elements){\n\t\t\tvar input = this._elements[name];\n\t\t\tif (this.callEvent && input.mapEvent && !input._evs_map.onitemclick)\n\t\t\t\tinput.mapEvent({\n\t\t\t\t\tonitemclick:this\n\t\t\t\t});\n\t\t\tinput.getTopParentView = this._get_self;\n\t\t}\n\n\t\tstate._global_collection = this._prev_global_col;\n\t\tthis._prev_global_col = 0;\n\t},\n\t_destroy_child:function(id){\n\t\tdelete this._elements[id];\n\t},\n\tui:function(){\n\t\tthis._run_inner_init_logic();\n\t\tvar temp = ui.apply(this, arguments);\n\t\tthis._run_after_inner_init_logic();\n\t\treturn temp;\n\t}\n};\n\n\nexport default IdSpace;","import {preventEvent} from \"../webix/html\";\nimport UIManager from \"../core/uimanager\";\nimport {$$} from \"../ui/core\";\nimport {assert} from \"../webix/debug\";\n\n\nconst KeysNavigation = {\n\t$init:function(){\n\t\tif(this.getSelectedId)\n\t\t\tthis.attachEvent(\"onAfterRender\", this._set_focusable_item);\n\t\tif(this.moveSelection)\n\t\t\tthis.attachEvent(\"onTabFocus\", this._set_item_focus);\n\t},\n\t_set_item_focus:function(){\n\t\tif(this.getSelectedId){\n\t\t\tvar sel = this.getSelectedId(true);\n\t\t\tif(!sel.length || !this.getItemNode(sel[0]))\n\t\t\t\tthis.moveSelection(\"down\"); //select and show\n\t\t}\n\t},\n\t_set_focusable_item:function(){\n\t\tvar sel = this.getSelectedId(true);\n\t\tif(!sel.length || !this.getItemNode(sel[0])){\n\t\t\tvar node = this._dataobj.querySelector(\"[\"+this._id+\"]\");\n\t\t\tif(node)\n\t\t\t\tnode.setAttribute(\"tabindex\", \"0\");\n\t\t}\n\t},\n\t_navigation_helper:function(mode){\n\t\treturn function(view, e){\n\t\t\tvar tag = (e.srcElement || e.target);\n\n\t\t\t//ignore clipboard listener\n\t\t\tif (!tag.getAttribute(\"webixignore\")){\n\t\t\t\t//ignore hotkeys if focus in the common input\n\t\t\t\t//to allow normal text edit operations\n\t\t\t\tvar name = tag.tagName;\n\t\t\t\tif (name == \"INPUT\" || name == \"TEXTAREA\" || name == \"SELECT\") return true;\n\t\t\t}\n\n\t\t\tif (view && view.moveSelection && view.config.navigation && !view._in_edit_mode){\n\t\t\t\tpreventEvent(e);\n\t\t\t\treturn view.moveSelection(mode, {shift:e.shiftKey, ctrl:e.ctrlKey});\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t},\n\tmoveSelection:function(mode, details, focus){\n\t\tvar config = this._settings;\n\t\tif(config.disabled) return;\n\t\t//get existing selection\n\t\tvar selected = this.getSelectedId(true);\n\t\tvar x_layout = (this.count && (config.layout ==\"x\" || config.xCount > 1));\n\n\t\tif((mode == \"right\" || mode == \"left\") && this._parent_menu){\n\t\t\tvar parent = $$(this._parent_menu);\n\n\t\t\tparent._hide_sub_menu(true);\n\t\t\tif(parent.config.layout === \"x\")\n\t\t\t\tparent.moveSelection(mode);\n\t\t\telse\n\t\t\t\tUIManager.setFocus(parent);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!selected.length && this.count()){\n\t\t\tif (mode == \"down\" || (mode == \"right\" && x_layout)) mode = \"top\";\n\t\t\telse if (mode == \"up\" || (mode == \"left\" && x_layout)) mode = \"bottom\";\n\t\t\telse return;\n\t\t\tselected = [this.getFirstId()];\n\t\t}\n\n\t\tif (selected.length == 1){ //if we have a selection\n\t\t\tselected = selected[0];\n\t\t\tvar prev = selected;\n\n\t\t\tif (mode == \"left\" && this.close)\n\t\t\t\treturn this.close(selected);\n\t\t\tif (mode == \"right\" && this.open)\n\t\t\t\treturn this.open(selected);\n\n\t\t\telse if (mode == \"top\") {\n\t\t\t\tselected = this.getFirstId();\n\t\t\t} else if (mode == \"bottom\") {\n\t\t\t\tselected = this.getLastId();\n\t\t\t} else if (mode == \"up\" || mode == \"left\" || mode == \"pgup\") {\n\t\t\t\tlet index = this.getIndexById(selected);\n\t\t\t\tlet step = mode == \"pgup\" ? 10 : 1;\n\t\t\t\tselected = this.getIdByIndex(Math.max(0, index-step));\n\t\t\t} else if (mode == \"down\" || mode == \"right\" || mode == \"pgdown\") {\n\t\t\t\tlet index = this.getIndexById(selected);\n\t\t\t\tlet step = mode == \"pgdown\" ? 10 : 1;\n\t\t\t\tselected = this.getIdByIndex(Math.min(this.count()-1, index+step));\n\t\t\t} else {\n\t\t\t\tassert(false, \"Not supported selection moving mode\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(this._skip_item)\n\t\t\t\tselected = this._skip_item(selected, prev, mode);\n\n\t\t\tthis.showItem(selected);\n\t\t\tthis.select(selected);\n\n\t\t\tif(this.getSubMenu && this.getSubMenu(selected))\n\t\t\t\tthis._mouse_move_activation(selected, this.getItemNode(selected));\n\n\t\t\tif(!this.config.clipboard && focus !== false){\n\t\t\t\tvar node = this.getItemNode(selected);\n\t\t\t\tif(node) node.focus();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tnavigation_setter:function(value){\n\t\t//using global flag to apply hotkey only once\n\t\tif (value && !UIManager._global_nav_grid_hotkeys){\n\t\t\tUIManager._global_nav_grid_hotkeys = true;\n\t\t\t//hotkeys will react on any component but will not work in edit mode\n\t\t\t//you can define moveSelection method to handle navigation keys\n\t\t\tUIManager.addHotKey(\"up\", this._navigation_helper(\"up\"));\n\t\t\tUIManager.addHotKey(\"down\", this._navigation_helper(\"down\"));\n\t\t\tUIManager.addHotKey(\"right\", this._navigation_helper(\"right\"));\n\t\t\tUIManager.addHotKey(\"left\", this._navigation_helper(\"left\"));\n\n\t\t\tUIManager.addHotKey(\"shift+up\", this._navigation_helper(\"up\"));\n\t\t\tUIManager.addHotKey(\"shift+down\", this._navigation_helper(\"down\"));\n\t\t\tUIManager.addHotKey(\"shift+right\", this._navigation_helper(\"right\"));\n\t\t\tUIManager.addHotKey(\"shift+left\", this._navigation_helper(\"left\"));\n\n\t\t\tUIManager.addHotKey(\"ctrl+shift+up\", this._navigation_helper(\"up\"));\n\t\t\tUIManager.addHotKey(\"ctrl+shift+down\", this._navigation_helper(\"down\"));\n\t\t\tUIManager.addHotKey(\"ctrl+shift+right\", this._navigation_helper(\"right\"));\n\t\t\tUIManager.addHotKey(\"ctrl+shift+left\", this._navigation_helper(\"left\"));\n\n\t\t\tUIManager.addHotKey(\"pageup\", \tthis._navigation_helper(\"pgup\"));\n\t\t\tUIManager.addHotKey(\"pagedown\", this._navigation_helper(\"pgdown\"));\n\t\t\tUIManager.addHotKey(\"home\", \t this._navigation_helper(\"top\"));\n\t\t\tUIManager.addHotKey(\"end\", \t\tthis._navigation_helper(\"bottom\"));\n\n\t\t\t\n\n\t\t}\n\n\t\treturn value;\n\t}\n};\n\nexport default KeysNavigation;","import {uid, isArray, bind} from \"../webix/helpers\";\nimport {$$} from \"../ui/core\";\n\nimport i18n from \"../webix/i18n\";\nimport {use} from \"../services\";\n\nimport template from \"../webix/template\";\n\n\n\n/*Data collection mapping logic */\n\nconst MapCollection = {\n\t$init:function(){\n\t\tthis.$ready.push(this._create_scheme_init);\n\t\tthis.attachEvent(\"onStructureUpdate\", this._create_scheme_init);\n\t\tthis.attachEvent(\"onStructureLoad\", function(){\n\t\t\tif(!this._scheme_init_order.length)\n\t\t\t\tthis._create_scheme_init();\n\t\t});\n\t},\n\t_create_scheme_init:function(){\n\t\tvar stack = this._scheme_init_order = [];\n\t\tvar config = this._settings;\n\n\t\tif (config.columns)\n\t\t\tthis._build_data_map(config.columns);\n\t\tif (this._settings.map)\n\t\t\tthis._process_field_map(config.map);\n\n\t\tif (stack.length){\n\t\t\tthis.data._scheme_init = function(obj){\n\t\t\t\tfor (var i=0; i a[target];\n\t\t} else {\n\t\t\tif (source.indexOf(\"#\") === -1 && source.indexOf(\"{\") === -1){\n\t\t\t\tsource = \"#\"+source+\"#\";\n\t\t\t}\n\t\t\tgetSource = template(source);\n\t\t}\n\n\t\tif (map.indexOf(\"(date)\")===0){\n\t\t\tif (extra && !extra.format) extra.format = i18n.dateFormatStr;\n\n\t\t\treturn function(obj){\n\t\t\t\tconst dateStr = (getSource(obj) || \"\").toString();\n\t\t\t\tobj[target] = i18n.parseFormatDate(dateStr);\n\t\t\t};\n\t\t} else if (map.indexOf(\"(number)\")===0){\n\t\t\treturn function(obj){\n\t\t\t\tobj[target] = getSource(obj)*1;\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(obj){\n\t\t\t\tobj[target] = getSource(obj) || \"\";\n\t\t\t};\n\t\t}\n\t},\n\t_build_data_map:function(columns){ //for datatable\n\t\tfor (var i=0; i= this._cells.length || index < 0){\n\t\t\t\tindex = (index < 0?this._cells.length-1:0);\n\t\t\t}\n\t\t\tthis.setActiveIndex(index);\n\t\t}\n\t},\n\t_showPanelBind: function(id){\n\t\tif(this._cells)\n\t\t\t$$(id).show();\n\t},\n\t_renderNavItems:function(){\n\t\tvar item, config;\n\t\tconfig = this._settings.navigation;\n\t\tif(config.items){\n\t\t\tthis._linkAttr = config.linkAttr || \"bind_id\";\n\n\t\t\tif(!this._navPanel)\n\t\t\t\tthis._renderPanel();\n\t\t\telse\n\t\t\t\tthis._clearPanel();\n\n\t\t\tvar data = (this._cells?this._cells:this.data.order);\n\t\t\tif(data.length>1){\n\t\t\t\tfor (var i=0; i < data.length; i++){\n\n\t\t\t\t\titem = create(\"DIV\",{\n\t\t\t\t\t\t\"class\":\"webix_nav_item webix_nav_\"+(i==this._active_cell?\"active\":\"inactive\"),\n\t\t\t\t\t\t\"role\":\"tab\",\n\t\t\t\t\t\t\"tabindex\":(i==this._active_cell?\"0\":\"-1\")\n\t\t\t\t\t});\n\t\t\t\t\tvar id = this._cells?this._cells[i]._settings.id:data[i];\n\t\t\t\t\tif(id)\n\t\t\t\t\t\titem.setAttribute(this._linkAttr, id);\n\t\t\t\t\tthis._navPanel.appendChild(item);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t_clearPanel:function(){\n\t\tif (this._navPanel){\n\t\t\tvar coll = this._navPanel.childNodes;\n\t\t\tfor (var i = coll.length - 1; i >= 0; i--)\n\t\t\t\tremove(coll[i]);\n\t\t}\n\t},\n\t_renderNavButtons: function(){\n\t\tvar config = this._settings.navigation;\n\t\tif(config.buttons){\n\n\t\t\tif(this._prevNavButton)\n\t\t\t\tremove(this._prevNavButton);\n\t\t\tif(this._prevNavButton)\n\t\t\t\tremove(this._nextNavButton);\n\n\n\t\t\tthis._prevNavButton = create(\n\t\t\t\t\"DIV\",\n\t\t\t\t{\n\t\t\t\t\t\"class\":\"webix_nav_button_\"+config.type+\" webix_nav_button_prev \"\n\t\t\t\t},\n\t\t\t\t\"
\"\n\t\t\t);\n\t\t\tthis._viewobj.appendChild(this._prevNavButton);\n\n\t\t\tthis._nextNavButton = create(\n\t\t\t\t\"DIV\",\n\t\t\t\t{\n\t\t\t\t\t\"class\":\"webix_nav_button_\"+config.type+\" webix_nav_button_next \"\n\t\t\t\t},\n\t\t\t\t\"
\"\n\t\t\t);\n\t\t\tthis._viewobj.appendChild(this._nextNavButton);\n\t\t}\n\t}\n};\n\nexport default NavigationButtons;","import {create, insertBefore, remove} from \"../webix/html\";\n\n\nconst OverlayBox = {\n\tshowOverlay:function(message){\n\t\tif (!this._overlay){\n\t\t\tthis._overlay = create(\"DIV\",{ \"class\":\"webix_overlay\" },(message||\"\"));\n\t\t\tinsertBefore(this._overlay, this._viewobj.firstChild, this._viewobj);\n\t\t\tthis._viewobj.style.position = \"relative\";\n\t\t} else \n\t\t\tthis._overlay.innerHTML = message;\n\t},\n\thideOverlay:function(){\n\t\tif (this._overlay){\n\t\t\tremove(this._overlay);\n\t\t\tthis._overlay = null;\n\t\t}\n\t}\n};\n\nexport default OverlayBox;","import {delay} from \"../webix/helpers\";\nimport {ui, $$} from \"../ui/core\";\n\n\nconst PagingAbility = {\n\tpager_setter:function(pager){\n\t\tif (typeof pager == \"string\"){\n\t\t\tvar ui_pager = $$(pager);\n\t\t\tif (!ui_pager){\n\t\t\t\tthis.$blockRender = true;\n\t\t\t\tdelay(function(){\n\t\t\t\t\tvar obj = $$(pager);\n\n\t\t\t\t\tthis._settings.pager = this.pager_setter(obj);\n\t\t\t\t\tvar s = obj._settings;\n\t\t\t\t\ts.count = this.data._count_pager_total(s.level);\n\t\t\t\t\tobj.refresh();\n\n\t\t\t\t\tthis.$blockRender = false;\n\t\t\t\t\tthis.render();\n\t\t\t\t}, this);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tpager = ui_pager;\n\t\t}\n\n\t\tfunction check_pager_sizes(repeat){\n\t\t\tif (pager.config.autosize && this.getVisibleCount){\n\t\t\t\tvar count = this.getVisibleCount();\n\t\t\t\tif (isNaN(count)){\n\t\t\t\t\tpager.config.size = 1;\n\t\t\t\t\tdelay(check_pager_sizes, this, [true]);\n\t\t\t\t} else if (count != pager.config.size){\n\t\t\t\t\tpager.config.size = count;\n\t\t\t\t\tpager.refresh();\n\t\t\t\t\tif (repeat === true)\n\t\t\t\t\t\tthis.refresh();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tvar s = this._settings.pager;\n\t\t\t//initial value of pager = -1, waiting for real value\n\t\t\tif (s.page == -1) return false;\t\n\t\t\t\n\t\t\tthis.data.$min = this._count_pager_index(0, s.page*s.size);\t//affect data.getRange\n\t\t\tthis.data.$max = this._count_pager_index(this.data.$min, s.size);\n\t\t\tthis.data.$pagesize = this.data.$max - this.data.$min;\n\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.attachEvent(\"onBeforeRender\",check_pager_sizes);\n\n\t\tif (!pager.$view){\n\t\t\tpager.view = \"pager\";\n\t\t\tpager = ui(pager);\n\t\t}\n\t\tthis._pager = pager;\n\t\tpager.$master = this;\n\n\t\tthis.data.attachEvent(\"onStoreUpdated\", function(){\n\t\t\tvar s = pager._settings;\n\t\t\ts.count = this._count_pager_total(s.level);\n\t\t\tpager.refresh();\n\t\t});\n\t\tthis.data._count_pager_total = this._count_pager_total;\n\n\t\treturn pager._settings;\n\t},\n\t_count_pager_total:function(level){\n\t\tif (level && level !== 0){\n\t\t\tvar count = 0; \n\t\t\tthis.each(function(obj){\n\t\t\t\tif (obj.$level == level) count++;\n\t\t\t});\n\t\t\treturn count;\n\t\t} else\n\t\t\treturn this.count();\n\t},\n\t_count_pager_index:function(start, count){\n\t\tvar s = this._settings.pager;\n\n\t\tif (s.level && s.level !== 0){\n\t\t\tvar end = start;\n\t\t\tvar max = this.data.order.length;\n\n\t\t\tif (count)\n\t\t\t\twhile (end < max){\n\t\t\t\t\tif (this.data.order[end] && this.data.getItem(this.data.order[end]).$level == s.level){\n\t\t\t\t\t\tif (count === 0)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcount--;\n\t\t\t\t\t}\n\t\t\t\t\tend++;\n\t\t\t\t}\n\n\t\t\treturn end;\n\t\t} else\n\t\t\treturn start+count;\n\t},\n\tsetPage:function(value){\n\t\tif (this._pager)\n\t\t\tthis._pager.select(value);\n\t},\n\tgetPage:function(){\n\t\treturn this._pager._settings.page;\n\t},\n\tgetPager:function(){\n\t\treturn this._pager;\n\t}\n};\n\nexport default PagingAbility;","import {create, insertBefore, remove} from \"../webix/html\";\nimport Touch from \"../core/touch\";\nimport env from \"../webix/env\";\nimport {isUndefined, extend, delay} from \"../webix/helpers\";\n\n\nconst ProgressBar = {\n\t$init:function(){\n\t\tif (isUndefined(this._progress) && this.attachEvent){\n\t\t\tthis.attachEvent(\"onBeforeLoad\", this.showProgress);\n\t\t\tthis.attachEvent(\"onAfterLoad\", this.hideProgress);\n\t\t\tthis._progress = null;\n\t\t}\n\t},\n\tshowProgress:function(config){\n\t\t// { position: 0 - 1, delay: 2000ms by default, css : name of css class to use }\n\t\tif (!this._progress){\n\n\t\t\tconfig = extend({\n\t\t\t\tposition:0,\n\t\t\t\tdelay: 2000,\n\t\t\t\ttype:\"icon\",\n\t\t\t\ticon:\"wxi-sync\",\n\t\t\t\thide:false\n\t\t\t}, (config||{}), true);\n\n\t\t\tvar incss = (config.type == \"icon\") ? (config.icon+\" webix_spin\") : \"\";\n\n\n\n\t\t\tthis._progress = create(\n\t\t\t\t\"DIV\",\n\t\t\t\t{\n\t\t\t\t\t\"class\":\"webix_progress_\"+config.type,\n\t\t\t\t\t\"role\":\"progressbar\",\n\t\t\t\t\t\"aria-valuemin\":\"0\",\n\t\t\t\t\t\"aria-valuemax\":\"100\",\n\t\t\t\t\t\"tabindex\":\"0\"\n\t\t\t\t},\n\t\t\t\t\"
\"\n\t\t\t);\n\n\t\t\tif(!this.setPosition)\n\t\t\t\tthis._viewobj.style.position = \"relative\";\n\n\t\t\tinsertBefore(this._progress, this._viewobj.firstChild, this._viewobj);\n\t\t\tthis._viewobj.setAttribute(\"aria-busy\", \"true\");\n\n\t\t\tif(!Touch.$active){\n\t\t\t\tif(this.getScrollState){\n\t\t\t\t\tvar scroll = this.getScrollState();\n\t\t\t\t\tif(this._viewobj.scrollWidth != this.$width){\n\t\t\t\t\t\tthis._progress.style.left = scroll.x +\"px\";\n\t\t\t\t\t}\n\t\t\t\t\tif(this._viewobj.scrollHeight != this.$height){\n\t\t\t\t\t\tif(config.type != \"bottom\"){\n\t\t\t\t\t\t\tthis._progress.style.top = scroll.y +\"px\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._progress.style.top = scroll.y + this.$height - this._progress.offsetHeight +\"px\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tthis._progress_delay = 1;\n\t\t}\n\n\t\tif (config && config.type != \"icon\")\n\t\t\tdelay(function(){\n\t\t\t\tif (this._progress){\n\t\t\t\t\tvar position = config.position || 1;\n\t\t\t\t\t//check for css-transition support\n\t\t\t\t\tif(this._progress.style[env.transitionDuration] !== undefined || !config.delay){\n\t\t\t\t\t\tthis._progress.firstChild.style.width = position*100+\"%\";\n\t\t\t\t\t\tif (config.delay)\n\t\t\t\t\t\t\tthis._progress.firstChild.style[env.transitionDuration] = config.delay+\"ms\";\n\t\t\t\t\t} else{\n\t\t\t\t\t//if animation is not supported fallback to timeouts [IE9]\n\t\t\t\t\t\tvar count = 0,\n\t\t\t\t\t\t\tstart = 0,\n\t\t\t\t\t\t\tstep = position/config.delay*30,\n\t\t\t\t\t\t\tview = this;\n\n\t\t\t\t\t\tif(this._progressTimer){\n\t\t\t\t\t\t\t//reset the existing progress\n\t\t\t\t\t\t\twindow.clearInterval(this._progressTimer);\n\t\t\t\t\t\t\tstart = this._progress.firstChild.offsetWidth/this._progress.offsetWidth*100;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._progressTimer = window.setInterval(function(){\n\t\t\t\t\t\t\tif(count*30 == config.delay){\n\t\t\t\t\t\t\t\twindow.clearInterval(view._progressTimer);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tif(view._progress && view._progress.firstChild)\n\t\t\t\t\t\t\t\t\tview._progress.firstChild.style.width = start+count*step*position*100+\"%\";\n\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},30);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (config.hide)\n\t\t\t\t\t\tdelay(this.hideProgress, this, [1], config.delay);\n\n\t\t\t\t}\n\t\t\t\tthis._progress_delay = 0;\n\t\t\t}, this);\n\t\telse if(config && config.type == \"icon\" && config.hide)\n\t\t\tdelay(this.hideProgress, this, [1], config.delay);\n\t},\n\thideProgress:function(now){\n\t\tif (this._progress_delay)\n\t\t\tnow = true;\n\n\t\tif (this._progress){\n\t\t\tif (now){\n\t\t\t\tif(this._progressTimer)\n\t\t\t\t\twindow.clearInterval(this._progressTimer);\n\t\t\t\tremove(this._progress);\n\t\t\t\tthis._progress = null;\n\t\t\t\tthis._viewobj.removeAttribute(\"aria-busy\");\n\t\t\t} else {\n\t\t\t\tthis.showProgress({ position:1.1, delay:300 , hide:true });\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default ProgressBar;","import {locate, insertBefore, remove} from \"../webix/html\";\nimport {bind, clone, extend, toFunctor} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport template from \"../webix/template\";\n\nimport type from \"../webix/type\";\n\nconst RenderStack ={\n\t$init:function(){\n\t\tassert(this.data,\"RenderStack :: Component doesn't have DataStore\");\n\t\tassert(template,\"template :: template is not accessible\");\n\n\t\t//used for temporary HTML elements\n\t\t//automatically nulified during destruction\n\t\tthis._html = document.createElement(\"DIV\");\n\t\t\t\t\n\t\tthis.data.attachEvent(\"onIdChange\", bind(this._render_change_id, this));\n\t\tthis.attachEvent(\"onItemClick\", this._call_onclick);\n\t\t\n\t\t//create copy of default type, and set it as active one\n\t\tif (!this.types){ \n\t\t\tthis.types = { \"default\" : this.type };\n\t\t\tthis.type.name = \"default\";\n\t\t}\n\n\t\tthis.type = clone(this.type);\n\t},\n\t\n\tcustomize:function(obj){ \n\t\ttype(this,obj);\n\t},\n\titem_setter:function(value){\n\t\treturn this.type_setter(value);\n\t},\n\ttype_setter:function(value){\n\t\tif(!this.types[value])\n\t\t\tthis.customize(value);\n\t\telse {\n\t\t\tthis.type = clone(this.types[value]);\n\t\t\tif (this.type.css) \n\t\t\t\tthis._contentobj.className+=\" \"+this.type.css;\n\t\t}\n\t\tif (this.type.on_click)\n\t\t\textend(this.on_click, this.type.on_click);\n\n\t\treturn value;\n\t},\n\t\n\ttemplate_setter:function(value){\n\t\tthis.type.template=template(value);\n\t},\n\t//convert single item to HTML text (templating)\n\t_toHTML:function(obj){\n\t\tvar mark = this.data._marks[obj.id];\n\t\t//check if related template exist\n\t\tassert((!obj.$template || this.type[\"template\"+obj.$template]),\"RenderStack :: Unknown template: \"+obj.$template);\n\t\tthis.callEvent(\"onItemRender\",[obj]);\n\t\treturn this.type.templateStart(obj,this.type, mark)+(obj.$template?this.type[\"template\"+obj.$template]:this.type.template)(obj,this.type,mark)+this.type.templateEnd(obj, this.type,mark);\n\t},\n\t//convert item to HTML object (templating)\n\t_toHTMLObject:function(obj){\n\t\tthis._html.innerHTML = this._toHTML(obj);\n\t\treturn this._html.firstChild;\n\t},\n\t_render_change_id:function(old, newid){\n\t\tvar obj = this.getItemNode(old);\n\t\tif (obj) {\n\t\t\tobj.setAttribute(this._id, newid);\n\t\t\tthis._htmlmap[newid] = this._htmlmap[old];\n\t\t\tdelete this._htmlmap[old];\n\t\t}\n\t},\n\t//calls function that is set in onclick property\n\t_call_onclick:function(){\n\t\tif (this._settings.click){\n\t\t\tvar code = toFunctor(this._settings.click, this.$scope);\n\t\t\tif (code && code.call) code.apply(this,arguments);\n\t\t}\n\t},\n\t//return html container by its ID\n\t//can return undefined if container doesn't exists\n\tgetItemNode:function(search_id){\n\t\tif (this._htmlmap)\n\t\t\treturn this._htmlmap[search_id];\n\t\t\t\n\t\t//fill map if it doesn't created yet\n\t\tthis._htmlmap={};\n\t\t\n\t\tvar t = this._dataobj.childNodes;\n\t\tfor (var i=0; i < t.length; i++){\n\t\t\tvar id = t[i].getAttribute(this._id); //get item's\n\t\t\tif (id)\n\t\t\t\tthis._htmlmap[id]=t[i];\n\t\t}\n\t\t//call locator again, when map is filled\n\t\treturn this.getItemNode(search_id);\n\t},\n\t//return id of item from html event\n\tlocate:function(e){ return locate(e,this._id); },\n\t/*change scrolling state of top level container, so related item will be in visible part*/\n\tshowItem:function(id){\n\n\t\tvar html = this.getItemNode(id);\n\t\tif (html&&this.scrollTo){\n\t\t\tvar txmin = html.offsetLeft;\n\t\t\tvar txmax = txmin + html.offsetWidth;\n\t\t\tvar tymin = html.offsetTop;\n\n\t\t\tvar tymax = tymin + html.offsetHeight;\n\t\t\tvar state = this.getScrollState();\n\n\t\t\tvar x = state.x;\n\t\t\tif (x > txmin || x + this._content_width < txmax )\n\t\t\t\tx = txmin;\n\t\t\tvar y = state.y;\n\t\t\tif (y > tymin || y + this._content_height < tymax )\n\t\t\t\ty = tymin;\n\n\t\t\tthis.scrollTo(x,y);\n\t\t\tif(this._setItemActive)\n\t\t\t\tthis._setItemActive(id);\n\t\t}\n\t},\n\t//update view after data update\n\t//method calls low-level rendering for related items\n\t//when called without parameters - all view refreshed\n\trender:function(id,data,type){\n\t\tif (!this.isVisible(this._settings.id) || this.$blockRender)\n\t\t\treturn;\n\t\t\n\t\tif (id){\n\t\t\tvar cont = this.getItemNode(id); //get html element of updated item\n\t\t\tswitch(type){\n\t\t\t\tcase \"paint\":\n\t\t\t\tcase \"update\":\n\t\t\t\t\t//in case of update - replace existing html with updated one\n\t\t\t\t\tif (!cont) return;\n\t\t\t\t\tvar t1 = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\t\tinsertBefore(t1, cont); \n\t\t\t\t\tremove(cont);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"delete\":\n\t\t\t\t\t//in case of delete - remove related html\n\t\t\t\t\tif (!cont) return;\n\t\t\t\t\tremove(cont);\n\t\t\t\t\tdelete this._htmlmap[id];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"add\":\n\t\t\t\t\t//in case of add - put new html at necessary position\n\t\t\t\t\tvar t2 = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\t\tinsertBefore(t2, this.getItemNode(this.data.getNextId(id)), this._dataobj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"move\":\n\t\t\t\t\t//moving without repainting the item\n\t\t\t\t\tinsertBefore(this.getItemNode(id), this.getItemNode(this.data.getNextId(id)), this._dataobj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tassert(0, \"Unknown render command: \"+type);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t//full reset\n\t\t\tif (this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\t\t//getRange - returns all elements\n\t\t\t\t(this._renderobj||this._dataobj).innerHTML = this.data.getRange().map(this._toHTML,this).join(\"\");\n\t\t\t\tthis._htmlmap = null; //clear map, it will be filled at first getItemNode\n\t\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default RenderStack;","import {create} from \"../webix/html\";\nimport {bind, delay} from \"../webix/helpers\";\nimport env from \"../webix/env\";\nimport {_event} from \"../webix/htmlevents\";\n\nimport Touch from \"../core/touch\";\nimport CustomScroll from \"../core/customscroll\";\n\nconst Scrollable= {\n\t$init:function(config){\n\t\t//do not spam unwanted scroll containers for templates \n\t\tif (config && !config.scroll && this._one_time_scroll) \n\t\t\treturn (this._dataobj = (this._dataobj||this._contentobj));\n\t\t\n\t\t(this._dataobj||this._contentobj).appendChild(create(\"DIV\",{ \"class\" : \"webix_scroll_cont\" },\"\"));\n\t\tthis._dataobj=(this._dataobj||this._contentobj).firstChild;\n\n\t\tif(!env.touch || env.touch === \"native\")\n\t\t\t_event(this._viewobj,\"scroll\", bind(function(){\n\t\t\t\tif(this.callEvent)\n\t\t\t\t\tdelay(function(){\n\t\t\t\t\t\tthis.callEvent(\"onAfterScroll\", []);\n\t\t\t\t\t}, this);\n\t\t\t},this));\n\t},\n\t/*defaults:{\n\t\tscroll:true\n\t},*/\n\tscroll_setter:function(value){\n\t\tif (!value) return false;\n\t\tvar marker = (value==\"x\"?\"x\":(value==\"xy\"?\"xy\":(value==\"a\"?\"xy\":\"y\")));\n\t\tif (Touch.$active && env.touch != \"native\"){\n\t\t\tthis._dataobj.setAttribute(\"touch_scroll\",marker);\n\t\t\tif (this.attachEvent)\n\t\t\t\tthis.attachEvent(\"onAfterRender\", bind(this._refresh_scroll,this));\n\t\t\tthis._touch_scroll = true;\n\t\t} else {\n\t\t\tif (env.$customScroll){\n\t\t\t\tCustomScroll.enable(this, marker);\n\t\t\t} else {\n\t\t\t\tvar node = this._dataobj.parentNode.style;\n\t\t\t\tif (value.toString().indexOf(\"a\")!=-1){\n\t\t\t\t\tnode.overflowX = node.overflowY = \"auto\";\n\t\t\t\t} else {\n\t\t\t\t\tif (marker.indexOf(\"x\")!=-1){\n\t\t\t\t\t\tthis._scroll_x = true;\n\t\t\t\t\t\tnode.overflowX = \"scroll\";\n\t\t\t\t\t}\n\t\t\t\t\tif (marker.indexOf(\"y\")!=-1){\n\t\t\t\t\t\tthis._scroll_y = true;\n\t\t\t\t\t\tnode.overflowY = \"scroll\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn marker;\n\t},\n\t_onoff_scroll:function(mode, dir){\n\t\tif (!!this._settings.scroll == !!mode) return;\n\n\t\tif (!env.$customScroll){\n\t\t\tvar style = this._dataobj.parentNode.style;\n\t\t\tstyle[dir === \"x\" ? \"overflowX\" : \"overflowY\"] = mode ? \"auto\" : \"hidden\";\n\t\t}\n\n\t\t\n\t\tif (dir === \"x\"){\n\t\t\tthis._scroll_x = mode;\n\t\t} else {\n\t\t\tthis._scroll_y = mode;\n\t\t}\n\t\tthis._settings.scroll = mode?dir:mode;\n\t},\n\tgetScrollState:function(){\n\t\tif (Touch.$active){\n\t\t\tvar temp = Touch._get_matrix(this._dataobj);\n\t\t\treturn { x : -temp.e, y : -temp.f };\n\t\t} else\n\t\t\treturn { x : this._dataobj.parentNode.scrollLeft, y : this._dataobj.parentNode.scrollTop };\n\t},\n\tscrollTo:function(x,y){\n\t\tif (Touch.$active && env.touch != \"native\"){\n\t\t\ty = Math.max(0, Math.min(y, this._dataobj.offsetHeight - this._content_height));\n\t\t\tx = Math.max(0, Math.min(x, this._dataobj.offsetWidth - this._content_width));\n\t\t\tTouch._set_matrix(this._dataobj, -x, -y, this._settings.scrollSpeed||\"100ms\");\n\t\t} else {\n\t\t\tthis._dataobj.parentNode.scrollLeft=x;\n\t\t\tthis._dataobj.parentNode.scrollTop=y;\n\t\t}\n\t},\n\t_refresh_scroll:function(){\n\t\tif (this._settings.scroll.toString().indexOf(\"x\")!=-1){\n\t\t\tlet x = this._dataobj.scrollWidth;\n\t\t\tif (x){ //in hidden state we will have a Zero scrollWidth\n\t\t\t\tthis._dataobj.style.width = \"100%\";\n\t\t\t\tthis._dataobj.style.width = this._dataobj.scrollWidth + \"px\";\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tif(Touch.$active && this._touch_scroll){\n\t\t\tTouch._clear_artefacts();\n\t\t\tTouch._scroll_end();\n\t\t\tvar s = this.getScrollState();\n\t\t\tvar dx = this._dataobj.offsetWidth - this.$width - s.x;\n\t\t\tvar dy = this._dataobj.offsetHeight - this.$height - s.y;\n\n\t\t\t//if current scroll is outside of data area\n\t\t\tif(dx<0 || dy < 0){\n\t\t\t\t//scroll to the end of data area\n\t\t\t\tlet x = (dx<0?Math.min(-dx - s.x,0):- s.x);\n\t\t\t\tlet y = (dy<0?Math.min(-dy - s.y,0):- s.y);\n\t\t\t\tTouch._set_matrix(this._dataobj, x, y, 0);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default Scrollable;","import {addCss, removeCss} from \"../webix/html\";\nimport {toArray, bind, isArray} from \"../webix/helpers\";\nimport {_event, event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\n\nimport ready from \"../webix/ready\";\nimport state from \"../core/state\";\n\n\n/*\n\tBehavior:SelectionModel - manage selection states\n\t@export\n\t\tselect\n\t\tunselect\n\t\tselectAll\n\t\tunselectAll\n\t\tisSelected\n\t\tgetSelectedId\n*/\nconst SelectionModel ={\n\t$init:function(){\n\t\t//collection of selected IDs\n\t\tthis._selected = toArray();\n\t\tassert(this.data, \"SelectionModel :: Component doesn't have DataStore\");\n\n\t\t//remove selection from deleted items\n\t\tthis.data.attachEvent(\"onStoreUpdated\",bind(this._data_updated,this));\n\t\tthis.data.attachEvent(\"onStoreLoad\", bind(this._data_loaded,this));\n\t\tthis.data.attachEvent(\"onAfterFilter\", bind(this._data_filtered,this));\n\t\tthis.data.attachEvent(\"onSyncApply\", bind(this._select_check,this));\n\t\tthis.data.attachEvent(\"onIdChange\", bind(this._id_changed,this));\n\t\tthis.$ready.push(this._set_noselect);\n\t},\n\t_set_noselect: function(){\n\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect || this._settings.select==\"area\")\n\t\t\t_event(this.$view,\"mousedown\", function(e){\n\t\t\t\tvar shiftKey = (e||event).shiftKey;\n\t\t\t\tif(shiftKey){\n\t\t\t\t\tstate._noselect_element = this;\n\t\t\t\t\taddCss(this,\"webix_noselect\",1);\n\t\t\t\t}\n\t\t\t});\n\t},\n\t_id_changed:function(oldid, newid){\n\t\tfor (var i = this._selected.length - 1; i >= 0; i--)\n\t\t\tif (this._selected[i]==oldid)\n\t\t\t\tthis._selected[i]=newid;\n\t},\n\t_data_filtered:function(){\n\t\tfor (var i = this._selected.length - 1; i >= 0; i--){\n\t\t\tif (this.data.getIndexById(this._selected[i]) < 0) {\n\t\t\t\tvar id = this._selected[i];\n\t\t\t\tthis.removeCss(id, \"webix_selected\", true);\n\t\t\t\tthis._selected.splice(i,1);\n\t\t\t\tthis.callEvent(\"onSelectChange\",[id]);\n\t\t\t}\n\t\t}\n\t},\n\t//helper - linked to onStoreUpdated\n\t_data_updated:function(id,obj,type){\n\t\tif (type == \"delete\"){\t\t\t\t//remove selection from deleted items\n\t\t\tif (this.loadBranch){\n\t\t\t\t//hierarchy, need to check all\n\t\t\t\tthis._select_check();\n\t\t\t} else\n\t\t\t\tthis._selected.remove(id);\n\t\t}\n\t\telse if (!id && !this.data.count() && !this.data._filter_order){\t//remove selection for clearAll\n\t\t\tthis._selected = toArray();\n\t\t}\n\t},\n\t_data_loaded:function(){\n\t\tif (this._settings.select)\n\t\t\tthis.data.each(function(obj){\n\t\t\t\tif (obj && obj.$selected) this.select(obj.id);\n\t\t\t}, this);\n\t},\n\t_select_check:function(){\n\t\tfor (var i = this._selected.length - 1; i >= 0; i--)\n\t\t\tif (!this.exists(this._selected[i]))\n\t\t\t\tthis._selected.splice(i,1);\n\t},\n\t//helper - changes state of selection for some item\n\t_select_mark:function(id,state,refresh,need_unselect){\n\t\tvar sname = state ? \"onBeforeSelect\" : \"onBeforeUnSelect\";\n\t\tif (!this.callEvent(sname,[id,state])) return false;\n\n\t\tif (need_unselect){\n\t\t\tthis._silent_selection = true;\n\t\t\tthis.unselectAll();\n\t\t\tthis._silent_selection = false;\n\t\t}\n\t\t\n\t\tif (state)\n\t\t\tthis.addCss(id, \"webix_selected\", true);\n\t\telse\n\t\t\tthis.removeCss(id, \"webix_selected\", true);\n\n\t\tif (refresh)\n\t\t\trefresh.push(id);\t\t\t\t//if we in the mass-select mode - collect all changed IDs\n\t\telse{\n\t\t\tif (state)\n\t\t\t\tthis._selected.push(id);\t\t//then add to list of selected items\n\t\t\telse\n\t\t\t\tthis._selected.remove(id);\n\t\t\tthis._refresh_selection(id);\t//othervise trigger repainting\n\t\t}\n\n\t\tvar ename = state ? \"onAfterSelect\" : \"onAfterUnSelect\";\n\t\tthis.callEvent(ename,[id]);\n\n\t\treturn true;\n\t},\n\t//select some item\n\tselect:function(id,preserve){\n\t\tvar ctrlKey = arguments[2];\n\t\tvar shiftKey = arguments[3];\n\t\t//if id not provide - works as selectAll\n\t\tif (!id) return this.selectAll();\n\n\t\t//allow an array of ids as parameter\n\t\tif (isArray(id)){\n\t\t\tfor (var i=0; i < id.length; i++)\n\t\t\t\tthis.select(id[i], (i?1:preserve), ctrlKey, shiftKey);\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.data.exists(id), \"Incorrect id in select command: \"+id);\n\t\t\n\t\t//block selection mode\n\t\tif (shiftKey && this._selected.length)\n\t\t\treturn this.selectAll(this._selected[this._selected.length-1],id);\n\n\t\t//single selection mode\n\t\tvar need_unselect = false;\n\t\tif (!ctrlKey && !preserve && (this._selected.length!=1 || this._selected[0]!=id))\n\t\t\tneed_unselect = true;\n\n\t\tif (!need_unselect && this.isSelected(id)){\n\t\t\tif (ctrlKey) this.unselect(id);\t//ctrl-selection of already selected item\n\t\t\treturn;\n\t\t}\n\n\t\tthis._select_mark(id, true, null, need_unselect);\n\t},\n\t//unselect some item\n\tunselect:function(id){\n\t\t//if id is not provided - unselect all items\n\t\tif (!id) return this.unselectAll();\n\t\tif (!this.isSelected(id)) return;\n\t\t\n\t\tthis._select_mark(id,false);\n\t},\n\t//select all items, or all in defined range\n\tselectAll:function(from,to){\n\t\tvar range;\n\t\tvar refresh=[];\n\t\t\n\t\tif (from||to)\n\t\t\trange = this.data.getRange(from||null,to||null);\t//get limited set if bounds defined\n\t\telse\n\t\t\trange = this.data.getRange();\t\t\t//get all items in other case\n\t\t//in case of paging - it will be current page only\n\t\trange.each(function(obj){ \n\t\t\tif (!this.data.getMark(obj.id, \"webix_selected\")){\n\t\t\t\tthis._selected.push(obj.id);\t\n\t\t\t\tthis._select_mark(obj.id,true,refresh);\n\t\t\t}\n\t\t},this);\n\t\t//repaint self\n\t\tthis._refresh_selection(refresh);\n\t},\n\t//remove selection from all items\n\tunselectAll:function(){\n\t\tvar refresh=[];\n\t\t\n\t\tthis._selected.each(function(id){\n\t\t\tthis._select_mark(id,false,refresh);\t//unmark selected only\n\t\t},this);\n\t\t\n\t\tthis._selected=toArray();\n\t\tthis._refresh_selection(refresh);\t//repaint self\n\t},\n\t//returns true if item is selected\n\tisSelected:function(id){\n\t\treturn this._selected.find(id)!=-1;\n\t},\n\t/*\n\t\treturns ID of selected items or array of IDs\n\t\tto make result predictable - as_array can be used, \n\t\t\twith such flag command will always return an array \n\t\t\tempty array in case when no item was selected\n\t*/\n\tgetSelectedId:function(as_array){\t\n\t\tswitch(this._selected.length){\n\t\t\tcase 0: return as_array?[]:\"\";\n\t\t\tcase 1: return as_array?[this._selected[0]]:this._selected[0];\n\t\t\tdefault: return ([].concat(this._selected)); //isolation\n\t\t}\n\t},\n\tgetSelectedItem:function(as_array){\n\t\tvar sel = this.getSelectedId(true);\n\t\tif (sel.length > 1 || as_array){\n\t\t\tfor (var i = sel.length - 1; i >= 0; i--)\n\t\t\t\tsel[i] = this.getItem(sel[i]);\n\t\t\treturn sel;\n\t\t} else if (sel.length)\n\t\t\treturn this.getItem(sel[0]);\n\t},\n\t//detects which repainting mode need to be used\n\t_is_mass_selection:function(obj){\n\t\t// crappy heuristic, but will do the job\n\t\treturn obj.length>100 || obj.length > this.data.count/2;\n\t},\n\t_refresh_selection:function(refresh){\n\t\tif (typeof refresh != \"object\") refresh = [refresh];\n\t\tif (!refresh.length) return;\t//nothing to repaint\n\t\t\n\t\tif (this._is_mass_selection(refresh))\t\n\t\t\tthis.data.refresh();\t//many items was selected - repaint whole view\n\t\telse\n\t\t\tfor (var i=0; i < refresh.length; i++)\t//repaint only selected\n\t\t\t\tthis.render(refresh[i],this.data.getItem(refresh[i]),\"update\");\n\t\t\t\n\t\tif (!this._silent_selection)\t\n\t\t\tthis.callEvent(\"onSelectChange\",[refresh]);\n\t}\n};\n\nready(function(){\n\tevent(document.body,\"mouseup\", function(){\n\t\tif(state._noselect_element){\n\t\t\tremoveCss(state._noselect_element,\"webix_noselect\");\n\t\t\tstate._noselect_element = null;\n\t\t}\n\t});\n});\n\nexport default SelectionModel;","import {isArray} from \"../webix/helpers\";\n\nconst color = {\n\t_toHex:[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\"],\n\ttoHex:function(number, length){\n\t\tnumber=parseInt(number,10);\n\t\tvar str = \"\";\n\t\twhile (number>0){\n\t\t\tstr=this._toHex[number%16]+str;\n\t\t\tnumber=Math.floor(number/16);\n\t\t}\n\t\twhile (str.length 255)\n\t\t\tr = 0;\n\t\tif (g < 0 || g > 255)\n\t\t\tg = 0;\n\t\tif (b < 0 || b > 255)\n\t\t\tb = 0;\n\t\treturn [r,g,b];\n\t},\n\thsvToRgb:function(h, s, v){\n\t\tvar hi,f,p,q,t,r,g,b;\n\t\thi = Math.floor((h/60))%6;\n\t\tf = h/60-hi;\n\t\tp = v*(1-s);\n\t\tq = v*(1-f*s);\n\t\tt = v*(1-(1-f)*s);\n\t\tr = 0;\n\t\tg = 0;\n\t\tb = 0;\n\t\tswitch(hi) {\n\t\t\tcase 0:\n\t\t\t\tr = v; g = t; b = p;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tr = q; g = v; b = p;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tr = p; g = v; b = t;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tr = p; g = q; b = v;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tr = t; g = p; b = v;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tr = v; g = p; b = q;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tr = Math.floor(r*255);\n\t\tg = Math.floor(g*255);\n\t\tb = Math.floor(b*255);\n\t\treturn [r, g, b];\n\t},\n\trgbToHsv:function(r, g, b){\n\t\tvar r0,g0,b0,min0,max0,s,h,v;\n\t\tr0 = r/255;\n\t\tg0 = g/255;\n\t\tb0 = b/255;\n\t\tmin0 = Math.min(r0, g0, b0);\n\t\tmax0 = Math.max(r0, g0, b0);\n\t\th = 0;\n\t\ts = max0===0?0:(1-min0/max0);\n\t\tv = max0;\n\t\tif (max0 == min0) {\n\t\t\th = 0;\n\t\t} else if (max0 == r0 && g0>=b0) {\n\t\t\th = 60*(g0 - b0)/(max0 - min0)+0;\n\t\t} else if (max0 == r0 && g0 < b0) {\n\t\t\th = 60*(g0 - b0)/(max0 - min0)+360;\n\t\t} else if (max0 == g0) {\n\t\t\th = 60*(b0 - r0)/(max0-min0)+120;\n\t\t} else if (max0 == b0) {\n\t\t\th = 60*(r0 - g0)/(max0 - min0)+240;\n\t\t}\n\t\treturn [h, s, v];\n\t}\n};\n\nexport default color;","import color from \"../../webix/color\";\nimport {assert} from \"../../webix/debug\";\n\n\nfunction joinAttributes(attrs){\n\tvar result = \" \";\n\tif(attrs)\n\t\tfor(var a in attrs)\n\t\t\tresult += a+\"=\\\"\"+attrs[a]+\"\\\" \";\n\treturn result;\n}\n// SVG\nvar SVG = {};\n\nSVG.draw = function(content, width, height, css){\n\tvar attrs = {\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tversion: \"1.1\",\n\t\theight: \"100%\",\n\t\twidth: \"100%\",\n\t\tviewBox: \"0 0 \"+width+\" \"+height,\n\t\t\"class\": css||\"\"\n\t};\n\treturn \"\"+content+\"\";\n};\nSVG.styleMap = {\n\t\"lineColor\": \"stroke\",\n\t\"color\": \"fill\"\n};\nSVG.group = function(path){\n\treturn \"\"+path+\"\";\n};\nSVG._handlers = {\n\t// MoveTo: {x:px,y:py}\n\t\"M\": function(p){\n\t\treturn \" M \"+ p.x+\" \"+ p.y;\n\t},\n\t// LineTo: {x:px,y:py}\n\t\"L\": function(p){\n\t\treturn \" L \"+ p.x+\" \"+ p.y;\n\t},\n\t// Curve: 3 points {x:px,y:py}: two control points and an end point\n\t\"C\": function(cp0, cp1, p){\n\t\treturn \" C \"+cp0.x + \" \"+cp0.y+\" \"+cp1.x + \" \"+cp1.y+\" \"+p.x + \" \"+p.y;\n\t},\n\t// Arc: center point {x:px,y:py}, radius, angle0, angle1\n\t\"A\": function(p, radius, angle0, angle1){\n\t\tvar x = p.x+Math.cos(angle1)*radius;\n\t\tvar y = p.y+Math.sin(angle1)*radius;\n\t\tvar bigCircle = angle1-angle0 >= Math.PI;\n\t\treturn \" A \"+radius+\" \"+radius+\" 0 \"+(bigCircle?1:0)+\" 1 \"+x+\" \"+y;\n\t}\n};\n// points is an array of an array with two elements: {string} line type, {array}\nSVG.definePath = function(points, close){\n\tvar path = \"\";\n\tfor(var i =0; i < points.length; i++){\n\t\tassert(points[i][0]&&typeof points[i][0] == \"string\", \"Path type must be a string\");\n\t\tvar type = (points[i][0]).toUpperCase();\n\t\tassert(this._handlers[type], \"Incorrect path type\");\n\t\tpath += this._handlers[type].apply(this,points[i].slice(1));\n\n\t}\n\tif(close)\n\t\tpath += \" Z\";\n\n\treturn path;\n};\nSVG._linePoints = function(points){\n\tvar result = [];\n\tfor(var i = 0; i< points.length; i++){\n\t\tresult.push([i?\"L\":\"M\",points[i]]);\n\t}\n\treturn result;\n};\nSVG.setOpacity = function(rawColor,opacity){\n\tlet rgbColor = color.toRgb(rawColor);\n\trgbColor.push(opacity);\n\treturn \"rgba(\"+rgbColor.join(\",\")+\")\";\n};\nSVG._curvePoints = function(points){\n\tvar result = [];\n\tfor(var i = 0; i< points.length; i++){\n\t\tvar p = points[i];\n\t\tif(!i){\n\t\t\tresult.push([\"M\",p[0]]);\n\t\t}\n\t\tresult.push([\"C\",p[1],p[2],p[3]]);\n\t}\n\treturn result;\n};\nSVG.getPath = function(path, css, attrs){\n\tattrs = joinAttributes(attrs);\n\treturn \"\";\n};\nSVG.getSector = function(p, radius, angle0, angle1, css, attrs){\n\tattrs = joinAttributes(attrs);\n\tvar x0 = p.x+Math.cos(angle0)*radius;\n\tvar y0 = p.y+Math.sin(angle0)*radius;\n\tvar lines = [\n\t\t[\"M\",p],\n\t\t[\"L\",{x:x0, y:y0}],\n\t\t[\"A\", p,radius,angle0,angle1],\n\t\t[\"L\",p]\n\t];\n\n\n\treturn \"\";\n};\nSVG.getCurve = function(points,css, attrs){\n\tattrs = joinAttributes(attrs);\n\tvar path = this.definePath(this._curvePoints(points));\n\treturn \"\";\n};\nSVG.getLine = function(p0,p1,css, attrs){\n\treturn this.getPath(this.definePath(this._linePoints([p0,p1]),true),css,attrs);\n};\nSVG.getCircle = function(p, radius, css, attrs){\n\tattrs = joinAttributes(attrs);\n\treturn \"\";\n};\nSVG.getRect = function(x, y, width, height, css, attrs){\n\tattrs = joinAttributes(attrs);\n\treturn \"\";\n};\n\n\nexport default SVG;","import {createCss} from \"../../webix/html\";\nimport {extend, copy} from \"../../webix/helpers\";\n\nimport SVG from \"./svg\";\n\nvar defaults = {\n\tpaddingX: 6,\n\tpaddingY: 6,\n\tradius: 2,\n\tminHeight: 4,\n\teventRadius: 8\n};\nfunction Line(config){\n\tthis.config = extend(copy(defaults),config||{},true);\n}\n\nLine.prototype.draw = function(data, width, height){\n\tvar points = this.getPoints(data, width, height);\n\tvar config = this.config;\n\tvar renderer = SVG;\n\tvar styles = config.color?this._applyColor(renderer,config.color):null;\n\t// draw line\n\tvar path = renderer.definePath(this._getLinePoints(points));\n\tvar graph = renderer.group(renderer.getPath(path,\"webix_sparklines_line\"+(styles?\" \"+styles.line:\"\")));\n\t// draw items\n\tgraph += this._drawItems(renderer, points, config.radius, \"webix_sparklines_item\"+(styles?\" \"+styles.item:\"\"));\n\t// draw event items\n\tvar eventRadius = Math.min(data.length?(width-2*(config.paddingX||0))/data.length:0,config.eventRadius);\n\tgraph += this._drawEventItems(renderer, points, eventRadius);\n\treturn renderer.draw(graph, width, height, \"webix_sparklines_line_chart\"+(config.css?\" \"+config.css:\"\"));\n};\nLine.prototype._applyColor = function(renderer,color){\n\tvar config = {\"line\":{},\"item\":{}},\n\t\tmap = renderer.styleMap;\n\tif(color){\n\t\tconfig.line[map.lineColor] = color;\n\t\tconfig.item[map.color] = color;\n\t\tfor(var name in config)\n\t\t\tconfig[name] = createCss(config[name]);\n\t}\n\treturn config;\n};\nLine.prototype._drawItems = function(renderer,points,radius,css,attrs){\n\tvar items = [];\n\tfor(var i = 0; i< points.length; i++){\n\t\titems.push(renderer.getCircle(points[i], radius, css,attrs));\n\t}\n\treturn renderer.group(items.join(\"\"));\n};\nLine.prototype._drawEventItems = function(renderer,points,radius){\n\tvar items = [];\n\tfor(var i = 0; i< points.length; i++){\n\t\titems.push(renderer.getCircle(points[i], radius, \"webix_sparklines_event_area\", {webix_area:i}));\n\t}\n\treturn renderer.group(items.join(\"\"));\n};\n\nLine.prototype._getLinePoints = function(points){\n\tvar i, type, result =[];\n\tfor( i =0; i< points.length; i++){\n\t\ttype = i?\"L\":\"M\";\n\t\tresult.push([type,points[i]]);\n\t}\n\treturn result;\n};\nLine.prototype.getPoints = function(data, width, height) {\n\tvar config = this.config;\n\tvar minValue = Math.min.apply(null,data);\n\tif (typeof config.origin !== \"undefined\")\n\t\tminValue = Math.min(config.origin, minValue);\n\n\tvar maxValue = Math.max.apply(null,data);\n\tvar result = [];\n\tvar x = config.paddingX||0;\n\tvar y = config.paddingY||0;\n\twidth = (width||100)-x*2;\n\tvar minHeight = config.minHeight||0;\n\theight = (height||100)-y*2;\n\tif(data.length){\n\t\tif(data.length==1)\n\t\t\tresult.push({x: width/2+x, y: height/2+x});\n\t\telse{\n\t\t\tvar unitX = width/(data.length-1);\n\t\t\tvar yNum = config.scale || (maxValue - minValue);\n\t\t\tvar unitY = (height- minHeight)/(yNum?yNum:1);\n\t\t\tif(!yNum)\n\t\t\t\theight /= 2;\n\t\t\tfor(var i=0; i < data.length; i++){\n\t\t\t\tresult.push({x: Math.ceil(unitX*i)+x, y: height-Math.ceil(unitY*(data[i]-minValue))+y-minHeight});\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n};\n\nexport default Line;","import {createCss} from \"../../webix/html\";\nimport {extend, copy} from \"../../webix/helpers\";\n\nimport SVG from \"./svg\";\nimport BaseLine from \"./line\";\n\n\n\nvar defaults = {\n\tpaddingX: 3,\n\tpaddingY: 4,\n\tradius: 1,\n\tminHeight: 4,\n\teventRadius: 8\n};\n\nfunction Area(config){\n\tthis.config = extend(copy(defaults),config||{},true);\n}\n\nArea.prototype.draw = function(data, width, height){\n\tvar eventRadius, graph, path, points, styles,\n\t\tconfig = this.config,\n\t\tLine = BaseLine.prototype,\n\t\trenderer = SVG;\n\n\t// draw area\n\tpoints = this.getPoints(data, width, height);\n\tpath = renderer.definePath(Line._getLinePoints(points),true);\n\n\tif(config.color)\n\t\tstyles = this._applyColor(renderer,config.color);\n\n\tgraph = renderer.group(renderer.getPath(path,\"webix_sparklines_area\"+(styles?\" \"+styles.area:\"\")));\n\t// draw line\n\tpoints.splice(points.length - 3, 3);\n\tpath = renderer.definePath(Line._getLinePoints(points));\n\tgraph += renderer.group(renderer.getPath(path,\"webix_sparklines_line\"+(styles?\" \"+styles.line:\"\")));\n\t// draw items\n\tgraph += Line._drawItems(renderer, points, config.radius, \"webix_sparklines_item\"+(styles?\" \"+styles.item:\"\"));\n\t// draw event areas\n\teventRadius = Math.min(data.length?(width-2*(config.paddingX||0))/data.length:0,config.eventRadius);\n\tgraph += Line._drawEventItems(renderer, points, eventRadius);\n\treturn renderer.draw(graph, width, height, \"webix_sparklines_area_chart\"+(config.css?\" \"+config.css:\"\"));\n};\nArea.prototype._applyColor = function(renderer,color){\n\tvar config = {\"area\": {}, \"line\":{},\"item\":{}},\n\t\tmap = renderer.styleMap;\n\tif(color){\n\t\tconfig.area[map.color] = renderer.setOpacity(color,0.2);\n\t\tconfig.line[map.lineColor] = color;\n\t\tconfig.item[map.color] = color;\n\t\tfor(var name in config)\n\t\t\tconfig[name] = createCss(config[name]);\n\t}\n\n\treturn config;\n};\nArea.prototype.getPoints = function(data, width, height){\n\tvar Line = BaseLine.prototype;\n\tvar points =Line.getPoints.call(this, data, width, height);\n\tvar x = this.config.paddingX || 0;\n\tvar y = this.config.paddingY || 0;\n\tpoints.push({x: width - x, y: height - y},{x: x, y: height - y},{x: x, y: points[0].y});\n\treturn points;\n};\n\nexport default Area;","import {createCss} from \"../../webix/html\";\nimport {extend, copy} from \"../../webix/helpers\";\n\nimport SVG from \"./svg\";\n\n\nvar defaults = {\n\tpaddingX: 3,\n\tpaddingY: 4,\n\twidth: 20,\n\tmargin: 4,\n\tminHeight: 4,\n\teventRadius: 8,\n\torigin:0,\n\titemCss: function(value){return value < (this.config.origin||0)?\" webix_sparklines_bar_negative\":\"\";}\n};\nfunction Bar(config){\n\tthis.config = extend(copy(defaults),config||{},true);\n}\n\nBar.prototype.draw = function(data, width, height){\n\tvar i, css, p, y, padding,\n\t\tconfig = this.config,\n\t\tgraph = \"\", items = [],\n\t\tpoints = this.getPoints(data, width, height),\n\t\trenderer = SVG;\n\n\t// draw bars\n\tfor( i = 0; i< points.length; i++){\n\t\tcss = (typeof config.itemCss == \"function\"?config.itemCss.call(this,data[i]):(config.itemCss||\"\"));\n\t\tif (config.negativeColor && data[i] < config.origin)\n\t\t\tcss += \" \"+this._applyColor(renderer,config.negativeColor);\n\t\telse if(config.color)\n\t\t\tcss += \" \"+this._applyColor(renderer,config.color);\n\t\tp = points[i];\n\t\titems.push(renderer.getRect(p.x, p.y, p.width, p.height,\"webix_sparklines_bar \"+css));\n\t}\n\tgraph += renderer.group(items.join(\"\"));\n\t// origin)\n\ty = parseInt(this._getOrigin(data, width, height),10)+0.5;\n\tpadding = config.paddingX||0;\n\tgraph += renderer.group(renderer.getLine({x:padding, y: y},{x: width-padding, y: y},\"webix_sparklines_origin\"));\n\n\t// event areas\n\tvar evPoints = this._getEventPoints(data, width, height);\n\tvar evItems = [];\n\tfor( i = 0; i< evPoints.length; i++){\n\t\tp = evPoints[i];\n\t\tevItems.push(renderer.getRect(p.x, p.y, p.width, p.height,\"webix_sparklines_event_area \",{\"webix_area\":i}));\n\t}\n\tgraph += renderer.group(evItems.join(\"\"));\n\treturn renderer.draw(graph, width, height, \"webix_sparklines_bar_chart\"+(config.css?\" \"+config.css:\"\"));\n};\nBar.prototype._applyColor = function(renderer,color){\n\tvar config = {},\n\t\tmap = renderer.styleMap;\n\tif(color)\n\t\tconfig[map.color] = color;\n\treturn createCss(config);\n};\nBar.prototype._getOrigin = function(data, width, height){\n\tvar config = this.config;\n\tvar y = config.paddingY||0;\n\theight = (height||100)-y*2;\n\tvar pos = y+height;\n\tif(config.origin !== false){\n\t\tvar minValue = Math.min.apply(null,data);\n\t\tvar maxValue = Math.max.apply(null,data);\n\t\tvar origin = config.origin||-0.000001;\n\t\tif(origin >= maxValue){\n\t\t\tpos = y;\n\t\t}\n\t\telse if(origin > minValue){\n\t\t\tvar unitY = height/(maxValue - minValue);\n\t\t\tpos -= unitY*(origin-minValue);\n\t\t}\n\t}\n\treturn pos;\n};\nBar.prototype._getEventPoints = function(data, width, height){\n\tvar result = [];\n\tvar x = this.config.paddingX||0;\n\tvar y = this.config.paddingY||0;\n\twidth = (width||100)-x*2;\n\theight = (height||100)-y*2;\n\tif(data.length){\n\t\tvar unitX = width/data.length;\n\t\tfor(var i=0; i < data.length; i++)\n\t\t\tresult.push({x: Math.ceil(unitX*i)+x, y: y, height: height, width: unitX});\n\t}\n\treturn result;\n};\nBar.prototype.getPoints = function(data, width, height){\n\tvar config = this.config;\n\tvar minValue = Math.min.apply(null,data);\n\tif (config.origin < minValue) \n\t\tminValue = config.origin;\n\n\tvar maxValue = Math.max.apply(null,data);\n\tvar result = [];\n\tvar x = config.paddingX;\n\tvar y = config.paddingY;\n\tvar margin = config.margin;\n\tvar barWidth = config.width||20;\n\tvar originY = this._getOrigin(data,width,height);\n\twidth = (width||100)-x*2;\n\theight = (height||100)-y*2;\n\tif(data.length){\n\t\tvar unitX = width/data.length;\n\t\tvar yNum = config.scale || (maxValue - minValue);\n\t\tbarWidth = Math.min(unitX-margin,barWidth);\n\t\tmargin = unitX-barWidth;\n\t\tvar minHeight = 0;\n\t\tvar origin = minValue;\n\n\t\tif(config.origin !== false && config.origin > minValue)\n\t\t\torigin = config.origin||0;\n\t\telse\n\t\t\tminHeight = config.minHeight;\n\n\t\tvar unitY = (height-minHeight)/(yNum?yNum:1);\n\n\t\tfor(var i=0; i < data.length; i++){\n\t\t\tvar h = Math.ceil(unitY*(data[i]-origin));\n\t\t\tresult.push({x: Math.ceil(unitX*i)+x+margin/2, y: originY-(data[i]>=origin?h:0)-minHeight, height: Math.abs(h)+minHeight, width: barWidth});\n\t\t}\n\n\t}\n\treturn result;\n};\n\nexport default Bar;","import {extend} from \"../../webix/helpers\";\n\nimport SVG from \"./svg\";\n\nvar defaults = {\n\tpaddingY: 2\n};\n\nfunction Pie(config){\n\tthis.config = extend(defaults,config||{},true);\n}\nPie.prototype._defColorsCursor = 0;\nPie.prototype._defColors = [\n\t\"#f55b50\",\"#ff6d3f\",\"#ffa521\",\"#ffc927\",\"#ffee54\",\"#d3e153\",\"#9acb61\",\"#63b967\",\n\t\"#21a497\",\"#21c5da\",\"#3ea4f5\",\"#5868bf\",\"#7b53c0\",\"#a943ba\",\"#ec3b77\",\"#9eb0b8\"\n];\nPie.prototype._getColor = function(i,data){\n\tvar count = data.length;\n\tvar colorsCount = this._defColors.length;\n\tif(colorsCount > count){\n\t\tif(i){\n\t\t\tif(i < colorsCount - count)\n\t\t\t\ti = this._defColorsCursor +2;\n\t\t\telse\n\t\t\t\ti = this._defColorsCursor+1;\n\t\t}\n\t\tthis._defColorsCursor = i;\n\t}\n\telse\n\t\ti = i%colorsCount;\n\treturn this._defColors[i];\n};\nPie.prototype.draw = function(data, width, height){\n\tvar attrs, graph, i, sectors,\n\t\tconfig = this.config,\n\t\tcolor = config.color||this._getColor,\n\t\tpoints = this.getAngles(data),\n\t\trenderer = SVG,\n\t\ty = config.paddingY|| 0,\n\t\t// radius\n\t\tr = height/2 - y,\n\t\t// center\n\t\tx0 = width/2, y0 = height/2;\n\n\t// draw sectors\n\tif(typeof color != \"function\")\n\t\tcolor = function(){return color;};\n\tsectors = \"\";\n\tfor( i =0; i < points.length; i++){\n\t\tattrs = {};\n\t\tattrs[renderer.styleMap[\"color\"]] = color.call(this,i,data,this._context);\n\t\tsectors += renderer.getSector({x:x0,y:y0},r,points[i][0],points[i][1],\"webix_sparklines_sector\", attrs);\n\t}\n\tgraph = renderer.group(sectors);\n\n\t// draw event areas\n\tsectors = \"\";\n\tfor(i =0; i < points.length; i++){\n\t\tsectors += renderer.getSector({x:x0,y:y0},r,points[i][0],points[i][1],\"webix_sparklines_event_area\",{\"webix_area\":i});\n\t}\n\tgraph += renderer.group(sectors);\n\n\treturn renderer.draw(graph, width, height, \"webix_sparklines_pie_chart\"+(config.css?\" \"+config.css:\"\"));\n};\nPie.prototype.getAngles = function(data){\n\tvar a0 = -Math.PI/ 2, a1,\n\t\ti, result = [];\n\n\tvar ratios = this._getRatios(data);\n\n\tfor( i =0; i < data.length; i++){\n\t\ta1= -Math.PI/2+ratios[i]-0.0001;\n\t\tresult.push([a0,a1]);\n\t\ta0 = a1;\n\t}\n\treturn result;\n};\nPie.prototype._getTotalValue = function(data){\n\tvar t=0;\n\tfor(var i = 0; i < data.length;i++)\n\t\tt += data[i]*1;\n\treturn t;\n};\nPie.prototype._getRatios = function(data){\n\tvar i, value,\n\t\tratios = [],\n\t\tprevSum = 0,\n\t\ttotalValue = this._getTotalValue(data);\n\tfor(i = 0; i < data.length;i++){\n\t\tvalue = data[i]*1;\n\t\tratios[i] = Math.PI*2*(totalValue?((value+prevSum)/totalValue):(1/data.length));\n\t\tprevSum += value;\n\t}\n\treturn ratios;\n};\n\nexport default Pie;","import {createCss} from \"../../webix/html\";\nimport {extend, copy} from \"../../webix/helpers\";\n\nimport SVG from \"./svg\";\nimport Base from \"./line\";\n\nvar defaults = {\n\tpaddingX: 3,\n\tpaddingY: 6,\n\tradius: 2,\n\tminHeight: 4,\n\teventRadius: 8\n};\n\nfunction Spline(config){\n\tthis.config = extend(copy(defaults),config||{},true);\n}\n\nSpline.prototype.draw = function(data, width, height){\n\tvar config = this.config,\n\t\tgraph = \"\",\n\t\tLine = Base.prototype,\n\t\tpoints = this.getPoints(data, width, height),\n\t\trenderer = SVG,\n\t\tstyles = config.color?this._applyColor(renderer,config.color):null;\n\n\t// draw spline\n\tgraph += renderer.group(renderer.getCurve(points, \"webix_sparklines_line\"+(styles?\" \"+styles.line:\"\")));\n\n\tvar linePoints = Line.getPoints.call(this,data, width, height);\n\t// draw items\n\tgraph += Line._drawItems(renderer, linePoints, config.radius, \"webix_sparklines_item\"+(styles?\" \"+styles.item:\"\"));\n\t// draw event items\n\tvar eventRadius = Math.min(data.length?(width-2*(config.paddingX||0))/data.length:0,config.eventRadius);\n\tgraph += Line._drawEventItems(renderer, linePoints, eventRadius);\n\treturn renderer.draw(graph, width, height,\"webix_sparklines_line_chart\"+(config.css?\" \"+config.css:\"\"));\n};\nSpline.prototype._applyColor = function(renderer,color){\n\tvar config = {\"line\":{},\"item\":{}},\n\t\tmap = renderer.styleMap;\n\tif(color){\n\t\tconfig.line[map.lineColor] = color;\n\t\tconfig.item[map.color] = color;\n\t\tfor(var name in config)\n\t\t\tconfig[name] = createCss(config[name]);\n\t}\n\treturn config;\n};\nSpline.prototype.getPoints = function(data, width, height){\n\tvar i, points, px, py,\n\t\tresult = [], x = [], y =[],\n\t\tLine = Base.prototype;\n\n\tpoints = Line.getPoints.call(this, data, width, height);\n\n\tfor(i = 0; i< points.length; i++){\n\t\tx.push(points[i].x);\n\t\ty.push(points[i].y);\n\t}\n\tpx = this._getControlPoints(x);\n\tpy = this._getControlPoints(y);\n\t/*updates path settings, the browser will draw the new spline*/\n\tfor ( i=0;i= 0; --i)\n\t\tp1[i] = (r[i] - c[i] * p1[i+1]) / b[i];\n\n\tfor (i=0;i= 0; i--) {\n\t\tvar value = data[i];\n\t\tvalues[i] = (typeof value === \"object\" ? value.value : value);\n\t}\n\treturn values;\n}\n\n\nSparklines.types ={};\n\nSparklines.getTemplate = function(customConfig){\n\tvar config = customConfig||{};\n\tif(typeof customConfig == \"string\")\n\t\tconfig = { type: customConfig };\n\n\textend(config,{ type:\"line\" });\n\n\tvar slConstructor = this.types[config.type];\n\tassert(slConstructor,\"Unknown sparkline type\");\n\treturn bind(this._template, new slConstructor(config));\n};\n\nSparklines._template = function(item, common, data, column){\n\tif (column)\n\t\treturn this.draw(getData(data), column.width, 33);\n\telse\n\t\treturn this.draw(item.data || item, common.width, common.height);\n};\n\n// add \"sparklines\" type\nattachEvent(\"onDataTable\", function(table){\n\ttable.type.sparklines = Sparklines.getTemplate();\n});\n\nSparklines.types[\"area\"]=Area;\nSparklines.types[\"bar\"]=Bar;\nSparklines.types[\"line\"]=Line;\nSparklines.types[\"pie\"]=Pie;\nSparklines.types[\"spline\"]=Spline;\nSparklines.types[\"splineArea\"]=SplineArea;\n\nexport default Sparklines;","import i18n from \"./i18n\";\n\nconst csv = {\n\tescape:true,\n\tdelimiter:{\n\t\trows: \"\\n\",\n\t\tcols: \"\\t\"\n\t},\n\tparse:function(text, sep){\n\t\tsep = sep||this.delimiter;\n\t\tif (!this.escape)\n\t\t\treturn this._split_clip_data(text, sep);\n\n\t\tvar lines = text.replace(/\\n$/,\"\").split(sep.rows);\n\n\t\tvar i = 0;\n\t\twhile (i < lines.length - 1) {\n\t\t\tif (this._substr_count(lines[i], \"\\\"\") % 2 === 1) {\n\t\t\t\tlines[i] += sep.rows + lines[i + 1];\n\t\t\t\tdelete lines[i + 1];\n\t\t\t\ti++;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tvar csv = [];\n\n\t\tfor (i = 0; i < lines.length; i++) {\n\t\t\tif (typeof(lines[i]) !== \"undefined\") {\n\t\t\t\tvar tline = lines[i];\n\t\t\t\tvar start = 0;\n\t\t\t\tvar line = [];\n\t\t\t\tvar quoted = false;\n\t\t\t\tfor (var j=0; j<=tline.length; j++){\n\t\t\t\t\tif (!quoted && tline[j] === sep.cols || j === tline.length){\n\t\t\t\t\t\tvar chunk = tline.substr(start, j-start);\n\t\t\t\t\t\tif (chunk[0] === chunk[chunk.length-1] && chunk[0] === \"\\\"\"){\n\t\t\t\t\t\t\tchunk = chunk.substr(1, chunk.length-2).replace(\"\\\"\\\"\", \"\\\"\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tline.push(chunk);\n\t\t\t\t\t\tstart = j+1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tline[j] === \"\\\"\") {\n\t\t\t\t\t\tquoted = !quoted;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcsv.push(line);\n\t\t\t}\n\t\t}\n\t\treturn csv;\n\t},\n\t_split_clip_data: function(text, sep) {\n\t\tvar lines = text.split(sep.rows);\n\t\tfor (var i = 0; i < lines.length; i++) {\n\t\t\tlines[i] = lines[i].split(sep.cols);\n\t\t}\n\t\treturn lines;\n\t},\n\t/*! counts how many occurances substring in string **/\n\t_substr_count: function(string, substring) {\n\t\tvar arr = string.split(substring);\n\t\treturn arr.length - 1;\n\t},\n\tstringify:function(data, sep){\n\t\tsep = sep||this.delimiter;\n\n\t\tif (!this.escape){\n\t\t\tfor (let i = 0; i < data.length; i++)\n\t\t\t\tdata[i] = data[i].join(sep.cols);\n\t\t\treturn data.join(sep.rows);\n\t\t}\n\n\t\tvar reg = /\\n|\"|;|,/;\n\t\tfor (let i = 0; i < data.length; i++) {\n\t\t\tfor (var j = 0; j < data[i].length; j++) {\n\t\t\t\tvar chunk = data[i][j];\n\t\t\t\tif (chunk instanceof Date)\n\t\t\t\t\tdata[i][j] = i18n.parseFormatStr(chunk);\n\t\t\t\telse if (reg.test(chunk))\n\t\t\t\t\tdata[i][j] = \"\\\"\" + chunk.toString().replace(/\"/g, \"\\\"\\\"\") + \"\\\"\";\n\t\t\t}\n\t\t\tdata[i] = data[i].join(sep.cols);\n\t\t}\n\t\tdata = data.join(sep.rows);\n\t\treturn data;\n\t}\n};\n\nexport default csv;","import i18n from \"../webix/i18n\";\nimport promise from \"../thirdparty/promiz\";\nimport require from \"../load/require\";\nimport csv from \"../webix/csv\";\nimport env from \"../webix/env\";\n\nimport {download} from \"../webix/html\";\nimport {$active} from \"../webix/skin\";\nimport {toNode, isArray, extend, copy as wcopy, isUndefined} from \"../webix/helpers\";\nimport {$$} from \"../ui/core\";\nimport {assert} from \"../webix/debug\";\n\n\nvar errorMessage = \"non-existing view for export\";\n\nexport const toPNG = function(id, options){\n\tvar defer = promise.defer();\n\n\treturn require(env.cdn + \"/extras/html2canvas.min.js\").then(function(){\n\t\t//backward compatibility\n\t\tif (typeof options === \"string\") options = { filename: options };\n\t\toptions = options || {};\n\t\n\t\tvar view = $$(id);\n\t\tif (view && view.$exportView)\n\t\t\tview = view.$exportView(options);\n\t\tassert(view, errorMessage);\n\t\tif(!view) return defer.reject(errorMessage);\n\n\t\tvar node = view ? view.$view : toNode(id);\n\t\tvar filename = (options.filename||\"Data\")+\".png\";\n\t\n\t\twindow.html2canvas(node).then(function(canvas) {\n\t\t\tvar callback = function(data){\n\t\t\t\tif(options.download !== false)\n\t\t\t\t\tdownload(data, filename);\n\t\t\t\tcanvas.remove();\n\t\t\t\tdefer.resolve(data);\n\t\t\t};\n\t\t\tif(canvas.msToBlob)\n\t\t\t\tcallback(canvas.msToBlob());\n\t\t\telse\n\t\t\t\tcanvas.toBlob(callback, \"image/png\");\n\t\t});\n\t\treturn defer;\n\t});\n};\n\nexport const toExcel = function(id, options){\n\toptions = options || {};\n\toptions.export_mode = \"excel\";\n\n\tid = isArray(id)?id:[id];\n\tvar views = [];\n\n\tfor(var i = 0; i=0; i--)\n\t\t\tif (options.ignore[columns[i].id])\n\t\t\t\tcolumns.splice(i,1);\n\n\tif (options.id)\n\t\tscheme.push({ id:\"id\", width:50, header:\" \", template:function(obj){ return obj.id; }});\n\n\tif (options.flatTree){\n\t\tvar flatKey = options.flatTree.id;\n\t\tvar copy = [].concat(options.flatTree.columns);\n\t\tvar fill = [];\n\t\tvar fillMode = !!options.flatTree.fill;\n\t\tfor (let i = 1; i <= copy.length; i++)\n\t\t\tcopy[i-1].template = (function(i){ \n\t\t\t\treturn function(obj){ \n\t\t\t\t\treturn obj.$level == i ? (fill[i]=obj[flatKey]) : ((fillMode && i= 0; i--)\n\t\t\tif (columns[i].id === flatKey)\n\t\t\t\tindex = i;\n\n\t\tcolumns = [].concat(columns.slice(0,index)).concat(copy).concat(columns.slice(index+1));\n\t}\n\n\t\n\tfor (let j = 0; j < columns.length; j++) {\n\t\tlet column = columns[j];\n\t\tlet key = column.id;\n\n\t\tif (column.noExport) continue;\n\t\n\t\t// raw mode has sense only for datatable\n\t\t// in other cases we don't have built-in data templates\n\t\tvar rawColumn = raw && isTable;\n\t\tif (isTable){\n\t\t\tlet sourceColumn = view._columns_pull[key];\n\t\t\t// when these's no column to take raw data from, or custom template defined - ignore raw mode\n\t\t\tif (column.template && (!sourceColumn || sourceColumn.template != column.template))\n\t\t\t\trawColumn = false;\n\t\t\tif(sourceColumn)\n\t\t\t\tcolumn = extend(extend({}, column), sourceColumn);\n\t\t}\n\n\t\tlet record = {\n\t\t\tid: column.id,\n\t\t\ttemplate: (( rawColumn || !column.template) ? getDataHelper(key, column, raw) : column.template ),\n\t\t\twidth: ((column.width || 200) * (options.export_mode===\"excel\"?8.43/70:1 )),\n\t\t\theader: (column.header!==false?(column.header||key) : \"\")\n\t\t};\n\n\t\tif(options.export_mode === \"excel\"){\n\t\t\textend(record, {\n\t\t\t\ttype: column.exportType || \"\",\n\t\t\t\tformat:column.exportFormat || \"\"\n\t\t\t});\n\t\t}\n\n\t\tif(typeof record.header === \"string\") record.header = [{text:record.header}];\n\t\telse record.header = wcopy(record.header);\n\n\t\tfor(let i = 0; i]*>/gi, \"\")):\"\";\n\n\t\th_count = Math.max(h_count, record.header.length);\n\n\t\tif(view._settings.footer){\n\t\t\tlet footer = column.footer || \"\";\n\t\t\tif(typeof footer == \"string\") footer = [{text:footer}];\n\t\t\telse footer = wcopy(footer);\n\n\t\t\tfor(let i = 0; i]*>/gi;\n\tvar data = [];\n\tvar header, headers;\n\n\tif(options.export_mode ===\"excel\" && options.docHeader){\n\t\tdata = [[(options.docHeader.text || options.docHeader).toString()], [\"\"]];\n\t\tif(options.docHeader.height)\n\t\t\tscheme.heights[0] = options.docHeader.height;\n\t}\n\n\tif( options.header !== false && scheme.length){\n\t\tfor(let h=0; h < scheme[0].header.length; h++){\n\t\t\theaders = [];\n\t\t\tfor (let i = 0; i < scheme.length; i++){\n\t\t\t\theader = \"\";\n\t\t\t\tif(scheme[i].header[h]){\n\t\t\t\t\theader = scheme[i].header[h];\n\t\t\t\t\tif (filterHTML)\n\t\t\t\t\t\theader = scheme[i].header[h] = header.replace(htmlFilter, \"\");\n\t\t\t\t}\n\t\t\t\theaders.push(header);\n\t\t\t}\n\n\t\t\tif(options.export_mode ==\"excel\" && view._columns && options.heights !==false &&\n\t\t\t(view._headers[h] !== $active.barHeight || options.heights == \"all\")\n\t\t\t) scheme.heights[data.length] = view._headers[h];\n\n\t\t\tif (options.export_mode !== \"pdf\")\n\t\t\t\tdata[data.length] = headers;\n\t\t}\n\t}\n\toptions.yCorrection = (options.yCorrection||0)-data.length;\n\n\tvar isTree = (view.data.name == \"TreeStore\");\n\tvar treeline = (options.flatTree || options.plainOutput) ? \"\" : \" - \";\n\n\tview.data.each(function(item){\n\t\tif(!options.filter || options.filter(item)){\n\t\t\tlet line = [];\n\t\t\tfor (let i = 0; i < scheme.length; i++){\n\t\t\t\tlet column = scheme[i], cell = null;\n\t\t\t\t//spreadsheet can output math\n\t\t\t\tif(options.math && item[\"$\"+column.id] && item[\"$\"+column.id].charAt(0) ==\"=\" && !item[\"$\"+column.id].match(/^=(image|link|sparkline)\\(/i))\n\t\t\t\t\tcell = item[\"$\"+column.id];\n\t\t\t\tif(this._spans_pull){\n\t\t\t\t\tlet span = this.getSpan(item.id, column.id);\n\t\t\t\t\tif(span && span[4] && span[0] == item.id && span[1] == column.id){\n\t\t\t\t\t\tcell = span[4];\n\t\t\t\t\t\tif(filterHTML && typeof cell === \"string\")\n\t\t\t\t\t\t\tcell = cell.replace(htmlFilter, \"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!cell){\n\t\t\t\t\tcell = column.template(item, view.type, item[column.id], column, i);\n\t\t\t\t\tif (!cell && cell !== 0) cell = \"\";\n\t\t\t\t\tif (filterHTML && typeof cell === \"string\"){\n\t\t\t\t\t\tif(isTree)\n\t\t\t\t\t\t\tcell = cell.replace(/
<\\/div>/, treeline);\n\t\t\t\t\t\tcell = cell.replace(htmlFilter, \"\");\n\t\t\t\t\t}\n\t\t\t\t\t//remove end/start spaces(ex.hierarchy data)\n\t\t\t\t\tif (typeof cell === \"string\" && options.export_mode === \"csv\")\n\t\t\t\t\t\tcell = cell.trim();\n\t\t\t\t\t//for multiline data\n\t\t\t\t\tif (typeof cell === \"string\" && (options.export_mode === \"excel\" || options.export_mode === \"csv\")){\n\t\t\t\t\t\tcell = cell.replace(//mg,\"\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tline.push(cell);\n\t\t\t}\n\n\t\t\tif(options.export_mode ==\"excel\" && view._columns && options.heights !==false &&\n\t\t\t((item.$height && item.$height !== $active.rowHeight) || options.heights ==\"all\")\n\t\t\t) scheme.heights[data.length] = item.$height || this.config.rowHeight;\n\n\t\t\tdata.push(line);\n\t\t}\n\t}, view);\n\n\tif( options.footer !==false ){\n\t\tlet f_count = scheme[0].footer?scheme[0].footer.length:0;\n\t\tfor (let f = 0; f < f_count; f++){\n\t\t\tlet footers = [];\n\t\t\tfor(let i = 0; i R) range.s.r = R;\n\t\t\tif(range.s.c > C) range.s.c = C;\n\t\t\tif(range.e.r < R) range.e.r = R;\n\t\t\tif(range.e.c < C) range.e.c = C;\n\n\t\t\tvar cell = {v: data[R][C] };\n\t\t\tif(cell.v === null) continue;\n\t\t\tvar cell_ref = XLSX.utils.encode_cell({c:C,r:R});\n\n\t\t\tlet stringValue = cell.v.toString();\n\t\t\tlet isFormula = (stringValue.charAt(0) === \"=\");\n\n\t\t\t// set type based on column's config\n\t\t\t// skip headers and formula based cells\n\t\t\tif(R>=scheme[0].header.length && !isFormula){\n\t\t\t\tvar column = scheme[C];\n\t\t\t\tif(column.type) cell.t = (types[column.type] || \"\");\n\t\t\t\tif(column.format) cell.z = column.format;\n\t\t\t}\n\n\t\t\t// set type based on cell's value\n\t\t\tif(cell.v instanceof Date){\n\t\t\t\tcell.t = cell.t || \"n\";\n\t\t\t\tcell.z = cell.z || XLSX.SSF[table][14];\n\t\t\t\tcell.v = excelDate(cell.v);\n\t\t\t}\n\t\t\telse if(!cell.t){\n\t\t\t\tif(typeof cell.v === \"boolean\")\n\t\t\t\t\tcell.t = \"b\";\n\t\t\t\telse if(typeof cell.v === \"number\" || parseFloat(cell.v) == cell.v){\n\t\t\t\t\tcell.v = cell.v*1;\n\t\t\t\t\tcell.t = \"n\";\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// convert any other object to a string\n\t\t\t\t\tcell.v = stringValue;\n\t\t\t\t\tif(isFormula){\n\t\t\t\t\t\tcell.t = \"n\";\n\t\t\t\t\t\tcell.f = cell.v;\n\t\t\t\t\t\tdelete cell.v;\n\t\t\t\t\t}\n\t\t\t\t\telse cell.t = \"s\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(styles)\n\t\t\t\tcell.s = getStyles(R, C, styles);\n\n\t\t\tws[cell_ref] = cell;\n\t\t}\n\t}\n\tif(range.s.c < 10000000) ws[\"!ref\"] = XLSX.utils.encode_range(range);\n\n\tws[\"!rows\"] = getRowHeights(scheme.heights);\n\tws[\"!cols\"] = getColumnsWidths(scheme);\n\tif(spans.length)\n\t\tws[\"!merges\"] = spans;\n\n\treturn ws;\n}\n\nfunction str2array(s) {\n\tvar buf = new ArrayBuffer(s.length);\n\tvar view = new Uint8Array(buf);\n\tfor (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;\n\treturn buf;\n}\n\nfunction getPdfData(scheme, data, options, callback){\n\n\n\toptions.header = (isUndefined(options.header) || options.header === true) ? {} : options.header;\n\toptions.footer = (isUndefined(options.footer) || options.footer === true) ? {} : options.footer;\n\toptions.table = options.table || {};\n\n\tvar width = options.width||595.296, height = options.height || 841.896;// default A4 size\n\n\tif(options.orientation && options.orientation ===\"landscape\")\n\t\theight = [width, width = height][0];\n\n\tif(options.autowidth){\n\t\twidth = 80; //paddings\n\t\tfor(let i = 0; i horder.text)\n\t\tdoc.header({paddingBottom:10}).text(options.docHeader.text, options.docHeader);\n\n\tif (options.docHeaderImage){\n\t\tpdfjs.load(options.docHeaderImage.url, function(err, buffer){\n\t\t\tif (!err){\n\t\t\t\tvar img = new pdfjs.Image(buffer);\n\t\t\t\tdoc.header({paddingBottom:10}).image(img, options.docHeaderImage);\n\n\t\t\t\tif(options.docHeader && horder.image < horder.text)\n\t\t\t\t\tdoc.header({paddingBottom:10}).text(options.docHeader.text, options.docHeader);\n\t\t\t}\n\t\t\t//render pdf and show in browser\n\t\t\tvar pdf = doc.render();\n\t\t\tcallback(pdf, options);\n\t\t});\n\t}\n\telse{\n\t\t//render pdf and show in browser\n\t\tvar pdf = doc.render();\n\t\tcallback(pdf, options);\n\t}\n}","import template from \"../webix/template\";\nimport UIManager from \"../core/uimanager\";\n\nimport clipbuffer from \"../webix/clipbuffer\";\nimport csv from \"../webix/csv\";\n\nimport {isUndefined} from \"../webix/helpers\";\n\n\nconst TablePaste = {\n\tclipboard_setter:function(value){\n\t\tif (value === true || value === 1) value = \"block\";\n\t\tclipbuffer.init();\n\t\tthis.attachEvent(\"onSelectChange\",this._sel_to_clip);\n\t\t// solution for clicks on selected items\n\t\tthis.attachEvent(\"onItemClick\",function(){\n\t\t\tif(document.activeElement && this.$view.contains(document.activeElement)){\n\t\t\t\tclipbuffer.focus();\n\t\t\t\tUIManager.setFocus(this);\n\t\t\t}\n\t\t});\n\t\tthis.attachEvent(\"onPaste\", this._clip_to_sel);\n\n\t\treturn value;\n\t},\n\ttemplateCopy_setter: template,\n\t_sel_to_clip: function() {\n\t\tvar data = this._get_sel_text();\n\t\tclipbuffer.set(data);\n\t\tUIManager.setFocus(this);\n\t},\n\n\t_get_sel_text: function() {\n\t\tvar data = [];\n\t\tvar filter = this._settings.templateCopy;\n\t\tthis.mapSelection(function(value, row, col, row_ind) {\n\t\t\tif (!data[row_ind]) data[row_ind] = [];\n\t\t\tvar newvalue = filter ? filter(value, row, col) : value;\n\t\t\tdata[row_ind].push(newvalue);\n\t\t\treturn value;\n\t\t});\n\t\tvar value = data.length === 1 && data[0].length === 1 ? data[0][0] : csv.stringify(data, this._settings.delimiter);\n\t\treturn value;\n\t},\n\n\t_clip_to_sel: function(text) {\n\t\tif (!isUndefined(this._paste[this._settings.clipboard])) {\n\t\t\tvar data = csv.parse(text, this._settings.delimiter);\n\t\t\tthis._paste[this._settings.clipboard].call(this, data);\n\t\t}\n\t},\n\n\t_paste: {\n\t\tblock: function(data) {\n\t\t\tvar leftTop = this.mapSelection(null);\n\t\t\tif (!leftTop) return;\n\n\t\t\t// filling cells with data\n\t\t\tthis.mapCells(leftTop.row, leftTop.column, data.length, null, function(value, row, col, row_ind, col_ind) {\n\t\t\t\tif (data[row_ind] && data[row_ind].length>col_ind) {\n\t\t\t\t\treturn data[row_ind][col_ind];\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tthis.render();\n\t\t},\n\n\t\tselection: function(data) {\n\t\t\tthis.mapSelection(function(value, row, col, row_ind, col_ind) {\n\t\t\t\tif (data[row_ind] && data[row_ind].length>col_ind)\n\t\t\t\t\treturn data[row_ind][col_ind];\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tthis.render();\n\t\t},\n\n\t\trepeat: function(data) {\n\t\t\tthis.mapSelection(function(value, row, col, row_ind, col_ind) {\n\t\t\t\trow = data[row_ind%data.length];\n\t\t\t\tvalue = row[col_ind%row.length];\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tthis.render();\n\t\t},\n\n\t\tcustom: function() {}\n\t}\n};\n\nexport default TablePaste;","\n\nconst TreeAPI = {\n\topen: function(id, show) {\n\t\tif (!id) return;\n\t\t//ignore open for leaf items\n\t\tvar item = this.getItem(id);\n\t\tif (!item.$count || item.open) return;\n\n\t\tif (this.callEvent(\"onBeforeOpen\",[id])){\n\t\t\titem.open=true;\n\t\t\tthis.data.callEvent(\"onStoreUpdated\",[id, 0, \"branch\"]);\n\t\t\tthis.callEvent(\"onAfterOpen\",[id]);\n\t\t}\n\n\t\tif (show && id != \"0\")\n\t\t\tthis.open(this.getParentId(id), show);\n\t},\n\tclose: function(id) {\n\t\tif (!id) return;\n\t\tvar item = this.getItem(id);\n\t\tif (!item.open) return;\n\n\t\tif (this.callEvent(\"onBeforeClose\",[id])){\n\t\t\titem.open=false;\n\t\t\tthis.data.callEvent(\"onStoreUpdated\",[id, 0, \"branch\"]);\n\t\t\tthis.callEvent(\"onAfterClose\",[id]);\n\t\t}\n\t},\n\topenAll: function(id){\n\t\tthis.data.eachSubItem((id||0), function(obj, branch){\n\t\t\tif (branch)\n\t\t\t\tobj.open = true;\n\t\t});\n\t\tthis.data.refresh();\n\t},\n\tcloseAll: function(id){\n\t\tthis.data.eachSubItem((id||0), function(obj, branch){\n\t\t\tif (branch)\n\t\t\t\tobj.open = false;\n\t\t});\n\t\tthis.data.refresh();\n\t},\n\t_tree_check_uncheck:function(id,mode,e){\n\t\tif(this._settings.threeState)\n\t\t\treturn this._tree_check_uncheck_3(id,(mode !== null?mode:\"\"));\n\n\t\tvar value,\n\t\t\titem = this.getItem(id),\n\t\t\ttrg = (e? (e.target|| e.srcElement):null);\n\n\t\t//read actual value from HTML tag when possible\n\t\t//as it can be affected by dbl-clicks\n\t\tif(trg && trg.type == \"checkbox\")\n\t\t\tvalue = trg.checked?true:false;\n\t\telse\n\t\t\tvalue = (mode !== null?mode:!item.checked);\n\n\t\titem.checked = value;\n\t\tthis.callEvent(\"onItemCheck\", [id, item.checked, e]);\n\t},\n\tisBranchOpen:function(search_id){\n\t\tif (search_id == \"0\") return true;\n\n\t\tvar item = this.getItem(search_id);\n\t\tif (item.open)\n\t\t\treturn this.isBranchOpen(item.$parent);\n\t\treturn false;\n\t},\n\tgetOpenItems: function() {\n\t\tvar open = [];\n\t\tfor (var id in this.data.branch) {\n\t\t\tif (this.exists(id) && this.getItem(id).open)\n\t\t\t\topen.push(id);\n\t\t}\n\t\treturn open;\n\t},\n\tgetState: function(){\n\t\treturn {\n\t\t\topen: this.getOpenItems(),\n\t\t\tselect: this.getSelectedId(true)\n\t\t};\n\t},\n\t_repeat_set_state:function(tree, open){\n\t\tvar event = this.data.attachEvent(\"onStoreLoad\", function(){\n\t\t\ttree.setState.call(tree,open);\n\t\t\ttree.data.detachEvent(event);\n\t\t\ttree = null;\n\t\t});\n\t},\n\tsetState: function(state){\n\t\tif (state.open){\n\t\t\tthis.closeAll();\t\n\t\t\tvar open = state.open;\n\t\t\tfor (let i = 0; i < open.length; i++){\n\t\t\t\tvar item = this.getItem(open[i]);\n\t\t\t\tif (item && item.$count){\n\t\t\t\t\titem.open=true;\n\t\t\t\t\t//dynamic loading\n\t\t\t\t\tif (item.$count == -1){\n\t\t\t\t\t\t//call the same method after data loading\n\t\t\t\t\t\tthis._repeat_set_state(this, state);\n\t\t\t\t\t\tthis.refresh();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t//end processing\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.refresh();\n\t\t}\n\n\n\t\tif (state.select && this.select){\t\t\t\n\t\t\tvar select = state.select;\n\t\t\tthis.unselect();\n\t\t\tfor (let i = 0; i < select.length; i++)\n\t\t\t\tif (this.exists(select[i]))\n\t\t\t\t\tthis.select(select[i], true);\n\t\t}\n\n\t\treturn 1;\n\t}\n};\n\nexport default TreeAPI;","\n\nconst TreeClick = {\n\twebix_tree_open:function(e, id){\n\t\tthis.close(id);\n\t\treturn false;\n\t},\n\twebix_tree_close:function(e, id){\n\t\tthis.open(id);\n\t\treturn false;\n\t},\n\twebix_tree_checkbox:function(e,id){\n\t\tthis._tree_check_uncheck(id, null, e);\n\t\treturn false;\n\t}\n};\n\nexport default TreeClick;","import {bind} from \"../webix/helpers\";\nimport DataLoader from \"../core/dataloader\";\n\n\nconst TreeDataLoader = {\n\t$init:function(){\n\t\tthis.data.attachEvent(\"onStoreUpdated\", bind(this._sync_hierarchy, this), null, true);\n\t\t//redefine methods\n\t\tthis._feed_common = this._feed_commonA;\n\t},\n\t_feed_commonA:function(id, count, callback, url){\n\t\t// branch loading\n\t\tvar details = (count === 0?{parent: encodeURIComponent(id)}:null);\n\n\t\tDataLoader.prototype._feed_common.call(this,id, count, callback, url, details);\n\t},\n\t//load next set of data rows\n\tloadBranch:function(id, callback, url){\n\t\tid = id ||0;\n\t\tthis.data.url = url || this.data.url;\n\t\tif (this.callEvent(\"onDataRequest\", [id,callback,this.data.url]) && this.data.url)\n\t\t\tthis.data.feed.call(this, id, 0, callback, url);\n\t},\n\t_sync_hierarchy:function(id, data, mode){\n\t\tif (!mode || mode == \"add\" || mode == \"delete\" || mode == \"branch\"){\n\t\t\tthis.data._sync_to_order(this);\n\t\t}\n\t}\n};\n\nexport default TreeDataLoader;","import {isArray, copy as makeCopy, uid, PowerArray} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport DataMove from \"../core/datamove\";\n\n\n/*\n\tBehavior:DataMove - allows to move and copy elements, heavily relays on DataStore.move\n\t@export\n\t\tcopy\n\t\tmove\n*/\nconst TreeDataMove ={\n\t$init:function(){\n\t\tassert(this.data, \"DataMove :: Component doesn't have DataStore\");\n\t},\n\t//creates a copy of the item\n\tcopy:function(sid,tindex,tobj,details){\n\t\tdetails = details || {};\n\t\tdetails.copy = true;\n\t\treturn this.move(sid, tindex, tobj, details);\n\t},\n\t_next_move_index:function(nid, next, source){\n\t\tif (next && nid){\n\t\t\tvar new_index = this.getBranchIndex(nid);\n\t\t\treturn new_index+(source == this && source.getBranchIndex(next)\"+this._toHTMLItem(obj);\n\n\t\tif (obj.open)\n\t\t\thtml+=this._toHTMLLevel(obj.id);\n\n\t\thtml+=\"
\";\n\n\t\treturn html;\n\t},\n\t_toHTMLLevel:function(id){\n\t\tvar html = \"\";\n\t\tvar leaves = this.data.branch[id];\n\t\tif (leaves){\n\t\t\thtml+=\"\";\n\t\t}\n\t\treturn html;\n\t},\n\t//return true when some actual rendering done\n\trender:function(id,data,type){\n\t\tTreeRenderStack._obj = this;\t//can be used from complex render\n\n\t\tif (!this.isVisible(this._settings.id) || this.$blockRender)\n\t\t\treturn;\n\n\t\tif (id){\n\t\t\tvar cont, node;\n\t\t\tvar item = this.getItem(id);\n\t\t\tif (type!=\"add\"){\n\t\t\t\tcont = this.getItemNode(id);\n\t\t\t\tif (!cont) return;\n\t\t\t}\n\t\t\t\n\t\t\tswitch(type){\n\t\t\t\tcase \"branch\":\n\t\t\t\t\tvar branch = cont.parentNode;\n\t\t\t\t\tnode = this._toHTMLObject(item);\n\t\t\t\t\t\n\t\t\t\t\tinsertBefore(node, branch); \n\t\t\t\t\tremove(branch);\n\t\t\t\t\tthis._htmlmap = null;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"paint\":\n\t\t\t\tcase \"update\":\n\t\t\t\t\tnode = this._htmlmap[id] = this._toHTMLItemObject(item);\n\t\t\t\t\tinsertBefore(node, cont); \n\t\t\t\t\tremove(cont);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"delete\":\n\t\t\t\t\t//deleting not item , but full branch\n\t\t\t\t\tremove(cont.parentNode);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"add\":\n\t\t\t\t\tvar parent;\n\t\t\t\t\t//we want process both empty value and 0 as string\n\t\t\t\t\t//jshint -W041:true\n\t\t\t\t\tif (item.$parent == 0){\n\t\t\t\t\t\tparent = this._dataobj.firstChild;\n\t\t\t\t\t} else if(this.getItem(item.$parent).open){\n\t\t\t\t\t\tparent = this.getItemNode(item.$parent);\n\t\t\t\t\t\tif (parent){\n\t\t\t\t\t\t\t//when item created by the script, it will miss the container for child notes\n\t\t\t\t\t\t\t//create it on demand\n\t\t\t\t\t\t\tif (!parent.nextSibling){\n\t\t\t\t\t\t\t\tvar leafs = create(\"DIV\", { \"class\" : \"webix_tree_leaves\" },\"\");\n\t\t\t\t\t\t\t\tparent.parentNode.appendChild(leafs);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tparent = parent.nextSibling;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (parent){\n\t\t\t\t\t\tvar next = this.data.getNextSiblingId(id);\n\t\t\t\t\t\tnext = this.getItemNode(next);\n\t\t\t\t\t\tif (next)\n\t\t\t\t\t\t\tnext = next.parentNode;\n\n\t\t\t\t\t\tnode = this._toHTMLObject(item);\n\t\t\t\t\t\tthis._htmlmap[id] = node.firstChild;\n\t\t\t\t\t\tinsertBefore(node, next, parent);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.callEvent(\"onPartialRender\", [id,data,type]);\n\t\t} else {\n\t\t\t//full reset\n\t\t\tif (this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\t\t//will be used for lines management\n\t\t\t\tthis.type._tree_branch_render_state = [];\n\t\t\t\t//getTopRange - returns all elements on top level\n\t\t\t\tthis._dataobj.innerHTML = this._toHTMLLevel(0);\n\t\t\t\t\t\n\t\t\t\tthis._htmlmap = null; //clear map, it will be filled at first getItemNode\n\t\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t\t}\n\t\t}\n\n\t\t//clear after usage\n\t\tthis.type._tree_branch_render_state = 0;\n\t\tTreeRenderStack._obj = null;\n\t\treturn true;\n\t},\n\tgetItemNode:function(search_id){\n\t\tif (this._htmlmap)\n\t\t\treturn this._htmlmap[search_id];\n\t\t\t\n\t\t//fill map if it doesn't created yet\n\t\tthis._htmlmap={};\n\t\t\n\t\tvar t = this._dataobj.getElementsByTagName(\"DIV\");\n\t\tfor (var i=0; i < t.length; i++){\n\t\t\tvar id = t[i].getAttribute(this._id); //get item's\n\t\t\tif (id) \n\t\t\t\tthis._htmlmap[id]=t[i];\n\t\t}\n\t\t//call locator again, when map is filled\n\t\treturn this.getItemNode(search_id);\n\t},\n\t_branch_render_supported:1\n};\n\nexport default TreeRenderStack;","\n\nconst TreeStateCheckbox = {\n\t_init_render_tree_state: function(){\n\t\tif (this._branch_render_supported){\n\t\t\tvar old_render = this.render;\n\t\t\tthis.render = function(id,data){\n\t\t\t\tvar updated = old_render.apply(this,arguments);\n\n\t\t\t\tif(this._settings.threeState && updated && data != \"checkbox\")\n\t\t\t\t\tthis._setThirdState.apply(this,arguments);\n\t\t\t};\n\t\t\tthis._init_render_tree_state=function(){};\n\t\t}\n\t},\n\tthreeState_setter:function(value){\n\t\tif (value)\n\t\t\tthis._init_render_tree_state();\n\t\treturn value;\n\t},\n\t_setThirdState:function(id){\n\t\tvar i,leaves,parents,checkedParents,tree;\n\t\tparents = [];\n\t\ttree = this;\n\n\t\t/*if item was removed*/\n\t\tif(id&&!tree.data.pull[id]){\n\t\t\tid = 0;\n\t\t}\n\t\t/*sets checkbox states*/\n\t\t/*if branch or full reloading*/\n\t\tif(!id||tree.data.pull[id].$count){\n\t\t\tleaves = this._getAllLeaves(id);\n\t\t\tleaves.sort(function(a,b){\n\t\t\t\treturn tree.data.pull[b].$level - tree.data.pull[a].$level;\n\t\t\t});\n\t\t\tfor(i=0;i < leaves.length;i++){\n\t\t\t\tif(!i||tree.data.pull[leaves[i]].$parent!=tree.data.pull[leaves[i-1]].$parent)\n\t\t\t\t\tparents = parents.concat(tree._setParentThirdState(leaves[i]));\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t/*an item is a leaf */\n\t\t\tparents = parents.concat(tree._setParentThirdState(id));\n\t\t}\n\n\t\tcheckedParents = {};\n\t\tfor(i=0;i0||unsureCount>0){\n\t\t\t\tindeterminate = true;\n\t\t\t}\n\t\t\t\n\t\t\t//we need to reset indeterminate in any case :(\n\t\t\tif (indeterminate || indeterminate != item.indeterminate)\n\t\t\t\tneedrender = true;\n\t\t\titem.indeterminate = indeterminate;\n\t\t\tif (checked || item.checked != checked)\n\t\t\t\tneedrender = true;\n\t\t\titem.checked = checked;\n\n\t\t\tif (needrender){\n\t\t\t\tresult.push(parentId);\n\t\t\t\tparentId = this.getParentId(parentId);\n\t\t\t} else\n\t\t\t\tparentId = 0;\n\t\t}\n\n\t\treturn result;\n\t},\n\t/*get all checked items in tree*/\n\tgetChecked:function(){\n\t\tvar result=[];\n\t\tvar tree = this;\n\t\tthis.data.eachSubItem(0,function(obj){\n\t\t\tif (tree.isChecked(obj.id))\n\t\t\t\tresult.push(obj.id);\n\t\t});\n\t\treturn result;\n\t},\n\t_tree_check_uncheck_3:function(id, mode){\n\t\tvar item = this.getItem(id);\n\t\tif(item){\n\t\t\tif (mode === \"\") \n\t\t\t\tmode = !item.checked;\n\t\t\tif(item.checked != mode || item.indeterminate){\n\t\t\t\titem.checked = mode;\n\t\t\t\tthis._correctThreeState(id);\n\t\t\t\tvar parents = this._setParentThirdState(id);\n\t\t\t\tif (this._branch_render_supported && parents.length < 5){\n\t\t\t\t\tfor (var i=0; i= 0)\n\t\t\t\tbranches[parent][index] = newid;\n\t\t}\n\t},\n\tchangeId:function(old, newid){\n\t\tif(old == newid) return;\n\t\t\n\t\tvar parent = this.getItem(old).$parent;\n\t\tthis._change_branch_id(this.branch, parent, old, newid);\n\n\t\t//in case of filter applied, update id in filtered state as well\n\t\tif (this._filter_branch)\n\t\t\tthis._change_branch_id(this._filter_branch, parent, old, newid);\n\n\t\treturn DataStore.prototype.changeId.call(this, old, newid);\n\t},\n\tclearAll:function(soft){\n\t\tthis.branch = { 0:[] };\n\t\tDataStore.prototype.clearAll.call(this, soft);\t\n\t},\n\tgetPrevSiblingId:function(id){\n\t\tvar order = this.branch[this.getItem(id).$parent];\n\t\tvar pos = PowerArray.find.call(order, id)-1;\n\t\tif (pos>=0)\n\t\t\treturn order[pos];\n\t\treturn null;\n\t},\n\tgetNextSiblingId:function(id){\n\t\tvar order = this.branch[this.getItem(id).$parent];\n\t\tvar pos = PowerArray.find.call(order, id)+1;\n\t\tif (pos 0){\n\t\t\tvar branch = this.branch[id];\n\t\t\tfor(var i=0;i\";\n\t\treturn html;\n\t},\n\ticon:function(obj){\n\t\tif (obj.$count){\n\t\t\tif (obj.open)\n\t\t\t\treturn \"
\";\n\t\t\telse\n\t\t\t\treturn \"
\";\n\t\t} else\n\t\t\treturn \"
\";\n\t},\n\tcheckbox:function(obj){\n\t\tif(obj.nocheckbox)\n\t\t\treturn \"\";\n\t\treturn \"\";\n\t},\t\n\tfolder:function(obj){\n\t\tif (obj.icon)\n\t\t\treturn \"
\";\n\n\t\tif (obj.$count){\n\t\t\tif (obj.open)\n\t\t\t\treturn \"
\";\n\t\t\telse\n\t\t\t\treturn \"
\";\n\t\t}\n\t\treturn \"
\";\n\t}\n};\n\nexport default TreeType;","import {create, preventEvent} from \"../webix/html\";\nimport {uid, bind, extend} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\nimport {callEvent} from \"../webix/customevents\";\n\nimport env from \"../webix/env\";\nimport require from \"../load/require\";\nimport DataDriver from \"../load/drivers/index\";\n\n\nconst UploadDriver = {\n\tflash: {\n\t\t$render: function() {\n\n\t\t\tif (!window.swfobject)\n\t\t\t\trequire(\"legacy/swfobject.js\", true); // sync loading\n\n\t\t\tvar config = this._settings;\n\t\t\tconfig.swfId = (config.swfId||\"webix_swf_\"+uid());\n\n\t\t\tthis._getBox().innerHTML += \"
\";\n\t\t\tthis._upload_area = this._getBox().lastChild;\n\n\t\t\t// add swf object\n\t\t\t/* global swfobject */\n\t\t\tswfobject.embedSWF(env.codebase+\"/legacy/uploader.swf\", config.swfId, \"100%\", \"100%\", \"9\", null, {\n\t\t\t\tuploaderId: config.id,\n\t\t\t\tID: config.swfId,\n\t\t\t\tenableLogs:(config.enableLogs?\"1\":\"\"),\n\t\t\t\tparamName:(config.inputName),\n\t\t\t\tmultiple:(config.multiple?\"Y\":\"\")\n\t\t\t}, {wmode:\"transparent\"});\n\n\t\t\t_event(this._viewobj, \"click\", bind(function() {\n\t\t\t\tvar now_date = new Date();\n\t\t\t\tif (now_date - (this._upload_timer_click||0) > 250){\n\t\t\t\t\tthis.fileDialog();\n\t\t\t\t}\n\t\t\t}, this));\n\n\t\t\tthis.files.attachEvent(\"onBeforeDelete\", bind(this._stop_file,this));\n\t\t},\n\t\t$applyFlash: function(name,params){\n\t\t\treturn this[name].apply(this,params);\n\t\t},\n\t\tgetSwfObject: function(){\n\t\t\t/* global swfobject */\n\t\t\treturn swfobject.getObjectById(this._settings.swfId);\n\t\t},\n\t\tfileDialog:function(){\n\t\t\tif(this.getSwfObject())\n\t\t\t\tthis.getSwfObject().showDialog();\n\t\t},\n\t\tsend: function(id){\n\t\t\tif (typeof id == \"function\"){\n\t\t\t\tthis._last_assigned_upload_callback = id;\n\t\t\t\tid = 0;\n\t\t\t}\n\n\t\t\tif (!id){\n\t\t\t\tvar order = this.files.data.order;\n\t\t\t\tvar complete = true;\n\t\t\t\tif (order.length)\n\t\t\t\t\tfor (var i=0; i 250) {\n\t\t\t\t\tthis.fileDialog();\n\t\t\t\t}\n\t\t\t}, this));\n\n\t\t\t_event(this._viewobj, \"dragenter\", preventEvent);\n\t\t\t_event(this._viewobj, \"dragexit\", preventEvent);\n\t\t\t_event(this._viewobj, \"dragover\", preventEvent);\n\t\t},\n\t\t_directoryEntry: function(value) {\n\t\t\treturn value.isDirectory;\n\t\t},\n\t\t_directoryDrop: function(item, state, path) {\n\t\t\tif (item.isFile){\n\t\t\t\titem.file(function(file){\n\t\t\t\t\tstate.addFile(file, null, null, { name : path+\"/\"+file.name });\n\t\t\t\t});\n\t\t\t} else if (item.isDirectory) {\n\t\t\t\t// Get folder contents\n\t\t\t\tvar dirReader = item.createReader();\n\t\t\t\tdirReader.readEntries(function(entries){\n\t\t\t\t\tfor (var i = 0; i < entries.length; i++){\n\t\t\t\t\t\tstate._directoryDrop(entries[i], state, (path ? (path + \"/\") : \"\") + item.name);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// adding files by drag-n-drop\n\t\t_drop: function(e) {\n\t\t\tvar files = e.dataTransfer.files;\n\t\t\tvar items = e.dataTransfer.items;\n\n\t\t\tif (this.callEvent(\"onBeforeFileDrop\", [files, e])) {\n\t\t\t\titems = items || files; //IE10+\n\t\t\t\tfor (var i = 0; i < items.length; i++) {\n\t\t\t\t\t//https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry\n\t\t\t\t\tvar item = items[i];\n\t\t\t\t\tif (item.webkitGetAsEntry){\n\t\t\t\t\t\titem = item.webkitGetAsEntry();\n\t\t\t\t\t\tif (item.isDirectory){\n\t\t\t\t\t\t\tthis._directoryDrop(item, this, \"\");\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.addFile(files[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.callEvent(\"onAfterFileDrop\", [files, e]);\n\t\t},\n\t\tfileDialog:function(context){\n\t\t\tthis._upload_timer_click = new Date();\n\t\t\tthis._last_file_context = context;\n\t\t\tvar inputs = this._viewobj.getElementsByTagName(\"INPUT\");\n\t\t\tinputs[inputs.length-1].click();\n\t\t},\n\t\tsend: function(id){\n\t\t\t//alternative syntx send(callback)\n\t\t\tif (typeof id == \"function\"){\n\t\t\t\tthis._last_assigned_upload_callback = id;\n\t\t\t\tid = 0;\n\t\t\t}\n\n\t\t\tif (!id){\n\t\t\t\tvar order = this.files.data.order;\n\t\t\t\tvar complete = true;\n\n\t\t\t\tif (order.length)\n\t\t\t\t\tfor (var i=0; i= state.y + this._content_height)\n\t\t\tthis.scrollTo(0, dy);\n\t},\n\t//repain self after changes in DOM\n\t//for add, delete, move operations - render is delayed, to minify performance impact\n\trender:function(id,data,type){\n\t\tif (!this.isVisible(this._settings.id) || this.$blockRender)\n\t\t\treturn;\n\t\t\n\t\tif (id){\n\t\t\tvar cont = this.getItemNode(id);\t//old html element\n\t\t\tswitch(type){\n\t\t\t\tcase \"update\":\n\t\t\t\t\tif (!cont) return;\n\t\t\t\t\t//replace old with new\n\t\t\t\t\tvar t = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\t\tinsertBefore(t, cont); \n\t\t\t\t\tremove(cont);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: // \"move\", \"add\", \"delete\"\n\t\t\t\t\t/*\n\t\t\t\t\t\tfor all above operations, full repainting is necessary\n\t\t\t\t\t\tbut from practical point of view, we need only one repainting per thread\n\t\t\t\t\t\tcode below initiates double-thread-rendering trick\n\t\t\t\t\t*/\n\t\t\t\t\tthis._render_delayed();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t//full repainting\n\t\t\tif (this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\t\tthis._htmlmap = {}; \t\t\t\t\t//nulify links to already rendered elements\n\t\t\t\tthis._render_visible_rows(null, true);\t\n\t\t\t\t// clear delayed-rendering, because we already have repaint view\n\t\t\t\tthis._wait_for_render = false;\t\t\t\n\t\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t\t}\n\t\t}\n\t},\n\t//implement double-thread-rendering pattern\n\t_render_delayed:function(){\n\t\t//this flag can be reset from outside, to prevent actual rendering \n\t\tif (this._wait_for_render) return;\n\t\tthis._wait_for_render = true;\t\n\t\t\n\t\twindow.setTimeout(bind(function(){\n\t\t\tthis.render();\n\t\t},this),1);\n\t},\n\t//create empty placeholders, which will take space before rendering\n\t_create_placeholder:function(height){\n\t\tif(env.maxHTMLElementSize)\n\t\t\theight = Math.min(env.maxHTMLElementSize, height);\n\t\tvar node = document.createElement(\"DIV\");\n\t\tnode.style.cssText = \"height:\"+height+\"px; width:100%; overflow:hidden;\";\n\t\treturn node;\n\t},\n\t/*\n\t\tMethods get coordinatest of visible area and checks that all related items are rendered\n\t\tIf, during rendering, some not-loaded items was detected - extra data loading is initiated.\n\t\treset - flag, which forces clearing of previously rendered elements\n\t*/\n\t_render_visible_rows:function(e,reset){\n\t\tthis._unrendered_area=[]; //clear results of previous calls\n\t\t\n\t\tvar viewport = this._getVisibleRange();\t//details of visible view\n\n\t\tif (!this._dataobj.firstChild || reset){\t//create initial placeholder - for all view space\n\t\t\tthis._dataobj.innerHTML=\"\";\n\t\t\tthis._dataobj.appendChild(this._create_placeholder(viewport._max));\n\t\t\t//register placeholder in collection\n\t\t\tthis._htmlrows = [this._dataobj.firstChild];\n\t\t}\n\t\t\n\t\t/*\n\t\t\tvirtual rendering breaks all view on rows, because we know widht of item\n\t\t\twe can calculate how much items can be placed on single row, and knowledge \n\t\t\tof that, allows to calculate count of such rows\n\t\t\t\n\t\t\teach time after scrolling, code iterate through visible rows and render items \n\t\t\tin them, if they are not rendered yet\n\t\t\t\n\t\t\tboth rendered rows and placeholders are registered in _htmlrows collection\n\t\t*/\n\n\t\t//position of first visible row\n\t\tvar t = viewport._from;\n\t\t\t\n\t\twhile(t<=viewport._height){\t//loop for all visible rows\n\t\t\t//skip already rendered rows\n\t\t\twhile(this._htmlrows[t] && this._htmlrows[t]._filled && t<=viewport._height){\n\t\t\t\tt++; \n\t\t\t}\n\t\t\t//go out if all is rendered\n\t\t\tif (t>viewport._height) break;\n\t\t\t\n\t\t\t//locate nearest placeholder\n\t\t\tvar holder = t;\n\t\t\twhile (!this._htmlrows[holder]) holder--;\n\t\t\tvar holder_row = this._htmlrows[holder];\n\t\t\t\n\t\t\t//render elements in the row\t\t\t\n\t\t\tvar base = t*viewport._dx+(this.data.$min||0);\t//index of rendered item\n\t\t\tif (base > (this.data.$max||Infinity)) break;\t//check that row is in virtual bounds, defined by paging\n\t\t\tvar nextpoint = Math.min(base+viewport._dx-1,(this.data.$max?this.data.$max-1:Infinity));\n\t\t\tvar node = this._create_placeholder(viewport._y);\n\t\t\t//all items in rendered row\n\t\t\tvar range = this.data.getIndexRange(base, nextpoint);\n\t\t\tif (!range.length) break; \n\t\t\t\n\t\t\tvar loading = { $template:\"Loading\" };\n\t\t\tfor (let i=0; i0){\n\t\t\t\tholder_row.style.height = delta2+\"px\";\n\t\t\t\tthis._htmlrows[t+1] = holder_row;\n\t\t\t} else {\n\t\t\t\tif (delta<0)\n\t\t\t\t\tremove(holder_row);\n\t\t\t\telse\n\t\t\t\t\tholder_row.style.height = delta+\"px\";\n\t\t\t\tif (delta2>0){ \n\t\t\t\t\tvar new_space = this._htmlrows[t+1] = this._create_placeholder(delta2);\n\t\t\t\t\tinsertBefore(new_space,node.nextSibling,this._dataobj);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tt++;\n\t\t}\n\t\t\n\t\t//when all done, check for non-loaded items\n\t\tif (this._unrendered_area.length){\n\t\t\t//we have some data to load\n\t\t\t//detect borders\n\t\t\tvar from = this._unrendered_area[0];\n\t\t\tvar to = this._unrendered_area.pop()+1;\n\t\t\tif (to>from){\n\t\t\t\t//initiate data loading\n\t\t\t\tvar count = to - from;\n\t\t\t\tif (this._maybe_loading_already(count, from)) return;\n\n\t\t\t\tcount = Math.max(count, (this._settings.datafetch||this._settings.loadahead||0));\n\t\t\t\tthis.loadNext(count, from);\n\t\t\t}\n\t\t}\n\t},\n\t//calculates visible view\n\t_getVisibleRange:function(){\n\t\tvar state = this.getScrollState();\n\t\tvar top = Math.max(0, state.y);\n\t\tvar width = this._content_width; \n\t\tvar height = this._content_height;\n\n\t\t//size of single item\n\t\tvar t = this.type;\n\n\t\tvar dx = Math.floor(width/t.width)||1; //at least single item per row\n\t\t\n\t\tvar min = Math.floor(top/t.height);\t\t\t\t//index of first visible row\n\t\tvar dy = Math.ceil((height+top)/t.height)-1;\t\t//index of last visible row\n\t\t//total count of items, paging can affect this math\n\t\tvar count = this.data.$max?(this.data.$max-this.data.$min):this.data.count();\n\t\tvar max = Math.ceil(count/dx)*t.height;\t\t\t//size of view in rows\n\n\t\treturn { _from:min, _height:dy, _top:top, _max:max, _y:t.height, _dx:dx};\n\t},\n\t_cellPosition:function(id){\n\t\tvar html = this.getItemNode(id);\n\t\tif (!html){\n\t\t\tthis.showItem(id);\n\t\t\tthis._render_visible_rows();\n\t\t\thtml = this.getItemNode(id);\n\t\t}\n\t\treturn {\n\t\t\tleft:html.offsetLeft, \n\t\t\ttop:html.offsetTop,\n\t\t\theight:html.offsetHeight,\n\t\t\twidth:html.offsetWidth,\n\t\t\tparent:this._contentobj\n\t\t};\n\t}\n};\n\nexport default VirtualRenderStack;","import {offset, insertBefore, remove} from \"../webix/html\";\nimport {bind} from \"../webix/helpers\";\nimport base from \"../views/view\";\nimport {_event} from \"../webix/htmlevents\";\n\n\n/*\n\tRenders collection of items on demand\n*/\nconst VRenderStack = {\n\t$init:function(){\n\t\tthis._htmlmap = {};\n\t\t_event(this._viewobj, \"scroll\", bind(function(){\n\t\t\tthis.render(null, null, \"paint\");\n\t\t}, this));\n\t},\n\t//return html container by its ID\n\t//can return undefined if container doesn't exists\n\tgetItemNode:function(search_id){\n\t\treturn this._htmlmap && this._htmlmap[search_id];\n\t},\n\t/*change scrolling state of top level container, so related item will be in visible part*/\n\tshowItem:function(id){\n\t\tvar index = this.data.getIndexById(id);\n\t\tif (index > -1){\n\t\t\tvar top = index*this.type.height;\n\t\t\tvar bottom = top + this.type.height;\n\t\t\tvar scroll = this.getScrollState();\n\t\t\tvar box = offset(this.$view);\n\t\t\tif (top < scroll.y)\n\t\t\t\tthis.scrollTo(0, top);\n\t\t\telse if (bottom > scroll.y+box.height)\n\t\t\t\tthis.scrollTo(0, bottom-box.height);\n\t\t}\n\t},\n\t//update view after data update\n\t//when called without parameters - all view refreshed\n\trender:function(id,data,type){\n\t\tif (!this.isVisible(this._settings.id) || this.$blockRender)\n\t\t\treturn;\n\t\t\n\t\tvar parent = (this._renderobj||this._dataobj);\n\n\t\tif (id){\n\t\t\tif (type == \"paint\" || type == \"update\"){\n\t\t\t\tvar cont = this.getItemNode(id); //get html element of updated item\n\t\t\t\tif (cont){\n\t\t\t\t\tvar t = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\t\tt.style.top = cont.style.top;\n\t\t\t\t\tt.style.position = \"absolute\";\n\t\t\t\t\tt.style.left = 0; t.style.width = \"100%\";\n\n\t\t\t\t\tinsertBefore(t, cont); \n\t\t\t\t\tremove(cont);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t//updating not rendered yet item\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (type != \"paint\"){\n\t\t\t//repaint all\n\t\t\tthis._htmlmap = {};\n\t\t\tparent.innerHTML = \"\";\n\t\t}\n\n\t\t//full reset\n\t\tif (this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\tvar count = this.data.count();\n\t\t\tvar scroll = this.getScrollState();\n\t\t\tvar box = offset(this._viewobj);\n\n\t\t\tvar top = Math.floor(scroll.y / this.type.height)-2;\n\t\t\tvar bottom = Math.ceil((scroll.y + box.height)/ this.type.height)+2;\n\n\t\t\ttop = Math.max(0, top);\n\t\t\tbottom = Math.min(this.data.count()-1, bottom);\n\n\t\t\tvar html = [];\n\t\t\tfor (let i=top; i<=bottom; i++){\n\t\t\t\tvar sid = this.data.order[i];\n\t\t\t\tif (!this._htmlmap[sid]){\n\t\t\t\t\tvar item = this.data.getItem(sid);\n\t\t\t\t\tif (!item){\n\t\t\t\t\t\tthis._run_load_next({ \n\t\t\t\t\t\t\tcount:bottom-i+(this._settings.loadahead || 0),\n\t\t\t\t\t\t\tstart:i \n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\thtml.push(this._toHTML(item));\n\t\t\t\t} else {\n\t\t\t\t\thtml.push(\"
\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._html.innerHTML = html.join(\"\");\n\n\t\t\tparent.style.position = \"relative\";\n\t\t\tparent.style.height = count*this.type.height+\"px\";\n\n\t\t\tvar kids = this._html.childNodes;\n\t\t\tfor (let i=kids.length-1; i>=0; i--){\n\t\t\t\tvar child = kids[i];\n\t\t\t\tvar cid = child.getAttribute(this._id);\n\n\t\t\t\tif (cid){\n\t\t\t\t\tchild.style.position = \"absolute\";\n\t\t\t\t\tchild.style.top = (top+i)*this.type.height+\"px\";\n\t\t\t\t\tchild.style.left = 0; child.style.width = \"100%\";\n\n\t\t\t\t\tparent.appendChild(child);\n\t\t\t\t\tthis._htmlmap[cid] = child;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t}\n\t},\n\t$setSize:function(){\n\t\tif (base.api.$setSize.apply(this, arguments)){\n\t\t\tthis.render(null, null, \"paint\");\n\t\t}\n\t},\n\t_run_load_next:function(conf){\n\t\tvar count = Math.max(conf.count, (this._settings.datafetch||this._settings.loadahead||0));\n\t\tif (this._maybe_loading_already(conf.count, conf.start)) return;\n\t\tthis.loadNext(count, conf.start);\n\t}\n};\n\nexport default VRenderStack;","import state from \"../core/state\";\nimport i18n from \"../webix/i18n\";\nimport rules from \"../webix/rules\";\n\nimport {toNode} from \"../webix/helpers\";\nimport { event } from \"../webix/htmlevents\";\nimport {define} from \"../services\";\n\nvar _webix_msg_cfg = null;\nfunction callback(config, result){\n\tvar usercall = config.callback;\n\tmodality(false);\n\tconfig.box.parentNode.removeChild(config.box);\n\t_webix_msg_cfg = config.box = null;\n\tif (usercall)\n\t\tusercall(result,config.details);\n}\nfunction modal_key(e){\n\tif (_webix_msg_cfg){\n\t\te = e||event;\n\t\tvar code = e.which||event.keyCode;\n\t\tif (message.keyboard){\n\t\t\tif (code == 13 || code == 32)\n\t\t\t\tcallback(_webix_msg_cfg, true);\n\t\t\tif (code == 27)\n\t\t\t\tcallback(_webix_msg_cfg, false);\n\t\t\n\t\t\tif (e.preventDefault)\n\t\t\t\te.preventDefault();\n\t\t\treturn !(e.cancelBubble = true);\n\t\t}\n\t}\n}\n\nevent(document, \"keydown\", modal_key, { capture: true });\n\t\nfunction modality(mode){\n\tif(!modality.cover || !modality.cover.parentNode){\n\t\tmodality.cover = document.createElement(\"DIV\");\n\t\t//necessary for IE only\n\t\tmodality.cover.onkeydown = modal_key;\n\t\tmodality.cover.className = \"webix_modal_cover\";\n\t\tdocument.body.appendChild(modality.cover);\n\t}\n\tmodality.cover.style.display = mode?\"inline-block\":\"none\";\n}\n\nfunction button(text, result, className){\n\treturn \"
\"+text+\"
\";\n}\n\nfunction info(text){\n\tif (!t.area){\n\t\tt.area = document.createElement(\"DIV\");\n\t\tt.area.className = \"webix_message_area\";\n\t\tt.area.style[t.position]=\"5px\";\n\t\t\n\t\tdocument.body.appendChild(t.area);\n\t}\n\tt.area.setAttribute(\"role\", \"alert\");\n\tt.area.setAttribute(\"aria-atomic\", true);\n\tt.hide(text.id);\n\tvar message = document.createElement(\"DIV\");\n\tmessage.innerHTML = \"
\"+text.text+\"
\";\n\tmessage.className = \"webix_info webix_\" + text.type;\n\tmessage.onclick = function(){\n\t\tt.hide(text.id);\n\t\ttext = null;\n\t};\n\n\tif (state.$testmode)\n\t\tmessage.className += \" webix_no_transition\";\n\n\tif (t.position == \"bottom\" && t.area.firstChild)\n\t\tt.area.insertBefore(message,t.area.firstChild);\n\telse\n\t\tt.area.appendChild(message);\n\t\n\tif (text.expire > 0)\n\t\tt.timers[text.id]=window.setTimeout(function(){\n\t\t\tt.hide(text.id);\n\t\t}, text.expire);\n\n\t//styling for animation\n\tmessage.style.height = message.offsetHeight-2+\"px\";\n\n\tt.pull[text.id] = message;\n\tmessage = null;\n\n\treturn text.id;\n}\nfunction _boxStructure(config, ok, cancel){\n\tvar box = document.createElement(\"DIV\");\n\tbox.className = \" webix_modal_box webix_\"+config.type;\n\tbox.setAttribute(\"webixbox\", 1);\n\tbox.setAttribute(\"role\", \"alertdialog\");\n\tbox.setAttribute(\"aria-label\", config.title || \"\");\n\tbox.setAttribute(\"tabindex\", \"0\");\n\t\t\n\tvar inner = \"\";\n\tif (config.width)\n\t\tbox.style.width = config.width+(rules.isNumber(config.width)?\"px\":\"\");\n\tif (config.height)\n\t\tbox.style.height = config.height+(rules.isNumber(config.height)?\"px\":\"\");\n\tif (config.title)\n\t\tinner+=\"
\"+config.title+\"
\";\n\tinner+=\"
\"+(config.content?\"\":config.text)+\"
\";\n\tif (ok || config.ok)\n\t\tinner += button(config.ok || i18n.message.ok, true,\"confirm\");\n\tif (cancel || config.cancel)\n\t\tinner += button(config.cancel || i18n.message.cancel, false);\n\tif (config.buttons){\n\t\tfor (var i=0; i\";\n\tbox.innerHTML = inner;\n\n\tif (config.content){\n\t\tvar node = config.content;\n\t\tif (typeof node == \"string\") \n\t\t\tnode = document.getElementById(node);\n\t\tif (node.style.display == \"none\")\n\t\t\tnode.style.display = \"\";\n\t\tbox.childNodes[config.title?1:0].appendChild(node);\n\t}\n\n\tbox.onclick = function(e){\n\t\te = e ||event;\n\t\tvar source = e.target || e.srcElement;\n\t\tif (!source.className) source = source.parentNode;\n\t\tif (source.className.indexOf(\"webix_popup_button\")!=-1){\n\t\t\tvar result = source.getAttribute(\"result\");\n\t\t\tresult = (result == \"true\")||(result == \"false\"?false:result);\n\t\t\tcallback(config, result);\n\t\t}\n\t\te.cancelBubble = true;\n\t};\n\tconfig.box = box;\n\tif (ok||cancel||config.buttons)\n\t\t_webix_msg_cfg = config;\n\n\treturn box;\n}\nfunction _createBox(config, ok, cancel){\n\tvar box = config.tagName ? config : _boxStructure(config, ok, cancel);\n\t\n\tif (!config.hidden)\n\t\tmodality(true);\n\n\ttoNode(config.container || document.body).appendChild(box);\n\t\t\n\tvar x = config.left||Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth) - box.offsetWidth)/2));\n\tvar y = config.top||Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight) - box.offsetHeight)/2));\n\tif (config.position == \"top\")\n\t\tbox.style.top = \"-3px\";\n\telse\n\t\tbox.style.top = y+\"px\";\n\tbox.style.left = x+\"px\";\n\t//necessary for IE only\n\tbox.onkeydown = modal_key;\n\n\tbox.focus();\n\tif (config.hidden)\n\t\tmodalbox.hide(box);\n\n\treturn box;\n}\n\nfunction alertPopup(config){\n\treturn _createBox(config, true, false);\n}\nfunction confirmPopup(config){\n\treturn _createBox(config, true, true);\n}\nfunction boxPopup(config){\n\treturn _createBox(config);\n}\nfunction box_params(text, type, callback){\n\tif (typeof text != \"object\"){\n\t\tif (typeof type == \"function\"){\n\t\t\tcallback = type;\n\t\t\ttype = \"\";\n\t\t}\n\t\ttext = {text:text, type:type, callback:callback };\n\t}\n\treturn text;\n}\nfunction params(text, type, expire, id){\n\tif (typeof text != \"object\")\n\t\ttext = {text:text, type:type, expire:expire, id:id};\n\ttext.id = text.id||t.uid();\n\ttext.expire = text.expire||t.expire;\n\treturn text;\n}\nexport function alert(){\n\tvar text = box_params.apply(this, arguments);\n\ttext.type = text.type || \"confirm\";\n\treturn alertPopup(text);\n}\nexport function confirm(){\n\tvar text = box_params.apply(this, arguments);\n\ttext.type = text.type || \"alert\";\n\treturn confirmPopup(text);\n}\n\nexport function modalbox(){\n\tvar text = box_params.apply(this, arguments);\n\ttext.type = text.type || \"alert\";\n\treturn boxPopup(text);\n}\n\nmodalbox.hide = function(node){\n\tif(node){\n\t\twhile (node && node.getAttribute && !node.getAttribute(\"webixbox\"))\n\t\t\tnode = node.parentNode;\n\t\tif (node){\n\t\t\tnode.parentNode.removeChild(node);\n\t\t}\n\t}\n\n\tmodality(false);\n\t_webix_msg_cfg = null;\n};\nexport function message(text, type, expire, id){ //eslint-disable-line\n\ttext = params.apply(this, arguments);\n\ttext.type = text.type||\"info\";\n\n\tvar subtype = text.type.split(\"-\")[0];\n\tswitch (subtype){\n\t\tcase \"alert\":\n\t\t\treturn alertPopup(text);\n\t\tcase \"confirm\":\n\t\t\treturn confirmPopup(text);\n\t\tcase \"modalbox\":\n\t\t\treturn boxPopup(text);\n\t\tdefault:\n\t\t\treturn info(text);\n\t}\n}\n\nvar t = message;\nt.seed = (new Date()).valueOf();\nt.uid = function(){return t.seed++;};\nt.expire = 4000;\nt.keyboard = true;\nt.position = \"top\";\nt.pull = {};\nt.timers = {};\n\nt.hideAll = function(){\n\tfor (var key in t.pull)\n\t\tt.hide(key);\n};\nt.hide = function(id){\n\tvar obj = t.pull[id];\n\tif (obj && obj.parentNode){\n\t\twindow.setTimeout(function(){\n\t\t\tobj.parentNode.removeChild(obj);\n\t\t\tobj = null;\n\t\t},2000);\n\t\t//styling for animation\n\t\tobj.style.height = 0;\n\t\tobj.className+=\" hidden\";\n\t\tt.area.removeAttribute(\"role\");\n\t\t\n\t\tif(t.timers[id])\n\t\t\twindow.clearTimeout(t.timers[id]);\n\t\tdelete t.pull[id];\n\t}\n};\n\n//override circualr dependencies\ndefine(\"message\", message);\nexport default modalbox;","const en = {\n\tgroupDelimiter:\",\",\n\tgroupSize:3,\n\tdecimalDelimiter:\".\",\n\tdecimalSize:2,\n\n\tdateFormat:\"%m/%d/%Y\",\n\ttimeFormat:\"%h:%i %A\",\n\tlongDateFormat:\"%d %F %Y\",\n\tfullDateFormat:\"%m/%d/%Y %h:%i %A\",\n\tam:[\"am\",\"AM\"],\n\tpm:[\"pm\",\"PM\"],\n\n\tprice:\"${obj}\",\n\tpriceSettings:{\n\t\tgroupDelimiter:\",\",\n\t\tgroupSize:3,\n\t\tdecimalDelimiter:\".\",\n\t\tdecimalSize:2\n\t},\n\tfileSize: [\"b\",\"Kb\",\"Mb\",\"Gb\",\"Tb\",\"Pb\",\"Eb\"],\n\t\n\tcalendar: {\n\t\tmonthFull:[\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n\t\tmonthShort:[\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n\t\tdayFull:[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n\t\tdayShort:[\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n\t\thours: \"Hours\",\n\t\tminutes: \"Minutes\",\n\t\tdone:\"Done\",\n\t\tclear: \"Clear\",\n\t\ttoday: \"Today\"\n\t},\n\n\tdataExport:{\n\t\tpage:\"Page\",\n\t\tof:\"of\"\n\t},\n\tPDFviewer:{\n\t\tof:\"of\",\n\t\tautomaticZoom:\"Automatic Zoom\",\n\t\tactualSize:\"Actual Size\",\n\t\tpageFit:\"Page Fit\",\n\t\tpageWidth:\"Page Width\",\n\t\tpageHeight:\"Page Height\"\n\t},\n\taria:{\n\t\tcalendar:\"Calendar\",\n\t\tincreaseValue:\"Increase value\",\n\t\tdecreaseValue:\"Decrease value\",\n\t\tnavMonth:[\"Previous month\", \"Next month\"],\n\t\tnavYear:[\"Previous year\", \"Next year\"],\n\t\tnavDecade:[\"Previous decade\", \"Next decade\"],\n\t\tdateFormat:\"%d %F %Y\",\n\t\tmonthFormat:\"%F %Y\",\n\t\tyearFormat:\"%Y\",\n\t\thourFormat:\"Hours: %h %A\",\n\t\tminuteFormat:\"Minutes: %i\",\n\t\tremoveItem:\"Remove item\",\n\t\tpages:[\"First page\", \"Previous page\", \"Next page\", \"Last page\"],\n\t\tpage:\"Page\",\n\t\theadermenu:\"Header menu\",\n\t\topenGroup:\"Open column group\",\n\t\tcloseGroup:\"Close column group\",\n\t\tcloseTab:\"Close tab\",\n\t\tshowTabs:\"Show more tabs\",\n\t\tresetTreeMap:\"Reset tree map\",\n\t\tnavTreeMap:\"Level up\",\n\t\tnextTab:\"Next tab\",\n\t\tprevTab:\"Previous tab\",\n\t\tmultitextSection:\"Add section\",\n\t\tmultitextextraSection:\"Remove section\",\n\t\tshowChart:\"Show chart\",\n\t\thideChart:\"Hide chart\",\n\t\tresizeChart:\"Resize chart\"\n\t},\n\trichtext:{\n\t\tunderline: \"Underline\",\n\t\tbold: \"Bold\",\n\t\titalic: \"Italic\"\n\t},\n\tcombo:{\n\t\tselect:\"Select\",\n\t\tselectAll:\"Select all\",\n\t\tunselectAll:\"Unselect all\"\n\t},\n\tmessage:{\n\t\tok:\"OK\",\n\t\tcancel:\"Cancel\"\n\t}\n};\n\nexport default en;","import env from \"../webix/env\";\nimport i18n from \"../webix/i18n\";\n\n\nconst wDate = {\n\tstartOnMonday:false,\n\n\ttoFixed:function(num, ms){\n\t\tif( num<10)\tnum = \"0\"+num;\n\t\tif( ms && num <100 ) num = \"0\"+num;\n\t\treturn num;\n\t},\n\tweekStart:function(date){\n\t\tdate = this.copy(date);\n\n\t\tvar shift=date.getDay();\n\t\tif (this.startOnMonday){\n\t\t\tif (shift===0) shift=6;\n\t\t\telse shift--;\n\t\t}\n\t\treturn this.datePart(this.add(date,-1*shift,\"day\"));\n\t},\n\tmonthStart:function(date){\n\t\tdate = this.copy(date);\n\n\t\tdate.setDate(1);\n\t\treturn this.datePart(date);\n\t},\n\tyearStart:function(date){\n\t\tdate = this.copy(date);\n\n\t\tdate.setMonth(0);\n\t\treturn this.monthStart(date);\n\t},\n\tdayStart:function(date){\n\t\treturn this.datePart(date, true);\n\t},\n\tdateToStr:function(format,utc){\n\t\tif (typeof format == \"function\") return format;\n\n\t\tif(env.strict){\n\t\t\treturn function(date){\n\t\t\t\tvar str = \"\";\n\t\t\t\tvar lastPos = 0;\n\t\t\t\tformat.replace(/%[a-zA-Z]/g,function(s,pos){\n\t\t\t\t\tstr += format.slice(lastPos,pos);\n\t\t\t\t\tvar fn = function(date){\n\t\t\t\t\t\tif( s == \"%d\") return wDate.toFixed(date.getDate());\n\t\t\t\t\t\tif( s == \"%m\") return wDate.toFixed((date.getMonth()+1));\n\t\t\t\t\t\tif( s == \"%j\") return date.getDate();\n\t\t\t\t\t\tif( s == \"%n\") return (date.getMonth()+1);\n\t\t\t\t\t\tif( s == \"%y\") return wDate.toFixed(date.getFullYear()%100);\n\t\t\t\t\t\tif( s == \"%Y\") return date.getFullYear();\n\t\t\t\t\t\tif( s == \"%D\") return i18n.calendar.dayShort[date.getDay()];\n\t\t\t\t\t\tif( s == \"%l\") return i18n.calendar.dayFull[date.getDay()];\n\t\t\t\t\t\tif( s == \"%M\") return i18n.calendar.monthShort[date.getMonth()];\n\t\t\t\t\t\tif( s == \"%F\") return i18n.calendar.monthFull[date.getMonth()];\n\t\t\t\t\t\tif( s == \"%h\") return wDate.toFixed((date.getHours()+11)%12+1);\n\t\t\t\t\t\tif( s == \"%g\") return ((date.getHours()+11)%12+1);\n\t\t\t\t\t\tif( s == \"%G\") return date.getHours();\n\t\t\t\t\t\tif( s == \"%H\") return wDate.toFixed(date.getHours());\n\t\t\t\t\t\tif( s == \"%i\") return wDate.toFixed(date.getMinutes());\n\t\t\t\t\t\tif( s == \"%a\") return (date.getHours()>11?i18n.pm[0]:i18n.am[0]);\n\t\t\t\t\t\tif( s == \"%A\") return (date.getHours()>11?i18n.pm[1]:i18n.am[1]);\n\t\t\t\t\t\tif( s == \"%s\") return wDate.toFixed(date.getSeconds());\n\t\t\t\t\t\tif( s == \"%S\")\treturn wDate.toFixed(date.getMilliseconds(), true);\n\t\t\t\t\t\tif( s == \"%W\") return wDate.toFixed(Date.getISOWeek(date));\n\t\t\t\t\t\tif( s == \"%c\"){\n\t\t\t\t\t\t\tvar str = date.getFullYear();\n\t\t\t\t\t\t\tstr += \"-\"+wDate.toFixed((date.getMonth()+1));\n\t\t\t\t\t\t\tstr += \"-\"+wDate.toFixed(date.getDate());\n\t\t\t\t\t\t\tstr += \"T\";\n\t\t\t\t\t\t\tstr += wDate.toFixed(date.getHours());\n\t\t\t\t\t\t\tstr += \":\"+wDate.toFixed(date.getMinutes());\n\t\t\t\t\t\t\tstr += \":\"+wDate.toFixed(date.getSeconds());\n\t\t\t\t\t\t\treturn str;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t};\n\t\t\t\t\tstr += fn(date);\n\t\t\t\t\tlastPos = pos + 2;\n\t\t\t\t});\n\t\t\t\tstr += format.slice(lastPos,format.length);\n\t\t\t\treturn str;\n\t\t\t};\n\n\t\t}\n\n\t\tformat=format.replace(/%[a-zA-Z]/g,function(a){\n\t\t\tswitch(a){\n\t\t\t\tcase \"%d\": return \"\\\"+wDate.toFixed(date.getDate())+\\\"\";\n\t\t\t\tcase \"%m\": return \"\\\"+wDate.toFixed((date.getMonth()+1))+\\\"\";\n\t\t\t\tcase \"%j\": return \"\\\"+date.getDate()+\\\"\";\n\t\t\t\tcase \"%n\": return \"\\\"+(date.getMonth()+1)+\\\"\";\n\t\t\t\tcase \"%y\": return \"\\\"+wDate.toFixed(date.getFullYear()%100)+\\\"\"; \n\t\t\t\tcase \"%Y\": return \"\\\"+date.getFullYear()+\\\"\";\n\t\t\t\tcase \"%D\": return \"\\\"+i18n.calendar.dayShort[date.getDay()]+\\\"\";\n\t\t\t\tcase \"%l\": return \"\\\"+i18n.calendar.dayFull[date.getDay()]+\\\"\";\n\t\t\t\tcase \"%M\": return \"\\\"+i18n.calendar.monthShort[date.getMonth()]+\\\"\";\n\t\t\t\tcase \"%F\": return \"\\\"+i18n.calendar.monthFull[date.getMonth()]+\\\"\";\n\t\t\t\tcase \"%h\": return \"\\\"+wDate.toFixed((date.getHours()+11)%12+1)+\\\"\";\n\t\t\t\tcase \"%g\": return \"\\\"+((date.getHours()+11)%12+1)+\\\"\";\n\t\t\t\tcase \"%G\": return \"\\\"+date.getHours()+\\\"\";\n\t\t\t\tcase \"%H\": return \"\\\"+wDate.toFixed(date.getHours())+\\\"\";\n\t\t\t\tcase \"%i\": return \"\\\"+wDate.toFixed(date.getMinutes())+\\\"\";\n\t\t\t\tcase \"%a\": return \"\\\"+(date.getHours()>11?i18n.pm[0]:i18n.am[0])+\\\"\";\n\t\t\t\tcase \"%A\": return \"\\\"+(date.getHours()>11?i18n.pm[1]:i18n.am[1])+\\\"\";\n\t\t\t\tcase \"%s\": return \"\\\"+wDate.toFixed(date.getSeconds())+\\\"\";\n\t\t\t\tcase \"%S\": return \"\\\"+wDate.toFixed(date.getMilliseconds(), true)+\\\"\";\n\t\t\t\tcase \"%W\": return \"\\\"+wDate.toFixed(wDate.getISOWeek(date))+\\\"\";\n\t\t\t\tcase \"%c\":\n\t\t\t\t\tvar str = \"\\\"+date.getFullYear()+\\\"\";\n\t\t\t\t\tstr += \"-\\\"+wDate.toFixed((date.getMonth()+1))+\\\"\";\n\t\t\t\t\tstr += \"-\\\"+wDate.toFixed(date.getDate())+\\\"\";\n\t\t\t\t\tstr += \"T\";\n\t\t\t\t\tstr += \"\\\"+wDate.toFixed(date.getHours())+\\\"\";\n\t\t\t\t\tstr += \":\\\"+wDate.toFixed(date.getMinutes())+\\\"\";\n\t\t\t\t\tstr += \":\\\"+wDate.toFixed(date.getSeconds())+\\\"\";\n\t\t\t\t\tif(utc === true)\n\t\t\t\t\t\tstr += \"Z\";\n\t\t\t\t\treturn str;\n\n\t\t\t\tdefault: return a;\n\t\t\t}\n\t\t});\n\t\tif (utc===true) format=format.replace(/date\\.get/g,\"date.getUTC\");\n\t\tconst temp = new Function(\"date\", \"i18n\", \"wDate\", \"if (!date) return ''; if (!date.getMonth) date=i18n.parseFormatDate(date); return \\\"\"+format+\"\\\";\");\n\t\treturn function(v){ return temp(v, i18n, wDate); };\n\t},\n\tstrToDate:function(format,utc){\n\t\tif (typeof format == \"function\") return format;\n\n\t\tvar mask=format.match(/%[a-zA-Z]/g);\n\t\tvar splt=\"var temp=date.split(/[^0-9a-zA-Z]+/g);\";\n\t\tvar i,t,s;\n\n\t\tif(!i18n.calendar.monthShort_hash){\n\t\t\ts = i18n.calendar.monthShort;\n\t\t\tt = i18n.calendar.monthShort_hash = {};\n\t\t\tfor (i = 0; i < s.length; i++)\n\t\t\t\tt[s[i]]=i;\n\n\t\t\ts = i18n.calendar.monthFull;\n\t\t\tt = i18n.calendar.monthFull_hash = {};\n\t\t\tfor (i = 0; i < s.length; i++)\n\t\t\t\tt[s[i]]=i;\n\t\t}\n\n\t\tif(env.strict){\n\t\t\treturn function(date){\n\t\t\t\tif (!date) return \"\";\n\t\t\t\tif (typeof date == \"object\") return date;\n\t\t\t\tvar temp=date.split(/[^0-9a-zA-Z]+/g);\n\t\t\t\tvar set=[0,0,1,0,0,0,0];\n\t\t\t\tfor (i=0; i30?1900:2000);\n\t\t\t\t\telse if( a == \"%Y\"){\n\t\t\t\t\t\tset[0]=(temp[i]||0)*1; if (set[0]<30) set[0]+=2000;\n\t\t\t\t\t}\n\t\t\t\t\telse if( a == \"%n\" || a == \"%m\")\n\t\t\t\t\t\tset[1]=(temp[i]||1)-1;\n\t\t\t\t\telse if( a == \"%M\")\n\t\t\t\t\t\tset[1]=i18n.calendar.monthShort_hash[temp[i]]||0;\n\t\t\t\t\telse if( a == \"%F\")\n\t\t\t\t\t\tset[1]=i18n.calendar.monthFull_hash[temp[i]]||0;\n\t\t\t\t\telse if( a == \"%j\" || a == \"%d\")\n\t\t\t\t\t\tset[2]=temp[i]||1;\n\t\t\t\t\telse if( a == \"%g\" || a == \"%G\" || a == \"%h\" || a == \"%H\")\n\t\t\t\t\t\tset[3]=temp[i]||0;\n\t\t\t\t\telse if( a == \"%a\")\n\t\t\t\t\t\tset[3]=set[3]%12+((temp[i]||\"\")==i18n.am[0]?0:12);\n\t\t\t\t\telse if( a == \"%A\")\n\t\t\t\t\t\tset[3]=set[3]%12+((temp[i]||\"\")==i18n.am[1]?0:12);\n\t\t\t\t\telse if( a == \"%i\")\n\t\t\t\t\t\tset[4]=temp[i]||0;\n\t\t\t\t\telse if( a == \"%s\")\n\t\t\t\t\t\tset[5]=temp[i]||0;\n\t\t\t\t\telse if( a == \"%S\")\n\t\t\t\t\t\tset[6]=temp[i]||0;\n\t\t\t\t\telse if( a == \"%c\"){\n\t\t\t\t\t\tvar reg = /(\\d+)-(\\d+)-(\\d+)T(\\d+):(\\d+):(\\d+)(\\+.*|)/g;\n\t\t\t\t\t\tvar res = reg.exec(date);\n\t\t\t\t\t\tset[0]= (res[1]||0)*1; if (set[0]<30) set[0]+=2000;\n\t\t\t\t\t\tset[1]= (res[2]||1)-1;\n\t\t\t\t\t\tset[2]= res[3]||1;\n\t\t\t\t\t\tset[3]= res[4]||0;\n\t\t\t\t\t\tset[4]= res[5]||0;\n\t\t\t\t\t\tset[5]= res[6]||0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(utc)\n\t\t\t\t\treturn new Date(Date.UTC(set[0],set[1],set[2],set[3],set[4],set[5], set[6]));\n\t\t\t\treturn new Date(set[0],set[1],set[2],set[3],set[4],set[5], set[6]);\n\t\t\t};\n\t\t}\n\n\t\tfor (i=0; i30?1900:2000);\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%g\":\n\t\t\t\tcase \"%G\":\n\t\t\t\tcase \"%h\": \n\t\t\t\tcase \"%H\":\n\t\t\t\t\tsplt+=\"set[3]=temp[\"+i+\"]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%i\":\n\t\t\t\t\tsplt+=\"set[4]=temp[\"+i+\"]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%Y\": splt+=\"set[0]=(temp[\"+i+\"]||0)*1; if (set[0]<30) set[0]+=2000;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%a\":\n\t\t\t\t\tsplt+= \"set[3]=set[3]%12+(temp[\"+i+\"]==i18n.am[0]?0:12);\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%A\":\n\t\t\t\t\tsplt+= \"set[3]=set[3]%12+(temp[\"+i+\"]==i18n.am[1]?0:12);\";\n\t\t\t\t\tbreak;\t\t\t\t\t\n\t\t\t\tcase \"%s\": splt+=\"set[5]=temp[\"+i+\"]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%S\": splt+=\"set[6]=temp[\"+i+\"]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%M\": splt+=\"set[1]=i18n.calendar.monthShort_hash[temp[\"+i+\"]]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%F\": splt+=\"set[1]=i18n.calendar.monthFull_hash[temp[\"+i+\"]]||0;\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"%c\":\n\t\t\t\t\tsplt+= \"var res = date.split('T');\";\n\t\t\t\t\tsplt+= \"if(res[0]){ var d = res[0].split('-');\";\n\t\t\t\t\tsplt+= \"set[0]= (d[0]||0)*1; if (set[0]<30) set[0]+=2000;\";\n\t\t\t\t\tsplt+= \"set[1]= (d[1]||1)-1;\";\n\t\t\t\t\tsplt+= \"set[2]= d[2]||1;}\";\n\t\t\t\t\tsplt+= \"if(res[1]){ var t = res[1].split(':');\";\n\t\t\t\t\tsplt+= \"set[3]= t[0]||0;\";\n\t\t\t\t\tsplt+= \"set[4]= t[1]||0;\";\n\t\t\t\t\tsplt+= \"set[5]= parseInt(t[2])||0;}\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar code =\"set[0],set[1],set[2],set[3],set[4],set[5], set[6]\";\n\t\tif (utc) code =\" Date.UTC(\"+code+\")\";\n\t\tconst temp = new Function(\"date\", \"i18n\", \"if (!date) return ''; if (typeof date == 'object') return date; var set=[0,0,1,0,0,0,0]; \"+splt+\" return new Date(\"+code+\");\");\n\t\treturn function(v){ return temp(v, i18n ); };\n\t},\n\t\t\n\tgetISOWeek: function(ndate) {\n\t\tif(!ndate) return false;\n\t\tvar nday = ndate.getDay();\n\t\tif (nday === 0) {\n\t\t\tnday = 7;\n\t\t}\n\t\tvar first_thursday = new Date(ndate.valueOf());\n\t\tfirst_thursday.setDate(ndate.getDate() + (4 - nday));\n\t\tvar year_number = first_thursday.getFullYear(); // year of the first Thursday\n\t\tvar ordinal_date = Math.floor( (first_thursday.getTime() - new Date(year_number, 0, 1).getTime()) / 86400000); //ordinal date of the first Thursday - 1 (so not really ordinal date)\n\t\tvar weekNumber = 1 + Math.floor( ordinal_date / 7);\t\n\t\treturn weekNumber;\n\t},\n\t\n\tgetUTCISOWeek: function(ndate){\n\t\treturn this.getISOWeek(ndate);\n\t},\n\t_correctDate: function(d,d0,inc,checkFunc){\n\t\tif(!inc)\n\t\t\treturn;\n\t\tvar incorrect = checkFunc(d,d0);\n\t\tif(incorrect){\n\t\t\tvar i = (inc>0?1:-1);\n\n\t\t\twhile(incorrect){\n\t\t\t\td.setHours(d.getHours()+i);\n\t\t\t\tincorrect = checkFunc(d,d0);\n\t\t\t\ti += (inc>0?1:-1);\n\t\t\t}\n\t\t}\n\t},\n\tadd:function(date,inc,mode,copy){\n\t\tif (copy) date = this.copy(date);\n\t\tvar d = wDate.copy(date);\n\t\tswitch(mode){\n\t\t\tcase \"day\":\n\t\t\t\tdate.setDate(date.getDate()+inc);\n\t\t\t\tthis._correctDate(date,d,inc,function(d,d0){\n\t\t\t\t\treturn \twDate.datePart(d0,true).valueOf()== wDate.datePart(d,true).valueOf();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"week\":\n\t\t\t\tdate.setDate(date.getDate()+7*inc);\n\t\t\t\tthis._correctDate(date,d,7*inc,function(d,d0){\n\t\t\t\t\treturn \twDate.datePart(d0,true).valueOf()== wDate.datePart(d,true).valueOf();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"month\":\n\t\t\t\tdate.setMonth(date.getMonth()+inc);\n\t\t\t\tthis._correctDate(date,d,inc,function(d,d0){\n\t\t\t\t\treturn \td0.getMonth() == d.getMonth() && d0.getYear() == d.getYear();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"year\":\n\t\t\t\tdate.setYear(date.getFullYear()+inc);\n\t\t\t\tthis._correctDate(date,d,inc,function(d,d0){\n\t\t\t\t\treturn \td0.getFullYear() == d.getFullYear();\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"hour\":\n\t\t\t\tdate.setHours(date.getHours()+inc);\n\t\t\t\tthis._correctDate(date,d,inc,function(d,d0){\n\t\t\t\t\treturn \td0.getHours() == d.getHours() && Date.datePart(d0,true)== Date.datePart(d,true);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase \"minute\": \tdate.setMinutes(date.getMinutes()+inc); break;\n\t\t\tdefault:\n\t\t\t\twDate.add[mode](date, inc, mode);\n\t\t\t\tbreak;\n\t\t}\n\t\treturn date;\n\t},\n\tdatePart:function(date, copy){\n\t\tif (copy) date = this.copy(date);\n\n\t\t// workaround for non-existent hours\n\t\tvar d = this.copy(date);\n\t\td.setHours(0);\n\t\tif(d.getDate()!=date.getDate()){\n\t\t\tdate.setHours(1);\n\t\t}\n\t\telse{\n\t\t\tdate.setHours(0);\n\t\t}\n\n\t\tdate.setMinutes(0);\n\t\tdate.setSeconds(0);\n\t\tdate.setMilliseconds(0);\n\t\treturn date;\n\t},\n\ttimePart:function(date, copy){\n\t\tif (copy) date = this.copy(date);\n\t\treturn (date.valueOf()/1000 - date.getTimezoneOffset()*60)%86400;\n\t},\n\tcopy:function(date){\n\t\treturn new Date(date.valueOf());\n\t},\n\tequal:function(a,b){\n\t\tif (!a || !b) return false;\n\t\treturn a.valueOf() === b.valueOf();\n\t},\n\tisHoliday:function(day){ \n\t\tday = day.getDay();\n\t\tif (day === 0 || day==6) return \"webix_cal_event\"; \n\t}\n};\n\nexport default wDate;","import i18n from \"../webix/i18n\";\n\nconst Number={\n\tgetConfig: function(value){\n\t\tvar config = {\n\t\t\tdecimalSize:0,\n\t\t\tgroupSize:999,\n\t\t\tprefix:\"\",\n\t\t\tsufix:\"\"\n\t\t};\n\t\tvar parts = value.split(/[0-9].*[0-9]/g);\n\t\tif (parts[0].length)\n\t\t\tconfig.prefix = parts[0];\n\t\tif (parts[1].length)\n\t\t\tconfig.sufix = parts[1];\n\t\tif (config.prefix || config.sufix){\n\t\t\tvalue = value.substr(config.prefix.length, value.length - config.prefix.length - config.sufix.length);\n\t\t}\n\n\t\tvar num = value.indexOf(\"1\");\n\t\tif (num > 0){\n\t\t\tconfig.prefix = value.substr(0, num);\n\t\t\tvalue = value.substr(num);\n\t\t}\n\n\t\tvar dot = value.indexOf(\"0\");\n\t\tif (dot > 0){\n\t\t\tconfig.decimalSize = value.length - dot;\n\t\t\tconfig.decimalDelimiter = value[dot-1];\n\t\t\tvalue = value.substr(0, dot-1);\n\t\t}\n\t\tvar sep = value.match(/[^0-9]/);\n\t\tif (sep){\n\t\t\tconfig.groupSize = value.length - sep.index - 1;\n\t\t\tconfig.groupDelimiter = value[sep.index];\n\t\t}\n\t\treturn config;\n\t},\n\tparse:function(value, config){\n\t\tif (!value || typeof value !== \"string\")\n\t\t\treturn value;\n\n\t\tif (config.prefix)\n\t\t\tvalue = value.toLowerCase().replace(config.prefix.toLowerCase() || \"\", \"\");\n\t\tif (config.sufix)\n\t\t\tvalue = value.toLowerCase().replace(config.sufix.toLowerCase() || \"\", \"\");\n\n\t\tvar decimal = \"\";\n\t\tif (config.decimalDelimiter){\n\t\t\tvar ind = value.indexOf(config.decimalDelimiter);\n\t\t\tif (ind > -1){\n\t\t\t\tdecimal = value.substr(ind+1).replace(/[^0-9]/g, \"\");\n\t\t\t\tdecimal = decimal.substr(0, Math.min(decimal.length, config.decimalSize));\n\t\t\t\tvalue = value.substr(0, ind);\n\t\t\t}\n\t\t}\n\n\t\tvar sign = value[0] === \"-\" ? -1 : 1;\n\t\tvalue = value.replace(/[^0-9]/g, \"\");\n\t\tif (!value)\n\t\t\tvalue = \"0\";\n\n\t\tif (decimal)\n\t\t\tvalue += \".\"+decimal;\n\n\t\treturn parseFloat(value)*sign;\n\t},\n\tformat: function(value, config){ \n\t\tif (value === \"\" || typeof value === \"undefined\") return value;\n\t\t\n\t\tconfig = config||i18n;\n\t\tvalue = parseFloat(value);\n\n\t\tvar sign = value < 0 ? \"-\":\"\";\n\t\tvalue = Math.abs(value);\n\n\t\tif (!config.decimalOptional)\n\t\t\tvalue = value.toFixed(config.decimalSize);\n\n\t\tvar str = value.toString();\n\t\tstr = str.split(\".\");\n\n\t\tvar int_value = \"\";\n\t\tif (config.groupSize){\n\t\t\tvar step = config.groupSize;\n\t\t\tvar i=str[0].length;\n\t\t\tdo {\n\t\t\t\ti-=step;\n\t\t\t\tvar chunk = (i>0)?str[0].substr(i,step):str[0].substr(0,step+i);\n\t\t\t\tint_value = chunk+(int_value?config.groupDelimiter+int_value:\"\");\n\t\t\t} while(i>0);\n\t\t} else\n\t\t\tint_value = str[0];\n\n\t\tif (config.decimalSize)\n\t\t\tstr = sign + int_value + (str[1] ? (config.decimalDelimiter + str[1]) : \"\");\n\t\telse\n\t\t\tstr = sign + int_value;\n\n\t\tif (config.prefix || config.sufix){\n\t\t\treturn config.prefix + str + config.sufix;\n\t\t} else \n\t\t\treturn str;\n\t},\n\tnumToStr:function(config){\n\t\treturn function(value){\n\t\t\treturn Number.format(value, config);\n\t\t};\n\t}\n};\n\nexport default Number;","import en from \"../i18n/en\";\nimport i18n from \"./i18n\";\n\nimport wDate from \"../core/date\";\nimport Number from \"../core/number\";\n\nimport {copy, isArray} from \"../webix/helpers\";\nimport template from \"./template\";\n\n\nfunction extend(base,source){\n\tfor (var method in source){\n\t\tif(typeof(source[method]) == \"object\" && !isArray(source[method])){\n\t\t\tif(!base[method]){\n\t\t\t\tbase[method] = {};\n\t\t\t}\n\t\t\textend(base[method],source[method]);\n\t\t}\n\t\telse\n\t\t\tbase[method] = source[method];\n\t}\n}\n\nconst helpers = [\"fullDateFormat\", \"timeFormat\", \"dateFormat\", \"longDateFormat\", \"parseFormat\", \"parseTimeFormat\"];\n\ni18n.setLocale = function(locale){\n\tif (typeof locale == \"string\")\n\t\tlocale = i18n.locales[locale];\n\tif (locale){\n\t\tlocale.priceSettings = copy(locale.priceSettings || locale);\n\t\textend(i18n, locale);\n\t}\n\tfor( var i=0; i= 0; i--) els[i] = temp[i];\n\t\t\n\t\tfor (let i = 0; i < els.length; i++) {\n\t\t\tvar config;\n\t\t\t//collect configuration\n\t\t\tconfig = this._sub_markup(els[i], html);\n\t\t\tconfig.$scope = scope;\n\t\t\tui = this._initComponent(config, els[i], html, target);\n\t\t}\n\t\treturn ui;\n\t},\n\n\tparse:function(source, mode){\n\t\t//convert from string to object\n\t\tif (typeof source == \"string\")\n\t\t\tsource = DataDriver[mode || \"xml\"].toObject(source, source);\n\n\t\tvar els = this._get_core_els(source, mode);\n\t\treturn this._sub_markup(els[0], els.html);\n\t},\n\n\t_initComponent:function(config, node, html, target){\n\t\tif (!target){\n\t\t\tconfig.container = node.parentNode;\n\t\t\tremove(node);\n\t\t} else \n\t\t\tconfig.container = target;\n\n\t\tif (this._view_has_method(config.view, \"setPosition\"))\n\t\t\tdelete config.container;\n\n\t\t//init ui\n\t\treturn ui(config);\n\t},\n\n\t_get_core_els:function(node){\n\t\tthis._full_prefix = this.namespace?(this.namespace+\":\"):\"\";\n\t\tthis._full_prefix_top = this._full_prefix+\"ui\";\n\n\t\t//xhtml mode\n\t\tvar els = node.getElementsByTagName(this._full_prefix_top);\n\t\tif (!els.length && node.documentElement && node.documentElement.tagName == this._full_prefix_top)\n\t\t\tels = [ node.documentElement ];\n\n\t\t//loading from xml file with valid namespace\n\t\tif (!els.length && this.namespace){\n\t\t\tels = node.getElementsByTagName(\"ui\");\n\t\t\tif (!els.length && node.documentElement && node.documentElement.tagName == \"ui\")\n\t\t\t\tels = [ node.documentElement ];\n\t\t}\n\n\t\tif (!els.length){\n\t\t\t//html mode\n\t\t\tels = this._get_html_tops(node);\n\t\t\tels.html = true;\n\t\t}\n\t\treturn els;\n\t},\n\n\t//html conversion\n\t_get_html_tops: function(node){\n\t\tif (node.getAttribute && node.getAttribute(this.attribute+\"view\"))\n\t\t\treturn [node];\n\n\t\tvar els = node.querySelectorAll(\"[\"+this.attribute+\"view]\");\n\n\t\tvar tags = [];\n\t\tfor (var i = 0; i < els.length; i++)\n\t\t\tif (!els[i].parentNode.getAttribute(this.attribute+\"view\"))\n\t\t\t\ttags.push(els[i]);\n\n\t\treturn tags;\n\t},\n\n\n\n\t_sub_markup: function(el, html, json){\n\t\tvar htmltable = false;\n\t\t//ignore top x:ui for xhtml and xml \n\t\tif (!json){\n\t\t\tlet name = this._get_name(el, html);\n\t\t\tif (name == \"ui\"){\n\t\t\t\tvar childs = el.childNodes;\n\t\t\t\tfor (var i = 0; i < childs.length; i++)\n\t\t\t\t\tif (childs[i].nodeType == 1){\n\t\t\t\t\t\treturn this._sub_markup(childs[i], html);\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tjson = { view: name };\n\t\t\tif (html && el.tagName.toLowerCase() == \"table\"){\n\t\t\t\tjson.data = el;\n\t\t\t\tjson.datatype = \"htmltable\";\n\t\t\t\thtmltable = true;\n\t\t\t}\n\t\t}\n\n\t\tvar is_layout = json.view == \"cols\" || json.view == \"rows\" || this._view_has_method(json.view, \"addView\");\n\n\t\tvar subs = [];\n\t\tvar has_tags = 0; \n\t\tvar allow_sub_tags = !(html || el.style); //only for xml documents\n\t\tvar first = el.firstChild;\n\t\twhile (first){\n\t\t\t//tag node\n\t\t\tif (first.nodeType == 1){\n\t\t\t\tlet name = this._get_name(first, html);\n\t\t\t\tif (name == \"data\"){\n\t\t\t\t\thas_tags = 1;\n\t\t\t\t\tvar data = first; first = first.nextSibling;\n\t\t\t\t\tjson.data = this._handle_data(data, html);\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (name == \"config\"){\n\t\t\t\t\tthis._get_config_html(first, json, html);\n\t\t\t\t\tvar confignode = first;\n\t\t\t\t\tfirst = first.nextSibling;\n\n\t\t\t\t\tremove(confignode);\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (name == \"column\"){\n\t\t\t\t\thas_tags = 1;\n\n\t\t\t\t\tvar column = this._tag_to_json(first, html);\n\t\t\t\t\tcolumn.header = column.header || column.value;\n\t\t\t\t\tcolumn.width = column.width * 1 || \"\";\n\n\t\t\t\t\tjson.columns = json.columns || [];\n\t\t\t\t\tjson.columns.push(column);\n\t\t\t\t} else if (name || (is_layout && html)){\n\t\t\t\t\tvar obj = this._sub_markup(first , html , { view:name });\n\t\t\t\t\tif (obj.view == \"head\")\n\t\t\t\t\t\tjson.head = obj.rows ? obj.rows[0] : obj.template;\n\t\t\t\t\telse if (obj.view == \"body\"){\n\t\t\t\t\t\tif (this._view_has_method(json.view, \"addView\")){\n\t\t\t\t\t\t\t//multiview, accordion\n\n\t\t\t\t\t\t\t//subtag or plain value\n\t\t\t\t\t\t\t//in case of multiple sub tags, only first will be used\n\t\t\t\t\t\t\t// #dirty\n\t\t\t\t\t\t\tsubs.push({\n\t\t\t\t\t\t\t\tbody: (obj.rows ? obj.rows[0] : obj.value),\n\t\t\t\t\t\t\t\theader:obj.header || \"\"\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//window, fieldset\n\n\t\t\t\t\t\t\t//one sub tag - use it\n\t\t\t\t\t\t\t//multiple sub tags - create sub layout\n\t\t\t\t\t\t\t//or use plain text value\n\t\t\t\t\t\t\tjson.body = obj.rows ? ( obj.rows.length == 1 ? obj.rows[0] : { rows:obj.rows } ) : obj.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else\n\t\t\t\t\t\tsubs.push(obj);\n\t\t\t\t} else if (allow_sub_tags) {\n\t\t\t\t\thas_tags = 1;\n\t\t\t\t\tvar tagName = first.tagName;\n\t\t\t\t\tif (html) tagName = tagName.toLowerCase().replace(this._dash, this._after_dash);\n\t\t\t\t\tjson[tagName] = DataDriver.xml.tagToObject(first);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfirst = first.nextSibling;\n\t\t}\n\n\t\tthis._attrs_to_json(el, json, html);\n\n\t\tif (subs.length){\n\t\t\tif (json.stack){\n\t\t\t\tjson[json.stack] = subs;\n\t\t\t} else if (json.subui){\n\t\t\t\tjson[json.subui] = subs[0];\n\t\t\t} else if (this._view_has_method(json.view, \"setValues\")){\n\t\t\t\tjson[\"elements\"] = subs;\n\t\t\t} else if (json.view == \"rows\"){\n\t\t\t\tjson.view = \"layout\";\n\t\t\t\tjson.rows = subs;\n\t\t\t} else if (json.view == \"cols\"){\n\t\t\t\tjson.view = \"layout\";\n\t\t\t\tjson.cols = subs;\n\t\t\t} else if (this._view_has_method(json.view, \"setValue\")){\n\t\t\t\tjson[\"cells\"] = subs;\n\t\t\t} else if (this._view_has_method(json.view, \"getBody\")){\n\t\t\t\tjson.body = subs.length == 1 ? subs[0] : { rows:subs };\n\t\t\t} else {\n\t\t\t\tjson[\"rows\"] = subs;\n\t\t\t}\n\t\t} else if (!htmltable && !has_tags){\n\t\t\tif (html && !json.template && (!json.view || json.view == \"template\")){\n\t\t\t\tjson.view = \"template\";\n\t\t\t\tjson.content = el;\n\t\t\t} else {\n\t\t\t\tvar content = this._content(el, html);\n\t\t\t\tif (content){\n\t\t\t\t\tvar target = \"template\";\n\t\t\t\t\tif (this._view_has_method(json.view, \"setValue\"))\n\t\t\t\t\t\ttarget = \"value\";\n\t\t\t\t\tjson[target] = json[target] || content;\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn json;\n\t},\n\n\t_empty: function(str) {\n\t\tvar clean = str.replace(/\\s+/gm, \"\");\n\t\treturn (clean.length > 0) ? false : true;\t \n\t},\n\n\t_markup_names:{\n\t\tbody:1,\n\t\thead:1,\n\t\tdata:1,\n\t\trows:1,\n\t\tcols:1,\n\t\tcells:1,\n\t\telements:1,\n\t\tui:1,\n\t\tcolumn:1,\n\t\tconfig:1\n\t},\n\n\t_get_config_html:function(tag, json, html){\n\t\tvar master = this._attrs_to_json(tag, { });\n\t\tif (master.name){\n\t\t\tjson[master.name] = master;\n\t\t\tdelete master.name;\n\t\t} else \n\t\tif (master.stack) json[master.stack] = [];\n\t\telse\n\t\t\tjson = master;\n\n\t\tvar childs = tag.childNodes;\n\t\tfor (var i = 0; i < childs.length; i++) {\n\t\t\tvar sub = null;\n\t\t\tif (childs[i].nodeType == 1 && childs[i].tagName.toLowerCase() == \"config\" && childs[i].attributes.length)\n\t\t\t\tsub = this._get_config_html(childs[i], master, html);\n\t\t\telse if (childs[i].nodeType == 1 && childs[i].tagName.toLowerCase() == \"data\"){\n\t\t\t\tsub = this._handle_data(childs[i], html);\n\t\t\t\tif (!master.stack)\n\t\t\t\t\tmaster.data = sub;\n\t\t\t} else\n\t\t\t\tsub = childs[i].innerHTML;\n\n\t\t\tif (master.stack && sub)\n\t\t\t\tjson[master.stack].push(sub);\n\n\t\t}\n\t\treturn json;\n\t},\n\n\t_get_name:function(tag, html){\n\t\t//value of view attribute or config tag\n\t\tif (html)\n\t\t\treturn tag.getAttribute(this.attribute+\"view\") || ( tag.tagName.toLowerCase() == \"config\" ? \"config\" : null);\n\t\tvar name = tag.tagName.toLowerCase();\n\t\tif (this.namespace){\n\t\t\tif (name.indexOf(this._full_prefix) === 0 || tag.scopeName == this.namespace)\n\t\t\t\treturn name.replace(this._full_prefix,\"\");\n\t\t} else {\n\t\t\tif (ui[name] || this._markup_names[name])\n\t\t\t\treturn name;\n\t\t}\n\t\treturn 0;\n\t},\n\n\t_handle_data:function(el, html){\n\t\tvar data = [];\n\n\t\tvar records = el.getElementsByTagName(markup.dataTag);\n\t\tfor (var i=0; i=0; i--){\n\t\t\tvar destCtx = doc.getElementsByTagName(\"canvas\")[i].getContext(\"2d\");\n\t\t\tdestCtx.drawImage(canvases[i], 0, 0);\n\t\t}\n\n\tinsertBefore(doc, options.docFooter, document.body);\n\n\taddCss(doc,\"webix_ui_print\");\n\tif(!options.scroll && ((view._dataobj && view.data && view.data.pull) || view.getBody))\n\t\taddCss(doc, \"webix_print_noscroll\");\n\n\twindow.print();\n\n\tremove(doc);\n}\n/*custom header nad footer*/\nfunction _getHeaderFooter(group, options){\n\tvar header = create(\"div\", { \n\t\t\"class\":\"webix_view webix_print_\"+group.toLowerCase(),\n\t\t\"style\":\"height:0px;visibility:hidden;\"\n\t}, options[\"doc\"+group]);\n\n\tif(group ===\"Header\")\n\t\tinsertBefore(header, document.body.firstChild);\n\telse\n\t\tdocument.body.appendChild(header);\n\n\toptions[\"doc\"+group] = header;\n}\n\nexport default print;","const patterns = {\n\tphone:{ mask:\"+# (###) ###-####\", allow:/[0-9]/g },\n\tcard: { mask:\"#### #### #### ####\", allow:/[0-9]/g },\n\tdate: { mask:\"####-##-## ##:##\", allow:/[0-9]/g }\n};\n\nexport default patterns;","import promise from \"../thirdparty/promiz\";\nimport {uid} from \"../webix/helpers\";\n\nvar timers = {};\n\nexport function jsonp(url, params, callback, master){\n\tvar defer = promise.defer();\n\n\tvar id = \"webix_jsonp_\"+uid();\n\tvar script = document.createElement(\"script\");\n\tscript.id = id;\n\tscript.type = \"text/javascript\";\n\n\tvar head = document.getElementsByTagName(\"head\")[0];\n\n\tif (typeof params == \"function\"){\n\t\tmaster = callback;\n\t\tcallback = params;\n\t\tparams = {};\n\t}\n\n\tif (!params)\n\t\tparams = {};\n\n\tparams.jsonp = id;\n\twindow[id]=function(){\n\t\tif (callback)\n\t\t\tcallback.apply(master||window, arguments);\n\t\tdefer.resolve(arguments[0]);\n\n\t\twindow.clearTimeout(timers[id]);\n\t\tdelete timers[id];\n\n\t\tscript.parentNode.removeChild(script);\n\t\tcallback = head = master = script = null;\n\t\tdelete window[id];\n\t};\n\n\t//timeout timer\n\ttimers[id] = window.setTimeout(function(){\n\t\tdefer.reject();\n\t\tdelete window[id];\n\t}, jsonp.timer);\n\t\n\tvar vals = [];\n\tfor (var key in params) vals.push(key+\"=\"+encodeURIComponent(params[key]));\n\t\n\turl += (url.indexOf(\"?\") == -1 ? \"?\" : \"&\")+vals.join(\"&\");\n\n\tscript.src = url;\n\thead.appendChild(script);\n\n\treturn defer;\n}\n\njsonp.timer = 3000;","import {ajax} from \"../load/ajax\";\nimport promise from \"../thirdparty/promiz\";\nimport {bind} from \"../webix/helpers\";\nimport {callEvent} from \"../webix/customevents\";\n\n\nvar error_key = \"__webix_remote_error\";\n\nfunction RemoteContext(url, config){\n\tthis._proxy = {};\n\tthis._queue = [];\n\tthis._url = url;\n\tthis._key = \"\";\n\n\tif (config)\n\t\tthis._process(config);\n\telse\n\t\tthis._ready = ajax(url)\n\t\t\t.then(function(data){\n\t\t\t\treturn data.text();\n\t\t\t})\n\t\t\t.then(bind(function(text){\n\t\t\t\ttext = text.split(\"/*api*/\")[1];\n\t\t\t\tthis._process(JSON.parse(text));\n\t\t\t\treturn this._proxy;\n\t\t\t}, this));\n}\nRemoteContext.prototype = {\n\t_process:function(config){\n\t\tif (config.$key)\n\t\t\tthis._key = config.$key;\n\t\tif (config.$vars)\n\t\t\tfor (var key in config.$vars)\n\t\t\t\tthis._proxy[key] = config.$vars[key];\n\n\t\tthis._parse(config, this._proxy, \"\");\n\t},\n\t_parse:function(api, obj, prefix){\n\t\tfor (var key in api){\n\t\t\tif (key === \"$key\" || key === \"$vars\") continue;\n\t\t\tvar val = api[key];\n\t\t\tif (typeof val == \"object\"){\n\t\t\t\tvar sub = obj[key] = {};\n\t\t\t\tthis._parse(val, sub, prefix+key+\".\");\n\t\t\t} else\n\t\t\t\tobj[key] = this._proxy_call(this, prefix+key);\n\t\t}\n\t},\n\t_call:function(name, args){\n\t\tvar def = this._deffer(this, name, args);\n\t\tthis._queue.push(def);\n\t\tthis._start_queue();\n\t\treturn def;\n\t},\n\t_start_queue:function(){\n\t\tif (!this._timer)\n\t\t\tthis._timer = setTimeout(bind(this._run_queue, this), 1);\n\t},\n\t_run_queue:function(){\n\t\tvar data = [], defs = this._queue;\n\t\tfor (var i=0; i\"; \n\t\t}\n\t},\n\t\"textFilter\":{\n\t\tgetInputNode:function(node){ return node.firstChild?node.firstChild.firstChild:{ value: null }; },\n\t\tgetValue:function(node){ return this.getInputNode(node).value; },\n\t\tsetValue:function(node, value){ this.getInputNode(node).value = value; },\n\t\trefresh:function(master, node, value){\n\t\t\tnode.component = master._settings.id;\n\t\t\tmaster.registerFilter(node, value, this);\n\t\t\tnode._comp_id = master._settings.id;\n\t\t\tif (value.value && this.getValue(node) != value.value) this.setValue(node, value.value);\n\t\t\tnode.onclick = preventEvent;\n\t\t\t_event(node, \"keydown\", this._on_key_down);\n\t\t},\n\t\trender:function(master, config){\n\t\t\tif (this.init) this.init(config);\n\t\t\tconfig.css = \"webix_ss_filter\"; \n\t\t\treturn \"\"; \n\t\t},\n\t\t_on_key_down:function(e){\n\t\t\tvar id = this._comp_id;\n\n\t\t\t//tabbing through filters must not trigger filtering\n\t\t\t//we can improve this functionality by preserving initial filter value\n\t\t\t//and comparing new one with it\n\t\t\tif ((e.which || e.keyCode) == 9) return;\n\n\t\t\tif (this._filter_timer) window.clearTimeout(this._filter_timer);\n\t\t\tthis._filter_timer=window.setTimeout(function(){\n\t\t\t\tvar ui = $$(id);\n\t\t\t\t//ensure that ui is not destroyed yet\n\t\t\t\tif (ui) ui.filterByAll();\n\t\t\t},datafilter.textWaitDelay);\n\t\t}\n\t},\n\t\"selectFilter\":{\n\t\tgetInputNode:function(node){ return node.firstChild?node.firstChild.firstChild:{ value: null}; },\n\t\tgetValue:function(node){ return this.getInputNode(node).value; },\n\t\tsetValue:function(node, value){ this.getInputNode(node).value = value; },\n\t\trefresh:function(master, node, value){\n\t\t\t//value - config from header { contet: }\n\t\t\tvalue.compare = value.compare || function(a,b){ return a == b; };\n\n\t\t\tnode.component = master._settings.id;\n\t\t\tmaster.registerFilter(node, value, this);\n\n\t\t\tvar data;\n\t\t\tvar options = value.options;\n\t\t\tif (options){\n\t\t\t\tif(typeof options ==\"string\"){\n\t\t\t\t\tdata = value.options = [];\n\t\t\t\t\tajax(options).then(bind(function(data){\n\t\t\t\t\t\tvalue.options = data.json();\n\t\t\t\t\t\tthis.refresh(master, node, value);\n\t\t\t\t\t}, this));\n\t\t\t\t} else\n\t\t\t\t\tdata = options;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tdata = master.collectValues(value.columnId);\n\t\t\t\tdata.unshift({ id:\"\", value:\"\" });\n\t\t\t}\n\n\t\t\tvar optview = $$(options);\n\t\t\tif(optview && optview.data && optview.data.getRange){\n\t\t\t\tdata = optview.data.getRange();\n\t\t\t}\n\t\t\t//slow in IE\n\t\t\t//http://jsperf.com/select-options-vs-innerhtml\n\n\t\t\tvar select = document.createElement(\"select\");\n\t\t\tfor (var i = 0; i < data.length; i++){\n\t\t\t\tvar option = document.createElement(\"option\");\n\t\t\t\toption.value = data[i].id;\n\t\t\t\toption.text = data[i].value;\n\t\t\t\tselect.add(option);\n\t\t\t}\n\n\t\t\tnode.firstChild.innerHTML = \"\";\n\t\t\tnode.firstChild.appendChild(select);\n\n\t\t\tif (value.value) this.setValue(node, value.value);\n\t\t\tnode.onclick = preventEvent;\n\n\t\t\tselect._comp_id = master._settings.id;\n\t\t\t_event(select, \"change\", this._on_change);\n\t\t},\n\t\trender:function(master, config){ \n\t\t\tif (this.init) this.init(config);\n\t\t\tconfig.css = \"webix_ss_filter\"; return \"\"; },\n\t\t_on_change:function(){ \n\t\t\t$$(this._comp_id).filterByAll();\n\t\t}\n\t}\n};\n\ndatafilter.serverFilter = extend({\n\t$server: true,\n\t_on_key_down:function(e){\n\t\tvar id = this._comp_id,\n\t\t\tcode = (e.which || e.keyCode);\n\n\t\t//ignore tab and navigation keys\n\t\tif (code == 9 || ( code >= 33 && code <= 40)) return;\n\t\tif (this._filter_timer) window.clearTimeout(this._filter_timer);\n\t\tthis._filter_timer=window.setTimeout(function(){\n\t\t\t$$(id).filterByAll();\n\t\t},datafilter.textWaitDelay);\n\t}\n}, datafilter.textFilter);\n\ndatafilter.serverSelectFilter = extend({\n\t$server: true,\n\t_on_change:function(){\n\t\tvar id = this._comp_id;\n\t\t$$(id).filterByAll();\n\t}\n}, datafilter.selectFilter);\n\ndatafilter.numberFilter = extend({\n\tinit:function(config){\n\t\tconfig.prepare = function(value){\n\t\t\tvar equality = (value.indexOf(\"=\") != -1)?1:0;\n\t\t\tvar intvalue = this.format(value);\n\t\t\tif (intvalue === \"\") return \"\";\n\n\t\t\tif (value.indexOf(\">\") != -1) \n\t\t\t\tconfig.compare = this._greater;\n\t\t\telse if (value.indexOf(\"<\") != -1){\n\t\t\t\tconfig.compare = this._lesser;\n\t\t\t\tequality *= -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconfig.compare = this._equal;\n\t\t\t\tequality = 0;\n\t\t\t}\n\n\t\t\treturn intvalue - equality;\n\t\t};\n\t},\n\tformat:function(value){\n\t\treturn value.replace(/[^\\-.0-9]/g,\"\");\n\t},\n\t_greater:function(a,b){ return a*1>b; },\n\t_lesser:function(a,b){ return a!==\"\" && a*1< =]+/,\"\"));\n\t\t}\n\t\treturn date.valueOf();\n\t}\n}, datafilter.numberFilter);\n\nexport default datafilter;","import Touch from \"../core/touch\";\nimport env from \"../webix/env\";\nimport ready from \"../webix/ready\";\nimport * as skin from \"../webix/skin\";\nimport {create, addStyle} from \"../webix/html\";\nimport {define} from \"../services\";\n\n\nenv.scrollSize = ((env.touch||env.$customScroll)?0:17);\nready(function(){\n\tvar size = _detectScrollSize();\n\tenv.scrollSize = env.touch ? 0 : size;\n});\n\n\nfunction _detectScrollSize(){\n\tvar div = create(\"div\");\n\tdiv.className = \"webix_skin_mark\";\n\tdiv.style.cssText=\"position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;\";\n\n\tdocument.body.appendChild(div);\n\tvar width = div.offsetWidth-div.clientWidth;\n\tvar name = { 200:\"flat\" , 210:\"compact\", 230: \"contrast\", 240:\"material\", 250:\"mini\" }[Math.floor(div.offsetHeight/10)*10];\n\tdocument.body.removeChild(div);\n\n\tif (name)\n\t\tskin.set(name);\n\n\tif (env.$customScroll) return 0;\n\treturn width;\n}\n\n\nlet fixed = false;\nfunction _fixHeight(){\n\tif (fixed) return;\n\n\taddStyle(\"html, body{ height:100%; }\");\n\tdocument.body.className+=\" webix_full_screen\";\n\tTouch.limit(false);\n\tfixed = true;\n}\n\ndefine(\"_fixHeight\", _fixHeight);","export {proto, protoUI, $$} from \"./core\";\nimport {hasMethod} from \"./core\";\n\nimport {ui} from \"./core\";\n\nimport {animate, animateView} from \"./animate\";\nimport {freeze, resize, each} from \"./helpers\";\nimport fullScreen from \"./fullscreen\";\n\n// filters\nimport datafilter from \"./datafilter\";\nimport \"./datafilter_pro\";\n\n// detect scroll\nimport \"./detect\";\n\n\nui.animate = animate;\nui.animateView = animateView;\n\nui.freeze = freeze;\nui.resize = resize;\nui.each = each;\nui.hasMethod = hasMethod;\nui.datafilter = datafilter;\nui.fullScreen = fullScreen;\n\nexport {ui};","import {ui, $$} from \"./core\";\nimport {create} from \"../webix/html\";\nimport ani from \"../webix/animate\";\n\nexport function animate(obj, parent, config){\n\tvar pobj = $$(parent);\n\tif (pobj){\n\t\tvar aniset = config || { type:\"slide\", direction:\"left\" };\n\t\tvar d = pobj._viewobj.cloneNode(true);\n\t\tvar view = ui(obj, parent);\n\n\t\tview._viewobj.parentNode.appendChild(d);\n\t\tvar line = ani.formLine(\n\t\t\tview._viewobj,\n\t\t\td,\n\t\t\taniset\n\t\t);\n\n\t\taniset.callback = function(){\n\t\t\tani.breakLine(line);\n\t\t};\n\t\tani(line, aniset);\n\n\t\treturn view;\n\t}\n}\n\nexport function animateView(view, stateHandler, config){\n\tview = $$(view);\n\tif (view){\n\t\tconfig = config || { type:\"slide\", direction:\"left\" };\n\n\t\tvar getHTML = function(view){\n\t\t\tvar el = view._viewobj;\n\t\t\tvar css = el.className;\n\t\t\tvar content =el.innerHTML;\n\t\t\treturn \"
\"+content+\"
\";\n\t\t};\n\n\t\t// get 'display' state of child nodes\n\t\tvar display = [];\n\t\tfor(let i=0; i this._cells.length)\n\t\t\t\t\ttarget_id = this._cells.length;\n\t\t\t\tvar prev_node = (this._cells[target_id]||{})._viewobj;\n\t\t\t\tPowerArray.insertAt.call(this._cells, new_view, target_id);\n\t\t\t\tif (!new_view._settings.hidden)\n\t\t\t\t\tinsertBefore(new_view._viewobj, prev_node, this._dataobj);\n\t\t\t} else {\n\t\t\t\tsource = $$(target_id);\n\t\t\t\ttarget_id = PowerArray.find.call(this._cells, source);\n\t\t\t\tassert(target_id!=-1, \"Attempt to replace the non-existing view\");\n\t\t\t\tvar parent = source._viewobj.parentNode;\n\t\t\t\tif (parent && !new_view._settings.hidden)\n\t\t\t\t\tparent.insertBefore(new_view._viewobj, source._viewobj);\n\n\t\t\t\tsource.destructor();\t\n\t\t\t\tthis._cells[target_id] = new_view;\n\t\t\t}\n\n\t\t\tif (!this._vertical_orientation)\n\t\t\t\tthis._fix_vertical_layout(new_view);\n\t\t}\n\t\tthis.resizeChildren(true);\n\n\t\tvar form = this.elements ? this : this.getFormView();\n\t\tif (form) form._recollect_elements();\n\n\t\tcallEvent(\"onReconstruct\",[this]);\n\t},\n\t_fix_vertical_layout:function(cell){\n\t\tcell._viewobj.style.display = \"inline-block\";\n\t\tcell._viewobj.style.verticalAlign = \"top\";\n\t},\n\taddView:function(view, index){\n\t\tif (isUndefined(index))\n\t\t\tindex = this._cells.length;\n\t\tvar top = this.$$ ? this : this.getTopParentView();\n\t\t\n\t\tstate._parent_cell = this;\n\t\tvar newui = (top && top.ui) ? top.ui(view, this, index) : ui(view, this, index);\n\t\tstate._parent_cell = null;\n\n\t\treturn newui._settings.id;\n\t},\n\tremoveView:function(id){\n\t\tvar view;\n\t\tif (typeof id != \"object\")\n\t\t\tview = $$(id) || (this.$$ ? this.$$(id) : null);\n\t\telse\n\t\t\tview = id;\n\n\t\tvar target = PowerArray.find.call(this._cells, view);\n\t\tif (target >= 0){\n\t\t\tif (this._beforeRemoveView)\n\t\t\t\tthis._beforeRemoveView(target, view);\n\n\t\t\tvar form = this.elements ? this : this.getFormView();\n\n\t\t\tthis._cells.splice(target, 1);\n\t\t\tif (form)\n\t\t\t\tui.each(view, function(sub){\n\t\t\t\t\tif (sub.name)\n\t\t\t\t\t\tdelete form.getCleanValues()[sub.config.name];\n\t\t\t\t}, form, true);\t\t\t\t\n\n\t\t\tview.destructor();\n\t\t\tthis.resizeChildren(true);\n\t\t\t\n\t\t\tif (form)\n\t\t\t\tform._recollect_elements();\n\t\t} else\n\t\t\tassert(false, \"Attemp to remove not existing view: \"+id);\n\n\t\tcallEvent(\"onReconstruct\",[this]);\n\t},\n\treconstruct:function(){\n\t\tthis._hiddencells = 0;\n\t\tthis._replace(this._collection);\n\t},\n\t_hide:function(obj, settings, silent){\n\t\tif (obj._settings.hidden) return;\n\t\tobj._settings.hidden = true;\n\t\tremove(obj._viewobj);\n\t\tthis._hiddencells++;\n\t\tif (!silent && !state._ui_creation)\n\t\t\tthis.resizeChildren(true);\t\n\t},\n\t_signal_hidden_cells:function(view){\n\t\tif (view.callEvent)\n\t\t\tview.callEvent(\"onViewShow\",[]);\n\t},\n\tresizeChildren:function(){\n\t\tif (state._freeze_resize) return;\n\n\t\tif (this._layout_sizes){\n\t\t\tvar parent = this.getParentView();\n\t\t\tif (parent){\n\t\t\t\tif (parent.resizeChildren)\n\t\t\t\t\treturn parent.resizeChildren();\n\t\t\t\telse\n\t\t\t\t\treturn parent.resize();\n\t\t\t}\n\t\t\t\t\n\t\t\tvar sizes = this.$getSize(0,0);\n\n\t\t\tvar x,y,nx,ny;\n\t\t\tnx = x = this._layout_sizes[0] || 0;\n\t\t\tny = y = this._layout_sizes[1] || 0;\n\n\t\t\t//for auto-fill content, use adjust strategy\n\t\t\tif ((sizes[1]>=100000 || sizes[3] >= 100000) && this._viewobj.parentNode){\n\t\t\t\t//in hidden container adjust doesn't work, so fallback to last known size\n\t\t\t\t//also, ensure that min-size is not violated\n\t\t\t\tnx = x = Math.max(sizes[0], (this._settings.width || this._viewobj.parentNode.offsetWidth || x || 0));\n\t\t\t\tny = y = Math.max(sizes[2], (this._settings.height || this._viewobj.parentNode.offsetHeight || y || 0));\n\t\t\t}\n\t\t\t\n\t\t\tif (!parent){\n\t\t\t\t//minWidth\n\t\t\t\tif (sizes[0]>x) nx = sizes[0];\n\t\t\t\t//minHeight\n\t\t\t\tif (sizes[2]>y) ny = sizes[2];\n\n\t\t\t\tvar fullscreen = (this._viewobj.parentNode == document.body) && !this.setPosition;\n\t\t\t\t//maxWidth rule\n\t\t\t\tif (!fullscreen && x>sizes[1]) nx = sizes[1];\n\t\t\t\t//maxHeight rule\n\t\t\t\tif (!fullscreen && y>sizes[3]) ny = sizes[3];\n\n\t\t\t\tthis.$setSize(nx,ny);\n\t\t\t} else\n\t\t\t\tthis._set_child_size(x,y);\n\n\t\t\tif (state._responsive_exception){\n\t\t\t\tstate._responsive_exception = false;\n\t\t\t\tthis.resizeChildren();\n\t\t\t}\n\n\t\t\tcallEvent(\"onResize\",[]);\n\t\t}\n\t},\n\tgetChildViews:function(){\n\t\treturn this._cells;\n\t},\n\tindex:function(obj){\n\t\tif (obj._settings)\n\t\t\tobj = obj._settings.id;\n\t\tfor (var i=0; i < this._cells.length; i++)\n\t\t\tif (this._cells[i]._settings.id == obj)\n\t\t\t\treturn i;\n\t\treturn -1;\n\t},\n\t_show:function(obj, settings, silent){\n\n\t\tif (!obj._settings.hidden) return;\n\t\tobj._settings.hidden = false;\n\n\t\t//index of sibling cell, next to which new item will appear\n\t\tvar index = this.index(obj)+1;\n\t\t//locate nearest visible cell\n\t\twhile (this._cells[index] && this._cells[index]._settings.hidden) index++;\n\t\tvar view = this._cells[index] ? this._cells[index]._viewobj : null;\n\n\t\tinsertBefore(obj._viewobj, view, (this._dataobj||this._viewobj));\n\t\tthis._hiddencells--;\n\n\t\tif (!silent){\n\t\t\tthis.resizeChildren(true);\n\t\t\tif (obj.refresh)\n\t\t\t\tobj.refresh();\n\t\t}\n\n\t\tif (obj.callEvent){\n\t\t\tobj.callEvent(\"onViewShow\", []);\n\t\t\tui.each(obj, this._signal_hidden_cells);\n\t\t}\n\t},\n\tshowBatch:function(name, mode){\n\t\tvar preserve = typeof mode != \"undefined\";\n\t\tmode = mode !== false;\n\n\t\tif (!preserve){\n\t\t\tif (this._settings.visibleBatch == name ) return;\n\t\t\tthis._settings.visibleBatch = name;\n\t\t} else \n\t\t\tthis._settings.visibleBatch = \"\";\n\n\t\tvar show = [];\n\t\tfor (let i=0; i < this._cells.length; i++){\n\t\t\tif (!this._cells[i]._settings.batch && !this._cells[i]._settings.hidden) \n\t\t\t\tshow.push(this._cells[i]);\n\t\t\telse if (this._cells[i]._settings.batch == name){\n\t\t\t\tif (mode)\n\t\t\t\t\tshow.push(this._cells[i]);\n\t\t\t\telse\n\t\t\t\t\tthis._hide(this._cells[i], null, true);\n\t\t\t} else if (!preserve)\n\t\t\t\tthis._hide(this._cells[i], null, true);\n\t\t}\n\n\t\tfor (let i=0; i < show.length; i++){\n\t\t\tthis._show(show[i], null, true);\n\t\t\tshow[i]._render_hidden_views();\n\t\t}\n\t\t\t\n\t\tthis.resizeChildren(true);\n\t},\n\t_parse_cells:function(collection){\n\t\tthis._cells=[];\n\n\t\tassert(collection,this.name+\" was incorrectly defined.

You have missed rows|cols|cells|elements collection\"); \n\t\tfor (var i=0; i
\";\n\t\t\t\telse {\n\t\t\t\t\tvar render = this.on_render[data.type],\n\t\t\t\t\t\tcontent;\n\t\t\t\t\tvar post = \"
\"+data.label+\"
\";\n\t\t\t\t\tif(data.collection || data.options){\n\t\t\t\t\t\tcontent = data.template(data, data.value);\n\t\t\t\t\t}else if(data.format)\n\t\t\t\t\t\tcontent = data.format(data.value);\n\t\t\t\t\telse\n\t\t\t\t\t\tcontent = data.value;\n\t\t\t\t\tif (render)\n\t\t\t\t\t\tcontent = render.call(this, data.value, data);\n\t\t\t\t\thtml[i] = pre+post+content+\"
\";\n\t\t\t\t}\n\t\t\t}\n\t\treturn html.join(\"\");\n\t},\n\ttype:{\n\t\theight:24,\n\t\ttemplateStart:template(\"\"),\n\t\ttemplateEnd:template(\"\")\n\t},\n\t$skin: function(){\n\t\tthis.type.height = $active.propertyItemHeight;\n\t}\n};\n\n\nconst view = protoUI(api, AutoTooltip, EditAbility, MapCollection, MouseEvents, Scrollable, SingleRender, AtomDataLoader, EventSystem, base.view);\nexport default {api, view};","import {index} from \"../webix/html\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport env from \"../webix/env\";\nimport {bind, isUndefined, extend, copy, toFunctor, isArray} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\nimport template from \"../webix/template\";\n\nimport i18n from \"../webix/i18n\";\nimport UIManager from \"../core/uimanager\";\nimport MouseEvents from \"../core/mouseevents\";\nimport EventSystem from \"../core/eventsystem\";\nimport base from \"../views/view\";\nimport DateHelper from \"../core/date\";\nimport KeysNavigation from \"../core/keysnavigation\";\n\n\nconst api = {\n\tname:\"calendar\",\n\n\tdefaults:{\n\t\tdate: new Date(), //selected date, not selected by default\n\t\tselect: false,\n\t\tnavigation: true,\n\t\tmonthSelect: true,\n\t\tweekHeader: true,\n\t\tweekNumber: false,\n\t\tskipEmptyWeeks: false,\n\n\t\tcalendarHeader: \"%F %Y\",\n\t\tcalendarWeekHeader: \"W#\",\n\t\t//calendarTime: \"%H:%i\",\n\t\tevents:DateHelper.isHoliday,\n\t\tminuteStep: 5,\n\t\ttimeIcon:\"wxi-clock\",\n\t\ticons: false,\n\t\ttimepickerHeight: 30,\n\t\theaderHeight: 70,\n\t\tdayTemplate: function(d){\n\t\t\treturn d.getDate();\n\t\t},\n\t\twidth: 260,\n\t\theight: 250\n\t},\n\n\tdayTemplate_setter: template,\n\tcalendarHeader_setter:DateHelper.dateToStr,\n\tcalendarWeekHeader_setter:DateHelper.dateToStr,\n\tcalendarTime_setter:function(format){\n\t\tthis._calendarTime = format;\n\t\treturn DateHelper.dateToStr(format);\n\t},\n\tdate_setter:function(date){\n\t\treturn this._string_to_date(date);\n\t},\n\tmaxDate_setter:function(date){\n\t\treturn this._string_to_date(date);\n\t},\n\tminDate_setter:function(date){\n\t\treturn this._string_to_date(date);\n\t},\n\tminTime_setter:function(time){\n\t\tif(typeof(time) == \"string\"){\n\t\t\ttime = i18n.parseTimeFormatDate(time);\n\t\t\ttime = [time.getHours(),time.getMinutes()];\n\n\t\t}\n\n\t\treturn time;\n\t},\n\tmaxTime_setter:function(time){\n\t\tif(typeof(time) == \"string\"){\n\t\t\ttime = i18n.parseTimeFormatDate(time);\n\t\t\ttime = [time.getHours(),time.getMinutes()];\n\t\t}\n\t\treturn time;\n\t},\n\t_ariaFocus:function(){\n\t\tvar ev = \"focus\"+(env.isIE?\"in\":\"\");\n\t\t\n\t\tif(!env.touch){\n\t\t\t_event(this.$view, ev, bind(function(e){\n\t\t\t\tvar t = e.target.className;\n\t\t\t\tvar css = t.indexOf(\"webix_cal_day\")!==-1 ? \"webix_cal_day\" : (t.indexOf(\"webix_cal_block\")!==-1?\"webix_cal_block\":\"\");\n\n\t\t\t\tif(new Date() - UIManager._tab_time > 300 && new Date() - UIManager._mouse_time >100 && css){\n\t\t\t\t\tvar prev = e.relatedTarget;\n\t\t\t\t\tif(prev && !isUndefined(prev.className)){\n\t\t\t\t\t\tvar date = (css==\"webix_cal_day\")?\n\t\t\t\t\t\t\tthis._locate_day(e.target):\n\t\t\t\t\t\t\tthis._locate_date(e.target);\n\t\t\t\t\t\tthis._moveSelection(date);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, this), {capture:!env.isIE});\n\t\t}\n\t},\n\t$init: function() {\n\t\tthis._viewobj.className += \" webix_calendar\";\n\t\tthis._viewobj.setAttribute(\"role\", \"region\");\n\t\tthis._viewobj.setAttribute(\"aria-label\", i18n.aria.calendar);\n\n\t\t//special dates\n\t\tthis._special_dates = {};\n\t\tthis._selected_days = {};\n\t\tthis._zoom_level = 0;\n\n\t\t//navigation and aria\n\t\tthis._ariaFocus();\n\t\tthis.attachEvent(\"onKeyPress\", this._onKeyPress);\n\t\tthis.attachEvent(\"onAfterZoom\", function(zoom){\n\t\t\tif(zoom >= 0) this.$view.querySelector(\".webix_cal_month_name\").blur();\n\t\t});\n\t},\n\ttype_setter: function(value){\n\t\tif(value == \"time\"){\n\t\t\tthis._zoom_in = true;\n\t\t\tthis._zoom_level = -1;\n\t\t}\n\t\telse if(value == \"year\"){\n\t\t\tthis._fixed = true;\n\t\t}\n\t\treturn value;\n\t},\n\t$setSize:function(x,y){\n\n\t\tif(base.api.$setSize.call(this,x,y)){\n\t\t\t//repaint calendar when size changed\n\t\t\tthis.render();\n\t\t}\n\t},\n\t$getSize:function(dx, dy){\n\t\tif (this._settings.cellHeight){\n\t\t\tvar state = this._getDateBoundaries(this._settings.date);\n\t\t\tthis._settings.height = this._settings.cellHeight * state._rows + ($active.calendarHeight||70);\n\t\t}\n\t\treturn base.api.$getSize.call(this, dx,dy);\n\t},\n\tmoveSelection:function(mode, details, focus){\n\t\tif(this.config.master) return; //in daterange\n\t\tvar start = this.getSelectedDate();\n\t\tif (this.config.multiselect)\n\t\t\tstart = start[0];\n\t\tvar date = DateHelper.copy(start || this.getVisibleDate());\n\t\tthis._moveSelection(date, mode, focus);\n\t\t\n\t},\n\t_moveSelection:function(date, mode, focus){\n\t\tvar css = this._zoom_logic[this._zoom_level]._keyshift(date, mode, this);\n\t\t\n\t\tif(focus !==false){\n\t\t\tvar sel = this._viewobj.querySelector(\".\"+css+\"[tabindex='0']\");\n\t\t\tif(sel) sel.focus();\n\t\t}\n\t},\n\t_getDateBoundaries: function(date, reset) {\n\t\t// addition information about rendering event:\n\t\t// how many days from the previous month,\n\t\t// next,\n\t\t// number of weeks to display and so on\n\t\t\n\t\tif (!this._set_date_bounds || reset){\n\t\t\tvar month = date.getMonth();\n\t\t\tvar year = date.getFullYear();\n\n\t\t\tvar next = new Date(year, month+1, 1);\n\t\t\tvar start = DateHelper.weekStart(new Date(year, month, 1));\n\n\t\t\tvar days = Math.round((next.valueOf() - start.valueOf())/(60*1000*60*24));\n\t\t\tvar rows = this._settings.skipEmptyWeeks?Math.ceil(days/7):6;\n\n\t\t\tthis._set_date_bounds = { _month: month, _start:start, _next:next, _rows: rows};\n\t\t}\n\n\t\treturn this._set_date_bounds;\n\t},\n\t$skin:function(){\n\t\tif($active.calendar){\n\t\t\tif( $active.calendar.width)\n\t\t\t\tthis.defaults.width = $active.calendar.width;\n\t\t\tif( $active.calendar.height)\n\t\t\t\tthis.defaults.height = $active.calendar.height;\n\t\t\tif( $active.calendar.headerHeight)\n\t\t\t\tthis.defaults.headerHeight = $active.calendar.headerHeight;\n\t\t\tif( $active.calendar.timepickerHeight)\n\t\t\t\tthis.defaults.timepickerHeight = $active.calendar.timepickerHeight;\n\t\t}\n\n\t},\n\t_getColumnConfigSizes: function(date){ \n\t\tvar bounds = this._getDateBoundaries(date);\n\n\t\tvar s = this._settings;\n\t\tvar _columnsHeight = [];\n\t\tvar _columnsWidth = [];\n\t\tvar min = Infinity;\n\n\t\tvar containerWidth = this._content_width - 36;\n\n\t\tvar containerHeight = this._content_height - this._settings.headerHeight - 10 - (this._settings.timepicker||this._icons?this._settings.timepickerHeight:0);\n\n\t\tvar columnsNumber = (s.weekNumber)?8:7;\n\t\tfor(var i=0; i\"+i18n.calendar.today+\"\";\n\t\t\t},\n\t\t\ton_click:{\n\t\t\t\t\"webix_cal_icon_today\": function(){\n\t\t\t\t\tvar date = new Date();\n\t\t\t\t\tif(!this._settings.timepicker)\n\t\t\t\t\t\tdate = DateHelper.datePart(date);\n\t\t\t\t\tthis.setValue(date);\n\t\t\t\t\tthis.callEvent(\"onTodaySet\",[this.getSelectedDate()]);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\ttemplate: function(){\n\t\t\t\treturn \"\"+i18n.calendar.clear+\"\";\n\t\t\t},\n\t\t\ton_click:{\n\t\t\t\t\"webix_cal_icon_clear\": function(){\n\t\t\t\t\tthis.setValue(\"\");\n\t\t\t\t\tthis.callEvent(\"onDateClear\",[this.getSelectedDate()]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t],\n\trefresh:function(){ this.render(); },\n\trender: function() {\n\t\t//reset zoom level\n\t\tthis._zoom_level = 0;\n\t\tthis._zoom_size = false;\n\n\t\tvar s = this._settings;\n\n\t\tif (!this.isVisible(s.id)) return;\n\t\tthis._current_time = DateHelper.datePart(new Date());\n\n\t\tthis.callEvent(\"onBeforeRender\",[]);\n\n\t\tvar date = this._settings.date;\n\n\t\tvar bounds = this._getDateBoundaries(date, true);\n\t\tvar sizes = this._getColumnConfigSizes(date);\n\t\tvar width = sizes[0];\n\t\tvar height = sizes[1];\n\n\t\tvar html = \"
\"+s.calendarHeader(date)+\"\";\n\t\tif (s.navigation)\n\t\t\thtml += \"
\";\n\t\thtml += \"
\";\n\n\t\tif(s.weekHeader)\n\t\t\thtml += \"\";\n\t\thtml += \"
\"+this._body_template(width, height, bounds, sizes[2])+\"
\";\n\n\t\tif (this._settings.timepicker || this._icons){\n\t\t\thtml += \"\";\n\t\t}\n\n\t\tthis._contentobj.innerHTML = html;\n\n\t\tif(this._settings.type == \"time\"){\n\t\t\tvar time = this._settings.date;\n\t\t\tif(time){\n\t\t\t\tif(typeof(time) == \"string\"){\n\t\t\t\t\tdate = i18n.parseTimeFormatDate(time);\n\t\t\t\t}\n\t\t\t\telse if(isArray(time)){\n\t\t\t\t\tdate.setHours(time[0]);\n\t\t\t\t\tdate.setMinutes(time[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._changeZoomLevel(-1,date);\n\t\t}\n\t\telse if(this._settings.type == \"month\"){\n\t\t\tthis._changeZoomLevel(1,date);\n\t\t}\n\t\telse if(this._settings.type == \"year\"){\n\t\t\tthis._changeZoomLevel(2,date);\n\t\t}\n\n\t\tthis.callEvent(\"onAfterRender\",[]);\n\t},\n\t_icons_template: function(date){\n\t\tvar html =\t\"
\";\n\t\tvar icons = this._icons;\n\n\t\tfor(var i=0; i < icons.length; i++){\n\t\t\tif(icons[i].template){\n\t\t\t\tvar template = (typeof(icons[i].template) == \"function\"?icons[i].template: template(icons[i].template));\n\t\t\t\thtml += template.call(this,date);\n\t\t\t}\n\t\t\tif(icons[i].on_click){\n\t\t\t\textend(this.on_click,icons[i].on_click);\n\t\t\t}\n\t\t}\n\t\thtml += \"
\";\n\t\treturn html;\n\t},\n\t_timepicker_template:function(date){\n\t\tvar timeFormat = this._settings.calendarTime||i18n.timeFormatStr;\n\t\tvar clock = this._settings.timeIcon;\n\t\tvar tpl = \"\";\n\n\t\tif(!this._settings.master)\n\t\t\ttpl = \"
\"+timeFormat(date)+\"
\";\n\t\telse{\n\t\t\t//daterange needs two clocks\n\t\t\tvar range_date = copy($$(this._settings.master)._settings.value);\n\t\t\tif(DateHelper.equal(range_date.end, date))\n\t\t\t\trange_date.start = range_date.end;\n\t\t\t\t\n\t\t\tfor(var i in range_date){\n\t\t\t\ttpl += \"
\"+timeFormat(range_date[i])+\"
\";\n\t\t\t}\n\t\t}\n\t\treturn tpl;\n\t},\n\t_week_template: function(widths){\n\t\tvar s = this._settings;\n\t\tvar week_template = \"\";\n\t\tvar correction = 0;\n\n\t\tif(s.weekNumber) {\n\t\t\tcorrection = 1;\n\t\t\tweek_template += \"
\"+s.calendarWeekHeader()+\"
\";\n\t\t}\n\t\t\n\t\tvar k = (DateHelper.startOnMonday)?1:0;\n\t\tfor (var i=0; i<7; i++){ // 7 days total\n\t\t\tvar day_index = (k + i) % 7; // 0 - Sun, 6 - Sat as in Locale.date.day_short\n\t\t\tvar day = i18n.calendar.dayShort[day_index]; // 01, 02 .. 31\n\t\t\tweek_template += \"
\"+day+\"
\";\n\t\t}\n\t\t\n\t\treturn week_template;\n\t},\n\tblockDates_setter:function(value){\n\t\treturn toFunctor(value, this.$scope);\n\t},\n\t_day_css:function(day, bounds){\n\t\tvar css = \"\", isOutside = false;\n\t\tif (DateHelper.equal(day, this._current_time))\n\t\t\tcss += \" webix_cal_today\";\n\t\tif (!this._checkDate(day))\n\t\t\tcss+= \" webix_cal_day_disabled\";\n\t\tif (day.getMonth() != bounds._month){\n\t\t\tisOutside = true;\n\t\t\tcss += \" webix_cal_outside\";\n\t\t}\n\t\tif (!isOutside && this._selectedDay(day))\n\t\t\tcss += \" webix_cal_select\";\n\t\tif (this._settings.events)\n\t\t\tcss+=\" \"+(this._settings.events(day, isOutside) || \"\");\n\t\tcss += \" webix_cal_day\";\n\t\treturn css;\n\t},\n\t_body_template: function(widths, heights, bounds, sqSize){\n\t\tvar s = this._settings;\n\t\tvar html = \"\";\n\t\tvar day = DateHelper.datePart(DateHelper.copy(bounds._start));\n\t\tvar start = s.weekNumber?1:0;\n\t\tvar weekNumber = DateHelper.getISOWeek(DateHelper.add(day,2,\"day\", true));\n\n\t\tfor (var y=0; y\";\n\n\t\t\tif (start){\n\t\t\t\t// recalculate week number for the first week of a year\n\t\t\t\tif(!day.getMonth() && day.getDate()<7)\n\t\t\t\t\tweekNumber = DateHelper.getISOWeek(DateHelper.add(day,2,\"day\", true));\n\t\t\t\thtml += \"\";\n\t\t\t}\n\n\t\t\tfor (var x=start; x\";\n\t\t\t\tday = DateHelper.add(day, 1, \"day\");\n\n\t\t\t\tif(day.getHours()){\n\t\t\t\t\tday = DateHelper.datePart(day);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thtml += \"\";\n\t\t\tweekNumber++;\n\t\t}\n\t\treturn html;\n\t},\n\t_changeDate:function(dir, step){\n\t\tvar now = this._settings.date;\n\t\tif(!step) { step = this._zoom_logic[this._zoom_level]._changeStep; }\n\t\tif(!this._zoom_level){\n\t\t\tnow = DateHelper.copy(now);\n\t\t\tnow.setDate(1);\n\t\t}\n\t\tvar next = DateHelper.add(now, dir*step, \"month\", true);\n\t\tthis._changeDateInternal(now, next);\n\t},\n\t_changeDateInternal:function(now, next){\n\t\tif(this.callEvent(\"onBeforeMonthChange\", [now, next])){\n\t\t\tif (this._zoom_level){\n\t\t\t\tthis._update_zoom_level(next);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tthis.showCalendar(next);\n\t\t\t}\n\t\t\tthis.callEvent(\"onAfterMonthChange\", [next, now]);\n\t\t}\n\t},\n\t_zoom_logic:{\n\t\t\"-2\":{\n\t\t\t_isBlocked: function(i){\n\t\t\t\tvar config = this._settings,\n\t\t\t\t\tdate = config.date,\n\t\t\t\t\tisBlocked = false;\n\n\t\t\t\tvar minHour = (config.minTime ? config.minTime[0] : 0);\n\t\t\t\tvar maxHour = (config.maxTime ? (config.maxTime[0] + ( config.maxTime[1] ? 1 : 0 )) : 24);\n\n\t\t\t\tvar minMinute = (config.minTime && (date.getHours()==minHour) ? config.minTime[1] : 0);\n\t\t\t\tvar maxMinute = (config.maxTime && config.maxTime[1] && (date.getHours()==(maxHour-1)) ? config.maxTime[1] : 60);\n\n\t\t\t\tif(this._settings.blockTime){\n\t\t\t\t\tvar d = DateHelper.copy(date);\n\t\t\t\t\td.setMinutes(i);\n\t\t\t\t\tisBlocked = this._settings.blockTime(d);\n\t\t\t\t}\n\t\t\t\treturn (i < minMinute || i >= maxMinute || isBlocked);\n\n\t\t\t},\n\t\t\t_setContent:function(next, i){ next.setMinutes(i); },\n\t\t\t_findActive:function(date, mode, calendar){\n\t\t\t\tif(!this._isBlocked.call(calendar, date.getMinutes()))\n\t\t\t\t\treturn date;\n\t\t\t\telse{\n\t\t\t\t\tvar step = calendar._settings.minuteStep;\n\t\t\t\t\tvar newdate = DateHelper.add(date, mode ==\"right\"?step:-step, \"minute\", true);\n\t\t\t\t\tif(date.getHours() === newdate.getHours())\n\t\t\t\t\t\treturn this._findActive(newdate, mode, calendar);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"-1\":{\n\t\t\t_isBlocked: function(i){\n\t\t\t\tvar config = this._settings,\n\t\t\t\t\tdate = config.date;\n\n\t\t\t\tvar minHour = (config.minTime? config.minTime[0]:0);\n\t\t\t\tvar maxHour = (config.maxTime? config.maxTime[0]+(config.maxTime[1]?1:0):24);\n\n\t\t\t\tif (i < minHour || i >= maxHour) return true;\n\n\t\t\t\tif(config.blockTime){\n\t\t\t\t\tvar d = DateHelper.copy(date);\n\t\t\t\t\td.setHours(i);\n\t\t\t\t\t\n\t\t\t\t\tvar minMinute = (config.minTime && (i==minHour) ? config.minTime[1] : 0);\n\t\t\t\t\tvar maxMinute = (config.maxTime && config.maxTime[1] && (i==(maxHour-1)) ? config.maxTime[1] : 60);\n\n\t\t\t\t\tfor (var j=minMinute; j= (60-step)) inc = step-60;\n\t\t\t\t\tinc -= date.getMinutes()%step;\n\t\t\t\t\tnewdate = calendar._zoom_logic[\"-2\"]._findActive(DateHelper.add(date, inc, \"minute\"), mode, calendar);\n\t\t\t\t}\n\t\t\t\telse if(mode === \"up\" || mode === \"down\"){ //hours\n\t\t\t\t\tinc = mode===\"down\"?1:-1;\n\t\t\t\t\tif(mode === \"down\" && date.getHours() === 23) inc = -23;\n\t\t\t\t\tif(mode === \"up\" && date.getHours() === 0) inc = 23;\n\t\t\t\t\tnewdate = this._findActive(DateHelper.add(date, inc, \"hour\"), mode, calendar);\n\t\t\t\t}\n\t\t\t\telse if(mode === false)\n\t\t\t\t\tnewdate = this._findActive(date, mode, calendar);\n\n\t\t\t\tcalendar.selectDate(newdate, false);\n\n\t\t\t\tif(newdate){\n\t\t\t\t\tcalendar._update_zoom_level(newdate);\n\t\t\t\t\tcalendar.selectDate(newdate, false);\n\t\t\t\t}\n\n\t\t\t\treturn \"webix_cal_block\"+(mode === \"left\" || mode === \"right\"?\"_min\":\"\");\n\t\t\t},\n\t\t\t_findActive:function(date, mode, calendar){\n\t\t\t\tif(!this._isBlocked.call(calendar, date.getHours()))\n\t\t\t\t\treturn date;\n\t\t\t\telse{\n\t\t\t\t\tvar newdate = DateHelper.add(date, mode ==\"down\"?1:-1, \"hour\", true);\n\t\t\t\t\tif(date.getDate() === newdate.getDate())\n\t\t\t\t\t\treturn this._findActive(newdate, mode, calendar);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\"0\":{//days\n\t\t\t_changeStep:1,\n\t\t\t_keyshift:function(date, mode, calendar){\n\t\t\t\tvar newdate = date;\n\t\t\t\tif(mode === \"pgup\" || mode === \"pgdown\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"pgdown\"?1:-1), \"month\");\n\t\t\t\telse if(mode === \"bottom\")\n\t\t\t\t\tnewdate = new Date(date.getFullYear(), date.getMonth()+1, 0);\n\t\t\t\telse if(mode === \"top\")\n\t\t\t\t\tnewdate = new Date(date.setDate(1));\n\t\t\t\telse if(mode === \"left\" || mode === \"right\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"right\"?1:-1), \"day\");\n\t\t\t\telse if(mode === \"up\" || mode === \"down\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"down\"?1:-1), \"week\");\n\t\t\t\t\n\t\t\t\tif(!calendar._checkDate(newdate))\n\t\t\t\t\tnewdate = calendar._findActive(date, mode);\n\t\t\t\t\n\t\t\t\tif(newdate)\n\t\t\t\t\tcalendar.selectDate(newdate, true);\n\t\t\t\treturn \"webix_cal_day\";\n\t\t\t},\n\t\t\t\n\t\t},\n\t\t\"1\":{\t//months\n\t\t\t_isBlocked: function(i,calendar){\n\t\t\t\tvar blocked = false, minYear, maxYear,\n\t\t\t\t\tmin = calendar._settings.minDate||null,\n\t\t\t\t\tmax = calendar._settings.maxDate||null,\n\t\t\t\t\tyear = calendar._settings.date.getFullYear();\n\n\t\t\t\tif(min && max){\n\t\t\t\t\tminYear = min.getFullYear();\n\t\t\t\t\tmaxYear = max.getFullYear();\n\t\t\t\t\tif(yeari || year>maxYear||year==maxYear&&max.getMonth() calendar._settings.maxDate){\n\t\t\t\t\tdate = DateHelper.copy(calendar._settings.maxDate);\n\t\t\t\t}\n\t\t\t\treturn date;\n\t\t\t},\n\t\t\t_getTitle:function(date){ return date.getFullYear(); },\n\t\t\t_getContent:function(i){ return i18n.calendar.monthShort[i]; },\n\t\t\t_setContent:function(next, i){ if(i!=next.getMonth()) next.setDate(1);next.setMonth(i); },\n\t\t\t_changeStep:12,\n\t\t\t_keyshift:function(date, mode, calendar){\n\t\t\t\tvar newdate = date;\n\t\t\t\tif(mode === \"pgup\" || mode === \"pgdown\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"pgdown\"?1:-1), \"year\");\n\t\t\t\telse if(mode === \"bottom\")\n\t\t\t\t\tnewdate = new Date(date.setMonth(11));\n\t\t\t\telse if(mode === \"top\")\n\t\t\t\t\tnewdate = new Date(date.setMonth(0));\n\t\t\t\telse if(mode === \"left\" || mode === \"right\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"right\"?1:-1), \"month\");\n\t\t\t\telse if(mode === \"up\" || mode === \"down\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"down\"?4:-4), \"month\");\n\n\t\t\t\tif(!calendar._checkDate(newdate))\n\t\t\t\t\tnewdate = calendar._findActive(date, mode);\n\t\t\t\t\n\t\t\t\tif(newdate){\n\t\t\t\t\tcalendar._update_zoom_level(newdate);\n\t\t\t\t\tcalendar.selectDate(newdate, false);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn \"webix_cal_block\";\n\t\t\t}\n\t\t},\n\t\t\"2\":{\t//years\n\t\t\t_isBlocked: function(i,calendar){\n\t\t\t\ti += calendar._zoom_start_date;\n\t\t\t\tvar blocked = false;\n\t\t\t\tvar min = calendar._settings.minDate;\n\t\t\t\tvar max = calendar._settings.maxDate;\n\n\t\t\t\tif( min && max && (min.getFullYear()>i || max.getFullYear() calendar._settings.maxDate){\n\t\t\t\t\tdate = DateHelper.copy(calendar._settings.maxDate);\n\t\t\t\t}\n\t\t\t\treturn date;\n\t\t\t},\n\t\t\t_getTitle:function(date, calendar){\n\t\t\t\tvar start = date.getFullYear();\n\t\t\t\tcalendar._zoom_start_date = start = start - start%10 - 1;\n\t\t\t\treturn start+\" - \"+(start+10 + 1);\n\t\t\t},\n\t\t\t_getContent:function(i, calendar){ return calendar._zoom_start_date+i; },\n\t\t\t_setContent:function(next, i, calendar){ next.setFullYear(calendar._zoom_start_date+i); },\n\t\t\t_changeStep:12*10,\n\t\t\t_keyshift:function(date, mode, calendar){\n\t\t\t\tvar newdate = date;\n\t\t\t\tif(mode === \"pgup\" || mode === \"pgdown\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"pgdown\"?10:-10), \"year\");\n\t\t\t\telse if(mode === \"bottom\")\n\t\t\t\t\tnewdate = new Date(date.setYear(calendar._zoom_start_date+10));\n\t\t\t\telse if(mode === \"top\")\n\t\t\t\t\tnewdate = new Date(date.setYear(calendar._zoom_start_date));\n\t\t\t\telse if(mode === \"left\" || mode === \"right\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"right\"?1:-1), \"year\");\n\t\t\t\telse if(mode === \"up\" || mode === \"down\")\n\t\t\t\t\tnewdate = DateHelper.add(date, (mode===\"down\"?4:-4), \"year\");\n\n\t\t\t\tif(!calendar._checkDate(newdate))\n\t\t\t\t\tnewdate = calendar._findActive(date, mode);\n\t\t\t\t\n\t\t\t\tif(newdate){\n\t\t\t\t\tcalendar._update_zoom_level(newdate);\n\t\t\t\t\tcalendar.selectDate(newdate, false);\n\t\t\t\t}\n\n\t\t\t\treturn \"webix_cal_block\";\n\t\t\t}\n\t\t}\n\t},\n\t_correctBlockedTime: function(){\n\t\tvar i, isDisabledHour, isDisabledMinutes;\n\t\tisDisabledHour = this._zoom_logic[-1]._isBlocked.call(this,this._settings.date.getHours());\n\t\tif(isDisabledHour){\n\t\t\tfor (i= 0; i< 24; i++){\n\t\t\t\tif(!this._zoom_logic[-1]._isBlocked.call(this,i)){\n\t\t\t\t\tthis._settings.date.setHours(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tisDisabledMinutes = this._zoom_logic[-2]._isBlocked.call(this,this._settings.date.getMinutes());\n\t\tif(isDisabledMinutes){\n\t\t\tfor (i=0; i<60; i+=this._settings.minuteStep){\n\t\t\t\tif(!this._zoom_logic[-2]._isBlocked.call(this,i)){\n\t\t\t\t\tthis._settings.date.setMinutes(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t_update_zoom_level:function(date){\n\t\tvar config, css, height, i, index, sections, selected, type, width, zlogic, temp, sqSize;\n\t\tvar html = \"\";\n\n\t\tconfig = this._settings;\n\t\tindex = config.weekHeader?2: 1;\n\t\tzlogic = this._zoom_logic[this._zoom_level];\n\t\tsections = this._contentobj.childNodes;\n\n\t\tif (date){\n\t\t\tconfig.date = date;\n\t\t}\n\n\t\ttype = config.type;\n\n\n\n\t\t//store width and height of draw area\n\t\tif (!this._zoom_size){\n\t\t\t/*this._reserve_box_height = sections[index].offsetHeight +(index==2?sections[1].offsetHeight:0);*/\n\n\t\t\tthis._reserve_box_height = this._contentobj.offsetHeight - config.headerHeight ;\n\t\t\tif(type != \"year\" && type != \"month\")\n\t\t\t\tthis._reserve_box_height -= config.timepickerHeight;\n\t\t\telse if(this._icons){\n\t\t\t\tthis._reserve_box_height -= 10;\n\t\t\t}\n\t\t\tthis._reserve_box_width = sections[index].offsetWidth;\n\t\t\tthis._zoom_size = 1;\n\t\t}\n\n\t\t//main section\n\t\tif (this._zoom_in){\n\t\t\t//hours and minutes\n\t\t\theight = this._reserve_box_height/6;\n\t\t\tvar timeColNum = 6;\n\t\t\tvar timeFormat = this._calendarTime||i18n.timeFormat;\n\t\t\tvar enLocale = timeFormat.match(/%([a,A])/);\n\t\t\tif(enLocale)\n\t\t\t\ttimeColNum++;\n\t\t\twidth = parseInt((this._reserve_box_width-3)/timeColNum,10);\n\t\t\tsqSize = Math.min(width,height);\n\n\t\t\thtml += \"
\"+this._timeHeaderTemplate(width,enLocale)+\"
\";\n\t\t\thtml += \"
\";\n\n\t\t\t// check and change blocked selected time\n\t\t\tthis._correctBlockedTime();\n\n\t\t\thtml += \"
\";\n\t\t\tselected = config.date.getHours();\n\t\t\ttemp = DateHelper.copy(config.date);\n\n\t\t\tfor (i= 0; i< 24; i++){\n\t\t\t\tcss=\"\";\n\t\t\t\tif(enLocale){\n\t\t\t\t\tif(i%4===0){\n\t\t\t\t\t\tvar label = (!i ? i18n.am[0] : (i==12?i18n.pm[0]:\"\"));\n\t\t\t\t\t\thtml += \"
\"+label+\"
\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(this._zoom_logic[-1]._isBlocked.call(this,i)){\n\t\t\t\t\tcss += \" webix_cal_day_disabled\";\n\t\t\t\t}\n\t\t\t\telse if(selected == i)\n\t\t\t\t\tcss += \" webix_selected\";\n\n\t\t\t\t\n\t\t\t\ttemp.setHours(i);\n\n\t\t\t\thtml += \"
\"+DateHelper.toFixed(enLocale?(!i||i==12?12:i%12):i)+\"
\";\n\t\t\t}\n\t\t\thtml += \"
\";\n\n\t\t\thtml += \"
\";\n\t\t\tselected = config.date.getMinutes();\n\t\t\ttemp = DateHelper.copy(config.date);\n\n\n\t\t\tfor (i=0; i<60; i+=config.minuteStep){\n\t\t\t\tcss = \"\";\n\t\t\t\tif(this._zoom_logic[-2]._isBlocked.call(this,i)){\n\t\t\t\t\tcss = \" webix_cal_day_disabled\";\n\t\t\t\t}\n\t\t\t\telse if(selected == i)\n\t\t\t\t\tcss = \" webix_selected\";\n\n\t\t\t\ttemp.setMinutes(i);\n\n\t\t\t\thtml += \"
\"+DateHelper.toFixed(i)+\"
\";\n\t\t\t}\n\t\t\thtml += \"
\";\n\n\t\t\thtml += \"
\";\n\t\t\thtml += \"\";\n\t\t\tthis._contentobj.innerHTML = html;\n\t\t} else {\n\t\t\t//years and months\n\t\t\t\n\t\t\t//reset header\n\t\t\tvar header = sections[0].childNodes;\n\t\t\tvar labels = i18n.aria[\"nav\"+(this._zoom_level==1?\"Year\":\"Decade\")];\n\t\t\theader[0].innerHTML = zlogic._getTitle(config.date, this);\n\t\t\theader[1].setAttribute(\"aria-label\", labels[0]);\n\t\t\theader[2].setAttribute(\"aria-label\", labels[1]);\n\n\t\t\theight = this._reserve_box_height/3;\n\t\t\twidth = this._reserve_box_width/4;\n\t\t\tsqSize = Math.min(height, width);\n\t\t\tif(this._checkDate(config.date))\n\t\t\t\tselected = (this._zoom_level==1?config.date.getMonth():config.date.getFullYear());\n\t\t\tfor (i=0; i<12; i++){\n\t\t\t\tcss = (selected == (this._zoom_level==1?i:zlogic._getContent(i, this)) ? \" webix_selected\" : \"\");\n\t\t\t\tif(zlogic._isBlocked(i,this)){\n\t\t\t\t\tcss += \" webix_cal_day_disabled\";\n\t\t\t\t}\n\n\t\t\t\tvar format = i18n.aria[(this._zoom_level==1?\"month\":\"year\")+\"Format\"];\n\t\t\t\thtml+=\"
\"+zlogic._getContent(i, this)+\"
\";\n\t\t\t}\n\t\t\tif(index-1){\n\t\t\t\tsections[index-1].style.display = \"none\";\n\t\t\t}\n\t\t\tsections[index].innerHTML = html;\n\t\t\tif(type != \"year\" && type != \"month\"){\n\t\t\t\tif(!sections[index+1])\n\t\t\t\t\tthis._contentobj.innerHTML += \"\";\n\t\t\t\telse\n\t\t\t\t\tsections[index+1].innerHTML=this._timeButtonsTemplate();\n\t\t\t}\n\t\t\tsections[index].style.height = this._reserve_box_height+\"px\";\n\t\t}\n\t},\n\t_getCalSizesString: function(width,height){\n\t\treturn \"width:\"+width+\"px; height:\"+height+\"px; line-height:\"+height+\"px;\";\n\t},\n\t_timeButtonsTemplate: function(){\n\t\treturn \"\";\n\t},\n\t_timeHeaderTemplate: function(width,enLocale){\n\t\tvar w1 = width*(enLocale?5:4);\n\t\tvar w2 = width*2;\n\t\treturn \"
\"+i18n.calendar.hours+\"
\"+i18n.calendar.minutes+\"
\";\n\t},\n\t_changeZoomLevel: function(zoom,date){\n\t\tvar oldzoom = this._zoom_level;\n\t\tif(this.callEvent(\"onBeforeZoom\",[zoom, oldzoom])){\n\t\t\tthis._zoom_level = zoom;\n\n\t\t\tif(zoom)\n\t\t\t\tthis._update_zoom_level(date);\n\t\t\telse\n\t\t\t\tthis.showCalendar(date);\n\t\t\tthis.callEvent(\"onAfterZoom\",[zoom, oldzoom]);\n\t\t}\n\t},\n\t_correctDate:function(date){\n\t\tif(!this._checkDate(date) && this._zoom_logic[this._zoom_level]._correctDate)\n\t\t\tdate = this._zoom_logic[this._zoom_level]._correctDate(date,this);\n\t\treturn date;\n\t},\n\t_mode_selected:function(target){\n\n\t\tvar next = this._locate_date(target);\n\t\tvar zoom = this._zoom_level-(this._fixed?0:1);\n\n\t\tnext = this._correctDate(next);\n\t\tif(this._checkDate(next)){\n\t\t\tthis._changeZoomLevel(zoom, next);\n\t\t\tvar type = this._settings.type;\n\t\t\tif(type == \"month\" || type == \"year\")\n\t\t\t\tthis._selectDate(next);\n\t\t}\n\t},\n\t// selects date and redraw calendar\n\t_selectDate: function(date, add){\n\t\tif(this.callEvent(\"onBeforeDateSelect\", [date])){\n\t\t\tthis.selectDate(date, true, add);\n\t\t\tthis.callEvent(\"onDateSelect\", [date]); // should be deleted in a future version\n\t\t\tthis.callEvent(\"onAfterDateSelect\", [date]);\n\t\t}\n\t},\n\t_locate_day:function(target){\n\t\tvar cind = index(target) - (this._settings.weekNumber?1:0);\n\t\tvar rind = index(target.parentNode);\n\t\tvar date = DateHelper.add(this._getDateBoundaries()._start, cind + rind*7, \"day\", true);\n\t\tif (this._settings.timepicker){\n\t\t\tdate.setHours(this._settings.date.getHours());\n\t\t\tdate.setMinutes(this._settings.date.getMinutes());\n\t\t}\n\t\treturn date;\n\t},\n\t_locate_date:function(target){\n\t\tvar value = target.getAttribute(\"data-value\")*1;\n\t\tvar level = (target.className.indexOf(\"webix_cal_block_min\")!=-1?this._zoom_level-1:this._zoom_level);\n\t\tvar now = this._settings.date;\n\t\tvar next = DateHelper.copy(now);\n\n\t\tthis._zoom_logic[level]._setContent(next, value, this);\n\n\t\treturn next;\n\t},\n\ton_click:{\n\t\twebix_cal_prev_button: function(){\n\t\t\tthis._changeDate(-1);\n\t\t},\n\t\twebix_cal_next_button: function(){\n\t\t\tthis._changeDate(1);\n\t\t},\n\t\twebix_cal_day_disabled: function(){\n\t\t\treturn false;\n\t\t},\n\t\twebix_cal_outside: function(){\n\t\t\tif(!this._settings.navigation)\n\t\t\t\treturn false;\n\t\t},\n\t\twebix_cal_day: function(e, id, target){\n\t\t\tvar date = this._locate_day(target);\n\t\t\tvar add = this._settings.multiselect === \"touch\" || (e.ctrlKey || e.metaKey);\n\t\t\tthis._selectDate(date, add);\n\t\t},\n\t\twebix_cal_time:function(){\n\t\t\tif(this._zoom_logic[this._zoom_level-1]){\n\t\t\t\tthis._zoom_in = true;\n\t\t\t\tvar zoom = this._zoom_level - 1;\n\t\t\t\tthis._changeZoomLevel(zoom);\n\t\t\t}\n\t\t},\n\t\twebix_range_time_start:function(){\n\t\t\t$$(this._settings.master)._time_mode = \"start\";\n\t\t},\n\t\twebix_range_time_end:function(){\n\t\t\t$$(this._settings.master)._time_mode = \"end\";\n\t\t},\n\t\twebix_cal_done:function(){\n\t\t\tvar date = DateHelper.copy(this._settings.date);\n\t\t\tdate = this._correctDate(date);\n\t\t\tthis._selectDate(date);\n\t\t},\n\t\twebix_cal_month_name:function(){\n\t\t\tthis._zoom_in = false;\n\t\t\t//maximum zoom reached\n\t\t\tif (this._zoom_level == 2 || !this._settings.monthSelect) return;\n\n\t\t\tvar zoom = Math.max(this._zoom_level, 0) + 1;\n\t\t\tthis._changeZoomLevel(zoom);\n\t\t},\n\t\twebix_cal_block:function(e, id, trg){\n\t\t\tif(this._zoom_in){\n\t\t\t\tif(trg.className.indexOf(\"webix_cal_day_disabled\")!==-1)\n\t\t\t\t\treturn false;\n\t\t\t\tvar next = this._locate_date(trg);\n\t\t\t\tthis._update_zoom_level(next);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(trg.className.indexOf(\"webix_cal_day_disabled\")==-1)\n\t\t\t\t\tthis._mode_selected(trg);\n\t\t\t}\n\t\t}\n\t},\n\t_string_to_date: function(date, format){\n\t\tif (!date){\n\t\t\treturn DateHelper.datePart(new Date());\n\t\t}\n\t\tif(typeof date == \"string\"){\n\t\t\tif (format)\n\t\t\t\tdate = DateHelper.strToDate(format)(date);\n\t\t\telse\n\t\t\t\tdate=i18n.parseFormatDate(date);\n\t\t}\n\n\t\treturn date;\n\t},\n\t_checkDate: function(date){\n\t\tvar blockedDate = (this._settings.blockDates && this._settings.blockDates.call(this,date));\n\t\tvar minDate = this._settings.minDate;\n\t\tvar maxDate = this._settings.maxDate;\n\t\tvar outOfRange = (date < minDate || date > maxDate);\n\t\treturn !blockedDate &&!outOfRange;\n\t},\n\t_findActive:function(date, mode){\n\t\tvar dir = (mode === \"top\" || mode ===\"left\" || mode === \"pgup\" || mode === \"up\") ? -1 : 1;\n\t\tvar newdate = DateHelper.add(date, dir, \"day\", true);\n\t\tif(this._checkDate(newdate))\n\t\t\treturn newdate;\n\t\telse{\n\t\t\tvar compare;\n\t\t\tif(this._zoom_level === 0) compare = (date.getMonth() === newdate.getMonth());\n\t\t\telse if(this._zoom_level === 1 ) compare = (date.getFullYear() === newdate.getFullYear());\n\t\t\telse if(this._zoom_level === 2) compare = (newdate.getFullYear() > this._zoom_start_date && newdate.getFullYear() < this._zoom_start_date+10);\n\n\t\t\tif(compare)\n\t\t\t\treturn this._findActive(newdate, mode);\n\t\t}\n\t},\n\tshowCalendar: function(date) {\n\t\tdate = this._string_to_date(date);\n\t\tthis._settings.date = date;\n\t\tthis.render();\n\t\tthis.resize();\n\t},\n\t_selectedDay: function(day){\n\t\treturn day && this._selected_days[day.valueOf()];\n\t},\n\tgetSelectedDate: function() {\n\t\tvar result = [];\n\t\tfor (var key in this._selected_days)\n\t\t\tresult.push(DateHelper.copy(this._selected_days[key]));\n\t\t\n\t\treturn this.config.multiselect ? result : (result[0] || null);\n\t},\n\tgetVisibleDate: function() {\n\t\treturn DateHelper.copy(this._settings.date);\n\t},\n\tsetValue: function(date){\n\t\tthis.selectDate(date, true);\n\t},\n\tgetValue: function(format){\n\t\tvar date = this.getSelectedDate();\n\t\tif (format)\n\t\t\tdate = DateHelper.dateToStr(format)(date);\n\t\treturn date;\n\t},\n\tselectDate: function(date, show, add){\n\t\tif (!date || !add || !this.config.multiselect)\n\t\t\tthis._selected_days = {};\n\n\t\tif(date){\n\t\t\tif (!isArray(date))\n\t\t\t\tdate = [date];\n\t\t\tfor (var i=0; i\",\n\t\tpalette:null,\n\t\theight:220,\n\t\twidth:220,\n\t\tcols:12,\n\t\trows:10,\n\t\tminLightness:0.15,\n\t\tmaxLightness:1,\n\t\tnavigation:true\n\t},\n\t$init:function(){\n\t\t_event(this._viewobj, \"click\", bind(function(e){\n\t\t\tvar value = locate(e, \"webix_val\");\n\t\t\t\n\t\t\tthis.setValue(value);\n\t\t\tthis.callEvent(\"onItemClick\", [this._settings.value, e]);\n\t\t\tthis.callEvent(\"onSelect\", [this._settings.value]);\n\t\t}, this));\n\n\t\tthis.$view.setAttribute(\"role\", \"grid\");\n\t\tthis._viewobj.setAttribute(\"aria-readonly\", \"true\");\n\t},\n\t_set_item_focus:function(){\n\t\tif(!this.getValue())\n\t\t\tthis.moveSelection(\"up\");\n\t},\n\t_findIndex:function(value){\n\t\tvar pal = this._settings.palette;\n\t\tvalue = (value || \"\").toUpperCase();\n\t\tfor(var r= 0, rows= pal.length; r < rows; r++)\n\t\t\tfor(var c= 0, cols = pal[r].length; c < cols; c++){\n\t\t\t\tif(pal[r][c].toUpperCase() == value){\n\t\t\t\t\treturn {row:r, col:c};\n\t\t\t\t}\n\t\t\t}\n\t\treturn null;\n\t},\n\t$setSize:function(x,y){\n\t\tif(base.api.$setSize.call(this,x,y)){\n\t\t\tthis.render();\n\t\t}\n\t},\n\tgetValue:function(){\n\t\treturn this._settings.value;\n\t},\n\t_getBox:function(){\n\t\treturn this._viewobj.firstChild;\n\t},\n\tsetValue:function(value){\n\t\tif(value && value.toString().charAt(0) != \"#\")\n\t\t\tvalue = \"#\" + value;\n\n\t\tvar oldvalue = this._settings.value;\n\n\t\tthis._settings.value = value;\n\t\tthis.$setValue(value, oldvalue);\n\n\t\treturn value;\n\t},\n\t_selectBox:null,\n\t_getSelectBox:function(){\n\t\tif( this._selectBox && this._selectBox.parentNode ){\n\t\t\treturn this._selectBox;\n\t\t}else{\n\t\t\tvar div = this._selectBox = document.createElement(\"div\");\n\t\t\tdiv.className = \"webix_color_selector\";\n\t\t\tthis._viewobj.lastChild.appendChild(div);\n\t\t\treturn div;\n\t\t}\n\t},\n\t$setValue:function(value, oldvalue){\n\t\tif(this.isVisible(this._settings.id)){\n\t\t\tvar cell, div, ind, parent, style,\n\t\t\t\tleft = 0, top = 0;\n\n\t\t\t//remove tabindex for previous selection\n\t\t\tif(oldvalue) ind = this._findIndex(oldvalue);\n\t\t\tif(!ind) ind = {row:0, col:0};\n\t\t\tthis._viewobj.lastChild.childNodes[ind.row].childNodes[ind.col].setAttribute(\"tabindex\", \"-1\");\n\n\t\t\tind = this._findIndex(value);\n\t\t\tif(ind){\n\t\t\t\tcell = this._viewobj.lastChild.childNodes[ind.row].childNodes[ind.col];\n\t\t\t}\n\n\t\t\tif(cell && cell.parentNode && cell.parentNode.parentNode){\n\t\t\t\tparent = cell.parentNode;\n\t\t\t\tleft = cell.offsetLeft - parent.offsetLeft ;\n\t\t\t\ttop = - (this.$height - (cell.offsetTop -parent.parentNode.offsetTop ));\n\n\t\t\t\tcell.setAttribute(\"tabindex\", \"0\");\n\t\t\t\tcell.setAttribute(\"aria-selected\", \"true\");\n\t\t\t\tcell.setAttribute(\"tabindex\", \"0\");\n\t\t\t\tcell.setAttribute(\"aria-selected\", \"true\");\n\t\t\t}else{\n\t\t\t\tif (this._selectBox)\n\t\t\t\t\tthis._selectBox.style.left = \"-100px\";\n\t\t\t\tthis._viewobj.lastChild.childNodes[0].childNodes[0].setAttribute(\"tabindex\", \"0\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdiv = this._getSelectBox();\n\t\t\tstyle = [\n\t\t\t\t\"left:\" + left + \"px\",\n\t\t\t\t\"top:\" + top+\"px\",\n\t\t\t\t\"width:\" + cell.style.width,\n\t\t\t\t\"height:\" + cell.style.height\n\t\t\t].join(\";\");\n\n\t\t\tif( typeof( div.style.cssText ) !== \"undefined\" ) {\n\t\t\t\tdiv.style.cssText = style;\n\t\t\t} else {\n\t\t\t\tdiv.setAttribute(\"style\",style);\n\t\t\t}\n\t\t}\n\t},\n\n\n\t_initPalette:function(config){\n\t\tfunction numToHex(n){\n\t\t\treturn color.toHex(n, 2);\n\t\t}\n\t\tfunction rgbToHex(r,g,b){\n\t\t\treturn \"#\"+numToHex( Math.floor(r)) +numToHex( Math.floor(g)) + numToHex(Math.floor(b));\n\t\t}\n\t\tfunction hslToRgb(h, s, l){\n\t\t\tvar r, g, b;\n\t\t\tif(!s){\n\t\t\t\tr = g = b = l; // achromatic\n\t\t\t}else{\n\t\t\t\tvar q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\t\t\tvar p = 2 * l - q;\n\t\t\t\tr = hue2rgb(p, q, h + 1/3);\n\t\t\t\tg = hue2rgb(p, q, h);\n\t\t\t\tb = hue2rgb(p, q, h - 1/3);\n\t\t\t}\n\n\t\t\treturn {r:r * 255, g:g * 255, b:b * 255};\n\t\t}\n\t\tfunction hue2rgb(p, q, t){\n\t\t\tif(t < 0) t += 1;\n\t\t\tif(t > 1) t -= 1;\n\t\t\tif (t < 1/6)\n\t\t\t\treturn p + (q - p) * 6 * t; \n\t\t\telse if (t <= 1/2)\n\t\t\t\treturn q;\n\t\t\telse if (t < 2/3) \n\t\t\t\treturn p + (q - p) * (2/3 - t) * 6;\n\t\t\telse\n\t\t\t\treturn p;\n\t\t}\n\n\t\tfunction renderGrayBar(colCount){\n\t\t\tvar gray = [],\n\t\t\t\tval = 255,\n\t\t\t\tstep = val / colCount;\n\n\t\t\tfor(var i=0; i < colCount; i++){\n\t\t\t\tval = Math.round(val > 0 ? val : 0);\n\t\t\t\tgray.push(rgbToHex(val, val, val));\n\t\t\t\tval -= step;\n\t\t\t}\n\t\t\tgray[gray.length - 1] = \"#000000\";\n\t\t\treturn gray;\n\t\t}\n\n\t\tvar colors = [];\n\t\tvar colorRows = config.rows - 1;\n\t\tvar colorStep = 1/config.cols;\n\t\tvar lightStep = (config.maxLightness - config.minLightness)/colorRows;\n\t\tvar colorRange = null;\n\n\t\tcolors.push(renderGrayBar(config.cols));\n\n\t\tfor(var step = 0, lt = config.minLightness; step < colorRows; step++){\n\t\t\tcolorRange = [];\n\t\t\tfor(var c = 0, col = 0; c < config.cols; c++ ){\n\t\t\t\tvar val = hslToRgb(col, 1, lt );\n\t\t\t\tcolorRange.push(rgbToHex(val.r, val.g, val.b));\n\t\t\t\tcol += colorStep;\n\t\t\t}\n\t\t\tcolors.push(colorRange);\n\t\t\tlt+=lightStep;\n\t\t}\n\n\t\tthis._settings.palette = colors;\n\t},\n\tmoveSelection:function(mode, details, focus){\n\t\tvar value = this.getValue(), ind, cell;\n\n\t\tif(value) ind = this._findIndex(value);\n\t\tif(!ind) ind = {row:0, col:0};\n\n\t\tif(ind){\n\t\t\tif(mode == \"up\" || mode == \"down\")\n\t\t\t\tind.row = ind.row + (mode == \"up\"?-1:1);\n\t\t\telse if(mode == \"right\" || mode == \"left\")\n\t\t\t\tind.col = ind.col +(mode == \"right\"?1:-1);\n\t\t\telse if(mode == \"top\" )\n\t\t\t\tind.row = ind.col = 0;\n\t\t\telse if(mode == \"bottom\"){\n\t\t\t\tind.row = this._viewobj.lastChild.querySelectorAll(\".webix_color_row\").length-1;\n\t\t\t\tind.col = this._viewobj.lastChild.childNodes[ind.row].childNodes.length-1;\n\t\t\t}\n\t\t\tind.row = Math.max(ind.row, 0);\n\t\t\tif(ind.row>=0)\n\t\t\t\tcell = this._viewobj.lastChild.childNodes[ind.row].childNodes[ind.col];\n\t\t\tif(cell){\n\t\t\t\tvalue = cell.getAttribute(\"webix_val\");\n\t\t\t\tthis.setValue(value);\n\t\t\t\tthis.callEvent(\"onSelect\", [this._settings.value]);\n\n\t\t\t\tif(focus !==false){\n\t\t\t\t\tvar sel = this._viewobj.querySelector(\"div[tabindex='0']\");\n\t\t\t\t\tif(sel) sel.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\trender:function(){\n\t\tif(!this.isVisible(this._settings.id))\n\t\t\treturn;\n\n\t\tif(!this._settings.palette)\n\t\t\tthis._initPalette(this._settings);\n\t\tvar palette = this._settings.palette;\n\n\t\tthis.callEvent(\"onBeforeRender\",[]);\n\t\tvar config = this._settings,\n\t\t\titemTpl = template(\"
\" + (config.template||\"\") + \"
\"),\n\t\t\tdata = {width: 0, height:0, val:0},\n\t\t\twidth = this.$width,\n\t\t\theight = this.$height,\n\t\t\twidths = [];\n\n\t\tvar html = \"
\";\n\n\t\tvar firstRow = (typeof palette[0] == \"object\") ? palette[0] : palette;\n\t\tfor(var i=0; i < firstRow.length; i++){\n\t\t\twidths[i] = Math.floor(width/(firstRow.length - i));\n\t\t\twidth -= widths[i];\n\t\t}\n\n\t\tif(typeof palette[0] == \"object\"){\n\t\t\tfor(var r=0; r < palette.length; r++){\n\t\t\t\tvar cellHeight = Math.floor(height/(palette.length - r));\n\t\t\t\theight -= cellHeight;\n\t\t\t\tvar row = palette[r];\n\t\t\t\thtml += renderRow(row, widths, cellHeight);\n\t\t\t}\n\t\t}else{\n\t\t\thtml+= renderRow(palette, widths, height);\n\t\t}\n\n\t\thtml += \"
\";\n\t\tthis._viewobj.innerHTML = html;\n\n\t\tfunction renderRow(row, widths, height){\n\t\t\tvar rowHtml = \"
\";\n\t\t\tfor(var cell = 0; cell < row.length; cell++){\n\t\t\t\tdata.width = widths[cell];\n\t\t\t\tdata.height = height;\n\t\t\t\tdata.val = row[cell];\n\t\t\t\trowHtml += itemTpl(data);\n\t\t\t}\n\t\t\trowHtml += \"
\";\n\t\t\treturn rowHtml;\n\t\t}\n\t\tthis._selectBox = null;\n\t\tif(this._settings.value)\n\t\t\tthis.$setValue(this._settings.value);\n\t\telse\n\t\t\tthis._viewobj.lastChild.childNodes[0].childNodes[0].setAttribute(\"tabindex\", \"0\");\n\t\tthis.callEvent(\"onAfterRender\",[]);\n\t},\n\trefresh:function(){ this.render(); }\n};\n\nconst view = protoUI(api, KeysNavigation, base.view, EventSystem);\nexport default {api, view};","import {triggerEvent, preventEvent, getTextSize, locate} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {isUndefined} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport template from \"../webix/template\";\n\nimport baseview from \"../views/baseview\";\nimport base from \"../views/view\";\n\nimport UIManager from \"../core/uimanager\";\nimport EventSystem from \"../core/eventsystem\";\nimport AtomRender from \"../core/atomrender\";\nimport Settings from \"../core/settings\";\n\n\nconst api = {\n\tname:\"button\",\n\ttouchable:true,\n\t$skin:function(){\n\t\tthis.defaults.height = $active.buttonHeight||$active.inputHeight;\n\t\t//used in \"text\"\n\t\tthis._labelTopHeight = $active.labelTopHeight||15;\n\t\tthis._borderWidth = $active.borderWidth;\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, common){\n\t\t\tvar text = common.$renderInput(obj, common);\n\t\t\tif (obj.badge) text = text.replace(\"\", \"\"+obj.badge+\"\");\n\t\t\treturn \"
\"+ text + \"
\";\n\t\t},\n\t\tlabel:\"\",\n\t\tborderless:true\n\t},\n\t$renderInput:function(obj){\n\t\tvar css = \"class='webixtype_\"+(obj.type||\"base\")+\"' \";\n\t\treturn \"\";\n\t},\n\t$init:function(){\n\t\tthis._viewobj.className += \" webix_control webix_el_\"+(this.$cssName||this.name);\n\n\t\tthis.data = this._settings;\n\t\tthis._dataobj = this._viewobj;\n\n\t\tthis.$ready.push(function(){ this._calc_size(this.config); });\n\t},\n\thotkey_setter: function(key){\n\t\tvar control = this;\n\t\tthis._addElementHotKey(key, function(view,ev){\n\t\t\tif(control.isVisible()){\n\t\t\t\tvar elem = control.$view.firstChild;\n\t\t\t\ttriggerEvent(elem, \"MouseEvents\", \"click\");\n\t\t\t\tpreventEvent(ev);\n\t\t\t}\n\t\t});\n\t},\n\n\t_addElementHotKey: function(key, func, view){\n\t\tvar keyCode = UIManager.addHotKey(key, func, view);\n\t\tthis.attachEvent(\"onDestruct\", function(){\n\t\t\tUIManager.removeHotKey(keyCode, func, view);\n\t\t});\n\t},\n\ttooltip_setter: function(value){\n\t\tvar box = this._getBox() || this.$view.firstChild;\n\t\tif(box)\n\t\t\tbox.title = value;\n\t\treturn value;\n\t},\n\ttype_setter:function(value){\n\t\tif (this._types[value])\n\t\t\tthis.$renderInput = template(this._types[value]);\n\t\tif (value == \"prev\" || value == \"next\")\n\t\t\tthis._set_inner_size = this._set_inner_size_next;\n\t\telse\n\t\t\tthis._set_inner_size = false;\n\t\treturn value;\n\t},\n\t_types:{\n\t\thtmlbutton: \"\",\n\n\t\tprev:\"
\",\n\t\tnext:\"
\",\n\n\t\timageButton:\"\",\n\t\timageButtonTop:\"\",\n\n\t\timage:\"\",\n\t\timageTop:\"\",\n\n\t\ticon:\"\",\n\t\ticonButton:\"\",\n\t\ticonTop:\"\",\n\t\ticonButtonTop:\"\"\n\n\t},\n\t_findAllInputs: function(){\n\t\tvar result = [];\n\t\tvar tagNames = [\"input\",\"select\",\"textarea\",\"button\"];\n\t\tfor(var i=0; i< tagNames.length; i++){\n\t\t\tvar inputs = this.$view.getElementsByTagName(tagNames[i]);\n\t\t\tfor(var j = 0; j< inputs.length; j++){\n\t\t\t\tresult.push(inputs[j]);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t},\n\tdisable: function(){\n\t\tvar i, node, elem = this._getBox();\n\t\tbaseview.api.disable.apply(this, arguments);\n\t\tif(elem && elem.className.indexOf(\" webix_disabled_box\")== -1){\n\t\t\telem.className += \" webix_disabled_box\";\n\t\t\tvar inputs = this._findAllInputs();\n\t\t\tfor(i=0; i< inputs.length; i++)\n\t\t\t\tinputs[i].setAttribute(\"disabled\",true);\n\n\t\t\t// richselect and based on it\n\t\t\tnode = this.getInputNode();\n\t\t\tif(node && node.tagName.toLowerCase() == \"div\"){\n\t\t\t\tthis._disabledTabIndex = node.getAttribute(\"tabIndex\");\n\t\t\t\tnode.removeAttribute(\"tabIndex\");\n\t\t\t}\n\n\t\t\tif(this._settings.labelPosition == \"top\"){\n\t\t\t\tvar label = this._dataobj.firstChild;\n\t\t\t\tif(label)\n\t\t\t\t\tlabel.className += \" webix_disabled_top_label\";\n\t\t\t}\n\t\t}\n\t},\n\tenable: function(){\n\t\tbaseview.api.enable.apply(this, arguments);\n\t\tvar node,\n\t\t\telem = this._getBox();\n\t\tif(elem){\n\t\t\telem.className = elem.className.replace(\" webix_disabled_box\",\"\");\n\t\t\tvar inputs = this._findAllInputs();\n\t\t\tfor(var i=0; i< inputs.length; i++)\n\t\t\t\tinputs[i].removeAttribute(\"disabled\");\n\n\t\t\tnode = this.getInputNode();\n\t\t\tif(node && !isUndefined(this._disabledTabIndex))\n\t\t\t\tnode.setAttribute(\"tabIndex\",this._disabledTabIndex);\n\n\t\t\tif(this._settings.labelPosition == \"top\"){\n\t\t\t\tvar label = this._dataobj.firstChild;\n\t\t\t\tif(label)\n\t\t\t\t\tlabel.className = label.className.replace(\" webix_disabled_top_label\",\"\");\n\t\t\t}\n\t\t}\n\t},\n\t$setSize:function(x,y){\n\t\tif(base.api.$setSize.call(this,x,y)){\n\t\t\tthis.render();\n\t\t}\n\t},\n\tsetValue:function(value){\n\t\tvalue = this.$prepareValue(value);\n\t\tvar oldvalue = this._settings.value;\n\t\t\n\t\tif (this.$compareValue(oldvalue, value)) return false;\n\t\t\n\t\tthis._settings.value = value;\n\t\tif (this._rendered_input)\n\t\t\tthis.$setValue(value);\n\n\t\tthis.callEvent(\"onChange\", [value, oldvalue]);\n\t},\n\t$compareValue:function(oldvalue, value){ \n\t\tif (typeof value === \"number\") value = value.toString();\n\t\tif (typeof oldvalue === \"number\") oldvalue = oldvalue.toString();\n\t\treturn oldvalue == value;\n\t},\n\t$prepareValue:function(value){ return this._pattern(value, false); },\n\t_pattern :function(value){\n\t\treturn value === 0 ? \"0\" : (value || \"\").toString();\n\t},\n\t//visual part of setValue\n\t$setValue:function(value){\n\t\t//\t\tthis._settings.label = value;\n\t\tvar node = this.getInputNode();\n\t\tif(node){\n\t\t\tif(node.tagName==\"BUTTON\") node.innerHTML = value;\n\t\t\telse node.value = value;\n\t\t}\n\t},\n\tgetValue:function(){\n\t\t//if button was rendered - returning actual value\n\t\t//otherwise - returning last set value\n\t\tvar value = this._rendered_input? this.$getValue() : this._settings.value;\n\t\treturn (typeof value == \"undefined\") ? \"\" : value;\n\t},\n\t$getValue:function(){\n\t\treturn this._settings.value||\"\";\t\n\t},\n\tfocus:function(){\n\t\tif(!this._settings.disabled && !this.queryView({disabled:true}, \"parent\")){\n\t\t\tvar input = this.getInputNode();\n\t\t\tif (input && input.focus) input.focus();\n\t\t}\n\t},\n\tblur:function() {\n\t\tvar input = this.getInputNode();\n\t\tif (input && input.blur) input.blur();\n\t},\n\t//get input element\n\tgetInputNode: function() {\n\t\treturn this._dataobj.getElementsByTagName(\"input\")[0]||this._dataobj.getElementsByTagName(\"button\")[0];\n\t},\n\t//get top-level sub-container\n\t_getBox:function(){\n\t\tfor(var i=0;i< this._dataobj.childNodes.length;i++){\n\t\t\tif(this._dataobj.childNodes[i].className.indexOf(\"webix_el_box\")>=0)\n\t\t\t\treturn this._dataobj.childNodes[i];\n\t\t}\n\t\treturn null;\n\t},\n\t_sqrt_2:Math.sqrt(2),\n\t_set_inner_size_next:function(){\n\t\tvar cfg = this._settings;\n\t\tvar arrow = this._getBox().childNodes[1];\n\t\tvar button = arrow.previousSibling;\n\t\tvar style = cfg.type == \"next\"?\"right\":\"left\";\n\t\tvar height = cfg.aheight-$active.inputPadding*2-2*this._borderWidth; //-2 - borders\n\n\t\tvar arrowEdge = height*this._sqrt_2/2;\n\t\tarrow.style.width = arrowEdge+\"px\";\n\t\tarrow.style.height = arrowEdge+\"px\";\n\t\tarrow.style.top = (height - arrowEdge)/2 + $active.inputPadding+ \"px\";\n\t\tarrow.style[style] = (height - arrowEdge)/2 +this._sqrt_2/2+ \"px\";\n\t\tbutton.style.width = cfg.awidth - height/2 -2 + \"px\";\n\t\tbutton.style.height = height + 2 + \"px\";\n\t\tbutton.style[style] = height/2 + 2 + \"px\";\n\t\tbutton.style.top = $active.inputPadding+ \"px\";\n\n\t},\n\t_calc_size:function(config){\n\t\tconfig = config || this._settings;\n\t\tif (config.autowidth)\n\t\t\tconfig.width = getTextSize((config.value||config.label || \"\"), \"webixbutton\").width +\n\t\t\t\t(config.badge ? 16 : 0) +\n\t\t\t\t((config.type === \"iconButton\" || config.type === \"icon\") ? 24 : 0) +\n\t\t\t\t((config.type === \"imageButton\" || config.type === \"image\") ? config.height-$active.inputPadding : 0);\n\t},\n\t_calck_input_size:function(){\n\t\t//use width for both width and inputWidth settings in clever way\n\t\t//in form, we can define width for some element smaller than for siblings\n\t\t//it will use inputWidth to render the desired view\n\t\tthis._input_width = this._settings.inputWidth || \n\t\t\t((this._content_width - this._settings.width > 2)?this._settings.width:0) || this._content_width;\n\t\tthis._input_height = this._settings.inputHeight||this._inputHeight||0;\n\t},\n\tresize: function(){\n\t\tthis._calc_size();\n\t\treturn base.api.resize.apply(this,arguments);\n\t},\n\trender:function(){\n\t\tthis._calck_input_size();\n\t\tthis._settings.awidth = this._input_width||this._content_width;\n\t\tthis._settings.aheight = this._input_height||this._content_height;\n\n\t\t//image button - image width\n\t\tthis._settings.bheight = this._settings.aheight+2;\n\t\tthis._settings.cheight = this._settings.aheight- 2*$active.inputPadding;\n\t\tthis._settings.dheight = this._settings.cheight - 2; // - borders\n\n\t\tif(AtomRender.render.call(this)){\n\t\t\tthis._rendered_input = true;\n\t\t\tif (this._set_inner_size) this._set_inner_size();\n\t\t\tif (this._settings.align){\n\t\t\t\tvar handle = this._dataobj.firstChild;\n\t\t\t\tif (this._settings.labelPosition == \"top\" && handle.nextSibling)\n\t\t\t\t\thandle = handle.nextSibling;\n\n\t\t\t\tswitch(this._settings.align){\n\t\t\t\t\tcase \"right\":\n\t\t\t\t\t\thandle.style.cssFloat = \"right\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"center\":\n\t\t\t\t\t\thandle.style.display = \"inline-block\";\n\t\t\t\t\t\thandle.parentNode.style.textAlign = \"center\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"middle\":\n\t\t\t\t\t\thandle.style.marginTop = Math.round((this._content_height-this._input_height)/2)+\"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"bottom\": \n\t\t\t\t\t\thandle.style.marginTop = (this._content_height-this._input_height)+\"px\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"left\":\n\t\t\t\t\t\thandle.style.cssFloat = \"left\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassert(false, \"Unknown align mode: \"+this._settings.align);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.$render)\n\t\t\t\tthis.$render(this.data);\n\n\t\t\tif (this._settings.disabled)\n\t\t\t\tthis.disable();\n\n\t\t\t// set tooltip after render\n\t\t\tif (this._settings.tooltip)\n\t\t\t\tthis.define(\"tooltip\",this._settings.tooltip );\n\n\t\t\tif (this._init_once){\n\t\t\t\tthis._init_once(this.data);\n\t\t\t\tthis._init_once = 0;\n\t\t\t}\n\t\t}\n\t},\n\n\trefresh:function(){ this.render(); },\n\n\ton_click:{\n\t\t_handle_tab_click: function(ev){\n\t\t\tvar id = locate(ev, \"button_id\");\n\t\t\tif (id && this.callEvent(\"onBeforeTabClick\", [id, ev])){\n\t\t\t\tthis.setValue(id);\n\t\t\t\tthis.callEvent(\"onAfterTabClick\", [id, ev]);\n\t\t\t}\n\t\t},\n\t\twebix_all_segments:function(ev, button){\n\t\t\tthis.on_click._handle_tab_click.call(this, ev, button);\n\t\t},\n\t\twebix_all_tabs:function(ev, button) {\n\t\t\tthis.on_click._handle_tab_click.call(this, ev, button);\n\t\t},\n\t\twebix_inp_counter_next:function(){\n\t\t\tif (!this._settings.readonly)\n\t\t\t\tthis.next();\n\t\t},\n\t\twebix_inp_counter_prev:function(){\n\t\t\tif (!this._settings.readonly)\n\t\t\t\tthis.prev();\n\t\t},\n\t\twebix_input_icon:function(){\n\t\t\tthis.getInputNode().focus();\n\t\t},\n\t\twebix_inp_checkbox_border: function(e) {\n\t\t\tif (!this._settings.disabled && (e.target||e.srcElement).tagName != \"DIV\" && !this._settings.readonly)\n\t\t\t\tthis.toggle();\n\t\t},\n\t\twebix_inp_checkbox_label: function() {\n\t\t\tif (!this._settings.readonly)\n\t\t\t\tthis.toggle();\n\t\t},\n\t\twebix_inp_radio_border: function(e) {\n\t\t\tvar value = locate(e, \"radio_id\");\n\t\t\tthis.setValue(value);\n\t\t\tthis.focus();\n\t\t},\n\t\twebix_inp_radio_label: function(e, obj, node) {\n\t\t\tnode = node.parentNode.getElementsByTagName(\"input\")[0];\n\t\t\treturn this.on_click.webix_inp_radio_border.call(this, node, obj, node);\n\t\t},\n\t\twebix_tab_more_icon: function(ev,obj, node){\n\t\t\tthis.getPopup().resize();\n\t\t\tthis.getPopup().show(node,null,true);\n\t\t},\n\t\twebix_tab_close:function(ev){\n\t\t\tvar id = locate(ev, \"button_id\");\n\t\t\tif (id && this.callEvent(\"onBeforeTabClose\", [id, ev]))\n\t\t\t\tthis.removeOption(id);\n\t\t}\n\t},\n\n\t//method do not used by button, but used by other child-views\n\t_check_options:function(opts){\n\t\tassert(opts, this.name+\": options not defined\");\n\t\tfor(var i=0;i\"+placeholder+\"\":\"\");\n\t}\n};\n\nconst view = protoUI(api, base.view, AtomRender, Settings, EventSystem);\nexport default {api, view};","import {getTextSize} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\n\nimport button from \"../views/button\";\n\nconst api = {\n\tname:\"label\",\n\tdefaults:{\n\t\ttemplate:\"
#label#
\"\n\t},\n\t$skin:function(){\n\t\tthis.defaults.height = $active.inputHeight;\n\t},\n\tfocus:function(){ return false; },\n\t_getBox:function(){\n\t\treturn this._dataobj.firstChild;\n\t},\n\tsetHTML:function(html){\n\t\tthis._settings.template = function(){ return html; };\n\t\tthis.refresh();\n\t},\n\tsetValue: function(value){\n\t\tthis._settings.label = value;\n\t\tbutton.api.setValue.apply(this,arguments);\n\t},\n\t$setValue:function(value){\n\t\tthis._dataobj.firstChild.innerHTML = value;\n\t},\n\t_set_inner_size:function(){},\n\t_calc_size:function(config){\n\t\tconfig = config || this._settings;\n\t\tif (config.autowidth)\n\t\t\tconfig.width = getTextSize((config.value||config.label), \"webix_el_label\").width;\n\t}\n};\n\nconst view = protoUI(api, button.view);\nexport default {api, view};","import UIManager from \"../core/uimanager\";\nimport Number from \"../core/number\";\n\nimport env from \"../webix/env\";\nimport patterns from \"../webix/patterns\";\n\nimport {preventEvent, getSelectionRange, setSelectionRange} from \"../webix/html\";\nimport {bind} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\n\n\nvar controls = {};\nfor(var i in UIManager._controls){\n\tcontrols[UIManager._controls[i]] = i;\n}\nvar nav_controls = {\n\t9:\"tab\",\n\t38:\"up\",\n\t40:\"down\",\n\t37:\"left\",\n\t39:\"right\"\n};\n\n\nconst TextPattern = {\n\t$init:function(config){\n\t\tvar pattern = this.defaults.pattern || config.pattern;\n\t\tvar format = this.defaults.format || config.format;\n\n\t\tif(pattern || (format && !this.format_setter)){\n\t\t\tthis.attachEvent(\"onKeyPress\", function(code, e){\n\t\t\t\tif(e.ctrlKey || e.altKey || this._custom_format)\n\t\t\t\t\treturn;\n\n\t\t\t\tif(code>105 && code<112) //numpad operators\n\t\t\t\t\tcode -=64;\n\n\t\t\t\tif(controls[code] && code !== 8 && code !==46){ //del && bsp\n\t\t\t\t\tif(!nav_controls[code])\n\t\t\t\t\t\tpreventEvent(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tpreventEvent(e);\n\t\t\t\tthis._on_key_pressed(e, code);\n\t\t\t});\n\n\t\t\tthis.attachEvent(\"onAfterRender\", this._after_render);\n\t\t\tthis.getText = function(){ return this.getInputNode().value; };\n\t\t\tthis._pattern = function(value, mode){\n\t\t\t\tif (mode === false)\n\t\t\t\t\treturn this._getRawValue(value);\n\t\t\t\telse\n\t\t\t\t\treturn this._matchPattern(value);\n\t\t\t};\n\n\t\t\tif (format){\n\t\t\t\tif (typeof format === \"object\"){\n\t\t\t\t\tthis._custom_format = format;\n\t\t\t\t} else {\n\t\t\t\t\tformat = Number.getConfig(format);\n\t\t\t\t\tthis._custom_format = {\n\t\t\t\t\t\tparse : function(value){ return Number.parse(value, format); },\n\t\t\t\t\t\tedit : function(value){ return Number.format(value, format); },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t},\n\tpattern_setter:function(value){\n\t\tvar pattern = patterns[value] || value;\n\t\t\n\t\tif(typeof pattern ==\"string\") pattern = { mask: pattern };\n\t\tpattern.allow = pattern.allow || /[A-Za-z0-9]/g;\n\t\t\n\t\tthis._patternScheme(pattern);\n\t\treturn pattern;\n\t},\n\t_init_validation:function(){\n\t\tthis.config.validate = this.config.validate || bind(function(){\n\t\t\tvar value = this.getText();\n\t\t\tvar raw = value.replace(this._pattern_chars, \"\");\n\t\t\tvar matches = (value.toString().match(this._pattern_allows) || []).join(\"\");\n\t\t\treturn (matches.length == raw.length && value.length == this._settings.pattern.mask.length);\n\t\t}, this);\n\t},\n\t_after_render:function(){\n\t\tvar ev = env.isIE8?\"propertychange\":\"input\";\n\t\t\n\t\tif (!this._custom_format) \n\t\t\t_event(this.getInputNode(), ev, function(){\n\t\t\t\tvar stamp = (new Date()).valueOf();\n\t\t\t\t//dark ie8 magic\n\t\t\t\tvar width = this.$view.offsetWidth; //eslint-disable-line\n\t\t\t\tif(!this._property_stamp || stamp-this._property_stamp>100){\n\t\t\t\t\tthis._property_stamp = stamp;\n\t\t\t\t\tthis.$setValue(this.getText());\n\t\t\t\t}\n\t\t\t}, {bind:this});\n\n\t\t_event(this.getInputNode(), \"blur\", function(){\n\t\t\tthis._applyChanges();\n\t\t}, {bind:this});\n\t},\n\t_patternScheme:function(pattern){\n\t\tvar mask = pattern.mask, scheme = {}, chars = \"\", count = 0;\n\t\t\n\t\tfor(var i = 0; i0) pos += rest;\n\t\t}\n\t\treturn pos;\n\t},\n\t_fixCaretPos:function(pos, code){\n\t\tvar prev = pos-(code !== 46)*1;\n\n\t\tif(this._pattern_scheme[prev] === false){\n\t\t\tpos = pos+(code ==8 ? -1: 1);\n\t\t\treturn this._fixCaretPos(pos, code);\n\t\t}\n\t\tif(this._pattern_scheme[pos] === false && code !==8)\n\t\t\treturn this._fixCaretPos(pos+1, code)-1;\n\t\treturn pos;\n\t},\n\t_getRawValue:function(value){\n\t\tif (this._custom_format)\n\t\t\treturn this._custom_format.parse(value);\n\n\t\tvalue = value || \"\";\n\t\tvar matches = value.toString().match(this._pattern_allows) || [];\n\t\treturn matches.join(\"\").replace(this._pattern_chars, \"\");\n\t},\n\t_matchPattern:function(value){\n\t\tif (this._custom_format)\n\t\t\treturn this._custom_format.edit(this._custom_format.parse(value));\n\n\t\tvar raw = this._getRawValue(value),\n\t\t\tpattern = this._settings.pattern.mask,\n\t\t\tmask = this._settings.pattern.mask,\n\t\t\tscheme = this._pattern_scheme,\n\t\t\tend = false,\n\t\t\tindex = 0,\n\t\t\trawIndex = 0,\n\t\t\trawLength = 0;\n\n\t\tfor(var i in scheme){\n\t\t\tif(scheme[i]!==false){\n\t\t\t\tif(!end){\n\t\t\t\t\tindex = i*1;\n\t\t\t\t\trawIndex = scheme[i];\n\t\t\t\t\tvar rchar = raw[rawIndex]||\"\";\n\t\t\t\t\tvar next = raw[rawIndex+1];\n\n\t\t\t\t\tpattern = (rchar?pattern.substr(0, index):\"\") + rchar +(rchar && next?pattern.substr(index + 1):\"\");\n\t\t\t\t\tif(!next) end = true;\n\t\t\t\t}\n\t\t\t\trawLength++;\n\t\t\t}\n\t\t}\n\n\t\t//finalize value with subsequent mask chars \n\t\tvar icode = this._input_code;\n\t\tif((icode && icode !== 8) || (!icode && rawLength-1 === rawIndex && pattern.length < mask.length)){\n\t\t\tif(raw){\n\t\t\t\tvar nind = index+1;\n\t\t\t\tif(mask.charAt(nind)!==\"#\" && pattern.length < mask.length){\n\t\t\t\t\tvar lind = mask.indexOf(\"#\", nind);\n\t\t\t\t\tif(lind<0) lind = mask.length;\n\t\t\t\t\tpattern += mask.substr(nind, lind-nind);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(icode !==46){\n\t\t\t\tpattern += mask.substr(0, mask.indexOf(\"#\"));\n\t\t\t}\n\t\t}\n\t\tthis._input_code = null;\n\t\treturn pattern;\n\t}\n};\n\nexport default TextPattern;","import {protoUI, ui, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {isUndefined, isArray, extend, uid} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\nimport template from \"../webix/template\";\n\nimport i18n from \"../webix/i18n\";\nimport rules from \"../webix/rules\";\nimport button from \"./button\";\nimport base from \"../views/view\";\n\nimport TextPattern from \"../core/textpattern\";\n\nconst api = {\n\tname:\"text\",\n\t$allowsClear:true,\n\t_init_onchange:function(){\n\t\tif (this.$allowsClear){\n\t\t\t//attach onChange handler only for controls which do not manage blur on their own\n\t\t\t//for example - combo\n\t\t\tif (!this._onBlur)\n\t\t\t\t_event(this.getInputNode(), \"change\", this._applyChanges, {bind:this});\n\t\t\tif (this._settings.suggest)\n\t\t\t\t$$(this._settings.suggest).linkInput(this);\n\t\t}\n\t},\n\t_applyChanges: function(){\n\t\tvar newvalue = this.getValue();\n\n\t\tif (newvalue != this._settings.value)\n\t\t\tthis.setValue(newvalue, true);\n\t\telse if (this._custom_format){\n\t\t\t//controls with post formating, we need to repaint value\n\t\t\tthis.$setValue(newvalue);\n\t\t}\n\t},\n\t$skin:function(){\n\t\tthis.defaults.height = $active.inputHeight;\n\t\tthis.defaults.inputPadding = $active.inputPadding;\n\t\tthis._inputSpacing = $active.inputSpacing;\n\t},\n\t$init:function(config){\n\t\tif (config.labelPosition == \"top\")\n\t\t\tif (isUndefined(config.height) && this.defaults.height) // textarea\n\t\t\t\tconfig.height = this.defaults.height + this._labelTopHeight;\n\n\t\t//suggest reference for destructor\n\t\tthis._destroy_with_me = [];\n\n\t\tthis.attachEvent(\"onAfterRender\", this._init_onchange);\n\t\tthis.attachEvent(\"onBlur\", function(){\n\t\t\tif(this._onBlur) this._onBlur();\n\t\t});\n\t},\n\t$renderIcon:function(){\n\t\tvar config = this._settings;\n\t\tif (config.icon){\n\t\t\tvar height = config.aheight - 2*config.inputPadding,\n\t\t\t\tpadding = (height - 18)/2 -1,\n\t\t\t\taria = this.addSection ? \"role='button' tabindex='0' aria-label='\"+(i18n.aria[\"multitext\"+(config.mode || \"\")+\"Section\"])+\"'\": \"\";\n\t\t\treturn \"\";\n\t\t}\n\t\treturn \"\";\n\t},\n\trelatedView_setter:function(value){\n\t\tthis.attachEvent(\"onChange\", function(){\n\t\t\tvar value = this.getValue();\n\t\t\tvar mode = this._settings.relatedAction;\n\t\t\tvar viewid = this._settings.relatedView;\n\t\t\tvar view = $$(viewid);\n\t\t\tif (!view){\n\t\t\t\tvar top = this.getTopParentView();\n\t\t\t\tif (top && top.$$)\n\t\t\t\t\tview = top.$$(viewid);\n\t\t\t}\n\n\t\t\tassert(view, \"Invalid relatedView: \"+viewid);\n\n\t\t\tif (mode == \"enable\"){\n\t\t\t\tif (value) view.enable(); else view.disable();\n\t\t\t} else {\n\t\t\t\tif (value) view.show(); else view.hide();\n\t\t\t}\n\t\t});\n\t\treturn value;\n\t},\n\tvalidateEvent_setter:function(value){\n\t\tif (value == \"blur\")\n\t\t\tthis.attachEvent(\"onBlur\", this.validate);\n\n\t\tif (value == \"key\")\n\t\t\tthis.attachEvent(\"onTimedKeyPress\", this.validate);\n\n\t\treturn value;\n\t},\n\tvalidate:function(){\n\t\tvar rule = this._settings.validate;\n\t\tif (!rule && this._settings.required)\n\t\t\trule = rules.isNotEmpty;\n\n\t\tvar form =this.getFormView();\n\t\tvar name = this._settings.name;\n\t\tvar value = this.getValue();\n\t\tvar data = {}; data[name] = value;\n\n\t\tassert(form, \"Validation works only for fields in the form\");\n\t\tassert(name, \"Validation works only for fields with name\");\n\n\t\tif (rule && !form._validate(rule, value, data, name))\n\t\t\treturn false;\n\t\treturn true;\n\t},\n\tbottomLabel_setter: function(value){\n\t\tif(!this._settings.bottomPadding)\n\t\t\tthis._settings.bottomPadding = 18;\n\t\treturn value;\n\t},\n\t_getInvalidText: function(){\n\t\tvar text = this._settings.invalidMessage;\n\t\tif(typeof text == \"function\"){\n\t\t\ttext.call(this);\n\t\t}\n\t\treturn text;\n\t},\n\tsetBottomText: function(text, height){\n\t\tvar config = this._settings;\n\t\tif (typeof text != \"undefined\"){\n\t\t\tif (config.bottomLabel == text) return;\n\t\t\tconfig.bottomLabel = text;\n\t\t}\n\n\t\tvar message = (config.invalid ? config.invalidMessage : \"\" ) || config.bottomLabel;\n\t\tif (!message && !config.bottomPadding)\n\t\t\tconfig.inputHeight = 0;\n\t\tif (message && !config.bottomPadding){\n\t\t\tthis._restorePadding = 1;\n\t\t\tconfig.bottomPadding = config.bottomPadding || height || 18;\t\n\t\t\tthis.render();\n\t\t\tthis.resize();\n\t\t} else if (!message && this._restorePadding){\n\t\t\tconfig.bottomPadding = this._restorePadding = 0;\n\t\t\t//textarea\n\t\t\tif (!config.height)\n\t\t\t\tthis.render();\n\t\t\tthis.resize();\n\t\t} else\n\t\t\tthis.render();\n\t},\n\t$getSize: function(){\n\t\tvar sizes = base.api.$getSize.apply(this,arguments);\n\t\tvar heightInc = this.config.bottomPadding;\n\t\tif(heightInc){\n\t\t\tsizes[2] += heightInc;\n\t\t\tsizes[3] += heightInc;\n\t\t}\n\t\treturn sizes;\n\t},\n\t$setSize:function(x,y){\n\t\tvar config = this._settings;\n\n\t\tif(base.api.$setSize.call(this,x,y)){\n\t\t\tif (!x || !y) return;\n\n\t\t\tif (config.labelPosition == \"top\"){\n\t\t\t\t// textarea\n\t\t\t\tif (!config.inputHeight)\n\t\t\t\t\tthis._inputHeight = this._content_height - this._labelTopHeight - (this.config.bottomPadding||0);\n\t\t\t\tconfig.labelWidth = 0;\n\t\t\t} else if (config.bottomPadding){\n\t\t\t\tconfig.inputHeight = this._content_height - this.config.bottomPadding;\n\t\t\t}\n\t\t\tthis.render();\n\t\t}\n\t},\n\t_get_input_width: function(config){\n\t\tvar width = (this._input_width||0)-(config.label?this._settings.labelWidth:0) - this._inputSpacing - (config.iconWidth || 0);\n\n\t\t//prevent js error in IE\n\t\treturn (width < 0)?0:width;\n\t},\n\t_render_div_block:function(obj, common){\n\t\tvar id = \"x\"+uid();\n\t\tvar width = common._get_input_width(obj);\n\t\tvar inputAlign = obj.inputAlign || \"left\";\n\t\tvar height = this._settings.aheight - 2*$active.inputPadding -2*this._borderWidth;\n\t\tvar text = (obj.text||obj.value||this._get_div_placeholder(obj));\n\t\tvar html = \"
\"+ text +\"
\";\n\t\treturn common.$renderInput(obj, html, id);\n\t},\n\t_baseInputHTML:function(tag){\n\t\tvar html = \"<\"+tag+(this._settings.placeholder?\" placeholder='\"+this._settings.placeholder+\"' \":\" \");\n\t\tif (this._settings.readonly)\n\t\t\thtml += \"readonly='true' aria-readonly=''\";\n\t\tif(this._settings.required)\n\t\t\thtml += \"aria-required='true'\";\n\t\tif(this._settings.invalid)\n\t\t\thtml += \"aria-invalid='true'\";\n\n\t\tvar attrs = this._settings.attributes;\n\t\tif (attrs)\n\t\t\tfor(var prop in attrs)\n\t\t\t\thtml += prop+\"='\"+attrs[prop]+\"' \";\n\t\treturn html;\n\t},\n\t$renderLabel: function(config, id){\n\t\tvar labelAlign = (config.labelAlign||\"left\");\n\t\tvar top = this._settings.labelPosition == \"top\";\n\t\tvar labelTop = top?\"display:block;\":(\"width: \" + this._settings.labelWidth + \"px;\");\n\t\tvar label = \"\";\n\t\tvar labelHeight = top?this._labelTopHeight-2*this._borderWidth:( this._settings.aheight - 2*this._settings.inputPadding);\n\t\tif (config.label)\n\t\t\tlabel = \"\";\n\t\treturn label;\n\t},\n\t$renderInput: function(config, div_start, id) {\n\t\tvar inputAlign = (config.inputAlign||\"left\");\n\t\tvar top = (config.labelPosition == \"top\");\n\t\tvar inputWidth = this._get_input_width(config);\n\n\t\tid = id||uid();\n\n\t\tvar label = this.$renderLabel(config,id);\n\n\t\tvar html = \"\";\n\t\tif(div_start){\n\t\t\thtml += div_start;\n\t\t} else {\n\t\t\tvar value = template.escape(config.text || this._pattern(config.value) );\n\t\t\thtml += this._baseInputHTML(\"input\")+\"id='\" + id + \"' type='\"+(config.type||this.name)+\"'\"+(config.editable?\" role='combobox'\":\"\")+\" value='\" + value + \"' style='width: \" + inputWidth + \"px; text-align: \" + inputAlign + \";'\";\n\t\t\tvar attrs = config.attributes;\n\t\t\tif (attrs)\n\t\t\t\tfor(var prop in attrs)\n\t\t\t\t\thtml += \" \"+prop+\"='\"+attrs[prop]+\"'\";\n\t\t\thtml += \" />\";\n\t\t}\n\t\tvar icon = this.$renderIcon?this.$renderIcon(config):\"\";\n\t\thtml += icon;\n\n\t\tvar result = \"\";\n\t\t//label position, top or left\n\t\tif (top)\n\t\t\tresult = label+\"
\"+html+\"
\";\n\t\telse\n\t\t\tresult = \"
\"+label+html+\"
\";\n\n\n\t\t//bottom message width\n\t\tvar padding = config.awidth-inputWidth-$active.inputPadding*2;\n\t\t//bottom message text\n\t\tvar message = (config.invalid ? config.invalidMessage : \"\") || config.bottomLabel;\n\t\tif (message)\n\t\t\tresult += \"
\"+message+\"
\";\n\n\t\treturn result;\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, common){\n\t\t\treturn common.$renderInput(obj);\n\t\t},\n\t\tlabel:\"\",\n\t\tlabelWidth:80\n\t},\n\ttype_setter:function(value){ return value; },\n\t_set_inner_size:false,\n\t$setValue:function(value){\n\t\tthis.getInputNode().value = this._pattern(value);\n\t},\n\t$getValue:function(){\n\t\treturn this._pattern(this.getInputNode().value, false);\n\t},\n\tsuggest_setter:function(value){\n\t\tif (value){\n\t\t\tassert(value !== true, \"suggest options can't be set as true, data need to be provided instead\");\n\n\t\t\tif (typeof value == \"string\"){\n\t\t\t\tvar attempt = $$(value);\n\t\t\t\tif (attempt) \n\t\t\t\t\treturn $$(value)._settings.id;\n\n\t\t\t\tvalue = { body: { url:value , dataFeed :value } };\n\t\t\t} else if(value.getItem)\n\t\t\t\tvalue = { body: {data:value}};\n\t\t\telse if (isArray(value))\n\t\t\t\tvalue = { body: { data: this._check_options(value) } };\n\t\t\telse if (!value.body)\n\t\t\t\tvalue.body = {};\n\n\t\t\textend(value, { view:\"suggest\" });\n\n\t\t\tvar view = ui(value);\n\t\t\tthis._destroy_with_me.push(view);\n\t\t\treturn view._settings.id;\n\t\t}\n\t\treturn false;\n\t}\n};\n\nconst view = protoUI(api, TextPattern, button.view);\nexport default {api, view};","import {uid, bind} from \"../webix/helpers\";\nimport {proto, ui} from \"../ui/core\";\n\nimport EventSystem from \"./eventsystem\";\nimport Destruction from \"./destruction\";\nimport DataMove from \"../core/datamove\";\nimport DataLoader from \"../core/dataloader\";\nimport MapCollection from \"../core/mapcollection\";\n\nimport Settings from \"../core/settings\";\n\nimport ValidateCollection from \"../core/validatecollection\";\n\nimport BindSource from \"../core/bindsource\";\nimport BaseBind from \"../core/basebind\";\nimport CollectionBind from \"../core/collectionbind\";\n\nimport {define} from \"../services\";\n\nconst DataCollection = proto({\n\tname:\"DataCollection\",\n\tisVisible:function(){ \n\t\tif (!this.data.order.length && !this.data._filter_order && !this._settings.dataFeed) return false;\n\t\treturn true; \n\t},\n\t$init:function(config){\n\t\tthis.data.provideApi(this, true);\n\t\tvar id = (config&&config.id)?config.id:uid();\n\t\tthis._settings.id =id;\n\t\tui.views[id] = this;\n\t\tthis.data.attachEvent(\"onStoreLoad\", bind(function(){\n\t\t\tthis.callEvent(\"onBindRequest\",[]);\n\t\t}, this));\n\t},\n\trefresh:function(){ this.callEvent(\"onBindRequest\",[]); }\n}, DataMove, CollectionBind, BindSource, ValidateCollection, DataLoader, MapCollection, EventSystem, BaseBind, Destruction, Settings);\n\ndefine(\"DataCollection\", DataCollection);\n\nexport default DataCollection;","import {protoUI, $$} from \"../ui/core\";\nimport {uid, bind} from \"../webix/helpers\";\n\nimport text from \"./text\";\nimport DataCollection from \"../core/datacollection\";\n\n\nconst api = {\n\tname:\"select\",\n\tdefaults:{\n\t\ttemplate:function(obj,common) {\n\t\t\tvar options = common._check_options(obj.options);\n\t\t\tvar id = \"x\"+uid();\n\t\t\tvar html = common._baseInputHTML(\"select\")+\"id='\"+id+\"' style='width:\"+common._get_input_width(obj)+\"px;'>\";\n\n\t\t\tvar optview = $$(options);\n\t\t\tif(optview && optview.data && optview.data.each){\n\t\t\t\toptview.data.each(function(option){\n\t\t\t\t\thtml+=\"\"+option.value+\"\";\n\t\t\t\t});\n\t\t\t}else\n\t\t\t\tfor(var i=0; i\"+options[i].value+\"\";\n\t\t\t\t}\n\t\t\thtml += \"\";\n\t\t\treturn common.$renderInput(obj, html, id);\n\t\t}\n\t},\n\toptions_setter:function(value){\n\t\tif(value){\n\t\t\tif(typeof value ==\"string\"){\n\t\t\t\tvar collection = new DataCollection({url:value});\n\t\t\t\tcollection.data.attachEvent(\"onStoreLoad\", bind(this.refresh, this));\n\t\t\t\treturn collection;\n\t\t\t}\n\t\t\telse\n\t\t\t\treturn value;\n\t\t}\n\t},\n\t//get input element\n\tgetInputNode: function() {\n\t\treturn this._dataobj.getElementsByTagName(\"select\")[0];\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {uid} from \"../webix/helpers\";\nimport template from \"../webix/template\";\n\nimport text from \"./text\";\n\n\nconst api = {\n\tname:\"checkbox\",\n\tdefaults:{\n\t\tcheckValue:1,\n\t\tuncheckValue:0,\n\t\ttemplate:function(config, common) {\n\t\t\tvar id = \"x\"+uid();\n\t\t\tvar rightlabel = \"\";\n\t\t\tif (config.labelRight){\n\t\t\t\trightlabel = \"\";\n\t\t\t\t//user clearly attempts to hide the label, help him\n\t\t\t\tif (config.labelWidth)\n\t\t\t\t\tconfig.label = config.label || \" \";\n\t\t\t}\n\t\t\tvar checked = (config.checkValue == config.value);\n\t\t\tvar margin = Math.floor((common._settings.aheight-16)/2);\n\t\t\tvar ch = common._baseInputHTML(\"input\")+\"style='margin-top:\"+margin+\"px;\"+(config.customCheckbox?\"display:none\":\"\")+\"' id='\"+id+\"' type='checkbox' \"+(checked?\"checked='1'\":\"\")+(config.labelRight?\" aria-label='\"+template.escape(config.labelRight)+\"'\":\"\")+\"/>\";\n\t\t\tvar className = \"webix_inp_checkbox_border webix_el_group webix_checkbox_\"+(checked?\"1\":\"0\");\n\t\t\tvar customCheckbox = config.customCheckbox || \"\";\n\t\t\tif(customCheckbox){\n\t\t\t\tcustomCheckbox = customCheckbox.replace(/(aria-checked=')\\w*(?=')/, \"$1\"+(config.value == config.checkValue?\"true\":\"false\"));\n\t\t\t\tcustomCheckbox = customCheckbox.replace(/(aria-label=')\\w*(?=')/, \"$1\"+template.escape(config.labelRight || config.label));\n\t\t\t\tcustomCheckbox = customCheckbox.replace(/(aria-invalid=')\\w*(?=')/, \"$1\"+(config.invalid?\"true\":\"false\"));\n\t\t\t}\n\t\t\tvar html = \"
\"+ch+customCheckbox+rightlabel+\"
\";\n\t\t\treturn common.$renderInput(config, html, id);\n\t\t}\n\t},\n\tcustomCheckbox_setter: function(value){\n\t\tif( value === true && $active.customCheckbox){\n\t\t\tvalue = \"\";\n\t\t}\n\t\treturn value;\n\t},\n\tblur: function(){\n\t\tvar input = this.getInputNode();\n\t\tif(input) input.blur();\n\t},\n\t_pattern :function(value){ return value; },\n\t_init_onchange: function(){},\n\t$setValue:function(value){\n\t\tvar isChecked = (value == this._settings.checkValue);\n\t\tvar input = this.$view.getElementsByTagName(\"input\")[0];\n\t\tvar parentNode = input?input.parentNode:null;\n\n\t\tif(parentNode && this._settings.customCheckbox){\n\t\t\tvar button = parentNode.getElementsByTagName(\"BUTTON\");\n\t\t\tif(button[0]) button[0].setAttribute(\"aria-checked\", isChecked?\"true\":\"false\");\n\t\t}\n\t\tif(parentNode){\n\t\t\tparentNode.className = parentNode.className.replace(/(webix_checkbox_)\\d/,\"$1\"+(isChecked?1:0));\n\t\t}\n\t\tinput.checked = isChecked;\n\t},\n\ttoggle:function(){\n\t\tvar value = (this.getValue() != this._settings.checkValue)?this._settings.checkValue:this._settings.uncheckValue;\n\t\tthis.setValue(value);\n\t},\n\tgetValue:function(){\n\t\tvar value = this._settings.value;\n\t\treturn (value == this._settings.checkValue)?this._settings.checkValue:this._settings.uncheckValue;\n\t},\n\tgetInputNode: function() {\n\t\treturn this.$view.getElementsByTagName(this._settings.customCheckbox?\"button\":\"input\")[0];\n\t},\n\t$skin:function(){\n\t\tthis.defaults.customCheckbox = !!$active.customCheckbox;\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {uid} from \"../webix/helpers\";\n\nimport template from \"../webix/template\";\nimport HTMLOptions from \"../core/htmloptions\";\n\nimport button from \"../views/button\";\nimport text from \"../views/text\";\n\nconst api = {\n\tname:\"radio\",\n\tdefaults:{\n\t\ttemplate: function(config,common) {\n\t\t\tvar options = common._check_options(config.options);\n\t\t\tvar html = [];\n\t\t\tvar id;\n\n\t\t\tfor (var i=0; i < options.length; i++) {\n\t\t\t\tvar eachid = \"x\"+uid();\n\t\t\t\tid = id || eachid;\n\n\t\t\t\tif (i && (options[i].newline || config.vertical))\n\t\t\t\t\thtml.push(\"
\");\n\t\t\t\tvar isChecked = (options[i].id == config.value);\n\t\t\t\tvar label = options[i].value || \"\";\n\t\t\t\t\n\t\t\t\tvar customRadio = config.customRadio|| \"\";\n\t\t\t\tif(customRadio){\n\t\t\t\t\tvar optlabel = (i === 0 ? config.label+\" \" : \"\")+label;\n\t\t\t\t\tcustomRadio = customRadio.replace(/(aria-label=')\\w*(?=')/, \"$1\"+template.escape(optlabel));\n\t\t\t\t\tcustomRadio = customRadio.replace(/(aria-checked=')\\w*(?=')/, \"$1\"+(isChecked?\"true\":\"false\"));\n\t\t\t\t\tcustomRadio = customRadio.replace(/(tabindex=')\\w*(?=')/, \"$1\"+(isChecked || (i === 0 && !config.value)?\"0\":\"-1\"));\n\t\t\t\t\tcustomRadio = customRadio.replace(/(aria-invalid=')\\w*(?=')/, \"$1\"+(config.invalid?\"true\":\"false\"));\n\t\t\t\t\tcustomRadio = customRadio.replace(/(button_id=')\\w*(?=')/, \"$1\"+options[i].id);\n\t\t\t\t}\n\t\t\t\tvar rd = common._baseInputHTML(\"input\")+\" name='\"+(config.name || config.id)+\"' type='radio' \"+(isChecked?\"checked='1'\":\"\")+\"tabindex=\"+(isChecked || (i === 0 && !config.value)?\"0\":\"-1\")+\" value='\"+options[i].id+\"' id='\"+eachid+\"' style='\"+(customRadio?\"display:none\":\"\")+\"' />\";\n\t\t\t\tvar input = \"\";\n\t\t\t\tif (label)\n\t\t\t\t\tlabel = \"\";\n\n\t\t\t\thtml.push(\"\");\n\t\t\t\t\n\t\t\t}\n\t\t\thtml = \"
\"+html.join(\"\")+\"
\";\n\t\t\t\n\t\t\treturn common.$renderInput(config, html, id);\n\t\t}\n\t},\n\trefresh:function(){\n\t\tthis.render();\n\t\tif (this._last_size && this.$getSize(0,0)[2] != this._last_size[1])\n\t\t\tthis.resize();\n\t},\n\t$getSize:function(dx, dy){\n\t\tvar size = button.api.$getSize.call(this, dx, dy);\n\t\tif (this._settings.options){\n\t\t\tvar count = this._settings.vertical?0:1;\n\t\t\tfor (var i=0; i < this._settings.options.length; i++)\n\t\t\t\tif (this._settings.vertical || this._settings.options[i].newline)\n\t\t\t\t\tcount++;\n\t\t\tsize[3] = size[2] = Math.max(size[2], (this._settings.optionHeight||25) * count+this._settings.inputPadding*2+ (this._settings.labelPosition == \"top\"?this._labelTopHeight:0));\n\t\t}\n\t\tvar heightInc = this.config.bottomPadding;\n\t\tif(heightInc){\n\t\t\tsize[2] += heightInc;\n\t\t\tsize[3] += heightInc;\n\t\t}\n\t\treturn size;\n\t},\n\t_getInputNode: function(){\n\t\treturn this._dataobj.getElementsByTagName(this._settings.customRadio ? \"button\" : \"input\");\n\t},\n\t$setValue:function(value){\n\t\tvar inp = this._dataobj.getElementsByTagName(\"input\");\n\n\t\tfor (var i=0; i < inp.length; i++){\n\t\t\tif (inp[i].parentNode.getAttribute(\"radio_id\")==value){\n\t\t\t\tinp[i].checked = true;\n\t\t\t\tinp[i].setAttribute(\"tabindex\",\"0\");\n\t\t\t} else{\n\t\t\t\tinp[i].checked = false;\n\t\t\t\tinp[i].setAttribute(\"tabindex\",\"-1\");\n\t\t\t}\n\t\t\tvar parentNode = inp[i]?inp[i].parentNode:null;\n\n\t\t\tif(parentNode){\n\t\t\t\tparentNode.className = parentNode.className.replace(/(webix_radio_)\\d/,\"$1\"+(inp[i].checked?1:0));\n\t\t\t\tif(this._settings.customRadio){\n\t\t\t\t\tvar button = parentNode.getElementsByTagName(\"BUTTON\");\n\t\t\t\t\tif(button[0]){\n\t\t\t\t\t\tbutton[0].setAttribute(\"aria-checked\", inp[i].checked?\"true\":\"false\");\n\t\t\t\t\t\tbutton[0].setAttribute(\"tabindex\", inp[i].checked?\"0\":\"-1\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tgetValue:function(){\n\t\treturn this._settings.value;\n\t},\n\tfocus: function(){ this._focus(); },\n\tblur: function(){ this._blur(); },\n\tcustomRadio_setter: function(value){\n\t\tif(value === true && $active.customRadio)\n\t\t\tvalue = \"\";\n\t\treturn value;\n\t},\n\t$skin:function(){\n\t\tthis.defaults.customRadio = !!$active.customRadio;\n\t\tif($active.optionHeight)\n\t\t\tthis.defaults.optionHeight = $active.optionHeight;\n\t}\n};\n\nconst view = protoUI(api, HTMLOptions, text.view);\nexport default {api, view};","import {protoUI, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {isUndefined, isArray} from \"../webix/helpers\";\n\nimport i18n from \"../webix/i18n\";\nimport wDate from \"../core/date\";\n\nimport text from \"./text\";\n\n\nconst api = {\n\tname:\"datepicker\",\n\t$init:function(){\n\t\tthis.$ready.push(this._init_popup);\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, common){\n\t\t\tif(common._settings.type == \"time\"){\n\t\t\t\tcommon._settings.icon = common._settings.timeIcon;\n\t\t\t}\n\t\t\t//temporary remove obj.type [[DIRTY]]\n\t\t\tvar t = obj.type; obj.type = \"\";\n\t\t\tvar res = obj.editable?common.$renderInput(obj):common._render_div_block(obj, common);\n\t\t\tobj.type = t;\n\t\t\treturn res;\n\t\t},\n\t\tstringResult:false,\n\t\ttimepicker:false,\n\t\ticon:\"wxi-calendar\",\n\t\ticons: true,\n\t\ttimeIcon: \"wxi-clock\",\n\t\tseparator:\", \"\n\t},\n\t_onBlur:function(){\n\t\tif (this._settings.text == this.getText() || (isUndefined(this._settings.text) && !this.getText()))\n\t\t\treturn;\n\n\t\tvar value = this.getPopup().getValue();\n\t\tif (value)\n\t\t\tthis.setValue(value);\n\t},\n\t$skin:function(){\n\t\tthis.defaults.inputPadding = $active.inputPadding;\n\t\tthis.defaults.point = !$active.popupNoPoint;\n\t},\n\tgetPopup: function(){\n\t\treturn $$(this._settings.popup);\n\t},\n\t_init_popup:function(){ \n\t\tvar obj = this._settings;\n\t\tif (obj.suggest)\n\t\t\tobj.popup = obj.suggest;\n\t\telse if (!obj.popup){\n\t\t\tvar timepicker = this._settings.timepicker;\n\t\t\tobj.popup = obj.suggest = this.suggest_setter({\n\t\t\t\ttype:\"calendar\", point:this._settings.point===false?false:true, padding:0,\n\t\t\t\tbody: {\n\t\t\t\t\theight:240+(timepicker||this._settings.icons?30:0),\n\t\t\t\t\twidth:250,\n\t\t\t\t\tmultiselect: this._settings.multiselect, \n\t\t\t\t\ttimepicker: timepicker,\n\t\t\t\t\ttype: this._settings.type,\n\t\t\t\t\ticons: this._settings.icons,\n\t\t\t\t\ttimeIcon: this._settings.timeIcon\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tthis._init_once = function(){};\n\t},\n\t$render:function(obj){\n\t\tif (isUndefined(obj.value)) return;\n\t\tobj.value = this.$prepareValue(obj.value);\n\t\tthis.$setValue(obj.value);\n\t},\n\t$prepareValue:function(value){\n\t\tif (this._settings.multiselect){\n\t\t\tif (typeof value === \"string\")\n\t\t\t\tvalue = value.split(this._settings.separator);\n\t\t\telse if (value instanceof Date){\n\t\t\t\tvalue = [value];\n\t\t\t} else if (!value){\n\t\t\t\tvalue = [];\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < value.length; i++){\n\t\t\t\tvalue[i] = this._prepareSingleValue(value[i]);\n\t\t\t}\n\n\t\t\treturn value;\n\t\t} else{ \n\t\t\treturn this._prepareSingleValue(value);\n\t\t}\n\t},\n\t_prepareSingleValue:function(value){\n\t\tvar type = this._settings.type;\n\t\tvar timeMode = type == \"time\";\n\n\t\t//setValue(\"1980-12-25\")\n\t\tif(!isNaN(parseFloat(value)))\n\t\t\tvalue = \"\"+value;\n\n\t\tif (typeof value==\"string\" && value){\n\t\t\tvar formatDate = null;\n\t\t\tif((type == \"month\" || type == \"year\") && this._formatDate){\n\t\t\t\tformatDate = this._formatDate;\n\t\t\t}\n\t\t\telse\n\t\t\t\tformatDate = (timeMode?i18n.parseTimeFormatDate:i18n.parseFormatDate);\n\t\t\tvalue = formatDate(value);\n\t\t}\n\n\t\tif (value){\n\t\t\t//time mode\n\t\t\tif(timeMode){\n\t\t\t\t//setValue([16,24])\n\t\t\t\tif(isArray(value)){\n\t\t\t\t\tvar time = new Date();\n\t\t\t\t\ttime.setHours(value[0]);\n\t\t\t\t\ttime.setMinutes(value[1]);\n\t\t\t\t\tvalue = time;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//setValue(invalid date)\n\t\t\tif(isNaN(value.getTime()))\n\t\t\t\tvalue = \"\";\n\t\t}\n\n\t\treturn value;\n\t},\n\t_get_visible_text:function(value){\n\t\tif (this._settings.multiselect){\n\t\t\treturn []\n\t\t\t\t.concat(value)\n\t\t\t\t.map((function(a){ return this._get_visible_text_single(a); }).bind(this))\n\t\t\t\t.join(this.config.separator);\n\t\t} else\n\t\t\treturn this._get_visible_text_single(value);\n\t},\n\t_get_visible_text_single:function(value){\n\t\tvar timeMode = this._settings.type == \"time\";\n\t\tvar timepicker = this.config.timepicker;\n\t\tvar formatStr = this._formatStr||(timeMode?i18n.timeFormatStr:(timepicker?i18n.fullDateFormatStr:i18n.dateFormatStr));\n\t\treturn formatStr(value);\n\t},\n\t_set_visible_text:function(){\n\t\tvar node = this.getInputNode();\n\t\tif(node.value == undefined){\n\t\t\tnode.innerHTML = this._settings.text || this._get_div_placeholder();\n\t\t}\n\t\telse{\n\t\t\tnode.value = this._settings.text || \"\";\n\t\t}\n\t},\n\t$compareValue:function(oldvalue, value){\n\t\tif(!oldvalue && !value) return true;\n\t\treturn wDate.equal(oldvalue, value);\n\t},\n\t$setValue:function(value){\n\t\tthis._settings.text = (value?this._get_visible_text(value):\"\");\n\t\tthis._set_visible_text();\n\t},\n\tformat_setter:function(value){\n\t\tif(value){\n\t\t\tif (typeof value === \"function\")\n\t\t\t\tthis._formatStr = value;\n\t\t\telse {\n\t\t\t\tthis._formatStr = wDate.dateToStr(value);\n\t\t\t\tthis._formatDate = wDate.strToDate(value);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tthis._formatStr = this._formatDate = null;\n\t\treturn value;\n\t},\n\tgetInputNode: function(){\n\t\treturn this._settings.editable?this._dataobj.getElementsByTagName(\"input\")[0]:this._dataobj.getElementsByTagName(\"DIV\")[1];\n\t},\n\tgetValue:function(){\n\t\tif (this._settings.multiselect){\n\t\t\tvar value = this._settings.value;\n\t\t\tif (!value) return [];\n\n\t\t\tvar result = []\n\t\t\t\t.concat(value)\n\t\t\t\t.map((function(a){ return this._get_value_single(a); }).bind(this));\n\n\t\t\tif (this._settings.stringResult)\n\t\t\t\treturn result.join(this._settings.separator);\n\n\t\t\treturn result;\n\t\t}\n\n\t\treturn this._get_value_single(this._settings.value);\n\t},\n\t_get_value_single:function(value){\n\t\tvar type = this._settings.type;\n\t\t//time mode\n\t\tvar timeMode = (type == \"time\");\n\t\t//date and time mode\n\t\tvar timepicker = this.config.timepicker;\n\n\t\t//input was not rendered, we need to parse value from setValue method\n\t\tif (!this._rendered_input)\n\t\t\tvalue = this.$prepareValue(value) || null;\n\t\t//rendere and in edit mode\n\t\telse if (this._settings.editable){\n\t\t\tvar formatDate = this._formatDate||(timeMode?i18n.timeFormatDate:(timepicker?i18n.fullDateFormatDate:i18n.dateFormatDate));\n\t\t\tvalue = formatDate(this.getInputNode().value);\n\t\t}\n\n\t\t//return string from getValue\n\t\tif(this._settings.stringResult){\n\t\t\tvar formatStr =i18n.parseFormatStr;\n\t\t\tif(timeMode)\n\t\t\t\tformatStr = i18n.parseTimeFormatStr;\n\t\t\tif(this._formatStr && (type == \"month\" || type == \"year\")){\n\t\t\t\tformatStr = this._formatStr;\n\t\t\t}\n\n\t\t\tif(this._settings.multiselect)\n\t\t\t\treturn [].concat(value).map((function(a){ return a?formatStr(a):\"\"; }));\n\t\t\treturn (value?formatStr(value):\"\");\n\t\t}\n\t\t\n\t\treturn value||null;\n\t},\n\tgetText:function(){\n\t\tvar node = this.getInputNode();\n\t\treturn (node?(typeof node.value == \"undefined\" ? (this.getValue()?node.innerHTML:\"\") : node.value):\"\");\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {isUndefined} from \"../webix/helpers\";\n\nimport datepicker from \"./datepicker\";\n\n\nconst api = {\n\tname:\"colorpicker\",\n\t$init:function(){\n\t\tthis.$ready.push(this._init_popup);\n\t},\n\tdefaults:{\n\t\ticon:true\n\t},\n\t_init_popup:function(){\n\t\tvar obj = this._settings;\n\t\tif (obj.suggest)\n\t\t\tobj.popup = obj.suggest;\n\t\telse if (!obj.popup)\n\t\t\tobj.popup = obj.suggest = this.suggest_setter({\n\t\t\t\ttype:\"colorboard\", height:200\n\t\t\t});\n\t\tthis._init_once = function(){};\n\t},\n\t$render:function(obj){\n\t\tif (isUndefined(obj.value)) return;\n\t\tobj.value = this.$prepareValue(obj.value);\n\t\tthis.$setValue(obj.value);\n\t},\n\tgetValue:function(){\n\t\tif (this._rendered_input && this._settings.editable)\n\t\t\treturn this.getInputNode().value;\n\t\telse\n\t\t\treturn this._settings.value;\n\t},\n\t$prepareValue:function(value){\n\t\tif(value && value.charAt && value.charAt(0) != \"#\")\n\t\t\tvalue = \"#\" + value;\n\t\treturn value || \"\";\n\t},\n\t_getColorNode: function(){\n\t\treturn this.$view.getElementsByTagName(\"DIV\")[this._settings.editable?1:2];\n\t},\n\t_get_visible_text:function(value){\n\t\treturn value;\n\t},\n\t$setValue:function(value){\n\t\tthis._getColorNode().style.backgroundColor = value;\n\t\tthis._settings.text = value;\n\n\t\tvar node = this.getInputNode();\n\t\tif(node.value == undefined)\n\t\t\tnode.innerHTML = value;\n\t\telse\n\t\t\tnode.value = value;\n\t},\n\t$renderIcon:function(){\n\t\tvar config = this.config;\n\t\treturn \"
\";\n\t}\n};\n\nconst view = protoUI(api, datepicker.view);\nexport default {api, view};","import {protoUI, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {isUndefined, bind} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\n\nimport text from \"./text\";\n\n\nconst api = {\n\tname:\"richselect\",\n\tdefaults:{\n\t\ttemplate:function(obj,common){\n\t\t\treturn common._render_div_block(obj, common);\n\t\t},\n\t\tpopupWidth:200,\n\t\ticon: \"wxi-menu-down\"\n\t},\n\t_onBlur:function(){\n\t\tif (this._settings.text == this.getText() || (isUndefined(this._settings.text) && !this.getText()))\n\t\t\treturn;\n\n\t\tvar suggest = this.getPopup(),\n\t\t\tnodeValue = this.getInputNode().value,\n\t\t\tvalue = suggest.getSuggestion(nodeValue),\n\t\t\toldvalue = this.getValue();\n\n\t\t//non-empty value that differs from old value and matches filtering rule\n\t\tif (value && value !=oldvalue && !(nodeValue===\"\" && suggest.getItemText(value)!==\"\"))\n\t\t\tthis.setValue(value);\n\t\telse if(nodeValue===\"\")\n\t\t\tthis.setValue(\"\");\n\t\telse if(this._revertValue)\n\t\t\tthis._revertValue();\n\t},\n\tsuggest_setter:function(value){\n\t\treturn this.options_setter(value);\n\t},\n\toptions_setter:function(value){\n\t\tvalue = this._suggest_config ? this._suggest_config(value) : value;\n\t\tvar suggest = (this._settings.popup = this._settings.suggest = text.api.suggest_setter.call(this, value));\n\t\tvar list = $$(suggest).getList();\n\t\tif (list)\n\t\t\tlist.attachEvent(\"onAfterLoad\", bind(this._reset_value, this));\n\n\t\treturn suggest;\n\t},\n\tgetList: function(){\n\t\tvar suggest = $$(this._settings.suggest);\n\t\tassert(suggest, \"Input doesn't have a list\");\n\t\treturn suggest.getList();\n\t},\n\t_pattern :function(value){ return value; },\n\t_reset_value:function(){\n\t\tvar value = this._settings.value;\n\t\t//this._dataobj.firstChild - check that input is already rendered, as in IE11 it can be destroy during parent repainting\n\t\tif(!isUndefined(value) && !this.getPopup().isVisible() && !this._settings.text && this._dataobj.firstChild)\n\t\t\tthis.$setValue(value);\n\t},\n\t$skin:function(){\n\t\tthis.defaults.inputPadding = $active.inputPadding;\n\t},\n\t$render:function(obj){\n\t\tif (isUndefined(obj.value)) return;\n\t\tthis.$setValue(obj.value);\n\t},\n\tgetInputNode: function(){\n\t\treturn this._dataobj.getElementsByTagName(\"DIV\")[1];\n\t},\n\tgetPopup: function(){\n\t\treturn $$(this._settings.popup);\n\t},\n\tgetText:function(){\n\t\tvar value = this._settings.value,\n\t\t\tnode = this.getInputNode();\n\t\tif(!node)\n\t\t\treturn value?this.getPopup().getItemText(value):\"\";\n\t\tif (typeof node.value == \"undefined\"){\n\t\t\tif (node.firstChild && node.firstChild.className === \"webix_placeholder\")\n\t\t\t\treturn \"\";\n\t\t\treturn node.innerHTML;\n\t\t}\n\t\treturn node.value;\n\t},\n\t$setValue:function(value){\n\t\tif (!this._rendered_input) return;\n\n\t\tvar text = value;\n\t\tvar popup = this.getPopup();\n\n\t\tif (popup)\n\t\t\ttext = this.getPopup().getItemText(value);\n\n\t\tif (!text && value && value.id){ //add new value\n\t\t\tthis.getPopup().getList().add(value);\n\t\t\ttext = this.getPopup().getItemText(value.id);\n\t\t\tthis._settings.value = value.id;\n\t\t}\n\n\t\tvar node = this.getInputNode();\n\n\t\tif (isUndefined(node.value))\n\t\t\tnode.innerHTML = text || this._get_div_placeholder();\n\t\telse \n\t\t\tnode.value = text = text.replace(/<[^>]*>/g,\"\");\n\n\t\tthis._settings.text = text;\n\t},\n\tgetValue:function(){\n\t\treturn this._settings.value||\"\";\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {isUndefined} from \"../webix/helpers\";\n\nimport richselect from \"./richselect\";\n\n\nconst api = {\n\tname:\"combo\",\n\tgetInputNode:function(){\n\t\treturn this._dataobj.getElementsByTagName(\"input\")[0];\n\t},\n\t$render:function(obj){\n\t\tif (isUndefined(obj.value)) return;\n\t\tthis.$setValue(obj.value);\n\t},\n\t_revertValue:function(){\n\t\tif(!this._settings.editable){\n\t\t\tvar value = this.getValue();\n\t\t\tthis.$setValue(isUndefined(value)?\"\":value);\n\t\t}\n\t},\n\t_applyChanges:function(){\n\t\tvar input = this.getInputNode(),\n\t\t\tvalue = \"\",\n\t\t\tsuggest = this.getPopup();\n\n\t\tif (input.value){\n\t\t\tvalue = this._settings.value;\n\t\t\tif(suggest.getItemText(value) != this.getText())\n\t\t\t\tvalue = suggest.getSuggestion()||value;\n\t\t}\n\t\tif (value != this._settings.value)\n\t\t\tthis.setValue(value, true);\n\t\telse\n\t\t\tthis.$setValue(value);\n\t},\n\tdefaults:{\n\t\ttemplate:function(config, common){\n\t\t\treturn common.$renderInput(config).replace(/(\";\n\t\t\thtml += \"\";\n\t\t\thtml += common._baseInputHTML(\"input\")+\" id='\"+id+\"' type='text' class='webix_inp_counter_value' aria-live='assertive'\"+\" value='\"+value+\"'>\";\n\t\t\thtml += \"\";\n\t\t\treturn common.$renderInput(config, html, id);\n\t\t},\n\t\tmin:0,\n\t\tmax:Infinity,\n\t\tstep:1\n\t},\n\t$init:function(){\n\t\t_event(this.$view, \"keydown\", this._keyshift, {bind:this});\n\t},\n\t_keyshift:function(e){\n\t\tvar code = e.which || e.keyCode, c = this._settings, value = c.value || c.min;\n\n\t\tif(code>32 && code <41){\n\t\t\tif(code === 35) value = c.min;\n\t\t\telse if(code === 36) value = c.max === Infinity? 1000000 :c.max;\n\t\t\telse if(code === 33) this.next();\n\t\t\telse if(code === 34) this.prev();\n\t\t\telse value = value+(code === 37 || code ===40?-1:1);\n\t\t\t\n\t\t\tif(code>34 && value>=c.min && value <=c.max)\n\t\t\t\tthis.setValue(value);\n\t\t}\n\t},\n\t$setValue:function(value){\n\t\tthis.getInputNode().value = value;\n\t},\n\tgetInputNode:function(){\n\t\treturn this._dataobj.getElementsByTagName(\"input\")[0];\n\t},\n\tgetValue:function(){\n\t\treturn button.api.getValue.apply(this,arguments)*1;\n\t},\n\tnext:function(step){\n\t\tstep = this._settings.step;\n\t\tthis.shift(step);\n\t},\n\tprev:function(step){\n\t\tstep = (-1)*this._settings.step;\n\t\tthis.shift(step);\n\t},\n\tshift:function(step){\n\t\tvar min = this._settings.min;\n\t\tvar max = this._settings.max;\n\n\t\tvar new_value = this.getValue() + step;\n\t\tif (new_value >= min && new_value <= max)\n\t\t\tthis.setValue(new_value);\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\n\nimport button from \"./button\";\n\n\nconst api = {\n\tname:\"icon\",\n\t$skin:function(){\n\t\tthis.defaults.height = $active.inputHeight;\n\t\tthis.defaults.width = $active.inputHeight;\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, view){\n\t\t\tlet min = Math.min(obj.awidth, obj.aheight);\n\t\t\tlet top = Math.round((view._content_height-obj.aheight)/2);\n\t\t\tlet inner = \"\";\n\n\t\t\treturn \"
\"+inner+(obj.badge ? \"\"+obj.badge+\"\":\"\")+\n\t\t\t\t\"
\";\n\t\t}\n\t},\n\t_set_inner_size:function(){},\n\t$setValue:function(){}\n};\n\nconst view = protoUI(api, button.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\n\nimport text from \"./text\";\n\n\nconst api = {\n\tname:\"search\",\n\ton_click:{\n\t\t\"webix_input_icon\":function(e){\n\t\t\tthis.getInputNode().focus();\n\t\t\tthis.callEvent(\"onSearchIconClick\", [e]);\n\t\t}\n\t},\n\t$skin:function(){\n\t\tthis.defaults.inputPadding = $active.inputPadding;\n\t},\n\tdefaults:{\n\t\ttype:\"text\",\n\t\ticon:\"wxi-search\"\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {addCss, removeCss} from \"../webix/html\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {once, uid, PowerArray} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport template from \"../webix/template\";\n\nimport HTMLOptions from \"../core/htmloptions\";\n\nimport text from \"./text\";\n\n\nconst api = {\n\tname:\"segmented\",\n\t$allowsClear:false,\n\t$init:function(){\n\t\tthis.attachEvent(\"onChange\", function(value){\n\t\t\tif (this._settings.multiview)\n\t\t\t\tthis._show_view(value);\n\t\t});\n\t\tthis.attachEvent(\"onAfterRender\", once(function(){\n\t\t\tif (this._settings.multiview && this._settings.value)\n\t\t\t\tthis._show_view(this._settings.value);\n\t\t}));\n\t},\n\t_show_view:function(value){\n\t\tvar top = this.getTopParentView();\n\t\tvar view = null;\n\n\t\t//get from local isolate\n\t\tif (top && top.$$)\n\t\t\tview = top.$$(value);\n\t\t//or check globally\n\t\tif (!view)\n\t\t\tview = $$(value);\n\n\t\tif(view && view.show)\n\t\t\tview.show();\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, common){\n\t\t\tif(!obj.options)\n\t\t\t\tassert(false, \"segmented: options undefined\");\n\t\t\tvar options = obj.options;\n\t\t\tcommon._check_options(options);\n\t\t\toptions = common._filterOptions(options);\n\n\t\t\tvar width = common._get_input_width(obj);\n\n\t\t\tvar id = uid();\n\t\t\tvar html = \"
\";\n\t\t\tvar optionWidth = obj.optionWidth || Math.floor(width/options.length);\n\t\t\tif(!obj.value)\n\t\t\t\tobj.value = options[0].id;\n\n\t\t\tfor(var i=0; i0?1:0))+((obj.value==options[i].id)?\" webix_selected \":\"\")+\"' button_id='\"+options[i].id+\"' \"+(options[i].tooltip?(\"title='\"+options[i].tooltip+\"'\"):\"\")+\">\";\n\t\t\t\thtml+= options[i].value+\"\";\n\t\t\t}\n\t\t\t\n\t\t\treturn common.$renderInput(obj, html+\"
\", id);\n\t\t}\n\t},\n\t_getInputNode:function(){\n\t\treturn this.$view.getElementsByTagName(\"BUTTON\");\n\t},\n\tfocus: function(){ this._focus(); },\n\tblur: function(){ this._blur(); },\n\t$setValue:function(value){\n\n\t\tvar options = this._getInputNode();\n\n\t\tfor(var i=0; i= 0)\n\t\t\tPowerArray.removeAt.call(options, index);\n\n\t\t// if we remove a selected option\n\t\tif(this._settings.value == id)\n\t\t\tthis._setNextVisible(options, index);\n\t\t\t\n\t\tthis.refresh();\n\t\tthis.callEvent(\"onOptionRemove\", [id, this._settings.value]);\n\t},\n\t_setNextVisible: function(options, index){\n\t\tvar size = options.length;\n\n\t\tif(size){\n\t\t\tindex = Math.min(index, size-1);\n\t\t\t//forward search\n\t\t\tfor (let i=index; i=0; i--)\n\t\t\t\tif (!options[i].hidden)\n\t\t\t\t\treturn this.setValue(options[i].id);\n\t\t}\n\t\t\n\t\t//nothing found\t\t\n\t\tthis.setValue(\"\");\n\t},\n\t_filterOptions: function(options){\n\t\tvar copy = [];\n\t\tfor(var i=0; i\"+common._pattern(obj.value)+\"\";\n\n\t\t\treturn common.$renderInput(obj, html, id);\n\t\t},\n\t\theight:0,\n\t\tminHeight:60\n\t},\n\t$skin:function(){\n\t\tthis.defaults.inputPadding = $active.inputPadding;\n\t\tthis._inputSpacing = $active.inputSpacing;\n\t},\n\t_skipSubmit: true,\n\t$renderLabel: function(config, id){\n\t\tvar labelAlign = (config.labelAlign||\"left\");\n\t\tvar top = this._settings.labelPosition == \"top\";\n\t\tvar labelTop = top?\"display:block;\":(\"width: \" + this._settings.labelWidth + \"px;\");\n\t\tvar label = \"\";\n\t\tif (config.label)\n\t\t\tlabel = \"\";\n\t\treturn label;\n\t},\n\t//get input element\n\tgetInputNode: function() {\n\t\treturn this._dataobj.getElementsByTagName(\"textarea\")[0];\n\t}\n};\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","import {addCss, removeCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\n\nimport button from \"./button\";\n\n\nconst api = {\n\tname:\"toggle\",\n\t$allowsClear:true,\n\t$init:function(){\n\t\tthis.attachEvent(\"onItemClick\", function(){\n\t\t\tthis.toggle();\n\t\t});\n\t},\n\t$setValue:function(value){\n\t\tvar input = this.getInputNode();\n\t\tvar obj = this._settings;\n\t\tvar isPressed = (value && value != \"0\");\n\t\tvar text = (isPressed ? obj.onLabel : obj.offLabel) || obj.label;\n\t\tvar textNode = input.lastChild;\n\t\t\n\t\tinput.setAttribute(\"aria-pressed\", isPressed?\"true\":false);\n\t\tinput.value = text;\n\t\tif (textNode)\n\t\t\t(textNode.firstChild || textNode).nodeValue = text;\n\n\t\t//icon or image button\n\t\tif(input.firstChild && input.firstChild.nodeName ===\"SPAN\" && obj.onIcon && obj.offIcon && obj.onIcon !==obj.offIcon)\n\t\t\tinput.firstChild.className = input.firstChild.className.replace((isPressed?obj.offIcon:obj.onIcon), (isPressed?obj.onIcon:obj.offIcon));\n\t\t\n\t\tvar parent = input.parentNode;\n\t\tif(isPressed)\n\t\t\taddCss(parent, \"webix_pressed\");\n\t\telse\n\t\t\tremoveCss(parent, \"webix_pressed\");\n\t},\n\ttoggle:function(){\n\t\tthis.setValue(!this.getValue());\n\t},\n\tgetValue:function(){\n\t\tvar value = this._settings.value;\n\t\treturn (!value||value==\"0\")?0:1;\n\t},\n\tdefaults:{\n\t\ttemplate:function(obj, common){\n\t\t\tvar isPressed = (obj.value && obj.value != \"0\");\n\t\t\tvar css = isPressed ? \" webix_pressed\" : \"\";\n\n\t\t\tobj.label = (isPressed ? obj.onLabel : obj.offLabel) || obj.label;\n\t\t\tobj.icon = (isPressed ? obj.onIcon : obj.offIcon) || obj.icon;\n\t\t\t\n\t\t\tvar html = \"
\"+common.$renderInput(obj, common)+\"
\";\n\t\t\thtml = html.replace(/(button)\\s*(?=\\w)/, \"$1\"+(\" aria-pressed='\"+(isPressed?\"true\":\"false\")+\"' \"));\n\t\t\tif (obj.badge)\n\t\t\t\thtml = html.replace(/<\\/div>$/, \"\"+obj.badge+\"\");\n\t\t\t\n\t\t\treturn html;\n\t\t}\n\t},\n\t_set_inner_size:false\n};\n\n\nconst view = protoUI(api, button.view);\nexport default {api, view};","import text from \"../views/text\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {extend, toArray} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"multitext\",\n\t$cssName:\"text\",\n\tdefaults:{\n\t\ticon:\"wxi-plus-circle\",\n\t\ticonWidth:25,\n\t\tseparator:\", \"\n\t},\n\tgetValueHere:function(){\n\t\treturn text.api.getValue.call(this);\n\t},\n\tsetValueHere:function(value){\n\t\treturn text.api.$setValue.call(this, value);\n\t},\n\tgetValue:function(){\n\t\tif (this.config.mode == \"extra\") return this.getValueHere();\n\n\t\tif (this._full_value) \n\t\t\treturn this._full_value;\n\n\t\tvar values = [ this.getValueHere(this) ];\n\t\tfor (var i=0; i= 0; i--){\n\t\t\tvar section = parent._subs[i];\n\t\t\tif (!id || section == id){\n\t\t\t\tparent._subs.removeAt(i);\n\t\t\t\tthis.getParentView().removeView(section);\n\t\t\t\tparent.callEvent(\"onSectionRemove\", [section, i+1]);\n\t\t\t}\n\t\t}\n\t},\n\ton_click:{\n\t\t\"webix_input_icon\":function(){\n\t\t\tif (this.config.mode == \"extra\"){\n\t\t\t\tthis.removeSection(this.config.id);\n\t\t\t\tvar childs = this.getParentView().getChildViews();\n\t\t\t\tchilds[childs.length - 1].focus();\n\t\t\t\tthis._subOnChange();\n\t\t\t} else\n\t\t\t\t$$( this.addSection() ).focus();\n\n\t\t\treturn false;\n\t\t}\n\t},\n\t$init:function(){\n\t\tthis._subs = toArray([]);\n\t\tthis.attachEvent(\"onKeyPress\", this._onKeyPress);\n\t},\n\t$render:function(obj){\n\t\tthis.$setValue(obj.value);\n\t},\n};\n\n\nconst view = protoUI(api, text.view);\nexport default {api, view};","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"multiselect\", defaults:{\n\ttemplate:\"GPL version doesn't support multiselect
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"multicombo\", defaults:{\n\ttemplate:\"GPL version doesn't support multicombo
You need Webix PRO\"\n}}, template.view);","import text from \"../views/text\";\nimport {preventEvent, addCss, removeCss, pos as getPos, offset} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport env from \"../webix/env\";\nimport {uid, bind, isArray, copy} from \"../webix/helpers\";\nimport {_event, event, eventRemove} from \"../webix/htmlevents\";\nimport template from \"../webix/template\";\n\n\n// #include ui/inputs.js\n\nconst api = {\n\tname:\"slider\",\n\t$touchCapture:true,\n\tdefaults:{\n\t\tmin:0,\n\t\tmax:100,\n\t\tvalue:50,\n\t\tstep:1,\n\t\ttitle:false,\n\t\tmoveTitle:true,\n\t\ttemplate:function(obj, common){\n\t\t\tvar id = common._handle_id = \"x\" +uid();\n\t\t\tvar html = \"\";\n\t\t\tvar title = \"
\";\n\t\t\tvar left = \"
 
\";\n\t\t\tvar right = \"
\";\n\t\t\tvar handle = \"
 
\";\n\t\t\t\n\t\t\tif(obj.vertical) html = \"
\"+right+left+handle+\"
\"+title;\n\t\t\telse html = title+\"
\"+left+right+handle+\"
\";\n\t\t\treturn common.$renderInput(obj, html, id);\n\t\t}\n\t},\n\ttype_setter:function(type){\n\t\tthis._viewobj.className += \" webix_slider_\"+type;\n\t},\n\ttitle_setter:function(value){\n\t\tif (typeof value == \"string\")\n\t\t\treturn template(value);\n\t\treturn value;\n\t},\n\t_get_slider_handle:function(){\n\t\treturn this.$view.querySelector(\".webix_slider_handle\");\n\t},\n\t_set_inner_size:function(){\n\t\tvar handle = this._get_slider_handle();\n\t\tvar config = this._settings;\n\n\t\tif(handle){ //view is rendered for sure\n\t\t\tvar size = config.vertical?this._content_height:this._get_input_width(config); //width or height\n\t\t\tvar value = config.value%config.step?(Math.round(config.value/config.step)*config.step):config.value;\n\t\t\tvar max = config.max - config.min;\n\t\t\t\n\t\t\tvalue = Math.max(Math.min(value,config.max),config.min);\n\t\t\tvalue = config.vertical?(max-(value-config.min)):(value-config.min);\n\t\t\t\n\t\t\t//top or left\n\t\t\tvar corner1 = Math.ceil((size - 2 * this._sliderPadding) * value / max);\n\t\t\t//bottom or right\n\t\t\tvar corner2 = size - 2 * this._sliderPadding - corner1;\n\n\t\t\tvar cornerStr = config.vertical?\"top\":\"left\";\n\t\t\tvar sizeStr = config.vertical?\"height\":\"width\";\n\n\t\t\thandle.style[cornerStr] = this._sliderPadding + corner1 - this._sliderHandleWidth / 2 + \"px\";\n\t\t\thandle.parentNode.style[sizeStr] = size+\"px\";\n\n\t\t\t//1px border\n\t\t\tcorner2= Math.min(Math.max(corner2, 2 * this._sliderBorder), size - this._sliderPadding * 2 - 2 * this._sliderBorder);\n\t\t\tcorner1 = Math.min(Math.max(corner1, 2 * this._sliderBorder), size - this._sliderPadding * 2 - 2 * this._sliderBorder);\n\n\t\t\t//width for left/top and right/bottom bars\n\t\t\tvar part = handle.previousSibling;\n\t\t\tpart.style[sizeStr] = corner2 + \"px\";\n\t\t\tvar last = part.previousSibling;\n\t\t\tlast.style[sizeStr] = corner1 + \"px\";\n\n\t\t\tthis._set_title(handle, corner1, corner2, cornerStr);\n\t\t}\n\t},\n\t_set_title:function(handle, corner1, corner2, cornerStr){\n\t\tvar config = this._settings;\n\t\tif (this._settings.title){\n\t\t\tvar title = handle.parentNode[config.vertical?\"nextSibling\":\"previousSibling\"];\n\t\t\ttitle.innerHTML = this._settings.title(this._settings, this);\n\t\t\t\n\t\t\tif(this._settings.moveTitle){\n\t\t\t\tvar pos = 0;\n\t\t\t\tif(config.vertical) pos = corner1+2 * this._sliderBorder-this._sliderHandleWidth/2;\n\t\t\t\telse{\n\t\t\t\t\tvar half = title.clientWidth/2;\n\t\t\t\t\tvar pos1 = half>corner1 ? (half-corner1-2*this._sliderBorder): 0;//left/top text is to large\n\t\t\t\t\tvar pos2 = half>corner2 ? (half-corner2-2*this._sliderBorder-this._sliderHandleWidth/2): 0;//right/bottom text is too large\n\t\t\t\t\tpos = this._sliderPadding + corner1 - half + pos1 - pos2;\n\t\t\t\t} \n\t\t\t\ttitle.style[cornerStr] = pos+ \"px\";\n\t\t\t}\n\t\t}\n\t},\n\t_set_value_now:function(){\n\t\tthis._get_slider_handle().setAttribute(\"aria-valuenow\", this._settings.value);\n\t},\n\trefresh:function(){\n\t\tvar handle = this._get_slider_handle();\n\t\tif(handle){\n\t\t\tthis._set_value_now();\n\t\t\tif(this._settings.title)\n\t\t\t\thandle.setAttribute(\"aria-label\", this._settings.label+\" \"+this._settings.title(this._settings, this));\n\n\t\t\tthis._set_inner_size();\n\t\t}\n\t},\n\tvalue_setter:function(value){\n\t\treturn this.$prepareValue(value);\n\t},\n\t$setValue:function(){\n\t\tthis.refresh();\n\t},\n\t$getValue:function(){\n\t\treturn this._settings.value;\n\t},\n\t$prepareValue:function(value){\n\t\tvalue = parseFloat(value);\n\t\treturn isNaN(value)?0:value;\n\t},\n\t$init:function(config){\n\t\tif(env.touch)\n\t\t\tthis.attachEvent(\"onTouchStart\" , bind(this._on_mouse_down_start, this));\n\t\telse\n\t\t\t_event(this._viewobj, \"mousedown\", bind(this._on_mouse_down_start, this));\n\n\t\t_event( this.$view, \"keydown\", bind(this._handle_move_keyboard, this));\n\n\t\tif(config.vertical){\n\t\t\tconfig.height = config.height || $active.vSliderHeight;\n\t\t\tthis._viewobj.className += \" webix_slider_vertical\";\n\t\t\tthis._sliderPadding = $active.vSliderPadding;\n\t\t}\n\t},\n\t$skin: function(){\n\t\tthis._sliderHandleWidth = $active.sliderHandleWidth; //8 - width of handle / 2\n\t\tthis._sliderPadding = $active.sliderPadding;//10 - padding of webix_slider_box ( 20 = 10*2 )\n\t\tthis._sliderBorder = $active.sliderBorder;//1px border\n\t},\n\t_handle_move_keyboard:function(e){\n\t\tvar code = e.keyCode, c = this._settings, value = c.value;\n\n\t\tif(code>32 && code <41){\n\t\t\tpreventEvent(e);\n\n\t\t\tvar trg = e.target || e.srcElement;\n\t\t\tvar match = /webix_slider_handle_(\\d)/.exec(trg.className);\n\t\t\tthis._activeIndex = match?parseInt(match[1],10):-1;\n\t\t\tif(match)\n\t\t\t\tvalue = c.value[this._activeIndex];\n\n\t\t\tvalue = valuec.max ? c.max : value);\n\t\t\t\n\t\t\tif(code === 35) value = c.min;\n\t\t\telse if(code === 36) value = c.max;\n\t\t\telse{\n\t\t\t\tvar inc = (code === 37 || code ===40 || code === 34)?-1:1;\n\t\t\t\tif(code === 33 || code === 34 || c.step>1)\n\t\t\t\t\tinc = inc*c.step;\n\t\t\t\tvalue = value*1+inc;\n\t\t\t}\n\n\t\t\tif(match){\n\t\t\t\tvar other = c.value[this._activeIndex?0:1];\n\t\t\t\tvalue = ((this._activeIndex && value <= other) || (!this._activeIndex && value >= other )) ? other : value;\n\t\t\t}\n\n\t\t\tif(value>=c.min && value <=c.max){\n\t\t\t\tif(match){\n\t\t\t\t\tvar temp =[];\n\t\t\t\t\tfor(var i=0; i You need Webix PRO\"\n}}, template.view);","import checkbox from \"../views/checkbox\";\nimport {addCss, removeCss, getTextSize} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {uid} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"switch\",\n\tdefaults:{\n\t\ttemplate:function (config, common) {\n\t\t\tcommon._calck_switch_size();\n\n\t\t\tvar id = config.name || \"x\"+uid();\n\t\t\tvar rightlabel = \"\";\n\t\t\tif (config.labelRight){\n\t\t\t\trightlabel = \"\";\n\t\t\t\tif (config.labelWidth)\n\t\t\t\t\tconfig.label = config.label || \" \";\n\t\t\t}\n\t\t\tvar checked = (config.checkValue == config.value);\n\t\t\tvar aria = \"aria-label=\\\"\"+(config.label||config.labelRight||\"\")+\"\\\" role=\\\"checkbox\\\" tabindex=\\\"0\\\" aria-checked=\\\"\"+(checked?\"true\":\"false\")+\"\\\" \"+(config.readonly?\"aria-readonly='true'\":\"\")+\"\\\"\";\n\t\t\tvar html = \n\t\t\t\t\"
\"+\n\t\t\t\t\t\"\"+((checked?config.onLabel:config.offLabel)||\"\")+\"\"+\n\t\t\t\t\t\"\"+\n\t\t\t\t\"
\"+rightlabel;\n\n\t\t\treturn common.$renderInput(config, html, id);\n\t\t}\n\t},\n\t$skin:function(){\n\t\tthis._switchHeight = $active.switchHeight;\n\t\tthis._switchWidth = $active.switchWidth;\n\t},\n\t$setValue:function(value){\n\t\tvar config = this._settings;\n\t\tvar checked = (value == config.checkValue);\n\t\tvar box = this.$view.querySelector(\".webix_switch_box\");\n\n\t\tif(box){\n\t\t\tvar handle = box.childNodes[1];\n\t\t\tvar text = (checked?config.onLabel:config.offLabel)||\"\";\n\t\t\tif(checked)\n\t\t\t\taddCss(box, \"webix_switch_on\");\n\t\t\telse\n\t\t\t\tremoveCss(box, \"webix_switch_on\");\n\n\t\t\thandle.style.left = (checked?this._switchWidth-this._switchHeight:0)+\"px\";\n\t\t\thandle.firstChild.checked = checked;\n\t\t\thandle.setAttribute(\"aria-checked\", checked?\"true\":\"false\");\n\n\t\t\tif(text){\n\t\t\t\tbox.childNodes[0].innerHTML = text;\n\t\t\t}\n\t\t}\n\t},\n\t_calck_switch_size:function(){\n\t\tvar config = this._settings;\n\t\tif(config.onLabel || config.offLabel){\n\t\t\tvar onWidth = config.onLabel ? getTextSize(config.onLabel, \"webix_switch_text\").width : 0;\n\t\t\tvar offWidth = config.onLabel ? getTextSize(config.offLabel, \"webix_switch_text\").width : 0;\n\t\t\tthis._switchWidth = Math.max(onWidth, offWidth)+this._switchHeight;\n\t\t}\n\t},\n\ton_click:{\n\t\t\"webix_switch_box\":function(){\n\t\t\tif(!this._settings.readonly)\n\t\t\t\tthis.toggle();\n\t\t},\n\t\t\"webix_label_right\":function(){\n\t\t\tif(!this._settings.readonly)\n\t\t\t\tthis.toggle();\n\t\t}\n\t}\n};\n\n\nconst view = protoUI(api, checkbox.view);\nexport default {api, view};","import segmented from \"../views/segmented\";\nimport {protoUI, ui, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {bind, extend} from \"../webix/helpers\";\nimport i18n from \"../webix/i18n\";\nimport template from \"../webix/template\";\n\n\nconst api = {\n\tname:\"tabbar\",\n\t$init:function(){\n\t\tthis.attachEvent(\"onKeyPress\", this._onKeyPress);\n\t},\n\t$skin:function(){\n\t\tvar skin = $active;\n\t\tvar defaults = this.defaults;\n\n\t\tdefaults.topOffset = skin.tabTopOffset||0;\n\t\tdefaults.tabOffset = (typeof skin.tabOffset != \"undefined\"?skin.tabOffset:10);\n\t\tdefaults.bottomOffset = skin.tabBottomOffset||0;\n\t\tdefaults.height = skin.tabbarHeight;\n\n\t\tdefaults.tabMargin = skin.tabMargin;\n\t\tdefaults.inputPadding = skin.inputPadding;\n\t\tdefaults.tabMinWidth = skin.tabMinWidth||100;\n\t\tdefaults.tabMoreWidth = skin.tabMoreWidth||40;\n\t\tdefaults.borderless = !skin.tabBorder;\n\t},\n\t_getTabbarSizes: function(){\n\n\t\tvar config = this._settings,\n\t\t\ti, len,\n\t\t\ttabs = this._tabs||config.options,\n\t\t\ttotalWidth = this._input_width - config.tabOffset*2,\n\t\t\tlimitWidth = config.optionWidth||config.tabMinWidth;\n\n\t\tlen = tabs.length;\n\n\t\tif(config.tabMinWidth && totalWidth/len < limitWidth){\n\t\t\treturn { max: (parseInt(totalWidth/limitWidth,10)||1)};\n\t\t}\n\n\n\t\tif(!config.optionWidth){\n\t\t\tfor(i=0;i< len; i++){\n\t\t\t\tif(tabs[i].width){\n\t\t\t\t\ttotalWidth -= tabs[i].width+(!i&&!config .type?config.tabMargin:0);\n\t\t\t\t\tlen--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {width: (len?totalWidth/len:config.tabMinWidth)};\n\t},\n\t_init_popup: function(){\n\t\tvar obj = this._settings;\n\t\tif (!obj.tabbarPopup){\n\t\t\tvar popupConfig = {\n\t\t\t\tview: \"popup\",\n\t\t\t\twidth: (obj.popupWidth||200),\n\t\t\t\tbody:{\n\t\t\t\t\tview: \"list\",\n\t\t\t\t\tborderless: true,\n\t\t\t\t\tselect: true,\n\t\t\t\t\tcss: \"webix_tab_list\",\n\t\t\t\t\tautoheight: true, yCount:obj.yCount,\n\t\t\t\t\ttype:{\n\t\t\t\t\t\ttemplate: obj.popupTemplate\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tvar view = ui(popupConfig);\n\t\t\tview.getBody().attachEvent(\"onBeforeSelect\",bind(function(id){\n\t\t\t\tif (id && this.callEvent(\"onBeforeTabClick\", [id])){\n\t\t\t\t\tthis.setValue(id);\n\t\t\t\t\t$$(this._settings.tabbarPopup).hide();\n\t\t\t\t\tthis.callEvent(\"onAfterTabClick\", [id]);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t},this));\n\n\t\t\tview.getBody().attachEvent(\"onAfterSelect\", bind(function(){\n\t\t\t\tthis.refresh();\n\t\t\t},this));\n\n\t\t\tobj.tabbarPopup = view._settings.id;\n\t\t\tthis._destroy_with_me.push(view);\n\t\t}\n\t\tthis._init_popup = function(){};\n\t},\n\tgetPopup: function(){\n\t\tthis._init_popup();\n\t\treturn $$(this._settings.tabbarPopup);\n\t},\n\tmoreTemplate_setter: template,\n\tpopupTemplate_setter: template,\n\tdefaults:{\n\t\tpopupWidth: 200,\n\t\tpopupTemplate: \"#value#\",\n\t\tyCount: 7,\n\t\tmoreTemplate: \"\",\n\t\ttemplate:function(obj,common) {\n\t\t\tvar contentWidth, html, i, leafWidth, resultHTML, style, sum, tabs, verticalOffset, width;\n\n\t\t\tcommon._tabs = tabs = common._filterOptions(obj.options);\n\n\t\t\tif (!tabs.length){\n\t\t\t\thtml = \"
\";\n\t\t\t} else {\n\t\t\t\tcommon._check_options(tabs);\n\t\t\t\tif (!obj.value && tabs.length)\n\t\t\t\t\tobj.value = tabs[0].id;\n\n\t\t\t\thtml = \"\";\n\t\t\t\tif (obj.tabOffset)\n\t\t\t\t\thtml += \"
 
\";\n\t\t\t\tcontentWidth = common._input_width - obj.tabOffset*2-(!obj.type?(obj.tabMargin)*(tabs.length-1):0);\n\t\t\t\tverticalOffset = obj.topOffset+obj.bottomOffset;\n\n\t\t\t\tvar sizes = common._getTabbarSizes();\n\n\t\t\t\tif(sizes.max && sizes.max < tabs.length){\n\t\t\t\t\t//we need popup\n\t\t\t\t\tvar popup = common.getPopup();\n\t\t\t\t\tpopup.hide();\n\n\t\t\t\t\tvar list = (popup.getBody()||null);\n\t\t\t\t\tif(list){\n\t\t\t\t\t\tif(sizes.max){\n\t\t\t\t\t\t\tvar found = false;\n\t\t\t\t\t\t\tfor( i = 0; i < tabs.length && !found; i++)\n\t\t\t\t\t\t\t\tif(tabs[i].id== obj.value){\n\t\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\t\tif((i+1) > sizes.max){\n\t\t\t\t\t\t\t\t\t\tvar selectedTab = tabs.splice(i, 1);\n\t\t\t\t\t\t\t\t\t\tvar displayTabs = tabs.splice(0, sizes.max-1).concat(selectedTab);\n\t\t\t\t\t\t\t\t\t\ttabs = displayTabs.concat(tabs);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlist.clearAll();\n\t\t\t\t\t\t\tlist.parse(tabs.slice(sizes.max));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tlist.clearAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (common._settings.tabbarPopup)\n\t\t\t\t\t$$(common._settings.tabbarPopup).hide();\n\n\t\t\t\tsum = obj.tabOffset;\n\t\t\t\tvar lastTab = false;\n\t\t\t\tfor(i = 0; (i1)?(obj.tabMargin)*(sizes.max-1):0);\n\t\t\t\t\t\twidth = (contentWidth - obj.tabMoreWidth)/sizes.max ;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\twidth = sizes.width;\n\n\t\t\t\t\twidth = (tabs[i].width||obj.optionWidth||width);\n\n\t\t\t\t\tsum += width + (i&&!obj.type?obj.tabMargin:0);\n\n\t\t\t\t\tif(obj.tabMargin>0&&i&&!obj.type)\n\t\t\t\t\t\thtml += \"
\";\n\n\t\t\t\t\t// tab innerHTML\n\t\t\t\t\thtml += common._getTabHTML(tabs[i],width);\n\n\n\t\t\t\t\tif(lastTab){\n\t\t\t\t\t\thtml += \"
\"+obj.moreTemplate(obj,common)+\"
\";\n\t\t\t\t\t\tsum += obj.tabMoreWidth;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tleafWidth = common._content_width - sum;\n\n\t\t\t\tif (leafWidth>0 && !obj.type)\n\t\t\t\t\thtml += \"
 
\";\n\t\t\t}\n\n\t\t\tresultHTML = \"\";\n\n\t\t\t// consider top and bottom offset in tabs height (top tabbar)\n\t\t\tstyle = (verticalOffset&& !obj.type)?\"height:\"+(common._content_height-verticalOffset)+\"px\":\"\";\n\n\t\t\t//space above tabs (top tabbar)\n\t\t\tif(obj.topOffset && !obj.type)\n\t\t\t\tresultHTML += \"
\";\n\n\t\t\t// tabs html\n\t\t\tresultHTML += \"
\"+html+\"
\";\n\n\t\t\t//space below to tabs (top tabbar)\n\t\t\tif(obj.bottomOffset && !obj.type)\n\t\t\t\tresultHTML += \"
\";\n\n\t\t\treturn resultHTML;\n\t\t}\n\t},\n\t_getInputNode:function(){\n\t\treturn this.$view.querySelectorAll(\".webix_item_tab\");\n\t},\n\t_getTabHTML: function(tab,width){\n\t\tvar\thtml,\n\t\t\tclassName = \"\",\n\t\t\tconfig = this.config;\n\n\t\tif(tab.id== config.value)\n\t\t\tclassName=\" webix_selected\";\n\n\t\tif (tab.css)\n\t\t\tclassName+=\" \"+tab.css;\n\n\t\twidth = (tab.width||width);\n\n\t\thtml =\"
\";\n\n\t\t// a tab title\n\t\tif(this._tabTemplate){\n\t\t\tvar calcHeight = this._content_height- config.inputPadding*2 - 2;\n\t\t\tvar height = this._content_height - 2;\n\t\t\tvar temp = extend({ cheight: calcHeight, aheight:height }, tab);\n\t\t\thtml+= this._tabTemplate(temp);\n\t\t}\n\t\telse {\n\t\t\tvar icon = tab.icon?(\" \"):\"\";\n\t\t\thtml+=icon + tab.value;\n\t\t}\n\n\t\tif (tab.close || config.close)\n\t\t\thtml+=\"\";\n\n\t\thtml+=\"
\";\n\t\treturn html;\n\t},\n\t_types:{\n\t\timage:\"
#value#
\",\n\t\ticon:\"
#value#
\",\n\t\ticonTop:\"
#value#
\"\n\t},\n\ttype_setter:function(value){\n\t\tthis._settings.tabOffset = 0;\n\t\tif (this._types[value])\n\t\t\tthis._tabTemplate = template(this._types[value]);\n\t\treturn value;\n\t}\n};\n\n\nconst view = protoUI(api, segmented.view);\nexport default {api, view};","import layout from \"../views/layout\";\nimport IdSpace from \"../core/idspace\";\nimport {protoUI} from \"../ui/core\";\nimport i18n from \"../webix/i18n\";\nimport {_event} from \"../webix/htmlevents\";\n\n\nconst api = {\n\tname: \"richtext\",\n\tdefaults:{\n\t\tlabel:\"\",\n\t\tlabelWidth:80,\n\t\tlabelPosition:\"left\"\n\t},\n\t$init: function() {\n\t\tthis._viewobj.className += \" webix_richtext\";\n\t\tthis.$ready.unshift(this._setLayout);\n\t},\n\tgetInputNode:function(){\n\t\treturn this.$view.querySelector(\".webix_richtext_editor\"); \n\t},\n\t_button:function(name){\n\t\treturn {\n\t\t\tview: \"toggle\",\n\t\t\ttype: \"iconButton\",\n\t\t\ticon: \"wxi-\"+name, name: name, id:name,\n\t\t\tlabel: i18n.richtext[name],\n\t\t\tautowidth: true, \n\t\t\taction:name,\n\t\t\tclick: this._add_data\n\t\t};\n\t},\n\t_setLayout: function() {\n\t\tvar top = this;\n\n\t\tvar editField = {\n\t\t\tview: \"template\",\n\t\t\tcss: \"webix_richtext_container\",\n\t\t\tborderless: true,\n\t\t\ttemplate: \"
\"+this.getValue()+\"
\",\n\t\t\ton: {\n\t\t\t\tonAfterRender: function() {\n\t\t\t\t\ttop._rendered_input = true;\n\t\t\t\t\t_event( \n\t\t\t\t\t\ttop.getInputNode(),\n\t\t\t\t\t\t\"blur\",\n\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\ttop._updateValue(this.innerHTML);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\t_event( \n\t\t\t\t\t\ttop.getInputNode(),\n\t\t\t\t\t\t\"keyup\",\n\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\ttop._getselection();\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonClick: {\n\t\t\t\twebix_richtext_editor: function() {\n\t\t\t\t\ttop._getselection();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar editorToolbar = {\n\t\t\tview: \"toolbar\",\n\t\t\tid:\"toolbar\",\n\t\t\telements: [\n\t\t\t\tthis._button(\"underline\"),\n\t\t\t\tthis._button(\"bold\"),\n\t\t\t\tthis._button(\"italic\"),\n\t\t\t\t{}\n\t\t\t]\n\t\t};\n\n\t\tvar rows = [\n\t\t\teditorToolbar,\n\t\t\teditField\n\t\t];\n\n\t\tif (this.config.labelPosition === \"top\" || !this.config.labelWidth){\n\t\t\teditorToolbar.elements.concat([\n\t\t\t\t{ view:\"label\", label: this.config.label, align:\"right\"},\n\t\t\t\t{ width:4 }\n\t\t\t]);\n\t\t\tthis.rows_setter(rows);\n\t\t} else {\n\t\t\tthis.config.borderless = true;\n\t\t\tthis.cols_setter([{ \n\t\t\t\ttemplate: (this.config.label || \" \"),\n\t\t\t\tcss: \"webix_richtext_inp_label\",\n\t\t\t\tborderless: true,\n\t\t\t\twidth: this.config.labelWidth\n\t\t\t}, {\n\t\t\t\trows:rows\n\t\t\t}]);\n\t\t}\n\t},\n\t_getselection: function() {\n\t\tvar top = this;\n\t\tvar bar = top.$$(\"toolbar\");\n\t\tvar sel;\n\n\t\tbar.setValues({\n\t\t\titalic:false, underline:false, bold:false\n\t\t});\n\n\t\tif(window.getSelection) {\n\t\t\tsel = window.getSelection();\n\t\t} else {\n\t\t\tsel = document.selection.createRange();\n\t\t}\n\n\t\tfor (var i = 0; i < sel.rangeCount; ++i) {\n\t\t\tif (top.$view.contains(this.getInputNode())){\n\t\t\t\tif (document.queryCommandState(\"bold\")) {\n\t\t\t\t\ttop.$$(\"bold\").setValue(true);\n\t\t\t\t} \n\t\t\t\tif (document.queryCommandState(\"underline\")) {\n\t\t\t\t\ttop.$$(\"underline\").setValue(true);\n\t\t\t\t}\n\t\t\t\tif (document.queryCommandState(\"italic\")) {\n\t\t\t\t\ttop.$$(\"italic\").setValue(true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\trefresh: function() {\n\t\tif(this._rendered_input)\n\t\t\tthis.getInputNode().innerHTML = this.config.value;\n\t},\n\t_execCommandOnElement:function(el, commandName) {\n\t\tvar sel, selText;\n\n\t\tif(window.getSelection()) {\n\t\t\tsel = window.getSelection();\n\t\t\tselText = sel.toString().length;\n\t\t} else {\n\t\t\tsel = document.selection.createRange();\n\t\t\tselText = sel.text.length;\n\t\t}\n\n\t\tif(selText > 0) {\n\t\t\tfor (var i = 0; i < sel.rangeCount; ++i) {\n\t\t\t\tvar range = sel.getRangeAt(i);\n\t\t\t\tif (!sel.isCollapsed) {\n\t\t\t\t\tdocument.execCommand(commandName, false, \"\");\n\t\t\t\t} else {\n\t\t\t\t\tvar textValue = sel.focusNode.textContent;\n\t\t\t\t\tvar focusEl = sel.focusNode;\n\t\t\t\t\tvar focustext = sel.anchorOffset;\n\t\t\t\t\tvar wordBegining = textValue.substring(0, focustext).match(/[A-Za-z]*$/)[0];\n\t\t\t\t\tvar wordEnd = textValue.substring(focustext).match(/^[A-Za-z]*/)[0];\n\n\t\t\t\t\tvar startWord = focustext - wordBegining.length;\n\t\t\t\t\tvar endWord = focustext + wordEnd.length;\n\n\t\t\t\t\trange.setStart(focusEl, startWord);\n\t\t\t\t\trange.setEnd(focusEl, endWord);\n\t\t\t\t\tsel.removeAllRanges();\n\n\t\t\t\t\twindow.getSelection().addRange(range);\n\t\t\t\t\tdocument.execCommand(commandName, false, \"\");\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t},\n\t_add_data:function() {\n\t\tvar top = this.getTopParentView();\n\t\tvar editableElement = top.getInputNode();\n\n\t\tif(this.$view.contains(this.getInputNode())){\n\t\t\ttop._execCommandOnElement(editableElement, this.config.action);\n\t\t}\n\t},\n\tfocus: function() {\n\t\tvar editableElement = this.$view.querySelector(\".webix_richtext_editor\");\n\t\teditableElement.focus();\n\t},\n\t_updateValue: function(value){\n\t\tvar old = this.config.value;\n\t\tthis.config.value = value || \"\";\n\n\t\tif (old !== value)\n\t\t\tthis.callEvent(\"onChange\", [value, old]);\n\t},\n\tsetValue: function(value) {\n\t\tthis._updateValue(value);\n\t\tthis.refresh();\n\t},\n\tgetValue: function() {\n\t\tvar input = this.getInputNode();\n\t\tif (input)\n\t\t\tthis.config.value = this.getInputNode().innerHTML;\n\n\t\tvar value = this.config.value;\n\t\treturn value || (value ===0?\"0\":\"\");\n\t}\n};\n\n\nconst view = protoUI(api, IdSpace, layout.view);\nexport default {api, view};","import base from \"../views/view\";\nimport PagingAbility from \"../core/pagingability\";\nimport DataMarks from \"../core/datamarks\";\nimport AutoTooltip from \"../core/autotooltip\";\nimport ValidateCollection from \"../core/validatecollection\";\nimport RenderStack from \"../core/renderstack\";\nimport DataLoader from \"../core/dataloader\";\nimport EventSystem from \"../core/eventsystem\";\nimport Settings from \"../core/settings\";\n\nimport {protoUI} from \"../ui/core\";\nimport {bind} from \"../webix/helpers\";\n\nconst api = {\n\tname:\"proto\",\n\t$init:function(){\n\t\tthis.data.provideApi(this, true);\n\t\tthis._dataobj = this._dataobj || this._contentobj;\n\t\t\n\t\t//render self , each time when data is updated\n\t\tthis.data.attachEvent(\"onStoreUpdated\",bind(function(){\n\t\t\tthis.render.apply(this,arguments);\n\t\t},this));\n\t},\n\t$setSize:function(){\n\t\tif (base.api.$setSize.apply(this, arguments))\n\t\t\tthis.render();\n\t},\n\t_id:\"webix_item\",\n\ton_mouse_move:{\n\t},\n\ttype:{}\n};\n\n\nconst view = protoUI(api, PagingAbility, DataMarks, AutoTooltip,ValidateCollection,RenderStack, DataLoader, base.view, EventSystem, Settings);\nexport default {api, view};","import {addCss, createCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {bind, extend} from \"../webix/helpers\";\nimport template from \"../webix/template\";\n\nimport env from \"../webix/env\";\n\nimport base from \"../views/view\";\nimport proto from \"../views/proto\";\nimport VRenderStack from \"../core/vrenderstack\";\nimport CustomPrint from \"../core/customprint\";\nimport KeysNavigation from \"../core/keysnavigation\";\nimport DataMove from \"../core/datamove\";\nimport DragItem from \"../core/dragitem\";\nimport MouseEvents from \"../core/mouseevents\";\nimport SelectionModel from \"../core/selectionmodel\";\nimport Scrollable from \"../core/scrollable\";\nimport CopyPaste from \"../core/copypaste\";\n\nconst api = {\n\tname:\"list\",\n\t_listClassName : \"webix_list\",\n\t_itemClassName:\"webix_list_item\",\n\t$init:function(config){\n\t\taddCss(this._viewobj, this._listClassName + (((config.layout||this.defaults.layout) == \"x\")?\"-x\":\"\") );\n\t\tthis.data.provideApi(this,true);\n\n\t\tthis._auto_resize = bind(this._auto_resize, this);\n\t\tthis.data.attachEvent(\"onStoreUpdated\", this._auto_resize);\n\t\tthis.data.attachEvent(\"onSyncApply\", this._auto_resize);\n\t\tthis.attachEvent(\"onAfterRender\", this._correct_width_scroll);\n\n\t\tthis._viewobj.setAttribute(\"role\", \"listbox\");\n\t},\n\tdynamic_setter:function(value){\n\t\tif (value)\n\t\t\textend(this, VRenderStack, true);\n\t\treturn value;\n\t},\n\t$dragHTML:function(obj){\n\t\tif (this._settings.layout == \"y\" && this.type.width == \"auto\"){\n\t\t\tthis.type.width = this._content_width;\n\t\t\tvar node = this._toHTML(obj);\n\t\t\tthis.type.width = \"auto\";\n\t\t\treturn node;\n\t\t}\n\t\treturn this._toHTML(obj);\n\t},\n\tdefaults:{\n\t\tselect:false,\n\t\tscroll:true,\n\t\tlayout:\"y\",\n\t\tnavigation:true,\n\t\tdatafetch:50\n\t},\n\t_id:\"webix_l_id\",\n\ton_click:{\n\t\twebix_list_item:function(e,id){\n\t\t\tif (this._settings.select){\n\t\t\t\tthis._no_animation = true;\n\t\t\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect)\n\t\t\t\t\tthis.select(id, false, (e.ctrlKey || e.metaKey || (this._settings.multiselect == \"touch\")), e.shiftKey); \t//multiselection\n\t\t\t\telse\n\t\t\t\t\tthis.select(id);\n\t\t\t\tthis._no_animation = false;\n\t\t\t}\n\t\t}\n\t},\n\ton_dblclick:{\n\t},\n\tgetVisibleCount:function(){\n\t\treturn Math.floor(this._content_height / this._one_height());\n\t},\n\t_auto_resize:function(){\n\t\tif (this._settings.autoheight || this._settings.autowidth)\n\t\t\tthis.resize();\n\t},\n\t_auto_height_calc:function(count){\n\t\tvar value = this.data.$pagesize||this.count();\n\n\t\tthis._onoff_scroll(count && count < value, \"y\");\n\t\tif (this._settings.autoheight && value < (count||Infinity) ) \n\t\t\tcount = value;\n\t\tvar height = this._one_height() * count + (this.type.margin||0);\n\t\t//unitlist\n\t\tif(this.getUnits)\n\t\t\theight += this.getUnits().length*this.type.headerHeight;\n\n\t\treturn Math.max(height,this._settings.minHeight||0);\n\t},\n\t_one_height:function(){\n\t\treturn this.type.height + (this.type.margin||0);\n\t},\n\t_auto_width_calc:function(count){\n\t\tvar value = this.data.$pagesize||this.count();\n\n\t\tthis._onoff_scroll(count && count < value, \"x\");\n\t\tif (this._settings.autowidth && value < (count||Infinity) ) \n\t\t\tcount = value;\n\n\t\treturn (this.type.width * count); \n\t},\n\t_correct_width_scroll:function(){\n\t\tif (this._settings.layout == \"x\")\n\t\t\tthis._dataobj.style.width = (this.type.width != \"auto\") ? (this.type.width * this.count() + \"px\") : \"auto\";\n\t},\n\t$getSize:function(dx,dy){\n\t\tif (this._settings.layout == \"y\"){\n\t\t\tif (this.type.width!=\"auto\")\n\t\t\t\tthis._settings.width = this.type.width + (this._scroll_y?env.scrollSize:0);\n\t\t\tif (this._settings.yCount || this._settings.autoheight)\n\t\t\t\tthis._settings.height = this._auto_height_calc(this._settings.yCount)||1;\n\t\t}\n\t\telse {\n\t\t\tif (this.type.height!=\"auto\")\n\t\t\t\tthis._settings.height = this._one_height() + (this._scroll_x?env.scrollSize:0);\n\t\t\tif (this._settings.xCount || this._settings.autowidth)\n\t\t\t\tthis._settings.width = this._auto_width_calc(this._settings.xCount)||1;\n\t\t}\n\t\treturn base.api.$getSize.call(this, dx, dy);\n\t},\n\t$setSize:function(){\n\t\tbase.api.$setSize.apply(this, arguments);\n\t},\n\ttype:{\n\t\tcss:\"\",\n\t\twidthSize:function(obj, common){\n\t\t\treturn common.width+(common.width>-1?\"px\":\"\");\n\t\t},\n\t\theightSize:function(obj, common){\n\t\t\treturn common.height+(common.height>-1?\"px\":\"\");\n\t\t},\n\t\tclassname:function(obj, common, marks){\n\t\t\tvar css = \"webix_list_item\";\n\t\t\tif (obj.$css){\n\t\t\t\tif (typeof obj.$css == \"object\")\n\t\t\t\t\tobj.$css = createCss(obj.$css);\n\t\t\t\tcss += \" \"+obj.$css;\n\t\t\t}\n\t\t\tif (marks && marks.$css)\n\t\t\t\tcss += \" \"+marks.$css;\n\n\t\t\treturn css;\n\t\t},\n\t\taria:function(obj, common, marks){\n\t\t\treturn \"role=\\\"option\\\"\"+(marks && marks.webix_selected?\" aria-selected=\\\"true\\\" tabindex=\\\"0\\\"\":\" tabindex=\\\"-1\\\"\")+(obj.$count && obj.$template?\"aria-expanded=\\\"true\\\"\":\"\");\n\t\t},\n\t\ttemplate:function(obj){\n\t\t\treturn (obj.icon?(\"\"):\"\") + obj.value + (obj.badge?(\"
\"+obj.badge+\"
\"):\"\");\n\t\t},\n\t\twidth:\"auto\",\n\t\ttemplateStart:template(\"
\"),\n\t\ttemplateEnd:template(\"
\")\n\t},\n\t$skin:function(){\n\t\tthis.type.height = $active.listItemHeight;\n\t}\n};\n\n\nconst view = protoUI(api, CustomPrint, KeysNavigation, DataMove, DragItem, MouseEvents, SelectionModel, Scrollable, proto.view, CopyPaste);\nexport default {api, view};","import {createCss, preventEvent, addCss, removeCss} from \"../webix/html\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {isUndefined, extend, delay, uid, toNode, bind} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\n\nimport base from \"../views/view\";\nimport button from \"../views/button\";\nimport list from \"../views/list\";\nimport i18n from \"../webix/i18n\";\nimport type from \"../webix/type\";\n\nimport UploadDriver from \"../core/uploaddriver\";\nimport DataCollection from \"../core/datacollection\";\n\n\n/*\n\tUI:Uploader\n*/\n\n// #include ui/view.js\n// #include ui/list.js\n\n\ntype(list.view, {\n\tname:\"uploader\",\n\ttemplate:\"{common.removeIcon()}{common.percent()}
#sizetext#
{common.fileName()}\",\n\tpercent:function(obj){\n\t\tif (obj.status == \"transfer\")\n\t\t\treturn \"
\"+obj.percent+\"%
\";\n\t\treturn \"
\";\n\t},\n\tremoveIcon:function(){\n\t\treturn \"
\";\n\t},\n\tfileName:function(obj){\n\t\treturn \"
\"+obj.name+\"
\";\n\t},\n\ton_click:{\n\t\t\"webix_remove_upload\":function(ev, id){\n\t\t\t$$(this.config.uploader).files.remove(id);\n\t\t}\n\t}\n});\n\nconst api = {\n\tname:\"uploader\",\n\tdefaults:{\n\t\tautosend:true,\n\t\tmultiple:true,\n\t\tinputName:\"upload\"\n\t},\n\t$cssName:\"button webix_uploader\",\n\t$allowsClear:true,\n\ton_click:{\n\t\t//don't fire extra onItemClick events, visible button will do it\n\t\t\"webix_hidden_upload\":function(){ return false; }\n\t},\n\t//will be redefined by upload driver\n\tsend:function(){},\n\tfileDialog:function(){},\n\tstopUpload:function(){},\n\n\t$init:function(){\n\t\tvar driver = UploadDriver.html5;\n\t\tthis.files = new DataCollection();\n\t\tthis._destroy_with_me = [this.files];\n\n\t\t// browser doesn't support XMLHttpRequest2\n\t\tif (isUndefined(XMLHttpRequest) || isUndefined((new XMLHttpRequest()).upload))\n\t\t\tdriver = UploadDriver.flash;\n\n\t\tassert(driver,\"incorrect driver\");\n\t\textend(this, driver, true);\n\t},\n\t$setSize:function(x,y){\n\t\tif (base.api.$setSize.call(this,x,y)){\n\t\t\tthis.render();\n\t\t}\n\t},\n\tapiOnly_setter:function(value){\n\t\tdelay(this.render, this);\n\t\treturn (this.$apiOnly=value);\n\t},\n\t_add_files: function(files){\n\t\tfor (var i = 0; i < files.length; i++)\n\t\t\tthis.addFile(files[i]);\n\n\t},\n\tlink_setter:function(value){\n\t\tif (value)\n\t\t\tdelay(function(){\n\t\t\t\tvar view = $$(this._settings.link);\n\t\t\t\tif (!view){\n\t\t\t\t\tvar top = this.getTopParentView();\n\t\t\t\t\tif (top.$$)\n\t\t\t\t\t\tview = top.$$(this._settings.link);\n\t\t\t\t}\n\n\t\t\t\tif (view.sync && view.filter)\n\t\t\t\t\tview.sync(this.files);\n\t\t\t\telse if (view.setValues)\n\t\t\t\t\tthis.files.data.attachEvent(\"onStoreUpdated\", function(){\n\t\t\t\t\t\tview.setValues(this);\n\t\t\t\t\t});\n\t\t\t\tview._settings.uploader = this._settings.id;\n\t\t\t}, this);\n\t\treturn value;\n\t},\n\taddFile:function(name, size, type, extra){\n\t\tvar file = null;\n\t\tif (typeof name == \"object\"){\n\t\t\tfile = name;\n\t\t\tname = file.name;\n\t\t\tsize = file.size;\n\t\t}\n\n\t\tvar format = this._format_size(size);\n\t\ttype = type || name.split(\".\").pop();\n\n\t\tvar file_struct = {\n\t\t\tfile: file,\n\t\t\tname: name,\n\t\t\tid: uid(),\n\t\t\tsize: size,\n\t\t\tsizetext: format,\n\t\t\ttype: type,\n\t\t\tcontext: this._last_file_context,\n\t\t\tstatus: \"client\"\n\t\t};\n\n\t\tif (file && file.webkitRelativePath)\n\t\t\tfile_struct.name = file.webkitRelativePath;\n\n\t\tif (extra)\n\t\t\textend(file_struct, extra, true);\n\n\t\tif (this.callEvent(\"onBeforeFileAdd\", [file_struct])){\n\t\t\tif (!this._settings.multiple)\n\t\t\t\tthis.files.clearAll();\n\n\t\t\tvar id = this.files.add(file_struct);\n\t\t\tthis.callEvent(\"onAfterFileAdd\", [file_struct]);\n\t\t\tif (id && this._settings.autosend)\n\t\t\t\tthis.send(id);\n\t\t}\n\t\t\n\t\treturn file_struct;\n\t},\n\t\n\t_get_active_url:function(item){\n\t\tvar url = this._settings.upload;\n\t\tvar urldata = extend(item.urlData||{},this._settings.urlData||{});\n\t\tif (url && urldata){\n\t\t\tvar subline = [];\n\t\t\tfor (var key in urldata)\n\t\t\t\tsubline.push(encodeURIComponent(key)+\"=\"+encodeURIComponent(urldata[key]));\n\n\t\t\tif (subline.length)\n\t\t\t\turl += ((url.indexOf(\"?\") ==-1) ? \"?\" : \"&\") + subline.join(\"&\");\n\t\t}\n\t\treturn url;\n\t},\n\n\taddDropZone:function(id, hover_text){\n\t\tvar node = toNode(id);\n\t\tvar extra_css = \"\";\n\t\tif (hover_text)\n\t\t\textra_css = \" \"+createCss({ content:\"\\\"\"+hover_text+\"\\\"\" }, \":before\");\n\n\t\tvar fullcss = \"webix_drop_file\"+extra_css;\n\t\tvar timer = null;\n\n\t\t//web\n\t\t_event(node,\"dragover\", preventEvent);\n\t\t_event(node,\"dragover\", function(){\n\t\t\taddCss(node, fullcss, true);\n\t\t\tif (timer){\n\t\t\t\tclearTimeout(timer);\n\t\t\t\ttimer = null;\n\t\t\t}\n\t\t});\n\t\t_event(node,\"dragleave\", function(){\n\t\t\t//when moving over html child elements\n\t\t\t//browser will issue dragleave and dragover events\n\t\t\t//ignore first one\n\t\t\ttimer = setTimeout(function(){\n\t\t\t\tremoveCss(node, fullcss);\n\t\t\t}, 150);\n\t\t});\n\n\t\t_event(node,\"drop\", bind(function(e){\n\t\t\tremoveCss(node, fullcss);\n\t\t\tthis._drop(e);\n\t\t\treturn preventEvent(e);\n\t\t}, this));\n\t},\n\t\n\t_format_size: function(size) {\n\t\tvar index = 0;\n\t\twhile (size > 1024){\n\t\t\tindex++;\n\t\t\tsize = size/1024;\n\t\t}\n\t\treturn Math.round(size*100)/100+\" \"+i18n.fileSize[index];\n\t},\n\n\t_complete: function(id, response) {\n\t\tvar item = this.files.getItem(id);\n\n\t\textend(item, response, true);\n\t\titem.status = \"server\";\n\t\titem.progress = 100;\n\n\t\tthis.callEvent(\"onFileUpload\", [item, response]);\n\t\tthis.callEvent(\"onChange\", []);\n\t\tthis.files.updateItem(id);\n\t\t\n\t\tif (this.isUploaded())\n\t\t\tthis._upload_complete(response);\n\t},\n\t_upload_complete:function(response){\n\t\tthis.callEvent(\"onUploadComplete\", [response]);\n\t\tif (this._last_assigned_upload_callback){\n\t\t\tthis._last_assigned_upload_callback.call(this, response);\n\t\t\tthis._last_assigned_upload_callback = 0;\n\t\t}\n\t},\n\tisUploaded:function(){\n\t\tvar order = this.files.data.order;\n\t\tfor (var i=0; i]*>/g,\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnode = node || this._last_input_target;\n\t\tif(node)\n\t\t\tnode.focus();\n\t},\n\tsetMasterValue:function(data, refresh){\n\t\tvar text = data.id ? this.getItemText(data.id) : (data.text||data.value);\n\n\t\tif (this._settings.master){\n\t\t\tvar master = $$(this._settings.master);\n\t\t\tif (refresh && data.id)\n\t\t\t\tmaster.refresh();\n\t\t\telse if (master.options_setter)\n\t\t\t\tmaster.setValue(data.$empty?\"\":data.id);\n\t\t\telse if(master.setValueHere)\n\t\t\t\tmaster.setValueHere(text);\n\t\t\telse\n\t\t\t\tmaster.setValue(text);\n\t\t} else if (this._last_input_target){\n\t\t\tthis._last_input_target.value = text;\n\t\t}\n\n\t\tif (!refresh){\n\t\t\tthis.hide(true);\n\t\t\tif (this._last_input_target)\n\t\t\t\tthis._last_input_target.focus();\n\t\t}\n\t\tthis.callEvent(\"onValueSuggest\", [data, text]);\n\t\tdelay(function(){\n\t\t\tcallEvent(\"onEditEnd\",[]);\n\t\t});\n\t},\n\tgetMasterValue:function(){\n\t\tif (this._settings.master)\n\t\t\treturn $$(this._settings.master).getValue();\n\t\treturn null;\n\t},\n\tgetItemId:function(text){\n\t\tvar list = this.getList();\n\t\tfor (var key in list.data.pull){\n\t\t\tvar obj = list.getItem(key);\n\t\t\tif (this._settings.filter.call(this, obj, text))\n\t\t\t\treturn obj.id;\n\t\t}\n\t},\n\tgetItemText:function(id){\n\t\tvar item = this.getList().getItem(id);\n\n\t\tif (!item)\n\t\t\treturn this._old_text[id] || \"\";\n\n\t\tif (this._settings.template)\n\t\t\treturn this._settings.template.call(this, item, this.type);\n\n\t\tif (this._settings.textValue)\n\t\t\treturn \"\"+item[this._settings.textValue]+\"\";\n\t\t\n\t\tvar type = this.getList().type;\n\t\tvar text = type.template.call(type, item, type);\n\n\t\treturn (this._old_text[id] = text);\n\t},\n\tgetSuggestion:function(text){\n\t\tvar id,\n\t\t\tlist = this.getList(),\n\t\t\torder = list.data.order;\n\n\t\tif (list.getSelectedId)\n\t\t\tid = list.getSelectedId();\n\n\t\tif (text && order.length && (!id || order.find(id) <0) ){\n\t\t\tid = order[0];\n\t\t\t//ensure that option really does match client-side filtering rules\n\t\t\tif (!list.config.dataFeed && !this.config.filter.call(this, list.data.pull[id], text)) return null;\n\t\t}\n\n\t\t//complex id in datatable\n\t\tif (id && typeof id == \"object\") id = id+\"\";\n\t\treturn id;\n\t},\n\tgetList:function(){\n\t\treturn this._body_cell;\n\t},\n\t_set_on_popup_click:function(){\n\t\tvar list = this.getList();\n\t\tvar type = this._settings.type;\n\n\t\tif (list.count){\n\t\t\tlist.attachEvent(\"onItemClick\", bind(function(item){\n\t\t\t\tthis.setMasterValue(list.getItem(item));\n\t\t\t}, this));\n\t\t\tlist.data.attachEvent(\"onstoreupdated\",bind(function(id, obj, mode){\n\t\t\t\tif (mode == \"delete\" && id == this.getMasterValue())\n\t\t\t\t\tthis.setMasterValue({ id:\"\", text:\"\" }, 1);\n\t\t\t\telse if (mode == \"update\" && id == this.getMasterValue()){\n\t\t\t\t\tthis.setMasterValue(obj, 1);\n\t\t\t\t}\n\t\t\t}, this));\n\t\t\tlist.data.attachEvent(\"onAfterFilter\", bind(this._suggest_after_filter, this));\n\t\t\tlist.data.attachEvent(\"onStoreLoad\", bind(this._suggest_after_filter, this));\n\t\t\tif (isUndefined(this._settings.fitMaster))\n\t\t\t\tthis._settings.fitMaster = true;\n\t\t} else if (type == \"calendar\"){\n\t\t\tlist.attachEvent(\"onDateSelect\", function(){\n\t\t\t\tthis.getParentView().setMasterValue({ value:list.getSelectedDate() }, list.config.multiselect);\n\t\t\t});\n\t\t\tlist.attachEvent(\"onTodaySet\", function(date){\n\t\t\t\tthis.getParentView().setMasterValue({ value:date});\n\t\t\t});\n\t\t\tlist.attachEvent(\"onDateClear\", function(date){\n\t\t\t\tthis.getParentView().setMasterValue({ value:date});\n\t\t\t});\n\t\t} else if (type == \"colorboard\"){\n\t\t\tlist.attachEvent(\"onItemClick\", function(value){\n\t\t\t\tthis.getParentView().setMasterValue({ value:value });\n\t\t\t});\n\t\t}\n\t},\n\tinput_setter: function(value) {\n\t\tthis.linkInput(value);\n\t\treturn 0;\n\t},\n\tlinkInput: function(input){\n\t\tvar node;\n\t\tif (input.getInputNode){\n\t\t\tnode = input.getInputNode();\n\t\t\tnode.webix_master_id = input._settings.id;\n\t\t} else\n\t\t\tnode = toNode(input);\n\n\t\t_event(node,\"keydown\",function(e){\n\t\t\tif ((node != document.body || this.isVisible()) && (input.config ? (!input.config.readonly) : (!node.getAttribute(\"readonly\"))))\n\t\t\t\tthis._suggestions(e);\n\t\t},{bind:this});\n\t\t\n\t\tif(input._getInputDiv)\n\t\t\tnode = input._getInputDiv();\n\t\t\n\t\tnode.setAttribute(\"aria-autocomplete\", \"list\");\n\t\tnode.setAttribute(\"aria-expanded\", \"false\");\n\n\t\tif(node.tagName === \"DIV\"){\n\t\t\tnode.setAttribute(\"aria-live\", \"assertive\");\n\t\t\tnode.setAttribute(\"aria-atomic\", \"true\");\n\t\t}\n\n\t\tthis._non_ui_mode = true;\n\t},\n\t_suggestions: function(e){\n\t\te = (e||event);\n\t\tvar list = this.getList();\n\t\tvar trg = e.target||e.srcElement;\n\t\tif((trg == document.body && !this.isVisible()) || trg.className ==\"webix_clipbuffer\")\n\t\t\treturn;\n\n\t\tthis._last_input_target = trg;\n\t\tthis._settings.master = trg.webix_master_id;\n\n\t\twindow.clearTimeout(this._key_timer);\n\n\t\tvar code = e.keyCode;\n\t\t//shift and ctrl\n\t\tif (code == 16 || code == 17) return;\n\n\t\t// tab - hide popup and do nothing\n\t\tif (code == 9)\n\t\t\treturn this._tab_key(this,list);\n\n\t\t// escape - hide popup\n\t\tif (code == 27)\n\t\t\treturn this._escape_key(this,list);\n\n\t\t// enter\n\t\tif (code == 13)\n\t\t\treturn this.$enterKey(this,list);\n\n\t\t// up/down/right/left are used for navigation\n\t\tif (this._navigate(e)) {\n\t\t\tpreventEvent(e);\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isUndefined(trg.value)) return;\n\n\t\tclearTimeout(this._last_delay);\n\t\tthis._last_delay = delay(function(){\n\t\t\t//focus moved to the different control, suggest is not necessary\n\t\t\tif (!this._non_ui_mode && \n\t\t\t\t\tUIManager.getFocus() != $$(this._settings.master)) return;\n\n\t\t\tthis._resolve_popup = true;\n\t\t\t//for multicombo\n\t\t\tvar val = trg.value;\n\n\t\t\t// used to prevent showing popup when it was initialized\n\t\t\tif (list.config.dataFeed)\n\t\t\t\tlist.filter(\"value\", val);\n\t\t\telse if (list.filter){\n\t\t\t\tlist.filter(bind(function(item){\n\t\t\t\t\treturn this._settings.filter.call(this,item,val);\n\t\t\t\t}, this));\n\t\t\t}\n\t\t},this, [], this._settings.keyPressTimeout);\n\t},\n\t_suggest_after_filter: function() {\n\t\tif (!this._resolve_popup) return true;\n\t\tthis._resolve_popup = false;\n\n\t\tvar list = this.getList();\n\t\t\n\t\t// filtering is complete\n\t\t// if there are as min 1 variant it must be shown, hidden otherwise\n\t\tif (list.count() >0){\n\t\t\tthis.adjust();\n\t\t\tif(!this.isVisible())\n\t\t\t\tthis._dont_unfilter = true;\n\t\t\tthis.show(this._last_input_target,null,true);\n\t\t\tthis._dont_unfilter = false;\n\t\t} else {\n\t\t\tthis.hide(true);\n\t\t\tthis._last_input_target = null;\n\t\t}\n\t},\n\n\tshow:function(node){\n\t\tif (!this.isVisible()){\n\t\t\tvar list = this.getList();\n\t\t\tif (list.filter && !this._dont_unfilter){\n\t\t\t\tlist.filter(\"\");\n\t\t\t}\n\n\t\t\tif(this.$customWidth&&((this._settings.fitMaster||!this._settings.width)||isUndefined(this._settings.fitMaster))){\n\t\t\t\tthis.$customWidth(node);\n\t\t\t}\n\t\t\tif (node.tagName && this._settings.fitMaster){\n\t\t\t\tthis._settings.width = node.offsetWidth -2 ; //2 - borders\n\t\t\t}\n\t\t\tif (list._zoom_level)\n\t\t\t\tlist.render();\n\n\t\t\tthis.adjust();\n\n\t\t\t// needed to return focus\n\t\t\tif(node.tagName == \"INPUT\")\n\t\t\t\tthis._last_input_target = node;\n\t\t}\n\t\tpopup.api.show.apply(this, arguments);\n\t},\n\t_show_selection:function(list){\n\t\tlist = list||this.getList();\n\t\tvar value = this.getMasterValue();\n\n\t\tif( list.select && list.showItem ){\n\n\t\t\tif (value && list.exists && list.exists(value)){\n\t\t\t\tlist.select(value);\n\t\t\t\tlist.showItem(value);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlist.unselect();\n\t\t\t\tlist.showItem(list.getFirstId());\n\t\t\t}\n\t\t}\n\t\telse if(list.setValue){\n\t\t\tif (this._settings.master)\n\t\t\t\tvalue = $$(this._settings.master).$prepareValue(value);\n\t\t\tlist.setValue(value);\n\t\t}\n\t},\n\t$enterKey: function(popup,list) {\n\t\tvar value;\n\n\t\tif (popup.isVisible()) {\n\t\t\tif (list.count && list.count()){\n\t\t\t\tvalue = list.getSelectedId(false, true);\n\t\t\t\tif(list.count()==1 && list.getFirstId()!=value)\n\t\t\t\t\tvalue = list.getFirstId();\n\t\t\t\tif(value)\n\t\t\t\t\tvalue = list.getItem(value);\n\t\t\t}\n\t\t\telse if(list.getSelectedDate && list.getSelectedDate())\n\t\t\t\tvalue = { value:list.getSelectedDate() };\n\t\t\telse if(list.getValue && list.getValue())\n\t\t\t\tvalue = {value: list.getValue() };\n\t\t\t\n\t\t\tif (value)\n\t\t\t\tthis.setMasterValue(value);\n\t\t\t\n\t\t\tpopup.hide(true);\n\t\t}\n\t\telse\n\t\t\tpopup.show(this._last_input_target);\n\t},\n\t_escape_key: function(popup) {\n\t\treturn popup.hide(true);\n\t},\n\t_tab_key: function(popup) {\n\t\treturn popup.hide(true);\n\t},\n\t/*! suggestions navigation: up/down buttons move selection\n\t *\t@param e\n\t *\t\tevent object\n\t **/\n\t_navigate: function(e) {\n\t\tvar list = this.getList();\n\t\tvar code = e.keyCode;\n\t\tvar data;\n\n\t\tif( list.moveSelection && code < 41 && code > 32 && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey) {\n\t\t\t// down arrow\n\t\t\tif (code === 40 ) {\n\t\t\t\tvar visible = this.isVisible();\n\t\t\t\tif (!visible)\n\t\t\t\t\tthis.show(this._last_input_target);\n\t\t\t\t\n\t\t\t\tlist.moveSelection(\"down\", false, false);\n\t\t\t}// other arrows\n\t\t\telse {\n\t\t\t\tif((list.count && code !==38) || (!list.count && !list.isVisible()))\n\t\t\t\t\treturn false;\n\n\t\t\t\tvar dir;\n\t\t\t\tif(code == 33) dir = \"pgup\";\n\t\t\t\tif(code == 34) dir = \"pgdown\";\n\t\t\t\tif(code == 35) dir = \"bottom\";\n\t\t\t\tif(code == 36) dir = \"top\";\n\t\t\t\tif(code == 37) dir = \"left\";\n\t\t\t\tif(code == 38) dir = \"up\";\n\t\t\t\tif(code == 39) dir = \"right\";\n\n\t\t\t\tlist.moveSelection(dir, false, false);\n\t\t\t}\n\n\t\t\tif(list.count)\n\t\t\t\tdata = list.getSelectedItem();\n\t\t\telse if(list.getSelectedDate)\n\t\t\t\tdata = { value:list.getVisibleDate()};\n\t\t\telse if(list.getValue)\n\t\t\t\tdata = { value:list.getValue() };\n\t\t\t\n\t\t\tthis._preselectMasterOption(data);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetValue:function(){\n\t\tvar list = this.getList();\n\t\tvar value = (list.getValue ? list.getValue() : list.getSelectedId()) || \"\";\n\t\tvalue = value.id || value;\n\n\t\t// check empty\n\t\tif(list.getItem){\n\t\t\tvar item = list.getItem(value);\n\t\t\tif(item && item.$empty)\n\t\t\t\treturn \"\";\n\t\t}\n\t\treturn value;\n\t},\n\tsetValue:function(value){\n\t\tvar list = this.getList();\n\t\tif(value){\n\t\t\tif(list.exists(value)){\n\t\t\t\tlist.select(value);\n\t\t\t\tlist.showItem(value);\n\t\t\t}\n\t\t}else{\n\t\t\tlist.unselect();\n\t\t\tlist.showItem(list.getFirstId());\n\t\t}\n\t}\n};\n\n\nconst view = protoUI(api, popup.view);\nexport default {api, view};","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"multisuggest\", defaults:{\n\ttemplate:\"GPL version doesn't support multisuggest
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"checksuggest\", defaults:{\n\ttemplate:\"GPL version doesn't support checksuggest
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"datasuggest\", defaults:{\n\ttemplate:\"GPL version doesn't support datasuggest
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"gridsuggest\", defaults:{\n\ttemplate:\"GPL version doesn't support gridsuggest
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"daterange\", defaults:{\n\ttemplate:\"GPL version doesn't support daterange
You need Webix PRO\"\n}}, template.view);","import suggest from \"../views/suggest\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {copy, bind} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"daterangesuggest\",\n\tdefaults:{\n\t\ttype:\"daterange\",\n\t\tbody: {\n\t\t\tview:\"daterange\", icons:true, button:true, borderless:true\n\t\t}\n\t},\n\tgetValue:function(){\n\t\treturn this.getRange().getValue();\n\t},\n\tsetValue:function(value){\n\t\tthis.getRange().setValue(copy(value));\n\t},\n\tgetRange:function(){\n\t\treturn this.getBody();\n\t},\n\tgetButton:function(){\n\t\treturn this.getBody().getChildViews()[1].getChildViews()[1];\n\t},\n\t_setValue:function(value, hide){\n\t\tvar master = $$(this._settings.master);\n\n\t\tif(master){\n\t\t\tmaster.setValue(value);\n\t\t\tif(hide) this.hide();\n\t\t}\n\t\telse\n\t\t\tthis.setValue(value);\n\t},\n\t_set_on_popup_click:function(){\n\t\tvar range = this.getRange();\n\t\trange.attachEvent(\"onAfterDateSelect\", bind(function(value) {this._setValue(value);}, this));\n\t\trange.attachEvent(\"onDateClear\", bind(function(value) {this._setValue(value);}, this));\n\t\trange.attachEvent(\"onTodaySet\", bind(function(value) {this._setValue(value);}, this));\n\t}\n};\n\n\nconst view = protoUI(api, suggest.view);\nexport default {api, view};","import datepicker from \"../views/datepicker\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {copy} from \"../webix/helpers\";\nimport i18n from \"../webix/i18n\";\n\n\nconst api = {\n\t$cssName:\"datepicker\",\n\tname:\"daterangepicker\",\n\t$init:function(config){\n\t\t//set non-empty initial value\n\t\tthis._settings.value = {};\n\t\t// other types are not implemented\n\t\tdelete config.type;\n\t},\n\t_init_popup:function(){\n\t\tvar obj = this._settings;\n\t\tif (obj.suggest)\n\t\t\tobj.popup = obj.suggest;\n\t\telse if (!obj.popup){\n\t\t\tobj.popup = obj.suggest = this.suggest_setter({\n\t\t\t\tview:\"daterangesuggest\", body:{\n\t\t\t\t\ttimepicker:obj.timepicker, calendarCount:obj.calendarCount, height:250+(obj.button || obj.icons?30:0)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tthis._init_once = function(){};\n\t},\n\t$prepareValue:function(value){\n\t\tvalue = value || {};\n\t\tvalue.start = datepicker.api.$prepareValue.call(this, value.start?value.start:null);\n\t\tvalue.end = datepicker.api.$prepareValue.call(this, value.end?value.end:null);\n\n\t\tvar daterange = $$(this._settings.popup).getRange();\n\t\treturn copy(daterange._correct_value(value));\n\t},\n\t$compareValue:function(oldvalue, value){\n\t\tvar compare = datepicker.api.$compareValue;\n\t\tvar start = compare.call(this, oldvalue.start, value.start);\n\t\tvar end = compare.call(this, oldvalue.end, value.end);\n\n\t\treturn (start && end);\n\t},\n\t$setValue:function(value){\n\t\tvalue = value || {};\n\n\t\tthis._settings.text = (value.start?this._get_visible_text(value.start):\"\")+(value.end?(\" - \"+ this._get_visible_text(value.end)):\"\");\n\t\tthis._set_visible_text();\n\t},\n\t$render:function(obj){\n\t\tobj.value = this.$prepareValue(obj.value);\n\t\tthis.$setValue(obj.value);\n\t},\n\tgetValue:function(){\n\n\t\tvar value = this._settings.value;\n\n\t\tif(this._settings.stringResult){\n\t\t\tvar formatStr =i18n.parseFormatStr;\n\t\t\treturn this._formatValue(formatStr, value);\n\t\t}\n\t\t\n\t\treturn value||null;\n\t},\n\t_formatValue:function(format, value){\n\t\tif(value.start) value.start = format(value.start);\n\t\tif(value.end) value.end = format(value.end);\n\t\treturn value;\n\t}\n};\n\n\nconst view = protoUI(api, datepicker.view);\nexport default {api, view};","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"excelbar\", defaults:{\n\ttemplate:\"GPL version doesn't support excelbar
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"excelviewer\", defaults:{\n\ttemplate:\"GPL version doesn't support excelviewer
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"pdfbar\", defaults:{\n\ttemplate:\"GPL version doesn't support pdfbar
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"pdfviewer\", defaults:{\n\ttemplate:\"GPL version doesn't support pdfviewer
You need Webix PRO\"\n}}, template.view);","import base from \"../views/view\";\nimport {create} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {uid} from \"../webix/helpers\";\n\n\n/*\n\tUI:Video\n*/\n// #include ui/view.js\nconst api = {\n\tname:\"video\",\n\t$init:function(config){\n\t\tif (!config.id) config.id = uid();\n\t\tthis.$ready.push(this._init_video);\n\t},\n\t_init_video:function(){\n\t\tvar c = this._settings;\n\t\tthis._contentobj = create(\"video\",{\n\t\t\t\"class\":\"webix_view_video\",\n\t\t\t\"style\":\"width:100%;height:100%;\",\n\t\t\t\"autobuffer\":\"autobuffer\"\n\t\t},\"\");\n\t\tif(c.poster)\n\t\t\tthis._contentobj.poster=c.poster;\n\n\t\tif(c.src){\n\t\t\tif(typeof c.src!= \"object\")\n\t\t\t\tc.src = [c.src];\n\t\t\tfor(var i = 0; i < c.src.length;i++)\n\t\t\t\tthis._contentobj.innerHTML += \" \";\n\t\t}\n\t\n\t\tif(c.controls)\n\t\t\tthis._contentobj.controls=true;\n\t\tif(c.autoplay)\n\t\t\tthis._contentobj.autoplay=true;\n\t\tthis._viewobj.appendChild(this._contentobj);\n\t},\n\tgetVideo:function(){\n\t\treturn this._contentobj;\n\t},\n\tdefaults:{\n\t\tsrc:\"\",\n\t\tcontrols: true\n\t}\n};\n\n\nconst view = protoUI(api, base.view);\nexport default {api, view};","import base from \"../views/view\";\nimport DataLoader from \"../core/dataloader\";\nimport EventSystem from \"../core/eventsystem\";\nimport {protoUI} from \"../ui/core\";\nimport template from \"../webix/template\";\nimport promise from \"../thirdparty/promiz\";\nimport {extend, bind, isUndefined} from \"../webix/helpers\";\n\n\nvar google, script;\nconst api = {\n\tname:\"geochart\",\n\tdefaults:{\n\t\tchart:{\n\t\t\tdisplayMode:\"auto\",\n\t\t\tregion:\"world\",\n\t\t\tresolution:\"countries\"\n\t\t}\n\t},\n\t$init:function(config){\n\t\tthis.$view.innerHTML = \"
\";\n\t\tthis._contentobj = this.$view.firstChild;\n\t\tthis._waitMap = promise.defer();\n\n\t\tconfig.chart = extend(config.chart||{}, this.defaults.chart);\n\n\t\tthis.data.provideApi(this, true);\n\t\tthis.$ready.push(this.render);\n\n\t\tthis.data.attachEvent(\"onClearAll\", bind(this._refreshColumns, this)); \n\t\tthis.data.attachEvent(\"onStoreUpdated\", bind(this._drawData, this));\n\t},\n\tgetMap:function(waitMap){\n\t\treturn waitMap?this._waitMap:this._map;\n\t},\n\t_getCallBack:function(prev){\n\t\treturn bind(function(){\n\t\t\tif (typeof prev === \"function\") prev();\n\n\t\t\tgoogle = google || window.google;\n\t\t\tthis._initMap();\n\t\t}, this);\n\t},\n\trender:function(){\n\t\tif(typeof window.google==\"undefined\"||typeof window.google.charts==\"undefined\"){\n\t\t\tif(!script){\n\t\t\t\tscript = document.createElement(\"script\");\n\t\t\t\tscript.type = \"text/javascript\";\n\n\t\t\t\tscript.src = \"//www.gstatic.com/charts/loader.js\";\n\t\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(script);\n\t\t\t}\n\t\t\tscript.onload = this._getCallBack(script.onload);\n\t\t}\n\t\telse //there's a custom link to google api in document head\n\t\t\t(this._getCallBack())();\n\t},\n\t_initMap:function(){\n\t\tif(!google.visualization || !google.visualization.GeoChart){\n\t\t\tgoogle.charts.load(\"current\", {\n\t\t\t\t\"packages\":[\"geochart\"],\n\t\t\t\t\"mapsApiKey\": this._settings.key\n\t\t\t});\n\t\t\tgoogle.charts.setOnLoadCallback(bind(function(){\n\t\t\t\tthis._initMap();\n\t\t\t}, this));\n\t\t}\n\t\telse{\n\t\t\tthis._map = new google.visualization.GeoChart(this._contentobj);\n\t\t\tthis._mapEvents();\n\t\t\t\n\t\t\tthis._waitMap.resolve(this._map);\n\t\t}\n\t},\n\t$onLoad:function(obj){\n\t\tif(!this._map){\n\t\t\tthis._waitMap.then(bind(function(){\n\t\t\t\tthis.parse(obj, this._settings.datatype);\n\t\t\t}, this));\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t},\n\t_drawData:function(){\n\t\tif(!this._map){\n\t\t\tif(!this._map) \n\t\t\t\tthis._waitMap.then(bind(this._drawData, this));\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\tvar columns = this._columns&&this._columns.length?this._columns:this._defineColumns();\n\t\tvar data = [];\n\t\tthis.data.each(function(obj){\n\t\t\tvar line = [];\n\t\t\tfor(var c = 0; c You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"barcode\", defaults:{\n\ttemplate:\"GPL version doesn't support barcode
You need Webix PRO\"\n}}, template.view);","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"bulletgraph\", defaults:{\n\ttemplate:\"GPL version doesn't support bulletgraph
You need Webix PRO\"\n}}, template.view);","import base from \"../views/view\";\nimport DataLoader from \"../core/dataloader\";\nimport EventSystem from \"../core/eventsystem\";\nimport {protoUI} from \"../ui/core\";\nimport promise from \"../thirdparty/promiz\";\nimport {bind, extend} from \"../webix/helpers\";\n\n\nvar google, script;\n\nconst api = {\n\tname:\"google-map\",\n\t$init:function(){\n\t\tthis.$view.innerHTML = \"
\";\n\t\tthis._contentobj = this.$view.firstChild;\n\t\tthis._waitMap = promise.defer();\n\n\t\tthis.data.provideApi(this, true);\n\t\tthis.$ready.push(this.render);\n\t},\n\tgetMap:function(waitMap){\n\t\treturn waitMap?this._waitMap:this._map;\n\t},\n\t_getCallBack:function(prev){\n\t\treturn bind(function(){\n\t\t\tif (typeof prev === \"function\") prev();\n\n\t\t\tgoogle = google || window.google;\n\t\t\tthis._initMap.call(this);\n\t\t}, this);\n\t},\n\trender:function(){\n\t\tif(typeof window.google==\"undefined\"||typeof window.google.maps==\"undefined\"){\n\t\t\tif(!script){\n\t\t\t\tscript = document.createElement(\"script\");\n\t\t\t\tscript.type = \"text/javascript\";\n\n\t\t\t\tvar config = this._settings;\n\t\t\t\tvar src = config.src || \"//maps.google.com/maps/api/js\";\n\t\t\t\tsrc += (src.indexOf(\"?\")===-1 ? \"?\" :\"&\");\n\t\t\t\t\n\t\t\t\tif (config.key)\n\t\t\t\t\tsrc += \"&key=\"+config.key;\n\t\t\t\tif (config.libraries)\n\t\t\t\t\tsrc += \"&libraries=\"+config.libraries;\n\n\t\t\t\tscript.src = src;\n\t\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(script);\n\t\t\t}\n\t\t\tscript.onload = this._getCallBack(script.onload);\n\t\t}\n\t\telse //there's a custom link to google api in document head\n\t\t\t(this._getCallBack())();\n\t},\n\t_initMap:function(){\n\t\tvar c = this.config;\n\t\tif(this.isVisible(c.id)){\n\t\t\tthis._map = new google.maps.Map(this._contentobj, {\n\t\t\t\tzoom: c.zoom,\n\t\t\t\tcenter: new google.maps.LatLng(c.center[0], c.center[1]),\n\t\t\t\tmapTypeId: google.maps.MapTypeId[c.mapType]\n\t\t\t});\n\t\t\tthis._waitMap.resolve(this._map);\n\t\t}\n\t},\n\tcenter_setter:function(config){\n\t\tif(this._map)\n\t\t\tthis._map.setCenter(new google.maps.LatLng(config[0], config[1]));\n\n\t\treturn config;\n\t},\n\tmapType_setter:function(config){\n\t\t/*ROADMAP,SATELLITE,HYBRID,TERRAIN*/\n\t\tif(this._map)\n\t\t\tthis._map.setMapTypeId(google.maps.MapTypeId[config]);\n\n\t\treturn config;\n\t},\n\tzoom_setter:function(config){\n\t\tif(this._map)\n\t\t\tthis._map.setZoom(config);\n\t\treturn config;\n\t},\n\tlayerType_setter:function(config){\n\t\tif(config == \"heatmap\")\n\t\t\tthis.config.libraries = \"visualization\";\n\t\tif(this._layerApi[config]){\n\t\t\textend(this, this._layerApi[config], true);\n\t\t\tthis.data.attachEvent(\"onStoreUpdated\", bind(function(){\n\t\t\t\tthis._waitMap.then(bind(function(){\t\n\t\t\t\t\tthis.drawData.call(this, arguments);\n\t\t\t\t}, this));\n\t\t\t}, this));\n\t\t}\n\t\treturn config;\n\t},\n\tdefaults:{\n\t\tzoom: 5,\n\t\tcenter:[ 39.5, -98.5 ],\n\t\tmapType: \"ROADMAP\",\n\t\tlayerType:\"marker\"\n\t},\n\t$setSize:function(){\n\t\tbase.api.$setSize.apply(this, arguments);\n\t\tif(this._map)\n\t\t\tgoogle.maps.event.trigger(this._map, \"resize\");\n\t},\n\t$onLoad:function(data){\n\t\tif(!this._map){\n\t\t\tthis._waitMap.then(bind(function(){\n\t\t\t\tthis.parse(data);\n\t\t\t}, this));\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t},\n\t_layerApi:{\n\t\tmarker:{\n\t\t\tdrawData:function(id, item, operation){\n\t\t\t\tswitch (operation){\n\t\t\t\t\tcase \"add\":\n\t\t\t\t\t\titem.$marker = this._getItemConfig(item);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"update\":\n\t\t\t\t\t\titem.$marker = this._getItemConfig(item);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"delete\":\n\t\t\t\t\t\titem.$marker.setMap(null);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.data.each(function(item){\n\t\t\t\t\t\t\titem.$marker = this._getItemConfig(item);\n\t\t\t\t\t\t}, this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tclearAll:function(soft){\n\t\t\t\tthis.data.each(function(obj){\n\t\t\t\t\tobj.$marker.setMap(null);\n\t\t\t\t});\n\t\t\t\tthis.data.clearAll(soft);\n\t\t\t},\n\t\t\tshowItem:function(id){\n\t\t\t\tvar item = this.getItem(id);\n\t\t\t\tthis._map.setCenter(new google.maps.LatLng(item.lat, item.lng));\n\t\t\t},\n\t\t\t_getItemConfig:function(item){\n\t\t\t\tvar obj = {};\n\t\t\t\tfor(var i in item) obj[i] = item[i];\n\t\t\t\tobj.position = new google.maps.LatLng(item.lat, item.lng);\n\t\t\t\tobj.map = item.hidden? null: this._map;\n\n\t\t\t\tvar marker = item.$marker;\n\t\t\t\tif(!marker){\n\t\t\t\t\tmarker = new google.maps.Marker(obj);\n\t\t\t\t\tthis._events(marker);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\titem.$marker.setMap(obj.map);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthis.callEvent(\"onItemRender\", [item]);\n\t\t\t\t\n\t\t\t\treturn marker;\n\t\t\t},\n\t\t\t_events:function(marker){\n\t\t\t\tvar map = this;\n\t\t\t\t\n\t\t\t\tmarker.addListener(\"click\", function(){\n\t\t\t\t\tmap.callEvent(\"onItemClick\", [this.id, this]);\n\t\t\t\t});\n\n\t\t\t\tif(marker.getDraggable()){\n\t\t\t\t\tmarker.addListener(\"dragend\", function(){ map._onDrag(this, true); });\n\t\t\t\t\tmarker.addListener(\"drag\", function(){ map._onDrag(this); });\n\t\t\t\t}\n\t\t\t},\n\t\t\t_onDrag:function(marker, end){\n\t\t\t\tvar item = this.getItem(marker.id);\n\t\t\t\tvar pos = marker.getPosition();\n\t\t\t\tvar ev = end?\"onAfterDrop\":\"onDrag\";\n\n\t\t\t\titem.lat = pos.lat();\n\t\t\t\titem.lng = pos.lng();\n\t\t\t\tthis.callEvent(ev, [item.id, item]);\n\t\t\t}\n\t\t},\n\t\theatmap:{\n\t\t\theatmapConfig_setter:function(value){\n\t\t\t\tvalue = value || {};\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\tdrawData:function(){\n\t\t\t\tif(this._heatmap){\n\t\t\t\t\tthis._heatmap.setMap(null);\n\t\t\t\t\tthis._heatmap = null;\n\t\t\t\t}\n\n\t\t\t\tvar hdata = [];\n\t\t\t\tthis.data.each(function(item){ hdata.push(this._getConfig(item)); }, this);\n\n\t\t\t\tif(hdata.length){\n\t\t\t\t\tvar data = extend(this.config.heatmapConfig, {data:hdata, map:this._map}, true);\n\t\t\t\t\tthis._heatmap = new google.maps.visualization.HeatmapLayer(data);\n\t\t\t\t\tthis.callEvent(\"onHeatMapRender\", [this._heatmap]);\n\t\t\t\t}\n\t\t\t},\n\t\t\tgetHeatmap:function(){\n\t\t\t\treturn this._heatmap;\n\t\t\t},\n\t\t\t_getConfig:function(item){\n\t\t\t\tvar obj = {};\n\t\t\t\tfor(var i in item) obj[i] = item[i];\n\t\t\t\tobj.location = new google.maps.LatLng(item.lat, item.lng);\n\n\t\t\t\treturn obj;\n\t\t\t}\n\t\t}\n\t}\n};\n\n\nconst view = protoUI(api, DataLoader, EventSystem, base.view);\nexport default {api, view};","\nimport {protoUI} from \"../ui/core\";\nimport template from \"../views/template\";\n\nprotoUI({ name:\"organogram\", defaults:{\n\ttemplate:\"GPL version doesn't support organogram
You need Webix PRO\"\n}}, template.view);","\n\nconst Pie = {\n\t$render_pie:function(ctx,data,x,y,sIndex,map){\n\t\tthis._renderPie(ctx,data,x,y,1,map,sIndex);\n\t\t\n\t},\n\t/**\n\t * renders a pie chart\n\t * @param: ctx - canvas object\n\t * @param: data - object those need to be displayed\n\t * @param: x - the width of the container\n\t * @param: y - the height of the container\n\t * @param: ky - value from 0 to 1 that defines an angle of inclination (0=0)||(a1>=0 && a2<=Math.PI)||(Math.abs(a1-Math.PI)>0.003&&a1<=Math.PI && a2>=Math.PI))) return;\n\n\t\tif(a1<=0 && a2>=0){\n\t\t\ta1 = 0;\n\t\t\tline = false;\n\t\t\tthis._drawSectorLine(ctx,x0,y0,R,a1,a2);\n\t\t}\n\t\tif(a1<=Math.PI && a2>=Math.PI){\n\t\t\ta2 = Math.PI;\n\t\t\tline = false;\n\t\t\tthis._drawSectorLine(ctx,x0,y0,R,a1,a2);\n\t\t}\n\t\t/*the height of 3D pie*/\n\t\tvar offset = (this._settings.pieHeight||Math.floor(R/4))/this._settings.cant;\n\t\tctx.beginPath();\n\t\tctx.arc(x0,y0,R,a1,a2,false);\n\t\tctx.lineTo(x0+R*Math.cos(a2),y0+R*Math.sin(a2)+offset);\n\t\tctx.arc(x0,y0+offset,R,a2,a1,true);\n\t\tctx.lineTo(x0+R*Math.cos(a1),y0+R*Math.sin(a1));\n\t\tctx.fill();\n\t\tif(line)\n\t\t\tctx.stroke();\n\t},\n\t/**\n\t * draws a serctor arc\n\t */\n\t_drawSectorLine:function(ctx,x0,y0,R,a1,a2){\n\t\tctx.beginPath();\n\t\tctx.arc(x0,y0,R,a1,a2,false);\n\t\tctx.stroke();\n\t},\n\t/**\n\t * adds a shadow to pie\n\t * @param: ctx - canvas object\n\t * @param: x - the horizontal position of the pie center\n\t * @param: y - the vertical position of the pie center\n\t * @param: R - pie radius\n\t */\n\t_addShadow:function(ctx,x,y,R){\n\t\tctx.globalAlpha = 0.5;\n\t\tvar shadows = [\"#c4c4c4\",\"#c6c6c6\",\"#cacaca\",\"#dcdcdc\",\"#dddddd\",\"#e0e0e0\",\"#eeeeee\",\"#f5f5f5\",\"#f8f8f8\"];\n\t\tfor(var i = shadows.length-1;i>-1;i--){\n\t\t\tctx.beginPath();\n\t\t\tctx.fillStyle = shadows[i];\n\t\t\tctx.arc(x+1,y+1,R+i,0,Math.PI*2,true);\n\t\t\tctx.fill();\n\t\t}\n\t\tctx.globalAlpha = 1;\n\t},\n\t/**\n\t * returns a gray gradient\n\t * @param: gradient - gradient object\n\t */\n\t_getGrayGradient:function(gradient){\n\t\tgradient.addColorStop(0.0,\"#ffffff\");\n\t\tgradient.addColorStop(0.7,\"#7a7a7a\");\n\t\tgradient.addColorStop(1.0,\"#000000\");\n\t\treturn gradient;\n\t},\n\t/**\n\t * adds gray radial gradient\n\t * @param: ctx - canvas object\n\t * @param: x - the horizontal position of the pie center\n\t * @param: y - the vertical position of the pie center\n\t * @param: radius - pie radius\n\t * @param: x0 - the horizontal position of a gradient center\n\t * @param: y0 - the vertical position of a gradient center\n\t */\n\t_showRadialGradient:function(ctx,x,y,radius,x0,y0){\n\t\t//ctx.globalAlpha = 0.3;\n\t\tctx.beginPath();\n\t\tvar gradient;\n\t\tif(typeof this._settings.gradient!= \"function\"){\n\t\t\tgradient = ctx.createRadialGradient(x0,y0,radius/4,x,y,radius);\n\t\t\tgradient = this._getGrayGradient(gradient);\n\t\t}\n\t\telse gradient = this._settings.gradient(gradient);\n\t\tctx.fillStyle = gradient;\n\t\tctx.arc(x,y,radius,0,Math.PI*2,true);\n\t\tctx.fill();\n\t\t//ctx.globalAlpha = 1;\n\t\tctx.globalAlpha = 0.7;\n\t},\n\t/**\n\t * returns the calculates pie parameters: center position and radius\n\t * @param: ctx - canvas object\n\t * @param: x0 - the horizontal position of the pie center\n\t * @param: y0 - the vertical position of the pie center\n\t * @param: R - pie radius\n\t * @param: alpha1 - the angle that defines the 1st edge of a sector\n\t * @param: alpha2 - the angle that defines the 2nd edge of a sector\n\t * @param: ky - the value that defines an angle of inclination\n\t * @param: text - label text\n\t * @param: in_width (boolean) - if label needs being displayed inside a pie\n\t */\n\t_drawSectorLabel:function(x0,y0,R,alpha1,alpha2,ky,text,in_width){\n\t\tvar t = this.canvases[0].renderText(0,0,text,0,1);\n\t\tif (!t) return;\n\n\t\t//get existing width of text\n\t\tvar labelWidth = t.scrollWidth;\n\t\tt.style.width = labelWidth+\"px\";\t//adjust text label to fit all text\n\t\tif (labelWidth>x0) labelWidth = x0;\t//the text can't be greater than half of view\n\n\t\t//calculate expected correction based on default font metrics\n\t\tvar width = (alpha2-alpha1<0.2?4:8);\n\t\tif (in_width) width = labelWidth/1.8;\n\t\tvar alpha = alpha1+(alpha2-alpha1)/2;\n\n\t\t//position and its correction\n\t\tR = R-(width-8)/2;\n\t\tvar corr_x = - width;\n\t\tvar corr_y = -8;\n\t\tvar align = \"right\";\n\n\t\t//for items in left upper and lower sector\n\t\tif(alpha>=Math.PI/2 && alpha=Math.PI){\n\t\t\tcorr_x = -labelWidth-corr_x+1;/*correction for label width*/\n\t\t\talign = \"left\";\n\t\t}\n\n\t\t/*\n\t\t calculate position of text\n\t\t basically get point at center of pie sector\n\t\t*/\n\t\tvar offset = 0;\n\n\t\tif(!in_width&&ky<1&&(alpha>0&&alpha=Math.PI/2 && alpha=Math.PI)){\n\t\t\tx += labelWidth/3;\n\t\t}\n\n\n\t\t//we need to set position of text manually, based on above calculations\n\t\tt.style.top = y+\"px\";\n\t\tt.style.left = x+\"px\";\n\t\tt.style.width = labelWidth+\"px\";\n\t\tt.style.textAlign = align;\n\t\tt.style.whiteSpace = \"nowrap\";\n\t},\n\t$render_pie3D:function(ctx,data,x,y,sIndex,map){\n\t\tthis._renderPie(ctx,data,x,y,this._settings.cant,map);\n\t},\n\t$render_donut:function(ctx,data,point0,point1,sIndex,map){\n\t\tif(!data.length)\n\t\t\treturn;\n\t\tthis._renderPie(ctx,data,point0,point1,1,map,sIndex);\n\t\tvar config = this._settings;\n\t\tvar coord = this._getPieParameters(point0,point1);\n\t\tvar pieRadius = (config.radius?config.radius:coord.radius);\n\t\tvar innerRadius = ((config.innerRadius&&(config.innerRadiusminValue){\n\t\t\tthis._drawXAxis(ctx,data,point0,point1,cellWidth,point1.y-unit*(this._settings.origin-minValue));\n\t\t}\n\n\t\t/*a real bar width */\n\t\tbarWidth = parseInt(this._settings.barWidth,10);\n\t\tvar seriesNumber = 0;\n\t\tvar seriesIndex = 0;\n\t\tfor(i=0; icellWidth) barWidth = parseInt(cellWidth/seriesNumber-4,10);\n\n\t\t/*the half of distance between bars*/\n\t\tvar barOffset = (cellWidth - barWidth*seriesNumber)/2;\n\n\t\t/*the radius of rounding in the top part of each bar*/\n\t\tvar radius = (typeof this._settings.radius!=\"undefined\"?parseInt(this._settings.radius,10):Math.round(barWidth/5));\n\n\t\tvar inner_gradient = false;\n\t\tvar gradient = this._settings.gradient;\n\n\t\tif(gradient && typeof(gradient) != \"function\"){\n\t\t\tinner_gradient = gradient;\n\t\t\tgradient = false;\n\t\t} else if (gradient){\n\t\t\tgradient = ctx.createLinearGradient(0,point1.y,0,point0.y);\n\t\t\tthis._settings.gradient(gradient);\n\t\t}\n\t\t/*draws a black line if the horizontal scale isn't defined*/\n\t\tif(!xax){\n\t\t\tthis._drawLine(ctx,point0.x,point1.y+0.5,point1.x,point1.y+0.5,\"#edeff0\",1); //hardcoded color!\n\t\t}\n\n\t\tfor(i=0; i < data.length;i ++){\n\t\t\tvar value = parseFloat(this._settings.value(data[i])||0);\n\t\t\tif(this._logScaleCalc)\n\t\t\t\tvalue = this._log10(value);\n\n\t\t\tif(value>maxValue) value = maxValue;\n\t\t\tvalue -= minValue;\n\t\t\tvalue *= valueFactor;\n\n\t\t\t/*start point (bottom left)*/\n\t\t\tvar x0 = point0.x + barOffset + i*cellWidth+(barWidth+1)*seriesIndex;\n\t\t\tvar y0 = point1.y;\n\n\t\t\tvar color = gradient||this._settings.color.call(this,data[i]);\n\t\t\tvar border = this._settings.border?1:0;\n\t\t\tvar label = this._settings.label(data[i]);\n\t\t\t\n\t\t\t/* don't draw borders and labels for not painted values (on y-Axis or lower) */\n\t\t\tif(value == this._settings.origin || (this._settings.origin ==\"auto\" && this._settings.value(data[i]) == minValue)){\n\t\t\t\tborder = 0;\n\t\t\t\tlabel = \"\";\n\t\t\t}\n\t\t\telse if(value<0||(this._settings.yAxis&&value===0&&!(this._settings.origin!=\"auto\"&&this._settings.origin>minValue))){\n\t\t\t\tvalue = border = 0;\n\t\t\t\tlabel = \"\";\n\t\t\t}\n\t\t\t/*takes start value into consideration */\n\t\t\telse if(!yax&&!(this._settings.origin!=\"auto\"&&xax)) \n\t\t\t\tvalue += startValue/unit;\n\n\t\t\t/*drawing bar body*/\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[i]);\n\t\t\tvar points = this._drawBar(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient, border);\n\t\t\tif (inner_gradient){\n\t\t\t\tthis._drawBarGradient(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient, border);\n\t\t\t}\n\t\t\t/*drawing the gradient border of a bar*/\n\t\t\tif(border)\n\t\t\t\tthis._drawBarBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);\n\n\t\t\tctx.globalAlpha = 1;\n\n\t\t\t/*sets a bar label*/\n\t\t\tif(points[0]!=x0)\n\t\t\t\tthis.canvases[sIndex].renderTextAt(false, true, x0+Math.floor(barWidth/2),points[1],label);\n\t\t\telse\n\t\t\t\tthis.canvases[sIndex].renderTextAt(true, true, x0+Math.floor(barWidth/2),points[3],label);\n\t\t\t/*defines a map area for a bar*/\n\t\t\tmap.addRect(data[i].id,[x0-point0.x,points[3]-point0.y,points[2]-point0.x,points[1]-point0.y],sIndex);\n\t\t\t//this._addMapRect(map,data[i].id,[{x:x0,y:points[3]},{x:points[2],y:points[1]}],point0,sIndex);\n\t\t}\n\t},\n\t_correctBarParams:function(ctx,x,y,value,unit,barWidth,minValue){\n\t\tvar xax = this._settings.xAxis;\n\t\tvar axisStart = y;\n\t\tif(!!xax&&this._settings.origin!=\"auto\" && (this._settings.origin>minValue)){\n\t\t\ty -= (this._settings.origin-minValue)*unit;\n\t\t\taxisStart = y;\n\t\t\tvalue = value-(this._settings.origin-minValue);\n\t\t\tif(value < 0){\n\t\t\t\tvalue *= (-1);\n\t\t\t\tctx.translate(x+barWidth,y);\n\t\t\t\tctx.rotate(Math.PI);\n\t\t\t\tx = 0;\n\t\t\t\ty = 0;\n\t\t\t}\n\t\t\ty -= 0.5;\n\t\t}\n\n\t\treturn {value:value,x0:x,y0:y,start:axisStart};\n\t},\n\t_drawBar:function(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient, border){\n\t\tctx.save();\n\t\tctx.fillStyle = color;\n\t\tvar p = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\t\tvar points = this._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,border);\n\t\tif (gradient&&!inner_gradient) ctx.lineTo(p.x0+border,point0.y); //fix gradient sphreading\n\t\tctx.fill();\n\t\tctx.restore();\n\t\tvar x1 = p.x0;\n\t\tvar x2 = (p.x0!=x0?x0+points[0]:points[0]);\n\t\tvar y1 = (p.x0!=x0?(p.start-points[1]-p.y0):p.y0);\n\t\tvar y2 = (p.x0!=x0?p.start-p.y0:points[1]);\n\n\t\treturn [x1,y1,x2,y2];\n\t},\n\t_setBorderStyles:function(ctx, rawColor){\n\t\tvar hsv,rgb;\n\t\trgb = color.toRgb(rawColor);\n\t\thsv = color.rgbToHsv(rgb[0],rgb[1],rgb[2]);\n\t\thsv[2] /= 1.4;\n\t\tvar rgbColor = \"rgb(\"+color.hsvToRgb(hsv[0],hsv[1],hsv[2])+\")\";\n\t\tctx.strokeStyle = rgbColor;\n\t\tif(ctx.globalAlpha==1)\n\t\t\tctx.globalAlpha = 0.9;\n\t},\n\t_drawBarBorder:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color){\n\t\tvar p;\n\t\tctx.save();\n\t\tp = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\t\tthis._setBorderStyles(ctx,color);\n\t\tthis._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,ctx.lineWidth/2,1);\n\t\tctx.stroke();\n\t\t/*ctx.fillStyle = color;\n\t\t this._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,0);\n\t\t ctx.lineTo(p.x0,0);\n\t\t ctx.fill()\n\n\n\t\t ctx.fillStyle = \"#000000\";\n\t\t ctx.globalAlpha = 0.37;\n\n\t\t this._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,0);\n\t\t ctx.fill()\n\t\t */\n\t\tctx.restore();\n\t},\n\t_drawBarGradient:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient, border){\n\t\tctx.save();\n\t\tvar p = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\t\tvar gradParam = this._setBarGradient(ctx,p.x0,p.y0,p.x0+barWidth,p.y0-unit*p.value+2,inner_gradient,color,\"y\");\n\t\tctx.fillStyle = gradParam.gradient;\n\t\tthis._setBarPoints(ctx,p.x0+gradParam.offset,p.y0,barWidth-gradParam.offset*2,radius,unit,p.value,gradParam.offset+border);\n\t\tctx.fill();\n\t\tctx.restore();\n\t},\n\t/**\n\t * sets points for bar and returns the position of the bottom right point\n\t * @param: ctx - canvas object\n\t * @param: x0 - the x position of start point\n\t * @param: y0 - the y position of start point\n\t * @param: barWidth - bar width\n\t * @param: radius - the rounding radius of the top\n\t * @param: unit - the value defines the correspondence between item value and bar height\n\t * @param: value - item value\n\t * @param: offset - the offset from expected bar edge (necessary for drawing border)\n\t */\n\t_setBarPoints:function(ctx,x0,y0,barWidth,radius,unit,value,offset,skipBottom){\n\t\t/*correction for displaing small values (when rounding radius is bigger than bar height)*/\n\t\tctx.beginPath();\n\t\t//y0 = 0.5;\n\t\tvar angle_corr = 0;\n\t\tif(radius>unit*value){\n\t\t\tvar cosA = (radius-unit*value)/radius;\n\t\t\tif(cosA<=1&&cosA>=-1)\n\t\t\t\tangle_corr = -Math.acos(cosA)+Math.PI/2;\n\t\t}\n\t\t/*start*/\n\t\tctx.moveTo(x0+offset,y0);\n\t\t/*start of left rounding*/\n\t\tvar y1 = y0 - Math.floor(unit*value) + radius + (radius?0:offset);\n\t\tif(radius0)\n\t\t\tctx.arc(x2,y1,Math.max(radius-offset,0),-Math.PI+angle_corr,-Math.PI/2,false);\n\t\t/*start of right rounding*/\n\t\tvar x3 = x0 + barWidth - radius - offset;\n\t\tvar y3 = y1 - radius + (radius?offset:0);\n\t\tctx.lineTo(x3,y3);\n\t\t/*right rounding*/\n\t\tif (radius&&radius>0)\n\t\t\tctx.arc(x3+offset,y1,Math.max(radius-offset,0),-Math.PI/2,0-angle_corr,false);\n\t\t/*bottom right point*/\n\t\tvar x5 = x0 + barWidth-offset;\n\t\tctx.lineTo(x5,y0);\n\t\t/*line to the start point*/\n\t\tif(!skipBottom){\n\t\t\tctx.lineTo(x0+offset,y0);\n\t\t}\n\t\t//\tctx.lineTo(x0,0); //IE fix!\n\t\treturn [x5,y3];\n\t}\n};\n\nexport default BarChart;","\n\nconst LineChart = {\n\t/**\n\t* renders a graphic\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: width - the width of the container\n\t* @param: height - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_line:function(ctx, data, point0, point1, sIndex, map){\n\t\tvar config,i,items,params,x0,x1,x2,y1,y2,y0,res1,res2;\n\t\tparams = this._calculateLineParams(ctx,data,point0,point1,sIndex);\n\t\tconfig = this._settings;\n\n\t\tif (data.length) {\n\t\t\tx0 = (config.offset?point0.x+params.cellWidth*0.5:point0.x);\n\t\t\t//finds items with data (excludes scale units)\n\t\t\titems= [];\n\t\t\tfor(i=0; i < data.length;i++){\n\t\t\t\tres2 = this._getPointY(data[i],point0,point1,params);\n\t\t\t\tif(res2 || res2==\"0\"){\n\t\t\t\t\tx2 = ((!i)?x0:params.cellWidth*i - 0.5 + x0);\n\t\t\t\t\ty2 = (typeof res2 == \"object\"?res2.y0:res2);\n\t\t\t\t\tif(i && this._settings.fixOverflow){\n\t\t\t\t\t\tres1 = this._getPointY(data[i-1],point0,point1,params);\n\t\t\t\t\t\tif(res1.out && res1.out == res2.out){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tx1 = params.cellWidth*(i-1) - 0.5 + x0;\n\t\t\t\t\t\ty1 = (typeof res1 == \"object\"?res1.y0:res1);\n\n\t\t\t\t\t\tif(res1.out){\n\t\t\t\t\t\t\ty0 = (res1.out == \"min\"?point1.y:point0.y);\n\t\t\t\t\t\t\titems.push({x:this._calcOverflowX(x1,x2,y1,y2,y0),y:y0});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(res2.out){\n\t\t\t\t\t\t\ty0 = (res2.out == \"min\"?point1.y:point0.y);\n\t\t\t\t\t\t\titems.push({x:this._calcOverflowX(x1,x2,y1,y2,y0),y:y0});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!res2.out)\n\t\t\t\t\t\titems.push({x:x2, y: res2, index: i});\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._mapStart = point0;\n\t\t\tfor(i = 1; i <= items.length; i++){\n\t\t\t\t//line start position\n\t\t\t\tx1 = items[i-1].x;\n\t\t\t\ty1 = items[i-1].y;\n\t\t\t\tif(i=0;i--){\n\t\t\t\t\tctx.globalAlpha = alphas[i];\n\t\t\t\t\tctx.strokeStyle = \"#d0d0d0\";\n\t\t\t\t\tctx.beginPath();\n\t\t\t\t\tthis._strokeChartItem(ctx,x0,y0+2*R/3,R+i+1,item);\n\t\t\t\t\tctx.stroke();\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.globalAlpha = 0.3;\n\t\t\t\tctx.fillStyle = \"#bdbdbd\";\n\t\t\t\tthis._strokeChartItem(ctx,x0,y0+2*R/3,R+1,item);\n\t\t\t\tctx.fill();\n\t\t\t}\n\t\t\tctx.restore();\n\t\t\tctx.lineWidth = config.borderWidth;\n\t\t\tctx.fillStyle = config.color.call(this,obj);\n\t\t\tctx.strokeStyle = config.borderColor.call(this,obj);\n\t\t\tctx.globalAlpha = config.alpha.call(this,obj);\n\t\t\tctx.beginPath();\n\t\t\tthis._strokeChartItem(ctx,x0,y0,R+1,item);\n\t\t\tctx.fill();\n\t\t\tctx.stroke();\n\t\t\tctx.globalAlpha = 1;\n\t\t}\n\t\t/*item label*/\n\t\tif(label){\n\t\t\tthis.canvases[sIndex].renderTextAt(false, true, x0,y0-R-this._settings.labelOffset,this._settings.label.call(this,obj));\n\t\t}\n\t\tif(map){\n\t\t\tvar areaPos = (this._settings.eventRadius||R+1);\n\t\t\t//this._addMapRect(map,obj.id,[{x:x0-areaPos,y:y0-areaPos},{x0+areaPos,y:y0+areaPos}],point0,sIndex);\n\t\t\tmap.addRect(obj.id,[x0-areaPos-mapStart.x,y0-areaPos-mapStart.y,x0+areaPos-mapStart.x,y0+areaPos-mapStart.y],sIndex);\n\t\t}\n\n\t},\n\t_strokeChartItem:function(ctx,x0,y0,R,type){\n\t\tvar p=[];\n\t\tif(type && (type==\"square\" || type==\"s\")){\n\t\t\tR *= Math.sqrt(2)/2;\n\t\t\tp = [\n\t\t\t\t[x0-R-ctx.lineWidth/2,y0-R],\n\t\t\t\t[x0+R,y0-R],\n\t\t\t\t[x0+R,y0+R],\n\t\t\t\t[x0-R,y0+R],\n\t\t\t\t[x0-R,y0-R]\n\t\t\t];\n\t\t}\n\t\telse if(type && (type==\"diamond\" || type==\"d\")){\n\t\t\tvar corr = (ctx.lineWidth>1?ctx.lineWidth*Math.sqrt(2)/4:0);\n\t\t\tp = [\n\t\t\t\t[x0,y0-R],\n\t\t\t\t[x0+R,y0],\n\t\t\t\t[x0,y0+R],\n\t\t\t\t[x0-R,y0],\n\t\t\t\t[x0+corr,y0-R-corr]\n\t\t\t];\n\t\t}\n\t\telse if(type && (type==\"triangle\" || type==\"t\")){\n\t\t\tp = [\n\t\t\t\t[x0,y0-R],\n\t\t\t\t[x0+Math.sqrt(3)*R/2,y0+R/2],\n\t\t\t\t[x0-Math.sqrt(3)*R/2,y0+R/2],\n\t\t\t\t[x0,y0-R]\n\t\t\t];\n\t\t}\n\t\telse\n\t\t\tp = [\n\t\t\t\t[x0,y0,R,0,Math.PI*2,true]\n\t\t\t];\n\t\tthis._path(ctx,p);\n\t},\n\t/**\n\t* gets the vertical position of the item\n\t* @param: data - data object\n\t* @param: y0 - the y position of chart start\n\t* @param: y1 - the y position of chart end\n\t* @param: params - the object with elements: minValue, maxValue, unit, valueFactor (the value multiple of 10)\n\t*/\n\t_getPointY: function(data,point0,point1,params){\n\t\tvar minValue = params.minValue;\n\t\tvar maxValue = params.maxValue;\n\t\tvar unit = params.unit;\n\t\tvar valueFactor = params.valueFactor;\n\t\t/*the real value of an object*/\n\t\tvar value = this._settings.value(data);\n\t\tif(this._logScaleCalc){\n\t\t\tvalue = this._log10(value);\n\t\t}\n\t\t/*a relative value*/\n\t\tvar v = (parseFloat(value||0) - minValue)*valueFactor;\n\t\tif(!this._settings.yAxis)\n\t\t\tv += params.startValue/unit;\n\t\t/*a vertical coordinate*/\n\t\tvar y = point1.y - unit*v;\n\t\t/*the limit of the max and min values*/\n\t\tif(this._settings.fixOverflow && ( this._settings.type == \"line\" || this._settings.type == \"area\")){\n\t\t\tif(value > maxValue)\n\t\t\t\ty = {y: point0.y, y0: y, out: \"max\"};\n\t\t\telse if(v<0 || value < minValue)\n\t\t\t\ty = {y: point1.y, y0: y, out: \"min\"};\n\t\t}\n\t\telse{\n\t\t\tif(value > maxValue)\n\t\t\t\ty = point0.y;\n\t\t\tif(v<0 || value < minValue)\n\t\t\t\ty = point1.y;\n\t\t}\n\t\treturn y;\n\t},\n\t_calculateLineParams: function(ctx,data,point0,point1,sIndex){\n\t\tvar params = {};\n\n\t\t/*maxValue - minValue*/\n\t\tvar relValue;\n\n\t\t/*available height*/\n\t\tparams.totalHeight = point1.y-point0.y;\n\n\t\t/*a space available for a single item*/\n\t\t//params.cellWidth = Math.round((point1.x-point0.x)/((!this._settings.offset&&this._settings.yAxis)?(data.length-1):data.length));\n\t\tif(this._settings.cellWidth)\n\t\t\tparams.cellWidth = Math.min(point1.x-point0.x, this._settings.cellWidth);\n\t\telse\n\t\t\tparams.cellWidth = (point1.x-point0.x)/((!this._settings.offset)?(data.length-1):data.length);\n\t\t/*scales*/\n\t\tvar yax = !!this._settings.yAxis;\n\n\t\tvar limits = (this._settings.type.indexOf(\"stacked\")!=-1?this._getStackedLimits(data):this._getLimits());\n\t\tparams.maxValue = limits.max;\n\t\tparams.minValue = limits.min;\n\n\t\t/*draws x and y scales*/\n\t\tif(!sIndex)\n\t\t\tthis._drawScales(data, point0, point1,params.minValue,params.maxValue,params.cellWidth);\n\n\t\t/*necessary for automatic scale*/\n\t\tif(yax){\n\t\t\tparams.maxValue = parseFloat(this._settings.yAxis.end);\n\t\t\tparams.minValue = parseFloat(this._settings.yAxis.start);\n\t\t}\n\n\t\t/*unit calculation (y_position = value*unit)*/\n\t\tvar relativeValues = this._getRelativeValue(params.minValue,params.maxValue);\n\t\trelValue = relativeValues[0];\n\t\tparams.valueFactor = relativeValues[1];\n\t\tparams.unit = (relValue?params.totalHeight/relValue:10);\n\n\t\tparams.startValue = 0;\n\t\tif(!yax){\n\t\t\t/*defines start value for better representation of small values*/\n\t\t\tparams.startValue = 10;\n\t\t\tif(params.unit!=params.totalHeight)\n\t\t\t\tparams.unit = (relValue?(params.totalHeight - params.startValue)/relValue:10);\n\t\t}\n\t\treturn params;\n\t}\n};\n\nexport default LineChart;","const BarHChart = {\n\t/**\n\t* renders a bar chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: x - the width of the container\n\t* @param: y - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_barH:function(ctx, data, point0, point1, sIndex, map){\n\t\tvar barOffset, barWidth, cellWidth, color, gradient, i, limits, maxValue, minValue,\n\t\t\tinnerGradient, valueFactor, relValue, radius, relativeValues,\n\t\t\tstartValue, totalWidth,value, unit, x0, y0, xax;\n\n\t\t/*an available width for one bar*/\n\t\tcellWidth = (point1.y-point0.y)/data.length;\n\n\t\tlimits = this._getLimits(\"h\");\n\n\t\tmaxValue = limits.max;\n\t\tminValue = limits.min;\n\n\t\ttotalWidth = point1.x-point0.x;\n\n\t\txax = !!this._settings.xAxis;\n\n\t\t/*draws x and y scales*/\n\t\tif(!sIndex )\n\t\t\tthis._drawHScales(ctx,data,point0, point1,minValue,maxValue,cellWidth);\n\n\t\t/*necessary for automatic scale*/\n\t\tif(xax ){\n\t\t\tmaxValue = parseFloat(this._settings.xAxis.end);\n\t\t\tminValue = parseFloat(this._settings.xAxis.start);\n\t\t}\n\n\t\t/*unit calculation (bar_height = value*unit)*/\n\t\trelativeValues = this._getRelativeValue(minValue,maxValue);\n\t\trelValue = relativeValues[0];\n\t\tvalueFactor = relativeValues[1];\n\n\t\tunit = (relValue?totalWidth/relValue:10);\n\t\tif(!xax){\n\t\t\t/*defines start value for better representation of small values*/\n\t\t\tstartValue = 10;\n\t\t\tunit = (relValue?(totalWidth-startValue)/relValue:10);\n\t\t}\n\n\n\t\t/*a real bar width */\n\t\tbarWidth = parseInt(this._settings.barWidth,10);\n\t\tif((barWidth*this._series.length+4)>cellWidth) barWidth = cellWidth/this._series.length-4;\n\t\t/*the half of distance between bars*/\n\t\tbarOffset = Math.floor((cellWidth - barWidth*this._series.length)/2);\n\t\t/*the radius of rounding in the top part of each bar*/\n\t\tradius = (typeof this._settings.radius!=\"undefined\"?parseInt(this._settings.radius,10):Math.round(barWidth/5));\n\n\t\tinnerGradient = false;\n\t\tgradient = this._settings.gradient;\n\n\t\tif (gradient&&typeof(gradient) != \"function\"){\n\t\t\tinnerGradient = gradient;\n\t\t\tgradient = false;\n\t\t} else if (gradient){\n\t\t\tgradient = ctx.createLinearGradient(point0.x,point0.y,point1.x,point0.y);\n\t\t\tthis._settings.gradient(gradient);\n\t\t}\n\t\t/*draws a black line if the horizontal scale isn't defined*/\n\t\tif(!xax){\n\t\t\tthis._drawLine(ctx,point0.x-0.5,point0.y,point0.x-0.5,point1.y,\"#edeff0\",1); //hardcoded color!\n\t\t}\n\n\n\n\t\tfor(i=0; i < data.length;i ++){\n\n\n\t\t\tvalue = parseFloat(this._settings.value(data[i]||0));\n\t\t\tif(this._logScaleCalc)\n\t\t\t\tvalue = this._log10(value);\n\t\t\t\n\t\t\tif(!value || isNaN(value))\n\t\t\t\tcontinue;\n\n\t\t\tif(value>maxValue) value = maxValue;\n\t\t\tvalue -= minValue;\n\t\t\tvalue *= valueFactor;\n\n\t\t\t/*start point (bottom left)*/\n\t\t\tx0 = point0.x;\n\t\t\ty0 = point0.y+ barOffset + i*cellWidth+(barWidth+1)*sIndex;\n\n\t\t\tif((value<0&&this._settings.origin==\"auto\")||(this._settings.xAxis&&value===0&&!(this._settings.origin!=\"auto\"&&this._settings.origin>minValue))){\n\t\t\t\tthis.canvases[sIndex].renderTextAt(\"middle\", \"right\", x0+10,y0+barWidth/2+barOffset,this._settings.label(data[i]));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(value<0&&this._settings.origin!=\"auto\"&&this._settings.origin>minValue){\n\t\t\t\tvalue = 0;\n\t\t\t}\n\n\t\t\t/*takes start value into consideration*/\n\t\t\tif(!xax) value += startValue/unit;\n\t\t\tcolor = gradient||this._settings.color.call(this,data[i]);\n\n\t\t\t/*drawing the gradient border of a bar*/\n\t\t\tif(this._settings.border){\n\t\t\t\tthis._drawBarHBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);\n\t\t\t}\n\n\t\t\t/*drawing bar body*/\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[i]);\n\t\t\tvar points = this._drawBarH(ctx,point1,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,innerGradient);\n\t\t\tif (innerGradient){\n\t\t\t\tthis._drawBarHGradient(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,innerGradient);\n\n\t\t\t}\n\t\t\tctx.globalAlpha = 1;\n\n\n\t\t\t/*sets a bar label and map area*/\n\n\t\t\tif(points[3]==y0){\n\t\t\t\tthis.canvases[sIndex].renderTextAt(\"middle\", \"left\", points[0]-5,points[3]+Math.floor(barWidth/2),this._settings.label(data[i]));\n\t\t\t\tmap.addRect(data[i].id,[points[0]-point0.x,points[3]-point0.y,points[2]-point0.x,points[3]+barWidth-point0.y],sIndex);\n\n\t\t\t}else{\n\t\t\t\tthis.canvases[sIndex].renderTextAt(\"middle\", false, points[2]+5,points[1]+Math.floor(barWidth/2),this._settings.label(data[i]));\n\t\t\t\tmap.addRect(data[i].id,[points[0]-point0.x,y0-point0.y,points[2]-point0.x,points[3]-point0.y],sIndex);\n\t\t\t}\n\n\t\t}\n\t},\n\t/**\n\t * sets points for bar and returns the position of the bottom right point\n\t * @param: ctx - canvas object\n\t * @param: x0 - the x position of start point\n\t * @param: y0 - the y position of start point\n\t * @param: barWidth - bar width\n\t * @param: radius - the rounding radius of the top\n\t * @param: unit - the value defines the correspondence between item value and bar height\n\t * @param: value - item value\n\t * @param: offset - the offset from expected bar edge (necessary for drawing border)\n\t */\n\t_setBarHPoints:function(ctx,x0,y0,barWidth,radius,unit,value,offset,skipLeft){\n\t\t/*correction for displaing small values (when rounding radius is bigger than bar height)*/\n\t\tvar angle_corr = 0;\n\n\t\tif(radius>unit*value){\n\t\t\tvar sinA = (radius-unit*value)/radius;\n\t\t\tangle_corr = -Math.asin(sinA)+Math.PI/2;\n\t\t}\n\t\t/*start*/\n\t\tctx.moveTo(x0,y0+offset);\n\t\t/*start of left rounding*/\n\t\tvar x1 = x0 + unit*value - radius - (radius?0:offset);\n\t\tx1 = Math.max(x0,x1);\n\t\tif(radius0)\n\t\t\tctx.arc(x1,y2,radius-offset,-Math.PI/2+angle_corr,0,false);\n\t\t/*start of right rounding*/\n\t\tvar y3 = y0 + barWidth - radius - (radius?0:offset);\n\t\tvar x3 = x1 + radius - (radius?offset:0);\n\t\tctx.lineTo(x3,y3);\n\t\t/*right rounding*/\n\t\tif (radius&&radius>0)\n\t\t\tctx.arc(x1,y3,radius-offset,0,Math.PI/2-angle_corr,false);\n\t\t/*bottom right point*/\n\t\tvar y5 = y0 + barWidth-offset;\n\t\tctx.lineTo(x0,y5);\n\t\t/*line to the start point*/\n\t\tif(!skipLeft){\n\t\t\tctx.lineTo(x0,y0+offset);\n\t\t}\n\t\t//\tctx.lineTo(x0,0); //IE fix!\n\t\treturn [x3,y5];\n\t},\n\t_drawHScales:function(ctx,data,point0,point1,start,end,cellWidth){\n\t\tvar x = 0;\n\t\tif(this._settings.xAxis){\n\t\t\tif(!this.canvases[\"x\"])\n\t\t\t\tthis.canvases[\"x\"] = this._createCanvas(\"axis_x\");\n\t\t\tx = this._drawHXAxis(this.canvases[\"x\"].getCanvas(),data,point0,point1,start,end);\n\t\t}\n\t\tif (this._settings.yAxis){\n\t\t\tif(!this.canvases[\"y\"])\n\t\t\t\tthis.canvases[\"y\"] = this._createCanvas(\"axis_y\");\n\t\t\tthis._drawHYAxis(this.canvases[\"y\"].getCanvas(),data,point0,point1,cellWidth,x);\n\t\t}\n\t},\n\t_drawHYAxis:function(ctx,data,point0,point1,cellWidth,yAxisX){\n\t\tif (!this._settings.yAxis) return;\n\t\tvar unitPos;\n\t\tvar x0 = parseInt((yAxisX?yAxisX:point0.x),10)-0.5;\n\t\tvar y0 = point1.y+0.5;\n\t\tvar y1 = point0.y;\n\t\tthis._drawLine(ctx,x0,y0,x0,y1,this._settings.yAxis.color,1);\n\n\n\n\t\tfor(var i=0; i < data.length;i ++){\n\n\t\t\t/*scale labels*/\n\t\t\tvar right = ((this._settings.origin!=\"auto\")&&(this._settings.type==\"barH\")&&(parseFloat(this._settings.value(data[i]))minValue)){\n\t\t\tx += (this._settings.origin-minValue)*unit;\n\t\t\taxisStart = x;\n\t\t\tvalue = value-(this._settings.origin-minValue);\n\t\t\tif(value < 0){\n\t\t\t\tvalue *= (-1);\n\t\t\t\tctx.translate(x,y+barWidth);\n\t\t\t\tctx.rotate(Math.PI);\n\t\t\t\tx = 0.5;\n\t\t\t\ty = 0;\n\t\t\t}\n\t\t\tx += 0.5;\n\t\t}\n\n\t\treturn {value:value,x0:x,y0:y,start:axisStart};\n\t},\n\t_drawBarH:function(ctx,point1,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient){\n\t\tctx.save();\n\t\tvar p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\t\tctx.fillStyle = color;\n\t\tctx.beginPath();\n\t\tvar points = this._setBarHPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,(this._settings.border?1:0));\n\t\tif (gradient&&!inner_gradient) ctx.lineTo(point1.x,p.y0+(this._settings.border?1:0)); //fix gradient sphreading\n\t\tctx.fill();\n\t\tctx.restore();\n\t\tvar y1 = p.y0;\n\t\tvar y2 = (p.y0!=y0?y0:points[1]);\n\t\tvar x1 = (p.y0!=y0?(p.start-points[0]):p.start);\n\t\tvar x2 = (p.y0!=y0?p.start:points[0]);\n\n\t\treturn [x1,y1,x2,y2];\n\t},\n\t_drawBarHBorder:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color){\n\t\tctx.save();\n\t\tvar p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\n\t\tctx.beginPath();\n\t\tthis._setBorderStyles(ctx,color);\n\t\tctx.globalAlpha =0.9;\n\t\tthis._setBarHPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,ctx.lineWidth/2,1);\n\n\t\tctx.stroke();\n\t\tctx.restore();\n\t},\n\t_drawBarHGradient:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient){\n\t\tctx.save();\n\t\tvar p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);\n\t\tvar gradParam = this._setBarGradient(ctx,p.x0,p.y0+barWidth,p.x0+unit*p.value,p.y0,inner_gradient,color,\"x\");\n\t\tctx.fillStyle = gradParam.gradient;\n\t\tctx.beginPath();\n\t\tthis._setBarHPoints(ctx,p.x0,p.y0+gradParam.offset,barWidth-gradParam.offset*2,radius,unit,p.value,gradParam.offset);\n\t\tctx.fill();\n\t\tctx.globalAlpha = 1;\n\t\tctx.restore();\n\t}\n};\n\nexport default BarHChart;","\n\nconst StackedBarChart = {\n\t/**\n\t* renders a bar chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: x - the width of the container\n\t* @param: y - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_stackedBar:function(ctx, data, point0, point1, sIndex, map){\n\t\tvar maxValue,minValue, xAxisY, x0, y0;\n\t\t/*necessary if maxValue - minValue < 0*/\n\t\tvar valueFactor;\n\t\t/*maxValue - minValue*/\n\t\tvar relValue;\n\t\tvar config = this._settings;\n\t\tvar total_height = point1.y-point0.y;\n\n\t\tvar yax = !!config.yAxis;\n\t\tvar xax = !!config.xAxis;\n\n\t\tvar limits = this._getStackedLimits(data);\n\n\t\tvar origin = (config.origin === 0);\n\n\t\tmaxValue = limits.max;\n\t\tminValue = limits.min;\n\n\t\t/*an available width for one bar*/\n\t\tvar cellWidth = Math.floor((point1.x-point0.x)/data.length);\n\n\t\t/*draws x and y scales*/\n\t\tif(!sIndex){\n\t\t\txAxisY = this._drawScales(data,point0, point1,minValue,maxValue,cellWidth);\n\t\t}\n\n\t\t/*necessary for automatic scale*/\n\t\tif(yax){\n\t\t\tmaxValue = parseFloat(config.yAxis.end);\n\t\t\tminValue = parseFloat(config.yAxis.start);\n\t\t}\n\n\t\t/*unit calculation (bar_height = value*unit)*/\n\t\tvar relativeValues = this._getRelativeValue(minValue,maxValue);\n\t\trelValue = relativeValues[0];\n\t\tvalueFactor = relativeValues[1];\n\n\t\tvar unit = (relValue?total_height/relValue:10);\n\n\t\t/*a real bar width */\n\t\tvar barWidth = parseInt(config.barWidth,10);\n\t\tif(barWidth+4 > cellWidth) barWidth = cellWidth-4;\n\t\t/*the half of distance between bars*/\n\t\tvar barOffset = Math.floor((cellWidth - barWidth)/2);\n\n\n\t\tvar inner_gradient = (config.gradient?config.gradient:false);\n\n\t\t/*draws a black line if the horizontal scale isn't defined*/\n\t\tif(!xax){\n\t\t\t//scaleY = y-bottomPadding;\n\t\t\tthis._drawLine(ctx,point0.x,point1.y+0.5,point1.x,point1.y+0.5,\"#edeff0\",1); //hardcoded color!\n\t\t}\n\n\t\tfor(var i=0; i < data.length;i ++){\n\t\t\tvar value = Math.abs(parseFloat(config.value(data[i]||0)));\n\n\t\t\tif(this._logScaleCalc)\n\t\t\t\tvalue = this._log10(value);\n\n\t\t\t/*start point (bottom left)*/\n\t\t\tx0 = point0.x + barOffset + i*cellWidth;\n\n\n\t\t\tvar negValue = origin&&value<0;\n\t\t\tif(!sIndex){\n\t\t\t\ty0 = xAxisY-1;\n\t\t\t\tdata[i].$startY = y0;\n\t\t\t\tif(origin){\n\t\t\t\t\tif(negValue)\n\t\t\t\t\t\ty0 = xAxisY+1;\n\t\t\t\t\tdata[i].$startYN = xAxisY+1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\ty0 = negValue?data[i].$startYN:data[i].$startY;\n\t\t\t}\n\n\t\t\tif(!value || isNaN(value))\n\t\t\t\tcontinue;\n\n\t\t\t/*adjusts the first tab to the scale*/\n\t\t\tif(!sIndex && !origin)\n\t\t\t\tvalue -= minValue;\n\n\t\t\tvalue *= valueFactor;\n\n\t\t\t/*the max height limit*/\n\t\t\tif(y0 < (point0.y+1)) continue;\n\n\t\t\tvar color = this._settings.color.call(this,data[i]);\n\n\t\t\tvar firstSector = Math.abs(y0-(origin?(point1.y+minValue*unit):point1.y))<3;\n\n\t\t\t/*drawing bar body*/\n\t\t\tctx.globalAlpha = config.alpha.call(this,data[i]);\n\t\t\tctx.fillStyle = ctx.strokeStyle = config.color.call(this,data[i]);\n\t\t\tctx.beginPath();\n\n\t\t\tvar y1 = y0 - unit*value + (firstSector?(negValue?-1:1):0);\n\n\t\t\tvar points = this._setStakedBarPoints(ctx,x0-(config.border?0.5:0),y0,barWidth+(config.border?0.5:0),y1, 0,point0.y);\n\t\t\tctx.fill();\n\t\t\tctx.stroke();\n\n\t\t\t/*gradient*/\n\t\t\tif (inner_gradient){\n\t\t\t\tctx.save();\n\t\t\t\tvar gradParam = this._setBarGradient(ctx,x0,y0,x0+barWidth,points[1],inner_gradient,color,\"y\");\n\t\t\t\tctx.fillStyle = gradParam.gradient;\n\t\t\t\tctx.beginPath();\n\t\t\t\tpoints = this._setStakedBarPoints(ctx,x0+gradParam.offset,y0,barWidth-gradParam.offset*2,y1,(config.border?1:0),point0.y);\n\t\t\t\tctx.fill();\n\t\t\t\tctx.restore();\n\t\t\t}\n\t\t\t/*drawing the gradient border of a bar*/\n\t\t\tif(config.border){\n\t\t\t\tctx.save();\n\t\t\t\tif(typeof config.border == \"string\")\n\t\t\t\t\tctx.strokeStyle = config.border;\n\t\t\t\telse\n\t\t\t\t\tthis._setBorderStyles(ctx,color);\n\t\t\t\tctx.beginPath();\n\n\t\t\t\tthis._setStakedBarPoints(ctx,x0-0.5,parseInt(y0,10)+0.5,barWidth+1,parseInt(y1,10)+0.5,0,point0.y, firstSector);\n\t\t\t\tctx.stroke();\n\t\t\t\tctx.restore();\n\t\t\t}\n\t\t\tctx.globalAlpha = 1;\n\n\t\t\t/*sets a bar label*/\n\t\t\tthis.canvases[sIndex].renderTextAt(false, true, x0+Math.floor(barWidth/2),(points[1]+(y0-points[1])/2)-7,this._settings.label(data[i]));\n\t\t\t/*defines a map area for a bar*/\n\t\t\tmap.addRect(data[i].id,[x0-point0.x,points[1]-point0.y,points[0]-point0.x,data[i][negValue?\"$startYN\":\"$startY\"]-point0.y],sIndex);\n\n\t\t\t/*the start position for the next series*/\n\n\t\t\tdata[i][negValue?\"$startYN\":\"$startY\"] = points[1];\n\n\t\t}\n\t},\n\t/**\n\t * sets points for bar and returns the position of the bottom right point\n\t * @param: ctx - canvas object\n\t * @param: x0 - the x position of start point\n\t * @param: y0 - the y position of start point\n\t * @param: barWidth - bar width\n\t * @param: radius - the rounding radius of the top\n\t * @param: unit - the value defines the correspondence between item value and bar height\n\t * @param: value - item value\n\t * @param: offset - the offset from expected bar edge (necessary for drawing border)\n\t * @param: minY - the minimum y position for the bars ()\n\t */\n\t_setStakedBarPoints:function(ctx,x0,y0,barWidth,y1,offset,minY,skipBottom){\n\t\t/*start*/\n\t\tctx.moveTo(x0,y0);\n\t\t/*maximum height limit*/\n\n\t\tif(y1cellWidth) barWidth = cellWidth-4;\n\t\t/*the half of distance between bars*/\n\t\tvar barOffset = (cellWidth - barWidth)/2;\n\t\t/*the radius of rounding in the top part of each bar*/\n\t\tvar radius = 0;\n\n\t\tvar inner_gradient = false;\n\t\tvar gradient = this._settings.gradient;\n\t\tif (gradient){\n\t\t\tinner_gradient = true;\n\t\t}\n\t\t/*draws a black line if the horizontal scale isn't defined*/\n\t\tif(!yax){\n\t\t\tthis._drawLine(ctx,point0.x-0.5,point0.y,point0.x-0.5,point1.y,\"#edeff0\",1); //hardcoded color!\n\t\t}\n\n\t\tvar seriesNumber = 0;\n\t\tvar seriesIndex = 0;\n\t\tfor(i=0; imaxValue) value = maxValue;\n\t\t\tvalue -= minValue;\n\t\t\tvalue *= valueFactor;\n\n\t\t\t/*start point (bottom left)*/\n\t\t\tvar x0 = point0.x;\n\t\t\tvar y0 = point0.y+ barOffset + i*cellWidth;\n\n\t\t\tif(!seriesIndex)\n\t\t\t\tdata[i].$startX = x0;\n\t\t\telse\n\t\t\t\tx0 = data[i].$startX;\n\n\t\t\tif(!value || isNaN(value))\n\t\t\t\tcontinue;\n\n\t\t\t/*takes start value into consideration*/\n\t\t\tif(!yax) value += startValue/unit;\n\t\t\tvar color = this._settings.color.call(this,data[i]);\n\n\n\t\t\t/*drawing bar body*/\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[i]);\n\t\t\tctx.fillStyle = this._settings.color.call(this,data[i]);\n\t\t\tctx.beginPath();\n\t\t\tvar points = this._setBarHPoints(ctx,x0,y0,barWidth,radius,unit,value,0);\n\t\t\tif (gradient&&!inner_gradient) ctx.lineTo(point0.x+total_width,y0+(this._settings.border?1:0)); //fix gradient sphreading\n\t\t\tctx.fill();\n\n\t\t\tif (inner_gradient){\n\t\t\t\tvar gradParam = this._setBarGradient(ctx,x0,y0+barWidth,x0,y0,inner_gradient,color,\"x\");\n\t\t\t\tctx.fillStyle = gradParam.gradient;\n\t\t\t\tctx.beginPath();\n\t\t\t\tpoints = this._setBarHPoints(ctx,x0,y0, barWidth,radius,unit,value,0);\n\t\t\t\tctx.fill();\n\t\t\t}\n\t\t\t/*drawing the gradient border of a bar*/\n\t\t\tif(this._settings.border){\n\t\t\t\tthis._drawBarHBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);\n\t\t\t}\n\n\t\t\tctx.globalAlpha = 1;\n\n\t\t\t/*sets a bar label*/\n\t\t\tthis.canvases[sIndex].renderTextAt(\"middle\",true,data[i].$startX+(points[0]-data[i].$startX)/2-1, y0+(points[1]-y0)/2, this._settings.label(data[i]));\n\t\t\t/*defines a map area for a bar*/\n\t\t\tmap.addRect(data[i].id,[data[i].$startX-point0.x,y0-point0.y,points[0]-point0.x,points[1]-point0.y],sIndex);\n\t\t\t/*the start position for the next series*/\n\t\t\tdata[i].$startX = points[0];\n\t\t}\n\t}\n};\n\nexport default StackedBarHChart;","\n\nconst AreaChart = {\n\t/**\n\t* renders an area chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: width - the width of the container\n\t* @param: height - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_area:function(ctx, data, point0, point1, sIndex, map){\n\n\t\tvar align, config, i, mapRect, obj, params, path,\n\t\t\tres1, res2, x0, x1, y1, x2, y2, y0;\n\n\t\tparams = this._calculateLineParams(ctx,data,point0,point1,sIndex);\n\t\tconfig = this._settings;\n\n\t\t//the size of map area\n\t\tmapRect = (config.eventRadius||Math.floor(params.cellWidth/2));\n\n\t\tif (data.length) {\n\n\t\t\t// area points\n\t\t\tpath = [];\n\n\t\t\t//the x position of the first item\n\t\t\tx0 = (!config.offset?point0.x:point0.x+params.cellWidth*0.5);\n\n\t\t\t/*\n\t\t\t iterates over all data items:\n\t\t\t calculates [x,y] for area path, adds rect to chart map and renders labels\n\t\t\t */\n\t\t\tfor(i=0; i < data.length;i ++){\n\t\t\t\tobj = data[i];\n\n\t\t\t\tres2 = this._getPointY(obj,point0,point1,params);\n\t\t\t\tx2 = x0 + params.cellWidth*i ;\n\t\t\t\tif(res2){\n\t\t\t\t\ty2 = (typeof res2 == \"object\"?res2.y0:res2);\n\t\t\t\t\tif(i && this._settings.fixOverflow){\n\t\t\t\t\t\tres1 = this._getPointY(data[i-1],point0,point1,params);\n\t\t\t\t\t\tif(res1.out && res1.out == res2.out){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tx1 = params.cellWidth*(i-1) - 0.5 + x0;\n\t\t\t\t\t\ty1 = (typeof res1 == \"object\"?res1.y0:res1);\n\t\t\t\t\t\tif(res1.out){\n\t\t\t\t\t\t\ty0 = (res1.out == \"min\"?point1.y:point0.y);\n\t\t\t\t\t\t\tpath.push([this._calcOverflowX(x1,x2,y1,y2,y0),y0]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(res2.out){\n\t\t\t\t\t\t\ty0 = (res2.out == \"min\"?point1.y:point0.y);\n\t\t\t\t\t\t\tpath.push([this._calcOverflowX(x1,x2,y1,y2,y0),y0]);\n\t\t\t\t\t\t\tif(i == (data.length-1) && y0 == point0.y)\n\t\t\t\t\t\t\t\tpath.push([x2,point0.y]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(!res2.out){\n\t\t\t\t\t\tpath.push([x2,y2]);\n\t\t\t\t\t\t//map\n\t\t\t\t\t\tmap.addRect(obj.id,[x2-mapRect-point0.x,y2-mapRect-point0.y,x2+mapRect-point0.x,y2+mapRect-point0.y],sIndex);\n\t\t\t\t\t}\n\n\t\t\t\t\t//labels\n\t\t\t\t\tif(!config.yAxis){\n\t\t\t\t\t\talign = (!config.offset&&(i == data.length-1)?\"left\":\"center\");\n\t\t\t\t\t\tthis.canvases[sIndex].renderTextAt(false, align, x2, y2-config.labelOffset,config.label(obj));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tif(path.length){\n\t\t\t\tpath.push([x2,point1.y]);\n\t\t\t\tpath.push([path[0][0],point1.y]);\n\t\t\t}\n\n\n\n\t\t\t//filling area\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[0]);\n\t\t\tctx.fillStyle = this._settings.color.call(this,data[0]);\n\t\t\tctx.beginPath();\n\t\t\tthis._path(ctx,path);\n\t\t\tctx.fill();\n\n\t\t\tctx.lineWidth = 1;\n\t\t\tctx.globalAlpha =1;\n\n\t\t\t//border\n\t\t\tif(config.border){\n\t\t\t\tctx.lineWidth = config.borderWidth||1;\n\t\t\t\tif(config.borderColor)\n\t\t\t\t\tctx.strokeStyle = config.borderColor.call(this,data[0]);\n\t\t\t\telse\n\t\t\t\t\tthis._setBorderStyles(ctx,ctx.fillStyle);\n\n\t\t\t\tctx.beginPath();\n\t\t\t\tthis._path(ctx,path);\n\t\t\t\tctx.stroke();\n\n\t\t\t}\n\n\n\t\t}\n\t},\n\t\n\t/**\n\t* renders an area chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: width - the width of the container\n\t* @param: height - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_stackedArea:function(ctx, data, point0, point1, sIndex, map){\n\n\t\tvar a0, a1, align, config, i, j, lastItem, mapRect, obj, params, path, x, y, yPos;\n\n\t\tparams = this._calculateLineParams(ctx,data,point0,point1,sIndex);\n\n\t\tconfig = this._settings;\n\n\t\t/*the value that defines the map area position*/\n\t\tmapRect = (config.eventRadius||Math.floor(params.cellWidth/2));\n\n\n\t\t/*drawing all items*/\n\t\tif (data.length) {\n\n\t\t\t// area points\n\t\t\tpath = [];\n\n\t\t\t// y item positions\n\t\t\tyPos = [];\n\n\t\t\t//the x position of the first item\n\t\t\tx = (!config.offset?point0.x:point0.x+params.cellWidth*0.5);\n\n\n\t\t\tvar setOffset = function(i,y){\n\t\t\t\treturn sIndex?(data[i].$startY?y-point1.y+data[i].$startY:0):y;\n\t\t\t};\n\n\t\t\tvar solveEquation = function(x,p0,p1){\n\t\t\t\tvar k = (p1.y - p0.y)/(p1.x - p0.x);\n\t\t\t\treturn k*x + p0.y - k*p0.x;\n\t\t\t};\n\n\t\t\t/*\n\t\t\t iterates over all data items:\n\t\t\t calculates [x,y] for area path, adds rect to chart map and renders labels\n\t\t\t */\n\n\t\t\tfor(i=0; i < data.length;i ++){\n\t\t\t\tobj = data[i];\n\n\t\t\t\tif(!i){\n\t\t\t\t\ty = setOffset(i,point1.y);\n\t\t\t\t\tpath.push([x,y]);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tx += params.cellWidth ;\n\t\t\t\t}\n\n\t\t\t\ty = setOffset(i,this._getPointY(obj,point0,point1,params));\n\n\t\t\t\tyPos.push((isNaN(y)&&!i)?(data[i].$startY||point1.y):y);\n\n\t\t\t\tif(y){\n\t\t\t\t\tpath.push([x,y]);\n\n\t\t\t\t\t//map\n\t\t\t\t\tmap.addRect(obj.id,[x-mapRect-point0.x,y-mapRect-point0.y,x+mapRect-point0.x,y+mapRect-point0.y],sIndex);\n\n\t\t\t\t\t//labels\n\t\t\t\t\tif(!config.yAxis){\n\t\t\t\t\t\talign = (!config.offset&&lastItem?\"left\":\"center\");\n\t\t\t\t\t\tthis.canvases[sIndex].renderTextAt(false, align, x, y-config.labelOffset,config.label(obj));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// bottom right point\n\t\t\tpath.push([x,setOffset(i-1,point1.y)]);\n\n\t\t\t// lower border from the end to start\n\t\t\tif(sIndex){\n\t\t\t\tfor(i=data.length-2; i > 0; i --){\n\t\t\t\t\tx -= params.cellWidth ;\n\t\t\t\t\ty = data[i].$startY;\n\t\t\t\t\tif(y)\n\t\t\t\t\t\tpath.push([x,y]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// go to start point\n\t\t\tpath.push([path[0][0],path[0][1]]);\n\n\t\t\t// filling path\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[0]);\n\t\t\tctx.fillStyle = this._settings.color.call(this,data[0]);\n\t\t\tctx.beginPath();\n\t\t\tthis._path(ctx,path);\n\t\t\tctx.fill();\n\n\t\t\t// set y positions of the next series\n\t\t\tfor(i=0; i < data.length;i ++){\n\t\t\t\ty = yPos[i];\n\n\t\t\t\tif(!y){\n\t\t\t\t\tif(i == data.length-1){\n\t\t\t\t\t\ty = data[i].$startY;\n\t\t\t\t\t}\n\t\t\t\t\tfor(j =i+1; j< data.length; j++){\n\t\t\t\t\t\tif(yPos[j]){\n\t\t\t\t\t\t\ta0 = {x:point0.x,y:yPos[0]};\n\t\t\t\t\t\t\ta1 = {x:(point0.x+params.cellWidth*j),y:yPos[j]};\n\t\t\t\t\t\t\ty = solveEquation(point0.x+params.cellWidth*i,a0,a1);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tdata[i].$startY = y;\n\t\t\t}\n\n\n\t\t}\n\t}\n};\n\nexport default AreaChart;","\n\nconst Radar = {\n\t$render_radar:function(ctx,data,x,y,sIndex,map){\n\t\tthis._renderRadarChart(ctx,data,x,y,sIndex,map);\n\t\t\n\t}, \n\t/**\n\t* renders a pie chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: x - the width of the container\n\t* @param: y - the height of the container\n\t* @param: ky - value from 0 to 1 that defines an angle of inclination (02)\n\t\t\tthis._strokeRadarChart(ctx,posArr,data);\n\t\tif(!config.disableItems || data.length<3)\n\t\t\tthis._drawRadarItemMarkers(ctx,posArr,data,sIndex,map);\n\t\tposArr = null;\n\t},\n\t_drawRadarItemMarkers:function(ctx,points,data,sIndex,map){\n\t\tfor(var i=0;i < points.length;i++){\n\t\t\tthis._drawItem(ctx,points[i].x,points[i].y,data[i],this._settings.label.call(this,data),sIndex,map);\n\t\t}\n\t},\n\t_fillRadarChart:function(ctx,points,data){\n\t\tvar pos0,pos1;\n\t\tctx.globalAlpha= this._settings.alpha.call(this,{});\n\n\t\tctx.beginPath();\n\t\tfor(var i=0;i < points.length;i++){\n\t\t\tctx.fillStyle = this._settings.fill.call(this,data[i]);\n\t\t\tpos0 = points[i];\n\t\t\tpos1 = (points[i+1]|| points[0]);\n\t\t\tif(!i){\n\n\t\t\t\tctx.moveTo(pos0.x,pos0.y);\n\t\t\t}\n\t\t\tctx.lineTo(pos1.x,pos1.y);\n\t\t}\n\t\tctx.fill();\n\t\tctx.globalAlpha=1;\n\t},\n\t_strokeRadarChart:function(ctx,points,data){\n\t\tvar pos0,pos1;\n\t\tfor(var i=0;i < points.length;i++){\n\t\t\tpos0 = points[i];\n\t\t\tpos1 = (points[i+1]|| points[0]);\n\t\t\tthis._drawLine(ctx,pos0.x,pos0.y,pos1.x,pos1.y,this._settings.line.color.call(this,data[i]),this._settings.line.width);\n\t\t}\n\t},\n\t_drawRadarAxises:function(ratios,x,y,radius,data){\n\t\tvar configY = this._settings.yAxis;\n\t\tvar configX = this._settings.xAxis;\n\t\tvar start = configY.start;\n\t\tvar end = configY.end;\n\t\tvar step = configY.step;\n\t\tvar scaleParam= {};\n\t\tvar config = this._configYAxis;\n\t\tif(typeof config.step ==\"undefined\"||typeof config.start==\"undefined\"||typeof config.end ==\"undefined\"){\n\t\t\tvar limits = this._getLimits();\n\t\t\tscaleParam = this._calculateScale(limits.min,limits.max);\n\t\t\tstart = scaleParam.start;\n\t\t\tend = scaleParam.end;\n\t\t\tstep = scaleParam.step;\n\t\t\tconfigY.end = end;\n\t\t\tconfigY.start = start;\n\t\t}\n\t\tvar units = [];\n\t\tvar i,j,p;\n\t\tvar c=0;\n\t\tvar stepHeight = radius*step/(end-start);\n\t\t/*correction for small step*/\n\t\tvar power,corr;\n\t\tif(step<1){\n\t\t\tpower = Math.min(this._log10(step),(start<=0?0:this._log10(start)));\n\t\t\tcorr = Math.pow(10,-power);\n\t\t}\n\t\tvar angles = [];\n\t\tif(!this.canvases[\"scale\"])\n\t\t\tthis.canvases[\"scale\"] = this._createCanvas(\"radar_scale\");\n\t\tvar ctx = this.canvases[\"scale\"].getCanvas();\n\t\tfor(i = end; i>=start; i -=step){\n\t\t\tvar value = this._logScaleCalc?Math.pow(10,i):i;\n\t\t\tif(scaleParam.fixNum) value = parseFloat(i).toFixed(scaleParam.fixNum);\n\n\t\t\tunits.push(Math.floor(c*stepHeight)+ 0.5);\n\t\t\tif(corr && !this._logScaleCalc){\n\t\t\t\tvalue = Math.round(value*corr)/corr;\n\t\t\t\ti = value;\n\t\t\t}\n\t\t\tvar unitY = y-radius+units[units.length-1];\n\n\t\t\tthis.canvases[\"scale\"].renderTextAt(\"middle\",\"left\",x,unitY,\n\t\t\t\tconfigY.template(value.toString()),\n\t\t\t\t\"webix_axis_item_y webix_radar\"\n\t\t\t);\n\t\t\tif(ratios.length<2){\n\t\t\t\tthis._drawScaleSector(ctx,\"arc\",x,y,radius-units[units.length-1],-Math.PI/2,3*Math.PI/2,i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar startAlpha = -Math.PI/2;/*possibly need to moved in config*/\n\t\t\tvar alpha0 = startAlpha;\n\t\t\tvar alpha1;\n\n\t\t\tfor(j=0;j< ratios.length;j++){\n\t\t\t\tif(!c)\n\t\t\t\t\tangles.push(alpha0);\n\t\t\t\talpha1 = startAlpha+ratios[j]-0.0001;\n\t\t\t\tthis._drawScaleSector(ctx,(ratios.length>2?(config.lineShape||\"line\"):\"arc\"),x,y,radius-units[units.length-1],alpha0,alpha1,i,j,data[i]);\n\t\t\t\talpha0 = alpha1;\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\t/*renders radius lines and labels*/\n\t\tfor(i=0;i< angles.length;i++){\n\t\t\tp = this._getPositionByAngle(angles[i],x,y,radius);\n\t\t\tif(configX.lines.call(this,data[i],i))\n\t\t\t\tthis._drawLine(ctx,x,y,p.x,p.y,(configX?configX.lineColor.call(this,data[i]):\"#cfcfcf\"),1);\n\t\t\tthis._drawRadarScaleLabel(ctx,x,y,radius,angles[i],(configX?configX.template.call(this,data[i]):\" \"));\n\t\t}\n\n\t},\n\t_drawScaleSector:function(ctx,shape,x,y,radius,a1,a2,i,j){\n\t\tvar pos1, pos2;\n\t\tif(radius<0)\n\t\t\treturn false;\n\t\tpos1 = this._getPositionByAngle(a1,x,y,radius);\n\t\tpos2 = this._getPositionByAngle(a2,x,y,radius);\n\t\tvar configY = this._settings.yAxis;\n\t\tif(configY.bg){\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(x,y);\n\t\t\tif(shape==\"arc\")\n\t\t\t\tctx.arc(x,y,radius,a1,a2,false);\n\t\t\telse{\n\t\t\t\tctx.lineTo(pos1.x,pos1.y);\n\t\t\t\tctx.lineTo(pos2.x,pos2.y);\n\t\t\t}\n\t\t\tctx.fillStyle = configY.bg(i,j);\n\t\t\tctx.moveTo(x,y);\n\t\t\tctx.fill();\n\t\t\tctx.closePath();\n\t\t}\n\t\tif(configY.lines.call(this,i)){\n\t\t\tctx.lineWidth = 1;\n\t\t\tctx.beginPath();\n\t\t\tif(shape==\"arc\")\n\t\t\t\tctx.arc(x,y,radius,a1,a2,false);\n\t\t\telse{\n\t\t\t\tctx.moveTo(pos1.x,pos1.y);\n\t\t\t\tctx.lineTo(pos2.x,pos2.y);\n\t\t\t}\n\t\t\tctx.strokeStyle = configY.lineColor.call(this,i);\n\t\t\tctx.stroke();\n\t\t}\n\t},\n\t_drawRadarScaleLabel:function(ctx,x,y,r,a,text){\n\t\tif(!text)\n\t\t\treturn false;\n\t\tvar t = this.canvases[\"scale\"].renderText(0,0,text,\"webix_axis_radar_title\",1);\n\t\tvar width = t.scrollWidth;\n\t\tvar height = t.offsetHeight;\n\t\tvar delta = 0.001;\n\t\tvar pos = this._getPositionByAngle(a,x,y,r+5);\n\t\tvar corr_x=0,corr_y=0;\n\t\tif(a<0||a>Math.PI){\n\t\t\tcorr_y = -height;\n\t\t}\n\t\tif(a>Math.PI/2){\n\t\t\tcorr_x = -width;\n\t\t}\n\t\tif(Math.abs(a+Math.PI/2)2){\n\t\t\t\t\t\tthis._drawLine(ctx,x2,y2,items[0].x,items[0].y,color,config.line.width);\n\t\t\t\t\t\t//render shape on top of the line\n\t\t\t\t\t\tif(!config.disableItems)\n\t\t\t\t\t\t\tthis._drawScatterItem(ctx,map, items[0],data[0],sIndex);\n\t\t\t\t\t\tif(config.fill)\n\t\t\t\t\t\t\tthis._fillScatterChart(ctx, items, data);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// line between two points\n\t\t\t\t\tx2 = items[i+1].x;\n\t\t\t\t\ty2 = items[i+1].y;\n\t\t\t\t\tthis._drawLine(ctx,x1,y1,x2,y2,color,config.line.width);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//item\n\t\t\tif(!config.disableItems && items[i]){\n\t\t\t\tthis._drawScatterItem(ctx,map, items[i],data[di],sIndex);\n\t\t\t}\n\t\t}\n\t},\n\t_fillScatterChart:function(ctx,points,data){\n\t\tvar pos0,pos1;\n\t\tctx.globalAlpha= this._settings.alpha.call(this,{});\n\n\t\tctx.beginPath();\n\t\tfor(var i=0;i < points.length;i++){\n\t\t\tctx.fillStyle = this._settings.fill.call(this,data[i]);\n\t\t\tpos0 = points[i];\n\t\t\tpos1 = (points[i+1]|| points[0]);\n\t\t\tif(!i){\n\t\t\t\tctx.moveTo(pos0.x,pos0.y);\n\t\t\t}\n\t\t\tctx.lineTo(pos1.x,pos1.y);\n\t\t}\n\t\tctx.fill();\n\t\tctx.globalAlpha=1;\n\t},\n\t_getScatterParams:function(ctx, data, point0, point1,limitsX,limitsY){\n\t\tvar params = {};\n\t\t/*available space*/\n\t\tparams.totalHeight = point1.y-point0.y;\n\t\t/*available width*/\n\t\tparams.totalWidth = point1.x-point0.x;\n\t\t/*unit calculation (y_position = value*unit)*/\n\t\tthis._calcScatterUnit(params,limitsX.min,limitsX.max,params.totalWidth,\"X\");\n\t\tthis._calcScatterUnit(params,limitsY.min,limitsY.max,params.totalHeight,\"Y\");\n\t\treturn params;\n\t},\n\t_drawScatterItem:function(ctx,map,item,obj,sIndex){\n\t\tthis._drawItem(ctx,item.x,item.y,obj,this._settings.label.call(this,obj),sIndex,map);\n\t},\n\t_calculateScatterItemPosition:function(params, point0, point1, limits, obj, axis){\n\t\t/*the real value of an object*/\n\t\tvar value = this._settings[axis==\"X\"?\"xValue\":\"value\"].call(this,obj);\n\t\t/*a relative value*/\n\t\tvar valueFactor = params[\"valueFactor\"+axis];\n\t\tvar v = (parseFloat(value||0) - limits.min)*valueFactor;\n\t\t/*a vertical coordinate*/\n\t\tvar unit = params[\"unit\"+axis];\n\t\tvar pos = point1[axis.toLowerCase()] - (axis==\"X\"?(-1):1)*Math.floor(unit*v);\n\t\t/*the limit of the minimum value is the minimum visible value*/\n\t\tif(v<0)\n\t\t\tpos = point1[axis.toLowerCase()];\n\t\t/*the limit of the maximum value*/\n\t\tif(value > limits.max)\n\t\t\tpos = point0[axis.toLowerCase()];\n\t\t/*the limit of the minimum value*/\n\t\tif(value < limits.min)\n\t\t\tpos = point1[axis.toLowerCase()];\n\t\treturn pos;\n\t},\n\t_calcScatterUnit:function(p,min,max,size,axis){\n\t\tvar relativeValues = this._getRelativeValue(min,max);\n\t\taxis = (axis||\"\");\n\t\tp[\"relValue\"+axis] = relativeValues[0];\n\t\tp[\"valueFactor\"+axis] = relativeValues[1];\n\t\tp[\"unit\"+axis] = (p[\"relValue\"+axis]?size/p[\"relValue\"+axis]:10);\n\t}\n};\n\nexport default Scatter;","\n\nconst SplineArea = {\n\t/**\n\t * renders an splineArea chart\n\t * @param: ctx - canvas object\n\t * @param: data - object those need to be displayed\n\t * @param: width - the width of the container\n\t * @param: height - the height of the container\n\t * @param: sIndex - index of drawing chart\n\t */\n\t$render_splineArea:function(ctx, data, point0, point1, sIndex, map){\n\t\tvar color, i,items,j,mapRect,params,sParams,\n\t\t\tx,x0,x1,x2,y,y2,\n\t\t\tconfig = this._settings,\n\t\t\tpath = [];\n\n\t\tparams = this._calculateLineParams(ctx,data,point0,point1,sIndex);\n\t\tmapRect = (config.eventRadius||Math.floor(params.cellWidth/2));\n\t\t/*array of all points*/\n\t\titems = [];\n\n\t\tif (data.length) {\n\t\t\t/*getting all points*/\n\t\t\tx0 = point0.x;\n\t\t\tfor(i=0; i < data.length;i ++){\n\t\t\t\ty = this._getPointY(data[i],point0,point1,params);\n\t\t\t\tif(y || y==\"0\"){\n\t\t\t\t\tx = ((!i)?x0:params.cellWidth*i - 0.5 + x0);\n\t\t\t\t\titems.push({x:x,y:y,index:i});\n\t\t\t\t\tmap.addRect(data[i].id,[x-mapRect-point0.x,y-mapRect-point0.y,x+mapRect-point0.x,y+mapRect-point0.y],sIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tsParams = this._getSplineParameters(items);\n\n\t\t\tfor(i =0; i< items.length; i++){\n\t\t\t\tx1 = items[i].x;\n\t\t\t\tif(ipoint1.y)\n\t\t\t\t\t\t\tsY1=point1.y;\n\t\t\t\t\t\tvar sY2 = this._getSplineYPoint(j+1,x1,i,sParams.a,sParams.b,sParams.c,sParams.d);\n\t\t\t\t\t\tif(sY2point1.y)\n\t\t\t\t\t\t\tsY2=point1.y;\n\t\t\t\t\t\tpath.push([j,sY1]);\n\t\t\t\t\t\tpath.push([j+1,sY2]);\n\t\t\t\t\t}\n\t\t\t\t\tpath.push([x2,y2]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcolor = this._settings.color.call(this,data[0]);\n\n\t\t\tif(path.length){\n\t\t\t\tpath.push([x2,point1.y]);\n\t\t\t\tpath.push([path[0][0],point1.y]);\n\t\t\t}\n\n\t\t\t//filling area\n\t\t\tctx.globalAlpha = this._settings.alpha.call(this,data[0]);\n\t\t\tctx.fillStyle = color;\n\t\t\tctx.beginPath();\n\t\t\tthis._path(ctx,path);\n\t\t\tctx.fill();\n\t\t\tctx.lineWidth = 1;\n\t\t\tctx.globalAlpha =1;\n\n\t\t\t// draw line\n\t\t\tif(config.border){\n\t\t\t\tctx.lineWidth = config.borderWidth||1;\n\t\t\t\tif(config.borderColor)\n\t\t\t\t\tctx.strokeStyle = config.borderColor.call(this,data[0]);\n\t\t\t\telse\n\t\t\t\t\tthis._setBorderStyles(ctx,color);\n\t\t\t\tctx.beginPath();\n\t\t\t\tpath.splice(path.length-3);\n\t\t\t\tthis._path(ctx,path);\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default SplineArea;","import {remove} from \"../../webix/html\";\n\n\nvar animateDuration = 400,\n\tcellWidth = 30;\n\nconst DynamicChart = {\n\tdynamic_setter: function(value){\n\t\tif(value)\n\t\t\tinit(this);\n\t\treturn value;\n\t}\n};\n\n/**\n * Sets event handlers and properties for a stock chart\n * @param {object} chart - chart view\n */\nfunction init(chart){\n\tif(chart._stockRenderHandler)\n\t\treturn;\n\tvar config = chart._settings;\n\n\tif(!config.cellWidth)\n\t\tconfig.cellWidth = cellWidth;\n\tif(!config.animateDuration)\n\t\tconfig.animateDuration = animateDuration;\n\tconfig.offset = false;\n\n\tchart._stockRenderHandler = chart.attachEvent(\"onBeforeRender\", function(data, type){\n\t\tvar bounds = chart._getChartBounds(chart._content_width, chart._content_height);\n\t\tresizeStockCanvases(chart);\n\t\tfilterStockData(data, bounds.start, bounds.end, config.cellWidth);\n\t\tif(type == \"add\")\n\t\t\tstartAnimation(chart);\n\t});\n\tchart._stockXAxisHandler = chart.attachEvent(\"onBeforeXAxis\", function(ctx,data,point0,point1,cellWidth,y){\n\t\tdrawXAxis(chart,ctx,data,point0,point1,cellWidth,y);\n\t\treturn false;\n\t});\n}\n\n/**\n * Starts stock animation\n * @param {object} chart - chart view\n */\nfunction startAnimation(chart){\n\tvar cellWidth = chart._settings.cellWidth;\n\tif(chart._stockAnimationOffset != cellWidth){\n\t\tchart._stockAnimationOffset = cellWidth;\n\t\tchart.render();\n\t}\n\n\tchart._stockAnimationOffset = 0;\n\tchart._stockAnimationStart = null;\n\n\tif(window.requestAnimationFrame && !document.hidden)\n\t\twindow.requestAnimationFrame(function(t){\n\t\t\tanimate(chart,t);\n\t\t});\n\n\tif(!chart._stockAnimateHandler)\n\t\tchart._stockAnimateHandler = chart.attachEvent(\"onAfterRender\", function(data){\n\t\t\tapplyStockOffset(chart, data);\n\t\t});\n}\n\n/**\n * Animates a chart\n * @param {object} chart - chart view\n * @param {number} timestamp - timestamp\n */\nfunction animate(chart, timestamp){\n\tvar progress,\n\t\tduration = chart._settings.animateDuration,\n\t\tcellWidth = chart._settings.cellWidth;\n\n\tif(cellWidth && chart.count() > 1){\n\t\tif (!chart._stockAnimationStart)\n\t\t\tchart._stockAnimationStart = timestamp;\n\t\tprogress = timestamp - chart._stockAnimationStart;\n\t\tchart._stockAnimationOffset = Math.min(Math.max(progress/duration*cellWidth,1), cellWidth);\n\t\tchart.render();\n\t\tif (progress < duration)\n\t\t\twindow.requestAnimationFrame(function(t){\n\t\t\t\tanimate(chart,t);\n\t\t\t});\n\t}\n}\n\n/**\n * Applies animation offset to \"series\" and \"x-axis\" canvases\n * @param {object} chart - chart view\n * @param {object} data - data array\n */\nfunction applyStockOffset(chart, data){\n\tvar count = chart.count(),\n\t\tbounds = chart._getChartBounds(chart._content_width,chart._content_height),\n\t\tcellWidth = chart._settings.cellWidth,\n\t\toffset = chart._stockAnimationOffset || 0,\n\t\tisScroll = (data.length < count || (data.length-1)*cellWidth > bounds.end.x-bounds.start.x);\n\n\tfunction setCanvasOffset(canvas, x0, x1, skipRight){\n\t\tvar ctx = canvas.getCanvas(),\n\t\t\telem = canvas._canvas,\n\t\t\tlabels = canvas._canvas_labels,\n\t\t\tseries = canvas._canvas_series;\n\n\n\t\t// if we need to display less values than they are\n\t\tif(offset && (data.length < count || (data.length-1)*cellWidth > x1-x0)){\n\t\t\t// move canvas to the left\n\t\t\telem.style.left = - offset + \"px\";\n\t\t\tif(data.length > 1){\n\t\t\t\tsetLabelsOffset(labels, offset, series);\n\t\t\t\t// clear out of the scale parts\n\t\t\t\tctx.clearRect(0, 0, x0+offset, elem.offsetHeight);\n\t\t\t\tctx.clearRect(x1+offset, 0, elem.offsetWidth, elem.offsetHeight);\n\t\t\t}\n\t\t}\n\t\t// animation for the right part (added item)\n\t\telse{\n\t\t\telem.style.left = \"0px\";\n\t\t\tif(!skipRight && offset!= cellWidth)\n\t\t\t\tctx.clearRect(x0+(data.length-1)*cellWidth-cellWidth+offset, 0, elem.offsetWidth, elem.offsetHeight);\n\t\t}\n\n\t\t// show label for the last label after finishing animation\n\t\tif(labels.length>1 && offset && offset != cellWidth){\n\t\t\tvar last = labels.length-1;\n\t\t\tif(isAxisTitle(series, labels[last]))\n\t\t\t\tlast -= 1;\n\t\t\tlabels[last].style.display = \"none\";\n\t\t}\n\t\t\t\n\t}\n\n\teachStockCanvas(chart,function(name, canvas){\n\t\tsetCanvasOffset(canvas, bounds.start.x, bounds.end.x, name == \"x\");\n\t});\n\n\tsetHtmlMapSizes(chart,bounds, isScroll?offset:0);\n}\n\nfunction isAxisTitle(series, label){\n\treturn series ===\"axis_x\" && label.className.indexOf(\"webix_axis_title_x\") !== -1;\n}\n\nfunction setLabelsOffset(labels, offset, series){\n\tif(labels.length){\n\n\t\tremove(labels[0]);\n\t\tfor(var i = 1; i< labels.length; i++){\n\t\t\t//don't move axis title\n\t\t\tif(isAxisTitle(series, labels[i])) continue;\n\t\t\tlabels[i].style.left = labels[i].offsetLeft - offset + \"px\";\n\t\t}\n\t\t\t\n\t}\n}\n\n/**\n * Gets visible chart data\n * @param {object} data - an array with all chart data\n * @param {object} point0 - a top left point of a plot\n * @param {object} point1 - a bottom right point of a plot\n * @param {number} cellWidth - a unit width\n */\nfunction filterStockData(data, point0, point1, cellWidth){\n\tif(cellWidth && data.length){\n\t\tvar limit = Math.ceil((point1.x - point0.x)/cellWidth);\n\t\tif(data.length > limit+1)\n\t\t\tdata.splice(0, data.length - limit-1);\n\t}\n}\n\n/**\n * Calls a function for \"series\" and \"x-axis\" canvases\n * @param {object} chart - chart view\n * @param {function} func - function to call\n */\nfunction eachStockCanvas(chart, func){\n\tif(chart.canvases){\n\t\tfor(var i=0; i < chart._series.length;i++)\n\t\t\tif (chart.canvases[i])\n\t\t\t\tfunc(i,chart.canvases[i]);\n\n\t\tif (chart.canvases[\"x\"])\n\t\t\tfunc(\"x\",chart.canvases[\"x\"]);\n\t}\n}\n\n/**\n * Set sizes for animated canvases\n * @param {object} chart - chart view\n */\nfunction resizeStockCanvases(chart){\n\teachStockCanvas(chart, function(name, canvas){\n\t\tcanvas._resizeCanvas(chart._content_width+2*chart._settings.cellWidth, chart._content_height);\n\t});\n}\n\n/**\n * Set sizes for an html map of a chart\n * @param {object} chart - a chart view\n * @param {object} bounds - start and end points of a plot\n * @param {number} offset - an offset to apply\n */\nfunction setHtmlMapSizes(chart, bounds, offset){\n\tchart._contentobj._htmlmap.style.left = (bounds.start.x - offset)+\"px\";\n\tchart._contentobj._htmlmap.style.width = (bounds.end.x-bounds.start.x+offset)+\"px\";\n}\n\n/**\n * Renders lines and labels of an x-axis\n * @param {object} chart - a chart view\n * @param {object} ctx - a canvas Context\n * @param {object} data - a data array\n * @param {object} point0 - a top left point of a plot\n * @param {object} point1 - a bottom right point of a plot\n * @param {number} cellWidth - a width of a unit\n * @param {number} y - the vertical position of an \"x-axis\" line\n */\nfunction drawXAxis(chart, ctx, data,point0,point1,cellWidth,y){\n\tvar center, i, isScroll,unitPos,\n\t\tconfig = chart._settings,\n\t\tx0 = point0.x-0.5,\n\t\ty0 = parseInt((y?y:point1.y),10)+0.5,\n\t\tx1 = point1.x;\n\n\tif(!config.dynamic)\n\t\treturn false;\n\n\tisScroll = ((data.length-1)*cellWidth > x1-x0 || data.length < chart.count());\n\n\tfor(i=0; i < data.length;i++){\n\t\tunitPos = x0+i*cellWidth ;\n\t\tcenter = isScroll?i>1:!!i;\n\t\tunitPos = Math.ceil(unitPos)-0.5;\n\t\t//scale labels\n\t\tchart._drawXAxisLabel(unitPos,y0,data[i],center);\n\t\t//draws a vertical line for the horizontal scale\n\t\tif(i && config.xAxis.lines.call(chart, data[i]))\n\t\t\tchart._drawXAxisLine(ctx,unitPos,point1.y,point0.y,data[i]);\n\n\t}\n\n\tchart.canvases[\"x\"].renderTextAt(true, false, x0, point1.y + config.padding.bottom-3,\n\t\tconfig.xAxis.title,\n\t\t\"webix_axis_title_x\",\n\t\tpoint1.x - point0.x\n\t);\n\tchart._drawLine(ctx,x0,y0,x1+ (isScroll?chart._stockAnimationOffset:0),y0,config.xAxis.color,1);\n}\n\n\nexport default DynamicChart;","import base from \"../views/view\";\nimport template from \"../webix/template\";\nimport color from \"../webix/color\";\nimport env from \"../webix/env\";\nimport i18n from \"../webix/i18n\";\n\nimport Group from \"../core/group\";\nimport AutoTooltip from \"../core/autotooltip\";\nimport DataLoader from \"../core/dataloader\";\nimport MouseEvents from \"../core/mouseevents\";\nimport EventSystem from \"../core/eventsystem\";\nimport Destruction from \"../core/destruction\";\nimport HtmlMap from \"../core/htmlmap\";\nimport Canvas from \"../core/canvas\";\nimport GroupMethods from \"../core/groupmethods\";\n\nimport {locate, offset as getOffset, pos as getPos, create} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {bind, extend, isUndefined} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\n\nimport Pie from \"./chart/pie\";\nimport Bar from \"./chart/bar\";\nimport Line from \"./chart/line\";\nimport BarH from \"./chart/barh\";\nimport StackedBar from \"./chart/stackedbar\";\nimport StackedBarH from \"./chart/stackedbarh\";\nimport Spline from \"./chart/spline\";\nimport Area from \"./chart/area\";\nimport Radar from \"./chart/radar\";\nimport Scatter from \"./chart/scatter\";\nimport Presets from \"./chart/presets\";\nimport SplineArea from \"./chart/splinearea\";\nimport DynamicChart from \"./chart/dynamic\";\n\nconst api = {\n\tname:\"chart\",\n\t$init:function(config){\n\t\tthis._series = [this._settings];\n\t\tthis._legend_labels = [];\n\t\tthis._contentobj.className += \" webix_chart\";\n\t\tthis.$ready.push(this._after_init_call);\n\t\t/*preset*/\n\t\tif(config.preset){\n\t\t\tthis._definePreset(config);\n\t\t}\n\n\t\t// move series to end of configuration properties hash\n\t\t// so it will be parsed after other settings\n\t\tif(config.series){\n\t\t\tvar series = config.series;\n\t\t\tdelete config.series;\n\t\t\tconfig.series = series;\n\t\t}\n\n\t\tthis.attachEvent(\"onMouseMove\",this._switchSeries);\n\n\t\tthis.data.provideApi(this, true);\n\t},\n\t_after_init_call:function(){\n\t\tthis.data.attachEvent(\"onStoreUpdated\",bind(function(){\n\t\t\tthis.render.apply(this,arguments);\n\t\t},this));\n\t},\n\tdefaults:{\n\t\tariaLabel:\"chart\",\n\t\tcolor:\"default\",\n\t\talpha:\"1\",\n\t\tradius:0,\n\t\tlabel:false,\n\t\tvalue:\"{obj.value}\",\n\t\tpadding:{},\n\t\ttype:\"pie\",\n\t\tlineColor:\"#ffffff\",\n\t\tcant:0.5,\n\t\tbarWidth: 30,\n\t\tline:{\n\t\t\twidth:2,\n\t\t\tcolor:\"#1ca1c1\"\n\t\t},\n\t\titem:{\n\t\t\tradius:3,\n\t\t\tborderColor:\"#1ca1c1\",\n\t\t\tborderWidth:2,\n\t\t\tcolor: \"#ffffff\",\n\t\t\talpha:1,\n\t\t\ttype:\"r\",\n\t\t\tshadow:false\n\t\t},\n\t\tshadow:false,\n\t\tgradient:false,\n\t\tborder:false,\n\t\tlabelOffset: 20,\n\t\torigin:\"auto\",\n\t\tscale: \"linear\"\n\t},\n\t_id:\"webix_area_id\",\n\ton_click:{\n\t\twebix_chart_legend_item: function(e,id,obj){\n\t\t\tvar series = obj.getAttribute(\"series_id\");\n\t\t\tif(this.callEvent(\"onLegendClick\",[e,series,obj])){\n\t\t\t\tif((typeof series != \"undefined\")&&this._series.length>1){\n\t\t\t\t\tvar config = this._settings;\n\t\t\t\t\tvar values = config.legend.values;\n\t\t\t\t\tvar toggle = (values&&values[series].toggle)||config.legend.toggle;\n\n\t\t\t\t\t// hide action\n\t\t\t\t\tif(toggle){\n\t\t\t\t\t\tif(obj.className.indexOf(\"hidden\")!=-1){\n\t\t\t\t\t\t\tthis.showSeries(series);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tthis.hideSeries(series);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\ton_dblclick:{\n\t},\n\ton_mouse_move:{\n\t},\n\tlocate: function(e){\n\t\treturn locate(e,this._id);\n\t},\n\t$setSize:function(x,y){\n\t\tvar res = base.api.$setSize.call(this,x,y);\n\t\tif(res){\n\t\t\tfor(var c in this.canvases){\n\t\t\t\tthis.canvases[c]._resizeCanvas(this._content_width, this._content_height);\n\t\t\t}\n\t\t\tthis.render();\n\t\t}\n\t\treturn res;\n\t},\n\ttype_setter:function(val){\n\t\tassert(this[\"$render_\"+val], \"Chart type is not supported, or extension is not loaded: \"+val);\n\t\t\n\t\tif (typeof this._settings.offset == \"undefined\"){\n\t\t\tthis._settings.offset = !(val.toLowerCase().indexOf(\"area\")!=-1);\n\t\t}\n\n\t\tif(val==\"radar\"&&!this._settings.yAxis)\n\t\t\tthis.define(\"yAxis\",{});\n\t\tif(val==\"scatter\"){\n\t\t\tif(!this._settings.yAxis)\n\t\t\t\tthis.define(\"yAxis\",{});\n\t\t\tif(!this._settings.xAxis)\n\t\t\t\tthis.define(\"xAxis\",{});\n\t\t}\n\t\t\t\n\t\t\t\n\t\treturn val;\n\t},\n\tdestructor: function(){\n\t\tthis.removeAllSeries();\n\t\tDestruction.destructor.apply(this,arguments);\n\t},\n\tremoveAllSeries: function(){\n\t\tthis.clearCanvas();\n\t\tif(this._legendObj){\n\t\t\tthis._legendObj.innerHTML = \"\";\n\t\t\tthis._legendObj.parentNode.removeChild(this._legendObj);\n\t\t\tthis._legendObj = null;\n\t\t}\n\t\tif(this.canvases){\n\t\t\tthis.canvases = {};\n\t\t}\n\t\tthis._contentobj.innerHTML=\"\";\n\t\tfor(var i = 0; i < this._series.length; i++){\n\t\t\tif(this._series[i].tooltip)\n\t\t\t\tthis._series[i].tooltip.destructor();\n\t\t}\n\t\t//\tthis.callEvent(\"onDestruct\",[]);\n\t\tthis._series = [];\n\t},\n\tclearCanvas:function(){\n\t\tif(this.canvases&&typeof this.canvases == \"object\")\n\t\t\tfor(var c in this.canvases){\n\t\t\t\tthis.canvases[c].clearCanvas();\n\t\t\t}\n\t},\n\trender:function(id, changes, type){\n\t\tvar bounds, data, map, temp;\n\t\tif (!this.isVisible(this._settings.id))\n\t\t\treturn;\n\n\t\tdata = this._getChartData();\n\n\t\tif (!this.callEvent(\"onBeforeRender\",[data, type]))\n\t\t\treturn;\n\t\t\n\t\tif(this.canvases&&typeof this.canvases == \"object\"){\n\t\t\tfor(const i in this.canvases){\n\t\t\t\tthis.canvases[i].clearCanvas();\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tthis.canvases = {};\n\t\t\n\t\tif(this._settings.legend){\n\t\t\tif(!this.canvases[\"legend\"])\n\t\t\t\tthis.canvases[\"legend\"] = this._createCanvas(\"legend\");\n\t\t\tthis._drawLegend(\n\t\t\t\tthis.data.getRange(),\n\t\t\t\tthis._content_width,\n\t\t\t\tthis._content_height\n\t\t\t);\n\t\t}\n\n\t\tthis._map = map = new HtmlMap(this._id);\n\t\ttemp = this._settings;\n\n\t\tbounds =this._getChartBounds(this._content_width,this._content_height);\n\n\t\tif(this._series){\n\t\t\tfor(let i=0; i < this._series.length;i++){\n\t\t\t\tthis._settings = this._series[i];\n\t\t\t\tif(!this.canvases[i])\n\t\t\t\t\tthis.canvases[i] = this._createCanvas(this.name+\" \"+i,\"z-index:\"+(2+i),null,i, this._settings.ariaLabel);\n\t\t\t\tthis[\"$render_\"+this._settings.type](\n\t\t\t\t\tthis.canvases[i].getCanvas(),\n\t\t\t\t\tdata,\n\t\t\t\t\tbounds.start,\n\t\t\t\t\tbounds.end,\n\t\t\t\t\ti,\n\t\t\t\t\tmap\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tmap.render(this._contentobj);\n\t\t\n\t\tthis._contentobj.lastChild.style.zIndex = 100;\n\t\tthis._applyBounds(this._contentobj.lastChild,bounds);\n\t\tthis.callEvent(\"onAfterRender\",[data]);\n\t\tthis._settings = temp;\n\n\t\t// hide hidden series\n\t\tif(this._settings.legend && this._settings.legend.values){\n\t\t\tvar series = this._settings.legend.values;\n\t\t\tfor(let i = 0; i count){\n\t\t\t\tif(i){\n\t\t\t\t\tif(i < colorsCount - count)\n\t\t\t\t\t\ti = this._defColorsCursor +2;\n\t\t\t\t\telse\n\t\t\t\t\t\ti = this._defColorsCursor+1;\n\t\t\t\t}\n\t\t\t\tthis._defColorsCursor = i;\n\t\t\t}\n\t\t\telse\n\t\t\t\ti = i%colorsCount;\n\t\t\treturn this._defColors[i];\n\t\t}\n\t},\n\tcolor_setter:function(value){\n\t\treturn this.colormap[value]||template( value);\n\t},\n\tfill_setter:function(value){\n\t\treturn ((!value||value==\"0\")?false:template( value));\n\t},\n\t_definePreset:function(obj){\n\t\tthis.define(\"preset\",obj.preset);\n\t\tdelete obj.preset;\n\t},\n\tpreset_setter:function(value){\n\t\tvar a, b, preset;\n\t\tthis.defaults = extend({},this.defaults);\n\t\tpreset = this.presets[value];\n\n\t\tif(typeof preset == \"object\"){\n\n\t\t\tfor(a in preset){\n\n\t\t\t\tif(typeof preset[a]==\"object\"){\n\t\t\t\t\tif(!this.defaults[a]||typeof this.defaults[a]!=\"object\"){\n\t\t\t\t\t\tthis.defaults[a] = extend({},preset[a]);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tthis.defaults[a] = extend({},this.defaults[a]);\n\t\t\t\t\t\tfor(b in preset[a]){\n\t\t\t\t\t\t\tthis.defaults[a][b] = preset[a][b];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tthis.defaults[a] = preset[a];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t\treturn false;\n\t},\n\tlegend_setter:function( config){\n\t\tif(!config){\n\t\t\tif(this._legendObj){\n\t\t\t\tthis._legendObj.innerHTML = \"\";\n\t\t\t\tthis._legendObj = null;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif(typeof(config)!=\"object\")\t//allow to use template string instead of object\n\t\t\tconfig={template:config};\n\n\t\tthis._mergeSettings(config,{\n\t\t\twidth:150,\n\t\t\theight:18,\n\t\t\tlayout:\"y\",\n\t\t\talign:\"left\",\n\t\t\tvalign:\"bottom\",\n\t\t\ttemplate:\"\",\n\t\t\ttoggle:(this._settings.type.toLowerCase().indexOf(\"stacked\")!=-1?\"\":\"hide\"),\n\t\t\tmarker:{\n\t\t\t\ttype:\"square\",\n\t\t\t\twidth:15,\n\t\t\t\theight:15,\n\t\t\t\tradius:3\n\t\t\t},\n\t\t\tmargin: 4,\n\t\t\tpadding: 3\n\t\t});\n\n\t\tconfig.template = template(config.template);\n\t\treturn config;\n\t},\n\titem_setter:function( config){\n\t\tif(typeof(config)!=\"object\")\n\t\t\tconfig={color:config, borderColor:config};\n\t\tthis._mergeSettings(config,extend({},this.defaults.item));\n\t\tvar settings = [\"alpha\",\"borderColor\",\"color\",\"radius\", \"type\"];\n\t\tthis._converToTemplate(settings,config);\n\t\treturn config;\n\t},\n\tline_setter:function( config){\n\t\tif(typeof(config)!=\"object\")\n\t\t\tconfig={color:config};\n\n\t\tconfig = extend(config,this.defaults.line);\n\t\tconfig.color = template(config.color);\n\t\treturn config;\n\t},\n\tpadding_setter:function( config){\n\t\tif(typeof(config)!=\"object\")\n\t\t\tconfig={left:config, right:config, top:config, bottom:config};\n\t\tthis._mergeSettings(config,{\n\t\t\tleft:50,\n\t\t\tright:20,\n\t\t\ttop:35,\n\t\t\tbottom:40\n\t\t});\n\t\treturn config;\n\t},\n\txAxis_setter:function( config){\n\t\tif(!config) return false;\n\t\tif(typeof(config)!=\"object\")\n\t\t\tconfig={ template:config };\n\n\t\tthis._mergeSettings(config,{\n\t\t\ttitle:\"\",\n\t\t\tcolor:\"#edeff0\",\n\t\t\tlineColor:\"#edeff0\",\n\t\t\ttemplate:\"{obj}\",\n\t\t\tlines:true\n\t\t});\n\t\tvar templates = [\"lineColor\",\"template\",\"lines\"];\n\t\tthis._converToTemplate(templates,config);\n\t\tthis._configXAxis = extend({},config);\n\t\treturn config;\n\t},\n\tyAxis_setter:function( config){\n\t\tthis._mergeSettings(config,{\n\t\t\ttitle:\"\",\n\t\t\tcolor:\"#edeff0\",\n\t\t\tlineColor:\"#edeff0\",\n\t\t\ttemplate:\"{obj}\",\n\t\t\tlines:true,\n\t\t\tbg:\"#ffffff\"\n\t\t});\n\t\tvar templates = [\"lineColor\",\"template\",\"lines\",\"bg\"];\n\t\tthis._converToTemplate(templates,config);\n\t\tthis._configYAxis = extend({},config);\n\t\treturn config;\n\t},\n\t_converToTemplate:function(arr,config){\n\t\tfor(var i=0;i< arr.length;i++){\n\t\t\tconfig[arr[i]] = template(config[arr[i]]);\n\t\t}\n\t},\n\t_createCanvas: function(name,style,container, index, title){\n\t\tvar params = {container:(container||this._contentobj),name:name, title:isUndefined(title)?name:title||\"\", series: index, style:(style||\"\"), width: this._content_width, height:this._content_height };\n\t\treturn new Canvas(params);\n\t},\n\t_drawScales:function(data,point0,point1,start,end,cellWidth){\n\t\tvar ctx, y = 0;\n\t\tif(this._settings.yAxis){\n\t\t\tif(!this.canvases[\"y\"])\n\t\t\t\tthis.canvases[\"y\"] = this._createCanvas(\"axis_y\");\n\n\t\t\ty = this._drawYAxis(this.canvases[\"y\"].getCanvas(),data,point0,point1,start,end);\n\t\t}\n\t\tif (this._settings.xAxis){\n\t\t\tif (!this.canvases[\"x\"])\n\t\t\t\tthis.canvases[\"x\"] = this._createCanvas(\"axis_x\");\n\t\t\tctx = this.canvases[\"x\"].getCanvas();\n\t\t\tif(this.callEvent(\"onBeforeXAxis\",[ctx,data,point0,point1,cellWidth,y]))\n\t\t\t\tthis._drawXAxis(ctx, data, point0, point1, cellWidth, y);\n\t\t}\n\t\treturn y;\n\t},\n\t_drawXAxis:function(ctx,data,point0,point1,cellWidth,y){\n\t\tvar i, unitPos,\n\t\t\tconfig = this._settings,\n\t\t\tx0 = point0.x-0.5,\n\t\t\ty0 = parseInt((y?y:point1.y),10)+0.5,\n\t\t\tx1 = point1.x,\n\t\t\tcenter = true,\n\t\t\tlabelY = config.type == \"stackedBar\"?(point1.y+0.5):y0;\n\n\t\tfor(i=0; i < data.length;i++){\n\t\t\tif(config.offset === true)\n\t\t\t\tunitPos = x0+cellWidth/2+i*cellWidth;\n\t\t\telse{\n\t\t\t\tunitPos = (i==data.length-1 && !config.cellWidth)?point1.x:x0+i*cellWidth;\n\t\t\t\tcenter = !!i;\n\t\t\t}\n\t\t\tunitPos = Math.ceil(unitPos)-0.5;\n\t\t\t/*scale labels*/\n\t\t\tvar top = ((config.origin!=\"auto\")&&(config.type==\"bar\")&&(parseFloat(config.value(data[i]))5?10:5);\n\t\treturn parseInt(stepVal,10)*calculStep;\t\n\t},\n\t_calculateScale:function(nmin,nmax){\n\t\tthis._logScaleCalc = false;\n\t\tif(this._settings.scale == \"logarithmic\"){\n\t\t\tvar logMin = Math.floor(this._log10(nmin));\n\t\t\tvar logMax = Math.ceil(this._log10(nmax));\n\t\t\tif(nmin>0 && nmax > 0 && (logMax-logMin>1) ){\n\t\t\t\tthis._logScaleCalc = true;\n\t\t\t\treturn this._calculateLogScale(nmin,nmax);\n\t\t\t}\n\n\t\t}\n\t\tif(this._settings.origin!=\"auto\"&&this._settings.originMath.abs(nmin))\n\t\t\tstart = (nmin<0?-step:0);\n\t\telse{\n\t\t\tvar absNmin = Math.abs(nmin);\n\t\t\tvar powerStart = Math.floor(this._log10(absNmin));\n\t\t\tvar nminVal = absNmin/Math.pow(10,powerStart);\n\t\t\tstart = Math.ceil(nminVal*10)/10*Math.pow(10,powerStart)-step;\n\t\t\tif(absNmin>1&&step>0.1){\n\t\t\t\tstart = Math.ceil(start);\n\t\t\t}\n\t\t\twhile(nmin<0?start<=nmin:start>=nmin)\n\t\t\t\tstart -= step;\n\t\t\tif(nmin<0) start =-start-2*step;\n\t\t\t\n\t\t}\n\t\tif ((nmax-start) > 10)\n\t\t\tstep = this._normStep(((nmax-start)/8)||1);\n\t\tend = start;\n\n\t\tvar power = Math.floor(this._log10(step));\n\t\twhile(end1)\n\t\t\t\tfor(var i=1; i < this._series.length;i++){\n\t\t\t\t\tvar maxI = GroupMethods.max(this._series[i][value], data);\n\t\t\t\t\tvar minI = GroupMethods.min(this._series[i][value], data);\n\t\t\t\t\tif (maxI > maxValue) maxValue = maxI;\n\t\t\t\t\tif (minI < minValue) minValue = minI;\n\t\t\t\t}\n\t\t}\n\t\treturn {max:maxValue,min:minValue};\n\t},\n\t_log10:function(n){\n\t\tvar method_name=\"log\";\n\t\treturn Math[method_name](n)/Math.LN10;\n\t},\n\t_drawXAxisLabel:function(x,y,obj,center,top){\n\t\tif (!this._settings.xAxis) return;\n\t\tvar elem = this.canvases[\"x\"].renderTextAt(top, center, x,y-(top?2:0),this._settings.xAxis.template(obj));\n\t\tif (elem)\n\t\t\telem.className += \" webix_axis_item_x\";\n\t},\n\t_drawXAxisLine:function(ctx,x,y1,y2,obj){\n\t\tif (!this._settings.xAxis||!this._settings.xAxis.lines) return;\n\t\tthis._drawLine(ctx,x,y1,x,y2,this._settings.xAxis.lineColor.call(this,obj),1);\n\t},\n\t_drawLine:function(ctx,x1,y1,x2,y2,color,width){\n\t\tctx.strokeStyle = color;\n\t\tctx.lineWidth = width;\n\t\tctx.beginPath();\n\t\tctx.moveTo(x1,y1);\n\t\tctx.lineTo(x2,y2);\n\t\tctx.stroke();\n\t\tctx.lineWidth = 1;\n\t},\n\t_getRelativeValue:function(minValue,maxValue){\n\t\tvar relValue;\n\t\tvar valueFactor = 1;\n\t\tif(maxValue != minValue){\n\t\t\trelValue = maxValue - minValue;\n\t\t}\n\t\telse relValue = minValue;\n\t\treturn [relValue,valueFactor];\n\t},\n\t_rainbow : [\n\t\tfunction(pos){ return \"#FF\"+color.toHex(pos/2,2)+\"00\";},\n\t\tfunction(pos){ return \"#FF\"+color.toHex(pos/2+128,2)+\"00\";},\n\t\tfunction(pos){ return \"#\"+color.toHex(255-pos,2)+\"FF00\";},\n\t\tfunction(pos){ return \"#00FF\"+color.toHex(pos,2);},\n\t\tfunction(pos){ return \"#00\"+color.toHex(255-pos,2)+\"FF\";},\n\t\tfunction(pos){ return \"#\"+color.toHex(pos,2)+\"00FF\";}\t\t\n\t],\n\t_defColors : [\n\t\t\"#f55b50\",\"#ff6d3f\",\"#ffa521\",\"#ffc927\",\"#ffee54\",\"#d3e153\",\"#9acb61\",\"#63b967\",\n\t\t\"#21a497\",\"#21c5da\",\"#3ea4f5\",\"#5868bf\",\"#7b53c0\",\"#a943ba\",\"#ec3b77\",\"#9eb0b8\"\n\t],\n\t_defColorsCursor: 0,\n\t/**\n\t* adds series to the chart (value and color properties)\n\t* @param: obj - obj with configuration properties\n\t*/\n\taddSeries:function(obj){\n\t\tvar temp = extend({},this._settings);\n\t\tthis._settings = extend({},temp);\n\t\tthis._parseSettings(obj,{});\n\t\tthis._series.push(this._settings);\n\t\tthis._settings = temp;\n\t},\n\t/*switch global settings to serit in question*/\n\t_switchSeries:function(id, e, tag) {\n\t\tvar tip;\n\n\t\tif(!tag.getAttribute(\"userdata\"))\n\t\t\treturn;\n\n\t\tthis._active_serie = this._series.length==1?this._getActiveSeries(e):tag.getAttribute(\"userdata\");\n\t\tif (!this._series[this._active_serie]) return;\n\t\tfor (var i=0; i < this._series.length; i++) {\n\t\t\ttip = this._series[i].tooltip;\n\n\t\t\tif (tip)\n\t\t\t\ttip.disable();\n\t\t}\n\t\tif(!tag.getAttribute(\"disabled\")){\n\t\t\ttip = this._series[this._active_serie].tooltip;\n\t\t\tif (tip)\n\t\t\t\ttip.enable();\n\t\t}\n\t},\n\t_getActiveSeries: function(e){\n\t\tvar a, areas, i, offset, pos, selection, x, y;\n\n\t\tareas = this._map._areas;\n\t\toffset = getOffset(this._contentobj._htmlmap);\n\t\tpos = getPos(e);\n\t\tx = pos.x - offset.x;\n\t\ty = pos.y - offset.y;\n\n\t\tfor( i = 0; i < areas.length; i++){\n\t\t\ta = areas[i].points;\n\t\t\tif(x <= a[2] && x >= a[0] && y <= a[3] && y >= a[1]){\n\t\t\t\tif(selection){\n\t\t\t\t\tif(areas[i].index > selection.index)\n\t\t\t\t\t\tselection = areas[i];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tselection = areas[i];\n\t\t\t}\n\t\t}\n\n\t\treturn selection?selection.index:0;\n\t},\n\thideSeries:function(series){\n\t\tthis.canvases[series].hideCanvas();\n\t\tvar legend = this._settings.legend;\n\t\tif(legend && legend.values && legend.values[series]){\n\t\t\tlegend.values[series].$hidden = true;\n\t\t\tthis._drawLegend();\n\t\t}\n\t\tthis._map.hide(this._contentobj, series, true);\n\t},\n\tshowSeries:function(series){\n\t\tthis.canvases[series].showCanvas();\n\t\tvar legend = this._settings.legend;\n\t\tif(legend && legend.values && legend.values[series]){\n\t\t\tdelete legend.values[series].$hidden;\n\t\t\tthis._drawLegend();\n\t\t}\n\t\tthis._map.hide(this._contentobj, series, false);\n\t},\n\t/**\n\t* renders legend block\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: width - the width of the container\n\t* @param: height - the height of the container\n\t*/\n\t_drawLegend:function(data,width){\n\t\t/*position of the legend block*/\n\t\tvar i, legend, legendContainer, legendHeight, legendItems, legendWidth, style,\n\t\t\tx=0, y= 0, ctx, itemColor, disabled, item;\n\n\t\tdata = data||[];\n\t\twidth = width||this._content_width;\n\t\tctx = this.canvases[\"legend\"].getCanvas();\n\t\t/*legend config*/\n\t\tlegend = this._settings.legend;\n\t\t/*the legend sizes*/\n\n\t\tstyle = (this._settings.legend.layout!=\"x\"?\"width:\"+legend.width+\"px\":\"\");\n\t\t/*creation of legend container*/\n\n\t\tif(this._legendObj){\n\n\t\t\tthis._legendObj.innerHTML = \"\";\n\t\t\tthis._legendObj.parentNode.removeChild(this._legendObj);\n\t\t}\n\t\tthis.canvases[\"legend\"].clearCanvas(true);\n\n\t\tlegendContainer = create(\"DIV\",{\n\t\t\t\"class\":\"webix_chart_legend\",\n\t\t\t\"style\":\"left:\"+x+\"px; top:\"+y+\"px;\"+style\n\t\t},\"\");\n\t\tif(legend.padding){\n\t\t\tlegendContainer.style.padding = legend.padding+\"px\";\n\t\t}\n\t\tthis._legendObj = legendContainer;\n\t\tthis._contentobj.appendChild(legendContainer);\n\n\t\t/*rendering legend text items*/\n\t\tlegendItems = [];\n\t\tif(!legend.values)\n\t\t\tfor(i = 0; i < data.length; i++){\n\t\t\t\tlegendItems.push(this._drawLegendText(legendContainer,legend.template(data[i]), data[i].id));\n\t\t\t}\n\t\telse\n\t\t\tfor(i = 0; i < legend.values.length; i++){\n\t\t\t\tlegendItems.push(this._drawLegendText(legendContainer,legend.values[i].text,(typeof legend.values[i].id!=\"undefined\"?typeof legend.values[i].id:i),legend.values[i].$hidden));\n\t\t\t}\n\t\tif (legendContainer.offsetWidth === 0)\n\t\t\tlegendContainer.style.width = \"auto\"; \n\t\tlegendWidth = legendContainer.offsetWidth;\n\t\tlegendHeight = legendContainer.offsetHeight;\n\n\t\t/*this._settings.legend.width = legendWidth;\n\t\tthis._settings.legend.height = legendHeight;*/\n\t\t/*setting legend position*/\n\t\tif(legendWidth2)\n\t\t\ttext.setAttribute(\"series_id\",series);\n\t\tcont.appendChild(text);\n\t\treturn text;\n\t},\n\t/**\n\t* draw legend colorful marder\n\t* @param: ctx - canvas object\n\t* @param: x - the horizontal position of the marker\n\t* @param: y - the vertical position of the marker\n\t* @param: obj - data object which color needs being used\n\t*/\n\t_drawLegendMarker:function(ctx,x,y,color,height,disabled,i){\n\t\tvar p = [];\n\t\tvar marker = this._settings.legend.marker;\n\t\tvar values = this._settings.legend.values;\n\t\tvar type = (values&&values[i].markerType?values[i].markerType:marker.type);\n\t\tif(color){\n\t\t\tctx.strokeStyle = ctx.fillStyle = color;\n\t\t}\n\n\t\tif(type==\"round\"||!marker.radius){\n\t\t\tctx.beginPath();\n\t\t\tctx.lineWidth = marker.height;\n\t\t\tctx.lineCap = marker.type;\n\t\t\t/*start of marker*/\n\t\t\tx += ctx.lineWidth/2+5;\n\t\t\ty += height/2;\n\t\t\tctx.moveTo(x,y);\n\t\t\tlet x1 = x + marker.width-marker.height +1;\n\t\t\tctx.lineTo(x1,y);\n\t\t\tctx.stroke();\n\t\t\tctx.fill();\n\n\t\t}\n\t\telse if(type==\"item\"){\n\t\t\t/*copy of line*/\n\t\t\tif(this._settings.line&&this._settings.type != \"scatter\" && !this._settings.disableLines){\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.lineWidth = this._series[i].line.width;\n\t\t\t\tctx.strokeStyle = disabled?color:this._series[i].line.color.call(this,{});\n\t\t\t\tlet x0 = x + 5;\n\t\t\t\tlet y0 = y + height/2;\n\t\t\t\tctx.moveTo(x0,y0);\n\t\t\t\tlet x1 = x0 + marker.width;\n\t\t\t\tctx.lineTo(x1,y0);\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t\t/*item copy*/\n\t\t\tvar config = this._series[i].item;\n\t\t\tvar radius = parseInt(config.radius.call(this,{}),10)||0;\n\t\t\tvar markerType = config.type.call(this,{});\n\t\t\tif(radius){\n\t\t\t\tctx.beginPath();\n\t\t\t\tif(disabled){\n\t\t\t\t\tctx.lineWidth = config.borderWidth;\n\t\t\t\t\tctx.strokeStyle = color;\n\t\t\t\t\tctx.fillStyle = color;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tctx.lineWidth = config.borderWidth;\n\t\t\t\t\tctx.fillStyle = config.color.call(this,{});\n\t\t\t\t\tctx.strokeStyle = config.borderColor.call(this,{});\n\t\t\t\t\tctx.globalAlpha = config.alpha.call(this,{});\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tx += marker.width/2+5;\n\t\t\t\ty += height/2;\n\t\t\t\tthis._strokeChartItem(ctx,x,y,radius+1,markerType);\n\t\t\t\tctx.fill();\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t\tctx.globalAlpha = 1;\n\t\t}else{\n\t\t\tctx.beginPath();\n\t\t\tctx.lineWidth = 1;\n\t\t\tx += 5;\n\t\t\ty += height/2-marker.height/2;\n\t\t\tp = [\n\t\t\t\t[x+marker.radius,y+marker.radius,marker.radius,Math.PI,3*Math.PI/2,false],\n\t\t\t\t[x+marker.width-marker.radius,y],\n\t\t\t\t[x+marker.width-marker.radius,y+marker.radius,marker.radius,-Math.PI/2,0,false],\n\t\t\t\t[x+marker.width,y+marker.height-marker.radius],\n\t\t\t\t[x+marker.width-marker.radius,y+marker.height-marker.radius,marker.radius,0,Math.PI/2,false],\n\t\t\t\t[x+marker.radius,y+marker.height],\n\t\t\t\t[x+marker.radius,y+marker.height-marker.radius,marker.radius,Math.PI/2,Math.PI,false],\n\t\t\t\t[x,y+marker.radius]\n\t\t\t];\n\t\t\tthis._path(ctx,p);\n\t\t\tctx.stroke();\n\t\t\tctx.fill();\n\t\t}\n\n\t},\n\t/**\n\t* gets the points those represent chart left top and right bottom bounds\n\t* @param: width - the width of the chart container\n\t* @param: height - the height of the chart container\n\t*/\n\t_getChartBounds:function(width,height){\n\t\tvar chartX0, chartY0, chartX1, chartY1;\n\t\t\n\t\tchartX0 = this._settings.padding.left;\n\t\tchartY0 = this._settings.padding.top;\n\t\tchartX1 = width - this._settings.padding.right;\n\t\tchartY1 = height - this._settings.padding.bottom;\t\n\t\t\n\t\tif(this._settings.legend){\n\t\t\tvar legend = this._settings.legend;\n\t\t\t/*legend size*/\n\t\t\tvar legendWidth = this._settings.legend.width;\n\t\t\tvar legendHeight = this._settings.legend.height;\n\t\t\n\t\t\t/*if legend is horizontal*/\n\t\t\tif(legend.layout == \"x\"){\n\t\t\t\tif(legend.valign == \"center\"){\n\t\t\t\t\tif(legend.align == \"right\")\n\t\t\t\t\t\tchartX1 -= legendWidth;\n\t\t\t\t\telse if(legend.align == \"left\")\n\t\t\t\t\t\tchartX0 += legendWidth;\n\t\t\t\t} else if(legend.valign == \"bottom\"){\n\t\t\t\t\tchartY1 -= legendHeight;\n\t\t\t\t} else {\n\t\t\t\t\tchartY0 += legendHeight;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*vertical scale*/\n\t\t\telse {\n\t\t\t\tif(legend.align == \"right\")\n\t\t\t\t\tchartX1 -= legendWidth;\n\t\t\t\telse if(legend.align == \"left\")\n\t\t\t\t\tchartX0 += legendWidth;\n\t\t\t}\n\t\t}\n\t\treturn {start:{x:chartX0,y:chartY0},end:{x:chartX1,y:chartY1}};\n\t},\n\t/**\n\t* gets the maximum and minimum values for the stacked chart\n\t* @param: data - data set\n\t*/\n\t_getStackedLimits:function(data){\n\t\tvar i, j, maxValue, minValue, value;\n\t\tif(this._settings.yAxis&&(typeof this._settings.yAxis.end!=\"undefined\")&&(typeof this._settings.yAxis.start!=\"undefined\")&&this._settings.yAxis.step){\n\t\t\tmaxValue = parseFloat(this._settings.yAxis.end);\n\t\t\tminValue = parseFloat(this._settings.yAxis.start);\n\t\t}\n\t\telse{\n\t\t\tfor(i=0; i < data.length; i++){\n\t\t\t\tdata[i].$sum = 0 ;\n\t\t\t\tdata[i].$min = Infinity;\n\t\t\t\tfor(j =0; j < this._series.length;j++){\n\t\t\t\t\tvalue = Math.abs(parseFloat(this._series[j].value(data[i])||0));\n\t\t\t\t\tif(isNaN(value)) continue;\n\t\t\t\t\tif(this._series[j].type.toLowerCase().indexOf(\"stacked\")!=-1)\n\t\t\t\t\t\tdata[i].$sum += value;\n\t\t\t\t\tif(value < data[i].$min) data[i].$min = value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmaxValue = -Infinity;\n\t\t\tminValue = Infinity;\n\t\t\tfor(i=0; i < data.length; i++){\n\t\t\t\tif (data[i].$sum > maxValue) maxValue = data[i].$sum ;\n\t\t\t\tif (data[i].$min < minValue) minValue = data[i].$min ;\n\t\t\t}\n\t\t\tif(minValue>0) minValue =0;\n\t\t}\n\t\treturn {max: maxValue, min: minValue};\n\t},\n\t/*adds colors to the gradient object*/\n\t_setBarGradient:function(ctx,x1,y1,x2,y2,type,rawColor,axis){\n\t\tvar gradient, offset, rgb, hsv, rawColor0, stops;\n\t\tif(type == \"light\"){\n\t\t\tif(axis == \"x\")\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y1,x2,y1);\n\t\t\telse\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y1,x1,y2);\n\t\t\tstops = [[0,\"#FFFFFF\"],[0.9,rawColor],[1,rawColor]];\n\t\t\toffset = 2;\n\t\t}\n\t\telse if(type == \"falling\"||type == \"rising\"){\n\t\t\tif(axis == \"x\")\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y1,x2,y1);\n\t\t\telse\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y1,x1,y2);\n\t\t\trgb = color.toRgb(rawColor);\n\t\t\thsv = color.rgbToHsv(rgb[0],rgb[1],rgb[2]);\n\t\t\thsv[1] *= 1/2;\n\t\t\trawColor0 = \"rgb(\"+color.hsvToRgb(hsv[0],hsv[1],hsv[2])+\")\";\n\t\t\tif(type == \"falling\"){\n\t\t\t\tstops = [[0,rawColor0],[0.7,rawColor],[1,rawColor]];\n\t\t\t}\n\t\t\telse if(type == \"rising\"){\n\t\t\t\tstops = [[0,rawColor],[0.3,rawColor],[1,rawColor0]];\n\t\t\t}\n\t\t\toffset = 0;\n\t\t}\n\t\telse{\n\t\t\tctx.globalAlpha = 0.37;\n\t\t\toffset = 0;\n\t\t\tif(axis == \"x\")\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y2,x1,y1);\n\t\t\telse\n\t\t\t\tgradient = ctx.createLinearGradient(x1,y1,x2,y1);\n\t\t\tstops = [[0,\"#9d9d9d\"],[0.3,\"#e8e8e8\"],[0.45,\"#ffffff\"],[0.55,\"#ffffff\"],[0.7,\"#e8e8e8\"],[1,\"#9d9d9d\"]];\n\t\t}\n\t\tthis._gradient(gradient,stops);\n\t\treturn {gradient: gradient,offset: offset};\n\t},\n\t/**\n\t* returns the x and y position\n\t* @param: a - angle\n\t* @param: x - start x position\n\t* @param: y - start y position\n\t* @param: r - destination to the point\n\t*/\n\t_getPositionByAngle:function(a,x,y,r){\n\t\ta *= (-1);\n\t\tx = x+Math.cos(a)*r;\n\t\ty = y-Math.sin(a)*r;\n\t\treturn {x:x,y:y};\n\t},\n\t_gradient:function(gradient,stops){\n\t\tfor(var i=0; i< stops.length; i++){\n\t\t\tgradient.addColorStop(stops[i][0],stops[i][1]);\n\t\t}\n\t},\n\t_path: function(ctx,points){\n\t\tvar i, method;\n\t\tfor(i = 0; i< points.length; i++){\n\t\t\tmethod = (i?\"lineTo\":\"moveTo\");\n\t\t\tif(points[i].length>2)\n\t\t\t\tmethod = \"arc\";\n\t\t\tctx[method].apply(ctx,points[i]);\n\t\t}\n\t},\n\t_addMapRect:function(map,id,points,bounds,sIndex){\n\t\tmap.addRect(id,[points[0].x-bounds.x,points[0].y-bounds.y,points[1].x-bounds.x,points[1].y-bounds.y],sIndex);\n\t}\n};\n\n\nconst view = protoUI(api, Pie, Bar, Line, BarH, StackedBar, StackedBarH, Spline, Area, Radar, Scatter, Presets, SplineArea, DynamicChart, Group, AutoTooltip, DataLoader, MouseEvents, EventSystem , base.view);\nexport default {api, view};","\n\nconst Spline = {\n\t/**\n\t* renders a spline chart\n\t* @param: ctx - canvas object\n\t* @param: data - object those need to be displayed\n\t* @param: width - the width of the container\n\t* @param: height - the height of the container\n\t* @param: sIndex - index of drawing chart\n\t*/\n\t$render_spline:function(ctx, data, point0, point1, sIndex, map){\n\t\tvar config,i,items,j,params,sparam,x,x0,x1,x2,y,y1,y2;\n\t\tparams = this._calculateLineParams(ctx,data,point0,point1,sIndex);\n\t\tconfig = this._settings;\n\t\tthis._mapStart = point0;\n\n\t\t/*array of all points*/\n\t\titems = [];\n\n\t\t/*drawing all items*/\n\t\tif (data.length) {\n\n\t\t\t/*getting all points*/\n\t\t\tx0 = (config.offset?point0.x+params.cellWidth*0.5:point0.x);\n\t\t\tfor(i=0; i < data.length;i ++){\n\t\t\t\ty = this._getPointY(data[i],point0,point1,params);\n\t\t\t\tif(y || y==\"0\"){\n\t\t\t\t\tx = ((!i)?x0:params.cellWidth*i - 0.5 + x0);\n\t\t\t\t\titems.push({x:x,y:y,v:this._settings.value(data[i]),index:i});\n\t\t\t\t}\n\t\t\t}\n\t\t\tsparam = this._getSplineParameters(items);\n\n\t\t\tfor(i =0; i< items.length; i++){\n\t\t\t\tx1 = items[i].x;\n\t\t\t\ty1 = items[i].y;\n\t\t\t\tif(ipoint1.y)\n\t\t\t\t\t\t\tsY1=point1.y;\n\t\t\t\t\t\tvar sY2 = this._getSplineYPoint(j+1,x1,i,sparam.a,sparam.b,sparam.c,sparam.d);\n\t\t\t\t\t\tif(sY2point1.y)\n\t\t\t\t\t\t\tsY2=point1.y;\n\t\t\t\t\t\tthis._drawLine(ctx,j,sY1,j+1,sY2,config.line.color(data[i]),config.line.width);\n\n\t\t\t\t\t}\n\t\t\t\t\tthis._drawLine(ctx,x2-1,this._getSplineYPoint(j,x1,i,sparam.a,sparam.b,sparam.c,sparam.d),x2,y2,config.line.color(data[i]),config.line.width);\n\t\t\t\t}\n\t\t\t\tthis._drawItem(ctx,x1,y1,data[items[i].index],config.label(data[items[i].index]), sIndex, map);\n\t\t\t}\n\t\t}\n\t},\n\t/*gets spline parameter*/\n\t_getSplineParameters:function(points){\n\t\tvar a ,b, c, d, i, s, u, v,\n\t\t\th = [],\n\t\t\tm = [],\n\t\t\tn = points.length;\n\n\t\tfor(i =0; i=1; i--)\n\t\t\ts[i] = (v[i] - h[i]*s[i+1])/u[i];\n\n\t\ta = []; b = []; c = [];\td = [];\n\n\t\tfor(i =0; i You need Webix PRO\"\n}}, template.view);","import base from \"../views/view\";\nimport list from \"../views/list\";\nimport Group from \"../core/group\";\nimport Touch from \"../core/touch\";\nimport TreeStore from \"../core/treestore\";\nimport RenderStack from \"../core/renderstack\";\n\nimport type from \"../webix/type\";\n\nimport {protoUI} from \"../ui/core\";\nimport {extend, bind, copy, delay, toArray, clone} from \"../webix/helpers\";\nimport animate from \"../webix/animate\";\nimport template from \"../webix/template\";\n\nconst api = {\n\tname:\"grouplist\",\n\tdefaults:{\n\t\tanimate:{\n\t\t}\n\t},\n\t_listClassName : \"webix_grouplist\",\n\t$init:function(){\n\t\textend(this.data, TreeStore, true);\n\t\t//needed for getRange\n\t\tthis.data.count = function(){ return this.order.length; };\n\t\tthis.data.provideApi(this,true);\n\t\tthis.data.attachEvent(\"onClearAll\", bind(this._onClear, this));\n\t\tthis._onClear();\n\t},\n\t_onClear:function(){\n\t\tthis._nested_cursor = [];\n\t\tthis._nested_chain = [];\n\t},\n\t$setSize:function(){\n\t\tif (base.api.$setSize.apply(this, arguments)){\n\t\t\t//critical for animations in group list\n\t\t\tthis._dataobj.style.width = this._content_width;\n\t\t}\n\t},\t\n\ton_click:{\n\t\twebix_list_item:function(e,id){\n\t\t\tif (this._in_animation) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tfor (var i=0; i < this._nested_chain.length; i++){\n\t\t\t\tif (this._nested_chain[i] == id){ //one level up\n\t\t\t\t\tfor (var j=i; j < this._nested_chain.length; j++) {\n\t\t\t\t\t\tthis.data.getItem(this._nested_chain[j]).$template=\"\";\n\t\t\t\t\t}\n\t\t\t\t\tif (!i){ //top level\n\t\t\t\t\t\tthis._nested_cursor = this.data.branch[0];\n\t\t\t\t\t\tthis._nested_chain = [];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._nested_cursor= this.data.branch[this._nested_chain[i-1]];\n\t\t\t\t\t\tthis._nested_chain.splice(i);\n\t\t\t\t\t}\n\t\t\t\t\tthis._is_level_down = false;\n\t\t\t\t\treturn this.render();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar obj = this.getItem(id);\n\t\t\tif (obj.$count){\t//one level down\n\t\t\t\tthis._is_level_down = true;\n\t\t\t\tthis._nested_chain.push(id);\n\t\t\t\tobj.$template = \"Back\";\n\t\t\t\tthis._nested_cursor = this.data.branch[obj.id];\n\t\t\t\treturn this.render();\n\t\t\t} else {\n\t\t\t\tif (this._settings.select){\n\t\t\t\t\tthis._no_animation = true;\n\t\t\t\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect)\n\t\t\t\t\t\tthis.select(id, false, ((this._settings.multiselect == \"touch\") || e.ctrlKey || e.metaKey), e.shiftKey); \t//multiselection\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.select(id);\n\t\t\t\t\tthis._no_animation = false;\n\t\t\t\t}\t\t\n\t\t\t}\n\t\t}\n\t},\n\tgetOpenState:function(){\n\t\treturn {parents:this._nested_chain,branch:this._nested_cursor};\n\t},\n\trender:function(){\n\t\tvar i, lastChain;\n\n\t\t//start filtering processing=>\n\t\tthis._nested_chain = copy(this._nested_chain);\n\t\tthis._nested_cursor = copy(this._nested_cursor);\n\n\t\tif(this._nested_chain.length){\n\t\t\tfor(i = 0;i\"),\n\t\ttemplateBack:template(\"#value#\"),\n\t\ttemplateItem:template(\"#value#\"),\n\t\ttemplateGroup:template(\"#value#\"),\n\t\ttemplateEnd:function(obj){\n\t\t\tvar html = \"\";\n\t\t\tif(obj.$count) html += \"
\";\n\t\t\thtml += \"\";\n\t\t\treturn html;\n\t\t}\n\t},\n\tshowItem:function(id){\n\t\tvar obj, parent;\n\t\tif(id){\n\t\t\tobj = this.getItem(id);\n\t\t\tparent = obj.$parent;\n\t\t\t\n\t\t\tif (obj.$count)\n\t\t\t\tparent = obj.id;\n\t\t}\n\t\tthis._nested_cursor = this.data.branch[parent||0];\n\t\tthis._nested_chain=[];\n\t\t\t\t\n\t\t//build _nested_chain\n\t\twhile(parent){\n\t\t\tthis.getItem(parent).$template = \"Back\";\n\t\t\tthis._nested_chain.unshift(parent);\n\t\t\tparent = this.getItem(parent).$parent;\n\t\t} \n\t\t\n\t\t//render\n\t\tthis._no_animation = true;\n\t\tthis.render();\n\t\tthis._no_animation = false;\n\t\t\n\t\t//scroll if necessary\n\t\tRenderStack.showItem.call(this,id);\n\t}\n};\n\n\nconst view = protoUI(api, Group, list.view );\nexport default {api, view};\n\n//register default type for grouplist\ntype(view,{});","import list from \"../views/list\";\nimport {insertBefore, remove} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {toArray} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\nimport template from \"../webix/template\";\n\n\nconst api = {\n\tname:\"unitlist\",\n\t_id:\"webix_item_id\",\n\tuniteBy_setter: template,\n\trender:function(id,data,type){\n\t\tvar config = this._settings;\n\t\tif (!this.isVisible(config.id))\n\t\t\treturn;\n\t\tif(!config.uniteBy)\n\t\t\treturn;\n\n\t\tif (id){\n\t\t\tvar cont = this.getItemNode(id); //get html element of updated item\n\t\t\tif(cont&&type==\"update\"&&(this._settings.uniteBy.call(this,data)==this.getItem(id).$unitValue)){\n\t\t\t\tvar t = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\tinsertBefore(t, cont);\n\t\t\t\tremove(cont);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t//full reset\n\t\tif (this.callEvent(\"onBeforeRender\",[this.data])){\n\t\t\tthis.units = null;\n\t\t\tthis._setUnits();\n\t\t\tif(this.units){\n\t\t\t\tthis._dataobj.innerHTML = this._getUnitRange().map(this._toHTML, this).join(\"\");\n\t\t\t\tthis._htmlmap = null; \n\t\t\t}\n\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t}\n\t},\n\tgetUnits:function(){\n\t\tvar result = [];\n\t\tif(this.units){\n\t\t\tfor(var b in this.units){\n\t\t\t\tresult.push(b);\n\t\t\t}\n\t\t}\n\t\treturn result;\t\n\t},\n\tgetUnitList:function(id){\n\t\treturn (this.units?this.units[id]:null);\n\t},\n\t_toHTML:function(obj){\n\t\t//check if related template exist\n\t\tvar mark = this.data._marks[obj.id];\n\t\tassert((!obj.$template || this.type[\"template\"+obj.$template]),\"RenderStack :: Unknown template: \"+obj.$template);\n\t\tthis.callEvent(\"onItemRender\",[obj]);\n\t\tif(obj.$unit){\n\t\t\treturn this.type.templateStartHeader(obj,this.type)+this.type.templateHeader.call(this,obj.$unit)+this.type.templateEnd(obj, this.type);\n\t\t}\n\t\treturn this.type.templateStart(obj,this.type,mark)+(obj.$template?this.type[\"template\"+obj.$template]:this.type.template)(obj,this.type)+this.type.templateEnd(obj, this.type);\n\t},\n\t_getUnitRange:function(){\n\t\tvar data,i,u,unit;\n\t\tdata = [];\n\t\tvar min = this.data.$min || 0;\n\t\tvar max = this.data.$max || Infinity;\n\t\tvar count = 0;\n\n\t\tfor(u in this.units){\n\t\t\tdata.push({$unit:u});\n\t\t\tunit = this.units[u];\n\t\t\tfor(i=0;i < unit.length;i++){\n\t\t\t\tif (count == min) data = [{$unit:u}];\n\t\t\t\tdata.push(this.getItem(unit[i]));\n\t\t\t\tif (count == max) return toArray(data);\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\treturn toArray(data);\n\t},\n\t_setUnits: function(){\n\t\tvar list = this;\n\t\tthis.units = {};\n\t\tthis.data.each(function(obj){\n\t\t\tvar result = list._settings.uniteBy.call(this,obj);\n\t\t\tobj.$unitValue = result;\n\t\t\tif(!list.units[result])\n\t\t\t\tlist.units[result] = [];\n\t\t\tlist.units[result].push(obj.id);\n\t\t});\n\t},\n\ttype:{\n\t\theaderHeight: 20,\n\t\ttemplateHeader: function(value){\n\t\t\treturn \"\"+value+\"\";\n\t\t},\n\t\ttemplateStart:function(obj,type,marks){\n\t\t\tif(obj.$unit)\n\t\t\t\treturn type.templateStartHeader.apply(this,arguments);\n\t\t\tvar className = \"webix_list_item webix_list_\"+(type.css)+\"_item\"+((marks&&marks.webix_selected)?\" webix_selected\":\"\")+(obj.$css?obj.$css:\"\");\n\t\t\tvar style = \"width:\"+type.widthSize(obj,type,marks)+\"; height:\"+type.heightSize(obj,type,marks)+\"; overflow:hidden;\"+(type.layout&&type.layout==\"x\"?\"float:left;\":\"\");\n\t\t\treturn \"
\";\n\t\t},\n\t\ttemplateStartHeader:function(obj,type,marks){\n\t\t\tvar className = \"webix_unit_header webix_unit_\"+(type.css)+\"_header\"+(obj.$selected?\"_selected\":\"\");\n\t\t\tvar style = \"width:\"+type.widthSize(obj,type,marks)+\"; height:\"+type.headerHeight+\"px; overflow:hidden;\";\n\t\t\treturn \"
\";\n\t\t}\n\t},\n\t$skin:function(){\n\t\tthis.type.headerHeight = $active.unitHeaderHeight;\n\t}\n};\n\n\nconst view = protoUI(api, list.view);\nexport default {api, view};","import {protoUI} from \"../ui/core\";\nimport {bind, extend} from \"../webix/helpers\";\nimport {freeze} from \"../ui/helpers\";\n\nimport UIManager from \"../core/uimanager\";\nimport i18n from \"../webix/i18n\";\n\nimport layout from \"../views/layout\";\n\nimport AtomDataLoader from \"../core/atomdataloader\";\nimport IdSpace from \"../core/idspace\";\n\ni18n.dbllist = {\n\tselectAll : \"\",\n\tselectOne : \"\",\n\tdeselectAll : \"\",\n\tdeselectOne : \"\"\n};\n\nconst api = {\n\tname: \"dbllist\",\n\tdefaults:{\n\t\tborderless:true\n\t},\n\t$init: function() {\n\t\tthis._moved = {};\n\t\tthis._inRight = bind(function(obj){ return this._moved[obj.id]; }, this);\n\t\tthis._inLeft = bind(function(obj){ return !this._moved[obj.id]; }, this);\n\t\n\t\tthis.$view.className += \" webix_dbllist\";\n\t\tthis.$ready.unshift(this._setLayout);\n\t},\n\t$onLoad:function(data, driver){\n\t\tthis._updateAndResize(function(){\n\t\t\tthis.$$(\"left\").data.driver = driver;\n\t\t\tthis.$$(\"left\").parse(data);\n\t\t\tthis.$$(\"right\").data.driver = driver;\n\t\t\tthis.$$(\"right\").parse(data);\n\t\t});\n\n\t\tthis._refresh();\n\t\treturn true;\n\t},\n\t_getButtons:function(){\n\t\tif (this._settings.buttons === false)\n\t\t\treturn { width: 10 };\n\n\t\tvar locale = i18n.dbllist;\n\t\tvar buttons = [\n\t\t\tthis._getButton(\"deselect_all\", locale.deselectAll),\n\t\t\tthis._getButton(\"select_all\", locale.selectAll),\n\t\t\tthis._getButton(\"deselect_one\", locale.deselectOne),\n\t\t\tthis._getButton(\"select_one\", locale.selectOne)\n\t\t];\n\n\n\t\tbuttons = { width:120, template:buttons.join(\"\"), onClick:{\n\t\t\tdbllist_button:function(e, id, trg){\n\t\t\t\tthis.getTopParentView()._update_list(trg.getAttribute(\"action\"));\n\t\t\t}\n\t\t}};\n\t\tif (this._settings.buttons)\n\t\t\tbuttons.template = this._settings.buttons;\n\n\t\treturn buttons;\n\t},\n\t_getButton: function(action, label){\n\t\treturn \"\";\n\t},\n\t_getList: function(id, action, label, bottom){\n\t\tvar list = {\n\t\t\tview: \"list\",\n\t\t\tselect: \"multiselect\",\n\t\t\tmultiselect: \"touch\",\n\t\t\tid: id,\n\t\t\taction: action,\n\t\t\tdrag: true,\n\t\t\ttype:{\n\t\t\t\tmargin:3,\n\t\t\t\tid:id\n\t\t\t},\n\t\t\ton: {\n\t\t\t\tonBeforeDrop: function(context) {\n\t\t\t\t\tvar source = context.from;\n\t\t\t\t\tvar target = context.to;\n\t\t\t\t\tvar top = source.getTopParentView();\n\n\t\t\t\t\tif (top === this.getTopParentView()) {\n\t\t\t\t\t\tvar mode = (target._settings.action != \"select_one\");\n\t\t\t\t\t\ttop.select(context.source, mode);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tonItemDblClick: function(){\n\t\t\t\t\treturn this.getTopParentView()._update_list(this.config.action);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (this._settings.list)\n\t\t\textend(list, this._settings.list, true);\n\n\t\tif (label)\n\t\t\tlist = { rows:[{ view:\"label\", label:label, css:\"webix_inp_top_label\" }, list] };\n\t\tif (bottom)\n\t\t\treturn { rows:[list, { view:\"label\", height:20, label:bottom, css:\"bottom_label\" }] };\n\t\treturn list;\n\t},\n\t_setLayout: function() {\n\t\tvar cols = [{\n\t\t\tmargin: 10, type:\"clean\",\n\t\t\tcols: [\n\t\t\t\tthis._getList(\"left\", \"select_one\", this._settings.labelLeft, this._settings.labelBottomLeft),\n\t\t\t\tthis._getButtons(),\n\t\t\t\tthis._getList(\"right\", \"deselect_one\", this._settings.labelRight, this._settings.labelBottomRight)\n\t\t\t]\n\t\t}];\n\n\t\tthis.cols_setter(cols);\n\t},\n\t_update_list: function(action) {\n\t\tvar top = this;\n\t\tvar id = null;\n\t\tvar mode = false;\n\n\t\tif (action === \"select_all\"){\n\t\t\tid = top.$$(\"left\").data.order;\n\t\t\tmode = true;\n\t\t} else if (action === \"select_one\"){\n\t\t\tid = top.$$(\"left\").getSelectedId(true);\n\t\t\tmode = true;\n\t\t} else if (action === \"deselect_all\"){\n\t\t\tid = top.$$(\"right\").data.order;\n\t\t\tmode = false;\n\t\t} else if (action === \"deselect_one\"){\n\t\t\tid = top.$$(\"right\").getSelectedId(true);\n\t\t\tmode = false;\n\t\t}\n\n\t\ttop.select(id, mode);\n\t},\n\tselect:function(id, mode){\n\t\tvar i;\n\t\tif (typeof id !== \"object\") id = [id];\n\n\t\tif (mode){\n\t\t\tfor (i = 0; i < id.length; i++)\n\t\t\t\tthis._moved[id[i]] = true;\n\t\t} else {\n\t\t\tfor (i = 0; i < id.length; i++)\n\t\t\t\tdelete this._moved[id[i]];\n\t\t}\n\t\tthis._refresh();\n\t\tthis.callEvent(\"onChange\", []);\n\t},\n\t_updateAndResize:function(handler, size){\n\t\tfreeze(bind(handler, this), false);\n\t\tif (size && (this.$$(\"left\")._settings.autoheight || this.$$(\"right\")._settings.autoheight))\n\t\t\tthis.resize();\n\t},\n\t_refresh: function() {\n\t\tvar left = this.$$(\"left\");\n\t\tvar right = this.$$(\"right\");\n\n\t\tif (left)\n\t\t\tthis._updateAndResize(function(){\n\t\t\t\tleft.filter(this._inLeft);\n\t\t\t\tright.filter(this._inRight);\n\t\t\t}, true);\n\t},\n\tfocus:function(){\n\t\tUIManager.setFocus(this);\n\t},\n\tvalue_setter:function(val){\n\t\tthis.setValue(val);\n\t},\n\tsetValue: function(value) {\n\t\tthis._moved = {};\n\t\tif (typeof value !== \"object\")\n\t\t\tvalue = value.toString().split(\",\");\n\t\tfor (var i = 0; i < value.length; i++)\n\t\t\tthis._moved[value[i]] = true;\n\n\t\t\n\t\tthis._refresh();\n\t},\n\tgetValue: function() {\n\t\tvar value = [];\n\t\tfor (var key in this._moved)\n\t\t\tvalue.push(key);\n\n\t\treturn value.join(\",\");\n\t}\n};\n\n\nconst view = protoUI(api, AtomDataLoader, IdSpace, layout.view);\nexport default {api, view};","import proto from \"../views/proto\";\nimport AutoTooltip from \"../core/autotooltip\";\nimport Group from \"../core/group\";\nimport TreeAPI from \"../core/treeapi\";\nimport DragItem from \"../core/dragitem\";\nimport TreeDataMove from \"../core/treedatamove\";\nimport SelectionModel from \"../core/selectionmodel\";\nimport KeysNavigation from \"../core/keysnavigation\";\nimport MouseEvents from \"../core/mouseevents\";\nimport Scrollable from \"../core/scrollable\";\nimport TreeDataLoader from \"../core/treedataloader\";\nimport TreeRenderStack from \"../core/treerenderstack\";\nimport CopyPaste from \"../core/copypaste\";\nimport EventSystem from \"../core/eventsystem\";\nimport type from \"../webix/type\";\nimport template from \"../webix/template\";\nimport TreeStore from \"../core/treestore\";\nimport TreeClick from \"../core/treeclick\";\nimport TreeType from \"../core/treetype\";\nimport TreeStateCheckbox from \"../core/treestatecheckbox\";\n\nimport {createCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {extend} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"tree\",\n\tdefaults:{\n\t\tscroll:\"a\",\n\t\tnavigation:true\n\t},\n\t$init:function(){\n\t\tthis._viewobj.className += \" webix_tree\";\n\n\t\t//map API of DataStore on self\n\t\textend(this.data, TreeStore, true);\n\t\textend(this.on_click, TreeClick);\n\t\tthis.attachEvent(\"onAfterRender\", this._refresh_scroll);\n\t\tthis.attachEvent(\"onPartialRender\", this._refresh_scroll);\n\t\tthis.data.provideApi(this,true);\n\t\tthis._viewobj.setAttribute(\"role\", \"tree\");\n\n\t},\n\t//attribute , which will be used for ID storing\n\t_id:\"webix_tm_id\",\n\t//supports custom context menu\n\ton_context:{},\n\ton_dblclick:{\n\t\twebix_tree_checkbox:function(){\n\t\t\tif(this.on_click.webix_tree_checkbox)\n\t\t\t\treturn this.on_click.webix_tree_checkbox.apply(this,arguments);\n\t\t}\n\t},\n\t$fixEditor: function(editor) {\n\t\tvar item = this.getItemNode(editor.id).querySelector(\"span\");\n\t\tif (item){\n\t\t\tif (item.innerHTML === \"\") item.innerHTML =\" \";\n\t\t\tvar padding = 10;\n\t\t\tvar pos = item.offsetLeft;\n\t\t\teditor.node.style.width = this.$view.scrollWidth - pos - padding + \"px\";\n\t\t\teditor.node.style.marginLeft = pos + \"px\";\n\t\t\teditor.node.style.left = \"0px\";\n\t\t}\n\t},\n\t//css class to action map, for onclick event\n\ton_click:{\n\t\twebix_tree_item:function(e, id){\n\t\t\tif(this._settings.activeTitle){\n\t\t\t\tvar item = this.getItem(id);\n\t\t\t\tif(item.open)\n\t\t\t\t\tthis.close(id);\n\t\t\t\telse\n\t\t\t\t\tthis.open(id);\n\t\t\t}\n\t\t\tif (this._settings.select){\n\t\t\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect){\n\t\t\t\t\tvar multimode = (e.ctrlKey || e.metaKey || (this._settings.multiselect == \"touch\"));\n\t\t\t\t\tif (this._settings.multiselect == \"level\" && (multimode || e.shiftKey)){\n\t\t\t\t\t\t//allow only selection on the same level\n\t\t\t\t\t\tvar select = this.getSelectedId(true)[0];\n\t\t\t\t\t\tif (select && this.getParentId(id) != this.getParentId(select)) \n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.select(id, false, multimode, e.shiftKey); \t//multiselection\n\t\t\t\t} else\n\t\t\t\t\tthis.select(id);\n\t\t\t}\n\t\t}\n\t},\n\t_paste: {\n\t\t// insert new item with pasted value\n\t\tinsert: function(text) {\n\t\t\tvar parent = this.getSelectedId() ||\"0\" ;\n\t\t\tthis.add({ value: text }, null, parent);\n\t\t},\n\t\t// change value of each selected item\n\t\tmodify: function(text) {\n\t\t\tvar sel = this.getSelectedId(true);\n\t\t\tfor (var i = 0; i < sel.length; i++) {\n\t\t\t\tthis.getItem(sel[i]).value = text;\n\t\t\t\tthis.refresh(sel[i]);\n\t\t\t}\n\t\t},\n\t\t// do nothing\n\t\tcustom: function() {}\n\t},\n\t_drag_order_complex:true,\n\t$dragHTML:function(obj){\n\t\treturn \"
\"+this.type.template(obj, this.type)+\"
\";\n\t},\n\t\n\t//css class to action map, for dblclick event\n\ttype:extend({\n\t\t//normal state of item\n\t\ttemplate:function(obj,common){\n\t\t\tvar template = common[\"template\"+obj.level]||common.templateCommon;\n\t\t\treturn template.apply(this, arguments);\n\t\t},\n\t\tclassname:function(obj, common, marks){\n\t\t\tvar css = \"webix_tree_item\";\n\n\t\t\tif (obj.$css){\n\t\t\t\tif (typeof obj.$css == \"object\")\n\t\t\t\t\tobj.$css = createCss(obj.$css);\n\t\t\t\tcss += \" \"+obj.$css;\n\t\t\t}\n\t\t\tif (marks && marks.$css)\n\t\t\t\tcss += \" \"+marks.$css;\n\n\t\t\treturn css;\n\t\t},\n\t\taria:function(obj, common, marks){\n\t\t\treturn \"role=\\\"treeitem\\\"\"+(marks && marks.webix_selected?\" aria-selected=\\\"true\\\" tabindex=\\\"0\\\"\":\" tabindex=\\\"-1\\\"\")+\n\t\t\t\t(obj.$count?(\"aria-expanded=\\\"\"+(obj.open?\"true\":\"false\")+\"\\\"\"):\"\")+\"aria-level=\\\"\"+obj.$level+\"\\\"\";\n\t\t},\n\t\ttemplateCommon:template(\"{common.icon()} {common.folder()} #value#\"),\n\t\ttemplateStart:template(\"
\"),\n\t\ttemplateEnd:template(\"
\"),\n\t\ttemplateCopy: template(\"#value#\")\n\t}, TreeType)\n};\n\n\nconst view = protoUI(api, TreeStateCheckbox, AutoTooltip, Group, TreeAPI, DragItem, TreeDataMove, SelectionModel, KeysNavigation, MouseEvents, Scrollable, TreeDataLoader, proto.view, TreeRenderStack, CopyPaste, EventSystem);\nexport default {api, view};\n\ntype(view, {\n\tname:\"lineTree\",\n\tcss:\"webixLineTree\",\n\ticon:function(obj, common){\n\t\tvar html = \"\";\n\t\tvar open = \"\";\n\t\tfor (var i=1; i<=obj.$level; i++){\n\t\t\tif (i==obj.$level)\n\t\t\t\topen = (obj.$count?(obj.open?\"webix_tree_open \":\"webix_tree_close \"):\"webix_tree_none \");\n\n\t\t\tvar icon = common._icon_src(obj, common, i);\n\t\t\tif (icon)\n\t\t\t\thtml+=\"
\";\n\t\t}\n\t\treturn html;\n\t},\n\t_icon_src:function(obj, common, level){\n\t\tvar lines = common._tree_branch_render_state; \n\t\tvar tree = TreeRenderStack._obj;\n\n\t\tif (lines === 0 && tree){\n\t\t\t//we are in standalone rendering \n\t\t\t//need to reconstruct rendering state\n\t\t\tvar lines_level = obj.$level;\n\t\t\tvar branch_id = obj.id;\n\n\t\t\tlines = [];\n\t\t\twhile (lines_level){\n\t\t\t\tvar parent_id = tree.getParentId(branch_id);\n\t\t\t\tvar pbranch = tree.data.branch[parent_id];\n\t\t\t\tif (pbranch[pbranch.length-1] == branch_id)\n\t\t\t\t\tlines[lines_level] = true;\t\n\n\t\t\t\tbranch_id = parent_id;\n\t\t\t\tlines_level--;\n\t\t\t}\n\n\t\t\t//store for next round\n\t\t\tcommon._tree_branch_render_state = lines;\n\t\t}\n\t\tif (!lines)\n\t\t\treturn 0;\n\t\t//need to be replaced with image urls\n\t\tif (level == obj.$level){\n\t\t\tvar mode = 3; //3-way line\n\t\t\tif (!obj.$parent){ //top level\n\t\t\t\tif (obj.$index === 0)\n\t\t\t\t\tmode = 4; //firts top item\n\t\t\t}\n\n\t\t\tif (lines[obj.$level])\n\t\t\t\tmode = 2;\n\n\t\t\tif (obj.$count){\n\t\t\t\tif (obj.open)\n\t\t\t\t\treturn \"minus\"+mode;\n\t\t\t\telse\n\t\t\t\t\treturn \"plus\"+mode;\n\t\t\t} else\n\t\t\t\treturn \"line\"+mode;\n\t\t} else {\n\t\t\tif (!lines[level])\n\t\t\t\treturn \"line1\";\n\t\t\treturn \"blank\";\n\t\t}\n\t}\n});","import proto from \"../views/proto\";\nimport AutoTooltip from \"../core/autotooltip\";\nimport Group from \"../core/group\";\nimport TreeAPI from \"../core/treeapi\";\nimport SelectionModel from \"../core/selectionmodel\";\nimport KeysNavigation from \"../core/keysnavigation\";\nimport MouseEvents from \"../core/mouseevents\";\nimport Scrollable from \"../core/scrollable\";\nimport TreeDataLoader from \"../core/treedataloader\";\nimport TreeRenderStack from \"../core/treerenderstack\";\nimport CopyPaste from \"../core/copypaste\";\nimport EventSystem from \"../core/eventsystem\";\nimport {insertBefore, remove, locate, createCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport template from \"../webix/template\";\nimport {extend, bind, copy} from \"../webix/helpers\";\nimport i18n from \"../webix/i18n\";\nimport TreeStore from \"../core/treestore\";\n\n\nconst api = {\n\tname: \"treemap\",\n\tdefaults: {\n\t\tactiveItem: false,\n\t\tsubRender: true,\n\t\theader: true,\n\t\theaderHeight: 35,\n\t\tvalue: template(\"#value#\"),\n\t\theaderTemplate: \"\",\n\t\tnavigation:true\n\t},\n\tvalue_setter: template,\n\theaderTemplate_setter: template,\n\theader_setter: function(value){\n\t\tif(value && value !== true){\n\t\t\tthis.type.header = value;\n\t\t}\n\t\treturn value;\n\t},\n\t$init: function(){\n\t\tthis.$view.className += \" webix_treemap\";\n\t\tthis._viewobj.setAttribute(\"role\", \"tree\");\n\n\t\tthis._htmlElement = document.createElement(\"DIV\");\n\n\t\textend(this.data, TreeStore, true);\n\t\tthis.data.provideApi(this,true);\n\n\t\tthis.data.attachEvent(\"onClearAll\", bind(function(){\n\t\t\tthis._html = \"\";\n\t\t\tthis.$values = {};\n\t\t\tthis.$xy = {};\n\t\t},this));\n\n\t\tthis.attachEvent(\"onKeyPress\", this._onKeyPress);\n\t},\n\t_toHTMLItem:function(obj){\n\t\tvar mark = this.data._marks[obj.id];\n\t\tthis.callEvent(\"onItemRender\",[obj]);\n\t\tvar template = (obj.$template?this.type[\"template\"+obj.$template].call(this,obj,this.type,mark):this.type.template.call(this,obj,this.type,mark));\n\t\treturn this.type.templateStart.call(this,obj,this.type,mark) + template + this.type.templateEnd.call(this);\n\t},\n\t_renderHeader: function(id){\n\t\tvar item = this.getItem(id);\n\t\tvar height = this._settings.headerHeight;\n\t\tvar html = \"
\";\n\t\thtml += this.type.header.call(this, item, this.type);\n\t\thtml += \"
\";\n\t\treturn html;\n\t},\n\t_renderBranch:function(pId){\n\t\tvar sizes, row, value, sum,\n\t\t\tleaves = [];\n\n\t\tif(!this.$width || !this.count()){\n\t\t\tthis._html = \"\";\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!pId){\n\t\t\tpId = this.config.branch||0;\n\t\t\tthis._html = \"\";\n\t\t\tthis.$values = {};\n\t\t\tthis.$xy = {};\n\t\t\tthis.$xy[pId] = {\n\t\t\t\twidth: this.$width,\n\t\t\t\theight: this.$height,\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0\n\t\t\t};\n\t\t\t// header\n\t\t\tif(pId && this._settings.header){\n\t\t\t\tthis.$xy[pId].height -= this._settings.headerHeight;\n\t\t\t\tthis.$xy[pId].top = this._settings.headerHeight;\n\t\t\t\tthis._html += this._renderHeader(pId);\n\t\t\t}\n\n\t\t\t// values calculation\n\t\t\tsum = 0;\n\t\t\tthis.data.each(function(item){\n\t\t\t\tvar parentId = this.getParentId(item.id);\n\t\t\t\tif(!this.data.branch[item.id]){\n\t\t\t\t\tvalue = this.config.value.call(this,item)*1;\n\t\t\t\t\tif(!isNaN(value) && value){\n\t\t\t\t\t\tthis.$values[item.id] = value;\n\t\t\t\t\t\tsum += value;\n\t\t\t\t\t\twhile(parentId){\n\t\t\t\t\t\t\tif(!this.$values[parentId])\n\t\t\t\t\t\t\t\tthis.$values[parentId] = 0;\n\t\t\t\t\t\t\tthis.$values[parentId] += value;\n\t\t\t\t\t\t\tparentId = this.getParentId(parentId);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, this, false, pId);\n\t\t}\n\n\t\tthis.data.eachChild(pId, function(item){\n\t\t\tif(this.$values[item.id])\n\t\t\t\tleaves.push(copy(item));\n\t\t}, this);\n\n\t\tsum = sum || this.$values[pId];\n\n\t\tif(leaves.length && sum){\n\t\t\tsizes = this.$xy[pId];\n\t\t\trow ={ top: sizes.top, left:sizes.left, dx: sizes.width, dy: sizes.height, set:[], sum:0 };\n\t\t\trow.dim = Math.min(row.dx,row.dy);\n\t\t\tlet delta = row.dx*row.dy/sum; //total area\n\t\t\tfor (let i=0; i< leaves.length; i++)\n\t\t\t\tleaves[i].$value = this.$values[leaves[i].id]*delta; //normalized value\n\n\n\t\t\tleaves.sort(function(a,b){\n\t\t\t\treturn a.$value >b.$value?-1:1;\n\t\t\t});\n\n\t\t\tvar bad = Infinity;\n\t\t\tlet i = 0;\n\t\t\twhile(leaves[i]){\n\t\t\t\tvar check=this._worst(row, leaves[i]);\n\t\t\t\tif (check row.dy){\n\t\t\t\t\t\tr.left += delta;\n\t\t\t\t\t\tr.dx -= delta;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tr.top += delta;\n\t\t\t\t\t\tr.dy -= delta;\n\t\t\t\t\t}\n\t\t\t\t\trow=r;\n\t\t\t\t\trow.dim = Math.min(row.dx,row.dy);\n\t\t\t\t\tbad=Infinity;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(row)\n\t\t\tthis._renderRow(row);\n\t},\n\t_renderRow:function(row){\n\t\tvar i, id, x, y,\n\t\t\ttop=row.top,\n\t\t\tleft=row.left;\n\n\t\trow.mode=(row.dy1?a:(1/a);\n\t},\n\t_toHTMLObject:function(obj){\n\t\tthis._htmlElement.innerHTML = this._toHTMLItem(obj);\n\t\treturn this._htmlElement.firstChild;\n\t},\n\tshowBranch: function(id){\n\t\tthis._settings.branch = id;\n\t\tthis.refresh();\n\t},\n\trender:function(id,data,type){\n\t\tif (!this.isVisible(this._settings.id) || this.$blockRender)\n\t\t\treturn;\n\n\t\tif(type == \"update\"){\n\t\t\tvar cont = this.getItemNode(id); //get html element of updated item\n\t\t\tif(cont){\n\t\t\t\tvar t = this._htmlmap[id] = this._toHTMLObject(data);\n\t\t\t\tinsertBefore(t, cont);\n\t\t\t\tremove(cont);\n\t\t\t}\n\t\t}\n\t\telse if(this.data.branch && (!this._settings.branch || this.data.branch[this._settings.branch])){\n\t\t\tthis._htmlmap = null;\n\t\t\tthis.callEvent(\"onBeforeRender\",[]);\n\t\t\tthis._renderBranch();\n\t\t\tthis._dataobj.innerHTML = this._html;\n\t\t\tthis.callEvent(\"onAfterRender\",[]);\n\t\t}\n\t\treturn true;\n\t},\n\t_id:\"webix_dm_id\",\n\ton_click:{\n\t\twebix_treemap_item:function(e,id){\n\t\t\tif (this._settings.select){\n\t\t\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect)\n\t\t\t\t\tthis.select(id, false, (e.ctrlKey || e.metaKey || (this._settings.multiselect == \"touch\")), e.shiftKey);\n\t\t\t\telse\n\t\t\t\t\tthis.select(id);\n\t\t\t}\n\t\t\tif(this._settings.activeItem && this.isBranch(id)){\n\t\t\t\tthis.showBranch(id);\n\t\t\t}\n\t\t},\n\t\twebix_treemap_header_item: function(e){\n\t\t\tvar id = locate(e, \"webix_dm_header_id\");\n\t\t\tthis.define(\"branch\", id);\n\t\t\tthis.refresh();\n\t\t},\n\t\twebix_treemap_reset: function(){\n\t\t\tthis.define(\"branch\", 0);\n\t\t\tthis.refresh();\n\t\t}\n\t},\n\ton_dblclick:{\n\t},\n\ton_mouse_move:{\n\t},\n\t_getCssText: function(style){\n\t\tvar css = \"\";\n\t\tfor(var property in style){\n\t\t\tcss += property+\":\"+style[property]+\";\";\n\t\t}\n\t\treturn css;\n\t},\n\ttype:{\n\t\t//normal state of item\n\t\ttemplate:template(\"#value#\"),\n\t\theader: function(obj, common){\n\t\t\tvar id = obj.id;\n\t\t\tvar resetIcon = \"
\";\n\t\t\tvar arr = [];\n\t\t\twhile(id){\n\t\t\t\tobj = this.getItem(id);\n\t\t\t\tarr.push(common.headerItem.call(this, obj, common));\n\t\t\t\tid = this.getParentId(id);\n\t\t\t}\n\t\t\tarr.reverse();\n\t\t\treturn resetIcon + arr.join(\"\");\n\t\t},\n\t\theaderItem: function(obj){\n\t\t\tvar template = this.config.headerTemplate(obj);\n\t\t\tvar html = \"\";\n\t\t\thtml += template;\n\t\t\thtml += \"\";\n\t\t\treturn html;\n\t\t},\n\t\tclassname:function(obj, common, marks){\n\t\t\tvar css = \"webix_treemap_item\";\n\n\t\t\tif (common.css) css +=common.css+\" \";\n\n\t\t\tif (obj.$css){\n\t\t\t\tif (typeof obj.$css == \"object\")\n\t\t\t\t\tobj.$css = createCss(obj.$css);\n\t\t\t\tcss +=\" \"+obj.$css;\n\t\t\t}\n\n\t\t\tvar xy = this.$xy[obj.id];\n\n\t\t\tif (marks && marks.$css) css +=\" \"+marks.$css;\n\n\t\t\tcss += \" webix_treemap_level_\" + this.getItem(obj.id).$level;\n\n\t\t\tvar parentId = this.getParentId(obj.id);\n\n\t\t\tif(!parentId || parentId == this._settings.branch)\n\t\t\t\tcss += \" webix_treemap_level_top\";\n\n\t\t\tif(this.$height - xy.top - xy.height < 1)\n\t\t\t\tcss += \" webix_treemap_item_bottom\";\n\n\t\t\tif(this.$width - xy.left - xy.width < 1)\n\t\t\t\tcss += \" webix_treemap_item_right\";\n\n\t\t\tif(common.cssClass){\n\t\t\t\tvar cssClass = common.cssClass.call(this, obj, common, marks);\n\t\t\t\tif(cssClass){\n\t\t\t\t\tif(typeof cssClass == \"object\"){\n\t\t\t\t\t\tcss += \" \"+ createCss(cssClass);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tcss += \" \"+cssClass;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn css;\n\t\t},\n\t\ttemplateStart:function(obj,type,marks){\n\t\t\tvar style=\"\";\n\t\t\tif(this.$xy){\n\t\t\t\tvar xy = this.$xy[obj.id];\n\t\t\t\tstyle += \"width: \"+ xy.width +\"px; height: \" + xy.height+\"px;\";\n\t\t\t\tstyle += \"top: \"+ xy.top+\"px; left: \" + xy.left+\"px;\";\n\t\t\t}\n\t\t\treturn \"
\";\n\t\t},\n\t\ttemplateEnd:template(\"
\")\n\t}\n};\n\n\nconst view = protoUI(api, AutoTooltip, Group, TreeAPI, SelectionModel, KeysNavigation, MouseEvents, Scrollable, TreeDataLoader, proto.view, TreeRenderStack, CopyPaste, EventSystem);\nexport default {api, view};","import {create, remove, createCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {extend, bind, delay} from \"../webix/helpers\";\n\nimport template from \"../webix/template\";\nimport env from \"../webix/env\";\n\nimport base from \"../views/view\";\nimport proto from \"../views/proto\";\n\nimport DataMove from \"../core/datamove\";\nimport DragItem from \"../core/dragitem\";\nimport MouseEvents from \"../core/mouseevents\";\nimport KeysNavigation from \"../core/keysnavigation\";\nimport SelectionModel from \"../core/selectionmodel\";\nimport Scrollable from \"../core/scrollable\";\nimport CustomPrint from \"../core/customprint\";\nimport VirtualRenderStack from \"../core/virtualrenderstack\";\n\n\n/*\n\tUI:DataView\n*/\n\n// #include ui/component.js\n// #include core/mouse.js \t\n// #include core/edit.js \n// #include core/selection.js \n\n// #include core/drag.js\n// #include core/move.js\n// #include core/virtual_render.js\n// #include core/keynav.js\n// #include core/print.js\n\nconst api = {\n\tname:\"dataview\",\n\t$init:function(config){\n\t\tif (config.sizeToContent)\n\t\t\t//method need to be called before data-loaders\n\t\t\t//so we are using unshift to place it at start\n\t\t\tthis.$ready.unshift(this._after_init_call);\n\t\t\n\t\tvar type = config.type || config.item;\n\t\tvar prerender = config.prerender || this.defaults.prerender || (type && type.width ==\"auto\");\n\t\t\n\t\tif (!prerender && !config.autoheight)\n\t\t\textend(this, VirtualRenderStack, true);\n\t\tif (config.autoheight)\n\t\t\tconfig.scroll = false;\n\n\t\tif(type && type.type ==\"tiles\"){\n\t\t\tthis._viewobj.firstChild.style.padding = \"8px\";\n\t\t\tthis._tilesPadding = 8;\n\t\t}\n\n\t\tthis._contentobj.className+=\" webix_dataview\";\n\n\t\tthis._viewobj.setAttribute(\"role\", \"listbox\");\n\t},\n\t_after_init_call:function(){\n\t\tvar test = create(\"DIV\",0,this.type.template({}));\n\t\ttest.style.position=\"absolute\";\n\t\tdocument.body.appendChild(test);\n\t\tthis.type.width = test.offsetWidth;\n\t\tthis.type.height = test.offsetHeight;\n\t\t\n\t\tremove(test);\n\t},\n\tdefaults:{\n\t\tscroll:true,\n\t\tdatafetch:50,\n\t\tnavigation:true\n\t},\n\t_id:\"webix_l_id\",\n\t_itemClassName:\"webix_dataview_item\",\n\t_tilesPadding:0,\n\ton_click:{\n\t\twebix_dataview_item:function(e,id){ \n\t\t\tif (this._settings.select){\n\t\t\t\tif (this._settings.select==\"multiselect\" || this._settings.multiselect)\n\t\t\t\t\tthis.select(id, false, ((this._settings.multiselect == \"touch\") || e.ctrlKey || e.metaKey), e.shiftKey); \t//multiselection\n\t\t\t\telse\n\t\t\t\t\tthis.select(id);\n\t\t\t}\n\t\t}\t\t\n\t},\n\ton_dblclick:{\n\t},\n\ton_mouse_move:{\n\t},\n\ttype:{\n\t\t//normal state of item\n\t\ttemplate:template(\"#value#\"),\n\t\t//in case of dyn. loading - temporary spacer\n\t\ttemplateLoading:template(\"Loading...\"),\n\t\twidth:160,\n\t\theight:50,\n\t\tclassname:function(obj, common, marks){\n\t\t\tvar css = \"webix_dataview_item \";\n\n\t\t\tif (common.css) css +=common.css+\" \";\n\t\t\tif (common.type && common.type.toString() == \"tiles\")\n\t\t\t\tcss += \"tiles \";\n\t\t\tif (obj.$css){\n\t\t\t\tif (typeof obj.$css == \"object\")\n\t\t\t\t\tobj.$css = createCss(obj.$css);\n\t\t\t\tcss +=obj.$css+\" \";\n\t\t\t}\n\t\t\tif (marks && marks.$css) css +=marks.$css+\" \";\n\t\t\t\n\t\t\treturn css;\n\t\t},\n\t\ttilesStart:function(obj, common){\n\t\t\tif (common.type == \"tiles\")\n\t\t\t\treturn \"
\";\n\t\t\treturn \"\";\n\t\t},\n\t\ttilesEnd:function(obj, common){\n\t\t\tif (common.type == \"tiles\")\n\t\t\t\treturn \"
\";\n\t\t\treturn \"\";\n\t\t},\n\t\taria:function(obj, common, marks){\n\t\t\treturn \"role=\\\"option\\\"\"+(marks && marks.webix_selected?\" aria-selected=\\\"true\\\" tabindex=\\\"0\\\"\":\" tabindex=\\\"-1\\\"\");\n\t\t},\n\t\ttemplateStart:template(\"
{common.tilesStart()}\"),\n\t\ttemplateEnd:template(\"{common.tilesEnd()}
\")\n\t\t\n\t},\n\t_calck_autoheight:function(width){\n\t\treturn (this._settings.height = this.type.height * Math.ceil( this.data.count() / Math.floor(width / this.type.width)));\n\t},\n\tautoheight_setter:function(mode){\n\t\tif (mode){\n\t\t\tthis.data.attachEvent(\"onStoreLoad\", bind(this.resize, this));\n\t\t\tthis._contentobj.style.overflowY = \"hidden\";\n\t\t}\n\t\treturn mode;\n\t},\n\t$getSize:function(dx, dy){\n\t\tif ((this._settings.xCount >0) && this.type.width != \"auto\" && !this._autowidth)\n\t\t\tthis._settings.width = this.type.width*this._settings.xCount + (this._scroll_y?env.scrollSize:0);\n\t\tif (this._settings.yCount && this.type.height != \"auto\")\n\t\t\tthis._settings.height = this.type.height*this._settings.yCount;\n\n\t\tvar width = this._settings.width || this._content_width;\n\t\tif (this._settings.autoheight && width){\n\t\t\tthis._calck_autoheight(width);\n\t\t\tthis.scroll_setter(false);\t\n\t\t}\n\t\treturn base.api.$getSize.call(this, dx, dy);\t\t\n\t},\n\t_recalk_counts:function(){\n\t\tvar render = false;\n\t\tif (this._settings.yCount && this.type.height == \"auto\"){\n\t\t\tthis.type.height = Math.floor((this._content_height-this._tilesPadding)/this._settings.yCount);\n\t\t\trender = true;\n\t\t}\n\t\tif (this._settings.xCount && (this.type.width == \"auto\"||this._autowidth)){\n\t\t\tthis._autowidth = true; //flag marks that width was set to \"auto\" initially\n\t\t\tthis.type.width = Math.floor((this._content_width-this._tilesPadding*2)/this._settings.xCount);\n\t\t\trender = true;\n\t\t} else \n\t\t\tthis._autowidth = false;\n\n\t\treturn render;\n\t},\n\t$setSize:function(x,y){\n\t\tif (base.api.$setSize.call(this, x, y)){\n\t\t\tif (this._settings.autoheight && this._calck_autoheight() != this._content_height)\n\t\t\t\treturn delay(this.resize, this);\n\n\t\t\tif (this._recalk_counts() || this._render_visible_rows)\n\t\t\t\tthis.render();\n\t\t}\n\t}\n};\n\n\nconst view = protoUI(api, DataMove, DragItem, MouseEvents, KeysNavigation, SelectionModel, Scrollable, CustomPrint, proto.view);\nexport default {api, view};","import {addCss, insertBefore, removeCss} from \"../webix/html\";\nimport {protoUI, ui} from \"../ui/core\";\nimport {delay, extend, bind} from \"../webix/helpers\";\nimport animate from \"../webix/animate\";\n\nimport MouseEvents from \"../core/mouseevents\";\nimport SingleRender from \"../core/singlerender\";\nimport EventSystem from \"../core/eventsystem\";\n\nimport base from \"../views/view\";\nimport template from \"../webix/template\";\n\nimport i18n from \"../webix/i18n\";\n\n\ni18n.pager = {\n\tfirst: \"\",\n\tlast: \"\",\n\tnext: \"\",\n\tprev: \"\"\n};\n\n\nconst api = {\n\tdefaults:{\n\t\tsize:10,\t//items on page\n\t\tpage: 0,\t//current page\n\t\tgroup:5,\n\t\ttemplate:\"{common.pages()}\",\n\t\tmaxWidth:100000,\n\t\theight:30,\n\t\tborderless:true\n\t},\n\tname:\"pager\",\n\ton_click:{\n\t\t//on paging button click\n\t\t\"webix_pager_item\":function(e,id){\n\t\t\tthis.select(id);\n\t\t}\n\t},\n\t$init:function(config){\n\t\tthis.data = this._settings;\n\t\tthis._dataobj = this._viewobj;\n\t\tthis._viewobj.className += \" webix_pager\"+(config.autowidth?\" webix_pager_auto\":\"\");\n\n\t\tif(config.master===false||config.master === 0)\n\t\t\tthis.$ready.push(this._remove_master);\n\t},\n\t_remove_master:function(){\n\t\tthis.refresh();\n\t\tthis.$master = { refresh:function(){}, select:function(){} };\n\t},\n\tselect:function(id){\n\t\tif (this.$master && this.$master.name == \"pager\")\n\t\t\treturn this.$master.select(id);\n\n\t\t//id - id of button, number for page buttons\n\t\tswitch(id){\n\t\t\tcase \"next\":\n\t\t\t\tid = this._settings.page+1;\n\t\t\t\tbreak;\n\t\t\tcase \"prev\":\n\t\t\t\tid = this._settings.page-1;\n\t\t\t\tbreak;\n\t\t\tcase \"first\":\n\t\t\t\tid = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"last\":\n\t\t\t\tid = this._settings.limit-1;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t//use incoming id\n\t\t\t\tbreak;\n\t\t}\n\t\tif (id<0) id=0;\n\t\tif (id>=this.data.limit) id=this.data.limit-1;\n\n\t\tvar old = this.data.page;\n\t\tif (this.callEvent(\"onBeforePageChange\",[id, old])){\n\t\t\tthis.data.page = id*1; //must be int\n\t\t\tif (this.refresh()){\n\t\t\t\tif (!this._settings.animate || !this._animate(old, id*1, this._settings.animate))\n\t\t\t\t\tthis.$master.refresh();\n\t\t\t}\n\t\t\tthis.callEvent(\"onAfterPageChange\",[id]);\t\n\t\t}\n\t},\n\t_id:\"webix_p_id\",\n\ttemplate_setter:template,\n\ttype:{\n\t\ttemplate:function(a,b){ return a.template.call(this, a,b); },\n\t\t//list of page numbers\n\t\tpages:function(obj){\n\t\t\tvar html=\"\";\n\t\t\t//skip rendering if paging is not fully initialized\n\t\t\tif (obj.page == -1) return \"\";\n\t\t\t//current page taken as center of view, calculate bounds of group\n\t\t\tobj.$min = obj.page-Math.round((obj.group-1)/2);\n\t\t\tobj.$max = obj.$min + obj.group*1 - 1;\n\t\t\tif (obj.$min<0){\n\t\t\t\tobj.$max+=obj.$min*(-1);\n\t\t\t\tobj.$min=0;\n\t\t\t}\n\t\t\tif (obj.$max>=obj.limit){\n\t\t\t\tobj.$min -= Math.min(obj.$min,obj.$max-obj.limit+1);\n\t\t\t\tobj.$max = obj.limit-1;\n\t\t\t}\n\t\t\t//generate HTML code of buttons\n\t\t\tfor (var i=(obj.$min||0); i<=obj.$max; i++)\n\t\t\t\thtml+=this.button({id:i, index:(i+1), selected:(i == obj.page ?\"_selected\":\"\"), label:i18n.aria.page+\" \"+(i+1)});\n\t\t\treturn html;\n\t\t},\n\t\tpage:function(obj){\n\t\t\treturn obj.page+1;\n\t\t},\n\t\t//go-to-first page button\n\t\tfirst:function(){\n\t\t\treturn this.button({ id:\"first\", index:i18n.pager.first, selected:\"\", label:i18n.aria.pages[0]});\n\t\t},\n\t\t//go-to-last page button\n\t\tlast:function(){\n\t\t\treturn this.button({ id:\"last\", index:i18n.pager.last, selected:\"\", label:i18n.aria.pages[3]});\n\t\t},\n\t\t//go-to-prev page button\n\t\tprev:function(){\n\t\t\treturn this.button({ id:\"prev\", index:i18n.pager.prev, selected:\"\", label:i18n.aria.pages[1]});\n\t\t},\n\t\t//go-to-next page button\n\t\tnext:function(){\n\t\t\treturn this.button({ id:\"next\", index:i18n.pager.next, selected:\"\", label:i18n.aria.pages[2]});\n\t\t},\n\t\tbutton:template(\"\")\n\t},\n\tclone:function(pager){\n\t\tif (!pager.$view){\n\t\t\tpager.view = \"pager\";\n\t\t\tpager = ui(pager);\n\t\t}\n\n\t\tthis._clone = pager;\n\t\tpager.$master = this;\n\t\tthis._refresh_clone();\n\t},\n\trefresh:function(){\n\t\tvar s = this._settings;\n\t\tif (!s.count) return;\n\n\t\t//max page number\n\t\ts.limit = Math.ceil(s.count/s.size);\n\n\t\tvar newPage = Math.min(s.limit-1, s.page);\n\n\t\tif (newPage != s.page)\n\t\t\treturn this.$master.setPage(newPage);\n\n\t\ts.page = newPage;\n\t\tif (newPage>=0 && (newPage!=s.old_page) || (s.limit != s.old_limit) || (s.old_count != s.count)){\n\t\t\t//refresh self only if current page or total limit was changed\n\t\t\tthis.render();\n\t\t\tthis._refresh_clone();\n\t\t\ts.old_limit = s.limit;\t//save for onchange check in next iteration\n\t\t\ts.old_page = s.page;\n\t\t\ts.old_count = s.count;\n\t\t\treturn true;\n\t\t}\n\t},\n\tapiOnly_setter:function(value){\n\t\treturn (this.$apiOnly=value);\n\t},\n\t_refresh_clone:function(){\n\t\tif (this._clone){\n\t\t\tthis._clone._settings.count = this._settings.count;\n\t\t\tthis._clone._settings.page = this._settings.page;\n\t\t\tthis._clone.refresh();\n\t\t}\n\t},\n\t_animate:function(old, id, config){\n\t\tif (old == id) return false;\n\t\tif (this._pgInAnimation){\n\t\t\tif(this._pgAnimateTimeout){\n\t\t\t\twindow.clearTimeout(this._pgAnimateTimeout);\n\t\t\t}\n\t\t\treturn (this._pgAnimateTimeout = delay(this._animate, this,[old, id, config],100));\n\t\t}\n\t\tvar direction = id > old ? \"left\" : \"right\";\n\t\tif (config.direction == \"top\" || config.direction == \"bottom\")\n\t\t\tdirection = id > old ? \"top\" : \"bottom\";\n\t\tif (config.flip)\n\t\t\tdirection = \"\";\n\n\t\t//make copy of existing view\n\t\tvar top = 0;\n\t\tvar snode = this.$master._dataobj;\n\t\tvar isDataTable = !!this.$master._body;\n\n\t\tif (isDataTable){\n\t\t\tsnode = this.$master._body;\n\t\t\ttop = snode.offsetTop;\n\t\t\taddCss(this.$master.$view, \"webix_animation\");\n\t\t}\n\n\t\tvar onode = snode.cloneNode(true);\n\t\tonode.style.width = snode.style.width = \"100%\";\n\t\t\n\t\t//redraw page\n\t\tthis.$master.refresh();\n\t\t//append copy next to original\n\t\tinsertBefore(onode, snode.nextSibling, snode.parentNode);\n\t\tif(isDataTable)\n\t\t\tonode.childNodes[1].scrollLeft = snode.childNodes[1].scrollLeft;\n\n\t\t//animation config\n\t\tvar line;\n\t\tvar base = config !== true ? config : {};\n\t\tvar aniset = extend({\n\t\t\tdirection:direction,\n\t\t\tcallback:bind(function(){\n\t\t\t\taniset.callback = null;\n\t\t\t\tanimate.breakLine(line);\n\t\t\t\tthis._pgInAnimation = false;\n\t\t\t\tif (this.$master._body)\n\t\t\t\t\tremoveCss(this.$master.$view, \"webix_animation\");\n\t\t\t},this),\n\t\t\ttop:top, keepViews: isDataTable\n\t\t}, base);\n\n\t\t//run animation\n\t\tline = animate.formLine(snode, onode, aniset);\n\t\tanimate([ snode, onode ], aniset );\n\t\tthis._pgInAnimation = true;\n\t}\n};\n\n\nconst view = protoUI(api, MouseEvents, SingleRender, base.view, EventSystem);\nexport default {api, view};","import list from \"../views/list\";\nimport {triggerEvent, getTextSize} from \"../webix/html\";\nimport {protoUI, ui, $$} from \"../ui/core\";\nimport template from \"../webix/template\";\nimport {$active} from \"../webix/skin\";\nimport env from \"../webix/env\";\nimport {bind, extend} from \"../webix/helpers\";\nimport {assert} from \"../webix/debug\";\n\n\n// #include ui/window.js\n// #include ui/list.js\nconst api = {\n\tname:\"menu\",\n\t_listClassName:\"webix_menu\",\n\t$init:function(config){\n\t\tthis.data._scheme_init = bind(function(obj){\n\t\t\tif (obj.disabled)\n\t\t\t\tthis.data.addMark(obj.id, \"webix_disabled\", true, 1, true);\n\t\t}, this);\n\n\t\tif (config.autowidth){\n\t\t\tthis._autowidth_submenu = true;\n\t\t\tdelete config.autowidth;\n\t\t}\n\n\t\tthis.data.attachEvent(\"onStoreUpdated\", bind(function(){\n\t\t\tthis._hide_sub_menu();\n\t\t},this));\n\t\tthis.attachEvent(\"onMouseMove\", this._mouse_move_menu);\n\t\tthis.attachEvent(\"onMouseOut\",function(e){\n\t\t\tif (this._menu_was_activated() && this._settings.openAction == \"click\") return;\n\t\t\tif (!this._child_menu_active && e.relatedTarget)\n\t\t\t\tthis._hide_sub_menu();\n\t\t});\n\t\tthis.attachEvent(\"onItemClick\", function(id, e, trg){\n\t\t\tvar item = this.getItem(id);\n\t\t\tif (item){\n\t\t\t\tif (item.$template) return;\n\n\t\t\t\tvar parent = this.getTopMenu();\n\n\t\t\t\t//ignore disabled items\n\t\t\t\tif (!this.data.getMark(id, \"webix_disabled\")){\n\t\t\t\t\tif (!parent.callEvent(\"onMenuItemClick\", [id, e, trg])){\n\t\t\t\t\t\te.showpopup = true;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this != parent)\n\t\t\t\t\t\tparent._call_onclick(id,e,trg);\n\n\t\t\t\t\t//click on group - do not close submenus\n\t\t\t\t\tif (!item.submenu && !parent._show_child_on_click){\n\t\t\t\t\t\tparent._hide_sub_menu(true);\n\t\t\t\t\t\tif (parent._hide_on_item_click)\n\t\t\t\t\t\t\tparent.hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ((this === parent || env.touch ) && parent._settings.openAction == \"click\"){\n\t\t\t\t\t\t\tthis._mouse_move_activation(id, trg);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//do not close popups when clicking on menu folder\n\t\t\t\t\t\te.showpopup = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.attachEvent(\"onKeyPress\", function(code){\n\t\t\tif(code === 9) this.getTopMenu()._hide_sub_menu();\n\t\t\telse if(code === 13 || code === 32){\n\t\t\t\tvar sel = this.getSelectedId(), node;\n\t\t\t\tif(sel)\n\t\t\t\t\tnode = this.getItemNode(sel);\n\t\t\t\tif(node)\n\t\t\t\t\ttriggerEvent(node, \"MouseEvents\", \"click\");\n\t\t\t}\n\n\t\t});\n\n\t\tthis.data.attachEvent(\"onClearAll\", function(){\n\t\t\tthis._hidden_items = [];\n\t\t});\n\t\tthis.data._hidden_items = [];\n\n\t\tthis._viewobj.setAttribute(\"role\", \"menubar\");\n\n\t\t//component can create new view\n\t\tthis._destroy_with_me = [];\n\t},\n\tsizeToContent:function(){\n\t\tif (this._settings.layout == \"y\"){\n\t\t\tvar texts = [];\n\t\t\tvar isSubmenu = false;\n\t\t\tthis.data.each(function(obj){\n\t\t\t\ttexts.push(this._toHTML(obj));\n\t\t\t\tif(obj.submenu)\n\t\t\t\t\tisSubmenu = true;\n\t\t\t}, this);\n\t\t\t// text width + padding + borders+ arrow\n\t\t\tthis.config.width = getTextSize(texts, this.$view.className).width+8*2+2+(isSubmenu?15:0);\n\t\t\tthis.resize();\n\t\t} else assert(false, \"sizeToContent will work for vertical menu only\");\n\t},\n\tgetTopMenu:function(){\n\t\tvar parent = this;\n\t\twhile (parent._parent_menu)\n\t\t\tparent = $$(parent._parent_menu);\n\t\treturn parent;\n\t},\n\t_auto_height_calc:function(count){\n\t\tif (this._settings.autoheight)\n\t\t\tcount = this.count();\n\t\t\n\t\tvar value = this.count(), height = 0;\n\n\t\tfor (var i=0; i\";\n\t\t\t}\n\t\t\tvar link = (obj.href?\" href='\"+obj.href+\"' \":\"\")+(obj.target?\" target='\"+obj.target+\"' \":\"\");\n\t\t\treturn list.api.type.templateStart(obj,common,mark).replace(/^
\":\"\");\n\t\t},\n\t\ttemplateEnd: function(obj){\n\t\t\treturn (obj.$template === \"Separator\" || obj.$template === \"Spacer\")?\"
\":\"\";\n\t\t},\n\t\ttemplateSeparator:template(\"
\"),\n\t\ttemplateSpacer:template(\"
\")\n\t},\n\tgetMenu: function(id){\n\t\tif (!this.data.pull[id]){\n\t\t\tfor (var subid in this.data.pull){\n\t\t\t\tvar obj = this.getItem(subid);\n\t\t\t\tif (obj.submenu){\n\t\t\t\t\tvar search = this._get_submenu(obj).getMenu(id);\n\t\t\t\t\tif (search) return search;\n\t\t\t\t}\n\t\t\t}\n\t\t} else return this;\n\t},\n\tgetSubMenu:function(id){\n\t\tvar menu = this.getMenu(id);\n\t\tvar obj = menu.getItem(id);\n\t\treturn (obj.submenu?menu._get_submenu(obj):null);\n\t},\n\tgetMenuItem:function(id){\n\t\treturn this.getMenu(id).getItem(id);\n\t},\n\t_get_submenu:function(data){\n\t\tvar sub = $$(data.submenu);\n\t\tif (!sub){\n\t\t\tdata.submenu = this._create_sub_menu(data);\n\t\t\tsub = $$(data.submenu);\n\t\t}\n\t\treturn sub;\n\t},\n\t_mouse_move_menu:function(id, e, target){\n\t\tif (!this._menu_was_activated())\n\t\t\treturn;\n\n\t\tthis._mouse_move_activation(id, target);\n\t},\n\t_menu_was_activated:function(){\n\t\tvar top = this.getTopMenu();\n\t\tif (top._settings.openAction == \"click\"){\n\t\t\tif (env.touch) return false;\n\t\t\tvar sub = top._open_sub_menu;\n\t\t\tif (sub && $$(sub).isVisible())\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\t_mouse_move_activation:function(id, target){\n\t\tvar data = this.getItem(id);\n\t\tif (!data) return;\n\t\t\n\t\t//clear flag of submenu usage\n\t\tthis._child_menu_active = null;\n\n\t\t//hide previously opened sub-menu\n\t\tif (this._open_sub_menu && data.submenu != this._open_sub_menu)\n\t\t\tthis._hide_sub_menu(true);\n\n\t\t//show submenu\n\t\tif (this.type._submenu(data)&&!this.config.hidden){\n\n\t\t\tvar sub = this._get_submenu(data);\n\t\t\tif(this.data.getMark(id,\"webix_disabled\"))\n\t\t\t\treturn;\n\t\t\tsub.show(target,{ pos:this._settings.subMenuPos });\n\n\t\t\tsub._parent_menu = this._settings.id;\n\n\t\t\tthis._open_sub_menu = data.submenu;\n\t\t}\n\t},\n\tdisableItem:function(id){\n\t\tthis.getMenu(id).addCss(id, \"webix_disabled\");\n\t},\n\tenableItem:function(id){\n\t\tthis.getMenu(id).removeCss(id, \"webix_disabled\");\n\t},\n\t_set_item_hidden:function(id, state){\n\t\tvar menu = this.data;\n\t\tif (menu._hidden_items[id] != state){\n\t\t\tmenu._hidden_items[id] = state;\n\t\t\tmenu.filter(function(obj){\n\t\t\t\treturn !menu._hidden_items[obj.id];\n\t\t\t});\n\t\t\tthis.resize();\t\t\n\t\t}\n\t},\n\thideItem:function(id){\n\t\tvar menu = this.getMenu(id);\n\t\tif (menu) menu._set_item_hidden(id, true);\n\t},\n\tshowItem:function(id){\n\t\tvar menu = this.getMenu(id);\n\t\tif (menu){\n\t\t\tmenu._set_item_hidden(id, false);\n\t\t\treturn list.api.showItem.call(menu, id);\n\t\t}\n\t},\n\t_hide_sub_menu : function(mode){\n\t\tif (this._open_sub_menu){\n\t\t\t//recursive sub-closing\n\t\t\tvar sub = $$(this._open_sub_menu);\n\t\t\tif (sub._hide_sub_menu)\t//custom context may not have submenu\n\t\t\t\tsub._hide_sub_menu(mode);\n\t\t\tif (mode || !sub._show_on_mouse_out){\n\t\t\t\tsub.hide();\n\t\t\t\tthis._open_sub_menu = null;\n\t\t\t}\n\t\t}\n\t},\n\t_create_sub_menu : function(data){\n\t\tvar listConfig = {\n\t\t\tview:\"submenu\",\n\t\t\tdata:this.type._submenu(data)\n\t\t};\n\n\t\tvar settings = this.getTopMenu()._settings.submenuConfig;\n\t\tif (settings)\n\t\t\textend(listConfig, settings, true);\n\n\t\tvar parentData = this.getMenuItem(data.id);\n\t\tif(parentData && parentData.config)\n\t\t\textend(listConfig, parentData.config, true);\n\n\t\tvar menu = ui(listConfig);\n\t\tthis._destroy_with_me.push(menu);\n\t\tmenu._parent_menu = this;\n\t\treturn menu._settings.id;\n\t},\n\t_skip_item:function(id, prev, mode){\n\t\tvar item = this.getItem(id);\n\t\tif(item.$template == \"Separator\" || item.$template == \"Spacer\" || this.data.getMark(id, \"webix_disabled\")){\n\t\t\tvar index = this.getIndexById(id)+(mode == \"up\"?-1:1);\n\t\t\tid = (index>=0)?this.getIdByIndex(index):null;\n\t\t\treturn id? this._skip_item(id, prev, mode) : prev;\n\t\t}\n\t\telse\n\t\t\treturn id;\n\t},\n\t$skin:function(){\n\t\tlist.api.$skin.call(this);\n\t\tthis.type.height = $active.menuHeight;\n\t},\n\tdefaults:{\n\t\tscroll:\"\",\n\t\tlayout:\"x\",\n\t\tmouseEventDelay:100,\n\t\tsubMenuPos:\"bottom\"\n\t}\n};\n\n\nconst view = protoUI(api, list.view);\nexport default {api, view};","\n\nimport menu from \"../views/menu\";\nimport popup from \"../views/popup\";\nimport {protoUI, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {clone} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"submenu\",\n\t$init:function(){\n\t\tthis._body_cell = clone(this._dummy_cell_interface);\n\t\tthis._body_cell._view = this;\n\n\t\tthis.attachEvent(\"onMouseOut\",function(e){\n\t\t\tif (this.getTopMenu()._settings.openAction == \"click\") \n\t\t\t\treturn;\n\t\t\tif (!this._child_menu_active && !this._show_on_mouse_out && e.relatedTarget)\n\t\t\t\tthis.hide();\n\t\t});\n\n\t\t//inform parent that focus is still in menu\n\t\tthis.attachEvent(\"onMouseMoving\",function(){\n\t\t\tif (this._parent_menu)\n\t\t\t\t$$(this._parent_menu)._child_menu_active = true;\n\t\t});\n\t\tthis.attachEvent(\"onBeforeShow\", function(){\n\t\t\tif (this.getTopMenu()._autowidth_submenu && this.sizeToContent && !this.isVisible())\n\t\t\t\tthis.sizeToContent();\n\t\t});\n\n\t\tthis._dataobj.setAttribute(\"role\", \"menu\");\n\t},\n\t$skin:function(){\n\t\tmenu.api.$skin.call(this);\n\t\tpopup.api.$skin.call(this);\n\n\t\tthis.type.height = $active.menuHeight;\n\t},\n\t_dummy_cell_interface : {\n\t\t$getSize:function(dx, dy){\n\t\t\t//we saving height and width, as list can hardcode new values\n\t\t\tvar h = this._view._settings.height*1;\n\t\t\tvar w = this._view._settings.width*1;\n\t\t\tvar size = menu.api.$getSize.call(this._view, dx, dy);\n\t\t\t//restoring\n\t\t\tthis._view._settings.height = h;\n\t\t\tthis._view._settings.width = w;\n\t\t\treturn size;\n\t\t},\n\t\t$setSize:function(x,y){\n\t\t\tif (this._view._settings.scroll)\n\t\t\t\tthis._view._bodyobj.style.height = y+\"px\";\n\t\t},\n\t\tdestructor:function(){ this._view = null; }\n\t},\n\t//ignore body element\n\tbody_setter:function(){\n\t},\n\tgetChildViews:function(){ return []; },\n\tdefaults:{\n\t\twidth:150,\n\t\tsubMenuPos:\"right\",\n\t\tlayout:\"y\",\n\t\tautoheight:true\n\t},\n\ttype:{\n\t\theight: $active.menuHeight,\n\t\tsubsign:true\n\t}\n};\n\n\nconst view = protoUI(api, menu.view, popup.view);\nexport default {api, view};","import env from \"../webix/env\";\nimport UIManager from \"../core/uimanager\";\n\nimport {removeCss, addCss} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport {delay, bind} from \"../webix/helpers\";\nimport {zIndex} from \"../ui/helpers\";\nimport {event, eventRemove} from \"../webix/htmlevents\";\nimport {assert} from \"../webix/debug\";\n\nimport popup from \"../views/popup\";\nimport window from \"../views/window\";\nimport base from \"../views/view\";\n\nimport animate from \"../webix/animate\";\nimport state from \"../core/state\";\n\n\nconst api = {\n\tname:\"sidemenu\",\n\tdefaults: {\n\t\tanimate: true,\n\t\tposition: \"left\",\n\t\twidth: 200,\n\t\tborderless: true\n\t},\n\t$init:function(){\n\t\tthis.$view.className += \" webix_sidemenu\";\n\t},\n\t$skin:function(){\n\t\tthis.defaults.padding = 0;\n\t},\n\tposition_setter: function(value){\n\t\tvar prevPosition = this._settings.position;\n\t\tif(prevPosition)\n\t\t\tremoveCss(this.$view,\" webix_sidemenu_\"+prevPosition);\n\t\taddCss(this.$view,\" webix_sidemenu_\"+value);\n\t\treturn value;\n\t},\n\t$getSize: function(){\n\t\tvar sizes = window.api.$getSize.apply(this,arguments);\n\t\tthis._desired_sizes = sizes;\n\t\treturn sizes;\n\t},\n\t$setSize:function(x,y){\n\t\tbase.api.$setSize.call(this,x,y);\n\t\tx = this._content_width-this._settings.padding*2;\n\t\ty = this._content_height-this._settings.padding*2;\n\t\tthis._contentobj.style.padding = this._settings.padding+\"px\";\n\t\tthis._headobj.style.display=\"none\";\n\t\tthis._bodyobj.style.height = y+\"px\";\n\t\tthis._body_cell.$setSize(x,y);\n\t},\n\tshow: function(){\n\t\tif(!this.callEvent(\"onBeforeShow\",arguments))\n\t\t\treturn false;\n\n\t\tthis._settings.hidden = false;\n\t\tthis._viewobj.style.zIndex = (this._settings.zIndex||zIndex());\n\t\tif (this._settings.modal || this._modal){\n\t\t\tthis._modal_set(true);\n\t\t\tthis._modal = null; // hidden_setter handling\n\t\t}\n\t\tthis._viewobj.style.display = \"block\";\n\t\tthis._render_hidden_views();\n\t\tif (this._settings.position)\n\t\t\tthis._setPosition();\n\n\t\tthis._hide_timer = 1;\n\t\tdelay(function(){ this._hide_timer = 0; }, this, [], (env.touch ? 400 : 100 ));\n\n\t\tif (this.config.autofocus){\n\t\t\tthis._prev_focus = UIManager.getFocus();\n\t\t\tUIManager.setFocus(this);\n\t\t}\n\n\t\tif (-1 == state._popups.find(this))\n\t\t\tstate._popups.push(this);\n\n\t\tthis.callEvent(\"onShow\",[]);\n\t},\n\t_setPosition: function(x){\n\t\tvar width, height, maxWidth, maxHeight,\n\t\t\tposition,\n\t\t\tleft = 0, top = 0,\n\t\t\tstate = { };\n\n\n\t\tthis.$view.style.position = \"fixed\";\n\n\t\tmaxWidth = (window.innerWidth||document.documentElement.offsetWidth);\n\t\tmaxHeight = (window.innerHeight||document.documentElement.offsetHeight);\n\n\t\twidth = this._desired_sizes[0] || maxWidth;\n\t\theight = this._desired_sizes[2] ||maxHeight;\n\n\t\tassert(width &&height, \"Attempt to show not rendered window\");\n\n\t\tposition = this._settings.position;\n\n\t\tif(position == \"top\"){\n\t\t\twidth = maxWidth;\n\t\t} else if(position == \"right\"){\n\t\t\theight = maxHeight;\n\t\t\tleft = maxWidth - width;\n\t\t} else if(position == \"bottom\"){\n\t\t\twidth = maxWidth;\n\t\t\ttop = maxHeight - height;\n\t\t} else {\n\t\t\theight = maxHeight;\n\t\t}\n\n\t\tstate = { left: left, top: top,\n\t\t\twidth: width, height: height,\n\t\t\tmaxWidth: maxWidth, maxHeight: maxHeight\n\t\t};\n\n\t\tif (typeof this._settings.state == \"function\")\n\t\t\tthis._settings.state.call(this, state);\n\n\t\tthis._state = state;\n\n\t\tthis.$setSize(state.width, state.height);\n\n\t\tif (typeof x == \"undefined\" && this._isAnimationSupported()){\n\t\t\tremoveCss(this.$view,\"webix_animate\",true);\n\t\t\t// set initial state\n\t\t\tthis._animate[this._settings.position].beforeShow.call(this, state);\n\t\t\t// set apply animation css\n\t\t\tdelay(function(){\n\t\t\t\taddCss(this.$view,\"webix_animate\",true);\n\t\t\t},this, null,1);\n\t\t\t// animate popup\n\t\t\tdelay(function(){\n\t\t\t\tthis._animate[this._settings.position].show.call(this, state);\n\t\t\t},this, null,10);\n\n\t\t}\n\t\telse{\n\t\t\tif(this._settings.position === \"right\")\n\t\t\t\tstate.left = state.right?maxWidth - state.width - state.right:maxWidth - state.width;\n\t\t\tthis.setPosition(state.left, state.top);\n\t\t}\n\t},\n\t_isAnimationSupported: function(){\n\t\treturn animate.isSupported() && this._settings.animate && !(env.isIE && navigator.appVersion.indexOf(\"MSIE 9\")!=-1);\n\t},\n\thidden_setter:function(value){\n\t\tif(value)\n\t\t\tthis.hide(true);\n\t\telse\n\t\t\tthis.show();\n\t\treturn !!value;\n\t},\n\t_animate:{\n\t\tleft: {\n\t\t\tbeforeShow: function(state){\n\t\t\t\tthis.$view.style.left = -state.width+\"px\";\n\t\t\t\tthis.$view.style.top = state.top+\"px\";\n\t\t\t},\n\t\t\tshow: function(state){\n\t\t\t\tthis.$view.style.left = state.left?state.left+\"px\":\"0px\";\n\t\t\t},\n\t\t\thide: function(state){\n\t\t\t\tthis.$view.style.left = -state.width+\"px\";\n\t\t\t}\n\t\t},\n\t\tright: {\n\t\t\tbeforeShow: function(state){\n\t\t\t\tthis.$view.style.left = \"auto\";\n\t\t\t\tthis.$view.style.right = -state.width+\"px\";\n\t\t\t\tthis.$view.style.top = state.top+\"px\";\n\t\t\t},\n\t\t\tshow: function(state){\n\t\t\t\tthis.$view.style.right = state.right?state.right+\"px\":\"0px\";\n\t\t\t},\n\t\t\thide: function(state){\n\t\t\t\tthis.$view.style.right = -state.width+\"px\";\n\t\t\t}\n\t\t},\n\t\ttop: {\n\t\t\tbeforeShow: function(state){\n\t\t\t\tthis.setPosition(state.left,state.top);\n\t\t\t\tthis.$view.style.height =\"0px\";\n\t\t\t\tthis._bodyobj.style.height =\"0px\";\n\t\t\t},\n\t\t\tshow: function(state){\n\t\t\t\tthis.$view.style.height = state.height +\"px\";\n\t\t\t\tthis._bodyobj.style.height =state.height+\"px\";\n\t\t\t},\n\t\t\thide: function(){\n\t\t\t\tthis.$view.style.height = \"0px\";\n\t\t\t\tthis._bodyobj.style.height = \"0px\";\n\t\t\t}\n\t\t},\n\t\tbottom: {\n\t\t\tbeforeShow: function(state){\n\t\t\t\tthis.$view.style.left = state.left + \"px\";\n\t\t\t\tthis.$view.style.top = \"auto\";\n\t\t\t\tvar bottom = (state.bottom != undefined?state.bottom:(state.maxHeight-state.top -state.height));\n\t\t\t\tthis.$view.style.bottom = bottom +\"px\";\n\t\t\t\tthis.$view.style.height =\"0px\";\n\t\t\t},\n\t\t\tshow: function(state){\n\t\t\t\tthis.$view.style.height = state.height +\"px\";\n\t\t\t},\n\t\t\thide: function(){\n\t\t\t\tthis.$view.style.height = \"0px\";\n\t\t\t}\n\t\t}\n\t},\n\thide:function(force){\n\n\t\tif (this.$destructed) return;\n\n\t\tif (this._settings.modal)\n\t\t\tthis._modal_set(false);\n\n\t\tvar maxWidth = (window.innerWidth||document.documentElement.offsetWidth);\n\t\tvar maxHeight = (window.innerHeight||document.documentElement.offsetHeight);\n\n\t\tif (!force && this._isAnimationSupported() && maxWidth == this._state.maxWidth && maxHeight == this._state.maxHeight){\n\t\t\t// call 'hide' animation handler\n\t\t\tthis._animate[this._settings.position].hide.call(this, this._state);\n\t\t\t// hide popup\n\t\t\tvar tid = event(this.$view, env.transitionEnd, bind(function(){\n\t\t\t\tthis._hide_callback();\n\t\t\t\teventRemove(tid);\n\t\t\t},this));\n\t\t}\n\t\telse{\n\t\t\tthis._hide_callback();\n\t\t}\n\n\t\tif (this._settings.autofocus){\n\t\t\tvar el = document.activeElement;\n\t\t\tif (el && this._viewobj && this._viewobj.contains(el)){\n\t\t\t\tUIManager.setFocus(this._prev_focus);\n\t\t\t\tthis._prev_focus = null;\n\t\t\t}\n\t\t}\n\n\t\tthis._hide_sub_popups();\n\n\t}\n\n};\n\n\nconst view = protoUI(api, popup.view);\nexport default {api, view};","import {addCss, removeCss} from \"../webix/html\";\nimport {protoUI, ui, $$} from \"../ui/core\";\nimport {$active} from \"../webix/skin\";\nimport {copy, extend} from \"../webix/helpers\";\nimport {_event} from \"../webix/htmlevents\";\n\nimport type from \"../webix/type\";\nimport env from \"../webix/env\";\nimport tree from \"../views/tree\";\n\n\nconst api = {\n\tname: \"sidebar\",\n\tdefaults:{\n\t\ttitleHeight: $active.sidebarTitleHeight || 40,\n\t\ttype: \"sideBar\",\n\t\tactiveTitle: true,\n\t\tselect: true,\n\t\tscroll: false,\n\t\tcollapsed: false,\n\t\tcollapsedWidth: 44,\n\t\tposition: \"left\",\n\t\twidth: 250,\n\t\tmouseEventDelay: 10\n\t},\n\t$init: function(){\n\t\tthis.$ready.push(this._initSidebar);\n\t\tthis.$ready.push(this._initContextMenu);\n\n\t\tthis.data._scheme_init = function(obj){\n\t\t\tif (obj.data)\n\t\t\t\tobj.menu = copy(obj.data);\n\t\t\telse if (obj.item) //xml child records, can be {} or []\n\t\t\t\tobj.menu = copy(obj.item.length?obj.item:[obj.item]);\n\t\t};\n\t},\n\ton_context:{},\n\ton_mouse_move:{},\n\t_initSidebar: function(){\n\t\tthis._fullWidth = this.config.width;\n\t\tthis.attachEvent(\"onBeforeOpen\", function(id){\n\t\t\tif(!this.config.multipleOpen){\n\t\t\t\tvar open = this.getOpenItems();\n\t\t\t\tfor(var i=0; i
\" : \"\";\n\t\t\t\treturn arrow+obj.value;\n\t\t\t};\n\n\t\t\tvar popupConfig = {\n\t\t\t\tview:\"popup\",\n\t\t\t\tcss: \"webix_sidebar_popup \"+dirClassName+\" \"+config.css,\n\t\t\t\tautofit: false,\n\t\t\t\twidth: this._fullWidth - this.config.collapsedWidth,\n\t\t\t\tborderless: true,\n\t\t\t\tpadding:0,\n\t\t\t\tbody:{\n\t\t\t\t\trows:[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tview: \"template\", \tborderless: true, css: \"webix_sidebar_popup_title\",\n\t\t\t\t\t\t\ttemplate: \"#value#\", height: this.config.titleHeight+2,\n\t\t\t\t\t\t\tonClick:{\n\t\t\t\t\t\t\t\twebix_template: function(){\n\t\t\t\t\t\t\t\t\tvar id = this.masterId;\n\t\t\t\t\t\t\t\t\tif(!master.getItem(id).$count)\n\t\t\t\t\t\t\t\t\t\tmaster.select(id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ \n\t\t\t\t\t\t\tview: \"menu\", \n\t\t\t\t\t\t\tsubmenu:\"data\",\n\t\t\t\t\t\t\tlayout: \"y\",\n\t\t\t\t\t\t\tsubMenuPos:subMenuPos,\n\t\t\t\t\t\t\tselect: true,\n\t\t\t\t\t\t\tborderless: true,\n\t\t\t\t\t\t\tautoheight: true,\n\t\t\t\t\t\t\tcss: \"webix_sidebar_popup_list \"+dirClassName+\" \"+config.css,\n\t\t\t\t\t\t\ttemplate: menuTemplate,\n\t\t\t\t\t\t\ttype:{ subsign:false },\n\t\t\t\t\t\t\tsubmenuConfig:{\n\t\t\t\t\t\t\t\tpadding:0,\n\t\t\t\t\t\t\t\tsubMenuPos:subMenuPos,\n\t\t\t\t\t\t\t\ttemplate:menuTemplate,\n\t\t\t\t\t\t\t\tselect:true,\n\t\t\t\t\t\t\t\ttype:{ subsign:false },\n\t\t\t\t\t\t\t\tcss:\"webix_sidebar_popup_list \"+dirClassName+\" \"+config.css,\n\t\t\t\t\t\t\t\ton:{\n\t\t\t\t\t\t\t\t\tonShow:function(){\n\t\t\t\t\t\t\t\t\t\tthis.clearCss(\"webix_sidebar_selected\");\n\t\t\t\t\t\t\t\t\t\tthis.unselectAll();\n\t\t\t\t\t\t\t\t\t\tvar sel = master.getSelectedId();\n\t\t\t\t\t\t\t\t\t\tif(sel && this.exists(sel))\n\t\t\t\t\t\t\t\t\t\t\tthis.select(sel);\n\t\t\t\t\t\t\t\t\t\telse if(sel)\n\t\t\t\t\t\t\t\t\t\t\tmaster._markMenu(this, sel);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonBeforeSelect:function(id){\n\t\t\t\t\t\t\t\t\t\tif(this.getSubMenu(id))\n\t\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonAfterSelect:function(id){\n\t\t\t\t\t\t\t\t\t\tvar menu = master.getPopup().queryView({view:\"menu\"});\n\t\t\t\t\t\t\t\t\t\tvar parent = master.getParentId(id);\n\t\t\t\t\t\t\t\t\t\twhile(parent){\n\t\t\t\t\t\t\t\t\t\t\tvar sub = menu.getMenu(parent);\n\t\t\t\t\t\t\t\t\t\t\tif(sub){\n\t\t\t\t\t\t\t\t\t\t\t\tsub.unselectAll();\n\t\t\t\t\t\t\t\t\t\t\t\tmaster._markMenu(sub, id);\n\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\t\tparent = master.getParentId(parent);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tmaster._markMenu(this, id);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ton:{\n\t\t\t\t\t\t\t\tonBeforeSelect:function(id){\n\t\t\t\t\t\t\t\t\tif(this.getSubMenu(id))\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonMenuItemClick: function(id){\n\t\t\t\t\t\t\t\t\tif(!this.getSubMenu(id))\n\t\t\t\t\t\t\t\t\t\tmaster.select(id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t};\n\n\t\t\textend(popupConfig, config.popup||{}, true);\n\t\t\tpopup = ui(popupConfig);\n\t\t\tpopup._onMasterSelect = function(id){\n\t\t\t\tif( master && master.getParentId(id) == this.masterId){\n\t\t\t\t\taddCss(this.$view, \"webix_sidebar_selected\", true);\n\t\t\t\t}\n\t\t\t\tif(master.config.collapsed && master.getItem(id).$level ==1){\n\t\t\t\t\taddCss(this.$view, \"webix_selected\", true);\n\t\t\t\t}\n\t\t\t};\n\t\t\tpopup.queryView({view:\"menu\"})._show_child_on_click = true;\n\t\t}\n\n\t\tpopup.attachEvent(\"onBeforeShow\",function(){\n\t\t\treturn config.collapsed;\n\t\t});\n\n\t\tthis._destroy_with_me = [popup];\n\t\tconfig.popupId = popup.config.id;\n\n\t\t_event(document.body,\"mousemove\", function(e){\n\t\t\tvar trg = e.target || e.srcElement;\n\t\t\tif(!popup.config.hidden && !popup.$view.contains(trg) && !this.$view.firstChild.contains(trg) && !popup.queryView({view:\"menu\"})._open_sub_menu){\n\t\t\t\tpopup.hide();\n\t\t\t}\n\t\t}, {bind:this});\n\t},\n\t_markMenu:function(view, sel, topOnly){\n\t\tvar css = \"webix_sidebar_selected\";\n\t\tview.data.each(function(obj){\n\t\t\tif(this._isChild(sel, obj.id) && (!topOnly || this.getParentId(obj.id)==\"0\"))\n\t\t\t\tview.addCss(obj.id, css);\n\t\t\telse if(view.hasCss(obj.id, css))\n\t\t\t\tview.removeCss(obj.id, css);\n\t\t}, this);\n\t},\n\t_isChild:function(cid, pid){\n\t\tvar parent = this.getParentId(cid);\n\t\tif(pid == parent) return true;\n\t\tif(parent)\n\t\t\treturn this._isChild(parent, pid);\n\t\treturn false;\n\t},\n\tgetPopup: function(){\n\t\treturn $$(this.config.popupId);\n\t},\n\tposition_setter:function(value){\n\t\tvar newPos = value;\n\t\tvar oldPos = value==\"left\"?\"right\":\"left\";\n\n\t\tremoveCss(this.$view, \"webix_sidebar_\"+oldPos);\n\t\taddCss(this.$view, \"webix_sidebar_\"+newPos, true);\n\n\t\tvar popup = this.getPopup();\n\t\tif(popup){\n\t\t\tvar popupEl = popup.$view;\n\t\t\tremoveCss(popupEl, \"webix_sidebar_popup_\"+oldPos);\n\t\t\taddCss(popupEl, \"webix_sidebar_popup_\"+newPos, true);\n\t\t}\n\t\treturn value;\n\t},\n\tcollapse: function(){\n\t\tthis.define(\"collapsed\", true);\n\t},\n\texpand: function(){\n\t\tthis.define(\"collapsed\", false);\n\t},\n\ttoggle: function(){\n\t\tvar collapsed = !this.config.collapsed;\n\t\tthis.define(\"collapsed\", collapsed);\n\t},\n\tcollapsed_setter: function(value){\n\t\tvar width;\n\n\t\tif(!value){\n\t\t\twidth = this._fullWidth;\n\t\t\tthis.type.collapsed = false;\n\t\t\taddCss(this.$view, \"webix_sidebar_expanded\", true);\n\t\t}\n\t\telse{\n\t\t\twidth = this.config.collapsedWidth;\n\t\t\tthis.closeAll();\n\t\t\tthis.type.collapsed = true;\n\t\t\tremoveCss(this.$view, \"webix_sidebar_expanded\");\n\t\t}\n\n\t\tthis.define(\"width\",width);\n\t\tthis.resize();\n\n\t\treturn value;\n\t}\n};\n\ntype(tree.view, {\n\tname:\"sideBar\",\n\theight: \"auto\",\n\tcss: \"webix_sidebar\",\n\ttemplate: function(obj, common){\n\t\tif(common.collapsed)\n\t\t\treturn common.icon(obj, common);\n\t\treturn common.arrow(obj, common)+common.icon(obj, common) +\"\"+obj.value+\"\";\n\t},\n\tarrow: function(obj) {\n\t\tvar html = \"\";\n\t\tfor (var i=1; i<=obj.$level; i++) {\n\t\t\tif (i==obj.$level && obj.$count) {\n\t\t\t\tvar icon = \"wxi-angle-\"+(obj.open?\"down\":\"left\");\n\t\t\t\tvar className = \"webix_sidebar_dir_icon webix_icon \"+ icon;\n\t\t\t\thtml+=\"\";\n\t\t\t}\n\t\t}\n\t\treturn html;\n\t},\n\ticon: function(obj) {\n\t\tvar style = \"\";\n\t\tif (obj.$level > 2) {\n\t\t\tstyle = \"style=\\\"padding-left:\"+ (40 * (obj.$level - 2))+\"px\\\"\";\n\t\t}\n\t\tif (obj.icon)\n\t\t\treturn \"\";\n\t\treturn \"\";\n\t}\n});\n\nconst view = protoUI(api, tree.view);\nexport default {api, view};","import popup from \"../views/popup\";\nimport ContextHelper from \"../core/contexthelper\";\nimport {protoUI} from \"../ui/core\";\n\n\nconst api = {\n\tname:\"context\"\n};\n\n\nconst view = protoUI(api, ContextHelper, popup.view);\nexport default {api, view};","import submenu from \"../views/submenu\";\nimport ContextHelper from \"../core/contexthelper\";\nimport {protoUI} from \"../ui/core\";\nimport {extend} from \"../webix/helpers\";\n\n\nconst api = {\n\tname:\"contextmenu\",\n\t_hide_on_item_click:true,\n\t$init: function(config){\n\t\tif(config.submenuConfig)\n\t\t\textend(config,config.submenuConfig);\n\t}\n};\n\n\nconst view = protoUI(api, ContextHelper, submenu.view);\nexport default {api, view};","import EventSystem from \"../core/eventsystem\";\nimport Settings from \"../core/settings\";\nimport {addCss, preventEvent} from \"../webix/html\";\nimport {protoUI} from \"../ui/core\";\nimport env from \"../webix/env\";\nimport Touch from \"../core/touch\";\nimport {toNode, isUndefined} from \"../webix/helpers\";\nimport {_event, event} from \"../webix/htmlevents\";\n\n\nconst api = {\n\tname:\"vscroll\",\n\t$apiOnly:true,\n\tdefaults:{\n\t\tscroll:\"x\",\n\t\tscrollStep:40,\n\t\tscrollPos:0,\n\t\tscrollSize:18,\n\t\tscrollVisible:1,\n\t\tzoom:1\n\t},\n\t$init:function(config){\n\t\tvar dir = config.scroll||\"x\";\n\t\tvar node = this._viewobj = toNode(config.container);\n\t\tnode.className += \" webix_vscroll_\"+dir;\n\t\tnode.innerHTML=\"
\";\n\t\t_event(node,\"scroll\", this._onscroll,{bind:this});\n\n\t\tthis._last_set_size = 0;\n\t},\n\treset:function(){\n\t\tthis.config.scrollPos = 0;\n\t\tthis._viewobj[this.config.scroll == \"x\"?\"scrollLeft\":\"scrollTop\"] = 0;\n\t},\n\t_check_quantum:function(value){\n\t\tif (value>1500000){\n\t\t\tthis._settings.zoom = value/1000000;\n\t\t\tvalue = 1000000;\n\t\t} else {\n\t\t\tthis._settings.zoom = 1;\n\t\t}\n\t\treturn value;\n\t},\t\n\tscrollWidth_setter:function(value){\n\t\tvalue = this._check_quantum(value);\n\t\tthis._viewobj.firstChild.style.width = value+\"px\";\n\t\treturn value;\t\t\n\t},\n\tscrollHeight_setter:function(value){\n\t\tvalue = this._check_quantum(value);\n\t\tthis._viewobj.firstChild.style.height = value+\"px\";\n\t\treturn value;\n\t},\n\tsizeTo:function(value, top, bottom){\n\t\tvalue = value-(top||0)-(bottom||0);\n\n\t\tvar width = this._settings.scrollSize;\n\t\t//IEFix\n\t\t//IE doesn't react on scroll-click if it has not at least 1 px of visible content\n\t\tif (env.isIE && width)\n\t\t\twidth += 1;\n\t\tif (!width && this._settings.scrollVisible && !env.$customScroll){\n\t\t\tthis._viewobj.style.pointerEvents=\"none\";\n\t\t\twidth = 14;\n\t\t}\n\n\t\tif (!width){\n\t\t\tthis._viewobj.style.display = \"none\";\n\t\t} else {\n\t\t\tthis._viewobj.style.display = \"block\";\n\t\t\tif (top)\n\t\t\t\tthis._viewobj.style.marginTop = top+ \"px\";\n\t\t\tthis._viewobj.style[this._settings.scroll == \"x\"?\"width\":\"height\"] = Math.max(0,value)+\"px\";\n\t\t\tthis._viewobj.style[this._settings.scroll == \"x\"?\"height\":\"width\"] = width+\"px\";\n\t\t}\n\n\t\tthis._last_set_size = value;\n\t},\n\tgetScroll:function(){\n\t\treturn Math.round(this._settings.scrollPos*this._settings.zoom);\n\t},\n\tgetSize:function(){\n\t\treturn Math.round((this._settings.scrollWidth||this._settings.scrollHeight)*this._settings.zoom);\n\t},\n\tscrollTo:function(value){\n\t\tif (value<0)\n\t\t\tvalue = 0;\n\t\tvar config = this._settings;\n\n\t\tvalue = value / config.zoom;\n\t\t//safety check for negative values\n\t\tif (value < 0) value = 0;\n\n\t\t//apply new position\n\t\tif (value != this._settings.scrollPos){\n\t\t\tthis._viewobj[config.scroll == \"x\"?\"scrollLeft\":\"scrollTop\"] = value;\n\t\t\tthis._onscroll_inner(value, true);\n\t\t\treturn true;\n\t\t}\n\t},\n\t_onscroll:function(){\t\n\t\tvar x = this._viewobj[this._settings.scroll == \"x\"?\"scrollLeft\":\"scrollTop\"];\n\t\tif (Math.floor(x) != Math.floor(this._settings.scrollPos))\n\t\t\tthis._onscroll_inner(x, false);\n\t},\n\t_onscroll_inner:function(value, api){\n\t\t//size of scroll area\n\t\tvar height = (this._settings.scrollWidth||this._settings.scrollHeight);\n\t\t//if we scrolled to the end of the area\n\t\tif (value >= height - this._last_set_size/(api?this._settings.zoom:1)) {\n\t\t\t//set value so the last row is visible\n\t\t\tvalue = Math.max(0, height - this._last_set_size/this._settings.zoom);\n\t\t}\n\t\t\n\t\tthis._settings.scrollPos = value || 0;\n\t\tthis.callEvent(\"onScroll\",[this.getScroll()]);\n\t},\n\tactiveArea:function(area, x_mode){\n\t\tthis._x_scroll_mode = x_mode;\n\t\t_event(area,(env.isIE8 ? \"mousewheel\" : \"wheel\"),this._on_wheel,{bind:this, passive:false});\n\t\tthis._add_touch_events(area);\n\t},\n\n\t_add_touch_events: function(area){\n\t\tif(!env.touch && window.navigator.pointerEnabled){\n\t\t\taddCss(area,\"webix_scroll_touch_ie\",true);\n\t\t\t_event(area, \"pointerdown\", function(e){\n\t\t\t\tif(e.pointerType == \"touch\" || e.pointerType == \"pen\"){\n\t\t\t\t\tthis._start_context = Touch._get_context_m(e);\n\t\t\t\t\tthis._start_scroll_pos = this.getScroll();\n\t\t\t\t}\n\t\t\t},{bind:this});\n\n\t\t\tevent(document.body, \"pointermove\", function(e){\n\t\t\t\tvar scroll;\n\t\t\t\tif(this._start_context){\n\t\t\t\t\tthis._current_context = Touch._get_context_m(e);\n\t\t\t\t\tif(this._settings.scroll == \"x\" ){\n\t\t\t\t\t\tscroll = this._current_context.x - this._start_context.x;\n\t\t\t\t\t}\n\t\t\t\t\telse if(this._settings.scroll == \"y\"){\n\t\t\t\t\t\tscroll = this._current_context.y - this._start_context.y;\n\t\t\t\t\t}\n\t\t\t\t\tif(scroll && Math.abs(scroll) > 5){\n\t\t\t\t\t\tthis.scrollTo(this._start_scroll_pos - scroll);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},{bind:this});\n\t\t\tevent(window, \"pointerup\", function(){\n\t\t\t\tif(this._start_context){\n\t\t\t\t\tthis._start_context = this._current_context = null;\n\t\t\t\t}\n\t\t\t},{bind:this});\n\t\t}\n\n\t},\n\t_on_wheel:function(e){\n\t\tvar dir = 0;\n\t\tvar step = e.deltaMode === 0 ? 30 : 1;\n\n\t\tif (env.isIE8)\n\t\t\tdir = e.detail = -e.wheelDelta / 30;\n\n\t\tif (e.deltaX && Math.abs(e.deltaX) > Math.abs(e.deltaY)){\n\t\t\t//x-scroll\n\t\t\tif (this._x_scroll_mode && this._settings.scrollVisible)\n\t\t\t\tdir = e.deltaX / step;\n\t\t} else {\n\t\t\t//y-scroll\n\t\t\tif (!this._x_scroll_mode && this._settings.scrollVisible){\n\t\t\t\tif (isUndefined(e.deltaY))\n\t\t\t\t\tdir = e.detail;\n\t\t\t\telse\n\t\t\t\t\tdir = e.deltaY / step;\n\t\t\t}\n\t\t}\n\n\t\t// Safari requires target preserving\n\t\t// (used in _check_rendered_cols of DataTable)\n\t\tif(env.isSafari)\n\t\t\tthis._scroll_trg = e.target|| e.srcElement;\n\n\t\tif (dir)\n\t\t\tif (this.scrollTo(this.getScroll() + dir*this._settings.scrollStep))\n\t\t\t\treturn preventEvent(e);\n\n\t}\n};\n\n\nconst view = protoUI(api, EventSystem, Settings);\nexport default {api, view};","import {extend, bind, isArray} from \"../../webix/helpers\";\nimport {$$} from \"../../ui/core\";\nimport {assert} from \"../../webix/debug\";\n\n\nconst Mixin = {\n\tfilterByAll:function(){\n\t\t//we need to use dynamic function creating\n\t\tvar server = false;\n\t\tthis.data.silent(function(){\n\t\t\tthis.filter();\n\t\t\tvar first = false;\n\t\t\tfor (var key in this._filter_elements){\n\t\t\t\tassert(key, \"empty column id for column with filtering\");\n\t\t\t\tif(!this.isColumnVisible(key))\n\t\t\t\t\tcontinue;\n\t\t\t\tvar record = this._filter_elements[key];\n\t\t\t\tvar originvalue = record[2].getValue(record[0]);\n\n\t\t\t\t//saving last filter value, for usage in getState\n\t\t\t\tvar inputvalue = originvalue;\n\t\t\t\tif (record[1].prepare)\n\t\t\t\t\tinputvalue = record[1].prepare.call(record[2], inputvalue, record[1], this);\n\n\t\t\t\t//preserve original value\n\t\t\t\trecord[1].value = originvalue;\n\t\t\t\tvar compare = record[1].compare;\n\n\t\t\t\tif (!this.callEvent(\"onBeforeFilter\",[key, inputvalue, record[1]])) continue;\n\t\t\t\tif(record[2].$server || server){ //if one of filters is server side, do not run any client side filters\n\t\t\t\t\tserver = true;\n\t\t\t\t} else {\n\t\t\t\t\tif (inputvalue === \"\") continue;\n\n\t\t\t\t\tif (compare){\n\t\t\t\t\t\tcompare = this._multi_compare(key, compare);\n\t\t\t\t\t\tthis.filter(bind(function(obj, value){\n\t\t\t\t\t\t\tif (!obj) return false;\n\t\t\t\t\t\t\treturn compare(obj[key], value, obj);\n\t\t\t\t\t\t},this), inputvalue, first);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tthis.filter(key, inputvalue, first);\n\n\t\t\t\t\tfirst = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (server)\n\t\t\t\tthis._runServerFilter();\n\n\t\t}, this);\n\n\t\tif (!server){\n\t\t\tthis.refresh();\n\t\t\tthis.callEvent(\"onAfterFilter\",[]);\n\t\t}\n\t},\n\t_multi_compare: function(key, compare){\n\t\tvar column = this.getColumnConfig(key);\n\t\tvar separator = column ? column.optionslist : null;\n\n\t\t//default mode\n\t\tif (!separator) \n\t\t\treturn compare;\n\n\t\tif(typeof separator != \"string\")\n\t\t\tseparator = \",\";\n\n\t\treturn function(itemValue, inputValue, obj){\n\t\t\tif(!itemValue)\n\t\t\t\treturn true;\n\t\t\tvar ids = itemValue.split(separator);\n\t\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\t\tif (compare(ids[i], inputValue, obj))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t},\n\tfilterMode_setter:function(mode){\n\t\treturn extend(this.data._filterMode, mode, true);\n\t},\n\tgetFilter:function(columnId){\n\t\tvar filter = this._filter_elements[columnId];\n\t\tassert(filter, \"Filter doesn't exists for column in question\");\n\n\t\tif (filter && filter[2].getInputNode)\n\t\t\treturn filter[2].getInputNode(filter[0]);\n\t\treturn null;\n\t},\n\tregisterFilter:function(node, config, obj){\n\t\tthis._filter_elements[config.columnId] = [node, config, obj];\n\t},\n\tcollectValues:function(id){\n\t\tvar values = [];\n\t\tvar checks = { \"\" : true };\n\n\t\tvar obj = this.getColumnConfig(id);\n\t\tvar options = obj.options||obj.collection;\n\n\t\tif (options){\n\t\t\tif (typeof options == \"object\" && !options.loadNext){\n\t\t\t\t//raw object\n\t\t\t\tif (isArray(options))\n\t\t\t\t\tfor (var i=0; i=0 ; i--){\n\t\t\t\t\tvar row = this._selected_areas[i].row;\n\t\t\t\t\tif (!this.exists(row)){\n\t\t\t\t\t\tthis._selected_areas.splice(i,1);\n\t\t\t\t\t\tdelete this._selected_pull[row];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t_reinit_selection:function(){\n\t\t\t\t//list of selected areas\n\t\t\t\tthis._selected_areas=[];\n\t\t\t\t//key-value hash of selected areas, for fast search\n\t\t\t\tthis._selected_pull={};\n\t\t\t\t//used to track selected cell objects\n\t\t\t\tthis._selected_rows = [];\n\t\t\t},\n\t\t\tisSelected:function(id, column){\n\t\t\t\tvar key;\n\t\t\t\tif (!isUndefined(column))\n\t\t\t\t\tkey = this._select_key({ row:id, column: column});\n\t\t\t\telse \n\t\t\t\t\tkey = typeof id === \"object\"? this._select_key(id) : id;\n\n\t\t\t\treturn this._selected_pull[key];\n\t\t\t},\n\t\t\tgetSelectedId:function(asArray, plain){\n\t\t\t\tvar result;\n\n\t\t\t\t//if multiple selections was created - return array\n\t\t\t\t//in case of single selection, return value or array, when asArray parameter provided\n\t\t\t\tif (this._selected_areas.length > 1 || asArray){\n\t\t\t\t\tresult = [].concat(this._selected_areas);\n\t\t\t\t\tif (plain)\n\t\t\t\t\t\tfor (let i = 0; i < result.length; i++)\n\t\t\t\t\t\t\tresult[i]=result[i].id;\n\t\t\t\t} else {\n\t\t\t\t\tresult = this._selected_areas[0];\n\t\t\t\t\tif (plain && result)\n\t\t\t\t\t\treturn result.id;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t_id_to_string:function(){\n\t\t\t\treturn this.row;\n\t\t\t},\n\t\t\t_select:function(data, preserve){\n\t\t\t\tvar key = this._select_key(data);\n\t\t\t\t//don't allow selection on unnamed columns\n\t\t\t\tif (key === null) return;\n\n\t\t\t\tif (preserve === -1)\n\t\t\t\t\treturn this._unselect(data);\n\n\t\t\t\tdata.id = key;\n\t\t\t\tdata.toString = this._id_to_string;\n\n\t\t\t\tif (!this.callEvent(\"onBeforeSelect\",[data, preserve])) return false;\n\n\t\t\t\t//ignore area, if it was already selected and\n\t\t\t\t// - we are preserving existing selection\n\t\t\t\t// - this is the only selected area\n\t\t\t\t// otherwise we need to clear other selected areas\n\t\t\t\tif (this._selected_pull[key] && (preserve || this._selected_areas.length == 1)) return;\n\n\t\t\t\tif (!preserve)\n\t\t\t\t\tthis._clear_selection();\n\n\t\t\t\tthis._selected_areas.push(data);\n\t\t\t\tthis._selected_pull[key] = true;\n\n\t\t\t\tthis.callEvent(\"onAfterSelect\",[data, preserve]);\n\n\t\t\t\t\n\t\t\t\tthis._finalize_select(this._post_select(data));\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\t_clear_selection:function(){\n\t\t\t\tif (!this._selected_areas.length) return false;\n\n\t\t\t\tfor (let i=0; irow_end_ind){\n\t\t\t\t\tvar temp = row_start_ind;\n\t\t\t\t\trow_start_ind = row_end_ind;\n\t\t\t\t\trow_end_ind = temp;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthis._silent_selection = true;\n\t\t\t\tfor (let i=row_start_ind; i<=row_end_ind; i++){\n\t\t\t\t\tvar id = this.getIdByIndex(i);\n\t\t\t\t\tif (!id){\n\t\t\t\t\t\tif (row_id)\n\t\t\t\t\t\t\tthis.select(row_id);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tthis.select(id, preserve);\n\t\t\t\t}\n\n\t\t\t\tthis._silent_selection = false;\n\t\t\t\tthis._finalize_select();\n\t\t\t}\n\t\t},\n\n\t\tcell:{\n\t\t\t_select_key:function(data){\n\t\t\t\tif (!data.column) return null;\n\t\t\t\treturn data.row+\"_\"+data.column; \n\t\t\t},\n\t\t\tselect:function(row_id, column_id, preserve){\n\t\t\t\tassert(this.data.exists(row_id), \"Incorrect id in select command: \"+row_id);\n\t\t\t\tthis._select({row:row_id, column:column_id}, preserve);\n\t\t\t},\n\t\t\t_post_select:function(data){\n\t\t\t\tvar sel = this._add_item_select(data.row);\n\t\t\t\tsel.$count++;\n\t\t\t\tsel[data.column]=true;\n\t\t\t\treturn data.row;\n\t\t\t},\n\t\t\tunselect:function(row_id, column_id){\n\t\t\t\tthis._unselect({row:row_id, column:column_id});\n\t\t\t},\n\t\t\t_post_unselect:function(data){\n\t\t\t\tvar sel = this._add_item_select(data.row);\n\t\t\t\tsel.$count-- ;\n\t\t\t\tsel[data.column] = false;\n\t\t\t\tif (sel.$count<=0)\n\t\t\t\t\tthis.data.removeMark(data.row,\"webix_selected\");\n\t\t\t\treturn data.row;\n\t\t\t},\n\t\t\tmapSelection:function(callback){\n\t\t\t\treturn this._mapSelection(callback, false, false);\n\t\t\t},\n\t\t\t_selectRange:function(a,b){\n\t\t\t\treturn this.selectRange(a.row, a.column, b.row, b.column);\n\t\t\t},\n\n\t\t\tselectRange:function(row_id, column_id, end_row_id, end_column_id, preserve){\n\t\t\t\tif (isUndefined(preserve)) preserve = true;\n\n\t\t\t\tvar row_start_ind = row_id ? this.getIndexById(row_id) : 0;\n\t\t\t\tvar row_end_ind = end_row_id ? this.getIndexById(end_row_id) : this.data.order.length-1;\n\n\t\t\t\tvar col_start_ind = column_id ? this.getColumnIndex(column_id) : 0;\n\t\t\t\tvar col_end_ind = end_column_id ? this.getColumnIndex(end_column_id) : this._columns.length-1;\n\n\t\t\t\tif (row_start_ind>row_end_ind){\n\t\t\t\t\tlet temp = row_start_ind;\n\t\t\t\t\trow_start_ind = row_end_ind;\n\t\t\t\t\trow_end_ind = temp;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (col_start_ind>col_end_ind){\n\t\t\t\t\tlet temp = col_start_ind;\n\t\t\t\t\tcol_start_ind = col_end_ind;\n\t\t\t\t\tcol_end_ind = temp;\n\t\t\t\t}\n\n\t\t\t\tthis._silent_selection = true;\n\t\t\t\tfor (let i=row_start_ind; i<=row_end_ind; i++)\n\t\t\t\t\tfor (let j=col_start_ind; j<=col_end_ind; j++)\n\t\t\t\t\t\tthis.select(this.getIdByIndex(i), this.columnId(j), preserve);\n\t\t\t\tthis._silent_selection = false;\n\t\t\t\tthis._finalize_select();\n\t\t\t}\n\t\t},\n\n\t\tcolumn:{\n\t\t\t_select_css:\" webix_column_select\",\n\t\t\t_select_key:function(data){ return data.column; },\n\t\t\t_id_to_string:function(){\n\t\t\t\treturn this.column;\n\t\t\t},\n\t\t\t//returns box-like area, with ordered selection cells\n\t\t\tselect:function(column_id, preserve){\n\t\t\t\tthis._select({ column:column_id }, preserve);\n\t\t\t},\n\t\t\t_post_select:function(data){\n\t\t\t\tthis._settings.columns[this.getColumnIndex(data.column)].$selected = true;\n\t\t\t\tif (!this._silent_selection)\n\t\t\t\t\tthis._render_header_and_footer();\n\t\t\t},\n\t\t\tunselect:function(column_id){\n\t\t\t\tthis._unselect({column : column_id});\n\t\t\t},\n\t\t\t_post_unselect:function(data){\n\t\t\t\tthis._settings.columns[this.getColumnIndex(data.column)].$selected = null;\n\t\t\t\tthis._render_header_and_footer();\n\t\t\t},\n\t\t\tmapSelection:function(callback){\n\t\t\t\treturn this._mapSelection(callback, true, false);\n\t\t\t},\n\t\t\t_selectRange:function(a,b){\n\t\t\t\treturn this.selectRange(a.column, b.column);\n\t\t\t},\n\t\t\tselectRange:function(column_id, end_column_id, preserve){\n\t\t\t\tif (isUndefined(preserve)) preserve = true;\n\n\t\t\t\tvar column_start_ind = column_id ? this.getColumnIndex(column_id) : 0;\n\t\t\t\tvar column_end_ind = end_column_id ? this.getColumnIndex(end_column_id) : this._columns.length-1;\n\n\t\t\t\tif (column_start_ind>column_end_ind){\n\t\t\t\t\tvar temp = column_start_ind;\n\t\t\t\t\tcolumn_start_ind = column_end_ind;\n\t\t\t\t\tcolumn_end_ind = temp;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthis._silent_selection = true;\n\t\t\t\tfor (let i=column_start_ind; i<=column_end_ind; i++)\n\t\t\t\t\tthis.select(this.columnId(i), preserve);\n\n\t\t\t\tthis._silent_selection = false;\n\n\t\t\t\tthis._render_header_and_footer();\n\t\t\t\tthis._finalize_select();\n\t\t\t},\n\t\t\t_data_synced:function(){\n\t\t\t\t//do nothing, as columns are not changed\n\t\t\t}\n\t\t},\n\t\tarea: {\n\t\t\t_select_key:function(data){\n\t\t\t\treturn data.row+\"_\"+data.column;\n\t\t\t},\n\t\t\tgetSelectedId: function(asArray){\n\t\t\t\tvar area = this.getSelectArea();\n\t\t\t\tvar result = [];\n\t\t\t\tif(area){\n\t\t\t\t\tif(asArray && ( area.start.row != area.end.row || area.start.column != area.end.column )){\n\t\t\t\t\t\tvar row_start_ind = this.getIndexById(area.start.row);\n\t\t\t\t\t\tvar row_end_ind = this.getIndexById(area.end.row);\n\t\t\t\t\t\t//filtering in process\n\t\t\t\t\t\tif(row_start_ind == -1 || row_end_ind == -1)\n\t\t\t\t\t\t\treturn result;\n\n\t\t\t\t\t\tvar col_start_ind = this.getColumnIndex(area.start.column);\n\t\t\t\t\t\tvar col_end_ind = this.getColumnIndex(area.end.column);\n\n\t\t\t\t\t\tfor (let i=row_start_ind; i<=row_end_ind; i++)\n\t\t\t\t\t\t\tfor (var j=col_start_ind; j<=col_end_ind; j++)\n\t\t\t\t\t\t\t\tresult.push({row:this.getIdByIndex(i), column:this.columnId(j)});\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tresult.push(area.end);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn asArray?result:result[0];\n\t\t\t},\n\t\t\tunselect:function(){\n\t\t\t\tthis._unselect();\n\t\t\t},\n\t\t\t_unselect: function() {\n\t\t\t\tthis.removeSelectArea();\n\t\t\t\tthis.callEvent(\"onSelectChange\", []);\n\t\t\t},\n\t\t\tmapSelection:function(callback){\n\t\t\t\tvar select = this.getSelectArea();\n\t\t\t\tif (select){\n\t\t\t\t\tvar sind = this.getColumnIndex(select.start.column);\n\t\t\t\t\tvar eind = this.getColumnIndex(select.end.column);\n\t\t\t\t\tvar srow = this.getIndexById(select.start.row);\n\t\t\t\t\tvar erow = this.getIndexById(select.end.row);\n\n\t\t\t\t\tfor (let i = srow; i <= erow; i++) {\n\t\t\t\t\t\tvar rid = this.data.order[i];\n\t\t\t\t\t\tvar item = this.getItem(rid);\n\t\t\t\t\t\tfor (var j = sind; j <= eind; j++) {\n\t\t\t\t\t\t\tvar cid = this._columns[j].id;\n\t\t\t\t\t\t\tif (callback)\n\t\t\t\t\t\t\t\titem[cid] = callback((item[cid] || \"\"), rid, cid, i-srow, j-sind);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\treturn { row:rid, column:cid };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tselect:function(row_id, column_id, preserve){\n\t\t\t\tassert(this.data.exists(row_id), \"Incorrect id in select command: \"+row_id);\n\t\t\t\tthis._select({row:row_id, column:column_id}, preserve);\n\t\t\t},\n\t\t\t_selectRange:function(id,last){\n\t\t\t\tthis._extendAreaRange(id, last);\n\t\t\t},\n\t\t\t_select: function(cell){\n\t\t\t\t//ctrl-selection is not supported yet, so ignoring the preserve flag\n\t\t\t\tthis.addSelectArea(cell,cell,false);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\t_data_synced:function(){\n\t\t\t\tif(this._selected_areas.length)\n\t\t\t\t\tthis.refreshSelectArea();\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport default Mixin;","import {offset, pos as getPos, preventEvent, remove, removeCss, create, addCss} from \"../../webix/html\";\nimport env from \"../../webix/env\";\nimport {extend, delay} from \"../../webix/helpers\";\nimport {$$} from \"../../ui/core\";\nimport {_event, event} from \"../../webix/htmlevents\";\nimport AutoScroll from \"../../core/autoscroll\";\n\n\n// #include core/autoscroll.js\nconst Mixin = {\n\tblockselect_setter:function(value){\n\t\tif (value && this._block_sel_flag){\n\t\t\t_event(this._viewobj, env.mouse.move, this._bs_move, {bind:this});\n\t\t\t_event(this._viewobj, env.mouse.down, this._bs_down, {bind:this});\n\t\t\tevent(document.body, env.mouse.up, this._bs_up, {bind:this});\n\t\t\tthis._block_sel_flag = this._bs_ready = this._bs_progress = false;\n\t\t\tthis.attachEvent(\"onAfterScroll\", function(){\n\t\t\t\tthis._update_block_selection();\n\t\t\t});\n\t\t\t// auto scroll\n\t\t\textend(this, AutoScroll, true);\n\t\t\tthis.attachEvent(\"onBeforeAutoScroll\",function(){\n\t\t\t\treturn this._bs_progress;\n\t\t\t});\n\t\t}\n\t\treturn value;\n\t},\n\t_block_sel_flag:true,\n\t_childOf:function(e, tag){\n\t\tvar src = e.target||e.srcElement;\n\t\twhile (src){\n\t\t\tif (src.getAttribute && src.getAttribute(\"webixignore\")) return false;\n\t\t\tif (src == tag)\n\t\t\t\treturn true;\n\t\t\tsrc = src.parentNode;\n\t\t}\n\t\treturn false;\n\t},\n\t_bs_down:function(e){\n\t\t// do not listen to mousedown of subview on master\n\t\tif (this._settings.subview && this != $$(e.target||e.srcElement)) return;\n\t\tif (this._childOf(e, this._body)){\n\t\t\t//disable block selection when we have an active editor\n\t\t\tif (e.target && e.target.tagName == \"INPUT\" || this._rs_process) return;\n\n\t\t\tthis._bs_position = offset(this._body);\n\t\t\tvar pos = getPos(e);\n\t\t\tthis._bs_ready = [pos.x - this._bs_position.x, pos.y - this._bs_position.y];\n\t\t\tpreventEvent(e);\n\t\t}\n\t},\n\t_bs_up:function(e){\n\t\tif (this._block_panel){\n\t\t\tthis._bs_select(\"select\", true, e);\n\t\t\tthis._block_panel = remove(this._block_panel);\n\t\t}\n\t\tremoveCss(document.body,\"webix_noselect\");\n\t\tthis._bs_ready = this._bs_progress = false;\n\t\tif (this._auto_scroll_delay)\n\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\t},\n\t_update_block_selection: function(){\n\t\tif (this._bs_progress)\n\t\t\tthis._bs_select(false, false);\n\t},\n\t_bs_select:function(mode, theend, e){\n\t\tvar start = null;\n\t\tif(!this._bs_ready[2])\n\t\t\tthis._bs_ready[2] = this._locate_cell_xy.apply(this, this._bs_ready);\n\t\tstart = this._bs_ready[2];\n\n\t\tvar end = this._locate_cell_xy.apply(this, this._bs_progress);\n\n\t\tif (!this.callEvent(\"onBeforeBlockSelect\", [start, end, theend, e]))\n\t\t\treturn;\n\n\t\tif ((!this._bs_do_select || this._bs_do_select(start, end, theend, e) !== false) && (start.row && end.row)){\n\t\t\tif (mode === \"select\"){\n\t\t\t\tthis._clear_selection();\n\t\t\t\tthis._selectRange(start, end);\n\t\t\t} else {\n\t\t\t\tvar startx, starty, endx, endy;\n\n\t\t\t\tif (mode === \"box\"){\n\t\t\t\t\tstartx = Math.min(this._bs_ready[0],this._bs_progress[0]);\n\t\t\t\t\tendx = Math.max(this._bs_ready[0],this._bs_progress[0]);\n\n\t\t\t\t\tstarty = Math.min(this._bs_ready[1],this._bs_progress[1]);\n\t\t\t\t\tendy = Math.max(this._bs_ready[1],this._bs_progress[1]);\n\t\t\t\t} else {\n\t\t\t\t\tvar startn = this._cellPosition(start.row, start.column);\n\t\t\t\t\tvar endn = this._cellPosition(end.row, end.column);\n\t\t\t\t\tvar scroll = this.getScrollState();\n\n\t\t\t\t\tvar startWidth = startn.width;\n\t\t\t\t\tvar endWidth = endn.width;\n\n\t\t\t\t\tif (this._right_width && this._bs_ready[0] > this._left_width+this._center_width){\n\t\t\t\t\t\tstartn.left += this._left_width+this._center_width;\n\t\t\t\t\t} else if (this._left_width){\n\n\t\t\t\t\t\tif (this._bs_ready[0] > this._left_width){\n\t\t\t\t\t\t\tif(startn.left < scroll.x){\n\t\t\t\t\t\t\t\tstartWidth -= scroll.x-startn.left;\n\t\t\t\t\t\t\t\tstartn.left = this._left_width;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstartn.left+=this._left_width-scroll.x;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else startn.left -= scroll.x;\n\n\n\n\t\t\t\t\tif (this._right_width && this._bs_progress[0] > this._left_width+this._center_width){\n\t\t\t\t\t\tendn.left += this._left_width+this._center_width;\n\t\t\t\t\t} else if (this._left_width){\n\t\t\t\t\t\tif (this._bs_progress[0] > this._left_width){\n\t\t\t\t\t\t\tif(endn.left < scroll.x){\n\t\t\t\t\t\t\t\tendWidth -= scroll.x-endn.left;\n\t\t\t\t\t\t\t\tendn.left = this._left_width;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tendn.left+=this._left_width-scroll.x;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else endn.left -= scroll.x;\n\n\t\t\t\t\tif(this._settings.prerender){\n\t\t\t\t\t\tstartn.top -= this._scrollTop;\n\t\t\t\t\t\tendn.top -= this._scrollTop;\n\t\t\t\t\t}\n\n\n\t\t\t\t\tstartx = Math.min(startn.left, endn.left);\n\t\t\t\t\tendx = Math.max(startn.left+startWidth, endn.left+endWidth);\n\n\t\t\t\t\tstarty = Math.min(startn.top, endn.top);\n\t\t\t\t\tendy = Math.max(startn.top+startn.height, endn.top+endn.height);\n\n\t\t\t\t\tif(this._settings.topSplit)\n\t\t\t\t\t\tstarty += this._getTopSplitOffset(start);\n\n\t\t\t\t\tif (this._auto_scroll_delay)\n\t\t\t\t\t\tthis._auto_scroll_delay = window.clearTimeout(this._auto_scroll_delay);\n\t\t\t\t\tif(e)\n\t\t\t\t\t\tthis._auto_scroll_delay = delay(this._auto_scroll, this, [getPos(e)], 250);\n\t\t\t\t}\n \n\n\t\t\t\tvar style = this._block_panel.style;\n\t\t\t\tstyle.left = startx+\"px\";\n\t\t\t\tstyle.top = starty+\"px\";\n\t\t\t\tstyle.width = (endx-startx)+\"px\";\n\t\t\t\tstyle.height = (endy-starty)+\"px\";\n\n\t\t\t}\n\t\t}\n\n\t\tif (theend)\n\t\t\tthis.callEvent(\"onAfterBlockSelect\", [start, end]);\n\t},\n\t_bs_start:function(){\n\t\tthis._block_panel = create(\"div\", {\"class\":\"webix_block_selection\"},\"\");\n\n\t\tthis._body.appendChild(this._block_panel);\n\t},\n\t_bs_move:function(e){\n\t\tif (this._bs_ready !== false){\n\t\t\tif(!this._bs_progress) addCss(document.body,\"webix_noselect\");\n\t\t\t\n\t\t\tvar pos = getPos(e);\n\t\t\tvar progress = [pos.x - this._bs_position.x, pos.y - this._bs_position.y];\n\n\t\t\t//prevent unnecessary block selection while dbl-clicking\n\t\t\tif (Math.abs(this._bs_ready[0] - progress[0]) < 5 && Math.abs(this._bs_ready[1] - progress[1]) < 5)\n\t\t\t\treturn;\n\n\t\t\tif (this._bs_progress === false)\n\t\t\t\tthis._bs_start(e);\n\n\t\t\tthis._bs_progress = progress;\n\t\t\tthis._bs_select(this.config.blockselect, false, e);\n\t\t}\n\t},\n\t_locate_cell_xy:function(x,y){\n\t\tvar inTopSplit = false,\n\t\t\trow = null,\n\t\t\tcolumn = null;\n\n\n\t\tif (this._right_width && x>this._left_width + this._center_width)\n\t\t\tx+= this._x_scroll.getSize()-this._center_width-this._left_width-this._right_width; \n\t\telse if (!this._left_width || x>this._left_width)\n\t\t\tx+= this._x_scroll.getScroll();\n\n\t\tif(this._settings.topSplit && this._render_scroll_top > this._settings.topSplit) {\n\t\t\tvar splitPos = this._cellPosition(this.getIdByIndex(this._settings.topSplit-1), this.columnId(0));\n\t\t\tif(splitPos.top + splitPos.height > y){\n\t\t\t\tinTopSplit = true;\n\t\t\t}\n\t\t}\n\t\tif(!inTopSplit)\n\t\t\ty += this.getScrollState().y;\n\n\t\tif (x<0) x=0;\n\t\tif (y<0) y=0;\n\n\t\tvar cols = this._settings.columns;\n\t\tvar rows = this.data.order;\n\n\t\tvar summ = 0; \n\t\tfor (let i=0; i=x){\n\t\t\t\tcolumn = cols[i].id;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!column)\n\t\t\tcolumn = cols[cols.length-1].id;\n\n\t\tsumm = 0;\n\n\t\tvar start = this.data.$min || 0;\n\t\tif (this._settings.fixedRowHeight){\n\t\t\trow = rows[start + Math.floor(y/this._settings.rowHeight)];\n\t\t} else for (let i=start; i=y){\n\t\t\t\trow = rows[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!row)\n\t\t\trow = rows[rows.length-1];\n\n\t\treturn {row:row, column:column};\n\t},\n\t_getTopSplitOffset: function(cell, area){\n\t\tvar y = 0,\n\t\t\tstartIndex = this.getIndexById(cell.row);\n\n\t\tif(startIndex >= this._settings.topSplit){\n\t\t\tvar startPos = this._cellPosition(this.getIdByIndex(startIndex), cell.column);\n\t\t\tvar splitPos = this._cellPosition(this.getIdByIndex(this._settings.topSplit-1), cell.column);\n\t\t\tif(splitPos.top + splitPos.height - startPos.top > 0){\n\t\t\t\ty = splitPos.top + splitPos.height - (startPos.top>0 ||!area?startPos.top:0);\n\t\t\t}\n\t\t}\n\n\t\treturn y;\n\t}\n};\n\nexport default Mixin;","import {pos, addCss, denySelect, removeCss, allowSelect, offset, posRelative} from \"../../webix/html\";\nimport {bind, delay} from \"../../webix/helpers\";\nimport {$$, ui} from \"../../ui/core\";\nimport {_event} from \"../../webix/htmlevents\";\n\n//indirect import\nimport \"../resizearea\";\n\nconst Mixin = {\n\n\tresizeRow_setter:function(value){\n\t\tthis._settings.scrollAlignY = false;\n\t\tthis._settings.fixedRowHeight = false;\n\t\treturn this.resizeColumn_setter(value);\n\t},\n\tresizeColumn_setter:function(value){\n\t\tif (value && this._rs_init_flag){\n\t\t\t_event(this._viewobj, \"mousemove\", this._rs_move, {bind:this});\n\t\t\t_event(this._viewobj, \"mousedown\", this._rs_down, {bind:this});\n\t\t\t_event(this._viewobj, \"mouseup\", this._rs_up, {bind:this});\n\t\t\tthis._rs_init_flag = false;\n\t\t}\n\t\treturn value;\n\t},\n\t_rs_init_flag:true,\n\t_rs_down:function(e){\n\t\t// do not listen to mousedown of subview on master\n\t\tif (this._settings.subview && this != $$(e.target||e.srcElement)) return;\n\t\t//if mouse was near border\n\t\tif (!this._rs_ready) return;\n\t\tthis._rs_process = [pos(e),this._rs_ready[2]];\n\t\taddCss(document.body,\"webix_noselect\");\n\t\tdenySelect();\n\t},\n\t_rs_up:function(){\n\t\tthis._rs_process = false;\n\t\tremoveCss(document.body,\"webix_noselect\");\n\t\tallowSelect();\n\t},\n\t_rs_start:function(){\n\t\tif(this._rs_progress)\n\t\t\treturn;\n\t\tvar dir = this._rs_ready[0];\n\t\tvar node = this._rs_process[1];\n\t\tvar obj = this._locate(node);\n\t\tif (!obj) return;\n\n\t\tvar eventPos = this._rs_process[0];\n\t\tvar start;\n\n\t\tif (dir == \"x\"){\n\t\t\tstart = offset(node).x+this._rs_ready[1] - offset(this._body).x;\n\t\t\teventPos = eventPos.x;\n\t\t\tif (!this._rs_ready[1]) obj.cind-=(node.parentNode.colSpan||1);\n\t\t} else {\n\t\t\tstart = offset(node).y+this._rs_ready[1] - offset(this._body).y+this._header_height;\n\t\t\teventPos = eventPos.y;\n\t\t\tif (!this._rs_ready[1]) obj.rind--;\n\t\t}\n\t\tif (obj.cind>=0 && obj.rind>=0){\n\t\t\tthis._rs_progress = [dir, obj, start];\n\t\t\t\n\t\t\tvar resize = new ui.resizearea({\n\t\t\t\tcontainer:this._viewobj,\n\t\t\t\tdir:dir,\n\t\t\t\teventPos:eventPos,\n\t\t\t\tstart:start,\n\t\t\t\tcursor:(dir == \"x\"?\"col\":\"row\")+\"-resize\"\n\t\t\t});\n\t\t\tresize.attachEvent(\"onResizeEnd\", bind(this._rs_end, this));\n\t\t}\n\t\tthis._rs_down = this._rs_ready = false;\n\t},\n\t_rs_end:function(result){\n\t\tif (this._rs_progress){\n\t\t\tvar dir = this._rs_progress[0];\n\t\t\tvar obj = this._rs_progress[1];\n\t\t\tvar newsize = result-this._rs_progress[2];\n\t\t\tif (dir == \"x\"){\n\t\t\t\t\n\t\t\t\t//in case of right split - different sizing logic applied\n\t\t\t\tif (this._settings.rightSplit && obj.cind+1>=this._rightSplit &&\n\t\t\t\t\tobj.cind !== this._columns.length - 1)\n\t\t\t\t{\n\t\t\t\t\tobj.cind++;\n\t\t\t\t\tnewsize *= -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar column = this._columns[obj.cind];\n\t\t\t\tvar oldwidth = column.width;\n\t\t\t\tdelete column.fillspace;\n\t\t\t\tdelete column.adjust;\n\t\t\t\tthis._setColumnWidth(obj.cind, oldwidth + newsize, true, true);\n\t\t\t\tthis._updateColsSizeSettings();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar rid = this.getIdByIndex(obj.rind);\n\t\t\t\tvar oldheight = this._getRowHeight(this.getItem(rid));\n\t\t\t\tthis.setRowHeight(rid, oldheight + newsize);\n\t\t\t}\n\t\t\tthis._rs_up();\n\t\t}\n\t\tthis._rs_progress = null;\n\t},\n\t_rs_move:function(e){\n\t\tvar cell= null,\n\t\t\tconfig = this._settings;\n\t\tif (this._rs_ready && this._rs_process)\n\t\t\treturn this._rs_start(e);\n\n\t\te = e||event;\n\t\tvar node = e.target||e.srcElement;\n\t\tvar mode = false; //resize ready flag\n\n\t\tif (node.tagName == \"TD\" || node.tagName == \"TABLE\") return ;\n\t\tvar element_class = node.className||\"\";\n\t\tvar in_body = typeof element_class === \"string\" && element_class.indexOf(\"webix_cell\")!=-1;\n\t\t//ignore resize in case of drag-n-drop enabled\n\t\tif (in_body && config.drag) return;\n\t\tvar in_header = typeof element_class === \"string\" && element_class.indexOf(\"webix_hcell\")!=-1;\n\t\tthis._rs_ready = false;\n\t\t\n\t\tif (in_body || in_header){\n\t\t\tvar dx = node.offsetWidth;\n\t\t\tvar dy = node.offsetHeight;\n\t\t\tvar pos = posRelative(e);\n\n\t\t\tvar resizeRow = config.resizeRow;\n\t\t\t// if resize is only within the first column\n\t\t\tif(typeof resizeRow == \"object\" && resizeRow.headerOnly){\n\t\t\t\tcell = this._locate(node);\n\t\t\t\tif(cell.cind >0)\n\t\t\t\t\tresizeRow = false;\n\t\t\t}\n\n\t\t\tif (in_body && resizeRow){\n\t\t\t\tresizeRow = (typeof resizeRow == \"object\" && resizeRow.size?resizeRow.size:3);\n\t\t\t\tif (pos.y0){\n\t\t\tfor (let i=0; i= 0){\n\t\t\tvar width = this._getColumnConfigSize(ind, headers);\n\t\t\treturn this._setColumnWidth(ind, width, ignore);\n\t\t}\n\t},\n\tadjustColumn:function(id, headers){\n\t\tthis._adjustColumn(this.getColumnIndex(id), headers);\n\t},\n\tadjustRowHeight:function(id, silent){\n\t\tif(id) {\n\t\t\tvar config = this.getColumnConfig(id);\n\t\t\tvar container;\n\t\t\tvar d = create(\"DIV\",{\"class\":\"webix_table_cell webix_measure_size webix_cell\"},\"\");\n\t\t\td.style.cssText = \"width:\"+config.width+\"px; height:1px; visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;\";\n\t\t\tthis.$view.appendChild(d);\n\n\t\t\tif (d.offsetHeight < 1){\n\t\t\t\t//hidden container, height detection is broken\n\t\t\t\t//reattach to the body\n\t\t\t\tcontainer = this.$view.cloneNode(true);\n\t\t\t\tdocument.body.appendChild(container);\n\t\t\t\tcontainer.appendChild(d);\n\t\t\t}\n\n\t\t\tthis.data.each(function(obj){\n\t\t\t\td.innerHTML = this._getValue(obj, config, 0);\n\t\t\t\tobj.$height = Math.max(d.scrollHeight, this._settings.rowHeight);\n\t\t\t}, this);\n\n\t\t\td = remove(d);\n\t\t\tif (container)\n\t\t\t\tremove(container);\n\t\t} else {\n\t\t\t//set size of array based on data size\n\t\t\t//can be not-reliable for tree-like components anyway\n\t\t\tvar heightsArr = new Array(this.data.order.length);\n\t\t\tvar cols = this.config.columns;\n\n\t\t\t//set 0 as initial height\n\t\t\tvar j = 0;\n\t\t\t//iterate through all possible items\n\t\t\t//we need to be sure that heightsArr is not lesser than real data count\n\t\t\tfor (let key in this.data.pull){ //eslint-disable-line\n\t\t\t\theightsArr[j] = 0;\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < cols.length; i++) {\n\t\t\t\t//adjust size for single columns\n\t\t\t\tthis.adjustRowHeight(cols[i].id, true);\n\t\t\t\t//for each row, set height as maximum between all columns\n\t\t\t\tlet j = 0;\n\t\t\t\tthis.data.each(function(obj){\n\t\t\t\t\t//index is not reliable for tree-components, using a custom counter\n\t\t\t\t\tif (obj.$height > heightsArr[j]) {\n\t\t\t\t\t\theightsArr[j] = obj.$height;\n\t\t\t\t\t}\n\t\t\t\t\tobj.$height = heightsArr[j];\n\t\t\t\t\tj++;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (!silent)\n\t\t\tthis.refresh();\n\t}\n};\n\nexport default Mixin;","import template from \"../../webix/template\";\nimport env from \"../../webix/env\";\nimport {assert} from \"../../webix/debug\";\nimport {bind} from \"../../webix/helpers\";\n\n\nconst Mixin = {\n\n\tmath_setter:function(value){\n\t\tif (value)\n\t\t\tthis._math_init();\n\t\treturn value;\n\t},\n\n\t_math_pref: \"$\",\n\n\t_math_init: function() {\n\t\tif(env.strict) return;\n\n\t\tthis.data.attachEvent(\"onStoreUpdated\", bind(this._parse_row_math, this));\n\t\tthis.data.attachEvent(\"onStoreLoad\", bind(this._parse_math, this));\n\t\tthis.attachEvent(\"onStructureLoad\", this._parse_math);\n\t},\n\t_parse_row_math:function(id, obj, action){\n\t\tif (!id || (action==\"delete\" || action==\"paint\")) return;\n\n\t\tif (action == \"add\")\n\t\t\tthis._exprs_by_columns(obj);\n\n\t\tfor (var i=0; i 0 && value.substr(0, 1) === \"=\") {\n\t\t\t// calculate math value\n\t\t\tif (!item[this._math_pref + col] || (_inner_call !== true))\n\t\t\t\titem[this._math_pref + col] = item[col];\n\t\t\titem[col] = this._calculate(value, row, col);\n\t\t\t//this.updateItem(item);\n\t\t} else {\n\t\t\t// just a string\n\t\t\tif (typeof(item[this._math_pref + col]) !== \"undefined\")\n\t\t\t\tdelete item[this._math_pref + col];\n\t\t\t// remove triggers if they were setted earlier\n\t\t\tthis._remove_old_triggers(item, col);\n\t\t}\n\t\t// recalculate depending cells\n\t\tif (typeof(item.depends) !== \"undefined\" && typeof(item.depends[col]) !== \"undefined\") {\n\t\t\tfor (var i in item.depends[col]) {\n\t\t\t\tvar name = item.depends[col][i][0] + \"__\" + item.depends[col][i][1];\n\t\t\t\tif (typeof(this._math_recalc[name]) === \"undefined\") {\n\t\t\t\t\tthis._math_recalc[name] = true;\n\t\t\t\t\tthis._parse_cell_math(item.depends[col][i][0], item.depends[col][i][1], true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t_set_original_value: function(row, col) {\n\t\tvar item = this.getItem(row);\n\t\tif (typeof(item[this._math_pref + col]) !== \"undefined\")\n\t\t\titem[col] = item[this._math_pref + col];\n\t},\n\n\t_parse_math: function(){\n\t\tif (!this._columns || !this.count()) return;\n\t\t\n\t\tthis._exprs_by_columns();\n\n\t\tfor (var j = 0; j < this._columns.length; j++){\n\t\t\tvar col = this.columnId(j);\n\t\t\tthis.data.each(function(obj){\n\t\t\t\tthis._parse_cell_math(obj.id, col);\n\t\t\t}, this);\n\t\t}\n\n\t\tthis._math_recalc = {};\n\t},\n\n\t_exprs_by_columns: function(row) {\n\t\tfor (var i = 0; i < this._columns.length; i++){\n\t\t\tif (this._columns[i].math) {\n\t\t\t\tvar col = this.columnId(i);\n\t\t\t\tvar math = \"=\" + this._columns[i].math;\n\t\t\t\tmath = math.replace(/\\$c/g, \"#$c#\");\n\t\t\t\tif (row){\n\t\t\t\t\trow[col] = this._parse_relative_expr(math, row.id, col);\n\t\t\t\t\tdelete row[this._math_pref+col];\n\t\t\t\t\tthis._remove_old_triggers(row, col);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tthis.data.each(function(obj){\n\t\t\t\t\t\tobj[col] = this._parse_relative_expr(math, obj.id, col);\n\t\t\t\t\t\tdelete obj[this._math_pref+col];\n\t\t\t\t\t\tthis._remove_old_triggers(obj, col);\n\t\t\t\t\t}, this);\n\t\t\t}\n\t\t}\n\t},\n\n\t_parse_relative_expr: function(expr, row, col) {\n\t\treturn (template(expr))({ \"$r\": row, \"$c\": col });\n\t},\n\n\t_get_calc_value: function(row, col) {\n\t\tvar item;\n\n\t\tif (this.exists(row))\n\t\t\titem = this.getItem(row);\n\t\telse\n\t\t\treturn \"#out_of_range\";\n\n\t\tvar value = item[this._math_pref + col] || item[col] || 0;\n\t\tvalue = value.toString();\n\t\tif (value.substring(0, 1) !== \"=\")\n\t\t\t// it's a string\n\t\t\treturn value;\n\t\telse {\n\t\t\t// TODO: check if value shouldn't be recalculated\n\t\t\t// and return value calculated earlier\n\n\t\t\t// calculate math expr value right now\n\t\t\tif (typeof(item[this._math_pref + col]) === \"undefined\")\n\t\t\t\titem[this._math_pref + col] = item[col];\n\t\t\titem[col] = this._calculate(value, row, col, true);\n\t\t\treturn item[col];\n\t\t}\n\t},\n\n\t_calculate: function(value, row, col, _inner_call) {\n\t\t// add coord in math trace to detect self-references\n\t\tif (_inner_call === true) {\n\t\t\tif (this._in_math_trace(row, col))\n\t\t\t\treturn \"#selfreference\";\n\t\t} else\n\t\t\tthis._start_math_trace();\n\t\tthis._to_math_trace(row, col);\n\n\t\tvar item = this.getItem(row);\n\t\tvalue = value.substring(1);\n\n\t\t// get operations list\n\t\tvar operations = this._get_operations(value);\n\t\tvar triggers = this._get_refs(value, row);\n\n\t\tif (operations) {\n\t\t\tvalue = this._replace_refs(value, triggers);\n\t\t\tvalue = this._parse_args(value, operations);\n\t\t} else {\n\t\t\tvalue = this._replace_refs(value, triggers, true);\n\t\t}\n\n\t\tvar exc = this._math_exception(value);\n\t\tif (exc !== false)\n\t\t\treturn exc;\n\n\t\t// remove from coord from trace when calculations were finished - it's important!\n\t\tthis._from_math_trace(row, col);\n\n\t\t// process triggers to know which cells should be recalculated when one was changed\n\t\tthis._remove_old_triggers(item, col);\n\t\tfor (var i = 0; i < triggers.length; i++) {\n\t\t\tthis._add_trigger([row, col], triggers[i]);\n\t\t}\n\t\texc = this._math_exception(value);\n\t\tif (exc !== false)\n\t\t\treturn exc;\n\n\t\t// there aren't any operations here. returns number or value of another cell\n\t\tif (!value) return value;\n\n\t\t// process mathematical expression and getting final result\n\t\tvalue = this._compute(value.replace(/\\$r/g, item.id));\n\t\texc = this._math_exception(value);\n\t\tif (exc !== false)\n\t\t\treturn exc;\n\t\treturn value;\n\t},\n\n\t_get_operations: function(value) {\n\t\t// gettings operations list (+-*/)\n\t\tvar splitter = /(\\+|-|\\*|\\/)/g;\n\t\tvar operations = value.replace(/\\[[^)]*?\\]/g,\"\").match(splitter);\n\t\treturn operations;\n\t},\n\n\t/*! gets list of referencies in formula\n\t **/\n\t_get_refs: function(value, id) {\n\t\tvar reg = /\\[([^\\]]+),([^\\]]+)\\]/g;\n\t\tvar cells = value.match(reg);\n\t\tif (cells === null) cells = [];\n\n\t\tfor (var i = 0; i < cells.length; i++) {\n\t\t\tvar cell = cells[i];\n\t\t\tvar tmp = cell;\n\t\t\tcell = cell.substr(1, cell.length - 2);\n\t\t\tcell = cell.split(\",\");\n\t\t\tcell[0] = this._trim(cell[0]);\n\t\t\tcell[1] = this._trim(cell[1]);\n\t\t\tif (cell[0].substr(0, 1) === \":\")\n\t\t\t\tcell[0] = this.getIdByIndex(cell[0].substr(1));\n\t\t\tif (cell[0] === \"$r\")\n\t\t\t\tcell[0] = id;\n\t\t\tif (cell[1].substr(0, 1) === \":\")\n\t\t\t\tcell[1] = this.columnId(cell[1].substr(1));\n\t\t\tcell[2] = tmp;\n\t\t\tcells[i] = cell;\n\t\t}\n\n\t\treturn cells;\n\t},\n\n\t// replace given list of references by their values\n\t_replace_refs: function(value, cells, clean) {\n\t\tvar dell = \"(\", delr = \")\";\n\t\tif (clean) dell = delr = \"\";\n\t\tfor (var i = 0; i < cells.length; i++) {\n\t\t\tvar cell = cells[i];\n\t\t\tvar cell_value = this._get_calc_value(cell[0], cell[1]);\n\t\t\tif (isNaN(cell_value))\n\t\t\t\tcell_value = \"\\\"\"+cell_value+\"\\\"\";\n\t\t\tvalue = value.replace(cell[2], dell + cell_value + delr);\n\t\t}\n\t\treturn value;\n\t},\n\n\t_parse_args: function(value, operations) {\n\t\tvar args = [];\n\t\tfor (let i = 0; i < operations.length; i++) {\n\t\t\tvar op = operations[i];\n\t\t\tvar temp = this._split_by(value, op);\n\t\t\targs.push(temp[0]);\n\t\t\tvalue = temp[1];\n\t\t}\n\t\targs.push(value);\n\n\t\t//var reg = /^(-?\\d|\\.|\\(|\\))+$/;\n\t\tfor (let i = 0; i < args.length; i++) {\n\t\t\tvar arg = this._trim(args[i]);\n\t\t\t//\tif (reg.test(arg) === false)\n\t\t\t//\t\treturn ''; //error\n\t\t\targs[i] = arg;\n\t\t}\n\n\t\tvar expr = \"\";\n\t\tfor (let i = 0; i < args.length - 1; i++) {\n\t\t\texpr += args[i] + operations[i];\n\t\t}\n\t\texpr += args[args.length - 1];\n\t\treturn expr;\n\t},\n\n\t_compute: function(expr) {\n\t\tvar result;\n\t\ttry {\n\t\t\tresult = window.eval(expr);\n\t\t} catch(ex) {\n\t\t\tassert(false,\"Math error in datatable
\"+expr);\n\t\t\tresult = \"\";\n\t\t}\n\t\treturn result.toString();\n\t},\n\n\t_split_by: function(value, splitter) {\n\t\tvar pos = value.indexOf(splitter);\n\t\tvar before = value.substr(0, pos);\n\t\tvar after = value.substr(pos + 1);\n\t\treturn [before, after];\n\t},\n\n\t_trim: function(value) {\n\t\tvalue = value.replace(/^ */g, \"\");\n\t\tvalue = value.replace(/ *$/g, \"\");\n\t\treturn value;\n\t},\n\n\t_start_math_trace: function() {\n\t\tthis._math_trace = [];\n\t},\n\t_to_math_trace: function(row, col) {\n\t\tthis._math_trace[row + \"__\" + col] = true;\n\t},\n\t_from_math_trace: function(row, col) {\n\t\tif (typeof(this._math_trace[row + \"__\" + col]) !== \"undefined\")\n\t\t\tdelete this._math_trace[row + \"__\" + col];\n\t},\n\t_in_math_trace: function(row, col) {\n\t\tif (typeof(this._math_trace[row + \"__\" + col]) !== \"undefined\")\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t},\n\n\t_add_trigger: function(depends, from) {\n\t\tvar item = this.getItem(from[0]);\n\t\tif (typeof(item.depends) === \"undefined\")\n\t\t\titem.depends = {};\n\t\tif (typeof(item.depends[from[1]]) === \"undefined\")\n\t\t\titem.depends[from[1]] = {};\n\t\titem.depends[from[1]][depends[0] + \"__\" + depends[1]] = depends;\n\n\t\titem = this.getItem(depends[0]);\n\t\tif (typeof(item.triggers) === \"undefined\")\n\t\t\titem.triggers = {};\n\t\tif (typeof(item.triggers[depends[1]]) === \"undefined\")\n\t\t\titem.triggers[depends[1]] = {};\n\t\titem.triggers[depends[1]][from[0] + \"__\" + from[1]] = from;\n\t},\n\n\t_remove_old_triggers: function(item, col) {\n\t\tif (!item) return;\n\t\tif (typeof(item.triggers) === \"undefined\") return;\n\t\tfor (var i in item.triggers[col]) {\n\t\t\tvar depend = item.triggers[col][i];\n\t\t\tvar row = this.getItem(depend[0]);\n\t\t\tif (row)\n\t\t\t\tdelete row.depends[depend[1]][item.id + \"__\" + col];\n\t\t}\n\t},\n\n\t// check if exception syntax exists and returns exception text or false\n\t_math_exception: function(value) {\n\t\tvar reg = /#\\w+/;\n\t\tvar match = value.match(reg);\n\t\tif (match !== null && match.length > 0)\n\t\t\treturn match[0];\n\t\treturn false;\n\t}\n\n};\n\nexport default Mixin;","import {isUndefined, bind} from \"../../webix/helpers\";\nimport {_event} from \"../../webix/htmlevents\";\nimport EditAbility from \"../../core/editability\";\n\n\n// #include core/drag.js\n// #include core/edit.js\n// #include ui/inputs.js\n\nconst Mixin = {\n\n\t/////////////////////////\n\t// edit start //\n\t/////////////////////////\n\t_get_editor_type:function(id){\n\t\treturn this.getColumnConfig(id.column).editor;\n\t},\n\tgetEditor:function(row, column){\n\t\tif (!row)\n\t\t\treturn this._last_editor;\n\n\t\tif (arguments.length == 1){\n\t\t\tcolumn = row.column;\n\t\t\trow = row.row; \n\t\t}\n\t\t\n\t\treturn ((this._editors[row]||{})[column]);\n\t},\n\t_for_each_editor:function(handler){\n\t\tfor (var row in this._editors){\n\t\t\tvar row_editors = this._editors[row];\n\t\t\tfor (var column in row_editors)\n\t\t\t\tif (column!=\"$count\")\n\t\t\t\t\thandler.call(this, row_editors[column]);\n\t\t}\n\t},\n\t_init_editor:function(id, type, show){\n\t\tvar row = id.row;\n\t\tvar column = id.column;\n\t\tvar col_settings = type.config = this.getColumnConfig(column);\n\t\t//show it over cell\n\t\tif (show !== false)\n\t\t\tthis.showCell(row, column);\n\n\t\tvar node = type.render();\n\n\t\tif (type.$inline)\n\t\t\tnode = this._locateInput(id);\n\t\ttype.node = node;\n\t\t\t\n\t\tvar item = this.getItem(row);\n\t\tvar format = col_settings.editFormat;\n\n\t\tvar value;\n\t\tif (this._settings.editMath)\n\t\t\tvalue = item[\"$\"+column];\n\t\tvalue = value || item[column];\n\n\t\tif (isUndefined(value))\n\t\t\tvalue=\"\";\n\n\t\ttype.setValue(format?format(value):value, item);\n\t\ttype.value = item[column];\n\t\tthis._addEditor(id, type);\n\n\t\tif (!type.$inline)\n\t\t\tthis._sizeToCell(id, node, true);\n\n\t\tif (type.afterRender)\n\t\t\ttype.afterRender();\n\t\t\n\t\tif (this._settings.liveValidation){\n\t\t\t_event(type.node, \"keyup\", this._bind_live_validation(id, this));\n\t\t\tthis.validateEditor(id);\n\t\t}\n\n\t\treturn node;\n\t},\n\t_bind_live_validation:function(id, that){\n\t\treturn function(){\n\t\t\tthat.validateEditor(id);\n\t\t};\n\t},\n\t_set_new_value:function(editor, new_value, copy){\n\t\tvar parser = this.getColumnConfig(editor.column).editParse;\n\t\tvar item = copy ? {} : this.getItem(editor.row);\n\t\titem[editor.column] = parser?parser(new_value):new_value;\n\n\t\tif (this._settings.editMath)\n\t\t\titem[\"$\"+editor.column] = null;\n\n\t\treturn item;\n\t},\n\t//register editor in collection\n\t_addEditor:function(id, type){\n\t\tvar row_editors = this._editors[id.row]=this._editors[id.row]||{};\n\n\t\trow_editors.$count = (row_editors.$count||0)+1;\n\n\t\ttype.row = id.row; type.column = id.column;\n\t\tthis._last_editor = row_editors[id.column] = type;\n\n\t\tthis._in_edit_mode++;\n\t\tthis._last_editor_scroll = this.getScrollState();\n\t},\n\t_removeEditor:function(editor){\n\t\tif (this._last_editor == editor)\n\t\t\tthis._last_editor = 0;\n\t\t\n\t\tif (editor.destroy)\n\t\t\teditor.destroy();\n\t\t\n\t\tvar row = this._editors[editor.row];\n\t\tdelete row[editor.column];\n\t\trow.$count -- ;\n\t\tif (!row.$count)\n\t\t\tdelete this._editors[editor.row];\n\t\tthis._in_edit_mode--;\n\t},\n\t_changeEditorId:function(oldid, newid)\t{\n\t\tvar editor = this._editors[oldid];\n\t\tif (editor){\n\t\t\tthis._editors[newid] = editor;\n\t\t\tdelete this._editors[oldid];\n\t\t\tfor (var key in editor)\n\t\t\t\teditor[key].row = newid;\n\t\t}\n\t},\n\t//get html cell by combined id\n\t_locate_cell:function(id){\n\t\tvar area, i, index, j, node, span,\n\t\t\tconfig = this.getColumnConfig(id.column),\n\t\t\tcell = 0;\n\n\t\tif (config && config.node && config.attached){\n\t\t\tindex = this.getIndexById(id.row);\n\t\t\tif(this._spans_pull){\n\t\t\t\tspan = this.getSpan(id.row,id.column);\n\t\t\t\tif(span){\n\t\t\t\t\tfor (i=0; i<3; i++){\n\t\t\t\t\t\tarea = this._spans_areas[i];\n\t\t\t\t\t\tfor(j=0; !cell && j < area.childNodes.length; j++){\n\t\t\t\t\t\t\tnode = area.childNodes[j];\n\t\t\t\t\t\t\tif(node.getAttribute(\"row\") == index && node.getAttribute(\"column\") == this.getColumnIndex(id.column))\n\t\t\t\t\t\t\t\tcell = node;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!cell && index >= (config._yr0-this._settings.topSplit) && index< config._yr1)\n\t\t\t\tcell = config.node.childNodes[index-config._yr0+this._settings.topSplit];\n\t\t}\n\t\treturn cell;\n\t},\n\n\t\n\t/////////////////////////\n\t// public methods //\n\t/////////////////////////\n\teditCell:function(row, column, preserve, show){\n\t\tcolumn = column || this._settings.columns[0].id;\n\t\treturn EditAbility.edit.call(this, {row:row, column:column}, preserve, show);\n\t},\n\teditRow:function(id){\n\t\tif (id && id.row)\n\t\t\tid = id.row;\n\n\t\tvar next = false;\n\t\tthis.eachColumn(function(column){\n\t\t\tthis.edit({ row:id, column:column}, next, !next);\n\t\t\tnext = true;\n\t\t});\n\t},\n\teditColumn:function(id){\n\t\tif (id && id.column)\n\t\t\tid = id.column;\n\n\t\tvar next = false;\n\t\tthis.eachRow(function(row){\n\t\t\tthis.edit({row:row, column:id}, next, !next);\n\t\t\tnext = true;\n\t\t});\n\t},\n\teachRow:function(handler, all){\n\t\tvar order = this.data.order;\n\t\tif (all) \n\t\t\torder = this.data._filter_order || order;\n\n\t\tfor (let i=0; i=0; i--){\n\t\t\t\tfor (let j=column-1; j>=0; j--){\n\t\t\t\t\tlet id = { row:order[i], column:cols[j].id};\n\t\t\t\t\tif (check.call(this, id))\n\t\t\t\t\t\treturn id;\n\t\t\t\t}\n\t\t\t\tcolumn = cols.length;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t},\n\n\n\t/////////////////////////////\n\t// scroll correction //\n\t/////////////////////////////\n\t_correct_after_focus_y:function(){\n\t\tif (this._in_edit_mode){\n\t\t\tif (this._ignore_after_focus_scroll)\n\t\t\t\tthis._ignore_after_focus_scroll = false;\n\t\t\telse {\n\t\t\t\tthis._y_scroll.scrollTo(this.getScrollState().y+this._body.childNodes[1].firstChild.scrollTop);\n\t\t\t\tthis._body.childNodes[1].firstChild.scrollTop = 0;\n\t\t\t\tthis._ignore_after_focus_scroll = true;\n\t\t\t}\n\t\t}\n\t},\n\t_correct_after_focus_x:function(){\n\t\tif (this._in_edit_mode){\n\t\t\tthis._x_scroll.scrollTo(this._body.childNodes[1].scrollLeft);\n\t\t}\n\t},\n\t_component_specific_edit_init:function(){\n\t\tthis.attachEvent(\"onScrollY\", this._update_editor_y_pos);\n\t\tthis.attachEvent(\"onScrollX\", this._update_editor_y_pos);\n\t\tthis.attachEvent(\"onScrollY\", this._refocus_inline_editor);\n\t\tthis.attachEvent(\"onColumnResize\", function(){ this.editStop(); });\n\t\tthis.attachEvent(\"onAfterFilter\", function(){ this.editStop(); });\n\t\tthis.attachEvent(\"onRowResize\", function(){ this.editStop(); });\n\t\tthis.attachEvent(\"onAfterScroll\", function(){ if(this._settings.topSplit) this.editStop(); });\n\t\tthis._body.childNodes[1].firstChild.onscroll = bind(this._correct_after_focus_y, this);\n\t\tthis._body.childNodes[1].onscroll = bind(this._correct_after_focus_x, this);\n\t},\n\t_update_editor_y_pos:function(){\n\t\tif (this._in_edit_mode){\n\t\t\tvar old = this._last_editor_scroll;\n\t\t\tthis._last_editor_scroll = this.getScrollState();\n\n\t\t\tvar diff = this._last_editor_scroll.y - old.y;\n\t\t\tthis._for_each_editor(function(editor){\n\t\t\t\tif (editor.getPopup){\n\t\t\t\t\tvar node = this.getItemNode(editor);\n\t\t\t\t\tif (node)\n\t\t\t\t\t\teditor.getPopup().show(node);\n\t\t\t\t\telse\n\t\t\t\t\t\teditor.getPopup().show({ x:-10000, y:-10000 });\n\t\t\t\t} else if (!editor.$inline){\n\t\t\t\t\teditor.node.top -= diff;\n\t\t\t\t\teditor.node.style.top = editor.node.top + \"px\";\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n};\n\nexport default Mixin;","import {toArray, PowerArray} from \"../../webix/helpers\";\nimport {assert} from \"../../webix/debug\";\n\n\nconst Mixin = {\n\t$init:function(){\n\t\tthis._clear_hidden_state();\t\n\t\tthis.attachEvent(\"onStructureLoad\", this._hideInitialColumns);\n\t},\n\t_clear_hidden_state:function(){\n\t\tthis._hidden_column_hash = {};\n\t\tthis._hidden_column_order = toArray();\n\t\tthis._hidden_split=[0,0];\n\t},\n\t_hideInitialColumns:function(){\n\t\tvar cols = this._columns;\n\n\t\tfor(let i=0; i=0; i--){\n\t\t\tif (cols[i].hidden)\n\t\t\t\tthis.hideColumn(cols[i].id, {}, true, true);\n\t\t\telse if (cols[i].batch && this.config.visibleBatch && cols[i].batch!=this.config.visibleBatch){\n\t\t\t\tthis.hideColumn(cols[i].id, {}, true, true);\n\t\t\t}\n\t\t}\n\t},\n\t_getInitialSpans:function(cols, elements){\n\t\tfor(var h = 0; hstart_index?1:0);\n\t\tPowerArray.insertAt.call(columns, start[0], pos);\n\n\t\tvar order = this._hidden_column_order;\n\t\t// order exists even if columns are not reordered, so checking for length\n\t\tif (order.length){\n\t\t\torder = toArray(order);\n\n\t\t\tvar hidden_index = order.find(id);\n\t\t\torder.removeAt(hidden_index);\n\t\t\tif (pos === 0)\n\t\t\t\torder.unshift(id);\n\t\t\telse { \n\t\t\t\torder.insertAt(id, order.find(columns[pos-1].id)+1);\n\t\t\t}\n\t\t}\n\n\t\t//TODO: split handling\n\t\t//we can move split line when column dropped after it\n\n\t\tthis._refresh_columns();\n\t},\n\t_init_horder:function(){\n\t\tvar horder = this._hidden_column_order;\n\t\tvar cols = this._settings.columns;\n\t\tif (!horder.length){\n\t\t\tfor (let i=0; i=this._rightSplit)\n\t\t\t\tthis._settings.rightSplit-=span;\n\t\t\telse \n\t\t\t\tthis._rightSplit-=span;\n\n\t\t\tfor (let i=index+span-1; i>=index; i--){\n\t\t\t\tthis._hideColumn(index);\n\t\t\t\tcolumn = cols.splice(index, 1)[0];\n\t\t\t\thhash[column.id] = column;\n\t\t\t\tcolumn._yr0 = -1;\n\t\t\t\tdelete this._columns_pull[column.id];\n\t\t\t}\n\n\t\t\tthis.callEvent(\"onAfterColumnHide\", [id]);\n\t\t} else {\n\t\t\tcolumn = hhash[id];\n\t\t\tassert(column, \"showColumn: invalid ID or already visible\");\n\n\t\t\t//in case of second show command for already visible column - ignoring\n\t\t\tif(!column || !this.callEvent(\"onBeforeColumnShow\", [id])) return;\n\n\t\t\tlet prev = null;\n\t\t\tlet i=0;\n\t\t\tlet hindex = 0;\n\t\t\tfor (; i=hindex; i--){\n\t\t\t\tlet column = hhash[horder[i]];\n\t\t\t\tif(column){ //can be already shown by another action\n\t\t\t\t\tPowerArray.insertAt.call(cols, column, index);\n\t\t\t\t\tdelete column.hidden;\n\t\t\t\t\tdelete hhash[column.id];\n\t\t\t\t\tthis._columns_pull[column.id] = column;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tspan--;\n\t\t\t}\n\n\t\t\tif (hindex=this._hidden_split[1])\t\n\t\t\t\tthis._settings.rightSplit+=span;\n\t\t\telse\n\t\t\t\tthis._rightSplit+=span;\n\n\n\t\t\tthis.callEvent(\"onAfterColumnShow\", [id]);\n\t\t}\n\n\t\tif(column.header) this._fixColspansHidden(column, mode !== false ? 0 : 1, \"header\");\n\t\tif(column.footer) this._fixColspansHidden(column, mode !== false ? 0 : 1, \"footer\");\n\n\t\tif (!silent)\n\t\t\tthis._refresh_columns();\n\t},\n\t_fixColspansHidden:function(config, mod, elName){\n\t\tfor (let i=config[elName].length - 1; i >= 0; i--) {\n\t\t\tvar ind = this._hidden_column_order;\n\t\t\tvar spanSource, isHidden = false, spanSize = 0;\n\n\t\t\tfor (let j = 0; j < ind.length; j++) {\n\t\t\t\tlet colConfig = this.getColumnConfig(ind[j]);\n\t\t\t\tlet el = colConfig[elName][i];\n\t\t\t\tif (!this.isColumnVisible(ind[j])){\n\t\t\t\t\t//hidden column\n\t\t\t\t\tif (el && el.$colspan && spanSize <= 0){\n\t\t\t\t\t\t//start of colspan in hidden\n\t\t\t\t\t\tspanSize = el.colspan = el.$colspan;\n\t\t\t\t\t\tisHidden = spanSource = el;\n\t\t\t\t\t}\n\t\t\t\t\tif (spanSource && spanSize > 0){\n\t\t\t\t\t\t//hidden column in colspan, decrease colspan size\n\t\t\t\t\t\tspanSource.colspan--;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//visible column\n\t\t\t\t\tif (isHidden && spanSize > 0 && spanSource && spanSource.colspan > 0){\n\t\t\t\t\t\t//bit start of colspan is hidden\n\t\t\t\t\t\tel = colConfig[elName][i] = spanSource;\n\t\t\t\t\t\tspanSource = el;\n\t\t\t\t\t} else if (el && el.$colspan && spanSize <= 0){\n\t\t\t\t\t\t//visible start of colspan\n\t\t\t\t\t\tspanSize = el.colspan = el.$colspan;\n\t\t\t\t\t\tspanSource = el;\n\t\t\t\t\t}\n\t\t\t\t\tisHidden = null;\n\t\t\t\t}\n\t\t\t\tspanSize--;\n\t\t\t}\n\t\t}\n\t},\n\trefreshColumns:function(columns, reset){\n\t\tif ((columns && columns != this.config.columns) || reset){\n\t\t\tthis._clear_hidden_state();\n\t\t\tthis._filter_elements = {};\n\t\t\tif (columns)\n\t\t\t\tthis._rightSplit = columns.length - (this.config.rightSplit || 0);\n\t\t}\n\n\t\tthis._columns_pull = {};\n\t\t//clear rendered data\n\t\tfor (let i=0; i