react-crud-mobile 0.1.7

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 (101) hide show
  1. package/dist/elements/UI.d.ts +48 -0
  2. package/dist/elements/UI.d.ts.map +1 -0
  3. package/dist/elements/UIChildren.d.ts +15 -0
  4. package/dist/elements/UIChildren.d.ts.map +1 -0
  5. package/dist/elements/UIComplete.d.ts +4 -0
  6. package/dist/elements/UIComplete.d.ts.map +1 -0
  7. package/dist/elements/UIElement.d.ts +4 -0
  8. package/dist/elements/UIElement.d.ts.map +1 -0
  9. package/dist/elements/UITag.d.ts +8 -0
  10. package/dist/elements/UITag.d.ts.map +1 -0
  11. package/dist/elements/card/ElCard.d.ts +4 -0
  12. package/dist/elements/card/ElCard.d.ts.map +1 -0
  13. package/dist/elements/charts/ElChart.d.ts +4 -0
  14. package/dist/elements/charts/ElChart.d.ts.map +1 -0
  15. package/dist/elements/core/AutoComplete.d.ts +3 -0
  16. package/dist/elements/core/AutoComplete.d.ts.map +1 -0
  17. package/dist/elements/core/Button.d.ts +3 -0
  18. package/dist/elements/core/Button.d.ts.map +1 -0
  19. package/dist/elements/core/Icon.d.ts +3 -0
  20. package/dist/elements/core/Icon.d.ts.map +1 -0
  21. package/dist/elements/core/Input.d.ts +3 -0
  22. package/dist/elements/core/Input.d.ts.map +1 -0
  23. package/dist/elements/core/Link.d.ts +3 -0
  24. package/dist/elements/core/Link.d.ts.map +1 -0
  25. package/dist/elements/core/Option.d.ts +3 -0
  26. package/dist/elements/core/Option.d.ts.map +1 -0
  27. package/dist/elements/core/Radio.d.ts +3 -0
  28. package/dist/elements/core/Radio.d.ts.map +1 -0
  29. package/dist/elements/core/Select.d.ts +3 -0
  30. package/dist/elements/core/Select.d.ts.map +1 -0
  31. package/dist/elements/core/Switch.d.ts +3 -0
  32. package/dist/elements/core/Switch.d.ts.map +1 -0
  33. package/dist/elements/grid/ElGrid.d.ts +4 -0
  34. package/dist/elements/grid/ElGrid.d.ts.map +1 -0
  35. package/dist/elements/grid/ElGridBotom.d.ts +4 -0
  36. package/dist/elements/grid/ElGridBotom.d.ts.map +1 -0
  37. package/dist/elements/grid/ElGridCheck.d.ts +4 -0
  38. package/dist/elements/grid/ElGridCheck.d.ts.map +1 -0
  39. package/dist/elements/grid/ElGridColumn.d.ts +12 -0
  40. package/dist/elements/grid/ElGridColumn.d.ts.map +1 -0
  41. package/dist/elements/grid/ElGridFilter.d.ts +4 -0
  42. package/dist/elements/grid/ElGridFilter.d.ts.map +1 -0
  43. package/dist/elements/grid/ElGridPaginator.d.ts +13 -0
  44. package/dist/elements/grid/ElGridPaginator.d.ts.map +1 -0
  45. package/dist/elements/grid/ElGridRow.d.ts +4 -0
  46. package/dist/elements/grid/ElGridRow.d.ts.map +1 -0
  47. package/dist/elements/grid/ElGridTop.d.ts +4 -0
  48. package/dist/elements/grid/ElGridTop.d.ts.map +1 -0
  49. package/dist/elements/grid/ElInclude.d.ts +4 -0
  50. package/dist/elements/grid/ElInclude.d.ts.map +1 -0
  51. package/dist/elements/grid/ElLabel.d.ts +8 -0
  52. package/dist/elements/grid/ElLabel.d.ts.map +1 -0
  53. package/dist/elements/grid/ElRepeat.d.ts +4 -0
  54. package/dist/elements/grid/ElRepeat.d.ts.map +1 -0
  55. package/dist/elements/grid/ElRepeatRow.d.ts +4 -0
  56. package/dist/elements/grid/ElRepeatRow.d.ts.map +1 -0
  57. package/dist/elements/index.d.ts +2 -0
  58. package/dist/elements/index.d.ts.map +1 -0
  59. package/dist/elements/tabs/ElTabs.d.ts +4 -0
  60. package/dist/elements/tabs/ElTabs.d.ts.map +1 -0
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +8 -0
  64. package/dist/react-crud-mobile.cjs.development.js +1260 -0
  65. package/dist/react-crud-mobile.cjs.development.js.map +1 -0
  66. package/dist/react-crud-mobile.cjs.production.min.js +2 -0
  67. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -0
  68. package/dist/react-crud-mobile.esm.js +1253 -0
  69. package/dist/react-crud-mobile.esm.js.map +1 -0
  70. package/package.json +95 -0
  71. package/src/elements/UI.tsx +57 -0
  72. package/src/elements/UIChildren.tsx +117 -0
  73. package/src/elements/UIComplete.tsx +15 -0
  74. package/src/elements/UIElement.tsx +379 -0
  75. package/src/elements/UITag.tsx +13 -0
  76. package/src/elements/card/ElCard.tsx +26 -0
  77. package/src/elements/charts/ElChart.tsx +10 -0
  78. package/src/elements/core/AutoComplete.tsx +18 -0
  79. package/src/elements/core/Button.tsx +18 -0
  80. package/src/elements/core/Icon.tsx +18 -0
  81. package/src/elements/core/Input.tsx +18 -0
  82. package/src/elements/core/Link.tsx +18 -0
  83. package/src/elements/core/Option.tsx +18 -0
  84. package/src/elements/core/Radio.tsx +18 -0
  85. package/src/elements/core/Select.tsx +18 -0
  86. package/src/elements/core/Switch.tsx +18 -0
  87. package/src/elements/grid/ElGrid.tsx +50 -0
  88. package/src/elements/grid/ElGridBotom.tsx +21 -0
  89. package/src/elements/grid/ElGridCheck.tsx +67 -0
  90. package/src/elements/grid/ElGridColumn.tsx +32 -0
  91. package/src/elements/grid/ElGridFilter.tsx +5 -0
  92. package/src/elements/grid/ElGridPaginator.tsx +82 -0
  93. package/src/elements/grid/ElGridRow.tsx +123 -0
  94. package/src/elements/grid/ElGridTop.tsx +45 -0
  95. package/src/elements/grid/ElInclude.tsx +40 -0
  96. package/src/elements/grid/ElLabel.tsx +50 -0
  97. package/src/elements/grid/ElRepeat.tsx +24 -0
  98. package/src/elements/grid/ElRepeatRow.tsx +40 -0
  99. package/src/elements/index.ts +1 -0
  100. package/src/elements/tabs/ElTabs.tsx +178 -0
  101. package/src/index.ts +1 -0
