react-crud-mobile 1.0.108 → 1.0.110
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/elements/core/UIList.d.ts +2 -2
- package/dist/elements/core/UIListItem.d.ts +7 -0
- package/dist/react-crud-mobile.cjs.development.js +20 -17
- 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 -17
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIAutoComplete.tsx +17 -17
- package/src/elements/core/UIButton.tsx +76 -76
- package/src/elements/core/UIIcon.tsx +17 -17
- package/src/elements/core/UILink.tsx +17 -17
- package/src/elements/core/UIList.tsx +40 -38
- package/src/elements/core/UIListItem.tsx +32 -0
- package/src/elements/core/UIOption.tsx +17 -17
- package/src/elements/core/UIRadio.tsx +17 -17
- package/src/elements/core/UISelect.tsx +17 -17
- package/src/elements/core/UISwitch.tsx +26 -26
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ChildType, Utils } from 'react-crud-utils';
|
|
3
|
-
import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
|
|
4
|
-
|
|
5
|
-
export default function UIList(props: ChildType) {
|
|
6
|
-
const scope = props.scope;
|
|
7
|
-
const items = scope.getItems();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChildType, Utils } from 'react-crud-utils';
|
|
3
|
+
import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export default function UIList(props: ChildType) {
|
|
6
|
+
const scope = props.scope;
|
|
7
|
+
const items = scope.getItems();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<View style={styles.container}>
|
|
11
|
+
<FlatList
|
|
12
|
+
data={items} // Dados da lista
|
|
13
|
+
keyExtractor={item => item.id} // Chave única
|
|
14
|
+
renderItem={({ item }) => (
|
|
15
|
+
<View style={styles.item}>
|
|
16
|
+
<Text style={styles.text}>{item.name}</Text>
|
|
17
|
+
</View>
|
|
18
|
+
)}
|
|
19
|
+
/>
|
|
20
|
+
</View>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const styles = StyleSheet.create({
|
|
25
|
+
container: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
padding: 20,
|
|
28
|
+
backgroundColor: '#fff',
|
|
29
|
+
},
|
|
30
|
+
item: {
|
|
31
|
+
padding: 15,
|
|
32
|
+
marginVertical: 8,
|
|
33
|
+
backgroundColor: '#f9c2ff',
|
|
34
|
+
borderRadius: 8,
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
fontSize: 18,
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { ChildType, Utils } from 'react-crud-utils';
|
|
3
|
+
import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
interface UIListItemType extends ChildType {
|
|
6
|
+
data: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function UIListItem(props: UIListItemType) {
|
|
10
|
+
const scope = props.scope;
|
|
11
|
+
const crud = props.crud;
|
|
12
|
+
|
|
13
|
+
return <View style={styles.item}></View>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
container: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
padding: 20,
|
|
20
|
+
backgroundColor: '#fff',
|
|
21
|
+
},
|
|
22
|
+
item: {
|
|
23
|
+
padding: 15,
|
|
24
|
+
marginVertical: 8,
|
|
25
|
+
backgroundColor: '#f9c2ff',
|
|
26
|
+
borderRadius: 8,
|
|
27
|
+
},
|
|
28
|
+
text: {
|
|
29
|
+
fontSize: 18,
|
|
30
|
+
fontWeight: 'bold',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -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,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,17 +1,17 @@
|
|
|
1
|
-
import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
export default function UISelect(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 UISelect(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,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
|
+
};
|