Description
Build a new component that, in the context of Default View, can render a type that has a string renderer and parser, and can effectively accept values in both ways.
Desired behavior/Acceptance criteria
- Types that don't have a builtin component, and have a string parser and renderer should be shown using a special component that:
- Can be collapsed/expanded
- When collapsed, shows a text input
- When expanded, falls back into ZObjectKeyValueSet
- In edit mode, both expanded and collapsed views can be edited
- Whenever editing the collapsed component (text input), the parser function is called and:
- if successful, the resulting object is persisted in the state
- if failed, the error is shown under the text field
- Whenever editing the expanded component (ZObjectKeyValueSet) and collapsing it, the renderer function is called and:
- if successful, the resulting string is shown in the collapsed input
- if failed, the error is shown under the text field
- The collapsed field placeholder shows an example from the renderer function tests
- The example should be shown in the user language
- If no valid test is found for the renderer function, fallback to a hardcoded placeholder
To-Do:
- Implement component and basic collapse-expand behavior
- Implement error handling
- Implement dynamic placeholder feature
- Add tests for:
- unit: store module types.js
- unit: component ZObjectStringRenderer.vue
- integration: create object by entering string value in the collapsed input, and Publish without expanding the field
- Fix T358135: Type creation: Allow creation of Types with empty renderer/parser/validator keys
- Fix T358136: Type creation: Allow adding non-existing keys whenever we edit a Type
Devices and Design (URLs or screenshots)
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist