@angular/cdk 21.0.5 → 21.0.6
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 +1 -1
- package/fesm2022/_overlay-module-chunk.mjs +15 -4
- package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +244 -241
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/_overlay-module-chunk.d.ts +2 -0
- package/types/drag-drop.d.ts +23 -7
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('21.0.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('21.0.6');\n"],"names":["VERSION","Version"],"mappings":";;MAWaA,OAAO,GAAG,IAAIC,OAAO,CAAC,mBAAmB;;;;"}
|
package/fesm2022/drag-drop.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { Subject,
|
|
2
|
+
import { Component, ViewEncapsulation, ChangeDetectionStrategy, inject, NgZone, DOCUMENT, RendererFactory2, signal, Injectable, Renderer2, Injector, InjectionToken, ElementRef, booleanAttribute, Directive, Input, ViewContainerRef, ChangeDetectorRef, EventEmitter, afterNextRender, numberAttribute, Output, TemplateRef, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject, Observable, merge, Subscription, interval, animationFrameScheduler, BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { _getEventTarget, _getShadowRoot } from './_shadow-dom-chunk.mjs';
|
|
5
|
-
import { isFakeTouchstartFromScreenReader, isFakeMousedownFromScreenReader } from './_fake-event-detection-chunk.mjs';
|
|
6
|
-
import { coerceElement, coerceNumberProperty } from './_element-chunk.mjs';
|
|
7
|
-
import { takeUntil, map, take, tap, switchMap, startWith } from 'rxjs/operators';
|
|
8
5
|
import { _CdkPrivateStyleLoader } from './_style-loader-chunk.mjs';
|
|
6
|
+
import { isFakeTouchstartFromScreenReader, isFakeMousedownFromScreenReader } from './_fake-event-detection-chunk.mjs';
|
|
9
7
|
import { ViewportRuler, ScrollDispatcher, CdkScrollableModule } from './scrolling.mjs';
|
|
10
8
|
export { CdkScrollable as ɵɵCdkScrollable } from './scrolling.mjs';
|
|
9
|
+
import { coerceElement, coerceNumberProperty } from './_element-chunk.mjs';
|
|
10
|
+
import { takeUntil, map, take, tap, switchMap, startWith } from 'rxjs/operators';
|
|
11
11
|
import { Directionality } from './_directionality-chunk.mjs';
|
|
12
12
|
import { _IdGenerator } from './_id-generator-chunk.mjs';
|
|
13
13
|
import { coerceArray } from './_array-chunk.mjs';
|
|
@@ -229,6 +229,223 @@ function getTransform(x, y) {
|
|
|
229
229
|
return `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
const capturingEventOptions = {
|
|
233
|
+
capture: true
|
|
234
|
+
};
|
|
235
|
+
const activeCapturingEventOptions$1 = {
|
|
236
|
+
passive: false,
|
|
237
|
+
capture: true
|
|
238
|
+
};
|
|
239
|
+
class _ResetsLoader {
|
|
240
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
241
|
+
minVersion: "12.0.0",
|
|
242
|
+
version: "21.0.3",
|
|
243
|
+
ngImport: i0,
|
|
244
|
+
type: _ResetsLoader,
|
|
245
|
+
deps: [],
|
|
246
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
247
|
+
});
|
|
248
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
249
|
+
minVersion: "14.0.0",
|
|
250
|
+
version: "21.0.3",
|
|
251
|
+
type: _ResetsLoader,
|
|
252
|
+
isStandalone: true,
|
|
253
|
+
selector: "ng-component",
|
|
254
|
+
host: {
|
|
255
|
+
attributes: {
|
|
256
|
+
"cdk-drag-resets-container": ""
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
ngImport: i0,
|
|
260
|
+
template: '',
|
|
261
|
+
isInline: true,
|
|
262
|
+
styles: ["@layer cdk-resets{.cdk-drag-preview{background:none;border:none;padding:0;color:inherit;inset:auto}}.cdk-drag-placeholder *,.cdk-drag-preview *{pointer-events:none !important}\n"],
|
|
263
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
264
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
268
|
+
minVersion: "12.0.0",
|
|
269
|
+
version: "21.0.3",
|
|
270
|
+
ngImport: i0,
|
|
271
|
+
type: _ResetsLoader,
|
|
272
|
+
decorators: [{
|
|
273
|
+
type: Component,
|
|
274
|
+
args: [{
|
|
275
|
+
encapsulation: ViewEncapsulation.None,
|
|
276
|
+
template: '',
|
|
277
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
278
|
+
host: {
|
|
279
|
+
'cdk-drag-resets-container': ''
|
|
280
|
+
},
|
|
281
|
+
styles: ["@layer cdk-resets{.cdk-drag-preview{background:none;border:none;padding:0;color:inherit;inset:auto}}.cdk-drag-placeholder *,.cdk-drag-preview *{pointer-events:none !important}\n"]
|
|
282
|
+
}]
|
|
283
|
+
}]
|
|
284
|
+
});
|
|
285
|
+
class DragDropRegistry {
|
|
286
|
+
_ngZone = inject(NgZone);
|
|
287
|
+
_document = inject(DOCUMENT);
|
|
288
|
+
_styleLoader = inject(_CdkPrivateStyleLoader);
|
|
289
|
+
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
290
|
+
_cleanupDocumentTouchmove;
|
|
291
|
+
_scroll = new Subject();
|
|
292
|
+
_dropInstances = new Set();
|
|
293
|
+
_dragInstances = new Set();
|
|
294
|
+
_activeDragInstances = signal([], ...(ngDevMode ? [{
|
|
295
|
+
debugName: "_activeDragInstances"
|
|
296
|
+
}] : []));
|
|
297
|
+
_globalListeners;
|
|
298
|
+
_draggingPredicate = item => item.isDragging();
|
|
299
|
+
_domNodesToDirectives = null;
|
|
300
|
+
pointerMove = new Subject();
|
|
301
|
+
pointerUp = new Subject();
|
|
302
|
+
constructor() {}
|
|
303
|
+
registerDropContainer(drop) {
|
|
304
|
+
if (!this._dropInstances.has(drop)) {
|
|
305
|
+
this._dropInstances.add(drop);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
registerDragItem(drag) {
|
|
309
|
+
this._dragInstances.add(drag);
|
|
310
|
+
if (this._dragInstances.size === 1) {
|
|
311
|
+
this._ngZone.runOutsideAngular(() => {
|
|
312
|
+
this._cleanupDocumentTouchmove?.();
|
|
313
|
+
this._cleanupDocumentTouchmove = this._renderer.listen(this._document, 'touchmove', this._persistentTouchmoveListener, activeCapturingEventOptions$1);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
removeDropContainer(drop) {
|
|
318
|
+
this._dropInstances.delete(drop);
|
|
319
|
+
}
|
|
320
|
+
removeDragItem(drag) {
|
|
321
|
+
this._dragInstances.delete(drag);
|
|
322
|
+
this.stopDragging(drag);
|
|
323
|
+
if (this._dragInstances.size === 0) {
|
|
324
|
+
this._cleanupDocumentTouchmove?.();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
startDragging(drag, event) {
|
|
328
|
+
if (this._activeDragInstances().indexOf(drag) > -1) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this._styleLoader.load(_ResetsLoader);
|
|
332
|
+
this._activeDragInstances.update(instances => [...instances, drag]);
|
|
333
|
+
if (this._activeDragInstances().length === 1) {
|
|
334
|
+
const isTouchEvent = event.type.startsWith('touch');
|
|
335
|
+
const endEventHandler = e => this.pointerUp.next(e);
|
|
336
|
+
const toBind = [['scroll', e => this._scroll.next(e), capturingEventOptions], ['selectstart', this._preventDefaultWhileDragging, activeCapturingEventOptions$1]];
|
|
337
|
+
if (isTouchEvent) {
|
|
338
|
+
toBind.push(['touchend', endEventHandler, capturingEventOptions], ['touchcancel', endEventHandler, capturingEventOptions]);
|
|
339
|
+
} else {
|
|
340
|
+
toBind.push(['mouseup', endEventHandler, capturingEventOptions]);
|
|
341
|
+
}
|
|
342
|
+
if (!isTouchEvent) {
|
|
343
|
+
toBind.push(['mousemove', e => this.pointerMove.next(e), activeCapturingEventOptions$1]);
|
|
344
|
+
}
|
|
345
|
+
this._ngZone.runOutsideAngular(() => {
|
|
346
|
+
this._globalListeners = toBind.map(([name, handler, options]) => this._renderer.listen(this._document, name, handler, options));
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
stopDragging(drag) {
|
|
351
|
+
this._activeDragInstances.update(instances => {
|
|
352
|
+
const index = instances.indexOf(drag);
|
|
353
|
+
if (index > -1) {
|
|
354
|
+
instances.splice(index, 1);
|
|
355
|
+
return [...instances];
|
|
356
|
+
}
|
|
357
|
+
return instances;
|
|
358
|
+
});
|
|
359
|
+
if (this._activeDragInstances().length === 0) {
|
|
360
|
+
this._clearGlobalListeners();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
isDragging(drag) {
|
|
364
|
+
return this._activeDragInstances().indexOf(drag) > -1;
|
|
365
|
+
}
|
|
366
|
+
scrolled(shadowRoot) {
|
|
367
|
+
const streams = [this._scroll];
|
|
368
|
+
if (shadowRoot && shadowRoot !== this._document) {
|
|
369
|
+
streams.push(new Observable(observer => {
|
|
370
|
+
return this._ngZone.runOutsideAngular(() => {
|
|
371
|
+
const cleanup = this._renderer.listen(shadowRoot, 'scroll', event => {
|
|
372
|
+
if (this._activeDragInstances().length) {
|
|
373
|
+
observer.next(event);
|
|
374
|
+
}
|
|
375
|
+
}, capturingEventOptions);
|
|
376
|
+
return () => {
|
|
377
|
+
cleanup();
|
|
378
|
+
};
|
|
379
|
+
});
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
return merge(...streams);
|
|
383
|
+
}
|
|
384
|
+
registerDirectiveNode(node, dragRef) {
|
|
385
|
+
this._domNodesToDirectives ??= new WeakMap();
|
|
386
|
+
this._domNodesToDirectives.set(node, dragRef);
|
|
387
|
+
}
|
|
388
|
+
removeDirectiveNode(node) {
|
|
389
|
+
this._domNodesToDirectives?.delete(node);
|
|
390
|
+
}
|
|
391
|
+
getDragDirectiveForNode(node) {
|
|
392
|
+
return this._domNodesToDirectives?.get(node) || null;
|
|
393
|
+
}
|
|
394
|
+
ngOnDestroy() {
|
|
395
|
+
this._dragInstances.forEach(instance => this.removeDragItem(instance));
|
|
396
|
+
this._dropInstances.forEach(instance => this.removeDropContainer(instance));
|
|
397
|
+
this._domNodesToDirectives = null;
|
|
398
|
+
this._clearGlobalListeners();
|
|
399
|
+
this.pointerMove.complete();
|
|
400
|
+
this.pointerUp.complete();
|
|
401
|
+
}
|
|
402
|
+
_preventDefaultWhileDragging = event => {
|
|
403
|
+
if (this._activeDragInstances().length > 0) {
|
|
404
|
+
event.preventDefault();
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
_persistentTouchmoveListener = event => {
|
|
408
|
+
if (this._activeDragInstances().length > 0) {
|
|
409
|
+
if (this._activeDragInstances().some(this._draggingPredicate)) {
|
|
410
|
+
event.preventDefault();
|
|
411
|
+
}
|
|
412
|
+
this.pointerMove.next(event);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
_clearGlobalListeners() {
|
|
416
|
+
this._globalListeners?.forEach(cleanup => cleanup());
|
|
417
|
+
this._globalListeners = undefined;
|
|
418
|
+
}
|
|
419
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
420
|
+
minVersion: "12.0.0",
|
|
421
|
+
version: "21.0.3",
|
|
422
|
+
ngImport: i0,
|
|
423
|
+
type: DragDropRegistry,
|
|
424
|
+
deps: [],
|
|
425
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
426
|
+
});
|
|
427
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
428
|
+
minVersion: "12.0.0",
|
|
429
|
+
version: "21.0.3",
|
|
430
|
+
ngImport: i0,
|
|
431
|
+
type: DragDropRegistry,
|
|
432
|
+
providedIn: 'root'
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
436
|
+
minVersion: "12.0.0",
|
|
437
|
+
version: "21.0.3",
|
|
438
|
+
ngImport: i0,
|
|
439
|
+
type: DragDropRegistry,
|
|
440
|
+
decorators: [{
|
|
441
|
+
type: Injectable,
|
|
442
|
+
args: [{
|
|
443
|
+
providedIn: 'root'
|
|
444
|
+
}]
|
|
445
|
+
}],
|
|
446
|
+
ctorParameters: () => []
|
|
447
|
+
});
|
|
448
|
+
|
|
232
449
|
function parseCssTimeUnitsToMs(value) {
|
|
233
450
|
const multiplier = value.toLowerCase().indexOf('ms') > -1 ? 1 : 1000;
|
|
234
451
|
return parseFloat(value) * multiplier;
|
|
@@ -361,13 +578,22 @@ const passiveEventListenerOptions = {
|
|
|
361
578
|
const activeEventListenerOptions = {
|
|
362
579
|
passive: false
|
|
363
580
|
};
|
|
364
|
-
const activeCapturingEventOptions
|
|
581
|
+
const activeCapturingEventOptions = {
|
|
365
582
|
passive: false,
|
|
366
583
|
capture: true
|
|
367
584
|
};
|
|
368
585
|
const MOUSE_EVENT_IGNORE_TIME = 800;
|
|
369
586
|
const PLACEHOLDER_CLASS = 'cdk-drag-placeholder';
|
|
370
587
|
const dragImportantProperties = new Set(['position']);
|
|
588
|
+
function createDragRef(injector, element, config = {
|
|
589
|
+
dragStartThreshold: 5,
|
|
590
|
+
pointerDirectionChangeThreshold: 5
|
|
591
|
+
}) {
|
|
592
|
+
const renderer = injector.get(Renderer2, null, {
|
|
593
|
+
optional: true
|
|
594
|
+
}) || injector.get(RendererFactory2).createRenderer(null, null);
|
|
595
|
+
return new DragRef(element, config, injector.get(DOCUMENT), injector.get(NgZone), injector.get(ViewportRuler), injector.get(DragDropRegistry), renderer);
|
|
596
|
+
}
|
|
371
597
|
class DragRef {
|
|
372
598
|
_config;
|
|
373
599
|
_document;
|
|
@@ -768,7 +994,7 @@ class DragRef {
|
|
|
768
994
|
const dropContainer = this._dropContainer;
|
|
769
995
|
if (shadowRoot) {
|
|
770
996
|
this._ngZone.runOutsideAngular(() => {
|
|
771
|
-
this._cleanupShadowRootSelectStart = this._renderer.listen(shadowRoot, 'selectstart', shadowDomSelectStart, activeCapturingEventOptions
|
|
997
|
+
this._cleanupShadowRootSelectStart = this._renderer.listen(shadowRoot, 'selectstart', shadowDomSelectStart, activeCapturingEventOptions);
|
|
772
998
|
});
|
|
773
999
|
}
|
|
774
1000
|
if (dropContainer) {
|
|
@@ -1647,6 +1873,9 @@ var AutoScrollHorizontalDirection;
|
|
|
1647
1873
|
AutoScrollHorizontalDirection[AutoScrollHorizontalDirection["LEFT"] = 1] = "LEFT";
|
|
1648
1874
|
AutoScrollHorizontalDirection[AutoScrollHorizontalDirection["RIGHT"] = 2] = "RIGHT";
|
|
1649
1875
|
})(AutoScrollHorizontalDirection || (AutoScrollHorizontalDirection = {}));
|
|
1876
|
+
function createDropListRef(injector, element) {
|
|
1877
|
+
return new DropListRef(element, injector.get(DragDropRegistry), injector.get(DOCUMENT), injector.get(NgZone), injector.get(ViewportRuler));
|
|
1878
|
+
}
|
|
1650
1879
|
class DropListRef {
|
|
1651
1880
|
_dragDropRegistry;
|
|
1652
1881
|
_ngZone;
|
|
@@ -2074,239 +2303,14 @@ function getElementScrollDirections(element, clientRect, direction, pointerX, po
|
|
|
2074
2303
|
return [verticalScrollDirection, horizontalScrollDirection];
|
|
2075
2304
|
}
|
|
2076
2305
|
|
|
2077
|
-
const capturingEventOptions = {
|
|
2078
|
-
capture: true
|
|
2079
|
-
};
|
|
2080
|
-
const activeCapturingEventOptions = {
|
|
2081
|
-
passive: false,
|
|
2082
|
-
capture: true
|
|
2083
|
-
};
|
|
2084
|
-
class _ResetsLoader {
|
|
2085
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2086
|
-
minVersion: "12.0.0",
|
|
2087
|
-
version: "21.0.3",
|
|
2088
|
-
ngImport: i0,
|
|
2089
|
-
type: _ResetsLoader,
|
|
2090
|
-
deps: [],
|
|
2091
|
-
target: i0.ɵɵFactoryTarget.Component
|
|
2092
|
-
});
|
|
2093
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2094
|
-
minVersion: "14.0.0",
|
|
2095
|
-
version: "21.0.3",
|
|
2096
|
-
type: _ResetsLoader,
|
|
2097
|
-
isStandalone: true,
|
|
2098
|
-
selector: "ng-component",
|
|
2099
|
-
host: {
|
|
2100
|
-
attributes: {
|
|
2101
|
-
"cdk-drag-resets-container": ""
|
|
2102
|
-
}
|
|
2103
|
-
},
|
|
2104
|
-
ngImport: i0,
|
|
2105
|
-
template: '',
|
|
2106
|
-
isInline: true,
|
|
2107
|
-
styles: ["@layer cdk-resets{.cdk-drag-preview{background:none;border:none;padding:0;color:inherit;inset:auto}}.cdk-drag-placeholder *,.cdk-drag-preview *{pointer-events:none !important}\n"],
|
|
2108
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2109
|
-
encapsulation: i0.ViewEncapsulation.None
|
|
2110
|
-
});
|
|
2111
|
-
}
|
|
2112
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
2113
|
-
minVersion: "12.0.0",
|
|
2114
|
-
version: "21.0.3",
|
|
2115
|
-
ngImport: i0,
|
|
2116
|
-
type: _ResetsLoader,
|
|
2117
|
-
decorators: [{
|
|
2118
|
-
type: Component,
|
|
2119
|
-
args: [{
|
|
2120
|
-
encapsulation: ViewEncapsulation.None,
|
|
2121
|
-
template: '',
|
|
2122
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2123
|
-
host: {
|
|
2124
|
-
'cdk-drag-resets-container': ''
|
|
2125
|
-
},
|
|
2126
|
-
styles: ["@layer cdk-resets{.cdk-drag-preview{background:none;border:none;padding:0;color:inherit;inset:auto}}.cdk-drag-placeholder *,.cdk-drag-preview *{pointer-events:none !important}\n"]
|
|
2127
|
-
}]
|
|
2128
|
-
}]
|
|
2129
|
-
});
|
|
2130
|
-
class DragDropRegistry {
|
|
2131
|
-
_ngZone = inject(NgZone);
|
|
2132
|
-
_document = inject(DOCUMENT);
|
|
2133
|
-
_styleLoader = inject(_CdkPrivateStyleLoader);
|
|
2134
|
-
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
2135
|
-
_cleanupDocumentTouchmove;
|
|
2136
|
-
_scroll = new Subject();
|
|
2137
|
-
_dropInstances = new Set();
|
|
2138
|
-
_dragInstances = new Set();
|
|
2139
|
-
_activeDragInstances = signal([], ...(ngDevMode ? [{
|
|
2140
|
-
debugName: "_activeDragInstances"
|
|
2141
|
-
}] : []));
|
|
2142
|
-
_globalListeners;
|
|
2143
|
-
_draggingPredicate = item => item.isDragging();
|
|
2144
|
-
_domNodesToDirectives = null;
|
|
2145
|
-
pointerMove = new Subject();
|
|
2146
|
-
pointerUp = new Subject();
|
|
2147
|
-
constructor() {}
|
|
2148
|
-
registerDropContainer(drop) {
|
|
2149
|
-
if (!this._dropInstances.has(drop)) {
|
|
2150
|
-
this._dropInstances.add(drop);
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
registerDragItem(drag) {
|
|
2154
|
-
this._dragInstances.add(drag);
|
|
2155
|
-
if (this._dragInstances.size === 1) {
|
|
2156
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2157
|
-
this._cleanupDocumentTouchmove?.();
|
|
2158
|
-
this._cleanupDocumentTouchmove = this._renderer.listen(this._document, 'touchmove', this._persistentTouchmoveListener, activeCapturingEventOptions);
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
removeDropContainer(drop) {
|
|
2163
|
-
this._dropInstances.delete(drop);
|
|
2164
|
-
}
|
|
2165
|
-
removeDragItem(drag) {
|
|
2166
|
-
this._dragInstances.delete(drag);
|
|
2167
|
-
this.stopDragging(drag);
|
|
2168
|
-
if (this._dragInstances.size === 0) {
|
|
2169
|
-
this._cleanupDocumentTouchmove?.();
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
startDragging(drag, event) {
|
|
2173
|
-
if (this._activeDragInstances().indexOf(drag) > -1) {
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
this._styleLoader.load(_ResetsLoader);
|
|
2177
|
-
this._activeDragInstances.update(instances => [...instances, drag]);
|
|
2178
|
-
if (this._activeDragInstances().length === 1) {
|
|
2179
|
-
const isTouchEvent = event.type.startsWith('touch');
|
|
2180
|
-
const endEventHandler = e => this.pointerUp.next(e);
|
|
2181
|
-
const toBind = [['scroll', e => this._scroll.next(e), capturingEventOptions], ['selectstart', this._preventDefaultWhileDragging, activeCapturingEventOptions]];
|
|
2182
|
-
if (isTouchEvent) {
|
|
2183
|
-
toBind.push(['touchend', endEventHandler, capturingEventOptions], ['touchcancel', endEventHandler, capturingEventOptions]);
|
|
2184
|
-
} else {
|
|
2185
|
-
toBind.push(['mouseup', endEventHandler, capturingEventOptions]);
|
|
2186
|
-
}
|
|
2187
|
-
if (!isTouchEvent) {
|
|
2188
|
-
toBind.push(['mousemove', e => this.pointerMove.next(e), activeCapturingEventOptions]);
|
|
2189
|
-
}
|
|
2190
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2191
|
-
this._globalListeners = toBind.map(([name, handler, options]) => this._renderer.listen(this._document, name, handler, options));
|
|
2192
|
-
});
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
stopDragging(drag) {
|
|
2196
|
-
this._activeDragInstances.update(instances => {
|
|
2197
|
-
const index = instances.indexOf(drag);
|
|
2198
|
-
if (index > -1) {
|
|
2199
|
-
instances.splice(index, 1);
|
|
2200
|
-
return [...instances];
|
|
2201
|
-
}
|
|
2202
|
-
return instances;
|
|
2203
|
-
});
|
|
2204
|
-
if (this._activeDragInstances().length === 0) {
|
|
2205
|
-
this._clearGlobalListeners();
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
isDragging(drag) {
|
|
2209
|
-
return this._activeDragInstances().indexOf(drag) > -1;
|
|
2210
|
-
}
|
|
2211
|
-
scrolled(shadowRoot) {
|
|
2212
|
-
const streams = [this._scroll];
|
|
2213
|
-
if (shadowRoot && shadowRoot !== this._document) {
|
|
2214
|
-
streams.push(new Observable(observer => {
|
|
2215
|
-
return this._ngZone.runOutsideAngular(() => {
|
|
2216
|
-
const cleanup = this._renderer.listen(shadowRoot, 'scroll', event => {
|
|
2217
|
-
if (this._activeDragInstances().length) {
|
|
2218
|
-
observer.next(event);
|
|
2219
|
-
}
|
|
2220
|
-
}, capturingEventOptions);
|
|
2221
|
-
return () => {
|
|
2222
|
-
cleanup();
|
|
2223
|
-
};
|
|
2224
|
-
});
|
|
2225
|
-
}));
|
|
2226
|
-
}
|
|
2227
|
-
return merge(...streams);
|
|
2228
|
-
}
|
|
2229
|
-
registerDirectiveNode(node, dragRef) {
|
|
2230
|
-
this._domNodesToDirectives ??= new WeakMap();
|
|
2231
|
-
this._domNodesToDirectives.set(node, dragRef);
|
|
2232
|
-
}
|
|
2233
|
-
removeDirectiveNode(node) {
|
|
2234
|
-
this._domNodesToDirectives?.delete(node);
|
|
2235
|
-
}
|
|
2236
|
-
getDragDirectiveForNode(node) {
|
|
2237
|
-
return this._domNodesToDirectives?.get(node) || null;
|
|
2238
|
-
}
|
|
2239
|
-
ngOnDestroy() {
|
|
2240
|
-
this._dragInstances.forEach(instance => this.removeDragItem(instance));
|
|
2241
|
-
this._dropInstances.forEach(instance => this.removeDropContainer(instance));
|
|
2242
|
-
this._domNodesToDirectives = null;
|
|
2243
|
-
this._clearGlobalListeners();
|
|
2244
|
-
this.pointerMove.complete();
|
|
2245
|
-
this.pointerUp.complete();
|
|
2246
|
-
}
|
|
2247
|
-
_preventDefaultWhileDragging = event => {
|
|
2248
|
-
if (this._activeDragInstances().length > 0) {
|
|
2249
|
-
event.preventDefault();
|
|
2250
|
-
}
|
|
2251
|
-
};
|
|
2252
|
-
_persistentTouchmoveListener = event => {
|
|
2253
|
-
if (this._activeDragInstances().length > 0) {
|
|
2254
|
-
if (this._activeDragInstances().some(this._draggingPredicate)) {
|
|
2255
|
-
event.preventDefault();
|
|
2256
|
-
}
|
|
2257
|
-
this.pointerMove.next(event);
|
|
2258
|
-
}
|
|
2259
|
-
};
|
|
2260
|
-
_clearGlobalListeners() {
|
|
2261
|
-
this._globalListeners?.forEach(cleanup => cleanup());
|
|
2262
|
-
this._globalListeners = undefined;
|
|
2263
|
-
}
|
|
2264
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2265
|
-
minVersion: "12.0.0",
|
|
2266
|
-
version: "21.0.3",
|
|
2267
|
-
ngImport: i0,
|
|
2268
|
-
type: DragDropRegistry,
|
|
2269
|
-
deps: [],
|
|
2270
|
-
target: i0.ɵɵFactoryTarget.Injectable
|
|
2271
|
-
});
|
|
2272
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
2273
|
-
minVersion: "12.0.0",
|
|
2274
|
-
version: "21.0.3",
|
|
2275
|
-
ngImport: i0,
|
|
2276
|
-
type: DragDropRegistry,
|
|
2277
|
-
providedIn: 'root'
|
|
2278
|
-
});
|
|
2279
|
-
}
|
|
2280
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
2281
|
-
minVersion: "12.0.0",
|
|
2282
|
-
version: "21.0.3",
|
|
2283
|
-
ngImport: i0,
|
|
2284
|
-
type: DragDropRegistry,
|
|
2285
|
-
decorators: [{
|
|
2286
|
-
type: Injectable,
|
|
2287
|
-
args: [{
|
|
2288
|
-
providedIn: 'root'
|
|
2289
|
-
}]
|
|
2290
|
-
}],
|
|
2291
|
-
ctorParameters: () => []
|
|
2292
|
-
});
|
|
2293
|
-
|
|
2294
|
-
const DEFAULT_CONFIG = {
|
|
2295
|
-
dragStartThreshold: 5,
|
|
2296
|
-
pointerDirectionChangeThreshold: 5
|
|
2297
|
-
};
|
|
2298
2306
|
class DragDrop {
|
|
2299
|
-
|
|
2300
|
-
_ngZone = inject(NgZone);
|
|
2301
|
-
_viewportRuler = inject(ViewportRuler);
|
|
2302
|
-
_dragDropRegistry = inject(DragDropRegistry);
|
|
2303
|
-
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
2307
|
+
_injector = inject(Injector);
|
|
2304
2308
|
constructor() {}
|
|
2305
|
-
createDrag(element, config
|
|
2306
|
-
return
|
|
2309
|
+
createDrag(element, config) {
|
|
2310
|
+
return createDragRef(this._injector, element, config);
|
|
2307
2311
|
}
|
|
2308
2312
|
createDropList(element) {
|
|
2309
|
-
return
|
|
2313
|
+
return createDropListRef(this._injector, element);
|
|
2310
2314
|
}
|
|
2311
2315
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2312
2316
|
minVersion: "12.0.0",
|
|
@@ -2515,8 +2519,7 @@ class CdkDrag {
|
|
|
2515
2519
|
const config = inject(CDK_DRAG_CONFIG, {
|
|
2516
2520
|
optional: true
|
|
2517
2521
|
});
|
|
2518
|
-
|
|
2519
|
-
this._dragRef = dragDrop.createDrag(this.element, {
|
|
2522
|
+
this._dragRef = createDragRef(this._injector, this.element, {
|
|
2520
2523
|
dragStartThreshold: config && config.dragStartThreshold != null ? config.dragStartThreshold : 5,
|
|
2521
2524
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ? config.pointerDirectionChangeThreshold : 5,
|
|
2522
2525
|
zIndex: config?.zIndex
|
|
@@ -3033,14 +3036,14 @@ class CdkDropList {
|
|
|
3033
3036
|
sorted = new EventEmitter();
|
|
3034
3037
|
_unsortedItems = new Set();
|
|
3035
3038
|
constructor() {
|
|
3036
|
-
const dragDrop = inject(DragDrop);
|
|
3037
3039
|
const config = inject(CDK_DRAG_CONFIG, {
|
|
3038
3040
|
optional: true
|
|
3039
3041
|
});
|
|
3042
|
+
const injector = inject(Injector);
|
|
3040
3043
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3041
3044
|
assertElementNode(this.element.nativeElement, 'cdkDropList');
|
|
3042
3045
|
}
|
|
3043
|
-
this._dropListRef =
|
|
3046
|
+
this._dropListRef = createDropListRef(injector, this.element);
|
|
3044
3047
|
this._dropListRef.data = this;
|
|
3045
3048
|
if (config) {
|
|
3046
3049
|
this._assignDefaults(config);
|
|
@@ -3534,5 +3537,5 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
3534
3537
|
}]
|
|
3535
3538
|
});
|
|
3536
3539
|
|
|
3537
|
-
export { CDK_DRAG_CONFIG, CDK_DRAG_HANDLE, CDK_DRAG_PARENT, CDK_DRAG_PLACEHOLDER, CDK_DRAG_PREVIEW, CDK_DROP_LIST, CDK_DROP_LIST_GROUP, CdkDrag, CdkDragHandle, CdkDragPlaceholder, CdkDragPreview, CdkDropList, CdkDropListGroup, DragDrop, DragDropModule, DragDropRegistry, DragRef, DropListRef, copyArrayItem, moveItemInArray, transferArrayItem };
|
|
3540
|
+
export { CDK_DRAG_CONFIG, CDK_DRAG_HANDLE, CDK_DRAG_PARENT, CDK_DRAG_PLACEHOLDER, CDK_DRAG_PREVIEW, CDK_DROP_LIST, CDK_DROP_LIST_GROUP, CdkDrag, CdkDragHandle, CdkDragPlaceholder, CdkDragPreview, CdkDropList, CdkDropListGroup, DragDrop, DragDropModule, DragDropRegistry, DragRef, DropListRef, copyArrayItem, createDragRef, createDropListRef, moveItemInArray, transferArrayItem };
|
|
3538
3541
|
//# sourceMappingURL=drag-drop.mjs.map
|