@angular/cdk 18.1.1 → 18.2.0-next.1
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/a11y/index.d.ts +283 -2
- package/coercion/private/index.d.ts +9 -0
- package/drag-drop/index.d.ts +12 -1
- package/esm2022/a11y/key-manager/list-key-manager.mjs +18 -38
- package/esm2022/a11y/key-manager/noop-tree-key-manager.mjs +94 -0
- package/esm2022/a11y/key-manager/tree-key-manager-strategy.mjs +9 -0
- package/esm2022/a11y/key-manager/tree-key-manager.mjs +345 -0
- package/esm2022/a11y/key-manager/typeahead.mjs +91 -0
- package/esm2022/a11y/public-api.mjs +4 -1
- package/esm2022/coercion/private/index.mjs +9 -0
- package/esm2022/coercion/private/observable.mjs +19 -0
- package/esm2022/coercion/private/private_public_index.mjs +5 -0
- package/esm2022/drag-drop/directives/drag.mjs +16 -3
- package/esm2022/drag-drop/drag-ref.mjs +8 -2
- package/esm2022/drag-drop/sorting/single-axis-sort-strategy.mjs +4 -3
- package/esm2022/tree/control/base-tree-control.mjs +7 -2
- package/esm2022/tree/control/flat-tree-control.mjs +8 -2
- package/esm2022/tree/control/nested-tree-control.mjs +11 -2
- package/esm2022/tree/control/tree-control.mjs +1 -1
- package/esm2022/tree/nested-node.mjs +6 -15
- package/esm2022/tree/padding.mjs +2 -4
- package/esm2022/tree/toggle.mjs +15 -8
- package/esm2022/tree/tree-errors.mjs +7 -6
- package/esm2022/tree/tree.mjs +817 -63
- package/esm2022/version.mjs +1 -1
- package/fesm2022/a11y.mjs +520 -40
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/coercion/private.mjs +19 -0
- package/fesm2022/coercion/private.mjs.map +1 -0
- package/fesm2022/drag-drop.mjs +25 -5
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/tree.mjs +858 -94
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +9 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/tree/index.d.ts +304 -25
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../../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.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('18.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../../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.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('18.2.0-next.1');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isObservable, of } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Given either an Observable or non-Observable value, returns either the original
|
|
5
|
+
* Observable, or wraps it in an Observable that emits the non-Observable value.
|
|
6
|
+
*/
|
|
7
|
+
function coerceObservable(data) {
|
|
8
|
+
if (!isObservable(data)) {
|
|
9
|
+
return of(data);
|
|
10
|
+
}
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Generated bundle index. Do not edit.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export { coerceObservable };
|
|
19
|
+
//# sourceMappingURL=private.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.mjs","sources":["../../../../../../../src/cdk/coercion/private/observable.ts","../../../../../../../src/cdk/coercion/private/private_public_index.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.io/license\n */\nimport {Observable, isObservable, of as observableOf} from 'rxjs';\n\n/**\n * Given either an Observable or non-Observable value, returns either the original\n * Observable, or wraps it in an Observable that emits the non-Observable value.\n */\nexport function coerceObservable<T>(data: T | Observable<T>): Observable<T> {\n if (!isObservable(data)) {\n return observableOf(data);\n }\n return data;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["observableOf"],"mappings":";;AASA;;;AAGG;AACG,SAAU,gBAAgB,CAAI,IAAuB,EAAA;AACzD,IAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AACvB,QAAA,OAAOA,EAAY,CAAC,IAAI,CAAC,CAAC;KAC3B;AACD,IAAA,OAAO,IAAI,CAAC;AACd;;AClBA;;AAEG;;;;"}
|
package/fesm2022/drag-drop.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, Component, ViewEncapsulation, ChangeDetectionStrategy, inject, ApplicationRef, EnvironmentInjector, createComponent, Injectable, Inject, InjectionToken, booleanAttribute, Directive, Optional, SkipSelf, Input, EventEmitter, Injector, afterNextRender, Self, Output, NgModule } from '@angular/core';
|
|
2
|
+
import { signal, Component, ViewEncapsulation, ChangeDetectionStrategy, inject, ApplicationRef, EnvironmentInjector, createComponent, Injectable, Inject, InjectionToken, booleanAttribute, Directive, Optional, SkipSelf, Input, EventEmitter, Injector, afterNextRender, numberAttribute, Self, Output, NgModule } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import * as i1 from '@angular/cdk/scrolling';
|
|
5
5
|
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
@@ -504,6 +504,11 @@ class DragRef {
|
|
|
504
504
|
* pointer down before starting to drag the element.
|
|
505
505
|
*/
|
|
506
506
|
this.dragStartDelay = 0;
|
|
507
|
+
/**
|
|
508
|
+
* If the parent of the dragged element has a `scale` transform, it can throw off the
|
|
509
|
+
* positioning when the user starts dragging. Use this input to notify the CDK of the scale.
|
|
510
|
+
*/
|
|
511
|
+
this.scale = 1;
|
|
507
512
|
this._disabled = false;
|
|
508
513
|
/** Emits as the drag sequence is being prepared. */
|
|
509
514
|
this.beforeStarted = new Subject();
|
|
@@ -1297,7 +1302,8 @@ class DragRef {
|
|
|
1297
1302
|
* @param y New transform value along the Y axis.
|
|
1298
1303
|
*/
|
|
1299
1304
|
_applyRootElementTransform(x, y) {
|
|
1300
|
-
const
|
|
1305
|
+
const scale = 1 / this.scale;
|
|
1306
|
+
const transform = getTransform(x * scale, y * scale);
|
|
1301
1307
|
const styles = this._rootElement.style;
|
|
1302
1308
|
// Cache the previous transform amount only after the first drag sequence, because
|
|
1303
1309
|
// we don't want our own transforms to stack on top of each other.
|
|
@@ -1619,6 +1625,7 @@ class SingleAxisSortStrategy {
|
|
|
1619
1625
|
: sibling.drag.getRootElement();
|
|
1620
1626
|
// Update the offset to reflect the new position.
|
|
1621
1627
|
sibling.offset += offset;
|
|
1628
|
+
const transformAmount = Math.round(sibling.offset * (1 / sibling.drag.scale));
|
|
1622
1629
|
// Since we're moving the items with a `transform`, we need to adjust their cached
|
|
1623
1630
|
// client rects to reflect their new position, as well as swap their positions in the cache.
|
|
1624
1631
|
// Note that we shouldn't use `getBoundingClientRect` here to update the cache, because the
|
|
@@ -1626,11 +1633,11 @@ class SingleAxisSortStrategy {
|
|
|
1626
1633
|
if (isHorizontal) {
|
|
1627
1634
|
// Round the transforms since some browsers will
|
|
1628
1635
|
// blur the elements, for sub-pixel transforms.
|
|
1629
|
-
elementToOffset.style.transform = combineTransforms(`translate3d(${
|
|
1636
|
+
elementToOffset.style.transform = combineTransforms(`translate3d(${transformAmount}px, 0, 0)`, sibling.initialTransform);
|
|
1630
1637
|
adjustDomRect(sibling.clientRect, 0, offset);
|
|
1631
1638
|
}
|
|
1632
1639
|
else {
|
|
1633
|
-
elementToOffset.style.transform = combineTransforms(`translate3d(0, ${
|
|
1640
|
+
elementToOffset.style.transform = combineTransforms(`translate3d(0, ${transformAmount}px, 0)`, sibling.initialTransform);
|
|
1634
1641
|
adjustDomRect(sibling.clientRect, offset, 0);
|
|
1635
1642
|
}
|
|
1636
1643
|
});
|
|
@@ -3191,6 +3198,11 @@ class CdkDrag {
|
|
|
3191
3198
|
this._parentDrag = _parentDrag;
|
|
3192
3199
|
this._destroyed = new Subject();
|
|
3193
3200
|
this._handles = new BehaviorSubject([]);
|
|
3201
|
+
/**
|
|
3202
|
+
* If the parent of the dragged element has a `scale` transform, it can throw off the
|
|
3203
|
+
* positioning when the user starts dragging. Use this input to notify the CDK of the scale.
|
|
3204
|
+
*/
|
|
3205
|
+
this.scale = 1;
|
|
3194
3206
|
/** Emits when the user starts dragging the item. */
|
|
3195
3207
|
this.started = new EventEmitter();
|
|
3196
3208
|
/** Emits when the user has released a drag item, before any animations have started. */
|
|
@@ -3247,6 +3259,10 @@ class CdkDrag {
|
|
|
3247
3259
|
if (dropContainer) {
|
|
3248
3260
|
this._dragRef._withDropContainer(dropContainer._dropListRef);
|
|
3249
3261
|
dropContainer.addItem(this);
|
|
3262
|
+
// The drop container reads this so we need to sync it here.
|
|
3263
|
+
dropContainer._dropListRef.beforeStarted.pipe(takeUntil(this._destroyed)).subscribe(() => {
|
|
3264
|
+
this._dragRef.scale = this.scale;
|
|
3265
|
+
});
|
|
3250
3266
|
}
|
|
3251
3267
|
this._syncInputs(this._dragRef);
|
|
3252
3268
|
this._handleEvents(this._dragRef);
|
|
@@ -3401,6 +3417,7 @@ class CdkDrag {
|
|
|
3401
3417
|
: null;
|
|
3402
3418
|
ref.disabled = this.disabled;
|
|
3403
3419
|
ref.lockAxis = this.lockAxis;
|
|
3420
|
+
ref.scale = this.scale;
|
|
3404
3421
|
ref.dragStartDelay =
|
|
3405
3422
|
typeof dragStartDelay === 'object' && dragStartDelay
|
|
3406
3423
|
? dragStartDelay
|
|
@@ -3539,7 +3556,7 @@ class CdkDrag {
|
|
|
3539
3556
|
});
|
|
3540
3557
|
}
|
|
3541
3558
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: CdkDrag, deps: [{ token: i0.ElementRef }, { token: CDK_DROP_LIST, optional: true, skipSelf: true }, { token: DOCUMENT }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: CDK_DRAG_CONFIG, optional: true }, { token: i1$1.Directionality, optional: true }, { token: DragDrop }, { token: i0.ChangeDetectorRef }, { token: CDK_DRAG_HANDLE, optional: true, self: true }, { token: CDK_DRAG_PARENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3542
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.0", type: CdkDrag, isStandalone: true, selector: "[cdkDrag]", inputs: { data: ["cdkDragData", "data"], lockAxis: ["cdkDragLockAxis", "lockAxis"], rootElementSelector: ["cdkDragRootElement", "rootElementSelector"], boundaryElement: ["cdkDragBoundary", "boundaryElement"], dragStartDelay: ["cdkDragStartDelay", "dragStartDelay"], freeDragPosition: ["cdkDragFreeDragPosition", "freeDragPosition"], disabled: ["cdkDragDisabled", "disabled", booleanAttribute], constrainPosition: ["cdkDragConstrainPosition", "constrainPosition"], previewClass: ["cdkDragPreviewClass", "previewClass"], previewContainer: ["cdkDragPreviewContainer", "previewContainer"] }, outputs: { started: "cdkDragStarted", released: "cdkDragReleased", ended: "cdkDragEnded", entered: "cdkDragEntered", exited: "cdkDragExited", dropped: "cdkDragDropped", moved: "cdkDragMoved" }, host: { properties: { "class.cdk-drag-disabled": "disabled", "class.cdk-drag-dragging": "_dragRef.isDragging()" }, classAttribute: "cdk-drag" }, providers: [{ provide: CDK_DRAG_PARENT, useExisting: CdkDrag }], exportAs: ["cdkDrag"], usesOnChanges: true, ngImport: i0 }); }
|
|
3559
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.1.0", type: CdkDrag, isStandalone: true, selector: "[cdkDrag]", inputs: { data: ["cdkDragData", "data"], lockAxis: ["cdkDragLockAxis", "lockAxis"], rootElementSelector: ["cdkDragRootElement", "rootElementSelector"], boundaryElement: ["cdkDragBoundary", "boundaryElement"], dragStartDelay: ["cdkDragStartDelay", "dragStartDelay"], freeDragPosition: ["cdkDragFreeDragPosition", "freeDragPosition"], disabled: ["cdkDragDisabled", "disabled", booleanAttribute], constrainPosition: ["cdkDragConstrainPosition", "constrainPosition"], previewClass: ["cdkDragPreviewClass", "previewClass"], previewContainer: ["cdkDragPreviewContainer", "previewContainer"], scale: ["cdkDragScale", "scale", numberAttribute] }, outputs: { started: "cdkDragStarted", released: "cdkDragReleased", ended: "cdkDragEnded", entered: "cdkDragEntered", exited: "cdkDragExited", dropped: "cdkDragDropped", moved: "cdkDragMoved" }, host: { properties: { "class.cdk-drag-disabled": "disabled", "class.cdk-drag-dragging": "_dragRef.isDragging()" }, classAttribute: "cdk-drag" }, providers: [{ provide: CDK_DRAG_PARENT, useExisting: CdkDrag }], exportAs: ["cdkDrag"], usesOnChanges: true, ngImport: i0 }); }
|
|
3543
3560
|
}
|
|
3544
3561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: CdkDrag, decorators: [{
|
|
3545
3562
|
type: Directive,
|
|
@@ -3615,6 +3632,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
3615
3632
|
}], previewContainer: [{
|
|
3616
3633
|
type: Input,
|
|
3617
3634
|
args: ['cdkDragPreviewContainer']
|
|
3635
|
+
}], scale: [{
|
|
3636
|
+
type: Input,
|
|
3637
|
+
args: [{ alias: 'cdkDragScale', transform: numberAttribute }]
|
|
3618
3638
|
}], started: [{
|
|
3619
3639
|
type: Output,
|
|
3620
3640
|
args: ['cdkDragStarted']
|