react-crud-mobile 1.1.3 → 1.3.2
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/elements/UI.d.ts +47 -0
- package/dist/elements/UIChildren.d.ts +15 -0
- package/dist/elements/UIComplete.d.ts +3 -0
- package/dist/elements/UIElement.d.ts +3 -0
- package/dist/elements/UITag.d.ts +7 -0
- package/dist/elements/charts/ElChart.d.ts +3 -0
- package/dist/elements/core/SafeView.d.ts +9 -0
- package/dist/elements/core/UIAutoComplete.d.ts +2 -0
- package/dist/elements/core/UIButton.d.ts +3 -0
- package/dist/elements/core/UIIcon.d.ts +3 -0
- package/dist/elements/core/UIInclude.d.ts +3 -0
- package/dist/elements/core/UIInput.d.ts +3 -0
- package/dist/elements/core/UILink.d.ts +2 -0
- package/dist/elements/core/UIList.d.ts +3 -0
- package/dist/elements/core/UIListItem.d.ts +7 -0
- package/dist/elements/core/UIListRow.d.ts +8 -0
- package/dist/elements/core/UIModal.d.ts +3 -0
- package/dist/elements/core/UIOption.d.ts +2 -0
- package/dist/elements/core/UIQuantity.d.ts +3 -0
- package/dist/elements/core/UIRadio.d.ts +2 -0
- package/dist/elements/core/UISelect.d.ts +3 -0
- package/dist/elements/core/UISlider.d.ts +3 -0
- package/dist/elements/core/UISwitch.d.ts +3 -0
- package/dist/elements/core/UIToast.d.ts +2 -0
- package/dist/elements/core/UIToggle.d.ts +3 -0
- package/dist/elements/core/UIView.d.ts +3 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/tabs/ElTabs.d.ts +3 -0
- package/dist/hooks/useIsVisible.d.ts +2 -0
- package/dist/index.d.ts +1 -2
- package/dist/react-crud-mobile.cjs.development.js +2367 -0
- package/dist/react-crud-mobile.cjs.development.js.map +1 -0
- package/dist/react-crud-mobile.cjs.production.min.js +2 -0
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -0
- package/dist/react-crud-mobile.esm.js +2359 -0
- package/dist/react-crud-mobile.esm.js.map +1 -0
- package/dist/utils/MobileUtils.d.ts +3 -0
- package/package.json +54 -30
- package/src/elements/UI.tsx +34 -18
- package/src/elements/UIChildren.tsx +38 -16
- package/src/elements/UIComplete.tsx +1 -2
- package/src/elements/UIElement.tsx +542 -225
- package/src/elements/core/SafeView.tsx +69 -0
- package/src/elements/core/{Link.tsx → UIAutoComplete.tsx} +17 -18
- package/src/elements/core/UIButton.tsx +139 -0
- package/src/elements/core/UIIcon.tsx +25 -0
- package/src/elements/{grid/ElInclude.tsx → core/UIInclude.tsx} +3 -3
- package/src/elements/core/UIInput.tsx +96 -0
- package/src/elements/core/{Icon.tsx → UILink.tsx} +17 -18
- package/src/elements/core/UIList.tsx +168 -0
- package/src/elements/core/UIListItem.tsx +32 -0
- package/src/elements/core/UIListRow.tsx +123 -0
- package/src/elements/core/UIModal.tsx +204 -0
- package/src/elements/core/{Input.tsx → UIOption.tsx} +17 -18
- package/src/elements/core/UIQuantity.tsx +98 -0
- package/src/elements/core/{Radio.tsx → UIRadio.tsx} +17 -18
- package/src/elements/core/UISelect.tsx +135 -0
- package/src/elements/core/UISlider.tsx +61 -0
- package/src/elements/core/UISwitch.tsx +27 -0
- package/src/elements/core/UIToast.tsx +44 -0
- package/src/elements/core/UIToggle.tsx +102 -0
- package/src/elements/core/UIView.tsx +94 -0
- package/src/elements/grid/ElInclude +0 -0
- package/src/hooks/useIsVisible.ts +39 -0
- package/src/index.ts +1 -1
- package/src/utils/MobileUtils.ts +12 -0
- package/src/elements/card/ElCard.tsx +0 -26
- package/src/elements/core/AutoComplete.tsx +0 -18
- package/src/elements/core/Button.tsx +0 -18
- package/src/elements/core/Option.tsx +0 -18
- package/src/elements/core/Select.tsx +0 -18
- package/src/elements/core/Switch.tsx +0 -18
- package/src/elements/grid/ElGrid.tsx +0 -50
- package/src/elements/grid/ElGridBotom.tsx +0 -21
- package/src/elements/grid/ElGridCheck.tsx +0 -67
- package/src/elements/grid/ElGridColumn.tsx +0 -32
- package/src/elements/grid/ElGridFilter.tsx +0 -5
- package/src/elements/grid/ElGridPaginator.tsx +0 -82
- package/src/elements/grid/ElGridRow.tsx +0 -123
- package/src/elements/grid/ElGridTop.tsx +0 -45
- package/src/elements/grid/ElLabel.tsx +0 -50
- package/src/elements/grid/ElRepeat.tsx +0 -24
- package/src/elements/grid/ElRepeatRow.tsx +0 -40
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import UIElement from
|
|
3
|
-
import { Crud, Scope, ScopeUtils, Utils } from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import UIElement from './UIElement';
|
|
3
|
+
import { Crud, Scope, ScopeUtils, Utils } from 'react-crud-utils';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
5
|
|
|
5
6
|
interface UIChildrenType {
|
|
6
7
|
scope: Scope;
|
|
@@ -10,14 +11,15 @@ interface UIChildrenType {
|
|
|
10
11
|
elements?: any;
|
|
11
12
|
transient?: boolean;
|
|
12
13
|
part?: string;
|
|
14
|
+
style?: any;
|
|
13
15
|
childProps?: any;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export default function UIChildren(props: UIChildrenType) {
|
|
17
19
|
let [scope] = useState(Utils.nvl(props.scope, ScopeUtils.create(props)));
|
|
18
20
|
let crud = Utils.nvl(props.crud, scope.crud);
|
|
19
|
-
let validateScope = Utils.nvl(props.validateScope,
|
|
20
|
-
let name = Utils.nvl(props.part,
|
|
21
|
+
let validateScope = Utils.nvl(props.validateScope, 'global');
|
|
22
|
+
let name = Utils.nvl(props.part, 'child');
|
|
21
23
|
|
|
22
24
|
if (scope.isInput()) {
|
|
23
25
|
return <></>;
|
|
@@ -27,7 +29,7 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
27
29
|
if (!child) {
|
|
28
30
|
return <></>;
|
|
29
31
|
}
|
|
30
|
-
if (typeof child ===
|
|
32
|
+
if (typeof child === 'string') {
|
|
31
33
|
return <>{child}</>;
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -36,7 +38,7 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
36
38
|
|
|
37
39
|
delete pps.children;
|
|
38
40
|
|
|
39
|
-
if (typeof Custom ===
|
|
41
|
+
if (typeof Custom === 'string') {
|
|
40
42
|
if (Utils.isEmpty(child.props.children)) {
|
|
41
43
|
return <Custom {...pps} />;
|
|
42
44
|
}
|
|
@@ -51,7 +53,7 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
51
53
|
></UIChildren>
|
|
52
54
|
</Custom>
|
|
53
55
|
);
|
|
54
|
-
} else if (typeof Custom ===
|
|
56
|
+
} else if (typeof Custom === 'function') {
|
|
55
57
|
return (
|
|
56
58
|
<Custom
|
|
57
59
|
validateScope={validateScope}
|
|
@@ -62,7 +64,7 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
if (!Utils.isEmpty(child.props
|
|
67
|
+
if (!Utils.isEmpty(child.props?.children)) {
|
|
66
68
|
return (
|
|
67
69
|
<UIChildren
|
|
68
70
|
validateScope={validateScope}
|
|
@@ -88,7 +90,7 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
88
90
|
}
|
|
89
91
|
return (
|
|
90
92
|
<>
|
|
91
|
-
{React.Children.map(props.children,
|
|
93
|
+
{React.Children.map(props.children, child => {
|
|
92
94
|
return <Paint child={child}></Paint>;
|
|
93
95
|
})}
|
|
94
96
|
</>
|
|
@@ -103,15 +105,35 @@ export default function UIChildren(props: UIChildrenType) {
|
|
|
103
105
|
return <></>;
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
const getStyle = (part?: string) => {
|
|
109
|
+
let key = Utils.nvl(part, 'root');
|
|
110
|
+
let def = styles[key];
|
|
111
|
+
let css = {};
|
|
112
|
+
|
|
113
|
+
if (!Utils.isEmpty(props.style)) {
|
|
114
|
+
if (props.style?.push) {
|
|
115
|
+
Utils.each(props.style, s => {
|
|
116
|
+
if (s) {
|
|
117
|
+
css = { ...css, ...s };
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
css = { ...props.style };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { ...def, ...css, ...scope.getStyle(part) };
|
|
125
|
+
};
|
|
126
|
+
|
|
106
127
|
return (
|
|
107
128
|
<>
|
|
108
|
-
<
|
|
109
|
-
className={scope.getStyleClass(name)}
|
|
110
|
-
style={scope.getStyle(name)}
|
|
111
|
-
{...props.childProps}
|
|
112
|
-
>
|
|
129
|
+
<View style={getStyle(name)}>
|
|
113
130
|
<Draw />
|
|
114
|
-
</
|
|
131
|
+
</View>
|
|
115
132
|
</>
|
|
116
133
|
);
|
|
117
134
|
}
|
|
135
|
+
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
child: { width: '100%' },
|
|
138
|
+
inner: { width: '100%' },
|
|
139
|
+
});
|