fix(education): improve some settings to make champ education more reliable
This commit is contained in:
parent
fe37f1acfe
commit
91b398d039
4 changed files with 14 additions and 9 deletions
|
@ -10,6 +10,7 @@ class EditableChamp::AnnuaireEducationComponent < EditableChamp::EditableChampBa
|
||||||
selected_key: @champ.external_id,
|
selected_key: @champ.external_id,
|
||||||
items: @champ.selected_items,
|
items: @champ.selected_items,
|
||||||
loader: data_sources_data_source_education_path,
|
loader: data_sources_data_source_education_path,
|
||||||
minimum_input_length: 3)
|
debounce: 500,
|
||||||
|
minimum_input_length: 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -231,6 +231,7 @@ export function RemoteComboBox({
|
||||||
allowsCustomValue,
|
allowsCustomValue,
|
||||||
minimumInputLength,
|
minimumInputLength,
|
||||||
limit,
|
limit,
|
||||||
|
debounce,
|
||||||
formValue,
|
formValue,
|
||||||
name,
|
name,
|
||||||
form,
|
form,
|
||||||
|
@ -252,6 +253,7 @@ export function RemoteComboBox({
|
||||||
allowsCustomValue,
|
allowsCustomValue,
|
||||||
defaultItems,
|
defaultItems,
|
||||||
defaultSelectedKey,
|
defaultSelectedKey,
|
||||||
|
debounce,
|
||||||
load,
|
load,
|
||||||
onChange: (item) => {
|
onChange: (item) => {
|
||||||
onChange?.(item);
|
onChange?.(item);
|
||||||
|
|
|
@ -427,14 +427,15 @@ export const createLoader: (
|
||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
const [err, result] = s.validate(json, s.array(Item), { coerce: true });
|
const [err, items] = s.validate(json, s.array(Item), { coerce: true });
|
||||||
if (!err) {
|
if (!err) {
|
||||||
const items = matchSorter(result, filterText, {
|
if (items.length > limit) {
|
||||||
keys: ['label']
|
const filteredItems = matchSorter(items, filterText, {
|
||||||
});
|
keys: ['label']
|
||||||
return {
|
});
|
||||||
items: limit ? items.slice(0, limit) : items
|
return { items: filteredItems.slice(0, limit) };
|
||||||
};
|
}
|
||||||
|
return { items };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { items: [] };
|
return { items: [] };
|
||||||
|
|
|
@ -67,7 +67,8 @@ export const RemoteComboBoxProps = s.assign(
|
||||||
selectedKey: s.nullable(s.string()),
|
selectedKey: s.nullable(s.string()),
|
||||||
minimumInputLength: s.number(),
|
minimumInputLength: s.number(),
|
||||||
limit: s.number(),
|
limit: s.number(),
|
||||||
allowsCustomValue: s.boolean()
|
allowsCustomValue: s.boolean(),
|
||||||
|
debounce: s.number()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue