react-crud-mobile 1.3.99 → 1.3.101

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.
Files changed (33) hide show
  1. package/dist/elements/core/UIStatusBar.d.ts +2 -0
  2. package/dist/react-crud-mobile.cjs.development.js +10 -4
  3. package/dist/react-crud-mobile.cjs.development.js.map +1 -1
  4. package/dist/react-crud-mobile.cjs.production.min.js +1 -1
  5. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
  6. package/dist/react-crud-mobile.esm.js +11 -5
  7. package/dist/react-crud-mobile.esm.js.map +1 -1
  8. package/package.json +77 -76
  9. package/src/elements/UI.tsx +74 -74
  10. package/src/elements/UIChildren.tsx +139 -139
  11. package/src/elements/UIComplete.tsx +14 -14
  12. package/src/elements/UIElement.tsx +788 -788
  13. package/src/elements/UITag.tsx +13 -13
  14. package/src/elements/charts/ElChart.tsx +10 -10
  15. package/src/elements/core/SafeView.tsx +62 -63
  16. package/src/elements/core/UIButton.tsx +139 -139
  17. package/src/elements/core/UIHeader.tsx +38 -38
  18. package/src/elements/core/UIIcon.tsx +25 -25
  19. package/src/elements/core/UIInclude.tsx +40 -40
  20. package/src/elements/core/UIInput.tsx +96 -96
  21. package/src/elements/core/UIList.tsx +168 -168
  22. package/src/elements/core/UIListRow.tsx +123 -123
  23. package/src/elements/core/UIModal.tsx +176 -174
  24. package/src/elements/core/UIOrder.tsx +123 -123
  25. package/src/elements/core/UIQuantity.tsx +98 -98
  26. package/src/elements/core/UISelect.tsx +171 -171
  27. package/src/elements/core/UIStatusBar.tsx +5 -0
  28. package/src/elements/core/UIToast.tsx +44 -44
  29. package/src/elements/core/UIToggle.tsx +102 -102
  30. package/src/elements/core/UIView.tsx +69 -69
  31. package/src/elements/index.ts +1 -1
  32. package/src/elements/tabs/ElTabs.tsx +178 -178
  33. package/src/index.ts +1 -1
