react-crud-mobile 1.3.182 → 1.3.184
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 +40 -13
- 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 +40 -13
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIOrder.tsx +33 -5
package/package.json
CHANGED
@@ -60,20 +60,39 @@ export default function UIOrder(props: ChildType) {
|
|
60
60
|
|
61
61
|
//v2
|
62
62
|
|
63
|
-
const renderItem = ({ item, drag, isActive }) => {
|
64
|
-
|
63
|
+
const renderItem = ({ item, drag, isActive, getIndex }) => {
|
64
|
+
const index = getIndex();
|
65
|
+
const name = `${scope.key('row', index, '')}`;
|
66
|
+
const [row] = useState(
|
67
|
+
ScopeUtils.create({
|
68
|
+
...original,
|
69
|
+
parent: scope,
|
70
|
+
name,
|
71
|
+
crud: scope.crud,
|
72
|
+
index,
|
73
|
+
type: 'row',
|
74
|
+
data: item,
|
75
|
+
})
|
76
|
+
);
|
77
|
+
|
78
|
+
let css = { ...scope.getStyle('row') };
|
65
79
|
|
66
80
|
if (isActive) {
|
67
|
-
|
81
|
+
css = { ...css, ...scope.getStyle('active') };
|
68
82
|
}
|
69
83
|
|
84
|
+
if (isActive) {
|
85
|
+
css = { ...css, ...row.getStyle('rowSelected', {}) };
|
86
|
+
} else {
|
87
|
+
css = { ...css, ...row.getStyle('rowUnSelected', {}) };
|
88
|
+
}
|
70
89
|
return (
|
71
90
|
<ScaleDecorator>
|
72
91
|
<TouchableOpacity
|
73
92
|
style={[
|
74
93
|
styles.row,
|
75
94
|
{ backgroundColor: isActive ? 'lightblue' : 'white' },
|
76
|
-
{ ...
|
95
|
+
{ ...css },
|
77
96
|
]}
|
78
97
|
delayLongPress={100}
|
79
98
|
onLongPress={drag} // Initiate drag on long press
|
@@ -102,13 +121,21 @@ export default function UIOrder(props: ChildType) {
|
|
102
121
|
return <>{children}</>;
|
103
122
|
};
|
104
123
|
|
124
|
+
const Header = ({ pos }) => {
|
125
|
+
const hPos = Utils.nvl(original.headerPos, 'outer');
|
126
|
+
|
127
|
+
if (hPos !== pos) return <></>;
|
128
|
+
|
129
|
+
return <UIHeader scope={scope} />;
|
130
|
+
};
|
131
|
+
|
105
132
|
let OrderData = () => {
|
106
133
|
const [data, setData] = useState(items);
|
107
134
|
|
108
135
|
return (
|
109
136
|
<DraggableFlatList
|
110
137
|
data={data}
|
111
|
-
ListHeaderComponent={<
|
138
|
+
ListHeaderComponent={<Header pos="inner" />}
|
112
139
|
ListFooterComponent={<>{scope.getPart('footer')}</>}
|
113
140
|
renderItem={renderItem}
|
114
141
|
containerStyle={{ ...scope.getStyle('list') }}
|
@@ -129,6 +156,7 @@ export default function UIOrder(props: ChildType) {
|
|
129
156
|
};
|
130
157
|
return (
|
131
158
|
<OrderView>
|
159
|
+
<Header pos="outer" />
|
132
160
|
<OrderData />
|
133
161
|
</OrderView>
|
134
162
|
);
|