@progress/kendo-angular-utils 16.5.0 → 16.6.0-develop.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.
@@ -4,25 +4,12 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
6
  import { Directive, HostBinding, Injectable, Component, Input, EventEmitter, isDevMode, Output, ContentChildren, NgModule } from '@angular/core';
7
- import * as i1 from '@angular/common';
8
- import { CommonModule } from '@angular/common';
9
7
  import { validatePackage } from '@progress/kendo-licensing';
10
- import { dispatchDragAndDrop, getScrollableParent, autoScroll } from '@progress/kendo-draggable-common';
11
- import { PreventableEvent, contains, isDocumentAvailable, parseCSSClassNames } from '@progress/kendo-angular-common';
12
8
  import { fromEvent, merge } from 'rxjs';
13
9
  import { filter } from 'rxjs/operators';
14
-
15
- /**
16
- * @hidden
17
- */
18
- const packageMetadata = {
19
- name: '@progress/kendo-angular-utils',
20
- productName: 'Kendo UI for Angular',
21
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
22
- publishDate: 1721814063,
23
- version: '16.5.0',
24
- licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
25
- };
10
+ import { dispatchDragAndDrop, getScrollableParent, autoScroll } from '@progress/kendo-draggable-common';
11
+ import { PreventableEvent, contains, isDocumentAvailable, parseCSSClassNames } from '@progress/kendo-angular-common';
12
+ import { NgTemplateOutlet } from '@angular/common';
26
13
 
27
14
  /**
28
15
  * Represents the Kendo UI DragHandle directive for Angular.
@@ -35,18 +22,31 @@ class DragHandleDirective {
35
22
  }
36
23
  }
37
24
  DragHandleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragHandleDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
38
- DragHandleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragHandleDirective, selector: "[kendoDragHandle]", host: { properties: { "style.cursor": "this.cursorStyle" } }, exportAs: ["kendoDragHandle"], ngImport: i0 });
25
+ DragHandleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragHandleDirective, isStandalone: true, selector: "[kendoDragHandle]", host: { properties: { "style.cursor": "this.cursorStyle" } }, exportAs: ["kendoDragHandle"], ngImport: i0 });
39
26
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragHandleDirective, decorators: [{
40
27
  type: Directive,
41
28
  args: [{
42
29
  selector: '[kendoDragHandle]',
43
- exportAs: 'kendoDragHandle'
30
+ exportAs: 'kendoDragHandle',
31
+ standalone: true
44
32
  }]
45
33
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { cursorStyle: [{
46
34
  type: HostBinding,
47
35
  args: ['style.cursor']
48
36
  }] } });
49
37
 
38
+ /**
39
+ * @hidden
40
+ */
41
+ const packageMetadata = {
42
+ name: '@progress/kendo-angular-utils',
43
+ productName: 'Kendo UI for Angular',
44
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
45
+ publishDate: 1721827680,
46
+ version: '16.6.0-develop.1',
47
+ licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
48
+ };
49
+
50
50
  function isDocumentNode(container) {
51
51
  return container.nodeType === 9;
52
52
  }
@@ -280,10 +280,10 @@ class HintComponent {
280
280
  }
281
281
  }
282
282
  HintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HintComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
283
- HintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: HintComponent, selector: "kendo-draghint", inputs: { template: "template", directive: "directive", targetIndex: "targetIndex", contextData: "contextData" }, host: { properties: { "style.pointer-events": "this.pointerEvents" } }, ngImport: i0, template: `
283
+ HintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: HintComponent, isStandalone: true, selector: "kendo-draghint", inputs: { template: "template", directive: "directive", targetIndex: "targetIndex", contextData: "contextData" }, host: { properties: { "style.pointer-events": "this.pointerEvents" } }, ngImport: i0, template: `
284
284
  <ng-container *ngTemplateOutlet="template; context: { $implicit: directive, index: targetIndex, data: contextData }">
285
285
  </ng-container>
