react-crud-mobile 1.3.94 → 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$currentDialog2, _main$dialog3;
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,63 +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 parent = main.dialog;
1378
- var crud = args.crud;
1379
- var name = scope.getName('modal');
1380
- var edit = args.edit === true;
1381
- var def = {};
1382
- var rowItem = null;
1383
- if (crud.is('row')) {
1384
- def.parent = crud.parent.parent;
1385
- def.search = crud.parent;
1386
- rowItem = crud.data;
1387
- } else if (crud.is('search')) {
1388
- def.parent = crud.parent;
1389
- def.search = crud;
1390
- }
1391
- var data = reactCrudUtils.Utils.nvl(args.item, rowItem, {});
1392
- var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
1393
- parent: crud,
1394
- root: crud,
1395
- name: name,
1396
- data: data,
1397
- edit: edit,
1398
- scope: scope
1399
- }, def));
1400
- var dialog = {
1401
- crud: d,
1402
- parent: parent
1403
- };
1404
- main.dialog = dialog;
1405
- scope.currentDialog = dialog;
1406
- toggle(true);
1407
- scope.update();
1408
- };
1409
- scope.dialogHide = function (args) {
1410
- var _main$dialog;
1411
- var old = scope.currentDialog;
1412
- main.dialog = reactCrudUtils.Utils.nvl(old.parent, null);
1413
- scope.currentDialog = null;
1414
- toggle(false);
1415
- if ((_main$dialog = main.dialog) != null && (_main$dialog = _main$dialog.crud) != null && _main$dialog.scope) {
1416
- var _main$dialog2;
1417
- (_main$dialog2 = main.dialog) == null || _main$dialog2.crud.scope.update();
1418
- }
1419
- scope.update();
1420
- };
1421
1375
  var curr = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1376
+ var main = reactCrudUtils.ViewUtils.getCrud('view');
1422
1377
  if (!curr) {
1423
1378
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
1424
1379
  }
1425
- if (curr.uuid !== ((_main$dialog3 = main.dialog) == null || (_main$dialog3 = _main$dialog3.crud) == null ? void 0 : _main$dialog3.uuid)) {
1380
+ if (curr.uuid !== ((_main$dialog = main.dialog) == null || (_main$dialog = _main$dialog.crud) == null ? void 0 : _main$dialog.uuid)) {
1426
1381
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
1427
1382
  }
1428
1383
  var headerRight = reactCrudUtils.ComponentUtils.getDefine(props, 'header', 'right');
@@ -2124,15 +2079,14 @@ function UIElement(props) {
2124
2079
  children: props.children
2125
2080
  });
2126
2081
  };
2127
- scope.dialogOpen = function (args) {
2128
- var crud = args.crud,
2129
- 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;
2130
2086
  var name = scope.getName('modal');
2131
2087
  var edit = args.edit === true;
2132
2088
  var def = {};
2133
2089
  var rowItem = null;
2134
- var main = reactCrudUtils.ViewUtils.getCrud('view');
2135
- var parent = main.dialog;
2136
2090
  if (crud.is('row')) {
2137
2091
  def.parent = crud.parent.parent;
2138
2092
  def.search = crud.parent;
@@ -2142,26 +2096,35 @@ function UIElement(props) {
2142
2096
  def.search = crud;
2143
2097
  }
2144
2098
  var data = reactCrudUtils.Utils.nvl(args.item, rowItem, {});
2145
- var component = event == null ? void 0 : event.component;
2146
- if (component) {
2147
- var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
2148
- parent: crud,
2149
- root: crud,
2150
- name: name,
2151
- dialog: main.dialog,
2152
- data: data,
2153
- edit: edit,
2154
- scope: scope
2155
- }, def));
2156
- main.dialog = d;
2157
- scope.currentDialog = {
2158
- component: component,
2159
- crud: d,
2160
- scope: scope,
2161
- parent: parent
2162
- };
2163
- 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();
2164
2125
  }
2126
+ scope.toggleDialog(false);
2127
+ scope.update();
2165
2128
  };
2166
2129
  return /*#__PURE__*/jsxRuntime.jsx(CrudContext.Provider, {
2167
2130
  value: {