react-crud-mobile 1.0.392 → 1.0.394

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 (32) hide show
  1. package/dist/react-crud-mobile.cjs.development.js +15 -3
  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 +15 -3
  6. package/dist/react-crud-mobile.esm.js.map +1 -1
  7. package/package.json +71 -71
  8. package/src/elements/UI.tsx +65 -65
  9. package/src/elements/UIChildren.tsx +126 -126
  10. package/src/elements/UIComplete.tsx +14 -14
  11. package/src/elements/UIElement.tsx +496 -496
  12. package/src/elements/UITag.tsx +13 -13
  13. package/src/elements/charts/ElChart.tsx +10 -10
  14. package/src/elements/core/UIAutoComplete.tsx +17 -17
  15. package/src/elements/core/UIButton.tsx +73 -73
  16. package/src/elements/core/UIIcon.tsx +17 -17
  17. package/src/elements/core/UIInclude.tsx +40 -40
  18. package/src/elements/core/UIInput.tsx +69 -69
  19. package/src/elements/core/UILink.tsx +17 -17
  20. package/src/elements/core/UIList.tsx +117 -102
  21. package/src/elements/core/UIListItem.tsx +32 -32
  22. package/src/elements/core/UIListRow.tsx +29 -29
  23. package/src/elements/core/UIModal.tsx +111 -111
  24. package/src/elements/core/UIOption.tsx +17 -17
  25. package/src/elements/core/UIQuantity.tsx +97 -97
  26. package/src/elements/core/UIRadio.tsx +17 -17
  27. package/src/elements/core/UISelect.tsx +122 -122
  28. package/src/elements/core/UISwitch.tsx +26 -26
  29. package/src/elements/core/UIToggle.tsx +102 -102
  30. package/src/elements/index.ts +1 -1
  31. package/src/elements/tabs/ElTabs.tsx +178 -178
  32. package/src/index.ts +1 -1
