"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[1879],{8802:function(t,e,o){o.r(e),o.d(e,{default:function(){return r}});var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"folders uk-flex uk-flex-row",class:{"folders-expanded":t.expanded,"folders-full":!t.compact}},[e("resize-observer",{ref:"buttons",staticClass:"uk-grid-row-collapse uk-grid-column-small uk-grid",staticStyle:{flex:"1","min-width":"1px"},attrs:{delay:100},on:{changed:function(e){t.buttonsWidth=e.width}}},[t.curNode?e("div",{staticClass:"uk-width",style:{width:t.buttonWidth},on:{click:function(e){return t.model.setCurNode(t.parent)}}},[e("button",{staticClass:"uk-button uk-button-small uk-button-default uk-margin-small-bottom uk-width-1-1 uk-text-left"},[e("i",{staticClass:"fas fa-arrow-left"}),t._v(" Назад ")])]):t._e(),t._l(t.children,(function(o){return e("div",{staticClass:"uk-width",style:{width:t.buttonWidth}},[e("button",{staticClass:"uk-button uk-button-small uk-button-default uk-margin-small-bottom uk-width-1-1 uk-text-truncate uk-text-left",attrs:{"uk-tooltip":"title: "+o.row.RES_NAME+"; pos: bottom"},on:{click:function(e){return t.selectNode(o)}}},[e("i",{staticClass:"fas fa-folder"}),t._v(" "+t._s(o.row.RES_NAME)+" ")])])})),t.writable?e("div",{staticClass:"uk-width",style:{width:t.buttonWidth},on:{click:t.createDirectory}},[e("button",{staticClass:"uk-button uk-button-small uk-margin-small-bottom uk-width-1-1 uk-text-left"},[e("i",{staticClass:"fas fa-folder-plus"}),t._v(" Новый раздел ")])]):t._e()],2),t.expandable?e("div",{staticClass:"uk-margin-small-left",staticStyle:{width:"30px"}},[e("button",{ref:"btnExpand",staticClass:"uk-button uk-button-small uk-button-default uk-width-1-1",on:{click:function(e){t.expanded=!t.expanded}}},[e("i",{staticClass:"fas",class:{"fa-caret-down":!t.expanded,"fa-caret-up":t.expanded}})])]):t._e()],1)},l=[],s=o(3216),d={name:"ClassificatorBar",components:{},props:{model:Object,writable:{type:Boolean,default:!1},buttonMinWidth:{type:Number,default:150},compact:{type:Boolean,default:!0}},data(){return{expanded:!1,buttonsWidth:0}},computed:{curNode(){return this.model.data.curNode},rootLoaded(){return this.model.data.loaded},parent(){return this.curNode?this.curNode.parent:null},buttonCount(){let t=Math.floor(this.buttonsWidth/this.buttonMinWidth);return Math.max(t,1)},buttonWidth(){return 100/(this.buttonCount+.001)+"%"},expandable(){if(!this.compact)return!1;let t=this.children.length;return this.curNode&&t++,this.nodeCode&&t++,this.writable&&t++,this.buttonCount<t},children(){return this.curNode?this.curNode.children||[]:this.rootLoaded?this.model.data.tree:[]}},watch:{async curNode(){null!==this.curNode&&await this.model.loadChildren(this.curNode)}},async mounted(){null!==this.model.data.curNode&&await this.model.loadChildren(this.model.data.curNode)},beforeDestroy(){},methods:{async createDirectory(){let t=this.curNode?this.curNode.row.RS_ID:this.model.rootId,e=await s.vd.query("ADD_RESOURCE_CS",{PARENT_ID:t,NAME:"Новый раздел",SYSTEM_NAME:""});console.log("new",e.RESULT),await this.model.reloadChildren(this.curNode);let o=this.model.data.curNode,a=o?o.children:this.model.data.tree,l=a.find((t=>t.row.RS_ID==parseInt(e.RESULT)));console.log("createDirectory children",o,a,l),l&&this.model.setCurNode(l)},async selectNode(t){console.log("selectNode",t),await this.model.loadChildren(t),this.model.setCurNode(t)}}},i=d,u=o(1656),n=(0,u.A)(i,a,l,!1,null,null,null),r=n.exports}}]);
//# sourceMappingURL=ClassificatorBar.7b4f7ba0.js.map