@@ -0,0 +1,379 @@
1
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import ElGrid from './grid/ElGrid';
3
+ import ElCard from './card/ElCard';
4
+ import UIChildren from './UIChildren';
5
+ import ElTabs from './tabs/ElTabs';
6
+ import ElLabel from './grid/ElLabel';
7
+ import ElChart from './charts/ElChart';
8
+ import UIComplete from './UIComplete';
9
+ import ElRepeat from './grid/ElRepeat';
10
+ import {
11
+ Crud,
12
+ HtmlUtils,
13
+ ScopeUtils,
14
+ Utils,
15
+ ElementType,
16
+ } from 'react-crud-utils';
17
+ import Link from './core/Link';
18
+ import Icon from './core/Icon';
19
+ import Button from './core/Button';
20
+ import Select from './core/Select';
21
+ import Switch from './core/Switch';
22
+ import Option from './core/Option';
23
+ import Radio from './core/Radio';
24
+ import Input from './core/Input';
25
+ import { Linking } from 'react-native';
26
+
27
+ export default function UIElement(props: ElementType) {
28
+ let [scope] = useState(ScopeUtils.create(props));
29
+ let [index, setIndex] = useState(0);
30
+ let [error, setError]: string | any = useState(null);
31
+ let options: any = scope.getOptions();
32
+ let crud: Crud = Utils.nvl(props.crud, scope.crud);
33
+ let original = scope.original;
34
+ let type = original.type;
35
+ let ref = useRef(null);
36
+
37
+ scope.update = () => {
38
+ setIndex(++index);
39
+ };
40
+
41
+ let router: any = {
42
+ list: ElGrid,
43
+ grid: ElGrid,
44
+ label: ElLabel,
45
+ card: ElCard,
46
+ repeat: ElRepeat,
47
+ tabs: ElTabs,
48
+ chart: ElChart,
49
+ };
50
+
51
+ let CurrentRouter = () => {
52
+ if (router[type]) {
53
+ let Aux = router[type];
54
+
55
+ return <Aux crud={crud} {...props} scope={scope} />;
56
+ }
57
+ return <></>;
58
+ };
59
+
60
+ const Custom = () => {
61
+ let c: any = original.custom;
62
+
63
+ if (c) {
64
+ if (typeof c === 'string') {
65
+ return (
66
+ <UIElement
67
+ element={{ value: c, type: 'dummy' }}
68
+ crud={crud}
69
+ ></UIElement>
70
+ );
71
+ }
72
+
73
+ return (
74
+ <UIElement
75
+ type={c.type}
76
+ tag={c.type}
77
+ {...c.props}
78
+ crud={crud}
79
+ ></UIElement>
80
+ );
81
+ }
82
+
83
+ return <></>;
84
+ };
85
+
86
+ if (scope.is('type', 'dummy')) {
87
+ return <>{scope.getDisplayValue()}</>;
88
+ }
89
+
90
+ let onCheck = () => {
91
+ let v = scope.getValue();
92
+ let check = !(v === true);
93
+
94
+ onChange({ target: { value: check } });
95
+ };
96
+
97
+ let onChange = (e: any) => {
98
+ let val = e.target.value;
99
+
100
+ if (scope.isType('integer', 'int', 'number')) {
101
+ val = parseInt(val);
102
+ } else if (scope.isType('decimal')) {
103
+ val = parseFloat(val);
104
+ }
105
+
106
+ if (scope.isType('select', 'complete')) {
107
+ val = scope.getSelectedItem(val);
108
+ }
109
+
110
+ scope.changeValue(val);
111
+ scope.update();
112
+ };
113
+
114
+ let onClick = (e: any) => {
115
+ scope.call('click');
116
+ };
117
+
118
+ let defaultsInput: any = {
119
+ label: scope.getLabel(),
120
+ value: scope.getValue(),
121
+ onChange: onChange,
122
+ };
123
+
124
+ if (scope.isType('password')) {
125
+ defaultsInput.type = 'password';
126
+ }
127
+
128
+ let elStyle = scope.getStyle('element');
129
+
130
+ let defaultsUI: any = {
131
+ required: scope.isRequired(),
132
+ size: 'small',
133
+ style: elStyle,
134
+ placeholder: scope.attr('placeholder', 'Digite aqui'),
135
+ };
136
+
137
+ let isChecked = () => {
138
+ let v = scope.getValue();
139
+
140
+ return v === true;
141
+ };
142
+
143
+ let hasChildren = () => {
144
+ if (scope.isInput()) {
145
+ return false;
146
+ }
147
+
148
+ return !Utils.isEmpty(props.children) || !Utils.isEmpty(props.elements);
149
+ };
150
+
151
+ if (!scope.isRendered() || scope.is('type', 'define')) {
152
+ return <></>;
153
+ }
154
+
155
+ scope.error = (msg: string) => {
156
+ error = msg;
157
+ setError(msg);
158
+ };
159
+
160
+ useEffect(() => {
161
+ if (!scope.ready) {
162
+ scope.ready = true;
163
+
164
+ scope.call('load');
165
+
166
+ if (scope.isType('list', 'repeat')) {
167
+ scope.search();
168
+ } else if (original.list) {
169
+ scope.call('list');
170
+ }
171
+ scope.start();
172
+ }
173
+ });
174
+
175
+ const CustomIcon = () => {
176
+ if (typeof original.icon === 'string') {
177
+ return <Icon>{scope.getIcon()}</Icon>;
178
+ }
179
+ return <>{original.icon}</>;
180
+ };
181
+
182
+ const getLabelClass = (type: string) => {
183
+ let clss = `ui-text ui-${type}-text`;
184
+ let icon = scope.getIcon();
185
+
186
+ if (icon) {
187
+ clss = clss + ` ui-icon ui-${type}-icon`;
188
+ }
189
+ return clss;
190
+ };
191
+
192
+ let hasCustomRoute = () => {
193
+ if (router[type]) return true;
194
+ return false;
195
+ };
196
+
197
+ scope.open = (args: any) => {
198
+ Linking.openURL(args.url);
199
+ };
200
+
201
+ if (scope.isType('dialog')) {
202
+ let name = original.name;
203
+
204
+ if (!crud.dialogs[name]) {
205
+ let dlg: any = { config: { ...original } };
206
+
207
+ dlg.component = (args: any) => {
208
+ return <UIChildren {...props} scope={scope} crud={crud} />;
209
+ };
210
+
211
+ crud.dialogs[name] = dlg;
212
+ }
213
+ return <></>;
214
+ }
215
+
216
+ useLayoutEffect(() => {
217
+ if (ref?.current && scope.is('type', 'card', 'list', 'tabs', 'stepper')) {
218
+ let el: any = ref?.current;
219
+
220
+ if (el) {
221
+ let bg = HtmlUtils.getBGColor(el);
222
+
223
+ if (bg === 'rgb(255, 255, 255)') {
224
+ el.classList.add('ui-dark');
225
+ } else {
226
+ el.classList.add('ui-light');
227
+ }
228
+ }
229
+ }
230
+ });
231
+
232
+ const isShowInner = () => {
233
+ if (hasChildren() || hasCustomRoute()) {
234
+ return false;
235
+ }
236
+ return true;
237
+ };
238
+
239
+ return (
240
+ <>
241
+ <div
242
+ className={'ui-el ' + scope.getStyleClass()}
243
+ ref={ref}
244
+ style={scope.getStyle()}
245
+ >
246
+ {isShowInner() && (
247
+ <>
248
+ <div
249
+ className={scope.getStyleClass('inner')}
250
+ style={scope.getStyle('inner')}
251
+ >
252
+ {scope.is('type', 'button') && (
253
+ <Button
254
+ {...defaultsUI}
255
+ onClick={onClick}
256
+ variant={scope.attr('variant', 'outlined')}
257
+ >
258
+ {original.icon && <CustomIcon />}
259
+ {original.label && (
260
+ <span className={getLabelClass('button')}>
261
+ {scope.getLabel()}
262
+ </span>
263
+ )}
264
+ </Button>
265
+ )}
266
+ {scope.is('type', 'icon') && (
267
+ <Icon
268
+ {...defaultsUI}
269
+ onClick={onClick}
270
+ variant={scope.attr('variant', 'outlined')}
271
+ >
272
+ {scope.getDisplayValue()}
273
+ </Icon>
274
+ )}
275
+ {scope.is('type', 'link') && (
276
+ <Link
277
+ {...defaultsUI}
278
+ onClick={onClick}
279
+ variant={scope.attr('variant', 'outlined')}
280
+ >
281
+ {original.icon && <CustomIcon />}
282
+ {original.label && (
283
+ <span className={getLabelClass('link')}>
284
+ {scope.getLabel()}
285
+ </span>
286
+ )}
287
+ </Link>
288
+ )}
289
+ {scope.is(
290
+ 'type',
291
+ 'text',
292
+ 'number',
293
+ 'phone',
294
+ 'postalCode',
295
+ 'money',
296
+ 'password',
297
+ 'email'
298
+ ) && (
299
+ <Input
300
+ {...defaultsInput}
301
+ {...defaultsUI}
302
+ InputProps={{ ...original.inputProps }}
303
+ />
304
+ )}
305
+ {scope.is('type', 'complete', 'autocomplete') && (
306
+ <UIComplete
307
+ scope={scope}
308
+ defaultsInput={defaultsInput}
309
+ defaultsUI={defaultsUI}
310
+ />
311
+ )}
312
+ {scope.is('type', 'checkbox', 'boolean', 'switch') && (
313
+ <Switch
314
+ checked={isChecked()}
315
+ {...defaultsInput}
316
+ onChange={onCheck}
317
+ />
318
+ )}
319
+ {scope.is('type', 'select') && (
320
+ <Select
321
+ {...defaultsInput}
322
+ {...defaultsUI}
323
+ value={scope.getSelectedValue()}
324
+ >
325
+ <Option value={''}>Selecione</Option>
326
+ {options.map((row: any, i: number) => (
327
+ <Option key={'i' + i} value={row.value}>
328
+ {row.label}
329
+ </Option>
330
+ ))}
331
+ </Select>
332
+ )}
333
+ {scope.is('type', 'radio') && (
334
+ <Radio {...defaultsInput} {...defaultsUI} row>
335
+ {options.map((row: any, i: number) => (
336
+ <Option
337
+ key={'i' + i}
338
+ control={<Radio {...defaultsUI} />}
339
+ label={row.label}
340
+ value={row.value}
341
+ />
342
+ ))}
343
+ </Radio>
344
+ )}
345
+ {scope.is('type', 'custom') && <Custom />}
346
+ {scope.is('type', 'column') && (
347
+ <>
348
+ {scope.is('format', 'img') && (
349
+ <img src={scope.getDisplayValue()} />
350
+ )}
351
+ {scope.is('format', 'icon') && (
352
+ <i className={scope.getDisplayValue()} />
353
+ )}
354
+ {!scope.is('format', 'icon', 'img') && (
355
+ <span>{scope.getDisplayValue()}</span>
356
+ )}
357
+ </>
358
+ )}
359
+ {scope.is('type', 'output') && (
360
+ <span>{scope.getDisplayValue()}</span>
361
+ )}
362
+ </div>
363
+ {error && <div className="ui-error">{error}</div>}
364
+ </>
365
+ )}
366
+ <CurrentRouter />
367
+ {!scope.is(
368
+ 'type',
369
+ 'card',
370
+ 'tabs',
371
+ 'grid',
372
+ 'list',
373
+ 'define',
374
+ 'repeat'
375
+ ) && <UIChildren {...props} scope={scope} crud={crud} />}
376
+ </div>
377
+ </>
378
+ );
379
+ }
@@ -0,0 +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
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import UIChildren from '../UIChildren';
3
+ import ElLabel from '../grid/ElLabel';
4
+ import ElInclude from '../grid/ElInclude';
5
+ import { ChildType } from 'react-crud-utils';
6
+
7
+ export default function ElCard(props: ChildType) {
8
+ let scope = props.scope;
9
+
10
+ return (
11
+ <div
12
+ className={scope.getStyleClass('inner')}
13
+ style={scope.getStyle('inner')}
14
+ >
15
+ <ElLabel {...props} scope={scope}></ElLabel>
16
+ <UIChildren {...props} scope={scope} />
17
+
18
+ <div
19
+ className={scope.getStyleClass('bottom')}
20
+ style={scope.getStyle('bottom')}
21
+ >
22
+ <ElInclude {...props} scope={scope} name="bottom" />
23
+ </div>
24
+ </div>
25
+ );
26
+ }
@@ -0,0 +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
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function AutoComplete(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Button(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Icon(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Input(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Link(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Option(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Radio(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Select(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
3
+
4
+ export default function Switch(props: any) {
5
+ const handlePress = () => {
6
+ Linking.openURL('https://reactnative.dev/');
7
+ };
8
+
9
+ return (
10
+ <TouchableOpacity onPress={handlePress}>
11
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
12
+ </TouchableOpacity>
13
+ );
14
+ }
15
+
16
+ const styles = {
17
+ link: {},
18
+ };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+
3
+ import ElGridRow from './ElGridRow';
4
+ import ElGridTop from './ElGridTop';
5
+ import ElGridFilter from './ElGridFilter';
6
+ import ElGridBotom from './ElGridBotom';
7
+ import ElLabel from './ElLabel';
8
+ import { ChildType, ComponentUtils, Scope } from 'react-crud-utils';
9
+
10
+ export default function ElGrid(props: ChildType) {
11
+ let scope: Scope = props.scope;
12
+ let items: any = scope.getItems();
13
+ let expansion = ComponentUtils.getDefine(props, 'expansion');
14
+
15
+ return (
16
+ <div
17
+ className={scope.getStyleClass('inner')}
18
+ style={scope.getStyle('inner')}
19
+ >
20
+ <ElLabel {...props} scope={scope} position="outside"></ElLabel>
21
+ <div
22
+ className={scope.getStyleClass('child')}
23
+ style={scope.getStyle('child')}
24
+ >
25
+ <ElLabel {...props} scope={scope} position="inside"></ElLabel>
26
+ <div className="ui-data">
27
+ <ElGridTop {...props} scope={scope}></ElGridTop>
28
+ <ElGridFilter scope={scope}></ElGridFilter>
29
+ <div className="ui-grid-data">
30
+ <table className="ui-grid ui-table">
31
+ <tbody>
32
+ {items.map((row: any, i: number) => (
33
+ <ElGridRow
34
+ {...props}
35
+ expansion={expansion}
36
+ key={'r' + i}
37
+ scope={scope}
38
+ value={row}
39
+ index={i}
40
+ />
41
+ ))}
42
+ </tbody>
43
+ </table>
44
+ </div>
45
+ </div>
46
+ <ElGridBotom {...props} scope={scope} />
47
+ </div>
48
+ </div>
49
+ );
50
+ }
@@ -0,0 +1,21 @@
1
+ import React, { useState } from "react";
2
+ import ElGridPaginator from "./ElGridPaginator";
3
+ import UI from "../UI";
4
+ import { ChildType } from "react-crud-utils";
5
+
6
+ export default function ElGridBotom(props: ChildType) {
7
+ let scope = props.scope;
8
+ let children = props.children;
9
+
10
+ return (
11
+ <div className="ui-grid-bottom">
12
+ <div className="ui-grid-bottom-inner">
13
+ <UI.Include {...props} transient name="bottomLeft" />
14
+ <ElGridPaginator scope={scope} position="bottom">
15
+ {children}
16
+ </ElGridPaginator>
17
+ <UI.Include {...props} transient name="bottomRight" />
18
+ </div>
19
+ </div>
20
+ );
21
+ }