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.
@@ -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$currentDialog2, _main$dialog3;
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,63 +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 parent = main.dialog;
1369
- var crud = args.crud;
1370
- var name = scope.getName('modal');
1371
- var edit = args.edit === true;
1372
- var def = {};
1373
- var rowItem = null;
1374
- if (crud.is('row')) {
1375
- def.parent = crud.parent.parent;
1376
- def.search = crud.parent;
1377
- rowItem = crud.data;
1378
- } else if (crud.is('search')) {
1379
- def.parent = crud.parent;
1380
- def.search = crud;
1381
- }
1382
- var data = Utils.nvl(args.item, rowItem, {});
1383
- var d = CrudUtils.create('dialog', _extends({
1384
- parent: crud,
1385
- root: crud,
1386
- name: name,
1387
- data: data,
1388
- edit: edit,
1389
- scope: scope
1390
- }, def));
1391
- var dialog = {
1392
- crud: d,
1393
- parent: parent
1394
- };
1395
- main.dialog = dialog;
1396
- scope.currentDialog = dialog;
1397
- toggle(true);
1398
- scope.update();
1399
- };
1400
- scope.dialogHide = function (args) {
1401
- var _main$dialog;
1402
- var old = scope.currentDialog;
1403
- main.dialog = Utils.nvl(old.parent, null);
1404
- scope.currentDialog = null;
1405
- toggle(false);
1406
- if ((_main$dialog = main.dialog) != null && (_main$dialog = _main$dialog.crud) != null && _main$dialog.scope) {
1407
- var _main$dialog2;
1408
- (_main$dialog2 = main.dialog) == null || _main$dialog2.crud.scope.update();
1409
- }
1410
- scope.update();
1411
- };
1412
1366
  var curr = (_scope$currentDialog2 = scope.currentDialog) == null ? void 0 : _scope$currentDialog2.crud;
1367
+ var main = ViewUtils.getCrud('view');
1413
1368
  if (!curr) {
1414
1369
  return /*#__PURE__*/jsx(Fragment, {});
1415
1370
  }
1416
- if (curr.uuid !== ((_main$dialog3 = main.dialog) == null || (_main$dialog3 = _main$dialog3.crud) == null ? void 0 : _main$dialog3.uuid)) {
1371
+ if (curr.uuid !== ((_main$dialog = main.dialog) == null || (_main$dialog = _main$dialog.crud) == null ? void 0 : _main$dialog.uuid)) {
1417
1372
  return /*#__PURE__*/jsx(Fragment, {});
1418
1373
  }
1419
1374
  var headerRight = ComponentUtils.getDefine(props, 'header', 'right');
@@ -2115,15 +2070,14 @@ function UIElement(props) {
2115
2070
  children: props.children
2116
2071
  });
2117
2072
  };
2118
- scope.dialogOpen = function (args) {
2119
- var crud = args.crud,
2120
- event = args.event;
2073
+ scope.dialogShow = function (args) {
2074
+ var main = ViewUtils.getCrud('view');
2075
+ var parent = main.dialog;
2076
+ var crud = args.crud;
2121
2077
  var name = scope.getName('modal');
2122
2078
  var edit = args.edit === true;
2123
2079
  var def = {};
2124
2080
  var rowItem = null;
2125
- var main = ViewUtils.getCrud('view');
2126
- var parent = main.dialog;
2127
2081
  if (crud.is('row')) {
2128
2082
  def.parent = crud.parent.parent;
2129
2083
  def.search = crud.parent;
@@ -2133,26 +2087,35 @@ function UIElement(props) {
2133
2087
  def.search = crud;
2134
2088
  }
2135
2089
  var data = Utils.nvl(args.item, rowItem, {});
2136
- var component = event == null ? void 0 : event.component;
2137
- if (component) {
2138
- var d = CrudUtils.create('dialog', _extends({
2139
- parent: crud,
2140
- root: crud,
2141
- name: name,
2142
- dialog: main.dialog,
2143
- data: data,
2144
- edit: edit,
2145
- scope: scope
2146
- }, def));
2147
- main.dialog = d;
2148
- scope.currentDialog = {
2149
- component: component,
2150
- crud: d,
2151
- scope: scope,
2152
- parent: parent
2153
- };
2154
- 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();
2155
2116
  }
2117
+ scope.toggleDialog(false);
2118
+ scope.update();
2156
2119
  };
2157
2120
  return /*#__PURE__*/jsx(CrudContext.Provider, {
2158
2121
  value: {