@centreon/ui 23.10.111 → 24.4.1-MON-add-chromatic-nightly.0

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 (49) hide show
  1. package/package.json +14 -12
  2. package/src/Button/Save/StartIcon.tsx +3 -3
  3. package/src/Dashboard/Item.tsx +1 -1
  4. package/src/FileDropZone/index.tsx +3 -1
  5. package/src/Form/Inputs/CheckboxGroup.tsx +1 -4
  6. package/src/Form/Inputs/index.tsx +1 -1
  7. package/src/Graph/Gauge/Gauge.stories.tsx +15 -1
  8. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +5 -4
  9. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +1 -1
  10. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +2 -3
  11. package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
  12. package/src/Graph/LineChart/Legend/useLegend.ts +5 -5
  13. package/src/Graph/LineChart/helpers/doc.ts +16 -13
  14. package/src/Graph/LineChart/helpers/index.ts +1 -1
  15. package/src/Graph/LineChart/index.stories.tsx +1 -2
  16. package/src/Graph/Text/Text.stories.tsx +60 -4
  17. package/src/Graph/common/timeSeries/index.ts +3 -3
  18. package/src/InputField/Select/Autocomplete/Connected/index.tsx +10 -7
  19. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
  20. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
  21. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
  22. package/src/InputField/Select/IconPopover/index.tsx +2 -2
  23. package/src/InputField/Select/index.tsx +1 -1
  24. package/src/Listing/Header/ListingHeader.tsx +1 -1
  25. package/src/Listing/index.stories.tsx +12 -1
  26. package/src/Listing/index.tsx +1 -1
  27. package/src/RichTextEditor/RichTextEditor.tsx +11 -1
  28. package/src/SortableItems/index.tsx +2 -7
  29. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +8 -3
  30. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
  31. package/src/TimePeriods/DateTimePickerInput.tsx +45 -17
  32. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
  33. package/src/TimePeriods/helpers/index.ts +1 -1
  34. package/src/api/QueryProvider.tsx +1 -1
  35. package/src/api/TestQueryProvider.tsx +1 -1
  36. package/src/api/useFetchQuery/index.ts +28 -24
  37. package/src/api/useMutationQuery/index.ts +39 -17
  38. package/src/components/DataTable/Item/DataTableItem.tsx +2 -2
  39. package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +2 -0
  40. package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +1 -1
  41. package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
  42. package/src/index.ts +1 -0
  43. package/src/queryParameters/url/index.ts +5 -1
  44. package/src/utils/index.ts +0 -1
  45. package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
  46. package/src/utils/useLicenseExpirationWarning.ts +18 -18
  47. package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
  48. package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
  49. package/src/utils/useDateTimePickerAdapter.ts +0 -309
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "23.10.111",
3
+ "version": "24.4.1-MON-add-chromatic-nightly.0",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -73,13 +73,13 @@
73
73
  "@testing-library/react-hooks": "^8.0.1",
74
74
  "@types/cypress": "^1.1.3",
75
75
  "@types/jest": "^27.5.0",
76
- "@types/ramda": "^0.28.12",
76
+ "@types/ramda": "^0.29.6",
77
77
  "@types/react": "^18.0.26",
78
78
  "@types/testing-library__jest-dom": "^5.14.6",
79
79
  "@vitejs/plugin-react": "^4.0.0",
80
80
  "@vitejs/plugin-react-swc": "^3.3.0",
81
81
  "axios-mock-adapter": "^1.21.4",
82
- "cypress": "^12.8.0",
82
+ "cypress": "^13.3.1",
83
83
  "identity-obj-proxy": "^3.0.0",
84
84
  "jest-transform-stub": "^2.0.0",
85
85
  "mochawesome": "^7.1.3",
@@ -101,12 +101,13 @@
101
101
  "vite-plugin-turbosnap": "^1.0.2"
102
102
  },
