diff --git a/docs/fields/join.mdx b/docs/fields/join.mdx index 6c006a03e0..56fcef5e08 100644 --- a/docs/fields/join.mdx +++ b/docs/fields/join.mdx @@ -130,6 +130,7 @@ powerful Admin UI. | **`name`** * | To be used as the property name when retrieved from the database. [More](./overview#field-names) | | **`collection`** * | The `slug`s having the relationship field or an array of collection slugs. | | **`on`** * | The name of the relationship or upload field that relates to the collection document. Use dot notation for nested paths, like 'myGroup.relationName'. If `collection` is an array, this field must exist for all specified collections | +| **`orderable`** | If true, enables custom ordering and joined documents can be reordered via drag and drop. Uses [fractional indexing](https://observablehq.com/@dgreensp/implementing-fractional-indexing) for efficient reordering. | | **`where`** | A `Where` query to hide related documents from appearing. Will be merged with any `where` specified in the request. | | **`maxDepth`** | Default is 1, Sets a maximum population depth for this field, regardless of the remaining depth when this field is reached. [Max Depth](../queries/depth#max-depth). | | **`label`** | Text used as a field label in the Admin Panel or an object with keys for each language. | diff --git a/packages/payload/src/fields/config/types.ts b/packages/payload/src/fields/config/types.ts index 6e67ef3450..89f01c92b2 100644 --- a/packages/payload/src/fields/config/types.ts +++ b/packages/payload/src/fields/config/types.ts @@ -1538,6 +1538,17 @@ export type JoinField = { * A string for the field in the collection being joined to. */ on: string + /** + * If true, enables custom ordering for the collection with the relationship, and joined documents can be reordered via drag and drop. + * New documents are inserted at the end of the list according to this parameter. + * + * Under the hood, a field with {@link https://observablehq.com/@dgreensp/implementing-fractional-indexing|fractional indexing} is used to optimize inserts and reorderings. + * + * @default false + * + * @experimental There may be frequent breaking changes to this API + */ + orderable?: boolean sanitizedMany?: JoinField[] type: 'join' validate?: never