react-crud-mobile 1.3.94 → 1.3.96

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,16 @@ 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 _args$event;
2075
+ var main = ViewUtils.getCrud('view');
2076
+ var parent = main.dialog;
2077
+ var crud = args.crud;
2121
2078
  var name = scope.getName('modal');
2122
2079
  var edit = args.edit === true;
2123
2080
  var def = {};
2124
2081
  var rowItem = null;
2125
- var main = ViewUtils.getCrud('view');
2126
- var parent = main.dialog;
2082
+ var component = args == null || (_args$event = args.event) == null ? void 0 : _args$event.component;
2127
2083
  if (crud.is('row')) {
2128
2084
  def.parent = crud.parent.parent;
2129
2085
  def.search = crud.parent;
@@ -2133,26 +2089,36 @@ function UIElement(props) {
2133
2089
  def.search = crud;
2134
2090
  }
2135
2091
  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();
2092
+ var d = CrudUtils.create('dialog', _extends({
2093
+ parent: crud,
2094
+ root: crud,
2095
+ name: name,
2096
+ data: data,
2097
+ edit: edit,
2098
+ scope: scope
2099
+ }, def));
2100
+ var dialog = {
2101
+ crud: d,
2102
+ parent: parent,
2103
+ component: component
2104
+ };
2105
+ main.dialog = dialog;
2106
+ scope.toggleDialog(true);
2107
+ scope.currentDialog = dialog;
2108
+ scope.update();
2109
+ };
2110
+ scope.dialogHide = function (args) {
2111
+ var _main$dialog;
2112
+ var main = ViewUtils.getCrud('view');
2113
+ var old = scope.currentDialog;
2114
+ main.dialog = Utils.nvl(old.parent, null);
2115
+ scope.currentDialog = null;
2116
+ if ((_main$dialog = main.dialog) != null && (_main$dialog = _main$dialog.crud) != null && _main$dialog.scope) {
2117
+ var _main$dialog2;
2118
+ (_main$dialog2 = main.dialog) == null || _main$dialog2.crud.scope.update();
2155
2119
  }
2120
+ scope.toggleDialog(false);
2121
+ scope.update();
2156
2122
  };
2157
2123
  return /*#__PURE__*/jsx(CrudContext.Provider, {
2158
2124
  value: {