react-crud-mobile 1.0.71 → 1.0.72
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.
- package/dist/react-crud-mobile.cjs.development.js +74 -78
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +75 -79
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/UIElement.tsx +135 -145
|
@@ -22,15 +22,7 @@ import Switch from './core/Switch';
|
|
|
22
22
|
import Option from './core/Option';
|
|
23
23
|
import Radio from './core/Radio';
|
|
24
24
|
import Input from './core/Input';
|
|
25
|
-
import {
|
|
26
|
-
Image,
|
|
27
|
-
Linking,
|
|
28
|
-
StyleSheet,
|
|
29
|
-
Text,
|
|
30
|
-
Keyboard,
|
|
31
|
-
TouchableWithoutFeedback,
|
|
32
|
-
View,
|
|
33
|
-
} from 'react-native';
|
|
25
|
+
import { Image, Linking, StyleSheet, Text, View } from 'react-native';
|
|
34
26
|
|
|
35
27
|
export default function UIElement(props: ElementType) {
|
|
36
28
|
let [scope] = useState(ScopeUtils.create(props));
|
|
@@ -264,142 +256,140 @@ export default function UIElement(props: ElementType) {
|
|
|
264
256
|
|
|
265
257
|
return (
|
|
266
258
|
<>
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
{
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
{
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
{
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
>
|
|
349
|
-
|
|
350
|
-
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
{
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
{scope.
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
{scope.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
{scope.
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
</View>
|
|
402
|
-
</TouchableWithoutFeedback>
|
|
259
|
+
<View ref={ref} style={getStyle()}>
|
|
260
|
+
<>
|
|
261
|
+
{isShowLabel() && (
|
|
262
|
+
<Text style={getStyle('label')}>{scope.getLabel()}</Text>
|
|
263
|
+
)}
|
|
264
|
+
{isShowInner() && (
|
|
265
|
+
<>
|
|
266
|
+
<View style={getStyle('inner')}>
|
|
267
|
+
{scope.is('type', 'button') && (
|
|
268
|
+
<Button
|
|
269
|
+
{...defaultsUI}
|
|
270
|
+
onClick={onClick}
|
|
271
|
+
variant={scope.attr('variant', 'outlined')}
|
|
272
|
+
>
|
|
273
|
+
{original.icon && <CustomIcon />}
|
|
274
|
+
{original.label && (
|
|
275
|
+
<Text style={scope.getPart('label', 'button')}>
|
|
276
|
+
{scope.getLabel()}
|
|
277
|
+
</Text>
|
|
278
|
+
)}
|
|
279
|
+
</Button>
|
|
280
|
+
)}
|
|
281
|
+
{scope.is('type', 'icon') && (
|
|
282
|
+
<Icon
|
|
283
|
+
{...defaultsUI}
|
|
284
|
+
onClick={onClick}
|
|
285
|
+
variant={scope.attr('variant', 'outlined')}
|
|
286
|
+
>
|
|
287
|
+
{scope.getDisplayValue()}
|
|
288
|
+
</Icon>
|
|
289
|
+
)}
|
|
290
|
+
{scope.is('type', 'link') && (
|
|
291
|
+
<Link
|
|
292
|
+
{...defaultsUI}
|
|
293
|
+
onClick={onClick}
|
|
294
|
+
variant={scope.attr('variant', 'outlined')}
|
|
295
|
+
>
|
|
296
|
+
{original.icon && <CustomIcon />}
|
|
297
|
+
{original.label && (
|
|
298
|
+
<Text style={scope.getPart('label', 'link')}>
|
|
299
|
+
{scope.getLabel()}
|
|
300
|
+
</Text>
|
|
301
|
+
)}
|
|
302
|
+
</Link>
|
|
303
|
+
)}
|
|
304
|
+
{scope.is(
|
|
305
|
+
'type',
|
|
306
|
+
'text',
|
|
307
|
+
'number',
|
|
308
|
+
'phone',
|
|
309
|
+
'postalCode',
|
|
310
|
+
'money',
|
|
311
|
+
'password',
|
|
312
|
+
'email'
|
|
313
|
+
) && (
|
|
314
|
+
<Input
|
|
315
|
+
{...defaultsInput}
|
|
316
|
+
{...defaultsUI}
|
|
317
|
+
InputProps={{ ...original.inputProps }}
|
|
318
|
+
/>
|
|
319
|
+
)}
|
|
320
|
+
{scope.is('type', 'complete', 'autocomplete') && (
|
|
321
|
+
<UIComplete
|
|
322
|
+
scope={scope}
|
|
323
|
+
defaultsInput={defaultsInput}
|
|
324
|
+
defaultsUI={defaultsUI}
|
|
325
|
+
/>
|
|
326
|
+
)}
|
|
327
|
+
{scope.is('type', 'checkbox', 'boolean', 'switch') && (
|
|
328
|
+
<Switch
|
|
329
|
+
checked={isChecked()}
|
|
330
|
+
{...defaultsInput}
|
|
331
|
+
onChange={onCheck}
|
|
332
|
+
/>
|
|
333
|
+
)}
|
|
334
|
+
{scope.is('type', 'select') && (
|
|
335
|
+
<Select
|
|
336
|
+
{...defaultsInput}
|
|
337
|
+
{...defaultsUI}
|
|
338
|
+
value={scope.getSelectedValue()}
|
|
339
|
+
>
|
|
340
|
+
<Option value={''}>Selecione</Option>
|
|
341
|
+
{options.map((row: any, i: number) => (
|
|
342
|
+
<Option key={'i' + i} value={row.value}>
|
|
343
|
+
{row.label}
|
|
344
|
+
</Option>
|
|
345
|
+
))}
|
|
346
|
+
</Select>
|
|
347
|
+
)}
|
|
348
|
+
{scope.is('type', 'radio') && (
|
|
349
|
+
<Radio {...defaultsInput} {...defaultsUI} row>
|
|
350
|
+
{options.map((row: any, i: number) => (
|
|
351
|
+
<Option
|
|
352
|
+
key={'i' + i}
|
|
353
|
+
control={<Radio {...defaultsUI} />}
|
|
354
|
+
label={row.label}
|
|
355
|
+
value={row.value}
|
|
356
|
+
/>
|
|
357
|
+
))}
|
|
358
|
+
</Radio>
|
|
359
|
+
)}
|
|
360
|
+
{scope.is('type', 'custom') && <Custom />}
|
|
361
|
+
{scope.is('type', 'column') && (
|
|
362
|
+
<>
|
|
363
|
+
{scope.is('format', 'img') && (
|
|
364
|
+
<Image source={scope.getDisplayValue()} />
|
|
365
|
+
)}
|
|
366
|
+
{scope.is('format', 'icon') && (
|
|
367
|
+
<Icon className={scope.getDisplayValue()} />
|
|
368
|
+
)}
|
|
369
|
+
{!scope.is('format', 'icon', 'img') && (
|
|
370
|
+
<Text>{scope.getDisplayValue()}</Text>
|
|
371
|
+
)}
|
|
372
|
+
</>
|
|
373
|
+
)}
|
|
374
|
+
{scope.is('type', 'output') && (
|
|
375
|
+
<Text>{scope.getDisplayValue()}</Text>
|
|
376
|
+
)}
|
|
377
|
+
</View>
|
|
378
|
+
{error && <View style={getStyle('error')}>{error}</View>}
|
|
379
|
+
</>
|
|
380
|
+
)}
|
|
381
|
+
<CurrentRouter />
|
|
382
|
+
{!scope.is(
|
|
383
|
+
'type',
|
|
384
|
+
'card',
|
|
385
|
+
'tabs',
|
|
386
|
+
'grid',
|
|
387
|
+
'list',
|
|
388
|
+
'define',
|
|
389
|
+
'repeat'
|
|
390
|
+
) && <UIChildren {...props} scope={scope} crud={crud} />}
|
|
391
|
+
</>
|
|
392
|
+
</View>
|
|
403
393
|
</>
|
|
404
394
|
);
|
|
405
395
|
}
|