diff --git a/packages/examples/app/index.html b/packages/examples/app/index.html index ba3ba29e..c8af2307 100644 --- a/packages/examples/app/index.html +++ b/packages/examples/app/index.html @@ -1 +1 @@ -
1){var f=(0,_.A)(t);return f[r]=i,e(f,n-u,r,a)}return i}return"min"===n?eS:"max"===n?eC:void 0},u=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",o=e[n],a=s(e,t,n,r);return{value:a,changed:a!==o}},d=function(e){return null===eO&&0===e||"number"==typeof eO&&e 1){var f=(0,_.A)(t);return f[r]=i,e(f,n-u,r,a)}return i}return"min"===n?eS:"max"===n?eC:void 0},u=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",o=e[n],a=s(e,t,n,r);return{value:a,changed:a!==o}},d=function(e){return null===eO&&0===e||"number"==typeof eO&&e -1?E.current[v]=e:delete E.current[v]},prefixCls:o,classNames:x,styles:C,className:a()(b,null==y?void 0:y.notice),style:k,times:h,key:p,eventKey:p,onNoticeClose:g,hovering:j&&F.length>0})))})},S=r.forwardRef(function(e,t){var n=e.prefixCls,o=void 0===n?"rc-notification":n,a=e.container,i=e.motion,l=e.maxCount,c=e.className,d=e.style,m=e.onAllRemoved,h=e.stack,v=e.renderNotifications,g=r.useState([]),b=(0,s.A)(g,2),y=b[0],A=b[1],k=function(e){var t,n=y.find(function(t){return t.key===e});null==n||null===(t=n.onClose)||void 0===t||t.call(n),A(function(t){return t.filter(function(t){return t.key!==e})})};r.useImperativeHandle(t,function(){return{open:function(e){A(function(t){var n,r=(0,u.A)(t),o=r.findIndex(function(t){return t.key===e.key}),a=(0,f.A)({},e);return o>=0?(a.times=((null===(n=t[o])||void 0===n?void 0:n.times)||0)+1,r[o]=a):(a.times=0,r.push(a)),l>0&&r.length>l&&(r=r.slice(-l)),r})},close:function(e){k(e)},destroy:function(){A([])}}});var E=r.useState({}),x=(0,s.A)(E,2),w=x[0],S=x[1];r.useEffect(function(){var e={};y.forEach(function(t){var n=t.placement,r=void 0===n?"topRight":n;r&&(e[r]=e[r]||[],e[r].push(t))}),Object.keys(w).forEach(function(t){e[t]=e[t]||[]}),S(e)},[y]);var M=function(e){S(function(t){var n=(0,f.A)({},t);return(n[e]||[]).length||delete n[e],n})},$=r.useRef(!1);if(r.useEffect(function(){Object.keys(w).length>0?$.current=!0:$.current&&(null==m||m(),$.current=!1)},[w]),!a)return null;var O=Object.keys(w);return(0,p.createPortal)(r.createElement(r.Fragment,null,O.map(function(e){var t=w[e],n=r.createElement(C,{key:e,configList:t,placement:e,prefixCls:o,className:null==c?void 0:c(e),style:null==d?void 0:d(e),motion:i,onNoticeClose:k,onAllNoticeRemoved:M,stack:h});return v?v(n,{prefixCls:o,key:e}):n})),a)}),M=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],$=function(){return document.body},O=0;function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getContainer,n=void 0===t?$:t,o=e.motion,a=e.prefixCls,i=e.maxCount,l=e.className,c=e.style,f=e.onAllRemoved,p=e.stack,m=e.renderNotifications,h=(0,d.A)(e,M),v=r.useState(),g=(0,s.A)(v,2),b=g[0],y=g[1],A=r.useRef(),k=r.createElement(S,{container:b,ref:A,prefixCls:a,motion:o,maxCount:i,className:l,style:c,onAllRemoved:f,stack:p,renderNotifications:m}),E=r.useState([]),x=(0,s.A)(E,2),w=x[0],C=x[1],P=r.useMemo(function(){return{open:function(e){var t=function(){for(var e={},t=arguments.length,n=Array(t),r=0;r -1?E.current[v]=e:delete E.current[v]},prefixCls:o,classNames:x,styles:C,className:a()(b,null==y?void 0:y.notice),style:k,times:h,key:p,eventKey:p,onNoticeClose:g,hovering:j&&F.length>0})))})},S=r.forwardRef(function(e,t){var n=e.prefixCls,o=void 0===n?"rc-notification":n,a=e.container,i=e.motion,l=e.maxCount,c=e.className,d=e.style,m=e.onAllRemoved,h=e.stack,v=e.renderNotifications,g=r.useState([]),b=(0,s.A)(g,2),y=b[0],A=b[1],k=function(e){var t,n=y.find(function(t){return t.key===e});null==n||null===(t=n.onClose)||void 0===t||t.call(n),A(function(t){return t.filter(function(t){return t.key!==e})})};r.useImperativeHandle(t,function(){return{open:function(e){A(function(t){var n,r=(0,u.A)(t),o=r.findIndex(function(t){return t.key===e.key}),a=(0,f.A)({},e);return o>=0?(a.times=((null===(n=t[o])||void 0===n?void 0:n.times)||0)+1,r[o]=a):(a.times=0,r.push(a)),l>0&&r.length>l&&(r=r.slice(-l)),r})},close:function(e){k(e)},destroy:function(){A([])}}});var E=r.useState({}),x=(0,s.A)(E,2),w=x[0],S=x[1];r.useEffect(function(){var e={};y.forEach(function(t){var n=t.placement,r=void 0===n?"topRight":n;r&&(e[r]=e[r]||[],e[r].push(t))}),Object.keys(w).forEach(function(t){e[t]=e[t]||[]}),S(e)},[y]);var M=function(e){S(function(t){var n=(0,f.A)({},t);return(n[e]||[]).length||delete n[e],n})},$=r.useRef(!1);if(r.useEffect(function(){Object.keys(w).length>0?$.current=!0:$.current&&(null==m||m(),$.current=!1)},[w]),!a)return null;var O=Object.keys(w);return(0,p.createPortal)(r.createElement(r.Fragment,null,O.map(function(e){var t=w[e],n=r.createElement(C,{key:e,configList:t,placement:e,prefixCls:o,className:null==c?void 0:c(e),style:null==d?void 0:d(e),motion:i,onNoticeClose:k,onAllNoticeRemoved:M,stack:h});return v?v(n,{prefixCls:o,key:e}):n})),a)}),M=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],$=function(){return document.body},O=0;function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.getContainer,n=void 0===t?$:t,o=e.motion,a=e.prefixCls,i=e.maxCount,l=e.className,c=e.style,f=e.onAllRemoved,p=e.stack,m=e.renderNotifications,h=(0,d.A)(e,M),v=r.useState(),g=(0,s.A)(v,2),b=g[0],y=g[1],A=r.useRef(),k=r.createElement(S,{container:b,ref:A,prefixCls:a,motion:o,maxCount:i,className:l,style:c,onAllRemoved:f,stack:p,renderNotifications:m}),E=r.useState([]),x=(0,s.A)(E,2),w=x[0],C=x[1],P=r.useMemo(function(){return{open:function(e){var t=function(){for(var e={},t=arguments.length,n=Array(t),r=0;r