react-crud-mobile 1.3.193 → 1.3.197

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 (42) hide show
  1. package/dist/react-crud-mobile.cjs.development.js +13 -5
  2. package/dist/react-crud-mobile.cjs.development.js.map +1 -1
  3. package/dist/react-crud-mobile.cjs.production.min.js +1 -1
  4. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
  5. package/dist/react-crud-mobile.esm.js +13 -5
  6. package/dist/react-crud-mobile.esm.js.map +1 -1
  7. package/package.json +77 -77
  8. package/src/elements/UI.tsx +76 -76
  9. package/src/elements/UIChildren.tsx +142 -142
  10. package/src/elements/UIComplete.tsx +14 -14
  11. package/src/elements/UIElement.tsx +824 -823
  12. package/src/elements/UITag.tsx +13 -13
  13. package/src/elements/charts/ElChart.tsx +10 -10
  14. package/src/elements/core/GestureView.tsx +16 -16
  15. package/src/elements/core/SafeView.tsx +63 -63
  16. package/src/elements/core/UIAutoComplete.tsx +17 -17
  17. package/src/elements/core/UIButton.tsx +143 -143
  18. package/src/elements/core/UIHeader.tsx +38 -38
  19. package/src/elements/core/UIIcon.tsx +25 -25
  20. package/src/elements/core/UIInclude.tsx +40 -40
  21. package/src/elements/core/UIInput.tsx +102 -96
  22. package/src/elements/core/UILink.tsx +17 -17
  23. package/src/elements/core/UIList.tsx +168 -168
  24. package/src/elements/core/UIListItem.tsx +32 -32
  25. package/src/elements/core/UIListRow.tsx +132 -132
  26. package/src/elements/core/UIModal.tsx +225 -225
  27. package/src/elements/core/UIOption.tsx +17 -17
  28. package/src/elements/core/UIOrder.tsx +194 -194
  29. package/src/elements/core/UIQuantity.tsx +98 -98
  30. package/src/elements/core/UIRadio.tsx +17 -17
  31. package/src/elements/core/UISelect.tsx +171 -171
  32. package/src/elements/core/UISlider.tsx +61 -61
  33. package/src/elements/core/UIStatusBar.tsx +5 -5
  34. package/src/elements/core/UISwitch.tsx +27 -27
  35. package/src/elements/core/UIToast.tsx +44 -44
  36. package/src/elements/core/UIToggle.tsx +102 -102
  37. package/src/elements/core/UIView.tsx +69 -69
  38. package/src/elements/index.ts +1 -1
  39. package/src/elements/tabs/ElTabs.tsx +178 -178
  40. package/src/hooks/useIsVisible.ts +39 -39
  41. package/src/index.ts +1 -1
  42. package/src/utils/MobileUtils.ts +12 -12
