meraproject/lib/js/bws/react/ui/notify.min.js
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

3 lines
1.4 KiB
JavaScript

var Notify,NotifyWrap,createNotifies;export default window.NotifyWrap=NotifyWrap=class extends React.Component{constructor(e){super(e),this.state={index:0},this.notifies={}}create(e){var t;return({index:t}=this.state),t++,this.notifies[t]=React.createElement(Notify,{key:t,data:e}),this.setState({index:t})}render(){var e,t;for(t in e=[],this.notifies)e.push(this.notifies[t]);return React.createElement("div",null,e)}};Notify=class extends React.Component{constructor(e){super(e),this.state=this.prepare(e.data),this.close=this.close.bind(this)}prepare(e){var t,n,i;return{opened:!1,removed:!1,timeout:null!=(t=e.timeout)?t:3e3,text:null!=(n=e.text)?n:"",color:null!=(i=e.color)?i:""}}close(){var e;return(e=this).setState({opened:!1}),setTimeout(function(){return e.setState({removed:!0}),e=null},150)}componentDidMount(){var e;return e=this,setTimeout(function(){return e.setState({opened:!0})},10),setTimeout(this.close,this.state.timeout)}render(){var e,t,n,i;return({opened:t,removed:n,text:i,color:e}=this.state),n?null:React.createElement("div",{className:"notify "+e+(t?" opened":""),onClick:this.close},i)}},createNotifies=function(){var e;return(e=document.createElement("div")).id="notifies",document.body.appendChild(e),ReactDOM.render(React.createElement(NotifyWrap,{ref:function(e){return window.Notify=e}}),e)},document.addEventListener("DOMContentLoaded",createNotifies);
//# sourceMappingURL=notify.min.js.map