[#3537620] feat(Theme builder): Allow defining values and labels for List props
Closes #3537620
I've found some issues in 1.x. Raising separate issues for them
- Can't create a prop of type "List: Text" if one of the enum value's has a
.in it (e.g.Foo.). You get the errorThe "meta:enum" keys for the "num" prop enum cannot contain a dot. Offending key: "Foo."when trying to publish. This means you can't use a float (e.g if you wanted to control CSS opacity) or, for another example, any sentence with a full stop at the end. https://www.drupal.org/project/canvas/issues/3553605 - If you set a prop to "Formatted text" before changing it to anything else, it gets "stuck" as "Formatted text": Follow up https://www.drupal.org/project/canvas/issues/3553361
Now on to what this MR does
- In the serialize and deserialize functions for the props we convert the meta:enum format that the backend uses to a more easy to use format for the form UI.
- The UI now has inputs for both the Value and the Label.
- When entering a value, the label is generated automatically.
- Once the label has been edited manually, or if the label was already present when the form was loaded, the "link" is broken and the label no longer updates automatically
- I added a validation state to warn the user if they have duplicate values in the same list.
Edited by Jesse Baker