@arrange/react
Advanced tools
Comparing version 0.1.0-alpha.6bd3a182 to 0.1.0-alpha.90f3eb67
@@ -13,3 +13,3 @@ 'use strict'; | ||
var PaneContext = /*#__PURE__*/Object.freeze({ | ||
var Context = /*#__PURE__*/Object.freeze({ | ||
Provider: Provider, | ||
@@ -23,3 +23,3 @@ Consumer: Consumer | ||
super(props); | ||
this.state = { arrange: undefined }; | ||
this.state = { layout: undefined }; | ||
this._divRefCallback = this._gotDivRef.bind(this); | ||
@@ -29,3 +29,3 @@ } | ||
componentWillUnmount() { | ||
if (this.state.arrange) this.state.arrange.destroy(); | ||
if (this.state.layout) this.state.layout.destroy(); | ||
} | ||
@@ -36,6 +36,6 @@ | ||
if (this.state.arrange != null) { | ||
if (this.state.layout != null) { | ||
children = React__default.createElement( | ||
Provider, | ||
{ value: this.state.arrange.root }, | ||
{ value: this.state.layout.root }, | ||
this.props.children | ||
@@ -47,3 +47,3 @@ ); | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
children | ||
@@ -54,4 +54,4 @@ ); | ||
_gotDivRef(divRef) { | ||
if (divRef && this.state.arrange && divRef !== this.state.arrange.element) { | ||
this.state.arrange.destroy(); | ||
if (divRef && this.state.layout && divRef !== this.state.layout.element) { | ||
this.state.layout.destroy(); | ||
} | ||
@@ -61,3 +61,3 @@ | ||
this.setState({ | ||
arrange: new core.Layout(divRef) | ||
layout: new core.Layout(divRef) | ||
}); | ||
@@ -88,3 +88,3 @@ } | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.pane != null ? React__default.createElement( | ||
@@ -142,4 +142,10 @@ Provider, | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
this.props.children | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.container != null ? React__default.createElement( | ||
Provider, | ||
{ value: this.state.container }, | ||
' ', | ||
this.props.children, | ||
' ' | ||
) : null | ||
); | ||
@@ -157,2 +163,4 @@ } | ||
const container = new core.Container({ element: divRef, parent: this.parent }); | ||
if (this.props.onResize) container.on('resize', this.props.onResize); | ||
this.parent.add(container); | ||
@@ -171,3 +179,3 @@ this.setState({ container }); | ||
exports.Context = PaneContext; | ||
exports.Context = Context; | ||
exports.Layout = Layout; | ||
@@ -174,0 +182,0 @@ exports.Row = Row; |
@@ -6,3 +6,3 @@ import React, { createContext, PureComponent } from 'react'; | ||
var PaneContext = /*#__PURE__*/Object.freeze({ | ||
var Context = /*#__PURE__*/Object.freeze({ | ||
Provider: Provider, | ||
@@ -16,3 +16,3 @@ Consumer: Consumer | ||
super(props); | ||
this.state = { arrange: undefined }; | ||
this.state = { layout: undefined }; | ||
this._divRefCallback = this._gotDivRef.bind(this); | ||
@@ -22,3 +22,3 @@ } | ||
componentWillUnmount() { | ||
if (this.state.arrange) this.state.arrange.destroy(); | ||
if (this.state.layout) this.state.layout.destroy(); | ||
} | ||
@@ -29,6 +29,6 @@ | ||
if (this.state.arrange != null) { | ||
if (this.state.layout != null) { | ||
children = React.createElement( | ||
Provider, | ||
{ value: this.state.arrange.root }, | ||
{ value: this.state.layout.root }, | ||
this.props.children | ||
@@ -40,3 +40,3 @@ ); | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
children | ||
@@ -47,4 +47,4 @@ ); | ||
_gotDivRef(divRef) { | ||
if (divRef && this.state.arrange && divRef !== this.state.arrange.element) { | ||
this.state.arrange.destroy(); | ||
if (divRef && this.state.layout && divRef !== this.state.layout.element) { | ||
this.state.layout.destroy(); | ||
} | ||
@@ -54,3 +54,3 @@ | ||
this.setState({ | ||
arrange: new Layout(divRef) | ||
layout: new Layout(divRef) | ||
}); | ||
@@ -81,3 +81,3 @@ } | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.pane != null ? React.createElement( | ||
@@ -135,4 +135,10 @@ Provider, | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
this.props.children | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.container != null ? React.createElement( | ||
Provider, | ||
{ value: this.state.container }, | ||
' ', | ||
this.props.children, | ||
' ' | ||
) : null | ||
); | ||
@@ -150,2 +156,4 @@ } | ||
const container = new Container({ element: divRef, parent: this.parent }); | ||
if (this.props.onResize) container.on('resize', this.props.onResize); | ||
this.parent.add(container); | ||
@@ -164,3 +172,3 @@ this.setState({ container }); | ||
export { PaneContext as Context, Layout$1 as Layout, Row, Container$1 as Container, Column }; | ||
export { Context, Layout$1 as Layout, Row, Container$1 as Container, Column }; | ||
//# sourceMappingURL=arrange-react.es.js.map |
@@ -11,3 +11,3 @@ (function (global, factory) { | ||
var PaneContext = /*#__PURE__*/Object.freeze({ | ||
var Context = /*#__PURE__*/Object.freeze({ | ||
Provider: Provider, | ||
@@ -21,3 +21,3 @@ Consumer: Consumer | ||
super(props); | ||
this.state = { arrange: undefined }; | ||
this.state = { layout: undefined }; | ||
this._divRefCallback = this._gotDivRef.bind(this); | ||
@@ -27,3 +27,3 @@ } | ||
componentWillUnmount() { | ||
if (this.state.arrange) this.state.arrange.destroy(); | ||
if (this.state.layout) this.state.layout.destroy(); | ||
} | ||
@@ -34,6 +34,6 @@ | ||
if (this.state.arrange != null) { | ||
if (this.state.layout != null) { | ||
children = React__default.createElement( | ||
Provider, | ||
{ value: this.state.arrange.root }, | ||
{ value: this.state.layout.root }, | ||
this.props.children | ||
@@ -45,3 +45,3 @@ ); | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
children | ||
@@ -52,4 +52,4 @@ ); | ||
_gotDivRef(divRef) { | ||
if (divRef && this.state.arrange && divRef !== this.state.arrange.element) { | ||
this.state.arrange.destroy(); | ||
if (divRef && this.state.layout && divRef !== this.state.layout.element) { | ||
this.state.layout.destroy(); | ||
} | ||
@@ -59,3 +59,3 @@ | ||
this.setState({ | ||
arrange: new core.Layout(divRef) | ||
layout: new core.Layout(divRef) | ||
}); | ||
@@ -86,3 +86,3 @@ } | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.pane != null ? React__default.createElement( | ||
@@ -140,4 +140,10 @@ Provider, | ||
'div', | ||
{ ref: this._divRefCallback }, | ||
this.props.children | ||
{ ref: this._divRefCallback, className: this.props.className }, | ||
this.state.container != null ? React__default.createElement( | ||
Provider, | ||
{ value: this.state.container }, | ||
' ', | ||
this.props.children, | ||
' ' | ||
) : null | ||
); | ||
@@ -155,2 +161,4 @@ } | ||
const container = new core.Container({ element: divRef, parent: this.parent }); | ||
if (this.props.onResize) container.on('resize', this.props.onResize); | ||
this.parent.add(container); | ||
@@ -169,3 +177,3 @@ this.setState({ container }); | ||
exports.Context = PaneContext; | ||
exports.Context = Context; | ||
exports.Layout = Layout; | ||
@@ -172,0 +180,0 @@ exports.Row = Row; |
{ | ||
"name": "@arrange/react", | ||
"version": "0.1.0-alpha.6bd3a182", | ||
"version": "0.1.0-alpha.90f3eb67", | ||
"description": "A React interface for @arrange/core", | ||
@@ -26,3 +26,3 @@ "main": "dist/arrange-react.js", | ||
"dependencies": { | ||
"@arrange/core": "^0.1.0-alpha.6bd3a182", | ||
"@arrange/core": "^0.1.0-alpha.90f3eb67", | ||
"prop-types": "^15.6.1", | ||
@@ -29,0 +29,0 @@ "react": "^16.3.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
44565
8
423