react-crud-mobile 1.0.430 → 1.0.432

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.
Files changed (32) hide show
  1. package/dist/react-crud-mobile.cjs.development.js +1 -0
  2. package/dist/react-crud-mobile.cjs.development.js.map +1 -1
  3. package/dist/react-crud-mobile.cjs.production.min.js +1 -1
  4. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
  5. package/dist/react-crud-mobile.esm.js +1 -0
  6. package/dist/react-crud-mobile.esm.js.map +1 -1
  7. package/package.json +71 -71
  8. package/src/elements/UI.tsx +65 -65
  9. package/src/elements/UIChildren.tsx +127 -127
  10. package/src/elements/UIComplete.tsx +14 -14
  11. package/src/elements/UIElement.tsx +518 -516
  12. package/src/elements/UITag.tsx +13 -13
  13. package/src/elements/charts/ElChart.tsx +10 -10
  14. package/src/elements/core/UIAutoComplete.tsx +17 -17
  15. package/src/elements/core/UIButton.tsx +73 -73
  16. package/src/elements/core/UIIcon.tsx +8 -8
  17. package/src/elements/core/UIInclude.tsx +40 -40
  18. package/src/elements/core/UIInput.tsx +69 -69
  19. package/src/elements/core/UILink.tsx +17 -17
  20. package/src/elements/core/UIList.tsx +135 -135
  21. package/src/elements/core/UIListItem.tsx +32 -32
  22. package/src/elements/core/UIListRow.tsx +32 -32
  23. package/src/elements/core/UIModal.tsx +139 -139
  24. package/src/elements/core/UIOption.tsx +17 -17
  25. package/src/elements/core/UIQuantity.tsx +97 -97
  26. package/src/elements/core/UIRadio.tsx +17 -17
  27. package/src/elements/core/UISelect.tsx +122 -122
  28. package/src/elements/core/UISwitch.tsx +26 -26
  29. package/src/elements/core/UIToggle.tsx +102 -102
  30. package/src/elements/index.ts +1 -1
  31. package/src/elements/tabs/ElTabs.tsx +178 -178
  32. package/src/index.ts +1 -1
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIOption(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIOption(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,97 +1,97 @@
1
- import { Ionicons } from '@expo/vector-icons';
2
- import { useState } from 'react';
3
- import { ChildType, Utils } from 'react-crud-utils';
4
- import { Text, TouchableHighlight, View } from 'react-native';
5
-
6
- export default function UIQuantity(props: ChildType) {
7
- const scope = props.scope;
8
- const element = scope.original;
9
-
10
- let [index, setIndex] = useState(0);
11
-
12
- const value = scope.getValue(0);
13
-
14
- let color = element.color;
15
-
16
- if (!color) color = 'primary';
17
-
18
- const btn = {
19
- padding: 10,
20
- alignItems: 'center',
21
- height: 44,
22
- width: 44,
23
- textAlign: 'center',
24
- verticalAling: 'middle',
25
- borderRadius: 24,
26
- backgroundColor: color,
27
- color: '#ffffff',
28
- justifyContent: 'center',
29
- };
30
-
31
- const styles: any = {
32
- buttonLabel: {
33
- color: '#ffffff',
34
- fontWeight: '500',
35
- fontSize: 16,
36
- },
37
- value: {
38
- flex: 1,
39
- flexDirection: 'row',
40
- textAlign: 'center',
41
- },
42
- buttonInner: {
43
- flexDirection: 'row',
44
- alignItems: 'center',
45
- justifyContent: 'center',
46
- },
47
- buttonIcon: {
48
- color: '#fff',
49
- fontSize: 18,
50
- },
51
- button: btn,
52
- addButton: {
53
- ...btn,
54
- },
55
- delButton: {
56
- ...btn,
57
- },
58
- };
59
-
60
- const change = (val: number) => {
61
- scope.changeValue(value + val);
62
- setIndex(++index);
63
- };
64
-
65
- const onClickAdd = () => {
66
- change(1);
67
- };
68
-
69
- const onClickDel = () => {
70
- change(-1);
71
- };
72
-
73
- const style = (part: string, extra?: any) => {
74
- let s = { ...styles[part], ...extra };
75
- return scope.getStyle(part, s);
76
- };
77
-
78
- return (
79
- <>
80
- <TouchableHighlight
81
- underlayColor={'transparent'}
82
- onPress={onClickDel}
83
- style={style('delButton')}
84
- >
85
- <Ionicons size={30} style={style('buttonIcon')} name="remove" />
86
- </TouchableHighlight>
87
- <Text style={style('value')}>{Utils.nvl(value, 0)}</Text>
88
- <TouchableHighlight
89
- underlayColor={'transparent'}
90
- onPress={onClickAdd}
91
- style={style('addButton')}
92
- >
93
- <Ionicons size={30} style={style('buttonIcon')} name="add" />
94
- </TouchableHighlight>
95
- </>
96
- );
97
- }
1
+ import { Ionicons } from '@expo/vector-icons';
2
+ import { useState } from 'react';
3
+ import { ChildType, Utils } from 'react-crud-utils';
4
+ import { Text, TouchableHighlight, View } from 'react-native';
5
+
6
+ export default function UIQuantity(props: ChildType) {
7
+ const scope = props.scope;
8
+ const element = scope.original;
9
+
10
+ let [index, setIndex] = useState(0);
11
+
12
+ const value = scope.getValue(0);
13
+
14
+ let color = element.color;
15
+
16
+ if (!color) color = 'primary';
17
+
18
+ const btn = {
19
+ padding: 10,
20
+ alignItems: 'center',
21
+ height: 44,
22
+ width: 44,
23
+ textAlign: 'center',
24
+ verticalAling: 'middle',
25
+ borderRadius: 24,
26
+ backgroundColor: color,
27
+ color: '#ffffff',
28
+ justifyContent: 'center',
29
+ };
30
+
31
+ const styles: any = {
32
+ buttonLabel: {
33
+ color: '#ffffff',
34
+ fontWeight: '500',
35
+ fontSize: 16,
36
+ },
37
+ value: {
38
+ flex: 1,
39
+ flexDirection: 'row',
40
+ textAlign: 'center',
41
+ },
42
+ buttonInner: {
43
+ flexDirection: 'row',
44
+ alignItems: 'center',
45
+ justifyContent: 'center',
46
+ },
47
+ buttonIcon: {
48
+ color: '#fff',
49
+ fontSize: 18,
50
+ },
51
+ button: btn,
52
+ addButton: {
53
+ ...btn,
54
+ },
55
+ delButton: {
56
+ ...btn,
57
+ },
58
+ };
59
+
60
+ const change = (val: number) => {
61
+ scope.changeValue(value + val);
62
+ setIndex(++index);
63
+ };
64
+
65
+ const onClickAdd = () => {
66
+ change(1);
67
+ };
68
+
69
+ const onClickDel = () => {
70
+ change(-1);
71
+ };
72
+
73
+ const style = (part: string, extra?: any) => {
74
+ let s = { ...styles[part], ...extra };
75
+ return scope.getStyle(part, s);
76
+ };
77
+
78
+ return (
79
+ <>
80
+ <TouchableHighlight
81
+ underlayColor={'transparent'}
82
+ onPress={onClickDel}
83
+ style={style('delButton')}
84
+ >
85
+ <Ionicons size={30} style={style('buttonIcon')} name="remove" />
86
+ </TouchableHighlight>
87
+ <Text style={style('value')}>{Utils.nvl(value, 0)}</Text>
88
+ <TouchableHighlight
89
+ underlayColor={'transparent'}
90
+ onPress={onClickAdd}
91
+ style={style('addButton')}
92
+ >
93
+ <Ionicons size={30} style={style('buttonIcon')} name="add" />
94
+ </TouchableHighlight>
95
+ </>
96
+ );
97
+ }
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIRadio(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIRadio(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,122 +1,122 @@
1
- import { useState } from 'react';
2
- import { ChildType, MethodType, useTheme, 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
- const theme = useTheme();
22
-
23
- const handlePress = () => {
24
- setModalVisible(!modalVisible);
25
- };
26
-
27
- const onClick = ({ crud, value }: MethodType) => {
28
- scope.changeValue(value);
29
- handlePress();
30
- };
31
-
32
- const style = (part: string, extra?: any) => {
33
- return { ...styles[part], ...scope.getStyle(part), ...extra };
34
- };
35
-
36
- return (
37
- <View style={style('selectRoot')}>
38
- <TouchableOpacity onPress={handlePress} style={style('selectInput')}>
39
- <Text style={style('selectLabel')}>
40
- {Utils.nvl(value, placeholder)}
41
- </Text>
42
- <Icon name="angle-down" size={20} color="#888" />
43
- </TouchableOpacity>
44
- <Modal
45
- animationType="slide"
46
- transparent={true}
47
- visible={modalVisible}
48
- onRequestClose={() => setModalVisible(false)}
49
- >
50
- <StatusBar
51
- barStyle="dark-content"
52
- backgroundColor={theme.colors.primary}
53
- />
54
- <SafeAreaView style={style('modalSafe')}>
55
- <View style={style('modalHeader')}>
56
- <TouchableOpacity
57
- onPress={() => setModalVisible(false)}
58
- style={style('modalCloseButton')}
59
- >
60
- <Text style={style('modalCloseText')}>X</Text>
61
- </TouchableOpacity>
62
- <Text style={style('modalTitle')}>{placeholder}</Text>
63
- </View>
64
- <View style={style('modalContent')}>
65
- <UI.List data={items} name={scope.getName('list')} click={onClick}>
66
- <UI.Value value="#{@this.label}" />
67
- </UI.List>
68
- </View>
69
- </SafeAreaView>
70
- </Modal>
71
- </View>
72
- );
73
- }
74
-
75
- const styles = StyleSheet.create({
76
- selectRoot: {
77
- justifyContent: 'flex-start',
78
- alignItems: 'flex-start',
79
- },
80
- selectInput: {
81
- width: '100%',
82
- flexDirection: 'row',
83
- borderWidth: 1,
84
- borderColor: '#a9a9a9',
85
- borderRadius: 20,
86
- paddingHorizontal: 15,
87
- paddingVertical: 10,
88
- },
89
- selectLabel: { flex: 1 },
90
- modalSafe: {
91
- flex: 1,
92
- backgroundColor: '#f5f5f5',
93
- paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
94
- },
95
- modalHeader: {
96
- flexDirection: 'row',
97
- alignItems: 'center',
98
- padding: 15,
99
- backgroundColor: '#6200ea',
100
- },
101
- modalCloseButton: {
102
- padding: 10,
103
- },
104
- modalCloseText: {
105
- fontSize: 18,
106
- color: 'white',
107
- },
108
- modalTitle: {
109
- fontSize: 18,
110
- color: 'white',
111
- fontWeight: 'bold',
112
- marginLeft: 10,
113
- },
114
- modalContent: {
115
- flex: 1,
116
- width: '100%',
117
- alignSelf: 'flex-start',
118
- flexDirection: 'row',
119
- flexWrap: 'wrap',
120
- padding: 20,
121
- },
122
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, MethodType, useTheme, 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
+ const theme = useTheme();
22
+
23
+ const handlePress = () => {
24
+ setModalVisible(!modalVisible);
25
+ };
26
+
27
+ const onClick = ({ crud, value }: MethodType) => {
28
+ scope.changeValue(value);
29
+ handlePress();
30
+ };
31
+
32
+ const style = (part: string, extra?: any) => {
33
+ return { ...styles[part], ...scope.getStyle(part), ...extra };
34
+ };
35
+
36
+ return (
37
+ <View style={style('selectRoot')}>
38
+ <TouchableOpacity onPress={handlePress} style={style('selectInput')}>
39
+ <Text style={style('selectLabel')}>
40
+ {Utils.nvl(value, placeholder)}
41
+ </Text>
42
+ <Icon name="angle-down" size={20} color="#888" />
43
+ </TouchableOpacity>
44
+ <Modal
45
+ animationType="slide"
46
+ transparent={true}
47
+ visible={modalVisible}
48
+ onRequestClose={() => setModalVisible(false)}
49
+ >
50
+ <StatusBar
51
+ barStyle="dark-content"
52
+ backgroundColor={theme.colors.primary}
53
+ />
54
+ <SafeAreaView style={style('modalSafe')}>
55
+ <View style={style('modalHeader')}>
56
+ <TouchableOpacity
57
+ onPress={() => setModalVisible(false)}
58
+ style={style('modalCloseButton')}
59
+ >
60
+ <Text style={style('modalCloseText')}>X</Text>
61
+ </TouchableOpacity>
62
+ <Text style={style('modalTitle')}>{placeholder}</Text>
63
+ </View>
64
+ <View style={style('modalContent')}>
65
+ <UI.List data={items} name={scope.getName('list')} click={onClick}>
66
+ <UI.Value value="#{@this.label}" />
67
+ </UI.List>
68
+ </View>
69
+ </SafeAreaView>
70
+ </Modal>
71
+ </View>
72
+ );
73
+ }
74
+
75
+ const styles = StyleSheet.create({
76
+ selectRoot: {
77
+ justifyContent: 'flex-start',
78
+ alignItems: 'flex-start',
79
+ },
80
+ selectInput: {
81
+ width: '100%',
82
+ flexDirection: 'row',
83
+ borderWidth: 1,
84
+ borderColor: '#a9a9a9',
85
+ borderRadius: 20,
86
+ paddingHorizontal: 15,
87
+ paddingVertical: 10,
88
+ },
89
+ selectLabel: { flex: 1 },
90
+ modalSafe: {
91
+ flex: 1,
92
+ backgroundColor: '#f5f5f5',
93
+ paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
94
+ },
95
+ modalHeader: {
96
+ flexDirection: 'row',
97
+ alignItems: 'center',
98
+ padding: 15,
99
+ backgroundColor: '#6200ea',
100
+ },
101
+ modalCloseButton: {
102
+ padding: 10,
103
+ },
104
+ modalCloseText: {
105
+ fontSize: 18,
106
+ color: 'white',
107
+ },
108
+ modalTitle: {
109
+ fontSize: 18,
110
+ color: 'white',
111
+ fontWeight: 'bold',
112
+ marginLeft: 10,
113
+ },
114
+ modalContent: {
115
+ flex: 1,
116
+ width: '100%',
117
+ alignSelf: 'flex-start',
118
+ flexDirection: 'row',
119
+ flexWrap: 'wrap',
120
+ padding: 20,
121
+ },
122
+ });
@@ -1,26 +1,26 @@
1
- import { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { Switch } from 'react-native';
4
-
5
- export default function UISwitch(props: ChildType) {
6
- const scope = props.scope;
7
- const initial = Utils.nvl(scope.getValue(), false) as boolean;
8
- const [value, setValue] = useState(initial);
9
-
10
- let onChange = v => {
11
- scope.changeValue(v);
12
-
13
- setValue(v);
14
- };
15
-
16
- return (
17
- <Switch
18
- value={value}
19
- onValueChange={onChange} // Alterna o estado
20
- />
21
- );
22
- }
23
-
24
- const styles = {
25
- link: {},
26
- };
1
+ import { useState } from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { Switch } from 'react-native';
4
+
5
+ export default function UISwitch(props: ChildType) {
6
+ const scope = props.scope;
7
+ const initial = Utils.nvl(scope.getValue(), false) as boolean;
8
+ const [value, setValue] = useState(initial);
9
+
10
+ let onChange = v => {
11
+ scope.changeValue(v);
12
+
13
+ setValue(v);
14
+ };
15
+
16
+ return (
17
+ <Switch
18
+ value={value}
19
+ onValueChange={onChange} // Alterna o estado
20
+ />
21
+ );
22
+ }
23
+
24
+ const styles = {
25
+ link: {},
26
+ };