react-crud-mobile 1.0.342 → 1.0.344

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.
@@ -11,6 +11,7 @@ import { ButtonType } from 'react-crud-utils';
11
11
  import { LinkType } from 'react-crud-utils';
12
12
  declare const UI: {
13
13
  List: (props: ListType) => import("react").JSX.Element;
14
+ Row: (props: UserType) => import("react").JSX.Element;
14
15
  Value: (props: UserType) => import("react").JSX.Element;
15
16
  Label: (props: UserType) => import("react").JSX.Element;
16
17
  Repeat: (props: ListType) => import("react").JSX.Element;
@@ -391,9 +391,7 @@ function UIButton(props) {
391
391
  }
392
392
  };
393
393
  var onClick = function onClick(e) {
394
- if (typeof element.click === 'function') {
395
- element.click(e);
396
- }
394
+ scope.call('click', {});
397
395
  };
398
396
  var style = function style(part, extra) {
399
397
  var s = _extends({}, styles[part], extra);
@@ -936,6 +934,98 @@ function UIQuantity(props) {
936
934
  });
937
935
  }
938
936
 
937
+ function UIModal(props) {
938
+ var _useState = React.useState(false),
939
+ modalVisible = _useState[0],
940
+ setModalVisible = _useState[1];
941
+ var scope = props.scope;
942
+ var label = scope.getLabel();
943
+ var theme = reactCrudUtils.useTheme();
944
+ var style = function style(part, extra) {
945
+ return _extends({}, styles$a[part], scope.getStyle(part), extra);
946
+ };
947
+ var toggle = function toggle(vis) {
948
+ modalVisible = vis;
949
+ setModalVisible(modalVisible);
950
+ };
951
+ scope.show = function () {
952
+ toggle(true);
953
+ };
954
+ scope.hide = function () {
955
+ toggle(true);
956
+ };
957
+ return /*#__PURE__*/jsxRuntime.jsxs(reactNative.Modal, {
958
+ animationType: "slide",
959
+ transparent: true,
960
+ visible: modalVisible,
961
+ onRequestClose: function onRequestClose() {
962
+ return setModalVisible(false);
963
+ },
964
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.StatusBar, {
965
+ barStyle: "dark-content",
966
+ backgroundColor: theme.colors.primary
967
+ }), /*#__PURE__*/jsxRuntime.jsxs(reactNative.SafeAreaView, {
968
+ style: style('modalSafe'),
969
+ children: [/*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
970
+ style: style('modalHeader'),
971
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableOpacity, {
972
+ onPress: function onPress() {
973
+ return setModalVisible(false);
974
+ },
975
+ style: style('modalCloseButton'),
976
+ children: /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
977
+ style: style('modalCloseText'),
978
+ children: "X"
979
+ })
980
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
981
+ style: style('modalTitle'),
982
+ children: label
983
+ })]
984
+ }), /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
985
+ style: style('modalContent'),
986
+ children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
987
+ scope: scope,
988
+ children: props.children
989
+ })
990
+ })]
991
+ })]
992
+ });
993
+ }
994
+ var styles$a = /*#__PURE__*/reactNative.StyleSheet.create({
995
+ modalSafe: {
996
+ flex: 1,
997
+ backgroundColor: '#f5f5f5',
998
+ paddingTop: reactNative.StatusBar.currentHeight || 0
999
+ },
1000
+ modalHeader: {
1001
+ flexDirection: 'row',
1002
+ alignItems: 'center',
1003
+ padding: 15,
1004
+ backgroundColor: '#6200ea'
1005
+ },
1006
+ modalCloseButton: {
1007
+ padding: 10
1008
+ },
1009
+ modalCloseText: {
1010
+ fontSize: 18,
1011
+ color: 'white'
1012
+ },
1013
+ modalTitle: {
1014
+ fontSize: 18,
1015
+ color: 'white',
1016
+ fontWeight: 'bold',
1017
+ marginLeft: 10
1018
+ },
1019
+ modalContent: {
1020
+ flex: 1,
1021
+ width: '100%',
1022
+ alignSelf: 'flex-start',
1023
+ flexDirection: 'row',
1024
+ flexWrap: 'wrap',
1025
+ padding: 20
1026
+ }
1027
+ });
1028
+
939
1029
  function UIElement(props) {
940
1030
  var _original$list, _original$load;
941
1031
  var _useState = React.useState(reactCrudUtils.ScopeUtils.create(props)),
@@ -956,6 +1046,7 @@ function UIElement(props) {
956
1046
  };
957
1047
  var router = {
958
1048
  list: UIList,
1049
+ dialog: UIModal,
959
1050
  repeat: UIList,
960
1051
  tabs: ElTabs,
961
1052
  chart: ElChart
@@ -1045,7 +1136,7 @@ function UIElement(props) {
1045
1136
  var _elementStyle$type;
1046
1137
  var type = reactCrudUtils.Utils.nvl(original.type, 'none');
1047
1138
  var key = reactCrudUtils.Utils.nvl(part, 'root');
1048
- var def = _extends({}, styles$a[key], elementStyle == null || (_elementStyle$type = elementStyle[type]) == null ? void 0 : _elementStyle$type[key]);
1139
+ var def = _extends({}, styles$b[key], elementStyle == null || (_elementStyle$type = elementStyle[type]) == null ? void 0 : _elementStyle$type[key]);
1049
1140
  var hasChild = hasChildren();
1050
1141
  if (!part && !hasChild) {
1051
1142
  def = _extends({}, def);
@@ -1286,7 +1377,7 @@ elementStyle.toggle = /*#__PURE__*/reactNative.StyleSheet.create({
1286
1377
  })
1287
1378
  });
1288
1379
  elementStyle.list = /*#__PURE__*/_extends({}, elementStyle.card);
1289
- var styles$a = /*#__PURE__*/reactNative.StyleSheet.create({
1380
+ var styles$b = /*#__PURE__*/reactNative.StyleSheet.create({
1290
1381
  root: {
1291
1382
  gap: 5,
1292
1383
  flexDirection: 'column',
@@ -1358,6 +1449,11 @@ var UI = {
1358
1449
  type: "list"
1359
1450
  }));
1360
1451
  },
1452
+ Row: function Row(props) {
1453
+ return /*#__PURE__*/jsxRuntime.jsx(UIElement, _extends({}, props, {
1454
+ type: "row"
1455
+ }));
1456
+ },
1361
1457
  Value: function Value(props) {
1362
1458
  return /*#__PURE__*/jsxRuntime.jsx(UIElement, _extends({}, props, {
1363
1459
  type: "value"