-
Notifications
You must be signed in to change notification settings - Fork 0
/
4371-d9559f9bed671b044df2.js
1 lines (1 loc) · 15.3 KB
/
4371-d9559f9bed671b044df2.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[4371],{82010:(e,t,n)=>{"use strict";n.d(t,{b:()=>p});var o=n(59312),i=n(24246),r=n(60042),s=n.n(r),l=n(27378),a=n(78486),c=n(78513),d=["outline","closed","onClose"],u=["title","description","loading","closable","closed","onClose","closeContent","extraContent"],p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={closed:!1},t.onCloseHandler=function(){t.isControlled||t.setState({closed:!0}),t.props.onClose&&t.props.onClose()},t}return(0,o.ZT)(t,e),Object.defineProperty(t.prototype,"isControlled",{get:function(){return"closed"in this.props},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this.isControlled?this.props.closed:this.state.closed},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e;if(this.closed)return null;var t=(0,c.Z)(this.props,u),n=t.className,r=t.type,l=t.outline,p=(0,o._T)(t,["className","type","outline"]),v=(0,c.Z)(this.props,d),m=s()("zent-alert","zent-alert-style-"+r,n,((e={})["zent-alert-outline"]=l,e));return(0,i.jsx)("div",(0,o.pi)({className:m},p,{"data-zv":"9.12.16"},{children:(0,i.jsx)(a.Z,(0,o.pi)({},v,{onAlertItemClose:this.onCloseHandler},{children:this.props.children}),void 0)}),void 0)},t.highlightClassName="zent-alert-content__highlight",t.defaultProps={type:"info",loading:!1,outline:!1,closable:!1},t}(l.PureComponent)},68715:(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var o=n(59312),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,o.ZT)(t,e),t.prototype.render=function(){return null},t}(n(27378).Component)},83931:(e,t,n)=>{"use strict";n.d(t,{f:()=>f});var o=n(59312),i=n(24246),r=n(27378),s=n(60042),l=n.n(s),a=n(78486),c=n(68715),d=n(65922),u=n(78513);function p(e){var t=r.Children.count(e),n=new Array(t);return r.Children.forEach(e,(function(e,o){n[o]=e,0===o&&(n[t]=e)})),t>1?n:[e]}var v=["loading","scrollInterval","onClose","closed"],m={items:[],renderItems:[],preChildren:null,transitionDuration:0,containerHeight:0,activeIndex:0},f=function(e){function t(t){var n,i,s=e.call(this,t)||this;return s.firstChildHeight=0,s.scrollHandler=function(){var e=s.props.scrollInterval;s.timeoutId=setTimeout((function(){var e=s.state,t=e.renderItems,n=e.activeIndex,o=t.length;if(!(o<=1)){var i=n+1;s.setState({transitionDuration:600,activeIndex:i}),i===o-1&&setTimeout(s.resetChildren,600),s.scrollHandler()}}),e)},s.stopScroll=function(){s.clearTimer()},s.continueScroll=function(){s.scrollHandler()},s.resetChildren=function(){s.setState({transitionDuration:0,activeIndex:0})},s.clearTimer=function(){s.timeoutId&&(clearTimeout(s.timeoutId),s.timeoutId=null)},s.onCloseItemHandler=function(e){var t=s.props.onClose,n=s.state.items;e===n.length&&(e=0,s.resetChildren());var o=n.filter((function(t,n){return e!==n}));0===o.length?null==t||t():1!==o.length&&e!==o.length||s.resetChildren(),s.setState({items:o,renderItems:p(o)})},s.onFirstChildRef=function(e){s.firstChildHeight=(null==e?void 0:e.offsetHeight)||0},s.state=(0,o.pi)((0,o.pi)({},m),(n=t.children,{items:i=r.Children.toArray(n).reduce((function(e,t){var n=t.type;return(0,d.Z)(n,c.C)&&e.push(t),e}),[]),preChildren:n,renderItems:p(i)})),s}return(0,o.ZT)(t,e),t.prototype.componentDidMount=function(){this.setState({containerHeight:this.firstChildHeight},this.scrollHandler)},t.prototype.componentWillUnmount=function(){this.clearTimer()},Object.defineProperty(t.prototype,"renderItem",{get:function(){var e=this,t=this.props,n=(t.outline,t.children,t.onClose,t.className,(0,o._T)(t,["outline","children","onClose","className"])),i=this.state,s=i.renderItems,c=i.activeIndex,d=s.length;return r.Children.map(s,(function(t,i){var s=Object.assign({},n,(0,o.pi)({},t.props));return(0,r.createElement)(a.Z,(0,o.pi)({classItemName:l()({"zent-alert-scroll-active-item":i===c,"zent-alert-scroll-virtual-item":!i&&c===d-1})},s,{key:i,onAlertItemClose:function(){return e.onCloseItemHandler(i)},ref:i?void 0:e.onFirstChildRef}))}))},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e;if(this.props.closed)return null;var t=(0,u.Z)(this.props,v),n=t.className,r=t.outline,s=t.type,a=(0,o._T)(t,["className","outline","type"]),c=this.state,d=c.transitionDuration,p=c.containerHeight,m=c.activeIndex,f=this.renderItem,h=l()("zent-alert-scroll","zent-alert-style-"+s,n,((e={})["zent-alert-scroll-outline"]=r,e));return f.length>0?(0,i.jsx)("div",(0,o.pi)({className:h},a,{"data-zv":"9.12.16"},{children:(0,i.jsx)("div",(0,o.pi)({className:"zent-alert-scroll-container",style:{height:p,transform:"translateY(-"+p*m+"px)",transitionDuration:d+"ms",transitionProperty:"transform"},onMouseEnter:this.stopScroll,onMouseLeave:this.continueScroll,"data-zv":"9.12.16"},{children:f}),void 0)}),void 0):null},t.defaultProps={type:"info",loading:!1,scrollInterval:5e3},t}(r.Component)},78486:(e,t,n)=>{"use strict";var o=n(59312),i=n(24246),r=n(27378),s=n(60042),l=n.n(s),a=n(27036),c=n(20840),d={info:"info-circle",warning:"warning",success:"check-circle",error:"error-circle"},u=(0,r.forwardRef)((function(e,t){var n=e.extraContent,s=e.classItemName,u=e.title,p=e.description,v=e.children,m=e.loading,f=e.type,h=e.closable,C=e.closeContent,g=e.onAlertItemClose,y=(0,r.useRef)(e);y.current=e;var x=(0,r.useMemo)((function(){return v||(0,i.jsxs)(i.Fragment,{children:[u&&(0,i.jsx)("h3",(0,o.pi)({className:"zent-alert-item-content__title","data-zv":"9.12.16"},{children:u}),void 0),p&&(0,i.jsx)("p",(0,o.pi)({className:"zent-alert-item-content__description","data-zv":"9.12.16"},{children:p}),void 0)]},void 0)}),[v,p,u]),z=(0,r.useMemo)((function(){var e=y.current.onClose;return h?(0,i.jsx)("div",(0,o.pi)({className:"zent-alert-item-close-wrapper",onClick:function(t){null==e||e(),g&&g(),t.stopPropagation()},"data-zv":"9.12.16"},{children:null!=C?C:(0,i.jsx)(a.Z,{type:"close",className:"zent-alert-item-close-btn"},void 0)}),void 0):null}),[h,C,g]),b=(0,r.useMemo)((function(){return m?(0,i.jsx)(c.Z,{className:"zent-alert-item-icon",loading:!0,icon:"circle",iconSize:16},void 0):f in d?(0,i.jsx)(a.Z,{className:"zent-alert-item-icon",type:d[f]},void 0):null}),[m,f]);return(0,i.jsxs)("div",(0,o.pi)({className:l()("zent-alert-item",s),ref:t,"data-zv":"9.12.16"},{children:[b,(0,i.jsx)("div",(0,o.pi)({className:"zent-alert-item-content","data-zv":"9.12.16"},{children:x}),void 0),n&&(0,i.jsx)("div",(0,o.pi)({className:"zent-alert-item-extra-content","data-zv":"9.12.16"},{children:n}),void 0),z]}),void 0)}));u.displayName="AlertItem",t.Z=u},97701:(e,t,n)=>{"use strict";n.d(t,{V:()=>Z,Z:()=>I});var o=n(59312),i=n(24246),r=n(27378),s=n(14623),l=n(53552),a=n(79352),c=n(60042),d=n.n(c),u=n(58801),p=n(27036),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dialogEl=null,t.onClickClose=function(e){var n=t.props.onClose;n&&n(e)},t}return(0,o.ZT)(t,e),t.prototype.componentDidMount=function(){this.resetTransformOrigin()},t.prototype.componentDidUpdate=function(){this.resetTransformOrigin()},t.prototype.setTransformOrigin=function(e,t){["Webkit","Moz","Ms","ms"].forEach((function(n){e[n+"TransformOrigin"]=t})),e.transformOrigin=t},t.prototype.resetTransformOrigin=function(e){void 0===e&&(e=this.props);var t=e.mousePosition,n=function(e,t){switch(e){case"center":return"center center 0";case"auto":default:return}}(e.position,this.dialogEl);if(void 0===n&&t&&t.x>=0&&t.y>=0&&this.dialogEl&&this.dialogEl.getBoundingClientRect){var o=this.dialogEl.getBoundingClientRect(),i=o.left,r=o.top;n=t.x-i+"px "+(t.y-r)+"px 0"}n&&this.dialogEl&&this.setTransformOrigin(this.dialogEl.style,n)},t.prototype.renderHeader=function(){var e=this.props.title;return e?(e="number"==typeof e||"string"==typeof e?(0,i.jsx)("span",(0,o.pi)({className:"zent-dialog-r-title-text","data-zv":"9.12.16"},{children:e}),void 0):e,(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-header","data-zv":"9.12.16"},{children:(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-title","data-zv":"9.12.16"},{children:e}),void 0)}),void 0)):null},t.prototype.render=function(){var e=this,t=this.props,n=t.className,r=t.closeBtn,s=t.footer,l=t.style,a=t.children,c=this.renderHeader(),u=d()("zent-dialog-r-close",{"zent-dialog-r-has-title":!!c}),v=r&&(0,i.jsx)("button",(0,o.pi)({type:"button",className:u,onClick:this.onClickClose,"data-zv":"9.12.16"},{children:(0,i.jsx)(p.Z,{type:"close"},void 0)}),void 0),m=s&&(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-footer","data-zv":"9.12.16"},{children:s}),void 0);return(0,i.jsxs)("div",(0,o.pi)({className:d()("zent-dialog-r",n,{"zent-dialog-r--has-header":!!c,"zent-dialog-r--has-footer":!!m,"zent-dialog-r--no-close-btn":!v}),style:l,ref:function(t){return e.dialogEl=t},"data-zv":"9.12.16"},{children:[v,c,(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-body","data-zv":"9.12.16"},{children:(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-body-content","data-zv":"9.12.16"},{children:a}),void 0)}),void 0),m]}),void 0)},t}(r.Component),m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.rootRef=(0,r.createRef)(),t.onMaskClick=function(e){e.target===e.currentTarget&&t.props.mask&&t.props.maskClosable&&t.props.onClose(e)},t}return(0,o.ZT)(t,e),t.prototype.componentDidMount=function(){var e=document.activeElement,t=this.rootRef.current;t!==e&&t&&!t.contains(e)&&function(e){if(e){var t=(0,u.Z)();e.focus(),window.scroll(t.x,t.y)}}(t)},t.prototype.render=function(){var e=this.props,t=e.mask,n=e.visible,r=e.children;return(0,i.jsxs)("div",(0,o.pi)({ref:this.rootRef,tabIndex:-1,className:"zent-dialog-r-root","data-zv":"9.12.16"},{children:[n&&t&&(0,i.jsx)("div",{className:"zent-dialog-r-backdrop","data-zv":"9.12.16"},void 0),(0,i.jsx)("div",(0,o.pi)({className:"zent-dialog-r-wrap",onClick:this.onMaskClick,"data-zv":"9.12.16"},{children:r}),void 0)]}),void 0)},t}(r.Component),f=n(31542),h=n.t(f,2),C=n(70453),g=n(42690),y=n(14805),x=new Map,z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={visible:!0},t.closeOptions={},t.onClosed=function(){var e=t.props,n=e.options.onClose,o=e.container,i=t.closeOptions.triggerOnClose;(void 0===i||i)&&n&&n(),f.unmountComponentAtNode(o)},t.onClose=function(e){t.close({triggerOnClose:!1!==e})},t}return(0,o.ZT)(t,e),t.prototype.close=function(e){void 0===e&&(e={}),this.closeOptions=e,this.setState({visible:!1})},t.prototype.componentWillUnmount=function(){var e=this.props.options.dialogId;x.delete(e)},t.prototype.render=function(){var e=this.props.options,t=this.state.visible;return(0,i.jsx)(I,(0,o.pi)({},e,{onClose:this.onClose,onClosed:this.onClosed,visible:t}),void 0)},t}(r.Component);function b(e,t){void 0===t&&(t={});var n=x.get(e);if(n){var o=n.current;o&&o.close(t)}}function N(e){if(void 0===e&&(e={}),!a.Z)return g.Z;var t=e.dialogId,n=void 0===t?(0,C.Z)("__zent-dialog__"):t,s=e.parentComponent;!function(e){if(x.has(e))throw new Error("Duplicate dialog id found: "+e)}(n);var l=(0,y.Z)("div"),c=s?f.unstable_renderSubtreeIntoContainer.bind(h,s):f.render,d=(0,r.createRef)();return c((0,i.jsx)(z,{ref:d,options:(0,o.pi)((0,o.pi)({},e),{dialogId:n}),container:l},void 0),l),function(e,t){x.set(e,t)}(n,d),function(e){void 0===e&&(e=!0),b(n,{triggerOnClose:!1!==e})}}var j=n(49744),k=null;a.Z&&(0,j.Oo)(document.documentElement,"click",(function(e){0!==e.clientX&&0!==e.clientY&&(k={x:e.clientX,y:e.clientY})}),{capture:!0});var Z=function(e){function t(t){var n=e.call(this,t)||this;return n.lastMousePosition=null,n.onClose=function(e){var t=n.props.onClose;t&&t(e)},n.onExited=function(){var e=n.props.onClosed;n.setState({exiting:!1}),e&&e()},n.state={prevOpen:t.visible,exiting:!1},n}return(0,o.ZT)(t,e),t.getDerivedStateFromProps=function(e,t){var n=t.prevOpen;return e.visible===n?null:e.visible?{prevOpen:e.visible,exiting:!1}:{prevOpen:e.visible,exiting:!0}},t.prototype.render=function(){var e=this.props,t=e.visible,n=e.closeBtn,r=e.style,a=e.position,c=e.onOpened,d=(e.onClosed,e.mask),u=e.maskClosable,p=e.children,f=(0,o._T)(e,["visible","closeBtn","style","position","onOpened","onClosed","mask","maskClosable","children"]),h=this.state.exiting;return this.lastMousePosition=t?this.lastMousePosition||k:null,(0,i.jsx)(l.ZP,(0,o.pi)({visible:t||h,onClose:this.onClose,className:"zent-dialog-r-anchor",closeOnESC:n,blockPageScroll:!0},{children:(0,i.jsx)(m,(0,o.pi)({mask:d,maskClosable:u,visible:t,onClose:this.onClose},{children:(0,i.jsx)(s.Z,(0,o.pi)({appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:t,timeout:300,classNames:"zent-zoom",onEntered:c,onExited:this.onExited},{children:(0,i.jsx)(v,(0,o.pi)({},f,{style:r,closeBtn:n,mousePosition:this.lastMousePosition,position:a},{children:p}),void 0)}),void 0)}),void 0)}),void 0)},t.defaultProps={onClose:function(){},visible:!1,className:"",style:{},position:"auto",title:"",closeBtn:!0,mask:!0,maskClosable:!0,footer:null},t.openDialog=N,t.closeDialog=b,t}(r.Component),I=Z},11497:(e,t,n)=>{"use strict";n.d(t,{Hj:()=>g});var o=n(59312),i=n(24246),r=n(60042),s=n.n(r),l=n(52074),a=n(97701).Z,c=n(27036),d=n(27378),u=n(90347),p=n(65436),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={loading:!1},t.onClick=function(){var e=t.props,n=e.onClick,o=(0,e.getClose)();if(!n)return o();var i=n.length>0,r=i?n(o):n();if((0,p.Z)(r))return t.setState({loading:!0}),void r.then((function(){o()}),(function(){t.setState({loading:!1})}));i||!1===r||o()},t}return(0,o.ZT)(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.type,r=e.text,s=this.state.loading;return(0,i.jsx)(u.ZP,(0,o.pi)({type:n,className:t,loading:s,onClick:this.onClick},{children:r}),void 0)},t}(d.Component),m={info:"info-circle-o",success:"check-circle-o",error:"close-circle-o",warning:"error-circle-o"},f=a.openDialog;function h(e,t){var n,r=e.className,a=void 0===r?"":r,d=e.confirmType,u=void 0===d?"primary":d,p=e.closeBtn,h=void 0!==p&&p,C=e.maskClosable,g=void 0!==C&&C,y=e.title,x=e.type,z=e.content,b=e.onConfirm,N=e.onCancel,j=e.confirmText,k=e.cancelText,Z=e.parentComponent,I=e.onClose,w=null;return w=f({closeBtn:h,maskClosable:g,className:s()("zent-sweetalert-"+t,(n={},n[a]=!!a,n)),title:(0,i.jsx)(l.Z,(0,o.pi)({componentName:"Sweetalert"},{children:function(e){var t=m[x];return(0,i.jsxs)("div",(0,o.pi)({className:"zent-sweetalert-"+(x?"icon-":"")+"title","data-zv":"9.12.16"},{children:[x&&(0,i.jsx)(c.Z,{className:"zent-sweetalert-type-icon",type:t},void 0),y||e.title]}),void 0)}}),void 0),children:z,footer:(0,i.jsx)(l.Z,(0,o.pi)({componentName:"Sweetalert"},{children:function(e){var n="alert"===t;return(0,i.jsxs)("div",(0,o.pi)({className:"sweet-"+t+"-actions","data-zv":"9.12.16"},{children:[!n&&(0,i.jsx)(v,{type:"default",className:"zent-sweetalert-"+t+"-btn-cancel",getClose:function(){return w},onClick:N,text:k||e.cancel},"sweetalert-cancel"),(0,i.jsx)(v,{type:u,className:"zent-sweetalert-"+t+"-btn-confirm",getClose:function(){return w},onClick:b,text:j||(n?e.ok:e.confirm)},"sweetalert-confirm")]}),void 0)}}),void 0),parentComponent:Z,onClose:I})}function C(e){return void 0===e&&(e={}),h(e,"alert")}var g={alert:C,info:C,confirm:function(e){return void 0===e&&(e={}),h(e,"confirm")}}},58801:(e,t,n)=>{"use strict";function o(){var e=window.pageXOffset,t=window.pageYOffset;return{x:void 0!==e?e:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==t?t:(document.documentElement||document.body.parentNode||document.body).scrollTop}}n.d(t,{Z:()=>o})},65922:(e,t,n)=>{"use strict";function o(e,t){return e===t||(null==e?void 0:e.prototype)instanceof t}n.d(t,{Z:()=>o})}}]);