element-gui
Version:
A Component Library for Vue.js.
1 lines • 5.05 kB
JavaScript
module.exports=function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=89)}({0:function(t,e,i){"use strict";function o(t,e,i,o,n,s,f,r){var l,h="function"==typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=i,h._compiled=!0),o&&(h.functional=!0),s&&(h._scopeId="data-v-"+s),f?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(f)},h._ssrRegister=l):n&&(l=r?function(){n.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(h.functional){h._injectStyles=l;var a=h.render;h.render=function(t,e){return l.call(e),a(t,e)}}else{var c=h.beforeCreate;h.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:h}}i.d(e,"a",(function(){return o}))},3:function(t,e){t.exports=require("element-gui/lib/utils/dom")},89:function(t,e,i){"use strict";i.r(e);var o=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{style:this.wrapStyle},[e("div",{ref:"affix",class:{"el-affix":this.affixed},style:this.styles},[this._t("default")],2)])};o._withStripped=!0;var n=i(3);function s(t,e){if("undefined"==typeof window)return 0;var i=e?"scrollTop":"scrollLeft",o=t===window,n=o?t[e?"pageYOffset":"pageXOffset"]:t[i];return o&&"number"!=typeof n&&(n=window.document.documentElement[i]),n}var f={name:"ElAffix",props:{offsetTop:{type:Number,default:0},offsetBottom:{type:Number},target:{type:Function,default:function(){return window}}},data:function(){return{affixed:!1,wrapStyle:{},slot:!1,styles:{}}},methods:{getTargetRect:function(t){return t===window?{top:0,bottom:0,left:0}:t.getBoundingClientRect()},getOffset:function(t,e){var i=t.getBoundingClientRect(),o=this.getTargetRect(e),n=s(this.el,!0),f=s(this.el,!1),r=window.document.body,l=r.clientTop||0,h=r.clientLeft||0;return{top:i.top-o.top+n-l,left:i.left-o.left+f-h,width:i.width,height:i.height}},handleScroll:function(){var t=this.affixed,e=s(this.el,!0),i=this.getOffset(this.$el,this.el),o=(this.$refs.affix.offsetWidth,this.$refs.affix.offsetHeight),n=this.getTargetRect(this.el),f=this.el.innerHeight||this.el.clientHeight;if(i.top-this.offsetTop<e&&"top"===this.offsetType&&!t?(this.affixed=!0,this.wrapStyle={width:i.width+"px",height:o+"px"},this.styles={top:this.offsetTop+n.top+"px",left:i.left+n.left+"px",width:i.width+"px"},this.$emit("change",!0)):i.top-this.offsetTop>e&&"top"===this.offsetType&&t&&(this.wrapStyle={},this.affixed=!1,this.styles=null,this.$emit("change",!1)),i.top+this.offsetBottom+o>e+f&&"bottom"===this.offsetType&&!t){this.affixed=!0;var r=this.el===window?0:window.innerHeight-n.bottom;this.wrapStyle={width:i.width+"px",height:i.height+"px"},this.styles={bottom:r+this.offsetBottom+"px",left:i.left+n.left+"px",width:i.width+"px"},this.$emit("change",!0)}else i.top+this.offsetBottom+o<e+f&&"bottom"===this.offsetType&&t&&(this.affixed=!1,this.styles=null,this.$emit("change",!1))},handleTargetScroll:function(){var t=this.getTargetRect(this.el),e=this.getOffset(this.$el,this.el),i=window.innerHeight;"top"===this.offsetType&&this.styles?(this.styles.top=t.top+this.offsetTop+"px",this.styles.left=e.left+t.left+"px"):"bottom"===this.offsetType&&this.styles&&(this.styles.bottom=i-t.bottom+this.offsetBottom+"px",this.styles.left=e.left+t.left+"px")}},computed:{offsetType:function(){var t="top";return this.offsetBottom>=0&&(t="bottom"),t},el:function(){return this.target()}},mounted:function(){Object(n.on)(this.el,"scroll",this.handleScroll),Object(n.on)(this.el,"resize",this.handleScroll),this.offsetBottom>=0&&this.handleScroll(),this.el!==window&&(Object(n.on)(window,"scroll",this.handleTargetScroll),Object(n.on)(window,"resize",this.handleTargetScroll))},beforeDestroy:function(){Object(n.off)(this.el,"scroll",this.handleScroll),Object(n.off)(this.el,"resize",this.handleScroll),this.el!==window&&(Object(n.off)(window,"scroll",this.handleTargetScroll),Object(n.off)(window,"resize",this.handleTargetScroll))}},r=i(0),l=Object(r.a)(f,o,[],!1,null,null,null).exports;l.install=function(t){t.component(l.name,l)};e.default=l}});