add $move descriptor

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-10-09 13:17:00 +02:00
parent 4f4d2f8e48
commit fe2d8176f1
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 16 additions and 1 deletions

View File

@ -85,6 +85,14 @@ export interface Position<X extends PropertyType> {
$position: number
}
/**
* @public
*/
export interface MoveDescriptor<X extends PropertyType> {
$value: X
$position: number
}
/**
* @public
*/
@ -92,6 +100,13 @@ export type ArrayAsElementPosition<T extends Doc> = {
[P in keyof T]: T[P] extends Arr<infer X> ? X | Position<X> : never
}
/**
* @public
*/
export type ArrayMoveDescriptor<T extends Doc> = {
[P in keyof T]: T[P] extends Arr<infer X> ? MoveDescriptor<X> : never
}
/**
* @public
*/
@ -110,6 +125,7 @@ export type OmitNever<T extends object> = Omit<T, KeysByType<T, never>>
export interface PushOptions<T extends Doc> {
$push?: Partial<OmitNever<ArrayAsElementPosition<T>>>
$pull?: Partial<OmitNever<ArrayAsElement<T>>>
$move?: Partial<OmitNever<ArrayMoveDescriptor<T>>>
}
/**

View File

@ -181,7 +181,6 @@
<KanbanCardEmpty label={'Create new application'} />
{#each objects as object, j}
{#if object.state === state._id}
{j}
<div
on:dragover|preventDefault={(ev) => {
dragover(ev, object)