refactor: Autocomplete component
Closes #1707 (closed), Closes #1506 (closed)
In this refactoring the following props are changed:
-
ols
is renamed toexternalSources
-
optionsClass
is renamed toincludeClasses
and changed the type to an array instead of a string. -
cssClasses
is removed and replaced withsize
that can take only the valuesm
for the moment. -
autoLoadOption
is not implimented, the autocomplete now always trigger the functionloadOptions
-
handleCreateExistingLabel
is removed, you can passisValidNewOption
as in react-select documented. - The props
onItemSelected
andonNewItemSelected
are removed and you have to always useonChange
because it insures the importing of external data when used. -
onInput
is removed and you can useonInputChange
as in react-select documented.
For the typing, now all options are typed with OptionType
but there is still some typing difficulties while passing the onChange
props
with takes the parameters forced by react-select
.
onChange: (newValue: MultiValue<OptionType> | SingleValue<OptionType>, { action }: ActionMeta<OptionType>) => void
The following points from the issue are covered:
- Move logic to API (ontology selection)
- Clear on blur
- Spreading props
- Default value (to some extend)
the component takes
defaultValueId
pros which can be the id of the entity but the value props should not be used (this can be improved) - Range restriction of literal values this can be incorporated in future once we have a use case.
Edited by Kheir Eddine