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.
@@ -1337,7 +1337,7 @@ function UIToast() {
1337
1337
 
1338
1338
  var _excluded = ["scope", "open", "dialog"];
1339
1339
  function UIModal(_ref) {
1340
- var _theme$styles, _scope$currentDialog3, _main$dialog2;
1340
+ var _theme$styles, _scope$currentDialog2, _main$dialog;
1341
1341
  var scope = _ref.scope,
1342
1342
  open = _ref.open,
1343
1343
  dialog = _ref.dialog,
@@ -1348,7 +1348,6 @@ function UIModal(_ref) {
1348
1348
  var _useState2 = React.useState(0),
1349
1349
  index = _useState2[0],
1350
1350
  setIndex = _useState2[1];
1351
- var main = reactCrudUtils.ViewUtils.getCrud('view');
1352
1351
  //v6
1353
1352
  var label = scope.getLabel();
1354
1353
  var theme = scope.getTheme();
@@ -1366,60 +1365,19 @@ function UIModal(_ref) {
1366
1365
  event: {}
1367
1366
  });
1368
1367
  };
1369
- var toggle = function toggle(vis) {
1368
+ scope.toggleDialog = function (vis) {
1370
1369
  modalVisible = vis;
1371
1370
  setModalVisible(modalVisible);
1372
1371
  };
1373
1372
  scope.update = function () {
1374
1373
  setIndex(++index);
1375
1374
  };
1376
- scope.dialogShow = function (args) {
1377
- var crud = args.crud;
1378
- var name = scope.getName('modal');
1379
- var edit = args.edit === true;
1380
- var def = {};
1381
- var rowItem = null;
1382
- if (crud.is('row')) {
1383
- def.parent = crud.parent.parent;
1384
- def.search = crud.parent;
1385
- rowItem = crud.data;
1386
- } else if (crud.is('search')) {
1387
- def.parent = crud.parent;
1388
- def.search = crud;
1389
- }
1390
- var data = reactCrudUtils.Utils.nvl(args.item, rowItem, {});
1391
- var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
1392
- parent: crud,
1393
- root: crud,
1394
- name: name,
1395
- dialog: main.dialog,
1396
- data: data,
1397
- edit: edit,
1398
- scope: scope
1399
- }, def));
1400
- main.dialog = d;
1401
- scope.currentDialog = {
1402
- crud: d
1403
- };
1404
- toggle(true);
1405
- scope.update();
1406
- };
1407
- scope.dialogHide = function (args) {
1408
- var _scope$currentDialog2, _main$dialog;
1409
- var old = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1410
- main.dialog = reactCrudUtils.Utils.nvl(old.dialog, null);
1411
- scope.currentDialog = null;
1412
- toggle(false);
1413
- if ((_main$dialog = main.dialog) != null && _main$dialog.scope) {
1414
- main.dialog.scope.update();
1415
- }
1416
- scope.update();
1417
- };
1418
- var curr = (_scope$currentDialog3 = scope.currentDialog) == null ? void 0 : _scope$currentDialog3.crud;
1375
+ var curr = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1376
+ var main = reactCrudUtils.ViewUtils.getCrud('view');
1419
1377
  if (!curr) {
1420
1378
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
1421
1379
  }
1422
- if (curr.uuid !== ((_main$dialog2 = main.dialog) == null ? void 0 : _main$dialog2.uuid)) {
1380
+ if (curr.uuid !== ((_main$dialog = main.dialog) == null || (_main$dialog = _main$dialog.crud) == null ? void 0 : _main$dialog.uuid)) {
1423
1381
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
1424
1382
  }
1425
1383
  var headerRight = reactCrudUtils.ComponentUtils.getDefine(props, 'header', 'right');
@@ -2121,14 +2079,14 @@ function UIElement(props) {
2121
2079
  children: props.children
2122
2080
  });
2123
2081
  };
2124
- scope.dialogOpen = function (args) {
2125
- var crud = args.crud,
2126
- event = args.event;
2082
+ scope.dialogShow = function (args) {
2083
+ var main = reactCrudUtils.ViewUtils.getCrud('view');
2084
+ var parent = main.dialog;
2085
+ var crud = args.crud;
2127
2086
  var name = scope.getName('modal');
2128
2087
  var edit = args.edit === true;
2129
2088
  var def = {};
2130
2089
  var rowItem = null;
2131
- var main = reactCrudUtils.ViewUtils.getCrud('view');
2132
2090
  if (crud.is('row')) {
2133
2091
  def.parent = crud.parent.parent;
2134
2092
  def.search = crud.parent;
@@ -2138,24 +2096,35 @@ function UIElement(props) {
2138
2096
  def.search = crud;
2139
2097
  }
2140
2098
  var data = reactCrudUtils.Utils.nvl(args.item, rowItem, {});
2141
- var component = event == null ? void 0 : event.component;
2142
- if (component) {
2143
- var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
2144
- parent: crud,
2145
- root: crud,
2146
- name: name,
2147
- dialog: main.dialog,
2148
- data: data,
2149
- edit: edit,
2150
- scope: scope
2151
- }, def));
2152
- main.dialog = d;
2153
- scope.currentDialog = {
2154
- component: component,
2155
- crud: d
2156
- };
2157
- scope.update();
2099
+ var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
2100
+ parent: crud,
2101
+ root: crud,
2102
+ name: name,
2103
+ data: data,
2104
+ edit: edit,
2105
+ scope: scope
2106
+ }, def));
2107
+ var dialog = {
2108
+ crud: d,
2109
+ parent: parent
2110
+ };
2111
+ main.dialog = dialog;
2112
+ scope.toggleDialog(true);
2113
+ scope.currentDialog = dialog;
2114
+ scope.update();
2115
+ };
2116
+ scope.dialogHide = function (args) {
2117
+ var _main$dialog;
2118
+ var main = reactCrudUtils.ViewUtils.getCrud('view');
2119
+ var old = scope.currentDialog;
2120
+ main.dialog = reactCrudUtils.Utils.nvl(old.parent, null);
2121
+ scope.currentDialog = null;
2122
+ if ((_main$dialog = main.dialog) != null && (_main$dialog = _main$dialog.crud) != null && _main$dialog.scope) {
2123
+ var _main$dialog2;
2124
+ (_main$dialog2 = main.dialog) == null || _main$dialog2.crud.scope.update();
2158
2125
  }
2126
+ scope.toggleDialog(false);
2127
+ scope.update();
2159
2128
  };
2160
2129
  return /*#__PURE__*/jsxRuntime.jsx(CrudContext.Provider, {
2161
2130
  value: {