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.
Files changed (87) hide show
  1. package/dist/elements/UI.d.ts +47 -0
  2. package/dist/elements/UIChildren.d.ts +15 -0
  3. package/dist/elements/UIComplete.d.ts +3 -0
  4. package/dist/elements/UIElement.d.ts +3 -0
  5. package/dist/elements/UITag.d.ts +7 -0
  6. package/dist/elements/charts/ElChart.d.ts +3 -0
  7. package/dist/elements/core/SafeView.d.ts +9 -0
  8. package/dist/elements/core/UIAutoComplete.d.ts +2 -0
  9. package/dist/elements/core/UIButton.d.ts +3 -0
  10. package/dist/elements/core/UIIcon.d.ts +3 -0
  11. package/dist/elements/core/UIInclude.d.ts +3 -0
  12. package/dist/elements/core/UIInput.d.ts +3 -0
  13. package/dist/elements/core/UILink.d.ts +2 -0
  14. package/dist/elements/core/UIList.d.ts +3 -0
  15. package/dist/elements/core/UIListItem.d.ts +7 -0
  16. package/dist/elements/core/UIListRow.d.ts +8 -0
  17. package/dist/elements/core/UIModal.d.ts +3 -0
  18. package/dist/elements/core/UIOption.d.ts +2 -0
  19. package/dist/elements/core/UIQuantity.d.ts +3 -0
  20. package/dist/elements/core/UIRadio.d.ts +2 -0
  21. package/dist/elements/core/UISelect.d.ts +3 -0
  22. package/dist/elements/core/UISlider.d.ts +3 -0
  23. package/dist/elements/core/UISwitch.d.ts +3 -0
  24. package/dist/elements/core/UIToast.d.ts +2 -0
  25. package/dist/elements/core/UIToggle.d.ts +3 -0
  26. package/dist/elements/core/UIView.d.ts +3 -0
  27. package/dist/elements/index.d.ts +1 -0
  28. package/dist/elements/tabs/ElTabs.d.ts +3 -0
  29. package/dist/hooks/useIsVisible.d.ts +2 -0
  30. package/dist/index.d.ts +1 -2
  31. package/dist/react-crud-mobile.cjs.development.js +2364 -0
  32. package/dist/react-crud-mobile.cjs.development.js.map +1 -0
  33. package/dist/react-crud-mobile.cjs.production.min.js +2 -0
  34. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -0
  35. package/dist/react-crud-mobile.esm.js +2356 -0
  36. package/dist/react-crud-mobile.esm.js.map +1 -0
  37. package/dist/utils/MobileUtils.d.ts +3 -0
  38. package/package.json +75 -50
  39. package/src/elements/UI.tsx +73 -57
  40. package/src/elements/UIChildren.tsx +139 -117
  41. package/src/elements/UIComplete.tsx +14 -15
  42. package/src/elements/UIElement.tsx +692 -379
  43. package/src/elements/UITag.tsx +13 -13
  44. package/src/elements/charts/ElChart.tsx +10 -10
  45. package/src/elements/core/SafeView.tsx +69 -0
  46. package/src/elements/core/{Link.tsx → UIAutoComplete.tsx} +1 -2
  47. package/src/elements/core/UIButton.tsx +139 -0
  48. package/src/elements/core/UIIcon.tsx +25 -0
  49. package/src/elements/{grid/ElInclude.tsx → core/UIInclude.tsx} +40 -40
  50. package/src/elements/core/UIInput.tsx +96 -0
  51. package/src/elements/core/{Icon.tsx → UILink.tsx} +1 -2
  52. package/src/elements/core/UIList.tsx +168 -0
  53. package/src/elements/core/UIListItem.tsx +32 -0
  54. package/src/elements/core/UIListRow.tsx +123 -0
  55. package/src/elements/core/UIModal.tsx +204 -0
  56. package/src/elements/core/{Input.tsx → UIOption.tsx} +1 -2
  57. package/src/elements/core/UIQuantity.tsx +98 -0
  58. package/src/elements/core/{Radio.tsx → UIRadio.tsx} +1 -2
  59. package/src/elements/core/UISelect.tsx +135 -0
  60. package/src/elements/core/UISlider.tsx +61 -0
  61. package/src/elements/core/UISwitch.tsx +27 -0
  62. package/src/elements/core/UIToast.tsx +44 -0
  63. package/src/elements/core/UIToggle.tsx +102 -0
  64. package/src/elements/core/UIView.tsx +94 -0
  65. package/src/elements/grid/ElInclude +0 -0
  66. package/src/elements/index.ts +1 -1
  67. package/src/elements/tabs/ElTabs.tsx +178 -178
  68. package/src/hooks/useIsVisible.ts +39 -0
  69. package/src/index.ts +1 -1
  70. package/src/utils/MobileUtils.ts +12 -0
  71. package/src/elements/card/ElCard.tsx +0 -26
  72. package/src/elements/core/AutoComplete.tsx +0 -18
  73. package/src/elements/core/Button.tsx +0 -18
  74. package/src/elements/core/Option.tsx +0 -18
  75. package/src/elements/core/Select.tsx +0 -18
  76. package/src/elements/core/Switch.tsx +0 -18
  77. package/src/elements/grid/ElGrid.tsx +0 -50
  78. package/src/elements/grid/ElGridBotom.tsx +0 -21
  79. package/src/elements/grid/ElGridCheck.tsx +0 -67
  80. package/src/elements/grid/ElGridColumn.tsx +0 -32
  81. package/src/elements/grid/ElGridFilter.tsx +0 -5
  82. package/src/elements/grid/ElGridPaginator.tsx +0 -82
  83. package/src/elements/grid/ElGridRow.tsx +0 -123
  84. package/src/elements/grid/ElGridTop.tsx +0 -45
  85. package/src/elements/grid/ElLabel.tsx +0 -50
  86. package/src/elements/grid/ElRepeat.tsx +0 -24
  87. package/src/elements/grid/ElRepeatRow.tsx +0 -40
