react-crud-mobile 1.3.78 → 1.3.80

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
  function UIModal(props) {
1330
1330
  var _theme$styles, _main$dialog2;
1331
- var _useState = useState(false),
1331
+ var _useState = useState(props.open === true),
1332
1332
  modalVisible = _useState[0],
1333
1333
  setModalVisible = _useState[1];
1334
1334
  var _useState2 = useState(0),
@@ -1618,6 +1618,7 @@ function UIOrder(props) {
1618
1618
  }
1619
1619
  return list;
1620
1620
  });
1621
+ //v2
1621
1622
  var renderItem = function renderItem(_ref) {
1622
1623
  var item = _ref.item,
1623
1624
  drag = _ref.drag,
@@ -1700,8 +1701,11 @@ function UIElement(props) {
1700
1701
  index = _useState2[0],
1701
1702
  setIndex = _useState2[1];
1702
1703
  var _useState3 = useState(null),
1703
- error = _useState3[0],
1704
- setError = _useState3[1];
1704
+ dialog = _useState3[0],
1705
+ setDialog = _useState3[1];
1706
+ var _useState4 = useState(null),
1707
+ error = _useState4[0],
1708
+ setError = _useState4[1];
1705
1709
  scope.compile(props);
1706
1710
  crud = scope.crud;
1707
1711
  var options = scope.getOptions();
@@ -2041,6 +2045,11 @@ function UIElement(props) {
2041
2045
  })), scope.isType('dialog') && /*#__PURE__*/jsx(UIModal, _extends({}, props, {
2042
2046
  scope: scope,
2043
2047
  crud: crud
2048
+ })), dialog && /*#__PURE__*/jsx(UIModal, _extends({}, props, {
2049
+ scope: scope,
2050
+ crud: dialog.crud,
2051
+ open: true,
2052
+ children: dialog.component
2044
2053
  })), scope.isType('chart') && /*#__PURE__*/jsx(ElChart, _extends({}, props, {
2045
2054
  scope: scope,
2046
2055
  crud: crud
@@ -2087,6 +2096,48 @@ function UIElement(props) {
2087
2096
  children: props.children
2088
2097
  });
2089
2098
  };
2099
+ scope.dialogOpen = function (args) {
2100
+ var crud = args.crud,
2101
+ event = args.event;
2102
+ var name = scope.getName('modal');
2103
+ var edit = args.edit === true;
2104
+ var def = {};
2105
+ var rowItem = null;
2106
+ var main = ViewUtils.getCrud('view');
2107
+ if (crud.is('row')) {
2108
+ def.parent = crud.parent.parent;
2109
+ def.search = crud.parent;
2110
+ rowItem = crud.data;
2111
+ } else if (crud.is('search')) {
2112
+ def.parent = crud.parent;
2113
+ def.search = crud;
2114
+ }
2115
+ var data = Utils.nvl(args.item, rowItem, {});
2116
+ var component = event == null ? void 0 : event.component;
2117
+ if (component) {
2118
+ var d = CrudUtils.create('dialog', _extends({
2119
+ parent: crud,
2120
+ root: crud,
2121
+ name: name,
2122
+ dialog: main.dialog,
2123
+ data: data,
2124
+ edit: edit,
2125
+ scope: scope
2126
+ }, def));
2127
+ main.dialog = d;
2128
+ scope.currentDialog = d;
2129
+ dialog = {
2130
+ component: component,
2131
+ crud: d
2132
+ };
2133
+ setDialog(dialog);
2134
+ }
2135
+ };
2136
+ scope.dialogOpen = function (args) {
2137
+ var component = args.event.component;
2138
+ dialog = component;
2139
+ setDialog(component);
2140
+ };
2090
2141
  return /*#__PURE__*/jsx(CrudContext.Provider, {
2091
2142
  value: {
2092
2143
  crud: crud,