|
1 |
| -// import { DragulaOptions as OriginalOptions } from 'dragula'; |
| 1 | +import { DragulaOptions as OriginalOptions } from 'dragula'; |
2 | 2 |
|
3 |
| -// the copy prop in @types/dragula are just booleans, which is severely limiting. |
4 |
| -// and it doesn't have copySortSource. |
5 |
| -// TODO: PR this against @types/dragula |
6 |
| -export interface DragulaOptions<T = any> { |
| 3 | +/* Use this instead of the DragulaOptions from '@types/dragula'. */ |
| 4 | +export interface DragulaOptions<T = any> extends OriginalOptions { |
7 | 5 |
|
8 |
| - // note: it's possible you could wrap DragulaOptions such that |
9 |
| - // the important functions would get model data included. |
10 |
| - // that wouldn't be a breaking change if you appended the args to the callbacks. |
11 |
| - |
12 |
| - /* from @types/dragula */ |
13 |
| - containers?: Element[]; |
14 |
| - isContainer?: (el?: Element) => boolean; |
15 |
| - moves?: (el?: Element, container?: Element, handle?: Element) => boolean; |
16 |
| - accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean; |
17 |
| - invalid?: (el?: Element, target?: Element) => boolean; |
18 |
| - direction?: string; |
19 |
| - revertOnSpill?: boolean; |
20 |
| - removeOnSpill?: boolean; |
21 |
| - delay?: boolean | number; |
22 |
| - mirrorContainer?: Element; |
23 |
| - |
24 |
| - /* modifications */ |
25 |
| - copy?: boolean | ((el: Element, source: Element) => boolean); |
26 | 6 | copySortSource?: boolean | ((el: Element, source: Element) => boolean);
|
27 | 7 |
|
| 8 | + /** You must provide this if you are using `copy` with `[dragulaModel]`. It |
| 9 | + * is responsible for cloning a model item. Your implementation should |
| 10 | + * ensure `x !== copyItem(x)` -- so you must create a *new* object. |
| 11 | + **/ |
28 | 12 | copyItem?: (item: T) => T;
|
| 13 | + |
29 | 14 | }
|
0 commit comments