react-crud-mobile 1.0.243 → 1.0.244

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,61 +1,61 @@
1
- import React from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { StyleSheet, Text, TouchableHighlight, 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
- const onClick = (item: any) => {
13
- console.log(item);
14
- scope.call('click', { value: item, item });
15
- };
16
-
17
- return (
18
- <>
19
- <UI.Text
20
- placeholder="Pesquisar..."
21
- field="query"
22
- crud={crud}
23
- right={<Icon name="eye" size={20} color="#888" />}
24
- />
25
-
26
- <View style={styles.container}>
27
- {items.map((item: any, i: number) => (
28
- <TouchableHighlight
29
- key={`k-${i}`}
30
- style={styles.item}
31
- onPress={e => {
32
- onClick(item);
33
- }}
34
- >
35
- <UIListRow scope={scope} item={item} index={i}>
36
- {props.children}
37
- </UIListRow>
38
- </TouchableHighlight>
39
- ))}
40
- </View>
41
- </>
42
- );
43
- }
44
-
45
- const styles = StyleSheet.create({
46
- container: {
47
- flex: 1,
48
- width: '100%',
49
- },
50
- item: {
51
- padding: 15,
52
- marginVertical: 8,
53
- backgroundColor: '#f5f5f5',
54
- borderRadius: 8,
55
- width: '100%',
56
- },
57
- text: {
58
- fontSize: 18,
59
- fontWeight: 'bold',
60
- },
61
- });
1
+ import React from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { StyleSheet, Text, TouchableHighlight, 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
+ const onClick = (item: any) => {
13
+ console.log(item);
14
+ scope.call('click', { value: item, item });
15
+ };
16
+
17
+ return (
18
+ <>
19
+ <UI.Text
20
+ placeholder="Pesquisar..."
21
+ field="query"
22
+ crud={crud}
23
+ right={<Icon name="eye" size={20} color="#888" />}
24
+ />
25
+
26
+ <View style={styles.container}>
27
+ {items.map((item: any, i: number) => (
28
+ <TouchableHighlight
29
+ key={`k-${i}`}
30
+ style={styles.item}
31
+ onPress={e => {
32
+ onClick(item);
33
+ }}
34
+ >
35
+ <UIListRow scope={scope} item={item} index={i}>
36
+ {props.children}
37
+ </UIListRow>
38
+ </TouchableHighlight>
39
+ ))}
40
+ </View>
41
+ </>
42
+ );
43
+ }
44
+
45
+ const styles = StyleSheet.create({
46
+ container: {
47
+ flex: 1,
48
+ width: '100%',
49
+ },
50
+ item: {
51
+ padding: 15,
52
+ marginVertical: 8,
53
+ backgroundColor: '#f5f5f5',
54
+ borderRadius: 8,
55
+ width: '100%',
56
+ },
57
+ text: {
58
+ fontSize: 18,
59
+ fontWeight: 'bold',
60
+ },
61
+ });
@@ -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,113 @@
1
- import { useState } from 'react';
2
- import { ChildType, MethodType, 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
- const placeholder = scope.attr('placeholder', 'Selecione...');
20
- const value = scope.getDisplayValue();
21
-
22
- const handlePress = () => {
23
- setModalVisible(!modalVisible);
24
- };
25
-
26
- const onClick = ({ crud, value }: MethodType) => {
27
- scope.changeValue(value);
28
- handlePress();
29
- };
30
-
31
- return (
32
- <View style={styles.root}>
33
- <TouchableOpacity onPress={handlePress} style={styles.select}>
34
- <Text style={styles.label}>{Utils.nvl(value, placeholder)}</Text>
35
- <Icon name="angle-down" size={20} color="#888" />
36
- </TouchableOpacity>
37
- <Modal
38
- animationType="slide"
39
- transparent={true}
40
- visible={modalVisible}
41
- onRequestClose={() => setModalVisible(false)}
42
- >
43
- <StatusBar barStyle="dark-content" backgroundColor="#6200ea" />
44
- <SafeAreaView style={styles.safe}>
45
- <View style={styles.header}>
46
- <TouchableOpacity
47
- onPress={() => setModalVisible(false)}
48
- style={styles.closeButton}
49
- >
50
- <Text style={styles.closeText}>X</Text>
51
- </TouchableOpacity>
52
- <Text style={styles.title}>Título do Modal</Text>
53
- </View>
54
- <View style={styles.content}>
55
- <UI.List data={items} name={scope.getName('list')} click={onClick}>
56
- <UI.Value value="#{@this.label}" />
57
- </UI.List>
58
- </View>
59
- </SafeAreaView>
60
- </Modal>
61
- </View>
62
- );
63
- }
64
-
65
- const styles = StyleSheet.create({
66
- safe: {
67
- flex: 1,
68
- backgroundColor: '#f5f5f5',
69
- paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
70
- },
71
- root: {
72
- justifyContent: 'flex-start',
73
- alignItems: 'flex-start',
74
- },
75
- select: {
76
- width: '100%',
77
- flexDirection: 'row',
78
- borderWidth: 1,
79
- borderColor: '#a9a9a9',
80
- borderRadius: 20,
81
- paddingHorizontal: 15,
82
- paddingVertical: 10,
83
- },
84
- item: { width: '100%' },
85
- label: { flex: 1 },
86
- header: {
87
- flexDirection: 'row',
88
- alignItems: 'center',
89
- padding: 15,
90
- backgroundColor: '#6200ea',
91
- },
92
- closeButton: {
93
- padding: 10,
94
- },
95
- closeText: {
96
- fontSize: 18,
97
- color: 'white',
98
- },
99
- title: {
100
- fontSize: 18,
101
- color: 'white',
102
- fontWeight: 'bold',
103
- marginLeft: 10,
104
- },
105
- content: {
106
- flex: 1,
107
- width: '100%',
108
- alignSelf: 'flex-start',
109
- flexDirection: 'row',
110
- flexWrap: 'wrap',
111
- padding: 20,
112
- },
113
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, MethodType, 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
+ const placeholder = scope.attr('placeholder', 'Selecione...');
20
+ const value = scope.getDisplayValue();
21
+
22
+ const handlePress = () => {
23
+ setModalVisible(!modalVisible);
24
+ };
25
+
26
+ const onClick = ({ crud, value }: MethodType) => {
27
+ scope.changeValue(value);
28
+ handlePress();
29
+ };
30
+
31
+ return (
32
+ <View style={styles.root}>
33
+ <TouchableOpacity onPress={handlePress} style={styles.select}>
34
+ <Text style={styles.label}>{Utils.nvl(value, placeholder)}</Text>
35
+ <Icon name="angle-down" size={20} color="#888" />
36
+ </TouchableOpacity>
37
+ <Modal
38
+ animationType="slide"
39
+ transparent={true}
40
+ visible={modalVisible}
41
+ onRequestClose={() => setModalVisible(false)}
42
+ >
43
+ <StatusBar barStyle="dark-content" backgroundColor="#6200ea" />
44
+ <SafeAreaView style={styles.safe}>
45
+ <View style={styles.header}>
46
+ <TouchableOpacity
47
+ onPress={() => setModalVisible(false)}
48
+ style={styles.closeButton}
49
+ >
50
+ <Text style={styles.closeText}>X</Text>
51
+ </TouchableOpacity>
52
+ <Text style={styles.title}>{placeholder}</Text>
53
+ </View>
54
+ <View style={styles.content}>
55
+ <UI.List data={items} name={scope.getName('list')} click={onClick}>
56
+ <UI.Value value="#{@this.label}" />
57
+ </UI.List>
58
+ </View>
59
+ </SafeAreaView>
60
+ </Modal>
61
+ </View>
62
+ );
63
+ }
64
+
65
+ const styles = StyleSheet.create({
66
+ safe: {
67
+ flex: 1,
68
+ backgroundColor: '#f5f5f5',
69
+ paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
70
+ },
71
+ root: {
72
+ justifyContent: 'flex-start',
73
+ alignItems: 'flex-start',
74
+ },
75
+ select: {
76
+ width: '100%',
77
+ flexDirection: 'row',
78
+ borderWidth: 1,
79
+ borderColor: '#a9a9a9',
80
+ borderRadius: 20,
81
+ paddingHorizontal: 15,
82
+ paddingVertical: 10,
83
+ },
84
+ item: { width: '100%' },
85
+ label: { flex: 1 },
86
+ header: {
87
+ flexDirection: 'row',
88
+ alignItems: 'center',
89
+ padding: 15,
90
+ backgroundColor: '#6200ea',
91
+ },
92
+ closeButton: {
93
+ padding: 10,
94
+ },
95
+ closeText: {
96
+ fontSize: 18,
97
+ color: 'white',
98
+ },
99
+ title: {
100
+ fontSize: 18,
101
+ color: 'white',
102
+ fontWeight: 'bold',
103
+ marginLeft: 10,
104
+ },
105
+ content: {
106
+ flex: 1,
107
+ width: '100%',
108
+ alignSelf: 'flex-start',
109
+ flexDirection: 'row',
110
+ flexWrap: 'wrap',
111
+ padding: 20,
112
+ },
113
+ });