@progress/kendo-angular-utils 16.5.0 → 16.6.0-develop.2

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