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.
- package/dist/react-crud-mobile.cjs.development.js +82 -68
- 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 +82 -68
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/UIChildren.tsx +1 -1
- package/src/elements/core/UIList.tsx +2 -52
- package/src/elements/core/UIListRow.tsx +67 -3
|
@@ -106,7 +106,7 @@ function UIChildren(props) {
|
|
|
106
106
|
var getStyle = function getStyle(part) {
|
|
107
107
|
var key = Utils.nvl(part, 'root');
|
|
108
108
|
var def = styles[key];
|
|
109
|
-
return _extends({}, def,
|
|
109
|
+
return _extends({}, def, scope.getStyle(part));
|
|
110
110
|
};
|
|
111
111
|
return /*#__PURE__*/jsx(Fragment, {
|
|
112
112
|
children: /*#__PURE__*/jsx(View, {
|
|
@@ -650,18 +650,92 @@ var styles$6 = /*#__PURE__*/StyleSheet.create({
|
|
|
650
650
|
}
|
|
651
651
|
});
|
|
652
652
|
|
|
653
|
-
function
|
|
653
|
+
function UIListRow(props) {
|
|
654
654
|
var _repeat$list;
|
|
655
655
|
var scope = props.scope;
|
|
656
|
-
var
|
|
656
|
+
var index = props.index;
|
|
657
657
|
var original = scope.original;
|
|
658
|
+
var item = props.item;
|
|
658
659
|
var cols = Utils.nvl(original.cols, 1);
|
|
659
660
|
var rowWidth = Math.floor(100 / cols) + '%';
|
|
660
|
-
var items = Utils.nvl(scope.getItems(), []);
|
|
661
661
|
var styles = (_repeat$list = {
|
|
662
662
|
repeat: stylesRepeat,
|
|
663
663
|
list: stylesList
|
|
664
664
|
}) == null ? void 0 : _repeat$list[original.type];
|
|
665
|
+
var name = "" + scope.key('row', index, '');
|
|
666
|
+
var row = ScopeUtils.create(_extends({}, original, {
|
|
667
|
+
parent: scope,
|
|
668
|
+
name: name,
|
|
669
|
+
crud: scope.crud,
|
|
670
|
+
index: index,
|
|
671
|
+
type: 'row',
|
|
672
|
+
data: item
|
|
673
|
+
}));
|
|
674
|
+
var getRowStyle = function getRowStyle() {
|
|
675
|
+
var css = row.getStyle('row', _extends({}, styles.row));
|
|
676
|
+
if (cols > 0) {
|
|
677
|
+
css.width = rowWidth;
|
|
678
|
+
}
|
|
679
|
+
return css;
|
|
680
|
+
};
|
|
681
|
+
var onClick = function onClick(item) {
|
|
682
|
+
row.call('click', {
|
|
683
|
+
value: item,
|
|
684
|
+
item: item,
|
|
685
|
+
edit: true
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
if (!original.click) {
|
|
689
|
+
return /*#__PURE__*/jsx(View, {
|
|
690
|
+
style: getRowStyle(),
|
|
691
|
+
children: /*#__PURE__*/jsx(UIChildren, {
|
|
692
|
+
scope: row,
|
|
693
|
+
crud: row.crud,
|
|
694
|
+
children: props.children
|
|
695
|
+
})
|
|
696
|
+
}, "k-" + index);
|
|
697
|
+
}
|
|
698
|
+
return /*#__PURE__*/jsx(TouchableHighlight, {
|
|
699
|
+
underlayColor: 'transparent',
|
|
700
|
+
onPress: function onPress(e) {
|
|
701
|
+
e.stopPropagation();
|
|
702
|
+
onClick(item);
|
|
703
|
+
},
|
|
704
|
+
children: /*#__PURE__*/jsx(UIChildren, {
|
|
705
|
+
scope: row,
|
|
706
|
+
crud: row.crud,
|
|
707
|
+
children: props.children
|
|
708
|
+
})
|
|
709
|
+
}, "k-" + index);
|
|
710
|
+
}
|
|
711
|
+
var stylesList = /*#__PURE__*/StyleSheet.create({
|
|
712
|
+
row: {
|
|
713
|
+
padding: 5,
|
|
714
|
+
margin: 3,
|
|
715
|
+
width: '100%',
|
|
716
|
+
backgroundColor: '#f5f5f5',
|
|
717
|
+
gap: 10,
|
|
718
|
+
borderRadius: 8
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
var stylesRepeat = /*#__PURE__*/StyleSheet.create({
|
|
722
|
+
row: {
|
|
723
|
+
padding: 0,
|
|
724
|
+
width: '100%'
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
function UIList(props) {
|
|
729
|
+
var _repeat$list;
|
|
730
|
+
var scope = props.scope;
|
|
731
|
+
var crud = scope.crud;
|
|
732
|
+
var original = scope.original;
|
|
733
|
+
var cols = Utils.nvl(original.cols, 1);
|
|
734
|
+
var items = Utils.nvl(scope.getItems(), []);
|
|
735
|
+
var styles = (_repeat$list = {
|
|
736
|
+
repeat: stylesRepeat$1,
|
|
737
|
+
list: stylesList$1
|
|
738
|
+
}) == null ? void 0 : _repeat$list[original.type];
|
|
665
739
|
var add = ComponentUtils.getDefine(props, 'add');
|
|
666
740
|
var hideAddWhenEmpty = original.hideAddWhenEmpty;
|
|
667
741
|
var getStyle = function getStyle(key, extra) {
|
|
@@ -709,56 +783,6 @@ function UIList(props) {
|
|
|
709
783
|
children: empty
|
|
710
784
|
});
|
|
711
785
|
};
|
|
712
|
-
var RowItem = function RowItem(_ref) {
|
|
713
|
-
var item = _ref.item,
|
|
714
|
-
index = _ref.index,
|
|
715
|
-
children = _ref.children;
|
|
716
|
-
var name = "" + scope.key('row', index, '');
|
|
717
|
-
var row = ScopeUtils.create(_extends({}, original, {
|
|
718
|
-
parent: scope,
|
|
719
|
-
name: name,
|
|
720
|
-
crud: scope.crud,
|
|
721
|
-
index: index,
|
|
722
|
-
type: 'row',
|
|
723
|
-
data: item
|
|
724
|
-
}));
|
|
725
|
-
var getRowStyle = function getRowStyle() {
|
|
726
|
-
var css = row.getStyle('row', _extends({}, styles.row));
|
|
727
|
-
if (cols > 0) {
|
|
728
|
-
css.width = rowWidth;
|
|
729
|
-
}
|
|
730
|
-
return css;
|
|
731
|
-
};
|
|
732
|
-
var onClick = function onClick(item) {
|
|
733
|
-
row.call('click', {
|
|
734
|
-
value: item,
|
|
735
|
-
item: item,
|
|
736
|
-
edit: true
|
|
737
|
-
});
|
|
738
|
-
};
|
|
739
|
-
if (!original.click) {
|
|
740
|
-
return /*#__PURE__*/jsx(View, {
|
|
741
|
-
style: getRowStyle(),
|
|
742
|
-
children: /*#__PURE__*/jsx(UIChildren, {
|
|
743
|
-
scope: row,
|
|
744
|
-
crud: row.crud,
|
|
745
|
-
children: children
|
|
746
|
-
})
|
|
747
|
-
}, "k-" + index);
|
|
748
|
-
}
|
|
749
|
-
return /*#__PURE__*/jsx(TouchableHighlight, {
|
|
750
|
-
underlayColor: 'transparent',
|
|
751
|
-
onPress: function onPress(e) {
|
|
752
|
-
e.stopPropagation();
|
|
753
|
-
onClick(item);
|
|
754
|
-
},
|
|
755
|
-
children: /*#__PURE__*/jsx(UIChildren, {
|
|
756
|
-
scope: row,
|
|
757
|
-
crud: row.crud,
|
|
758
|
-
children: children
|
|
759
|
-
})
|
|
760
|
-
}, "k-" + index);
|
|
761
|
-
};
|
|
762
786
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
763
787
|
children: [original.search !== false && /*#__PURE__*/jsx(UI.Text, {
|
|
764
788
|
placeholder: "Pesquisar...",
|
|
@@ -772,9 +796,10 @@ function UIList(props) {
|
|
|
772
796
|
}), /*#__PURE__*/jsxs(View, {
|
|
773
797
|
style: getContainerStyle(),
|
|
774
798
|
children: [/*#__PURE__*/jsx(Empty, {}), items.map(function (item, i) {
|
|
775
|
-
return /*#__PURE__*/jsx(
|
|
799
|
+
return /*#__PURE__*/jsx(UIListRow, {
|
|
776
800
|
index: i,
|
|
777
801
|
item: item,
|
|
802
|
+
scope: scope,
|
|
778
803
|
children: props.children
|
|
779
804
|
});
|
|
780
805
|
}), isShowAdd() && /*#__PURE__*/jsx(Fragment, {
|
|
@@ -783,7 +808,7 @@ function UIList(props) {
|
|
|
783
808
|
})]
|
|
784
809
|
});
|
|
785
810
|
}
|
|
786
|
-
var stylesList = /*#__PURE__*/StyleSheet.create({
|
|
811
|
+
var stylesList$1 = /*#__PURE__*/StyleSheet.create({
|
|
787
812
|
container: {
|
|
788
813
|
flex: 1,
|
|
789
814
|
width: '100%',
|
|
@@ -812,7 +837,7 @@ var stylesList = /*#__PURE__*/StyleSheet.create({
|
|
|
812
837
|
fontWeight: 'bold'
|
|
813
838
|
}
|
|
814
839
|
});
|
|
815
|
-
var stylesRepeat = /*#__PURE__*/StyleSheet.create({
|
|
840
|
+
var stylesRepeat$1 = /*#__PURE__*/StyleSheet.create({
|
|
816
841
|
container: {
|
|
817
842
|
flex: 1,
|
|
818
843
|
width: '100%',
|
|
@@ -838,17 +863,6 @@ var stylesRepeat = /*#__PURE__*/StyleSheet.create({
|
|
|
838
863
|
}
|
|
839
864
|
});
|
|
840
865
|
|
|
841
|
-
function UIListRow(props) {
|
|
842
|
-
var scope = props.scope;
|
|
843
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
844
|
-
children: /*#__PURE__*/jsx(UIChildren, {
|
|
845
|
-
scope: scope,
|
|
846
|
-
crud: scope.crud,
|
|
847
|
-
children: props.children
|
|
848
|
-
})
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
|
|
852
866
|
function UIToggle(props) {
|
|
853
867
|
var scope = props.scope;
|
|
854
868
|
var options = Utils.nvl(scope.getOptions(), []);
|