react-crud-mobile 1.3.92 → 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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.92",
2
+ "version": "1.3.95",
3
3
  "license": "MIT",
4
4
  "description": "Uma biblioteca de componentes para React Native",
5
5
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@react-native-vector-icons/ionicons": "^7.4.0",
46
46
  "@react-native-vector-icons/material-icons": "^0.0.1",
47
47
  "react": "19.0.0",
48
- "react-crud-utils": "^0.1.372",
48
+ "react-crud-utils": "^0.1.376",
49
49
  "react-dom": "19.0.0",
50
50
  "react-native": "0.79.2",
51
51
  "react-native-draggable-flatlist": "^4.0.3",
@@ -598,13 +598,14 @@ export default function UIElement(props: ElementType) {
598
598
  return <>{props.children}</>;
599
599
  };
600
600
 
601
- scope.dialogOpen = (args?: MethodType) => {
602
- let { crud, event } = args;
601
+ scope.dialogShow = (args?: MethodType) => {
602
+ let main = ViewUtils.getCrud('view');
603
+ let parent = main.dialog;
604
+ let { crud } = args;
603
605
  let name = scope.getName('modal');
604
606
  let edit = args.edit === true;
605
607
  let def: any = {};
606
608
  let rowItem = null;
607
- let main = ViewUtils.getCrud('view');
608
609
 
609
610
  if (crud.is('row')) {
610
611
  def.parent = crud.parent.parent;
@@ -617,25 +618,38 @@ export default function UIElement(props: ElementType) {
617
618
  }
618
619
 
619
620
  let data = Utils.nvl(args.item, rowItem, {});
620
- let component = event?.component;
621
-
622
- if (component) {
623
- let d = CrudUtils.create('dialog', {
624
- parent: crud,
625
- root: crud,
626
- name,
627
- dialog: main.dialog,
628
- data,
629
- edit,
630
- scope,
631
- ...def,
632
- });
633
-
634
- main.dialog = d;
635
-
636
- scope.currentDialog = { component, crud: d };
637
- scope.update();
621
+
622
+ let d = CrudUtils.create('dialog', {
623
+ parent: crud,
624
+ root: crud,
625
+ name,
626
+ data,
627
+ edit,
628
+ scope,
629
+ ...def,
630
+ });
631
+
632
+ let dialog = { crud: d, parent };
633
+
634
+ main.dialog = dialog;
635
+ scope.toggleDialog(true);
636
+ scope.currentDialog = dialog;
637
+
638
+ scope.update();
639
+ };
640
+
641
+ scope.dialogHide = (args?: MethodType) => {
642
+ let main = ViewUtils.getCrud('view');
643
+ let old = scope.currentDialog;
644
+
645
+ main.dialog = Utils.nvl(old.parent, null);
646
+ scope.currentDialog = null;
647
+
648
+ if (main.dialog?.crud?.scope) {
649
+ main.dialog?.crud.scope.update();
638
650
  }
651
+ scope.toggleDialog(false);
652
+ scope.update();
639
653
  };
640
654
 
641
655
  return (
@@ -33,7 +33,6 @@ export default function UIModal({
33
33
  }: UIModalType) {
34
34
  let [modalVisible, setModalVisible] = useState(open === true);
35
35
  let [index, setIndex] = useState(0);
36
- let main = ViewUtils.getCrud('view');
37
36
  //v6
38
37
 
39
38
  const label = scope.getLabel();
@@ -51,7 +50,7 @@ export default function UIModal({
51
50
  scope.close({ scope, crud: scope.currentDialog?.crud, event: {} });
52
51
  };
53
52
 
54
- const toggle = vis => {
53
+ scope.toggleDialog = vis => {
55
54
  modalVisible = vis;
56
55
  setModalVisible(modalVisible);
57
56
  };
@@ -60,65 +59,14 @@ export default function UIModal({
60
59
  setIndex(++index);
61
60
  };
62
61
 
63
- scope.dialogShow = (args?: MethodType) => {
64
- let { crud } = args;
65
- let name = scope.getName('modal');
66
- let edit = args.edit === true;
67
- let def: any = {};
68
- let rowItem = null;
69
-
70
- if (crud.is('row')) {
71
- def.parent = crud.parent.parent;
72
- def.search = crud.parent;
73
-
74
- rowItem = crud.data;
75
- } else if (crud.is('search')) {
76
- def.parent = crud.parent;
77
- def.search = crud;
78
- }
79
-
80
- let data = Utils.nvl(args.item, rowItem, {});
81
-
82
- let d = CrudUtils.create('dialog', {
83
- parent: crud,
84
- root: crud,
85
- name,
86
- dialog: main.dialog,
87
- data,
88
- edit,
89
- scope,
90
- ...def,
91
- });
92
-
93
- main.dialog = d;
94
-
95
- scope.currentDialog = { crud: d };
96
-
97
- toggle(true);
98
- scope.update();
99
- };
100
-
101
- scope.dialogHide = (args?: MethodType) => {
102
- let old = scope.currentDialog?.crud;
103
-
104
- main.dialog = Utils.nvl(old.dialog, null);
105
- scope.currentDialog = null;
106
-
107
- toggle(false);
108
-
109
- if (main.dialog?.scope) {
110
- main.dialog.scope.update();
111
- }
112
- scope.update();
113
- };
114
-
115
62
  let curr = scope.currentDialog?.crud;
63
+ let main = ViewUtils.getCrud('view');
116
64
 
117
65
  if (!curr) {
118
66
  return <></>;
119
67
  }
120
68
 
121
- if (curr.uuid !== main.dialog?.uuid) {
69
+ if (curr.uuid !== main.dialog?.crud?.uuid) {
122
70
  return <></>;
123
71
  }
124
72