react-crud-mobile 1.0.671 → 1.0.673
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 +1 -1
- 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 +2 -2
- 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 +139 -139
- package/src/elements/UIComplete.tsx +14 -14
- package/src/elements/UIElement.tsx +625 -625
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/SafeView.tsx +63 -63
- package/src/elements/core/UIAutoComplete.tsx +17 -17
- 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/UILink.tsx +17 -17
- package/src/elements/core/UIList.tsx +133 -133
- package/src/elements/core/UIListItem.tsx +32 -32
- package/src/elements/core/UIListRow.tsx +117 -117
- package/src/elements/core/UIModal.tsx +181 -181
- package/src/elements/core/UIOption.tsx +17 -17
- package/src/elements/core/UIQuantity.tsx +97 -97
- package/src/elements/core/UIRadio.tsx +17 -17
- package/src/elements/core/UISelect.tsx +135 -135
- package/src/elements/core/UISwitch.tsx +27 -27
- package/src/elements/core/UIToggle.tsx +102 -102
- package/src/elements/core/UIView.tsx +55 -55
- 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
|
@@ -1,133 +1,133 @@
|
|
|
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(original.cols, 1);
|
|
13
|
-
const items = Utils.nvl(scope.getItems(), []);
|
|
14
|
-
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
|
15
|
-
const add = ComponentUtils.getDefine(props, 'add');
|
|
16
|
-
const hideAddWhenEmpty = original.hideAddWhenEmpty;
|
|
17
|
-
|
|
18
|
-
let [index, setIndex] = useState(0);
|
|
19
|
-
|
|
20
|
-
scope.update = () => {
|
|
21
|
-
scope.updateIndex = ++index;
|
|
22
|
-
|
|
23
|
-
setIndex(index);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getStyle = (key: string, extra?: any) => {
|
|
27
|
-
return scope.getStyle(key, { ...extra, ...styles[key] });
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const getContainerStyle = (extra?: any) => {
|
|
31
|
-
let row = getStyle('container', {});
|
|
32
|
-
|
|
33
|
-
if (cols > 1) {
|
|
34
|
-
row = { ...row, flexDirection: 'row', flexWrap: 'wrap' };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return row;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const isShowAdd = () => {
|
|
41
|
-
if (!Utils.isEmpty(items)) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return hideAddWhenEmpty !== true;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
let Empty = () => {
|
|
48
|
-
if (!Utils.isEmpty(items)) {
|
|
49
|
-
return <></>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let empty = scope.attr('empty', 'Sem registro');
|
|
53
|
-
|
|
54
|
-
if (!empty) {
|
|
55
|
-
return <></>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (typeof empty === 'string') {
|
|
59
|
-
return (
|
|
60
|
-
<Text
|
|
61
|
-
style={scope.getStyle('empty', {
|
|
62
|
-
flex: 1,
|
|
63
|
-
fontWeight: 500,
|
|
64
|
-
fontSize: 20,
|
|
65
|
-
padding: 10,
|
|
66
|
-
textAlign: 'center',
|
|
67
|
-
justifyContent: 'center',
|
|
68
|
-
alignItems: 'center',
|
|
69
|
-
})}
|
|
70
|
-
>
|
|
71
|
-
{empty}
|
|
72
|
-
</Text>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return <>{empty}</>;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
let keyData = scope.key('data');
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
{original.search !== false && (
|
|
84
|
-
<UI.Text
|
|
85
|
-
placeholder="Pesquisar..."
|
|
86
|
-
field="query"
|
|
87
|
-
crud={crud}
|
|
88
|
-
right={<Ionicons name="search" size={20} color="#888" />}
|
|
89
|
-
/>
|
|
90
|
-
)}
|
|
91
|
-
|
|
92
|
-
<View key={keyData} style={getContainerStyle()}>
|
|
93
|
-
<Empty />
|
|
94
|
-
{items.map((item: any, i: number) => (
|
|
95
|
-
<UIListRow index={i} item={item} scope={scope}>
|
|
96
|
-
{props.children}
|
|
97
|
-
</UIListRow>
|
|
98
|
-
))}
|
|
99
|
-
{isShowAdd() && <>{add}</>}
|
|
100
|
-
</View>
|
|
101
|
-
</>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const stylesList = StyleSheet.create({
|
|
106
|
-
container: {
|
|
107
|
-
flex: 1,
|
|
108
|
-
width: '100%',
|
|
109
|
-
flexDirection: 'row',
|
|
110
|
-
flexWrap: 'wrap',
|
|
111
|
-
alignItems: 'stretch',
|
|
112
|
-
gap: 10,
|
|
113
|
-
},
|
|
114
|
-
text: {
|
|
115
|
-
fontSize: 18,
|
|
116
|
-
fontWeight: 'bold',
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const stylesRepeat = StyleSheet.create({
|
|
121
|
-
container: {
|
|
122
|
-
flex: 1,
|
|
123
|
-
width: '100%',
|
|
124
|
-
flexDirection: 'row',
|
|
125
|
-
flexWrap: 'wrap',
|
|
126
|
-
gap: 10,
|
|
127
|
-
alignItems: 'stretch',
|
|
128
|
-
},
|
|
129
|
-
text: {
|
|
130
|
-
fontSize: 18,
|
|
131
|
-
fontWeight: 'bold',
|
|
132
|
-
},
|
|
133
|
-
});
|
|
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(original.cols, 1);
|
|
13
|
+
const items = Utils.nvl(scope.getItems(), []);
|
|
14
|
+
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
|
15
|
+
const add = ComponentUtils.getDefine(props, 'add');
|
|
16
|
+
const hideAddWhenEmpty = original.hideAddWhenEmpty;
|
|
17
|
+
|
|
18
|
+
let [index, setIndex] = useState(0);
|
|
19
|
+
|
|
20
|
+
scope.update = () => {
|
|
21
|
+
scope.updateIndex = ++index;
|
|
22
|
+
|
|
23
|
+
setIndex(index);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getStyle = (key: string, extra?: any) => {
|
|
27
|
+
return scope.getStyle(key, { ...extra, ...styles[key] });
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getContainerStyle = (extra?: any) => {
|
|
31
|
+
let row = getStyle('container', {});
|
|
32
|
+
|
|
33
|
+
if (cols > 1) {
|
|
34
|
+
row = { ...row, flexDirection: 'row', flexWrap: 'wrap' };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return row;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const isShowAdd = () => {
|
|
41
|
+
if (!Utils.isEmpty(items)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return hideAddWhenEmpty !== true;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let Empty = () => {
|
|
48
|
+
if (!Utils.isEmpty(items)) {
|
|
49
|
+
return <></>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let empty = scope.attr('empty', 'Sem registro');
|
|
53
|
+
|
|
54
|
+
if (!empty) {
|
|
55
|
+
return <></>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof empty === 'string') {
|
|
59
|
+
return (
|
|
60
|
+
<Text
|
|
61
|
+
style={scope.getStyle('empty', {
|
|
62
|
+
flex: 1,
|
|
63
|
+
fontWeight: 500,
|
|
64
|
+
fontSize: 20,
|
|
65
|
+
padding: 10,
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
})}
|
|
70
|
+
>
|
|
71
|
+
{empty}
|
|
72
|
+
</Text>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return <>{empty}</>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
let keyData = scope.key('data');
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
{original.search !== false && (
|
|
84
|
+
<UI.Text
|
|
85
|
+
placeholder="Pesquisar..."
|
|
86
|
+
field="query"
|
|
87
|
+
crud={crud}
|
|
88
|
+
right={<Ionicons name="search" size={20} color="#888" />}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
<View key={keyData} style={getContainerStyle()}>
|
|
93
|
+
<Empty />
|
|
94
|
+
{items.map((item: any, i: number) => (
|
|
95
|
+
<UIListRow index={i} item={item} scope={scope}>
|
|
96
|
+
{props.children}
|
|
97
|
+
</UIListRow>
|
|
98
|
+
))}
|
|
99
|
+
{isShowAdd() && <>{add}</>}
|
|
100
|
+
</View>
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const stylesList = StyleSheet.create({
|
|
106
|
+
container: {
|
|
107
|
+
flex: 1,
|
|
108
|
+
width: '100%',
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
flexWrap: 'wrap',
|
|
111
|
+
alignItems: 'stretch',
|
|
112
|
+
gap: 10,
|
|
113
|
+
},
|
|
114
|
+
text: {
|
|
115
|
+
fontSize: 18,
|
|
116
|
+
fontWeight: 'bold',
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const stylesRepeat = StyleSheet.create({
|
|
121
|
+
container: {
|
|
122
|
+
flex: 1,
|
|
123
|
+
width: '100%',
|
|
124
|
+
flexDirection: 'row',
|
|
125
|
+
flexWrap: 'wrap',
|
|
126
|
+
gap: 10,
|
|
127
|
+
alignItems: 'stretch',
|
|
128
|
+
},
|
|
129
|
+
text: {
|
|
130
|
+
fontSize: 18,
|
|
131
|
+
fontWeight: 'bold',
|
|
132
|
+
},
|
|
133
|
+
});
|
|
@@ -1,32 +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
|
+
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,117 +1,117 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
2
|
-
import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
|
|
3
|
-
import UIChildren from '../UIChildren';
|
|
4
|
-
import { StyleSheet, TouchableHighlight, View } from 'react-native';
|
|
5
|
-
import { useIsVisible } from '../../hooks/useIsVisible';
|
|
6
|
-
|
|
7
|
-
interface UIListRowType extends ChildType {
|
|
8
|
-
item: any;
|
|
9
|
-
index: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function UIListRow(props: UIListRowType) {
|
|
13
|
-
const scope = props.scope;
|
|
14
|
-
const index = props.index;
|
|
15
|
-
const original = scope.original;
|
|
16
|
-
const item = props.item;
|
|
17
|
-
const cols = Utils.nvl(original.cols, 1);
|
|
18
|
-
const rowWidth = Math.floor(100 / cols) + '%';
|
|
19
|
-
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
|
20
|
-
const name = `${scope.key('row', index, '')}`;
|
|
21
|
-
const [row] = useState(
|
|
22
|
-
ScopeUtils.create({
|
|
23
|
-
...original,
|
|
24
|
-
parent: scope,
|
|
25
|
-
name,
|
|
26
|
-
crud: scope.crud,
|
|
27
|
-
index,
|
|
28
|
-
type: 'row',
|
|
29
|
-
data: item,
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const targetRef = useRef(null);
|
|
34
|
-
const isVisible = useIsVisible(targetRef, row);
|
|
35
|
-
|
|
36
|
-
const onClick = (item: any) => {
|
|
37
|
-
row.call('click', { value: item, item, edit: true, index });
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const Child = () => {
|
|
41
|
-
if (!isVisible && original.useIsInView && !row.visible && index > 20) {
|
|
42
|
-
return <></>;
|
|
43
|
-
}
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
<UIChildren scope={row} crud={row.crud}>
|
|
47
|
-
{props.children}
|
|
48
|
-
</UIChildren>
|
|
49
|
-
</>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const ListItem = () => {
|
|
54
|
-
let [updateIndex, setUpdateIndex] = useState(0);
|
|
55
|
-
let key = scope.key('item');
|
|
56
|
-
|
|
57
|
-
const getRowStyle = () => {
|
|
58
|
-
let css = row.getStyle('row', { ...styles.row, minHeight: 40 });
|
|
59
|
-
|
|
60
|
-
if (cols > 0) {
|
|
61
|
-
css.width = rowWidth;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return css;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
row.update = () => {
|
|
68
|
-
scope.updateIndex = scope.updateIndex + 1;
|
|
69
|
-
|
|
70
|
-
setUpdateIndex(++updateIndex);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
if (!original.click) {
|
|
74
|
-
return (
|
|
75
|
-
<View key={key} style={getRowStyle()} ref={targetRef}>
|
|
76
|
-
<Child />
|
|
77
|
-
</View>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return (
|
|
81
|
-
<TouchableHighlight
|
|
82
|
-
key={key}
|
|
83
|
-
style={getRowStyle()}
|
|
84
|
-
underlayColor={'transparent'}
|
|
85
|
-
ref={targetRef}
|
|
86
|
-
onPress={e => {
|
|
87
|
-
e.stopPropagation();
|
|
88
|
-
onClick(item);
|
|
89
|
-
}}
|
|
90
|
-
>
|
|
91
|
-
<Child />
|
|
92
|
-
</TouchableHighlight>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return <ListItem />;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const stylesList = StyleSheet.create({
|
|
100
|
-
row: {
|
|
101
|
-
padding: 5,
|
|
102
|
-
margin: 0,
|
|
103
|
-
width: '100%',
|
|
104
|
-
backgroundColor: '#f5f5f5',
|
|
105
|
-
gap: 10,
|
|
106
|
-
borderRadius: 8,
|
|
107
|
-
justifyContent: 'center',
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const stylesRepeat = StyleSheet.create({
|
|
112
|
-
row: {
|
|
113
|
-
padding: 0,
|
|
114
|
-
width: '100%',
|
|
115
|
-
justifyContent: 'center',
|
|
116
|
-
},
|
|
117
|
-
});
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
|
|
3
|
+
import UIChildren from '../UIChildren';
|
|
4
|
+
import { StyleSheet, TouchableHighlight, View } from 'react-native';
|
|
5
|
+
import { useIsVisible } from '../../hooks/useIsVisible';
|
|
6
|
+
|
|
7
|
+
interface UIListRowType extends ChildType {
|
|
8
|
+
item: any;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function UIListRow(props: UIListRowType) {
|
|
13
|
+
const scope = props.scope;
|
|
14
|
+
const index = props.index;
|
|
15
|
+
const original = scope.original;
|
|
16
|
+
const item = props.item;
|
|
17
|
+
const cols = Utils.nvl(original.cols, 1);
|
|
18
|
+
const rowWidth = Math.floor(100 / cols) + '%';
|
|
19
|
+
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
|
20
|
+
const name = `${scope.key('row', index, '')}`;
|
|
21
|
+
const [row] = useState(
|
|
22
|
+
ScopeUtils.create({
|
|
23
|
+
...original,
|
|
24
|
+
parent: scope,
|
|
25
|
+
name,
|
|
26
|
+
crud: scope.crud,
|
|
27
|
+
index,
|
|
28
|
+
type: 'row',
|
|
29
|
+
data: item,
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const targetRef = useRef(null);
|
|
34
|
+
const isVisible = useIsVisible(targetRef, row);
|
|
35
|
+
|
|
36
|
+
const onClick = (item: any) => {
|
|
37
|
+
row.call('click', { value: item, item, edit: true, index });
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const Child = () => {
|
|
41
|
+
if (!isVisible && original.useIsInView && !row.visible && index > 20) {
|
|
42
|
+
return <></>;
|
|
43
|
+
}
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<UIChildren scope={row} crud={row.crud}>
|
|
47
|
+
{props.children}
|
|
48
|
+
</UIChildren>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const ListItem = () => {
|
|
54
|
+
let [updateIndex, setUpdateIndex] = useState(0);
|
|
55
|
+
let key = scope.key('item');
|
|
56
|
+
|
|
57
|
+
const getRowStyle = () => {
|
|
58
|
+
let css = row.getStyle('row', { ...styles.row, minHeight: 40 });
|
|
59
|
+
|
|
60
|
+
if (cols > 0) {
|
|
61
|
+
css.width = rowWidth;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return css;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
row.update = () => {
|
|
68
|
+
scope.updateIndex = scope.updateIndex + 1;
|
|
69
|
+
|
|
70
|
+
setUpdateIndex(++updateIndex);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (!original.click) {
|
|
74
|
+
return (
|
|
75
|
+
<View key={key} style={getRowStyle()} ref={targetRef}>
|
|
76
|
+
<Child />
|
|
77
|
+
</View>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return (
|
|
81
|
+
<TouchableHighlight
|
|
82
|
+
key={key}
|
|
83
|
+
style={getRowStyle()}
|
|
84
|
+
underlayColor={'transparent'}
|
|
85
|
+
ref={targetRef}
|
|
86
|
+
onPress={e => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
onClick(item);
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Child />
|
|
92
|
+
</TouchableHighlight>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return <ListItem />;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const stylesList = StyleSheet.create({
|
|
100
|
+
row: {
|
|
101
|
+
padding: 5,
|
|
102
|
+
margin: 0,
|
|
103
|
+
width: '100%',
|
|
104
|
+
backgroundColor: '#f5f5f5',
|
|
105
|
+
gap: 10,
|
|
106
|
+
borderRadius: 8,
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const stylesRepeat = StyleSheet.create({
|
|
112
|
+
row: {
|
|
113
|
+
padding: 0,
|
|
114
|
+
width: '100%',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
},
|
|
117
|
+
});
|