|
@@ -5,13 +5,12 @@ import {Icon} from 'react-native-elements';
|
|
import BaseSystem from './System';
|
|
import BaseSystem from './System';
|
|
|
|
|
|
|
|
|
|
-export default class Environment extends BaseSystem{
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- constructor(CS, phoneRef) {
|
|
|
|
|
|
+export default class Environment extends BaseSystem {
|
|
|
|
+ constructor(CS, ToolBox, phoneRef) {
|
|
super()
|
|
super()
|
|
this.phoneRef = phoneRef;
|
|
this.phoneRef = phoneRef;
|
|
this.CoreSystem = CS;
|
|
this.CoreSystem = CS;
|
|
|
|
+ this.ToolBox = ToolBox;
|
|
}
|
|
}
|
|
|
|
|
|
addRow(){
|
|
addRow(){
|
|
@@ -25,14 +24,70 @@ export default class Environment extends BaseSystem{
|
|
this.forceUpdate();
|
|
this.forceUpdate();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ selectRow(row) {
|
|
|
|
+ this.ToolBox.selectNode(row);
|
|
|
|
+ this.forceUpdate();
|
|
|
|
+ }
|
|
|
|
+ selectCol(col) {
|
|
|
|
+ this.ToolBox.selectNode(col);
|
|
|
|
+ this.forceUpdate();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ rowHolders(Rows) {
|
|
|
|
+ return Rows.map((row, index) => {
|
|
|
|
+ let dom = '',
|
|
|
|
+ ref = null;
|
|
|
|
+ try {
|
|
|
|
+ ref = this.CoreSystem.ModuleSystem.getRef(row.id);
|
|
|
|
+ dom = ref.current._reactInternalFiber.child.child.stateNode;
|
|
|
|
+ } catch(e) {}
|
|
|
|
+ console.log("DOM", ref, dom,dom.clientHeight);
|
|
|
|
+ return <View
|
|
|
|
+ style={[{height: dom.clientHeight}, styles.rowHolderContainer]}
|
|
|
|
+ onClick={(e) => this.selectRow(row)}>
|
|
|
|
+ <View style={styles.rowHolder}>
|
|
|
|
+ <Text style={styles.rowButton}>{index}</Text>
|
|
|
|
+ </View>
|
|
|
|
+ </View>;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ colHolders(Cols) {
|
|
|
|
+ return Cols.map((col, index) => {
|
|
|
|
+ let dom = '',
|
|
|
|
+ ref = null;
|
|
|
|
+ try {
|
|
|
|
+ ref = this.CoreSystem.ModuleSystem.getRef(col.id);
|
|
|
|
+ dom = ref.current._reactInternalFiber.child.child.stateNode;
|
|
|
|
+ } catch(e) {}
|
|
|
|
+ console.log("DOM", ref, dom,dom.clientHeight);
|
|
|
|
+ return <View
|
|
|
|
+ style={[{width: dom.clientWidth}, styles.colHolderContainer]}
|
|
|
|
+ onClick={(e) => this.selectCol(col)}>
|
|
|
|
+ <View style={styles.colHolder}>
|
|
|
|
+ <Text style={styles.colButton}>{index}</Text>
|
|
|
|
+ </View>
|
|
|
|
+ </View>;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
render() {
|
|
render() {
|
|
let CurrentView = this.CoreSystem.getCurrentView();
|
|
let CurrentView = this.CoreSystem.getCurrentView();
|
|
let defaultContainer = CurrentView.getDefaultContainer();
|
|
let defaultContainer = CurrentView.getDefaultContainer();
|
|
let Rows = CurrentView.getRows(defaultContainer);
|
|
let Rows = CurrentView.getRows(defaultContainer);
|
|
|
|
+ let Cols = [];
|
|
|
|
+ // Check if selection is Row or Col and find ROW to getColumns
|
|
|
|
+ if(this.ToolBox.selectedNode){
|
|
|
|
+ let selectedRowNode = this.ToolBox.selectedNode.isRow ?
|
|
|
|
+ this.ToolBox.selectedNode :
|
|
|
|
+ CurrentView.getParent(this.ToolBox.selectedNode);
|
|
|
|
+ Cols = CurrentView.getColumns(selectedRowNode);
|
|
|
|
+ }
|
|
|
|
+
|
|
return <View style={styles.container}>
|
|
return <View style={styles.container}>
|
|
- <View style={[styles.row,styles.button]}>
|
|
|
|
- <Button
|
|
|
|
|
|
+ <View style={styles.row}>
|
|
|
|
+ <View style={styles.button}>
|
|
|
|
+ <Button
|
|
color="#D2691E"
|
|
color="#D2691E"
|
|
onPress = {() => this.addRow()}
|
|
onPress = {() => this.addRow()}
|
|
title={
|
|
title={
|
|
@@ -41,23 +96,21 @@ export default class Environment extends BaseSystem{
|
|
containerStyle={{height:10}}
|
|
containerStyle={{height:10}}
|
|
/>}
|
|
/>}
|
|
/>
|
|
/>
|
|
- </View>
|
|
|
|
- <View style={styles.row}>
|
|
|
|
- <View style={styles.col}>
|
|
|
|
- <Text>Colasdasdasdasdasd</Text>
|
|
|
|
- {Rows.map((row) => {
|
|
|
|
- return <Text>Row : {row.id}</Text>
|
|
|
|
- })}
|
|
|
|
|
|
+ </View>
|
|
|
|
+ </View>
|
|
|
|
+ <View style={[styles.row, styles.colHolders]}>
|
|
|
|
+ {this.colHolders(Cols)}
|
|
|
|
+ </View>
|
|
|
|
+ <View style={styles.row}>
|
|
|
|
+ <View style={[styles.col, styles.rowHolders]}>
|
|
|
|
+ {this.rowHolders(Rows)}
|
|
</View>
|
|
</View>
|
|
<div ref={this.phoneRef}>
|
|
<div ref={this.phoneRef}>
|
|
<View style={[styles.mobileView]}>
|
|
<View style={[styles.mobileView]}>
|
|
- {this.CoreSystem.render()}
|
|
|
|
- </View>
|
|
|
|
|
|
+ {this.CoreSystem.render()}
|
|
|
|
+ </View>
|
|
</div>
|
|
</div>
|
|
- <View style={styles.col}>
|
|
|
|
- <Text>Col</Text>
|
|
|
|
- </View>
|
|
|
|
- </View>
|
|
|
|
|
|
+ </View>
|
|
<View style={[styles.row,styles.button]}>
|
|
<View style={[styles.row,styles.button]}>
|
|
<Button
|
|
<Button
|
|
color="#D2691E"
|
|
color="#D2691E"
|
|
@@ -68,7 +121,6 @@ export default class Environment extends BaseSystem{
|
|
containerStyle={{height:10}}
|
|
containerStyle={{height:10}}
|
|
/>}
|
|
/>}
|
|
/>
|
|
/>
|
|
-
|
|
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
}
|
|
}
|
|
@@ -93,15 +145,40 @@ const styles = StyleSheet.create({
|
|
|
|
|
|
row: {
|
|
row: {
|
|
flexDirection: "row",
|
|
flexDirection: "row",
|
|
- borderWidth: 1
|
|
|
|
|
|
+ //borderWidth: 1
|
|
},
|
|
},
|
|
col: {
|
|
col: {
|
|
flexDirection: "column",
|
|
flexDirection: "column",
|
|
- borderWidth: 1
|
|
|
|
|
|
+ //borderWidth: 1
|
|
},
|
|
},
|
|
button:{
|
|
button:{
|
|
flex:1,
|
|
flex:1,
|
|
justifyContent:'center',
|
|
justifyContent:'center',
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+ rowHolders: {
|
|
|
|
+ padding:4
|
|
|
|
+ },
|
|
|
|
+ colHolders: {
|
|
|
|
+ padding:4,
|
|
|
|
+ justifyContent: 'flex-end'
|
|
|
|
+ },
|
|
|
|
+ rowHolderContainer: {
|
|
|
|
+ justifyContent: 'center'
|
|
|
|
+ },
|
|
|
|
+ colHolderContainer: {
|
|
|
|
+ justifyContent: 'center'
|
|
|
|
+ },
|
|
|
|
+ rowHolder: {
|
|
|
|
+ height: 50,
|
|
|
|
+ width:100,
|
|
|
|
+ backgroundColor: 'green',
|
|
|
|
+ textAlign: 'center'
|
|
|
|
+ },
|
|
|
|
+ colHolder: {
|
|
|
|
+ width:100,
|
|
|
|
+ height: 50,
|
|
|
|
+ backgroundColor: 'purple',
|
|
|
|
+ textAlign: 'center'
|
|
}
|
|
}
|
|
});
|
|
});
|