Releases: cormacrelf/angular-skyhook
multi-backend v1.0.8: fix for noImplicitAny:true + skipLibCheck:false
v1.0.7: fix TypeScript < 2.7 compatibility
v1.0.6: fix forRoot with plain backends; support testing
Fixes SkyhookDndModule.forRoot({ backend: HTML5Backend })
, which was failing due to misuse of the very confusing names for BackendFactory.
Also, exposes getHandlerId()
to sources and targets so you can use them in your tests.
See here for an example of testing with react-dnd-test-backend
.
v1.0.5: type annotations on connections
You can now do this:
interface InTransit {
id: number;
}
// ...
// note the <InTransit>
source = this.dnd.dragSource<InTransit>('ITEM', {
beginDrag: () => ({ id: this.id }),
isDragging: monitor => {
// getItem returns InTransit
return monitor.getItem().id === this.id;
}
});
// item$ is an Observable<InTransit>
item$ = this.source.listen(m => m.getItem());
target = this.dnd.dropTarget<InTransit>('ITEM', {
drop: monitor => {
// getItem returns InTransit
const { id } = monitor.getItem();
}
});
By default, the connection creators will try to infer your type from the beginDrag return type.
However, limitations on TypeScript prevent inferring where there is an endDrag method as well. See the comment on DragSourceSpec for why.
It won't cause an error, however; it will just infer that Item
is {}
.
Lastly, you can even specify the getDroppedItem
type, with the second type parameter.
v1.0.4: noHTML5Preview
There is one new @Input() noHTML5Preview
on the [dragSource]
directive. It applies an empty image for the HTML5 preview as a convenience.
Almost no public API changed as a result of using the dnd-core type annotations, except for the types on the InjectionToken
s.
v1.0.3: Publish contents fixed; release multi-backend
Previously, the content in the published bundle was
- dist/*
- README.md
- package.json (root)
Now, it's just the output from ng-packagr
, i.e. the dist directory.
And angular-skyhook-multi-backend
is now available, with versions in lockstep.
v1.0.0: Stable
Some changes to the way manual connections are made in this final 1.0 release. The strange DragSource.connect(c => c.dragPreview(...))
API and others have been replaced with nicer ones, like DragSource.connectDragPreview(...)
.
Otherwise, things are pretty solid. The examples are varied and complex. Give it a go, and file any issues you come across.
Correct Zone for setTimeout/delay/click handlers
Now, if you set up timers in the skyhook zone, they will correctly cause change detection when fired. Useful if doing DragLayer.listen(...).delay(1000)
and the resulting asynchronous subscribers which tend to call setTimeout at odd times.