@@ -1,496 +1,496 @@
1
- import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
- import UIChildren from './UIChildren';
3
- import ElTabs from './tabs/ElTabs';
4
- import ElChart from './charts/ElChart';
5
- import UIComplete from './UIComplete';
6
- import {
7
- Crud,
8
- HtmlUtils,
9
- ScopeUtils,
10
- Utils,
11
- ElementType,
12
- ChildType,
13
- } from 'react-crud-utils';
14
- import UILink from './core/UILink';
15
- import UIIcon from './core/UIIcon';
16
- import UIButton from './core/UIButton';
17
- import UISelect from './core/UISelect';
18
- import UISwitch from './core/UISwitch';
19
- import UIOption from './core/UIOption';
20
- import UIRadio from './core/UIRadio';
21
- import UIInput from './core/UIInput';
22
- import { Image, Linking, StyleSheet, Text, View } from 'react-native';
23
- import UIList from './core/UIList';
24
- import UIToggle from './core/UIToggle';
25
- import UIQuantity from './core/UIQuantity';
26
- import UIModal from './core/UIModal';
27
-
28
- export default function UIElement(props: ElementType) {
29
- let scope = ScopeUtils.create(props);
30
- let [index, setIndex] = useState(0);
31
- let [error, setError]: string | any = useState(null);
32
- let options: any = scope.getOptions();
33
- let crud: Crud = Utils.nvl(props.crud, scope.crud);
34
- let original = scope.original;
35
- let type = original.type;
36
- let ref = useRef(null);
37
-
38
- scope.update = () => {
39
- setIndex(++index);
40
- };
41
-
42
- scope.updateElement = () => {
43
- setIndex(++index);
44
- };
45
-
46
- const Custom = () => {
47
- let c: any = original.custom;
48
-
49
- if (c) {
50
- if (typeof c === 'string') {
51
- return (
52
- <UIElement
53
- element={{ value: c, type: 'dummy' }}
54
- crud={crud}
55
- ></UIElement>
56
- );
57
- }
58
-
59
- return (
60
- <UIElement
61
- type={c.type}
62
- tag={c.type}
63
- {...c.props}
64
- crud={crud}
65
- ></UIElement>
66
- );
67
- }
68
-
69
- return <></>;
70
- };
71
-
72
- if (scope.is('type', 'dummy')) {
73
- return <>{scope.getDisplayValue()}</>;
74
- }
75
-
76
- let onCheck = () => {
77
- let v = scope.getValue();
78
- let check = !(v === true);
79
-
80
- onChange({ target: { value: check } });
81
- };
82
-
83
- let onChange = (e: any) => {
84
- let val = e.target.value;
85
-
86
- if (scope.isType('integer', 'int', 'number')) {
87
- val = parseInt(val);
88
- } else if (scope.isType('decimal')) {
89
- val = parseFloat(val);
90
- }
91
-
92
- if (scope.isType('select', 'complete')) {
93
- val = scope.getSelectedItem(val);
94
- }
95
-
96
- scope.changeValue(val);
97
- scope.update();
98
- };
99
-
100
- let onClick = (e: any) => {
101
- scope.call('click');
102
- };
103
-
104
- let defaultsInput: any = {
105
- scope,
106
- crud,
107
- onChange: onChange,
108
- };
109
-
110
- if (scope.isType('password')) {
111
- defaultsInput.type = 'password';
112
- }
113
-
114
- let isChecked = () => {
115
- let v = scope.getValue();
116
-
117
- return v === true;
118
- };
119
-
120
- let hasChildren = () => {
121
- if (scope.isInput()) {
122
- return false;
123
- }
124
-
125
- return !Utils.isEmpty(props.children) || !Utils.isEmpty(props.elements);
126
- };
127
-
128
- let isInput = scope.is(
129
- 'type',
130
- 'text',
131
- 'number',
132
- 'phone',
133
- 'postalCode',
134
- 'money',
135
- 'password',
136
- 'email'
137
- );
138
-
139
- const getStyle = (part?: string) => {
140
- let type = Utils.nvl(original.type, 'none');
141
- let key = Utils.nvl(part, 'root');
142
- let def = { ...styles[key], ...elementStyle?.[type]?.[key] };
143
- let hasChild = hasChildren();
144
-
145
- if (!part && !hasChild) {
146
- def = { ...def };
147
- }
148
-
149
- if (hasChild && part) {
150
- def = { ...def, ...withChildStyles[part] };
151
- }
152
-
153
- if (isInput) {
154
- def = { ...def, ...elementStyle.input[key] };
155
- }
156
-
157
- return { ...def, ...scope.getStyle(part, def) };
158
- };
159
-
160
- let elStyle = getStyle('element');
161
-
162
- let defaultsUI: any = {
163
- required: scope.isRequired(),
164
- size: 'small',
165
- scope,
166
- crud,
167
- style: elStyle,
168
- placeholder: scope.attr('placeholder', 'Digite aqui'),
169
- };
170
-
171
- scope.error = (msg: string) => {
172
- error = msg;
173
- setError(msg);
174
- };
175
-
176
- if (!original.list?.url && !original.load?.url) {
177
- scope.start();
178
- }
179
-
180
- useEffect(() => {
181
- scope.start();
182
- });
183
-
184
- const CustomIcon = () => {
185
- if (typeof original.icon === 'string') {
186
- return <UIIcon>{scope.getIcon()}</UIIcon>;
187
- }
188
- return <>{original.icon}</>;
189
- };
190
-
191
- scope.open = (args: any) => {
192
- Linking.openURL(args.url);
193
- };
194
-
195
- useLayoutEffect(() => {
196
- if (ref?.current && scope.is('type', 'card', 'list', 'tabs', 'stepper')) {
197
- let el: any = ref?.current;
198
-
199
- if (el?.classList) {
200
- let bg = HtmlUtils.getBGColor(el);
201
-
202
- if (bg === 'rgb(255, 255, 255)') {
203
- el.classList.add('ui-dark');
204
- } else {
205
- el.classList.add('ui-light');
206
- }
207
- }
208
- }
209
- });
210
-
211
- const isShowLabel = () => {
212
- if (
213
- typeof original.label !== 'undefined' &&
214
- original.label !== false &&
215
- !scope.isType('button', 'dialog', 'modal')
216
- ) {
217
- return true;
218
- }
219
-
220
- return false;
221
- };
222
-
223
- const isShowInner = () => {
224
- if (hasChildren()) {
225
- return false;
226
- }
227
- return true;
228
- };
229
-
230
- if (!scope.isRendered() || scope.is('type', 'define')) {
231
- return <></>;
232
- }
233
-
234
- const isShowChild = () => {
235
- if (
236
- scope.is(
237
- 'type',
238
- 'tabs',
239
- 'grid',
240
- 'list',
241
- 'define',
242
- 'repeat',
243
- 'modal',
244
- 'dialog',
245
- 'chart'
246
- )
247
- ) {
248
- return false;
249
- }
250
-
251
- return true;
252
- };
253
-
254
- return (
255
- <>
256
- <View ref={ref} style={getStyle()}>
257
- <>
258
- {isShowLabel() && (
259
- <Text style={getStyle('label')}>{scope.getLabel()}</Text>
260
- )}
261
- {isShowInner() && (
262
- <>
263
- <View style={getStyle('inner')}>
264
- {scope.is('type', 'button') && (
265
- <UIButton
266
- {...defaultsUI}
267
- onClick={onClick}
268
- variant={scope.attr('variant', 'outlined')}
269
- >
270
- {original.icon && <CustomIcon />}
271
- {original.label && (
272
- <Text style={scope.getPart('label', 'button')}>
273
- {scope.getLabel()}
274
- </Text>
275
- )}
276
- </UIButton>
277
- )}
278
- {scope.is('type', 'icon') && (
279
- <UIIcon
280
- {...defaultsUI}
281
- onClick={onClick}
282
- variant={scope.attr('variant', 'outlined')}
283
- >
284
- {scope.getDisplayValue()}
285
- </UIIcon>
286
- )}
287
- {scope.is('type', 'link') && (
288
- <UILink
289
- {...defaultsUI}
290
- onClick={onClick}
291
- variant={scope.attr('variant', 'outlined')}
292
- >
293
- {original.icon && <CustomIcon />}
294
- {original.label && (
295
- <Text style={scope.getPart('label', 'link')}>
296
- {scope.getLabel()}
297
- </Text>
298
- )}
299
- </UILink>
300
- )}
301
- {isInput && (
302
- <UIInput
303
- {...defaultsInput}
304
- {...defaultsUI}
305
- InputProps={{ ...original.inputProps }}
306
- />
307
- )}
308
- {scope.is('type', 'complete', 'autocomplete') && (
309
- <UIComplete
310
- scope={scope}
311
- defaultsInput={defaultsInput}
312
- defaultsUI={defaultsUI}
313
- />
314
- )}
315
- {scope.is('type', 'quantity') && (
316
- <UIQuantity
317
- scope={scope}
318
- defaultsInput={defaultsInput}
319
- defaultsUI={defaultsUI}
320
- />
321
- )}
322
- {scope.is('type', 'checkbox', 'boolean', 'switch') && (
323
- <UISwitch
324
- checked={isChecked()}
325
- {...defaultsInput}
326
- onChange={onCheck}
327
- />
328
- )}
329
- {scope.is('type', 'select') && (
330
- <UISelect
331
- {...defaultsInput}
332
- {...defaultsUI}
333
- value={scope.getSelectedValue()}
334
- />
335
- )}
336
- {scope.is('type', 'toggle') && (
337
- <UIToggle
338
- {...defaultsInput}
339
- {...defaultsUI}
340
- value={scope.getSelectedValue()}
341
- />
342
- )}
343
- {scope.is('type', 'radio') && (
344
- <UIRadio {...defaultsInput} {...defaultsUI} row>
345
- {options.map((row: any, i: number) => (
346
- <UIOption
347
- key={'i' + i}
348
- control={<UIRadio {...defaultsUI} />}
349
- label={row.label}
350
- value={row.value}
351
- />
352
- ))}
353
- </UIRadio>
354
- )}
355
- {scope.is('type', 'custom') && <Custom />}
356
- {scope.is('type', 'column') && (
357
- <>
358
- {scope.is('format', 'img') && (
359
- <Image source={scope.getDisplayValue()} />
360
- )}
361
- {scope.is('format', 'icon') && (
362
- <UIIcon className={scope.getDisplayValue()} />
363
- )}
364
- {!scope.is('format', 'icon', 'img') && (
365
- <Text>{scope.getDisplayValue()}</Text>
366
- )}
367
- </>
368
- )}
369
- {scope.is('type', 'output', 'value') && (
370
- <Text>{scope.getDisplayValue()}</Text>
371
- )}
372
- </View>
373
- {error && <View style={getStyle('error')}>{error}</View>}
374
- </>
375
- )}
376
- {scope.isType('type', 'list', 'repeat') && (
377
- <UIList {...props} scope={scope} crud={crud} />
378
- )}
379
- {scope.isType('type', 'dialog') && (
380
- <UIModal {...props} scope={scope} crud={crud} />
381
- )}
382
- {scope.isType('type', 'chart') && (
383
- <ElChart {...props} scope={scope} crud={crud} />
384
- )}
385
- {scope.isType('type', 'tabs') && (
386
- <ElTabs {...props} scope={scope} crud={crud} />
387
- )}
388
-
389
- {isShowChild() && <UIChildren {...props} scope={scope} crud={crud} />}
390
- </>
391
- </View>
392
- </>
393
- );
394
- }
395
-
396
- const box: any = {
397
- backgroundColor: 'white',
398
- padding: 16,
399
- borderRadius: 10,
400
- width: '100%',
401
- shadowColor: '#888', // iOS
402
- shadowOffset: { width: 0, height: 1 }, // iOS
403
- shadowOpacity: 0.25, // iOS
404
- shadowRadius: 3.84, // iOS
405
- elevation: 3, // Android
406
- };
407
-
408
- const elementStyle: any = {};
409
-
410
- elementStyle.card = StyleSheet.create({
411
- root: {
412
- ...box,
413
- },
414
- inner: {
415
- flex: 1,
416
- width: '100%',
417
- paddingBottom: 10,
418
- paddingTop: 5,
419
- alignSelf: 'flex-start',
420
- flexDirection: 'row',
421
- flexWrap: 'wrap',
422
- gap: 10,
423
- },
424
- });
425
-
426
- elementStyle.input = StyleSheet.create({
427
- inner: {
428
- flex: 1,
429
- width: '100%',
430
- paddingBottom: 0,
431
- paddingTop: 0,
432
- alignItems: 'center',
433
- borderWidth: 1,
434
- borderColor: 'borderColor',
435
- borderRadius: 20,
436
- paddingHorizontal: 15,
437
- alignSelf: 'flex-start',
438
- flexDirection: 'row',
439
- flexWrap: 'wrap',
440
- },
441
- });
442
-
443
- elementStyle.quantity = {
444
- inner: {
445
- ...box,
446
- padding: 5,
447
- borderRadius: 25,
448
- flexWrap: 'nowrap',
449
- flex: 1,
450
- flexDirection: 'row',
451
- justifyContent: 'center',
452
- alignItems: 'center',
453
- },
454
- };
455
-
456
- elementStyle.toggle = StyleSheet.create({
457
- inner: {
458
- ...box,
459
- flex: 1,
460
- width: '100%',
461
- gap: 10,
462
- justifyContent: 'center',
463
- flexDirection: 'row',
464
- paddingHorizontal: 10,
465
- paddingVertical: 0,
466
- alignSelf: 'flex-start',
467
- flexWrap: 'nowrap',
468
- },
469
- });
470
-
471
- elementStyle.list = {
472
- ...elementStyle.card,
473
- };
474
-
475
- const styles = StyleSheet.create({
476
- root: {
477
- gap: 5,
478
- flexDirection: 'column',
479
- flexWrap: 'wrap',
480
- width: '100%',
481
- alignItems: 'flex-start',
482
- },
483
- label: { width: '100%', fontWeight: 500, fontSize: 12 },
484
- inner: { width: '100%', marginBottom: 10 },
485
- });
486
-
487
- const withChildStyles = StyleSheet.create({
488
- root: {
489
- gap: 10,
490
- },
491
- label: {
492
- width: '100%',
493
- fontWeight: 500,
494
- fontSize: 24,
495
- },
496
- });
1
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import UIChildren from './UIChildren';
3
+ import ElTabs from './tabs/ElTabs';
4
+ import ElChart from './charts/ElChart';
5
+ import UIComplete from './UIComplete';
6
+ import {
7
+ Crud,
8
+ HtmlUtils,
9
+ ScopeUtils,
10
+ Utils,
11
+ ElementType,
12
+ ChildType,
13
+ } from 'react-crud-utils';
14
+ import UILink from './core/UILink';
15
+ import UIIcon from './core/UIIcon';
16
+ import UIButton from './core/UIButton';
17
+ import UISelect from './core/UISelect';
18
+ import UISwitch from './core/UISwitch';
19
+ import UIOption from './core/UIOption';
20
+ import UIRadio from './core/UIRadio';
21
+ import UIInput from './core/UIInput';
22
+ import { Image, Linking, StyleSheet, Text, View } from 'react-native';
23
+ import UIList from './core/UIList';
24
+ import UIToggle from './core/UIToggle';
25
+ import UIQuantity from './core/UIQuantity';
26
+ import UIModal from './core/UIModal';
27
+
28
+ export default function UIElement(props: ElementType) {
29
+ let scope = ScopeUtils.create(props);
30
+ let [index, setIndex] = useState(0);
31
+ let [error, setError]: string | any = useState(null);
32
+ let options: any = scope.getOptions();
33
+ let crud: Crud = Utils.nvl(props.crud, scope.crud);
34
+ let original = scope.original;
35
+ let type = original.type;
36
+ let ref = useRef(null);
37
+
38
+ scope.update = () => {
39
+ setIndex(++index);
40
+ };
41
+
42
+ scope.updateElement = () => {
43
+ setIndex(++index);
44
+ };
45
+
46
+ const Custom = () => {
47
+ let c: any = original.custom;
48
+
49
+ if (c) {
50
+ if (typeof c === 'string') {
51
+ return (
52
+ <UIElement
53
+ element={{ value: c, type: 'dummy' }}
54
+ crud={crud}
55
+ ></UIElement>
56
+ );
57
+ }
58
+
59
+ return (
60
+ <UIElement
61
+ type={c.type}
62
+ tag={c.type}
63
+ {...c.props}
64
+ crud={crud}
65
+ ></UIElement>
66
+ );
67
+ }
68
+
69
+ return <></>;
70
+ };
71
+
72
+ if (scope.is('type', 'dummy')) {
73
+ return <>{scope.getDisplayValue()}</>;
74
+ }
75
+
76
+ let onCheck = () => {
77
+ let v = scope.getValue();
78
+ let check = !(v === true);
79
+
80
+ onChange({ target: { value: check } });
81
+ };
82
+
83
+ let onChange = (e: any) => {
84
+ let val = e.target.value;
85
+
86
+ if (scope.isType('integer', 'int', 'number')) {
87
+ val = parseInt(val);
88
+ } else if (scope.isType('decimal')) {
89
+ val = parseFloat(val);
90
+ }
91
+
92
+ if (scope.isType('select', 'complete')) {
93
+ val = scope.getSelectedItem(val);
94
+ }
95
+
96
+ scope.changeValue(val);
97
+ scope.update();
98
+ };
99
+
100
+ let onClick = (e: any) => {
101
+ scope.call('click');
102
+ };
103
+
104
+ let defaultsInput: any = {
105
+ scope,
106
+ crud,
107
+ onChange: onChange,
108
+ };
109
+
110
+ if (scope.isType('password')) {
111
+ defaultsInput.type = 'password';
112
+ }
113
+
114
+ let isChecked = () => {
115
+ let v = scope.getValue();
116
+
117
+ return v === true;
118
+ };
119
+
120
+ let hasChildren = () => {
121
+ if (scope.isInput()) {
122
+ return false;
123
+ }
124
+
125
+ return !Utils.isEmpty(props.children) || !Utils.isEmpty(props.elements);
126
+ };
127
+
128
+ let isInput = scope.is(
129
+ 'type',
130
+ 'text',
131
+ 'number',
132
+ 'phone',
133
+ 'postalCode',
134
+ 'money',
135
+ 'password',
136
+ 'email'
137
+ );
138
+
139
+ const getStyle = (part?: string) => {
140
+ let type = Utils.nvl(original.type, 'none');
141
+ let key = Utils.nvl(part, 'root');
142
+ let def = { ...styles[key], ...elementStyle?.[type]?.[key] };
143
+ let hasChild = hasChildren();
144
+
145
+ if (!part && !hasChild) {
146
+ def = { ...def };
147
+ }
148
+
149
+ if (hasChild && part) {
150
+ def = { ...def, ...withChildStyles[part] };
151
+ }
152
+
153
+ if (isInput) {
154
+ def = { ...def, ...elementStyle.input[key] };
155
+ }
156
+
157
+ return { ...def, ...scope.getStyle(part, def) };
158
+ };
159
+
160
+ let elStyle = getStyle('element');
161
+
162
+ let defaultsUI: any = {
163
+ required: scope.isRequired(),
164
+ size: 'small',
165
+ scope,
166
+ crud,
167
+ style: elStyle,
168
+ placeholder: scope.attr('placeholder', 'Digite aqui'),
169
+ };
170
+
171
+ scope.error = (msg: string) => {
172
+ error = msg;
173
+ setError(msg);
174
+ };
175
+
176
+ if (!original.list?.url && !original.load?.url) {
177
+ scope.start();
178
+ }
179
+
180
+ useEffect(() => {
181
+ scope.start();
182
+ });
183
+
184
+ const CustomIcon = () => {
185
+ if (typeof original.icon === 'string') {
186
+ return <UIIcon>{scope.getIcon()}</UIIcon>;
187
+ }
188
+ return <>{original.icon}</>;
189
+ };
190
+
191
+ scope.open = (args: any) => {
192
+ Linking.openURL(args.url);
193
+ };
194
+
195
+ useLayoutEffect(() => {
196
+ if (ref?.current && scope.is('type', 'card', 'list', 'tabs', 'stepper')) {
197
+ let el: any = ref?.current;
198
+
199
+ if (el?.classList) {
200
+ let bg = HtmlUtils.getBGColor(el);
201
+
202
+ if (bg === 'rgb(255, 255, 255)') {
203
+ el.classList.add('ui-dark');
204
+ } else {
205
+ el.classList.add('ui-light');
206
+ }
207
+ }
208
+ }
209
+ });
210
+
211
+ const isShowLabel = () => {
212
+ if (
213
+ typeof original.label !== 'undefined' &&
214
+ original.label !== false &&
215
+ !scope.isType('button', 'dialog', 'modal')
216
+ ) {
217
+ return true;
218
+ }
219
+
220
+ return false;
221
+ };
222
+
223
+ const isShowInner = () => {
224
+ if (hasChildren()) {
225
+ return false;
226
+ }
227
+ return true;
228
+ };
229
+
230
+ if (!scope.isRendered() || scope.is('type', 'define')) {
231
+ return <></>;
232
+ }
233
+
234
+ const isShowChild = () => {
235
+ if (
236
+ scope.is(
237
+ 'type',
238
+ 'tabs',
239
+ 'grid',
240
+ 'list',
241
+ 'define',
242
+ 'repeat',
243
+ 'modal',
244
+ 'dialog',
245
+ 'chart'
246
+ )
247
+ ) {
248
+ return false;
249
+ }
250
+
251
+ return true;
252
+ };
253
+
254
+ return (
255
+ <>
256
+ <View ref={ref} style={getStyle()}>
257
+ <>
258
+ {isShowLabel() && (
259
+ <Text style={getStyle('label')}>{scope.getLabel()}</Text>
260
+ )}
261
+ {isShowInner() && (
262
+ <>
263
+ <View style={getStyle('inner')}>
264
+ {scope.is('type', 'button') && (
265
+ <UIButton
266
+ {...defaultsUI}
267
+ onClick={onClick}
268
+ variant={scope.attr('variant', 'outlined')}
269
+ >
270
+ {original.icon && <CustomIcon />}
271
+ {original.label && (
272
+ <Text style={scope.getPart('label', 'button')}>
273
+ {scope.getLabel()}
274
+ </Text>
275
+ )}
276
+ </UIButton>
277
+ )}
278
+ {scope.is('type', 'icon') && (
279
+ <UIIcon
280
+ {...defaultsUI}
281
+ onClick={onClick}
282
+ variant={scope.attr('variant', 'outlined')}
283
+ >
284
+ {scope.getDisplayValue()}
285
+ </UIIcon>
286
+ )}
287
+ {scope.is('type', 'link') && (
288
+ <UILink
289
+ {...defaultsUI}
290
+ onClick={onClick}
291
+ variant={scope.attr('variant', 'outlined')}
292
+ >
293
+ {original.icon && <CustomIcon />}
294
+ {original.label && (
295
+ <Text style={scope.getPart('label', 'link')}>
296
+ {scope.getLabel()}
297
+ </Text>
298
+ )}
299
+ </UILink>
300
+ )}
301
+ {isInput && (
302
+ <UIInput
303
+ {...defaultsInput}
304
+ {...defaultsUI}
305
+ InputProps={{ ...original.inputProps }}
306
+ />
307
+ )}
308
+ {scope.is('type', 'complete', 'autocomplete') && (
309
+ <UIComplete
310
+ scope={scope}
311
+ defaultsInput={defaultsInput}
312
+ defaultsUI={defaultsUI}
313
+ />
314
+ )}
315
+ {scope.is('type', 'quantity') && (
316
+ <UIQuantity
317
+ scope={scope}
318
+ defaultsInput={defaultsInput}
319
+ defaultsUI={defaultsUI}
320
+ />
321
+ )}
322
+ {scope.is('type', 'checkbox', 'boolean', 'switch') && (
323
+ <UISwitch
324
+ checked={isChecked()}
325
+ {...defaultsInput}
326
+ onChange={onCheck}
327
+ />
328
+ )}
329
+ {scope.is('type', 'select') && (
330
+ <UISelect
331
+ {...defaultsInput}
332
+ {...defaultsUI}
333
+ value={scope.getSelectedValue()}
334
+ />
335
+ )}
336
+ {scope.is('type', 'toggle') && (
337
+ <UIToggle
338
+ {...defaultsInput}
339
+ {...defaultsUI}
340
+ value={scope.getSelectedValue()}
341
+ />
342
+ )}
343
+ {scope.is('type', 'radio') && (
344
+ <UIRadio {...defaultsInput} {...defaultsUI} row>
345
+ {options.map((row: any, i: number) => (
346
+ <UIOption
347
+ key={'i' + i}
348
+ control={<UIRadio {...defaultsUI} />}
349
+ label={row.label}
350
+ value={row.value}
351
+ />
352
+ ))}
353
+ </UIRadio>
354
+ )}
355
+ {scope.is('type', 'custom') && <Custom />}
356
+ {scope.is('type', 'column') && (
357
+ <>
358
+ {scope.is('format', 'img') && (
359
+ <Image source={scope.getDisplayValue()} />
360
+ )}
361
+ {scope.is('format', 'icon') && (
362
+ <UIIcon className={scope.getDisplayValue()} />
363
+ )}
364
+ {!scope.is('format', 'icon', 'img') && (
365
+ <Text>{scope.getDisplayValue()}</Text>
366
+ )}
367
+ </>
368
+ )}
369
+ {scope.is('type', 'output', 'value') && (
370
+ <Text>{scope.getDisplayValue()}</Text>
371
+ )}
372
+ </View>
373
+ {error && <View style={getStyle('error')}>{error}</View>}
374
+ </>
375
+ )}
376
+ {scope.isType('type', 'list', 'repeat') && (
377
+ <UIList {...props} scope={scope} crud={crud} />
378
+ )}
379
+ {scope.isType('type', 'dialog') && (
380
+ <UIModal {...props} scope={scope} crud={crud} />
381
+ )}
382
+ {scope.isType('type', 'chart') && (
383
+ <ElChart {...props} scope={scope} crud={crud} />
384
+ )}
385
+ {scope.isType('type', 'tabs') && (
386
+ <ElTabs {...props} scope={scope} crud={crud} />
387
+ )}
388
+
389
+ {isShowChild() && <UIChildren {...props} scope={scope} crud={crud} />}
390
+ </>
391
+ </View>
392
+ </>
393
+ );
394
+ }
395
+
396
+ const box: any = {
397
+ backgroundColor: 'white',
398
+ padding: 16,
399
+ borderRadius: 10,
400
+ width: '100%',
401
+ shadowColor: '#888', // iOS
402
+ shadowOffset: { width: 0, height: 1 }, // iOS
403
+ shadowOpacity: 0.25, // iOS
404
+ shadowRadius: 3.84, // iOS
405
+ elevation: 3, // Android
406
+ };
407
+
408
+ const elementStyle: any = {};
409
+
410
+ elementStyle.card = StyleSheet.create({
411
+ root: {
412
+ ...box,
413
+ },
414
+ inner: {
415
+ flex: 1,
416
+ width: '100%',
417
+ paddingBottom: 10,
418
+ paddingTop: 5,
419
+ alignSelf: 'flex-start',
420
+ flexDirection: 'row',
421
+ flexWrap: 'wrap',
422
+ gap: 10,
423
+ },
424
+ });
425
+
426
+ elementStyle.input = StyleSheet.create({
427
+ inner: {
428
+ flex: 1,
429
+ width: '100%',
430
+ paddingBottom: 0,
431
+ paddingTop: 0,
432
+ alignItems: 'center',
433
+ borderWidth: 1,
434
+ borderColor: 'borderColor',
435
+ borderRadius: 20,
436
+ paddingHorizontal: 15,
437
+ alignSelf: 'flex-start',
438
+ flexDirection: 'row',
439
+ flexWrap: 'wrap',
440
+ },
441
+ });
442
+
443
+ elementStyle.quantity = {
444
+ inner: {
445
+ ...box,
446
+ padding: 5,
447
+ borderRadius: 25,
448
+ flexWrap: 'nowrap',
449
+ flex: 1,
450
+ flexDirection: 'row',
451
+ justifyContent: 'center',
452
+ alignItems: 'center',
453
+ },
454
+ };
455
+
456
+ elementStyle.toggle = StyleSheet.create({
457
+ inner: {
458
+ ...box,
459
+ flex: 1,
460
+ width: '100%',
461
+ gap: 10,
462
+ justifyContent: 'center',
463
+ flexDirection: 'row',
464
+ paddingHorizontal: 10,
465
+ paddingVertical: 0,
466
+ alignSelf: 'flex-start',
467
+ flexWrap: 'nowrap',
468
+ },
469
+ });
470
+
471
+ elementStyle.list = {
472
+ ...elementStyle.card,
473
+ };
474
+
475
+ const styles = StyleSheet.create({
476
+ root: {
477
+ gap: 5,
478
+ flexDirection: 'column',
479
+ flexWrap: 'wrap',
480
+ width: '100%',
481
+ alignItems: 'flex-start',
482
+ },
483
+ label: { width: '100%', fontWeight: 500, fontSize: 12 },
484
+ inner: { width: '100%', marginBottom: 10 },
485
+ });
486
+
487
+ const withChildStyles = StyleSheet.create({
488
+ root: {
489
+ gap: 10,
490
+ },
491
+ label: {
492
+ width: '100%',
493
+ fontWeight: 500,
494
+ fontSize: 24,
495
+ },
496
+ });