AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

Allow `enumNames` to be set #15

Closed bebraw closed 9 years ago

bebraw commented 9 years ago

Previously it was not possible to i18n enum fields given names and values were same. In other words if you translated enum, its value was transformed as well!

I worked around this issue by implementing support for non-standard enumNames (https://github.com/json-schema/json-schema/wiki/enumNames-(v5-proposal)).

In case the field is set, it will try to use the values of that array instead for names. If the array is shorter than enum, it will default to enum values so at least you won't get empty fields unless values happen to be empty.

Closes #14.