@angular/cdk 12.1.3 → 12.2.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/bundles/cdk-a11y.umd.js +10 -4
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +10 -4
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.js +10 -4
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +69 -44
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +10 -4
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.js +10 -4
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +29 -4
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-table.umd.js +18 -4
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +12 -5
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-selenium-webdriver.umd.js +12 -5
- package/bundles/cdk-testing-selenium-webdriver.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +11 -6
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.js +10 -4
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +29 -8
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.js +10 -4
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/drag-drop/directives/drag.d.ts +2 -0
- package/drag-drop/drag-events.d.ts +2 -2
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/drag-drop/directives/drag.js +50 -39
- package/esm2015/drag-drop/drag-events.js +1 -1
- package/esm2015/drag-drop/drag-ref.js +6 -2
- package/esm2015/drag-drop/drag-styling.js +4 -2
- package/esm2015/overlay/overlay-reference.js +1 -1
- package/esm2015/scrolling/fixed-size-virtual-scroll.js +1 -1
- package/esm2015/scrolling/virtual-scroll-viewport.js +17 -1
- package/esm2015/table/table.js +10 -2
- package/esm2015/testing/protractor/protractor-element.js +3 -2
- package/esm2015/testing/selenium-webdriver/selenium-web-driver-element.js +3 -2
- package/esm2015/text-field/autosize.js +29 -9
- package/esm2015/version.js +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +57 -40
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/scrolling.js +16 -1
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +9 -1
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +2 -1
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/selenium-webdriver.js +2 -1
- package/fesm2015/testing/selenium-webdriver.js.map +1 -1
- package/fesm2015/text-field.js +28 -8
- package/fesm2015/text-field.js.map +1 -1
- package/overlay/overlay-reference.d.ts +9 -1
- package/package.json +2 -5
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/virtual-scroll-viewport.d.ts +9 -0
- package/table/index.metadata.json +1 -1
- package/table/table.d.ts +6 -1
- package/text-field/autosize.d.ts +3 -2
- package/text-field/index.metadata.json +1 -1
package/fesm2015/drag-drop.js
CHANGED
|
@@ -75,7 +75,9 @@ function toggleVisibility(element, enable, importantProperties) {
|
|
|
75
75
|
* that exited before the base transform was applied.
|
|
76
76
|
*/
|
|
77
77
|
function combineTransforms(transform, initialTransform) {
|
|
78
|
-
return initialTransform
|
|
78
|
+
return initialTransform && initialTransform != 'none' ?
|
|
79
|
+
(transform + ' ' + initialTransform) :
|
|
80
|
+
transform;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
/**
|
|
@@ -1198,8 +1200,12 @@ class DragRef {
|
|
|
1198
1200
|
const transform = getTransform(x, y);
|
|
1199
1201
|
// Cache the previous transform amount only after the first drag sequence, because
|
|
1200
1202
|
// we don't want our own transforms to stack on top of each other.
|
|
1203
|
+
// Should be excluded none because none + translate3d(x, y, x) is invalid css
|
|
1201
1204
|
if (this._initialTransform == null) {
|
|
1202
|
-
this._initialTransform = this._rootElement.style.transform
|
|
1205
|
+
this._initialTransform = this._rootElement.style.transform
|
|
1206
|
+
&& this._rootElement.style.transform != 'none'
|
|
1207
|
+
? this._rootElement.style.transform
|
|
1208
|
+
: '';
|
|
1203
1209
|
}
|
|
1204
1210
|
// Preserve the previous `transform` value, if there was one. Note that we apply our own
|
|
1205
1211
|
// transform before the user's, because things like rotation can affect which direction
|
|
@@ -3228,43 +3234,22 @@ class CdkDrag {
|
|
|
3228
3234
|
return this._dragRef.getFreeDragPosition();
|
|
3229
3235
|
}
|
|
3230
3236
|
ngAfterViewInit() {
|
|
3231
|
-
//
|
|
3232
|
-
//
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
this.
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
.
|
|
3245
|
-
.map(handle => handle.element);
|
|
3246
|
-
// Usually handles are only allowed to be a descendant of the drag element, but if
|
|
3247
|
-
// the consumer defined a different drag root, we should allow the drag element
|
|
3248
|
-
// itself to be a handle too.
|
|
3249
|
-
if (this._selfHandle && this.rootElementSelector) {
|
|
3250
|
-
childHandleElements.push(this.element);
|
|
3237
|
+
// Normally this isn't in the zone, but it can cause major performance regressions for apps
|
|
3238
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3239
|
+
this._ngZone.runOutsideAngular(() => {
|
|
3240
|
+
// We need to wait for the zone to stabilize, in order for the reference
|
|
3241
|
+
// element to be in the proper place in the DOM. This is mostly relevant
|
|
3242
|
+
// for draggable elements inside portals since they get stamped out in
|
|
3243
|
+
// their original DOM position and then they get transferred to the portal.
|
|
3244
|
+
this._ngZone.onStable
|
|
3245
|
+
.pipe(take(1), takeUntil(this._destroyed))
|
|
3246
|
+
.subscribe(() => {
|
|
3247
|
+
this._updateRootElement();
|
|
3248
|
+
this._setupHandlesListener();
|
|
3249
|
+
if (this.freeDragPosition) {
|
|
3250
|
+
this._dragRef.setFreeDragPosition(this.freeDragPosition);
|
|
3251
3251
|
}
|
|
3252
|
-
this._dragRef.withHandles(childHandleElements);
|
|
3253
|
-
}),
|
|
3254
|
-
// Listen if the state of any of the handles changes.
|
|
3255
|
-
switchMap((handles) => {
|
|
3256
|
-
return merge(...handles.map(item => {
|
|
3257
|
-
return item._stateChanges.pipe(startWith(item));
|
|
3258
|
-
}));
|
|
3259
|
-
}), takeUntil(this._destroyed)).subscribe(handleInstance => {
|
|
3260
|
-
// Enabled/disable the handle that changed in the DragRef.
|
|
3261
|
-
const dragRef = this._dragRef;
|
|
3262
|
-
const handle = handleInstance.element.nativeElement;
|
|
3263
|
-
handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
|
|
3264
3252
|
});
|
|
3265
|
-
if (this.freeDragPosition) {
|
|
3266
|
-
this._dragRef.setFreeDragPosition(this.freeDragPosition);
|
|
3267
|
-
}
|
|
3268
3253
|
});
|
|
3269
3254
|
}
|
|
3270
3255
|
ngOnChanges(changes) {
|
|
@@ -3288,9 +3273,12 @@ class CdkDrag {
|
|
|
3288
3273
|
if (index > -1) {
|
|
3289
3274
|
CdkDrag._dragInstances.splice(index, 1);
|
|
3290
3275
|
}
|
|
3291
|
-
|
|
3292
|
-
this.
|
|
3293
|
-
|
|
3276
|
+
// Unnecessary in most cases, but used to avoid extra change detections with `zone-paths-rxjs`.
|
|
3277
|
+
this._ngZone.runOutsideAngular(() => {
|
|
3278
|
+
this._destroyed.next();
|
|
3279
|
+
this._destroyed.complete();
|
|
3280
|
+
this._dragRef.dispose();
|
|
3281
|
+
});
|
|
3294
3282
|
}
|
|
3295
3283
|
/** Syncs the root element with the `DragRef`. */
|
|
3296
3284
|
_updateRootElement() {
|
|
@@ -3445,6 +3433,35 @@ class CdkDrag {
|
|
|
3445
3433
|
this.previewContainer = previewContainer;
|
|
3446
3434
|
}
|
|
3447
3435
|
}
|
|
3436
|
+
/** Sets up the listener that syncs the handles with the drag ref. */
|
|
3437
|
+
_setupHandlesListener() {
|
|
3438
|
+
// Listen for any newly-added handles.
|
|
3439
|
+
this._handles.changes.pipe(startWith(this._handles),
|
|
3440
|
+
// Sync the new handles with the DragRef.
|
|
3441
|
+
tap((handles) => {
|
|
3442
|
+
const childHandleElements = handles
|
|
3443
|
+
.filter(handle => handle._parentDrag === this)
|
|
3444
|
+
.map(handle => handle.element);
|
|
3445
|
+
// Usually handles are only allowed to be a descendant of the drag element, but if
|
|
3446
|
+
// the consumer defined a different drag root, we should allow the drag element
|
|
3447
|
+
// itself to be a handle too.
|
|
3448
|
+
if (this._selfHandle && this.rootElementSelector) {
|
|
3449
|
+
childHandleElements.push(this.element);
|
|
3450
|
+
}
|
|
3451
|
+
this._dragRef.withHandles(childHandleElements);
|
|
3452
|
+
}),
|
|
3453
|
+
// Listen if the state of any of the handles changes.
|
|
3454
|
+
switchMap((handles) => {
|
|
3455
|
+
return merge(...handles.map(item => {
|
|
3456
|
+
return item._stateChanges.pipe(startWith(item));
|
|
3457
|
+
}));
|
|
3458
|
+
}), takeUntil(this._destroyed)).subscribe(handleInstance => {
|
|
3459
|
+
// Enabled/disable the handle that changed in the DragRef.
|
|
3460
|
+
const dragRef = this._dragRef;
|
|
3461
|
+
const handle = handleInstance.element.nativeElement;
|
|
3462
|
+
handleInstance.disabled ? dragRef.disableHandle(handle) : dragRef.enableHandle(handle);
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3448
3465
|
}
|
|
3449
3466
|
CdkDrag._dragInstances = [];
|
|
3450
3467
|
CdkDrag.decorators = [
|