@progress/kendo-angular-utils 0.1.1-dev.202208160834 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-utils.umd.js +1 -1
- package/drag-and-drop/dragtarget.directive.d.ts +16 -44
- package/drag-and-drop/droptarget.directive.d.ts +5 -5
- package/drag-and-drop/events/drag-target/drag-event.d.ts +1 -1
- package/drag-and-drop/events/drag-target/end-event.d.ts +1 -1
- package/drag-and-drop/events/drag-target/index.d.ts +4 -5
- package/drag-and-drop/events/drag-target/press-event.d.ts +1 -1
- package/drag-and-drop/events/drag-target/start-event.d.ts +1 -1
- package/drag-and-drop/events/drop-target/drop-event.d.ts +1 -1
- package/drag-and-drop/events/drop-target/enter-event.d.ts +1 -1
- package/drag-and-drop/events/drop-target/index.d.ts +4 -4
- package/drag-and-drop/events/drop-target/leave-event.d.ts +1 -1
- package/drag-and-drop/events/drop-target/over-event.d.ts +1 -1
- package/drag-and-drop/models/allowed-target.d.ts +1 -1
- package/drag-and-drop.module.d.ts +31 -0
- package/esm2015/drag-and-drop/dragtarget.directive.js +49 -62
- package/esm2015/drag-and-drop/droptarget.directive.js +14 -6
- package/esm2015/drag-and-drop/events/drag-target/drag-event.js +1 -1
- package/esm2015/drag-and-drop/events/drag-target/end-event.js +1 -1
- package/esm2015/drag-and-drop/events/drag-target/index.js +4 -5
- package/esm2015/drag-and-drop/events/drag-target/press-event.js +1 -1
- package/esm2015/drag-and-drop/events/drag-target/start-event.js +1 -1
- package/esm2015/drag-and-drop/events/drop-target/drop-event.js +1 -1
- package/esm2015/drag-and-drop/events/drop-target/enter-event.js +1 -1
- package/esm2015/drag-and-drop/events/drop-target/index.js +4 -4
- package/esm2015/drag-and-drop/events/drop-target/leave-event.js +1 -1
- package/esm2015/drag-and-drop/events/drop-target/over-event.js +1 -1
- package/esm2015/drag-and-drop.module.js +33 -1
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-utils.js +105 -90
- package/main.d.ts +1 -0
- package/package.json +1 -1
- package/drag-and-drop/events/drag-target/release-event.d.ts +0 -22
- package/esm2015/drag-and-drop/events/drag-target/release-event.js +0 -15
|
@@ -8,7 +8,7 @@ import * as i1 from '@angular/common';
|
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
10
|
import { dispatchDragAndDrop, getScrollableParent, autoScroll } from '@progress/kendo-draggable-common';
|
|
11
|
-
import { PreventableEvent,
|
|
11
|
+
import { PreventableEvent, contains, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @hidden
|
|
@@ -17,7 +17,7 @@ const packageMetadata = {
|
|
|
17
17
|
name: '@progress/kendo-angular-utils',
|
|
18
18
|
productName: 'Kendo UI for Angular',
|
|
19
19
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
20
|
-
publishDate:
|
|
20
|
+
publishDate: 1663073506,
|
|
21
21
|
version: '',
|
|
22
22
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
23
23
|
};
|
|
@@ -47,7 +47,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
47
47
|
/**
|
|
48
48
|
* Arguments for the press event of the DragTarget.
|
|
49
49
|
*/
|
|
50
|
-
class
|
|
50
|
+
class DragTargetPressEvent {
|
|
51
51
|
/**
|
|
52
52
|
* @hidden
|
|
53
53
|
*/
|
|
@@ -59,7 +59,7 @@ class PressEvent {
|
|
|
59
59
|
/**
|
|
60
60
|
* Arguments for the dragStart event of the DragTarget.
|
|
61
61
|
*/
|
|
62
|
-
class
|
|
62
|
+
class DragTargetDragStartEvent extends PreventableEvent {
|
|
63
63
|
/**
|
|
64
64
|
* @hidden
|
|
65
65
|
*/
|
|
@@ -69,22 +69,10 @@ class DragStartEvent extends PreventableEvent {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* Arguments for the release event of the DragTarget.
|
|
74
|
-
*/
|
|
75
|
-
class ReleaseEvent {
|
|
76
|
-
/**
|
|
77
|
-
* @hidden
|
|
78
|
-
*/
|
|
79
|
-
constructor(args) {
|
|
80
|
-
Object.assign(this, args);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
72
|
/**
|
|
85
73
|
* Arguments for the dragEnd event of the DragTarget.
|
|
86
74
|
*/
|
|
87
|
-
class
|
|
75
|
+
class DragTargetDragEndEvent {
|
|
88
76
|
/**
|
|
89
77
|
* @hidden
|
|
90
78
|
*/
|
|
@@ -96,7 +84,7 @@ class DragEndEvent {
|
|
|
96
84
|
/**
|
|
97
85
|
* Arguments for the drag event of the DragTarget.
|
|
98
86
|
*/
|
|
99
|
-
class
|
|
87
|
+
class DragTargetDragEvent extends PreventableEvent {
|
|
100
88
|
/**
|
|
101
89
|
* @hidden
|
|
102
90
|
*/
|
|
@@ -329,27 +317,28 @@ class DragTargetDirective {
|
|
|
329
317
|
this.dragDelay = 0;
|
|
330
318
|
/**
|
|
331
319
|
* Fires when the user presses the DragTarget element.
|
|
332
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
333
320
|
*/
|
|
334
321
|
this.press = new EventEmitter();
|
|
335
322
|
/**
|
|
336
323
|
* Fires when the dragging of the DragTarget element begins.
|
|
337
|
-
* This event is preventable.
|
|
324
|
+
* This event is preventable.
|
|
338
325
|
*/
|
|
339
326
|
this.dragStart = new EventEmitter();
|
|
340
327
|
/**
|
|
341
328
|
* Fires while the user drags the DragTarget element.
|
|
342
|
-
* This event is preventable.
|
|
329
|
+
* This event is preventable.
|
|
343
330
|
*/
|
|
344
331
|
this.drag = new EventEmitter();
|
|
345
332
|
/**
|
|
346
|
-
* Fires when the user
|
|
347
|
-
|
|
333
|
+
* Fires when the DragTarget's `dragDelay` has passed and the user is able to drag the element.
|
|
334
|
+
*/
|
|
335
|
+
this.dragReady = new EventEmitter();
|
|
336
|
+
/**
|
|
337
|
+
* Fires when the user releases the DragTarget element after being pressed.
|
|
348
338
|
*/
|
|
349
339
|
this.release = new EventEmitter();
|
|
350
340
|
/**
|
|
351
|
-
* Fires when the dragging of the DragTarget element
|
|
352
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
341
|
+
* Fires when the dragging of the DragTarget ends and the element is released.
|
|
353
342
|
*/
|
|
354
343
|
this.dragEnd = new EventEmitter();
|
|
355
344
|
this.touchAction = 'none';
|
|
@@ -360,6 +349,7 @@ class DragTargetDirective {
|
|
|
360
349
|
this.dragStarted = false;
|
|
361
350
|
this.pressed = false;
|
|
362
351
|
this.dragTimeout = null;
|
|
352
|
+
this.position = { x: 0, y: 0 };
|
|
363
353
|
validatePackage(packageMetadata);
|
|
364
354
|
}
|
|
365
355
|
/**
|
|
@@ -434,13 +424,16 @@ class DragTargetDirective {
|
|
|
434
424
|
if (this.dragDelay > 0) {
|
|
435
425
|
this.dragTimeout = setTimeout(() => {
|
|
436
426
|
this.pressed = true;
|
|
427
|
+
this.ngZone.run(() => {
|
|
428
|
+
this.dragReady.emit();
|
|
429
|
+
});
|
|
437
430
|
}, this.dragDelay);
|
|
438
431
|
}
|
|
439
432
|
else {
|
|
440
433
|
this.pressed = true;
|
|
441
434
|
}
|
|
442
435
|
this.ngZone.run(() => {
|
|
443
|
-
const eventArgs = new
|
|
436
|
+
const eventArgs = new DragTargetPressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
444
437
|
this.press.emit(eventArgs);
|
|
445
438
|
});
|
|
446
439
|
}
|
|
@@ -455,12 +448,12 @@ class DragTargetDirective {
|
|
|
455
448
|
}
|
|
456
449
|
return;
|
|
457
450
|
}
|
|
458
|
-
if (isDragStartPrevented) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
451
|
this.ngZone.run(() => {
|
|
462
452
|
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
463
453
|
});
|
|
454
|
+
if (isDragStartPrevented) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
464
457
|
if (isPresent(this.hintTemplate)) {
|
|
465
458
|
this.createHint();
|
|
466
459
|
if (isPresent(this.hint)) {
|
|
@@ -470,13 +463,10 @@ class DragTargetDirective {
|
|
|
470
463
|
this.dragStarted = this.threshold === 0;
|
|
471
464
|
this.service.dragTarget = this.dragTarget;
|
|
472
465
|
this.service.dragTargetDirective = this;
|
|
473
|
-
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
466
|
+
this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
|
|
474
467
|
}
|
|
475
|
-
/**
|
|
476
|
-
* @hidden
|
|
477
|
-
*/
|
|
478
468
|
handleDrag(event) {
|
|
479
|
-
if (!this.pressed) {
|
|
469
|
+
if (!this.pressed || isDragStartPrevented) {
|
|
480
470
|
return;
|
|
481
471
|
}
|
|
482
472
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
@@ -487,32 +477,28 @@ class DragTargetDirective {
|
|
|
487
477
|
if (isDragPrevented) {
|
|
488
478
|
return;
|
|
489
479
|
}
|
|
490
|
-
let coordinates = { x: 0, y: 0 };
|
|
491
480
|
if (this.restrictByAxis === 'horizontal') {
|
|
492
|
-
|
|
481
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
493
482
|
}
|
|
494
483
|
else if (this.restrictByAxis === 'vertical') {
|
|
495
|
-
|
|
484
|
+
this.position = { x: 0, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
496
485
|
}
|
|
497
486
|
else {
|
|
498
|
-
|
|
487
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
499
488
|
}
|
|
500
|
-
const thresholdNotReached = Math.abs(
|
|
489
|
+
const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
|
|
501
490
|
if (!this.dragStarted && thresholdNotReached) {
|
|
502
491
|
return;
|
|
503
492
|
}
|
|
504
493
|
if (!this.dragStarted && this.threshold > 0) {
|
|
505
494
|
this.dragStarted = true;
|
|
506
495
|
}
|
|
507
|
-
const transform = `translate(${
|
|
496
|
+
const transform = `translate(${this.position.x}px, ${this.position.y}px)`;
|
|
508
497
|
setElementStyles(this.renderer, elem, {
|
|
509
498
|
transform: transform,
|
|
510
499
|
transition: 'none'
|
|
511
500
|
});
|
|
512
501
|
}
|
|
513
|
-
/**
|
|
514
|
-
* @hidden
|
|
515
|
-
*/
|
|
516
502
|
handleRelease(event) {
|
|
517
503
|
if (this.dragTimeout) {
|
|
518
504
|
clearTimeout(this.dragTimeout);
|
|
@@ -522,35 +508,40 @@ class DragTargetDirective {
|
|
|
522
508
|
this.service.dragTarget = null;
|
|
523
509
|
this.service.dragTargetDirective = null;
|
|
524
510
|
this.ngZone.run(() => {
|
|
525
|
-
const eventArgs = new
|
|
511
|
+
const eventArgs = new DragTargetPressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
526
512
|
this.release.emit(eventArgs);
|
|
527
513
|
});
|
|
528
514
|
}
|
|
529
|
-
/**
|
|
530
|
-
* @hidden
|
|
531
|
-
*/
|
|
532
515
|
handleDragEnd(event) {
|
|
533
|
-
if (
|
|
534
|
-
|
|
516
|
+
if (this.dragTimeout) {
|
|
517
|
+
clearTimeout(this.dragTimeout);
|
|
518
|
+
this.dragTimeout = null;
|
|
519
|
+
this.pressed = false;
|
|
535
520
|
}
|
|
536
|
-
this.
|
|
521
|
+
const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget, this.service.dragTarget, true);
|
|
537
522
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
523
|
+
if (isDroppedOverParentTarget || this.service.dropTargets.length > 0) {
|
|
524
|
+
this.renderer.removeStyle(elem, 'transform');
|
|
525
|
+
setElementStyles(this.renderer, elem, {
|
|
526
|
+
transition: dragTargetTransition
|
|
527
|
+
});
|
|
528
|
+
this.position = { x: 0, y: 0 };
|
|
529
|
+
}
|
|
538
530
|
if (isPresent(this.hint)) {
|
|
539
531
|
this.renderer.removeStyle(this.nativeElement, 'opacity');
|
|
540
532
|
this.destroyHint();
|
|
541
533
|
}
|
|
542
|
-
this.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
534
|
+
this.service.dragTarget = null;
|
|
535
|
+
this.service.dragTargetDirective = null;
|
|
536
|
+
if (!this.dragStarted || isDragStartPrevented || isDragPrevented) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
546
539
|
this.ngZone.run(() => {
|
|
547
|
-
const eventArgs = new
|
|
540
|
+
const eventArgs = new DragTargetDragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
548
541
|
this.dragEnd.emit(eventArgs);
|
|
549
542
|
});
|
|
543
|
+
this.dragStarted = false;
|
|
550
544
|
}
|
|
551
|
-
/**
|
|
552
|
-
* @hidden
|
|
553
|
-
*/
|
|
554
545
|
initializeDraggable() {
|
|
555
546
|
this.dragTarget = {
|
|
556
547
|
element: this.nativeElement,
|
|
@@ -562,9 +553,6 @@ class DragTargetDirective {
|
|
|
562
553
|
onDragEnd: this.handleDragEnd.bind(this)
|
|
563
554
|
};
|
|
564
555
|
}
|
|
565
|
-
/**
|
|
566
|
-
* @hidden
|
|
567
|
-
*/
|
|
568
556
|
attachDomHandlers() {
|
|
569
557
|
if (this.domSubscriptions.length > 0) {
|
|
570
558
|
this.domSubscriptions.forEach(subscription => subscription());
|
|
@@ -604,24 +592,15 @@ class DragTargetDirective {
|
|
|
604
592
|
];
|
|
605
593
|
}
|
|
606
594
|
}
|
|
607
|
-
/**
|
|
608
|
-
* @hidden
|
|
609
|
-
*/
|
|
610
595
|
isDragHandle(el) {
|
|
611
596
|
return this.dragHandles.toArray().some(dh => contains(dh.element.nativeElement, el, true));
|
|
612
597
|
}
|
|
613
|
-
/**
|
|
614
|
-
* @hidden
|
|
615
|
-
*/
|
|
616
598
|
getAutoScrollContainer() {
|
|
617
599
|
return typeof this.autoScroll === 'object' &&
|
|
618
600
|
this.autoScroll.boundaryElementRef &&
|
|
619
601
|
this.autoScroll.boundaryElementRef.nativeElement ?
|
|
620
602
|
this.autoScroll.boundaryElementRef.nativeElement : null;
|
|
621
603
|
}
|
|
622
|
-
/**
|
|
623
|
-
* @hidden
|
|
624
|
-
*/
|
|
625
604
|
createHint() {
|
|
626
605
|
const hintComponent = this.resolver.resolveComponentFactory(HintComponent);
|
|
627
606
|
this.hint = this.viewContainer.createComponent(hintComponent);
|
|
@@ -630,26 +609,20 @@ class DragTargetDirective {
|
|
|
630
609
|
this.hint.changeDetectorRef.detectChanges();
|
|
631
610
|
this.dragTarget.hint = this.hint.instance.element.nativeElement;
|
|
632
611
|
}
|
|
633
|
-
/**
|
|
634
|
-
* @hidden
|
|
635
|
-
*/
|
|
636
612
|
destroyHint() {
|
|
637
613
|
this.hint.destroy();
|
|
638
614
|
this.hint.changeDetectorRef.detectChanges();
|
|
639
615
|
this.hint = null;
|
|
640
616
|
this.dragTarget.hint = null;
|
|
641
617
|
}
|
|
642
|
-
/**
|
|
643
|
-
* @hidden
|
|
644
|
-
*/
|
|
645
618
|
emitEvent(event, args) {
|
|
646
619
|
let eventArgs;
|
|
647
620
|
switch (event) {
|
|
648
621
|
case 'dragStart':
|
|
649
|
-
eventArgs = new
|
|
622
|
+
eventArgs = new DragTargetDragStartEvent(args);
|
|
650
623
|
break;
|
|
651
624
|
case 'drag':
|
|
652
|
-
eventArgs = new
|
|
625
|
+
eventArgs = new DragTargetDragEvent(args);
|
|
653
626
|
break;
|
|
654
627
|
default:
|
|
655
628
|
break;
|
|
@@ -659,7 +632,7 @@ class DragTargetDirective {
|
|
|
659
632
|
}
|
|
660
633
|
}
|
|
661
634
|
DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
662
|
-
DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hintTemplate: "hintTemplate", threshold: "threshold", autoScroll: "autoScroll", link: "link", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis" }, outputs: { press: "press", dragStart: "dragStart", drag: "drag", release: "release", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
635
|
+
DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hintTemplate: "hintTemplate", threshold: "threshold", autoScroll: "autoScroll", link: "link", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis" }, outputs: { press: "press", dragStart: "dragStart", drag: "drag", dragReady: "dragReady", release: "release", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
663
636
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, decorators: [{
|
|
664
637
|
type: Directive,
|
|
665
638
|
args: [{
|
|
@@ -684,6 +657,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
684
657
|
type: Output
|
|
685
658
|
}], drag: [{
|
|
686
659
|
type: Output
|
|
660
|
+
}], dragReady: [{
|
|
661
|
+
type: Output
|
|
687
662
|
}], release: [{
|
|
688
663
|
type: Output
|
|
689
664
|
}], dragEnd: [{
|
|
@@ -699,7 +674,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
699
674
|
/**
|
|
700
675
|
* Arguments for the dragEnter event of the DropTarget.
|
|
701
676
|
*/
|
|
702
|
-
class
|
|
677
|
+
class DropTargetDragEnterEvent {
|
|
703
678
|
/**
|
|
704
679
|
* @hidden
|
|
705
680
|
*/
|
|
@@ -711,7 +686,7 @@ class DragEnterEvent {
|
|
|
711
686
|
/**
|
|
712
687
|
* Arguments for the dragOver event of the DropTarget.
|
|
713
688
|
*/
|
|
714
|
-
class
|
|
689
|
+
class DropTargetDragOverEvent {
|
|
715
690
|
/**
|
|
716
691
|
* @hidden
|
|
717
692
|
*/
|
|
@@ -723,7 +698,7 @@ class DragOverEvent {
|
|
|
723
698
|
/**
|
|
724
699
|
* Arguments for the dragLeave event of the DropTarget.
|
|
725
700
|
*/
|
|
726
|
-
class
|
|
701
|
+
class DropTargetDragLeaveEvent {
|
|
727
702
|
/**
|
|
728
703
|
* @hidden
|
|
729
704
|
*/
|
|
@@ -735,7 +710,7 @@ class DragLeaveEvent {
|
|
|
735
710
|
/**
|
|
736
711
|
* Arguments for the drop event of the DropTarget.
|
|
737
712
|
*/
|
|
738
|
-
class
|
|
713
|
+
class DropTargetDropEvent {
|
|
739
714
|
/**
|
|
740
715
|
* @hidden
|
|
741
716
|
*/
|
|
@@ -782,6 +757,9 @@ class DropTargetDirective {
|
|
|
782
757
|
* @hidden
|
|
783
758
|
*/
|
|
784
759
|
handleDragEnter(event) {
|
|
760
|
+
if (!this.service.dragTarget) {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
785
763
|
let allowed = true;
|
|
786
764
|
if (isPresent(this.allowedDragTargets)) {
|
|
787
765
|
switch (typeof this.allowedDragTargets) {
|
|
@@ -801,7 +779,7 @@ class DropTargetDirective {
|
|
|
801
779
|
if (allowed) {
|
|
802
780
|
this.service.dropTarget = this.dropTarget;
|
|
803
781
|
this.ngZone.run(() => {
|
|
804
|
-
const eventArgs = new
|
|
782
|
+
const eventArgs = new DropTargetDragEnterEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
805
783
|
this.dragEnter.emit(eventArgs);
|
|
806
784
|
});
|
|
807
785
|
}
|
|
@@ -811,8 +789,11 @@ class DropTargetDirective {
|
|
|
811
789
|
*/
|
|
812
790
|
handleDragLeave(event) {
|
|
813
791
|
this.service.dropTarget = null;
|
|
792
|
+
if (!this.service.dragTarget) {
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
814
795
|
this.ngZone.run(() => {
|
|
815
|
-
const eventArgs = new
|
|
796
|
+
const eventArgs = new DropTargetDragLeaveEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
816
797
|
this.dragLeave.emit(eventArgs);
|
|
817
798
|
});
|
|
818
799
|
}
|
|
@@ -820,8 +801,11 @@ class DropTargetDirective {
|
|
|
820
801
|
* @hidden
|
|
821
802
|
*/
|
|
822
803
|
handleDragOver(event) {
|
|
804
|
+
if (!this.service.dragTarget) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
823
807
|
this.ngZone.run(() => {
|
|
824
|
-
const eventArgs = new
|
|
808
|
+
const eventArgs = new DropTargetDragOverEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
825
809
|
this.dragOver.emit(eventArgs);
|
|
826
810
|
});
|
|
827
811
|
}
|
|
@@ -830,10 +814,9 @@ class DropTargetDirective {
|
|
|
830
814
|
*/
|
|
831
815
|
handleDrop(event) {
|
|
832
816
|
this.ngZone.run(() => {
|
|
833
|
-
const eventArgs = new
|
|
817
|
+
const eventArgs = new DropTargetDropEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
834
818
|
this.drop.emit(eventArgs);
|
|
835
819
|
});
|
|
836
|
-
this.service.setScrollOffset({ x: 0, y: 0 });
|
|
837
820
|
}
|
|
838
821
|
/**
|
|
839
822
|
* @hidden
|
|
@@ -874,6 +857,37 @@ const EXPORTS = [
|
|
|
874
857
|
DropTargetDirective,
|
|
875
858
|
HintComponent
|
|
876
859
|
];
|
|
860
|
+
/**
|
|
861
|
+
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
862
|
+
* definition for the Drag and Drop directives.
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
*
|
|
866
|
+
* ```ts-no-run
|
|
867
|
+
* // Import the DragAndDrop module
|
|
868
|
+
* import { DragAndDropModule } from '@progress/kendo-angular-utils';
|
|
869
|
+
*
|
|
870
|
+
* // The browser platform with a compiler
|
|
871
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
872
|
+
*
|
|
873
|
+
* import { NgModule } from '@angular/core';
|
|
874
|
+
*
|
|
875
|
+
* // Import the app component
|
|
876
|
+
* import { AppComponent } from './app.component';
|
|
877
|
+
*
|
|
878
|
+
* // Define the app module
|
|
879
|
+
* _@NgModule({
|
|
880
|
+
* declarations: [AppComponent], // declare app component
|
|
881
|
+
* imports: [BrowserModule, DragAndDropModule], // import DragAndDropModule module
|
|
882
|
+
* bootstrap: [AppComponent]
|
|
883
|
+
* })
|
|
884
|
+
* export class AppModule {}
|
|
885
|
+
*
|
|
886
|
+
* // Compile and launch the module
|
|
887
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
888
|
+
*
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
877
891
|
class DragAndDropModule {
|
|
878
892
|
}
|
|
879
893
|
DragAndDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -890,7 +904,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
890
904
|
args: [{
|
|
891
905
|
declarations: [...EXPORTS],
|
|
892
906
|
exports: [...EXPORTS],
|
|
893
|
-
imports: [CommonModule]
|
|
907
|
+
imports: [CommonModule],
|
|
908
|
+
entryComponents: [HintComponent]
|
|
894
909
|
}]
|
|
895
910
|
}] });
|
|
896
911
|
|
|
@@ -941,5 +956,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
941
956
|
* Generated bundle index. Do not edit.
|
|
942
957
|
*/
|
|
943
958
|
|
|
944
|
-
export { DragAndDropModule,
|
|
959
|
+
export { DragAndDropModule, DragHandleDirective, DragTargetDirective, DragTargetDragEndEvent, DragTargetDragEvent, DragTargetDragStartEvent, DragTargetPressEvent, DropTargetDirective, DropTargetDragEnterEvent, DropTargetDragLeaveEvent, DropTargetDragOverEvent, DropTargetDropEvent, HintComponent, UtilsModule };
|
|
945
960
|
|
package/main.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { HintComponent } from './drag-and-drop/hint.component';
|
|
|
11
11
|
export { DragAxis, AutoScrollOptions, AllowedTargetFn, ScrollDirection, Coordinates } from './drag-and-drop/models/index';
|
|
12
12
|
export * from './drag-and-drop/events/drag-target';
|
|
13
13
|
export * from './drag-and-drop/events/drop-target';
|
|
14
|
+
export { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the release event of the DragTarget.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ReleaseEvent {
|
|
10
|
-
/**
|
|
11
|
-
* The normalized event.
|
|
12
|
-
*/
|
|
13
|
-
normalizedEvent: NormalizedDragEvent;
|
|
14
|
-
/**
|
|
15
|
-
* The DOM element that is released.
|
|
16
|
-
*/
|
|
17
|
-
hostElement: HTMLElement;
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
constructor(args?: any);
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* Arguments for the release event of the DragTarget.
|
|
7
|
-
*/
|
|
8
|
-
export class ReleaseEvent {
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
constructor(args) {
|
|
13
|
-
Object.assign(this, args);
|
|
14
|
-
}
|
|
15
|
-
}
|