react-crud-mobile 1.3.79 → 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.
@@ -1,3 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ChildType } from 'react-crud-utils';
3
- export default function UIModal(props: ChildType): import("react").JSX.Element;
3
+ interface UIModalType extends ChildType {
4
+ open?: boolean;
5
+ }
6
+ export default function UIModal(props: UIModalType): import("react").JSX.Element;
7
+ export {};
@@ -1337,7 +1337,7 @@ function UIToast() {
1337
1337
 
1338
1338
  function UIModal(props) {
1339
1339
  var _theme$styles, _main$dialog2;
1340
- var _useState = React.useState(false),
1340
+ var _useState = React.useState(props.open === true),
1341
1341
  modalVisible = _useState[0],
1342
1342
  setModalVisible = _useState[1];
1343
1343
  var _useState2 = React.useState(0),
@@ -1710,8 +1710,11 @@ function UIElement(props) {
1710
1710
  index = _useState2[0],
1711
1711
  setIndex = _useState2[1];
1712
1712
  var _useState3 = React.useState(null),
1713
- error = _useState3[0],
1714
- setError = _useState3[1];
1713
+ dialog = _useState3[0],
1714
+ setDialog = _useState3[1];
1715
+ var _useState4 = React.useState(null),
1716
+ error = _useState4[0],
1717
+ setError = _useState4[1];
1715
1718
  scope.compile(props);
1716
1719
  crud = scope.crud;
1717
1720
  var options = scope.getOptions();
@@ -2051,6 +2054,11 @@ function UIElement(props) {
2051
2054
  })), scope.isType('dialog') && /*#__PURE__*/jsxRuntime.jsx(UIModal, _extends({}, props, {
2052
2055
  scope: scope,
2053
2056
  crud: crud
2057
+ })), dialog && /*#__PURE__*/jsxRuntime.jsx(UIModal, _extends({}, props, {
2058
+ scope: scope,
2059
+ crud: dialog.crud,
2060
+ open: true,
2061
+ children: dialog.component
2054
2062
  })), scope.isType('chart') && /*#__PURE__*/jsxRuntime.jsx(ElChart, _extends({}, props, {
2055
2063
  scope: scope,
2056
2064
  crud: crud
@@ -2097,6 +2105,48 @@ function UIElement(props) {
2097
2105
  children: props.children
2098
2106
  });
2099
2107
  };
2108
+ scope.dialogOpen = function (args) {
2109
+ var crud = args.crud,
2110
+ event = args.event;
2111
+ var name = scope.getName('modal');
2112
+ var edit = args.edit === true;
2113
+ var def = {};
2114
+ var rowItem = null;
2115
+ var main = reactCrudUtils.ViewUtils.getCrud('view');
2116
+ if (crud.is('row')) {
2117
+ def.parent = crud.parent.parent;
2118
+ def.search = crud.parent;
2119
+ rowItem = crud.data;
2120
+ } else if (crud.is('search')) {
2121
+ def.parent = crud.parent;
2122
+ def.search = crud;
2123
+ }
2124
+ var data = reactCrudUtils.Utils.nvl(args.item, rowItem, {});
2125
+ var component = event == null ? void 0 : event.component;
2126
+ if (component) {
2127
+ var d = reactCrudUtils.CrudUtils.create('dialog', _extends({
2128
+ parent: crud,
2129
+ root: crud,
2130
+ name: name,
2131
+ dialog: main.dialog,
2132
+ data: data,
2133
+ edit: edit,
2134
+ scope: scope
2135
+ }, def));
2136
+ main.dialog = d;
2137
+ scope.currentDialog = d;
2138
+ dialog = {
2139
+ component: component,
2140
+ crud: d
2141
+ };
2142
+ setDialog(dialog);
2143
+ }
2144
+ };
2145
+ scope.dialogOpen = function (args) {
2146
+ var component = args.event.component;
2147
+ dialog = component;
2148
+ setDialog(component);
2149
+ };
2100
2150
  return /*#__PURE__*/jsxRuntime.jsx(CrudContext.Provider, {
2101
2151
  value: {
2102
2152
  crud: crud,