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.
Files changed (83) 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 +2367 -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 +2359 -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 +54 -30
  39. package/src/elements/UI.tsx +34 -18
  40. package/src/elements/UIChildren.tsx +38 -16
  41. package/src/elements/UIComplete.tsx +1 -2
  42. package/src/elements/UIElement.tsx +542 -225
  43. package/src/elements/core/SafeView.tsx +69 -0
  44. package/src/elements/core/{Link.tsx → UIAutoComplete.tsx} +17 -18
  45. package/src/elements/core/UIButton.tsx +139 -0
  46. package/src/elements/core/UIIcon.tsx +25 -0
  47. package/src/elements/{grid/ElInclude.tsx → core/UIInclude.tsx} +3 -3
  48. package/src/elements/core/UIInput.tsx +96 -0
  49. package/src/elements/core/{Icon.tsx → UILink.tsx} +17 -18
  50. package/src/elements/core/UIList.tsx +168 -0
  51. package/src/elements/core/UIListItem.tsx +32 -0
  52. package/src/elements/core/UIListRow.tsx +123 -0
  53. package/src/elements/core/UIModal.tsx +204 -0
  54. package/src/elements/core/{Input.tsx → UIOption.tsx} +17 -18
  55. package/src/elements/core/UIQuantity.tsx +98 -0
  56. package/src/elements/core/{Radio.tsx → UIRadio.tsx} +17 -18
  57. package/src/elements/core/UISelect.tsx +135 -0
  58. package/src/elements/core/UISlider.tsx +61 -0
  59. package/src/elements/core/UISwitch.tsx +27 -0
  60. package/src/elements/core/UIToast.tsx +44 -0
  61. package/src/elements/core/UIToggle.tsx +102 -0
  62. package/src/elements/core/UIView.tsx +94 -0
  63. package/src/elements/grid/ElInclude +0 -0
  64. package/src/hooks/useIsVisible.ts +39 -0
  65. package/src/index.ts +1 -1
  66. package/src/utils/MobileUtils.ts +12 -0
  67. package/src/elements/card/ElCard.tsx +0 -26
  68. package/src/elements/core/AutoComplete.tsx +0 -18
  69. package/src/elements/core/Button.tsx +0 -18
  70. package/src/elements/core/Option.tsx +0 -18
  71. package/src/elements/core/Select.tsx +0 -18
  72. package/src/elements/core/Switch.tsx +0 -18
  73. package/src/elements/grid/ElGrid.tsx +0 -50
  74. package/src/elements/grid/ElGridBotom.tsx +0 -21
  75. package/src/elements/grid/ElGridCheck.tsx +0 -67
  76. package/src/elements/grid/ElGridColumn.tsx +0 -32
  77. package/src/elements/grid/ElGridFilter.tsx +0 -5
  78. package/src/elements/grid/ElGridPaginator.tsx +0 -82
  79. package/src/elements/grid/ElGridRow.tsx +0 -123
  80. package/src/elements/grid/ElGridTop.tsx +0 -45
  81. package/src/elements/grid/ElLabel.tsx +0 -50
  82. package/src/elements/grid/ElRepeat.tsx +0 -24
  83. package/src/elements/grid/ElRepeatRow.tsx +0 -40
