react-crud-mobile 1.0.603 → 1.0.604
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.
- package/dist/react-crud-mobile.cjs.development.js +72 -77
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +72 -77
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIList.tsx +3 -69
- package/src/elements/core/UIListRow.tsx +65 -2
|
@@ -658,21 +658,66 @@ var styles$6 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
658
658
|
});
|
|
659
659
|
|
|
660
660
|
function UIListRow(props) {
|
|
661
|
+
var _repeat$list;
|
|
661
662
|
var parent = props.scope;
|
|
663
|
+
var original = parent.original;
|
|
662
664
|
var item = props.item;
|
|
663
665
|
var index = props.index;
|
|
664
666
|
var name = "" + parent.key('row', index);
|
|
665
|
-
var
|
|
667
|
+
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
668
|
+
var rowWidth = Math.floor(100 / cols) + '%';
|
|
669
|
+
var row = _extends({}, original, {
|
|
670
|
+
list: null,
|
|
666
671
|
parent: parent,
|
|
667
672
|
name: name,
|
|
668
673
|
crud: parent.crud,
|
|
669
674
|
index: index,
|
|
670
675
|
type: 'row',
|
|
671
676
|
data: item
|
|
672
|
-
};
|
|
677
|
+
});
|
|
678
|
+
var styles = (_repeat$list = {
|
|
679
|
+
repeat: stylesRepeat,
|
|
680
|
+
list: stylesList
|
|
681
|
+
}) == null ? void 0 : _repeat$list[original.type];
|
|
673
682
|
var _useState = React.useState(reactCrudUtils.ScopeUtils.create(row)),
|
|
674
683
|
scope = _useState[0];
|
|
675
|
-
|
|
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,
|
|
676
721
|
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
677
722
|
scope: scope,
|
|
678
723
|
crud: scope.crud,
|
|
@@ -680,6 +725,22 @@ function UIListRow(props) {
|
|
|
680
725
|
})
|
|
681
726
|
});
|
|
682
727
|
}
|
|
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
|
+
});
|
|
683
744
|
|
|
684
745
|
function UIList(props) {
|
|
685
746
|
var _repeat$list;
|
|
@@ -687,31 +748,16 @@ function UIList(props) {
|
|
|
687
748
|
var crud = scope.crud;
|
|
688
749
|
var original = scope.original;
|
|
689
750
|
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
690
|
-
var rowWidth = Math.floor(100 / cols) + '%';
|
|
691
751
|
var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
|
|
692
752
|
var styles = (_repeat$list = {
|
|
693
|
-
repeat: stylesRepeat,
|
|
694
|
-
list: stylesList
|
|
753
|
+
repeat: stylesRepeat$1,
|
|
754
|
+
list: stylesList$1
|
|
695
755
|
}) == null ? void 0 : _repeat$list[original.type];
|
|
696
756
|
var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
|
|
697
757
|
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
|
-
};
|
|
705
758
|
var getStyle = function getStyle(key, extra) {
|
|
706
759
|
return scope.getStyle(key, _extends({}, extra, styles[key]));
|
|
707
760
|
};
|
|
708
|
-
var getRowStyle = function getRowStyle(extra) {
|
|
709
|
-
var row = getStyle('row', {});
|
|
710
|
-
if (cols > 0) {
|
|
711
|
-
row.width = rowWidth;
|
|
712
|
-
}
|
|
713
|
-
return row;
|
|
714
|
-
};
|
|
715
761
|
var getContainerStyle = function getContainerStyle(extra) {
|
|
716
762
|
var row = getStyle('container', {});
|
|
717
763
|
if (cols > 1) {
|
|
@@ -754,26 +800,6 @@ function UIList(props) {
|
|
|
754
800
|
children: empty
|
|
755
801
|
});
|
|
756
802
|
};
|
|
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
|
-
};
|
|
777
803
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
778
804
|
children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
|
|
779
805
|
placeholder: "Pesquisar...",
|
|
@@ -787,15 +813,11 @@ function UIList(props) {
|
|
|
787
813
|
}), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
|
|
788
814
|
style: getContainerStyle(),
|
|
789
815
|
children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
|
|
790
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
791
|
-
|
|
816
|
+
return /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
|
|
817
|
+
scope: scope,
|
|
792
818
|
item: item,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
item: item,
|
|
796
|
-
index: i,
|
|
797
|
-
children: props.children
|
|
798
|
-
})
|
|
819
|
+
index: i,
|
|
820
|
+
children: props.children
|
|
799
821
|
});
|
|
800
822
|
}), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
801
823
|
children: add
|
|
@@ -803,7 +825,7 @@ function UIList(props) {
|
|
|
803
825
|
})]
|
|
804
826
|
});
|
|
805
827
|
}
|
|
806
|
-
var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
828
|
+
var stylesList$1 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
807
829
|
container: {
|
|
808
830
|
flex: 1,
|
|
809
831
|
width: '100%',
|
|
@@ -811,28 +833,12 @@ var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
811
833
|
flexWrap: 'wrap',
|
|
812
834
|
alignItems: 'stretch'
|
|
813
835
|
},
|
|
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
|
-
},
|
|
830
836
|
text: {
|
|
831
837
|
fontSize: 18,
|
|
832
838
|
fontWeight: 'bold'
|
|
833
839
|
}
|
|
834
840
|
});
|
|
835
|
-
var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
841
|
+
var stylesRepeat$1 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
836
842
|
container: {
|
|
837
843
|
flex: 1,
|
|
838
844
|
width: '100%',
|
|
@@ -841,17 +847,6 @@ var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
841
847
|
gap: 10,
|
|
842
848
|
alignItems: 'stretch'
|
|
843
849
|
},
|
|
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
|
-
},
|
|
855
850
|
text: {
|
|
856
851
|
fontSize: 18,
|
|
857
852
|
fontWeight: 'bold'
|