@@ -1,13 +1,13 @@
1
- import React, { useState } from "react";
2
- import { Utils } from "react-crud-utils";
3
-
4
- interface UITagType {
5
- name: string;
6
- [otherOptions: string]: unknown;
7
- }
8
-
9
- export default function UITag(props: UITagType) {
10
- let Aux = Utils.nvl(props.name, "span");
11
-
12
- return <Aux {...props} />;
13
- }
1
+ import React, { useState } from "react";
2
+ import { Utils } from "react-crud-utils";
3
+
4
+ interface UITagType {
5
+ name: string;
6
+ [otherOptions: string]: unknown;
7
+ }
8
+
9
+ export default function UITag(props: UITagType) {
10
+ let Aux = Utils.nvl(props.name, "span");
11
+
12
+ return <Aux {...props} />;
13
+ }
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { ChildType, Scope, Utils } from "react-crud-utils";
3
-
4
- export default function ElChart(props: ChildType) {
5
- let scope: Scope = props.scope;
6
- let items: any = scope.getItems();
7
- let columns = Utils.asList(scope.original.columns);
8
-
9
- return <div className="ui-chart-data"></div>;
10
- }
1
+ import React from "react";
2
+ import { ChildType, Scope, Utils } from "react-crud-utils";
3
+
4
+ export default function ElChart(props: ChildType) {
5
+ let scope: Scope = props.scope;
6
+ let items: any = scope.getItems();
7
+ let columns = Utils.asList(scope.original.columns);
8
+
9
+ return <div className="ui-chart-data"></div>;
10
+ }
@@ -1,63 +1,62 @@
1
- import {
2
- Keyboard,
3
- KeyboardAvoidingView,
4
- Platform,
5
- StatusBar,
6
- StyleProp,
7
- TouchableWithoutFeedback,
8
- ViewStyle,
9
- } from 'react-native';
10
- import {
11
- SafeAreaProvider,
12
- SafeAreaView as SafeAreaContextView,
13
- } from 'react-native-safe-area-context';
14
- import { ThemeUtils, useTheme, Utils } from 'react-crud-utils';
15
- import { useEffect } from 'react';
16
-
17
- interface SafeViewType {
18
- safeStyle?: StyleProp<ViewStyle> | any;
19
- viewStyle?: StyleProp<ViewStyle> | any;
20
- children?: any;
21
- }
22
-
23
- export default function SafeView(props: SafeViewType) {
24
- let theme = ThemeUtils.getCurrentTheme();
25
-
26
- if (Utils.isEmpty(theme)) {
27
- theme = useTheme();
28
- }
29
-
30
- const dismissKeyboard = () => {
31
- if (Platform.OS !== 'web') {
32
- Keyboard.dismiss();
33
- }
34
- };
35
-
36
- return (
37
- <SafeAreaProvider>
38
- <StatusBar barStyle="dark-content" />
39
- <SafeAreaContextView
40
- style={{
41
- backgroundColor: theme.colors?.theme,
42
- ...props.viewStyle,
43
- flex: 1,
44
- }}
45
- >
46
- <KeyboardAvoidingView
47
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
48
- style={{
49
- flex: 1, // 🔹 Ocupa 100% da tela
50
- justifyContent: 'center',
51
- }}
52
- >
53
- <TouchableWithoutFeedback
54
- onPress={dismissKeyboard}
55
- accessible={false}
56
- >
57
- <>{props.children}</>
58
- </TouchableWithoutFeedback>
59
- </KeyboardAvoidingView>
60
- </SafeAreaContextView>
61
- </SafeAreaProvider>
62
- );
63
- }
1
+ import {
2
+ Keyboard,
3
+ KeyboardAvoidingView,
4
+ Platform,
5
+ StyleProp,
6
+ TouchableWithoutFeedback,
7
+ ViewStyle,
8
+ } from 'react-native';
9
+ import {
10
+ SafeAreaProvider,
11
+ SafeAreaView as SafeAreaContextView,
12
+ } from 'react-native-safe-area-context';
13
+ import { ThemeUtils, useTheme, Utils } from 'react-crud-utils';
14
+ import UIStatusBar from './UIStatusBar';
15
+
16
+ interface SafeViewType {
17
+ safeStyle?: StyleProp<ViewStyle> | any;
18
+ viewStyle?: StyleProp<ViewStyle> | any;
19
+ children?: any;
20
+ }
21
+
22
+ export default function SafeView(props: SafeViewType) {
23
+ let theme = ThemeUtils.getCurrentTheme();
24
+
25
+ if (Utils.isEmpty(theme)) {
26
+ theme = useTheme();
27
+ }
28
+
29
+ const dismissKeyboard = () => {
30
+ if (Platform.OS !== 'web') {
31
+ Keyboard.dismiss();
32
+ }
33
+ };
34
+
35
+ return (
36
+ <SafeAreaProvider>
37
+ <UIStatusBar />
38
+ <SafeAreaContextView
39
+ style={{
40
+ backgroundColor: theme.colors?.theme,
41
+ ...props.viewStyle,
42
+ flex: 1,
43
+ }}
44
+ >
45
+ <KeyboardAvoidingView
46
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
47
+ style={{
48
+ flex: 1, // 🔹 Ocupa 100% da tela
49
+ justifyContent: 'center',
50
+ }}
51
+ >
52
+ <TouchableWithoutFeedback
53
+ onPress={dismissKeyboard}
54
+ accessible={false}
55
+ >
56
+ <>{props.children}</>
57
+ </TouchableWithoutFeedback>
58
+ </KeyboardAvoidingView>
59
+ </SafeAreaContextView>
60
+ </SafeAreaProvider>
61
+ );
62
+ }
@@ -1,139 +1,139 @@
1
- import { Ionicons } from '@expo/vector-icons';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { Text, TouchableHighlight, View } from 'react-native';
4
-
5
- const BUTTONS_SIZE: any = { small: { minWidth: 30, height: 30 } };
6
-
7
- export default function UIButton(props: ChildType) {
8
- let scope = props.scope;
9
- let element = scope.original;
10
- let size = Utils.nvl(element.size, 'default');
11
- let align = Utils.nvl(element.align, 'center');
12
- let variant = Utils.nvl(element.variant, 'default');
13
-
14
- let color = element.color;
15
- let label = scope.getLabel();
16
- let icon = element.icon;
17
-
18
- //ajuste align v3
19
- if (!color) color = 'primaryLight';
20
-
21
- const styles: any = {
22
- buttonLabel: {
23
- color: '#ffffff',
24
- fontWeight: '500',
25
- fontSize: 16,
26
- },
27
- buttonInner: {
28
- flexDirection: 'row',
29
- alignItems: 'center',
30
- justifyContent: 'center',
31
- height: 44,
32
- minWidth: 44,
33
- },
34
- buttonIcon: {
35
- color: '#fff',
36
- fontSize: 18,
37
- },
38
- button: {
39
- backgroundColor: color,
40
- borderRadius: 24,
41
- gap: 10,
42
- justifyContent: 'center',
43
- alignItems: 'center',
44
- flexDirection: 'row',
45
- },
46
- };
47
-
48
- const onClick = (e: any) => {
49
- scope.call('click', {});
50
- };
51
-
52
- const style = (part: string, extra?: any) => {
53
- let css = { ...styles[part], ...extra };
54
-
55
- if (variant === 'text' || variant === 'outlined') {
56
- css.backgroundColor = 'transparent';
57
- css.color = Utils.nvl(color, 'text');
58
- }
59
-
60
- if (size === 'small') {
61
- css.fontSize = 12;
62
- css.fontWeight = 500;
63
- }
64
-
65
- if (size === 'medium') {
66
- css.fontSize = 14;
67
- css.fontWeight = 500;
68
- }
69
-
70
- if (align === 'left') {
71
- css.justifyContent = 'flex-start';
72
- }
73
-
74
- return scope.getStyle(part, css);
75
- };
76
-
77
- let extra: any = {};
78
-
79
- if (icon) {
80
- extra.button = { height: 40, padding: 0 };
81
- } else {
82
- extra.button = { height: 50 };
83
- }
84
-
85
- const buttonStyle = Utils.call(() => {
86
- let def: any = { ...extra?.button };
87
-
88
- if (variant === 'outlined') {
89
- def.borderWidth = 1;
90
- def.borderColor = Utils.nvl(color, 'text');
91
- }
92
-
93
- if (size) {
94
- def = { ...def, ...BUTTONS_SIZE[size] };
95
- }
96
-
97
- let css = style('button', def);
98
-
99
- if (!css.width) {
100
- let h = css.height;
101
-
102
- if (typeof h === 'number') {
103
- css.minWidth = h;
104
- }
105
- }
106
-
107
- return css;
108
- });
109
-
110
- const buttonLabel = style('buttonLabel');
111
- const iconStyle = Utils.call(() => {
112
- let css: any = style('buttonIcon', extra.icon);
113
-
114
- css.fontSize = Utils.nvl(buttonLabel.fontSize, css.fontSize);
115
-
116
- return css;
117
- });
118
-
119
- return (
120
- <TouchableHighlight
121
- underlayColor={'transparent'}
122
- onPress={onClick}
123
- style={buttonStyle}
124
- >
125
- <>
126
- {icon && (
127
- <>
128
- <Ionicons
129
- size={Utils.nvl(element.iconSize, 30)}
130
- style={iconStyle}
131
- name={icon}
132
- />
133
- </>
134
- )}
135
- {label && <Text style={buttonLabel}>{label}</Text>}
136
- </>
137
- </TouchableHighlight>
138
- );
139
- }
1
+ import { Ionicons } from '@expo/vector-icons';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { Text, TouchableHighlight, View } from 'react-native';
4
+
5
+ const BUTTONS_SIZE: any = { small: { minWidth: 30, height: 30 } };
6
+
7
+ export default function UIButton(props: ChildType) {
8
+ let scope = props.scope;
9
+ let element = scope.original;
10
+ let size = Utils.nvl(element.size, 'default');
11
+ let align = Utils.nvl(element.align, 'center');
12
+ let variant = Utils.nvl(element.variant, 'default');
13
+
14
+ let color = element.color;
15
+ let label = scope.getLabel();
16
+ let icon = element.icon;
17
+
18
+ //ajuste align v3
19
+ if (!color) color = 'primaryLight';
20
+
21
+ const styles: any = {
22
+ buttonLabel: {
23
+ color: '#ffffff',
24
+ fontWeight: '500',
25
+ fontSize: 16,
26
+ },
27
+ buttonInner: {
28
+ flexDirection: 'row',
29
+ alignItems: 'center',
30
+ justifyContent: 'center',
31
+ height: 44,
32
+ minWidth: 44,
33
+ },
34
+ buttonIcon: {
35
+ color: '#fff',
36
+ fontSize: 18,
37
+ },
38
+ button: {
39
+ backgroundColor: color,
40
+ borderRadius: 24,
41
+ gap: 10,
42
+ justifyContent: 'center',
43
+ alignItems: 'center',
44
+ flexDirection: 'row',
45
+ },
46
+ };
47
+
48
+ const onClick = (e: any) => {
49
+ scope.call('click', {});
50
+ };
51
+
52
+ const style = (part: string, extra?: any) => {
53
+ let css = { ...styles[part], ...extra };
54
+
55
+ if (variant === 'text' || variant === 'outlined') {
56
+ css.backgroundColor = 'transparent';
57
+ css.color = Utils.nvl(color, 'text');
58
+ }
59
+
60
+ if (size === 'small') {
61
+ css.fontSize = 12;
62
+ css.fontWeight = 500;
63
+ }
64
+
65
+ if (size === 'medium') {
66
+ css.fontSize = 14;
67
+ css.fontWeight = 500;
68
+ }
69
+
70
+ if (align === 'left') {
71
+ css.justifyContent = 'flex-start';
72
+ }
73
+
74
+ return scope.getStyle(part, css);
75
+ };
76
+
77
+ let extra: any = {};
78
+
79
+ if (icon) {
80
+ extra.button = { height: 40, padding: 0 };
81
+ } else {
82
+ extra.button = { height: 50 };
83
+ }
84
+
85
+ const buttonStyle = Utils.call(() => {
86
+ let def: any = { ...extra?.button };
87
+
88
+ if (variant === 'outlined') {
89
+ def.borderWidth = 1;
90
+ def.borderColor = Utils.nvl(color, 'text');
91
+ }
92
+
93
+ if (size) {
94
+ def = { ...def, ...BUTTONS_SIZE[size] };
95
+ }
96
+
97
+ let css = style('button', def);
98
+
99
+ if (!css.width) {
100
+ let h = css.height;
101
+
102
+ if (typeof h === 'number') {
103
+ css.minWidth = h;
104
+ }
105
+ }
106
+
107
+ return css;
108
+ });
109
+
110
+ const buttonLabel = style('buttonLabel');
111
+ const iconStyle = Utils.call(() => {
112
+ let css: any = style('buttonIcon', extra.icon);
113
+
114
+ css.fontSize = Utils.nvl(buttonLabel.fontSize, css.fontSize);
115
+
116
+ return css;
117
+ });
118
+
119
+ return (
120
+ <TouchableHighlight
121
+ underlayColor={'transparent'}
122
+ onPress={onClick}
123
+ style={buttonStyle}
124
+ >
125
+ <>
126
+ {icon && (
127
+ <>
128
+ <Ionicons
129
+ size={Utils.nvl(element.iconSize, 30)}
130
+ style={iconStyle}
131
+ name={icon}
132
+ />
133
+ </>
134
+ )}
135
+ {label && <Text style={buttonLabel}>{label}</Text>}
136
+ </>
137
+ </TouchableHighlight>
138
+ );
139
+ }
@@ -1,38 +1,38 @@
1
- import { Text, View } from 'react-native';
2
-
3
- import { ChildType, HtmlUtils, Utils } from 'react-crud-utils';
4
-
5
- export default function UIHeader({ scope }: ChildType) {
6
- const theme = scope.getTheme();
7
- const header = scope.getPart('header', null, []);
8
- const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
9
- const headerTextStyle = Utils.nvl(theme.styles?.defaults?.headerText, {});
10
-
11
- let headerStyleFull = Utils.call(() => {
12
- let css = scope.getStyle('header', headerStyle);
13
- let bg = css.backgroundColor;
14
-
15
- if (bg) {
16
- css.color = HtmlUtils.getTextColor(bg);
17
- }
18
- return css;
19
- });
20
-
21
- let hasHeader = !Utils.isEmpty(header);
22
- let AuxHeader = () => {
23
- if (typeof header === 'string') {
24
- return <Text style={headerTextStyle}>{header}</Text>;
25
- }
26
- return <>{header}</>;
27
- };
28
-
29
- return (
30
- <>
31
- {hasHeader && (
32
- <View style={headerStyleFull}>
33
- <AuxHeader />
34
- </View>
35
- )}
36
- </>
37
- );
38
- }
1
+ import { Text, View } from 'react-native';
2
+
3
+ import { ChildType, HtmlUtils, Utils } from 'react-crud-utils';
4
+
5
+ export default function UIHeader({ scope }: ChildType) {
6
+ const theme = scope.getTheme();
7
+ const header = scope.getPart('header', null, []);
8
+ const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
9
+ const headerTextStyle = Utils.nvl(theme.styles?.defaults?.headerText, {});
10
+
11
+ let headerStyleFull = Utils.call(() => {
12
+ let css = scope.getStyle('header', headerStyle);
13
+ let bg = css.backgroundColor;
14
+
15
+ if (bg) {
16
+ css.color = HtmlUtils.getTextColor(bg);
17
+ }
18
+ return css;
19
+ });
20
+
21
+ let hasHeader = !Utils.isEmpty(header);
22
+ let AuxHeader = () => {
23
+ if (typeof header === 'string') {
24
+ return <Text style={headerTextStyle}>{header}</Text>;
25
+ }
26
+ return <>{header}</>;
27
+ };
28
+
29
+ return (
30
+ <>
31
+ {hasHeader && (
32
+ <View style={headerStyleFull}>
33
+ <AuxHeader />
34
+ </View>
35
+ )}
36
+ </>
37
+ );
38
+ }
@@ -1,25 +1,25 @@
1
- import {
2
- Ionicons,
3
- MaterialCommunityIcons,
4
- AntDesign,
5
- Entypo,
6
- EvilIcons,
7
- } from '@expo/vector-icons';
8
-
9
- import { ChildType, Utils } from 'react-crud-utils';
10
-
11
- export default function UIIcon({ scope }: ChildType) {
12
- let name = scope.getValue();
13
- let libs: any = {
14
- ion: Ionicons,
15
- ant: AntDesign,
16
- entypo: Entypo,
17
- evil: EvilIcons,
18
- material: MaterialCommunityIcons,
19
- };
20
-
21
- let library = Utils.nvl(scope.original.library, 'ion');
22
- let Aux = libs[library];
23
-
24
- return <Aux name={name} style={scope.getStyle('icon')} />;
25
- }
1
+ import {
2
+ Ionicons,
3
+ MaterialCommunityIcons,
4
+ AntDesign,
5
+ Entypo,
6
+ EvilIcons,
7
+ } from '@expo/vector-icons';
8
+
9
+ import { ChildType, Utils } from 'react-crud-utils';
10
+
11
+ export default function UIIcon({ scope }: ChildType) {
12
+ let name = scope.getValue();
13
+ let libs: any = {
14
+ ion: Ionicons,
15
+ ant: AntDesign,
16
+ entypo: Entypo,
17
+ evil: EvilIcons,
18
+ material: MaterialCommunityIcons,
19
+ };
20
+
21
+ let library = Utils.nvl(scope.original.library, 'ion');
22
+ let Aux = libs[library];
23
+
24
+ return <Aux name={name} style={scope.getStyle('icon')} />;
25
+ }
@@ -1,40 +1,40 @@
1
- import UIChildren from '../UIChildren';
2
- import { ComponentUtils, DefineType, Utils } from 'react-crud-utils';
3
-
4
- export default function UIInclude(props: DefineType) {
5
- if (props.rendered === false) {
6
- return <></>;
7
- }
8
-
9
- let includes = ComponentUtils.getDefine(props, props.name, props.position);
10
-
11
- if (Utils.isEmpty(includes)) {
12
- includes = props.default;
13
- }
14
-
15
- if (!Utils.isEmpty(includes)) {
16
- let Aux = (tagProp: any) => {
17
- let Tag: any = props.tag;
18
-
19
- if (!Utils.isEmpty(Tag)) {
20
- return <Tag {...tagProp}>{tagProp.children}</Tag>;
21
- }
22
- return <>{tagProp.children}</>;
23
- };
24
-
25
- return (
26
- <Aux {...props.tagProps}>
27
- <UIChildren
28
- transient
29
- {...props}
30
- scope={props.scope}
31
- crud={props.crud}
32
- part={props.name}
33
- >
34
- {includes}
35
- </UIChildren>
36
- </Aux>
37
- );
38
- }
39
- return <>{includes}</>;
40
- }
1
+ import UIChildren from '../UIChildren';
2
+ import { ComponentUtils, DefineType, Utils } from 'react-crud-utils';
3
+
4
+ export default function UIInclude(props: DefineType) {
5
+ if (props.rendered === false) {
6
+ return <></>;
7
+ }
8
+
9
+ let includes = ComponentUtils.getDefine(props, props.name, props.position);
10
+
11
+ if (Utils.isEmpty(includes)) {
12
+ includes = props.default;
13
+ }
14
+
15
+ if (!Utils.isEmpty(includes)) {
16
+ let Aux = (tagProp: any) => {
17
+ let Tag: any = props.tag;
18
+
19
+ if (!Utils.isEmpty(Tag)) {
20
+ return <Tag {...tagProp}>{tagProp.children}</Tag>;
21
+ }
22
+ return <>{tagProp.children}</>;
23
+ };
24
+
25
+ return (
26
+ <Aux {...props.tagProps}>
27
+ <UIChildren
28
+ transient
29
+ {...props}
30
+ scope={props.scope}
31
+ crud={props.crud}
32
+ part={props.name}
33
+ >
34
+ {includes}
35
+ </UIChildren>
36
+ </Aux>
37
+ );
38
+ }
39
+ return <>{includes}</>;
40
+ }