react-crud-mobile 1.3.232 → 1.3.234
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 +12 -4
- 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 +12 -4
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIList.tsx +16 -6
package/package.json
CHANGED
@@ -13,6 +13,7 @@ export default function UIList(props: ChildType) {
|
|
13
13
|
const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
|
14
14
|
const add = ComponentUtils.getDefine(props, 'add');
|
15
15
|
const hideAddWhenEmpty = original.hideAddWhenEmpty;
|
16
|
+
const hideEmpty = original.hideEmpty;
|
16
17
|
|
17
18
|
//v2
|
18
19
|
const getStyle = (key: string, extra?: any) => {
|
@@ -31,6 +32,7 @@ export default function UIList(props: ChildType) {
|
|
31
32
|
|
32
33
|
const LocalData = () => {
|
33
34
|
let [index, setIndex] = useState(scope.updateIndex);
|
35
|
+
let empty = scope.attr('empty', 'Sem registro');
|
34
36
|
|
35
37
|
scope.update = () => {
|
36
38
|
scope.updateIndex = ++index;
|
@@ -38,8 +40,6 @@ export default function UIList(props: ChildType) {
|
|
38
40
|
setIndex(index);
|
39
41
|
};
|
40
42
|
|
41
|
-
let keyData = scope.key('data');
|
42
|
-
|
43
43
|
const items = Utils.call(() => {
|
44
44
|
let list = Utils.nvl(scope.getItems(), []);
|
45
45
|
|
@@ -69,20 +69,20 @@ export default function UIList(props: ChildType) {
|
|
69
69
|
return list;
|
70
70
|
});
|
71
71
|
|
72
|
+
let isEmpty = Utils.isEmpty(items);
|
73
|
+
|
72
74
|
const isShowAdd = () => {
|
73
|
-
if (!
|
75
|
+
if (!isEmpty) {
|
74
76
|
return true;
|
75
77
|
}
|
76
78
|
return hideAddWhenEmpty !== true;
|
77
79
|
};
|
78
80
|
|
79
81
|
let Empty = () => {
|
80
|
-
if (!
|
82
|
+
if (!isEmpty) {
|
81
83
|
return <></>;
|
82
84
|
}
|
83
85
|
|
84
|
-
let empty = scope.attr('empty', 'Sem registro');
|
85
|
-
|
86
86
|
if (!empty) {
|
87
87
|
return <></>;
|
88
88
|
}
|
@@ -109,6 +109,10 @@ export default function UIList(props: ChildType) {
|
|
109
109
|
return <>{empty}</>;
|
110
110
|
};
|
111
111
|
|
112
|
+
if (empty === false && isEmpty) {
|
113
|
+
return <></>;
|
114
|
+
}
|
115
|
+
|
112
116
|
return (
|
113
117
|
<View style={getContainerStyle()}>
|
114
118
|
<Empty />
|
@@ -122,6 +126,12 @@ export default function UIList(props: ChildType) {
|
|
122
126
|
);
|
123
127
|
};
|
124
128
|
|
129
|
+
let items = Utils.nvl(scope.getItems(), []);
|
130
|
+
|
131
|
+
if (hideEmpty && Utils.isEmpty(items)) {
|
132
|
+
return <></>;
|
133
|
+
}
|
134
|
+
|
125
135
|
return (
|
126
136
|
<>
|
127
137
|
{original.search !== false && (
|