@onehat/ui 0.4.71 → 0.4.72
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 +1 -1
- package/src/Components/Buttons/Button.js +13 -6
- package/src/Components/Container/ScreenContainer.js +1 -0
- package/src/Components/Form/Field/Combo/MeterTypesCombo.js +4 -2
- package/src/Components/Form/Field/Input.js +5 -4
- package/src/Components/Grid/Grid.js +16 -7
- package/src/Components/Grid/GridHeaderRow.js +1 -1
- package/src/Components/Grid/GridRow.js +35 -34
- package/src/Components/Grid/RowDragHandle.js +25 -10
- package/src/Components/Grid/RowHandle.js +55 -0
- package/src/{Hooks → Components/Grid}/useAsyncRenderers.js +1 -1
- package/src/Components/Hoc/Secondary/withSecondaryData.js +2 -1
- package/src/Components/Hoc/Secondary/withSecondaryEditor.js +3 -2
- package/src/Components/Hoc/Secondary/withSecondarySelection.js +3 -2
- package/src/Components/Hoc/Secondary/withSecondaryValue.js +2 -1
- package/src/Components/Hoc/withAlert.js +3 -1
- package/src/Components/Hoc/withCollapsible.js +9 -4
- package/src/Components/Hoc/withComponent.js +6 -0
- package/src/Components/Hoc/withContextMenu.js +6 -0
- package/src/Components/Hoc/withData.js +3 -2
- package/src/Components/Hoc/withDnd.js +16 -8
- package/src/Components/Hoc/withDraggable.js +21 -5
- package/src/Components/Hoc/withEditor.js +2 -1
- package/src/Components/Hoc/withEvents.js +11 -1
- package/src/Components/Hoc/withFilters.js +7 -2
- package/src/Components/Hoc/withModal.js +3 -2
- package/src/Components/Hoc/withPdfButtons.js +3 -2
- package/src/Components/Hoc/withPermissions.js +3 -2
- package/src/Components/Hoc/withPresetButtons.js +3 -2
- package/src/Components/Hoc/withSelection.js +2 -8
- package/src/Components/Hoc/withToast.js +4 -2
- package/src/Components/Hoc/withTooltip.js +10 -1
- package/src/Components/Hoc/withValue.js +3 -9
- package/src/Components/Messages/GlobalModals.js +47 -0
- package/src/Components/Tree/Tree.js +22 -6
- package/src/Components/Tree/TreeNode.js +11 -11
- package/src/Components/Tree/TreeNodeDragHandle.js +8 -4
- package/src/Components/Viewer/MeterTypeText.js +21 -1
- package/src/Constants/MeterTypes.js +2 -0
- package/src/Functions/addIconProps.js +46 -0
- package/src/Functions/testProps.js +1 -1
- package/src/Hooks/useWhyDidYouUpdate.js +33 -0
- package/src/PlatformImports/Web/Attachments.js +1 -1
- package/src/Components/Hoc/withBlank.js +0 -10
|
@@ -22,7 +22,7 @@ export default function testProps(id, suffix) {
|
|
|
22
22
|
if (suffix) {
|
|
23
23
|
id += suffix; // this is used in conjunction with 'self' object
|
|
24
24
|
}
|
|
25
|
-
if (
|
|
25
|
+
if (typeof window === 'undefined' && Platform.OS === 'android') {
|
|
26
26
|
return {
|
|
27
27
|
accessibilityLabel: id,
|
|
28
28
|
accessible: true,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// This custom hook logs changes in props for debugging purposes.
|
|
4
|
+
// It can be used to track why a component re-renders by comparing current props with previous props
|
|
5
|
+
|
|
6
|
+
// Usage in your component:
|
|
7
|
+
// useWhyDidYouUpdate('withMhTree', { enterpriseId, getEquipment, showInactiveEquipment });
|
|
8
|
+
|
|
9
|
+
export default function useWhyDidYouUpdate(name, props) {
|
|
10
|
+
const previous = useRef();
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (previous.current) {
|
|
14
|
+
const allKeys = Object.keys({ ...previous.current, ...props });
|
|
15
|
+
const changedProps = {};
|
|
16
|
+
|
|
17
|
+
allKeys.forEach(key => {
|
|
18
|
+
if (previous.current[key] !== props[key]) {
|
|
19
|
+
changedProps[key] = {
|
|
20
|
+
from: previous.current[key],
|
|
21
|
+
to: props[key]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (Object.keys(changedProps).length) {
|
|
27
|
+
console.log('[why-did-you-update]', name, changedProps);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
previous.current = props;
|
|
32
|
+
});
|
|
33
|
+
}
|