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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.94",
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.375",
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,14 +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
- let parent = main.dialog;
609
609
 
610
610
  if (crud.is('row')) {
611
611
  def.parent = crud.parent.parent;
@@ -618,25 +618,38 @@ export default function UIElement(props: ElementType) {
618
618
  }
619
619
 
620
620
  let data = Utils.nvl(args.item, rowItem, {});
621
- let component = event?.component;
622
-
623
- if (component) {
624
- let d = CrudUtils.create('dialog', {
625
- parent: crud,
626
- root: crud,
627
- name,
628
- dialog: main.dialog,
629
- data,
630
- edit,
631
- scope,
632
- ...def,
633
- });
634
-
635
- main.dialog = d;
636
-
637
- scope.currentDialog = { component, crud: d, scope, parent };
638
- 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();
639
650
  }
651
+ scope.toggleDialog(false);
652
+ scope.update();
640
653
  };
641
654
 
642
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,60 +59,8 @@ export default function UIModal({
60
59
  setIndex(++index);
61
60
  };
62
61
 
63
- scope.dialogShow = (args?: MethodType) => {
64
- let parent = main.dialog;
65
- let { crud } = args;
66
- let name = scope.getName('modal');
67
- let edit = args.edit === true;
68
- let def: any = {};
69
- let rowItem = null;
70
-
71
- if (crud.is('row')) {
72
- def.parent = crud.parent.parent;
73
- def.search = crud.parent;
74
-
75
- rowItem = crud.data;
76
- } else if (crud.is('search')) {
77
- def.parent = crud.parent;
78
- def.search = crud;
79
- }
80
-
81
- let data = Utils.nvl(args.item, rowItem, {});
82
-
83
- let d = CrudUtils.create('dialog', {
84
- parent: crud,
85
- root: crud,
86
- name,
87
- data,
88
- edit,
89
- scope,
90
- ...def,
91
- });
92
-
93
- let dialog = { crud: d, parent };
94
-
95
- main.dialog = dialog;
96
- scope.currentDialog = dialog;
97
-
98
- toggle(true);
99
- scope.update();
100
- };
101
-
102
- scope.dialogHide = (args?: MethodType) => {
103
- let old = scope.currentDialog;
104
-
105
- main.dialog = Utils.nvl(old.parent, null);
106
- scope.currentDialog = null;
107
-
108
- toggle(false);
109
-
110
- if (main.dialog?.crud?.scope) {
111
- main.dialog?.crud.scope.update();
112
- }
113
- scope.update();
114
- };
115
-
116
62
  let curr = scope.currentDialog?.crud;
63
+ let main = ViewUtils.getCrud('view');
117
64
 
118
65
  if (!curr) {
119
66
  return <></>;