react-miniui
Version:
A mini react UI library
5 lines • 33.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports["react-miniui"]=t(require("react"),require("react-dom")):e["react-miniui"]=t(e.react,e["react-dom"])}(window,function(n,r){return a={},o.m=i=[function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t,n){"use strict";n.r(t),n.d(t,"Button",function(){return r}),n.d(t,"ButtonGroup",function(){return o}),n.d(t,"Input",function(){return c}),n.d(t,"Textarea",function(){return u}),n.d(t,"FormGroup",function(){return s}),n.d(t,"Icon",function(){return d}),n.d(t,"Badge",function(){return g}),n.d(t,"Row",function(){return j}),n.d(t,"Flex",function(){return k}),n.d(t,"Col",function(){return E}),n.d(t,"Dropdown",function(){return A}),n.d(t,"Menu",function(){return B}),n.d(t,"Item",function(){return H}),n.d(t,"Select",function(){return I}),n.d(t,"Option",function(){return z}),n.d(t,"OverlayTrigger",function(){return Q}),n.d(t,"Popovers",function(){return X}),n.d(t,"Tooltip",function(){return X}),n.d(t,"Modal",function(){return le}),n.d(t,"ActiveModal",function(){return pe}),n.d(t,"showModal",function(){return se}),n.d(t,"closeModal",function(){return fe}),n.d(t,"Alert",function(){return he}),n.d(t,"Confirm",function(){return de}),n.d(t,"Tabs",function(){return Oe}),n.d(t,"Tab",function(){return we}),n.d(t,"openSheet",function(){return Me}),n.d(t,"Miniui",function(){return Ke});var h=n(0),l=n.n(h);function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}var d=l.a.forwardRef(function(e,t){var n=[],r=e.icon,o=e.className,e=a(e,["icon","className"]);return n.push(r),o&&n.push(o),l.a.createElement("i",i({ref:t,className:n.join(" ")},e))});function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function y(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}var r=h.forwardRef(function(e,t){var n=["button"],r=e.color,o=e.type,i=e.size,a=e.block,c=e.icon,l=e.loading,u=e.space,s=e.className,f=y(e,["color","type","size","block","icon","loading","space","className"]),p=e.disabled;r&&n.push(r),o&&n.push(o),i&&n.push(i),u&&n.push(u),a&&n.push("button-block"),c&&n.push("label"),l&&n.push("loading"),p&&n.push("disabled");c=c?h.createElement(d,{icon:c}):null;return s&&n.push(s),e.href?h.createElement("a",m({ref:t,className:n.join(" ")},f),c,e.children):h.createElement("button",m({ref:t,className:n.join(" ")},f),c,e.children)}),o=function(e){var t=["button-group"],n=e.className,r=y(e,["className"]);return n&&t.push(n),h.createElement("div",m({className:t.join(" ")},r),e.children)};function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function p(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}var c=function(e){var t,n=["input"],r=[],o=e.color,i=e.block,a=e.size,c=e.addonAfter,l=e.addonBefore,u=e.className,s=p(e,["color","block","size","addonAfter","addonBefore","className"]),e=e.disabled;return o&&n.push(o),a&&n.push(a),e&&n.push("disabled"),u&&n.push(u),l||c?(l&&(r.push("input-prepend"),t=l),c&&(t=c,r.push("input-append")),i&&r.push("input-block"),h.createElement("label",{className:r.join(" ")},h.createElement("input",f({className:n.join(" ")},s)),h.createElement("span",{className:"add-on"},t))):(i&&n.push("input-block"),h.createElement("input",f({className:n.join(" ")},s)))},u=function(e){var t=["textarea"],n=e.color,r=e.block,o=p(e,["color","block"]),e=e.disabled;return n&&t.push(n),e&&t.push("disabled"),r&&t.push("input-block"),h.createElement("textarea",f({className:t.join(" ")},o))},s=function(e){var t=["form-group"],n=e.className,r=p(e,["className"]);return n&&t.push(n),h.createElement("div",f({className:t.join(" ")},r),e.children)};function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}var g=function(e){var t=["badge"],n=e.color,r=e.space,o=e.className,i=b(e,["color","space","className"]);return t.push(n),r&&t.push(r),o&&t.push(o),l.a.createElement("span",v({className:t.join(" ")},i),e.children)};function O(){return(O=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function w(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}var E=function(e){var t=[],n=e.span,r=e.grid,o=e.offset,i=e.flex,a=e.className,c=w(e,["span","grid","offset","flex","className"]);return n&&(t.push("col-span".concat(n)),o&&t.push("offset-span".concat(o))),r&&(t.push("col-grid".concat(r)),r&&t.push("offset-grid".concat(o))),i&&t.push("flex".concat(i)),a&&t.push(a),l.a.createElement("div",O({className:t.join(" ")},c),e.children)},j=function(e){var t=["row"],n=e.className,r=w(e,["className"]);return n&&t.push(n),l.a.createElement("div",O({className:t.join(" ")},r),e.children)},k=function(e){var t=[],n=e.className,r=w(e,["className"]);return n&&t.push(n),l.a.createElement("div",O({className:t.join(" ")},r),e.children)};function N(e){return(N="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})(e)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function P(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=M(n);return e=r?(e=M(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==N(e)&&"function"!=typeof e?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}
/*!
* 下拉菜单对象基类,所有下单菜单组件继承此类
* @type {Object}
*/var A=function(){T(r,h["Component"]);var n=L(r);function r(e){var t;return R(this,r),(t=n.call(this,e)).state={opend:!1,value:void 0===e.value?"":e.value,text:void 0===e.text?"":e.text},t}return x(r,[{key:"mouseupCallback",value:function(){this.hide()}},{key:"handleClick",value:function(){this.state.opend?this.hide():this.show()}},{key:"show",value:function(){document.addEventListener("mouseup",this.mouseupCallback.bind(this),!1),this.setState({opend:!0})}},{key:"hide",value:function(){document.removeEventListener("mouseup",this.mouseupCallback),this.setState({opend:!1})}},{key:"mouseupEvent",value:function(e){e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()}},{key:"selectEvent",value:function(e){var t=e.target;if(t instanceof HTMLElement){for(var n,r=t;!r.matches||!r.matches(".item");){if(r===e.currentTarget)return!1;if(!r.parentNode)return!1;r=r.parentNode}r&&r instanceof HTMLElement&&(n=r.getAttribute("data-value")||"",t=r.innerText,this.setState({value:n,text:t}),this.props.onChange&&this.props.onChange(n,t))}this.hide()}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.children,r=e.isSelect,o=this.state,i=o.opend,a=o.value,e=o.text,o=["dropdown"];t&&o.push(t),r&&o.push("dropdown-select");r=r?h.createElement("div",{className:"dropdown-header"},e,h.createElement(d,{icon:"fa-down-dir"})):h.createElement("div",{className:"dropdown-header"},this.props.text,h.createElement(d,{icon:"fa-down-dir"})),e=n;return 1<h.Children.count(n)&&(e=(r=h.Children.toArray(this.props.children)).pop()),h.createElement("div",{className:o.join(" "),onMouseUp:this.mouseupEvent.bind(this)},h.createElement("input",{type:"hidden",name:this.props.name,value:a}),h.createElement("div",{className:"dropdown-toggler",onClick:this.handleClick.bind(this)},r),h.createElement("div",{className:"dropdown-main ".concat(i?"visible":""),onClick:this.selectEvent.bind(this)},e))}}]),r}(),B=function(){T(n,h["Component"]);var t=L(n);function n(){var e;return R(this,n),(e=t.call(this)).state={searchValue:""},e}return x(n,[{key:"handleChange",value:function(e){e=e.target.value;this.setState({searchValue:e})}},{key:"render",value:function(){var e=["menu"],t=this.props,n=t.className,r=t.dropArrow,o=t.search,t=h.Children.toArray(this.props.children);n&&e.push(n),r&&e.push("drop-arrow");var i=new RegExp(this.state.searchValue);return h.createElement("div",{className:e.join(" ")},o&&h.createElement("div",{className:"dropdown-search"},h.createElement("label",{className:"input-append input-block"},h.createElement("input",{className:"input",type:"text",onChange:this.handleChange.bind(this),value:this.state.searchValue,placeholder:"serach"}),h.createElement("span",{className:"add-on"},h.createElement("i",{className:"fa-search"})))),o?t.filter(function(e){return i.test(e.props.value)}):t)}}]),n}(),H=function(e){var t=["item"],n=e.className,r=e.disabled,o=e.value,i=P(e,["className","disabled","value"]);return n&&t.push(n),r&&t.push("disabled"),e.href?h.createElement("a",S({className:t.join(" "),"data-value":o},i),e.children):h.createElement("div",S({className:t.join(" "),"data-value":o},i),e.children)},z=function(){T(t,h["Component"]);var e=L(t);function t(){return R(this,t),e.apply(this,arguments)}return x(t,[{key:"render",value:function(){var e=["item"],t=this.props,n=t.className,r=t.disabled,o=t.value,t=P(t,["className","disabled","value"]);return n&&e.push(n),r&&e.push("disabled"),h.createElement("div",S({className:e.join(" "),"data-value":o},t),this.props.children)}}]),t}(),I=function(){T(t,h["Component"]);var e=L(t);function t(){return R(this,t),e.apply(this,arguments)}return x(t,[{key:"render",value:function(){var e=h.Children.toArray(this.props.children),t=this.props,n=t.name,r=t.search,t=t.value,o=void 0===t?e[0]&&e[0].props.value:t,e=e.find(function(e){return e.props.value===o}),e=e?e.props.children:"";return h.createElement(A,{isSelect:!0,value:o,text:e,name:n},h.createElement(B,{search:r||!1},this.props.children))}}]),t}(),t=n(1),V=n.n(t);function D(e){return(D="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})(e)}function K(){return(K=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function U(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}function W(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=Y(n);return e=r?(e=Y(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==D(e)&&"function"!=typeof e?G(t):e}}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(o,h["Component"]);var e,t,n,r=q(o);function o(){var a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),J(G(a=r.call(this)),"trigger",void 0),J(G(a),"overlayer",void 0),J(G(a),"getScrollTop",function(){return document.documentElement?document.documentElement.scrollTop:0}),J(G(a),"getTriggerAttr",function(e){return{width:e.offsetWidth,height:e.offsetHeight,offsetTop:a.getOffsetTop(e)-a.getScrollTop(),offsetLeft:a.getOffsetLeft(e)}}),J(G(a),"getOverlayerAttr",function(e){return{width:e.offsetWidth,height:e.offsetHeight,offsetTop:a.getOffsetTop(e),offsetLeft:a.getOffsetLeft(e)}}),J(G(a),"getScreenArea",function(){return{scrollTop:a.getScrollTop(),height:window.screen.availHeight,width:window.screen.availWidth}}),J(G(a),"getDirection",function(e,t,n){var r=a.props.position;if(r)return r;var o=e.offsetLeft>t.width,i=e.offsetTop>t.height,r=n.width-e.offsetLeft-e.width>t.width,t=n.height-e.offsetTop-e.height>t.height;return o&&i&&r?"top":o&&t&&r?"bottom":o&&t&&i||r&&t&&i?"left":"top"}),J(G(a),"getPosition",function(){var e=a.trigger.current,t=a.overlayer.current;if(e instanceof HTMLElement&&t instanceof HTMLDivElement){var n=a.getTriggerAttr(e),r=a.getOverlayerAttr(t),t=a.getScreenArea(),o=a.getDirection(n,r,t);switch(o){case"top":return{direction:o,top:n.offsetTop-(r.height+8),left:n.offsetLeft+n.width/2-r.width/2};case"bottom":return{direction:o,top:n.offsetTop+n.height+8,left:n.offsetLeft+n.width/2-r.width/2};case"right":return{direction:o,top:n.offsetTop+n.height/2-r.height/2,left:n.offsetLeft+n.width+8};case"left":return{direction:o,top:n.offsetTop+n.height/2-r.height/2-2,left:n.offsetLeft-r.width-8}}}return{direction:"top",top:0,left:0}}),a.state={isVisible:!1,classNames:[]},a.trigger=l.a.createRef(),a.overlayer=l.a.createRef(),a}return e=o,(t=[{key:"getOffsetTop",value:function(e){for(var t=e.offsetTop,n=e.offsetParent;null!=n;)t+=n.offsetTop,n=n.offsetParent;return t}},{key:"getOffsetLeft",value:function(e){for(var t=e.offsetLeft,n=e.offsetParent;null!=n;)t+=n.offsetLeft,n=n.offsetParent;return t}},{key:"handleMouseOver",value:function(){var e=this;this.setState({isVisible:!0},function(){e.show()})}},{key:"handleMouseOut",value:function(){this.setState({isVisible:!1})}},{key:"handleClick",value:function(){var e=this;this.state.isVisible?this.setState({isVisible:!1}):this.setState({isVisible:!0},function(){e.show()})}},{key:"show",value:function(){var e=this.overlayer.current,t=this.getPosition();e instanceof HTMLElement&&(e.style.top="".concat(t.top,"px"),e.style.left="".concat(t.left,"px"),e.classList.add(t.direction),e.classList.add("visible"))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.overlay,r=e.trigger,e=this.state.isVisible,t=l.a.Children.only(t);return l.a.createElement(l.a.Fragment,null,"click"===r?Object(h.cloneElement)(t,{ref:this.trigger,onClick:this.handleClick.bind(this)}):Object(h.cloneElement)(t,{ref:this.trigger,onMouseOver:this.handleMouseOver.bind(this),onMouseOut:this.handleMouseOut.bind(this)}),e&&Object(h.cloneElement)(n,{ref:this.overlayer}))}}])&&W(e.prototype,t),n&&W(e,n),o}(),X=l.a.forwardRef(function(e,t){var n=["popovers"],r=e.className,o=e.color,i=e.title,a=e.children,e=U(e,["className","color","title","children"]);r&&n.push(r),o&&n.push("pop-".concat(o));i=l.a.createElement("div",K({className:n.join(" ")},e,{ref:t}),i&&l.a.createElement("h3",{className:"pop-title"},i),a),a=document.body;return a instanceof HTMLBodyElement?V.a.createPortal(i,a):i});function Z(e){return(Z="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})(e)}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),e}function ne(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&re(e,t)}function re(e,t){return(re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function oe(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=ae(n);return e=r?(e=ae(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==Z(e)&&"function"!=typeof e?ie(t):e}}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=function(){ne(i,h["Component"]);var o=oe(i);function i(){var e;$(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ce(ie(e=o.call.apply(o,[this].concat(n))),"state",{style:{marginLeft:0,marginTop:0,left:0,top:0}}),ce(ie(e),"modalRef",h.createRef()),e}return te(i,[{key:"componentDidMount",value:function(){var e,t,n,r=this.modalRef&&this.modalRef.current;r&&(e=r.offsetWidth,t=r.offsetHeight,n=window.innerHeight,r=window.pageYOffset,this.setState({style:{marginLeft:-e/2+"px",marginTop:-(n-60<t?n-60:t)/2+r+"px",left:"50%",top:"50%"}}))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.size,r=e.children,o=this.state.style,e=["modal"];return n&&e.push(n),t&&e.push(t),h.createElement(h.Fragment,null,h.createElement("div",{className:"dimmer",id:"modalDimmer",onClick:fe}),h.createElement("div",{className:e.join(" "),id:"modal",ref:this.modalRef,style:o},h.createElement("span",{className:"modal-close",onClick:fe},"×"),r))}}],[{key:"Title",value:function(e){return h.createElement("div",{className:"modal-header"},e.children)}},{key:"Content",value:function(e){return h.createElement("div",{className:"modal-content"},e.children)}},{key:"Actions",value:function(e){return h.createElement("div",{className:"modal-actions"},e.children)}}]),i}(),ue=null;function se(e){if(!ue)throw new Error("Not active modal manager, Please add <Miniui /> component to root component. http://mui.alvinhtml.com/modal");ue.setState({modal:e})}function fe(){if(!ue)throw new Error("Not active modal manager, Please add <Miniui /> component to root component. http://mui.alvinhtml.com/modal");var e=ue.modalRef.current,t=e&&e.children[1];e&&t&&(e.classList.add("hidden"),t.addEventListener("webkitAnimationEnd",ue.animationEndUnmount.bind(ue)),t.addEventListener("animationend",ue.animationEndUnmount.bind(ue)))}var pe=function(){ne(i,h["Component"]);var o=oe(i);function i(){var e;$(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ce(ie(e=o.call.apply(o,[this].concat(n))),"state",{modal:null}),ce(ie(e),"modalRef",h.createRef()),e}return te(i,[{key:"componentDidMount",value:function(){ue=this}},{key:"componentWillUnmount",value:function(){ue=null}},{key:"animationEndUnmount",value:function(){this.setState({modal:null})}},{key:"render",value:function(){var e=this.state.modal;if(!e)return null;var t=document.body;return t instanceof HTMLBodyElement?V.a.createPortal(h.createElement("div",{className:"modal-wrapper",ref:this.modalRef},e),t):e}}]),i}(),he=function(e){se(h.createElement(le,null,h.createElement(le.Title,null,"提示信息"),h.createElement(le.Content,null,e),h.createElement(le.Actions,null,h.createElement(r,{onClick:fe},"关闭"))))},de=function(e,t){se(h.createElement(le,null,h.createElement(le.Title,null,"提示信息"),h.createElement(le.Content,null,e),h.createElement(le.Actions,null,h.createElement(r,{onClick:fe},"取消"),h.createElement(r,{color:"green",onClick:function(){t&&t(),fe()}},"确认"))))};function me(e){return(me="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})(e)}function ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function be(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=ge(n);return e=r?(e=ge(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==me(e)&&"function"!=typeof e?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Oe=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(o,l.a.Component);var e,t,n,r=be(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),t=r.call(this,e),console.log("React.Children",l.a.Children,e.children),t.state={activeKey:e.defaultActiveKey||(Array.isArray(e.children)?e.children[0]:e.children).props.eventKey},t}return e=o,(t=[{key:"handleClick",value:function(e){this.setState({activeKey:e})}},{key:"render",value:function(){var n=this,e=this.props.className,r=this.state.activeKey,t=["mui-tabs"];return e&&t.push(e),l.a.createElement("div",{className:t.join(" ")},l.a.createElement("ul",{className:"tabs-nav"},l.a.Children.map(this.props.children,function(e,t){e=e.props;return l.a.createElement("li",{className:r===e.eventKey?"active":"",key:e.eventKey,onClick:n.handleClick.bind(n,e.eventKey)},e.title)})),l.a.createElement("div",{className:"tabs-body"},l.a.Children.map(this.props.children,function(e,t){e=e.props;return r===e.eventKey&&e.children})))}}])&&ye(e.prototype,t),n&&ye(e,n),o}(),we=function(e){return l.a.createElement("div",null,(void 0).props.children)};function Ee(e){return(Ee="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})(e)}function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ne(e,t,n){return t&&ke(e.prototype,t),n&&ke(e,n),e}function Se(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pe(e,t)}function Pe(e,t){return(Pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Re(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=xe(n);return e=r?(e=xe(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==Ee(e)&&"function"!=typeof e?Ce(t):e}}function Ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _e=function(){Se(i,h["Component"]);var o=Re(i);function i(){var e;je(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Te(Ce(e=o.call.apply(o,[this].concat(n))),"state",{style:{}}),Te(Ce(e),"sheetRef",h.createRef()),e}return Ne(i,[{key:"componentDidMount",value:function(){var e=this.props.direction,t=this.sheetRef&&this.sheetRef.current;t&&(t.getBoundingClientRect(),"rtl"===e&&this.setState({style:{right:0}}),"ltr"===e&&this.setState({style:{left:0}}),"btt"===e&&this.setState({style:{bottom:0}}),"ttb"===e&&this.setState({style:{top:0}}))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.size,r=void 0===n?"medium":n,t=e.children,n=e.direction,n=void 0===n?"rtl":n,e=(e.title,this.state.style);console.log("size",r);n=["sheet",r,n];return h.createElement(h.Fragment,null,h.createElement("div",{className:"dimmer",id:"sheetDimmer",onClick:Ae}),h.createElement("div",{className:n.join(" "),id:"sheet",ref:this.sheetRef,style:e},h.createElement("span",{className:"sheet-close",onClick:Ae},"×"),t))}}],[{key:"Title",value:function(e){return h.createElement("div",{className:"sheet-header"},e.children)}},{key:"Content",value:function(e){return h.createElement("div",{className:"sheet-content"},e.children)}}]),i}(),Le=null;function Me(e,t,n){if(!Le)throw new Error("Not active sheet manager, Please add <Miniui /> component to root component. http://mui.alvinhtml.com/sheet");console.log("typeof ",Ee(t)),console.log("title, sheet, direction",e,t,void 0);var r=n.direction,n=n.size;Le.setState({title:e,sheet:t,direction:void 0===r?"rtl":r,size:void 0===n?"medium":n})}function Ae(){if(!Le)throw new Error("Not active sheet manager, Please add <Miniui /> component to root component. http://mui.alvinhtml.com/sheet");var e=Le.sheetRef.current,t=e&&e.children[1];console.log("sheetWarpper",Le.sheetRef),console.log("sheetElement",t),e&&t&&(e.classList.add("hidden"),t.addEventListener("webkitAnimationEnd",Le.animationEndUnmount.bind(Le)),t.addEventListener("animationend",Le.animationEndUnmount.bind(Le)))}var Be=function(){Se(i,h["Component"]);var o=Re(i);function i(){var e;je(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Te(Ce(e=o.call.apply(o,[this].concat(n))),"state",{sheet:null,title:"Sheet",direction:"rtl",size:"medium"}),Te(Ce(e),"sheetRef",h.createRef()),e}return Ne(i,[{key:"componentDidMount",value:function(){Le=this}},{key:"componentWillUnmount",value:function(){Le=null}},{key:"animationEndUnmount",value:function(){this.setState({sheet:null})}},{key:"render",value:function(){var e=this.state,t=e.sheet,n=e.title,r=e.direction,o=e.size;if(!t)return null;e=document.body;return console.log("sheet",t),e instanceof HTMLBodyElement?V.a.createPortal(h.createElement("div",{className:"sheet-wrapper ".concat(r),ref:this.sheetRef},t&&h.createElement(_e,{title:n,direction:r,size:o},h.createElement(_e.Title,null,n),h.createElement(_e.Content,null,t))),e):t}}]),i}();function He(e){return(He="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})(e)}function ze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ie(e,t){return(Ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ve(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t=De(n);return e=r?(e=De(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),t=this,!(e=e)||"object"!==He(e)&&"function"!=typeof e?function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}}function De(e){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ke=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ie(e,t)}(o,h["Component"]);var e,t,n,r=Ve(o);function o(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.apply(this,arguments)}return e=o,(t=[{key:"render",value:function(){return h.createElement("div",null,h.createElement(pe,null),h.createElement(Be,null))}}])&&ze(e.prototype,t),n&&ze(e,n),o}()}],o.c=a,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2);function o(e){if(a[e])return a[e].exports;var t=a[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var i,a});