diff --git a/modules/ng2-dragula/package.json b/modules/ng2-dragula/package.json index 04418483..e182f0f3 100644 --- a/modules/ng2-dragula/package.json +++ b/modules/ng2-dragula/package.json @@ -36,7 +36,8 @@ "watch": "chokidar 'src/**/*.ts' 'src/**/*.html' 'src/**/*.scss' -c 'yarn build'" }, "dependencies": { - "dragula": "^3.7.2" + "dragula": "^3.7.2", + "@types/dragula": "^2.1.33" }, "peerDependencies": { "@angular/core": ">=6.0.0", @@ -50,7 +51,6 @@ "@angular/core": "^6.0.4", "@angular/language-service": "^6.0.4", "@compodoc/compodoc": "^1.1.3", - "@types/dragula": "2.1.29", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~10.5.0", diff --git a/modules/ng2-dragula/src/DragulaOptions.ts b/modules/ng2-dragula/src/DragulaOptions.ts index 3a4574e2..4c959acb 100644 --- a/modules/ng2-dragula/src/DragulaOptions.ts +++ b/modules/ng2-dragula/src/DragulaOptions.ts @@ -1,29 +1,14 @@ -// import { DragulaOptions as OriginalOptions } from 'dragula'; +import { DragulaOptions as OriginalOptions } from 'dragula'; -// the copy prop in @types/dragula are just booleans, which is severely limiting. -// and it doesn't have copySortSource. -// TODO: PR this against @types/dragula -export interface DragulaOptions { +/* Use this instead of the DragulaOptions from '@types/dragula'. */ +export interface DragulaOptions extends OriginalOptions { - // note: it's possible you could wrap DragulaOptions such that - // the important functions would get model data included. - // that wouldn't be a breaking change if you appended the args to the callbacks. - - /* from @types/dragula */ - containers?: Element[]; - isContainer?: (el?: Element) => boolean; - moves?: (el?: Element, container?: Element, handle?: Element) => boolean; - accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean; - invalid?: (el?: Element, target?: Element) => boolean; - direction?: string; - revertOnSpill?: boolean; - removeOnSpill?: boolean; - delay?: boolean | number; - mirrorContainer?: Element; - - /* modifications */ - copy?: boolean | ((el: Element, source: Element) => boolean); copySortSource?: boolean | ((el: Element, source: Element) => boolean); + /** You must provide this if you are using `copy` with `[dragulaModel]`. It + * is responsible for cloning a model item. Your implementation should + * ensure `x !== copyItem(x)` -- so you must create a *new* object. + **/ copyItem?: (item: T) => T; + } diff --git a/yarn.lock b/yarn.lock index 6ed07a94..6cf810eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -266,9 +266,9 @@ semver "^5.3.0" semver-intersect "^1.1.2" -"@types/dragula@2.1.29": - version "2.1.29" - resolved "https://registry.yarnpkg.com/@types/dragula/-/dragula-2.1.29.tgz#77d688c03b77c654f9754474165fe7d17bb4373b" +"@types/dragula@^2.1.33": + version "2.1.33" + resolved "https://registry.yarnpkg.com/@types/dragula/-/dragula-2.1.33.tgz#63a694bd8a5fb7bfa570778a12a069be98462919" "@types/estree@0.0.39": version "0.0.39"