{"version":3,"file":"filemanager.js","sources":["../sources/views/actions.js","../sources/types.js","../sources/locale.js","../sources/widgets/filelist.js","../sources/widgets/filemenu.js","../sources/widgets/filetree.js","../sources/widgets/filetable.js","../sources/widgets/fileview.js","../sources/widgets/path.js","../sources/defaults.js","../sources/history.js","../sources/sort.js","../sources/load.js","../sources/path.js","../sources/save.js","../sources/views/modes.js","../sources/views/modeviews.js","../sources/views/table.js","../sources/views/toggle.js","../sources/views/tree.js","../sources/ui.js","../sources/views/mainlayout.js","../sources/views/toolbar.js","../sources/views/menu.js","../sources/views/back.js","../sources/views/forward.js","../sources/views/up.js","../sources/views/path.js","../sources/views/search.js","../sources/views/bodylayout.js","../sources/views/treelayout.js","../sources/views/panel.js","../sources/views/treetoolbar.js","../sources/views/expandall.js","../sources/views/collapseall.js","../sources/views/files.js","../sources/views/columns.js","../sources/views/upload.js","../sources/filemanager.js","../sources/tree.js"],"sourcesContent":["function getData(){\n\treturn [\n\t\t{id: \"copy\", batch: \"item\", method: \"markCopy\", icon: \"fm-copy\", value: webix.i18n.filemanager.copy},\n\t\t{id: \"cut\", batch: \"item\", method: \"markCut\", icon: \"fm-cut\", value: webix.i18n.filemanager.cut},\n\t\t{id: \"paste\", method: \"pasteFile\", icon: \"fm-paste\", value: webix.i18n.filemanager.paste},\n\t\t{ $template:\"Separator\" },\n\t\t{id: \"create\", method: \"createFolder\", icon: \"fm-folder\", value: webix.i18n.filemanager.create},\n\t\t{id: \"remove\", batch: \"item\", method: \"deleteFile\", icon: \"fm-delete\", value: webix.i18n.filemanager.remove},\n\t\t{id: \"edit\", batch: \"item\", method: \"editFile\", icon: \"fm-edit\", value: webix.i18n.filemanager.rename},\n\t\t{id: \"upload\", method: \"uploadFile\", event:\"UploadDialog\", icon: \"fm-upload\", value: webix.i18n.filemanager.upload}\n\t];\n}\n\nexport function init(view){\n\tview.attachEvent(\"onComponentInit\", () => ready(view));\n\n\tvar templateName = view.config.templateName;\n\tvar data = getData();\n\n\n\tvar popup = {\n\t\tview: \"filemenu\",\n\t\tid:\"actions\",\n\t\twidth: 200,\n\t\tpadding:0,\n\t\tautofocus: false,\n\t\tcss: \"webix_fmanager_actions\",\n\t\ttemplate: function(obj,common){\n\t\t\tvar name = templateName(obj,common);\n\t\t\tvar icon = obj.icon.indexOf(\"fm-\") == -1?obj.icon:\"webix_fmanager_icon \"+obj.icon;\n\t\t\treturn \" \"+name+\"\";\n\t\t},\n\t\tdata: data\n\t};\n\n\n\tview.callEvent(\"onViewInit\", [\"actions\", popup]);\n\tview._contextMenu = view.ui(popup);\n\tview.attachEvent(\"onDestruct\",function(){\n\t\tview._contextMenu.destructor();\n\t});\n}\n\nfunction ready(view){\n\tvar menu = view.getMenu();\n\tif(menu){\n\t\tmenu.attachEvent(\"onItemClick\",function(id,e){\n\t\t\tvar obj = this.getItem(id);\n\t\t\tvar method = view[obj.method]||view[id];\n\t\t\tif(method){\n\t\t\t\tvar active = view.getActive();\n\t\t\t\tif(view.callEvent(\"onbefore\"+(obj.event||obj.method||id),[active])){\n\t\t\t\t\tif(!(id==\"upload\" && view.config.legacyUploader)){\n\t\t\t\t\t\tif(view._uploadPopup)\n\t\t\t\t\t\t\tview._uploadPopup.hide();\n\t\t\t\t\t\tmenu.hide();\n\t\t\t\t\t}\n\t\t\t\t\tvar args = [active];\n\t\t\t\t\tif(id==\"upload\"){\n\t\t\t\t\t\te = webix.html.pos(e);\n\t\t\t\t\t\targs.push(e);\n\t\t\t\t\t}\n\t\t\t\t\twebix.delay(function(){\n\t\t\t\t\t\tmethod.apply(view,args);\n\t\t\t\t\t\tview.callEvent(\"onafter\"+(obj.event||obj.method||id),[]);\n\t\t\t\t\t});\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t});\n\t\tmenu.attachEvent(\"onBeforeShow\",function(e){\n\t\t\tmenu.filter(\"\");\n\t\t\tmenu.hide();\n\t\t\tvar c = menu.getContext();\n\n\t\t\t//context menu over empty area \n\t\t\tif(c && c.obj && !c.id)\n\t\t\t\tc.obj.unselectAll();\n\t\t\t\n\t\t\tif(c && c.obj)\n\t\t\t\treturn c.obj.callEvent(\"onBeforeMenuShow\",[c.id,e]);\n\n\t\t\treturn true;\n\t\t});\n\n\t}\n}\n","// tree type\nwebix.type(webix.ui.tree,{\n\tname: \"FileTree\",\n\tcss: \"webix_fmanager_tree\",\n\tdragTemplate: webix.template(\"#value#\"),\n\ticon:function(obj){\n\t\tvar html = \"\";\n\t\tfor(var i =1; i < obj.$level; i++){\n\t\t\thtml += \"
\";\n\t\t}\n\t\tif(obj.webix_child_branch && !obj.$count){\n\t\t\thtml += \"\";\n\t\t}\n\t\telse if (obj.$count>0){\n\t\t\tif (obj.open)\n\t\t\t\thtml += \"\";\n\t\t\telse\n\t\t\t\thtml += \"\";\n\t\t} else\n\t\t\thtml += \"\";\n\t\treturn html;\n\t},\n\tfolder:function(obj){\n\t\tif (obj.$count && obj.open)\n\t\t\treturn \"\";\n\t\treturn \"\";\n\t}\n});\n// dataview type\nwebix.type(webix.ui.dataview, {\n\tname:\"FileView\",\n\tcss: \"webix_fmanager_files\",\n\theight: 110,\n\tmargin: 10,\n\twidth: 150,\n\ttemplate: function(obj,common){\n\t\tvar css = \"webix_fmanager_data_icon\";\n\t\tvar name = common.templateName(obj,common);\n\t\treturn \"