@progress/kendo-angular-utils 0.1.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/LICENSE.md +11 -0
- package/NOTICE.txt +654 -0
- package/README.md +31 -0
- package/bundles/kendo-angular-utils.umd.js +5 -0
- package/drag-and-drop/drag-state.service.d.ts +52 -0
- package/drag-and-drop/draghandle.directive.d.ts +16 -0
- package/drag-and-drop/dragtarget.directive.d.ts +155 -0
- package/drag-and-drop/droptarget.directive.d.ts +67 -0
- package/drag-and-drop/events/drag-target/drag-event.d.ts +23 -0
- package/drag-and-drop/events/drag-target/end-event.d.ts +23 -0
- package/drag-and-drop/events/drag-target/index.d.ts +9 -0
- package/drag-and-drop/events/drag-target/press-event.d.ts +22 -0
- package/drag-and-drop/events/drag-target/release-event.d.ts +22 -0
- package/drag-and-drop/events/drag-target/start-event.d.ts +23 -0
- package/drag-and-drop/events/drop-target/drop-event.d.ts +23 -0
- package/drag-and-drop/events/drop-target/enter-event.d.ts +23 -0
- package/drag-and-drop/events/drop-target/index.d.ts +8 -0
- package/drag-and-drop/events/drop-target/leave-event.d.ts +23 -0
- package/drag-and-drop/events/drop-target/over-event.d.ts +23 -0
- package/drag-and-drop/hint.component.d.ts +20 -0
- package/drag-and-drop/models/allowed-target.d.ts +16 -0
- package/drag-and-drop/models/autoscroll-options.d.ts +23 -0
- package/drag-and-drop/models/dragaxis.d.ts +8 -0
- package/drag-and-drop/models/index.d.ts +8 -0
- package/drag-and-drop/models/scroll-direction.d.ts +8 -0
- package/drag-and-drop/util.d.ts +29 -0
- package/drag-and-drop.module.d.ts +15 -0
- package/esm2015/drag-and-drop/drag-state.service.js +126 -0
- package/esm2015/drag-and-drop/draghandle.directive.js +27 -0
- package/esm2015/drag-and-drop/dragtarget.directive.js +389 -0
- package/esm2015/drag-and-drop/droptarget.directive.js +134 -0
- package/esm2015/drag-and-drop/events/drag-target/drag-event.js +17 -0
- package/esm2015/drag-and-drop/events/drag-target/end-event.js +17 -0
- package/esm2015/drag-and-drop/events/drag-target/index.js +9 -0
- package/esm2015/drag-and-drop/events/drag-target/press-event.js +15 -0
- package/esm2015/drag-and-drop/events/drag-target/release-event.js +15 -0
- package/esm2015/drag-and-drop/events/drag-target/start-event.js +17 -0
- package/esm2015/drag-and-drop/events/drop-target/drop-event.js +17 -0
- package/esm2015/drag-and-drop/events/drop-target/enter-event.js +17 -0
- package/esm2015/drag-and-drop/events/drop-target/index.js +8 -0
- package/esm2015/drag-and-drop/events/drop-target/leave-event.js +17 -0
- package/esm2015/drag-and-drop/events/drop-target/over-event.js +17 -0
- package/esm2015/drag-and-drop/hint.component.js +49 -0
- package/esm2015/drag-and-drop/models/allowed-target.js +5 -0
- package/esm2015/drag-and-drop/models/autoscroll-options.js +5 -0
- package/esm2015/drag-and-drop/models/dragaxis.js +5 -0
- package/esm2015/drag-and-drop/models/index.js +5 -0
- package/esm2015/drag-and-drop/models/scroll-direction.js +5 -0
- package/esm2015/drag-and-drop/util.js +30 -0
- package/esm2015/drag-and-drop.module.js +36 -0
- package/esm2015/kendo-angular-utils.js +8 -0
- package/esm2015/main.js +12 -0
- package/esm2015/package-metadata.js +15 -0
- package/esm2015/utils.module.js +49 -0
- package/fesm2015/kendo-angular-utils.js +925 -0
- package/kendo-angular-utils.d.ts +9 -0
- package/main.d.ts +13 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +81 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +21 -0
- package/schematics/ngAdd/index.js.map +1 -0
- package/schematics/ngAdd/schema.json +28 -0
- package/utils.module.d.ts +42 -0
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { Directive, HostBinding, Component, Input, Injectable, EventEmitter, Output, ContentChildren, NgModule } from '@angular/core';
|
|
7
|
+
import * as i1 from '@angular/common';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
+
import { dispatchDragAndDrop, getScrollableParent, autoScroll } from '@progress/kendo-draggable-common';
|
|
11
|
+
import { PreventableEvent, isDocumentAvailable, contains } from '@progress/kendo-angular-common';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
const packageMetadata = {
|
|
17
|
+
name: '@progress/kendo-angular-utils',
|
|
18
|
+
productName: 'Kendo UI for Angular',
|
|
19
|
+
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
20
|
+
publishDate: 1658922268,
|
|
21
|
+
version: '',
|
|
22
|
+
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Represents the Kendo UI DragHandle directive for Angular.
|
|
27
|
+
*/
|
|
28
|
+
class DragHandleDirective {
|
|
29
|
+
constructor(element) {
|
|
30
|
+
this.element = element;
|
|
31
|
+
this.hostClass = true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
DragHandleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragHandleDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
35
|
+
DragHandleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragHandleDirective, selector: "[kendoDragHandle]", host: { properties: { "class.k-cursor-pointer": "this.hostClass" } }, exportAs: ["kendoDragHandle"], ngImport: i0 });
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragHandleDirective, decorators: [{
|
|
37
|
+
type: Directive,
|
|
38
|
+
args: [{
|
|
39
|
+
selector: '[kendoDragHandle]',
|
|
40
|
+
exportAs: 'kendoDragHandle'
|
|
41
|
+
}]
|
|
42
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { hostClass: [{
|
|
43
|
+
type: HostBinding,
|
|
44
|
+
args: ['class.k-cursor-pointer']
|
|
45
|
+
}] } });
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Arguments for the press event of the DragTarget.
|
|
49
|
+
*/
|
|
50
|
+
class PressEvent {
|
|
51
|
+
/**
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
constructor(args) {
|
|
55
|
+
Object.assign(this, args);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Arguments for the dragStart event of the DragTarget.
|
|
61
|
+
*/
|
|
62
|
+
class DragStartEvent extends PreventableEvent {
|
|
63
|
+
/**
|
|
64
|
+
* @hidden
|
|
65
|
+
*/
|
|
66
|
+
constructor(args) {
|
|
67
|
+
super();
|
|
68
|
+
Object.assign(this, args);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Arguments for the release event of the DragTarget.
|
|
74
|
+
*/
|
|
75
|
+
class ReleaseEvent {
|
|
76
|
+
/**
|
|
77
|
+
* @hidden
|
|
78
|
+
*/
|
|
79
|
+
constructor(args) {
|
|
80
|
+
Object.assign(this, args);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Arguments for the dragEnd event of the DragTarget.
|
|
86
|
+
*/
|
|
87
|
+
class DragEndEvent extends PreventableEvent {
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
*/
|
|
91
|
+
constructor(args) {
|
|
92
|
+
super();
|
|
93
|
+
Object.assign(this, args);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Arguments for the drag event of the DragTarget.
|
|
99
|
+
*/
|
|
100
|
+
class DragEvent extends PreventableEvent {
|
|
101
|
+
/**
|
|
102
|
+
* @hidden
|
|
103
|
+
*/
|
|
104
|
+
constructor(args) {
|
|
105
|
+
super();
|
|
106
|
+
Object.assign(this, args);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @hidden
|
|
112
|
+
*/
|
|
113
|
+
const dragTargetTransition = 'transform .3s ease-in-out';
|
|
114
|
+
/**
|
|
115
|
+
* @hidden
|
|
116
|
+
*/
|
|
117
|
+
const getAction = (event, draggable) => {
|
|
118
|
+
return {
|
|
119
|
+
event: event,
|
|
120
|
+
payload: draggable
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* @hidden
|
|
125
|
+
*/
|
|
126
|
+
const setElementStyles = (renderer, elem, styles) => {
|
|
127
|
+
const props = Object.keys(styles);
|
|
128
|
+
props.forEach(p => {
|
|
129
|
+
renderer.setStyle(elem, p, styles[p]);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* @hidden
|
|
134
|
+
*/
|
|
135
|
+
const isPresent = (value) => value !== null && value !== undefined;
|
|
136
|
+
|
|
137
|
+
const DEFAULT_ZINDEX = 10;
|
|
138
|
+
/**
|
|
139
|
+
* @hidden
|
|
140
|
+
*/
|
|
141
|
+
class HintComponent {
|
|
142
|
+
constructor(element) {
|
|
143
|
+
this.element = element;
|
|
144
|
+
this.hostClasses = true;
|
|
145
|
+
this.zIndex = DEFAULT_ZINDEX;
|
|
146
|
+
this.touchAction = 'none';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
HintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HintComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
150
|
+
HintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: HintComponent, selector: "ng-component", inputs: { template: "template", directive: "directive" }, host: { properties: { "class.k-pos-absolute": "this.hostClasses", "class.k-cursor-grab": "this.hostClasses", "style.zIndex": "this.zIndex", "style.touch-action": "this.touchAction" } }, ngImport: i0, template: `
|
|
151
|
+
<ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">
|
|
152
|
+
</ng-container>
|
|
153
|
+
`, isInline: true, directives: [{ type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HintComponent, decorators: [{
|
|
155
|
+
type: Component,
|
|
156
|
+
args: [{
|
|
157
|
+
template: `
|
|
158
|
+
<ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">
|
|
159
|
+
</ng-container>
|
|
160
|
+
`
|
|
161
|
+
}]
|
|
162
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { template: [{
|
|
163
|
+
type: Input
|
|
164
|
+
}], directive: [{
|
|
165
|
+
type: Input
|
|
166
|
+
}], hostClasses: [{
|
|
167
|
+
type: HostBinding,
|
|
168
|
+
args: ['class.k-pos-absolute']
|
|
169
|
+
}, {
|
|
170
|
+
type: HostBinding,
|
|
171
|
+
args: ['class.k-cursor-grab']
|
|
172
|
+
}], zIndex: [{
|
|
173
|
+
type: HostBinding,
|
|
174
|
+
args: ['style.zIndex']
|
|
175
|
+
}], touchAction: [{
|
|
176
|
+
type: HostBinding,
|
|
177
|
+
args: ['style.touch-action']
|
|
178
|
+
}] } });
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @hidden
|
|
182
|
+
*/
|
|
183
|
+
class DragStateService {
|
|
184
|
+
constructor() {
|
|
185
|
+
this.dragTarget = null;
|
|
186
|
+
this.dropTarget = null;
|
|
187
|
+
this.dragTargets = [];
|
|
188
|
+
this.dropTargets = [];
|
|
189
|
+
this.pressed = false;
|
|
190
|
+
this.ignoreMouse = false;
|
|
191
|
+
this.autoScroll = true;
|
|
192
|
+
this.isScrolling = false;
|
|
193
|
+
this.scrollableParent = null;
|
|
194
|
+
this.autoScrollDirection = { horizontal: true, vertical: true };
|
|
195
|
+
this.initialClientOffset = { x: 0, y: 0 };
|
|
196
|
+
this.clientOffset = { x: 0, y: 0 };
|
|
197
|
+
this.initialScrollOffset = { x: 0, y: 0 };
|
|
198
|
+
this.scrollOffset = { x: 0, y: 0 };
|
|
199
|
+
this.offset = { x: 0, y: 0 };
|
|
200
|
+
this.pageOffset = { x: 0, y: 0 };
|
|
201
|
+
this.velocity = { x: 0, y: 0 };
|
|
202
|
+
this.callbacks = {};
|
|
203
|
+
this.scrollInterval = null;
|
|
204
|
+
this.setCallbacks();
|
|
205
|
+
}
|
|
206
|
+
handleDragAndDrop(action) {
|
|
207
|
+
this.updateState();
|
|
208
|
+
dispatchDragAndDrop(this.state, action, this.callbacks);
|
|
209
|
+
}
|
|
210
|
+
setPressed(pressed) {
|
|
211
|
+
this.pressed = pressed;
|
|
212
|
+
}
|
|
213
|
+
setScrolling(isScrolling) {
|
|
214
|
+
this.isScrolling = isScrolling;
|
|
215
|
+
if (isScrolling) {
|
|
216
|
+
const scrollableParent = getScrollableParent(document.elementFromPoint(this.clientOffset.x, this.clientOffset.y));
|
|
217
|
+
window.clearInterval(this.scrollInterval);
|
|
218
|
+
this.scrollInterval = window.setInterval(() => {
|
|
219
|
+
autoScroll(scrollableParent, { x: this.velocity.x, y: this.velocity.y });
|
|
220
|
+
}, 50);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
if (this.scrollInterval) {
|
|
224
|
+
window.clearInterval(this.scrollInterval);
|
|
225
|
+
this.scrollInterval = null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
setVelocity(velocity) {
|
|
230
|
+
this.velocity = velocity;
|
|
231
|
+
}
|
|
232
|
+
setOffset(offset) {
|
|
233
|
+
this.offset = offset;
|
|
234
|
+
}
|
|
235
|
+
setClientOffset(clientOffset) {
|
|
236
|
+
this.clientOffset = clientOffset;
|
|
237
|
+
}
|
|
238
|
+
setPageOffset(pageOffset) {
|
|
239
|
+
this.pageOffset = pageOffset;
|
|
240
|
+
}
|
|
241
|
+
setInitialClientOffset(initialClientOffset) {
|
|
242
|
+
this.initialClientOffset = initialClientOffset;
|
|
243
|
+
}
|
|
244
|
+
setScrollOffset(scrollOffset) {
|
|
245
|
+
this.scrollOffset = scrollOffset;
|
|
246
|
+
}
|
|
247
|
+
setInitialScrollOffset(initialScrollOffset) {
|
|
248
|
+
this.initialScrollOffset = initialScrollOffset;
|
|
249
|
+
}
|
|
250
|
+
updateState() {
|
|
251
|
+
this.state = {
|
|
252
|
+
drag: this.dragTarget,
|
|
253
|
+
drop: this.dropTarget,
|
|
254
|
+
drags: this.dragTargets,
|
|
255
|
+
drops: this.dropTargets,
|
|
256
|
+
pressed: this.pressed,
|
|
257
|
+
ignoreMouse: this.ignoreMouse,
|
|
258
|
+
autoScroll: this.autoScroll,
|
|
259
|
+
isScrolling: this.isScrolling,
|
|
260
|
+
scrollableParent: this.scrollableParent,
|
|
261
|
+
autoScrollDirection: this.autoScrollDirection,
|
|
262
|
+
initialClientOffset: this.initialClientOffset,
|
|
263
|
+
clientOffset: this.clientOffset,
|
|
264
|
+
initialScrollOffset: this.initialScrollOffset,
|
|
265
|
+
scrollOffset: this.scrollOffset,
|
|
266
|
+
offset: this.offset,
|
|
267
|
+
pageOffset: this.pageOffset,
|
|
268
|
+
velocity: this.velocity
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
setCallbacks() {
|
|
272
|
+
this.callbacks = {
|
|
273
|
+
onVelocityChange: this.setVelocity.bind(this),
|
|
274
|
+
onOffsetChange: this.setOffset.bind(this),
|
|
275
|
+
onClientOffsetChange: this.setClientOffset.bind(this),
|
|
276
|
+
onPageOffsetChange: this.setPageOffset.bind(this),
|
|
277
|
+
onInitialClientOffsetChange: this.setInitialClientOffset.bind(this),
|
|
278
|
+
onScrollOffsetChange: this.setScrollOffset.bind(this),
|
|
279
|
+
onInitialScrollOffsetChange: this.setInitialScrollOffset.bind(this),
|
|
280
|
+
onIsPressedChange: this.setPressed.bind(this),
|
|
281
|
+
onIsScrollingChange: this.setScrolling.bind(this)
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
ngOnDestroy() {
|
|
285
|
+
if (this.scrollInterval) {
|
|
286
|
+
window.clearInterval(this.scrollInterval);
|
|
287
|
+
this.scrollInterval = null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
DragStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
292
|
+
DragStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragStateService, providedIn: 'root' });
|
|
293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragStateService, decorators: [{
|
|
294
|
+
type: Injectable,
|
|
295
|
+
args: [{
|
|
296
|
+
providedIn: 'root'
|
|
297
|
+
}]
|
|
298
|
+
}], ctorParameters: function () { return []; } });
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Represents the Kendo UI DragTarget directive for Angular.
|
|
302
|
+
*/
|
|
303
|
+
class DragTargetDirective {
|
|
304
|
+
constructor(element, renderer, ngZone, service, viewContainer, resolver) {
|
|
305
|
+
this.element = element;
|
|
306
|
+
this.renderer = renderer;
|
|
307
|
+
this.ngZone = ngZone;
|
|
308
|
+
this.service = service;
|
|
309
|
+
this.viewContainer = viewContainer;
|
|
310
|
+
this.resolver = resolver;
|
|
311
|
+
/**
|
|
312
|
+
* The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})).
|
|
313
|
+
*
|
|
314
|
+
* @default 0
|
|
315
|
+
*/
|
|
316
|
+
this.threshold = 0;
|
|
317
|
+
/**
|
|
318
|
+
* Defines the automatic container scrolling behavior when close to the edge ([see example]({% slug auto_scroll %})).
|
|
319
|
+
*
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
322
|
+
this.autoScroll = true;
|
|
323
|
+
/**
|
|
324
|
+
* Defines the delay in milliseconds after which the drag will begin ([see example]({% slug drag_delay %})).
|
|
325
|
+
*
|
|
326
|
+
* @default 0
|
|
327
|
+
*/
|
|
328
|
+
this.dragDelay = 0;
|
|
329
|
+
/**
|
|
330
|
+
* Fires when the user presses the DragTarget element.
|
|
331
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
332
|
+
*/
|
|
333
|
+
this.press = new EventEmitter();
|
|
334
|
+
/**
|
|
335
|
+
* Fires when the dragging of the DragTarget element begins.
|
|
336
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
337
|
+
*/
|
|
338
|
+
this.dragStart = new EventEmitter();
|
|
339
|
+
/**
|
|
340
|
+
* Fires while the user drags the DragTarget element.
|
|
341
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
342
|
+
*/
|
|
343
|
+
this.drag = new EventEmitter();
|
|
344
|
+
/**
|
|
345
|
+
* Fires when the user releases the DragTarget element.
|
|
346
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
347
|
+
*/
|
|
348
|
+
this.release = new EventEmitter();
|
|
349
|
+
/**
|
|
350
|
+
* Fires when the dragging of the DragTarget element ends.
|
|
351
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
352
|
+
*/
|
|
353
|
+
this.dragEnd = new EventEmitter();
|
|
354
|
+
this.touchAction = 'none';
|
|
355
|
+
this.dragTarget = null;
|
|
356
|
+
this.domSubscriptions = [];
|
|
357
|
+
this.hint = null;
|
|
358
|
+
this.initialPosition = { x: 0, y: 0 };
|
|
359
|
+
this.dragStarted = false;
|
|
360
|
+
this.pressed = false;
|
|
361
|
+
this.dragTimeout = null;
|
|
362
|
+
validatePackage(packageMetadata);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @hidden
|
|
366
|
+
*/
|
|
367
|
+
get nativeElement() {
|
|
368
|
+
return this.element.nativeElement;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @hidden
|
|
372
|
+
*/
|
|
373
|
+
get hintElem() {
|
|
374
|
+
return this.hint.instance.element.nativeElement;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @hidden
|
|
378
|
+
*/
|
|
379
|
+
onPointerDown(event) {
|
|
380
|
+
if (this.dragHandles.length && !this.isDragHandle(event.target)) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
event.preventDefault();
|
|
384
|
+
const action = getAction(event, this.dragTarget);
|
|
385
|
+
this.service.handleDragAndDrop(action);
|
|
386
|
+
this.service.autoScroll = typeof this.autoScroll === 'object' ? this.autoScroll.enabled !== false : this.autoScroll;
|
|
387
|
+
this.service.scrollableParent = this.getAutoScrollContainer();
|
|
388
|
+
this.service.autoScrollDirection = typeof this.autoScroll === 'object' ? this.autoScroll.direction : { horizontal: true, vertical: true };
|
|
389
|
+
this.ngZone.runOutsideAngular(() => {
|
|
390
|
+
this.attachDomHandlers();
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @hidden
|
|
395
|
+
*/
|
|
396
|
+
onPointerMove(event) {
|
|
397
|
+
event.preventDefault();
|
|
398
|
+
const action = getAction(event, this.dragTarget);
|
|
399
|
+
this.service.handleDragAndDrop(action);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* @hidden
|
|
403
|
+
*/
|
|
404
|
+
onPointerUp(event) {
|
|
405
|
+
event.preventDefault();
|
|
406
|
+
const action = getAction(event, this.dragTarget);
|
|
407
|
+
this.service.handleDragAndDrop(action);
|
|
408
|
+
this.ngZone.runOutsideAngular(() => {
|
|
409
|
+
this.attachDomHandlers();
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
ngOnInit() {
|
|
413
|
+
this.initializeDraggable();
|
|
414
|
+
}
|
|
415
|
+
ngAfterContentInit() {
|
|
416
|
+
if (isPresent(this.element) || isPresent(this.dragTarget)) {
|
|
417
|
+
this.ngZone.runOutsideAngular(() => {
|
|
418
|
+
this.attachDomHandlers();
|
|
419
|
+
if (!this.dragHandles.length) {
|
|
420
|
+
this.renderer.addClass(this.nativeElement, 'k-cursor-pointer');
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
this.service.dragTargets.push(this.dragTarget);
|
|
425
|
+
}
|
|
426
|
+
ngOnDestroy() {
|
|
427
|
+
this.domSubscriptions.forEach(subscription => subscription());
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @hidden
|
|
431
|
+
*/
|
|
432
|
+
handlePress(event) {
|
|
433
|
+
if (this.dragDelay > 0) {
|
|
434
|
+
this.dragTimeout = setTimeout(() => {
|
|
435
|
+
this.pressed = true;
|
|
436
|
+
}, this.dragDelay);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
this.pressed = true;
|
|
440
|
+
}
|
|
441
|
+
this.ngZone.run(() => {
|
|
442
|
+
const eventArgs = new PressEvent({ event, element: this.nativeElement });
|
|
443
|
+
this.press.emit(eventArgs);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* @hidden
|
|
448
|
+
*/
|
|
449
|
+
handleDragStart(event) {
|
|
450
|
+
if (!this.pressed) {
|
|
451
|
+
if (this.dragTimeout) {
|
|
452
|
+
clearTimeout(this.dragTimeout);
|
|
453
|
+
this.dragTimeout = null;
|
|
454
|
+
}
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (isPresent(this.hintTemplate)) {
|
|
458
|
+
this.createHint();
|
|
459
|
+
if (isPresent(this.hint)) {
|
|
460
|
+
this.renderer.setStyle(this.nativeElement, 'opacity', '0.7');
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
this.dragStarted = this.threshold === 0;
|
|
464
|
+
this.service.dragTarget = this.dragTarget;
|
|
465
|
+
this.service.dragTargetDirective = this;
|
|
466
|
+
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
467
|
+
this.ngZone.run(() => {
|
|
468
|
+
const eventArgs = new DragStartEvent({ event, element: this.nativeElement });
|
|
469
|
+
this.dragStart.emit(eventArgs);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* @hidden
|
|
474
|
+
*/
|
|
475
|
+
handleDrag(event) {
|
|
476
|
+
if (!this.pressed) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
480
|
+
let coordinates = { x: 0, y: 0 };
|
|
481
|
+
if (this.restrictByAxis === 'horizontal') {
|
|
482
|
+
coordinates = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
483
|
+
}
|
|
484
|
+
else if (this.restrictByAxis === 'vertical') {
|
|
485
|
+
coordinates = { x: 0, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
coordinates = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
489
|
+
}
|
|
490
|
+
const thresholdNotReached = Math.abs(coordinates.x) < this.threshold && Math.abs(coordinates.y) < this.threshold;
|
|
491
|
+
if (!this.dragStarted && thresholdNotReached) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const transform = `translate(${coordinates.x}px, ${coordinates.y}px)`;
|
|
495
|
+
setElementStyles(this.renderer, elem, {
|
|
496
|
+
transform: transform,
|
|
497
|
+
transition: 'none'
|
|
498
|
+
});
|
|
499
|
+
if (!this.dragStarted && this.threshold > 0) {
|
|
500
|
+
this.dragStarted = true;
|
|
501
|
+
}
|
|
502
|
+
this.ngZone.run(() => {
|
|
503
|
+
const eventArgs = new DragEvent({ event, element: this.nativeElement });
|
|
504
|
+
this.drag.emit(eventArgs);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @hidden
|
|
509
|
+
*/
|
|
510
|
+
handleRelease(event) {
|
|
511
|
+
if (this.dragTimeout) {
|
|
512
|
+
clearTimeout(this.dragTimeout);
|
|
513
|
+
this.dragTimeout = null;
|
|
514
|
+
this.pressed = false;
|
|
515
|
+
}
|
|
516
|
+
this.service.dragTarget = null;
|
|
517
|
+
this.service.dragTargetDirective = null;
|
|
518
|
+
this.ngZone.run(() => {
|
|
519
|
+
const eventArgs = new ReleaseEvent({ event, element: this.nativeElement });
|
|
520
|
+
this.release.emit(eventArgs);
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* @hidden
|
|
525
|
+
*/
|
|
526
|
+
handleDragEnd(event) {
|
|
527
|
+
if (!this.dragStarted) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
this.dragStarted = false;
|
|
531
|
+
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
532
|
+
if (isPresent(this.hint)) {
|
|
533
|
+
this.renderer.removeStyle(this.nativeElement, 'opacity');
|
|
534
|
+
this.destroyHint();
|
|
535
|
+
}
|
|
536
|
+
this.renderer.removeStyle(elem, 'transform');
|
|
537
|
+
setElementStyles(this.renderer, elem, {
|
|
538
|
+
transition: dragTargetTransition
|
|
539
|
+
});
|
|
540
|
+
this.ngZone.run(() => {
|
|
541
|
+
const eventArgs = new DragEndEvent({ event, element: this.nativeElement });
|
|
542
|
+
this.dragEnd.emit(eventArgs);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* @hidden
|
|
547
|
+
*/
|
|
548
|
+
initializeDraggable() {
|
|
549
|
+
this.dragTarget = {
|
|
550
|
+
element: this.nativeElement,
|
|
551
|
+
hint: null,
|
|
552
|
+
onPress: this.handlePress.bind(this),
|
|
553
|
+
onRelease: this.handleRelease.bind(this),
|
|
554
|
+
onDragStart: this.handleDragStart.bind(this),
|
|
555
|
+
onDrag: this.handleDrag.bind(this),
|
|
556
|
+
onDragEnd: this.handleDragEnd.bind(this)
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* @hidden
|
|
561
|
+
*/
|
|
562
|
+
attachDomHandlers() {
|
|
563
|
+
if (this.domSubscriptions.length > 0) {
|
|
564
|
+
this.domSubscriptions.forEach(subscription => subscription());
|
|
565
|
+
}
|
|
566
|
+
if (!(isDocumentAvailable() && isPresent(this.element))) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (this.service.pressed) {
|
|
570
|
+
this.onPointerMove = this.onPointerMove.bind(this);
|
|
571
|
+
this.onPointerUp = this.onPointerUp.bind(this);
|
|
572
|
+
let scrollable = getScrollableParent(this.nativeElement);
|
|
573
|
+
this.domSubscriptions = [
|
|
574
|
+
this.renderer.listen(document, 'pointermove', this.onPointerMove),
|
|
575
|
+
this.renderer.listen(document, 'mousemove', this.onPointerMove),
|
|
576
|
+
this.renderer.listen(document, 'touchmove', this.onPointerMove),
|
|
577
|
+
this.renderer.listen(document, 'pointerup', this.onPointerUp),
|
|
578
|
+
this.renderer.listen(document, 'pointercancel', this.onPointerUp),
|
|
579
|
+
this.renderer.listen(document, 'mouseup', this.onPointerUp),
|
|
580
|
+
this.renderer.listen(document, 'contextmenu', this.onPointerUp),
|
|
581
|
+
this.renderer.listen(document, 'touchend', this.onPointerUp),
|
|
582
|
+
this.renderer.listen(document, 'touchcancel', this.onPointerUp)
|
|
583
|
+
];
|
|
584
|
+
if (scrollable) {
|
|
585
|
+
if (scrollable === document.getElementsByTagName('html')[0]) {
|
|
586
|
+
scrollable = document;
|
|
587
|
+
}
|
|
588
|
+
this.domSubscriptions.push(this.renderer.listen(scrollable, 'scroll', this.onPointerMove));
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
this.onPointerDown = this.onPointerDown.bind(this);
|
|
593
|
+
const element = this.nativeElement;
|
|
594
|
+
this.domSubscriptions = [
|
|
595
|
+
this.renderer.listen(element, 'pointerdown', this.onPointerDown),
|
|
596
|
+
this.renderer.listen(element, 'mousedown', this.onPointerDown),
|
|
597
|
+
this.renderer.listen(element, 'touchstart', this.onPointerDown)
|
|
598
|
+
];
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* @hidden
|
|
603
|
+
*/
|
|
604
|
+
isDragHandle(el) {
|
|
605
|
+
return this.dragHandles.toArray().some(dh => contains(dh.element.nativeElement, el, true));
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* @hidden
|
|
609
|
+
*/
|
|
610
|
+
getAutoScrollContainer() {
|
|
611
|
+
return typeof this.autoScroll === 'object' &&
|
|
612
|
+
this.autoScroll.boundaryElementRef &&
|
|
613
|
+
this.autoScroll.boundaryElementRef.nativeElement ?
|
|
614
|
+
this.autoScroll.boundaryElementRef.nativeElement : null;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* @hidden
|
|
618
|
+
*/
|
|
619
|
+
createHint() {
|
|
620
|
+
const hintComponent = this.resolver.resolveComponentFactory(HintComponent);
|
|
621
|
+
this.hint = this.viewContainer.createComponent(hintComponent);
|
|
622
|
+
this.hint.instance.template = this.hintTemplate;
|
|
623
|
+
this.hint.instance.directive = this;
|
|
624
|
+
this.hint.changeDetectorRef.detectChanges();
|
|
625
|
+
this.dragTarget.hint = this.hint.instance.element.nativeElement;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* @hidden
|
|
629
|
+
*/
|
|
630
|
+
destroyHint() {
|
|
631
|
+
this.hint.destroy();
|
|
632
|
+
this.hint.changeDetectorRef.detectChanges();
|
|
633
|
+
this.hint = null;
|
|
634
|
+
this.dragTarget.hint = null;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
638
|
+
DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hintTemplate: "hintTemplate", threshold: "threshold", autoScroll: "autoScroll", link: "link", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis" }, outputs: { press: "press", dragStart: "dragStart", drag: "drag", release: "release", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
639
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, decorators: [{
|
|
640
|
+
type: Directive,
|
|
641
|
+
args: [{
|
|
642
|
+
selector: '[kendoDragTarget]',
|
|
643
|
+
exportAs: 'kendoDragTarget'
|
|
644
|
+
}]
|
|
645
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: DragStateService }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { hintTemplate: [{
|
|
646
|
+
type: Input
|
|
647
|
+
}], threshold: [{
|
|
648
|
+
type: Input
|
|
649
|
+
}], autoScroll: [{
|
|
650
|
+
type: Input
|
|
651
|
+
}], link: [{
|
|
652
|
+
type: Input
|
|
653
|
+
}], dragDelay: [{
|
|
654
|
+
type: Input
|
|
655
|
+
}], restrictByAxis: [{
|
|
656
|
+
type: Input
|
|
657
|
+
}], press: [{
|
|
658
|
+
type: Output
|
|
659
|
+
}], dragStart: [{
|
|
660
|
+
type: Output
|
|
661
|
+
}], drag: [{
|
|
662
|
+
type: Output
|
|
663
|
+
}], release: [{
|
|
664
|
+
type: Output
|
|
665
|
+
}], dragEnd: [{
|
|
666
|
+
type: Output
|
|
667
|
+
}], touchAction: [{
|
|
668
|
+
type: HostBinding,
|
|
669
|
+
args: ['style.touch-action']
|
|
670
|
+
}], dragHandles: [{
|
|
671
|
+
type: ContentChildren,
|
|
672
|
+
args: [DragHandleDirective]
|
|
673
|
+
}] } });
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Arguments for the dragEnter event of the DropTarget.
|
|
677
|
+
*/
|
|
678
|
+
class DragEnterEvent extends PreventableEvent {
|
|
679
|
+
/**
|
|
680
|
+
* @hidden
|
|
681
|
+
*/
|
|
682
|
+
constructor(args) {
|
|
683
|
+
super();
|
|
684
|
+
Object.assign(this, args);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Arguments for the dragOver event of the DropTarget.
|
|
690
|
+
*/
|
|
691
|
+
class DragOverEvent extends PreventableEvent {
|
|
692
|
+
/**
|
|
693
|
+
* @hidden
|
|
694
|
+
*/
|
|
695
|
+
constructor(args) {
|
|
696
|
+
super();
|
|
697
|
+
Object.assign(this, args);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Arguments for the dragLeave event of the DropTarget.
|
|
703
|
+
*/
|
|
704
|
+
class DragLeaveEvent extends PreventableEvent {
|
|
705
|
+
/**
|
|
706
|
+
* @hidden
|
|
707
|
+
*/
|
|
708
|
+
constructor(args) {
|
|
709
|
+
super();
|
|
710
|
+
Object.assign(this, args);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Arguments for the drop event of the DropTarget.
|
|
716
|
+
*/
|
|
717
|
+
class DropEvent extends PreventableEvent {
|
|
718
|
+
/**
|
|
719
|
+
* @hidden
|
|
720
|
+
*/
|
|
721
|
+
constructor(args) {
|
|
722
|
+
super();
|
|
723
|
+
Object.assign(this, args);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Represents the Kendo UI DropTarget directive for Angular.
|
|
729
|
+
*/
|
|
730
|
+
class DropTargetDirective {
|
|
731
|
+
constructor(service, element, ngZone) {
|
|
732
|
+
this.service = service;
|
|
733
|
+
this.element = element;
|
|
734
|
+
this.ngZone = ngZone;
|
|
735
|
+
/**
|
|
736
|
+
* Fires when a DragTarget element enters the DropTarget.
|
|
737
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
738
|
+
*/
|
|
739
|
+
this.dragEnter = new EventEmitter();
|
|
740
|
+
/**
|
|
741
|
+
* Fires when a DragTarget element is being dragged over the DropTarget.
|
|
742
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
743
|
+
*/
|
|
744
|
+
this.dragOver = new EventEmitter();
|
|
745
|
+
/**
|
|
746
|
+
* Fires when a DragTarget element leaves the DropTarget.
|
|
747
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
748
|
+
*/
|
|
749
|
+
this.dragLeave = new EventEmitter();
|
|
750
|
+
/**
|
|
751
|
+
* Fires when a DragTarget element is dropped over the DropTarget.
|
|
752
|
+
* This event is preventable. Preventing it allows full logic customization.
|
|
753
|
+
*/
|
|
754
|
+
this.drop = new EventEmitter();
|
|
755
|
+
validatePackage(packageMetadata);
|
|
756
|
+
}
|
|
757
|
+
ngOnInit() {
|
|
758
|
+
this.initializeDropTarget();
|
|
759
|
+
this.service.dropTargets.push(this.dropTarget);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* @hidden
|
|
763
|
+
*/
|
|
764
|
+
handleDragEnter(event) {
|
|
765
|
+
let allowed = true;
|
|
766
|
+
if (isPresent(this.allowedDragTargets)) {
|
|
767
|
+
switch (typeof this.allowedDragTargets) {
|
|
768
|
+
case 'function': {
|
|
769
|
+
allowed = this.allowedDragTargets(this.service.dragTargetDirective);
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
case 'string': {
|
|
773
|
+
allowed = this.service.dragTargetDirective.link === this.allowedDragTargets;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
default: {
|
|
777
|
+
allowed = this.allowedDragTargets.some(dt => dt === this.service.dragTargetDirective.link);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if (allowed) {
|
|
782
|
+
this.service.dropTarget = this.dropTarget;
|
|
783
|
+
this.ngZone.run(() => {
|
|
784
|
+
const eventArgs = new DragEnterEvent({ event, element: this.element.nativeElement });
|
|
785
|
+
this.dragEnter.emit(eventArgs);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* @hidden
|
|
791
|
+
*/
|
|
792
|
+
handleDragLeave(event) {
|
|
793
|
+
this.service.dropTarget = null;
|
|
794
|
+
this.ngZone.run(() => {
|
|
795
|
+
const eventArgs = new DragLeaveEvent({ event, element: this.element.nativeElement });
|
|
796
|
+
this.dragLeave.emit(eventArgs);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* @hidden
|
|
801
|
+
*/
|
|
802
|
+
handleDragOver(event) {
|
|
803
|
+
this.ngZone.run(() => {
|
|
804
|
+
const eventArgs = new DragOverEvent({ event, element: this.element.nativeElement });
|
|
805
|
+
this.dragOver.emit(eventArgs);
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* @hidden
|
|
810
|
+
*/
|
|
811
|
+
handleDrop(event) {
|
|
812
|
+
this.ngZone.run(() => {
|
|
813
|
+
const eventArgs = new DropEvent({ event, element: this.element.nativeElement });
|
|
814
|
+
this.drop.emit(eventArgs);
|
|
815
|
+
});
|
|
816
|
+
this.service.setScrollOffset({ x: 0, y: 0 });
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* @hidden
|
|
820
|
+
*/
|
|
821
|
+
initializeDropTarget() {
|
|
822
|
+
this.dropTarget = {
|
|
823
|
+
element: this.element.nativeElement,
|
|
824
|
+
onDragEnter: this.handleDragEnter.bind(this),
|
|
825
|
+
onDragLeave: this.handleDragLeave.bind(this),
|
|
826
|
+
onDragOver: this.handleDragOver.bind(this),
|
|
827
|
+
onDrop: this.handleDrop.bind(this)
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
DropTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropTargetDirective, deps: [{ token: DragStateService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
832
|
+
DropTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DropTargetDirective, selector: "[kendoDropTarget]", inputs: { allowedDragTargets: "allowedDragTargets" }, outputs: { dragEnter: "dragEnter", dragOver: "dragOver", dragLeave: "dragLeave", drop: "drop" }, exportAs: ["kendoDropTarget"], ngImport: i0 });
|
|
833
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropTargetDirective, decorators: [{
|
|
834
|
+
type: Directive,
|
|
835
|
+
args: [{
|
|
836
|
+
selector: '[kendoDropTarget]',
|
|
837
|
+
exportAs: 'kendoDropTarget'
|
|
838
|
+
}]
|
|
839
|
+
}], ctorParameters: function () { return [{ type: DragStateService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { allowedDragTargets: [{
|
|
840
|
+
type: Input
|
|
841
|
+
}], dragEnter: [{
|
|
842
|
+
type: Output
|
|
843
|
+
}], dragOver: [{
|
|
844
|
+
type: Output
|
|
845
|
+
}], dragLeave: [{
|
|
846
|
+
type: Output
|
|
847
|
+
}], drop: [{
|
|
848
|
+
type: Output
|
|
849
|
+
}] } });
|
|
850
|
+
|
|
851
|
+
const EXPORTS = [
|
|
852
|
+
DragTargetDirective,
|
|
853
|
+
DragHandleDirective,
|
|
854
|
+
DropTargetDirective,
|
|
855
|
+
HintComponent
|
|
856
|
+
];
|
|
857
|
+
class DragAndDropModule {
|
|
858
|
+
}
|
|
859
|
+
DragAndDropModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
860
|
+
DragAndDropModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, declarations: [DragTargetDirective,
|
|
861
|
+
DragHandleDirective,
|
|
862
|
+
DropTargetDirective,
|
|
863
|
+
HintComponent], imports: [CommonModule], exports: [DragTargetDirective,
|
|
864
|
+
DragHandleDirective,
|
|
865
|
+
DropTargetDirective,
|
|
866
|
+
HintComponent] });
|
|
867
|
+
DragAndDropModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, imports: [[CommonModule]] });
|
|
868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragAndDropModule, decorators: [{
|
|
869
|
+
type: NgModule,
|
|
870
|
+
args: [{
|
|
871
|
+
declarations: [...EXPORTS],
|
|
872
|
+
exports: [...EXPORTS],
|
|
873
|
+
imports: [CommonModule]
|
|
874
|
+
}]
|
|
875
|
+
}] });
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
879
|
+
* definition for the Utils components.
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
*
|
|
883
|
+
* ```ts-no-run
|
|
884
|
+
* // Import the Utils module
|
|
885
|
+
* import { UtilsModule } from '@progress/kendo-angular-utils';
|
|
886
|
+
*
|
|
887
|
+
* // The browser platform with a compiler
|
|
888
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
889
|
+
*
|
|
890
|
+
* import { NgModule } from '@angular/core';
|
|
891
|
+
*
|
|
892
|
+
* // Import the app component
|
|
893
|
+
* import { AppComponent } from './app.component';
|
|
894
|
+
*
|
|
895
|
+
* // Define the app module
|
|
896
|
+
* _@NgModule({
|
|
897
|
+
* declarations: [AppComponent], // declare app component
|
|
898
|
+
* imports: [BrowserModule, UtilsModule], // import Utils module
|
|
899
|
+
* bootstrap: [AppComponent]
|
|
900
|
+
* })
|
|
901
|
+
* export class AppModule {}
|
|
902
|
+
*
|
|
903
|
+
* // Compile and launch the module
|
|
904
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
905
|
+
*
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
class UtilsModule {
|
|
909
|
+
}
|
|
910
|
+
UtilsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UtilsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
911
|
+
UtilsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UtilsModule, exports: [DragAndDropModule] });
|
|
912
|
+
UtilsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UtilsModule, imports: [DragAndDropModule] });
|
|
913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UtilsModule, decorators: [{
|
|
914
|
+
type: NgModule,
|
|
915
|
+
args: [{
|
|
916
|
+
exports: [DragAndDropModule]
|
|
917
|
+
}]
|
|
918
|
+
}] });
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Generated bundle index. Do not edit.
|
|
922
|
+
*/
|
|
923
|
+
|
|
924
|
+
export { DragAndDropModule, DragEndEvent, DragEnterEvent, DragEvent, DragHandleDirective, DragLeaveEvent, DragOverEvent, DragStartEvent, DragTargetDirective, DropEvent, DropTargetDirective, HintComponent, PressEvent, ReleaseEvent, UtilsModule };
|
|
925
|
+
|