ui:enumOrder now orders boolean options and constant anyOf or oneOf options
Detect
- In your
uiSchema:ui:enumOrderon atype: 'boolean'field, a two-value booleanenum, or beside ananyOf/oneOfmade entirely of constants. - On the rendered page: options missing from that field, or a field with no options at all.
Change
ui:enumOrder now orders the options of an anyOf or oneOf made entirely of constants, as it orders enum values, where 6.x ignored it there (#4298). It also orders a boolean's Yes/No options, those of a two-value enum and the implicit true and false of a plain { "type": "boolean" }, where it used to ignore them unless ui:enumNames was set.
As for any enum, the order drops a value it doesn't list unless it has '*'. A "ui:enumOrder": ["b"] beside a constant oneOf of a, b and c now leaves only b. On a boolean, "ui:enumOrder": [true] leaves only Yes, and an empty "ui:enumOrder": [] leaves no options.
Options keep their schema order when any of them is read through a discriminator or ui:optionsSchemaSelector.
List every value, add '*' to an order meant only to put one first, or remove an order that was never meant to apply:
const uiSchema = {
- agree: { 'ui:enumOrder': [true] },
+ agree: { 'ui:enumOrder': [true, '*'] },
};
Verify
- Each field shows all its options in the order you meant.
Also read: