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.
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect, useRef, useContext, useLayoutEffect, createContext } from 'react';
2
- import { Utils, ScopeUtils, CrudUtils, ViewUtils, ComponentUtils, 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';
2
+ import { Utils, ScopeUtils, CrudUtils, ComponentUtils, ViewUtils, HtmlUtils, ThemeUtils, useTheme } from 'react-crud-utils';
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,41 +481,26 @@ 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(), []);
506
489
  var placeholder = scope.attr('placeholder', 'Selecione...');
507
490
  var value = scope.getDisplayValue();
508
- var main = ViewUtils.getCrud('view');
509
491
  var theme = scope.getTheme();
510
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');
511
494
  var handlePress = function handlePress() {
512
- setModalVisible(!modalVisible);
495
+ scope.call('click', {
496
+ click: {
497
+ action: 'dialog',
498
+ dialog: dlgName
499
+ }
500
+ });
513
501
  };
514
502
  var iconColor = Utils.nvl((_theme$colors = theme.colors) == null ? void 0 : _theme$colors.text, '#100e0e');
515
503
  var modalColor = Utils.nvl(headerStyle.color, 'white');
516
- var defaults = {
517
- color: modalColor
518
- };
519
504
  var onClick = function onClick(_ref) {
520
505
  var value = _ref.value;
521
506
  var val = value;
@@ -526,20 +511,11 @@ function UISelect(props) {
526
511
  } else {
527
512
  scope.changeValue(value);
528
513
  }
529
- setModalVisible(false);
530
514
  };
531
515
  var style = function style(part, extra) {
532
516
  var all = _extends({}, styles$3[part], extra);
533
517
  return scope.getStyle(part, all);
534
518
  };
535
- var isModalVisible = function isModalVisible() {
536
- return modalVisible;
537
- };
538
- //v4
539
- useEffect(function () {
540
- MobileUtils.syncTheme();
541
- }, [modalVisible]);
542
- console.log(scope.original);
543
519
  return /*#__PURE__*/jsxs(View, {
544
520
  style: style('selectRoot'),
545
521
  children: [/*#__PURE__*/jsxs(TouchableOpacity, {
@@ -554,54 +530,25 @@ function UISelect(props) {
554
530
  color: scope.getPart('iconColor', null, iconColor),
555
531
  style: style('iconStyle', {})
556
532
  })]
557
- }), /*#__PURE__*/jsxs(Modal, {
558
- animationType: "slide",
559
- transparent: true,
560
- visible: isModalVisible(),
561
- onRequestClose: function onRequestClose() {
562
- return setModalVisible(false);
563
- },
564
- children: [/*#__PURE__*/jsx(SafeAreaView, {
565
- style: style('modalTop')
566
- }), /*#__PURE__*/jsxs(SafeAreaView, {
567
- style: style('modalSafe'),
568
- children: [/*#__PURE__*/jsxs(View, {
569
- style: scope.getStyle('header', headerStyle),
570
- children: [/*#__PURE__*/jsx(TouchableOpacity, {
571
- onPress: function onPress() {
572
- return setModalVisible(false);
573
- },
574
- style: style('modalCloseButton'),
575
- children: /*#__PURE__*/jsx(Ionicons$1, {
576
- name: "close",
577
- size: 24,
578
- color: modalColor,
579
- style: style('modalCloseText', defaults)
580
- })
581
- }), /*#__PURE__*/jsx(Text, {
582
- style: style('modalTitle'),
583
- children: placeholder
584
- })]
585
- }), /*#__PURE__*/jsx(View, {
586
- style: style('modalContent'),
587
- children: /*#__PURE__*/jsx(UI.List, _extends({
588
- data: items,
589
- name: scope.getName('list'),
590
- layout: "card",
591
- click: onClick,
592
- rowStyle: _extends({
593
- paddingLeft: 15,
594
- paddinRight: 15
595
- }, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
596
- }, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
597
- children: /*#__PURE__*/jsx(UI.Value, {
598
- value: "#{@this.label}"
599
- })
600
- }))
601
- })]
602
- })]
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
+ }))
603
550
  })]
604
- }, scope.getName(scope.getPart('modal') + "_" + modalVisible));
551
+ }, scope.getName("" + scope.getPart('modal')));
605
552
  }
606
553
  var styles$3 = /*#__PURE__*/StyleSheet.create({
607
554
  selectRoot: {
@@ -1405,9 +1352,6 @@ function UIModal(props) {
1405
1352
  }
1406
1353
  scope.update();
1407
1354
  };
1408
- useEffect(function () {
1409
- MobileUtils.syncTheme();
1410
- }, [modalVisible]);
1411
1355
  var curr = scope.currentDialog;
1412
1356
  if (!curr) {
1413
1357
  return /*#__PURE__*/jsx(Fragment, {});
@@ -1506,6 +1450,20 @@ var styles$8 = /*#__PURE__*/StyleSheet.create({
1506
1450
  }
1507
1451
  });
1508
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
+
1509
1467
  function UIView(_ref) {
1510
1468
  var _theme$styles, _theme$styles2;
1511
1469
  var scope = _ref.scope,