-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 1.71 KB
/
index.js
1
(function () {var a={props:{label:String,placeholder:String,value:Array},data:function(){return{text:""}},methods:{addItem:function(){var t=this;this.text.split("\n").map(function(t){return t.trim()}).filter(Boolean).forEach(function(e){return t.value.push(e)}),this.text="",this.$emit("input",this.value),this.$refs.textarea.focus()},removeItem:function(t){this.value.splice(t,1),this.$emit("input",this.value)},onSort:function(){this.$emit("input",this.value)}}};if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-field",{attrs:{"name":"input-field","label":_vm.label}},[_c("k-draggable",{attrs:{"element":"ul","list":_vm.value,"options":{handle:".list-item-handle",animation:150,forceFallback:true}},on:{"change":_vm.onSort}},_vm._l(_vm.value,function(item,index){return _c("li",{key:item},[_c("k-icon",{staticClass:"list-item-handle",attrs:{"type":"sort"}}),_vm._v(" "),_c("span",{staticClass:"item-label"},[_vm._v(" "+_vm._s(item)+" ")]),_vm._v(" "),_c("k-button",{attrs:{"icon":"remove"},on:{"click":function(){return _vm.removeItem(index)}}})],1)}),0),_vm._v(" "),_c("k-input",{ref:"textarea",attrs:{"name":"text","type":"textarea","theme":"field","buttons":false,"placeholder":_vm.placeholder},model:{value:_vm.text,callback:function($$v){_vm.text=$$v},expression:"text"}}),_vm._v(" "),this.text?_c("k-button",{staticClass:"add-item",attrs:{"icon":"add"},on:{"click":_vm.addItem}},[_vm._v(" "+_vm._s(this.$t("add"))+" ")]):_vm._e()],1)};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("fmujakitz/list-field",{fields:{"list-field":a}});})();