directus-extension-super-table 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +17 -13
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -37,7 +37,7 @@ Smart image handling with an enlarged hover preview, proper aspect ratios, and a
37
37
  Duplicate items with all their relationships and translations. Perfect for creating variations of complex data structures.
38
38
 
39
39
  ### 🧩 Many-to-Any (M2A) Display
40
- Render polymorphic Many-to-Any relationships directly in the table. Use the `related-values` display or a per-column template with the `{{item:collection.field}}` syntax including nested chains like `{{item:partners_catalog.catalog_id.title}}`. Each junction row resolves against its own target collection.
40
+ Render polymorphic Many-to-Any relationships directly in the table built straight from the native field picker or by hand. Use `{{item:<collection>.<field>}}` for a target's fields (nested chains like `{{item:partners_catalog.catalog_id.title}}` work), `{{collection}}` for the discriminator, and bare tokens like `{{code}}` for parent-row fields. Each junction row resolves against its own target collection.
41
41
 
42
42
 
43
43
 
@@ -164,24 +164,28 @@ sidebar under **Layout Options → Column Displays**:
164
164
  3. **Templates** use the `{{ field }}` mustache syntax and may reference related fields
165
165
 
166
166
  #### Many-to-Any (M2A) templates
167
- M2A fields are polymorphic — each row points at one of several target collections —
168
- so their templates use a dedicated `item:` syntax. Tokens are written **relative to
169
- the field** (do not prefix the field name):
170
-
171
- - `{{collection}}` — the name of the row's target collection
172
- - `{{item:<collection>.<field>}}` — a field on a specific target collection
173
- - Nested paths are supported, e.g. `{{item:partners_catalog.catalog_id.title}}`
174
- (M2A M2O value)
175
-
176
- Each junction row only resolves the token whose `<collection>` matches its own
167
+ M2A fields are polymorphic — each junction row points at one of several target
168
+ collections. Build the template straight from the **native field picker** (it now
169
+ resolves correctly), or write tokens by hand. Tokens resolve per junction row; on a
170
+ name clash the most specific (deepest) match wins:
171
+
172
+ - `{{item:<collection>.<field>}}` — a field on a specific target collection;
173
+ nested paths work, e.g. `{{item:partners_catalog.catalog_id.title}}` (M2A → M2O → value)
174
+ - `{{collection}}` the name of the row's target collection (the discriminator)
175
+ - The field-key-prefixed forms the picker emits also work, e.g.
176
+ `{{treatment.collection}}`, `{{treatment.item:service.name}}`, or a junction
177
+ column like `{{treatment.sort}}`
178
+ - `{{<parentField>}}` — a bare token reads a field on the parent row, e.g.
179
+ `{{code}}` shows the order's own code next to each item
180
+
181
+ Each junction row only resolves the item token whose `<collection>` matches its own
177
182
  target, so a template can cover every allowed collection at once:
178
183
 
179
184
  ```
180
185
  {{collection}}: {{item:partners_catalog.name}} {{item:service.name}}
181
186
  ```
182
187
 
183
- The editor shows the allowed collections and an example for the selected field. A
184
- bare token (e.g. `{{name}}`) is intentionally dropped for M2A — use the `item:` form.
188
+ The editor shows the allowed collections and an example for the selected field.
185
189
 
186
190
  ### Bookmarks
187
191
  Save table configurations for quick access: