ngx-virtual-dnd 3.1.3 → 3.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -481
- package/fesm2022/ngx-virtual-dnd.mjs +464 -57
- package/fesm2022/ngx-virtual-dnd.mjs.map +1 -1
- package/package.json +2 -2
- package/types/ngx-virtual-dnd.d.ts +78 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-virtual-dnd",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.0-alpha.1",
|
|
4
4
|
"description": "A performant drag-and-drop library for Angular that works seamlessly with virtual scrolling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"type": "git",
|
|
22
22
|
"url": "git+https://github.com/gultyayev/ngx-virtual-dnd.git"
|
|
23
23
|
},
|
|
24
|
-
"homepage": "https://github.
|
|
24
|
+
"homepage": "https://gultyayev.github.io/ngx-virtual-dnd/",
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/gultyayev/ngx-virtual-dnd/issues"
|
|
27
27
|
},
|
|
@@ -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.
|
|
@@ -692,6 +748,17 @@ declare class KeyboardDragService {
|
|
|
692
748
|
* The droppable registry is managed externally.
|
|
693
749
|
*/
|
|
694
750
|
moveToDroppable(droppableId: string, targetIndex: number, totalItemCount: number): void;
|
|
751
|
+
/**
|
|
752
|
+
* Register the callback that scrolls a droppable's placeholder into view. It runs
|
|
753
|
+
* synchronously on every keyboard move into or within that droppable, so a drop that
|
|
754
|
+
* follows before the next render still lands inside the rendered range.
|
|
755
|
+
*/
|
|
756
|
+
registerRevealer(droppableId: string, reveal: () => void): void;
|
|
757
|
+
/**
|
|
758
|
+
* Unregister a droppable's reveal callback. Ignored if another callback has since been
|
|
759
|
+
* registered under the same ID.
|
|
760
|
+
*/
|
|
761
|
+
unregisterRevealer(droppableId: string, reveal: () => void): void;
|
|
695
762
|
/**
|
|
696
763
|
* Complete the keyboard drag (Space or Enter to drop).
|
|
697
764
|
*/
|
|
@@ -1111,8 +1178,10 @@ declare class VirtualSortableListComponent<T> {
|
|
|
1111
1178
|
constrainToContainer: _angular_core.InputSignal<boolean>;
|
|
1112
1179
|
/** Emits when an item is dropped on this list */
|
|
1113
1180
|
drop: _angular_core.OutputEmitterRef<DropEvent>;
|
|
1181
|
+
/** Emits each time the placeholder moves within this list (every item displacement) */
|
|
1182
|
+
placeholderMove: _angular_core.OutputEmitterRef<PlaceholderMoveEvent>;
|
|
1114
1183
|
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>;
|
|
1184
|
+
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
1185
|
}
|
|
1117
1186
|
|
|
1118
1187
|
/**
|
|
@@ -1409,6 +1478,11 @@ declare class DroppableDirective implements OnDestroy {
|
|
|
1409
1478
|
constrainToContainer: _angular_core.InputSignal<boolean>;
|
|
1410
1479
|
/** Emits when an item is dropped on this droppable */
|
|
1411
1480
|
drop: _angular_core.OutputEmitterRef<DropEvent>;
|
|
1481
|
+
/**
|
|
1482
|
+
* Emits each time the placeholder moves within this droppable during a drag
|
|
1483
|
+
* (every item displacement) — e.g. to trigger haptic feedback.
|
|
1484
|
+
*/
|
|
1485
|
+
placeholderMove: _angular_core.OutputEmitterRef<PlaceholderMoveEvent>;
|
|
1412
1486
|
/** Whether this droppable is currently being targeted */
|
|
1413
1487
|
readonly isActive: _angular_core.Signal<boolean>;
|
|
1414
1488
|
/** The current placeholder ID when this droppable is active */
|
|
@@ -1432,7 +1506,7 @@ declare class DroppableDirective implements OnDestroy {
|
|
|
1432
1506
|
*/
|
|
1433
1507
|
getScrollHeight(): number;
|
|
1434
1508
|
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>;
|
|
1509
|
+
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
1510
|
}
|
|
1437
1511
|
|
|
1438
1512
|
/**
|
|
@@ -1741,5 +1815,5 @@ declare function insertAt<T>(list: T[], item: T, index: number): T[];
|
|
|
1741
1815
|
*/
|
|
1742
1816
|
declare function removeAt<T>(list: T[], index: number): T[];
|
|
1743
1817
|
|
|
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 };
|
|
1818
|
+
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 };
|
|
1819
|
+
export type { AutoScrollConfig, CursorPosition, DragEndEvent, DragPreviewContext, DragStartEvent, DragState, DraggedItem, DropDestination, DropEvent, DropSource, GrabOffset, PlaceholderContext, PlaceholderMoveEvent, VdndAnimationConfig, VdndGroupContext, VdndScrollContainer, VdndVirtualViewport, VirtualForContext, VirtualScrollItemContext, VirtualScrollStrategy };
|