@centreon/ui 25.4.1 → 25.4.2

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": "25.4.1",
3
+ "version": "25.4.2",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -4,6 +4,7 @@ import { InputPropsWithoutGroup } from './models';
4
4
 
5
5
  import { Box, Typography } from '@mui/material';
6
6
  import { FormikValues, useFormikContext } from 'formik';
7
+ import { isNotEmpty, isNotNil } from 'ramda';
7
8
  import { getInput } from '.';
8
9
 
9
10
  interface StylesProps {
@@ -47,12 +48,17 @@ const Grid = ({
47
48
  {grid?.columns.map((field) => {
48
49
  const Input = getInput(field.type);
49
50
 
51
+ const key =
52
+ isNotNil(field.label) || isNotEmpty(field.label)
53
+ ? field.label
54
+ : field.additionalLabel;
55
+
50
56
  if (field.hideInput?.(values) ?? false) {
51
57
  return null;
52
58
  }
53
59
 
54
60
  return (
55
- <Box sx={{ width: '100%' }} key={field.fieldName}>
61
+ <Box sx={{ width: '100%' }} key={key}>
56
62
  {field.additionalLabel && (
57
63
  <Typography
58
64
  sx={{ marginBottom: 0.5, color: 'primary.main' }}
@@ -20,6 +20,8 @@ import {
20
20
  groupBy,
21
21
  isEmpty,
22
22
  isNil,
23
+ isNotEmpty,
24
+ isNotNil,
23
25
  keys,
24
26
  last,
25
27
  not,
@@ -204,7 +206,6 @@ const Inputs = ({
204
206
  : ({} as Group);
205
207
 
206
208
  const hasGroupDivider = !groups[index]?.isDividerHidden;
207
-
208
209
  const isFirstElement = areGroupsOpen || equals(index, 0);
209
210
 
210
211
  return (
@@ -219,22 +220,19 @@ const Inputs = ({
219
220
  >
220
221
  <div className={classes.inputs}>
221
222
  {groupedInputs.map((inputProps) => {
223
+ const key =
224
+ isNotNil(inputProps.label) || isNotEmpty(inputProps.label)
225
+ ? inputProps.label
226
+ : inputProps.additionalLabel;
227
+
222
228
  if (isLoading) {
223
- return (
224
- <LoadingSkeleton
225
- input={inputProps}
226
- key={inputProps.label}
227
- />
228
- );
229
+ return <LoadingSkeleton input={inputProps} key={key} />;
229
230
  }
230
231
 
231
232
  const Input = getInput(inputProps.type);
232
233
 
233
234
  return (
234
- <div
235
- className={classes.inputWrapper}
236
- key={inputProps.label}
237
- >
235
+ <div className={classes.inputWrapper} key={key}>
238
236
  {inputProps.additionalLabel && (
239
237
  <Typography
240
238
  className={cx(