react-crud-mobile 1.0.606 → 1.0.608

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.
@@ -658,66 +658,21 @@ var styles$6 = /*#__PURE__*/reactNative.StyleSheet.create({
658
658
  });
659
659
 
660
660
  function UIListRow(props) {
661
- var _repeat$list;
662
661
  var parent = props.scope;
663
- var original = parent.original;
664
662
  var item = props.item;
665
663
  var index = props.index;
666
664
  var name = "" + parent.key('row', index);
667
- var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
668
- var rowWidth = Math.floor(100 / cols) + '%';
669
- var row = _extends({}, original, {
670
- list: null,
665
+ var row = {
671
666
  parent: parent,
672
667
  name: name,
673
668
  crud: parent.crud,
674
669
  index: index,
675
670
  type: 'row',
676
671
  data: item
677
- });
678
- var styles = (_repeat$list = {
679
- repeat: stylesRepeat,
680
- list: stylesList
681
- }) == null ? void 0 : _repeat$list[original.type];
672
+ };
682
673
  var _useState = React.useState(reactCrudUtils.ScopeUtils.create(row)),
683
674
  scope = _useState[0];
684
- var getRowStyle = function getRowStyle() {
685
- var row = scope.getStyle('row', _extends({}, styles.row));
686
- if (cols > 0) {
687
- row.width = rowWidth;
688
- }
689
- return row;
690
- };
691
- var onClick = function onClick(item) {
692
- scope.call('click', {
693
- value: item,
694
- item: item,
695
- edit: true
696
- });
697
- };
698
- var RowItem = function RowItem(_ref) {
699
- var item = _ref.item,
700
- index = _ref.index,
701
- children = _ref.children;
702
- if (!original.click) {
703
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
704
- style: getRowStyle(),
705
- children: children
706
- }, "k-" + index);
707
- }
708
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
709
- style: getRowStyle(),
710
- underlayColor: 'transparent',
711
- onPress: function onPress(e) {
712
- e.stopPropagation();
713
- onClick(item);
714
- },
715
- children: children
716
- }, "k-" + index);
717
- };
718
- return /*#__PURE__*/jsxRuntime.jsx(RowItem, {
719
- index: index,
720
- item: item,
675
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
721
676
  children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
722
677
  scope: scope,
723
678
  crud: scope.crud,
@@ -725,22 +680,6 @@ function UIListRow(props) {
725
680
  })
726
681
  });
727
682
  }
728
- var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
729
- row: {
730
- padding: 5,
731
- margin: 3,
732
- width: '100%',
733
- backgroundColor: '#f5f5f5',
734
- gap: 10,
735
- borderRadius: 8
736
- }
737
- });
738
- var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
739
- row: {
740
- padding: 0,
741
- width: '100%'
742
- }
743
- });
744
683
 
745
684
  function UIList(props) {
746
685
  var _repeat$list;
@@ -748,16 +687,31 @@ function UIList(props) {
748
687
  var crud = scope.crud;
749
688
  var original = scope.original;
750
689
  var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
690
+ var rowWidth = Math.floor(100 / cols) + '%';
751
691
  var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
752
692
  var styles = (_repeat$list = {
753
- repeat: stylesRepeat$1,
754
- list: stylesList$1
693
+ repeat: stylesRepeat,
694
+ list: stylesList
755
695
  }) == null ? void 0 : _repeat$list[original.type];
756
696
  var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
757
697
  var hideAddWhenEmpty = original.hideAddWhenEmpty;
698
+ var onClick = function onClick(item) {
699
+ scope.call('click', {
700
+ value: item,
701
+ item: item,
702
+ edit: true
703
+ });
704
+ };
758
705
  var getStyle = function getStyle(key, extra) {
759
706
  return scope.getStyle(key, _extends({}, extra, styles[key]));
760
707
  };
708
+ var getRowStyle = function getRowStyle(extra) {
709
+ var row = getStyle('row', {});
710
+ if (cols > 0) {
711
+ row.width = rowWidth;
712
+ }
713
+ return row;
714
+ };
761
715
  var getContainerStyle = function getContainerStyle(extra) {
762
716
  var row = getStyle('container', {});
763
717
  if (cols > 1) {
@@ -800,6 +754,26 @@ function UIList(props) {
800
754
  children: empty
801
755
  });
802
756
  };
757
+ var RowItem = function RowItem(_ref) {
758
+ var item = _ref.item,
759
+ index = _ref.index,
760
+ children = _ref.children;
761
+ if (!original.click) {
762
+ return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
763
+ style: getRowStyle(),
764
+ children: children
765
+ }, "k-" + index);
766
+ }
767
+ return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
768
+ style: getRowStyle(),
769
+ underlayColor: 'transparent',
770
+ onPress: function onPress(e) {
771
+ e.stopPropagation();
772
+ onClick(item);
773
+ },
774
+ children: children
775
+ }, "k-" + index);
776
+ };
803
777
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
804
778
  children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
805
779
  placeholder: "Pesquisar...",
@@ -813,11 +787,15 @@ function UIList(props) {
813
787
  }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
814
788
  style: getContainerStyle(),
815
789
  children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
816
- return /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
817
- scope: scope,
818
- item: item,
790
+ return /*#__PURE__*/jsxRuntime.jsx(RowItem, {
819
791
  index: i,
820
- children: props.children
792
+ item: item,
793
+ children: /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
794
+ scope: scope,
795
+ item: item,
796
+ index: i,
797
+ children: props.children
798
+ })
821
799
  });
822
800
  }), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
823
801
  children: add
@@ -825,7 +803,7 @@ function UIList(props) {
825
803
  })]
826
804
  });
827
805
  }
828
- var stylesList$1 = /*#__PURE__*/reactNative.StyleSheet.create({
806
+ var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
829
807
  container: {
830
808
  flex: 1,
831
809
  width: '100%',
@@ -833,12 +811,28 @@ var stylesList$1 = /*#__PURE__*/reactNative.StyleSheet.create({
833
811
  flexWrap: 'wrap',
834
812
  alignItems: 'stretch'
835
813
  },
814
+ row: {
815
+ padding: 5,
816
+ margin: 3,
817
+ width: '100%',
818
+ backgroundColor: '#f5f5f5',
819
+ gap: 10,
820
+ borderRadius: 8
821
+ },
822
+ rowInner: {
823
+ flexGrow: 1,
824
+ justifyContent: 'center',
825
+ alignItems: 'center',
826
+ borderRadius: 8,
827
+ padding: 10,
828
+ width: '100%'
829
+ },
836
830
  text: {
837
831
  fontSize: 18,
838
832
  fontWeight: 'bold'
839
833
  }
840
834
  });
841
- var stylesRepeat$1 = /*#__PURE__*/reactNative.StyleSheet.create({
835
+ var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
842
836
  container: {
843
837
  flex: 1,
844
838
  width: '100%',
@@ -847,6 +841,17 @@ var stylesRepeat$1 = /*#__PURE__*/reactNative.StyleSheet.create({
847
841
  gap: 10,
848
842
  alignItems: 'stretch'
849
843
  },
844
+ row: {
845
+ padding: 0,
846
+ width: '100%'
847
+ },
848
+ rowInner: {
849
+ flexGrow: 1,
850
+ justifyContent: 'center',
851
+ alignItems: 'center',
852
+ padding: 0,
853
+ width: '100%'
854
+ },
850
855
  text: {
851
856
  fontSize: 18,
852
857
  fontWeight: 'bold'