@centreon/ui 24.12.0 → 24.12.1
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
|
@@ -95,8 +95,8 @@ describe(SingleConnectedAutocompleteField, () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
await waitFor(() => {
|
|
98
|
-
expect(getFetchCall(2)).toEqual(
|
|
99
|
-
|
|
98
|
+
expect(decodeURIComponent(getFetchCall(2))).toEqual(
|
|
99
|
+
'endpoint?page=1&search={"$and":[{"$and":[{"host.name":{"$lk":"%My Option 2%"}}]}]}'
|
|
100
100
|
);
|
|
101
101
|
});
|
|
102
102
|
});
|
|
@@ -34,7 +34,7 @@ export interface ConnectedAutoCompleteFieldProps<TData> {
|
|
|
34
34
|
allowUniqOption?: boolean;
|
|
35
35
|
baseEndpoint?: string;
|
|
36
36
|
changeIdValue: (item: TData) => number | string;
|
|
37
|
-
|
|
37
|
+
exclusionOptionProperty?: keyof SelectEntry;
|
|
38
38
|
field: string;
|
|
39
39
|
getEndpoint: ({ search, page }) => string;
|
|
40
40
|
getRenderedOptionText: (option: TData) => string;
|
|
@@ -55,7 +55,7 @@ const ConnectedAutocompleteField = (
|
|
|
55
55
|
field,
|
|
56
56
|
labelKey,
|
|
57
57
|
open,
|
|
58
|
-
|
|
58
|
+
exclusionOptionProperty = 'id',
|
|
59
59
|
searchConditions = [],
|
|
60
60
|
getRenderedOptionText = (option): string => option.name?.toString(),
|
|
61
61
|
getRequestHeaders,
|
|
@@ -106,7 +106,7 @@ const ConnectedAutocompleteField = (
|
|
|
106
106
|
],
|
|
107
107
|
isPaginated: true,
|
|
108
108
|
queryOptions: {
|
|
109
|
-
|
|
109
|
+
gcTime: 0,
|
|
110
110
|
enabled: false,
|
|
111
111
|
staleTime: 0,
|
|
112
112
|
suspense: false
|
|
@@ -134,10 +134,11 @@ const ConnectedAutocompleteField = (
|
|
|
134
134
|
: [selectedValue];
|
|
135
135
|
|
|
136
136
|
return {
|
|
137
|
-
|
|
137
|
+
operator: '$and',
|
|
138
|
+
field,
|
|
138
139
|
values: {
|
|
139
140
|
$ni: map(
|
|
140
|
-
prop(
|
|
141
|
+
prop(exclusionOptionProperty),
|
|
141
142
|
selectedValues as Array<
|
|
142
143
|
Record<keyof SelectEntry, string | undefined>
|
|
143
144
|
>
|
|
@@ -154,6 +155,7 @@ const ConnectedAutocompleteField = (
|
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
return {
|
|
158
|
+
operator: '$and',
|
|
157
159
|
field,
|
|
158
160
|
values: {
|
|
159
161
|
$lk: `%${searchedValue}%`
|
|
@@ -322,12 +324,13 @@ const ConnectedAutocompleteField = (
|
|
|
322
324
|
<AutocompleteField
|
|
323
325
|
filterOptions={(opt): SelectEntry => opt}
|
|
324
326
|
loading={isFetching}
|
|
325
|
-
open={optionsOpen}
|
|
326
327
|
options={
|
|
327
328
|
allowUniqOption ? uniqBy(getRenderedOptionText, options) : options
|
|
328
329
|
}
|
|
329
330
|
renderOption={renderOptions}
|
|
330
|
-
onChange={(_, value) =>
|
|
331
|
+
onChange={(_, value) => {
|
|
332
|
+
setAutocompleteChangedValue(value);
|
|
333
|
+
}}
|
|
331
334
|
onClose={(): void => setOptionsOpen(false)}
|
|
332
335
|
onOpen={(): void => setOptionsOpen(true)}
|
|
333
336
|
onTextChange={changeText}
|
|
@@ -93,8 +93,14 @@ const getConditionsSearchQueryParameterValue = (
|
|
|
93
93
|
equals(listField, field)
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
const globalOperator = filteredItems.every(({ operator }) =>
|
|
97
|
+
equals(operator, filteredItems[0].operator)
|
|
98
|
+
)
|
|
99
|
+
? filteredItems[0].operator || '$or'
|
|
100
|
+
: '$or';
|
|
101
|
+
|
|
96
102
|
return {
|
|
97
|
-
|
|
103
|
+
[globalOperator]: flatten(
|
|
98
104
|
filteredItems.map(({ value, values }) => {
|
|
99
105
|
if (!isNil(value)) {
|
|
100
106
|
return [
|