react-crud-mobile 1.3.92 → 1.3.95

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.
@@ -1328,7 +1328,7 @@ function UIToast() {
1328
1328
 
1329
1329
  var _excluded = ["scope", "open", "dialog"];
1330
1330
  function UIModal(_ref) {
1331
- var _theme$styles, _scope$currentDialog3, _main$dialog2;
1331
+ var _theme$styles, _scope$currentDialog2, _main$dialog;
1332
1332
  var scope = _ref.scope,
1333
1333
  open = _ref.open,
1334
1334
  dialog = _ref.dialog,
@@ -1339,7 +1339,6 @@ function UIModal(_ref) {
1339
1339
  var _useState2 = useState(0),
1340
1340
  index = _useState2[0],
1341
1341
  setIndex = _useState2[1];
1342
- var main = ViewUtils.getCrud('view');
1343
1342
  //v6
1344
1343
  var label = scope.getLabel();
1345
1344
  var theme = scope.getTheme();
@@ -1357,60 +1356,19 @@ function UIModal(_ref) {
1357
1356
  event: {}
1358
1357
  });
1359
1358
  };
1360
- var toggle = function toggle(vis) {
1359
+ scope.toggleDialog = function (vis) {
1361
1360
  modalVisible = vis;
1362
1361
  setModalVisible(modalVisible);
1363
1362
  };
1364
1363
  scope.update = function () {
1365
1364
  setIndex(++index);
1366
1365
  };
1367
- scope.dialogShow = function (args) {
1368
- var crud = args.crud;
1369
- var name = scope.getName('modal');
1370
- var edit = args.edit === true;
1371
- var def = {};
1372
- var rowItem = null;
1373
- if (crud.is('row')) {
1374
- def.parent = crud.parent.parent;
1375
- def.search = crud.parent;
1376
- rowItem = crud.data;
1377
- } else if (crud.is('search')) {
1378
- def.parent = crud.parent;
1379
- def.search = crud;
1380
- }
1381
- var data = Utils.nvl(args.item, rowItem, {});
1382
- var d = CrudUtils.create('dialog', _extends({
1383
- parent: crud,
1384
- root: crud,
1385
- name: name,
1386
- dialog: main.dialog,
1387
- data: data,
1388
- edit: edit,
1389
- scope: scope
1390
- }, def));
1391
- main.dialog = d;
1392
- scope.currentDialog = {
1393
- crud: d
1394
- };
1395
- toggle(true);
1396
- scope.update();
1397
- };
1398
- scope.dialogHide = function (args) {
1399
- var _scope$currentDialog2, _main$dialog;
1400
- var old = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1401
- main.dialog = Utils.nvl(old.dialog, null);
1402
- scope.currentDialog = null;
1403
- toggle(false);
1404
- if ((_main$dialog = main.dialog) != null && _main$dialog.scope) {
1405
- main.dialog.scope.update();
1406
- }
1407
- scope.update();
1408
- };
1409
- var curr = (_scope$currentDialog3 = scope.currentDialog) == null ? void 0 : _scope$currentDialog3.crud;
1366
+ var curr = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1367
+ var main = ViewUtils.getCrud('view');
1410
1368
  if (!curr) {
1411
1369
  return /*#__PURE__*/jsx(Fragment, {});
1412
1370
  }
1413
- if (curr.uuid !== ((_main$dialog2 = main.dialog) == null ? void 0 : _main$dialog2.uuid)) {
1371
+ if (curr.uuid !== ((_main$dialog = main.dialog) == null || (_main$dialog = _main$dialog.crud) == null ? void 0 : _main$dialog.uuid)) {
1414
1372
  return /*#__PURE__*/jsx(Fragment, {});
1415
1373
  }
1416
1374
  var headerRight = ComponentUtils.getDefine(props, 'header', 'right');
@@ -2112,14 +2070,14 @@ function UIElement(props) {
2112
2070
  children: props.children
2113
2071
  });
2114
2072
  };
2115
- scope.dialogOpen = function (args) {
2116
- var crud = args.crud,
2117
- event = args.event;
2073
+ scope.dialogShow = function (args) {
2074
+ var main = ViewUtils.getCrud('view');
2075
+ var parent = main.dialog;
2076
+ var crud = args.crud;
2118
2077
  var name = scope.getName('modal');
2119
2078
  var edit = args.edit === true;
2120
2079
  var def = {};
2121
2080
  var rowItem = null;
2122
- var main = ViewUtils.getCrud('view');
2123
2081
  if (crud.is('row')) {
2124
2082
  def.parent = crud.parent.parent;
2125
2083
  def.search = crud.parent;
@@ -2129,24 +2087,35 @@ function UIElement(props) {
2129
2087
  def.search = crud;
2130
2088
  }
2131
2089
  var data = Utils.nvl(args.item, rowItem, {});
2132
- var component = event == null ? void 0 : event.component;
2133
- if (component) {
2134
- var d = CrudUtils.create('dialog', _extends({
2135
- parent: crud,
2136
- root: crud,
2137
- name: name,
2138
- dialog: main.dialog,
2139
- data: data,
2140
- edit: edit,
2141
- scope: scope
2142
- }, def));
2143
- main.dialog = d;
2144
- scope.currentDialog = {
2145
- component: component,
2146
- crud: d
2147
- };
2148
- scope.update();
2090
+ var d = CrudUtils.create('dialog', _extends({
2091
+ parent: crud,
2092
+ root: crud,
2093
+ name: name,
2094
+ data: data,
2095
+ edit: edit,
2096
+ scope: scope
2097
+ }, def));
2098
+ var dialog = {
2099
+ crud: d,
2100
+ parent: parent
2101
+ };
2102
+ main.dialog = dialog;
2103
+ scope.toggleDialog(true);
2104
+ scope.currentDialog = dialog;
2105
+ scope.update();
2106
+ };
2107
+ scope.dialogHide = function (args) {
2108
+ var _main$dialog;
2109
+ var main = ViewUtils.getCrud('view');
2110
+ var old = scope.currentDialog;
2111
+ main.dialog = Utils.nvl(old.parent, null);
2112
+ scope.currentDialog = null;
2113
+ if ((_main$dialog = main.dialog) != null && (_main$dialog = _main$dialog.crud) != null && _main$dialog.scope) {
2114
+ var _main$dialog2;
2115
+ (_main$dialog2 = main.dialog) == null || _main$dialog2.crud.scope.update();
2149
2116
  }
2117
+ scope.toggleDialog(false);
2118
+ scope.update();
2150
2119
  };
2151
2120
  return /*#__PURE__*/jsx(CrudContext.Provider, {
2152
2121
  value: {