react-crud-mobile 1.1.2 → 1.3.1
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 +2364 -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 +2356 -0
- package/dist/react-crud-mobile.esm.js.map +1 -0
- package/dist/utils/MobileUtils.d.ts +3 -0
- package/package.json +75 -50
- package/src/elements/UI.tsx +73 -57
- package/src/elements/UIChildren.tsx +139 -117
- package/src/elements/UIComplete.tsx +14 -15
- package/src/elements/UIElement.tsx +692 -379
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/SafeView.tsx +69 -0
- package/src/elements/core/{Link.tsx → UIAutoComplete.tsx} +1 -2
- 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} +40 -40
- package/src/elements/core/UIInput.tsx +96 -0
- package/src/elements/core/{Icon.tsx → UILink.tsx} +1 -2
- 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} +1 -2
- package/src/elements/core/UIQuantity.tsx +98 -0
- package/src/elements/core/{Radio.tsx → UIRadio.tsx} +1 -2
- 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/elements/index.ts +1 -1
- package/src/elements/tabs/ElTabs.tsx +178 -178
- 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
package/src/elements/UI.tsx
CHANGED
|
@@ -1,57 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
1
|
+
import {
|
|
2
|
+
ListType,
|
|
3
|
+
UserType,
|
|
4
|
+
InputType,
|
|
5
|
+
ChartType,
|
|
6
|
+
ContainerType,
|
|
7
|
+
ListInputType,
|
|
8
|
+
TabsType,
|
|
9
|
+
DefineType,
|
|
10
|
+
ButtonType,
|
|
11
|
+
IconType,
|
|
12
|
+
LinkType,
|
|
13
|
+
SliderType,
|
|
14
|
+
} from 'react-crud-utils';
|
|
15
|
+
import UIElement from './UIElement';
|
|
16
|
+
|
|
17
|
+
import UIInclude from './core/UIInclude';
|
|
18
|
+
import SafeView from './core/SafeView';
|
|
19
|
+
|
|
20
|
+
const UI = {
|
|
21
|
+
List: (props: ListType) => <UIElement {...props} type="list" />,
|
|
22
|
+
Row: (props: UserType) => <UIElement {...props} type="row" />,
|
|
23
|
+
Value: (props: UserType) => <UIElement {...props} type="value" />,
|
|
24
|
+
Label: (props: UserType) => <UIElement {...props} type="label" />,
|
|
25
|
+
Repeat: (props: ListType) => (
|
|
26
|
+
<UIElement {...props} type="repeat" props={{ search: false }} />
|
|
27
|
+
),
|
|
28
|
+
Define: (props: DefineType) => <UIElement {...props} type="define" />,
|
|
29
|
+
Include: (props: DefineType) => <UIInclude {...props} />,
|
|
30
|
+
Column: ({ type = 'column', ...props }: UserType) => (
|
|
31
|
+
<UIElement {...props} type="column" />
|
|
32
|
+
),
|
|
33
|
+
Input: (props: InputType) => <UIElement {...props} />,
|
|
34
|
+
Text: (props: InputType) => <UIElement {...props} type="text" />,
|
|
35
|
+
Email: (props: InputType) => <UIElement {...props} type="email" />,
|
|
36
|
+
Button: (props: ButtonType) => <UIElement {...props} type="button" />,
|
|
37
|
+
Link: (props: LinkType) => <UIElement {...props} type="link" />,
|
|
38
|
+
Icon: (props: IconType) => <UIElement {...props} type="icon" />,
|
|
39
|
+
Output: (props: ContainerType) => <UIElement {...props} type="output" />,
|
|
40
|
+
Form: (props: ContainerType) => <UIElement {...props} type="form" />,
|
|
41
|
+
Crud: (props: ContainerType) => <UIElement {...props} type="crud" />,
|
|
42
|
+
View: (props: ContainerType) => (
|
|
43
|
+
<UIElement {...props} type="view" transient />
|
|
44
|
+
),
|
|
45
|
+
Bottom: (props: ContainerType) => <UIElement {...props} type="bottom" />,
|
|
46
|
+
Dialog: (props: ContainerType) => <UIElement {...props} type="dialog" />,
|
|
47
|
+
Content: (props: ContainerType) => <UIElement {...props} type="content" />,
|
|
48
|
+
Top: (props: ContainerType) => <UIElement {...props} type="top" />,
|
|
49
|
+
Card: (props: ContainerType) => <UIElement {...props} type="card" />,
|
|
50
|
+
Tab: (props: ContainerType) => <UIElement {...props} type="tab" />,
|
|
51
|
+
Tabs: (props: TabsType) => <UIElement {...props} type="tabs" />,
|
|
52
|
+
Step: (props: ContainerType) => (
|
|
53
|
+
<UIElement {...props} type="tab" layout="step" />
|
|
54
|
+
),
|
|
55
|
+
Stepper: (props: TabsType) => (
|
|
56
|
+
<UIElement {...props} type="tabs" layout="stepper" />
|
|
57
|
+
),
|
|
58
|
+
Money: (props: InputType) => <UIElement {...props} type="money" />,
|
|
59
|
+
Chart: (props: ChartType) => <UIElement {...props} type="chart" />,
|
|
60
|
+
Password: (props: InputType) => <UIElement {...props} type="password" />,
|
|
61
|
+
Complete: (props: InputType) => <UIElement {...props} type="complete" />,
|
|
62
|
+
Checkbox: (props: InputType) => <UIElement {...props} type="switch" />,
|
|
63
|
+
Switch: (props: InputType) => <UIElement {...props} type="switch" />,
|
|
64
|
+
Radio: (props: ListInputType) => <UIElement {...props} type="radio" />,
|
|
65
|
+
Select: (props: ListInputType) => <UIElement {...props} type="select" />,
|
|
66
|
+
Toggle: (props: ListInputType) => <UIElement {...props} type="toggle" />,
|
|
67
|
+
Entity: (props: ListInputType) => <UIElement {...props} type="entity" />,
|
|
68
|
+
Element: (props: ListInputType) => <UIElement {...props} type="element" />,
|
|
69
|
+
Quantity: (props: ListInputType) => <UIElement {...props} type="quantity" />,
|
|
70
|
+
Slider: (props: SliderType) => <UIElement {...props} type="slider" />,
|
|
71
|
+
SafeView: SafeView,
|
|
72
|
+
};
|
|
73
|
+
export default UI;
|
|
@@ -1,117 +1,139 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import UIElement from
|
|
3
|
-
import { Crud, Scope, ScopeUtils, Utils } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
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';
|
|
5
|
+
|
|
6
|
+
interface UIChildrenType {
|
|
7
|
+
scope: Scope;
|
|
8
|
+
crud?: Crud;
|
|
9
|
+
validateScope?: String;
|
|
10
|
+
children?: any;
|
|
11
|
+
elements?: any;
|
|
12
|
+
transient?: boolean;
|
|
13
|
+
part?: string;
|
|
14
|
+
style?: any;
|
|
15
|
+
childProps?: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function UIChildren(props: UIChildrenType) {
|
|
19
|
+
let [scope] = useState(Utils.nvl(props.scope, ScopeUtils.create(props)));
|
|
20
|
+
let crud = Utils.nvl(props.crud, scope.crud);
|
|
21
|
+
let validateScope = Utils.nvl(props.validateScope, 'global');
|
|
22
|
+
let name = Utils.nvl(props.part, 'child');
|
|
23
|
+
|
|
24
|
+
if (scope.isInput()) {
|
|
25
|
+
return <></>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let Paint = ({ child }: any) => {
|
|
29
|
+
if (!child) {
|
|
30
|
+
return <></>;
|
|
31
|
+
}
|
|
32
|
+
if (typeof child === 'string') {
|
|
33
|
+
return <>{child}</>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let Custom = child.type;
|
|
37
|
+
let pps = { ...child.props };
|
|
38
|
+
|
|
39
|
+
delete pps.children;
|
|
40
|
+
|
|
41
|
+
if (typeof Custom === 'string') {
|
|
42
|
+
if (Utils.isEmpty(child.props.children)) {
|
|
43
|
+
return <Custom {...pps} />;
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<Custom {...pps}>
|
|
47
|
+
<UIChildren
|
|
48
|
+
transient
|
|
49
|
+
validateScope={validateScope}
|
|
50
|
+
{...child.props}
|
|
51
|
+
scope={scope}
|
|
52
|
+
crud={crud}
|
|
53
|
+
></UIChildren>
|
|
54
|
+
</Custom>
|
|
55
|
+
);
|
|
56
|
+
} else if (typeof Custom === 'function') {
|
|
57
|
+
return (
|
|
58
|
+
<Custom
|
|
59
|
+
validateScope={validateScope}
|
|
60
|
+
{...child.props}
|
|
61
|
+
parent={scope}
|
|
62
|
+
crud={crud}
|
|
63
|
+
></Custom>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!Utils.isEmpty(child.props?.children)) {
|
|
68
|
+
return (
|
|
69
|
+
<UIChildren
|
|
70
|
+
validateScope={validateScope}
|
|
71
|
+
{...child.props}
|
|
72
|
+
scope={scope}
|
|
73
|
+
crud={crud}
|
|
74
|
+
transient
|
|
75
|
+
></UIChildren>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return <></>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const Draw = () => {
|
|
82
|
+
if (props.elements) {
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
{Object.entries(props.elements).map((t: any, k) => {
|
|
86
|
+
return <UIElement crud={crud} {...t[1]} />;
|
|
87
|
+
})}
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
{React.Children.map(props.children, child => {
|
|
94
|
+
return <Paint child={child}></Paint>;
|
|
95
|
+
})}
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
if (props.transient) {
|
|
101
|
+
return <Draw />;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (Utils.isEmpty(props.children) && Utils.isEmpty(props.elements)) {
|
|
105
|
+
return <></>;
|
|
106
|
+
}
|
|
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
|
+
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<View style={getStyle(name)}>
|
|
130
|
+
<Draw />
|
|
131
|
+
</View>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
child: { width: '100%' },
|
|
138
|
+
inner: { width: '100%' },
|
|
139
|
+
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
1
|
+
import { ChildType } from 'react-crud-utils';
|
|
2
|
+
import AutoComplete from './core/UIAutoComplete';
|
|
3
|
+
|
|
4
|
+
export default function UIComplete({
|
|
5
|
+
defaultsInput,
|
|
6
|
+
defaultsUI,
|
|
7
|
+
scope,
|
|
8
|
+
}: ChildType) {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<AutoComplete {...defaultsInput} {...defaultsUI} />
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
}
|