react-crud-mobile 1.3.79 → 1.3.81
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/dist/elements/core/UIModal.d.ts +5 -1
- package/dist/react-crud-mobile.cjs.development.js +48 -3
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +48 -3
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/elements/UIElement.tsx +52 -0
- package/src/elements/core/UIModal.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
2
|
+
"version": "1.3.81",
|
|
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.
|
|
48
|
+
"react-crud-utils": "^0.1.372",
|
|
49
49
|
"react-dom": "19.0.0",
|
|
50
50
|
"react-native": "0.79.2",
|
|
51
51
|
"react-native-draggable-flatlist": "^4.0.3",
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
MethodType,
|
|
20
20
|
ActionType,
|
|
21
21
|
ComponentUtils,
|
|
22
|
+
CrudUtils,
|
|
23
|
+
ViewUtils,
|
|
22
24
|
} from 'react-crud-utils';
|
|
23
25
|
import UILink from './core/UILink';
|
|
24
26
|
import UIIcon from './core/UIIcon';
|
|
@@ -56,6 +58,7 @@ export default function UIElement(props: ElementType) {
|
|
|
56
58
|
let crud: Crud = Utils.nvl(props.crud, ctx?.crud);
|
|
57
59
|
let [scope] = useState(ScopeUtils.create({ crud, ...props, theme }));
|
|
58
60
|
let [index, setIndex] = useState(0);
|
|
61
|
+
let [dialog, setDialog] = useState(null);
|
|
59
62
|
let [error, setError]: string | any = useState(null);
|
|
60
63
|
|
|
61
64
|
scope.compile(props);
|
|
@@ -529,6 +532,13 @@ export default function UIElement(props: ElementType) {
|
|
|
529
532
|
{scope.isType('dialog') && (
|
|
530
533
|
<UIModal {...props} scope={scope} crud={crud} />
|
|
531
534
|
)}
|
|
535
|
+
|
|
536
|
+
{dialog && (
|
|
537
|
+
<UIModal {...props} scope={scope} crud={dialog.crud} open>
|
|
538
|
+
{dialog.component}
|
|
539
|
+
</UIModal>
|
|
540
|
+
)}
|
|
541
|
+
|
|
532
542
|
{scope.isType('chart') && (
|
|
533
543
|
<ElChart {...props} scope={scope} crud={crud} />
|
|
534
544
|
)}
|
|
@@ -584,6 +594,48 @@ export default function UIElement(props: ElementType) {
|
|
|
584
594
|
return <>{props.children}</>;
|
|
585
595
|
};
|
|
586
596
|
|
|
597
|
+
scope.dialogOpen = (args?: MethodType) => {
|
|
598
|
+
let { crud, event } = args;
|
|
599
|
+
let name = scope.getName('modal');
|
|
600
|
+
let edit = args.edit === true;
|
|
601
|
+
let def: any = {};
|
|
602
|
+
let rowItem = null;
|
|
603
|
+
let main = ViewUtils.getCrud('view');
|
|
604
|
+
|
|
605
|
+
if (crud.is('row')) {
|
|
606
|
+
def.parent = crud.parent.parent;
|
|
607
|
+
def.search = crud.parent;
|
|
608
|
+
|
|
609
|
+
rowItem = crud.data;
|
|
610
|
+
} else if (crud.is('search')) {
|
|
611
|
+
def.parent = crud.parent;
|
|
612
|
+
def.search = crud;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
let data = Utils.nvl(args.item, rowItem, {});
|
|
616
|
+
let component = event?.component;
|
|
617
|
+
|
|
618
|
+
if (component) {
|
|
619
|
+
let d = CrudUtils.create('dialog', {
|
|
620
|
+
parent: crud,
|
|
621
|
+
root: crud,
|
|
622
|
+
name,
|
|
623
|
+
dialog: main.dialog,
|
|
624
|
+
data,
|
|
625
|
+
edit,
|
|
626
|
+
scope,
|
|
627
|
+
...def,
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
main.dialog = d;
|
|
631
|
+
|
|
632
|
+
scope.currentDialog = d;
|
|
633
|
+
|
|
634
|
+
dialog = { component, crud: d };
|
|
635
|
+
setDialog(dialog);
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
|
|
587
639
|
return (
|
|
588
640
|
<CrudContext.Provider value={{ crud, theme }}>
|
|
589
641
|
<Tag ref={ref} style={getStyle()} {...custom}>
|
|
@@ -20,8 +20,12 @@ import UIChildren from '../UIChildren';
|
|
|
20
20
|
import Ionicons from '@expo/vector-icons/Ionicons';
|
|
21
21
|
import UIToast from './UIToast';
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
interface UIModalType extends ChildType {
|
|
24
|
+
open?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default function UIModal(props: UIModalType) {
|
|
28
|
+
let [modalVisible, setModalVisible] = useState(props.open === true);
|
|
25
29
|
let [index, setIndex] = useState(0);
|
|
26
30
|
let main = ViewUtils.getCrud('view');
|
|
27
31
|
//v3
|