react-crud-mobile 1.0.592 → 1.0.595
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/elements/core/UIListRow.d.ts +1 -0
- package/dist/react-crud-mobile.cjs.development.js +44 -44
- 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 +44 -44
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UIList.tsx +3 -42
- package/src/elements/core/UIListRow.tsx +49 -2
|
@@ -659,6 +659,7 @@ var styles$6 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
659
659
|
|
|
660
660
|
function UIListRow(props) {
|
|
661
661
|
var parent = props.scope;
|
|
662
|
+
var original = parent.original;
|
|
662
663
|
var item = props.item;
|
|
663
664
|
var index = props.index;
|
|
664
665
|
var name = "" + parent.key('row', index);
|
|
@@ -670,13 +671,50 @@ function UIListRow(props) {
|
|
|
670
671
|
type: 'row',
|
|
671
672
|
data: item
|
|
672
673
|
};
|
|
674
|
+
var styles = props.styles;
|
|
675
|
+
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
676
|
+
var rowWidth = Math.floor(100 / cols) + '%';
|
|
673
677
|
var _useState = React.useState(reactCrudUtils.ScopeUtils.create(row)),
|
|
674
678
|
scope = _useState[0];
|
|
679
|
+
var getStyle = function getStyle(key, extra) {
|
|
680
|
+
return scope.getStyle(key, _extends({}, extra, styles[key]));
|
|
681
|
+
};
|
|
682
|
+
var getRowStyle = function getRowStyle(extra) {
|
|
683
|
+
var row = getStyle('row', {});
|
|
684
|
+
if (cols > 0) {
|
|
685
|
+
row.width = rowWidth;
|
|
686
|
+
}
|
|
687
|
+
return row;
|
|
688
|
+
};
|
|
689
|
+
var onClick = function onClick(item) {
|
|
690
|
+
scope.call('click', {
|
|
691
|
+
value: item,
|
|
692
|
+
item: item,
|
|
693
|
+
edit: true
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
var RowItem = function RowItem() {
|
|
697
|
+
if (!original.click) {
|
|
698
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
699
|
+
style: getRowStyle(),
|
|
700
|
+
children: props.children
|
|
701
|
+
}, "k-" + index);
|
|
702
|
+
}
|
|
703
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
|
|
704
|
+
style: getRowStyle(),
|
|
705
|
+
underlayColor: 'transparent',
|
|
706
|
+
onPress: function onPress(e) {
|
|
707
|
+
e.stopPropagation();
|
|
708
|
+
onClick(item);
|
|
709
|
+
},
|
|
710
|
+
children: props.children
|
|
711
|
+
}, "k-" + index);
|
|
712
|
+
};
|
|
675
713
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
676
714
|
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
677
715
|
scope: scope,
|
|
678
716
|
crud: scope.crud,
|
|
679
|
-
children:
|
|
717
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RowItem, {})
|
|
680
718
|
})
|
|
681
719
|
});
|
|
682
720
|
}
|
|
@@ -687,7 +725,6 @@ function UIList(props) {
|
|
|
687
725
|
var crud = scope.crud;
|
|
688
726
|
var original = scope.original;
|
|
689
727
|
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
690
|
-
var rowWidth = Math.floor(100 / cols) + '%';
|
|
691
728
|
var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
|
|
692
729
|
var styles = (_repeat$list = {
|
|
693
730
|
repeat: stylesRepeat,
|
|
@@ -695,23 +732,9 @@ function UIList(props) {
|
|
|
695
732
|
}) == null ? void 0 : _repeat$list[original.type];
|
|
696
733
|
var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
|
|
697
734
|
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
735
|
var getStyle = function getStyle(key, extra) {
|
|
706
736
|
return scope.getStyle(key, _extends({}, extra, styles[key]));
|
|
707
737
|
};
|
|
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
738
|
var getContainerStyle = function getContainerStyle(extra) {
|
|
716
739
|
var row = getStyle('container', {});
|
|
717
740
|
if (cols > 1) {
|
|
@@ -754,26 +777,6 @@ function UIList(props) {
|
|
|
754
777
|
children: empty
|
|
755
778
|
});
|
|
756
779
|
};
|
|
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
780
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
778
781
|
children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
|
|
779
782
|
placeholder: "Pesquisar...",
|
|
@@ -787,15 +790,12 @@ function UIList(props) {
|
|
|
787
790
|
}), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
|
|
788
791
|
style: getContainerStyle(),
|
|
789
792
|
children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
|
|
790
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
791
|
-
|
|
793
|
+
return /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
|
|
794
|
+
scope: scope,
|
|
792
795
|
item: item,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
index: i,
|
|
797
|
-
children: props.children
|
|
798
|
-
})
|
|
796
|
+
index: i,
|
|
797
|
+
styles: styles,
|
|
798
|
+
children: props.children
|
|
799
799
|
});
|
|
800
800
|
}), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
801
801
|
children: add
|