(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0b2d09"],{"265d":function(t,i,n){"use strict";n.r(i);var e=function(){var t=this,i=t.$createElement,n=t._self._c||i;return n("div",{staticClass:"ibps-edit-tags"},[n("div",{staticClass:"ibps-edit-tags__warp clearfix"},[t._l(t.dynamicTags,(function(i,e){return n("el-tag",t._b({key:i+"_"+e,attrs:{size:t.size,closable:!t.readOnly,"disable-transitions":!0},on:{close:function(n){return t.handleClose(i)}}},"el-tag",t.$attrs,!1),[t._v(" "+t._s(i)+" ")])})),t.inputVisible?n("el-input",{ref:"saveTagInput",class:t.inputClass,style:t.inputStyle,attrs:{size:"mini"},on:{blur:t.handleInputConfirm},nativeOn:{keyup:function(i){return!i.type.indexOf("key")&&t._k(i.keyCode,"enter",13,i.key,"Enter")?null:t.handleInputConfirm.apply(null,arguments)}},model:{value:t.inputValue,callback:function(i){t.inputValue=i},expression:"inputValue"}}):n("el-tag",t._b({directives:[{name:"show",rawName:"v-show",value:t.addTableAble,expression:"addTableAble "}],key:"edit",staticClass:"button-new-tag",style:t.addTagStyle,attrs:{size:t.size,"disable-transitions":!0},on:{click:t.showInput}},"el-tag",t.$attrs,!1),[t._v("+ "+t._s(t.addText||t.$t("common.buttons.add")))])],2)])},a=[],s=n("5530"),u=(n("a9e3"),n("99af"),n("a434"),n("498a"),n("caad"),n("2532"),n("d3b7"),n("07ac"),n("a15b"),{name:"IbpsEditTags",props:{value:{type:Array,default:function(){return[]}},readOnly:{type:Boolean,default:!1},devides:{type:Array,default:function(){return["，",",","|"]}},inputWidth:{type:String,default:"80px"},placement:{type:String,default:"behind"},size:{type:String,default:"",validator:function(t){return-1!==["","medium","small","mini"].indexOf(t)}},validate:{type:Function},invalidateHandle:{type:Function},max:Number,addText:{type:String}},data:function(){return{dynamicTags:[],inputVisible:!1,inputValue:""}},computed:{isBehind:function(){return"behind"===this.placement},inputClass:function(){var t=["input-new-tag"],i=this.size?"is-".concat(this.size):"is-large";return t.push(i),t},inputStyle:function(){var t=this.isBehind?{marginLeft:"5px"}:{marginRight:"5px"};return Object(s["a"])({width:this.inputWidth,float:this.isBehind?"none":"left"},t)},addTableAble:function(){return!this.readOnly&&!(this.max&&this.dynamicTags.length>=this.max)},addTagStyle:function(){var t=this.isBehind?{marginLeft:"5px",marginRight:"0px"}:{marginLeft:"0px",marginRight:"5px"};return Object(s["a"])({float:this.isBehind?"none":"left"},t)}},watch:{value:function(t){this.dynamicTags=this.value.concat([])}},created:function(){this.value&&this.value.length&&(this.dynamicTags=this.value.concat([]))},methods:{handleClose:function(t){this.dynamicTags.splice(this.dynamicTags.indexOf(t),1),this.$emit("on-delete",t,this.dynamicTags),this.$emit("input",this.dynamicTags)},showInput:function(){var t=this;this.$emit("on-add-click"),this.inputVisible=!0,this.$nextTick((function(){t.$refs.saveTagInput.$refs.input.focus()}))},handleInputConfirm:function(){var t=this;if(!this.inputValue.trim())return this.inputVisible=!1,void(this.inputValue="");var i=this.inputValue,n=this._devideInput(i);this.validate&&"function"===typeof this.validate?this.validate(n,this).then((function(i){i.length&&(t.dynamicTags=t.isBehind?t.dynamicTags.concat(i):i.concat(t.dynamicTags),t.$emit("on-add",i,t.dynamicTags),t.$emit("input",t.dynamicTags)),t.inputVisible=!1,t.inputValue=""})).catch((function(i){t.invalidateHandle&&"function"===typeof t.invalidateHandle&&t.invalidateHandle(i,t)})):(n&&n.length&&(this.dynamicTags=this.isBehind?this.dynamicTags.concat(n):n.concat(this.dynamicTags),this.$emit("on-add",i,this.dynamicTags),this.$emit("input",this.dynamicTags)),this.inputVisible=!1,this.inputValue="")},_devideInput:function(t){for(var i=this,n={},e=0,a=0;a<t.length;a++)this.devides.includes(t[a])?e+=1:n[e]?n[e].push(t[a]):n[e]=[t[a]];var s=Object.values(n).reduce((function(t,n){var e=n.join("").trim();return i.dynamicTags.includes(e)||t.push(e),t}),[]);return s},setTags:function(t){this.dynamicTags=t,this.$emit("input",this.dynamicTags)}}}),d=u,l=n("2877"),c=Object(l["a"])(d,e,a,!1,null,null,null);i["default"]=c.exports}}]);