react-crud-mobile 1.3.46 → 1.3.47

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.
@@ -489,8 +489,25 @@ function UIButton(props) {
489
489
  });
490
490
  }
491
491
 
492
+ //import { ThemeUtils, Utils } from 'react-crud-utils';
493
+ //import { StatusBar } from 'react-native';
494
+ var MobileUtils = /*#__PURE__*/function () {
495
+ function MobileUtils() {}
496
+ MobileUtils.syncTheme = function syncTheme() {
497
+ // let current = ThemeUtils.getCurrentTheme();
498
+ //let dec: any = { light: 'light-content', dark: 'dark-content' };
499
+ //let name = Utils.nvl(dec[current?.theme], dec.light);
500
+ //StatusBar.setBarStyle?.(name);
501
+ //StatusBar.setBackgroundColor?.(current?.colors?.theme);
502
+ };
503
+ return MobileUtils;
504
+ }();
505
+
492
506
  function UISelect(props) {
493
- var _theme$styles, _theme$colors, _scope$original, _scope$original2;
507
+ var _theme$styles, _theme$colors, _scope$original, _scope$original2, _scope$original3, _scope$original4;
508
+ var _useState = React.useState(false),
509
+ modalVisible = _useState[0],
510
+ setModalVisible = _useState[1];
494
511
  var scope = props.scope;
495
512
  var element = scope.original;
496
513
  var items = reactCrudUtils.Utils.nvl(scope.getOptions(), []);
@@ -498,17 +515,15 @@ function UISelect(props) {
498
515
  var value = scope.getDisplayValue();
499
516
  var theme = scope.getTheme();
500
517
  var headerStyle = reactCrudUtils.Utils.nvl((_theme$styles = theme.styles) == null || (_theme$styles = _theme$styles.defaults) == null ? void 0 : _theme$styles.header, {});
501
- var dlgName = scope.getName('dialog');
502
518
  var handlePress = function handlePress() {
503
- scope.call('click', {
504
- click: {
505
- action: 'dialog',
506
- dialog: dlgName
507
- }
508
- });
519
+ setModalVisible(!modalVisible);
509
520
  };
521
+ var scrollRef = React.useRef(null);
510
522
  var iconColor = reactCrudUtils.Utils.nvl((_theme$colors = theme.colors) == null ? void 0 : _theme$colors.text, '#100e0e');
511
523
  var modalColor = reactCrudUtils.Utils.nvl(headerStyle.color, 'white');
524
+ var defaults = {
525
+ color: modalColor
526
+ };
512
527
  var onClick = function onClick(_ref) {
513
528
  var value = _ref.value;
514
529
  var val = value;
@@ -519,11 +534,19 @@ function UISelect(props) {
519
534
  } else {
520
535
  scope.changeValue(value);
521
536
  }
537
+ setModalVisible(false);
522
538
  };
523
539
  var style = function style(part, extra) {
524
540
  var all = _extends({}, styles$3[part], extra);
525
541
  return scope.getStyle(part, all);
526
542
  };
543
+ var isModalVisible = function isModalVisible() {
544
+ return modalVisible;
545
+ };
546
+ //v4
547
+ React.useEffect(function () {
548
+ MobileUtils.syncTheme();
549
+ }, [modalVisible]);
527
550
  return /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
528
551
  style: style('selectRoot'),
529
552
  children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.TouchableOpacity, {
@@ -538,25 +561,101 @@ function UISelect(props) {
538
561
  color: scope.getPart('iconColor', null, iconColor),
539
562
  style: style('iconStyle', {})
540
563
  })]
541
- }), /*#__PURE__*/jsxRuntime.jsx(UI.Dialog, {
542
- name: dlgName,
543
- label: "Selecione",
544
- children: /*#__PURE__*/jsxRuntime.jsx(UI.List, _extends({
545
- data: items,
546
- name: scope.getName('list'),
547
- layout: "card",
548
- click: onClick,
549
- rowStyle: _extends({
550
- paddingLeft: 15,
551
- paddinRight: 15
552
- }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
553
- }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
554
- children: /*#__PURE__*/jsxRuntime.jsx(UI.Value, {
555
- value: "#{@this.label}"
556
- })
557
- }))
564
+ }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.Modal, {
565
+ animationType: "slide",
566
+ transparent: true,
567
+ visible: isModalVisible(),
568
+ onRequestClose: function onRequestClose() {
569
+ return setModalVisible(false);
570
+ },
571
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.SafeAreaView, {
572
+ style: style('modalTop')
573
+ }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.SafeAreaView, {
574
+ style: style('modalSafe'),
575
+ children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
576
+ style: scope.getStyle('header', headerStyle),
577
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableOpacity, {
578
+ onPress: handlePress,
579
+ style: style('modalCloseButton'),
580
+ children: /*#__PURE__*/jsxRuntime.jsx(vectorIcons.Ionicons, {
581
+ name: "close",
582
+ size: 24,
583
+ color: modalColor,
584
+ style: style('modalCloseText', defaults)
585
+ })
586
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
587
+ style: style('modalTitle', defaults),
588
+ children: placeholder
589
+ })]
590
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.ScrollView, {
591
+ contentContainerStyle: {
592
+ flexGrow: 1,
593
+ paddingBottom: 50
594
+ },
595
+ style: style('modalContent'),
596
+ nestedScrollEnabled: true,
597
+ ref: scrollRef,
598
+ children: /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
599
+ style: {
600
+ flex: 1
601
+ },
602
+ children: /*#__PURE__*/jsxRuntime.jsx(UI.List, _extends({
603
+ data: items,
604
+ name: scope.getName('list'),
605
+ layout: "card",
606
+ click: onClick,
607
+ rowStyle: _extends({
608
+ paddingLeft: 15,
609
+ paddinRight: 15
610
+ }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
611
+ }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
612
+ children: /*#__PURE__*/jsxRuntime.jsx(UI.Value, {
613
+ value: "#{@this.label}"
614
+ })
615
+ }))
616
+ })
617
+ })]
618
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.SafeAreaView, {
619
+ style: style('modalTop')
620
+ }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.SafeAreaView, {
621
+ style: style('modalSafe'),
622
+ children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
623
+ style: scope.getStyle('header', headerStyle),
624
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableOpacity, {
625
+ onPress: function onPress() {
626
+ return setModalVisible(false);
627
+ },
628
+ style: style('modalCloseButton'),
629
+ children: /*#__PURE__*/jsxRuntime.jsx(vectorIcons.Ionicons, {
630
+ name: "close",
631
+ size: 24,
632
+ color: modalColor,
633
+ style: style('modalCloseText', defaults)
634
+ })
635
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
636
+ style: style('modalTitle'),
637
+ children: placeholder
638
+ })]
639
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
640
+ style: style('modalContent'),
641
+ children: /*#__PURE__*/jsxRuntime.jsx(UI.List, _extends({
642
+ data: items,
643
+ name: scope.getName('list'),
644
+ layout: "card",
645
+ click: onClick,
646
+ rowStyle: _extends({
647
+ paddingLeft: 15,
648
+ paddinRight: 15
649
+ }, (_scope$original3 = scope.original) == null ? void 0 : _scope$original3.rowStyle)
650
+ }, (_scope$original4 = scope.original) == null ? void 0 : _scope$original4.listProps, {
651
+ children: /*#__PURE__*/jsxRuntime.jsx(UI.Value, {
652
+ value: "#{@this.label}"
653
+ })
654
+ }))
655
+ })]
656
+ })]
558
657
  })]
