discourse/app/assets/javascripts
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
..
admin DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
custom-proxy Build(deps-dev): Bump express from 4.21.1 to 4.21.2 (#30167) 2024-12-08 23:35:23 +01:00
deprecation-silencer DEV: Reformat package.json files (#28733) 2024-09-04 21:14:13 +02:00
dialog-holder Build(deps-dev): Bump webpack from 5.97.0 to 5.97.1 (#30138) 2024-12-05 23:52:02 +01:00
discourse DEV: adds support for nested collections and objects (#30265) 2024-12-13 15:43:32 +01:00
discourse-common DEV: Switch the glimmer post menu to auto and unsilence deprecations (#30161) 2024-12-12 18:27:02 -03:00
discourse-hbr DEV: Detect hbr topic list customizations (#29793) 2024-11-21 16:00:49 +01:00
discourse-i18n DEV: Fixup verbose localization method name (#30208) 2024-12-10 17:30:36 +00:00
discourse-markdown-it FIX: properly quote videos (#30099) 2024-12-04 12:39:38 +01:00
discourse-plugins Build(deps-dev): Bump webpack from 5.97.0 to 5.97.1 (#30138) 2024-12-05 23:52:02 +01:00
discourse-widget-hbs DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
docs
ember-addons
ember-cli-progress-ci
float-kit DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
locales
pretty-text DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
select-kit FIX: restore zero-width space character... (#30243) 2024-12-12 16:10:01 +01:00
theme-transpiler DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
truth-helpers Build(deps): Bump ember-auto-import from 2.9.0 to 2.10.0 (#29606) 2024-11-06 01:06:08 +01:00
.npmrc
handlebars-shim.js
polyfills.js DEV: Bump eslint, lint-configs, and move to flat config (#29661) 2024-11-12 12:33:17 +00:00
service-worker.js.erb DEV: allow non focused tab to be primary tab in service worker (#29516) 2024-11-01 09:42:33 +04:00