react-crud-mobile 1.3.194 → 1.3.197
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 +13 -5
- 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 +13 -5
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +77 -77
- package/src/elements/UI.tsx +76 -76
- package/src/elements/UIChildren.tsx +142 -142
- package/src/elements/UIComplete.tsx +14 -14
- package/src/elements/UIElement.tsx +824 -823
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/GestureView.tsx +16 -16
- package/src/elements/core/SafeView.tsx +63 -63
- package/src/elements/core/UIAutoComplete.tsx +17 -17
- package/src/elements/core/UIButton.tsx +143 -143
- package/src/elements/core/UIHeader.tsx +38 -38
- package/src/elements/core/UIIcon.tsx +25 -25
- package/src/elements/core/UIInclude.tsx +40 -40
- package/src/elements/core/UIInput.tsx +102 -96
- package/src/elements/core/UILink.tsx +17 -17
- package/src/elements/core/UIList.tsx +168 -168
- package/src/elements/core/UIListItem.tsx +32 -32
- package/src/elements/core/UIListRow.tsx +132 -132
- package/src/elements/core/UIModal.tsx +225 -225
- package/src/elements/core/UIOption.tsx +17 -17
- package/src/elements/core/UIOrder.tsx +194 -194
- package/src/elements/core/UIQuantity.tsx +98 -98
- package/src/elements/core/UIRadio.tsx +17 -17
- package/src/elements/core/UISelect.tsx +171 -171
- package/src/elements/core/UISlider.tsx +61 -61
- package/src/elements/core/UIStatusBar.tsx +5 -5
- package/src/elements/core/UISwitch.tsx +27 -27
- package/src/elements/core/UIToast.tsx +44 -44
- package/src/elements/core/UIToggle.tsx +102 -102
- package/src/elements/core/UIView.tsx +69 -69
- package/src/elements/index.ts +1 -1
- package/src/elements/tabs/ElTabs.tsx +178 -178
- package/src/hooks/useIsVisible.ts +39 -39
- package/src/index.ts +1 -1
- package/src/utils/MobileUtils.ts +12 -12
@@ -1,225 +1,225 @@
|
|
1
|
-
import { useRef, useState } from 'react';
|
2
|
-
import {
|
3
|
-
ChildType,
|
4
|
-
ComponentUtils,
|
5
|
-
CrudUtils,
|
6
|
-
MethodType,
|
7
|
-
Utils,
|
8
|
-
ViewUtils,
|
9
|
-
} from 'react-crud-utils';
|
10
|
-
import {
|
11
|
-
Text,
|
12
|
-
TouchableOpacity,
|
13
|
-
StyleSheet,
|
14
|
-
Modal,
|
15
|
-
View,
|
16
|
-
SafeAreaView,
|
17
|
-
ScrollView,
|
18
|
-
} from 'react-native';
|
19
|
-
import UIChildren from '../UIChildren';
|
20
|
-
import Ionicons from '@expo/vector-icons/Ionicons';
|
21
|
-
import UIToast from './UIToast';
|
22
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
23
|
-
|
24
|
-
interface UIModalType extends ChildType {
|
25
|
-
open?: boolean;
|
26
|
-
dialog?: any;
|
27
|
-
}
|
28
|
-
|
29
|
-
export default function UIModal({
|
30
|
-
scope,
|
31
|
-
open,
|
32
|
-
dialog,
|
33
|
-
...props
|
34
|
-
}: UIModalType) {
|
35
|
-
let [modalVisible, setModalVisible] = useState(open === true);
|
36
|
-
let [index, setIndex] = useState(0);
|
37
|
-
//v1
|
38
|
-
|
39
|
-
const label = scope.getLabel();
|
40
|
-
const theme = scope.getTheme();
|
41
|
-
const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
|
42
|
-
const scrollRef = useRef(null);
|
43
|
-
|
44
|
-
const style = (part: string, extra?: any) => {
|
45
|
-
let st = { ...styles[part], ...extra };
|
46
|
-
|
47
|
-
return { ...scope.getStyle(part, st) };
|
48
|
-
};
|
49
|
-
|
50
|
-
const onClose = () => {
|
51
|
-
scope.close({ scope, crud: scope.currentDialog?.crud, event: {} });
|
52
|
-
};
|
53
|
-
|
54
|
-
scope.toggleDialog = vis => {
|
55
|
-
modalVisible = vis;
|
56
|
-
setModalVisible(modalVisible);
|
57
|
-
};
|
58
|
-
|
59
|
-
scope.update = () => {
|
60
|
-
setIndex(++index);
|
61
|
-
};
|
62
|
-
|
63
|
-
let curr = scope.currentDialog?.crud;
|
64
|
-
let main = ViewUtils.getCrud('view');
|
65
|
-
|
66
|
-
if (!curr) {
|
67
|
-
return <></>;
|
68
|
-
}
|
69
|
-
|
70
|
-
if (curr.uuid !== main.dialog?.crud?.uuid) {
|
71
|
-
return <></>;
|
72
|
-
}
|
73
|
-
|
74
|
-
const headerRight = ComponentUtils.getDefine(props, 'header', 'right');
|
75
|
-
const bottom = ComponentUtils.getDefine(props, 'bottom');
|
76
|
-
|
77
|
-
scope.put('scrollRef', scrollRef);
|
78
|
-
|
79
|
-
const original = scope.original;
|
80
|
-
|
81
|
-
ComponentUtils.setViewScope(scope);
|
82
|
-
|
83
|
-
let color = Utils.nvl(headerStyle.color, 'white');
|
84
|
-
let defaults = { color };
|
85
|
-
let key = `${curr.name}-${index}`;
|
86
|
-
|
87
|
-
let Content = () => {
|
88
|
-
if (dialog?.component) {
|
89
|
-
let Aux = dialog?.component;
|
90
|
-
|
91
|
-
return <Aux key={curr.uuid} crud={curr} />;
|
92
|
-
}
|
93
|
-
|
94
|
-
return (
|
95
|
-
<UIChildren scope={scope} crud={curr}>
|
96
|
-
{props.children}
|
97
|
-
</UIChildren>
|
98
|
-
);
|
99
|
-
};
|
100
|
-
|
101
|
-
let ModalContent = ({ children }) => {
|
102
|
-
let disableScroll = scope.part('disableScroll', false);
|
103
|
-
let disableContent = scope.part('disableContent', false);
|
104
|
-
|
105
|
-
if (disableContent) {
|
106
|
-
return <>{children}</>;
|
107
|
-
}
|
108
|
-
|
109
|
-
if (disableScroll) {
|
110
|
-
return <View style={style('modalContent')}>{children}</View>;
|
111
|
-
}
|
112
|
-
return (
|
113
|
-
<ScrollView
|
114
|
-
contentContainerStyle={{ flexGrow: 1, paddingBottom: 50 }}
|
115
|
-
style={style('modalContent')}
|
116
|
-
nestedScrollEnabled={true}
|
117
|
-
ref={scrollRef}
|
118
|
-
>
|
119
|
-
{children}
|
120
|
-
</ScrollView>
|
121
|
-
);
|
122
|
-
};
|
123
|
-
|
124
|
-
const ModalView = ({ children }) => {
|
125
|
-
if (original.gesture) {
|
126
|
-
return (
|
127
|
-
<GestureHandlerRootView
|
128
|
-
style={{
|
129
|
-
flex: 1,
|
130
|
-
}}
|
131
|
-
>
|
132
|
-
{children}
|
133
|
-
</GestureHandlerRootView>
|
134
|
-
);
|
135
|
-
}
|
136
|
-
return <>{children}</>;
|
137
|
-
};
|
138
|
-
|
139
|
-
const ModalInner = () => {
|
140
|
-
if (original.transient) {
|
141
|
-
return (
|
142
|
-
<View style={style('modalSafe')}>
|
143
|
-
<Content />
|
144
|
-
</View>
|
145
|
-
);
|
146
|
-
}
|
147
|
-
|
148
|
-
return (
|
149
|
-
<>
|
150
|
-
<SafeAreaView style={style('modalTop')} />
|
151
|
-
<SafeAreaView style={style('modalSafe')}>
|
152
|
-
<View style={scope.getStyle('header', headerStyle)}>
|
153
|
-
<TouchableOpacity
|
154
|
-
onPress={onClose}
|
155
|
-
style={style('modalCloseButton')}
|
156
|
-
>
|
157
|
-
<Ionicons
|
158
|
-
name="chevron-back-outline"
|
159
|
-
size={24}
|
160
|
-
color={color}
|
161
|
-
style={style('modalCloseText', defaults)}
|
162
|
-
/>
|
163
|
-
</TouchableOpacity>
|
164
|
-
<Text style={style('modalTitle', defaults)}>{label}</Text>
|
165
|
-
{!Utils.isEmpty(headerRight) && (
|
166
|
-
<UIChildren scope={scope} crud={curr} transient>
|
167
|
-
{headerRight}
|
168
|
-
</UIChildren>
|
169
|
-
)}
|
170
|
-
</View>
|
171
|
-
<ModalContent>
|
172
|
-
<Content />
|
173
|
-
</ModalContent>
|
174
|
-
{bottom}
|
175
|
-
</SafeAreaView>
|
176
|
-
<UIToast />
|
177
|
-
</>
|
178
|
-
);
|
179
|
-
};
|
180
|
-
return (
|
181
|
-
<ModalView>
|
182
|
-
<Modal
|
183
|
-
key={key}
|
184
|
-
animationType="slide"
|
185
|
-
transparent={true}
|
186
|
-
visible={modalVisible}
|
187
|
-
onRequestClose={onClose}
|
188
|
-
>
|
189
|
-
<ModalInner />
|
190
|
-
</Modal>
|
191
|
-
</ModalView>
|
192
|
-
);
|
193
|
-
}
|
194
|
-
|
195
|
-
const styles = StyleSheet.create({
|
196
|
-
modalTop: {
|
197
|
-
backgroundColor: 'primary',
|
198
|
-
width: '100%',
|
199
|
-
},
|
200
|
-
modalSafe: {
|
201
|
-
flex: 1,
|
202
|
-
width: '100%',
|
203
|
-
backgroundColor: 'background',
|
204
|
-
},
|
205
|
-
modalCloseButton: {
|
206
|
-
padding: 10,
|
207
|
-
},
|
208
|
-
modalCloseText: {
|
209
|
-
fontSize: 18,
|
210
|
-
color: 'white',
|
211
|
-
},
|
212
|
-
modalTitle: {
|
213
|
-
fontSize: 22,
|
214
|
-
fontWeight: 600,
|
215
|
-
marginLeft: 10,
|
216
|
-
},
|
217
|
-
modalContent: {
|
218
|
-
flex: 1,
|
219
|
-
backgroundColor: 'background',
|
220
|
-
paddingLeft: 15,
|
221
|
-
paddingRight: 15,
|
222
|
-
paddingTop: 10,
|
223
|
-
paddingBottom: 10,
|
224
|
-
},
|
225
|
-
});
|
1
|
+
import { useRef, useState } from 'react';
|
2
|
+
import {
|
3
|
+
ChildType,
|
4
|
+
ComponentUtils,
|
5
|
+
CrudUtils,
|
6
|
+
MethodType,
|
7
|
+
Utils,
|
8
|
+
ViewUtils,
|
9
|
+
} from 'react-crud-utils';
|
10
|
+
import {
|
11
|
+
Text,
|
12
|
+
TouchableOpacity,
|
13
|
+
StyleSheet,
|
14
|
+
Modal,
|
15
|
+
View,
|
16
|
+
SafeAreaView,
|
17
|
+
ScrollView,
|
18
|
+
} from 'react-native';
|
19
|
+
import UIChildren from '../UIChildren';
|
20
|
+
import Ionicons from '@expo/vector-icons/Ionicons';
|
21
|
+
import UIToast from './UIToast';
|
22
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
23
|
+
|
24
|
+
interface UIModalType extends ChildType {
|
25
|
+
open?: boolean;
|
26
|
+
dialog?: any;
|
27
|
+
}
|
28
|
+
|
29
|
+
export default function UIModal({
|
30
|
+
scope,
|
31
|
+
open,
|
32
|
+
dialog,
|
33
|
+
...props
|
34
|
+
}: UIModalType) {
|
35
|
+
let [modalVisible, setModalVisible] = useState(open === true);
|
36
|
+
let [index, setIndex] = useState(0);
|
37
|
+
//v1
|
38
|
+
|
39
|
+
const label = scope.getLabel();
|
40
|
+
const theme = scope.getTheme();
|
41
|
+
const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
|
42
|
+
const scrollRef = useRef(null);
|
43
|
+
|
44
|
+
const style = (part: string, extra?: any) => {
|
45
|
+
let st = { ...styles[part], ...extra };
|
46
|
+
|
47
|
+
return { ...scope.getStyle(part, st) };
|
48
|
+
};
|
49
|
+
|
50
|
+
const onClose = () => {
|
51
|
+
scope.close({ scope, crud: scope.currentDialog?.crud, event: {} });
|
52
|
+
};
|
53
|
+
|
54
|
+
scope.toggleDialog = vis => {
|
55
|
+
modalVisible = vis;
|
56
|
+
setModalVisible(modalVisible);
|
57
|
+
};
|
58
|
+
|
59
|
+
scope.update = () => {
|
60
|
+
setIndex(++index);
|
61
|
+
};
|
62
|
+
|
63
|
+
let curr = scope.currentDialog?.crud;
|
64
|
+
let main = ViewUtils.getCrud('view');
|
65
|
+
|
66
|
+
if (!curr) {
|
67
|
+
return <></>;
|
68
|
+
}
|
69
|
+
|
70
|
+
if (curr.uuid !== main.dialog?.crud?.uuid) {
|
71
|
+
return <></>;
|
72
|
+
}
|
73
|
+
|
74
|
+
const headerRight = ComponentUtils.getDefine(props, 'header', 'right');
|
75
|
+
const bottom = ComponentUtils.getDefine(props, 'bottom');
|
76
|
+
|
77
|
+
scope.put('scrollRef', scrollRef);
|
78
|
+
|
79
|
+
const original = scope.original;
|
80
|
+
|
81
|
+
ComponentUtils.setViewScope(scope);
|
82
|
+
|
83
|
+
let color = Utils.nvl(headerStyle.color, 'white');
|
84
|
+
let defaults = { color };
|
85
|
+
let key = `${curr.name}-${index}`;
|
86
|
+
|
87
|
+
let Content = () => {
|
88
|
+
if (dialog?.component) {
|
89
|
+
let Aux = dialog?.component;
|
90
|
+
|
91
|
+
return <Aux key={curr.uuid} crud={curr} />;
|
92
|
+
}
|
93
|
+
|
94
|
+
return (
|
95
|
+
<UIChildren scope={scope} crud={curr}>
|
96
|
+
{props.children}
|
97
|
+
</UIChildren>
|
98
|
+
);
|
99
|
+
};
|
100
|
+
|
101
|
+
let ModalContent = ({ children }) => {
|
102
|
+
let disableScroll = scope.part('disableScroll', false);
|
103
|
+
let disableContent = scope.part('disableContent', false);
|
104
|
+
|
105
|
+
if (disableContent) {
|
106
|
+
return <>{children}</>;
|
107
|
+
}
|
108
|
+
|
109
|
+
if (disableScroll) {
|
110
|
+
return <View style={style('modalContent')}>{children}</View>;
|
111
|
+
}
|
112
|
+
return (
|
113
|
+
<ScrollView
|
114
|
+
contentContainerStyle={{ flexGrow: 1, paddingBottom: 50 }}
|
115
|
+
style={style('modalContent')}
|
116
|
+
nestedScrollEnabled={true}
|
117
|
+
ref={scrollRef}
|
118
|
+
>
|
119
|
+
{children}
|
120
|
+
</ScrollView>
|
121
|
+
);
|
122
|
+
};
|
123
|
+
|
124
|
+
const ModalView = ({ children }) => {
|
125
|
+
if (original.gesture) {
|
126
|
+
return (
|
127
|
+
<GestureHandlerRootView
|
128
|
+
style={{
|
129
|
+
flex: 1,
|
130
|
+
}}
|
131
|
+
>
|
132
|
+
{children}
|
133
|
+
</GestureHandlerRootView>
|
134
|
+
);
|
135
|
+
}
|
136
|
+
return <>{children}</>;
|
137
|
+
};
|
138
|
+
|
139
|
+
const ModalInner = () => {
|
140
|
+
if (original.transient) {
|
141
|
+
return (
|
142
|
+
<View style={style('modalSafe')}>
|
143
|
+
<Content />
|
144
|
+
</View>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
|
148
|
+
return (
|
149
|
+
<>
|
150
|
+
<SafeAreaView style={style('modalTop')} />
|
151
|
+
<SafeAreaView style={style('modalSafe')}>
|
152
|
+
<View style={scope.getStyle('header', headerStyle)}>
|
153
|
+
<TouchableOpacity
|
154
|
+
onPress={onClose}
|
155
|
+
style={style('modalCloseButton')}
|
156
|
+
>
|
157
|
+
<Ionicons
|
158
|
+
name="chevron-back-outline"
|
159
|
+
size={24}
|
160
|
+
color={color}
|
161
|
+
style={style('modalCloseText', defaults)}
|
162
|
+
/>
|
163
|
+
</TouchableOpacity>
|
164
|
+
<Text style={style('modalTitle', defaults)}>{label}</Text>
|
165
|
+
{!Utils.isEmpty(headerRight) && (
|
166
|
+
<UIChildren scope={scope} crud={curr} transient>
|
167
|
+
{headerRight}
|
168
|
+
</UIChildren>
|
169
|
+
)}
|
170
|
+
</View>
|
171
|
+
<ModalContent>
|
172
|
+
<Content />
|
173
|
+
</ModalContent>
|
174
|
+
{bottom}
|
175
|
+
</SafeAreaView>
|
176
|
+
<UIToast />
|
177
|
+
</>
|
178
|
+
);
|
179
|
+
};
|
180
|
+
return (
|
181
|
+
<ModalView>
|
182
|
+
<Modal
|
183
|
+
key={key}
|
184
|
+
animationType="slide"
|
185
|
+
transparent={true}
|
186
|
+
visible={modalVisible}
|
187
|
+
onRequestClose={onClose}
|
188
|
+
>
|
189
|
+
<ModalInner />
|
190
|
+
</Modal>
|
191
|
+
</ModalView>
|
192
|
+
);
|
193
|
+
}
|
194
|
+
|
195
|
+
const styles = StyleSheet.create({
|
196
|
+
modalTop: {
|
197
|
+
backgroundColor: 'primary',
|
198
|
+
width: '100%',
|
199
|
+
},
|
200
|
+
modalSafe: {
|
201
|
+
flex: 1,
|
202
|
+
width: '100%',
|
203
|
+
backgroundColor: 'background',
|
204
|
+
},
|
205
|
+
modalCloseButton: {
|
206
|
+
padding: 10,
|
207
|
+
},
|
208
|
+
modalCloseText: {
|
209
|
+
fontSize: 18,
|
210
|
+
color: 'white',
|
211
|
+
},
|
212
|
+
modalTitle: {
|
213
|
+
fontSize: 22,
|
214
|
+
fontWeight: 600,
|
215
|
+
marginLeft: 10,
|
216
|
+
},
|
217
|
+
modalContent: {
|
218
|
+
flex: 1,
|
219
|
+
backgroundColor: 'background',
|
220
|
+
paddingLeft: 15,
|
221
|
+
paddingRight: 15,
|
222
|
+
paddingTop: 10,
|
223
|
+
paddingBottom: 10,
|
224
|
+
},
|
225
|
+
});
|
@@ -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
|
+
};
|