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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.94",
2
+ "version": "1.3.96",
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,15 @@ 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
+ let component = args?.event?.component;
609
610
 
610
611
  if (crud.is('row')) {
611
612
  def.parent = crud.parent.parent;
@@ -618,25 +619,38 @@ export default function UIElement(props: ElementType) {
618
619
  }
619
620
 
620
621
  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();
622
+
623
+ let d = CrudUtils.create('dialog', {
624
+ parent: crud,
625
+ root: crud,
626
+ name,
627
+ data,
628
+ edit,
629
+ scope,
630
+ ...def,
631
+ });
632
+
633
+ let dialog = { crud: d, parent, component };
634
+
635
+ main.dialog = dialog;
636
+ scope.toggleDialog(true);
637
+ scope.currentDialog = dialog;
638
+
639
+ scope.update();
640
+ };
641
+
642
+ scope.dialogHide = (args?: MethodType) => {
643
+ let main = ViewUtils.getCrud('view');
644
+ let old = scope.currentDialog;
645
+
646
+ main.dialog = Utils.nvl(old.parent, null);
647
+ scope.currentDialog = null;
648
+
649
+ if (main.dialog?.crud?.scope) {
650
+ main.dialog?.crud.scope.update();
639
651
  }
652
+ scope.toggleDialog(false);
653
+ scope.update();
640
654
  };
641
655
 
642
656
  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 <></>;