react-crud-mobile 1.0.585 → 1.0.587
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.
- package/dist/react-crud-mobile.cjs.development.js +18 -76
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +20 -78
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +73 -73
- package/src/elements/UI.tsx +67 -67
- package/src/elements/UIChildren.tsx +127 -127
- package/src/elements/UIComplete.tsx +14 -14
- package/src/elements/UIElement.tsx +580 -580
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/UIButton.tsx +85 -85
- package/src/elements/core/UIIcon.tsx +8 -8
- package/src/elements/core/UIInclude.tsx +40 -40
- package/src/elements/core/UIInput.tsx +69 -69
- package/src/elements/core/UIList.tsx +188 -188
- package/src/elements/core/UIListRow.tsx +32 -32
- package/src/elements/core/UIModal.tsx +174 -174
- package/src/elements/core/UIQuantity.tsx +97 -97
- package/src/elements/core/UISelect.tsx +69 -122
- package/src/elements/core/UIToggle.tsx +102 -102
- package/src/elements/core/UIView.tsx +42 -42
- package/src/elements/index.ts +1 -1
- package/src/elements/tabs/ElTabs.tsx +178 -178
- package/src/index.ts +1 -1
|
@@ -1,122 +1,69 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { ChildType, MethodType,
|
|
3
|
-
import {
|
|
4
|
-
Text,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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, Utils } from 'react-crud-utils';
|
|
3
|
+
import {
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
View,
|
|
8
|
+
StatusBar,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
11
|
+
import UI from '../UI';
|
|
12
|
+
|
|
13
|
+
export default function UISelect(props: ChildType) {
|
|
14
|
+
const scope = props.scope;
|
|
15
|
+
const items = Utils.nvl(scope.getOptions(), []);
|
|
16
|
+
const placeholder = scope.attr('placeholder', 'Selecione...');
|
|
17
|
+
const value = scope.getDisplayValue();
|
|
18
|
+
const modalName = `${scope.getName()}_Modal`;
|
|
19
|
+
|
|
20
|
+
const handlePress = () => {
|
|
21
|
+
scope.hide();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onClick = ({ crud, value }: MethodType) => {
|
|
25
|
+
scope.changeValue(value);
|
|
26
|
+
handlePress();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const style = (part: string, extra?: any) => {
|
|
30
|
+
return { ...styles[part], ...scope.getStyle(part), ...extra };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const onStartModal = ({ crud, scope }: MethodType) => {
|
|
34
|
+
console.log(crud, scope);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<View style={style('selectRoot')}>
|
|
39
|
+
<TouchableOpacity onPress={handlePress} style={style('selectInput')}>
|
|
40
|
+
<Text style={style('selectLabel')}>
|
|
41
|
+
{Utils.nvl(value, placeholder)}
|
|
42
|
+
</Text>
|
|
43
|
+
<Ionicons name="arrow-down" size={20} color="#888" />
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
<UI.Dialog name={modalName} onStart={onStartModal}>
|
|
46
|
+
<UI.List data={items} name={scope.getName('list')} click={onClick}>
|
|
47
|
+
<UI.Value value="#{@this.label}" />
|
|
48
|
+
</UI.List>
|
|
49
|
+
</UI.Dialog>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const styles = StyleSheet.create({
|
|
55
|
+
selectRoot: {
|
|
56
|
+
justifyContent: 'flex-start',
|
|
57
|
+
alignItems: 'flex-start',
|
|
58
|
+
},
|
|
59
|
+
selectInput: {
|
|
60
|
+
width: '100%',
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
borderWidth: 1,
|
|
63
|
+
borderColor: '#a9a9a9',
|
|
64
|
+
borderRadius: 20,
|
|
65
|
+
paddingHorizontal: 15,
|
|
66
|
+
paddingVertical: 10,
|
|
67
|
+
},
|
|
68
|
+
selectLabel: { flex: 1 },
|
|
69
|
+
});
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import React, { useState } 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
|
-
|
|
6
|
-
export default function UIToggle(props: ChildType) {
|
|
7
|
-
const scope = props.scope;
|
|
8
|
-
const options = Utils.nvl(scope.getOptions(), []);
|
|
9
|
-
const value = scope.getInputValue();
|
|
10
|
-
|
|
11
|
-
let [index, setIndex] = useState(0);
|
|
12
|
-
|
|
13
|
-
const isSelected = (item: any) => {
|
|
14
|
-
return item?.value === value;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const onClick = (item: any) => {
|
|
18
|
-
scope.changeValue(item.object);
|
|
19
|
-
setIndex(++index);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const Item = ({ item, index }) => {
|
|
23
|
-
let selected = isSelected(item);
|
|
24
|
-
let style: any = { ...styles.text };
|
|
25
|
-
|
|
26
|
-
if (selected) style.color = '#ffffff';
|
|
27
|
-
|
|
28
|
-
if (Utils.isEmpty(props.children)) {
|
|
29
|
-
return <Text style={style}>{item.label}</Text>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<UIListRow scope={scope} item={item.object} index={index}>
|
|
34
|
-
{props.children}
|
|
35
|
-
</UIListRow>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getItemStyle = (item: any) => {
|
|
40
|
-
let style = { ...styles.item, ...scope.getStyle('item') };
|
|
41
|
-
|
|
42
|
-
let wPart = 100 / options.length;
|
|
43
|
-
let width = Math.floor(wPart) + '%';
|
|
44
|
-
|
|
45
|
-
if (isSelected(item)) {
|
|
46
|
-
let selectedColor = scope.getPart('selectedColor', undefined, 'primary');
|
|
47
|
-
let st = scope.getStyle('selected', {
|
|
48
|
-
backgroundColor: selectedColor,
|
|
49
|
-
color: '#ffffff',
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
style = { ...style, ...st };
|
|
53
|
-
|
|
54
|
-
if (!style.color) {
|
|
55
|
-
style.color = '#ffffff';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
style.width = width;
|
|
60
|
-
|
|
61
|
-
return style;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<>
|
|
66
|
-
{options.map((item: any, i: number) => (
|
|
67
|
-
<TouchableHighlight
|
|
68
|
-
key={`k-${i}`}
|
|
69
|
-
style={getItemStyle(item)}
|
|
70
|
-
onPress={e => {
|
|
71
|
-
onClick(item);
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
<Item item={item} index={i} />
|
|
75
|
-
</TouchableHighlight>
|
|
76
|
-
))}
|
|
77
|
-
</>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const styles = StyleSheet.create({
|
|
82
|
-
container: {
|
|
83
|
-
flex: 1,
|
|
84
|
-
width: '100%',
|
|
85
|
-
gap: 10,
|
|
86
|
-
justifyContent: 'center',
|
|
87
|
-
flexDirection: 'row',
|
|
88
|
-
},
|
|
89
|
-
item: {
|
|
90
|
-
padding: 15,
|
|
91
|
-
marginVertical: 8,
|
|
92
|
-
backgroundColor: '#f5f5f5',
|
|
93
|
-
borderRadius: 8,
|
|
94
|
-
justifyContent: 'center',
|
|
95
|
-
width: 'auto',
|
|
96
|
-
flexDirection: 'row',
|
|
97
|
-
},
|
|
98
|
-
text: {
|
|
99
|
-
fontSize: 16,
|
|
100
|
-
fontWeight: '500',
|
|
101
|
-
},
|
|
102
|
-
});
|
|
1
|
+
import React, { useState } 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
|
+
|
|
6
|
+
export default function UIToggle(props: ChildType) {
|
|
7
|
+
const scope = props.scope;
|
|
8
|
+
const options = Utils.nvl(scope.getOptions(), []);
|
|
9
|
+
const value = scope.getInputValue();
|
|
10
|
+
|
|
11
|
+
let [index, setIndex] = useState(0);
|
|
12
|
+
|
|
13
|
+
const isSelected = (item: any) => {
|
|
14
|
+
return item?.value === value;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const onClick = (item: any) => {
|
|
18
|
+
scope.changeValue(item.object);
|
|
19
|
+
setIndex(++index);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Item = ({ item, index }) => {
|
|
23
|
+
let selected = isSelected(item);
|
|
24
|
+
let style: any = { ...styles.text };
|
|
25
|
+
|
|
26
|
+
if (selected) style.color = '#ffffff';
|
|
27
|
+
|
|
28
|
+
if (Utils.isEmpty(props.children)) {
|
|
29
|
+
return <Text style={style}>{item.label}</Text>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<UIListRow scope={scope} item={item.object} index={index}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</UIListRow>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getItemStyle = (item: any) => {
|
|
40
|
+
let style = { ...styles.item, ...scope.getStyle('item') };
|
|
41
|
+
|
|
42
|
+
let wPart = 100 / options.length;
|
|
43
|
+
let width = Math.floor(wPart) + '%';
|
|
44
|
+
|
|
45
|
+
if (isSelected(item)) {
|
|
46
|
+
let selectedColor = scope.getPart('selectedColor', undefined, 'primary');
|
|
47
|
+
let st = scope.getStyle('selected', {
|
|
48
|
+
backgroundColor: selectedColor,
|
|
49
|
+
color: '#ffffff',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
style = { ...style, ...st };
|
|
53
|
+
|
|
54
|
+
if (!style.color) {
|
|
55
|
+
style.color = '#ffffff';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
style.width = width;
|
|
60
|
+
|
|
61
|
+
return style;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
{options.map((item: any, i: number) => (
|
|
67
|
+
<TouchableHighlight
|
|
68
|
+
key={`k-${i}`}
|
|
69
|
+
style={getItemStyle(item)}
|
|
70
|
+
onPress={e => {
|
|
71
|
+
onClick(item);
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<Item item={item} index={i} />
|
|
75
|
+
</TouchableHighlight>
|
|
76
|
+
))}
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
container: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
width: '100%',
|
|
85
|
+
gap: 10,
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
},
|
|
89
|
+
item: {
|
|
90
|
+
padding: 15,
|
|
91
|
+
marginVertical: 8,
|
|
92
|
+
backgroundColor: '#f5f5f5',
|
|
93
|
+
borderRadius: 8,
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
width: 'auto',
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
},
|
|
98
|
+
text: {
|
|
99
|
+
fontSize: 16,
|
|
100
|
+
fontWeight: '500',
|
|
101
|
+
},
|
|
102
|
+
});
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import UIChildren from '../UIChildren';
|
|
4
|
-
import { ChildType, useTheme } from 'react-crud-utils';
|
|
5
|
-
import { useEffect } from 'react';
|
|
6
|
-
import { StatusBar } from 'react-native';
|
|
7
|
-
|
|
8
|
-
export default function UIView({ scope, children }: ChildType) {
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const header = scope.getPart('header', null, []);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
StatusBar.setBarStyle('light-content');
|
|
14
|
-
StatusBar.setBackgroundColor?.(theme.colors.primary);
|
|
15
|
-
}, []);
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
{header}
|
|
19
|
-
<View style={scope.getStyle('container', styles.container)}>
|
|
20
|
-
<ScrollView
|
|
21
|
-
keyboardShouldPersistTaps="handled"
|
|
22
|
-
contentContainerStyle={scope.getStyle('contentContainer', {})}
|
|
23
|
-
style={scope.getStyle('scroll', styles.scroll)}
|
|
24
|
-
>
|
|
25
|
-
<UIChildren scope={scope}>{children}</UIChildren>
|
|
26
|
-
</ScrollView>
|
|
27
|
-
</View>
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
scroll: {
|
|
34
|
-
padding: 10,
|
|
35
|
-
},
|
|
36
|
-
container: {
|
|
37
|
-
backgroundColor: 'primary',
|
|
38
|
-
},
|
|
39
|
-
view: {
|
|
40
|
-
backgroundColor: 'primary',
|
|
41
|
-
},
|
|
42
|
-
});
|
|
1
|
+
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import UIChildren from '../UIChildren';
|
|
4
|
+
import { ChildType, useTheme } from 'react-crud-utils';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { StatusBar } from 'react-native';
|
|
7
|
+
|
|
8
|
+
export default function UIView({ scope, children }: ChildType) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const header = scope.getPart('header', null, []);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
StatusBar.setBarStyle('light-content');
|
|
14
|
+
StatusBar.setBackgroundColor?.(theme.colors.primary);
|
|
15
|
+
}, []);
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{header}
|
|
19
|
+
<View style={scope.getStyle('container', styles.container)}>
|
|
20
|
+
<ScrollView
|
|
21
|
+
keyboardShouldPersistTaps="handled"
|
|
22
|
+
contentContainerStyle={scope.getStyle('contentContainer', {})}
|
|
23
|
+
style={scope.getStyle('scroll', styles.scroll)}
|
|
24
|
+
>
|
|
25
|
+
<UIChildren scope={scope}>{children}</UIChildren>
|
|
26
|
+
</ScrollView>
|
|
27
|
+
</View>
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
scroll: {
|
|
34
|
+
padding: 10,
|
|
35
|
+
},
|
|
36
|
+
container: {
|
|
37
|
+
backgroundColor: 'primary',
|
|
38
|
+
},
|
|
39
|
+
view: {
|
|
40
|
+
backgroundColor: 'primary',
|
|
41
|
+
},
|
|
42
|
+
});
|
package/src/elements/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as UI } from "./UI";
|
|
1
|
+
export { default as UI } from "./UI";
|