@angular/cdk 21.0.3 → 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.
Files changed (44) hide show
  1. package/LICENSE +1 -1
  2. package/fesm2022/_a11y-module-chunk.mjs +22 -22
  3. package/fesm2022/_breakpoints-observer-chunk.mjs +6 -6
  4. package/fesm2022/_directionality-chunk.mjs +3 -3
  5. package/fesm2022/_focus-monitor-chunk.mjs +9 -9
  6. package/fesm2022/_id-generator-chunk.mjs +3 -3
  7. package/fesm2022/_list-key-manager-chunk.mjs +5 -5
  8. package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
  9. package/fesm2022/_overlay-module-chunk.mjs +49 -38
  10. package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
  11. package/fesm2022/_platform-chunk.mjs +3 -3
  12. package/fesm2022/_style-loader-chunk.mjs +3 -3
  13. package/fesm2022/_unique-selection-dispatcher-chunk.mjs +3 -3
  14. package/fesm2022/_visually-hidden-chunk.mjs +3 -3
  15. package/fesm2022/a11y.mjs +9 -9
  16. package/fesm2022/accordion.mjs +10 -10
  17. package/fesm2022/bidi.mjs +7 -7
  18. package/fesm2022/cdk.mjs +1 -1
  19. package/fesm2022/cdk.mjs.map +1 -1
  20. package/fesm2022/clipboard.mjs +10 -10
  21. package/fesm2022/dialog.mjs +10 -10
  22. package/fesm2022/drag-drop.mjs +269 -266
  23. package/fesm2022/drag-drop.mjs.map +1 -1
  24. package/fesm2022/layout.mjs +4 -4
  25. package/fesm2022/listbox.mjs +10 -10
  26. package/fesm2022/menu.mjs +49 -49
  27. package/fesm2022/observers-private.mjs +3 -3
  28. package/fesm2022/observers.mjs +13 -13
  29. package/fesm2022/overlay.mjs +3 -3
  30. package/fesm2022/platform.mjs +4 -4
  31. package/fesm2022/portal.mjs +10 -10
  32. package/fesm2022/scrolling.mjs +40 -40
  33. package/fesm2022/scrolling.mjs.map +1 -1
  34. package/fesm2022/stepper.mjs +22 -22
  35. package/fesm2022/table.mjs +73 -73
  36. package/fesm2022/testing-testbed.mjs +7 -1
  37. package/fesm2022/testing-testbed.mjs.map +1 -1
  38. package/fesm2022/text-field.mjs +16 -16
  39. package/fesm2022/tree.mjs +25 -25
  40. package/package.json +1 -1
  41. package/schematics/ng-add/index.js +1 -1
  42. package/types/_overlay-module-chunk.d.ts +2 -0
  43. package/types/drag-drop.d.ts +23 -7
  44. package/types/testing-testbed.d.ts +3 -0
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Component, ViewEncapsulation, ChangeDetectionStrategy, inject, NgZone, DOCUMENT, RendererFactory2, Injectable, InjectionToken, ElementRef, booleanAttribute, Directive, Input, ViewContainerRef, ChangeDetectorRef, EventEmitter, Injector, afterNextRender, numberAttribute, Output, TemplateRef, NgModule } from '@angular/core';
3
- import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge, BehaviorSubject } from 'rxjs';
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$1 = {
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$1);
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,243 +2303,18 @@ 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.0",
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.0",
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.0",
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.0",
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.0",
2275
- ngImport: i0,
2276
- type: DragDropRegistry,
2277
- providedIn: 'root'
2278
- });
2279
- }
2280
- i0.ɵɵngDeclareClassMetadata({
2281
- minVersion: "12.0.0",
2282
- version: "21.0.0",
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
- _document = inject(DOCUMENT);
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 = DEFAULT_CONFIG) {
2306
- return new DragRef(element, config, this._document, this._ngZone, this._viewportRuler, this._dragDropRegistry, this._renderer);
2309
+ createDrag(element, config) {
2310
+ return createDragRef(this._injector, element, config);
2307
2311
  }
2308
2312
  createDropList(element) {
2309
- return new DropListRef(element, this._dragDropRegistry, this._document, this._ngZone, this._viewportRuler);
2313
+ return createDropListRef(this._injector, element);
2310
2314
  }
2311
2315
  static ɵfac = i0.ɵɵngDeclareFactory({
2312
2316
  minVersion: "12.0.0",
2313
- version: "21.0.0",
2317
+ version: "21.0.3",
2314
2318
  ngImport: i0,
2315
2319
  type: DragDrop,
2316
2320
  deps: [],
@@ -2318,7 +2322,7 @@ class DragDrop {
2318
2322
  });
2319
2323
  static ɵprov = i0.ɵɵngDeclareInjectable({
2320
2324
  minVersion: "12.0.0",
2321
- version: "21.0.0",
2325
+ version: "21.0.3",
2322
2326
  ngImport: i0,
2323
2327
  type: DragDrop,
2324
2328
  providedIn: 'root'
@@ -2326,7 +2330,7 @@ class DragDrop {
2326
2330
  }
2327
2331
  i0.ɵɵngDeclareClassMetadata({
2328
2332
  minVersion: "12.0.0",
2329
- version: "21.0.0",
2333
+ version: "21.0.3",
2330
2334
  ngImport: i0,
2331
2335
  type: DragDrop,
2332
2336
  decorators: [{
@@ -2389,7 +2393,7 @@ class CdkDragHandle {
2389
2393
  }
2390
2394
  static ɵfac = i0.ɵɵngDeclareFactory({
2391
2395
  minVersion: "12.0.0",
2392
- version: "21.0.0",
2396
+ version: "21.0.3",
2393
2397
  ngImport: i0,
2394
2398
  type: CdkDragHandle,
2395
2399
  deps: [],
@@ -2397,7 +2401,7 @@ class CdkDragHandle {
2397
2401
  });
2398
2402
  static ɵdir = i0.ɵɵngDeclareDirective({
2399
2403
  minVersion: "16.1.0",
2400
- version: "21.0.0",
2404
+ version: "21.0.3",
2401
2405
  type: CdkDragHandle,
2402
2406
  isStandalone: true,
2403
2407
  selector: "[cdkDragHandle]",
@@ -2416,7 +2420,7 @@ class CdkDragHandle {
2416
2420
  }
2417
2421
  i0.ɵɵngDeclareClassMetadata({
2418
2422
  minVersion: "12.0.0",
2419
- version: "21.0.0",
2423
+ version: "21.0.3",
2420
2424
  ngImport: i0,
2421
2425
  type: CdkDragHandle,
2422
2426
  decorators: [{
@@ -2515,8 +2519,7 @@ class CdkDrag {
2515
2519
  const config = inject(CDK_DRAG_CONFIG, {
2516
2520
  optional: true
2517
2521
  });
2518
- const dragDrop = inject(DragDrop);
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
@@ -2779,7 +2782,7 @@ class CdkDrag {
2779
2782
  }
2780
2783
  static ɵfac = i0.ɵɵngDeclareFactory({
2781
2784
  minVersion: "12.0.0",
2782
- version: "21.0.0",
2785
+ version: "21.0.3",
2783
2786
  ngImport: i0,
2784
2787
  type: CdkDrag,
2785
2788
  deps: [],
@@ -2787,7 +2790,7 @@ class CdkDrag {
2787
2790
  });
2788
2791
  static ɵdir = i0.ɵɵngDeclareDirective({
2789
2792
  minVersion: "16.1.0",
2790
- version: "21.0.0",
2793
+ version: "21.0.3",
2791
2794
  type: CdkDrag,
2792
2795
  isStandalone: true,
2793
2796
  selector: "[cdkDrag]",
@@ -2831,7 +2834,7 @@ class CdkDrag {
2831
2834
  }
2832
2835
  i0.ɵɵngDeclareClassMetadata({
2833
2836
  minVersion: "12.0.0",
2834
- version: "21.0.0",
2837
+ version: "21.0.3",
2835
2838
  ngImport: i0,
2836
2839
  type: CdkDrag,
2837
2840
  decorators: [{
@@ -2942,7 +2945,7 @@ class CdkDropListGroup {
2942
2945
  }
2943
2946
  static ɵfac = i0.ɵɵngDeclareFactory({
2944
2947
  minVersion: "12.0.0",
2945
- version: "21.0.0",
2948
+ version: "21.0.3",
2946
2949
  ngImport: i0,
2947
2950
  type: CdkDropListGroup,
2948
2951
  deps: [],
@@ -2950,7 +2953,7 @@ class CdkDropListGroup {
2950
2953
  });
2951
2954
  static ɵdir = i0.ɵɵngDeclareDirective({
2952
2955
  minVersion: "16.1.0",
2953
- version: "21.0.0",
2956
+ version: "21.0.3",
2954
2957
  type: CdkDropListGroup,
2955
2958
  isStandalone: true,
2956
2959
  selector: "[cdkDropListGroup]",
@@ -2967,7 +2970,7 @@ class CdkDropListGroup {
2967
2970
  }
2968
2971
  i0.ɵɵngDeclareClassMetadata({
2969
2972
  minVersion: "12.0.0",
2970
- version: "21.0.0",
2973
+ version: "21.0.3",
2971
2974
  ngImport: i0,
2972
2975
  type: CdkDropListGroup,
2973
2976
  decorators: [{
@@ -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 = dragDrop.createDropList(this.element);
3046
+ this._dropListRef = createDropListRef(injector, this.element);
3044
3047
  this._dropListRef.data = this;
3045
3048
  if (config) {
3046
3049
  this._assignDefaults(config);
@@ -3201,7 +3204,7 @@ class CdkDropList {
3201
3204
  }
3202
3205
  static ɵfac = i0.ɵɵngDeclareFactory({
3203
3206
  minVersion: "12.0.0",
3204
- version: "21.0.0",
3207
+ version: "21.0.3",
3205
3208
  ngImport: i0,
3206
3209
  type: CdkDropList,
3207
3210
  deps: [],
@@ -3209,7 +3212,7 @@ class CdkDropList {
3209
3212
  });
3210
3213
  static ɵdir = i0.ɵɵngDeclareDirective({
3211
3214
  minVersion: "16.1.0",
3212
- version: "21.0.0",
3215
+ version: "21.0.3",
3213
3216
  type: CdkDropList,
3214
3217
  isStandalone: true,
3215
3218
  selector: "[cdkDropList], cdk-drop-list",
@@ -3256,7 +3259,7 @@ class CdkDropList {
3256
3259
  }
3257
3260
  i0.ɵɵngDeclareClassMetadata({
3258
3261
  minVersion: "12.0.0",
3259
- version: "21.0.0",
3262
+ version: "21.0.3",
3260
3263
  ngImport: i0,
3261
3264
  type: CdkDropList,
3262
3265
  decorators: [{
@@ -3380,7 +3383,7 @@ class CdkDragPreview {
3380
3383
  }
3381
3384
  static ɵfac = i0.ɵɵngDeclareFactory({
3382
3385
  minVersion: "12.0.0",
3383
- version: "21.0.0",
3386
+ version: "21.0.3",
3384
3387
  ngImport: i0,
3385
3388
  type: CdkDragPreview,
3386
3389
  deps: [],
@@ -3388,7 +3391,7 @@ class CdkDragPreview {
3388
3391
  });
3389
3392
  static ɵdir = i0.ɵɵngDeclareDirective({
3390
3393
  minVersion: "16.1.0",
3391
- version: "21.0.0",
3394
+ version: "21.0.3",
3392
3395
  type: CdkDragPreview,
3393
3396
  isStandalone: true,
3394
3397
  selector: "ng-template[cdkDragPreview]",
@@ -3405,7 +3408,7 @@ class CdkDragPreview {
3405
3408
  }
3406
3409
  i0.ɵɵngDeclareClassMetadata({
3407
3410
  minVersion: "12.0.0",
3408
- version: "21.0.0",
3411
+ version: "21.0.3",
3409
3412
  ngImport: i0,
3410
3413
  type: CdkDragPreview,
3411
3414
  decorators: [{
@@ -3447,7 +3450,7 @@ class CdkDragPlaceholder {
3447
3450
  }
3448
3451
  static ɵfac = i0.ɵɵngDeclareFactory({
3449
3452
  minVersion: "12.0.0",
3450
- version: "21.0.0",
3453
+ version: "21.0.3",
3451
3454
  ngImport: i0,
3452
3455
  type: CdkDragPlaceholder,
3453
3456
  deps: [],
@@ -3455,7 +3458,7 @@ class CdkDragPlaceholder {
3455
3458
  });
3456
3459
  static ɵdir = i0.ɵɵngDeclareDirective({
3457
3460
  minVersion: "14.0.0",
3458
- version: "21.0.0",
3461
+ version: "21.0.3",
3459
3462
  type: CdkDragPlaceholder,
3460
3463
  isStandalone: true,
3461
3464
  selector: "ng-template[cdkDragPlaceholder]",
@@ -3471,7 +3474,7 @@ class CdkDragPlaceholder {
3471
3474
  }
3472
3475
  i0.ɵɵngDeclareClassMetadata({
3473
3476
  minVersion: "12.0.0",
3474
- version: "21.0.0",
3477
+ version: "21.0.3",
3475
3478
  ngImport: i0,
3476
3479
  type: CdkDragPlaceholder,
3477
3480
  decorators: [{
@@ -3496,7 +3499,7 @@ const DRAG_DROP_DIRECTIVES = [CdkDropList, CdkDropListGroup, CdkDrag, CdkDragHan
3496
3499
  class DragDropModule {
3497
3500
  static ɵfac = i0.ɵɵngDeclareFactory({
3498
3501
  minVersion: "12.0.0",
3499
- version: "21.0.0",
3502
+ version: "21.0.3",
3500
3503
  ngImport: i0,
3501
3504
  type: DragDropModule,
3502
3505
  deps: [],
@@ -3504,7 +3507,7 @@ class DragDropModule {
3504
3507
  });
3505
3508
  static ɵmod = i0.ɵɵngDeclareNgModule({
3506
3509
  minVersion: "14.0.0",
3507
- version: "21.0.0",
3510
+ version: "21.0.3",
3508
3511
  ngImport: i0,
3509
3512
  type: DragDropModule,
3510
3513
  imports: [CdkDropList, CdkDropListGroup, CdkDrag, CdkDragHandle, CdkDragPreview, CdkDragPlaceholder],
@@ -3512,7 +3515,7 @@ class DragDropModule {
3512
3515
  });
3513
3516
  static ɵinj = i0.ɵɵngDeclareInjector({
3514
3517
  minVersion: "12.0.0",
3515
- version: "21.0.0",
3518
+ version: "21.0.3",
3516
3519
  ngImport: i0,
3517
3520
  type: DragDropModule,
3518
3521
  providers: [DragDrop],
@@ -3521,7 +3524,7 @@ class DragDropModule {
3521
3524
  }
3522
3525
  i0.ɵɵngDeclareClassMetadata({
3523
3526
  minVersion: "12.0.0",
3524
- version: "21.0.0",
3527
+ version: "21.0.3",
3525
3528
  ngImport: i0,
3526
3529
  type: DragDropModule,
3527
3530
  decorators: [{
@@ -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