react-crud-mobile 1.0.615 → 1.0.617

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.
@@ -113,7 +113,7 @@ function UIChildren(props) {
113
113
  var getStyle = function getStyle(part) {
114
114
  var key = reactCrudUtils.Utils.nvl(part, 'root');
115
115
  var def = styles[key];
116
- return _extends({}, def, props.style, scope.getStyle(part));
116
+ return _extends({}, def, scope.getStyle(part));
117
117
  };
118
118
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
119
119
  children: /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
@@ -657,18 +657,92 @@ var styles$6 = /*#__PURE__*/reactNative.StyleSheet.create({
657
657
  }
658
658
  });
659
659
 
660
- function UIList(props) {
660
+ function UIListRow(props) {
661
661
  var _repeat$list;
662
662
  var scope = props.scope;
663
- var crud = scope.crud;
663
+ var index = props.index;
664
664
  var original = scope.original;
665
+ var item = props.item;
665
666
  var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
666
667
  var rowWidth = Math.floor(100 / cols) + '%';
667
- var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
668
668
  var styles = (_repeat$list = {
669
669
  repeat: stylesRepeat,
670
670
  list: stylesList
671
671
  }) == null ? void 0 : _repeat$list[original.type];
672
+ var name = "" + scope.key('row', index, '');
673
+ var row = reactCrudUtils.ScopeUtils.create(_extends({}, original, {
674
+ parent: scope,
675
+ name: name,
676
+ crud: scope.crud,
677
+ index: index,
678
+ type: 'row',
679
+ data: item
680
+ }));
681
+ var getRowStyle = function getRowStyle() {
682
+ var css = row.getStyle('row', _extends({}, styles.row));
683
+ if (cols > 0) {
684
+ css.width = rowWidth;
685
+ }
686
+ return css;
687
+ };
688
+ var onClick = function onClick(item) {
689
+ row.call('click', {
690
+ value: item,
691
+ item: item,
692
+ edit: true
693
+ });
694
+ };
695
+ if (!original.click) {
696
+ return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
697
+ style: getRowStyle(),
698
+ children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
699
+ scope: row,
700
+ crud: row.crud,
701
+ children: props.children
702
+ })
703
+ }, "k-" + index);
704
+ }
705
+ return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
706
+ underlayColor: 'transparent',
707
+ onPress: function onPress(e) {
708
+ e.stopPropagation();
709
+ onClick(item);
710
+ },
711
+ children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
712
+ scope: row,
713
+ crud: row.crud,
714
+ children: props.children
715
+ })
716
+ }, "k-" + index);
717
+ }
718
+ var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
719
+ row: {
720
+ padding: 5,
721
+ margin: 3,
722
+ width: '100%',
723
+ backgroundColor: '#f5f5f5',
724
+ gap: 10,
725
+ borderRadius: 8
726
+ }
727
+ });
728
+ var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
729
+ row: {
730
+ padding: 0,
731
+ width: '100%'
732
+ }
733
+ });
734
+
735
+ function UIList(props) {
736
+ var _repeat$list;
737
+ var scope = props.scope;
738
+ var crud = scope.crud;
739
+ var original = scope.original;
740
+ var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
741
+ var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
742
+ var styles = (_repeat$list = {
743
+ repeat: stylesRepeat$1,
744
+ list: stylesList$1
745
+ }) == null ? void 0 : _repeat$list[original.type];
672
746
  var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
673
747
  var hideAddWhenEmpty = original.hideAddWhenEmpty;
674
748
  var getStyle = function getStyle(key, extra) {
@@ -716,56 +790,6 @@ function UIList(props) {
716
790
  children: empty
717
791
  });
718
792
  };
719
- var RowItem = function RowItem(_ref) {
720
- var item = _ref.item,
721
- index = _ref.index,
722
- children = _ref.children;
723
- var name = "" + scope.key('row', index, '');
724
- var row = reactCrudUtils.ScopeUtils.create(_extends({}, original, {
725
- parent: scope,
726
- name: name,
727
- crud: scope.crud,
728
- index: index,
729
- type: 'row',
730
- data: item
731
- }));
732
- var getRowStyle = function getRowStyle() {
733
- var css = row.getStyle('row', _extends({}, styles.row));
734
- if (cols > 0) {
735
- css.width = rowWidth;
736
- }
737
- return css;
738
- };
739
- var onClick = function onClick(item) {
740
- row.call('click', {
741
- value: item,
742
- item: item,
743
- edit: true
744
- });
745
- };
746
- if (!original.click) {
747
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
748
- style: getRowStyle(),
749
- children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
750
- scope: row,
751
- crud: row.crud,
752
- children: children
753
- })
754
- }, "k-" + index);
755
- }
756
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
757
- underlayColor: 'transparent',
758
- onPress: function onPress(e) {
759
- e.stopPropagation();
760
- onClick(item);
761
- },
762
- children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
763
- scope: row,
764
- crud: row.crud,
765
- children: children
766
- })
767
- }, "k-" + index);
768
- };
769
793
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
770
794
  children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
771
795
  placeholder: "Pesquisar...",
@@ -779,9 +803,10 @@ function UIList(props) {
779
803
  }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
780
804
  style: getContainerStyle(),
781
805
  children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
782
- return /*#__PURE__*/jsxRuntime.jsx(RowItem, {
806
+ return /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
783
807
  index: i,
784
808
  item: item,
809
+ scope: scope,
785
810
  children: props.children
786
811
  });
787
812
  }), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -790,7 +815,7 @@ function UIList(props) {
790
815
  })]
791
816
  });
792
817
  }
793
- var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
818
+ var stylesList$1 = /*#__PURE__*/reactNative.StyleSheet.create({
794
819
  container: {
795
820
  flex: 1,
796
821
  width: '100%',
@@ -819,7 +844,7 @@ var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
819
844
  fontWeight: 'bold'
820
845
  }
821
846
  });
822
- var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
847
+ var stylesRepeat$1 = /*#__PURE__*/reactNative.StyleSheet.create({
823
848
  container: {
824
849
  flex: 1,
825
850
  width: '100%',
@@ -845,17 +870,6 @@ var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
845
870
  }
846
871
  });
847
872
 
848
- function UIListRow(props) {
849
- var scope = props.scope;
850
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
851
- children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
852
- scope: scope,
853
- crud: scope.crud,
854
- children: props.children
855
- })
856
- });
857
- }
858
-
859
873
  function UIToggle(props) {
860
874
  var scope = props.scope;
861
875
  var options = reactCrudUtils.Utils.nvl(scope.getOptions(), []);