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.
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, useRef, useContext, useLayoutEffect, createContext } from 'react';
2
2
  import { Utils, ScopeUtils, CrudUtils, ComponentUtils, ViewUtils, HtmlUtils, ThemeUtils, useTheme } from 'react-crud-utils';
3
- import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight, Modal, SafeAreaView, Switch, TextInput, Platform, Dimensions, ScrollView, Alert, Image, StatusBar, KeyboardAvoidingView, TouchableWithoutFeedback, Keyboard } from 'react-native';
3
+ import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight, Switch, TextInput, Platform, Dimensions, Modal, SafeAreaView, ScrollView, Alert, Image, StatusBar, KeyboardAvoidingView, TouchableWithoutFeedback, Keyboard } from 'react-native';
4
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
5
5
  import Ionicons from '@expo/vector-icons/Ionicons';
6
6
  import { Ionicons as Ionicons$1, AntDesign, Entypo, EvilIcons, MaterialCommunityIcons } from '@expo/vector-icons';
@@ -481,25 +481,8 @@ function UIButton(props) {
481
481
  });
482
482
  }
483
483
 
484
- //import { ThemeUtils, Utils } from 'react-crud-utils';
485
- //import { StatusBar } from 'react-native';
486
- var MobileUtils = /*#__PURE__*/function () {
487
- function MobileUtils() {}
488
- MobileUtils.syncTheme = function syncTheme() {
489
- // let current = ThemeUtils.getCurrentTheme();
490
- //let dec: any = { light: 'light-content', dark: 'dark-content' };
491
- //let name = Utils.nvl(dec[current?.theme], dec.light);
492
- //StatusBar.setBarStyle?.(name);
493
- //StatusBar.setBackgroundColor?.(current?.colors?.theme);
494
- };
495
- return MobileUtils;
496
- }();
497
-
498
484
  function UISelect(props) {
499
485
  var _theme$styles, _theme$colors, _scope$original, _scope$original2;
500
- var _useState = useState(false),
501
- modalVisible = _useState[0],
502
- setModalVisible = _useState[1];
503
486
  var scope = props.scope;
504
487
  var element = scope.original;
505
488
  var items = Utils.nvl(scope.getOptions(), []);
@@ -507,14 +490,17 @@ function UISelect(props) {
507
490
  var value = scope.getDisplayValue();
508
491
  var theme = scope.getTheme();
509
492
  var headerStyle = Utils.nvl((_theme$styles = theme.styles) == null || (_theme$styles = _theme$styles.defaults) == null ? void 0 : _theme$styles.header, {});
493
+ var dlgName = scope.getName('dialog');
510
494
  var handlePress = function handlePress() {
511
- setModalVisible(!modalVisible);
495
+ scope.call('click', {
496
+ click: {
497
+ action: 'dialog',
498
+ dialog: dlgName
499
+ }
500
+ });
512
501
  };
513
502
  var iconColor = Utils.nvl((_theme$colors = theme.colors) == null ? void 0 : _theme$colors.text, '#100e0e');
514
503
  var modalColor = Utils.nvl(headerStyle.color, 'white');
515
- var defaults = {
516
- color: modalColor
517
- };
518
504
  var onClick = function onClick(_ref) {
519
505
  var value = _ref.value;
520
506
  var val = value;
@@ -525,19 +511,11 @@ function UISelect(props) {
525
511
  } else {
526
512
  scope.changeValue(value);
527
513
  }
528
- setModalVisible(false);
529
514
  };
530
515
  var style = function style(part, extra) {
531
516
  var all = _extends({}, styles$3[part], extra);
532
517
  return scope.getStyle(part, all);
533
518
  };
534
- var isModalVisible = function isModalVisible() {
535
- return modalVisible;
536
- };
537
- //v4
538
- useEffect(function () {
539
- MobileUtils.syncTheme();
540
- }, [modalVisible]);
541
519
  return /*#__PURE__*/jsxs(View, {
542
520
  style: style('selectRoot'),
543
521
  children: [/*#__PURE__*/jsxs(TouchableOpacity, {
@@ -552,54 +530,25 @@ function UISelect(props) {
552
530
  color: scope.getPart('iconColor', null, iconColor),
553
531
  style: style('iconStyle', {})
554
532
  })]
555
- }), /*#__PURE__*/jsxs(Modal, {
556
- animationType: "slide",
557
- transparent: true,
558
- visible: isModalVisible(),
559
- onRequestClose: function onRequestClose() {
560
- return setModalVisible(false);
561
- },
562
- children: [/*#__PURE__*/jsx(SafeAreaView, {
563
- style: style('modalTop')
564
- }), /*#__PURE__*/jsxs(SafeAreaView, {
565
- style: style('modalSafe'),
566
- children: [/*#__PURE__*/jsxs(View, {
567
- style: scope.getStyle('header', headerStyle),
568
- children: [/*#__PURE__*/jsx(TouchableOpacity, {
569
- onPress: function onPress() {
570
- return setModalVisible(false);
571
- },
572
- style: style('modalCloseButton'),
573
- children: /*#__PURE__*/jsx(Ionicons$1, {
574
- name: "close",
575
- size: 24,
576
- color: modalColor,
577
- style: style('modalCloseText', defaults)
578
- })
579
- }), /*#__PURE__*/jsx(Text, {
580
- style: style('modalTitle'),
581
- children: placeholder
582
- })]
583
- }), /*#__PURE__*/jsx(View, {
584
- style: style('modalContent'),
585
- children: /*#__PURE__*/jsx(UI.List, _extends({
586
- data: items,
587
- name: scope.getName('list'),
588
- layout: "card",
589
- click: onClick,
590
- rowStyle: _extends({
591
- paddingLeft: 15,
592
- paddinRight: 15
593
- }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
594
- }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
595
- children: /*#__PURE__*/jsx(UI.Value, {
596
- value: "#{@this.label}"
597
- })
598
- }))
599
- })]
600
- })]
533
+ }), /*#__PURE__*/jsx(UI.Dialog, {
534
+ name: dlgName,
535
+ label: "Selecione",
536
+ children: /*#__PURE__*/jsx(UI.List, _extends({
537
+ data: items,
538
+ name: scope.getName('list'),
539
+ layout: "card",
540
+ click: onClick,
541
+ rowStyle: _extends({
542
+ paddingLeft: 15,
543
+ paddinRight: 15
544
+ }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
545
+ }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
546
+ children: /*#__PURE__*/jsx(UI.Value, {
547
+ value: "#{@this.label}"
548
+ })
549
+ }))
601
550
  })]
602
- }, scope.getName(scope.getPart('modal') + "_" + modalVisible));
551
+ }, scope.getName("" + scope.getPart('modal')));
603
552
  }
