@centreon/ui 24.4.33 → 24.4.34

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.4.33",
3
+ "version": "24.4.34",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -77,9 +77,9 @@ const mountListing = (): void => {
77
77
  subItems={{
78
78
  canCheckSubItems: false,
79
79
  enable: true,
80
+ getRowProperty: () => 'subItems',
80
81
  labelCollapse: 'Collapse',
81
- labelExpand: 'Expand',
82
- rowProperty: 'subItems'
82
+ labelExpand: 'Expand'
83
83
  }}
84
84
  totalRows={10}
85
85
  />
@@ -377,9 +377,9 @@ export const ListingWithSubItems = {
377
377
  subItems: {
378
378
  canCheckSubItems: false,
379
379
  enable: true,
380
+ getRowProperty: () => 'subItems',
380
381
  labelCollapse: 'Collapse',
381
- labelExpand: 'Expand',
382
- rowProperty: 'subItems'
382
+ labelExpand: 'Expand'
383
383
  },
384
384
  totalRows: 10
385
385
  }
@@ -123,9 +123,9 @@ export interface Props<TRow> {
123
123
  subItems?: {
124
124
  canCheckSubItems: boolean;
125
125
  enable: boolean;
126
+ getRowProperty: (row?) => string;
126
127
  labelCollapse: string;
127
128
  labelExpand: string;
128
- rowProperty: string;
129
129
  };
130
130
  totalRows?: number;
131
131
  viewerModeConfiguration?: ViewerModeConfiguration;
@@ -180,9 +180,9 @@ const Listing = <TRow extends { id: RowId }>({
180
180
  subItems = {
181
181
  canCheckSubItems: false,
182
182
  enable: false,
183
+ getRowProperty: () => '',
183
184
  labelCollapse: 'Collapse',
184
- labelExpand: 'Expand',
185
- rowProperty: ''
185
+ labelExpand: 'Expand'
186
186
  }
187
187
  }: Props<TRow>): JSX.Element => {
188
188
  const currentVisibleColumns = getVisibleColumns({
@@ -215,10 +215,10 @@ const Listing = <TRow extends { id: RowId }>({
215
215
  ? reduce<TRow, Array<TRow>>(
216
216
  (acc, row): Array<TRow> => {
217
217
  if (
218
- row[subItems.rowProperty] &&
218
+ row[subItems.getRowProperty()] &&
219
219
  subItemsPivots.includes(row.id)
220
220
  ) {
221
- return [...acc, row, ...row[subItems.rowProperty]];
221
+ return [...acc, row, ...row[subItems.getRowProperty()]];
222
222
  }
223
223
 
224
224
  return [...acc, row];
@@ -454,7 +454,7 @@ const Listing = <TRow extends { id: RowId }>({
454
454
  reduce<TRow | number, Array<string | number>>(
455
455
  (acc, row) => [
456
456
  ...acc,
457
- ...pluck('id', row[subItems?.rowProperty || ''] || [])
457
+ ...pluck('id', row[subItems?.getRowProperty() || ''] || [])
458
458
  ],
459
459
  [],
460
460
  rows
@@ -632,7 +632,9 @@ const Listing = <TRow extends { id: RowId }>({
632
632
  listingVariant={listingVariant}
633
633
  row={row}
634
634
  rowColorConditions={rowColorConditions}
635
- subItemsRowProperty={subItems?.rowProperty}
635
+ subItemsRowProperty={subItems?.getRowProperty(
636
+ row
637
+ )}
636
638
  />
637
639
  ))}
638
640
  </ListingRow>
@@ -49,13 +49,14 @@ const useStyles = makeStyles<{
49
49
  }
50
50
  },
51
51
  modalActions: {
52
- bottom: 0,
52
+ '&[data-fixed="true"]': {
53
+ position: 'fixed'
54
+ },
53
55
  bottom: theme.spacing(2),
54
56
  display: 'flex',
55
57
  flexDirection: 'row',
56
58
  gap: theme.spacing(2),
57
59
  justifyContent: 'flex-end',
58
- position: 'fixed',
59
60
  right: theme.spacing(2)
60
61
  },
61
62
  modalBody: {
@@ -8,6 +8,7 @@ export type ModalActionsProps = {
8
8
  children?: React.ReactNode;
9
9
  disabled?: boolean;
10
10
  isDanger?: boolean;
11
+ isFixed?: boolean;
11
12
  labels?: ModalActionsLabels;
12
13
  onCancel?: () => void;
13
14
  onConfirm?: () => void;
@@ -24,12 +25,13 @@ const ModalActions = ({
24
25
  onCancel,
25
26
  onConfirm,
26
27
  isDanger = false,
27
- disabled
28
+ disabled,
29
+ isFixed
28
30
  }: ModalActionsProps): ReactElement => {
29
31
  const { classes } = useStyles();
30
32
 
31
33
  return (
32
- <div className={classes.modalActions}>
34
+ <div className={classes.modalActions} data-fixed={isFixed}>
33
35
  {children || (
34
36
  <>
35
37
  <Button