@centreon/ui 24.10.25 → 24.10.26

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.10.25",
3
+ "version": "24.10.26",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -13,7 +13,6 @@ import { equals, isNil, prop } from 'ramda';
13
13
 
14
14
  import { Card, useTheme } from '@mui/material';
15
15
 
16
- import LoadingSkeleton from '../LoadingSkeleton';
17
16
  import { useMemoComponent, useViewportIntersection } from '../utils';
18
17
 
19
18
  import { useDashboardItemStyles } from './Dashboard.styles';
@@ -22,7 +21,10 @@ import { isResizingItemAtom } from './atoms';
22
21
  interface DashboardItemProps {
23
22
  additionalMemoProps?: Array<unknown>;
24
23
  canMove?: boolean;
25
- children: ReactElement;
24
+ children: Array<
25
+ | ReactElement
26
+ | (({ isInViewport }: { isInViewport: boolean }) => ReactElement)
27
+ >;
26
28
  className?: string;
27
29
  disablePadding?: boolean;
28
30
  header?: ReactElement;
@@ -119,15 +121,8 @@ const Item = forwardRef<HTMLDivElement, DashboardItemProps>(
119
121
  !disablePadding && classes.widgetPadding
120
122
  )}
121
123
  >
122
- {!isInViewport ? (
123
- <LoadingSkeleton
124
- animation={false}
125
- data-widget-skeleton={id}
126
- height="100%"
127
- width="100%"
128
- />
129
- ) : (
130
- children
124
+ {children.map((child) =>
125
+ typeof child === 'function' ? child({ isInViewport }) : child
131
126
  )}
132
127
  </div>
133
128
  </Card>
@@ -37,6 +37,7 @@ interface UseMetricsQueryProps {
37
37
  timePeriodType: number;
38
38
  };
39
39
  isEnabled?: boolean;
40
+ enforceIsEnabled?: boolean;
40
41
  }
41
42
 
42
43
  interface UseMetricsQueryState {
@@ -103,7 +104,8 @@ const useGraphQuery = ({
103
104
  refreshCount,
104
105
  bypassQueryParams = false,
105
106
  prefix,
106
- isEnabled = true
107
+ isEnabled = true,
108
+ enforceIsEnabled
107
109
  }: UseMetricsQueryProps): UseMetricsQueryState => {
108
110
  const timePeriodToUse = equals(timePeriod?.timePeriodType, -1)
109
111
  ? {
@@ -161,9 +163,10 @@ const useGraphQuery = ({
161
163
  ],
162
164
  queryOptions: {
163
165
  enabled:
164
- areResourcesFullfilled(resources) &&
165
- !isEmpty(definedMetrics) &&
166
- isEnabled,
166
+ enforceIsEnabled ??
167
+ (areResourcesFullfilled(resources) &&
168
+ !isEmpty(definedMetrics) &&
169
+ isEnabled),
167
170
  refetchInterval: refreshInterval,
168
171
  suspense: false
169
172
  },
@@ -18,10 +18,9 @@ export const useViewportIntersection = (
18
18
  observer.current.disconnect();
19
19
  }
20
20
 
21
- observer.current = new window.IntersectionObserver(
22
- ([newEntry]) => setEntry(newEntry),
23
- options
24
- );
21
+ observer.current = new window.IntersectionObserver(([newEntry]) => {
22
+ setEntry(newEntry);
23
+ }, options);
25
24
 
26
25
  if (element) {
27
26
  observer.current.observe(element);