pcm-shared-components 0.0.90 → 0.0.91
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.
|
@@ -81,31 +81,22 @@ export const GenericDialogWindow = props => {
|
|
|
81
81
|
return obj;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const setMenuOnClickCallback =
|
|
84
|
+
const setMenuOnClickCallback = (id, onClick) => {
|
|
85
85
|
//Used to set the onClick callback on a specific menu matching the id provided.
|
|
86
86
|
//Example: Used by the children component to set the onClick of a menu.
|
|
87
87
|
// A menu must have a unique id object matching the id on which we are searching for and a callback function must be provided
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}, [appBarMenu]);
|
|
88
|
+
//Need to filter out previous ids and add the new ones
|
|
89
|
+
setOnClickOverride(previousState => {
|
|
90
|
+
return [...previousState.filter(ps => ps.id !== id), {
|
|
91
|
+
id: id,
|
|
92
|
+
onClick: onClick
|
|
93
|
+
}];
|
|
94
|
+
});
|
|
95
|
+
};
|
|
98
96
|
|
|
99
97
|
const setOverrides = () => {
|
|
100
98
|
try {
|
|
101
99
|
//Loop over all our on click overrides and apply the onClick callback for each id found in the onClickOverride state
|
|
102
|
-
onClickOverride.forEach(item => {
|
|
103
|
-
setManagedAppBarMenu(previousState => {
|
|
104
|
-
return { ...previousState,
|
|
105
|
-
mainMenu: updateObjectByID(previousState.mainMenu, item.id, undefined)
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
100
|
onClickOverride.forEach(item => {
|
|
110
101
|
setManagedAppBarMenu(previousState => {
|
|
111
102
|
return { ...previousState,
|
|
@@ -138,8 +129,7 @@ export const GenericDialogWindow = props => {
|
|
|
138
129
|
})]
|
|
139
130
|
}); // If we have a mainMenu item with the id='save' then override the onClick event to use the onSave function which reaches into the child ref
|
|
140
131
|
//Need to re-apply any onClick override to ensure they are still properly set by what was overridden from the child component.
|
|
141
|
-
|
|
142
|
-
setOverrides();
|
|
132
|
+
// setOverrides();
|
|
143
133
|
}
|
|
144
134
|
}, [appBarMenu, can_save, showSaveButton, save_button_label]); // -----------------------------------------
|
|
145
135
|
// Note make sure to include disableEnforceFocus or else I'll have infinite error/warnings on Uncaught RangeError.
|