The WikibaseWbui2025EditableSnakValue component currently has different input elements depending on the value type:
<cdx-text-input v-if="!valueStrategy.isLookupDatatype() && snakTypeSelection === 'value'" v-model="textvalue"></cdx-text-input> <cdx-lookup v-else-if="valueStrategy.isLookupDatatype()" v-model:selected="lookupSelection" v-model:input-value="lookupInputValue" :menu-items="lookupMenuItems" :menu-config="menuConfig" @update:input-value="onUpdateInputValue" @load-more="onLoadMore" > </cdx-lookup>
The <v-if>/<v-else-if>/<v-else> pattern is not especially maintainable or extensible, and leads to the view becoming busy with logic for all the different types of inputs, without it being clear what logic applies for which snak types.
Extend the valueStrategy pattern to inject the appropriate input element for the current data type, moving associated state management logic to subcomponents (e.g. SnakTextInput, SnakLookupInput).
Acceptance Criteria
- WikibaseWbui2025EditableSnakValue no longer includes <v-if>/<v-else-if> to display the snak input field, and instead uses <component is='...'> to inject an appropriate subcomponent.
- Appropriate subcomponents are implemented, and encapsulate the logic for the input type.