UX: Allow a default value to be specified for enum properties (#26529)

Why this change?

For a `typed: objects` theme setting with an enum property, we are
adding a `default` key for `type: enum` fields which will be used
as the default value on the client side.

```
some_objects_setting:
  type: objects
  schema:
    name: field
    properties:
      enum_field:
        type: enum
        default: awesome
        choices:
          - nice
          - cool
          - awesome
```
This commit is contained in:
Alan Guo Xiang Tan
2024-04-05 11:44:39 +08:00
committed by GitHub
parent 67a8080e33
commit de5ca63eb5
3 changed files with 29 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ import FieldInputDescription from "admin/components/schema-theme-setting/field-i
import ComboBox from "select-kit/components/combo-box";
export default class SchemaThemeSettingTypeEnum extends Component {
@tracked value = this.args.value;
@tracked value = this.args.value || this.args.spec.default;
get content() {
return this.args.spec.choices.map((choice) => {