element-gui
Version:
A Component Library for Vue.js.
1 lines • 8.67 kB
JavaScript
module.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i(i.s=72)}({0:function(e,t,i){"use strict";function n(e,t,i,n,s,l,o,r){var a,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=i,c._compiled=!0),n&&(c.functional=!0),l&&(c._scopeId="data-v-"+l),o?(a=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__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=a):s&&(a=r?function(){s.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:s),a)if(c.functional){c._injectStyles=a;var u=c.render;c.render=function(e,t){return a.call(t),u(e,t)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,a):[a]}return{exports:e,options:c}}i.d(t,"a",(function(){return n}))},2:function(e,t){e.exports=require("element-gui/lib/utils/util")},28:function(e,t,i){"use strict";var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i(e.elTag,{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],tag:"component",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(t)}}},[e._t("default",[i("span",{staticClass:"ellipsis-wrapper"},[i("em",{directives:[{name:"ellipsis",rawName:"v-ellipsis"}]},[e._v(e._s(e.currentLabel))])])])],2)};n._withStripped=!0;var s=i(4),l=i.n(s),o=i(2),r=i(9),a="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},c={mixins:[l.a],name:"ElOption",componentName:"ElOption",inject:["select"],directives:{ellipsis:r.a},props:{value:{required:!0},elTag:{type:String,default:"li"},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},data:function(){return{index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}},computed:{isObject:function(){return"[object object]"===Object.prototype.toString.call(this.value).toLowerCase()},currentLabel:function(){return this.label||(this.isObject?"":this.value)},currentValue:function(){return this.value||this.label||""},itemSelected:function(){return this.select.multiple?this.contains(this.select.value,this.value):this.isEqual(this.value,this.select.value)},limitReached:function(){return!!this.select.multiple&&(!this.itemSelected&&(this.select.value||[]).length>=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel:function(){this.created||this.select.remote||this.dispatch("ElSelect","setSelected")},value:function(e,t){var i=this.select,n=i.remote,s=i.valueKey;if(!this.created&&!n){if(s&&"object"===(void 0===e?"undefined":a(e))&&"object"===(void 0===t?"undefined":a(t))&&e[s]===t[s])return;this.dispatch("ElSelect","setSelected")}}},methods:{isEqual:function(e,t){if(this.isObject){var i=this.select.valueKey;return Object(o.getValueByPath)(e,i)===Object(o.getValueByPath)(t,i)}return e===t},contains:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];if(this.isObject){var i=this.select.valueKey;return e&&e.some((function(e){return Object(o.getValueByPath)(e,i)===Object(o.getValueByPath)(t,i)}))}return e&&e.indexOf(t)>-1},handleGroupDisabled:function(e){this.groupDisabled=e},hoverItem:function(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this)),this.select.formateOptionMaxWidth&&(this.$el.title=this.$el.clientWidth<this.$el.scrollWidth?this.currentLabel:"")},selectOptionClick:function(){!0!==this.select.disabled&&!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ElSelect","handleOptionClick",[this,!0])},queryChange:function(e){this.visible=new RegExp(Object(o.escapeRegexpString)(e),"i").test(this.currentLabel)||this.created,this.visible?""===e&&(this.select.filteredOptionsCount=this.select.optionsCount):this.select.filteredOptionsCount--}},created:function(){var e=this;this.select.options.push(this),this.select.cachedOptions.push(this),this.select.optionsCount++,this.select.filteredOptionsCount++,this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled),this.$once("hook:beforeDestroy",(function(){e.$off("queryChange",e.queryChange),e.$off("handleGroupDisabled",e.handleGroupDisabled)}))},beforeDestroy:function(){var e=this.select,t=e.selected,i=e.multiple?t:[t],n=this.select.cachedOptions.indexOf(this),s=i.indexOf(this);n>-1&&s<0&&this.select.cachedOptions.splice(n,1),this.select.onOptionDestroy(this.select.options.indexOf(this))}},u=i(0),p=Object(u.a)(c,n,[],!1,null,null,null);t.a=p.exports},34:function(e,t){e.exports=require("element-gui/lib/virtual")},4:function(e,t){e.exports=require("element-gui/lib/mixins/emitter")},72:function(e,t,i){"use strict";i.r(t);var n=function(){var e=this.$createElement,t=this._self._c||e;return t("el-scrollbar",{ref:"scrollbar",attrs:{"wrap-class":"el-select-dropdown__wrap","view-class":"el-select-dropdown__list is-virtual"},on:{doScroll:this.scroll}},[t("el-virtual",{ref:"virtualContainer",staticClass:"el-select-virtual",attrs:{"wrap-class":"el-select-virtual-group","item-class":"el-select-virtual-item","data-key":this.props.value,"data-sources":this.optionsCopy,"data-component":this.itemComponent,keeps:15,"estimate-size":this.size,"extra-props":{props:this.props}}})],1)};n._withStripped=!0;var s=i(4),l=i.n(s),o=i(34),r=i.n(o),a=function(){var e=this,t=e.$createElement;return(e._self._c||t)("el-option",{key:e.index,attrs:{"el-tag":"div",label:e.source[e.props.label],value:e.source[e.props.value],disabled:e.source[e.props.disabled],closable:e.source[e.props.closable]}})};a._withStripped=!0;var c={name:"ElOptionVirtualItem",componentName:"ElOptionVirtualItem",components:{ElOption:i(28).a},props:{index:{type:Number},source:{type:Object,default:function(){return{}}},props:{type:Object,default:function(){return{label:"label",value:"value",disabled:"disabled",closable:"closable"}}}}},u=i(0),p=Object(u.a)(c,a,[],!1,null,null,null).exports,d=i(2),h={medium:32,small:30,mini:28},f={name:"ElOptionVirtual",componentName:"ElOptionVirtual",components:{ElVirtual:r.a,ElOptionVirtualItem:p},inject:["select"],mixins:[l.a],props:{options:{type:Array,default:function(){return[]}},props:{type:Object,default:function(){return{label:"label",value:"value",disabled:"disabled",closable:"closable"}}}},data:function(){return{itemComponent:p,optionsCopy:[]}},computed:{size:function(){return h[this.select.selectSize]||34}},created:function(){this.optionsCopy=Object(d.deepClone)(this.options),this.$on("queryVirtualChange",this.queryVirtualChange),this.$on("init",this.init)},watch:{},methods:{init:function(){this.$refs.virtualContainer.reset()},scroll:function(e){this.$refs.virtualContainer.virtual.handleScroll(e.event.target.scrollTop)},scrollUpdate:function(){var e=this;this.$nextTick((function(){e.$refs.scrollbar.update()}))},queryVirtualChange:function(e){var t=this;this.optionsCopy=this.options.filter((function(i){return-1!==i[t.props.label].indexOf(e)})),this.scrollUpdate()}}},b=Object(u.a)(f,n,[],!1,null,null,null).exports;b.install=function(e){e.component(b.name,b)};t.default=b},9:function(e,t,i){"use strict";var n=i(2);t.a={inserted:function(e,t){e.onmouseover=function(){var t=e.offsetWidth;Object(n.isIE)()&&(e.parentNode.style.textOverflow="clip",t=e.offsetWidth,e.parentNode.style.textOverflow="ellipsis"),e.parentNode.offsetWidth<t&&(e.title=e.innerHTML.replace(/<[^>]*>/g,""))},e.onmouseout=function(){e.title&&e.removeAttribute("title")}}}}});