@angular/cdk 21.1.0-next.2 → 21.1.0-next.4
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/_a11y-module-chunk.mjs +7 -9
- package/fesm2022/_a11y-module-chunk.mjs.map +1 -1
- package/fesm2022/_focus-monitor-chunk.mjs +2 -4
- package/fesm2022/_focus-monitor-chunk.mjs.map +1 -1
- package/fesm2022/_list-key-manager-chunk.mjs +1 -1
- package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_overlay-module-chunk.mjs +28 -17
- package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
- package/fesm2022/_selection-model-chunk.mjs +1 -1
- package/fesm2022/_selection-model-chunk.mjs.map +1 -1
- package/fesm2022/bidi.mjs +1 -1
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/clipboard.mjs +1 -1
- package/fesm2022/clipboard.mjs.map +1 -1
- package/fesm2022/dialog.mjs +2 -2
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +261 -258
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/listbox.mjs +1 -1
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +6 -9
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/portal.mjs +4 -4
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +8 -5
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +3 -3
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/testing-testbed.mjs +7 -1
- package/fesm2022/testing-testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +10 -13
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +1 -1
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/tree.mjs +8 -12
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/_harness-environment-chunk.d.ts +0 -2
- package/types/_overlay-module-chunk.d.ts +3 -1
- package/types/drag-drop.d.ts +23 -7
- package/types/menu.d.ts +1 -3
- package/types/testing-testbed.d.ts +3 -0
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;
|
|
@@ -262,7 +479,7 @@ class PreviewRef {
|
|
|
262
479
|
_initialTransform;
|
|
263
480
|
_zIndex;
|
|
264
481
|
_renderer;
|
|
265
|
-
_previewEmbeddedView;
|
|
482
|
+
_previewEmbeddedView = null;
|
|
266
483
|
_preview;
|
|
267
484
|
get element() {
|
|
268
485
|
return this._preview;
|
|
@@ -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;
|
|
@@ -377,9 +603,9 @@ class DragRef {
|
|
|
377
603
|
_renderer;
|
|
378
604
|
_rootElementCleanups;
|
|
379
605
|
_cleanupShadowRootSelectStart;
|
|
380
|
-
_preview;
|
|
606
|
+
_preview = null;
|
|
381
607
|
_previewContainer;
|
|
382
|
-
_placeholderRef;
|
|
608
|
+
_placeholderRef = null;
|
|
383
609
|
_placeholder;
|
|
384
610
|
_pickupPositionInElement;
|
|
385
611
|
_pickupPositionOnPage;
|
|
@@ -397,7 +623,7 @@ class DragRef {
|
|
|
397
623
|
_hasStartedDragging = signal(false, ...(ngDevMode ? [{
|
|
398
624
|
debugName: "_hasStartedDragging"
|
|
399
625
|
}] : []));
|
|
400
|
-
_hasMoved;
|
|
626
|
+
_hasMoved = false;
|
|
401
627
|
_initialContainer;
|
|
402
628
|
_initialIndex;
|
|
403
629
|
_parentPositions;
|
|
@@ -406,7 +632,7 @@ class DragRef {
|
|
|
406
632
|
_pointerPositionAtLastDirectionChange;
|
|
407
633
|
_lastKnownPointerPosition;
|
|
408
634
|
_rootElement;
|
|
409
|
-
_ownerSVGElement;
|
|
635
|
+
_ownerSVGElement = null;
|
|
410
636
|
_rootElementTapHighlight;
|
|
411
637
|
_pointerMoveSubscription = Subscription.EMPTY;
|
|
412
638
|
_pointerUpSubscription = Subscription.EMPTY;
|
|
@@ -425,7 +651,7 @@ class DragRef {
|
|
|
425
651
|
_disabledHandles = new Set();
|
|
426
652
|
_dropContainer;
|
|
427
653
|
_direction = 'ltr';
|
|
428
|
-
_parentDragRef;
|
|
654
|
+
_parentDragRef = null;
|
|
429
655
|
_cachedShadowRoot;
|
|
430
656
|
lockAxis = null;
|
|
431
657
|
dragStartDelay = 0;
|
|
@@ -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) {
|
|
@@ -1268,7 +1494,7 @@ class SingleAxisSortStrategy {
|
|
|
1268
1494
|
_itemPositions = [];
|
|
1269
1495
|
_activeDraggables;
|
|
1270
1496
|
orientation = 'vertical';
|
|
1271
|
-
direction;
|
|
1497
|
+
direction = 'ltr';
|
|
1272
1498
|
constructor(_dragDropRegistry) {
|
|
1273
1499
|
this._dragDropRegistry = _dragDropRegistry;
|
|
1274
1500
|
}
|
|
@@ -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",
|
|
@@ -2470,8 +2474,8 @@ class CdkDrag {
|
|
|
2470
2474
|
_dragDropRegistry = inject(DragDropRegistry);
|
|
2471
2475
|
_destroyed = new Subject();
|
|
2472
2476
|
_handles = new BehaviorSubject([]);
|
|
2473
|
-
_previewTemplate;
|
|
2474
|
-
_placeholderTemplate;
|
|
2477
|
+
_previewTemplate = null;
|
|
2478
|
+
_placeholderTemplate = null;
|
|
2475
2479
|
_dragRef;
|
|
2476
2480
|
data;
|
|
2477
2481
|
lockAxis = null;
|
|
@@ -2486,7 +2490,7 @@ class CdkDrag {
|
|
|
2486
2490
|
this._disabled = value;
|
|
2487
2491
|
this._dragRef.disabled = this._disabled;
|
|
2488
2492
|
}
|
|
2489
|
-
_disabled;
|
|
2493
|
+
_disabled = false;
|
|
2490
2494
|
constrainPosition;
|
|
2491
2495
|
previewClass;
|
|
2492
2496
|
previewContainer;
|
|
@@ -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
|
|
@@ -3005,12 +3008,12 @@ class CdkDropList {
|
|
|
3005
3008
|
});
|
|
3006
3009
|
_latestSortedRefs;
|
|
3007
3010
|
_destroyed = new Subject();
|
|
3008
|
-
_scrollableParentsResolved;
|
|
3011
|
+
_scrollableParentsResolved = false;
|
|
3009
3012
|
static _dropLists = [];
|
|
3010
3013
|
_dropListRef;
|
|
3011
3014
|
connectedTo = [];
|
|
3012
3015
|
data;
|
|
3013
|
-
orientation;
|
|
3016
|
+
orientation = 'vertical';
|
|
3014
3017
|
id = inject(_IdGenerator).getId('cdk-drop-list-');
|
|
3015
3018
|
lockAxis = null;
|
|
3016
3019
|
get disabled() {
|
|
@@ -3019,28 +3022,28 @@ class CdkDropList {
|
|
|
3019
3022
|
set disabled(value) {
|
|
3020
3023
|
this._dropListRef.disabled = this._disabled = value;
|
|
3021
3024
|
}
|
|
3022
|
-
_disabled;
|
|
3023
|
-
sortingDisabled;
|
|
3025
|
+
_disabled = false;
|
|
3026
|
+
sortingDisabled = false;
|
|
3024
3027
|
enterPredicate = () => true;
|
|
3025
3028
|
sortPredicate = () => true;
|
|
3026
|
-
autoScrollDisabled;
|
|
3029
|
+
autoScrollDisabled = false;
|
|
3027
3030
|
autoScrollStep;
|
|
3028
|
-
elementContainerSelector;
|
|
3029
|
-
hasAnchor;
|
|
3031
|
+
elementContainerSelector = null;
|
|
3032
|
+
hasAnchor = false;
|
|
3030
3033
|
dropped = new EventEmitter();
|
|
3031
3034
|
entered = new EventEmitter();
|
|
3032
3035
|
exited = new EventEmitter();
|
|
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
|