react-crud-mobile 1.0.602 → 1.0.603
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 +52 -111
- 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 +52 -111
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIList.tsx +42 -3
- package/src/elements/core/UIListRow.tsx +4 -104
|
@@ -658,9 +658,7 @@ 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);
|
|
@@ -672,112 +670,16 @@ function UIListRow(props) {
|
|
|
672
670
|
type: 'row',
|
|
673
671
|
data: item
|
|
674
672
|
};
|
|
675
|
-
var styles = (_repeat$list = {
|
|
676
|
-
repeat: stylesRepeat,
|
|
677
|
-
list: stylesList
|
|
678
|
-
}) == null ? void 0 : _repeat$list[original.type];
|
|
679
|
-
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
680
|
-
var rowWidth = Math.floor(100 / cols) + '%';
|
|
681
673
|
var _useState = React.useState(reactCrudUtils.ScopeUtils.create(row)),
|
|
682
674
|
scope = _useState[0];
|
|
683
|
-
var getRowStyle = function getRowStyle() {
|
|
684
|
-
var row = scope.getStyle('row', _extends({}, styles.row));
|
|
685
|
-
if (cols > 0) {
|
|
686
|
-
row.width = rowWidth;
|
|
687
|
-
}
|
|
688
|
-
console.log(row);
|
|
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() {
|
|
699
|
-
if (!original.click) {
|
|
700
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
701
|
-
style: getRowStyle(),
|
|
702
|
-
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
703
|
-
scope: scope,
|
|
704
|
-
crud: scope.crud,
|
|
705
|
-
children: props.children
|
|
706
|
-
})
|
|
707
|
-
}, "k-" + index);
|
|
708
|
-
}
|
|
709
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
|
|
710
|
-
style: getRowStyle(),
|
|
711
|
-
underlayColor: 'transparent',
|
|
712
|
-
onPress: function onPress(e) {
|
|
713
|
-
e.stopPropagation();
|
|
714
|
-
onClick(item);
|
|
715
|
-
},
|
|
716
|
-
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
717
|
-
scope: scope,
|
|
718
|
-
crud: scope.crud,
|
|
719
|
-
children: props.children
|
|
720
|
-
})
|
|
721
|
-
}, "k-" + index);
|
|
722
|
-
};
|
|
723
675
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
724
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
676
|
+
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
677
|
+
scope: scope,
|
|
678
|
+
crud: scope.crud,
|
|
679
|
+
children: props.children
|
|
680
|
+
})
|
|
725
681
|
});
|
|
726
682
|
}
|
|
727
|
-
var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
728
|
-
container: {
|
|
729
|
-
flex: 1,
|
|
730
|
-
width: '100%',
|
|
731
|
-
flexDirection: 'row',
|
|
732
|
-
flexWrap: 'wrap',
|
|
733
|
-
alignItems: 'stretch'
|
|
734
|
-
},
|
|
735
|
-
row: {
|
|
736
|
-
padding: 5,
|
|
737
|
-
margin: 3,
|
|
738
|
-
width: '100%',
|
|
739
|
-
backgroundColor: '#f5f5f5',
|
|
740
|
-
gap: 10,
|
|
741
|
-
borderRadius: 8
|
|
742
|
-
},
|
|
743
|
-
rowInner: {
|
|
744
|
-
flexGrow: 1,
|
|
745
|
-
justifyContent: 'center',
|
|
746
|
-
alignItems: 'center',
|
|
747
|
-
borderRadius: 8,
|
|
748
|
-
padding: 10,
|
|
749
|
-
width: '100%'
|
|
750
|
-
},
|
|
751
|
-
text: {
|
|
752
|
-
fontSize: 18,
|
|
753
|
-
fontWeight: 'bold'
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
757
|
-
container: {
|
|
758
|
-
flex: 1,
|
|
759
|
-
width: '100%',
|
|
760
|
-
flexDirection: 'row',
|
|
761
|
-
flexWrap: 'wrap',
|
|
762
|
-
gap: 10,
|
|
763
|
-
alignItems: 'stretch'
|
|
764
|
-
},
|
|
765
|
-
row: {
|
|
766
|
-
padding: 0,
|
|
767
|
-
width: '100%'
|
|
768
|
-
},
|
|
769
|
-
rowInner: {
|
|
770
|
-
flexGrow: 1,
|
|
771
|
-
justifyContent: 'center',
|
|
772
|
-
alignItems: 'center',
|
|
773
|
-
padding: 0,
|
|
774
|
-
width: '100%'
|
|
775
|
-
},
|
|
776
|
-
text: {
|
|
777
|
-
fontSize: 18,
|
|
778
|
-
fontWeight: 'bold'
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
683
|
|
|
782
684
|
function UIList(props) {
|
|
783
685
|
var _repeat$list;
|
|
@@ -785,16 +687,31 @@ function UIList(props) {
|
|
|
785
687
|
var crud = scope.crud;
|
|
786
688
|
var original = scope.original;
|
|
787
689
|
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
690
|
+
var rowWidth = Math.floor(100 / cols) + '%';
|
|
788
691
|
var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
|
|
789
692
|
var styles = (_repeat$list = {
|
|
790
|
-
repeat: stylesRepeat
|
|
791
|
-
list: stylesList
|
|
693
|
+
repeat: stylesRepeat,
|
|
694
|
+
list: stylesList
|
|
792
695
|
}) == null ? void 0 : _repeat$list[original.type];
|
|
793
696
|
var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
|
|
794
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
|
+
};
|
|
795
705
|
var getStyle = function getStyle(key, extra) {
|
|
796
706
|
return scope.getStyle(key, _extends({}, extra, styles[key]));
|
|
797
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
|
+
};
|
|
798
715
|
var getContainerStyle = function getContainerStyle(extra) {
|
|
799
716
|
var row = getStyle('container', {});
|
|
800
717
|
if (cols > 1) {
|
|
@@ -837,6 +754,26 @@ function UIList(props) {
|
|
|
837
754
|
children: empty
|
|
838
755
|
});
|
|
839
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
|
+
};
|
|
840
777
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
841
778
|
children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
|
|
842
779
|
placeholder: "Pesquisar...",
|
|
@@ -850,11 +787,15 @@ function UIList(props) {
|
|
|
850
787
|
}), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
|
|
851
788
|
style: getContainerStyle(),
|
|
852
789
|
children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
|
|
853
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
854
|
-
scope: scope,
|
|
855
|
-
item: item,
|
|
790
|
+
return /*#__PURE__*/jsxRuntime.jsx(RowItem, {
|
|
856
791
|
index: i,
|
|
857
|
-
|
|
792
|
+
item: item,
|
|
793
|
+
children: /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
|
|
794
|
+
scope: scope,
|
|
795
|
+
item: item,
|
|
796
|
+
index: i,
|
|
797
|
+
children: props.children
|
|
798
|
+
})
|
|
858
799
|
});
|
|
859
800
|
}), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
860
801
|
children: add
|
|
@@ -862,7 +803,7 @@ function UIList(props) {
|
|
|
862
803
|
})]
|
|
863
804
|
});
|
|
864
805
|
}
|
|
865
|
-
var stylesList
|
|
806
|
+
var stylesList = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
866
807
|
container: {
|
|
867
808
|
flex: 1,
|
|
868
809
|
width: '100%',
|
|
@@ -891,7 +832,7 @@ var stylesList$1 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
891
832
|
fontWeight: 'bold'
|
|
892
833
|
}
|
|
893
834
|
});
|
|
894
|
-
var stylesRepeat
|
|
835
|
+
var stylesRepeat = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
895
836
|
container: {
|
|
896
837
|
flex: 1,
|
|
897
838
|
width: '100%',
|