@tft/interact 17.0.0 → 21.0.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/fesm2022/tft-interact.mjs +58 -48
- package/fesm2022/tft-interact.mjs.map +1 -1
- package/package.json +5 -7
- package/tft-interact-21.0.0.tgz +0 -0
- package/types/tft-interact.d.ts +506 -0
- package/esm2022/index.mjs +0 -6
- package/esm2022/lib/directives/account-for-scale.directive.mjs +0 -26
- package/esm2022/lib/directives/apply-scale.directive.mjs +0 -28
- package/esm2022/lib/directives/auto-scroll.directive.mjs +0 -56
- package/esm2022/lib/directives/drag-preview.directive.mjs +0 -20
- package/esm2022/lib/directives/drag-root.directive.mjs +0 -32
- package/esm2022/lib/directives/draggable.directive.mjs +0 -320
- package/esm2022/lib/directives/dropzone.directive.mjs +0 -114
- package/esm2022/lib/directives/gesturable.directive.mjs +0 -82
- package/esm2022/lib/directives/index.mjs +0 -10
- package/esm2022/lib/directives/resizable.directive.mjs +0 -228
- package/esm2022/lib/interact.module.mjs +0 -66
- package/esm2022/lib/models/index.mjs +0 -2
- package/esm2022/lib/models/interact.mjs +0 -28
- package/esm2022/lib/pipes/array-of-n.pipe.mjs +0 -22
- package/esm2022/lib/pipes/index.mjs +0 -2
- package/esm2022/lib/services/interact.service.mjs +0 -197
- package/esm2022/lib/utils/helpers.mjs +0 -35
- package/esm2022/lib/utils/index.mjs +0 -2
- package/esm2022/tft-interact.mjs +0 -5
- package/index.d.ts +0 -5
- package/lib/directives/account-for-scale.directive.d.ts +0 -15
- package/lib/directives/apply-scale.directive.d.ts +0 -11
- package/lib/directives/auto-scroll.directive.d.ts +0 -34
- package/lib/directives/drag-preview.directive.d.ts +0 -10
- package/lib/directives/drag-root.directive.d.ts +0 -15
- package/lib/directives/draggable.directive.d.ts +0 -76
- package/lib/directives/dropzone.directive.d.ts +0 -40
- package/lib/directives/gesturable.directive.d.ts +0 -27
- package/lib/directives/index.d.ts +0 -9
- package/lib/directives/resizable.directive.d.ts +0 -61
- package/lib/interact.module.d.ts +0 -20
- package/lib/models/index.d.ts +0 -1
- package/lib/models/interact.d.ts +0 -140
- package/lib/pipes/array-of-n.pipe.d.ts +0 -12
- package/lib/pipes/index.d.ts +0 -1
- package/lib/services/interact.service.d.ts +0 -83
- package/lib/utils/helpers.d.ts +0 -12
- package/lib/utils/index.d.ts +0 -1
- package/tft-interact-17.0.0.tgz +0 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { RendererFactory2, NgZone, ElementRef, OnInit, OnChanges, EventEmitter, Renderer2, SimpleChanges, TemplateRef, InjectionToken, OnDestroy, AfterViewInit, ViewContainerRef, PipeTransform, ModuleWithProviders, EmbeddedViewRef } from '@angular/core';
|
|
3
|
+
import * as _interactjs_core_Interactable from '@interactjs/core/Interactable';
|
|
4
|
+
import * as _tft_interact from '@tft/interact';
|
|
5
|
+
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
6
|
+
import { DropzoneOptions, Interactable, DraggableOptions, ResizableOptions, ResizeEvent, GesturableOptions } from '@interactjs/types/index';
|
|
7
|
+
import { Point, DropEvent, Interactable as Interactable$1, ResizeEvent as ResizeEvent$1, DragEvent, GestureEvent } from '@interactjs/types';
|
|
8
|
+
import * as i11 from '@angular/common';
|
|
9
|
+
|
|
10
|
+
declare class InteractService {
|
|
11
|
+
private rendererFactory;
|
|
12
|
+
private ngZone;
|
|
13
|
+
rootConfig: any;
|
|
14
|
+
private _interactableIndex;
|
|
15
|
+
private _dropzoneIndex;
|
|
16
|
+
private renderer;
|
|
17
|
+
readonly dragRegistrySystem: {
|
|
18
|
+
[key: string]: InteractableRegistry;
|
|
19
|
+
};
|
|
20
|
+
private cssUnit;
|
|
21
|
+
constructor(rendererFactory: RendererFactory2, ngZone: NgZone, rootConfig: any);
|
|
22
|
+
addDeltaToPosition(delta: Delta, position: Position): {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
targetElement: TftDragElement;
|
|
26
|
+
};
|
|
27
|
+
addRegistryToSystem(customRegistryId?: string | null): string;
|
|
28
|
+
addDraggableToRegistry(customRegistryId?: any, interactableId?: string | null): string;
|
|
29
|
+
destroyInteractable(interactableId: string, registryId?: string): void;
|
|
30
|
+
subscribeToInteractable(interactableId: string, registryId?: string): _tft_interact.InteractableSystem;
|
|
31
|
+
createInteractableState(initialPosition: Position, initialSize: Size, initialDelta: Delta): {
|
|
32
|
+
deltas$: BehaviorSubject<Delta>;
|
|
33
|
+
position$: BehaviorSubject<Position>;
|
|
34
|
+
size$: BehaviorSubject<{
|
|
35
|
+
deltaX: number | null;
|
|
36
|
+
deltaY: number | null;
|
|
37
|
+
targetElement: TftDragElement | null;
|
|
38
|
+
width: number | null;
|
|
39
|
+
height: number | null;
|
|
40
|
+
}>;
|
|
41
|
+
interactable$: Observable<TftCoords>;
|
|
42
|
+
};
|
|
43
|
+
createInteractableId(customInteractableId?: string | null): string;
|
|
44
|
+
createDropzoneId(index: number): string;
|
|
45
|
+
getInteractableState(interactableId: string, registryId?: string): Observable<TftCoords>;
|
|
46
|
+
updateDeltas(interactId: string, registryId: string, { deltaX, deltaY }: {
|
|
47
|
+
deltaX: any;
|
|
48
|
+
deltaY: any;
|
|
49
|
+
}, targetElement: any): void;
|
|
50
|
+
updatePosition(interactId: string, registryId: string, { x, y }: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
}, targetElement: any): void;
|
|
54
|
+
updateSize(interactId: string, registryId: string, { deltaX, deltaY, width, height }: {
|
|
55
|
+
deltaX: any;
|
|
56
|
+
deltaY: any;
|
|
57
|
+
width: any;
|
|
58
|
+
height: any;
|
|
59
|
+
}, targetElement: any): void;
|
|
60
|
+
interactableExistOnRegistry(interactId: string, registryId?: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Uses renderer to set width and height of angular component
|
|
63
|
+
* @param width the desired width of component
|
|
64
|
+
* @param height the desired height of component
|
|
65
|
+
* @param target the element to transform
|
|
66
|
+
*/
|
|
67
|
+
setElementSize(width: number, height: number, target: TftResizeElement): void;
|
|
68
|
+
/**
|
|
69
|
+
* Uses renderer to set position of angular component
|
|
70
|
+
* @param x position on x axis
|
|
71
|
+
* @param y position on y axis
|
|
72
|
+
* @param target the element to transform
|
|
73
|
+
*/
|
|
74
|
+
setElementTransform(x: number, y: number, position: Position): void;
|
|
75
|
+
/**
|
|
76
|
+
* Generates a translate string for the x and y arguments passed to
|
|
77
|
+
* be passed to css transform
|
|
78
|
+
* @param x the position along the x axis
|
|
79
|
+
* @param y the position along the y axis
|
|
80
|
+
*/
|
|
81
|
+
createTransformString(x: number, y: number): string;
|
|
82
|
+
calculatePositionInElement(zoneElement: Interact.Element, dragElement: TftDragElement, scale?: number): {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
};
|
|
86
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InteractService, [null, null, { optional: true; }]>;
|
|
87
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InteractService>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Use to apply scale to the element and tell the drag and resize directives to account for the scale when
|
|
92
|
+
* @example <div tftAccountForScale [scale]="2.5"> <div tftDraggable> </div> </div>
|
|
93
|
+
* @note if `dragRoot` is used this directive should be used on the same element to ensure that the drag
|
|
94
|
+
* element accounts for scale
|
|
95
|
+
*/
|
|
96
|
+
declare class AccountForScaleDirective {
|
|
97
|
+
el: ElementRef;
|
|
98
|
+
scale: number;
|
|
99
|
+
constructor(el: ElementRef);
|
|
100
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccountForScaleDirective, never>;
|
|
101
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AccountForScaleDirective, "[tftAccountForScale]", never, { "scale": { "alias": "scale"; "required": false; }; }, {}, never, never, false, never>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type PositionOption = 'relative' | 'absolute' | 'fixed' | 'static' | 'sticky' | 'unset' | 'inherit' | 'initial' | 'revert';
|
|
105
|
+
declare class DropzoneDirective implements OnInit, OnChanges {
|
|
106
|
+
el: ElementRef;
|
|
107
|
+
private renderer;
|
|
108
|
+
private interactService;
|
|
109
|
+
private account_for_scale_dir?;
|
|
110
|
+
dropzoneId: string;
|
|
111
|
+
dropzoneConfig: DropzoneOptions;
|
|
112
|
+
dropzoneData: any;
|
|
113
|
+
position: PositionOption;
|
|
114
|
+
dropActivate: EventEmitter<TftDropEvent>;
|
|
115
|
+
dragEnter: EventEmitter<TftDropEvent>;
|
|
116
|
+
dragLeave: EventEmitter<TftDropEvent>;
|
|
117
|
+
dragDrop: EventEmitter<TftDropEvent>;
|
|
118
|
+
dropzone: Interactable;
|
|
119
|
+
get scale(): number;
|
|
120
|
+
constructor(el: ElementRef, renderer: Renderer2, interactService: InteractService, account_for_scale_dir?: AccountForScaleDirective);
|
|
121
|
+
ngOnInit(): void;
|
|
122
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
123
|
+
/**
|
|
124
|
+
* Connects element to interacts dropzone events and returns a reference to the interactable
|
|
125
|
+
* @param nativeElement the element to tie drop events to
|
|
126
|
+
* @param dropzoneConfig the interact configuration to use when connecting
|
|
127
|
+
*/
|
|
128
|
+
connectDropzoneEvents(nativeElement: any, dropzoneConfig: DropzoneOptions): _interactjs_core_Interactable.Interactable;
|
|
129
|
+
/**
|
|
130
|
+
* Maps the drop event emitted by interact to something a little easier to use
|
|
131
|
+
* @param event the drop event emitted by interact, extended with extra fields we added to
|
|
132
|
+
*/
|
|
133
|
+
mapDropzoneEvent(event: NgDropEvent): TftDropEvent;
|
|
134
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropzoneDirective, [null, null, null, { optional: true; }]>;
|
|
135
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DropzoneDirective, "[tftDropzone]", never, { "dropzoneId": { "alias": "dropzoneId"; "required": false; }; "dropzoneConfig": { "alias": "dropzoneConfig"; "required": false; }; "dropzoneData": { "alias": "dropzoneData"; "required": false; }; "position": { "alias": "position"; "required": false; }; }, { "dropActivate": "dropActivate"; "dragEnter": "dragEnter"; "dragLeave": "dragLeave"; "dragDrop": "dragDrop"; }, never, never, false, never>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare const TFT_DRAG_PREVIEW: InjectionToken<DragPreviewDirective<any>>;
|
|
139
|
+
declare class DragPreviewDirective<T = any> {
|
|
140
|
+
templateRef: TemplateRef<T>;
|
|
141
|
+
dragData: T;
|
|
142
|
+
constructor(templateRef: TemplateRef<T>);
|
|
143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DragPreviewDirective<any>, never>;
|
|
144
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DragPreviewDirective<any>, "ng-template[tftDragPreview]", never, { "dragData": { "alias": "dragData"; "required": false; }; }, {}, never, never, false, never>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Use this directive to select which element to attach the element to while dragging
|
|
149
|
+
* @example <div tftDragRoot><div tftDraggable> </div> </div>
|
|
150
|
+
* @note this directive will overwrite any style transformations (e.g. transform: scale(2); )
|
|
151
|
+
*/
|
|
152
|
+
declare class DragRootDirective {
|
|
153
|
+
el: ElementRef;
|
|
154
|
+
account_for_scale_dir?: AccountForScaleDirective;
|
|
155
|
+
constructor(el: ElementRef, account_for_scale_dir?: AccountForScaleDirective);
|
|
156
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DragRootDirective, [null, { optional: true; self: true; }]>;
|
|
157
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DragRootDirective, "[tftDragRoot]", ["tftDragRoot"], {}, {}, never, never, false, never>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface ScrollObject {
|
|
161
|
+
scrollTop: number;
|
|
162
|
+
scrollLeft: number;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Use to apply scale to the element and tell the drag and resize directives to account for the scale when
|
|
166
|
+
* @example <div tftAccountForScale [scale]="2.5"> <div tftDraggable> </div> </div>
|
|
167
|
+
* @note if `dragRoot` is used this directive should be used on the same element to ensure that the drag
|
|
168
|
+
* element accounts for scale
|
|
169
|
+
*/
|
|
170
|
+
declare class AutoScrollDirective {
|
|
171
|
+
el: ElementRef;
|
|
172
|
+
/**
|
|
173
|
+
* Limit minimum time between scroll events in milliseconds
|
|
174
|
+
*/
|
|
175
|
+
autoScrollConfig: {
|
|
176
|
+
margin: number;
|
|
177
|
+
distance: number;
|
|
178
|
+
interval: number;
|
|
179
|
+
speed: number;
|
|
180
|
+
enabled: boolean;
|
|
181
|
+
};
|
|
182
|
+
private scrollSubject;
|
|
183
|
+
readonly scrollObserver: Observable<ScrollObject>;
|
|
184
|
+
readonly scrollDeltaObserver: Subject<ScrollObject>;
|
|
185
|
+
scroll(scrollEvent: Event): void;
|
|
186
|
+
constructor(el: ElementRef);
|
|
187
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AutoScrollDirective, never>;
|
|
188
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AutoScrollDirective, "[tftAutoScroll]", never, { "autoScrollConfig": { "alias": "autoScrollConfig"; "required": false; }; }, {}, never, never, false, never>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** @dynamic */
|
|
192
|
+
declare class DraggableDirective<D = any> implements OnInit, OnChanges, OnDestroy, AfterViewInit {
|
|
193
|
+
el: ElementRef;
|
|
194
|
+
private interactService;
|
|
195
|
+
private renderer;
|
|
196
|
+
private _viewContainerRef;
|
|
197
|
+
private _document;
|
|
198
|
+
account_for_scale_dir?: AccountForScaleDirective;
|
|
199
|
+
dropzone_dir?: DropzoneDirective;
|
|
200
|
+
drag_root_dir?: DragRootDirective;
|
|
201
|
+
auto_scroll_dir?: AutoScrollDirective;
|
|
202
|
+
x: number;
|
|
203
|
+
y: number;
|
|
204
|
+
dragZIndex: number;
|
|
205
|
+
/** zIndex while at rest */
|
|
206
|
+
zIndex: number;
|
|
207
|
+
interactableId: string;
|
|
208
|
+
dragData: D;
|
|
209
|
+
enableDragDefault: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated replaced by 'dragDisabled' property, please migrate before v13
|
|
212
|
+
*/
|
|
213
|
+
disabled: boolean;
|
|
214
|
+
dragDisabled: boolean;
|
|
215
|
+
dragConfig: Partial<Interact.OrBoolean<DraggableOptions>>;
|
|
216
|
+
showPlaceholder: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* The element we want to prepend the drag element to.
|
|
219
|
+
* Use `tftDragRoot` directive on a parent element to set custom root element
|
|
220
|
+
* @default document.body
|
|
221
|
+
*/
|
|
222
|
+
dragRoot: DragRootDirective;
|
|
223
|
+
private dragRootEl;
|
|
224
|
+
dragStart: EventEmitter<TftDragEvent>;
|
|
225
|
+
dragMove: EventEmitter<TftDragEvent>;
|
|
226
|
+
dragInertiaStart: EventEmitter<TftDragEvent>;
|
|
227
|
+
dragEnd: EventEmitter<TftDragEvent>;
|
|
228
|
+
_previewTemplate: DragPreviewDirective;
|
|
229
|
+
interactableState: Observable<TftCoords>;
|
|
230
|
+
interactable: Interactable;
|
|
231
|
+
private registryId;
|
|
232
|
+
private interactableSubscription;
|
|
233
|
+
private scrollEventsSubscription;
|
|
234
|
+
previewRef: TftDragElement;
|
|
235
|
+
get scale(): number;
|
|
236
|
+
constructor(el: ElementRef, interactService: InteractService, renderer: Renderer2, _viewContainerRef: ViewContainerRef, _document: Document, account_for_scale_dir?: AccountForScaleDirective, dropzone_dir?: DropzoneDirective, drag_root_dir?: DragRootDirective, auto_scroll_dir?: AutoScrollDirective);
|
|
237
|
+
ngOnInit(): void;
|
|
238
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
239
|
+
setDragConfig(): void;
|
|
240
|
+
ngAfterViewInit(): void;
|
|
241
|
+
ngOnDestroy(): void;
|
|
242
|
+
dragMoveListener(event: NgDragEvent, element: Interact.Element): void;
|
|
243
|
+
setDragStyles(dragElement: HTMLElement): void;
|
|
244
|
+
addDragPropertiesToElement(nativeElement: TftDragElement): void;
|
|
245
|
+
mapDragEvent(event: NgDragEvent): TftDragEvent;
|
|
246
|
+
setPosition(x: number, y: number): void;
|
|
247
|
+
alignPositionWithInputs(x: number, y: number): void;
|
|
248
|
+
isValidPosition(x: number, y: number): boolean;
|
|
249
|
+
isNumeric(num: number): boolean;
|
|
250
|
+
initiateDragEvents(dragConfig: Partial<Interact.OrBoolean<DraggableOptions>>, nativeElement: HTMLElement): _interactjs_core_Interactable.Interactable;
|
|
251
|
+
subscribeToScrollEvents(): void;
|
|
252
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DraggableDirective<any>, [null, null, null, null, null, { optional: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }]>;
|
|
253
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DraggableDirective<any>, "[tftDraggable]", never, { "x": { "alias": "x"; "required": false; }; "y": { "alias": "y"; "required": false; }; "dragZIndex": { "alias": "dragZIndex"; "required": false; }; "zIndex": { "alias": "zIndex"; "required": false; }; "interactableId": { "alias": "interactableId"; "required": false; }; "dragData": { "alias": "dragData"; "required": false; }; "enableDragDefault": { "alias": "enableDragDefault"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "dragDisabled": { "alias": "dragDisabled"; "required": false; }; "dragConfig": { "alias": "dragConfig"; "required": false; }; "showPlaceholder": { "alias": "showPlaceholder"; "required": false; }; "dragRoot": { "alias": "dragRoot"; "required": false; }; }, { "dragStart": "dragStart"; "dragMove": "dragMove"; "dragInertiaStart": "dragInertiaStart"; "dragEnd": "dragEnd"; }, ["_previewTemplate"], never, false, never>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** @dynamic */
|
|
257
|
+
declare class ResizableDirective implements OnInit, OnDestroy, OnChanges {
|
|
258
|
+
el: ElementRef;
|
|
259
|
+
private _document;
|
|
260
|
+
private interactService;
|
|
261
|
+
private renderer;
|
|
262
|
+
private drag_root_dir?;
|
|
263
|
+
account_for_scale_dir?: AccountForScaleDirective;
|
|
264
|
+
private draggable_dir?;
|
|
265
|
+
private dropzone_dir?;
|
|
266
|
+
auto_scroll_dir?: AutoScrollDirective;
|
|
267
|
+
enableResizeDefault: boolean;
|
|
268
|
+
position: string;
|
|
269
|
+
resizeConfig: Partial<Interact.OrBoolean<ResizableOptions>>;
|
|
270
|
+
interactableId: string;
|
|
271
|
+
width: number;
|
|
272
|
+
height: number;
|
|
273
|
+
resizeDisabled: boolean;
|
|
274
|
+
resizeStart: EventEmitter<TftResizeEvent>;
|
|
275
|
+
resizeMove: EventEmitter<TftResizeEvent>;
|
|
276
|
+
resizeInertiaStart: EventEmitter<TftResizeEvent>;
|
|
277
|
+
resizeEnd: EventEmitter<TftResizeEvent>;
|
|
278
|
+
defaultConfig: Partial<Interact.OrBoolean<ResizableOptions>>;
|
|
279
|
+
registryId: string;
|
|
280
|
+
interactable: Interactable;
|
|
281
|
+
dragRootEl: HTMLElement;
|
|
282
|
+
private activeEdges;
|
|
283
|
+
private interactableSubscription;
|
|
284
|
+
private scrollEventsSubscription;
|
|
285
|
+
get scale(): number;
|
|
286
|
+
constructor(el: ElementRef, _document: Document, interactService: InteractService, renderer: Renderer2, drag_root_dir?: DragRootDirective, account_for_scale_dir?: AccountForScaleDirective, draggable_dir?: DraggableDirective, dropzone_dir?: DropzoneDirective, auto_scroll_dir?: AutoScrollDirective);
|
|
287
|
+
ngOnInit(): void;
|
|
288
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
289
|
+
ngOnDestroy(): void;
|
|
290
|
+
resizeListener(event: ResizeEvent): void;
|
|
291
|
+
/**
|
|
292
|
+
* hook elements into interacts resize event listeners
|
|
293
|
+
* we spread the configs so that the consuming component only overwrites the
|
|
294
|
+
* pieces that it explicitly indicates
|
|
295
|
+
* @param resizeConfig
|
|
296
|
+
* @param nativeElement
|
|
297
|
+
*/
|
|
298
|
+
initiateResizeEvents(resizeConfig: Partial<Interact.OrBoolean<ResizableOptions>>, nativeElement: TftDragElement): _interactjs_core_Interactable.Interactable;
|
|
299
|
+
mapResizeEvent(event: NgResizeEvent): TftResizeEvent;
|
|
300
|
+
alignDimensionsWithInputs(width: number, height: number): void;
|
|
301
|
+
addResizePropertiesToElement(nativeElement: TftDragElement): void;
|
|
302
|
+
subscribeToScrollEvents(): void;
|
|
303
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ResizableDirective, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }]>;
|
|
304
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ResizableDirective, "[tftResizable]", never, { "enableResizeDefault": { "alias": "enableResizeDefault"; "required": false; }; "position": { "alias": "position"; "required": false; }; "resizeConfig": { "alias": "resizeConfig"; "required": false; }; "interactableId": { "alias": "interactableId"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "resizeDisabled": { "alias": "resizeDisabled"; "required": false; }; }, { "resizeStart": "resizeStart"; "resizeMove": "resizeMove"; "resizeInertiaStart": "resizeInertiaStart"; "resizeEnd": "resizeEnd"; }, never, never, false, never>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** @dynamic */
|
|
308
|
+
declare class GesturableDirective<D = any> implements OnInit, OnChanges {
|
|
309
|
+
el: ElementRef;
|
|
310
|
+
private draggable_dir?;
|
|
311
|
+
gesturableId: string;
|
|
312
|
+
gestureDisabled: boolean;
|
|
313
|
+
gestureConfig: Partial<Interact.OrBoolean<DraggableOptions>>;
|
|
314
|
+
gestureStart: EventEmitter<TftGestureEvent>;
|
|
315
|
+
gestureMove: EventEmitter<TftGestureEvent>;
|
|
316
|
+
gestureEnd: EventEmitter<TftGestureEvent>;
|
|
317
|
+
interactableState: Observable<TftCoords>;
|
|
318
|
+
interactable: Interactable;
|
|
319
|
+
constructor(el: ElementRef, draggable_dir?: DraggableDirective);
|
|
320
|
+
ngOnInit(): void;
|
|
321
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
322
|
+
setGestureConfig(): void;
|
|
323
|
+
initiateGestureEvents(gestureConfig: Partial<Interact.OrBoolean<GesturableOptions>>, nativeElement: HTMLElement): _interactjs_core_Interactable.Interactable;
|
|
324
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GesturableDirective<any>, [null, { optional: true; }]>;
|
|
325
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<GesturableDirective<any>, "[tftGesturable]", never, { "gesturableId": { "alias": "gesturableId"; "required": false; }; "gestureDisabled": { "alias": "gestureDisabled"; "required": false; }; "gestureConfig": { "alias": "gestureConfig"; "required": false; }; }, { "gestureStart": "gestureStart"; "gestureMove": "gestureMove"; "gestureEnd": "gestureEnd"; }, never, never, false, never>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare class ApplyScaleDirective {
|
|
329
|
+
el: ElementRef;
|
|
330
|
+
_scale: number;
|
|
331
|
+
set scale(val: number);
|
|
332
|
+
fontSize: string;
|
|
333
|
+
constructor(el: ElementRef);
|
|
334
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApplyScaleDirective, never>;
|
|
335
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ApplyScaleDirective, "[tftApplyScale]", never, { "scale": { "alias": "scale"; "required": false; }; }, {}, never, never, false, never>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
type CssDimensionUnit = 'px' | 'em';
|
|
339
|
+
interface InteractRootConfig {
|
|
340
|
+
cssDimensionUnit: CssDimensionUnit;
|
|
341
|
+
}
|
|
342
|
+
declare const INTERACT_ROOT_CONFIG: InjectionToken<InteractRootConfig>;
|
|
343
|
+
declare const DEFAULT_REGISTRY_ID = "DEFAULT";
|
|
344
|
+
/**
|
|
345
|
+
* Default initial value for Delta BehaviorSubject
|
|
346
|
+
*/
|
|
347
|
+
declare const defaultDelta: Delta;
|
|
348
|
+
/**
|
|
349
|
+
* Default initial value for Size BehaviorSubject
|
|
350
|
+
*/
|
|
351
|
+
declare const defaultSize: Size;
|
|
352
|
+
/**
|
|
353
|
+
* Default initial value for Position BehaviorSubject
|
|
354
|
+
*/
|
|
355
|
+
declare const defaultPosition: Position;
|
|
356
|
+
/**
|
|
357
|
+
* The shape of the state/events/behavior system for each dropzone
|
|
358
|
+
* and the DEFAULT_REGISTRY_ID system (for drop components initialized outside
|
|
359
|
+
* of a dropzone).
|
|
360
|
+
*/
|
|
361
|
+
interface InteractableSystem {
|
|
362
|
+
deltas$: BehaviorSubject<Delta>;
|
|
363
|
+
position$: BehaviorSubject<Position>;
|
|
364
|
+
size$: BehaviorSubject<Size & Delta>;
|
|
365
|
+
interactable$: Observable<TftCoords>;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* The key map of InteractableSystems. One for the drag components
|
|
369
|
+
* that originated outside of a dropzone, plus one for each dropzone.
|
|
370
|
+
*/
|
|
371
|
+
interface InteractableRegistry {
|
|
372
|
+
[key: string]: InteractableSystem;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* HTMLElement with helpful drag directives attached to facilitate moving drag data between dropzones
|
|
376
|
+
*/
|
|
377
|
+
type TftDragElement = HTMLElement & {
|
|
378
|
+
dragRef?: DraggableDirective;
|
|
379
|
+
dragOrigin?: DropzoneDirective;
|
|
380
|
+
dropTarget?: DropzoneDirective;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* HTMLElement with helpful drag directives attached to facilitate moving drag data between dropzones
|
|
384
|
+
*/
|
|
385
|
+
type TftResizeElement = HTMLElement & {
|
|
386
|
+
resizeRef?: ResizableDirective;
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Extends the interact drop events by adding reference to the dropped components drag
|
|
390
|
+
* directive to the html element. This gives the dropzone access to things like data
|
|
391
|
+
* and parent dropzone of the dropped component.
|
|
392
|
+
*/
|
|
393
|
+
type NgDropEvent = DropEvent & {
|
|
394
|
+
draggable: Interactable$1 & {
|
|
395
|
+
target: TftDragElement;
|
|
396
|
+
};
|
|
397
|
+
relatedTarget: TftDragElement;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Extends the interact resize events by adding a reference to the dragRef
|
|
401
|
+
* directive to the html element.
|
|
402
|
+
*/
|
|
403
|
+
type NgResizeEvent = ResizeEvent$1 & {
|
|
404
|
+
draggable: Interactable$1 & {
|
|
405
|
+
target: TftDragElement;
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* We extend the interact DragEvent a little here, adding to the target element references for:
|
|
410
|
+
* - the component we are dragging (dragRef)
|
|
411
|
+
* - the dropzone component where the drag component originated (dragOrigin)
|
|
412
|
+
* - the dropzone component that it was dropped in (dropTarget)
|
|
413
|
+
* This helps us to pass references to directive classes as events like dragenter and drag exit happens.
|
|
414
|
+
* We use these references to emit a (mostly) consistent event across drag, drop, resize event.
|
|
415
|
+
*/
|
|
416
|
+
type NgDragEvent = DragEvent & {
|
|
417
|
+
dropzone: {
|
|
418
|
+
target: HTMLElement;
|
|
419
|
+
};
|
|
420
|
+
target: TftDragElement;
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Event emitted when resizing, dragging, dropping
|
|
424
|
+
*/
|
|
425
|
+
interface TftInteractableEvent {
|
|
426
|
+
dragRef: DraggableDirective;
|
|
427
|
+
dragOrigin?: DropzoneDirective;
|
|
428
|
+
dropTarget?: DropzoneDirective;
|
|
429
|
+
positionInDropTarget: Point;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Event emitted on drop
|
|
433
|
+
*/
|
|
434
|
+
interface TftDropEvent extends TftInteractableEvent {
|
|
435
|
+
interactEvent: NgDropEvent;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Event emitted on drag
|
|
439
|
+
*/
|
|
440
|
+
interface TftDragEvent extends TftInteractableEvent {
|
|
441
|
+
interactEvent: NgDragEvent;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Event emitted on resize
|
|
445
|
+
*/
|
|
446
|
+
interface TftResizeEvent extends TftInteractableEvent {
|
|
447
|
+
interactEvent: ResizeEvent$1;
|
|
448
|
+
resizeRef: ResizableDirective;
|
|
449
|
+
size: {
|
|
450
|
+
width: number;
|
|
451
|
+
height: number;
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
type TftCoords = Delta & Position & Size;
|
|
455
|
+
interface Delta {
|
|
456
|
+
deltaX: number | null;
|
|
457
|
+
deltaY: number | null;
|
|
458
|
+
targetElement: TftDragElement | null;
|
|
459
|
+
}
|
|
460
|
+
interface Position {
|
|
461
|
+
x: number | null;
|
|
462
|
+
y: number | null;
|
|
463
|
+
targetElement: TftDragElement | null;
|
|
464
|
+
}
|
|
465
|
+
interface Size {
|
|
466
|
+
width: number | null;
|
|
467
|
+
height: number | null;
|
|
468
|
+
targetElement: TftResizeElement | null;
|
|
469
|
+
}
|
|
470
|
+
interface TftGestureEvent {
|
|
471
|
+
gestureRef: GesturableDirective;
|
|
472
|
+
interactEvent: GestureEvent;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
declare class ArrayOfNPipe implements PipeTransform {
|
|
476
|
+
/**
|
|
477
|
+
*
|
|
478
|
+
* @param n the number to make an array of
|
|
479
|
+
* @param max the max length of the array (useful for limiting rendering in ngFor loop)
|
|
480
|
+
*/
|
|
481
|
+
transform(n: number, max: number): any;
|
|
482
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayOfNPipe, never>;
|
|
483
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ArrayOfNPipe, "arrayOfN", false>;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
declare class InteractModule {
|
|
487
|
+
static forRoot(config: InteractRootConfig): ModuleWithProviders<InteractModule>;
|
|
488
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InteractModule, never>;
|
|
489
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<InteractModule, [typeof DraggableDirective, typeof ResizableDirective, typeof DropzoneDirective, typeof GesturableDirective, typeof DragRootDirective, typeof AutoScrollDirective, typeof AccountForScaleDirective, typeof ApplyScaleDirective, typeof DragPreviewDirective, typeof ArrayOfNPipe], [typeof i11.CommonModule], [typeof DraggableDirective, typeof ResizableDirective, typeof DropzoneDirective, typeof GesturableDirective, typeof DragRootDirective, typeof AutoScrollDirective, typeof AccountForScaleDirective, typeof ApplyScaleDirective, typeof DragPreviewDirective, typeof ArrayOfNPipe]>;
|
|
490
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<InteractModule>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** Gets the closest ancestor of an element that matches a selector. */
|
|
494
|
+
declare function getClosestMatchingAncestor(element: HTMLElement, selector: string): HTMLElement;
|
|
495
|
+
/**
|
|
496
|
+
* Create a copy of the HTML Element
|
|
497
|
+
*/
|
|
498
|
+
declare function cloneElement(element: HTMLElement): HTMLElement;
|
|
499
|
+
/**
|
|
500
|
+
* Gets the root HTML element of an embedded view.
|
|
501
|
+
* If the root is not an HTML element it gets wrapped in one.
|
|
502
|
+
*/
|
|
503
|
+
declare function getRootNode(viewRef: EmbeddedViewRef<any>, _document: Document): HTMLElement;
|
|
504
|
+
|
|
505
|
+
export { AccountForScaleDirective, ApplyScaleDirective, ArrayOfNPipe, AutoScrollDirective, DEFAULT_REGISTRY_ID, DragPreviewDirective, DragRootDirective, DraggableDirective, DropzoneDirective, GesturableDirective, INTERACT_ROOT_CONFIG, InteractModule, ResizableDirective, TFT_DRAG_PREVIEW, cloneElement, defaultDelta, defaultPosition, defaultSize, getClosestMatchingAncestor, getRootNode };
|
|
506
|
+
export type { CssDimensionUnit, Delta, InteractRootConfig, InteractableRegistry, InteractableSystem, NgDragEvent, NgDropEvent, NgResizeEvent, Position, PositionOption, Size, TftCoords, TftDragElement, TftDragEvent, TftDropEvent, TftGestureEvent, TftInteractableEvent, TftResizeElement, TftResizeEvent };
|
package/esm2022/index.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './lib/interact.module';
|
|
2
|
-
export * from './lib/directives';
|
|
3
|
-
export * from './lib/models';
|
|
4
|
-
export * from './lib/pipes';
|
|
5
|
-
export * from './lib/utils';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2ludGVyYWN0L3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsa0JBQWtCLENBQUE7QUFDaEMsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyxhQUFhLENBQUM7QUFDNUIsY0FBYyxhQUFhLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9pbnRlcmFjdC5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvZGlyZWN0aXZlcydcbmV4cG9ydCAqIGZyb20gJy4vbGliL21vZGVscyc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9waXBlcyc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi91dGlscyc7XG4iXX0=
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Use to apply scale to the element and tell the drag and resize directives to account for the scale when
|
|
5
|
-
* @example <div tftAccountForScale [scale]="2.5"> <div tftDraggable> </div> </div>
|
|
6
|
-
* @note if `dragRoot` is used this directive should be used on the same element to ensure that the drag
|
|
7
|
-
* element accounts for scale
|
|
8
|
-
*/
|
|
9
|
-
export class AccountForScaleDirective {
|
|
10
|
-
constructor(el) {
|
|
11
|
-
this.el = el;
|
|
12
|
-
// this setup allows consumers to set x, y scale independently or just set them both with scale
|
|
13
|
-
this.scale = 1;
|
|
14
|
-
}
|
|
15
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AccountForScaleDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
16
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: AccountForScaleDirective, selector: "[tftAccountForScale]", inputs: { scale: "scale" }, ngImport: i0 }); }
|
|
17
|
-
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AccountForScaleDirective, decorators: [{
|
|
19
|
-
type: Directive,
|
|
20
|
-
args: [{
|
|
21
|
-
selector: '[tftAccountForScale]'
|
|
22
|
-
}]
|
|
23
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { scale: [{
|
|
24
|
-
type: Input
|
|
25
|
-
}] } });
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudC1mb3Itc2NhbGUuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9pbnRlcmFjdC9zcmMvbGliL2RpcmVjdGl2ZXMvYWNjb3VudC1mb3Itc2NhbGUuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFlLEtBQUssRUFBNEIsTUFBTSxlQUFlLENBQUM7O0FBRXBHOzs7OztHQUtHO0FBSUgsTUFBTSxPQUFPLHdCQUF3QjtJQUluQyxZQUNTLEVBQWM7UUFBZCxPQUFFLEdBQUYsRUFBRSxDQUFZO1FBSnZCLCtGQUErRjtRQUN0RixVQUFL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d2l0aCBzY2FsZVxuICBASW5wdXQoKSBzY2FsZSA9IDE7XG5cbiAgY29uc3RydWN0b3IoXG4gICAgcHVibGljIGVsOiBFbGVtZW50UmVmXG4gICkgeyB9XG59XG4iXX0=
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class ApplyScaleDirective {
|
|
4
|
-
// this setup allows consumers to set x, y scale independently or just set them both with scale
|
|
5
|
-
set scale(val) {
|
|
6
|
-
this._scale;
|
|
7
|
-
this.fontSize = `${val}px`;
|
|
8
|
-
}
|
|
9
|
-
;
|
|
10
|
-
constructor(el) {
|
|
11
|
-
this.el = el;
|
|
12
|
-
this._scale = 1;
|
|
13
|
-
}
|
|
14
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ApplyScaleDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
15
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: ApplyScaleDirective, selector: "[tftApplyScale]", inputs: { scale: "scale" }, host: { properties: { "style.fontSize": "this.fontSize" } }, ngImport: i0 }); }
|
|
16
|
-
}
|
|
17
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ApplyScaleDirective, decorators: [{
|
|
18
|
-
type: Directive,
|
|
19
|
-
args: [{
|
|
20
|
-
selector: '[tftApplyScale]'
|
|
21
|
-
}]
|
|
22
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { scale: [{
|
|
23
|
-
type: Input
|
|
24
|
-
}], fontSize: [{
|
|
25
|
-
type: HostBinding,
|
|
26
|
-
args: ['style.fontSize']
|
|
27
|
-
}] } });
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI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hbGVEaXJlY3RpdmUge1xuXG4gIF9zY2FsZSA9IDE7XG4gICAvLyB0aGlzIHNldHVwIGFsbG93cyBjb25zdW1lcnMgdG8gc2V0IHgsIHkgc2NhbGUgaW5kZXBlbmRlbnRseSBvciBqdXN0IHNldCB0aGVtIGJvdGggd2l0aCBzY2FsZVxuICBASW5wdXQoKSBzZXQgc2NhbGUodmFsOiBudW1iZXIpe1xuICAgIHRoaXMuX3NjYWxlO1xuICAgIHRoaXMuZm9udFNpemUgPSBgJHt2YWx9cHhgO1xuICB9O1xuXG4gIEBIb3N0QmluZGluZygnc3R5bGUuZm9udFNpemUnKSBmb250U2l6ZTogc3RyaW5nO1xuXG4gIGNvbnN0cnVjdG9yKFxuICAgIHB1YmxpYyBlbDogRWxlbWVudFJlZlxuICApIHsgfVxufVxuIl19
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject, Subject } from 'rxjs';
|
|
3
|
-
import { scan, shareReplay } from 'rxjs/operators';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
;
|
|
6
|
-
/**
|
|
7
|
-
* Use to apply scale to the element and tell the drag and resize directives to account for the scale when
|
|
8
|
-
* @example <div tftAccountForScale [scale]="2.5"> <div tftDraggable> </div> </div>
|
|
9
|
-
* @note if `dragRoot` is used this directive should be used on the same element to ensure that the drag
|
|
10
|
-
* element accounts for scale
|
|
11
|
-
*/
|
|
12
|
-
export class AutoScrollDirective {
|
|
13
|
-
// this setup allows consumers to set x, y scale independently or just set them both with scale
|
|
14
|
-
scroll(scrollEvent) {
|
|
15
|
-
const target = scrollEvent.target;
|
|
16
|
-
const { scrollTop, scrollLeft } = target;
|
|
17
|
-
this.scrollSubject.next({ scrollTop, scrollLeft });
|
|
18
|
-
}
|
|
19
|
-
constructor(el) {
|
|
20
|
-
this.el = el;
|
|
21
|
-
/**
|
|
22
|
-
* Limit minimum time between scroll events in milliseconds
|
|
23
|
-
*/
|
|
24
|
-
this.autoScrollConfig = {
|
|
25
|
-
margin: 50,
|
|
26
|
-
distance: 3,
|
|
27
|
-
interval: 50,
|
|
28
|
-
speed: 300,
|
|
29
|
-
enabled: true
|
|
30
|
-
};
|
|
31
|
-
this.scrollDeltaObserver = new Subject();
|
|
32
|
-
const { scrollTop, scrollLeft } = el.nativeElement;
|
|
33
|
-
this.scrollSubject = new BehaviorSubject({ scrollTop, scrollLeft });
|
|
34
|
-
this.scrollObserver = this.scrollSubject.pipe(scan((previous, current) => {
|
|
35
|
-
const scrollTop = current.scrollTop - previous.scrollTop;
|
|
36
|
-
const scrollLeft = current.scrollLeft - previous.scrollLeft;
|
|
37
|
-
this.scrollDeltaObserver.next({ scrollTop, scrollLeft });
|
|
38
|
-
return current;
|
|
39
|
-
}), shareReplay(1));
|
|
40
|
-
this.scrollObserver.subscribe();
|
|
41
|
-
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AutoScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
43
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: AutoScrollDirective, selector: "[tftAutoScroll]", inputs: { autoScrollConfig: "autoScrollConfig" }, host: { listeners: { "scroll": "scroll($event)" } }, ngImport: i0 }); }
|
|
44
|
-
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AutoScrollDirective, decorators: [{
|
|
46
|
-
type: Directive,
|
|
47
|
-
args: [{
|
|
48
|
-
selector: '[tftAutoScroll]'
|
|
49
|
-
}]
|
|
50
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { autoScrollConfig: [{
|
|
51
|
-
type: Input
|
|
52
|
-
}], scroll: [{
|
|
53
|
-
type: HostListener,
|
|
54
|
-
args: ['scroll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0ID0gbmV3IEJlaGF2aW9yU3ViamVjdCh7c2Nyb2xsVG9wLCBzY3JvbGxMZWZ0fSk7XG4gICAgdGhpcy5zY3JvbGxPYnNlcnZlciA9IHRoaXMuc2Nyb2xsU3ViamVjdC5waXBlKFxuICAgICAgc2NhbigocHJldmlvdXMsIGN1cnJlbnQpID0+IHtcbiAgICAgICAgY29uc3Qgc2Nyb2xsVG9wID0gY3VycmVudC5zY3JvbGxUb3AgLSBwcmV2aW91cy5zY3JvbGxUb3A7XG4gICAgICAgIGNvbnN0IHNjcm9sbExlZnQgPSBjdXJyZW50LnNjcm9sbExlZnQgLSBwcmV2aW91cy5zY3JvbGxMZWZ0O1xuICAgICAgICB0aGlzLnNjcm9sbERlbHRhT2JzZXJ2ZXIubmV4dCh7c2Nyb2xsVG9wLCBzY3JvbGxMZWZ0fSk7XG4gICAgICAgIHJldHVybiBjdXJyZW50O1xuICAgICAgfSksXG4gICAgICBzaGFyZVJlcGxheSgxKSxcbiAgICApXG4gICAgdGhpcy5zY3JvbGxPYnNlcnZlci5zdWJzY3JpYmUoKTtcbiAgfVxuXG59XG4iXX0=
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Directive, InjectionToken, Input, TemplateRef } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export const TFT_DRAG_PREVIEW = new InjectionToken('DragPreviewDirective');
|
|
4
|
-
export class DragPreviewDirective {
|
|
5
|
-
constructor(templateRef) {
|
|
6
|
-
this.templateRef = templateRef;
|
|
7
|
-
}
|
|
8
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DragPreviewDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
9
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: DragPreviewDirective, selector: "ng-template[tftDragPreview]", inputs: { dragData: "dragData" }, ngImport: i0 }); }
|
|
10
|
-
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DragPreviewDirective, decorators: [{
|
|
12
|
-
type: Directive,
|
|
13
|
-
args: [{
|
|
14
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
15
|
-
selector: 'ng-template[tftDragPreview]',
|
|
16
|
-
}]
|
|
17
|
-
}], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { dragData: [{
|
|
18
|
-
type: Input
|
|
19
|
-
}] } });
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZy1wcmV2aWV3LmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvaW50ZXJhY3Qvc3JjL2xpYi9kaXJlY3RpdmVzL2RyYWctcHJldmlldy5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFNBQVMsRUFBRSxjQUFjLEVBQUUsS0FBSyxFQUFFLFdBQVcsRUFBQyxNQUFNLGVBQWUsQ0FBQzs7QUFFNUUsTUFBTSxDQUFDLE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSxjQUFjLENBQXVCLHNCQUFzQixDQUFDLENBQUM7QUFNakcsTUFBTSxPQUFPLG9CQUFvQjtJQUcvQixZQUFtQixXQUEyQjtRQUEzQixnQkFBVyxHQUFYLFdBQVcsQ0FBZ0I7SUFBSSxDQUFDOzhHQUh4QyxvQkFBb0I7a0dBQXBCLG9CQUFvQjs7MkZBQXBCLG9CQUFvQjtrQkFKaEMsU0FBUzttQkFBQztvQkFDVCw4REFBOEQ7b0JBQzlELFFBQVEsRUFBRSw2QkFBNkI7aUJBQ3ZDO2dGQUdTLFFBQVE7c0JBQWhCLEtBQUsiLCJzb3VyY2VzQ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