react-crud-mobile 1.3.45 → 1.3.46

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,25 +489,8 @@ 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
-
506
492
  function UISelect(props) {
507
493
  var _theme$styles, _theme$colors, _scope$original, _scope$original2;
508
- var _useState = React.useState(false),
509
- modalVisible = _useState[0],
510
- setModalVisible = _useState[1];
511
494
  var scope = props.scope;
512
495
  var element = scope.original;
513
496
  var items = reactCrudUtils.Utils.nvl(scope.getOptions(), []);
@@ -515,14 +498,17 @@ function UISelect(props) {
515
498
  var value = scope.getDisplayValue();
516
499
  var theme = scope.getTheme();
517
500
  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');
518
502
  var handlePress = function handlePress() {
519
- setModalVisible(!modalVisible);
503
+ scope.call('click', {
504
+ click: {
505
+ action: 'dialog',
506
+ dialog: dlgName
507
+ }
508
+ });
520
509
  };
521
510
  var iconColor = reactCrudUtils.Utils.nvl((_theme$colors = theme.colors) == null ? void 0 : _theme$colors.text, '#100e0e');
522
511
  var modalColor = reactCrudUtils.Utils.nvl(headerStyle.color, 'white');
523
- var defaults = {
524
- color: modalColor
525
- };
526
512
  var onClick = function onClick(_ref) {
527
513
  var value = _ref.value;
528
514
  var val = value;
@@ -533,19 +519,11 @@ function UISelect(props) {
533
519
  } else {
534
520
  scope.changeValue(value);
535
521
  }
536
- setModalVisible(false);
537
522
  };
538
523
  var style = function style(part, extra) {
539
524
  var all = _extends({}, styles$3[part], extra);
540
525
  return scope.getStyle(part, all);
541
526
  };
542
- var isModalVisible = function isModalVisible() {
543
- return modalVisible;
544
- };
545
- //v4
546
- React.useEffect(function () {
547
- MobileUtils.syncTheme();
548
- }, [modalVisible]);
549
527
  return /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
550
528
  style: style('selectRoot'),
551
529
  children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.TouchableOpacity, {
@@ -560,54 +538,25 @@ function UISelect(props) {
560
538
  color: scope.getPart('iconColor', null, iconColor),
561
539
  style: style('iconStyle', {})
562
540
  })]
563
- }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.Modal, {
564
- animationType: "slide",
565
- transparent: true,
566
- visible: isModalVisible(),
567
- onRequestClose: function onRequestClose() {
568
- return setModalVisible(false);
569
- },
570
- children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.SafeAreaView, {
571
- style: style('modalTop')
572
- }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.SafeAreaView, {
573
- style: style('modalSafe'),
574
- children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
575
- style: scope.getStyle('header', headerStyle),
576
- children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableOpacity, {
577
- onPress: function onPress() {
578
- return setModalVisible(false);
579
- },
580
- style: style('modalCloseButton'),
581
- children: /*#__PURE__*/jsxRuntime.jsx(vectorIcons.Ionicons, {
582
- name: "close",
583
- size: 24,
584
- color: modalColor,
585
- style: style('modalCloseText', defaults)
586
- })
587
- }), /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
588
- style: style('modalTitle'),
589
- children: placeholder
590
- })]
591
- }), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
592
- style: style('modalContent'),
593
- children: /*#__PURE__*/jsxRuntime.jsx(UI.List, _extends({
594
- data: items,
595
- name: scope.getName('list'),
596
- layout: "card",
597
- click: onClick,
598
- rowStyle: _extends({
599
- paddingLeft: 15,
600
- paddinRight: 15
601
- }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
602
- }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
603
- children: /*#__PURE__*/jsxRuntime.jsx(UI.Value, {
604
- value: "#{@this.label}"
605
- })
606
- }))
607
- })]
608
- })]
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
+ }))
609
558
  })]
610
- }, scope.getName(scope.getPart('modal') + "_" + modalVisible));
559
+ }, scope.getName("" + scope.getPart('modal')));
611
560
  }
612
561
  var styles$3 = /*#__PURE__*/reactNative.StyleSheet.create({
613
562
  selectRoot: {
@@ -1411,9 +1360,6 @@ function UIModal(props) {
1411
1360
  }
1412
1361
  scope.update();
1413
1362
  };
1414
- React.useEffect(function () {
1415
- MobileUtils.syncTheme();
1416
- }, [modalVisible]);
1417
1363
  var curr = scope.currentDialog;
1418
1364
  if (!curr) {
1419
1365
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
@@ -1512,6 +1458,20 @@ var styles$8 = /*#__PURE__*/reactNative.StyleSheet.create({
1512
1458
  }
1513
1459
  });
1514
1460
 
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
+
1515
1475
  function UIView(_ref) {
1516
1476
  var _theme$styles, _theme$styles2;
1517
1477
  var scope = _ref.scope,