Skip to content

Commit

Permalink
fix(types): '@types/dragula' was a devDependency, not present in publ…
Browse files Browse the repository at this point in the history
…ished version, closes #876
  • Loading branch information
cormacrelf committed Jul 20, 2018
1 parent 291036d commit eaef778
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
4 changes: 2 additions & 2 deletions modules/ng2-dragula/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
31 changes: 8 additions & 23 deletions modules/ng2-dragula/src/DragulaOptions.ts
Original file line number Diff line number Diff line change
@@ -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<T = any> {
/* Use this instead of the DragulaOptions from '@types/dragula'. */
export interface DragulaOptions<T = any> 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;

}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit eaef778

Please # to comment.