ngx-virtual-dnd 3.1.3 → 3.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-virtual-dnd",
3
- "version": "3.1.3",
3
+ "version": "3.2.0-alpha.0",
4
4
  "description": "A performant drag-and-drop library for Angular that works seamlessly with virtual scrolling",
5
5
  "keywords": [
6
6
  "angular",
@@ -116,6 +116,31 @@ interface DropEvent {
116
116
  /** Information about where the item is going */
117
117
  destination: DropDestination;
118
118
  }
119
+ /**
120
+ * Event emitted by a droppable each time the placeholder moves within it during a drag,
121
+ * i.e. whenever items are displaced. Useful for haptic feedback on every step.
122
+ *
123
+ * Indexes use the same convention as `DropEvent.destination.index` (the insertion index
124
+ * the item would get if dropped now). Not emitted for the placeholder's initial position
125
+ * at drag start, nor when the placeholder leaves this droppable.
126
+ */
127
+ interface PlaceholderMoveEvent {
128
+ /** Unique identifier for the dragged item */
129
+ draggableId: string;
130
+ /** ID of the droppable container the item originated from */
131
+ sourceDroppableId: string;
132
+ /** ID of the droppable the placeholder moved within */
133
+ droppableId: string;
134
+ /**
135
+ * Previous insertion index in this droppable, or `null` when the placeholder just entered
136
+ * it from elsewhere. For the first move in the source list this is the item's own index.
137
+ */
138
+ previousIndex: number | null;
139
+ /** New insertion index in this droppable */
140
+ currentIndex: number;
141
+ /** Optional user-provided data associated with the dragged item */
142
+ data?: unknown;
143
+ }
119
144
  /**
120
145
  * Event emitted when a drag operation ends (including cancel).
121
146
  */
@@ -311,6 +336,37 @@ interface VdndVirtualViewport {
311
336
  */
312
337
  declare const VDND_VIRTUAL_VIEWPORT: InjectionToken<VdndVirtualViewport>;
313
338
 
339
+ /**
340
+ * Animation settings for drag-and-drop lists.
341
+ */
342
+ interface VdndAnimationConfig {
343
+ /**
344
+ * Duration (ms) of the slide animation played when items are displaced by the
345
+ * placeholder during a drag. `0` disables the animation.
346
+ * @default 200
347
+ */
348
+ shiftDuration?: number;
349
+ /**
350
+ * CSS easing function for the shift animation.
351
+ * @default 'cubic-bezier(0.2, 0, 0, 1)'
352
+ */
353
+ shiftEasing?: string;
354
+ }
355
+ /**
356
+ * Opt-in animation configuration. When provided, items displaced by the placeholder
357
+ * slide into their new position instead of jumping. Resolved through the element
358
+ * injector, so it can be provided app-wide or per component subtree.
359
+ *
360
+ * The animation is skipped when the user prefers reduced motion. Values are read each
361
+ * time an animation starts, so getters can toggle the animation at runtime.
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * providers: [{ provide: VDND_ANIMATION_CONFIG, useValue: { shiftDuration: 200 } }]
366
+ * ```
367
+ */
368
+ declare const VDND_ANIMATION_CONFIG: InjectionToken<VdndAnimationConfig>;
369
+
314
370
  /**
315
371
  * Central service for managing drag-and-drop state.
316
372
  * Uses signals for reactive state management.
@@ -1111,8 +1167,10 @@ declare class VirtualSortableListComponent<T> {
1111
1167
  constrainToContainer: _angular_core.InputSignal<boolean>;
1112
1168
  /** Emits when an item is dropped on this list */
1113
1169
  drop: _angular_core.OutputEmitterRef<DropEvent>;
1170
+ /** Emits each time the placeholder moves within this list (every item displacement) */
1171
+ placeholderMove: _angular_core.OutputEmitterRef<PlaceholderMoveEvent>;
1114
1172
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<VirtualSortableListComponent<any>, never>;
1115
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<VirtualSortableListComponent<any>, "vdnd-sortable-list", never, { "droppableId": { "alias": "droppableId"; "required": true; "isSignal": true; }; "group": { "alias": "group"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": true; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": true; "isSignal": true; }; "dynamicItemHeight": { "alias": "dynamicItemHeight"; "required": false; "isSignal": true; }; "itemIdFn": { "alias": "itemIdFn"; "required": true; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": true; "isSignal": true; }; "trackByFn": { "alias": "trackByFn"; "required": false; "isSignal": true; }; "droppableData": { "alias": "droppableData"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "containerHeight": { "alias": "containerHeight"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "autoScrollEnabled": { "alias": "autoScrollEnabled"; "required": false; "isSignal": true; }; "autoScrollConfig": { "alias": "autoScrollConfig"; "required": false; "isSignal": true; }; "constrainToContainer": { "alias": "constrainToContainer"; "required": false; "isSignal": true; }; }, { "drop": "drop"; }, never, never, true, never>;
1173
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<VirtualSortableListComponent<any>, "vdnd-sortable-list", never, { "droppableId": { "alias": "droppableId"; "required": true; "isSignal": true; }; "group": { "alias": "group"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": true; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": true; "isSignal": true; }; "dynamicItemHeight": { "alias": "dynamicItemHeight"; "required": false; "isSignal": true; }; "itemIdFn": { "alias": "itemIdFn"; "required": true; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": true; "isSignal": true; }; "trackByFn": { "alias": "trackByFn"; "required": false; "isSignal": true; }; "droppableData": { "alias": "droppableData"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "containerHeight": { "alias": "containerHeight"; "required": false; "isSignal": true; }; "overscan": { "alias": "overscan"; "required": false; "isSignal": true; }; "autoScrollEnabled": { "alias": "autoScrollEnabled"; "required": false; "isSignal": true; }; "autoScrollConfig": { "alias": "autoScrollConfig"; "required": false; "isSignal": true; }; "constrainToContainer": { "alias": "constrainToContainer"; "required": false; "isSignal": true; }; }, { "drop": "drop"; "placeholderMove": "placeholderMove"; }, never, never, true, never>;
1116
1174
  }
1117
1175
 
1118
1176
  /**
@@ -1409,6 +1467,11 @@ declare class DroppableDirective implements OnDestroy {
1409
1467
  constrainToContainer: _angular_core.InputSignal<boolean>;
1410
1468
  /** Emits when an item is dropped on this droppable */
1411
1469
  drop: _angular_core.OutputEmitterRef<DropEvent>;
1470
+ /**
1471
+ * Emits each time the placeholder moves within this droppable during a drag
1472
+ * (every item displacement) — e.g. to trigger haptic feedback.
1473
+ */
1474
+ placeholderMove: _angular_core.OutputEmitterRef<PlaceholderMoveEvent>;
1412
1475
  /** Whether this droppable is currently being targeted */
1413
1476
  readonly isActive: _angular_core.Signal<boolean>;
1414
1477
  /** The current placeholder ID when this droppable is active */
@@ -1432,7 +1495,7 @@ declare class DroppableDirective implements OnDestroy {
1432
1495
  */
1433
1496
  getScrollHeight(): number;
1434
1497
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DroppableDirective, never>;
1435
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DroppableDirective, "[vdndDroppable]", never, { "vdndDroppable": { "alias": "vdndDroppable"; "required": true; "isSignal": true; }; "vdndDroppableGroup": { "alias": "vdndDroppableGroup"; "required": false; "isSignal": true; }; "vdndDroppableData": { "alias": "vdndDroppableData"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "autoScrollEnabled": { "alias": "autoScrollEnabled"; "required": false; "isSignal": true; }; "autoScrollConfig": { "alias": "autoScrollConfig"; "required": false; "isSignal": true; }; "constrainToContainer": { "alias": "constrainToContainer"; "required": false; "isSignal": true; }; }, { "drop": "drop"; }, never, never, true, never>;
1498
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DroppableDirective, "[vdndDroppable]", never, { "vdndDroppable": { "alias": "vdndDroppable"; "required": true; "isSignal": true; }; "vdndDroppableGroup": { "alias": "vdndDroppableGroup"; "required": false; "isSignal": true; }; "vdndDroppableData": { "alias": "vdndDroppableData"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "autoScrollEnabled": { "alias": "autoScrollEnabled"; "required": false; "isSignal": true; }; "autoScrollConfig": { "alias": "autoScrollConfig"; "required": false; "isSignal": true; }; "constrainToContainer": { "alias": "constrainToContainer"; "required": false; "isSignal": true; }; }, { "drop": "drop"; "placeholderMove": "placeholderMove"; }, never, never, true, never>;
1436
1499
  }
1437
1500
 
1438
1501
  /**
@@ -1741,5 +1804,5 @@ declare function insertAt<T>(list: T[], item: T, index: number): T[];
1741
1804
  */
1742
1805
  declare function removeAt<T>(list: T[], index: number): T[];
1743
1806
 
1744
- export { AutoScrollService, ContentHeaderDirective, DragPlaceholderComponent, DragPreviewComponent, DragStateService, DraggableDirective, DroppableDirective, DroppableGroupDirective, DynamicHeightStrategy, END_OF_LIST, ElementCloneService, FixedHeightStrategy, INITIAL_DRAG_STATE, KeyboardDragService, OverlayContainerService, PlaceholderComponent, PositionCalculatorService, ScrollableDirective, VDND_GROUP_TOKEN, VDND_SCROLL_CONTAINER, VDND_VIRTUAL_VIEWPORT, VirtualContentComponent, VirtualForDirective, VirtualScrollContainerComponent, VirtualSortableListComponent, VirtualViewportComponent, applyMove, insertAt, isNoOpDrop, moveItem, removeAt, reorderItems };
1745
- export type { AutoScrollConfig, CursorPosition, DragEndEvent, DragPreviewContext, DragStartEvent, DragState, DraggedItem, DropDestination, DropEvent, DropSource, GrabOffset, PlaceholderContext, VdndGroupContext, VdndScrollContainer, VdndVirtualViewport, VirtualForContext, VirtualScrollItemContext, VirtualScrollStrategy };
1807
+ export { AutoScrollService, ContentHeaderDirective, DragPlaceholderComponent, DragPreviewComponent, DragStateService, DraggableDirective, DroppableDirective, DroppableGroupDirective, DynamicHeightStrategy, END_OF_LIST, ElementCloneService, FixedHeightStrategy, INITIAL_DRAG_STATE, KeyboardDragService, OverlayContainerService, PlaceholderComponent, PositionCalculatorService, ScrollableDirective, VDND_ANIMATION_CONFIG, VDND_GROUP_TOKEN, VDND_SCROLL_CONTAINER, VDND_VIRTUAL_VIEWPORT, VirtualContentComponent, VirtualForDirective, VirtualScrollContainerComponent, VirtualSortableListComponent, VirtualViewportComponent, applyMove, insertAt, isNoOpDrop, moveItem, removeAt, reorderItems };
1808
+ export type { AutoScrollConfig, CursorPosition, DragEndEvent, DragPreviewContext, DragStartEvent, DragState, DraggedItem, DropDestination, DropEvent, DropSource, GrabOffset, PlaceholderContext, PlaceholderMoveEvent, VdndAnimationConfig, VdndGroupContext, VdndScrollContainer, VdndVirtualViewport, VirtualForContext, VirtualScrollItemContext, VirtualScrollStrategy };