react-crud-mobile 1.0.174 → 1.0.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- import React, { useState } from "react";
2
- import { Utils } from "react-crud-utils";
3
-
4
- interface UITagType {
5
- name: string;
6
- [otherOptions: string]: unknown;
7
- }
8
-
9
- export default function UITag(props: UITagType) {
10
- let Aux = Utils.nvl(props.name, "span");
11
-
12
- return <Aux {...props} />;
13
- }
1
+ import React, { useState } from "react";
2
+ import { Utils } from "react-crud-utils";
3
+
4
+ interface UITagType {
5
+ name: string;
6
+ [otherOptions: string]: unknown;
7
+ }
8
+
9
+ export default function UITag(props: UITagType) {
10
+ let Aux = Utils.nvl(props.name, "span");
11
+
12
+ return <Aux {...props} />;
13
+ }
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { ChildType, Scope, Utils } from "react-crud-utils";
3
-
4
- export default function ElChart(props: ChildType) {
5
- let scope: Scope = props.scope;
6
- let items: any = scope.getItems();
7
- let columns = Utils.asList(scope.original.columns);
8
-
9
- return <div className="ui-chart-data"></div>;
10
- }
1
+ import React from "react";
2
+ import { ChildType, Scope, Utils } from "react-crud-utils";
3
+
4
+ export default function ElChart(props: ChildType) {
5
+ let scope: Scope = props.scope;
6
+ let items: any = scope.getItems();
7
+ let columns = Utils.asList(scope.original.columns);
8
+
9
+ return <div className="ui-chart-data"></div>;
10
+ }
@@ -1,40 +1,40 @@
1
- import UIChildren from '../UIChildren';
2
- import { ComponentUtils, DefineType, Utils } from 'react-crud-utils';
3
-
4
- export default function UIInclude(props: DefineType) {
5
- if (props.rendered === false) {
6
- return <></>;
7
- }
8
-
9
- let includes = ComponentUtils.getDefine(props, props.name, props.position);
10
-
11
- if (Utils.isEmpty(includes)) {
12
- includes = props.default;
13
- }
14
-
15
- if (!Utils.isEmpty(includes)) {
16
- let Aux = (tagProp: any) => {
17
- let Tag: any = props.tag;
18
-
19
- if (!Utils.isEmpty(Tag)) {
20
- return <Tag {...tagProp}>{tagProp.children}</Tag>;
21
- }
22
- return <>{tagProp.children}</>;
23
- };
24
-
25
- return (
26
- <Aux {...props.tagProps}>
27
- <UIChildren
28
- transient
29
- {...props}
30
- scope={props.scope}
31
- crud={props.crud}
32
- part={props.name}
33
- >
34
- {includes}
35
- </UIChildren>
36
- </Aux>
37
- );
38
- }
39
- return <>{includes}</>;
40
- }
1
+ import UIChildren from '../UIChildren';
2
+ import { ComponentUtils, DefineType, Utils } from 'react-crud-utils';
3
+
4
+ export default function UIInclude(props: DefineType) {
5
+ if (props.rendered === false) {
6
+ return <></>;
7
+ }
8
+
9
+ let includes = ComponentUtils.getDefine(props, props.name, props.position);
10
+
11
+ if (Utils.isEmpty(includes)) {
12
+ includes = props.default;
13
+ }
14
+
15
+ if (!Utils.isEmpty(includes)) {
16
+ let Aux = (tagProp: any) => {
17
+ let Tag: any = props.tag;
18
+
19
+ if (!Utils.isEmpty(Tag)) {
20
+ return <Tag {...tagProp}>{tagProp.children}</Tag>;
21
+ }
22
+ return <>{tagProp.children}</>;
23
+ };
24
+
25
+ return (
26
+ <Aux {...props.tagProps}>
27
+ <UIChildren
28
+ transient
29
+ {...props}
30
+ scope={props.scope}
31
+ crud={props.crud}
32
+ part={props.name}
33
+ >
34
+ {includes}
35
+ </UIChildren>
36
+ </Aux>
37
+ );
38
+ }
39
+ return <>{includes}</>;
40
+ }
@@ -1,56 +1,56 @@
1
- import { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { StyleSheet, TextInput, View } from 'react-native';
4
-
5
- export default function UIInput(props: ChildType) {
6
- let scope = props.scope;
7
- let initial = Utils.nvl(scope.getValue(), '');
8
-
9
- let label = scope.getLabel();
10
- let placeholder = scope.getPart('placeholder', null, label);
11
- let el = scope.original;
12
-
13
- const [value, setValue] = useState(initial);
14
-
15
- let onChange = v => {
16
- scope.changeValue(v);
17
-
18
- setValue(v);
19
- };
20
-
21
- return (
22
- <View style={styles.base}>
23
- {scope.getPart('left')}
24
- <TextInput
25
- style={styles.input}
26
- onChangeText={onChange}
27
- value={value}
28
- placeholder={placeholder}
29
- />
30
- {scope.getPart('right')}
31
- </View>
32
- );
33
- }
34
-
35
- const styles = StyleSheet.create({
36
- base: {
37
- flexDirection: 'row',
38
- alignItems: 'center',
39
- borderWidth: 1,
40
- borderColor: '#a9a9a9',
41
- borderRadius: 20,
42
- paddingHorizontal: 10,
43
- paddingVertical: 5,
44
- padding: 10,
45
- paddingLeft: 5,
46
- paddingRight: 10,
47
- },
48
- icon: {
49
- marginRight: 10, // Espaço entre ícone e input
50
- },
51
- input: {
52
- marginHorizontal: 10,
53
- marginVertical: 5,
54
- flex: 1, // Para o input ocupar o espaço restante
55
- },
56
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { StyleSheet, TextInput, View } from 'react-native';
4
+
5
+ export default function UIInput(props: ChildType) {
6
+ let scope = props.scope;
7
+ let initial = Utils.nvl(scope.getValue(), '');
8
+
9
+ let label = scope.getLabel();
10
+ let placeholder = scope.getPart('placeholder', null, label);
11
+ let el = scope.original;
12
+
13
+ const [value, setValue] = useState(initial);
14
+
15
+ let onChange = v => {
16
+ scope.changeValue(v);
17
+
18
+ setValue(v);
19
+ };
20
+
21
+ return (
22
+ <View style={styles.base}>
23
+ {scope.getPart('left')}
24
+ <TextInput
25
+ style={styles.input}
26
+ onChangeText={onChange}
27
+ value={value}
28
+ placeholder={placeholder}
29
+ />
30
+ {scope.getPart('right')}
31
+ </View>
32
+ );
33
+ }
34
+
35
+ const styles = StyleSheet.create({
36
+ base: {
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ borderWidth: 1,
40
+ borderColor: '#a9a9a9',
41
+ borderRadius: 20,
42
+ paddingHorizontal: 10,
43
+ paddingVertical: 5,
44
+ padding: 10,
45
+ paddingLeft: 5,
46
+ paddingRight: 10,
47
+ },
48
+ icon: {
49
+ marginRight: 10, // Espaço entre ícone e input
50
+ },
51
+ input: {
52
+ marginHorizontal: 10,
53
+ marginVertical: 5,
54
+ flex: 1, // Para o input ocupar o espaço restante
55
+ },
56
+ });
@@ -1,51 +1,52 @@
1
- import React from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { StyleSheet, Text, View } from 'react-native';
4
- import UIListRow from './UIListRow';
5
- import UI from '../UI';
6
- import Icon from 'react-native-vector-icons/FontAwesome';
7
-
8
- export default function UIList(props: ChildType) {
9
- const scope = props.scope;
10
- const crud = scope.crud;
11
- const items = Utils.nvl(scope.getItems(), []);
12
-
13
- return (
14
- <>
15
- <UI.Text
16
- placeholder="Pesquisar..."
17
- field="query"
18
- crud={crud}
19
- right={<Icon name="eye" size={20} color="#888" />}
20
- />
21
-
22
- <View style={styles.container}>
23
- {items.map((item: any, i: number) => (
24
- <View key={`k-${i}`} style={styles.item}>
25
- <UIListRow scope={scope} item={item} index={i}>
26
- {props.children}
27
- </UIListRow>
28
- </View>
29
- ))}
30
- </View>
31
- </>
32
- );
33
- }
34
-
35
- const styles = StyleSheet.create({
36
- container: {
37
- flex: 1,
38
- width: '100%',
39
- },
40
- item: {
41
- padding: 15,
42
- marginVertical: 8,
43
- backgroundColor: '#f5f5f5',
44
- borderRadius: 8,
45
- width: '100%',
46
- },
47
- text: {
48
- fontSize: 18,
49
- fontWeight: 'bold',
50
- },
51
- });
1
+ import React from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { StyleSheet, Text, View } from 'react-native';
4
+ import UIListRow from './UIListRow';
5
+ import UI from '../UI';
6
+ import Icon from 'react-native-vector-icons/FontAwesome';
7
+
8
+ export default function UIList(props: ChildType) {
9
+ const scope = props.scope;
10
+ const crud = scope.crud;
11
+ const items = Utils.nvl(scope.getItems(), []);
12
+
13
+ //console.log(items);
14
+ return (
15
+ <>
16
+ <UI.Text
17
+ placeholder="Pesquisar..."
18
+ field="query"
19
+ crud={crud}
20
+ right={<Icon name="eye" size={20} color="#888" />}
21
+ />
22
+
23
+ <View style={styles.container}>
24
+ {items.map((item: any, i: number) => (
25
+ <View key={`k-${i}`} style={styles.item}>
26
+ <UIListRow scope={scope} item={item} index={i}>
27
+ {props.children}
28
+ </UIListRow>
29
+ </View>
30
+ ))}
31
+ </View>
32
+ </>
33
+ );
34
+ }
35
+
36
+ const styles = StyleSheet.create({
37
+ container: {
38
+ flex: 1,
39
+ width: '100%',
40
+ },
41
+ item: {
42
+ padding: 15,
43
+ marginVertical: 8,
44
+ backgroundColor: '#f5f5f5',
45
+ borderRadius: 8,
46
+ width: '100%',
47
+ },
48
+ text: {
49
+ fontSize: 18,
50
+ fontWeight: 'bold',
51
+ },
52
+ });
@@ -1,29 +1,29 @@
1
- import React, { useState } from 'react';
2
- import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
3
- import UIChildren from '../UIChildren';
4
-
5
- interface UIListRowType extends ChildType {
6
- item: any;
7
- index: number;
8
- }
9
-
10
- export default function UIListRow(props: UIListRowType) {
11
- const parent = props.scope;
12
- const item = props.item;
13
- const row = {
14
- parent,
15
- crud: parent.crud,
16
- index: props.index,
17
- type: 'row',
18
- data: item,
19
- };
20
- let [scope] = useState(ScopeUtils.create(row));
21
-
22
- return (
23
- <>
24
- <UIChildren scope={scope} crud={scope.crud}>
25
- {props.children}
26
- </UIChildren>
27
- </>
28
- );
29
- }
1
+ import React, { useState } from 'react';
2
+ import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
3
+ import UIChildren from '../UIChildren';
4
+
5
+ interface UIListRowType extends ChildType {
6
+ item: any;
7
+ index: number;
8
+ }
9
+
10
+ export default function UIListRow(props: UIListRowType) {
11
+ const parent = props.scope;
12
+ const item = props.item;
13
+ const row = {
14
+ parent,
15
+ crud: parent.crud,
16
+ index: props.index,
17
+ type: 'row',
18
+ data: item,
19
+ };
20
+ let [scope] = useState(ScopeUtils.create(row));
21
+
22
+ return (
23
+ <>
24
+ <UIChildren scope={scope} crud={scope.crud}>
25
+ {props.children}
26
+ </UIChildren>
27
+ </>
28
+ );
29
+ }
@@ -1,113 +1,115 @@
1
- import { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import {
4
- Text,
5
- TouchableOpacity,
6
- StyleSheet,
7
- Modal,
8
- View,
9
- StatusBar,
10
- SafeAreaView,
11
- } from 'react-native';
12
- import Icon from 'react-native-vector-icons/FontAwesome';
13
- import UI from '../UI';
14
-
15
- export default function UISelect(props: ChildType) {
16
- const [modalVisible, setModalVisible] = useState(false);
17
- const scope = props.scope;
18
- const items = Utils.nvl(scope.getOptions(), []);
19
-
20
- const handlePress = () => {
21
- setModalVisible(!modalVisible);
22
- };
23
-
24
- return (
25
- <View style={styles.root}>
26
- <TouchableOpacity onPress={handlePress} style={styles.select}>
27
- <Text style={styles.label}>
28
- Clique aqui para acessar o React Native
29
- </Text>
30
- <Icon name="angle-down" size={20} color="#888" />
31
- </TouchableOpacity>
32
- <Modal
33
- animationType="slide"
34
- transparent={true}
35
- visible={modalVisible}
36
- onRequestClose={() => setModalVisible(false)}
37
- >
38
- <StatusBar barStyle="light-content" backgroundColor="#6200ee" />
39
- <SafeAreaView style={styles.safe}>
40
- <View style={styles.header}>
41
- <TouchableOpacity
42
- onPress={() => setModalVisible(false)}
43
- style={styles.closeButton}
44
- >
45
- <Text style={styles.closeText}>X</Text>
46
- </TouchableOpacity>
47
- <Text style={styles.title}>Título do Modal</Text>
48
- </View>
49
- <View style={styles.content}>
50
- <UI.List data={items} name={scope.getName('list')}>
51
- <UI.Value value="#{@this.label}" />
52
- </UI.List>
53
- </View>
54
- </SafeAreaView>
55
- </Modal>
56
- </View>
57
- );
58
- }
59
-
60
- const styles = StyleSheet.create({
61
- safe: {
62
- flex: 1,
63
- backgroundColor: 'white',
64
- paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
65
- },
66
- root: {
67
- flex: 1,
68
- justifyContent: 'flex-start',
69
- alignItems: 'flex-start',
70
- },
71
- select: {
72
- flex: 1,
73
- width: '100%',
74
- flexDirection: 'row',
75
- borderWidth: 1,
76
- borderColor: '#a9a9a9',
77
- borderRadius: 20,
78
- paddingHorizontal: 15,
79
- paddingVertical: 10,
80
- },
81
- item: { width: '100%' },
82
- label: { flex: 1 },
83
- container: {
84
- flex: 1,
85
- justifyContent: 'flex-start',
86
- alignItems: 'center',
87
- },
88
- header: {
89
- flexDirection: 'row',
90
- alignItems: 'center',
91
- padding: 15,
92
- backgroundColor: '#6200ea',
93
- },
94
- closeButton: {
95
- padding: 10,
96
- },
97
- closeText: {
98
- fontSize: 18,
99
- color: 'white',
100
- },
101
- title: {
102
- fontSize: 18,
103
- color: 'white',
104
- fontWeight: 'bold',
105
- marginLeft: 10,
106
- },
107
- content: {
108
- flex: 1,
109
- justifyContent: 'flex-start',
110
- alignItems: 'flex-start',
111
- padding: 20,
112
- },
113
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import {
4
+ Text,
5
+ TouchableOpacity,
6
+ StyleSheet,
7
+ Modal,
8
+ View,
9
+ StatusBar,
10
+ SafeAreaView,
11
+ } from 'react-native';
12
+ import Icon from 'react-native-vector-icons/FontAwesome';
13
+ import UI from '../UI';
14
+
15
+ export default function UISelect(props: ChildType) {
16
+ const [modalVisible, setModalVisible] = useState(false);
17
+ const scope = props.scope;
18
+ const items = Utils.nvl(scope.getOptions(), []);
19
+
20
+ const handlePress = () => {
21
+ setModalVisible(!modalVisible);
22
+ };
23
+
24
+ console.log(items);
25
+
26
+ return (
27
+ <View style={styles.root}>
28
+ <TouchableOpacity onPress={handlePress} style={styles.select}>
29
+ <Text style={styles.label}>
30
+ Clique aqui para acessar o React Native
31
+ </Text>
32
+ <Icon name="angle-down" size={20} color="#888" />
33
+ </TouchableOpacity>
34
+ <Modal
35
+ animationType="slide"
36
+ transparent={true}
37
+ visible={modalVisible}
38
+ onRequestClose={() => setModalVisible(false)}
39
+ >
40
+ <StatusBar barStyle="dark-content" backgroundColor="#6200ea" />
41
+ <SafeAreaView style={styles.safe}>
42
+ <View style={styles.header}>
43
+ <TouchableOpacity
44
+ onPress={() => setModalVisible(false)}
45
+ style={styles.closeButton}
46
+ >
47
+ <Text style={styles.closeText}>X</Text>
48
+ </TouchableOpacity>
49
+ <Text style={styles.title}>Título do Modal</Text>
50
+ </View>
51
+ <View style={styles.content}>
52
+ <UI.List data={items} name={scope.getName('list')}>
53
+ <UI.Value value="#{@this.label}" />
54
+ </UI.List>
55
+ </View>
56
+ </SafeAreaView>
57
+ </Modal>
58
+ </View>
59
+ );
60
+ }
61
+
62
+ const styles = StyleSheet.create({
63
+ safe: {
64
+ flex: 1,
65
+ backgroundColor: 'white',
66
+ paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
67
+ },
68
+ root: {
69
+ flex: 1,
70
+ justifyContent: 'flex-start',
71
+ alignItems: 'flex-start',
72
+ },
73
+ select: {
74
+ flex: 1,
75
+ width: '100%',
76
+ flexDirection: 'row',
77
+ borderWidth: 1,
78
+ borderColor: '#a9a9a9',
79
+ borderRadius: 20,
80
+ paddingHorizontal: 15,
81
+ paddingVertical: 10,
82
+ },
83
+ item: { width: '100%' },
84
+ label: { flex: 1 },
85
+ container: {
86
+ flex: 1,
87
+ justifyContent: 'flex-start',
88
+ alignItems: 'center',
89
+ },
90
+ header: {
91
+ flexDirection: 'row',
92
+ alignItems: 'center',
93
+ padding: 15,
94
+ backgroundColor: '#6200ea',
95
+ },
96
+ closeButton: {
97
+ padding: 10,
98
+ },
99
+ closeText: {
100
+ fontSize: 18,
101
+ color: 'white',
102
+ },
103
+ title: {
104
+ fontSize: 18,
105
+ color: 'white',
106
+ fontWeight: 'bold',
107
+ marginLeft: 10,
108
+ },
109
+ content: {
110
+ flex: 1,
111
+ justifyContent: 'flex-start',
112
+ alignItems: 'flex-start',
113
+ padding: 20,
114
+ },
115
+ });
@@ -1 +1 @@
1
- export { default as UI } from "./UI";
1
+ export { default as UI } from "./UI";