@onehat/ui 0.3.370 → 0.3.372
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,3 +1,4 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import Inflector from 'inflector-js';
|
|
2
3
|
import inArray from '../../Functions/inArray.js';
|
|
3
4
|
import {
|
|
@@ -81,10 +82,10 @@ export function canUser(permission, modelToCheck = null) {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
export default function withPermissions(WrappedComponent, forceUsePermissions = false) {
|
|
84
|
-
return (props) => {
|
|
85
|
+
return forwardRef((props, ref) => {
|
|
85
86
|
|
|
86
87
|
if (!props.usePermissions && !forceUsePermissions) {
|
|
87
|
-
return <WrappedComponent {...props} />;
|
|
88
|
+
return <WrappedComponent {...props} ref={ref} />;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const {
|
|
@@ -114,6 +115,7 @@ export default function withPermissions(WrappedComponent, forceUsePermissions =
|
|
|
114
115
|
{...props}
|
|
115
116
|
canUser={canUserDecorator}
|
|
116
117
|
showPermissionsError={showPermissionsError}
|
|
118
|
+
ref={ref}
|
|
117
119
|
/>;
|
|
118
|
-
};
|
|
120
|
+
});
|
|
119
121
|
}
|