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

feat: fine row deletion #1193

Open
wants to merge 12 commits into
base: 3.0
Choose a base branch
from
Open

feat: fine row deletion #1193

wants to merge 12 commits into from

Conversation

laurentC35
Copy link
Contributor

New feature ⭐

Allow fine row deletion in dynamic-table or loop

src/components/RosterForLoop/RosterForLoop.tsx Outdated Show resolved Hide resolved
src/i18n/dictionary.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/components/Loop/Loop.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@Grafikart Grafikart left a comment

Choose a reason for hiding this comment

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

Bien pensé l'argument removedIndex, il y a juste quelques petite amélioration mais dans le principe ça me semble être la bonne approche.

}
// Case 0: trying to delete with wrong index
if (indexToRemove >= nbRows || indexToRemove < 0) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ici j'aurais tendance à throw une exception car c'est un cas qui n'est vraiment censé jamais arrivé

if (nbRows <= 0) {
return null;
}

const canControlRows = min !== max && Number.isFinite(max);
Copy link
Collaborator

Choose a reason for hiding this comment

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

il faut aussi que nbRows > min non ?

))}
<br />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ce <br/> m'étonne

if (0 > removedIndex || array.length <= removedIndex) {
return array;
}
return [...array].filter((_, i) => i !== removedIndex);
Copy link
Collaborator

Choose a reason for hiding this comment

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

La destructuration ne sert pas ici, filter va déjà recréer un nouveau tableau

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