@progress/kendo-angular-utils 0.1.0 → 0.1.1-dev.202209131028
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/drag-state.service.d.ts +1 -1
- package/drag-and-drop/dragtarget.directive.d.ts +17 -41
- package/drag-and-drop/droptarget.directive.d.ts +5 -5
- package/drag-and-drop/events/drag-target/drag-event.d.ts +7 -3
- package/drag-and-drop/events/drag-target/end-event.d.ts +3 -4
- package/drag-and-drop/events/drag-target/index.d.ts +4 -5
- package/drag-and-drop/events/drag-target/press-event.d.ts +3 -3
- package/drag-and-drop/events/drag-target/start-event.d.ts +3 -3
- package/drag-and-drop/events/drop-target/drop-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/enter-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/index.d.ts +4 -4
- package/drag-and-drop/events/drop-target/leave-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/over-event.d.ts +3 -4
- package/drag-and-drop/models/allowed-target.d.ts +1 -1
- package/{esm2015/drag-and-drop/events/drag-target/release-event.js → drag-and-drop/models/coordinates.d.ts} +4 -8
- package/drag-and-drop/models/index.d.ts +1 -0
- package/drag-and-drop/util.d.ts +0 -7
- package/drag-and-drop.module.d.ts +31 -0
- package/esm2015/drag-and-drop/dragtarget.directive.js +77 -65
- 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 -3
- 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 -3
- package/esm2015/drag-and-drop/events/drop-target/enter-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/index.js +4 -4
- package/esm2015/drag-and-drop/events/drop-target/leave-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/over-event.js +1 -3
- package/esm2015/drag-and-drop/models/coordinates.js +5 -0
- package/esm2015/drag-and-drop.module.js +33 -1
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-utils.js +133 -98
- package/main.d.ts +2 -1
- package/package.json +2 -2
- package/drag-and-drop/events/drag-target/release-event.d.ts +0 -22
|
@@ -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: 1663064885,
|
|
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,27 +69,14 @@ 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
|
*/
|
|
91
79
|
constructor(args) {
|
|
92
|
-
super();
|
|
93
80
|
Object.assign(this, args);
|
|
94
81
|
}
|
|
95
82
|
}
|
|
@@ -97,7 +84,7 @@ class DragEndEvent extends PreventableEvent {
|
|
|
97
84
|
/**
|
|
98
85
|
* Arguments for the drag event of the DragTarget.
|
|
99
86
|
*/
|
|
100
|
-
class
|
|
87
|
+
class DragTargetDragEvent extends PreventableEvent {
|
|
101
88
|
/**
|
|
102
89
|
* @hidden
|
|
103
90
|
*/
|
|
@@ -297,6 +284,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
297
284
|
}]
|
|
298
285
|
}], ctorParameters: function () { return []; } });
|
|
299
286
|
|
|
287
|
+
let isDragStartPrevented = false;
|
|
288
|
+
let isDragPrevented = false;
|
|
300
289
|
/**
|
|
301
290
|
* Represents the Kendo UI DragTarget directive for Angular.
|
|
302
291
|
*/
|
|
@@ -328,27 +317,28 @@ class DragTargetDirective {
|
|
|
328
317
|
this.dragDelay = 0;
|
|
329
318
|
/**
|
|
330
319
|
* Fires when the user presses the DragTarget element.
|
|
331
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
332
320
|
*/
|
|
333
321
|
this.press = new EventEmitter();
|
|
334
322
|
/**
|
|
335
323
|
* Fires when the dragging of the DragTarget element begins.
|
|
336
|
-
* This event is preventable.
|
|
324
|
+
* This event is preventable.
|
|
337
325
|
*/
|
|
338
326
|
this.dragStart = new EventEmitter();
|
|
339
327
|
/**
|
|
340
328
|
* Fires while the user drags the DragTarget element.
|
|
341
|
-
* This event is preventable.
|
|
329
|
+
* This event is preventable.
|
|
342
330
|
*/
|
|
343
331
|
this.drag = new EventEmitter();
|
|
344
332
|
/**
|
|
345
|
-
* Fires when the user
|
|
346
|
-
|
|
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.
|
|
347
338
|
*/
|
|
348
339
|
this.release = new EventEmitter();
|
|
349
340
|
/**
|
|
350
|
-
* Fires when the dragging of the DragTarget element
|
|
351
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
341
|
+
* Fires when the dragging of the DragTarget ends and the element is released.
|
|
352
342
|
*/
|
|
353
343
|
this.dragEnd = new EventEmitter();
|
|
354
344
|
this.touchAction = 'none';
|
|
@@ -359,6 +349,7 @@ class DragTargetDirective {
|
|
|
359
349
|
this.dragStarted = false;
|
|
360
350
|
this.pressed = false;
|
|
361
351
|
this.dragTimeout = null;
|
|
352
|
+
this.position = { x: 0, y: 0 };
|
|
362
353
|
validatePackage(packageMetadata);
|
|
363
354
|
}
|
|
364
355
|
/**
|
|
@@ -433,13 +424,16 @@ class DragTargetDirective {
|
|
|
433
424
|
if (this.dragDelay > 0) {
|
|
434
425
|
this.dragTimeout = setTimeout(() => {
|
|
435
426
|
this.pressed = true;
|
|
427
|
+
this.ngZone.run(() => {
|
|
428
|
+
this.dragReady.emit();
|
|
429
|
+
});
|
|
436
430
|
}, this.dragDelay);
|
|
437
431
|
}
|
|
438
432
|
else {
|
|
439
433
|
this.pressed = true;
|
|
440
434
|
}
|
|
441
435
|
this.ngZone.run(() => {
|
|
442
|
-
const eventArgs = new
|
|
436
|
+
const eventArgs = new DragTargetPressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
443
437
|
this.press.emit(eventArgs);
|
|
444
438
|
});
|
|
445
439
|
}
|
|
@@ -454,6 +448,12 @@ class DragTargetDirective {
|
|
|
454
448
|
}
|
|
455
449
|
return;
|
|
456
450
|
}
|
|
451
|
+
this.ngZone.run(() => {
|
|
452
|
+
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
453
|
+
});
|
|
454
|
+
if (isDragStartPrevented) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
457
|
if (isPresent(this.hintTemplate)) {
|
|
458
458
|
this.createHint();
|
|
459
459
|
if (isPresent(this.hint)) {
|
|
@@ -463,50 +463,42 @@ class DragTargetDirective {
|
|
|
463
463
|
this.dragStarted = this.threshold === 0;
|
|
464
464
|
this.service.dragTarget = this.dragTarget;
|
|
465
465
|
this.service.dragTargetDirective = this;
|
|
466
|
-
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
467
|
-
this.ngZone.run(() => {
|
|
468
|
-
const eventArgs = new DragStartEvent({ event, element: this.nativeElement });
|
|
469
|
-
this.dragStart.emit(eventArgs);
|
|
470
|
-
});
|
|
466
|
+
this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
|
|
471
467
|
}
|
|
472
|
-
/**
|
|
473
|
-
* @hidden
|
|
474
|
-
*/
|
|
475
468
|
handleDrag(event) {
|
|
476
|
-
if (!this.pressed) {
|
|
469
|
+
if (!this.pressed || isDragStartPrevented) {
|
|
477
470
|
return;
|
|
478
471
|
}
|
|
479
472
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
480
|
-
|
|
473
|
+
const eventArgsProps = elem === this.nativeElement ? { normalizedEvent: event, hostElement: this.nativeElement } : { normalizedEvent: event, hostElement: this.nativeElement, hintElement: elem };
|
|
474
|
+
this.ngZone.run(() => {
|
|
475
|
+
isDragPrevented = this.emitEvent('drag', eventArgsProps).isDefaultPrevented();
|
|
476
|
+
});
|
|
477
|
+
if (isDragPrevented) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
481
480
|
if (this.restrictByAxis === 'horizontal') {
|
|
482
|
-
|
|
481
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
483
482
|
}
|
|
484
483
|
else if (this.restrictByAxis === 'vertical') {
|
|
485
|
-
|
|
484
|
+
this.position = { x: 0, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
486
485
|
}
|
|
487
486
|
else {
|
|
488
|
-
|
|
487
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
489
488
|
}
|
|
490
|
-
const thresholdNotReached = Math.abs(
|
|
489
|
+
const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
|
|
491
490
|
if (!this.dragStarted && thresholdNotReached) {
|
|
492
491
|
return;
|
|
493
492
|
}
|
|
494
|
-
const transform = `translate(${coordinates.x}px, ${coordinates.y}px)`;
|
|
495
|
-
setElementStyles(this.renderer, elem, {
|
|
496
|
-
transform: transform,
|
|
497
|
-
transition: 'none'
|
|
498
|
-
});
|
|
499
493
|
if (!this.dragStarted && this.threshold > 0) {
|
|
500
494
|
this.dragStarted = true;
|
|
501
495
|
}
|
|
502
|
-
this.
|
|
503
|
-
|
|
504
|
-
|
|
496
|
+
const transform = `translate(${this.position.x}px, ${this.position.y}px)`;
|
|
497
|
+
setElementStyles(this.renderer, elem, {
|
|
498
|
+
transform: transform,
|
|
499
|
+
transition: 'none'
|
|
505
500
|
});
|
|
506
501
|
}
|
|
507
|
-
/**
|
|
508
|
-
* @hidden
|
|
509
|
-
*/
|
|
510
502
|
handleRelease(event) {
|
|
511
503
|
if (this.dragTimeout) {
|
|
512
504
|
clearTimeout(this.dragTimeout);
|
|
@@ -516,35 +508,40 @@ class DragTargetDirective {
|
|
|
516
508
|
this.service.dragTarget = null;
|
|
517
509
|
this.service.dragTargetDirective = null;
|
|
518
510
|
this.ngZone.run(() => {
|
|
519
|
-
const eventArgs = new
|
|
511
|
+
const eventArgs = new DragTargetPressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
520
512
|
this.release.emit(eventArgs);
|
|
521
513
|
});
|
|
522
514
|
}
|
|
523
|
-
/**
|
|
524
|
-
* @hidden
|
|
525
|
-
*/
|
|
526
515
|
handleDragEnd(event) {
|
|
527
|
-
if (
|
|
528
|
-
|
|
516
|
+
if (this.dragTimeout) {
|
|
517
|
+
clearTimeout(this.dragTimeout);
|
|
518
|
+
this.dragTimeout = null;
|
|
519
|
+
this.pressed = false;
|
|
529
520
|
}
|
|
530
|
-
this.
|
|
521
|
+
const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget, this.service.dragTarget, true);
|
|
531
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
|
+
}
|
|
532
530
|
if (isPresent(this.hint)) {
|
|
533
531
|
this.renderer.removeStyle(this.nativeElement, 'opacity');
|
|
534
532
|
this.destroyHint();
|
|
535
533
|
}
|
|
536
|
-
this.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
534
|
+
this.service.dragTarget = null;
|
|
535
|
+
this.service.dragTargetDirective = null;
|
|
536
|
+
if (!this.dragStarted || isDragStartPrevented || isDragPrevented) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
540
539
|
this.ngZone.run(() => {
|
|
541
|
-
const eventArgs = new
|
|
540
|
+
const eventArgs = new DragTargetDragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
542
541
|
this.dragEnd.emit(eventArgs);
|
|
543
542
|
});
|
|
543
|
+
this.dragStarted = false;
|
|
544
544
|
}
|
|
545
|
-
/**
|
|
546
|
-
* @hidden
|
|
547
|
-
*/
|
|
548
545
|
initializeDraggable() {
|
|
549
546
|
this.dragTarget = {
|
|
550
547
|
element: this.nativeElement,
|
|
@@ -556,9 +553,6 @@ class DragTargetDirective {
|
|
|
556
553
|
onDragEnd: this.handleDragEnd.bind(this)
|
|
557
554
|
};
|
|
558
555
|
}
|
|
559
|
-
/**
|
|
560
|
-
* @hidden
|
|
561
|
-
*/
|
|
562
556
|
attachDomHandlers() {
|
|
563
557
|
if (this.domSubscriptions.length > 0) {
|
|
564
558
|
this.domSubscriptions.forEach(subscription => subscription());
|
|
@@ -598,24 +592,15 @@ class DragTargetDirective {
|
|
|
598
592
|
];
|
|
599
593
|
}
|
|
600
594
|
}
|
|
601
|
-
/**
|
|
602
|
-
* @hidden
|
|
603
|
-
*/
|
|
604
595
|
isDragHandle(el) {
|
|
605
596
|
return this.dragHandles.toArray().some(dh => contains(dh.element.nativeElement, el, true));
|
|
606
597
|
}
|
|
607
|
-
/**
|
|
608
|
-
* @hidden
|
|
609
|
-
*/
|
|
610
598
|
getAutoScrollContainer() {
|
|
611
599
|
return typeof this.autoScroll === 'object' &&
|
|
612
600
|
this.autoScroll.boundaryElementRef &&
|
|
613
601
|
this.autoScroll.boundaryElementRef.nativeElement ?
|
|
614
602
|
this.autoScroll.boundaryElementRef.nativeElement : null;
|
|
615
603
|
}
|
|
616
|
-
/**
|
|
617
|
-
* @hidden
|
|
618
|
-
*/
|
|
619
604
|
createHint() {
|
|
620
605
|
const hintComponent = this.resolver.resolveComponentFactory(HintComponent);
|
|
621
606
|
this.hint = this.viewContainer.createComponent(hintComponent);
|
|
@@ -624,18 +609,30 @@ class DragTargetDirective {
|
|
|
624
609
|
this.hint.changeDetectorRef.detectChanges();
|
|
625
610
|
this.dragTarget.hint = this.hint.instance.element.nativeElement;
|
|
626
611
|
}
|
|
627
|
-
/**
|
|
628
|
-
* @hidden
|
|
629
|
-
*/
|
|
630
612
|
destroyHint() {
|
|
631
613
|
this.hint.destroy();
|
|
632
614
|
this.hint.changeDetectorRef.detectChanges();
|
|
633
615
|
this.hint = null;
|
|
634
616
|
this.dragTarget.hint = null;
|
|
635
617
|
}
|
|
618
|
+
emitEvent(event, args) {
|
|
619
|
+
let eventArgs;
|
|
620
|
+
switch (event) {
|
|
621
|
+
case 'dragStart':
|
|
622
|
+
eventArgs = new DragTargetDragStartEvent(args);
|
|
623
|
+
break;
|
|
624
|
+
case 'drag':
|
|
625
|
+
eventArgs = new DragTargetDragEvent(args);
|
|
626
|
+
break;
|
|
627
|
+
default:
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
this[event].emit(eventArgs);
|
|
631
|
+
return eventArgs;
|
|
632
|
+
}
|
|
636
633
|
}
|
|
637
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 });
|
|
638
|
-
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 });
|
|
639
636
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, decorators: [{
|
|
640
637
|
type: Directive,
|
|
641
638
|
args: [{
|
|
@@ -660,6 +657,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
660
657
|
type: Output
|
|
661
658
|
}], drag: [{
|
|
662
659
|
type: Output
|
|
660
|
+
}], dragReady: [{
|
|
661
|
+
type: Output
|
|
663
662
|
}], release: [{
|
|
664
663
|
type: Output
|
|
665
664
|
}], dragEnd: [{
|
|
@@ -675,12 +674,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
675
674
|
/**
|
|
676
675
|
* Arguments for the dragEnter event of the DropTarget.
|
|
677
676
|
*/
|
|
678
|
-
class
|
|
677
|
+
class DropTargetDragEnterEvent {
|
|
679
678
|
/**
|
|
680
679
|
* @hidden
|
|
681
680
|
*/
|
|
682
681
|
constructor(args) {
|
|
683
|
-
super();
|
|
684
682
|
Object.assign(this, args);
|
|
685
683
|
}
|
|
686
684
|
}
|
|
@@ -688,12 +686,11 @@ class DragEnterEvent extends PreventableEvent {
|
|
|
688
686
|
/**
|
|
689
687
|
* Arguments for the dragOver event of the DropTarget.
|
|
690
688
|
*/
|
|
691
|
-
class
|
|
689
|
+
class DropTargetDragOverEvent {
|
|
692
690
|
/**
|
|
693
691
|
* @hidden
|
|
694
692
|
*/
|
|
695
693
|
constructor(args) {
|
|
696
|
-
super();
|
|
697
694
|
Object.assign(this, args);
|
|
698
695
|
}
|
|
699
696
|
}
|
|
@@ -701,12 +698,11 @@ class DragOverEvent extends PreventableEvent {
|
|
|
701
698
|
/**
|
|
702
699
|
* Arguments for the dragLeave event of the DropTarget.
|
|
703
700
|
*/
|
|
704
|
-
class
|
|
701
|
+
class DropTargetDragLeaveEvent {
|
|
705
702
|
/**
|
|
706
703
|
* @hidden
|
|
707
704
|
*/
|
|
708
705
|
constructor(args) {
|
|
709
|
-
super();
|
|
710
706
|
Object.assign(this, args);
|
|
711
707
|
}
|
|
712
708
|
}
|
|
@@ -714,12 +710,11 @@ class DragLeaveEvent extends PreventableEvent {
|
|
|
714
710
|
/**
|
|
715
711
|
* Arguments for the drop event of the DropTarget.
|
|
716
712
|
*/
|
|
717
|
-
class
|
|
713
|
+
class DropTargetDropEvent {
|
|
718
714
|
/**
|
|
719
715
|
* @hidden
|
|
720
716
|
*/
|
|
721
717
|
constructor(args) {
|
|
722
|
-
super();
|
|
723
718
|
Object.assign(this, args);
|
|
724
719
|
}
|
|
725
720
|
}
|
|
@@ -762,6 +757,9 @@ class DropTargetDirective {
|
|
|
762
757
|
* @hidden
|
|
763
758
|
*/
|
|
764
759
|
handleDragEnter(event) {
|
|
760
|
+
if (!this.service.dragTarget) {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
765
763
|
let allowed = true;
|
|
766
764
|
if (isPresent(this.allowedDragTargets)) {
|
|
767
765
|
switch (typeof this.allowedDragTargets) {
|
|
@@ -781,7 +779,7 @@ class DropTargetDirective {
|
|
|
781
779
|
if (allowed) {
|
|
782
780
|
this.service.dropTarget = this.dropTarget;
|
|
783
781
|
this.ngZone.run(() => {
|
|
784
|
-
const eventArgs = new
|
|
782
|
+
const eventArgs = new DropTargetDragEnterEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
785
783
|
this.dragEnter.emit(eventArgs);
|
|
786
784
|
});
|
|
787
785
|
}
|
|
@@ -791,8 +789,11 @@ class DropTargetDirective {
|
|
|
791
789
|
*/
|
|
792
790
|
handleDragLeave(event) {
|
|
793
791
|
this.service.dropTarget = null;
|
|
792
|
+
if (!this.service.dragTarget) {
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
794
795
|
this.ngZone.run(() => {
|
|
795
|
-
const eventArgs = new
|
|
796
|
+
const eventArgs = new DropTargetDragLeaveEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
796
797
|
this.dragLeave.emit(eventArgs);
|
|
797
798
|
});
|
|
798
799
|
}
|
|
@@ -800,8 +801,11 @@ class DropTargetDirective {
|
|
|
800
801
|
* @hidden
|
|
801
802
|
*/
|
|
802
803
|
handleDragOver(event) {
|
|
804
|
+
if (!this.service.dragTarget) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
803
807
|
this.ngZone.run(() => {
|
|
804
|
-
const eventArgs = new
|
|
808
|
+
const eventArgs = new DropTargetDragOverEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
805
809
|
this.dragOver.emit(eventArgs);
|
|
806
810
|
});
|
|
807
811
|
}
|
|
@@ -810,10 +814,9 @@ class DropTargetDirective {
|
|
|
810
814
|
*/
|
|
811
815
|
handleDrop(event) {
|
|
812
816
|
this.ngZone.run(() => {
|
|
813
|
-
const eventArgs = new
|
|
817
|
+
const eventArgs = new DropTargetDropEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
814
818
|
this.drop.emit(eventArgs);
|
|
815
819
|
});
|
|
816
|
-
this.service.setScrollOffset({ x: 0, y: 0 });
|
|
817
820
|
}
|
|
818
821
|
/**
|
|
819
822
|
* @hidden
|
|
@@ -854,6 +857,37 @@ const EXPORTS = [
|
|
|
854
857
|
DropTargetDirective,
|
|
855
858
|
HintComponent
|
|
856
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
|
+
*/
|
|
857
891
|
class DragAndDropModule {
|
|
858
892
|
}
|
|
859
893
|
DragAndDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -870,7 +904,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
870
904
|
args: [{
|
|
871
905
|
declarations: [...EXPORTS],
|
|
872
906
|
exports: [...EXPORTS],
|
|
873
|
-
imports: [CommonModule]
|
|
907
|
+
imports: [CommonModule],
|
|
908
|
+
entryComponents: [HintComponent]
|
|
874
909
|
}]
|
|
875
910
|
}] });
|
|
876
911
|
|
|
@@ -921,5 +956,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
921
956
|
* Generated bundle index. Do not edit.
|
|
922
957
|
*/
|
|
923
958
|
|
|
924
|
-
export { DragAndDropModule,
|
|
959
|
+
export { DragAndDropModule, DragHandleDirective, DragTargetDirective, DragTargetDragEndEvent, DragTargetDragEvent, DragTargetDragStartEvent, DragTargetPressEvent, DropTargetDirective, DropTargetDragEnterEvent, DropTargetDragLeaveEvent, DropTargetDragOverEvent, DropTargetDropEvent, HintComponent, UtilsModule };
|
|
925
960
|
|
package/main.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { DragTargetDirective } from './drag-and-drop/dragtarget.directive';
|
|
|
8
8
|
export { DragHandleDirective } from './drag-and-drop/draghandle.directive';
|
|
9
9
|
export { DropTargetDirective } from './drag-and-drop/droptarget.directive';
|
|
10
10
|
export { HintComponent } from './drag-and-drop/hint.component';
|
|
11
|
-
export { DragAxis, AutoScrollOptions, AllowedTargetFn, ScrollDirection } from './drag-and-drop/models/index';
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-dev.202209131028",
|
|
4
4
|
"description": "Kendo UI Angular Utilities package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@progress/kendo-schematics": "^3.0.0",
|
|
26
|
-
"@progress/kendo-draggable-common": "
|
|
26
|
+
"@progress/kendo-draggable-common": "0.2.3",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -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
|
-
event: NormalizedDragEvent;
|
|
14
|
-
/**
|
|
15
|
-
* The DOM element that is released.
|
|
16
|
-
*/
|
|
17
|
-
element: HTMLElement;
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
constructor(args?: any);
|
|
22
|
-
}
|