lc-vue-select-input
Version:
3 lines (2 loc) • 8.24 kB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".multiple-input.is-clearable:not(.is-disabled):hover .clear-btn[data-v-be13deb0]{display:inline}.multiple-input.is-clearable:not(.is-disabled):hover .info-btn[data-v-be13deb0]{display:none}.multiple-input.is-clearable:not(.is-disabled) .clear-btn[data-v-be13deb0]{display:none}.el-input .el-input__inner.tags-list[data-v-be13deb0]{min-height:var(--el-input-inner-height);height:auto;padding:2px 0;position:relative;display:flex;flex-wrap:wrap;align-items:center;min-width:0;gap:6px}.el-input .el-input__inner.multiple-line[data-v-be13deb0]{position:relative;display:flex;flex-wrap:wrap;align-items:center;min-width:0;gap:6px}.el-input .el-input__inner[data-v-be13deb0] .el-icon{vertical-align:middle}.select-input[data-v-8f4f5a83]{width:100%}.select-input[data-v-8f4f5a83] .el-input .el-input__inner,.select-input[data-v-8f4f5a83] .el-input .el-input__suffix-inner{cursor:pointer}.select-input[data-v-8f4f5a83] .el-input.is-disabled .el-input__inner,.select-input[data-v-8f4f5a83] .el-input.is-disabled .el-input__suffix-inner{cursor:not-allowed}.select-input[data-v-8f4f5a83] .el-input.is-disabled .el-input__suffix-inner i{color:var(--el-input-placeholder-color)}.select-input.clearable:not(.disabled):hover .clear-btn[data-v-8f4f5a83]{display:inline}.select-input.clearable:not(.disabled):hover .info-btn[data-v-8f4f5a83]{display:none}.select-input .clear-btn[data-v-8f4f5a83]{display:none}.select-input[data-v-8f4f5a83] .el-icon{vertical-align:middle}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d["lc-vue-select-input"]={},d.Vue))})(this,function(d,e){"use strict";/*! Element Plus Icons Vue v2.1.0 */var u=(l,n)=>{let t=l.__vccOpts||l;for(let[c,a]of n)t[c]=a;return t},g={name:"ArrowDown"},V={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},C=e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"},null,-1),B=[C];function x(l,n,t,c,a,r){return e.openBlock(),e.createElementBlock("svg",V,B)}var h=u(g,[["render",x],["__file","arrow-down.vue"]]),w={name:"CircleClose"},N={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},E=e.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"},null,-1),$=e.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),S=[E,$];function L(l,n,t,c,a,r){return e.openBlock(),e.createElementBlock("svg",N,S)}var k=u(w,[["render",L],["__file","circle-close.vue"]]);const I=l=>(e.pushScopeId("data-v-be13deb0"),l=l(),e.popScopeId(),l),T={class:"el-input__wrapper",tabindex:"-1"},M=["placeholder"],z={key:0,class:"el-input__inner multiple-line"},A={key:1,class:"el-input__inner tags-list"},D={class:"el-input__suffix"},O={class:"el-input__suffix-inner"},j=["onClick"],F=I(()=>e.createElementVNode("i",{class:"el-icon-circle-close"},null,-1)),R={style:{"margin-left":"8px"},class:"info-btn"},U=e.defineComponent({__name:"index",props:{modelValue:{type:Array,default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},multipleLine:{type:Boolean,default:!0},clearable:{type:Boolean,default:!1}},emits:["clear-click","tag-remove"],setup(l,{emit:n}){const t=l,c=e.computed(()=>Array.isArray(t.modelValue)&&t.modelValue.length>0),a=e.computed(()=>t.clearable&&!t.disabled&&c.value),r=()=>{n("clear-click")},_=i=>{n("tag-remove",i)};return(i,s)=>{const p=e.resolveComponent("el-tag"),o=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["el-input el-input--suffix multiple-input",{"is-disabled":l.disabled,"is-clearable":e.unref(a)}])},[e.createElementVNode("div",T,[e.unref(c)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.multipleLine?(e.openBlock(),e.createElementBlock("div",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.modelValue,(f,m)=>(e.openBlock(),e.createBlock(p,{key:m,closable:!l.disabled,type:"info",class:"tag-item",onClose:b=>_(m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f),1)]),_:2},1032,["closable","onClose"]))),128))])):(e.openBlock(),e.createElementBlock("div",z,[e.createVNode(p,{closable:!l.disabled,type:"info",class:"tag-item",onClose:s[0]||(s[0]=f=>_(0))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.modelValue[0]),1)]),_:1},8,["closable"]),l.modelValue.length>1?(e.openBlock(),e.createBlock(p,{key:0,type:"info",class:"tag-item-close"},{default:e.withCtx(()=>[e.createTextVNode(" +"+e.toDisplayString(l.modelValue.length-1),1)]),_:1})):e.createCommentVNode("",!0)]))],64)):(e.openBlock(),e.createElementBlock("input",{key:0,class:"el-input__inner",type:"text",readonly:"",autocomplete:"off",tabindex:"0",placeholder:l.placeholder},null,8,M)),e.createElementVNode("span",D,[e.createElementVNode("span",O,[e.unref(a)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-btn",onClick:e.withModifiers(r,["stop","prevent"])},[F,e.createVNode(o,{style:{"vertical-align":"middle"}},{default:e.withCtx(()=>[e.createVNode(e.unref(k))]),_:1})],8,j)):e.createCommentVNode("",!0),e.createElementVNode("span",R,[e.renderSlot(i.$slots,"icon",{},()=>[e.createVNode(o,{style:{"vertical-align":"middle"}},{default:e.withCtx(()=>[e.createVNode(e.unref(h))]),_:1})],!0)])])])])],2)}}}),K="",y=(l,n)=>{const t=l.__vccOpts||l;for(const[c,a]of n)t[c]=a;return t},q=y(U,[["__scopeId","data-v-be13deb0"]]),P=["onClick"],G={style:{"margin-left":"8px"},class:"info-btn"},H=e.defineComponent({__name:"index",props:{modelValue:{type:[String,Number,Array],default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},multipleLine:{type:Boolean,default:!0},clearable:{type:Boolean,default:!1}},emits:["update:modelValue","change","click","clear-click","multiple-tag-remove"],setup(l,{emit:n}){const t=l,c=e.computed(()=>t.modelValue&&t.modelValue!==""),a=e.computed(()=>t.clearable&&!t.disabled&&c.value),r=o=>{n("update:modelValue",o)},_=(...o)=>{n("change",...o)},i=(...o)=>{t.disabled||n("click",...o)},s=(...o)=>{t.disabled||n("clear-click",...o)},p=o=>{n("multiple-tag-remove",o)};return(o,f)=>{const m=e.resolveComponent("el-icon"),b=e.resolveComponent("el-input");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["select-input",{clearable:e.unref(a),disabled:l.disabled}]),onClick:i},[l.multiple?(e.openBlock(),e.createBlock(q,{key:0,"model-value":l.modelValue,readonly:"",clearable:l.clearable,placeholder:l.placeholder,disabled:l.disabled,"multiple-line":l.multipleLine,onTagRemove:p,onClearClick:s},{icon:e.withCtx(()=>[e.renderSlot(o.$slots,"icon",{},void 0,!0)]),_:3},8,["model-value","clearable","placeholder","disabled","multiple-line"])):(e.openBlock(),e.createBlock(b,{key:1,"model-value":l.modelValue,readonly:"",placeholder:l.placeholder,disabled:l.disabled,onChange:_,"onUpdate:modelValue":r},{suffix:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-btn",onClick:e.withModifiers(s,["stop","prevent"])},[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(k))]),_:1})],8,P)):e.createCommentVNode("",!0),e.createElementVNode("span",G,[e.renderSlot(o.$slots,"icon",{},()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(h))]),_:1})],!0)])]),_:3},8,["model-value","placeholder","disabled"]))],2)}}}),Q="",J=y(H,[["__scopeId","data-v-8f4f5a83"]]);d.SelectInput=J,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});