Skip to content

feat(components/VirtualizedList): MappedCellData#3393

Merged
sgangnant merged 7 commits intomasterfrom
sgangnant/feat/mapped-cell-data
Aug 20, 2021
Merged

feat(components/VirtualizedList): MappedCellData#3393
sgangnant merged 7 commits intomasterfrom
sgangnant/feat/mapped-cell-data

Conversation

@sgangnant
Copy link
Copy Markdown
Contributor

What is the problem this PR is trying to solve?
When, in a VirtualizedList, we need to transform a field in the objects of a collection to a human-readable name, we currently have only 2 options:

  • Iterate over the collection to transform the value in evey object to the HR name (inefficient)
  • Define a custom cell renderer (which can be a bit cumbersome)

What is the chosen solution to this problem?
Create a new cell renderer MappedCellData (couldn't come up with something nicer, open to suggestions) that accepts a map of values in columnData so that value conversion is done at render time.
The cell also accepts arrays as values; in that case values are sorted.

Please check if the PR fulfills these requirements

  • The PR commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features) And non reg done before need review
  • Docs have been added / updated (for bug fixes / features)
  • Related design / discussions / pages (not in jira), if any, are all linked or available in the PR

[ ] This PR introduces a breaking change

@github-actions
Copy link
Copy Markdown
Contributor

3393

:octocat: Demo is available here

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 19, 2021

Size Change: +795 B (0%)

Total Size: 2.24 MB

Filename Size Change
./packages/components/dist/TalendReactComponents.css 33.2 kB -73 B (0%)
./packages/components/dist/TalendReactComponents.js 464 kB +349 B (0%)
./packages/components/dist/TalendReactComponents.js.dependencies.json 772 B -1 B (0%)
./packages/components/dist/TalendReactComponents.min.js 201 kB +89 B (0%)
./packages/components/dist/TalendReactComponents.min.js.dependencies.json 771 B -5 B (-1%)
./packages/containers/dist/TalendReactContainers.css 533 B -1 B (0%)
./packages/containers/dist/TalendReactContainers.js.dependencies.json 413 B +1 B (0%)
./packages/containers/dist/TalendReactContainers.min.js.dependencies.json 416 B +1 B (0%)
./packages/datagrid/dist/TalendReactDatagrid.css 11.4 kB -3 B (0%)
./packages/datagrid/dist/TalendReactDatagrid.js.dependencies.json 370 B -2 B (-1%)
./packages/forms/dist/TalendReactForms.css 4.7 kB -9 B (0%)
./packages/forms/dist/TalendReactForms.js 311 kB +49 B (0%)
./packages/forms/dist/TalendReactForms.js.dependencies.json 484 B -2 B (0%)
./packages/forms/dist/TalendReactForms.min.js 114 kB +25 B (0%)
./packages/theme/dist/bootstrap.css 26.3 kB -521 B (-2%)
./packages/theme/dist/bootstrap.js 1.26 kB +898 B (+251%) 🆘
ℹ️ View Unchanged
Filename Size
./packages/cmf-cqrs/dist/TalendReactCmfCqrs.js 6.37 kB
./packages/cmf-cqrs/dist/TalendReactCmfCqrs.js.dependencies.json 224 B
./packages/cmf-cqrs/dist/TalendReactCmfCqrs.min.js 2.56 kB
./packages/cmf-cqrs/dist/TalendReactCmfCqrs.min.js.dependencies.json 224 B
./packages/cmf/dist/TalendReactCmf.js 93.6 kB
./packages/cmf/dist/TalendReactCmf.js.dependencies.json 421 B
./packages/cmf/dist/TalendReactCmf.min.js 31.5 kB
./packages/cmf/dist/TalendReactCmf.min.js.dependencies.json 419 B
./packages/containers/dist/TalendReactContainers.js 59.7 kB
./packages/containers/dist/TalendReactContainers.min.js 25.4 kB
./packages/datagrid/dist/TalendReactDatagrid.js 60 kB
./packages/datagrid/dist/TalendReactDatagrid.min.js 18.8 kB
./packages/datagrid/dist/TalendReactDatagrid.min.js.dependencies.json 375 B
./packages/forms/dist/TalendReactForms.min.js.dependencies.json 482 B
./packages/icons/dist/bundle.js 2.4 kB
./packages/icons/dist/info.js 1.96 kB
./packages/icons/dist/react.esm.js 185 kB
./packages/icons/dist/react.js 186 kB
./packages/icons/dist/talend-icons-webfont.css 2.86 kB
./packages/icons/dist/talendicons.css 199 B
./packages/icons/dist/TalendIcons.js 191 kB
./packages/icons/dist/TalendIcons.js.dependencies.json 107 B
./packages/icons/dist/TalendIcons.min.js 188 kB
./packages/icons/dist/TalendIcons.min.js.dependencies.json 109 B
./packages/sagas/dist/TalendReactSagas.js 2.5 kB
./packages/sagas/dist/TalendReactSagas.js.dependencies.json 168 B
./packages/sagas/dist/TalendReactSagas.min.js 924 B
./packages/sagas/dist/TalendReactSagas.min.js.dependencies.json 170 B
./packages/stepper/dist/TalendReactStepper.js 4.83 kB
./packages/stepper/dist/TalendReactStepper.js.dependencies.json 343 B
./packages/stepper/dist/TalendReactStepper.min.js 1.83 kB
./packages/stepper/dist/TalendReactStepper.min.js.dependencies.json 342 B
./packages/theme/dist/bootstrap.js.dependencies.json 23 B

compressed-size-action

Copy link
Copy Markdown
Contributor

@jsomsanith-tlnd jsomsanith-tlnd left a comment

Choose a reason for hiding this comment

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

Don't forget to update utils/dictionary.js

@@ -15,7 +15,7 @@ function CellMappedData(props) {
cellContent = cellData
.map(value => valuesMap[value] || value || null)
.filter(value => !!value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You filter 0 as number here

Copy link
Copy Markdown
Contributor

@jmfrancois jmfrancois left a comment

Choose a reason for hiding this comment

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

interesting new cell. Just one question (that could change in the future)

@sgangnant sgangnant merged commit d7e8249 into master Aug 20, 2021
@sgangnant sgangnant deleted the sgangnant/feat/mapped-cell-data branch August 20, 2021 14:20
@github-actions github-actions bot mentioned this pull request Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants