Преглед изворни кода

Merge branch 'master' of http://git.onarbooks.com/klapi/TrapiLib

Nikatlas пре 5 година
родитељ
комит
e1a0a67127

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/lib/Module.js


+ 1 - 0
dist/lib/systems/InjectionSystem.js

@@ -0,0 +1 @@
+"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var InjectionSystem=function(){function InjectionSystem(){(0,_classCallCheck2["default"])(this,InjectionSystem);}(0,_createClass2["default"])(InjectionSystem,[{key:"inject",value:function inject(component){}}]);return InjectionSystem;}();exports["default"]=InjectionSystem;

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/lib/systems/ViewSystem.js


+ 1 - 1
dist/modules/BaseContainer.js

@@ -1 +1 @@
-"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=BaseContainer;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../lib/Types"));var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\modules\\BaseContainer.js";function BaseContainer(props){var selected=props.selected,width=props.width,height=props.height,restProps=(0,_objectWithoutProperties2["default"])(props,["selected","width","height"]);if(!width)width=BaseContainer.Inputs.width["default"];if(!height)height=BaseContainer.Inputs.height["default"];return _react["default"].createElement(_reactNative.View,(0,_extends2["default"])({},restProps,{style:{width:width,height:height},__source:{fileName:_jsxFileName,lineNumber:16}}));}BaseContainer.Inputs={width:new _Types["default"].Integer().require()["default"](50),height:new _Types["default"].Integer().require()["default"](50)};
+"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=BaseContainer;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../lib/Types"));var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\modules\\BaseContainer.js";function BaseContainer(props){var selected=props.selected,width=props.width,height=props.height,restProps=(0,_objectWithoutProperties2["default"])(props,["selected","width","height"]);if(!width)width=BaseContainer.Inputs.width["default"];if(!height)height=BaseContainer.Inputs.height["default"];return _react["default"].createElement(_reactNative.View,(0,_extends2["default"])({},restProps,{style:{width:width,height:height},__source:{fileName:_jsxFileName,lineNumber:16}}));}BaseContainer.Inputs={width:new _Types["default"].Integer().require()["default"](50),height:new _Types["default"].Integer().require()["default"](50)};

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/BaseHolder.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/Button.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/Col.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/DatePicker.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/Form.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/Image.js


+ 1 - 1
dist/modules/RootComp.js

@@ -1 +1 @@
-"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Types=_interopRequireDefault(require("../lib/Types"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\modules\\RootComp.js";var RootComp=function(_Module){(0,_inherits2["default"])(RootComp,_Module);function RootComp(props){(0,_classCallCheck2["default"])(this,RootComp);return(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(RootComp).call(this,props));}(0,_createClass2["default"])(RootComp,[{key:"display",value:function display(){return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:13}},_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:14}},this.props.text||""," - ",this.props.second),this.props.children);}}]);return RootComp;}(_Module2["default"]);exports["default"]=RootComp;RootComp.Inputs={text:new _Types["default"].Text().require()["default"]("Sample Text"),second:new _Types["default"].Integer().require()["default"](5)};
+"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Types=_interopRequireDefault(require("../lib/Types"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\modules\\RootComp.js";var RootComp=function(_Module){(0,_inherits2["default"])(RootComp,_Module);function RootComp(props){(0,_classCallCheck2["default"])(this,RootComp);return(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(RootComp).call(this,props));}(0,_createClass2["default"])(RootComp,[{key:"display",value:function display(){return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:13}},_react["default"].createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:14}},this.props.text||""," - ",this.props.second),this.props.children);}}]);return RootComp;}(_Module2["default"]);exports["default"]=RootComp;RootComp.Inputs={text:new _Types["default"].Text().require()["default"]("Sample Text"),second:new _Types["default"].Integer().require()["default"](5)};

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
dist/modules/Row.js


+ 1 - 1
dist/modules/Text.js

