Ver código fonte

Module Input type!

Nikatlas 5 anos atrás
pai
commit
f8e2f000a1

+ 24 - 17
Components/ActionEditor.js

@@ -6,22 +6,26 @@ export default function ActionEditor(props) {
 	if(!action.data || typeof action.data !== "object") action.data = {};
 	return (
 			<View style={styles.container}>
-				<Text style={[styles.title, styles.capFirst]}>Type</Text>
-				<TextInput style={styles.defaultInput} 
-					onChangeText={(text) => {
-						action.type = text;
-						props.onChange && props.onChange(action);
-						setAction(action);
-					}}
-    				value={action.type}/>
-				<Text style={[styles.title, styles.capFirst]}>Data</Text>
-				<TextInput style={styles.defaultInput} 
-					onChangeText={(text) => {
-						action.data.route = text;
-						props.onChange && props.onChange(action);
-						setAction(action);
-					}}
-    				value={action.data.route}/>
+				<View style={styles.row}>
+					<Text style={[styles.title, styles.capFirst]}>Type</Text>
+					<TextInput style={styles.defaultInput} 
+						onChangeText={(text) => {
+							action.type = text;
+							props.onChange && props.onChange(action);
+							setAction(action);
+						}}
+	    				value={action.type}/>
+	    		</View>
+	    		<View style={styles.row}>
+					<Text style={[styles.title, styles.capFirst]}>Data</Text>
+					<TextInput style={styles.defaultInput} 
+						onChangeText={(text) => {
+							action.data.route = text;
+							props.onChange && props.onChange(action);
+							setAction(action);
+						}}
+	    				value={action.data.route}/>
+	    		</View>
 			</View>
 		);
 }
@@ -30,9 +34,12 @@ const styles = StyleSheet.create({
 	container:{
 		padding:24,
 		paddingTop: 0,
+		flexDirection: 'column'
+	},
+	row: {
 		flexDirection: 'row',
+		alignItems: 'baseline',
 		justifyContent: 'space-between',
-		alignItems: 'baseline'
 	},
 	capFirst: {
 		fontSize: 14, 

+ 59 - 0
Components/ModuleEditor.js

@@ -0,0 +1,59 @@
+import React, { useState } from 'react';
+import {View, Text, TextInput, StyleSheet} from 'react-native';
+
+export default function ModuleEditor(props) {
+	let [module, setModule] = useState(props.module || {});
+	return (
+			<View style={styles.container}>
+				<View style={styles.row}>
+					<Text style={[styles.title, styles.capFirst]}>Module</Text>
+					<TextInput style={styles.defaultInput} 
+						onChangeText={(text) => {
+							module.value = text;
+							props.onChange && props.onChange(module);
+							setModule(module);
+						}}
+	    				value={module.value}/>
+    			</View>
+    			<View style={styles.row}>
+					<Text style={[styles.title, styles.capFirst]}>Namespace</Text>
+					<TextInput style={styles.defaultInput} 
+						onChangeText={(text) => {
+							module.namespace = text;
+							props.onChange && props.onChange(module);
+							setModule(module);
+						}}
+	    				value={module.namespace}/>
+				</View>
+			</View>
+		);
+}
+
+const styles = StyleSheet.create({
+	container:{
+		padding:24,
+		paddingTop: 0,
+		flexDirection: 'column'
+	},
+	row: {
+		flexDirection: 'row',
+		alignItems: 'baseline',
+		justifyContent: 'space-between',
+	},
+	capFirst: {
+		fontSize: 14, 
+		fontFamily: 'roboto-light',
+		textTransform: 'capitalize'
+	},
+	defaultInput: {
+		marginTop:6,
+		borderWidth:1,
+		backgroundColor: 'white',
+		boxShadow: '0px 3px 6px #00000029',
+		borderColor: '#FFFFFF66',
+		borderRadius: 14
+	},
+	title: {
+
+	}
+})

+ 2 - 0
Components/TypeHandler.js

@@ -18,6 +18,8 @@ export default function(Type) {
 			return Editors.BoolEditor;
 		case Types.Action:
 			return Editors.ActionEditor;
+		case Types.Module:
+			return Editors.ModuleEditor;
 		default: 
 			return Editors.TextEditor;
 	}

+ 2 - 1
Components/index.js

@@ -4,7 +4,8 @@ export default [
 	"Numbers",
 	"FormEditor",
 	"BoolEditor",
-	"ActionEditor"
+	"ActionEditor",
+	"ModuleEditor"
 ].reduce((acc, item) => {
 	acc[item] = require('./' + item).default;
 	return acc;

+ 4 - 1
Systems/SideBar.js

@@ -67,7 +67,7 @@ export default class SideBar extends BaseSystem {
 		this.forceUpdate();
 	}
 
-    editNode(node, text,key){
+    editNode(node, text, key){
 		node.props[key] = text;
 		this.forceUpdate();
     }
@@ -106,6 +106,9 @@ export default class SideBar extends BaseSystem {
 			case DataTypes.Types.Action:
 				editorProps.action = viewNodeProps[key];
 				break;
+			case DataTypes.Types.Module:
+				editorProps.module = viewNodeProps[key];
+				break;
 			default:
 				//Must create a generic Vuiew Component
 				return (<View></View>)

+ 1 - 1
Tools/select.js

@@ -57,7 +57,7 @@ export default class Select extends Tool{
 		}
 		this.selectedNode = node;
 		let View = CS.getCurrentView();
-		this.selectedNodeParent = View.getParent(node);
+		// this.selectedNodeParent = View.getParent(node);
 	}
 
 	render(){

+ 1 - 1
yalc.lock

@@ -2,7 +2,7 @@
   "version": "v1",
   "packages": {
     "trapilib": {
-      "signature": "22aedbcfcf5f82b0a831b14da99eaa51",
+      "signature": "6ef4ee298fa31e267376b7848015f93a",
       "file": true,
       "replaced": "http://git.onarbooks.com/Klapi/TrapiLib.git"
     }

+ 2 - 2
yarn.lock

@@ -5691,7 +5691,7 @@ [email protected]:
   integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
 
 "trapilib@file:.yalc/trapilib":
-  version "1.1.1-22aedbcf"
+  version "1.1.1-6ef4ee29"
   dependencies:
     expo "^33.0.0"
     native-base "^2.13.8"
@@ -5704,7 +5704,7 @@ [email protected]:
 
 "trapilib@http://git.onarbooks.com/Klapi/TrapiLib.git":
   version "1.1.1"
-  resolved "http://git.onarbooks.com/Klapi/TrapiLib.git#46b96bc1a5b1087ae5b71392de380bf4f7a3eb4e"
+  resolved "http://git.onarbooks.com/Klapi/TrapiLib.git#4b6bd747ab0bb386e37cacf5e0ba8c0a62124b8f"
   dependencies:
     expo "^33.0.0"
     native-base "^2.13.8"