ex-select
Version:
> 基于`element-ui`和`vue-virtual-scroller`的下拉选择器,用虚拟列表的方式逐级渲染列表。适用于数据量较大的场景。
2 lines • 50.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("element-ui/src/mixins/emitter"),require("element-ui/src/mixins/focus"),require("element-ui/src/mixins/locale"),require("element-ui/packages/input"),require("element-ui/src/utils/vue-popper"),require("element-ui/src/utils/util"),require("element-ui/packages/tag"),require("throttle-debounce/debounce"),require("element-ui/src/utils/clickoutside"),require("element-ui/src/utils/resize-event"),require("element-ui/src/utils/scroll-into-view"),require("element-ui/src/utils/shared")):"function"==typeof define&&define.amd?define(["element-ui/src/mixins/emitter","element-ui/src/mixins/focus","element-ui/src/mixins/locale","element-ui/packages/input","element-ui/src/utils/vue-popper","element-ui/src/utils/util","element-ui/packages/tag","throttle-debounce/debounce","element-ui/src/utils/clickoutside","element-ui/src/utils/resize-event","element-ui/src/utils/scroll-into-view","element-ui/src/utils/shared"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).exSelect=t(e.Emitter,e.Focus,e.Locale,e.ElInput,e.Popper,e.util,e.ElTag,e.debounce,e.Clickoutside,e.resizeEvent,null,e.shared)}(this,(function(e,t,i,s,n,r,l,o,a,c,h,u){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=d(e),f=d(t),v=d(i),m=d(s),y=d(n),b=d(l),g=d(o),_=d(a);function S(e,t,i,s,n,r,l,o,a,c){"boolean"!=typeof l&&(a=o,o=l,l=!1);const h="function"==typeof i?i.options:i;let u;if(e&&e.render&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns,h._compiled=!0,n&&(h.functional=!0)),s&&(h._scopeId=s),r?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},h._ssrRegister=u):t&&(u=l?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),u)if(h.functional){const e=h.render;h.render=function(t,i){return u.call(i),e(t,i)}}else{const e=h.beforeCreate;h.beforeCreate=e?[].concat(e,u):[u]}return i}const $={name:"ExSelectDropdown",componentName:"ExSelectDropdown",mixins:[y.default],props:{placement:{default:"bottom-start"},boundariesPadding:{default:0},popperOptions:{default:()=>({gpuAcceleration:!1})},visibleArrow:{default:!0},appendToBody:{type:Boolean,default:!0}},data:()=>({minWidth:""}),computed:{popperClass(){return this.$parent.popperClass}},watch:{"$parent.inputWidth"(){this.minWidth=this.$parent.$el.getBoundingClientRect().width+"px"}},mounted(){this.referenceElm=this.$parent.$refs.reference.$el,this.$parent.popperElm=this.popperElm=this.$el,this.$on("updatePopper",(()=>{this.$parent.visible&&this.updatePopper()})),this.$on("destroyPopper",this.destroyPopper)}};var w=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{staticClass:"el-select-dropdown el-popper",class:[{"is-multiple":e.$parent.multiple},e.popperClass],style:{minWidth:e.minWidth}},[e._t("default")],2)};w._withStripped=!0;const x=S({render:w,staticRenderFns:[]},undefined,$,undefined,false,undefined,!1,void 0,void 0,void 0);const O={mixins:[p.default],name:"ExOption",componentName:"ExOption",inject:["select"],props:{value:{required:!0},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},data:()=>({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),computed:{isObject(){return"[object object]"===Object.prototype.toString.call(this.value).toLowerCase()},currentLabel(){return this.label||(this.isObject?"":this.value)},currentValue(){return this.value||this.label||""},itemSelected(){return this.select.multiple?this.contains(this.select.value,this.value):this.isEqual(this.value,this.select.value)},limitReached(){return!!this.select.multiple&&(!this.itemSelected&&(this.select.value||[]).length>=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel(){console.log("nnn=",!this.select.searchKey),this.created||this.select.remote||this.select.searchKey||this.dispatch("ExSelect","setSelected")},value(e,t){const{remote:i,valueKey:s}=this.select;if(!this.created&&!i&&!this.select.searchKey){if(s&&"object"==typeof e&&"object"==typeof t&&e[s]===t[s])return;console.log("mmm=",!this.select.searchKey),this.dispatch("ExSelect","setSelected")}}},methods:{isEqual(e,t){if(this.isObject){const i=this.select.valueKey;return r.getValueByPath(e,i)===r.getValueByPath(t,i)}return e===t},contains(e=[],t){if(this.isObject){const i=this.select.valueKey;return e&&e.some((e=>r.getValueByPath(e,i)===r.getValueByPath(t,i)))}return e&&e.indexOf(t)>-1},handleGroupDisabled(e){this.groupDisabled=e},hoverItem(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this))},selectOptionClick(){!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ExSelect","handleOptionClick",[this,!0])},queryChange(e){this.visible=new RegExp(r.escapeRegexpString(e),"i").test(this.currentLabel)||this.created,this.visible||this.select.filteredOptionsCount--}},created(){this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled)},beforeDestroy(){}};var z=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("li",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],staticClass:"el-select-dropdown__item",class:{selected:e.itemSelected,"is-disabled":e.disabled||e.groupDisabled||e.limitReached,hover:e.hover},on:{mouseenter:e.hoverItem,click:function(t){return t.stopPropagation(),e.selectOptionClick.apply(null,arguments)}}},[e._t("default",(function(){return[i("span",[e._v(e._s(e.currentLabel))])]}))],2)};z._withStripped=!0;const C=S({render:z,staticRenderFns:[]},undefined,O,undefined,false,undefined,!1,void 0,void 0,void 0);var k=void 0;function T(){T.init||(T.init=!0,k=-1!==function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var s=e.indexOf("Edge/");return s>0?parseInt(e.substring(s+5,e.indexOf(".",s)),10):-1}())}var D={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"resize-observer",attrs:{tabindex:"-1"}})},staticRenderFns:[],_scopeId:"data-v-b329ee4c",name:"resize-observer",methods:{compareAndNotify:function(){this._w===this.$el.offsetWidth&&this._h===this.$el.offsetHeight||(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.$emit("notify"))},addResizeHandlers:function(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers:function(){this._resizeObject&&this._resizeObject.onload&&(!k&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),delete this._resizeObject.onload)}},mounted:function(){var e=this;T(),this.$nextTick((function(){e._w=e.$el.offsetWidth,e._h=e.$el.offsetHeight}));var t=document.createElement("object");this._resizeObject=t,t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex",-1),t.onload=this.addResizeHandlers,t.type="text/html",k&&this.$el.appendChild(t),t.data="about:blank",k||this.$el.appendChild(t)},beforeDestroy:function(){this.removeResizeHandlers()}};var I={version:"0.4.5",install:function(e){e.component("resize-observer",D),e.component("ResizeObserver",D)}},P=null;function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function L(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function R(e){return function(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t<e.length;t++)i[t]=e[t];return i}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function V(e,t){if(e===t)return!0;if("object"===E(e)){for(var i in e)if(!V(e[i],t[i]))return!1;return!0}return!1}"undefined"!=typeof window?P=window.Vue:"undefined"!=typeof global&&(P=global.Vue),P&&P.use(I);var A=function(){function e(t,i,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=t,this.observer=null,this.frozen=!1,this.createObserver(i,s)}var t,i,s;return t=e,(i=[{key:"createObserver",value:function(e,t){var i=this;if(this.observer&&this.destroyObserver(),!this.frozen){var s;if(this.options="function"==typeof(s=e)?{callback:s}:s,this.callback=function(e,t){i.options.callback(e,t),e&&i.options.once&&(i.frozen=!0,i.destroyObserver())},this.callback&&this.options.throttle){var n=(this.options.throttleOptions||{}).leading;this.callback=function(e,t){var i,s,n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=function(l){for(var o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];if(n=a,!i||l!==s){var h=r.leading;"function"==typeof h&&(h=h(l,s)),i&&l===s||!h||e.apply(void 0,[l].concat(R(n))),s=l,clearTimeout(i),i=setTimeout((function(){e.apply(void 0,[l].concat(R(n))),i=0}),t)}};return l._clear=function(){clearTimeout(i),i=null},l}(this.callback,this.options.throttle,{leading:function(e){return"both"===n||"visible"===n&&e||"hidden"===n&&!e}})}this.oldResult=void 0,this.observer=new IntersectionObserver((function(e){var t=e[0];if(e.length>1){var s=e.find((function(e){return e.isIntersecting}));s&&(t=s)}if(i.callback){var n=t.isIntersecting&&t.intersectionRatio>=i.threshold;if(n===i.oldResult)return;i.oldResult=n,i.callback(n,t)}}),this.options.intersection),t.context.$nextTick((function(){i.observer&&i.observer.observe(i.el)}))}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&this.options.intersection.threshold||0}}])&&L(t.prototype,i),s&&L(t,s),e}();function q(e,t,i){var s=t.value;if(s)if("undefined"==typeof IntersectionObserver)console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var n=new A(e,s,i);e._vue_visibilityState=n}}function j(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var F={bind:q,update:function(e,t,i){var s=t.value;if(!V(s,t.oldValue)){var n=e._vue_visibilityState;s?n?n.createObserver(s,i):q(e,{value:s},i):j(e)}},unbind:j};var B={version:"0.4.6",install:function(e){e.directive("observe-visibility",F)}},M=null;"undefined"!=typeof window?M=window.Vue:"undefined"!=typeof global&&(M=global.Vue),M&&M.use(B);var N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},H={exports:{}};!function(e){var t,i;t=N,i=function(){var e=/(auto|scroll)/,t=function(e,i){return null===e.parentNode?i:t(e.parentNode,i.concat([e]))},i=function(e,t){return getComputedStyle(e,null).getPropertyValue(t)},s=function(t){return e.test(function(e){return i(e,"overflow")+i(e,"overflow-y")+i(e,"overflow-x")}(t))};return function(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var i=t(e.parentNode,[]),n=0;n<i.length;n+=1)if(s(i[n]))return i[n];return document.scrollingElement||document.documentElement}}},e.exports?e.exports=i():t.Scrollparent=i()}(H);var U=H.exports,K={itemsLimit:1e3};function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Q(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function G(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function X(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?G(Object(i),!0).forEach((function(t){Q(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):G(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i<t;i++)s[i]=e[i];return s}function J(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return Y(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Y(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,n,r=!0,l=!1;return{s:function(){s=e[Symbol.iterator]()},n:function(){var e=s.next();return r=e.done,e},e:function(e){l=!0,n=e},f:function(){try{r||null==s.return||s.return()}finally{if(l)throw n}}}}var Z={items:{type:Array,required:!0},keyField:{type:String,default:"id"},direction:{type:String,default:"vertical",validator:function(e){return["vertical","horizontal"].includes(e)}}};function ee(){return this.items.length&&"object"!==W(this.items[0])}var te=!1;if("undefined"!=typeof window){te=!1;try{var ie=Object.defineProperty({},"passive",{get:function(){te=!0}});window.addEventListener("test",null,ie)}catch(e){}}var se=0;function ne(e,t,i,s,n,r,l,o,a,c){"boolean"!=typeof l&&(a=o,o=l,l=!1);const h="function"==typeof i?i.options:i;let u;if(e&&e.render&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns,h._compiled=!0,n&&(h.functional=!0)),s&&(h._scopeId=s),r?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},h._ssrRegister=u):t&&(u=l?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),u)if(h.functional){const e=h.render;h.render=function(t,i){return u.call(i),e(t,i)}}else{const e=h.beforeCreate;h.beforeCreate=e?[].concat(e,u):[u]}return i}const re={name:"RecycleScroller",components:{ResizeObserver:D},directives:{ObserveVisibility:F},props:X({},Z,{itemSize:{type:Number,default:null},minItemSize:{type:[Number,String],default:null},sizeField:{type:String,default:"size"},typeField:{type:String,default:"type"},buffer:{type:Number,default:200},pageMode:{type:Boolean,default:!1},prerender:{type:Number,default:0},emitUpdate:{type:Boolean,default:!1}}),data:function(){return{pool:[],totalSize:0,ready:!1,hoverKey:null}},computed:{sizes:function(){if(null===this.itemSize){for(var e,t={"-1":{accumulator:0}},i=this.items,s=this.sizeField,n=this.minItemSize,r=1e4,l=0,o=0,a=i.length;o<a;o++)(e=i[o][s]||n)<r&&(r=e),l+=e,t[o]={accumulator:l,size:e};return this.$_computedMinItemSize=r,t}return[]},simpleArray:ee},watch:{items:function(){this.updateVisibleItems(!0)},pageMode:function(){this.applyPageMode(),this.updateVisibleItems(!1)},sizes:{handler:function(){this.updateVisibleItems(!1)},deep:!0}},created:function(){this.$_startIndex=0,this.$_endIndex=0,this.$_views=new Map,this.$_unusedViews=new Map,this.$_scrollDirty=!1,this.$_lastUpdateScrollPosition=0,this.prerender&&(this.$_prerender=!0,this.updateVisibleItems(!1))},mounted:function(){var e=this;this.applyPageMode(),this.$nextTick((function(){e.$_prerender=!1,e.updateVisibleItems(!0),e.ready=!0}))},beforeDestroy:function(){this.removeListeners()},methods:{addView:function(e,t,i,s,n){var r={item:i,position:0},l={id:se++,index:t,used:!0,key:s,type:n};return Object.defineProperty(r,"nr",{configurable:!1,value:l}),e.push(r),r},unuseView:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.$_unusedViews,s=e.nr.type,n=i.get(s);n||(n=[],i.set(s,n)),n.push(e),t||(e.nr.used=!1,e.position=-9999,this.$_views.delete(e.nr.key))},handleResize:function(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll:function(e){var t=this;this.$_scrollDirty||(this.$_scrollDirty=!0,requestAnimationFrame((function(){t.$_scrollDirty=!1,t.updateVisibleItems(!1,!0).continuous||(clearTimeout(t.$_refreshTimout),t.$_refreshTimout=setTimeout(t.handleScroll,100))})))},handleVisibilityChange:function(e,t){var i=this;this.ready&&(e||0!==t.boundingClientRect.width||0!==t.boundingClientRect.height?(this.$emit("visible"),requestAnimationFrame((function(){i.updateVisibleItems(!1)}))):this.$emit("hidden"))},updateVisibleItems:function(e){var t,i,s,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.itemSize,o=this.$_computedMinItemSize,a=this.typeField,c=this.simpleArray?null:this.keyField,h=this.items,u=h.length,d=this.sizes,p=this.$_views,f=this.$_unusedViews,v=this.pool;if(u)if(this.$_prerender)t=0,i=this.prerender,s=null;else{var m=this.getScroll();if(r){var y=m.start-this.$_lastUpdateScrollPosition;if(y<0&&(y=-y),null===l&&y<o||y<l)return{continuous:!0}}this.$_lastUpdateScrollPosition=m.start;var b=this.buffer;if(m.start-=b,m.end+=b,null===l){var g,_=0,S=u-1,$=~~(u/2);do{g=$,d[$].accumulator<m.start?_=$:$<u-1&&d[$+1].accumulator>m.start&&(S=$),$=~~((_+S)/2)}while($!==g);for($<0&&($=0),t=$,s=d[u-1].accumulator,i=$;i<u&&d[i].accumulator<m.end;i++);-1===i?i=h.length-1:++i>u&&(i=u)}else(t=~~(m.start/l))<0&&(t=0),(i=Math.ceil(m.end/l))>u&&(i=u),s=u*l}else t=i=s=0;i-t>K.itemsLimit&&this.itemsLimitError(),this.totalSize=s;var w=t<=this.$_endIndex&&i>=this.$_startIndex;if(this.$_continuous!==w){if(w){p.clear(),f.clear();for(var x=0,O=v.length;x<O;x++)n=v[x],this.unuseView(n)}this.$_continuous=w}else if(w)for(var z=0,C=v.length;z<C;z++)(n=v[z]).nr.used&&(e&&(n.nr.index=h.findIndex((function(e){return c?e[c]===n.item[c]:e===n.item}))),(-1===n.nr.index||n.nr.index<t||n.nr.index>=i)&&this.unuseView(n));for(var k,T,D,I,P=w?null:new Map,E=t;E<i;E++){k=h[E];var L=c?k[c]:k;if(null==L)throw new Error("Key is ".concat(L," on item (keyField is '").concat(c,"')"));n=p.get(L),l||d[E].size?(n?(n.nr.used=!0,n.item=k):(T=k[a],D=f.get(T),w?D&&D.length?((n=D.pop()).item=k,n.nr.used=!0,n.nr.index=E,n.nr.key=L,n.nr.type=T):n=this.addView(v,E,k,L,T):(I=P.get(T)||0,(!D||I>=D.length)&&(n=this.addView(v,E,k,L,T),this.unuseView(n,!0),D=f.get(T)),(n=D[I]).item=k,n.nr.used=!0,n.nr.index=E,n.nr.key=L,n.nr.type=T,P.set(T,I+1),I++),p.set(L,n)),n.position=null===l?d[E-1].accumulator:E*l):n&&this.unuseView(n)}return this.$_startIndex=t,this.$_endIndex=i,this.emitUpdate&&this.$emit("update",t,i),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,300),{continuous:w}},getListenerTarget:function(){var e=U(this.$el);return!window.document||e!==window.document.documentElement&&e!==window.document.body||(e=window),e},getScroll:function(){var e,t=this.$el,i="vertical"===this.direction;if(this.pageMode){var s=t.getBoundingClientRect(),n=i?s.height:s.width,r=-(i?s.top:s.left),l=i?window.innerHeight:window.innerWidth;r<0&&(l+=r,r=0),r+l>n&&(l=n-r),e={start:r,end:r+l}}else e=i?{start:t.scrollTop,end:t.scrollTop+t.clientHeight}:{start:t.scrollLeft,end:t.scrollLeft+t.clientWidth};return e},applyPageMode:function(){this.pageMode?this.addListeners():this.removeListeners()},addListeners:function(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,!!te&&{passive:!0}),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners:function(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem:function(e){var t;t=null===this.itemSize?e>0?this.sizes[e-1].accumulator:0:e*this.itemSize,this.scrollToPosition(t)},scrollToPosition:function(e){"vertical"===this.direction?this.$el.scrollTop=e:this.$el.scrollLeft=e},itemsLimitError:function(){var e=this;throw setTimeout((function(){console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",e.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")})),new Error("Rendered items limit reached")},sortViews:function(){this.pool.sort((function(e,t){return e.nr.index-t.nr.index}))}}};var le=function(){var e,t,i=this,s=i.$createElement,n=i._self._c||s;return n("div",{directives:[{name:"observe-visibility",rawName:"v-observe-visibility",value:i.handleVisibilityChange,expression:"handleVisibilityChange"}],staticClass:"vue-recycle-scroller",class:(e={ready:i.ready,"page-mode":i.pageMode},e["direction-"+i.direction]=!0,e),on:{"&scroll":function(e){return i.handleScroll(e)}}},[i.$slots.before?n("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("before")],2):i._e(),i._v(" "),n("div",{ref:"wrapper",staticClass:"vue-recycle-scroller__item-wrapper",style:(t={},t["vertical"===i.direction?"minHeight":"minWidth"]=i.totalSize+"px",t)},i._l(i.pool,(function(e){return n("div",{key:e.nr.id,staticClass:"vue-recycle-scroller__item-view",class:{hover:i.hoverKey===e.nr.key},style:i.ready?{transform:"translate"+("vertical"===i.direction?"Y":"X")+"("+e.position+"px)"}:null,on:{mouseenter:function(t){i.hoverKey=e.nr.key},mouseleave:function(e){i.hoverKey=null}}},[i._t("default",null,{item:e.item,index:e.nr.index,active:e.nr.used})],2)})),0),i._v(" "),i.$slots.after?n("div",{staticClass:"vue-recycle-scroller__slot"},[i._t("after")],2):i._e(),i._v(" "),n("ResizeObserver",{on:{notify:i.handleResize}})],1)};le._withStripped=!0;const oe=ne({render:le,staticRenderFns:[]},undefined,re,undefined,!1,undefined,!1,void 0,void 0,void 0);const ae={name:"DynamicScroller",components:{RecycleScroller:oe},inheritAttrs:!1,provide:function(){return"undefined"!=typeof ResizeObserver&&(this.$_resizeObserver=new ResizeObserver((function(e){var t,i=J(e);try{for(i.s();!(t=i.n()).done;){var s=t.value;if(s.target){var n=new CustomEvent("resize",{detail:{contentRect:s.contentRect}});s.target.dispatchEvent(n)}}}catch(e){i.e(e)}finally{i.f()}}))),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},props:X({},Z,{minItemSize:{type:[Number,String],required:!0}}),data:function(){return{vscrollData:{active:!0,sizes:{},validSizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:ee,itemsWithSize:function(){for(var e=[],t=this.items,i=this.keyField,s=this.simpleArray,n=this.vscrollData.sizes,r=0;r<t.length;r++){var l=t[r],o=s?r:l[i],a=n[o];void 0!==a||this.$_undefinedMap[o]||(a=0),e.push({item:l,id:o,size:a})}return e},listeners:function(){var e={};for(var t in this.$listeners)"resize"!==t&&"visible"!==t&&(e[t]=this.$listeners[t]);return e}},watch:{items:function(){this.forceUpdate(!1)},simpleArray:{handler:function(e){this.vscrollData.simpleArray=e},immediate:!0},direction:function(e){this.forceUpdate(!0)}},created:function(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={}},activated:function(){this.vscrollData.active=!0},deactivated:function(){this.vscrollData.active=!1},methods:{onScrollerResize:function(){this.$refs.scroller&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible:function(){this.$emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(e||this.simpleArray)&&(this.vscrollData.validSizes={}),this.$emit("vscroll:update",{force:!0})},scrollToItem:function(e){var t=this.$refs.scroller;t&&t.scrollToItem(e)},getItemSize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=this.simpleArray?null!=t?t:this.items.indexOf(e):e[this.keyField];return this.vscrollData.sizes[i]||0},scrollToBottom:function(){var e=this;if(!this.$_scrollingToBottom){this.$_scrollingToBottom=!0;var t=this.$el;this.$nextTick((function(){t.scrollTop=t.scrollHeight+5e3;requestAnimationFrame((function i(){t.scrollTop=t.scrollHeight+5e3,requestAnimationFrame((function(){t.scrollTop=t.scrollHeight+5e3,0===e.$_undefinedSizes?e.$_scrollingToBottom=!1:requestAnimationFrame(i)}))}))}))}}}};var ce=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("RecycleScroller",e._g(e._b({ref:"scroller",attrs:{items:e.itemsWithSize,"min-item-size":e.minItemSize,direction:e.direction,"key-field":"id"},on:{resize:e.onScrollerResize,visible:e.onScrollerVisible},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.item,s=t.index,n=t.active;return[e._t("default",null,null,{item:i.item,index:s,active:n,itemWithSize:i})]}}],null,!0)},"RecycleScroller",e.$attrs,!1),e.listeners),[e._v(" "),i("template",{slot:"before"},[e._t("before")],2),e._v(" "),i("template",{slot:"after"},[e._t("after")],2)],2)};ce._withStripped=!0;const he=ne({render:ce,staticRenderFns:[]},undefined,ae,undefined,!1,undefined,!1,void 0,void 0,void 0);const ue=ne({},undefined,{name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},computed:{id:function(){return this.vscrollData.simpleArray?this.index:this.item[this.vscrollData.keyField]},size:function(){return this.vscrollData.validSizes[this.id]&&this.vscrollData.sizes[this.id]||0},finalActive:function(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id:function(){this.size||this.onDataUpdate()},finalActive:function(e){this.size||(e?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?e?this.observeSize():this.unobserveSize():e&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created:function(){var e=this;if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){var t=function(t){e.$watch((function(){return e.sizeDependencies[t]}),e.onDataUpdate)};for(var i in this.sizeDependencies)t(i);this.vscrollParent.$on("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$on("vscroll:update-size",this.onVscrollUpdateSize)}},mounted:function(){this.vscrollData.active&&(this.updateSize(),this.observeSize())},beforeDestroy:function(){this.vscrollParent.$off("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$off("vscroll:update-size",this.onVscrollUpdateSize),this.unobserveSize()},methods:{updateSize:function(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData:function(){var e=this;this.watchData?this.$_watchData=this.$watch("data",(function(){e.onDataUpdate()}),{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate:function(e){var t=e.force;!this.finalActive&&t&&(this.$_pendingVScrollUpdate=this.id),this.$_forceNextVScrollUpdate!==this.id&&!t&&this.size||this.updateSize()},onDataUpdate:function(){this.updateSize()},computeSize:function(e){var t=this;this.$nextTick((function(){if(t.id===e){var i=t.$el.offsetWidth,s=t.$el.offsetHeight;t.applySize(i,s)}t.$_pendingSizeUpdate=null}))},applySize:function(e,t){var i=Math.round("vertical"===this.vscrollParent.direction?t:e);i&&this.size!==i&&(this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.$set(this.vscrollData.sizes,this.id,i),this.$set(this.vscrollData.validSizes,this.id,!0),this.emitResize&&this.$emit("resize",this.id))},observeSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.observe(this.$el.parentNode),this.$el.parentNode.addEventListener("resize",this.onResize))},unobserveSize:function(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.unobserve(this.$el.parentNode),this.$el.parentNode.removeEventListener("resize",this.onResize))},onResize:function(e){var t=e.detail.contentRect,i=t.width,s=t.height;this.applySize(i,s)}},render:function(e){return e(this.tag,this.$slots.default)}},undefined,undefined,undefined,!1,void 0,void 0,void 0);var de={version:"1.0.10",install:function(e,t){var i=Object.assign({},{installComponents:!0,componentsPrefix:""},t);for(var s in i)void 0!==i[s]&&(K[s]=i[s]);i.installComponents&&function(e,t){e.component("".concat(t,"recycle-scroller"),oe),e.component("".concat(t,"RecycleScroller"),oe),e.component("".concat(t,"dynamic-scroller"),he),e.component("".concat(t,"DynamicScroller"),he),e.component("".concat(t,"dynamic-scroller-item"),ue),e.component("".concat(t,"DynamicScrollerItem"),ue)}(e,i.componentsPrefix)}},pe=null;"undefined"!=typeof window?pe=window.Vue:"undefined"!=typeof global&&(pe=global.Vue),pe&&pe.use(de);const fe={mixins:[p.default,v.default,f.default("reference"),{data:function(){return{hoverOption:-1}},computed:{optionsAllDisabled:function(){return this.options.filter((function(e){return e.visible})).every((function(e){return e.disabled}))}},watch:{hoverIndex:function(e){var t=this;"number"==typeof e&&e>-1&&(this.hoverOption=this.options[e]||{}),this.options.forEach((function(e){e.hover=t.hoverOption===e}))}},methods:{navigateOptions:function(e){var t=this;if(this.visible){if(0!==this.options.length&&0!==this.filteredOptionsCount&&!this.optionsAllDisabled){"next"===e?(this.hoverIndex++,this.hoverIndex===this.options.length&&(this.hoverIndex=0)):"prev"===e&&(this.hoverIndex--,this.hoverIndex<0&&(this.hoverIndex=this.options.length-1));var i=this.options[this.hoverIndex];!0!==i.disabled&&!0!==i.groupDisabled&&i.visible||this.navigateOptions(e),this.$nextTick((function(){return t.scrollToOption(t.hoverOption)}))}}else this.visible=!0}}}],name:"ExSelect",componentName:"ExSelect",inject:{elForm:{default:""},elFormItem:{default:""}},provide(){return{select:this}},computed:{filterNodes(){return this.searchKey?this.originOptions.filter((e=>e.label.includes(this.searchKey))):this.originOptions},_elFormItemSize(){return(this.elFormItem||{}).elFormItemSize},readonly(){return!this.filterable||this.multiple||!r.isIE()&&!r.isEdge()&&!this.visible},showClose(){let e=this.multiple?Array.isArray(this.value)&&this.value.length>0:void 0!==this.value&&null!==this.value&&""!==this.value;return this.clearable&&!this.selectDisabled&&this.inputHovering&&e},iconClass(){return this.remote&&this.filterable?"":this.visible?"arrow-up is-reverse":"arrow-up"},debounce(){return this.remote?300:0},emptyText(){return this.loading?this.loadingText||this.t("el.select.loading"):(!this.remote||""!==this.query||0!==this.options.length)&&(this.filterable&&this.query&&this.options.length>0&&0===this.filteredOptionsCount?this.noMatchText||this.t("el.select.noMatch"):0===this.options.length?this.noDataText||this.t("el.select.noData"):null)},showNewOption(){let e=this.options.filter((e=>!e.created)).some((e=>e.currentLabel===this.query));return this.filterable&&this.allowCreate&&""!==this.query&&!e},selectSize(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},selectDisabled(){return this.disabled||(this.elForm||{}).disabled},collapseTagSize(){return["small","mini"].indexOf(this.selectSize)>-1?"mini":"small"},propPlaceholder(){return void 0!==this.placeholder?this.placeholder:this.t("el.select.placeholder")}},components:{ElInput:m.default,ExSelectMenu:x,ExOption:C,ElTag:b.default,RecycleScroller:oe},directives:{Clickoutside:_.default},props:{name:String,id:String,value:{required:!0},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:e=>("production"!==process.env.NODE_ENV&&console.warn("[Element Warn][Select]'auto-complete' property will be deprecated in next major version. please use 'autocomplete' instead."),!0)},automaticDropdown:Boolean,size:String,disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:String,remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String,required:!1},defaultFirstOption:Boolean,reserveKeyword:Boolean,valueKey:{type:String,default:"value"},collapseTags:Boolean,popperAppendToBody:{type:Boolean,default:!0},originOptions:{type:Array,default:()=>[]}},data(){return{options:[],list:(()=>{let e=[];for(let t=0;t<1e3;t++)e.push({value:t,label:"选项"+t});return e})(),cachedOptions:[],createdLabel:null,createdSelected:!1,selected:this.multiple?[]:{},inputLength:20,inputWidth:0,initialInputHeight:0,cachedPlaceHolder:"",optionsCount:0,filteredOptionsCount:0,visible:!1,softFocus:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,currentPlaceholder:"",menuVisibleOnFocus:!1,isOnComposition:!1,isSilentBlur:!1,searchKey:""}},watch:{selectDisabled(){this.$nextTick((()=>{this.resetInputHeight()}))},propPlaceholder(e){this.cachedPlaceHolder=this.currentPlaceholder=e},value(e,t){this.multiple&&(this.resetInputHeight(),e&&e.length>0||this.$refs.input&&""!==this.query?this.currentPlaceholder="":this.currentPlaceholder=this.cachedPlaceHolder,this.filterable&&!this.reserveKeyword&&(this.query="",this.handleQueryChange(this.query))),this.setSelected(),this.filterable&&!this.multiple&&(this.inputLength=20),r.valueEquals(e,t)||this.dispatch("ElFormItem","el.form.change",e)},visible(e){e?(this.searchKey="",this.broadcast("ExSelectDropdown","updatePopper"),this.filterable&&(this.query=this.remote?"":this.selectedLabel,this.handleQueryChange(this.query),this.multiple?this.$refs.input.focus():(this.remote||(this.broadcast("ExOption","queryChange",""),this.broadcast("ExOptionGroup","queryChange")),console.log(111,this.selectedLabel),this.selectedLabel&&(this.currentPlaceholder=this.selectedLabel,this.selectedLabel="")))):(this.broadcast("ExSelectDropdown","destroyPopper"),this.$refs.input&&this.$refs.input.blur(),this.query="",this.previousQuery=null,this.selectedLabel="",this.inputLength=20,this.menuVisibleOnFocus=!1,this.resetHoverIndex(),this.$nextTick((()=>{this.$refs.input&&""===this.$refs.input.value&&0===this.selected.length&&(this.currentPlaceholder=this.cachedPlaceHolder)})),this.multiple||(this.selected&&(this.filterable&&this.allowCreate&&this.createdSelected&&this.createdLabel?this.selectedLabel=this.createdLabel:this.selectedLabel=this.selected.currentLabel,this.filterable&&(this.query=this.selectedLabel)),this.filterable&&(this.currentPlaceholder=this.cachedPlaceHolder))),this.$emit("visible-change",e),console.log(222,this.selectedLabel)},options(){if(this.$isServer)return;this.$nextTick((()=>{this.broadcast("ExSelectDropdown","updatePopper")})),this.multiple&&this.resetInputHeight();let e=this.$el.querySelectorAll("input");-1===[].indexOf.call(e,document.activeElement)&&this.setSelected(),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()}},methods:{handleComposition(e){const t=e.target.value;if("compositionend"===e.type)this.isOnComposition=!1,this.$nextTick((e=>this.handleQueryChange(t)));else{const e=t[t.length-1]||"";this.isOnComposition=!u.isKorean(e)}},handleQueryChange(e){this.previousQuery===e||this.isOnComposition||(null!==this.previousQuery||"function"!=typeof this.filterMethod&&"function"!=typeof this.remoteMethod?(this.previousQuery=e,this.$nextTick((()=>{this.visible&&this.broadcast("ExSelectDropdown","updatePopper")})),this.hoverIndex=-1,this.multiple&&this.filterable&&this.$nextTick((()=>{const e=15*this.$refs.input.value.length+20;this.inputLength=this.collapseTags?Math.min(50,e):e,this.managePlaceholder(),this.resetInputHeight()})),this.remote&&"function"==typeof this.remoteMethod?(this.hoverIndex=-1,this.remoteMethod(e)):"function"==typeof this.filterMethod?(this.filterMethod(e),this.broadcast("ExOptionGroup","queryChange")):(this.filteredOptionsCount=this.optionsCount,this.broadcast("ExOption","queryChange",e),this.broadcast("ExOptionGroup","queryChange")),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()):this.previousQuery=e)},scrollToOption(e){},handleMenuEnter(){this.$nextTick((()=>this.scrollToOption(this.selected)))},emitChange(e){r.valueEquals(this.value,e)||this.$emit("change",e)},getOption(e){let t;const i="[object object]"===Object.prototype.toString.call(e).toLowerCase(),s="[object null]"===Object.prototype.toString.call(e).toLowerCase(),n="[object undefined]"===Object.prototype.toString.call(e).toLowerCase();for(let s=this.cachedOptions.length-1;s>=0;s--){const n=this.cachedOptions[s];if(i?r.getValueByPath(n.value,this.valueKey)===r.getValueByPath(e,this.valueKey):n.value===e){t=n;break}}if(t)return t;let l={value:e,currentLabel:i||s||n?"":String(e)};return this.multiple&&(l.hitState=!1),l},setSelected(){if(console.log(999,this.query,this.selectedLabel),!this.multiple){let e=this.getOption(this.value);return e.created?(this.createdLabel=e.currentLabel,this.createdSelected=!0):this.createdSelected=!1,this.selectedLabel=e.currentLabel,this.selected=e,void(this.filterable&&(this.query=this.selectedLabel))}let e=[];Array.isArray(this.value)&&this.value.forEach((t=>{e.push(this.getOption(t))})),this.selected=e,this.$nextTick((()=>{this.resetInputHeight()}))},handleFocus(e){this.softFocus?this.softFocus=!1:((this.automaticDropdown||this.filterable)&&(this.visible=!0,this.filterable&&(this.menuVisibleOnFocus=!0)),this.$emit("focus",e))},blur(){this.visible=!1,this.$refs.reference.blur()},handleBlur(e){setTimeout((()=>{this.isSilentBlur?this.isSilentBlur=!1:this.$emit("blur",e)}),50),this.softFocus=!1},handleClearClick(e){this.deleteSelected(e)},doDestroy(){this.$refs.popper&&this.$refs.popper.doDestroy()},handleClose(){this.visible=!1},toggleLastOptionHitState(e){if(!Array.isArray(this.selected))return;const t=this.selected[this.selected.length-1];return t?!0===e||!1===e?(t.hitState=e,e):(t.hitState=!t.hitState,t.hitState):void 0},deletePrevTag(e){if(e.target.value.length<=0&&!this.toggleLastOptionHitState()){const e=this.value.slice();e.pop(),this.$emit("input",e),this.emitChange(e)}},managePlaceholder(){""!==this.currentPlaceholder&&(this.currentPlaceholder=this.$refs.input.value?"":this.cachedPlaceHolder)},resetInputState(e){8!==e.keyCode&&this.toggleLastOptionHitState(!1),this.inputLength=15*this.$refs.input.value.length+20,this.resetInputHeight()},resetInputHeight(){this.collapseTags&&!this.filterable||this.$nextTick((()=>{if(!this.$refs.reference)return;let e=this.$refs.reference.$el.childNodes,t=[].filter.call(e,(e=>"INPUT"===e.tagName))[0];const i=this.$refs.tags,s=this.initialInputHeight||40;t.style.height=0===this.selected.length?s+"px":Math.max(i?i.clientHeight+(i.clientHeight>s?6:0):0,s)+"px",this.visible&&!1!==this.emptyText&&this.broadcast("ExSelectDropdown","updatePopper")}))},resetHoverIndex(){setTimeout((()=>{this.multiple?this.selected.length>0?this.hoverIndex=Math.min.apply(null,this.selected.map((e=>this.options.indexOf(e)))):this.hoverIndex=-1:this.hoverIndex=this.options.indexOf(this.selected)}),300)},handleOptionSelect(e,t){if(this.searchKey="",this.multiple){const t=(this.value||[]).slice(),i=this.getValueIndex(t,e.value);i>-1?t.splice(i,1):(this.multipleLimit<=0||t.length<this.multipleLimit)&&t.push(e.value),this.$emit("input",t),this.emitChange(t),e.created&&(this.query="",this.handleQueryChange(""),this.inputLength=20),this.filterable&&this.$refs.input.focus()}else this.$emit("input",e.value),this.emitChange(e.value),this.visible=!1;this.isSilentBlur=t,this.setSoftFocus(),this.visible||this.$nextTick((()=>{this.scrollToOption(e)}))},setSoftFocus(){this.softFocus=!0;const e=this.$refs.input||this.$refs.reference;e&&e.focus()},getValueIndex(e=[],t){if("[object object]"===Object.prototype.toString.call(t).toLowerCase()){const i=this.valueKey;let s=-1;return e.some(((e,n)=>r.getValueByPath(e,i)===r.getValueByPath(t,i)&&(s=n,!0))),s}return e.indexOf(t)},toggleMenu(){this.selectDisabled||(this.menuVisibleOnFocus?this.menuVisibleOnFocus=!1:this.visible=!this.visible,this.visible&&(this.$refs.input||this.$refs.reference).focus())},selectOption(){this.visible?this.options[this.hoverIndex]&&this.handleOptionSelect(this.options[this.hoverIndex]):this.toggleMenu()},deleteSelected(e){e.stopPropagation();const t=this.multiple?[]:"";this.$emit("input",t),this.emitChange(t),this.visible=!1,this.$emit("clear")},deleteTag(e,t){let i=this.selected.indexOf(t);if(i>-1&&!this.selectDisabled){const e=this.value.slice();e.splice(i,1),this.$emit("input",e),this.emitChange(e),this.$emit("remove-tag",t.value)}e.stopPropagation()},onInputChange(){this.filterable&&this.query!==this.selectedLabel&&(this.query=this.selectedLabel,this.handleQueryChange(this.query))},onOptionDestroy(e){e>-1&&(this.optionsCount--,this.filteredOptionsCount--,this.options.splice(e,1))},resetInputWidth(){this.inputWidth=this.$refs.reference.$el.getBoundingClientRect().width},handleResize(){this.resetInputWidth(),this.multiple&&this.resetInputHeight()},checkDefaultFirstOption(){this.hoverIndex=-1;let e=!1;for(let t=this.options.length-1;t>=0;t--)if(this.options[t].created){e=!0,this.hoverIndex=t;break}if(!e)for(let e=0;e!==this.options.length;++e){const t=this.options[e];if(this.query){if(!t.disabled&&!t.groupDisabled&&t.visible){this.hoverIndex=e;break}}else if(t.itemSelected){this.hoverIndex=e;break}}},getValueKey(e){return"[object object]"!==Object.prototype.toString.call(e.value).toLowerCase()?e.value:r.getValueByPath(e.value,this.valueKey)},handleSearchInput(e=""){this.searchKey=e,this.setVisibleOpt()},setVisibleOpt(){}},created(){this.options=this.originOptions.map((e=>({...e,currentLabel:e.label,currentValue:e.value}))),this.cachedOptions=[...this.options],this.optionsCount=this.options.length,this.filteredOptionsCount=this.options.length,this.cachedPlaceHolder=this.currentPlaceholder=this.propPlaceholder,this.multiple&&!Array.isArray(this.value)&&this.$emit("input",[]),!this.multiple&&Array.isArray(this.value)&&this.$emit("input",""),this.debouncedOnInputChange=g.default(this.debounce,(()=>{this.onInputChange()})),this.debouncedQueryChange=g.default(this.debounce,(e=>{this.handleQueryChange(e.target.value)})),this.$on("handleOptionClick",this.handleOptionSelect),this.$on("setSelected",this.setSelected)},mounted(){this.multiple&&Array.isArray(this.value)&&this.value.length>0&&(this.currentPlaceholder=""),c.addResizeListener(this.$el,this.handleResize);const e=this.$refs.reference;if(e&&e.$el){const t={medium:36,small:32,mini:28},i=e.$el.querySelector("input");this.initialInputHeight=i.getBoundingClientRect().height||t[this.selectSize]}this.remote&&this.multiple&&this.resetInputHeight(),this.$nextTick((()=>{e&&e.$el&&(this.inputWidth=e.$el.getBoundingClientRect().width)})),this.setSelected()},beforeDestroy(){this.$el&&this.handleResize&&c.removeResizeListener(this.$el,this.handleResize)}};var ve=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:e.handleClose,expression:"handleClose"}],staticClass:"el-select",class:[e.selectSize?"el-select--"+e.selectSize:""],on:{click:function(t){return t.stopPropagation(),e.toggleMenu.apply(null,arguments)}}},[e.multiple?i("div",{ref:"tags",staticClass:"el-select__tags",style:{"max-width":e.inputWidth-32+"px",width:"100%"}},[e.collapseTags&&e.selected.length?i("span",[i("el-tag",{attrs:{closable:!e.selectDisabled,size:e.collapseTagSize,hit:e.selected[0].hitState,type:"info","disable-transitions":""},on:{close:function(t){return e.deleteTag(t,e.selected[0])}}},[i("span",{staticClass:"el-select__tags-text"},[e._v(e._s(e.selected[0].currentLabel))])]),e._v(" "),e.selected.length>1?i("el-tag",{attrs:{closable:!1,size:e.collapseTagSize,type:"info","disable-transitions":""}},[i("span",{staticClass:"el-select__tags-text"},[e._v("+ "+e._s(e.selected.length-1))])]):e._e()],1):e._e(),e._v(" "),e.collapseTags?e._e():i("transition-group",{on:{"after-leave":e.resetInputHeight}},e._l(e.selected,(function(t){return i("el-tag",{key:e.getValueKey(t),attrs:{closable:!e.selectDisabled,size:e.collapseTagSize,hit:t.hitState,type:"info","disable-transitions":""},on:{close:function(i){return e.deleteTag(i,t)}}},[i("span",{staticClass:"el-select__tags-text"},[e._v(e._s(t.currentLabel))])])})),1),e._v(" "),e.filterable?i("input",{directives:[{name:"model",rawName:"v-model",value:e.query,expression:"query"}],ref:"input",staticClass:"el-select__input",class:[e.selectSize?"is-"+e.selectSize:""],style:{"flex-grow":"1",width:e.inputLength/(e.inputWidth-32)+"%","max-width":e.inputWidth-42+"px"},attrs:{type:"text",disabled:e.selectDisabled,autocomplete:e.autoComplete||e.autocomplete},domProps:{value:e.query},on:{focus:e.handleFocus,blur:function(t){e.softFocus=!1},keyup:e.managePlaceholder,keydown:[e.resetInputState,function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.navigateOptions("next"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.navigateOptions("prev"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),e.selectOption.apply(null,arguments))},function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"]))return null;t.stopPropagation(),t.preventDefault(),e.visible=!1},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.deletePrevTag.apply(null,arguments)},function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab"))return null;e.visible=!1}],compositionstart:e.handleComposition,compositionupdate:e.handleComposition,compositionend:e.handleComposition,input:[function(t){t.target.composing||(e.query=t.target.value)},e.debouncedQueryChange]}}):e._e()],1):e._e(),e._v(" "),i("el-input",{ref:"reference",class:{"is-focus":e.visible},attrs:{type:"text",placeholder:e.currentPlaceholder,name:e.name,id:e.id,autocomplete:e.autoComplete||e.autocomplete,size:e.selectSize,disabled:e.selectDisabled,readonly:e.readonly,"validate-event":!1,tabindex:e.multiple&&e.filterable?"-1":null},on:{focus:e.handleFocus,blur:e.handleBlur,input:e.handleSearchInput},nativeOn:{keyup:function(t){return e.debouncedOnInputChange.apply(null,arguments)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.stopPropagation(),t.preventDefault(),e.navigateOptions("next"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.stopPropagation(),t.preventDefault(),e.navigateOptions("prev"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),e.selectOption.apply(null,arguments))},function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"]))return null;t.stopPropagation(),t.preventDefault(),e.visible=!1},function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab"))return null;e.visible=!1}],paste:function(t){return e.debouncedOnInputChange.apply(null,arguments)},mouseenter:function(t){e.inputHovering=!0},mouseleave:function(t){e.inputHovering=!1}},model:{value:e.selectedLabel,callback:function(t){e.selectedLabel=t},expression:"selectedLabel"}},[e.$slots.prefix?i("template",{slot:"prefix"},[e._t("prefix")],2):e._e(),e._v(" "),i("template",{slot:"suffix"},[i("i",{directives:[{name:"show",rawName:"v-show",value:!e.showClose,expression:"!showClose"}],class:["el-select__caret","el-input__icon","el-icon-"+e.iconClass]}),e._v(" "),e.showClose?i("i",{staticClass:"el-select__caret el-input__icon el-icon-circle-close",on:{click:e.handleClearClick}}):e._e()])],2),e._v(" "),i("transition",{attrs:{name:"el-zoom-in-top"},on:{"before-enter":e.handleMenuEnter,"after-leave":e.doDestroy}},[i("ex-select-menu",{directives:[{name:"show",rawName:"v-show",value:e.visible&&!1!==e.emptyText,expression:"visible && emptyText !== false"}],ref:"popper",staticStyle:{height:"204px"},attrs:{"append-to-body":e.popperAppendToBody}},[i("RecycleScroller",{directives:[{name:"show",rawName:"v-show",value:e.options.length>0&&!e.loading,expression:"options.length > 0 && !loading"}],staticClass:"scroller el-select-dropdown__list el-select-dropdown__wrap",attrs:{tag:"ul",items:e.filterNodes,"item-size":32,"key-field":"value",emitUpdate:!0},scopedSlots:e._u([{key:"default",fn:function(t){var s=t.item;return t.index,[e.showNewOption?i("ex-option",{attrs:{value:e.query,created:""}}):e._e(),e._v(" "),i("ex-option",{attrs:{label:s.label,value:s.value}})]}}])}),e._v(" "),e.emptyText&&(!e.allowCreate||e.loading||e.allowCreate&&0===e.options.length)?[e.$slots.empty?e._t("empty"):i("p",{staticClass:"el-select-dropdown__empty"},[e._v("\n "+e._s(e.emptyText)+"\n ")])]:e._e()],2)],1)],1)};ve._withStripped=!0;const me=S({render:ve,staticRenderFns:[]},undefined,fe,"data-v-0662a644",false,undefined,!1,void 0,void 0,void 0);return me.install=function(e){e.component(me.name,me)},me}));