@@ -1 +1 @@
-"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../lib/Types"));var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\modules\\Text.js";var TextComp=function(_Module){(0,_inherits2["default"])(TextComp,_Module);function TextComp(props){var _this;(0,_classCallCheck2["default"])(this,TextComp);_this=(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(TextComp).call(this,props));_this.state={text:props.text||""};return _this;}(0,_createClass2["default"])(TextComp,[{key:"display",value:function display(){var _this$props=this.props,text=_this$props.text,color=_this$props.color,fontSize=_this$props.fontSize;return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:21}},_react["default"].createElement(_reactNative.Text,{style:{color:color,fontSize:fontSize},__source:{fileName:_jsxFileName,lineNumber:22}},text),this.props.children);}}]);return TextComp;}(_Module2["default"]);exports["default"]=TextComp;TextComp.Inputs={text:new _Types["default"].Text()["default"]("Enter Text"),color:new _Types["default"].Text(),fontSize:new _Types["default"].Integer()["default"](22)};
+"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../lib/Types"));var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\modules\\Text.js";var TextComp=function(_Module){(0,_inherits2["default"])(TextComp,_Module);function TextComp(props){var _this;(0,_classCallCheck2["default"])(this,TextComp);_this=(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(TextComp).call(this,props));_this.state={text:props.text||""};return _this;}(0,_createClass2["default"])(TextComp,[{key:"display",value:function display(){var _this$props=this.props,text=_this$props.text,color=_this$props.color,fontSize=_this$props.fontSize;return _react["default"].createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:21}},_react["default"].createElement(_reactNative.Text,{style:{color:color,fontSize:fontSize},__source:{fileName:_jsxFileName,lineNumber:22}},text),this.props.children);}}]);return TextComp;}(_Module2["default"]);exports["default"]=TextComp;TextComp.Inputs={text:new _Types["default"].Text()["default"]("Enter Text"),color:new _Types["default"].Text(),fontSize:new _Types["default"].Integer()["default"](22)};

+ 1 - 1
dist/modules/ViewComp.js

@@ -1 +1 @@
-"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\modules\\ViewComp.js";var ViewComp=function(_Module){(0,_inherits2["default"])(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2["default"])(this,ViewComp);return(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(ViewComp).call(this,props));}(0,_createClass2["default"])(ViewComp,[{key:"display",value:function display(){return _react["default"].createElement(_reactNative.View,{key:Math.random(),__source:{fileName:_jsxFileName,lineNumber:16}});}}]);return ViewComp;}(_Module2["default"]);exports["default"]=ViewComp;
+"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\modules\\ViewComp.js";var ViewComp=function(_Module){(0,_inherits2["default"])(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2["default"])(this,ViewComp);return(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(ViewComp).call(this,props));}(0,_createClass2["default"])(ViewComp,[{key:"display",value:function display(){return _react["default"].createElement(_reactNative.View,{key:Math.random(),__source:{fileName:_jsxFileName,lineNumber:16}});}}]);return ViewComp;}(_Module2["default"]);exports["default"]=ViewComp;

+ 9 - 0
lib/systems/InjectionSystem.js

@@ -0,0 +1,9 @@
+export default class InjectionSystem {
+	constructor(){
+
+	}
+
+	inject(component){
+		
+	}
+}

+ 34 - 0
modules/DatePicker.js

@@ -0,0 +1,34 @@
+import React, {Component} from 'react';
+import {DatePickerIOS, View, StyleSheet} from 'react-native';
+import Module from '../lib/Module';
+import Types from '../lib/Types';
+
+
+export default class DatePicker extends Module{
+	constructor(props){
+		super(props)
+		this.state = { chosenDate : new Date()}
+	}
+	setDate(newDate) {
+    		this.setState({chosenDate: newDate});
+  		}
+
+	display(){
+		let { container } = this.props.style || '';
+		return(
+		<View style={container}>
+        	<DatePickerIOS
+          		date={this.state.chosenDate}
+          		onDateChange={(date) => this.setDate(date)}
+        />
+        </View>
+        )
+	}
+}
+
+
+
+DatePicker.Inputs = {
+
+}
+

