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