@centreon/ui 23.10.58 → 23.10.60

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": "23.10.58",
3
+ "version": "23.10.60",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -73,15 +73,13 @@ describe('Multi connected autocomplete', () => {
73
73
  });
74
74
  });
75
75
 
76
- cy.matchImageSnapshot(
77
- 'displays the list when the user clicks on the input'
78
- );
76
+ cy.makeSnapshot('displays the list when the user clicks on the input');
79
77
 
80
78
  cy.get('@input').click();
81
79
 
82
80
  cy.get('@listOptions').should('not.exist');
83
81
 
84
- cy.matchImageSnapshot('hides the list when the user clicks on the input');
82
+ cy.makeSnapshot('hides the list when the user clicks on the input');
85
83
  });
86
84
 
87
85
  it('displays exactly one option on the list when the user types that option', () => {
@@ -109,7 +107,7 @@ describe('Multi connected autocomplete', () => {
109
107
  cy.contains(optionOne).should('be.visible');
110
108
  });
111
109
 
112
- cy.matchImageSnapshot();
110
+ cy.makeSnapshot();
113
111
  });
114
112
 
115
113
  it('displays all options on the list when the user searches for and selects an option', () => {
@@ -156,6 +154,6 @@ describe('Multi connected autocomplete', () => {
156
154
  });
157
155
  });
158
156
 
159
- cy.matchImageSnapshot();
157
+ cy.makeSnapshot();
160
158
  });
161
159
  });
@@ -105,7 +105,7 @@ describe('Listing', () => {
105
105
  });
106
106
  });
107
107
 
108
- cy.matchImageSnapshot();
108
+ cy.makeSnapshot();
109
109
  });
110
110
 
111
111
  it('collapses the row when the corresponding icon si clicked', () => {
@@ -115,6 +115,6 @@ describe('Listing', () => {
115
115
 
116
116
  cy.contains('Sub item 100').should('not.exist');
117
117
 
118
- cy.matchImageSnapshot();
118
+ cy.makeSnapshot();
119
119
  });
120
120
  });
@@ -53,6 +53,7 @@ interface Props {
53
53
  error?: string;
54
54
  hasInitialTextContent?: boolean;
55
55
  initialEditorState?: string;
56
+ initialize?: (editor) => void;
56
57
  inputClassname?: string;
57
58
  minInputHeight: number;
58
59
  namespace: string;
@@ -77,7 +78,8 @@ const ContentEditable = ({
77
78
  error,
78
79
  onBlur,
79
80
  className,
80
- disabled
81
+ disabled,
82
+ initialize
81
83
  }: Props): JSX.Element => {
82
84
  const { classes, cx } = useStyles({ editable, error, minInputHeight });
83
85
  const { t } = useTranslation();
@@ -147,6 +149,10 @@ const ContentEditable = ({
147
149
  editor.setEditable(!disabled);
148
150
  }, [disabled]);
149
151
 
152
+ useEffect(() => {
153
+ initialize?.(editor);
154
+ }, []);
155
+
150
156
  return (
151
157
  <div
152
158
  className={cx(
@@ -7,7 +7,7 @@ import { HeadingNode } from '@lexical/rich-text';
7
7
  import { ListItemNode, ListNode } from '@lexical/list';
8
8
  import anylogger from 'anylogger';
9
9
  import { makeStyles } from 'tss-react/mui';
10
- import { EditorState } from 'lexical';
10
+ import { EditorState, LexicalEditor } from 'lexical';
11
11
  import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
12
12
  import { equals } from 'ramda';
13
13
  import { ListPlugin } from '@lexical/react/LexicalListPlugin';
@@ -27,8 +27,9 @@ export interface RichTextEditorProps {
27
27
  editable: boolean;
28
28
  editorState?: string;
29
29
  error?: string;
30
- getEditorState?: (editorState: EditorState) => void;
30
+ getEditorState?: (editorState: EditorState, editor: LexicalEditor) => void;
31
31
  initialEditorState?: string;
32
+ initialize?: (editor) => void;
32
33
  inputClassname?: string;
33
34
  minInputHeight?: number;
34
35
  namespace?: string;
@@ -132,7 +133,8 @@ const RichTextEditor = ({
132
133
  contentClassName,
133
134
  displayMacrosButton = false,
134
135
  disabled,
135
- openLinkInNewTab = true
136
+ openLinkInNewTab = true,
137
+ initialize
136
138
  }: RichTextEditorProps): JSX.Element => {
137
139
  const { classes } = useStyles({ toolbarPositions });
138
140
 
@@ -188,6 +190,7 @@ const RichTextEditor = ({
188
190
  error={error}
189
191
  hasInitialTextContent={hasInitialTextContent}
190
192
  initialEditorState={initialEditorState}
193
+ initialize={initialize}
191
194
  inputClassname={inputClassname}
192
195
  minInputHeight={minInputHeight}
193
196
  namespace={namespace}
@@ -59,7 +59,7 @@ data.forEach((item) =>
59
59
  });
60
60
 
61
61
  it(`displays correctly the dates design when screen resolution is ${width}px`, () => {
62
- cy.matchImageSnapshot(`${width}px`);
62
+ cy.makeSnapshot(`${width}px`);
63
63
  });
64
64
  })
65
65
  );
@@ -499,7 +499,7 @@ testData.forEach((item) =>
499
499
  getNextMonth({ currentMonth, labelButton: item.button });
500
500
  }
501
501
 
502
- cy.matchImageSnapshot(
502
+ cy.makeSnapshot(
503
503
  `calendar-${item.timezone}-${
504
504
  Object.keys(element)[0]
505
505
  }-when-clicking-on-${item.button}`
@@ -132,6 +132,6 @@ describe('License', () => {
132
132
 
133
133
  cy.findByText(labelLicenseWarning('centreon-autodiscovery-server', 10));
134
134
 
135
- cy.matchImageSnapshot();
135
+ cy.makeSnapshot();
136
136
  });
137
137
  });