559
- }, scope.getName("" + scope.getPart('modal')));
658
+ }, scope.getName(scope.getPart('modal') + "_" + modalVisible));
560
659
  }
561
660
  var styles$3 = /*#__PURE__*/reactNative.StyleSheet.create({
562
661
  selectRoot: {
@@ -1458,20 +1557,6 @@ var styles$8 = /*#__PURE__*/reactNative.StyleSheet.create({
1458
1557
  }
1459
1558
  });
1460
1559
 
1461
- //import { ThemeUtils, Utils } from 'react-crud-utils';
1462
- //import { StatusBar } from 'react-native';
1463
- var MobileUtils = /*#__PURE__*/function () {
1464
- function MobileUtils() {}
1465
- MobileUtils.syncTheme = function syncTheme() {
1466
- // let current = ThemeUtils.getCurrentTheme();
1467
- //let dec: any = { light: 'light-content', dark: 'dark-content' };
1468
- //let name = Utils.nvl(dec[current?.theme], dec.light);
1469
- //StatusBar.setBarStyle?.(name);
1470
- //StatusBar.setBackgroundColor?.(current?.colors?.theme);
1471
- };
1472
- return MobileUtils;
1473
- }();
1474
-
1475
1560
  function UIView(_ref) {
1476
1561
  var _theme$styles, _theme$styles2;
1477
1562
  var scope = _ref.scope,