@gustavo-valsechi/client 1.4.368 → 1.4.369
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.
|
@@ -68,17 +68,34 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
68
68
|
};
|
|
69
69
|
const setProps = (modalName, props) => {
|
|
70
70
|
const index = import_lodash.default.findIndex(memory, (modal) => modal.name === modalName);
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
71
|
+
const data = import_lodash.default.find(memory, (modal) => modal.name === modalName);
|
|
72
|
+
if (!data) return;
|
|
73
73
|
memory.splice(index, 1, {
|
|
74
|
-
...
|
|
74
|
+
...data,
|
|
75
75
|
props: {
|
|
76
|
-
...
|
|
76
|
+
...data.props,
|
|
77
77
|
...props
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
setModals([...memory]);
|
|
81
81
|
};
|
|
82
|
+
const setContent = (modalName, content) => {
|
|
83
|
+
var _a;
|
|
84
|
+
const index = import_lodash.default.findIndex(memory, (modal) => modal.name === modalName);
|
|
85
|
+
const data = import_lodash.default.find(memory, (modal) => modal.name === modalName);
|
|
86
|
+
if (!data) return;
|
|
87
|
+
memory.splice(index, 1, {
|
|
88
|
+
...data,
|
|
89
|
+
props: {
|
|
90
|
+
...data.props,
|
|
91
|
+
content: ((_a = data.props) == null ? void 0 : _a.content) ? {
|
|
92
|
+
...data.props.content,
|
|
93
|
+
...content
|
|
94
|
+
} : content
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
setModals([...memory]);
|
|
98
|
+
};
|
|
82
99
|
const toggle = (modalName) => {
|
|
83
100
|
var _a;
|
|
84
101
|
const content = import_lodash.default.find(memory, (modal) => modal.name === modalName);
|
|
@@ -92,6 +109,7 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
92
109
|
add,
|
|
93
110
|
remove,
|
|
94
111
|
setProps,
|
|
112
|
+
setContent,
|
|
95
113
|
toggle
|
|
96
114
|
},
|
|
97
115
|
children: [
|
|
@@ -34,17 +34,34 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
34
34
|
};
|
|
35
35
|
const setProps = (modalName, props) => {
|
|
36
36
|
const index = _.findIndex(memory, (modal) => modal.name === modalName);
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const data = _.find(memory, (modal) => modal.name === modalName);
|
|
38
|
+
if (!data) return;
|
|
39
39
|
memory.splice(index, 1, {
|
|
40
|
-
...
|
|
40
|
+
...data,
|
|
41
41
|
props: {
|
|
42
|
-
...
|
|
42
|
+
...data.props,
|
|
43
43
|
...props
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
setModals([...memory]);
|
|
47
47
|
};
|
|
48
|
+
const setContent = (modalName, content) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const index = _.findIndex(memory, (modal) => modal.name === modalName);
|
|
51
|
+
const data = _.find(memory, (modal) => modal.name === modalName);
|
|
52
|
+
if (!data) return;
|
|
53
|
+
memory.splice(index, 1, {
|
|
54
|
+
...data,
|
|
55
|
+
props: {
|
|
56
|
+
...data.props,
|
|
57
|
+
content: ((_a = data.props) == null ? void 0 : _a.content) ? {
|
|
58
|
+
...data.props.content,
|
|
59
|
+
...content
|
|
60
|
+
} : content
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
setModals([...memory]);
|
|
64
|
+
};
|
|
48
65
|
const toggle = (modalName) => {
|
|
49
66
|
var _a;
|
|
50
67
|
const content = _.find(memory, (modal) => modal.name === modalName);
|
|
@@ -58,6 +75,7 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
58
75
|
add,
|
|
59
76
|
remove,
|
|
60
77
|
setProps,
|
|
78
|
+
setContent,
|
|
61
79
|
toggle
|
|
62
80
|
},
|
|
63
81
|
children: [
|
|
@@ -11,5 +11,6 @@ export interface IModalContext {
|
|
|
11
11
|
add: (config: IModalConfig | IModalConfig[]) => void;
|
|
12
12
|
remove: (modalName: string | string[]) => void;
|
|
13
13
|
setProps: (modalName: string, props: IModal) => void;
|
|
14
|
+
setContent: (modalName: string, props: IModal) => void;
|
|
14
15
|
toggle: (modalName: string) => void;
|
|
15
16
|
}
|