-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Unify color definition type among components. #6790
Comments
I found out, that we have, kind-of fourth type. {
model: color.color.replace( / /g, '' ),
label: color.label || color.color,
hasBorder: false,
view: {
name: 'span',
styles: {
color
}
}
} |
Feels like DUP of #6237. |
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue. |
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it). |
📝 Provide a description of the improvement
Currently, the number of components uses a color definition object. Unfortunately, there are two slightly different types, which introduces confusion and cognitive burden for developers, requires more documentation, and makes code complicated and less performance (due to translations needed).
Current types
TableColorConfig
Array.<String | Object>
ColorDefinition
Object
undocumented, unnamed structure - let's call it ColorValue - for the sake of this post.
Object
As you can see they are similar, but slightly off. I don't see any particular reason why is it so.
Who uses what?
... that was the tricky part to me, but AFAI have found:
ColorGridView
ColorTileView
execute
event dataColorTileView
s.execute
event.ColorTileView
ColorInputView
ColorGridView
, to match values fromInputTextView
ColorTableView
ColorTileView
andColorGridView
ColorTileView
s andColorGridView
s.execute
event.TableCellPropertiesView
,TablePropertiesView
ColorGridView
, to match values fromInputTextView
ColorInputView
s using dedicated utilColorTableView
An then comes normalization etc.
Problems
As already stated, lack of consistency - all the drawback it brings was already stated (DevX, performance, etc.)
Fixing that would require major breaking change as may affect users configuration.
TableColorConfig
- defines anArray
ofObject
s of a specific kind without a name. There is nothing specific in theArray
itself. I'd rather create atypedef
for the object, then useArray.<SpecificObject>
andSpecificObject
if needed. With the current setup, I lacked a vocabulary, even to describe the original issue.I believe we do not need to introduce a breaking change, to solve that, and simplify the docs, by renaming things.
.color
- property is misleading to me. If the object type we are talking about is to describe a color to be picked, then we do not talk about "color's color", I would rather say "color's value" or "color's code".Such change would require major breaking change, as would affect users' configs. Also, it does not bring much value from the functional perspective (for example improving performance, reducing code bloat). However, if we are about to make a heavy change to meet 1., we could consider such clarification as well.
Proposal
I propose for all classes to use the following object
ColorConfig
Object
The classes/functions that requires an
Array
, could simply useArray.<ColorConfig>
orArray.<ColorConfig | String>
I see no reason why
hasBorder
requires a dedicatedoptions
namespace. Usingvalue
property would also simplify creation, of...Tiles
and forwarding the color value from various inputs.//cc @Reinmar
📃 Other details
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: