3 lines
1.5 KiB
JavaScript
3 lines
1.5 KiB
JavaScript
|
|
var Drop;export default window.Drop=Drop=class extends React.Component{constructor(t){super(t),this.state={open:!1,right:null!=t.right?t.right:t.right=!1,title:null!=t.title?t.title:t.title=null,content:null!=t.content?t.content:t.content=null,bodyAddClass:null!=t.bodyAddClass?t.bodyAddClass:t.bodyAddClass=""},this.open=this.open.bind(this),this.toggle=this.toggle.bind(this),this.wrap=null,this.$wrap=null}componentDidMount(){return document.addEventListener("click",this.handleOuterClick.bind(this))}componentWillUnmount(){return document.removeEventListener("click",this.handleOuterClick.bind(this))}handleOuterClick(t){if(0===this.$wrap.has(t.target).length&&1===$(document).has(t.target).length)return this.close()}close(){return this.setState({open:!1})}aOpen(t){return this.setState({content:t})}open(){var t;return t=this,this.setState({open:!0},function(){var e;return"function"==typeof(e=t.props).onOpen?e.onOpen(t.aOpen.bind(t)):void 0})}toggle(){return this.state.open?this.close():this.open()}refWrap(t){return this.wrap=t,this.$wrap=$(this.wrap)}render(){var t,e;return t=!0===this.state.open,e=!0===this.state.right,React.createElement("div",{className:["drop",t?"open":""].join(" "),ref:this.refWrap.bind(this)},React.createElement("div",{className:"drop_title",onClick:this.toggle},this.state.title),React.createElement("div",{className:["drop_content",this.state.bodyAddClass,e?"d-right":""].join(" ")},this.state.content))}};window.Drop=Drop;
|
||
|
|
//# sourceMappingURL=drop.min.js.map
|