@zeit-ui/vue
Version:
A popular UI framework for Vue
2 lines • 7.04 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["dialog"]=e():t["dialog"]=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){},ba8f:function(t,e,n){"use strict";var i=n("7ce0"),o=n.n(i);o.a},c630: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)},fa26:function(t,e,n){"use strict";var i=n("c630"),o=n.n(i);o.a},fb15:function(t,e,n){"use strict";n.r(e);var i,o={};(n.r(o),n.d(o,"lockScroll",(function(){return g})),"undefined"!==typeof window)&&(n("f6fd"),(i=window.document.currentScript)&&(i=i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=i[1]));var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"zi-dialog-backdrop"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!!t.model,expression:"!!model"}],staticClass:"zi-dialog-root"},[n("div",{staticClass:"zi-dialog-backdrop"}),t.closeByModal?n("div",{staticClass:"zi-dialog-backdrop responsive",on:{click:function(e){return e.target!==e.currentTarget?null:t.close(e)}}}):t._e(),n("transition",{attrs:{name:"zi-dialog-slide"}},[t.model?n("div",{staticClass:"zi-dialog-wrapper",style:{width:t.width,minWidth:t.width||""}},[n("div",{staticClass:"zi-dialog-content"},[t.title?n("h2",{staticClass:"header"},[t._v(t._s(t.title))]):t._e(),n("div",{staticClass:"body"},[t._t("default")],2)]),n("div",{staticClass:"zi-dialog-footer"},[n("button",{staticClass:"action",on:{click:function(e){return e.stopPropagation(),t.confirm(!1)}}},[t._v(t._s(t.cancel))]),n("button",{staticClass:"action",on:{click:function(e){return e.stopPropagation(),t.confirm(!0)}}},[t._v(t._s(t.done))])])]):t._e()])],1)])},a=[],l=function(){if("undefined"===typeof window||!window.navigator)return!1;var t=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(t)},c=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)}},s=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)},u=[],d={name:"zi-transition-expand",methods:{enter:function(t){var e=c(t),n=e.width;t.style.width="".concat(n,"px"),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";var i=c(t),o=i.height;t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,c(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=c(t),n=e.height;t.style.height="".concat(n,"px"),c(t);var i=setTimeout((function(){t.style.height=0,clearTimeout(i)}),0)},afterLeave:function(t){t.style.height=null}}},f=d;n("ba8f");function p(t,e,n,i,o,r,a,l){var c,s="function"===typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),i&&(s.functional=!0),r&&(s._scopeId="data-v-"+r),a?(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(a)},s._ssrRegister=c):o&&(c=l?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(s.functional){s._injectStyles=c;var u=s.render;s.render=function(t,e){return c.call(e),u(t,e)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,c):[c]}return{exports:t,options:s}}var h=p(f,s,u,!1,null,null,null),v=(h.exports,new Map),g=function(t){if("undefined"!==typeof document){var e=document.body,n=function(t){var n=getComputedStyle(e)["padding-right"],i=v.get(t);if(!i)return v.set(t,{counter:1,initialOverflow:t.style.overflow,initialRight:n}),t.style.overflow="hidden",void(t.style.paddingRight="calc(".concat(m()," + ").concat(n,")"));v.set(t,{counter:i.counter++,initialOverflow:i.initialOverflow,initialRight:n})},i=function(t){var e=v.get(t);e&&(1===e.counter?(v.delete(t),t.style.overflow=e.initialOverflow,t.style.paddingRight=e.initialRight):v.set(t,{counter:e.counter-1,initialOverflow:e.initialOverflow,initialRight:e.initialRight}))};t?n(e):i(e)}},m=function(){if(l())return"0px";var t=window.getComputedStyle(document.body,"-webkit-scrollbar").width;if("auto"!==t)return t;var e=document.createElement("div"),n="position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll;";e.setAttribute("style",n),document.body.appendChild(e);var i="".concat(e.getBoundingClientRect().width-e.clientWidth,"px");return document.body.removeChild(e),i},y={name:"zi-dialog",data:function(){return{privateModel:!1}},props:{title:String,value:Boolean,width:String,cancel:{type:String,default:"cancel"},done:{type:String,default:"done"},beforeDone:{type:Function,default:function(t){return t()}},closeByModal:{type:Boolean,default:!0}},computed:{model:{get:function(){return void 0===this.value?this.privateModel:this.value},set:function(t){this.privateModel=t,this.$emit("input",t)}}},watch:{value:function(t){this.privateModel=t,o.lockScroll(this.privateModel)}},methods:{confirm:function(t){var e=this;if(t)return this.beforeDone((function(){e.model=!1,e.$emit("done")}));this.model=!1,this.$emit("cancel")},close:function(){this.closeByModal&&this.confirm(!1)}},mounted:function(){this.value&&o.lockScroll(this.value)}},w=y,b=(n("fa26"),p(w,r,a,!1,null,"f60247cc",null)),_=b.exports;_.install=function(t){t.component(_.name,_)};var x=_;e["default"]=x}})["default"]}));
//# sourceMappingURL=dialog.umd.min.js.map