-
Notifications
You must be signed in to change notification settings - Fork 22
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
base: 3.0
Are you sure you want to change the base?
feat: fine row deletion #1193
Conversation
src/use-lunatic/commons/variables/behaviours/resizing-behaviour.ts
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 /> |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
New feature ⭐
Allow fine row deletion in dynamic-table or loop