m2-ui
Version:
The package is provided web components and utilities based on vue and element-ui.
6 lines • 10.4 kB
JavaScript
/*!
* m2-ui v1.0.0
* (c) 2020 by Miracle He
* Released under the MIT License.
*/
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},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="/dist/",n(n.s=16)}([function(t,e,n){"use strict";function o(t,e,n,o,i,r,a,l){var s,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),o&&(c.functional=!0),r&&(c._scopeId="data-v-"+r),a?(s=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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=s):i&&(s=l?function(){i.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:i),s)if(c.functional){c._injectStyles=s;var u=c.render;c.render=function(t,e){return s.call(e),u(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,s):[s]}return{exports:t,options:c}}n.d(e,"a",(function(){return o}))},function(t,e){t.exports=require("vue")},function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i="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};e.a={hasOwn:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},isListened:function(t,e){return t._events[e]&&"object"===i(t._events[e])},getClientHeight:function(){return document.documentElement.clientHeight},getScrollTop:function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop},setScrollTop:function(t){document.documentElement.scrollTop=document.body.scrollTop=t},getMapItem:function(t,e){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return i.reduce((function(n,i){var r;return o({},n,((r={})[i]=t[e[i]]||t[i],r))}),{})},oneOf:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.some((function(e){return e===t}));return n}}},function(t,e){t.exports=require("m2-core")},function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return r})),n.d(e,"d",(function(){return a}));var o=n(7).default,i=n(12).default,r=n(10).default,a=n(11).default},function(t,e){t.exports=require("deepmerge")},,function(t,e,n){"use strict";n.r(e);var o=n(3);e.default={data:function(){return{contentHeight:"100%",clientHeight:"1000px"}},computed:{contentStyle:function(){return this.contentHeight>0?{height:this.contentHeight+"px"}:{height:this.contentHeight}}},mounted:function(){var t=this;this.$nextTick((function(){return t.initContentHeight()}))},methods:{initContentHeight:function(){this.resizeWindow(),window.addEventListener("resize",this.resizeWindow)},resizeWindow:function(){var t=document.documentElement;this.clientHeight=""+t.clientHeight,o.DataType.isFunction(this.calculateHeight)?this.contentHeight=this.calculateHeight(this.clientHeight):this.contentHeight=this.clientHeight}},destroyed:function(){window.removeEventListener("resize",this.resizeWindow)}}},function(t,e,n){"use strict";n.r(e),e.default={m2:{backtop:"Back Top",loading:"Loading...",modal:{ok:"OK",cancel:"Cancel"},confirm:{title:"Delete Confirmation",message:"This will delete the data permanently, continue?"},toast:"Toast Message",header:{navigation:"Navigation",logoText:"M2 MFE",placeholder:"Search People, Material, Guideline...",feedback:"Suggestion & Feedback",exit:"Exit"},sidebar:{home:"Home Page"},table:{index:"No.",menu:"Action"},queryPanel:{query:"Query",reset:"Reset"}}}},function(t,e,n){"use strict";n.r(e),e.default={m2:{backtop:"返回顶部",loading:"正在努力加载中",modal:{ok:"确定",cancel:"取消"},confirm:{title:"删除提示",message:"此操作将永久删除该数据, 是否继续?"},toast:"提示消息",header:{navigation:"导航",logoText:"M2微前端框架",placeholder:"找人、搜功能、看指引",feedback:"意见反馈",exit:"退出"},sidebar:{home:"返回首页"},table:{index:"序号",menu:"操作"},queryPanel:{query:"查询",reset:"重置"}}}},function(t,e,n){"use strict";n.r(e),e.default={methods:{show:function(){this.$refs.modal&&this.$refs.modal.show()},hide:function(){this.$refs.modal&&this.$refs.modal.hide()}}}},function(t,e,n){"use strict";n.r(e);var o=n(2);e.default={props:{showMenu:{type:Boolean,default:!1},config:{type:Object,default:function(){return{menus:{active:"0",map:{},data:[]}}}}},mounted:function(){this.handleMenuConfig()},data:function(){return{menuList:[],collapseClass:"",activeIndex:""}},watch:{config:{handler:function(t){this.handleMenuConfig()},deep:!0}},methods:{handleMenuConfig:function(){var t=this.config.menus,e=t.active,n=t.map,o=t.data;this.activeIndex=e,this.menuList=this.getMenuList(n,o)},getMenuList:function(t,e){var n=this;return e.map((function(e){var i=o.a.getMapItem(e,t,"key","text","url","level","pid"),r=e[t.children]||e.children;return i.pid===(t.root||"0")&&(i.icon=e.icon?"iconfont el-icon-"+e.icon:"iconfont el-icon-menu",i.title=e.alias||i.text),i.level&&(i.className="m2-menu-item-"+i.level),e.click?i.click=e.click:i.click=function(){},r&&r.length>0?(i.hasChildren=!!r&&r.length>0,i.hasChildren&&(i.slotName="title",i.children=n.getMenuList(t,r))):i.slotName="default",i}))},handleToggleMenu:function(t){this.collapseClass=t?"nav-collapse":""}}}},function(t,e,n){"use strict";n.r(e);var o=n(1),i=n.n(o),r=n(5),a=n.n(r),l=n(3),s=n(2),c="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},u=/(%|)\{([0-9a-zA-Z_]+)\}/g,d=function(){return function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];return 1===n.length&&"object"===c(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(u,(function(e,o,i,r){var a=void 0;return"{"===t[r-1]&&"}"===t[r+e.length]?i:null==(a=s.a.hasOwn(n,i)?n[i]:null)?"":a}))}},f=void 0,h=arguments,m=null,p=!1,g=function(){var t=Object.getPrototypeOf(f||i.a).$t;if("function"==typeof t&&i.a.locale)return p||(p=!0,i.a.locale(i.a.config.lang,a()(m,i.a.locale(i.a.config.lang)||{},{clone:!0}))),t.apply(f,h)},v=function(t,e){var n=l.DataStorage.get(l.DEFAULT_LANGUAGE_SETTING);y(n);var o=g.apply(f,h);if(null!=o)return o;for(var i=t.split("."),r=m,a=0,s=i.length;a<s;a++){if(o=r[i[a]],a===s-1)return d()(o,e);if(!o)return"";r=o}return""},y=function(t){switch(t){case"en":m=n(8).default;break;case"zh":default:m=n(9).default}},b={t:v,use:y,i18n:function(t){return g=t||g}};e.default={methods:{t:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return b.t.apply(this,e)}}}},,,,function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"slide"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.showModal,expression:"showModal"}],staticClass:"m2-modal",class:t.modalClass},[n("div",{staticClass:"mask"}),n("div",{staticClass:"modal-dialog",style:{width:t.modalDialogWidth,"max-height":t.modalHeight}},[n("div",{staticClass:"modal-header"},[t._t("header",[n("span",{staticClass:"title"},[t._v(t._s(t.title))])]),t.showClose?n("span",{staticClass:"close",on:{click:function(e){t.hide("close")}}}):t._e()],2),n("div",{staticClass:"modal-body",style:{"max-height":t.modalBodyHeight}},[t._t("body")],2),t.showFooter?n("div",{staticClass:"modal-footer"},[t._t("footer",[n("div",{staticClass:"btn-group"},[t._t("buttons"),n("a",{staticClass:"btn btn-primary",attrs:{href:"javascript:void(0);"},on:{click:function(e){t.$emit("ok")}}},[t._v(t._s(t.okText||t.t("m2.modal.ok")))]),n("a",{staticClass:"btn",attrs:{href:"javascript:void(0);"},on:{click:function(e){t.hide("cancel")}}},[t._v(t._s(t.cancelText||t.t("m2.modal.cancel")))])],2)])],2):t._e()])])])};o._withStripped=!0;var i=n(2),r={name:"m2-modal",mixins:[n(4).b],props:{title:String,customClass:{type:String,default:""},showOk:{type:Boolean,default:!0},showFooter:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},size:{type:String,default:"md",validator:function(t){return i.a.oneOf(t,["sm","md","lg","xl"],"size")}},scrollable:{type:Boolean,default:!1},width:String,okText:String,cancelText:String},data:function(){return{showModal:!1,modalSizes:[{size:"sm",value:"300px"},{size:"md",value:"600px",default:!0},{size:"lg",value:"900px"},{size:"xl",value:"1200px"}]}},computed:{modalDialogWidth:function(){var t=this;if(this.width){var e=this.width+"";return["%","px","vw","em","rem"].some((function(t){return e.endsWith(t)}))?e:parseFloat(e)+"px"}return(this.modalSizes.find((function(e){return e.size===t.size}))||this.modalSizes.find((function(t){return t.default}))).value},modalBodyHeight:function(){return parseInt(this.modalHeight)-100+"px"},modalHeight:function(){return.9*document.documentElement.clientHeight+"px"},modalClass:function(){return(this.scrollable?"modal-scroll":"")+" "+this.customClass}},methods:{show:function(){this.showModal=!0},hide:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.showModal=!1,this.$emit("reset"),t&&this.$emit(t)}}},a=n(0),l=Object(a.a)(r,o,[],!1,null,null,null);l.options.__file="packages/modal/src/main.vue";var s=l.exports;s.install=function(t){t.component(s.name,s)};e.default=s}]);