103
103
  "dependencies": {
104
- "@lexical/link": "0.11.3",
105
- "@lexical/list": "^0.11.3",
106
- "@lexical/react": "0.11.3",
107
- "@lexical/rich-text": "^0.11.3",
108
- "@lexical/selection": "0.11.3",
109
- "@lexical/utils": "0.11.3",
104
+ "@lexical/html": "^0.12.2",
105
+ "@lexical/link": "^0.12.2",
106
+ "@lexical/list": "^0.12.2",
107
+ "@lexical/react": "^0.12.2",
108
+ "@lexical/rich-text": "^0.12.2",
109
+ "@lexical/selection": "^0.12.2",
110
+ "@lexical/utils": "^0.12.2",
110
111
  "@react-spring/web": "^9.7.3",
111
112
  "@visx/curve": "^2.1.0",
112
113
  "@visx/group": "^3.3.0",
@@ -118,8 +119,9 @@
118
119
  "anylogger": "^1.0.11",
119
120
  "d3-array": "3.2.0",
120
121
  "humanize-duration": "^3.27.3",
121
- "lexical": "0.11.3",
122
- "notistack": "^2.0.8",
122
+ "lexical": "^0.12.2",
123
+ "notistack": "^3.0.1",
124
+ "ramda": "0.29.1",
123
125
  "react-grid-layout": "^1.3.4",
124
126
  "react-html-parser": "^2.0.2",
125
127
  "react-resizable": "^3.0.5",
@@ -135,7 +137,7 @@
135
137
  "@mui/icons-material": "5.x",
136
138
  "@mui/material": "5.x",
137
139
  "@mui/styles": "5.x",
138
- "@tanstack/react-query": "4.x",
140
+ "@tanstack/react-query": "5.x",
139
141
  "axios": "0.x",
140
142
  "dayjs": "1.x",
141
143
  "formik": "2.x",
@@ -15,9 +15,9 @@ interface Props {
15
15
 
16
16
  const StartIcon = ({ startIconConfig }: Props): JSX.Element | null =>
17
17
  cond<Array<StartIconConfigProps>, JSX.Element | null>([
18
- [pipe(propEq('hasLabel', true), not), always(null)],
19
- [propEq('succeeded', true), always(<CheckIcon />)],
20
- [propEq('loading', true), always(<SaveIcon />)],
18
+ [pipe(propEq(true, 'hasLabel'), not), always(null)],
19
+ [propEq(true, 'succeeded'), always(<CheckIcon />)],
20
+ [propEq(true, 'loading'), always(<SaveIcon />)],
21
21
  [T, always(<SaveIcon />)]
22
22
  ])(startIconConfig);
23
23
 
@@ -27,7 +27,7 @@ interface DashboardItemProps {
27
27
  style?: CSSProperties;
28
28
  }
29
29
 
30
- const Item = forwardRef(
30
+ const Item = forwardRef<HTMLDivElement, DashboardItemProps>(
31
31
  (
32
32
  {
33
33
  children,
@@ -98,7 +98,9 @@ const getExtensions = cond([
98
98
  [T, identity]
99
99
  ]) as (accept: string) => Array<string>;
100
100
 
101
- export const transformFileListToArray = (files: FileList | null): Array<File> =>
101
+ export const transformFileListToArray = (
102
+ files: FileList | null
103
+ ): Array<File> =>
102
104
  isNil(files)
103
105
  ? []
104
106
  : (Array(files.length)
@@ -46,10 +46,7 @@ const CheckboxGroup = ({
46
46
  return;
47
47
  }
48
48
 
49
- setFieldValue(
50
- fieldName,
51
- value?.filter((elm) => !equals(elm, label))
52
- );
49
+ setFieldValue(fieldName, value?.filter((elm) => !equals(elm, label)));
53
50
  };
54
51
 
55
52
  return useMemoComponent({
@@ -185,7 +185,7 @@ const Inputs = ({
185
185
  const hasGroupTitle = R.not(R.isNil(groupName));
186
186
 
187
187
  const groupProps = hasGroupTitle
188
- ? R.find(R.propEq('name', groupName), groups)
188
+ ? R.find(R.propEq(groupName, 'name'), groups)
189
189
  : ({} as Group);
190
190
 
191
191
  const isFirstElement = areGroupsOpen || R.equals(index, 0);
@@ -140,7 +140,21 @@ export const RawValue: Story = {
140
140
  data: dataLastWeek,
141
141
  displayAsRaw: true,
142
142
  thresholdTooltipLabels: ['Warning', 'Critical'],
143
- thresholds: [0.5, 0.6]
143
+ thresholds: {
144
+ critical: [
145
+ {
146
+ label: 'Critical',
147
+ value: 0.6
148
+ }
149
+ ],
150
+ enabled: true,
151
+ warning: [
152
+ {
153
+ label: 'Warning',
154
+ value: 0.5
155
+ }
156
+ ]
157
+ }
144
158
  },
145
159
  render: Template
146
160
  };
@@ -130,10 +130,11 @@ const WrapperThresholdLines = ({
130
130
 
131
131
  return (
132
132
  <g>
133
- {filteredThresholdLines.map((element) =>
134
- element?.map(({ Component, props, key }) => (
135
- <Component {...props} id={key} key={key} />
136
- ))
133
+ {filteredThresholdLines.map(
134
+ (element) =>
135
+ element?.map(({ Component, props, key }) => (
136
+ <Component {...props} id={key} key={key} />
137
+ ))
137
138
  )}
138
139
  </g>
139
140
  );
@@ -28,7 +28,7 @@ const useFilterLines = ({
28
28
  linesGraph,
29
29
  setLinesGraph
30
30
  }: UseFilterLines): Result => {
31
- const displayedLines = reject(propEq('display', false), linesGraph ?? lines);
31
+ const displayedLines = reject(propEq(false, 'display'), linesGraph ?? lines);
32
32
  const filterLines = (): Array<Line> => {
33
33
  const lineOriginMetric = findLineOfOriginMetricThreshold(lines);
34
34
 
@@ -43,9 +43,8 @@ const Annotation = ({
43
43
 
44
44
  const setAnnotationHovered = useSetAtom(annotationHoveredAtom);
45
45
 
46
- const content = `${truncate(event.content)} (${t(labelBy)} ${
47
- event.contact?.name
48
- })`;
46
+ const content = `${truncate(event.content)} (${t(labelBy)} ${event.contact
47
+ ?.name})`;
49
48
 
50
49
  return (
51
50
  <g>
@@ -26,7 +26,7 @@ const EventAnnotations = ({
26
26
  color,
27
27
  annotationHoveredId
28
28
  }: Props): JSX.Element => {
29
- const events = filter(propEq('type', type), data);
29
+ const events = filter(propEq(type, 'type'), data);
30
30
 
31
31
  return (
32
32
  <>
@@ -27,15 +27,15 @@ interface Props {
27
27
  }
28
28
 
29
29
  const useLegend = ({ lines, setLinesGraph }: Props): LegendActions => {
30
- const displayedLines = reject(propEq('display', false), lines);
30
+ const displayedLines = reject(propEq(false, 'display'), lines);
31
31
  const getLineByMetric = (metric_id: number): Line =>
32
- find(propEq('metric_id', metric_id), lines) as Line;
32
+ find(propEq(metric_id, 'metric_id'), lines) as Line;
33
33
 
34
34
  const toggleMetricLine = (metric_id): void => {
35
35
  const line = getLineByMetric(metric_id);
36
36
 
37
37
  setLinesGraph([
38
- ...reject(propEq('metric_id', metric_id), lines),
38
+ ...reject(propEq(metric_id, 'metric_id'), lines),
39
39
  { ...line, display: !line.display }
40
40
  ]);
41
41
  };
@@ -43,7 +43,7 @@ const useLegend = ({ lines, setLinesGraph }: Props): LegendActions => {
43
43
  const highlightLine = (metric_id): void => {
44
44
  const fadedLines = map((line) => ({ ...line, highlight: false }), lines);
45
45
  const data = [
46
- ...reject(propEq('metric_id', metric_id), fadedLines),
46
+ ...reject(propEq(metric_id, 'metric_id'), fadedLines),
47
47
  { ...getLineByMetric(metric_id), highlight: true }
48
48
  ];
49
49
 
@@ -93,7 +93,7 @@ const useLegend = ({ lines, setLinesGraph }: Props): LegendActions => {
93
93
 
94
94
  const newLines = lines.map((line) => ({
95
95
  ...line,
96
- display: find(propEq('metric_id', line.metric_id), lines)?.display ?? true
96
+ display: find(propEq(line.metric_id, 'metric_id'), lines)?.display ?? true
97
97
  }));
98
98
 
99
99
  setLinesGraph(newLines);
@@ -69,21 +69,24 @@ export const getDescription = ({ sections }: Description): string => {
69
69
  })}<br></details>`;
70
70
  }
71
71
 
72
- const formattedProps = props.reduce((accumulator, currentValue, index) => {
73
- const key = Object.keys(currentValue)[0];
74
- const { description, type } = currentValue[key];
75
- const body = `${accumulator} ${getBodyDescription({
76
- description,
77
- key,
78
- type
79
- })}`;
72
+ const formattedProps = props.reduce(
73
+ (accumulator, currentValue, index) => {
74
+ const key = Object.keys(currentValue)[0];
75
+ const { description, type } = currentValue[key];
76
+ const body = `${accumulator} ${getBodyDescription({
77
+ description,
78
+ key,
79
+ type
80
+ })}`;
80
81
 
81
- if (!equals(index, props.length - 1)) {
82
- return body;
83
- }
82
+ if (!equals(index, props.length - 1)) {
83
+ return body;
84
+ }
84
85
 
85
- return `${body}</details>`;
86
- }, getInitialValue({ section: name, type: item?.type }));
86
+ return `${body}</details>`;
87
+ },
88
+ getInitialValue({ section: name, type: item?.type })
89
+ );
87
90
 
88
91
  return formattedProps as string;
89
92
  });
@@ -14,7 +14,7 @@ import { LineChartData } from '../../common/models';
14
14
  export const adjustGraphData = (graphData: LineChartData): LinesData => {
15
15
  const lines = getLineData(graphData);
16
16
  const sortedLines = sortBy(prop('name'), lines);
17
- const displayedLines = reject(propEq('display', false), sortedLines);
17
+ const displayedLines = reject(propEq(false, 'display'), sortedLines);
18
18
 
19
19
  const timeSeries = getTimeSeries(graphData);
20
20
 
@@ -39,8 +39,7 @@ import { Interval, ThresholdType, TooltipData } from './models';
39
39
  import WrapperLineChart from './index';
40
40
 
41
41
  const meta: Meta<typeof WrapperLineChart> = {
42
- component: WrapperLineChart,
43
- tags: ['autodocs']
42
+ component: WrapperLineChart
44
43
  };
45
44
  export default meta;
46
45
 
@@ -24,7 +24,21 @@ export const success: Story = {
24
24
  critical: 'Critical',
25
25
  warning: 'Warning'
26
26
  },
27
- thresholds: [0.5, 1.5]
27
+ thresholds: {
28
+ critical: [
29
+ {
30
+ label: 'Critical',
31
+ value: 1.5
32
+ }
33
+ ],
34
+ enabled: true,
35
+ warning: [
36
+ {
37
+ label: 'Warning',
38
+ value: 0.5
39
+ }
40
+ ]
41
+ }
28
42
  },
29
43
  render: Template
30
44
  };
@@ -36,7 +50,21 @@ export const warning: Story = {
36
50
  critical: 'Critical',
37
51
  warning: 'Warning'
38
52
  },
39
- thresholds: [0.2, 0.5]
53
+ thresholds: {
54
+ critical: [
55
+ {
56
+ label: 'Critical',
57
+ value: 1.5
58
+ }
59
+ ],
60
+ enabled: true,
61
+ warning: [
62
+ {
63
+ label: 'Warning',
64
+ value: 0.4
65
+ }
66
+ ]
67
+ }
40
68
  },
41
69
  render: Template
42
70
  };
@@ -48,7 +76,21 @@ export const critical: Story = {
48
76
  critical: 'Critical',
49
77
  warning: 'Warning'
50
78
  },
51
- thresholds: [0.13, 0.35]
79
+ thresholds: {
80
+ critical: [
81
+ {
82
+ label: 'Critical',
83
+ value: 0.3
84
+ }
85
+ ],
86
+ enabled: true,
87
+ warning: [
88
+ {
89
+ label: 'Warning',
90
+ value: 0.2
91
+ }
92
+ ]
93
+ }
52
94
  },
53
95
  render: Template
54
96
  };
@@ -61,7 +103,21 @@ export const rawValue: Story = {
61
103
  critical: 'Critical',
62
104
  warning: 'Warning'
63
105
  },
64
- thresholds: [0.5, 1.5]
106
+ thresholds: {
107
+ critical: [
108
+ {
109
+ label: 'Critical',
110
+ value: 1.5
111
+ }
112
+ ],
113
+ enabled: true,
114
+ warning: [
115
+ {
116
+ label: 'Warning',
117
+ value: 0.5
118
+ }
119
+ ]
120
+ }
65
121
  },
66
122
  render: Template
67
123
  };
@@ -179,7 +179,7 @@ const getMetricValuesForUnit = ({
179
179
  ) as Array<number>;
180
180
 
181
181
  return pipe(
182
- filter(propEq('unit', unit)) as (line) => Array<Line>,
182
+ filter(propEq(unit, 'unit')) as (line) => Array<Line>,
183
183
  map(prop('metric_id')),
184
184
  map(getTimeSeriesValuesForMetric),
185
185
  flatten,
@@ -203,7 +203,7 @@ const getLineForMetric = ({
203
203
  lines,
204
204
  metric_id
205
205
  }: LineForMetricProps): Line | undefined =>
206
- find(propEq('metric_id', metric_id), lines);
206
+ find(propEq(metric_id, 'metric_id'), lines);
207
207
 
208
208
  interface LinesTimeSeries {
209
209
  lines: Array<Line>;
@@ -275,7 +275,7 @@ interface HasStackedLines {
275
275
  }
276
276
 
277
277
  const hasUnitStackedLines = ({ lines, unit }: HasStackedLines): boolean =>
278
- pipe(getSortedStackedLines, any(propEq('unit', unit)))(lines);
278
+ pipe(getSortedStackedLines, any(propEq(unit, 'unit')))(lines);
279
279
 
280
280
  const getTimeSeriesForLines = ({
281
281
  lines,
@@ -280,13 +280,16 @@ const ConnectedAutocompleteField = (
280
280
  }
281
281
  }, [optionsOpen]);
282
282
 
283
- useEffect(() => {
284
- setSearchParameter(
285
- !isEmpty(searchConditions)
286
- ? { conditions: searchConditions }
287
- : undefined
288
- );
289
- }, useDeepCompare([searchConditions]));
283
+ useEffect(
284
+ () => {
285
+ setSearchParameter(
286
+ !isEmpty(searchConditions)
287
+ ? { conditions: searchConditions }
288
+ : undefined
289
+ );
290
+ },
291
+ useDeepCompare([searchConditions])
292
+ );
290
293
 
291
294
  useEffect(() => {
292
295
  if (!autocompleteChangedValue && !props?.value) {
@@ -49,7 +49,7 @@ const SortableList = ({
49
49
  const dragEnd = ({ items: newItems }): void =>
50
50
  changeItemsOrder(
51
51
  map(
52
- (item) => find(propEq('id', item), items),
52
+ (item) => find(propEq(item, 'id'), items),
53
53
  newItems
54
54
  ) as Array<DraggableSelectEntry>
55
55
  );
@@ -49,7 +49,7 @@ const SortableListContent = ({
49
49
  return;
50
50
  }
51
51
 
52
- const itemIndex = findIndex(propEq('id', id), items);
52
+ const itemIndex = findIndex(propEq(id, 'id'), items);
53
53
 
54
54
  itemHover?.(null);
55
55
  itemClick?.({ index: itemIndex, item: { createOption, id, name } });
@@ -77,7 +77,7 @@ const DraggableAutocomplete = (
77
77
  const deleteValue = (id): void => {
78
78
  itemHover?.(null);
79
79
  setSelectedValues((values: Array<DraggableSelectEntry>) => {
80
- const index = findIndex(propEq('id', id), values);
80
+ const index = findIndex(propEq(id, 'id'), values);
81
81
 
82
82
  const newSelectedValues = remove(index, 1, values);
83
83
 
@@ -73,14 +73,14 @@ const IconPopoverMultiAutocomplete = ({
73
73
  };
74
74
 
75
75
  const isSelected = (id: number | string): boolean => {
76
- return pipe(find(propEq('id', id)), Boolean)(value);
76
+ return pipe(find(propEq(id, 'id')), Boolean)(value);
77
77
  };
78
78
 
79
79
  const unSelect = (option: SelectEntry): void => {
80
80
  const { id } = option;
81
81
 
82
82
  const updatedValue = isSelected(id)
83
- ? reject(propEq('id', id), value)
83
+ ? reject(propEq(id, 'id'), value)
84
84
  : [...value, option];
85
85
 
86
86
  onChange(updatedValue);
@@ -69,7 +69,7 @@ const SelectField = ({
69
69
  const { classes, cx } = useStyles();
70
70
 
71
71
  const getOption = (id): SelectEntry => {
72
- return options.find(propEq('id', id)) as SelectEntry;
72
+ return options.find(propEq(id, 'id')) as SelectEntry;
73
73
  };
74
74
 
75
75
  const changeOption = (event): void => {
@@ -71,7 +71,7 @@ const ListingHeader = ({
71
71
  });
72
72
 
73
73
  const getColumnById = (id: string): Column => {
74
- return find(propEq('id', id), columns) as Column;
74
+ return find(propEq(id, 'id'), columns) as Column;
75
75
  };
76
76
 
77
77
  const Content = React.useCallback(
@@ -366,6 +366,16 @@ const columnsWithSubItems = [
366
366
  }
367
367
  ];
368
368
 
369
+ const TemplateSubItems = (args): JSX.Element => {
370
+ const { classes } = useStyles();
371
+
372
+ return (
373
+ <div className={classes.listing}>
374
+ <Listing {...args} />
375
+ </div>
376
+ );
377
+ };
378
+
369
379
  export const ListingWithSubItems = {
370
380
  args: {
371
381
  checkable: true,
@@ -382,5 +392,6 @@ export const ListingWithSubItems = {
382
392
  rowProperty: 'subItems'
383
393
  },
384
394
  totalRows: 10
385
- }
395
+ },
396
+ render: TemplateSubItems
386
397
  };
@@ -69,7 +69,7 @@ const getVisibleColumns = ({
69
69
  }
70
70
 
71
71
  return selectedColumnIds.map((id) =>
72
- columns.find(propEq('id', id))
72
+ columns.find(propEq(id, 'id'))
73
73
  ) as Array<Column>;
74
74
  };
75
75
 
@@ -12,6 +12,7 @@ import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
12
12
  import { equals } from 'ramda';
13
13
  import { ListPlugin } from '@lexical/react/LexicalListPlugin';
14
14
  import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
15
+ import { $generateHtmlFromNodes } from '@lexical/html';
15
16
 
16
17
  import { Typography } from '@mui/material';
17
18
 
@@ -38,6 +39,7 @@ export interface RichTextEditorProps {
38
39
  openLinkInNewTab?: boolean;
39
40
  placeholder?: string;
40
41
  resetEditorToInitialStateCondition?: () => boolean;
42
+ setHtmlString?: (htmlString: string) => void;
41
43
  toolbarClassName?: string;
42
44
  toolbarPositions?: 'start' | 'end';
43
45
  }
@@ -138,6 +140,7 @@ const RichTextEditor = ({
138
140
  openLinkInNewTab = true,
139
141
  initialize,
140
142
  displayBlockButtons = true,
143
+ setHtmlString,
141
144
  toolbarClassName
142
145
  }: RichTextEditorProps): JSX.Element => {
143
146
  const { classes } = useStyles({ toolbarPositions });
@@ -172,6 +175,13 @@ const RichTextEditor = ({
172
175
  }
173
176
  };
174
177
 
178
+ const change = (state: EditorState, editor: LexicalEditor): void => {
179
+ editor.update(() => {
180
+ setHtmlString?.($generateHtmlFromNodes(editor, null));
181
+ });
182
+ getEditorState?.(state, editor);
183
+ };
184
+
175
185
  return (
176
186
  <LexicalComposer initialConfig={initialConfig}>
177
187
  <div className={classes.container}>
@@ -212,7 +222,7 @@ const RichTextEditor = ({
212
222
  <HistoryPlugin />
213
223
  <LinkPlugin />
214
224
  <ListPlugin />
215
- <OnChangePlugin onChange={getEditorState} />
225
+ <OnChangePlugin onChange={change} />
216
226
  <AutoCompleteLinkPlugin openLinkInNewTab={openLinkInNewTab} />
217
227
  <FloatingLinkEditorPlugin
218
228
  editable={editable}
@@ -15,11 +15,7 @@ import {
15
15
  DragEndEvent,
16
16
  Over
17
17
  } from '@dnd-kit/core';
18
- import {
19
- SortableContext,
20
- sortableKeyboardCoordinates,
21
- SortingStrategy
22
- } from '@dnd-kit/sortable';
18
+ import { SortableContext, SortingStrategy } from '@dnd-kit/sortable';
23
19
  import {
24
20
  equals,
25
21
  find,
@@ -117,7 +113,6 @@ const SortableItems = <T extends { [propertyToFilterItemsOn]: string }>({
117
113
  useSensor(MouseSensor),
118
114
  useSensor(PointerSensor),
119
115
  useSensor(KeyboardSensor, {
120
- coordinateGetter: sortableKeyboardCoordinates,
121
116
  keyboardCodes: {
122
117
  cancel: ['Escape'],
123
118
  end: ['Space', 'Enter'],
@@ -169,7 +164,7 @@ const SortableItems = <T extends { [propertyToFilterItemsOn]: string }>({
169
164
  };
170
165
 
171
166
  const getItemById = (id): T | undefined =>
172
- find(propEq(propertyToFilterItemsOn, id), items);
167
+ find(propEq(id, propertyToFilterItemsOn), items);
173
168
 
174
169
  const activeItem = getItemById(activeId) as Record<string, unknown>;
175
170
 
@@ -2,12 +2,15 @@ import { useAtomValue } from 'jotai';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
  import { equals } from 'ramda';
4
4
  import { useTranslation } from 'react-i18next';
5
+ import dayjs from 'dayjs';
6
+ import utc from 'dayjs/plugin/utc';
7
+ import timezone from 'dayjs/plugin/timezone';
5
8
 
9
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
6
10
  import { Typography } from '@mui/material';
7
11
  import { LocalizationProvider } from '@mui/x-date-pickers';
8
12
 
9
13
  import { userAtom } from '@centreon/ui-context';
10
- import { useDateTimePickerAdapter } from '@centreon/ui';
11
14
 
12
15
  import DateTimePickerInput from '../../DateTimePickerInput';
13
16
  import {
@@ -20,6 +23,9 @@ import ErrorText from './ErrorText';
20
23
  import { PickersData, PickersStartEndDateDirection } from './models';
21
24
  import { PickersStartEndDateModel } from './usePickersStartEndDate';
22
25
 
26
+ dayjs.extend(utc);
27
+ dayjs.extend(timezone);
28
+
23
29
  const useStyles = makeStyles()((theme) => ({
24
30
  error: {
25
31
  textAlign: 'center'
@@ -104,7 +110,6 @@ const PickersStartEndDate = ({
104
110
  direction = PickersStartEndDateDirection.column
105
111
  }: Props): JSX.Element => {
106
112
  const { classes, cx } = useStyles();
107
- const { Adapter } = useDateTimePickerAdapter();
108
113
 
109
114
  const { locale } = useAtomValue(userAtom);
110
115
  const error = useAtomValue(errorTimePeriodAtom);
@@ -126,7 +131,7 @@ const PickersStartEndDate = ({
126
131
  return (
127
132
  <LocalizationProvider
128
133
  adapterLocale={locale.substring(0, 2)}
129
- dateAdapter={Adapter}
134
+ dateAdapter={AdapterDayjs}
130
135
  >
131
136
  <div className={styleContainer}>
132
137
  <PickerDateWithLabel