react-crud-mobile 1.0.71 → 1.0.73

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.
@@ -1,82 +1,82 @@
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
+ 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 +1,123 @@
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
+ 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,44 +1,44 @@
1
- import UI from '../UI';
2
- import Ionicons from '@expo/vector-icons/Ionicons';
3
- import ElGridPaginator from './ElGridPaginator';
4
- import { ChildType } from 'react-crud-utils';
5
-
6
- export default function ElGridTop(props: ChildType) {
7
- let scope = props.scope;
8
-
9
- return (
10
- <>
11
- <UI.Output styleClass="ui-grid-top">
12
- <UI.Output field="search" position="left" space={4}>
13
- <UI.Include {...props} transient name="top" position="left" />
14
- <UI.Text
15
- field="query"
16
- space={0}
17
- label="Pesquisar"
18
- placeholder={scope.attr('placeholder', 'Pesquisar')}
19
- >
20
- <UI.Define name="right">
21
- <UI.Button
22
- field="search"
23
- icon={<Ionicons />}
24
- space={0}
25
- variant="text"
26
- owner={scope}
27
- click={'search'}
28
- ></UI.Button>
29
- </UI.Define>
30
- </UI.Text>
31
- </UI.Output>
32
- <UI.Output position="right" space={8}>
33
- <UI.Include {...props} transient name="top" position="right" />
34
- <ElGridPaginator
35
- scope={scope}
36
- last={false}
37
- first={false}
38
- position="top"
39
- ></ElGridPaginator>
40
- </UI.Output>
41
- </UI.Output>
42
- </>
43
- );
44
- }
1
+ import UI from '../UI';
2
+ import Ionicons from '@expo/vector-icons/Ionicons';
3
+ import ElGridPaginator from './ElGridPaginator';
4
+ import { ChildType } from 'react-crud-utils';
5
+
6
+ export default function ElGridTop(props: ChildType) {
7
+ let scope = props.scope;
8
+
9
+ return (
10
+ <>
11
+ <UI.Output styleClass="ui-grid-top">
12
+ <UI.Output field="search" position="left" space={4}>
13
+ <UI.Include {...props} transient name="top" position="left" />
14
+ <UI.Text
15
+ field="query"
16
+ space={0}
17
+ label="Pesquisar"
18
+ placeholder={scope.attr('placeholder', 'Pesquisar')}
19
+ >
20
+ <UI.Define name="right">
21
+ <UI.Button
22
+ field="search"
23
+ icon={<Ionicons />}
24
+ space={0}
25
+ variant="text"
26
+ owner={scope}
27
+ click={'search'}
28
+ ></UI.Button>
29
+ </UI.Define>
30
+ </UI.Text>
31
+ </UI.Output>
32
+ <UI.Output position="right" space={8}>
33
+ <UI.Include {...props} transient name="top" position="right" />
34
+ <ElGridPaginator
35
+ scope={scope}
36
+ last={false}
37
+ first={false}
38
+ position="top"
39
+ ></ElGridPaginator>
40
+ </UI.Output>
41
+ </UI.Output>
42
+ </>
43
+ );
44
+ }
@@ -1,40 +1,40 @@
1
- import UIChildren from "../UIChildren";
2
- import { ComponentUtils, DefineType, Utils } from "react-crud-utils";
3
-
4
- export default function ElInclude(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 ElInclude(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,50 +1,50 @@
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
+ 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
+ }