react-crud-mobile 1.0.592 → 1.0.596
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 +46 -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 +46 -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,52 @@ 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: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
711
|
+
children: props.children
|
|
712
|
+
})
|
|
713
|
+
}, "k-" + index);
|
|
714
|
+
};
|
|
675
715
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
676
716
|
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
677
717
|
scope: scope,
|
|
678
718
|
crud: scope.crud,
|
|
679
|
-
children:
|
|
719
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RowItem, {})
|
|
680
720
|
})
|
|
681
721
|
});
|
|
682
722
|
}
|
|
@@ -687,7 +727,6 @@ function UIList(props) {
|
|
|
687
727
|
var crud = scope.crud;
|
|
688
728
|
var original = scope.original;
|
|
689
729
|
var cols = reactCrudUtils.Utils.nvl(original.cols, 1);
|
|
690
|
-
var rowWidth = Math.floor(100 / cols) + '%';
|
|
691
730
|
var items = reactCrudUtils.Utils.nvl(scope.getItems(), []);
|
|
692
731
|
var styles = (_repeat$list = {
|
|
693
732
|
repeat: stylesRepeat,
|
|
@@ -695,23 +734,9 @@ function UIList(props) {
|
|
|
695
734
|
}) == null ? void 0 : _repeat$list[original.type];
|
|
696
735
|
var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
|
|
697
736
|
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
737
|
var getStyle = function getStyle(key, extra) {
|
|
706
738
|
return scope.getStyle(key, _extends({}, extra, styles[key]));
|
|
707
739
|
};
|
|
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
740
|
var getContainerStyle = function getContainerStyle(extra) {
|
|
716
741
|
var row = getStyle('container', {});
|
|
717
742
|
if (cols > 1) {
|
|
@@ -754,26 +779,6 @@ function UIList(props) {
|
|
|
754
779
|
children: empty
|
|
755
780
|
});
|
|
756
781
|
};
|
|
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
782
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
778
783
|
children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
|
|
779
784
|
placeholder: "Pesquisar...",
|
|
@@ -787,15 +792,12 @@ function UIList(props) {
|
|
|
787
792
|
}), /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
|
|
788
793
|
style: getContainerStyle(),
|
|
789
794
|
children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), items.map(function (item, i) {
|
|
790
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
791
|
-
|
|
795
|
+
return /*#__PURE__*/jsxRuntime.jsx(UIListRow, {
|
|
796
|
+
scope: scope,
|
|
792
797
|
item: item,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
index: i,
|
|
797
|
-
children: props.children
|
|
798
|
-
})
|
|
798
|
+
index: i,
|
|
799
|
+
styles: styles,
|
|
800
|
+
children: props.children
|
|
799
801
|
});
|
|
800
802
|
}), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
801
803
|
children: add
|