@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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/src/Components/Buttons/Button.js +13 -6
  3. package/src/Components/Container/ScreenContainer.js +1 -0
  4. package/src/Components/Form/Field/Combo/MeterTypesCombo.js +4 -2
  5. package/src/Components/Form/Field/Input.js +5 -4
  6. package/src/Components/Grid/Grid.js +16 -7
  7. package/src/Components/Grid/GridHeaderRow.js +1 -1
  8. package/src/Components/Grid/GridRow.js +35 -34
  9. package/src/Components/Grid/RowDragHandle.js +25 -10
  10. package/src/Components/Grid/RowHandle.js +55 -0
  11. package/src/{Hooks → Components/Grid}/useAsyncRenderers.js +1 -1
  12. package/src/Components/Hoc/Secondary/withSecondaryData.js +2 -1
  13. package/src/Components/Hoc/Secondary/withSecondaryEditor.js +3 -2
  14. package/src/Components/Hoc/Secondary/withSecondarySelection.js +3 -2
  15. package/src/Components/Hoc/Secondary/withSecondaryValue.js +2 -1
  16. package/src/Components/Hoc/withAlert.js +3 -1
  17. package/src/Components/Hoc/withCollapsible.js +9 -4
  18. package/src/Components/Hoc/withComponent.js +6 -0
  19. package/src/Components/Hoc/withContextMenu.js +6 -0
  20. package/src/Components/Hoc/withData.js +3 -2
  21. package/src/Components/Hoc/withDnd.js +16 -8
  22. package/src/Components/Hoc/withDraggable.js +21 -5
  23. package/src/Components/Hoc/withEditor.js +2 -1
  24. package/src/Components/Hoc/withEvents.js +11 -1
  25. package/src/Components/Hoc/withFilters.js +7 -2
  26. package/src/Components/Hoc/withModal.js +3 -2
  27. package/src/Components/Hoc/withPdfButtons.js +3 -2
  28. package/src/Components/Hoc/withPermissions.js +3 -2
  29. package/src/Components/Hoc/withPresetButtons.js +3 -2
  30. package/src/Components/Hoc/withSelection.js +2 -8
  31. package/src/Components/Hoc/withToast.js +4 -2
  32. package/src/Components/Hoc/withTooltip.js +10 -1
  33. package/src/Components/Hoc/withValue.js +3 -9
  34. package/src/Components/Messages/GlobalModals.js +47 -0
  35. package/src/Components/Tree/Tree.js +22 -6
  36. package/src/Components/Tree/TreeNode.js +11 -11
  37. package/src/Components/Tree/TreeNodeDragHandle.js +8 -4
  38. package/src/Components/Viewer/MeterTypeText.js +21 -1
  39. package/src/Constants/MeterTypes.js +2 -0
  40. package/src/Functions/addIconProps.js +46 -0
  41. package/src/Functions/testProps.js +1 -1
  42. package/src/Hooks/useWhyDidYouUpdate.js +33 -0
  43. package/src/PlatformImports/Web/Attachments.js +1 -1
  44. 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 (!window && Platform.OS === 'android') {
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
+ }
@@ -37,7 +37,7 @@ import _ from 'lodash';
37
37
  const
38
38
  EXPANDED_MAX = 100,
39
39
  COLLAPSED_MAX = 4,
40
- isPwa = !!window?.navigator?.standalone;
40
+ isPwa = typeof window !== 'undefined' && !!window?.navigator?.standalone;
41
41
 
42
42
  function FileCardCustom(props) {
43
43
  const {
@@ -1,10 +0,0 @@
1
- import { forwardRef } from 'react';
2
-
3
- export default function withBlank(WrappedComponent) {
4
- return forwardRef((props, ref) => {
5
- const {
6
-
7
- } = props;
8
- return <WrappedComponent {...props} ref={ref} />;
9
- });
10
- }