@centreon/ui 26.5.2 → 26.5.4

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": "26.5.2",
3
+ "version": "26.5.4",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -54,6 +54,7 @@
54
54
  "test/*"
55
55
  ],
56
56
  "devDependencies": {
57
+ "@biomejs/biome": "2.3.11",
57
58
  "@cypress/react": "^9.0.0",
58
59
  "@cypress/webpack-dev-server": "^4.0.1",
59
60
  "@faker-js/faker": "^9.5.1",
@@ -347,11 +347,11 @@ const ConnectedAutocompleteField = (
347
347
  }, [...useDeepCompare([searchConditions])]);
348
348
 
349
349
  useEffect(() => {
350
- if (!autocompleteChangedValue && !props?.value) {
350
+ if (!autocompleteChangedValue) {
351
351
  return;
352
352
  }
353
353
  setSearchParameter(undefined);
354
- }, [autocompleteChangedValue, props?.value]);
354
+ }, [autocompleteChangedValue]);
355
355
 
356
356
  useEffect(() => {
357
357
  if (!optionsOpen) {
@@ -39,7 +39,8 @@ const ListboxComponent = ({
39
39
  options,
40
40
  isOptionSelected,
41
41
  onChange,
42
- total
42
+ total,
43
+ value = []
43
44
  }) => {
44
45
  const { t } = useTranslation();
45
46
 
@@ -55,12 +56,19 @@ const ListboxComponent = ({
55
56
  const syntheticEvent = {} as React.SyntheticEvent;
56
57
 
57
58
  if (allSelected) {
58
- onChange?.(syntheticEvent, [], 'selectOption');
59
+ const remaining = value.filter(
60
+ (v) => !options.some((opt) => opt.id === v.id)
61
+ );
62
+ onChange?.(syntheticEvent, remaining, 'selectOption');
59
63
 
60
64
  return;
61
65
  }
62
66
 
63
- onChange?.(syntheticEvent, options, 'selectOption');
67
+ const merged = [
68
+ ...value,
69
+ ...options.filter((opt) => !isOptionSelected(opt))
70
+ ];
71
+ onChange?.(syntheticEvent, merged, 'selectOption');
64
72
  };
65
73
 
66
74
  return (
@@ -97,7 +97,8 @@ const MultiAutocompleteField = ({
97
97
  isOptionSelected,
98
98
  onChange,
99
99
  options,
100
- total
100
+ total,
101
+ value: values
101
102
  })}
102
103
  multiple
103
104
  onChange={onChange}