Skip to content

Rework TypeOfValues type into Options

Loic Huder requested to merge type-of-values into main

I lied in !474 (merged), it was not the final one 😈

I still wanted to tackle !465 (comment 308923). I changed TypeOfValues into Options for the three situations where we specify options for StrOrNumEditCell

Situation TypeOfValues (before) Options (this MR)
There are no options { typeOfInput: input } undefined
There are options but none are required { typeOfInput: select, values: [...] } { values: [...], requiredValues: [] }
There are options and some are required { typeOfInput: select, values: [...], requiredValues: [...] } { values: [...], requiredValues: [...] }

Looking a the TypeOfValues column, we could see the values are always defined when typeOfInput is select. This means we can rely in the existence of values (or Options in this case) instead of having an additional field typeOfInput. Also, typings are easier to work with if we use a required field for requiredValues (and use an empty array when there is no required values).

This sums up the changes I made in this MR.


But with that, I think I will stop refactoring.

I think the whole table component hierarchy is now in much better shape. There are probably new refactoring opportunities that I missed or didn't do:

  • use a generic for RowValue
  • put more stuff in common between each table now that abstractions are more sane -
  • use Map to store rows for other tables as in !460 (merged)
  • ...

But it is time to move on.

Edited by Loic Huder

Merge request reports