react-crud-mobile 1.3.84 → 1.3.86

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.
@@ -1326,9 +1326,14 @@ function UIToast() {
1326
1326
  });
1327
1327
  }
1328
1328
 
1329
- function UIModal(props) {
1329
+ var _excluded = ["scope", "open", "dialog"];
1330
+ function UIModal(_ref) {
1330
1331
  var _theme$styles, _main$dialog2;
1331
- var _useState = useState(props.open === true),
1332
+ var scope = _ref.scope,
1333
+ open = _ref.open,
1334
+ dialog = _ref.dialog,
1335
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
1336
+ var _useState = useState(open === true),
1332
1337
  modalVisible = _useState[0],
1333
1338
  setModalVisible = _useState[1];
1334
1339
  var _useState2 = useState(0),
@@ -1336,7 +1341,6 @@ function UIModal(props) {
1336
1341
  setIndex = _useState2[1];
1337
1342
  var main = ViewUtils.getCrud('view');
1338
1343
  //v4
1339
- var scope = props.scope;
1340
1344
  var label = scope.getLabel();
1341
1345
  var theme = scope.getTheme();
1342
1346
  var headerStyle = Utils.nvl((_theme$styles = theme.styles) == null || (_theme$styles = _theme$styles.defaults) == null ? void 0 : _theme$styles.header, {});
@@ -1415,6 +1419,19 @@ function UIModal(props) {
1415
1419
  color: color
1416
1420
  };
1417
1421
  var key = scope.currentDialog.name + "-" + index;
1422
+ var Content = function Content() {
1423
+ if (dialog != null && dialog.component) {
1424
+ var Aux = dialog == null ? void 0 : dialog.component;
1425
+ return /*#__PURE__*/jsx(Aux, {
1426
+ crud: scope.currentDialog
1427
+ });
1428
+ }
1429
+ return /*#__PURE__*/jsx(UIChildren, {
1430
+ scope: scope,
1431
+ crud: scope.currentDialog,
1432
+ children: props.children
1433
+ });
1434
+ };
1418
1435
  return /*#__PURE__*/jsxs(Modal, {
1419
1436
  animationType: "slide",
1420
1437
  transparent: true,
@@ -1460,11 +1477,7 @@ function UIModal(props) {
1460
1477
  paddingTop: 10,
1461
1478
  paddingBottom: 10
1462
1479
  },
1463
- children: /*#__PURE__*/jsx(UIChildren, {
1464
- scope: scope,
1465
- crud: scope.currentDialog,
1466
- children: props.children
1467
- })
1480
+ children: /*#__PURE__*/jsx(Content, {})
1468
1481
  })
1469
1482
  }), bottom]
1470
1483
  }), /*#__PURE__*/jsx(UIToast, {})]
@@ -2049,6 +2062,7 @@ function UIElement(props) {
2049
2062
  scope: scope,
2050
2063
  crud: dialog.crud,
2051
2064
  open: true,
2065
+ dialog: dialog,
2052
2066
  children: dialog.component
2053
2067
  })), scope.isType('chart') && /*#__PURE__*/jsx(ElChart, _extends({}, props, {
2054
2068
  scope: scope,
@@ -2097,40 +2111,42 @@ function UIElement(props) {
2097
2111
  });
2098
2112
  };
2099
2113
  scope.dialogOpen = function (args) {
2100
- var crud = args.crud,
2101
- event = args.event;
2102
- var name = scope.getName('modal');
2103
- var edit = args.edit === true;
2104
- var def = {};
2105
- var rowItem = null;
2106
- var main = ViewUtils.getCrud('view');
2107
- if (crud.is('row')) {
2108
- def.parent = crud.parent.parent;
2109
- def.search = crud.parent;
2110
- rowItem = crud.data;
2111
- } else if (crud.is('search')) {
2112
- def.parent = crud.parent;
2113
- def.search = crud;
2114
- }
2115
- var data = Utils.nvl(args.item, rowItem, {});
2116
- var component = event == null ? void 0 : event.component;
2117
- if (component) {
2118
- var d = CrudUtils.create('dialog', _extends({
2119
- parent: crud,
2120
- root: crud,
2121
- name: name,
2122
- dialog: main.dialog,
2123
- data: data,
2124
- edit: edit,
2125
- scope: scope
2126
- }, def));
2127
- main.dialog = d;
2128
- scope.currentDialog = d;
2129
- dialog = {
2130
- component: component,
2131
- crud: d
2132
- };
2133
- setDialog(dialog);
2114
+ if (!dialog) {
2115
+ var _crud = args.crud,
2116
+ event = args.event;
2117
+ var name = scope.getName('modal');
2118
+ var edit = args.edit === true;
2119
+ var def = {};
2120
+ var rowItem = null;
2121
+ var main = ViewUtils.getCrud('view');
2122
+ if (_crud.is('row')) {
2123
+ def.parent = _crud.parent.parent;
2124
+ def.search = _crud.parent;
2125
+ rowItem = _crud.data;
2126
+ } else if (_crud.is('search')) {
2127
+ def.parent = _crud.parent;
2128
+ def.search = _crud;
2129
+ }
2130
+ var data = Utils.nvl(args.item, rowItem, {});
2131
+ var component = event == null ? void 0 : event.component;
2132
+ if (component) {
2133
+ var d = CrudUtils.create('dialog', _extends({
2134
+ parent: _crud,
2135
+ root: _crud,
2136
+ name: name,
2137
+ dialog: main.dialog,
2138
+ data: data,
2139
+ edit: edit,
2140
+ scope: scope
2141
+ }, def));
2142
+ main.dialog = d;
2143
+ scope.currentDialog = d;
2144
+ dialog = {
2145
+ component: component,
2146
+ crud: d
2147
+ };
2148
+ setDialog(dialog);
2149
+ }
2134
2150
  }
2135
2151
  };
2136
2152
  return /*#__PURE__*/jsx(CrudContext.Provider, {
@@ -2335,7 +2351,7 @@ function SafeView(props) {
2335
2351
  });
2336
2352
  }
2337
2353
 
2338
- var _excluded = ["type"];
2354
+ var _excluded$1 = ["type"];
2339
2355
  var UI = {
2340
2356
  Order: function Order(props) {
2341
2357
  return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
@@ -2379,7 +2395,7 @@ var UI = {
2379
2395
  return /*#__PURE__*/jsx(UIInclude, _extends({}, props));
2380
2396
  },
2381
2397
  Column: function Column(_ref) {
2382
- var props = _objectWithoutPropertiesLoose(_ref, _excluded);
2398
+ var props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2383
2399
  return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
2384
2400
  type: "column"
2385
2401
  }));