Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List component #638

Merged
merged 73 commits into from
Dec 6, 2022
Merged

List component #638

merged 73 commits into from
Dec 6, 2022

Conversation

caroliss
Copy link
Contributor

@caroliss caroliss commented Nov 9, 2022

Description

First version of listcomponent with sorting and pagination.

Related Issue(s)

Functional requirements (from #578)

  • The component can be configured with a static data source, much like existing options/code lists.
  • The component can be configured with a dynamic data source (fetched from backend). The source data must have a logical structure (i.e. an array of objects, where the object keys indicate the column name, and the object values refer to the cell content/text)
  • The List component can be configured to use pagination. In this case, if the data source is fetching from the backend, app-frontend-react only keeps the current page of data in memory, and re-fetches the data when navigating between pages.
  • Columns in the component can be configured as sortable. If data is fetched from backend, the sort column and direction is passed to the backend via query parameters such that it can handle the sorting implementation.
  • For static data defined in the layout file, sorting can only work on alphabetically sorting strings.
  • A row in the List component can be configured as being selectable. This means a radio button will show up as the first column in the table view, and clicking that radio will use the data model bindings to put one or more cells of data from the list data into the data model.
  • A row in the List component can be configured to as behaving as a multi-select. This means a checkbox will show up as the first column in the table view. If this is used instead of a radio button, the data model binding should be interpreted as a list data model binding (as used for attachments), i.e. it will store data in an array. It might also be required to interpret the data model binding as a group binding (i.e. prefilling/populating a repeating group structure).
  • Some columns should be possible to hide. This can be useful when you want the backend to send an internal reference number you want to populate into the data model when selecting a row, but you don't want to show that column/data to the user.
  • The JsonSchema definition for the column definition in the List component should be as similar to the column definition for repeating groups as possible, to avoid having multiple ways to describe the visual properties of tables.
  • The List component should work nicely on mobile
  • Keyboard navigation
  • Screen reader support
  • Configuration options for which value(s) in the data model bindings should be used when presenting the chosen row(s) in a Summary component referencing the List
  • Support for the component in repeating groups, using the Summary value in the table header
  • Support for 'required'
  • Proper/intuitive validation messages when no row is selected
  • Support for 'readOnly'?
  • Add query parameter for search connected to a data model parameter (aka 'mapping')
  • Bugfix: Handlechange is called in a loop, sometimes causing race condition when you have multiple datamodel bindings. Sometimes only one of the datamodelbindings are saved correctly.

Other tasks (from #578)

  • Define a data structure to be used to describe the data/rows, and implement support for this in Altinn/app-lib-dotnet
  • Create issue(s) for implementing support for this component in Altinn Studio
  • Automatic tests (preferably by adding to our Cypress test suite)
  • Documentation

Johanne Lie and others added 23 commits October 17, 2022 13:39
# Conflicts:
#	src/altinn-app-frontend/src/features/form/containers/Form.tsx
#	src/altinn-app-frontend/src/features/form/layout/formLayoutSlice.ts
#	src/altinn-app-frontend/src/features/form/layout/index.ts
#	src/altinn-app-frontend/src/shared/resources/options/fetch/fetchOptionsSagas.ts
#	src/altinn-app-frontend/src/utils/options.ts
@olemartinorg olemartinorg added the external-contribution-❤️ Pull request from a developer outside the Altinn teams. label Nov 9, 2022
@olemartinorg olemartinorg self-requested a review November 9, 2022 09:52
@caroliss caroliss changed the title WIP: List component List component Dec 2, 2022
@caroliss caroliss marked this pull request as ready for review December 2, 2022 12:22
@olemartinorg
Copy link
Contributor

Would you mind merging from our main now that #711 is done, so that we can run automated tests and prepare for merging these changes? 🥳

Copy link
Contributor

@olemartinorg olemartinorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test related to automated and functional testing external-contribution-❤️ Pull request from a developer outside the Altinn teams. kind/product-feature Pull requests containing new features
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

New component: List
4 participants