@@ -1,57 +1,73 @@
1
- import { ListType } from "react-crud-utils";
2
- import { UserType } from "react-crud-utils";
3
- import { InputType } from "react-crud-utils";
4
- import { ChartType } from "react-crud-utils";
5
- import { ContainerType } from "react-crud-utils";
6
- import { ListInputType } from "react-crud-utils";
7
- import UIElement from "./UIElement";
8
- import { TabsType } from "react-crud-utils";
9
- import { DefineType } from "react-crud-utils";
10
- import ElInclude from "./grid/ElInclude";
11
- import { ButtonType } from "react-crud-utils";
12
- import { LinkType } from "react-crud-utils";
13
-
14
- const UI = {
15
- Grid: (props: ListType) => <UIElement {...props} type="list" />,
16
- Repeat: (props: ListType) => <UIElement {...props} type="repeat" />,
17
- Define: (props: DefineType) => <UIElement {...props} type="define" />,
18
- Include: (props: DefineType) => <ElInclude {...props} />,
19
- Column: ({ type = "column", ...props }: UserType) => (
20
- <UIElement {...props} type="column" />
21
- ),
22
- Input: (props: InputType) => <UIElement {...props} />,
23
- Text: (props: InputType) => <UIElement {...props} type="text" />,
24
- Email: (props: InputType) => <UIElement {...props} type="email" />,
25
- Button: (props: ButtonType) => <UIElement {...props} type="button" />,
26
- Link: (props: LinkType) => <UIElement {...props} type="link" />,
27
- Icon: (props: ButtonType) => <UIElement {...props} type="icon" />,
28
- Output: (props: ContainerType) => <UIElement {...props} type="output" />,
29
- Form: (props: ContainerType) => <UIElement {...props} type="form" />,
30
- Crud: (props: ContainerType) => <UIElement {...props} type="crud" />,
31
- View: (props: ContainerType) => (
32
- <UIElement {...props} type="view" transient />
33
- ),
34
- Bottom: (props: ContainerType) => <UIElement {...props} type="bottom" />,
35
- Dialog: (props: ContainerType) => <UIElement {...props} type="dialog" />,
36
- Content: (props: ContainerType) => <UIElement {...props} type="content" />,
37
- Top: (props: ContainerType) => <UIElement {...props} type="top" />,
38
- Card: (props: ContainerType) => <UIElement {...props} type="card" />,
39
- Tab: (props: ContainerType) => <UIElement {...props} type="tab" />,
40
- Tabs: (props: TabsType) => <UIElement {...props} type="tabs" />,
41
- Step: (props: ContainerType) => (
42
- <UIElement {...props} type="tab" layout="step" />
43
- ),
44
- Stepper: (props: TabsType) => (
45
- <UIElement {...props} type="tabs" layout="stepper" />
46
- ),
47
- Money: (props: InputType) => <UIElement {...props} type="money" />,
48
- Chart: (props: ChartType) => <UIElement {...props} type="chart" />,
49
- Password: (props: InputType) => <UIElement {...props} type="password" />,
50
- Complete: (props: InputType) => <UIElement {...props} type="complete" />,
51
- Checkbox: (props: InputType) => <UIElement {...props} type="checkbox" />,
52
- Radio: (props: ListInputType) => <UIElement {...props} type="radio" />,
53
- Select: (props: ListInputType) => <UIElement {...props} type="select" />,
54
- Entity: (props: ListInputType) => <UIElement {...props} type="entity" />,
55
- Element: (props: ListInputType) => <UIElement {...props} type="element" />,
56
- };
57
- export default UI;
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 "react";
2
- import UIElement from "./UIElement";
3
- import { Crud, Scope, ScopeUtils, Utils } from "react-crud-utils";
4
-
5
- interface UIChildrenType {
6
- scope: Scope;
7
- crud?: Crud;
8
- validateScope?: String;
9
- children?: any;
10
- elements?: any;
11
- transient?: boolean;
12
- part?: string;
13
- childProps?: any;
14
- }
15
-
16
- export default function UIChildren(props: UIChildrenType) {
17
- let [scope] = useState(Utils.nvl(props.scope, ScopeUtils.create(props)));
18
- let crud = Utils.nvl(props.crud, scope.crud);
19
- let validateScope = Utils.nvl(props.validateScope, "global");
20
- let name = Utils.nvl(props.part, "child");
21
-
22
- if (scope.isInput()) {
23
- return <></>;
24
- }
25
-
26
- let Paint = ({ child }: any) => {
27
- if (!child) {
28
- return <></>;
29
- }
30
- if (typeof child === "string") {
31
- return <>{child}</>;
32
- }
33
-
34
- let Custom = child.type;
35
- let pps = { ...child.props };
36
-
37
- delete pps.children;
38
-
39
- if (typeof Custom === "string") {
40
- if (Utils.isEmpty(child.props.children)) {
41
- return <Custom {...pps} />;
42
- }
43
- return (
44
- <Custom {...pps}>
45
- <UIChildren
46
- transient
47
- validateScope={validateScope}
48
- {...child.props}
49
- scope={scope}
50
- crud={crud}
51
- ></UIChildren>
52
- </Custom>
53
- );
54
- } else if (typeof Custom === "function") {
55
- return (
56
- <Custom
57
- validateScope={validateScope}
58
- {...child.props}
59
- parent={scope}
60
- crud={crud}
61
- ></Custom>
62
- );
63
- }
64
-
65
- if (!Utils.isEmpty(child.props.children)) {
66
- return (
67
- <UIChildren
68
- validateScope={validateScope}
69
- {...child.props}
70
- scope={scope}
71
- crud={crud}
72
- transient
73
- ></UIChildren>
74
- );
75
- }
76
- return <></>;
77
- };
78
-
79
- const Draw = () => {
80
- if (props.elements) {
81
- return (
82
- <>
83
- {Object.entries(props.elements).map((t: any, k) => {
84
- return <UIElement crud={crud} {...t[1]} />;
85
- })}
86
- </>
87
- );
88
- }
89
- return (
90
- <>
91
- {React.Children.map(props.children, (child) => {
92
- return <Paint child={child}></Paint>;
93
- })}
94
- </>
95
- );
96
- };
97
-
98
- if (props.transient) {
99
- return <Draw />;
100
- }
101
-
102
- if (Utils.isEmpty(props.children) && Utils.isEmpty(props.elements)) {
103
- return <></>;
104
- }
105
-
106
- return (
107
- <>
108
- <div
109
- className={scope.getStyleClass(name)}
110
- style={scope.getStyle(name)}
111
- {...props.childProps}
112
- >
113
- <Draw />
114
- </div>
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 React from 'react';
2
- import { ChildType } from 'react-crud-utils';
3
- import AutoComplete from './core/AutoComplete';
4
-
5
- export default function UIComplete({
6
- defaultsInput,
7
- defaultsUI,
8
- scope,
9
- }: ChildType) {
10
- return (
11
- <>
12
- <AutoComplete {...defaultsInput} {...defaultsUI} />
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
+ }