604
553
  var styles$3 = /*#__PURE__*/StyleSheet.create({
605
554
  selectRoot: {
@@ -1403,9 +1352,6 @@ function UIModal(props) {
1403
1352
  }
1404
1353
  scope.update();
1405
1354
  };
1406
- useEffect(function () {
1407
- MobileUtils.syncTheme();
1408
- }, [modalVisible]);
1409
1355
  var curr = scope.currentDialog;
1410
1356
  if (!curr) {
1411
1357
  return /*#__PURE__*/jsx(Fragment, {});
@@ -1504,6 +1450,20 @@ var styles$8 = /*#__PURE__*/StyleSheet.create({
1504
1450
  }
1505
1451
  });
1506
1452
 
1453
+ //import { ThemeUtils, Utils } from 'react-crud-utils';
1454
+ //import { StatusBar } from 'react-native';
1455
+ var MobileUtils = /*#__PURE__*/function () {
1456
+ function MobileUtils() {}
1457
+ MobileUtils.syncTheme = function syncTheme() {
1458
+ // let current = ThemeUtils.getCurrentTheme();
1459
+ //let dec: any = { light: 'light-content', dark: 'dark-content' };
1460
+ //let name = Utils.nvl(dec[current?.theme], dec.light);
1461
+ //StatusBar.setBarStyle?.(name);
1462
+ //StatusBar.setBackgroundColor?.(current?.colors?.theme);
1463
+ };
1464
+ return MobileUtils;
1465
+ }();
1466
+
1507
1467
  function UIView(_ref) {
1508
1468
  var _theme$styles, _theme$styles2;
1509
1469
  var scope = _ref.scope,