Page MenuHomePhabricator

(MS 3)create QuantityValueInput component in QueryBuilder
Closed, ResolvedPublic

Description

Analogous to ItemValueInput and StringValueInput, we need a QuantityValueInput componet.

  • needs to adhere to the interface of ValueInput
    • take numberValue and unitValue props
    • emit input events for numberInput and unitInput and when the values change
    • take a disabled prop
    • take a error prop
  • implement Lookup-behavior for unit lookup part
    • when the user types text into the unit lookup part of the query input -> search for item
    • present those items as menu items
    • if the user selects an item -> emit input event
    • react to scroll to load more results, etc.
    • => it needs to have all the functionality of EntityLookup and ItemValueLookup
      • consider synergies instead of duplicating that logic
NOTE: validation of the number is not part of this task but happens in the store and is going to be implemented in T276944

open questions:

  • the error prop will apply for now only to the number input. We still need to figure out when/how it should apply to the unit input

Event Timeline

amy_rc renamed this task from create QuantityValueInput component in QueryBuilder to (MS 3)create QuantityValueInput component in QueryBuilder.Mar 17 2021, 11:56 AM

Suggested by @Michael : using the Composition API over mixins to address the code duplication with EntityLookup

Wikit example
Composition APi official docs

Change 675507 had a related patch set uploaded (by Guergana Tzatchkova; author: Guergana Tzatchkova):
[wikidata/query-builder@master] Create QuantityValueInput component in QueryBuilder

https://gerrit.wikimedia.org/r/675507

Change 675507 merged by jenkins-bot:

[wikidata/query-builder@master] Create QuantityValueInput component in QueryBuilder

https://gerrit.wikimedia.org/r/675507