writer / writer-framework

No-code in the front, Python in the back. An open-source framework for creating data apps.
https://dev.writer.com/framework/introduction
Apache License 2.0
1.3k stars 73 forks source link

feat(ui): introduce `CoreColorInput`. WF-9 #486

Closed madeindjs closed 1 month ago

madeindjs commented 2 months ago

Create a new component CoreColorInput using a sub-component BaseInputColor.

The component accept a list of predefined colors using datalist (see doc)

Screencast from 2024-07-09 22-10-29.webm

FabienArcellier commented 2 months ago

The implementation look promising but I fails to reproduce the video on review environment.

Peek 2024-07-07 19-41

FabienArcellier commented 1 month ago

src/ui/core/index.ts to get component definition based on its type

export function getComponentDefinition(type: string)
madeindjs commented 1 month ago

@FabienArcellier & @ramedina86 , I implemented the changes. Here the new screenshot

Screencast from 2024-07-09 22-10-29.webm

I have a small doubt regarding predifined colors because:

  1. we use FieldType.Object since we don't have array field, so we have to check that the JSON is an array and it's not convenient for the user to edit it
  2. The browser accept only a list of hexadecimal colors (see doc)
  3. It's just a suggestion palette, the user can use the color picker to select whatever he wants

Let me know what you think about it

FabienArcellier commented 1 month ago

Thanks It seems good. An improvement for later would be to add a BuilderFieldsValueList component which takes inspiration from BuilderFieldsKeyValue to manipulate a proposal list and provide preformatted Json.