@@ -1,32 +1,32 @@
1
- import { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
4
-
5
- interface UIListItemType extends ChildType {
6
- data: any;
7
- }
8
-
9
- export default function UIListItem(props: UIListItemType) {
10
- const scope = props.scope;
11
- const crud = props.crud;
12
-
13
- return <View style={styles.item}></View>;
14
- }
15
-
16
- const styles = StyleSheet.create({
17
- container: {
18
- flex: 1,
19
- padding: 20,
20
- backgroundColor: '#fff',
21
- },
22
- item: {
23
- padding: 15,
24
- marginVertical: 8,
25
- backgroundColor: '#f9c2ff',
26
- borderRadius: 8,
27
- },
28
- text: {
29
- fontSize: 18,
30
- fontWeight: 'bold',
31
- },
32
- });
1
+ import { useState } from 'react';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { FlatList, StyleSheet, Switch, Text, View } from 'react-native';
4
+
5
+ interface UIListItemType extends ChildType {
6
+ data: any;
7
+ }
8
+
9
+ export default function UIListItem(props: UIListItemType) {
10
+ const scope = props.scope;
11
+ const crud = props.crud;
12
+
13
+ return <View style={styles.item}></View>;
14
+ }
15
+
16
+ const styles = StyleSheet.create({
17
+ container: {
18
+ flex: 1,
19
+ padding: 20,
20
+ backgroundColor: '#fff',
21
+ },
22
+ item: {
23
+ padding: 15,
24
+ marginVertical: 8,
25
+ backgroundColor: '#f9c2ff',
26
+ borderRadius: 8,
27
+ },
28
+ text: {
29
+ fontSize: 18,
30
+ fontWeight: 'bold',
31
+ },
32
+ });
@@ -1,132 +1,132 @@
1
- import React, { useRef, useState } from 'react';
2
- import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
3
- import UIChildren from '../UIChildren';
4
- import { StyleSheet, TouchableHighlight, View } from 'react-native';
5
- import { useIsVisible } from '../../hooks/useIsVisible';
6
-
7
- interface UIListRowType extends ChildType {
8
- item: any;
9
- index: number;
10
- }
11
-
12
- export default function UIListRow(props: UIListRowType) {
13
- const scope = props.scope;
14
- const index = props.index;
15
- const original = scope.original;
16
- const item = props.item;
17
- const cols = scope.getPart('cols', undefined, -1);
18
- const rowWidth = Math.floor(100 / cols) + '%';
19
- const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
20
- const name = `${scope.key('row', index, '')}`;
21
- const [row] = useState(
22
- ScopeUtils.create({
23
- ...original,
24
- parent: scope,
25
- name,
26
- crud: scope.crud,
27
- index,
28
- type: 'row',
29
- data: item,
30
- })
31
- );
32
-
33
- //v4
34
- const targetRef = useRef(null);
35
- const isVisible = useIsVisible(targetRef, row);
36
-
37
- const onClick = (item: any) => {
38
- row.call('click', { value: item, item, edit: true, index });
39
- };
40
-
41
- const Child = () => {
42
- if (!isVisible && original.useIsInView && !row.visible && index > 20) {
43
- return <></>;
44
- }
45
- return (
46
- <>
47
- <UIChildren transient scope={row} crud={row.crud}>
48
- {props.children}
49
- </UIChildren>
50
- </>
51
- );
52
- };
53
-
54
- const ListItem = () => {
55
- let [updateIndex, setUpdateIndex] = useState(0);
56
- let key = scope.key('item');
57
-
58
- row.selected = row.getPart('isSelectedRow', undefined, false);
59
-
60
- const getRowStyle = () => {
61
- let css = row.getStyle('row', { ...styles.row, minHeight: 40 });
62
-
63
- if (row.selected) {
64
- css = { ...css, ...row.getStyle('rowSelected', {}) };
65
- } else {
66
- css = { ...css, ...row.getStyle('rowUnSelected', {}) };
67
- }
68
-
69
- if (cols > 0) {
70
- css.width = rowWidth;
71
- }
72
-
73
- return css;
74
- };
75
-
76
- row.update = () => {
77
- scope.updateIndex = scope.updateIndex + 1;
78
-
79
- setUpdateIndex(++updateIndex);
80
- };
81
-
82
- let renderedRow = row.getPart('renderedItem', undefined, true);
83
-
84
- if (renderedRow === false) {
85
- return <></>;
86
- }
87
-
88
- if (!original.click) {
89
- return (
90
- <View key={key} style={getRowStyle()} ref={targetRef}>
91
- <Child />
92
- </View>
93
- );
94
- }
95
- return (
96
- <TouchableHighlight
97
- key={key}
98
- style={getRowStyle()}
99
- underlayColor={'transparent'}
100
- ref={targetRef}
101
- onPress={e => {
102
- e.stopPropagation();
103
- onClick(item);
104
- }}
105
- >
106
- <Child />
107
- </TouchableHighlight>
108
- );
109
- };
110
-
111
- return <ListItem />;
112
- }
113
-
114
- const stylesList = StyleSheet.create({
115
- row: {
116
- padding: 5,
117
- margin: 0,
118
- width: '100%',
119
- backgroundColor: 'background',
120
- gap: 10,
121
- borderRadius: 8,
122
- justifyContent: 'center',
123
- },
124
- });
125
-
126
- const stylesRepeat = StyleSheet.create({
127
- row: {
128
- padding: 0,
129
- width: '100%',
130
- justifyContent: 'center',
131
- },
132
- });
1
+ import React, { useRef, useState } from 'react';
2
+ import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
3
+ import UIChildren from '../UIChildren';
4
+ import { StyleSheet, TouchableHighlight, View } from 'react-native';
5
+ import { useIsVisible } from '../../hooks/useIsVisible';
6
+
7
+ interface UIListRowType extends ChildType {
8
+ item: any;
9
+ index: number;
10
+ }
11
+
12
+ export default function UIListRow(props: UIListRowType) {
13
+ const scope = props.scope;
14
+ const index = props.index;
15
+ const original = scope.original;
16
+ const item = props.item;
17
+ const cols = scope.getPart('cols', undefined, -1);
18
+ const rowWidth = Math.floor(100 / cols) + '%';
19
+ const styles = { repeat: stylesRepeat, list: stylesList }?.[original.type];
20
+ const name = `${scope.key('row', index, '')}`;
21
+ const [row] = useState(
22
+ ScopeUtils.create({
23
+ ...original,
24
+ parent: scope,
25
+ name,
26
+ crud: scope.crud,
27
+ index,
28
+ type: 'row',
29
+ data: item,
30
+ })
31
+ );
32
+
33
+ //v4
34
+ const targetRef = useRef(null);
35
+ const isVisible = useIsVisible(targetRef, row);
36
+
37
+ const onClick = (item: any) => {
38
+ row.call('click', { value: item, item, edit: true, index });
39
+ };
40
+
41
+ const Child = () => {
42
+ if (!isVisible && original.useIsInView && !row.visible && index > 20) {
43
+ return <></>;
44
+ }
45
+ return (
46
+ <>
47
+ <UIChildren transient scope={row} crud={row.crud}>
48
+ {props.children}
49
+ </UIChildren>
50
+ </>
51
+ );
52
+ };
53
+
54
+ const ListItem = () => {
55
+ let [updateIndex, setUpdateIndex] = useState(0);
56
+ let key = scope.key('item');
57
+
58
+ row.selected = row.getPart('isSelectedRow', undefined, false);
59
+
60
+ const getRowStyle = () => {
61
+ let css = row.getStyle('row', { ...styles.row, minHeight: 40 });
62
+
63
+ if (row.selected) {
64
+ css = { ...css, ...row.getStyle('rowSelected', {}) };
65
+ } else {
66
+ css = { ...css, ...row.getStyle('rowUnSelected', {}) };
67
+ }
68
+
69
+ if (cols > 0) {
70
+ css.width = rowWidth;
71
+ }
72
+
73
+ return css;
74
+ };
75
+
76
+ row.update = () => {
77
+ scope.updateIndex = scope.updateIndex + 1;
78
+
79
+ setUpdateIndex(++updateIndex);
80
+ };
81
+
82
+ let renderedRow = row.getPart('renderedItem', undefined, true);
83
+
84
+ if (renderedRow === false) {
85
+ return <></>;
86
+ }
87
+
88
+ if (!original.click) {
89
+ return (
90
+ <View key={key} style={getRowStyle()} ref={targetRef}>
91
+ <Child />
92
+ </View>
93
+ );
94
+ }
95
+ return (
96
+ <TouchableHighlight
97
+ key={key}
98
+ style={getRowStyle()}
99
+ underlayColor={'transparent'}
100
+ ref={targetRef}
101
+ onPress={e => {
102
+ e.stopPropagation();
103
+ onClick(item);
104
+ }}
105
+ >
106
+ <Child />
107
+ </TouchableHighlight>
108
+ );
109
+ };
110
+
111
+ return <ListItem />;
112
+ }
113
+
114
+ const stylesList = StyleSheet.create({
115
+ row: {
116
+ padding: 5,
117
+ margin: 0,
118
+ width: '100%',
119
+ backgroundColor: 'background',
120
+ gap: 10,
121
+ borderRadius: 8,
122
+ justifyContent: 'center',
123
+ },
124
+ });
125
+
126
+ const stylesRepeat = StyleSheet.create({
127
+ row: {
128
+ padding: 0,
129
+ width: '100%',
130
+ justifyContent: 'center',
131
+ },
132
+ });