discourse/app
Joffrey JAFFEUX f6a4de4805
DEV: adds support for nested collections and objects (#30265)
Collections were an existing concept in FormKit but didn't allow nesting. You can now do infinite nesting:

```gjs
<Form
  @data={{hash
    foo=(array
      (hash bar=(array (hash baz=1))) (hash bar=(array (hash baz=2)))
    )
  }}
  as |form|
>
  <form.Collection @name="foo" as |parent parentIndex|>
    <parent.Collection @name="bar" as |child childIndex|>
      <child.Field @name="baz" @title="Baz" as |field|>
        <field.Input />
      </child.Field>
    </parent.Collection>
  </form.Collection>
</Form>
```

On top of this a new component has been added: `Object`. It allows you to represent objects in your form data. Collections are basically handling arrays, and Objects are objects.

This is useful if you form data has this shape for example:

```javascript
{ foo: { bar: 1, baz: 2 } }
```

This can now be mapped in your form using this syntax:

```gjs
<Form @data={{hash foo=(hash bar=1 baz=2)}} as |form|>
  <form.Object @name="foo" as |object name|>
    <object.Field @name={{name}} @title={{name}} as |field|>
      <field.Input />
    </object.Field>
  </form.Object>
</Form>
```

Objects accept nested collections and nested objects. Just like Collections.

A small addition has also been made to `Collection`, they now support a custom `@tagName`, it's useful if each item of your collection is the row of a table for example.
2024-12-13 15:43:32 +01:00
..
assets DEV: adds support for nested collections and objects (#30265) 2024-12-13 15:43:32 +01:00
controllers FEATURE: add support for "Flagged By" filter in reviewable (#30197) 2024-12-10 18:26:38 +11:00
helpers UX: add color-scheme meta tag to _head (#30245) 2024-12-13 08:10:08 -03:00
jobs DEV: Fix broken sidekiq logging due to eeb01ea0de (#30199) 2024-12-10 17:01:25 +08:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
models DEV: add full_move to MovedPost record small_action modifier (#30236) 2024-12-12 11:47:14 -06:00
serializers DEV: Switch the glimmer post menu to auto and unsilence deprecations (#30161) 2024-12-12 18:27:02 -03:00
services FEATURE: Add an option to block IPs and emails to bulk user delete (#29993) 2024-12-09 14:25:31 +03:00
views UX: add color-scheme meta tag to _head (#30245) 2024-12-13 08:10:08 -03:00