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,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,96 +1,102 @@
|
|
1
|
-
import { useState } from 'react';
|
2
|
-
import { ChildType, Utils } from 'react-crud-utils';
|
3
|
-
import { StyleSheet, TextInput, View } from 'react-native';
|
4
|
-
import { Ionicons } from '@expo/vector-icons';
|
5
|
-
|
6
|
-
export default function UIInput(props: ChildType) {
|
7
|
-
let scope = props.scope;
|
8
|
-
let initial = Utils.call(() => {
|
9
|
-
let val = Utils.nvl(scope.getValue(), '');
|
10
|
-
|
11
|
-
if (val && val?.push) {
|
12
|
-
return val.join(', ').trim();
|
13
|
-
}
|
14
|
-
return val;
|
15
|
-
});
|
16
|
-
|
17
|
-
let label = scope.getLabel();
|
18
|
-
let placeholder = scope.getPart('placeholder', null, label);
|
19
|
-
let el = scope.original;
|
20
|
-
|
21
|
-
const [value, setValue] = useState(initial);
|
22
|
-
|
23
|
-
let onChange = v => {
|
24
|
-
v = scope.changeValue(v);
|
25
|
-
|
26
|
-
setValue(v);
|
27
|
-
};
|
28
|
-
|
29
|
-
const style = (part: string, extra?: any) => {
|
30
|
-
return { ...scope.getStyle(part, styles[part]), ...extra };
|
31
|
-
};
|
32
|
-
|
33
|
-
const CustomIcon = () => {
|
34
|
-
let icon = el.icon;
|
35
|
-
|
36
|
-
if (icon) {
|
37
|
-
if (typeof icon === 'string') {
|
38
|
-
return (
|
39
|
-
<>
|
40
|
-
{el.icon && (
|
41
|
-
<Ionicons
|
42
|
-
name={el.icon}
|
43
|
-
size={scope.attr('iconSize', 20)}
|
44
|
-
color={scope.attr('iconColor', '#888')}
|
45
|
-
/>
|
46
|
-
)}
|
47
|
-
</>
|
48
|
-
);
|
49
|
-
}
|
50
|
-
return <>{icon}</>;
|
51
|
-
}
|
52
|
-
return <></>;
|
53
|
-
};
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
},
|
96
|
-
|
1
|
+
import { useState } from 'react';
|
2
|
+
import { ChildType, Utils } from 'react-crud-utils';
|
3
|
+
import { StyleSheet, TextInput, View } from 'react-native';
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
5
|
+
|
6
|
+
export default function UIInput(props: ChildType) {
|
7
|
+
let scope = props.scope;
|
8
|
+
let initial = Utils.call(() => {
|
9
|
+
let val = Utils.nvl(scope.getValue(), '');
|
10
|
+
|
11
|
+
if (val && val?.push) {
|
12
|
+
return val.join(', ').trim();
|
13
|
+
}
|
14
|
+
return val;
|
15
|
+
});
|
16
|
+
|
17
|
+
let label = scope.getLabel();
|
18
|
+
let placeholder = scope.getPart('placeholder', null, label);
|
19
|
+
let el = scope.original;
|
20
|
+
|
21
|
+
const [value, setValue] = useState(initial);
|
22
|
+
|
23
|
+
let onChange = v => {
|
24
|
+
v = scope.changeValue(v);
|
25
|
+
|
26
|
+
setValue(v);
|
27
|
+
};
|
28
|
+
|
29
|
+
const style = (part: string, extra?: any) => {
|
30
|
+
return { ...scope.getStyle(part, styles[part]), ...extra };
|
31
|
+
};
|
32
|
+
|
33
|
+
const CustomIcon = () => {
|
34
|
+
let icon = el.icon;
|
35
|
+
|
36
|
+
if (icon) {
|
37
|
+
if (typeof icon === 'string') {
|
38
|
+
return (
|
39
|
+
<>
|
40
|
+
{el.icon && (
|
41
|
+
<Ionicons
|
42
|
+
name={el.icon}
|
43
|
+
size={scope.attr('iconSize', 20)}
|
44
|
+
color={scope.attr('iconColor', '#888')}
|
45
|
+
/>
|
46
|
+
)}
|
47
|
+
</>
|
48
|
+
);
|
49
|
+
}
|
50
|
+
return <>{icon}</>;
|
51
|
+
}
|
52
|
+
return <></>;
|
53
|
+
};
|
54
|
+
|
55
|
+
let type = scope.getPart('type', 'none');
|
56
|
+
let decode = { textarea: { multiline: true, textAlignVertical: 'top' } };
|
57
|
+
let defs = Utils.nvl(decode[type], {});
|
58
|
+
|
59
|
+
return (
|
60
|
+
<>
|
61
|
+
<View style={style('base')}>
|
62
|
+
{scope.getPart('left')}
|
63
|
+
<TextInput
|
64
|
+
style={style('input')}
|
65
|
+
onChangeText={onChange}
|
66
|
+
value={value}
|
67
|
+
placeholder={placeholder}
|
68
|
+
{...defs}
|
69
|
+
/>
|
70
|
+
<CustomIcon />
|
71
|
+
</View>
|
72
|
+
{scope.getPart('right')}
|
73
|
+
</>
|
74
|
+
);
|
75
|
+
}
|
76
|
+
|
77
|
+
const styles = StyleSheet.create({
|
78
|
+
base: {
|
79
|
+
flex: 1,
|
80
|
+
width: '100%',
|
81
|
+
paddingBottom: 0,
|
82
|
+
paddingTop: 0,
|
83
|
+
alignItems: 'center',
|
84
|
+
borderWidth: 1,
|
85
|
+
borderColor: 'borderColor',
|
86
|
+
borderRadius: 5,
|
87
|
+
paddingHorizontal: 15,
|
88
|
+
alignSelf: 'flex-start',
|
89
|
+
flexDirection: 'row',
|
90
|
+
flexWrap: 'wrap',
|
91
|
+
gap: 10,
|
92
|
+
},
|
93
|
+
icon: {
|
94
|
+
marginRight: 10, // Espaço entre ícone e input
|
95
|
+
},
|
96
|
+
input: {
|
97
|
+
marginHorizontal: 0,
|
98
|
+
marginVertical: 0,
|
99
|
+
height: 40,
|
100
|
+
flex: 1, // Para o input ocupar o espaço restante
|
101
|
+
},
|
102
|
+
});
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
|
2
|
-
|
3
|
-
export default function UILink(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 UILink(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,168 +1,168 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import { ChildType, ComponentUtils, ScopeUtils, 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 { Ionicons } from '@expo/vector-icons';
|
7
|
-
|
8
|
-
export default function UIList(props: ChildType) {
|
9
|
-
const scope = props.scope;
|
10
|
-
const crud = scope.crud;
|
11
|
-
const original = scope.original;
|
12
|
-
const cols = Utils.nvl(scope.getPart('cols', undefined, 1));
|
13
|
-
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
14
|
-
const add = ComponentUtils.getDefine(props, 'add');
|
15
|
-
const hideAddWhenEmpty = original.hideAddWhenEmpty;
|
16
|
-
|
17
|
-
const getStyle = (key: string, extra?: any) => {
|
18
|
-
return scope.getStyle(key, { ...extra, ...styles[key] });
|
19
|
-
};
|
20
|
-
|
21
|
-
const getContainerStyle = (extra?: any) => {
|
22
|
-
let row = getStyle('container', {});
|
23
|
-
|
24
|
-
if (cols > 1) {
|
25
|
-
row = { ...row, flexDirection: 'row', flexWrap: 'wrap' };
|
26
|
-
}
|
27
|
-
|
28
|
-
return row;
|
29
|
-
};
|
30
|
-
|
31
|
-
const LocalData = () => {
|
32
|
-
let [index, setIndex] = useState(scope.updateIndex);
|
33
|
-
|
34
|
-
scope.update = () => {
|
35
|
-
scope.updateIndex = ++index;
|
36
|
-
|
37
|
-
setIndex(index);
|
38
|
-
};
|
39
|
-
|
40
|
-
let keyData = scope.key('data');
|
41
|
-
|
42
|
-
const items = Utils.call(() => {
|
43
|
-
let list = Utils.nvl(scope.getItems(), []);
|
44
|
-
|
45
|
-
if (original.search !== false && !original.list?.url) {
|
46
|
-
let query = crud
|
47
|
-
.get('query', '')
|
48
|
-
.toLowerCase()
|
49
|
-
.trim() as string;
|
50
|
-
|
51
|
-
if (query.length > 1) {
|
52
|
-
let filters: any[] = [];
|
53
|
-
let filterBy = Utils.nvl(original.filterBy, 'label');
|
54
|
-
|
55
|
-
Utils.each(list, o => {
|
56
|
-
let label = Utils.getValue(filterBy, 'none', o).toLowerCase();
|
57
|
-
|
58
|
-
if (label) {
|
59
|
-
if (label.includes(query)) {
|
60
|
-
filters.push(o);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
});
|
64
|
-
|
65
|
-
return filters;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
return list;
|
69
|
-
});
|
70
|
-
|
71
|
-
const isShowAdd = () => {
|
72
|
-
if (!Utils.isEmpty(items)) {
|
73
|
-
return true;
|
74
|
-
}
|
75
|
-
return hideAddWhenEmpty !== true;
|
76
|
-
};
|
77
|
-
|
78
|
-
let Empty = () => {
|
79
|
-
if (!Utils.isEmpty(items)) {
|
80
|
-
return <></>;
|
81
|
-
}
|
82
|
-
|
83
|
-
let empty = scope.attr('empty', 'Sem registro');
|
84
|
-
|
85
|
-
if (!empty) {
|
86
|
-
return <></>;
|
87
|
-
}
|
88
|
-
|
89
|
-
if (typeof empty === 'string') {
|
90
|
-
return (
|
91
|
-
<Text
|
92
|
-
style={scope.getStyle('empty', {
|
93
|
-
flex: 1,
|
94
|
-
fontWeight: 500,
|
95
|
-
fontSize: 20,
|
96
|
-
padding: 10,
|
97
|
-
textAlign: 'center',
|
98
|
-
justifyContent: 'center',
|
99
|
-
alignItems: 'center',
|
100
|
-
})}
|
101
|
-
>
|
102
|
-
{empty}
|
103
|
-
</Text>
|
104
|
-
);
|
105
|
-
}
|
106
|
-
|
107
|
-
return <>{empty}</>;
|
108
|
-
};
|
109
|
-
|
110
|
-
return (
|
111
|
-
<View key={keyData} style={getContainerStyle()}>
|
112
|
-
<Empty />
|
113
|
-
{items.map((item: any, i: number) => (
|
114
|
-
<UIListRow index={i} item={item} scope={scope}>
|
115
|
-
{props.children}
|
116
|
-
</UIListRow>
|
117
|
-
))}
|
118
|
-
{isShowAdd() && <>{add}</>}
|
119
|
-
</View>
|
120
|
-
);
|
121
|
-
};
|
122
|
-
|
123
|
-
return (
|
124
|
-
<>
|
125
|
-
{original.search !== false && (
|
126
|
-
<UI.Text
|
127
|
-
placeholder="Pesquisar..."
|
128
|
-
field="query"
|
129
|
-
crud={crud}
|
130
|
-
style={{ marginBottom: 10 }}
|
131
|
-
change={{
|
132
|
-
action: () => {
|
133
|
-
scope.search();
|
134
|
-
},
|
135
|
-
}}
|
136
|
-
icon={<Ionicons name="search" size={20} color="#888" />}
|
137
|
-
/>
|
138
|
-
)}
|
139
|
-
<LocalData />
|
140
|
-
</>
|
141
|
-
);
|
142
|
-
}
|
143
|
-
|
144
|
-
const stylesList = StyleSheet.create({
|
145
|
-
container: {
|
146
|
-
display: 'flex',
|
147
|
-
flexWrap: 'wrap',
|
148
|
-
gap: 10,
|
149
|
-
width: '100%',
|
150
|
-
},
|
151
|
-
text: {
|
152
|
-
fontSize: 18,
|
153
|
-
fontWeight: 'bold',
|
154
|
-
},
|
155
|
-
});
|
156
|
-
|
157
|
-
const stylesRepeat = StyleSheet.create({
|
158
|
-
container: {
|
159
|
-
display: 'flex',
|
160
|
-
flexWrap: 'wrap',
|
161
|
-
gap: 10,
|
162
|
-
width: '100%',
|
163
|
-
},
|
164
|
-
text: {
|
165
|
-
fontSize: 18,
|
166
|
-
fontWeight: 'bold',
|
167
|
-
},
|
168
|
-
});
|
1
|
+
import React, { useState } from 'react';
|
2
|
+
import { ChildType, ComponentUtils, ScopeUtils, 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 { Ionicons } from '@expo/vector-icons';
|
7
|
+
|
8
|
+
export default function UIList(props: ChildType) {
|
9
|
+
const scope = props.scope;
|
10
|
+
const crud = scope.crud;
|
11
|
+
const original = scope.original;
|
12
|
+
const cols = Utils.nvl(scope.getPart('cols', undefined, 1));
|
13
|
+
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
14
|
+
const add = ComponentUtils.getDefine(props, 'add');
|
15
|
+
const hideAddWhenEmpty = original.hideAddWhenEmpty;
|
16
|
+
|
17
|
+
const getStyle = (key: string, extra?: any) => {
|
18
|
+
return scope.getStyle(key, { ...extra, ...styles[key] });
|
19
|
+
};
|
20
|
+
|
21
|
+
const getContainerStyle = (extra?: any) => {
|
22
|
+
let row = getStyle('container', {});
|
23
|
+
|
24
|
+
if (cols > 1) {
|
25
|
+
row = { ...row, flexDirection: 'row', flexWrap: 'wrap' };
|
26
|
+
}
|
27
|
+
|
28
|
+
return row;
|
29
|
+
};
|
30
|
+
|
31
|
+
const LocalData = () => {
|
32
|
+
let [index, setIndex] = useState(scope.updateIndex);
|
33
|
+
|
34
|
+
scope.update = () => {
|
35
|
+
scope.updateIndex = ++index;
|
36
|
+
|
37
|
+
setIndex(index);
|
38
|
+
};
|
39
|
+
|
40
|
+
let keyData = scope.key('data');
|
41
|
+
|
42
|
+
const items = Utils.call(() => {
|
43
|
+
let list = Utils.nvl(scope.getItems(), []);
|
44
|
+
|
45
|
+
if (original.search !== false && !original.list?.url) {
|
46
|
+
let query = crud
|
47
|
+
.get('query', '')
|
48
|
+
.toLowerCase()
|
49
|
+
.trim() as string;
|
50
|
+
|
51
|
+
if (query.length > 1) {
|
52
|
+
let filters: any[] = [];
|
53
|
+
let filterBy = Utils.nvl(original.filterBy, 'label');
|
54
|
+
|
55
|
+
Utils.each(list, o => {
|
56
|
+
let label = Utils.getValue(filterBy, 'none', o).toLowerCase();
|
57
|
+
|
58
|
+
if (label) {
|
59
|
+
if (label.includes(query)) {
|
60
|
+
filters.push(o);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
65
|
+
return filters;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return list;
|
69
|
+
});
|
70
|
+
|
71
|
+
const isShowAdd = () => {
|
72
|
+
if (!Utils.isEmpty(items)) {
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
return hideAddWhenEmpty !== true;
|
76
|
+
};
|
77
|
+
|
78
|
+
let Empty = () => {
|
79
|
+
if (!Utils.isEmpty(items)) {
|
80
|
+
return <></>;
|
81
|
+
}
|
82
|
+
|
83
|
+
let empty = scope.attr('empty', 'Sem registro');
|
84
|
+
|
85
|
+
if (!empty) {
|
86
|
+
return <></>;
|
87
|
+
}
|
88
|
+
|
89
|
+
if (typeof empty === 'string') {
|
90
|
+
return (
|
91
|
+
<Text
|
92
|
+
style={scope.getStyle('empty', {
|
93
|
+
flex: 1,
|
94
|
+
fontWeight: 500,
|
95
|
+
fontSize: 20,
|
96
|
+
padding: 10,
|
97
|
+
textAlign: 'center',
|
98
|
+
justifyContent: 'center',
|
99
|
+
alignItems: 'center',
|
100
|
+
})}
|
101
|
+
>
|
102
|
+
{empty}
|
103
|
+
</Text>
|
104
|
+
);
|
105
|
+
}
|
106
|
+
|
107
|
+
return <>{empty}</>;
|
108
|
+
};
|
109
|
+
|
110
|
+
return (
|
111
|
+
<View key={keyData} style={getContainerStyle()}>
|
112
|
+
<Empty />
|
113
|
+
{items.map((item: any, i: number) => (
|
114
|
+
<UIListRow index={i} item={item} scope={scope}>
|
115
|
+
{props.children}
|
116
|
+
</UIListRow>
|
117
|
+
))}
|
118
|
+
{isShowAdd() && <>{add}</>}
|
119
|
+
</View>
|
120
|
+
);
|
121
|
+
};
|
122
|
+
|
123
|
+
return (
|
124
|
+
<>
|
125
|
+
{original.search !== false && (
|
126
|
+
<UI.Text
|
127
|
+
placeholder="Pesquisar..."
|
128
|
+
field="query"
|
129
|
+
crud={crud}
|
130
|
+
style={{ marginBottom: 10 }}
|
131
|
+
change={{
|
132
|
+
action: () => {
|
133
|
+
scope.search();
|
134
|
+
},
|
135
|
+
}}
|
136
|
+
icon={<Ionicons name="search" size={20} color="#888" />}
|
137
|
+
/>
|
138
|
+
)}
|
139
|
+
<LocalData />
|
140
|
+
</>
|
141
|
+
);
|
142
|
+
}
|
143
|
+
|
144
|
+
const stylesList = StyleSheet.create({
|
145
|
+
container: {
|
146
|
+
display: 'flex',
|
147
|
+
flexWrap: 'wrap',
|
148
|
+
gap: 10,
|
149
|
+
width: '100%',
|
150
|
+
},
|
151
|
+
text: {
|
152
|
+
fontSize: 18,
|
153
|
+
fontWeight: 'bold',
|
154
|
+
},
|
155
|
+
});
|
156
|
+
|
157
|
+
const stylesRepeat = StyleSheet.create({
|
158
|
+
container: {
|
159
|
+
display: 'flex',
|
160
|
+
flexWrap: 'wrap',
|
161
|
+
gap: 10,
|
162
|
+
width: '100%',
|
163
|
+
},
|
164
|
+
text: {
|
165
|
+
fontSize: 18,
|
166
|
+
fontWeight: 'bold',
|
167
|
+
},
|
168
|
+
});
|