@@ -1,82 +0,0 @@
1
- import React, { useState } from 'react';
2
- import UI from '../UI';
3
- import { ChildType, Utils } from 'react-crud-utils';
4
- import Ionicons from '@expo/vector-icons/Ionicons';
5
-
6
- interface ElGridPaginatorType extends ChildType {
7
- next?: boolean;
8
- previous?: boolean;
9
- first?: boolean;
10
- size?: boolean;
11
- last?: boolean;
12
- position: string;
13
- }
14
-
15
- export default function ElGridPaginator({
16
- scope,
17
- next,
18
- previous,
19
- first,
20
- size,
21
- last,
22
- position,
23
- }: ElGridPaginatorType) {
24
- let [sizes] = useState([10, 20, 30, 50, 100, 200, 500]);
25
- let defaults = {
26
- crud: scope.crudSearch,
27
- owner: scope,
28
- variant: scope.attr('variant', 'text'),
29
- };
30
-
31
- let paginatorPosition = Utils.nvl(scope.original.paginatorPosition, 'bottom');
32
-
33
- if (paginatorPosition !== position) {
34
- return <></>;
35
- }
36
-
37
- return (
38
- <>
39
- <UI.Button
40
- field="first"
41
- space={0}
42
- rendered={first !== false}
43
- {...defaults}
44
- click="first"
45
- icon={<Ionicons />}
46
- ></UI.Button>
47
- <UI.Button
48
- field="previous"
49
- space={0}
50
- rendered={previous !== false}
51
- click="previous"
52
- {...defaults}
53
- icon={<Ionicons />}
54
- ></UI.Button>
55
- <UI.Select
56
- field="size"
57
- space={0}
58
- rendered={size !== false}
59
- default={10}
60
- {...defaults}
61
- data={sizes}
62
- change="search"
63
- ></UI.Select>
64
- <UI.Button
65
- field="next"
66
- space={0}
67
- rendered={next !== false}
68
- {...defaults}
69
- click="next"
70
- icon={<Ionicons />}
71
- ></UI.Button>
72
- <UI.Button
73
- field="last"
74
- space={0}
75
- rendered={last !== false}
76
- {...defaults}
77
- click="last"
78
- icon={<Ionicons />}
79
- ></UI.Button>
80
- </>
81
- );
82
- }
@@ -1,123 +0,0 @@
1
- import React, { useState } from 'react';
2
- import ElGridColumn from './ElGridColumn';
3
- import ElGridCheck from './ElGridCheck';
4
- import Ionicons from '@expo/vector-icons/Ionicons';
5
- import UI from '../UI';
6
- import UIChildren from '../UIChildren';
7
- import {
8
- ComponentUtils,
9
- CrudUtils,
10
- ListType,
11
- RowType,
12
- Scope,
13
- Utils,
14
- } from 'react-crud-utils';
15
-
16
- export default function ElGridRow(props: RowType) {
17
- let expansion = props.expansion;
18
- let value = props.value;
19
- let scope = props.scope;
20
- let index = props.index;
21
- let original: ListType = scope.original;
22
-
23
- let row = CrudUtils.create('row', {
24
- index,
25
- row: true,
26
- itemVar: scope.original.itemVar,
27
- parent: scope.crudSearch,
28
- data: value,
29
- });
30
-
31
- let [expanded, setExpanded] = useState(false);
32
- let [rowScope] = useState(new Scope(scope.original, scope, row));
33
-
34
- let getRowStyleClass = () => {
35
- let s = 'ui-grid-row';
36
-
37
- s = s + ' ui-grid-row-';
38
-
39
- if (index % 2 == 0) {
40
- s = s + 'even';
41
- } else {
42
- s = s + 'odd';
43
- }
44
- return s;
45
- };
46
-
47
- let cols = ComponentUtils.getChild(props, 'Column');
48
- let colspan = cols.length;
49
-
50
- let ExpansionStatus = () => {
51
- return (
52
- <>
53
- {!expanded && <Ionicons />}
54
- {expanded && <Ionicons />}
55
- </>
56
- );
57
- };
58
-
59
- let onExpansion = () => {
60
- setExpanded(!expanded);
61
- };
62
-
63
- let hasExpansion = !Utils.isEmpty(expansion);
64
- let multiple = original.multiple;
65
-
66
- if (hasExpansion) colspan++;
67
- if (multiple) colspan++;
68
-
69
- return (
70
- <>
71
- <tr className={getRowStyleClass()} style={rowScope.getStyle('row')}>
72
- {hasExpansion && (
73
- <ElGridColumn
74
- key={'r' + index + 'e'}
75
- scope={rowScope}
76
- styleClass="ui-click ui-icon-only ui-expansion"
77
- >
78
- <UI.Button
79
- icon={<ExpansionStatus />}
80
- click={onExpansion}
81
- ></UI.Button>
82
- </ElGridColumn>
83
- )}
84
- {multiple && (
85
- <ElGridColumn
86
- key={'r' + index + 'c'}
87
- scope={rowScope}
88
- styleClass="ui-click ui-icon-only ui-multiple"
89
- >
90
- <ElGridCheck
91
- key={'check-' + index}
92
- scope={scope}
93
- value={value}
94
- rowIndex={index}
95
- />
96
- </ElGridColumn>
97
- )}
98
- {cols.map((col: any, i: number) => (
99
- <ElGridColumn
100
- column={col}
101
- key={'r' + index + 'c' + i}
102
- scope={rowScope}
103
- >
104
- {col}
105
- </ElGridColumn>
106
- ))}
107
- </tr>
108
- {expanded && (
109
- <tr className={getRowStyleClass()} style={rowScope.getStyle('row')}>
110
- <ElGridColumn
111
- key={'r' + index + '-expanded'}
112
- scope={rowScope}
113
- colspan={colspan}
114
- >
115
- <UIChildren {...props} crud={row}>
116
- {expansion}
117
- </UIChildren>
118
- </ElGridColumn>
119
- </tr>
120
- )}
121
- </>
122
- );
123
- }
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import UI from '../UI';
3
- import Ionicons from '@expo/vector-icons/Ionicons';
4
- import ElGridPaginator from './ElGridPaginator';
5
- import { ChildType } from 'react-crud-utils';
6
-
7
- export default function ElGridTop(props: ChildType) {
8
- let scope = props.scope;
9
-
10
- return (
11
- <>
12
- <UI.Output styleClass="ui-grid-top">
13
- <UI.Output field="search" position="left" space={4}>
14
- <UI.Include {...props} transient name="top" position="left" />
15
- <UI.Text
16
- field="query"
17
- space={0}
18
- label="Pesquisar"
19
- placeholder={scope.attr('placeholder', 'Pesquisar')}
20
- >
21
- <UI.Define name="right">
22
- <UI.Button
23
- field="search"
24
- icon={<Ionicons />}
25
- space={0}
26
- variant="text"
27
- owner={scope}
28
- click={'search'}
29
- ></UI.Button>
30
- </UI.Define>
31
- </UI.Text>
32
- </UI.Output>
33
- <UI.Output position="right" space={8}>
34
- <UI.Include {...props} transient name="top" position="right" />
35
- <ElGridPaginator
36
- scope={scope}
37
- last={false}
38
- first={false}
39
- position="top"
40
- ></ElGridPaginator>
41
- </UI.Output>
42
- </UI.Output>
43
- </>
44
- );
45
- }
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import UI from '../UI';
3
- import { ChildType, Utils } from 'react-crud-utils';
4
- import Icon from '../core/Icon';
5
-
6
- interface ElLabelType extends ChildType {
7
- position?: string;
8
- }
9
- export default function ElLabel(props: ElLabelType) {
10
- let scope = props.scope;
11
- let original = scope.original;
12
- let defaultPos = 'outside';
13
-
14
- let elPos = Utils.nvl(original.labelPos, defaultPos);
15
- let lbPos = Utils.nvl(props.position, defaultPos);
16
-
17
- if (elPos != lbPos) {
18
- return <></>;
19
- }
20
-
21
- const CustomIcon = () => {
22
- if (!scope.is('type', 'list', 'grid')) {
23
- return <></>;
24
- }
25
-
26
- if (typeof original.icon === 'string') {
27
- return (
28
- <div className="ui-label-icon">
29
- <Icon className={scope.getIcon()}></Icon>
30
- </div>
31
- );
32
- }
33
- return <div className="ui-label-icon">{original.icon}</div>;
34
- };
35
-
36
- let label = scope.getLabel();
37
-
38
- return (
39
- <div className={'ui-label ui-label-' + lbPos}>
40
- <div className="ui-label-left">
41
- <UI.Include {...props} transient name="label" position="left" />
42
- <CustomIcon />
43
- {label && <div className="ui-label-value">{label}</div>}
44
- </div>
45
- <div className="ui-label-right">
46
- <UI.Include {...props} transient name="label" position="right" />
47
- </div>
48
- </div>
49
- );
50
- }
@@ -1,24 +0,0 @@
1
- import ElRepeatRow from './ElRepeatRow';
2
- import { ChildType, Scope } from 'react-crud-utils';
3
-
4
- export default function ElRepeat(props: ChildType) {
5
- let scope: Scope = props.scope;
6
- let items: any = scope.getItems();
7
-
8
- return (
9
- <div
10
- className={scope.getStyleClass('inner')}
11
- style={scope.getStyle('inner')}
12
- >
13
- {items.map((row: any, i: number) => (
14
- <ElRepeatRow
15
- {...props}
16
- key={'r' + i}
17
- scope={scope}
18
- value={row}
19
- index={i}
20
- />
21
- ))}
22
- </div>
23
- );
24
- }
@@ -1,40 +0,0 @@
1
- import React, { useState } from "react";
2
- import UIChildren from "../UIChildren";
3
- import { CrudUtils, RowType, Scope } from "react-crud-utils";
4
-
5
- export default function ElRepeatRow(props: RowType) {
6
- let value = props.value;
7
- let scope = props.scope;
8
- let index = props.index;
9
-
10
- let row = CrudUtils.create("row", {
11
- index,
12
- row: true,
13
- itemVar: scope.original.itemVar,
14
- parent: scope.crudSearch,
15
- data: value,
16
- });
17
-
18
- let [rowScope] = useState(new Scope(scope.original, scope, row));
19
-
20
- let getRowStyleClass = () => {
21
- let s = rowScope.getStyleClass("row");
22
-
23
- s = s + " ui-repeat-row-";
24
-
25
- if (index % 2 == 0) {
26
- s = s + "even";
27
- } else {
28
- s = s + "odd";
29
- }
30
- return s;
31
- };
32
-
33
- return (
34
- <div className={getRowStyleClass()} style={rowScope.getStyle("row")}>
35
- <UIChildren transient {...props} crud={row}>
36
- {props.children}
37
- </UIChildren>
38
- </div>
39
- );
40
- }