Altinn / Altinn/app-frontend-react

Checkbox component should support mapping to an array

Open
#273 3 comments 1 reaction 0 assignees View on GitHub
feature-complete kind/user-story
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

## Description
The current implementation of the checkbox component maps answers to a comma-separated string. As an app developer, it feels more natural that these values are mapped as an array. We should support both cases 🦅 and make this setting configurable on the component.

## Considerations
- Default config? We have to stick to the current implementation as default as this could break existing apps. (or if we strongly belive that an array is better we should create a new major versjon.)
- Adding a checkbox-component from studio could potentially be setup as array mapping as default for all new boxes

Depends on #345 to be solved first.

## Acceptance criteria
- Checkbox component should support mapping data to an array structure
- Make this mapping configurable at the component
- Default mapping should be a comma-separated string

## Specification tasks

- [x] Development tasks are defined

## Development tasks
- [ ] Implement configurable setting in formlayout.json
- [ ] update json-schema with new possible config values
- [ ] update checkbox-component to handle both cases
- [ ] unit tests

## Test
> Add test cases here as checkboxes that are being tested as part of the changes.

## Definition of done
Verify that this issue meets [DoD](https://digdir-digitalisering.atlassian.net/wiki/spaces/T3KP/pages/5049246/Definition+of+Done) (Only for project members) before closing.

- [ ] Documentation is updated (if relevant)
- [ ] Technical documentation (docs.altinn.studio)
- [ ] User documentation (altinn.github.io/docs)
- [ ] QA
- [ ] Manual test is complete (if relevant)
- [ ] Automated test is implemented (if relevant)
- [ ] All tasks in this userstory are closed (i.e. remaining tasks are moved to other user stories or marked obsolete)

Contributor guide

Open the contributing guide

Research direction

First check the status and requirements of dependency #345. Then inspect the formlayout.json configuration and its JSON schema, followed by the checkbox-component implementation and existing unit tests. Done means both array and comma-separated mappings work, the setting is configurable, the comma-separated mapping remains the default, and unit tests cover both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.