+ 71 - 21
modules/Form.js

@@ -1,9 +1,17 @@
 import React from 'react';
 import Module from '../lib/Module';
-import {StyleSheet ,TextInput, View, Button } from 'react-native';
+import {StyleSheet ,TextInput, View, Button , Text } from 'react-native';
 
 import Types from '../lib/Types';
-
+const Inp = [
+		{
+		textContentType :"username",
+		placeholder:"username"
+		},
+		{
+		textContentType :"password",
+		placeholder:"password"
+		}]
 
 
 export default class FormComp extends Module {
@@ -19,29 +27,42 @@ export default class FormComp extends Module {
 	}	
 	display() {
 		let {
-			inputsNum,
+			inputs, // number of inputs this must be Object
+			inputsMargin,
 			ButtonText,
 			ButtonColor,
-			container
+			backgroundColor,
+			Formtitle
 		} = this.props
-		if(!inputsNum) inputsNum = 2;
-		let Inputs = [];
-		for(let i = 0; i<inputsNum; i++){
-			let key = i+1;
-			let state = {};
-			let input =  <TextInput key={i}
-				        style={{height: 20, borderColor: 'gray', borderWidth: 1 , marginBottom:5}}
+		
+		//Init
+		if(!inputs) inputs = Inp;
+		if(!inputsMargin) inputsMargin = 7
+		if(!backgroundColor) backgroundColor = "#f7e6ff"
+
+
+		let Inputs = Object.keys(inputs).map((key,indx) => {
+			let state = {}
+			return (<TextInput key={indx}
+				        style={[{height: 20, borderColor: 'gray', borderWidth: 1 , marginBottom:inputsMargin},StaticRules.text]}
 				        onChangeText={(text) => {
-				        	state[key] = text;
+				        state[indx] = text;
 				        	this.setState(state)}}
 				        value={this.state.key}
-				        placeholder={'placeholder'}
-				      />
-			Inputs.push(input);
-		}
+				        placeholder={inputs[key].placeholder}
+				        textContentType={inputs[key].textContentType}
+				        secureTextEntry={ inputs[key].textContentType === "password" ? true :false}
+				      />)
+		})
+		
 		let fn = this.props.submit || this.submit
 		return 	(
-				<View style={{backgroundColor:"#f7e6ff",width:250,height:100,padding:10}}>
+				<View style={[{backgroundColor:backgroundColor},StaticRules.container]}>
+					{this.props.Formtitle ? (
+						<Text>{this.props.Formtitle}</Text>
+						):(null)}	
+
+
 					{Inputs}
 			        <Button
 				    onPress = {(e) => fn(e)}
@@ -52,12 +73,41 @@ export default class FormComp extends Module {
 				</View>)
 	}
 }
-
-
+//Predefined Rules that the User cant change
+let StaticRules = StyleSheet.create({
+	container:{
+		padding:10
+	},
+	text:{
+		fontSize:7
+	}
+})
 
 FormComp.Inputs = {
-	inputsNum: new Types.Integer().require().default(2),
+	//inputsNum: new Types.Integer().require().default(2),
+	/*inputs:[
+		{
+		textContentType :"username",
+		placeholder:"username"
+		},
+		{
+		textContentType :"password",
+		placeholder:"password"
+		},
+	],*/
+	inputs:new Types.Object().require(),
 	ButtonText:new Types.Text().require().default('Submit'),
-	ButtonColor: new Types.Text().require().color().default('#008CBA')
+	ButtonColor: new Types.Text().require().color().default('#008CBA'),
+	backgroundColor: new Types.Text().require().color().default('#03DAC6'),
+	Formtitle: new Types.Text().require()
 }
 
+/*
+inputs, // number of inputs this must be Object
+			inputsMargin,
+			ButtonText,
+			ButtonColor,
+			backgroundColor,
+			Formtitle
+
+*/

Неке датотеке нису приказане због велике количине промена