@zeit-ui/vue
Version:
A popular UI framework for Vue
2 lines • 7.68 kB
JavaScript
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["button"]=e():t["button"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"7ce0":function(t,e,n){},"8a85":function(t,e,n){"use strict";var i=n("fade"),o=n.n(i);e["default"]=o.a},"94c3":function(t,e,n){"use strict";var i=n("cef9"),o=n.n(i);o.a},ba8f:function(t,e,n){"use strict";var i=n("7ce0"),o=n.n(i);o.a},cef9:function(t,e,n){},f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(i){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(i.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fade:function(t,e,n){t.exports={drip:"button-drip_drip_-12JB"}},fb15:function(t,e,n){"use strict";n.r(e);var i={};n.r(i),n.d(i,"enums",(function(){return l})),n.d(i,"isMac",(function(){return f}));var o,r={};(n.r(r),n.d(r,"getRealShape",(function(){return d})),n.d(r,"getRect",(function(){return h})),"undefined"!==typeof window)&&(n("f6fd"),(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=o[1]));var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("button",{staticClass:"zi-btn",class:t.classes,attrs:{tabindex:t.tabindex},on:{click:t.clickHandler,keyup:function(e){if(!e.type.indexOf("key")&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.isFocus=!0},blur:function(e){t.isFocus=!1}}},[t.loading?n("span",{staticClass:"zi-loading-shim"},[n("i"),n("i"),n("i")]):t._e(),n("zi-button-drip",{ref:"drip"}),t.showIcon?n("span",{staticClass:"zi-btn-icon default"},[n(t.icon,{tag:"component"})],1):t._e(),t._t("default"),t.showIconRight?n("span",{staticClass:"zi-btn-icon right"},[n(t.iconRight,{tag:"component"})],1):t._e()],2)},a=[],c=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.show?n("span",{class:t.$style.drip,style:t.styles}):t._e()},u=[],l=function(t){return function(e){return!!Array.isArray(t)&&!!t.find((function(t){return t===e}))}},f=function(){if("undefined"===typeof window||!window.navigator)return!1;var t=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(t)},d=function(t){var e=t.getBoundingClientRect(),n=window.getComputedStyle(t),i=n.width,o=n.height,r=function(t,e){if(!t)return 0;var n=t.includes("px")?+t.split("px")[0]:t.includes("%")?+t.split("%")[0]*e*.01:t;return Number.isNaN(+n)?0:+n};return{width:r("".concat(i),e.width),height:r("".concat(o),e.height)}},h=function(t){return t.getBoundingClientRect()},p=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"expand"},on:{enter:t.enter,"after-enter":t.afterEnter,leave:t.leave}},[t._t("default")],2)},y=[],m={name:"zi-transition-expand",methods:{enter:function(t){var e=d(t),n=e.width;t.style.width="".concat(n,"px"),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";var i=d(t),o=i.height;t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,d(t);var r=setTimeout((function(){t.style.height="".concat(o,"px"),clearTimeout(r)}),0)},afterEnter:function(t){t.style.height="auto"},leave:function(t){var e=d(t),n=e.height;t.style.height="".concat(n,"px"),d(t);var i=setTimeout((function(){t.style.height=0,clearTimeout(i)}),0)},afterLeave:function(t){t.style.height=null}}},g=m;n("ba8f");function b(t,e,n,i,o,r,s,a){var c,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):o&&(c=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}var v=b(g,p,y,!1,null,null,null);v.exports,new Map;function _(t){return _="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}var w={left:"",top:"",opacity:.8,transform:"translate(-50%, -50%)"},x={name:"zi-button-drip",props:["clickEvent"],data:function(){return{show:!1,styles:w}},methods:{trigger:function(t){var e=this;t&&"object"===_(t)&&(t.offsetX||t.offsetY)&&(this.show||(this.show=!0,this.$nextTick((function(){return e.setStyle(t)}))))},setStyle:function(t){var e=this,n=r.getRect(this.$parent.$el),i=n.width,o=n.height,s=Math.max(t.offsetX,i-t.offsetX),a=Math.max(t.offsetY,o-t.offsetY),c=Math.max(s,a),u=c/9;this.styles={left:"".concat(t.offsetX,"px"),top:"".concat(t.offsetY,"px"),opacity:.25,transform:"translate(-50%, -50%) scale(".concat(u,")")};var l=setTimeout((function(){e.reset(),clearTimeout(l)}),400)},reset:function(){this.styles=w,this.show=!1}}},S=x,$=n("8a85");function C(t){this["$style"]=$["default"].locals||$["default"]}var j=b(S,c,u,!1,C,null,null),R=j.exports,T={name:"zi-button",props:{size:{type:String,default:"medium",validator:i.enums(["small","mini","medium","big","huge"])},type:{type:String,validator:i.enums(["primary","success","warning","danger","abort","normal"])},loading:Boolean,disabled:Boolean,shadow:Boolean,circular:Boolean,auto:Boolean,ghost:Boolean,effect:{type:Boolean,default:!0},icon:Object,iconRight:Object},data:function(){return{dripStyles:"",isFocus:!1}},computed:{classes:function(){var t="";return this.loading&&(t+=" loading"),this.disabled&&(t+=" disabled"),this.shadow&&(t+=" shadow"),this.circular&&(t+=" circular"),this.auto&&(t+=" auto"),this.ghost&&(t+=" ghost"),this.type&&(t+=" ".concat(this.type)),this.size&&(t+=" ".concat(this.size)),this.isFocus&&(t+=" tab-selected"),t.trim()},showIcon:function(){return this.icon&&"mini"!==this.size&&!this.loading},showIconRight:function(){return this.iconRight&&"mini"!==this.size&&!this.loading},tabindex:function(){return this.disabled?-1:0}},components:{ZiButtonDrip:R},methods:{clickHandler:function(t){if(!this.loading&&!this.disabled){this.isFocus=!1;var e=!this.shadow&&!this.ghost&&this.effect&&this.$refs.drip;e&&this.$refs.drip.trigger(t),this.$emit("click",t)}}}},z=T,O=(n("94c3"),b(z,s,a,!1,null,null,null)),k=O.exports;k.install=function(t){return t.component(k.name,k)};var B=k;e["default"]=B}})["default"]}));
//# sourceMappingURL=button.umd.min.js.map