286
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
286
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
287
287
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HintComponent, decorators: [{
288
288
  type: Component,
289
289
  args: [{
@@ -291,7 +291,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
291
291
  template: `
292
292
  <ng-container *ngTemplateOutlet="template; context: { $implicit: directive, index: targetIndex, data: contextData }">
293
293
  </ng-container>
294
- `
294
+ `,
295
+ standalone: true,
296
+ imports: [NgTemplateOutlet]
295
297
  }]
296
298
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { template: [{
297
299
  type: Input
@@ -453,39 +455,42 @@ class DragTargetReleaseEvent {
453
455
  let isDragStartPrevented$1 = false;
454
456
  let isDragPrevented$1 = false;
455
457
  /**
456
- * Represents the Kendo UI DragTarget directive for Angular.
458
+ * Represents the [Kendo UI DragTargetContainer directive for Angular]({% slug api_utils_dragtargetcontainerdirective %}).
459
+ * Used to configure multiple elements as draggable.
460
+ *
461
+ * @example
462
+ * ```ts-no-run
463
+ * <ul kendoDragTargetContainer dragTargetFilter=".my-draggable">
464
+ * <li class="my-draggable">foo</li>
465
+ * </ul>
466
+ * ```
457
467
  */
458
- class DragTargetDirective {
459
- constructor(element, renderer, ngZone, service, viewContainer) {
460
- this.element = element;
461
- this.renderer = renderer;
468
+ class DragTargetContainerDirective {
469
+ constructor(wrapper, ngZone, renderer, service, viewContainer, cdr) {
470
+ this.wrapper = wrapper;
462
471
  this.ngZone = ngZone;
472
+ this.renderer = renderer;
463
473
  this.service = service;
464
474
  this.viewContainer = viewContainer;
475
+ this.cdr = cdr;
465
476
  /**
466
- * Defines whether a hint will be used for dragging. By default, the hint is a copy of the drag target. ([see example]({% slug drag_hint %})).
477
+ * Defines whether a hint will be used for dragging. By default, the hint is a copy of the current drag target. ([see example]({% slug drag_hint %})).
467
478
  *
468
479
  * @default false
469
480
  */
470
481
  this.hint = false;
471
482
  /**
472
- * The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})). Applicable when `manualDrag` is set to `false`.
483
+ * Defines the delay in milliseconds after which the drag will begin ([see example](slug drag_target_container#toc-events)).
473
484
  *
474
485
  * @default 0
475
486
  */
476
- this.threshold = 0;
477
- /**
478
- * Defines the automatic container scrolling behavior when close to the edge ([see example]({% slug auto_scroll %})).
479
- *
480
- * @default true
481
- */
482
- this.autoScroll = true;
487
+ this.dragDelay = 0;
483
488
  /**
484
- * Defines the delay in milliseconds after which the drag will begin ([see example]({% slug drag_delay %})).
489
+ * The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})).
485
490
  *
486
491
  * @default 0
487
492
  */
488
- this.dragDelay = 0;
493
+ this.threshold = 0;
489
494
  /**
490
495
  * Specifies whether the default dragging behavior will be performed or the developer will manually handle the drag action.
491
496
  *
@@ -493,46 +498,77 @@ class DragTargetDirective {
493
498
  */
494
499
  this.mode = 'auto';
495
500
  /**
496
- * Fires when the user presses the DragTarget element.
501
+ * Fires when a DragTarget's `dragDelay` has passed and the user is able to drag the element.
497
502
  */
498
- this.onPress = new EventEmitter();
503
+ this.onDragReady = new EventEmitter();
499
504
  /**
500
- * Fires when the dragging of the DragTarget element begins.
505
+ * Fires when the user presses a DragTarget element.
501
506
  */
507
+ this.onPress = new EventEmitter();
508
+ /**
509
+ * Fires when the dragging of a DragTarget element begins.
510
+ */
502
511
  this.onDragStart = new EventEmitter();
503
512
  /**
504
- * Fires while the user drags the DragTarget element.
513
+ * Fires while the user drags a DragTarget element.
505
514
  */
506
515
  this.onDrag = new EventEmitter();
507
516
  /**
508
- * Fires when the DragTarget's `dragDelay` has passed and the user is able to drag the element.
509
- */
510
- this.onDragReady = new EventEmitter();
511
- /**
512
- * Fires when the user releases the DragTarget element after being pressed.
517
+ * Fires when the user releases a DragTarget element after being pressed.
513
518
  */
514
519
  this.onRelease = new EventEmitter();
515
520
  /**
516
- * Fires when the dragging of the DragTarget ends and the element is released.
521
+ * Fires when the dragging of a DragTarget ends and the element is released.
517
522
  */
518
523
  this.onDragEnd = new EventEmitter();
519
- this.dragTarget = null;
520
- this.domSubscriptions = [];
521
- this.hintComponent = null;
522
- this.dragStarted = false;
523
- this.pressed = false;
524
+ this.currentDragTarget = null;
524
525
  this.dragTimeout = null;
526
+ this.pressed = false;
527
+ this.dragStarted = false;
528
+ this.hintComponent = null;
529
+ this.defaultHint = null;
530
+ this.currentDragTargetElement = null;
531
+ this.scrollableParent = null;
532
+ this.previousDragTargets = [];
525
533
  this.initialPosition = { x: 0, y: 0 };
526
534
  this.position = { x: 0, y: 0 };
527
- this.scrollableParent = null;
528
- this.defaultHint = null;
535
+ this.positionsMap = new Map();
536
+ this._dragTargetFilter = null;
537
+ this._dragDisabled = false;
529
538
  this._dragData = () => null;
539
+ this._dragTargetId = () => null;
530
540
  validatePackage(packageMetadata);
531
541
  }
532
542
  /**
533
- * Defines a callback function used for attaching custom data to the dragTarget.
534
- * The data will be available in the events of the respective [`DropTarget`]({% slug api_utils_droptargetdirective %}) or [`DropTargetContainer`]({% slug api_utils_droptargetcontainerdirective %}) directives.
535
- * The current DragTarget HTML element and its `dragTargetId` will be available as arguments.
543
+ * Specifies a selector for elements within a container which will be configured as draggable
544
+ * ([see example]({% slug drag_target_container %})). The possible values include any
545
+ * DOM `selector`.
546
+ */
547
+ set dragTargetFilter(value) {
548
+ this._dragTargetFilter = value;
549
+ if (!this.dragDisabled) {
550
+ this.initializeDragTargets();
551
+ }
552
+ }
553
+ get dragTargetFilter() {
554
+ return this._dragTargetFilter;
555
+ }
556
+ /**
557
+ * Defines a unique identifier for each drag target.
558
+ * It exposes the current DragTarget HTML element and its index in the collection of drag targets as arguments.
559
+ */
560
+ set dragTargetId(fn) {
561
+ if (isDevMode && typeof fn !== 'function') {
562
+ throw new Error(`dragTargetId must be a function, but received ${JSON.stringify(fn)}.`);
563
+ }
564
+ this._dragTargetId = fn;
565
+ }
566
+ get dragTargetId() {
567
+ return this._dragTargetId;
568
+ }
569
+ /**
570
+ * Defines a callback function which returns custom data passed to the DropTarget events.
571
+ * It exposes the current DragTarget HTML element, its `dragTargetId` and its index in the collection of drag targets as arguments.
536
572
  */
537
573
  set dragData(fn) {
538
574
  if (isDevMode && typeof fn !== 'function') {
@@ -543,52 +579,73 @@ class DragTargetDirective {
543
579
  get dragData() {
544
580
  return this._dragData;
545
581
  }
582
+ /**
583
+ * If set to true, the dragging of DragTargets within the container will be disabled.
584
+ *
585
+ * @default false
586
+ */
587
+ set dragDisabled(value) {
588
+ this._dragDisabled = value;
589
+ if (value) {
590
+ this.clearPreviousTargets();
591
+ this.unsubscribe();
592
+ if (isPresent(this.hintElem)) {
593
+ this.destroyHint();
594
+ }
595
+ }
596
+ else {
597
+ if (isPresent(this.wrapper) || isPresent(this.currentDragTarget)) {
598
+ this.subscribe();
599
+ }
600
+ this.initializeDragTargets();
601
+ }
602
+ }
603
+ get dragDisabled() {
604
+ return this._dragDisabled;
605
+ }
606
+ /**
607
+ * Used for notifying the DragTargetContainer that its content has changed.
608
+ */
609
+ notify() {
610
+ this.cdr.detectChanges();
611
+ this.initializeDragTargets();
612
+ }
613
+ get allDragTargets() {
614
+ return this.queryHost(this.dragTargetFilter);
615
+ }
616
+ get dragHandles() {
617
+ return this.isHandleSelectorValid ? this.queryHost(this.dragHandle) : null;
618
+ }
546
619
  get hintTemplate() {
547
620
  return isPresent(this.hint) && typeof this.hint === 'object' ? this.hint.hintTemplate : null;
548
621
  }
549
- get nativeElement() {
550
- return this.element.nativeElement;
551
- }
552
- get hintElem() {
553
- return this.hintTemplate && isPresent(this.hintComponent) ? this.hintComponent.instance.element.nativeElement : this.defaultHint;
622
+ ngAfterViewInit() {
623
+ const isTargetPresent = isPresent(this.wrapper) || isPresent(this.currentDragTarget);
624
+ if (!this.dragDisabled && isTargetPresent) {
625
+ this.subscribe();
626
+ }
627
+ !this.dragDisabled && this.initializeDragTargets();
554
628
  }
555
629
  onPointerDown(event) {
556
- if (this.dragHandles.length && !this.isDragHandle(event.target)) {
630
+ if (isPresent(this.dragHandles) && !this.isDragHandle(event.target)) {
557
631
  return;
558
632
  }
559
- event.preventDefault();
560
- const action = getAction(event, this.dragTarget);
633
+ const action = getAction(event, this.currentDragTarget);
561
634
  this.service.handleDragAndDrop(action);
562
- this.service.autoScroll = typeof this.autoScroll === 'object' ? this.autoScroll.enabled !== false : this.autoScroll;
563
- this.service.scrollableParent = this.getAutoScrollContainer();
564
- this.service.autoScrollDirection = typeof this.autoScroll === 'object' ? this.autoScroll.direction : { horizontal: true, vertical: true };
565
- this.attachDomHandlers();
635
+ this.subscribe();
566
636
  }
567
637
  onPointerMove(event) {
568
638
  event.preventDefault();
569
- const action = getAction(event, this.dragTarget);
639
+ const action = getAction(event, this.currentDragTarget);
570
640
  this.service.handleDragAndDrop(action);
571
641
  }
572
642
  onPointerUp(event) {
573
643
  event.preventDefault();
574
- const action = getAction(event, this.dragTarget);
644
+ const action = getAction(event, this.currentDragTarget);
575
645
  this.service.handleDragAndDrop(action);
576
- this.attachDomHandlers();
577
- }
578
- ngOnInit() {
579
- this.initializeDragTarget();
580
- }
581
- ngAfterContentInit() {
582
- if (isPresent(this.element) || isPresent(this.dragTarget)) {
583
- this.attachDomHandlers();
584
- if (!this.dragHandles.length) {
585
- this.renderer.setStyle(this.nativeElement, 'cursor', 'move');
586
- }
587
- }
588
- this.service.dragTargets.push(this.dragTarget);
589
- }
590
- ngOnDestroy() {
591
- this.domSubscriptions.forEach(subscription => subscription());
646
+ this.ngZone.runOutsideAngular(() => {
647
+ this.subscribe();
648
+ });
592
649
  }
593
650
  handlePress(event) {
594
651
  if (this.dragDelay > 0) {
@@ -600,7 +657,12 @@ class DragTargetDirective {
600
657
  else {
601
658
  this.pressed = true;
602
659
  }
603
- this.scrollableParent = this.dragTarget.element ? getScrollableParent(this.dragTarget.element) : null;
660
+ event.originalEvent.preventDefault();
661
+ const eventTarget = event.originalEvent.target;
662
+ this.currentDragTargetElement = closestBySelector(eventTarget, this.dragTargetFilter);
663
+ this.currentDragTarget.element = this.currentDragTargetElement;
664
+ this.service.dragIndex = this.getDragIndex();
665
+ this.scrollableParent = this.hintTemplate ? document.body : this.currentDragTargetElement ? getScrollableParent(this.currentDragTargetElement) : null;
604
666
  this.emitZoneAwareEvent('onPress', event);
605
667
  }
606
668
  handleDragStart(event) {
@@ -615,26 +677,28 @@ class DragTargetDirective {
615
677
  if (isDragStartPrevented$1) {
616
678
  return;
617
679
  }
680
+ this.position = this.positionsMap.has(this.currentDragTargetElement) ? this.positionsMap.get(this.currentDragTargetElement) : { x: 0, y: 0 };
618
681
  if (this.hint) {
619
682
  this.createHint();
620
683
  if (this.mode === 'auto') {
621
- this.renderer.setStyle(this.nativeElement, 'opacity', '0.7');
684
+ this.renderer.setStyle(this.currentDragTargetElement, 'opacity', '0.7');
622
685
  }
623
- this.initialPosition = { x: event.offsetX, y: event.offsetY };
624
686
  }
625
687
  else {
626
688
  this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
627
689
  }
628
690
  this.dragStarted = this.threshold === 0;
629
- this.service.dragTarget = this.dragTarget;
630
- this.service.dragTargetDirective = this;
631
- this.service.dragData = this.dragData({ dragTarget: this.dragTarget.element, dragTargetId: this.dragTargetIdResult, dragTargetIndex: null });
691
+ this.service.dragTarget = this.currentDragTarget;
692
+ const targetIdArgs = { dragTarget: this.currentDragTargetElement, dragTargetIndex: this.service.dragIndex };
693
+ this.service.dragTargetId = this.dragTargetId(targetIdArgs);
694
+ const targetDataArgs = Object.assign({ dragTargetId: this.service.dragTargetId }, targetIdArgs);
695
+ this.service.dragData = this.dragData(targetDataArgs);
632
696
  }
633
697
  handleDrag(event) {
634
698
  if (!this.pressed || isDragStartPrevented$1) {
635
699
  return;
636
700
  }
637
- const elem = this.hint ? this.hintElem : this.nativeElement;
701
+ const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
638
702
  this.position = this.calculatePosition(elem, event);
639
703
  const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
640
704
  if (!this.dragStarted && thresholdNotReached) {
@@ -655,6 +719,9 @@ class DragTargetDirective {
655
719
  }
656
720
  }
657
721
  handleRelease(event) {
722
+ if (this.dragStarted) {
723
+ this.positionsMap.set(this.currentDragTargetElement, this.position);
724
+ }
658
725
  if (this.dragTimeout) {
659
726
  clearTimeout(this.dragTimeout);
660
727
  this.dragTimeout = null;
@@ -663,93 +730,129 @@ class DragTargetDirective {
663
730
  this.emitZoneAwareEvent('onRelease', event);
664
731
  }
665
732
  handleDragEnd(event) {
733
+ if (!this.dragStarted) {
734
+ return;
735
+ }
666
736
  if (this.mode === 'auto') {
667
737
  const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget?.element, this.service.dragTarget?.element, true);
668
- const elem = this.hint ? this.hintElem : this.nativeElement;
738
+ const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
669
739
  if (isDroppedOverParentTarget || this.service.dropTargets.length > 0 && isPresent(elem)) {
670
740
  this.renderer.removeStyle(elem, 'transform');
671
741
  setElementStyles(this.renderer, elem, {
672
742
  transition: dragTargetTransition
673
743
  });
674
- this.position = { x: 0, y: 0 };
744
+ this.positionsMap.delete(this.currentDragTargetElement);
675
745
  }
676
746
  }
677
747
  if (this.hint && isPresent(this.hintElem)) {
678
748
  this.destroyHint();
679
749
  if (this.mode === 'auto') {
680
- this.renderer.removeStyle(this.nativeElement, 'opacity');
750
+ this.renderer.removeStyle(this.currentDragTargetElement, 'opacity');
681
751
  }
682
752
  }
683
753
  this.service.dragTarget = null;
684
- this.service.dragTargetDirective = null;
685
- if (!this.dragStarted || isDragStartPrevented$1 || isDragPrevented$1) {
754
+ this.service.dragIndex = null;
755
+ this.currentDragTarget.element = null;
756
+ this.emitZoneAwareEvent('onDragEnd', event);
757
+ if (isDragStartPrevented$1 || isDragPrevented$1) {
686
758
  return;
687
759
  }
688
- this.emitZoneAwareEvent('onDragEnd', event);
689
760
  this.dragStarted = false;
690
761
  }
691
- initializeDragTarget() {
692
- this.dragTarget = {
693
- element: this.nativeElement,
694
- hint: null,
695
- onPress: this.handlePress.bind(this),
696
- onRelease: this.handleRelease.bind(this),
697
- onDragStart: this.handleDragStart.bind(this),
698
- onDrag: this.handleDrag.bind(this),
699
- onDragEnd: this.handleDragEnd.bind(this)
700
- };
762
+ get nativeElement() {
763
+ return this.wrapper.nativeElement;
701
764
  }
702
- attachDomHandlers() {
765
+ get hintElem() {
766
+ return this.hintTemplate && isPresent(this.hintComponent) ? this.hintComponent.instance.element.nativeElement : this.defaultHint;
767
+ }
768
+ unsubscribe() {
769
+ if (this.pointerDownSubscription) {
770
+ this.pointerDownSubscription.unsubscribe();
771
+ }
772
+ if (this.pointerMoveSubscription) {
773
+ this.pointerMoveSubscription.unsubscribe();
774
+ }
775
+ if (this.pointerUpSubscription) {
776
+ this.pointerUpSubscription.unsubscribe();
777
+ }
778
+ if (this.scrollSubscription) {
779
+ this.scrollSubscription.unsubscribe();
780
+ }
781
+ }
782
+ subscribe() {
703
783
  this.ngZone.runOutsideAngular(() => {
704
- if (this.domSubscriptions.length > 0) {
705
- this.domSubscriptions.forEach(subscription => subscription());
706
- }
707
- if (!(isDocumentAvailable() && isPresent(this.element))) {
784
+ this.unsubscribe();
785
+ if (!(isDocumentAvailable() && isPresent(this.wrapper))) {
708
786
  return;
709
787
  }
788
+ const element = this.nativeElement;
710
789
  if (this.service.pressed) {
711
- this.onPointerMove = this.onPointerMove.bind(this);
712
- this.onPointerUp = this.onPointerUp.bind(this);
713
- this.domSubscriptions = [
714
- this.renderer.listen(document, 'pointermove', this.onPointerMove),
715
- this.renderer.listen(document, 'mousemove', this.onPointerMove),
716
- this.renderer.listen(document, 'touchmove', this.onPointerMove),
717
- this.renderer.listen(document, 'pointerup', this.onPointerUp),
718
- this.renderer.listen(document, 'pointercancel', this.onPointerUp),
719
- this.renderer.listen(document, 'mouseup', this.onPointerUp),
720
- this.renderer.listen(document, 'contextmenu', this.onPointerUp),
721
- this.renderer.listen(document, 'touchend', this.onPointerUp),
722
- this.renderer.listen(document, 'touchcancel', this.onPointerUp)
723
- ];
790
+ const pointerMoveStreams = allPointerMoveEvents.map((ev) => fromEvent(document, ev));
791
+ const pointerUpStreams = allPointerUpEvents.map((ev) => fromEvent(document, ev));
792
+ this.pointerMoveSubscription = merge(...pointerMoveStreams)
793
+ .pipe(filter(() => this.dragTargetFilter !== ''))
794
+ .subscribe(e => this.onPointerMove(e));
795
+ this.pointerUpSubscription = merge(...pointerUpStreams)
796
+ .subscribe(e => this.onPointerUp(e));
724
797
  if (isPresent(this.scrollableParent)) {
725
- if (this.scrollableParent === document.getElementsByTagName('html')[0]) {
726
- this.scrollableParent = window;
727
- }
728
- this.domSubscriptions.push(this.renderer.listen(this.scrollableParent, 'scroll', this.onPointerMove));
798
+ this.scrollSubscription = fromEvent(this.scrollableParent, 'scroll')
799
+ .subscribe(e => this.onPointerMove(e));
729
800
  }
730
801
  }
731
802
  else {
732
- this.onPointerDown = this.onPointerDown.bind(this);
733
- const element = this.nativeElement;
734
- this.domSubscriptions = [
735
- this.renderer.listen(element, 'pointerdown', this.onPointerDown),
736
- this.renderer.listen(element, 'mousedown', this.onPointerDown),
737
- this.renderer.listen(element, 'touchstart', this.onPointerDown)
738
- ];
803
+ const pointerDownStreams = allPointerDownEvents.map((ev) => fromEvent(element, ev));
804
+ this.pointerDownSubscription = merge(...pointerDownStreams)
805
+ .pipe(filter(() => this.dragTargetFilter !== ''))
806
+ .subscribe((e) => {
807
+ const filterElement = closestBySelector(e.target, this.isHandleSelectorValid ? this.dragHandle : this.dragTargetFilter);
808
+ if (filterElement) {
809
+ this.onPointerDown(e);
810
+ }
811
+ });
739
812
  }
740
813
  });
741
814
  }
742
- isDragHandle(el) {
743
- return this.dragHandles.toArray().some(dh => contains(dh.element.nativeElement, el, true));
744
- }
745
- getAutoScrollContainer() {
746
- return typeof this.autoScroll === 'object' &&
747
- this.autoScroll.boundaryElementRef &&
748
- this.autoScroll.boundaryElementRef.nativeElement ?
749
- this.autoScroll.boundaryElementRef.nativeElement : null;
815
+ emitZoneAwareEvent(event, normalizedEvent) {
816
+ const targetIdArgs = { dragTarget: this.currentDragTargetElement, dragTargetIndex: this.service.dragIndex };
817
+ const eventProps = {
818
+ dragTarget: this.currentDragTargetElement,
819
+ dragEvent: normalizedEvent,
820
+ dragTargetIndex: this.service.dragIndex,
821
+ dragTargetId: this.dragTargetId(targetIdArgs)
822
+ };
823
+ if (this.hint && isPresent(this.hintElem)) {
824
+ eventProps.hintElement = this.hintElem;
825
+ }
826
+ let eventArgs;
827
+ switch (event) {
828
+ case 'onDragReady':
829
+ eventArgs = new DragTargetDragReadyEvent(eventProps);
830
+ break;
831
+ case 'onPress':
832
+ eventArgs = new DragTargetPressEvent(eventProps);
833
+ break;
834
+ case 'onDragStart':
835
+ eventArgs = new DragTargetDragStartEvent(eventProps);
836
+ break;
837
+ case 'onDrag':
838
+ eventArgs = new DragTargetDragEvent(eventProps);
839
+ break;
840
+ case 'onRelease':
841
+ eventArgs = new DragTargetReleaseEvent(eventProps);
842
+ break;
843
+ case 'onDragEnd':
844
+ eventArgs = new DragTargetDragEndEvent(eventProps);
845
+ break;
846
+ default:
847
+ break;
848
+ }
849
+ this.ngZone.run(() => {
850
+ this[event].emit(eventArgs);
851
+ });
852
+ return eventArgs;
750
853
  }
751
854
  createHint() {
752
- if (!(isDocumentAvailable() && isPresent(this.element))) {
855
+ if (!(isDocumentAvailable() && isPresent(this.wrapper))) {
753
856
  return;
754
857
  }
755
858
  if (isPresent(this.hint) && typeof this.hint === 'object') {
@@ -763,7 +866,7 @@ class DragTargetDirective {
763
866
  else {
764
867
  this.createDefaultHint();
765
868
  }
766
- this.dragTarget.hint = this.hintElem;
869
+ this.currentDragTarget.hint = this.hintElem;
767
870
  if (typeof this.hint === 'object' && isPresent(this.hint.appendTo)) {
768
871
  this.hint.appendTo.element.nativeElement.appendChild(this.hintElem);
769
872
  }
@@ -772,7 +875,7 @@ class DragTargetDirective {
772
875
  }
773
876
  }
774
877
  createDefaultHint() {
775
- this.defaultHint = this.nativeElement.cloneNode(true);
878
+ this.defaultHint = this.currentDragTargetElement.cloneNode(true);
776
879
  if (typeof this.hint === 'object') {
777
880
  if (isPresent(this.hint.hintClass)) {
778
881
  const hintClasses = parseCSSClassNames(this.hint.hintClass);
@@ -789,6 +892,9 @@ class DragTargetDirective {
789
892
  }
790
893
  this.hintComponent.instance.template = this.hintTemplate;
791
894
  this.hintComponent.instance.directive = this;
895
+ this.hintComponent.instance.targetIndex = this.service.dragIndex;
896
+ const targetDataArgs = { dragTarget: this.currentDragTargetElement, dragTargetId: this.service.dragTargetId, dragTargetIndex: this.service.dragIndex };
897
+ this.hintComponent.instance.contextData = this.dragData(targetDataArgs);
792
898
  this.hintComponent.changeDetectorRef.detectChanges();
793
899
  }
794
900
  destroyHint() {
@@ -798,62 +904,95 @@ class DragTargetDirective {
798
904
  this.hintComponent = null;
799
905
  }
800
906
  else {
801
- if (typeof this.hint === 'object' && isPresent(this.hint.appendTo)) {
802
- this.hint.appendTo.element.nativeElement.removeChild(this.defaultHint);
803
- }
804
- else {
805
- document.body.removeChild(this.defaultHint);
806
- }
907
+ document.body.removeChild(this.defaultHint);
807
908
  this.defaultHint = null;
808
909
  }
809
- this.dragTarget.hint = null;
910
+ this.currentDragTarget.hint = null;
810
911
  }
811
- emitZoneAwareEvent(event, normalizedEvent) {
812
- const eventProps = {
813
- dragTarget: this.nativeElement,
814
- dragEvent: normalizedEvent
912
+ getDragIndex() {
913
+ return this.allDragTargets.indexOf(this.currentDragTargetElement);
914
+ }
915
+ initializeDragTargets() {
916
+ if (!isPresent(this.allDragTargets)) {
917
+ if (this.previousDragTargets.length > 0) {
918
+ this.clearPreviousTargets();
919
+ }
920
+ return;
921
+ }
922
+ this.allDragTargets.forEach(dragTargetEl => {
923
+ const isDragTargetInitialized = this.service.dragTargets.find(dt => dt.element === dragTargetEl);
924
+ if (!isDragTargetInitialized) {
925
+ this.service.dragTargets.push({
926
+ element: dragTargetEl,
927
+ hint: null,
928
+ onPress: this.handlePress.bind(this),
929
+ onRelease: this.handleRelease.bind(this),
930
+ onDragStart: this.handleDragStart.bind(this),
931
+ onDrag: this.handleDrag.bind(this),
932
+ onDragEnd: this.handleDragEnd.bind(this)
933
+ });
934
+ }
935
+ });
936
+ if (this.previousDragTargets.length > 0) {
937
+ const dragTargetsToRemove = this.previousDragTargets.filter(dt => !this.allDragTargets.includes(dt));
938
+ dragTargetsToRemove.forEach(dragTarget => {
939
+ const idx = this.service.dragTargets.findIndex(serviceDragTarget => serviceDragTarget.element === dragTarget);
940
+ if (idx > -1) {
941
+ this.service.dragTargets.splice(idx, 1);
942
+ }
943
+ });
944
+ }
945
+ this.previousDragTargets = this.allDragTargets;
946
+ this.currentDragTarget = {
947
+ element: null,
948
+ hint: null,
949
+ onPress: this.handlePress.bind(this),
950
+ onRelease: this.handleRelease.bind(this),
951
+ onDragStart: this.handleDragStart.bind(this),
952
+ onDrag: this.handleDrag.bind(this),
953
+ onDragEnd: this.handleDragEnd.bind(this)
815
954
  };
816
- if (this.hint && isPresent(this.hintElem)) {
817
- eventProps.hintElement = this.hintElem;
955
+ this.setCursorStyle();
956
+ }
957
+ isDragHandle(el) {
958
+ return this.dragHandles.some(dh => contains(dh, el, true));
959
+ }
960
+ get isHandleSelectorValid() {
961
+ return isPresent(this.dragHandle) && this.dragHandle !== '';
962
+ }
963
+ setCursorStyle() {
964
+ if (!isDocumentAvailable()) {
965
+ return;
818
966
  }
819
- if (this.dragTargetId && this.dragTargetId !== '') {
820
- eventProps.dragTargetId = this.dragTargetIdResult;
967
+ if (isPresent(this.dragHandle) && this.dragHandle !== '') {
968
+ if (isPresent(this.dragHandles) && this.dragHandles.length > 0) {
969
+ this.dragHandles.forEach(handle => {
970
+ this.renderer.setStyle(handle, 'cursor', 'move');
971
+ });
972
+ }
821
973
  }
822
- let eventArgs;
823
- switch (event) {
824
- case 'onDragReady':
825
- eventArgs = new DragTargetDragReadyEvent(eventProps);
826
- break;
827
- case 'onPress':
828
- eventArgs = new DragTargetPressEvent(eventProps);
829
- break;
830
- case 'onDragStart':
831
- eventArgs = new DragTargetDragStartEvent(eventProps);
832
- break;
833
- case 'onDrag':
834
- eventArgs = new DragTargetDragEvent(eventProps);
835
- break;
836
- case 'onRelease':
837
- eventArgs = new DragTargetReleaseEvent(eventProps);
838
- break;
839
- case 'onDragEnd':
840
- eventArgs = new DragTargetDragEndEvent(eventProps);
841
- break;
842
- default:
843
- break;
974
+ else {
975
+ this.allDragTargets.forEach(target => {
976
+ this.renderer.setStyle(target, 'cursor', 'move');
977
+ });
844
978
  }
845
- this.ngZone.run(() => {
846
- this[event].emit(eventArgs);
847
- });
848
- return eventArgs;
849
979
  }
850
- get dragTargetIdResult() {
851
- if (this.dragTargetId && this.dragTargetId !== '') {
852
- return typeof this.dragTargetId === 'string' ? this.dragTargetId : this.dragTargetId({ dragTarget: this.dragTarget.element, dragTargetIndex: null });
980
+ queryHost(selector) {
981
+ if (isPresent(selector) && selector !== "") {
982
+ return Array.from(this.nativeElement.querySelectorAll(selector));
853
983
  }
854
984
  }
985
+ clearPreviousTargets() {
986
+ this.previousDragTargets.forEach(dragTarget => {
987
+ const idx = this.service.dragTargets.findIndex(serviceDragTarget => serviceDragTarget.element === dragTarget);
988
+ if (idx > -1) {
989
+ this.service.dragTargets.splice(idx, 1);
990
+ }
991
+ });
992
+ this.previousDragTargets = [];
993
+ }
855
994
  performDrag() {
856
- const elem = this.hint ? this.hintElem : this.nativeElement;
995
+ const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
857
996
  if (elem) {
858
997
  const styles = this.getStylesPerElement(elem);
859
998
  setElementStyles(this.renderer, elem, styles);
@@ -867,12 +1006,6 @@ class DragTargetDirective {
867
1006
  else {
868
1007
  position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
869
1008
  }
870
- if (this.restrictByAxis === 'horizontal') {
871
- position.y = 0;
872
- }
873
- else if (this.restrictByAxis === 'vertical') {
874
- position.x = 0;
875
- }
876
1009
  return position;
877
1010
  }
878
1011
  getStylesPerElement(element) {
@@ -895,221 +1028,83 @@ class DragTargetDirective {
895
1028
  }
896
1029
  }
897
1030
  }
898
- DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: DragStateService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
899
- DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hint: "hint", threshold: "threshold", autoScroll: "autoScroll", dragTargetId: "dragTargetId", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis", mode: "mode", dragData: "dragData" }, outputs: { onPress: "onPress", onDragStart: "onDragStart", onDrag: "onDrag", onDragReady: "onDragReady", onRelease: "onRelease", onDragEnd: "onDragEnd" }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetDirective, decorators: [{
1031
+ DragTargetContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetContainerDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1032
+ DragTargetContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragTargetContainerDirective, isStandalone: true, selector: "[kendoDragTargetContainer]", inputs: { hint: "hint", dragTargetFilter: "dragTargetFilter", dragHandle: "dragHandle", dragDelay: "dragDelay", threshold: "threshold", dragTargetId: "dragTargetId", dragData: "dragData", dragDisabled: "dragDisabled", mode: "mode" }, outputs: { onDragReady: "onDragReady", onPress: "onPress", onDragStart: "onDragStart", onDrag: "onDrag", onRelease: "onRelease", onDragEnd: "onDragEnd" }, exportAs: ["kendoDragTargetContainer"], ngImport: i0 });
1033
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetContainerDirective, decorators: [{
901
1034
  type: Directive,
902
1035
  args: [{
903
- selector: '[kendoDragTarget]',
904
- exportAs: 'kendoDragTarget'
1036
+ selector: '[kendoDragTargetContainer]',
1037
+ exportAs: 'kendoDragTargetContainer',
1038
+ standalone: true
905
1039
  }]
906
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: DragStateService }, { type: i0.ViewContainerRef }]; }, propDecorators: { hint: [{
907
- type: Input
908
- }], threshold: [{
1040
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: DragStateService }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hint: [{
909
1041
  type: Input
910
- }], autoScroll: [{
1042
+ }], dragTargetFilter: [{
911
1043
  type: Input
912
- }], dragTargetId: [{
1044
+ }], dragHandle: [{
913
1045
  type: Input
914
1046
  }], dragDelay: [{
915
1047
  type: Input
916
- }], restrictByAxis: [{
1048
+ }], threshold: [{
917
1049
  type: Input
918
- }], mode: [{
1050
+ }], dragTargetId: [{
919
1051
  type: Input
920
1052
  }], dragData: [{
921
1053
  type: Input
1054
+ }], dragDisabled: [{
1055
+ type: Input
1056
+ }], mode: [{
1057
+ type: Input
1058
+ }], onDragReady: [{
1059
+ type: Output
922
1060
  }], onPress: [{
923
1061
  type: Output
924
1062
  }], onDragStart: [{
925
1063
  type: Output
926
1064
  }], onDrag: [{
927
1065
  type: Output
928
- }], onDragReady: [{
929
- type: Output
930
1066
  }], onRelease: [{
931
1067
  type: Output
932
1068
  }], onDragEnd: [{
933
1069
  type: Output
934
- }], dragHandles: [{
935
- type: ContentChildren,
936
- args: [DragHandleDirective]
937
- }] } });
938
-
939
- /**
940
- * Arguments for the drag events of the DropTarget and DropTargetContainer directives.
941
- */
942
- class DropTargetEvent {
943
- /**
944
- * @hidden
945
- */
946
- constructor(args) {
947
- Object.assign(this, args);
948
- }
949
- /**
950
- * Left for backward compatibility for the DropTarget deprecated events.
951
- * @hidden
952
- */
953
- get normalizedEvent() {
954
- return this.dragEvent;
955
- }
956
- /**
957
- * Left for backward compatibility for the DropTarget deprecated events.
958
- * @hidden
959
- */
960
- get hostElement() {
961
- return this.dropTarget;
962
- }
963
- }
964
-
965
- /**
966
- * Represents the Kendo UI DropTarget directive for Angular.
967
- */
968
- class DropTargetDirective {
969
- constructor(service, element, ngZone) {
970
- this.service = service;
971
- this.element = element;
972
- this.ngZone = ngZone;
973
- /**
974
- * Fires when a DragTarget element enters the DropTarget.
975
- */
976
- this.onDragEnter = new EventEmitter();
977
- /**
978
- * Fires when a DragTarget element is being dragged over the DropTarget.
979
- */
980
- this.onDragOver = new EventEmitter();
981
- /**
982
- * Fires when a DragTarget element leaves the DropTarget.
983
- */
984
- this.onDragLeave = new EventEmitter();
985
- /**
986
- * Fires when a DragTarget element is dropped over the DropTarget.
987
- */
988
- this.onDrop = new EventEmitter();
989
- validatePackage(packageMetadata);
990
- }
991
- ngOnInit() {
992
- this.initializeDropTarget();
993
- this.service.dropTargets.push(this.dropTarget);
994
- }
995
- /**
996
- * @hidden
997
- */
998
- handleDragEnter(event) {
999
- if (!this.service.dragTarget) {
1000
- return;
1001
- }
1002
- this.service.dropTarget = this.dropTarget;
1003
- this.emitZoneAwareEvent('onDragEnter', event);
1004
- }
1005
- /**
1006
- * @hidden
1007
- */
1008
- handleDragLeave(event) {
1009
- this.service.dropTarget = null;
1010
- if (!this.service.dragTarget) {
1011
- return;
1012
- }
1013
- this.emitZoneAwareEvent('onDragLeave', event);
1014
- }
1015
- /**
1016
- * @hidden
1017
- */
1018
- handleDragOver(event) {
1019
- if (!this.service.dragTarget) {
1020
- return;
1021
- }
1022
- this.emitZoneAwareEvent('onDragOver', event);
1023
- }
1024
- /**
1025
- * @hidden
1026
- */
1027
- handleDrop(event) {
1028
- this.emitZoneAwareEvent('onDrop', event);
1029
- this.service.dropTarget = null;
1030
- }
1031
- initializeDropTarget() {
1032
- this.dropTarget = {
1033
- element: this.element.nativeElement,
1034
- onDragEnter: this.handleDragEnter.bind(this),
1035
- onDragLeave: this.handleDragLeave.bind(this),
1036
- onDragOver: this.handleDragOver.bind(this),
1037
- onDrop: this.handleDrop.bind(this)
1038
- };
1039
- }
1040
- emitZoneAwareEvent(event, normalizedEvent) {
1041
- const eventProps = {
1042
- dropTarget: this.element.nativeElement,
1043
- dragTarget: this.service.dragTarget?.element,
1044
- dragEvent: normalizedEvent,
1045
- dragData: this.service.dragData
1046
- };
1047
- if (isPresent(this.service.dragTarget?.hint)) {
1048
- eventProps.hintElement = this.service.dragTarget.element;
1049
- }
1050
- const eventArgs = new DropTargetEvent(eventProps);
1051
- this.ngZone.run(() => {
1052
- this[event].emit(eventArgs);
1053
- });
1054
- }
1055
- }
1056
- DropTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetDirective, deps: [{ token: DragStateService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1057
- DropTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropTargetDirective, selector: "[kendoDropTarget]", outputs: { onDragEnter: "onDragEnter", onDragOver: "onDragOver", onDragLeave: "onDragLeave", onDrop: "onDrop" }, exportAs: ["kendoDropTarget"], ngImport: i0 });
1058
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetDirective, decorators: [{
1059
- type: Directive,
1060
- args: [{
1061
- selector: '[kendoDropTarget]',
1062
- exportAs: 'kendoDropTarget'
1063
- }]
1064
- }], ctorParameters: function () { return [{ type: DragStateService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { onDragEnter: [{
1065
- type: Output
1066
- }], onDragOver: [{
1067
- type: Output
1068
- }], onDragLeave: [{
1069
- type: Output
1070
- }], onDrop: [{
1071
- type: Output
1072
1070
  }] } });
1073
1071
 
1074
1072
  let isDragStartPrevented = false;
1075
1073
  let isDragPrevented = false;
1076
1074
  /**
1077
- * Represents the [Kendo UI DragTargetContainer directive for Angular]({% slug api_utils_dragtargetcontainerdirective %}).
1078
- * Used to configure multiple elements as draggable.
1079
- *
1080
- * @example
1081
- * ```ts-no-run
1082
- * <ul kendoDragTargetContainer dragTargetFilter=".my-draggable">
1083
- * <li class="my-draggable">foo</li>
1084
- * </ul>
1085
- * ```
1075
+ * Represents the Kendo UI DragTarget directive for Angular.
1086
1076
  */
1087
- class DragTargetContainerDirective {
1088
- constructor(wrapper, ngZone, renderer, service, viewContainer, cdr) {
1089
- this.wrapper = wrapper;
1090
- this.ngZone = ngZone;
1077
+ class DragTargetDirective {
1078
+ constructor(element, renderer, ngZone, service, viewContainer) {
1079
+ this.element = element;
1091
1080
  this.renderer = renderer;
1081
+ this.ngZone = ngZone;
1092
1082
  this.service = service;
1093
1083
  this.viewContainer = viewContainer;
1094
- this.cdr = cdr;
1095
1084
  /**
1096
- * Defines whether a hint will be used for dragging. By default, the hint is a copy of the current drag target. ([see example]({% slug drag_hint %})).
1085
+ * Defines whether a hint will be used for dragging. By default, the hint is a copy of the drag target. ([see example]({% slug drag_hint %})).
1097
1086
  *
1098
1087
  * @default false
1099
1088
  */
1100
1089
  this.hint = false;
1101
1090
  /**
1102
- * Defines the delay in milliseconds after which the drag will begin ([see example](slug drag_target_container#toc-events)).
1091
+ * The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})). Applicable when `manualDrag` is set to `false`.
1103
1092
  *
1104
1093
  * @default 0
1105
1094
  */
1106
- this.dragDelay = 0;
1095
+ this.threshold = 0;
1107
1096
  /**
1108
- * The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})).
1097
+ * Defines the automatic container scrolling behavior when close to the edge ([see example]({% slug auto_scroll %})).
1098
+ *
1099
+ * @default true
1100
+ */
1101
+ this.autoScroll = true;
1102
+ /**
1103
+ * Defines the delay in milliseconds after which the drag will begin ([see example]({% slug drag_delay %})).
1109
1104
  *
1110
1105
  * @default 0
1111
1106
  */
1112
- this.threshold = 0;
1107
+ this.dragDelay = 0;
1113
1108
  /**
1114
1109
  * Specifies whether the default dragging behavior will be performed or the developer will manually handle the drag action.
1115
1110
  *
@@ -1117,77 +1112,46 @@ class DragTargetContainerDirective {
1117
1112
  */
1118
1113
  this.mode = 'auto';
1119
1114
  /**
1120
- * Fires when a DragTarget's `dragDelay` has passed and the user is able to drag the element.
1121
- */
1122
- this.onDragReady = new EventEmitter();
1123
- /**
1124
- * Fires when the user presses a DragTarget element.
1115
+ * Fires when the user presses the DragTarget element.
1125
1116
  */
1126
1117
  this.onPress = new EventEmitter();
1127
1118
  /**
1128
- * Fires when the dragging of a DragTarget element begins.
1129
- */
1119
+ * Fires when the dragging of the DragTarget element begins.
1120
+ */
1130
1121
  this.onDragStart = new EventEmitter();
1131
1122
  /**
1132
- * Fires while the user drags a DragTarget element.
1123
+ * Fires while the user drags the DragTarget element.
1133
1124
  */
1134
1125
  this.onDrag = new EventEmitter();
1135
1126
  /**
1136
- * Fires when the user releases a DragTarget element after being pressed.
1127
+ * Fires when the DragTarget's `dragDelay` has passed and the user is able to drag the element.
1128
+ */
1129
+ this.onDragReady = new EventEmitter();
1130
+ /**
1131
+ * Fires when the user releases the DragTarget element after being pressed.
1137
1132
  */
1138
1133
  this.onRelease = new EventEmitter();
1139
1134
  /**
1140
- * Fires when the dragging of a DragTarget ends and the element is released.
1135
+ * Fires when the dragging of the DragTarget ends and the element is released.
1141
1136
  */
1142
1137
  this.onDragEnd = new EventEmitter();
1143
- this.currentDragTarget = null;
1144
- this.dragTimeout = null;
1145
- this.pressed = false;
1146
- this.dragStarted = false;
1138
+ this.dragTarget = null;
1139
+ this.domSubscriptions = [];
1147
1140
  this.hintComponent = null;
1148
- this.defaultHint = null;
1149
- this.currentDragTargetElement = null;
1150
- this.scrollableParent = null;
1151
- this.previousDragTargets = [];
1141
+ this.dragStarted = false;
1142
+ this.pressed = false;
1143
+ this.dragTimeout = null;
1152
1144
  this.initialPosition = { x: 0, y: 0 };
1153
1145
  this.position = { x: 0, y: 0 };
1154
- this.positionsMap = new Map();
1155
- this._dragTargetFilter = null;
1156
- this._dragDisabled = false;
1146
+ this.scrollableParent = null;
1147
+ this.defaultHint = null;
1157
1148
  this._dragData = () => null;
1158
- this._dragTargetId = () => null;
1159
1149
  validatePackage(packageMetadata);
1160
1150
  }
1161
1151
  /**
1162
- * Specifies a selector for elements within a container which will be configured as draggable
1163
- * ([see example]({% slug drag_target_container %})). The possible values include any
1164
- * DOM `selector`.
1165
- */
1166
- set dragTargetFilter(value) {
1167
- this._dragTargetFilter = value;
1168
- if (!this.dragDisabled) {
1169
- this.initializeDragTargets();
1170
- }
1171
- }
1172
- get dragTargetFilter() {
1173
- return this._dragTargetFilter;
1174
- }
1175
- /**
1176
- * Defines a unique identifier for each drag target.
1177
- * It exposes the current DragTarget HTML element and its index in the collection of drag targets as arguments.
1178
- */
1179
- set dragTargetId(fn) {
1180
- if (isDevMode && typeof fn !== 'function') {
1181
- throw new Error(`dragTargetId must be a function, but received ${JSON.stringify(fn)}.`);
1182
- }
1183
- this._dragTargetId = fn;
1184
- }
1185
- get dragTargetId() {
1186
- return this._dragTargetId;
1187
- }
1188
- /**
1189
- * Defines a callback function which returns custom data passed to the DropTarget events.
1190
- * It exposes the current DragTarget HTML element, its `dragTargetId` and its index in the collection of drag targets as arguments.
1152
+ * Defines a callback function used for attaching custom data to the dragTarget.
1153
+ * The data will be available in the events of the respective [`DropTarget`]({% slug api_utils_droptargetdirective %}) or [`DropTargetContainer`]({% slug api_utils_droptargetcontainerdirective %}) directives.
1154
+ * The current DragTarget HTML element and its `dragTargetId` will be available as arguments.
1191
1155
  */
1192
1156
  set dragData(fn) {
1193
1157
  if (isDevMode && typeof fn !== 'function') {
@@ -1198,73 +1162,52 @@ class DragTargetContainerDirective {
1198
1162
  get dragData() {
1199
1163
  return this._dragData;
1200
1164
  }
1201
- /**
1202
- * If set to true, the dragging of DragTargets within the container will be disabled.
1203
- *
1204
- * @default false
1205
- */
1206
- set dragDisabled(value) {
1207
- this._dragDisabled = value;
1208
- if (value) {
1209
- this.clearPreviousTargets();
1210
- this.unsubscribe();
1211
- if (isPresent(this.hintElem)) {
1212
- this.destroyHint();
1213
- }
1214
- }
1215
- else {
1216
- if (isPresent(this.wrapper) || isPresent(this.currentDragTarget)) {
1217
- this.subscribe();
1218
- }
1219
- this.initializeDragTargets();
1220
- }
1221
- }
1222
- get dragDisabled() {
1223
- return this._dragDisabled;
1224
- }
1225
- /**
1226
- * Used for notifying the DragTargetContainer that its content has changed.
1227
- */
1228
- notify() {
1229
- this.cdr.detectChanges();
1230
- this.initializeDragTargets();
1231
- }
1232
- get allDragTargets() {
1233
- return this.queryHost(this.dragTargetFilter);
1234
- }
1235
- get dragHandles() {
1236
- return this.isHandleSelectorValid ? this.queryHost(this.dragHandle) : null;
1237
- }
1238
1165
  get hintTemplate() {
1239
1166
  return isPresent(this.hint) && typeof this.hint === 'object' ? this.hint.hintTemplate : null;
1240
1167
  }
1241
- ngAfterViewInit() {
1242
- const isTargetPresent = isPresent(this.wrapper) || isPresent(this.currentDragTarget);
1243
- if (!this.dragDisabled && isTargetPresent) {
1244
- this.subscribe();
1245
- }
1246
- !this.dragDisabled && this.initializeDragTargets();
1168
+ get nativeElement() {
1169
+ return this.element.nativeElement;
1170
+ }
1171
+ get hintElem() {
1172
+ return this.hintTemplate && isPresent(this.hintComponent) ? this.hintComponent.instance.element.nativeElement : this.defaultHint;
1247
1173
  }
1248
1174
  onPointerDown(event) {
1249
- if (isPresent(this.dragHandles) && !this.isDragHandle(event.target)) {
1175
+ if (this.dragHandles.length && !this.isDragHandle(event.target)) {
1250
1176
  return;
1251
1177
  }
1252
- const action = getAction(event, this.currentDragTarget);
1178
+ event.preventDefault();
1179
+ const action = getAction(event, this.dragTarget);
1253
1180
  this.service.handleDragAndDrop(action);
1254
- this.subscribe();
1181
+ this.service.autoScroll = typeof this.autoScroll === 'object' ? this.autoScroll.enabled !== false : this.autoScroll;
1182
+ this.service.scrollableParent = this.getAutoScrollContainer();
1183
+ this.service.autoScrollDirection = typeof this.autoScroll === 'object' ? this.autoScroll.direction : { horizontal: true, vertical: true };
1184
+ this.attachDomHandlers();
1255
1185
  }
1256
1186
  onPointerMove(event) {
1257
1187
  event.preventDefault();
1258
- const action = getAction(event, this.currentDragTarget);
1188
+ const action = getAction(event, this.dragTarget);
1259
1189
  this.service.handleDragAndDrop(action);
1260
1190
  }
1261
- onPointerUp(event) {
1262
- event.preventDefault();
1263
- const action = getAction(event, this.currentDragTarget);
1264
- this.service.handleDragAndDrop(action);
1265
- this.ngZone.runOutsideAngular(() => {
1266
- this.subscribe();
1267
- });
1191
+ onPointerUp(event) {
1192
+ event.preventDefault();
1193
+ const action = getAction(event, this.dragTarget);
1194
+ this.service.handleDragAndDrop(action);
1195
+ this.attachDomHandlers();
1196
+ }
1197
+ ngOnInit() {
1198
+ this.initializeDragTarget();
1199
+ }
1200
+ ngAfterContentInit() {
1201
+ if (isPresent(this.element) || isPresent(this.dragTarget)) {
1202
+ this.attachDomHandlers();
1203
+ if (!this.dragHandles.length) {
1204
+ this.renderer.setStyle(this.nativeElement, 'cursor', 'move');
1205
+ }
1206
+ }
1207
+ this.service.dragTargets.push(this.dragTarget);
1208
+ }
1209
+ ngOnDestroy() {
1210
+ this.domSubscriptions.forEach(subscription => subscription());
1268
1211
  }
1269
1212
  handlePress(event) {
1270
1213
  if (this.dragDelay > 0) {
@@ -1276,12 +1219,7 @@ class DragTargetContainerDirective {
1276
1219
  else {
1277
1220
  this.pressed = true;
1278
1221
  }
1279
- event.originalEvent.preventDefault();
1280
- const eventTarget = event.originalEvent.target;
1281
- this.currentDragTargetElement = closestBySelector(eventTarget, this.dragTargetFilter);
1282
- this.currentDragTarget.element = this.currentDragTargetElement;
1283
- this.service.dragIndex = this.getDragIndex();
1284
- this.scrollableParent = this.hintTemplate ? document.body : this.currentDragTargetElement ? getScrollableParent(this.currentDragTargetElement) : null;
1222
+ this.scrollableParent = this.dragTarget.element ? getScrollableParent(this.dragTarget.element) : null;
1285
1223
  this.emitZoneAwareEvent('onPress', event);
1286
1224
  }
1287
1225
  handleDragStart(event) {
@@ -1296,28 +1234,26 @@ class DragTargetContainerDirective {
1296
1234
  if (isDragStartPrevented) {
1297
1235
  return;
1298
1236
  }
1299
- this.position = this.positionsMap.has(this.currentDragTargetElement) ? this.positionsMap.get(this.currentDragTargetElement) : { x: 0, y: 0 };
1300
1237
  if (this.hint) {
1301
1238
  this.createHint();
1302
1239
  if (this.mode === 'auto') {
1303
- this.renderer.setStyle(this.currentDragTargetElement, 'opacity', '0.7');
1240
+ this.renderer.setStyle(this.nativeElement, 'opacity', '0.7');
1304
1241
  }
1242
+ this.initialPosition = { x: event.offsetX, y: event.offsetY };
1305
1243
  }
1306
1244
  else {
1307
1245
  this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
1308
1246
  }
1309
1247
  this.dragStarted = this.threshold === 0;
1310
- this.service.dragTarget = this.currentDragTarget;
1311
- const targetIdArgs = { dragTarget: this.currentDragTargetElement, dragTargetIndex: this.service.dragIndex };
1312
- this.service.dragTargetId = this.dragTargetId(targetIdArgs);
1313
- const targetDataArgs = Object.assign({ dragTargetId: this.service.dragTargetId }, targetIdArgs);
1314
- this.service.dragData = this.dragData(targetDataArgs);
1248
+ this.service.dragTarget = this.dragTarget;
1249
+ this.service.dragTargetDirective = this;
1250
+ this.service.dragData = this.dragData({ dragTarget: this.dragTarget.element, dragTargetId: this.dragTargetIdResult, dragTargetIndex: null });
1315
1251
  }
1316
1252
  handleDrag(event) {
1317
1253
  if (!this.pressed || isDragStartPrevented) {
1318
1254
  return;
1319
1255
  }
1320
- const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
1256
+ const elem = this.hint ? this.hintElem : this.nativeElement;
1321
1257
  this.position = this.calculatePosition(elem, event);
1322
1258
  const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
1323
1259
  if (!this.dragStarted && thresholdNotReached) {
@@ -1338,9 +1274,6 @@ class DragTargetContainerDirective {
1338
1274
  }
1339
1275
  }
1340
1276
  handleRelease(event) {
1341
- if (this.dragStarted) {
1342
- this.positionsMap.set(this.currentDragTargetElement, this.position);
1343
- }
1344
1277
  if (this.dragTimeout) {
1345
1278
  clearTimeout(this.dragTimeout);
1346
1279
  this.dragTimeout = null;
@@ -1349,129 +1282,93 @@ class DragTargetContainerDirective {
1349
1282
  this.emitZoneAwareEvent('onRelease', event);
1350
1283
  }
1351
1284
  handleDragEnd(event) {
1352
- if (!this.dragStarted) {
1353
- return;
1354
- }
1355
1285
  if (this.mode === 'auto') {
1356
1286
  const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget?.element, this.service.dragTarget?.element, true);
1357
- const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
1287
+ const elem = this.hint ? this.hintElem : this.nativeElement;
1358
1288
  if (isDroppedOverParentTarget || this.service.dropTargets.length > 0 && isPresent(elem)) {
1359
1289
  this.renderer.removeStyle(elem, 'transform');
1360
1290
  setElementStyles(this.renderer, elem, {
1361
1291
  transition: dragTargetTransition
1362
1292
  });
1363
- this.positionsMap.delete(this.currentDragTargetElement);
1293
+ this.position = { x: 0, y: 0 };
1364
1294
  }
1365
1295
  }
1366
1296
  if (this.hint && isPresent(this.hintElem)) {
1367
1297
  this.destroyHint();
1368
1298
  if (this.mode === 'auto') {
1369
- this.renderer.removeStyle(this.currentDragTargetElement, 'opacity');
1299
+ this.renderer.removeStyle(this.nativeElement, 'opacity');
1370
1300
  }
1371
1301
  }
1372
1302
  this.service.dragTarget = null;
1373
- this.service.dragIndex = null;
1374
- this.currentDragTarget.element = null;
1375
- this.emitZoneAwareEvent('onDragEnd', event);
1376
- if (isDragStartPrevented || isDragPrevented) {
1303
+ this.service.dragTargetDirective = null;
1304
+ if (!this.dragStarted || isDragStartPrevented || isDragPrevented) {
1377
1305
  return;
1378
1306
  }
1307
+ this.emitZoneAwareEvent('onDragEnd', event);
1379
1308
  this.dragStarted = false;
1380
1309
  }
1381
- get nativeElement() {
1382
- return this.wrapper.nativeElement;
1383
- }
1384
- get hintElem() {
1385
- return this.hintTemplate && isPresent(this.hintComponent) ? this.hintComponent.instance.element.nativeElement : this.defaultHint;
1386
- }
1387
- unsubscribe() {
1388
- if (this.pointerDownSubscription) {
1389
- this.pointerDownSubscription.unsubscribe();
1390
- }
1391
- if (this.pointerMoveSubscription) {
1392
- this.pointerMoveSubscription.unsubscribe();
1393
- }
1394
- if (this.pointerUpSubscription) {
1395
- this.pointerUpSubscription.unsubscribe();
1396
- }
1397
- if (this.scrollSubscription) {
1398
- this.scrollSubscription.unsubscribe();
1399
- }
1310
+ initializeDragTarget() {
1311
+ this.dragTarget = {
1312
+ element: this.nativeElement,
1313
+ hint: null,
1314
+ onPress: this.handlePress.bind(this),
1315
+ onRelease: this.handleRelease.bind(this),
1316
+ onDragStart: this.handleDragStart.bind(this),
1317
+ onDrag: this.handleDrag.bind(this),
1318
+ onDragEnd: this.handleDragEnd.bind(this)
1319
+ };
1400
1320
  }
1401
- subscribe() {
1321
+ attachDomHandlers() {
1402
1322
  this.ngZone.runOutsideAngular(() => {
1403
- this.unsubscribe();
1404
- if (!(isDocumentAvailable() && isPresent(this.wrapper))) {
1323
+ if (this.domSubscriptions.length > 0) {
1324
+ this.domSubscriptions.forEach(subscription => subscription());
1325
+ }
1326
+ if (!(isDocumentAvailable() && isPresent(this.element))) {
1405
1327
  return;
1406
1328
  }
1407
- const element = this.nativeElement;
1408
1329
  if (this.service.pressed) {
1409
- const pointerMoveStreams = allPointerMoveEvents.map((ev) => fromEvent(document, ev));
1410
- const pointerUpStreams = allPointerUpEvents.map((ev) => fromEvent(document, ev));
1411
- this.pointerMoveSubscription = merge(...pointerMoveStreams)
1412
- .pipe(filter(() => this.dragTargetFilter !== ''))
1413
- .subscribe(e => this.onPointerMove(e));
1414
- this.pointerUpSubscription = merge(...pointerUpStreams)
1415
- .subscribe(e => this.onPointerUp(e));
1330
+ this.onPointerMove = this.onPointerMove.bind(this);
1331
+ this.onPointerUp = this.onPointerUp.bind(this);
1332
+ this.domSubscriptions = [
1333
+ this.renderer.listen(document, 'pointermove', this.onPointerMove),
1334
+ this.renderer.listen(document, 'mousemove', this.onPointerMove),
1335
+ this.renderer.listen(document, 'touchmove', this.onPointerMove),
1336
+ this.renderer.listen(document, 'pointerup', this.onPointerUp),
1337
+ this.renderer.listen(document, 'pointercancel', this.onPointerUp),
1338
+ this.renderer.listen(document, 'mouseup', this.onPointerUp),
1339
+ this.renderer.listen(document, 'contextmenu', this.onPointerUp),
1340
+ this.renderer.listen(document, 'touchend', this.onPointerUp),
1341
+ this.renderer.listen(document, 'touchcancel', this.onPointerUp)
1342
+ ];
1416
1343
  if (isPresent(this.scrollableParent)) {
1417
- this.scrollSubscription = fromEvent(this.scrollableParent, 'scroll')
1418
- .subscribe(e => this.onPointerMove(e));
1344
+ if (this.scrollableParent === document.getElementsByTagName('html')[0]) {
1345
+ this.scrollableParent = window;
1346
+ }
1347
+ this.domSubscriptions.push(this.renderer.listen(this.scrollableParent, 'scroll', this.onPointerMove));
1419
1348
  }
1420
1349
  }
1421
1350
  else {
1422
- const pointerDownStreams = allPointerDownEvents.map((ev) => fromEvent(element, ev));
1423
- this.pointerDownSubscription = merge(...pointerDownStreams)
1424
- .pipe(filter(() => this.dragTargetFilter !== ''))
1425
- .subscribe((e) => {
1426
- const filterElement = closestBySelector(e.target, this.isHandleSelectorValid ? this.dragHandle : this.dragTargetFilter);
1427
- if (filterElement) {
1428
- this.onPointerDown(e);
1429
- }
1430
- });
1351
+ this.onPointerDown = this.onPointerDown.bind(this);
1352
+ const element = this.nativeElement;
1353
+ this.domSubscriptions = [
1354
+ this.renderer.listen(element, 'pointerdown', this.onPointerDown),
1355
+ this.renderer.listen(element, 'mousedown', this.onPointerDown),
1356
+ this.renderer.listen(element, 'touchstart', this.onPointerDown)
1357
+ ];
1431
1358
  }
1432
1359
  });
1433
1360
  }
1434
- emitZoneAwareEvent(event, normalizedEvent) {
1435
- const targetIdArgs = { dragTarget: this.currentDragTargetElement, dragTargetIndex: this.service.dragIndex };
1436
- const eventProps = {
1437
- dragTarget: this.currentDragTargetElement,
1438
- dragEvent: normalizedEvent,
1439
- dragTargetIndex: this.service.dragIndex,
1440
- dragTargetId: this.dragTargetId(targetIdArgs)
1441
- };
1442
- if (this.hint && isPresent(this.hintElem)) {
1443
- eventProps.hintElement = this.hintElem;
1444
- }
1445
- let eventArgs;
1446
- switch (event) {
1447
- case 'onDragReady':
1448
- eventArgs = new DragTargetDragReadyEvent(eventProps);
1449
- break;
1450
- case 'onPress':
1451
- eventArgs = new DragTargetPressEvent(eventProps);
1452
- break;
1453
- case 'onDragStart':
1454
- eventArgs = new DragTargetDragStartEvent(eventProps);
1455
- break;
1456
- case 'onDrag':
1457
- eventArgs = new DragTargetDragEvent(eventProps);
1458
- break;
1459
- case 'onRelease':
1460
- eventArgs = new DragTargetReleaseEvent(eventProps);
1461
- break;
1462
- case 'onDragEnd':
1463
- eventArgs = new DragTargetDragEndEvent(eventProps);
1464
- break;
1465
- default:
1466
- break;
1467
- }
1468
- this.ngZone.run(() => {
1469
- this[event].emit(eventArgs);
1470
- });
1471
- return eventArgs;
1361
+ isDragHandle(el) {
1362
+ return this.dragHandles.toArray().some(dh => contains(dh.element.nativeElement, el, true));
1363
+ }
1364
+ getAutoScrollContainer() {
1365
+ return typeof this.autoScroll === 'object' &&
1366
+ this.autoScroll.boundaryElementRef &&
1367
+ this.autoScroll.boundaryElementRef.nativeElement ?
1368
+ this.autoScroll.boundaryElementRef.nativeElement : null;
1472
1369
  }
1473
1370
  createHint() {
1474
- if (!(isDocumentAvailable() && isPresent(this.wrapper))) {
1371
+ if (!(isDocumentAvailable() && isPresent(this.element))) {
1475
1372
  return;
1476
1373
  }
1477
1374
  if (isPresent(this.hint) && typeof this.hint === 'object') {
@@ -1485,7 +1382,7 @@ class DragTargetContainerDirective {
1485
1382
  else {
1486
1383
  this.createDefaultHint();
1487
1384
  }
1488
- this.currentDragTarget.hint = this.hintElem;
1385
+ this.dragTarget.hint = this.hintElem;
1489
1386
  if (typeof this.hint === 'object' && isPresent(this.hint.appendTo)) {
1490
1387
  this.hint.appendTo.element.nativeElement.appendChild(this.hintElem);
1491
1388
  }
@@ -1494,7 +1391,7 @@ class DragTargetContainerDirective {
1494
1391
  }
1495
1392
  }
1496
1393
  createDefaultHint() {
1497
- this.defaultHint = this.currentDragTargetElement.cloneNode(true);
1394
+ this.defaultHint = this.nativeElement.cloneNode(true);
1498
1395
  if (typeof this.hint === 'object') {
1499
1396
  if (isPresent(this.hint.hintClass)) {
1500
1397
  const hintClasses = parseCSSClassNames(this.hint.hintClass);
@@ -1511,9 +1408,6 @@ class DragTargetContainerDirective {
1511
1408
  }
1512
1409
  this.hintComponent.instance.template = this.hintTemplate;
1513
1410
  this.hintComponent.instance.directive = this;
1514
- this.hintComponent.instance.targetIndex = this.service.dragIndex;
1515
- const targetDataArgs = { dragTarget: this.currentDragTargetElement, dragTargetId: this.service.dragTargetId, dragTargetIndex: this.service.dragIndex };
1516
- this.hintComponent.instance.contextData = this.dragData(targetDataArgs);
1517
1411
  this.hintComponent.changeDetectorRef.detectChanges();
1518
1412
  }
1519
1413
  destroyHint() {
@@ -1523,95 +1417,62 @@ class DragTargetContainerDirective {
1523
1417
  this.hintComponent = null;
1524
1418
  }
1525
1419
  else {
1526
- document.body.removeChild(this.defaultHint);
1527
- this.defaultHint = null;
1528
- }
1529
- this.currentDragTarget.hint = null;
1530
- }
1531
- getDragIndex() {
1532
- return this.allDragTargets.indexOf(this.currentDragTargetElement);
1533
- }
1534
- initializeDragTargets() {
1535
- if (!isPresent(this.allDragTargets)) {
1536
- if (this.previousDragTargets.length > 0) {
1537
- this.clearPreviousTargets();
1420
+ if (typeof this.hint === 'object' && isPresent(this.hint.appendTo)) {
1421
+ this.hint.appendTo.element.nativeElement.removeChild(this.defaultHint);
1538
1422
  }
1539
- return;
1540
- }
1541
- this.allDragTargets.forEach(dragTargetEl => {
1542
- const isDragTargetInitialized = this.service.dragTargets.find(dt => dt.element === dragTargetEl);
1543
- if (!isDragTargetInitialized) {
1544
- this.service.dragTargets.push({
1545
- element: dragTargetEl,
1546
- hint: null,
1547
- onPress: this.handlePress.bind(this),
1548
- onRelease: this.handleRelease.bind(this),
1549
- onDragStart: this.handleDragStart.bind(this),
1550
- onDrag: this.handleDrag.bind(this),
1551
- onDragEnd: this.handleDragEnd.bind(this)
1552
- });
1423
+ else {
1424
+ document.body.removeChild(this.defaultHint);
1553
1425
  }
1554
- });
1555
- if (this.previousDragTargets.length > 0) {
1556
- const dragTargetsToRemove = this.previousDragTargets.filter(dt => !this.allDragTargets.includes(dt));
1557
- dragTargetsToRemove.forEach(dragTarget => {
1558
- const idx = this.service.dragTargets.findIndex(serviceDragTarget => serviceDragTarget.element === dragTarget);
1559
- if (idx > -1) {
1560
- this.service.dragTargets.splice(idx, 1);
1561
- }
1562
- });
1426
+ this.defaultHint = null;
1563
1427
  }
1564
- this.previousDragTargets = this.allDragTargets;
1565
- this.currentDragTarget = {
1566
- element: null,
1567
- hint: null,
1568
- onPress: this.handlePress.bind(this),
1569
- onRelease: this.handleRelease.bind(this),
1570
- onDragStart: this.handleDragStart.bind(this),
1571
- onDrag: this.handleDrag.bind(this),
1572
- onDragEnd: this.handleDragEnd.bind(this)
1573
- };
1574
- this.setCursorStyle();
1575
- }
1576
- isDragHandle(el) {
1577
- return this.dragHandles.some(dh => contains(dh, el, true));
1578
- }
1579
- get isHandleSelectorValid() {
1580
- return isPresent(this.dragHandle) && this.dragHandle !== '';
1428
+ this.dragTarget.hint = null;
1581
1429
  }
1582
- setCursorStyle() {
1583
- if (!isDocumentAvailable()) {
1584
- return;
1585
- }
1586
- if (isPresent(this.dragHandle) && this.dragHandle !== '') {
1587
- if (isPresent(this.dragHandles) && this.dragHandles.length > 0) {
1588
- this.dragHandles.forEach(handle => {
1589
- this.renderer.setStyle(handle, 'cursor', 'move');
1590
- });
1591
- }
1430
+ emitZoneAwareEvent(event, normalizedEvent) {
1431
+ const eventProps = {
1432
+ dragTarget: this.nativeElement,
1433
+ dragEvent: normalizedEvent
1434
+ };
1435
+ if (this.hint && isPresent(this.hintElem)) {
1436
+ eventProps.hintElement = this.hintElem;
1592
1437
  }
1593
- else {
1594
- this.allDragTargets.forEach(target => {
1595
- this.renderer.setStyle(target, 'cursor', 'move');
1596
- });
1438
+ if (this.dragTargetId && this.dragTargetId !== '') {
1439
+ eventProps.dragTargetId = this.dragTargetIdResult;
1597
1440
  }
1598
- }
1599
- queryHost(selector) {
1600
- if (isPresent(selector) && selector !== "") {
1601
- return Array.from(this.nativeElement.querySelectorAll(selector));
1441
+ let eventArgs;
1442
+ switch (event) {
1443
+ case 'onDragReady':
1444
+ eventArgs = new DragTargetDragReadyEvent(eventProps);
1445
+ break;
1446
+ case 'onPress':
1447
+ eventArgs = new DragTargetPressEvent(eventProps);
1448
+ break;
1449
+ case 'onDragStart':
1450
+ eventArgs = new DragTargetDragStartEvent(eventProps);
1451
+ break;
1452
+ case 'onDrag':
1453
+ eventArgs = new DragTargetDragEvent(eventProps);
1454
+ break;
1455
+ case 'onRelease':
1456
+ eventArgs = new DragTargetReleaseEvent(eventProps);
1457
+ break;
1458
+ case 'onDragEnd':
1459
+ eventArgs = new DragTargetDragEndEvent(eventProps);
1460
+ break;
1461
+ default:
1462
+ break;
1602
1463
  }
1603
- }
1604
- clearPreviousTargets() {
1605
- this.previousDragTargets.forEach(dragTarget => {
1606
- const idx = this.service.dragTargets.findIndex(serviceDragTarget => serviceDragTarget.element === dragTarget);
1607
- if (idx > -1) {
1608
- this.service.dragTargets.splice(idx, 1);
1609
- }
1464
+ this.ngZone.run(() => {
1465
+ this[event].emit(eventArgs);
1610
1466
  });
1611
- this.previousDragTargets = [];
1467
+ return eventArgs;
1468
+ }
1469
+ get dragTargetIdResult() {
1470
+ if (this.dragTargetId && this.dragTargetId !== '') {
1471
+ return typeof this.dragTargetId === 'string' ? this.dragTargetId : this.dragTargetId({ dragTarget: this.dragTarget.element, dragTargetIndex: null });
1472
+ }
1612
1473
  }
1613
1474
  performDrag() {
1614
- const elem = this.hint ? this.hintElem : this.currentDragTargetElement;
1475
+ const elem = this.hint ? this.hintElem : this.nativeElement;
1615
1476
  if (elem) {
1616
1477
  const styles = this.getStylesPerElement(elem);
1617
1478
  setElementStyles(this.renderer, elem, styles);
@@ -1625,6 +1486,12 @@ class DragTargetContainerDirective {
1625
1486
  else {
1626
1487
  position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
1627
1488
  }
1489
+ if (this.restrictByAxis === 'horizontal') {
1490
+ position.y = 0;
1491
+ }
1492
+ else if (this.restrictByAxis === 'vertical') {
1493
+ position.x = 0;
1494
+ }
1628
1495
  return position;
1629
1496
  }
1630
1497
  getStylesPerElement(element) {
@@ -1647,46 +1514,74 @@ class DragTargetContainerDirective {
1647
1514
  }
1648
1515
  }
1649
1516
  }
1650
- DragTargetContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetContainerDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1651
- DragTargetContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragTargetContainerDirective, selector: "[kendoDragTargetContainer]", inputs: { hint: "hint", dragTargetFilter: "dragTargetFilter", dragHandle: "dragHandle", dragDelay: "dragDelay", threshold: "threshold", dragTargetId: "dragTargetId", dragData: "dragData", dragDisabled: "dragDisabled", mode: "mode" }, outputs: { onDragReady: "onDragReady", onPress: "onPress", onDragStart: "onDragStart", onDrag: "onDrag", onRelease: "onRelease", onDragEnd: "onDragEnd" }, exportAs: ["kendoDragTargetContainer"], ngImport: i0 });
1652
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetContainerDirective, decorators: [{
1517
+ DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: DragStateService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1518
+ DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragTargetDirective, isStandalone: true, selector: "[kendoDragTarget]", inputs: { hint: "hint", threshold: "threshold", autoScroll: "autoScroll", dragTargetId: "dragTargetId", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis", mode: "mode", dragData: "dragData" }, outputs: { onPress: "onPress", onDragStart: "onDragStart", onDrag: "onDrag", onDragReady: "onDragReady", onRelease: "onRelease", onDragEnd: "onDragEnd" }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
1519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragTargetDirective, decorators: [{
1653
1520
  type: Directive,
1654
1521
  args: [{
1655
- selector: '[kendoDragTargetContainer]',
1656
- exportAs: 'kendoDragTargetContainer'
1522
+ selector: '[kendoDragTarget]',
1523
+ exportAs: 'kendoDragTarget',
1524
+ standalone: true
1657
1525
  }]
1658
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: DragStateService }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hint: [{
1659
- type: Input
1660
- }], dragTargetFilter: [{
1661
- type: Input
1662
- }], dragHandle: [{
1663
- type: Input
1664
- }], dragDelay: [{
1526
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: DragStateService }, { type: i0.ViewContainerRef }]; }, propDecorators: { hint: [{
1665
1527
  type: Input
1666
1528
  }], threshold: [{
1667
1529
  type: Input
1530
+ }], autoScroll: [{
1531
+ type: Input
1668
1532
  }], dragTargetId: [{
1669
1533
  type: Input
1670
- }], dragData: [{
1534
+ }], dragDelay: [{
1671
1535
  type: Input
1672
- }], dragDisabled: [{
1536
+ }], restrictByAxis: [{
1673
1537
  type: Input
1674
1538
  }], mode: [{
1675
1539
  type: Input
1676
- }], onDragReady: [{
1677
- type: Output
1540
+ }], dragData: [{
1541
+ type: Input
1678
1542
  }], onPress: [{
1679
1543
  type: Output
1680
1544
  }], onDragStart: [{
1681
1545
  type: Output
1682
1546
  }], onDrag: [{
1683
1547
  type: Output
1548
+ }], onDragReady: [{
1549
+ type: Output
1684
1550
  }], onRelease: [{
1685
1551
  type: Output
1686
1552
  }], onDragEnd: [{
1687
1553
  type: Output
1554
+ }], dragHandles: [{
1555
+ type: ContentChildren,
1556
+ args: [DragHandleDirective]
1688
1557
  }] } });
1689
1558
 
1559
+ /**
1560
+ * Arguments for the drag events of the DropTarget and DropTargetContainer directives.
1561
+ */
1562
+ class DropTargetEvent {
1563
+ /**
1564
+ * @hidden
1565
+ */
1566
+ constructor(args) {
1567
+ Object.assign(this, args);
1568
+ }
1569
+ /**
1570
+ * Left for backward compatibility for the DropTarget deprecated events.
1571
+ * @hidden
1572
+ */
1573
+ get normalizedEvent() {
1574
+ return this.dragEvent;
1575
+ }
1576
+ /**
1577
+ * Left for backward compatibility for the DropTarget deprecated events.
1578
+ * @hidden
1579
+ */
1580
+ get hostElement() {
1581
+ return this.dropTarget;
1582
+ }
1583
+ }
1584
+
1690
1585
  /**
1691
1586
  * Represents the [Kendo UI DropTargetContainer directive for Angular]({% slug api_utils_droptargetcontainerdirective %}).
1692
1587
  * Used to configure multiple elements as drop targets.
@@ -1884,12 +1779,13 @@ class DropTargetContainerDirective {
1884
1779
  }
1885
1780
  }
1886
1781
  DropTargetContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetContainerDirective, deps: [{ token: DragStateService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1887
- DropTargetContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropTargetContainerDirective, selector: "[kendoDropTargetContainer]", inputs: { dropTargetFilter: "dropTargetFilter", dropDisabled: "dropDisabled" }, outputs: { onDragEnter: "onDragEnter", onDragOver: "onDragOver", onDragLeave: "onDragLeave", onDrop: "onDrop" }, exportAs: ["kendoDropTargetContainer"], ngImport: i0 });
1782
+ DropTargetContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropTargetContainerDirective, isStandalone: true, selector: "[kendoDropTargetContainer]", inputs: { dropTargetFilter: "dropTargetFilter", dropDisabled: "dropDisabled" }, outputs: { onDragEnter: "onDragEnter", onDragOver: "onDragOver", onDragLeave: "onDragLeave", onDrop: "onDrop" }, exportAs: ["kendoDropTargetContainer"], ngImport: i0 });
1888
1783
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetContainerDirective, decorators: [{
1889
1784
  type: Directive,
1890
1785
  args: [{
1891
1786
  selector: '[kendoDropTargetContainer]',
1892
- exportAs: 'kendoDropTargetContainer'
1787
+ exportAs: 'kendoDropTargetContainer',
1788
+ standalone: true
1893
1789
  }]
1894
1790
  }], ctorParameters: function () { return [{ type: DragStateService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { dropTargetFilter: [{
1895
1791
  type: Input
@@ -1905,7 +1801,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1905
1801
  type: Output
1906
1802
  }] } });
1907
1803
 
1908
- const EXPORTS = [
1804
+ /**
1805
+ * Represents the Kendo UI DropTarget directive for Angular.
1806
+ */
1807
+ class DropTargetDirective {
1808
+ constructor(service, element, ngZone) {
1809
+ this.service = service;
1810
+ this.element = element;
1811
+ this.ngZone = ngZone;
1812
+ /**
1813
+ * Fires when a DragTarget element enters the DropTarget.
1814
+ */
1815
+ this.onDragEnter = new EventEmitter();
1816
+ /**
1817
+ * Fires when a DragTarget element is being dragged over the DropTarget.
1818
+ */
1819
+ this.onDragOver = new EventEmitter();
1820
+ /**
1821
+ * Fires when a DragTarget element leaves the DropTarget.
1822
+ */
1823
+ this.onDragLeave = new EventEmitter();
1824
+ /**
1825
+ * Fires when a DragTarget element is dropped over the DropTarget.
1826
+ */
1827
+ this.onDrop = new EventEmitter();
1828
+ validatePackage(packageMetadata);
1829
+ }
1830
+ ngOnInit() {
1831
+ this.initializeDropTarget();
1832
+ this.service.dropTargets.push(this.dropTarget);
1833
+ }
1834
+ /**
1835
+ * @hidden
1836
+ */
1837
+ handleDragEnter(event) {
1838
+ if (!this.service.dragTarget) {
1839
+ return;
1840
+ }
1841
+ this.service.dropTarget = this.dropTarget;
1842
+ this.emitZoneAwareEvent('onDragEnter', event);
1843
+ }
1844
+ /**
1845
+ * @hidden
1846
+ */
1847
+ handleDragLeave(event) {
1848
+ this.service.dropTarget = null;
1849
+ if (!this.service.dragTarget) {
1850
+ return;
1851
+ }
1852
+ this.emitZoneAwareEvent('onDragLeave', event);
1853
+ }
1854
+ /**
1855
+ * @hidden
1856
+ */
1857
+ handleDragOver(event) {
1858
+ if (!this.service.dragTarget) {
1859
+ return;
1860
+ }
1861
+ this.emitZoneAwareEvent('onDragOver', event);
1862
+ }
1863
+ /**
1864
+ * @hidden
1865
+ */
1866
+ handleDrop(event) {
1867
+ this.emitZoneAwareEvent('onDrop', event);
1868
+ this.service.dropTarget = null;
1869
+ }
1870
+ initializeDropTarget() {
1871
+ this.dropTarget = {
1872
+ element: this.element.nativeElement,
1873
+ onDragEnter: this.handleDragEnter.bind(this),
1874
+ onDragLeave: this.handleDragLeave.bind(this),
1875
+ onDragOver: this.handleDragOver.bind(this),
1876
+ onDrop: this.handleDrop.bind(this)
1877
+ };
1878
+ }
1879
+ emitZoneAwareEvent(event, normalizedEvent) {
1880
+ const eventProps = {
1881
+ dropTarget: this.element.nativeElement,
1882
+ dragTarget: this.service.dragTarget?.element,
1883
+ dragEvent: normalizedEvent,
1884
+ dragData: this.service.dragData
1885
+ };
1886
+ if (isPresent(this.service.dragTarget?.hint)) {
1887
+ eventProps.hintElement = this.service.dragTarget.element;
1888
+ }
1889
+ const eventArgs = new DropTargetEvent(eventProps);
1890
+ this.ngZone.run(() => {
1891
+ this[event].emit(eventArgs);
1892
+ });
1893
+ }
1894
+ }
1895
+ DropTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetDirective, deps: [{ token: DragStateService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1896
+ DropTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropTargetDirective, isStandalone: true, selector: "[kendoDropTarget]", outputs: { onDragEnter: "onDragEnter", onDragOver: "onDragOver", onDragLeave: "onDragLeave", onDrop: "onDrop" }, exportAs: ["kendoDropTarget"], ngImport: i0 });
1897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropTargetDirective, decorators: [{
1898
+ type: Directive,
1899
+ args: [{
1900
+ selector: '[kendoDropTarget]',
1901
+ exportAs: 'kendoDropTarget',
1902
+ standalone: true
1903
+ }]
1904
+ }], ctorParameters: function () { return [{ type: DragStateService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { onDragEnter: [{
1905
+ type: Output
1906
+ }], onDragOver: [{
1907
+ type: Output
1908
+ }], onDragLeave: [{
1909
+ type: Output
1910
+ }], onDrop: [{
1911
+ type: Output
1912
+ }] } });
1913
+
1914
+ /**
1915
+ * Utility array that contains all `Drag and Drop` related components and directives
1916
+ */
1917
+ const KENDO_DRAGANDDROP = [
1909
1918
  DragTargetDirective,
1910
1919
  DragHandleDirective,
1911
1920
  DropTargetDirective,
@@ -1913,15 +1922,24 @@ const EXPORTS = [
1913
1922
  DropTargetContainerDirective,
1914
1923
  HintComponent
1915
1924
  ];
1925
+ /**
1926
+ * Utility array that contains all `@progress/kendo-angular-utils` related components and directives.
1927
+ * > As of now, `KENDO_UTILS` includes only the `KENDO_DRAGANDDROP` utility array and their usage is equivalent.
1928
+ */
1929
+ const KENDO_UTILS = [
1930
+ ...KENDO_DRAGANDDROP
1931
+ ];
1932
+
1933
+ // IMPORTANT: NgModule export kept for backwards compatibility
1916
1934
  /**
1917
1935
  * Represents the [NgModule](link:site.data.urls.angular['ngmodules'])
1918
- * definition for the Drag and Drop directives.
1936
+ * definition for the Utils components.
1919
1937
  *
1920
1938
  * @example
1921
1939
  *
1922
1940
  * ```ts-no-run
1923
- * // Import the DragAndDrop module
1924
- * import { DragAndDropModule } from '@progress/kendo-angular-utils';
1941
+ * // Import the Utils module
1942
+ * import { UtilsModule } from '@progress/kendo-angular-utils';
1925
1943
  *
1926
1944
  * // The browser platform with a compiler
1927
1945
  * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@@ -1934,7 +1952,7 @@ const EXPORTS = [
1934
1952
  * // Define the app module
1935
1953
  * _@NgModule({
1936
1954
  * declarations: [AppComponent], // declare app component
1937
- * imports: [BrowserModule, DragAndDropModule], // import DragAndDropModule module
1955
+ * imports: [BrowserModule, UtilsModule], // import Utils module
1938
1956
  * bootstrap: [AppComponent]
1939
1957
  * })
1940
1958
  * export class AppModule {}
@@ -1944,40 +1962,29 @@ const EXPORTS = [
1944
1962
  *
1945
1963
  * ```
1946
1964
  */
1947
- class DragAndDropModule {
1965
+ class UtilsModule {
1948
1966
  }
1949
- DragAndDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1950
- DragAndDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, declarations: [DragTargetDirective,
1951
- DragHandleDirective,
1952
- DropTargetDirective,
1953
- DragTargetContainerDirective,
1954
- DropTargetContainerDirective,
1955
- HintComponent], imports: [CommonModule], exports: [DragTargetDirective,
1956
- DragHandleDirective,
1957
- DropTargetDirective,
1958
- DragTargetContainerDirective,
1959
- DropTargetContainerDirective,
1960
- HintComponent] });
1961
- DragAndDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, imports: [CommonModule] });
1962
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, decorators: [{
1967
+ UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1968
+ UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, imports: [DragTargetDirective, DragHandleDirective, DropTargetDirective, DragTargetContainerDirective, DropTargetContainerDirective, HintComponent], exports: [DragTargetDirective, DragHandleDirective, DropTargetDirective, DragTargetContainerDirective, DropTargetContainerDirective, HintComponent] });
1969
+ UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, imports: [HintComponent] });
1970
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, decorators: [{
1963
1971
  type: NgModule,
1964
1972
  args: [{
1965
- declarations: [...EXPORTS],
1966
- exports: [...EXPORTS],
1967
- imports: [CommonModule],
1968
- entryComponents: [HintComponent]
1973
+ exports: [...KENDO_UTILS],
1974
+ imports: [...KENDO_UTILS]
1969
1975
  }]
1970
1976
  }] });
1971
1977
 
1978
+ // IMPORTANT: NgModule export kept for backwards compatibility
1972
1979
  /**
1973
1980
  * Represents the [NgModule](link:site.data.urls.angular['ngmodules'])
1974
- * definition for the Utils components.
1981
+ * definition for the Drag and Drop directives.
1975
1982
  *
1976
1983
  * @example
1977
1984
  *
1978
1985
  * ```ts-no-run
1979
- * // Import the Utils module
1980
- * import { UtilsModule } from '@progress/kendo-angular-utils';
1986
+ * // Import the DragAndDrop module
1987
+ * import { DragAndDropModule } from '@progress/kendo-angular-utils';
1981
1988
  *
1982
1989
  * // The browser platform with a compiler
1983
1990
  * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@@ -1990,7 +1997,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1990
1997
  * // Define the app module
1991
1998
  * _@NgModule({
1992
1999
  * declarations: [AppComponent], // declare app component
1993
- * imports: [BrowserModule, UtilsModule], // import Utils module
2000
+ * imports: [BrowserModule, DragAndDropModule], // import DragAndDropModule module
1994
2001
  * bootstrap: [AppComponent]
1995
2002
  * })
1996
2003
  * export class AppModule {}
@@ -2000,15 +2007,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2000
2007
  *
2001
2008
  * ```
2002
2009
  */
2003
- class UtilsModule {
2010
+ class DragAndDropModule {
2004
2011
  }
2005
- UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2006
- UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, exports: [DragAndDropModule] });
2007
- UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, imports: [DragAndDropModule] });
2008
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UtilsModule, decorators: [{
2012
+ DragAndDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2013
+ DragAndDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, imports: [DragTargetDirective, DragHandleDirective, DropTargetDirective, DragTargetContainerDirective, DropTargetContainerDirective, HintComponent], exports: [DragTargetDirective, DragHandleDirective, DropTargetDirective, DragTargetContainerDirective, DropTargetContainerDirective, HintComponent] });
2014
+ DragAndDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, imports: [HintComponent] });
2015
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropModule, decorators: [{
2009
2016
  type: NgModule,
2010
2017
  args: [{
2011
- exports: [DragAndDropModule]
2018
+ exports: [...KENDO_DRAGANDDROP],
2019
+ imports: [...KENDO_DRAGANDDROP],
2020
+ entryComponents: [HintComponent]
2012
2021
  }]
2013
2022
  }] });
2014
2023
 
@@ -2016,5 +2025,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2016
2025
  * Generated bundle index. Do not edit.
2017
2026
  */
2018
2027
 
2019
- export { DragAndDropModule, DragHandleDirective, DragTargetContainerDirective, DragTargetDirective, DragTargetDragEndEvent, DragTargetDragEvent, DragTargetDragReadyEvent, DragTargetDragStartEvent, DragTargetPressEvent, DragTargetReleaseEvent, DropTargetContainerDirective, DropTargetDirective, DropTargetEvent, HintComponent, UtilsModule };
2028
+ export { DragAndDropModule, DragHandleDirective, DragTargetContainerDirective, DragTargetDirective, DragTargetDragEndEvent, DragTargetDragEvent, DragTargetDragReadyEvent, DragTargetDragStartEvent, DragTargetPressEvent, DragTargetReleaseEvent, DropTargetContainerDirective, DropTargetDirective, DropTargetEvent, HintComponent, KENDO_DRAGANDDROP, KENDO_UTILS, UtilsModule };
2020
2029