Skip to content

Commit

Permalink
fix(module:docs): fix dependabot alert (NG-ZORRO#6428)
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie authored and vthinkxie committed Feb 25, 2021
1 parent 4d80873 commit 2222798
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 58 deletions.
22 changes: 0 additions & 22 deletions components/core/animation/zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,6 @@
import { animate, AnimationTriggerMetadata, style, transition, trigger } from '@angular/animations';
import { AnimationCurves, AnimationDuration } from './animation-consts';

export const zoomMotion: AnimationTriggerMetadata = trigger('zoomMotion', [
transition(':enter', [
style({ opacity: 0, transform: 'scale(0.2)' }),
animate(
`${AnimationDuration.BASE} ${AnimationCurves.EASE_OUT_CIRC}`,
style({
opacity: 1,
transform: 'scale(1)'
})
)
]),
transition(':leave', [
style({ opacity: 1, transform: 'scale(1)' }),
animate(
`${AnimationDuration.BASE} ${AnimationCurves.EASE_IN_OUT_CIRC}`,
style({
opacity: 0,
transform: 'scale(0.2)'
})
)
])
]);
export const zoomBigMotion: AnimationTriggerMetadata = trigger('zoomBigMotion', [
transition('void => active', [
style({ opacity: 0, transform: 'scale(0.8)' }),
Expand Down
11 changes: 0 additions & 11 deletions components/select/select-top-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { zoomMotion } from 'ng-zorro-antd/core/animation';
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzSelectSearchComponent } from './select-search.component';
Expand All @@ -29,7 +28,6 @@ import { NzSelectItemInterface, NzSelectModeType, NzSelectTopControlItemType } f
selector: 'nz-select-top-control',
exportAs: 'nzSelectTopControl',
preserveWhitespaces: false,
animations: [zoomMotion],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
Expand Down Expand Up @@ -60,16 +58,12 @@ import { NzSelectItemInterface, NzSelectModeType, NzSelectTopControlItemType } f
<!--multiple or tags mode-->
<nz-select-item
*ngFor="let item of listOfSlicedItem; trackBy: trackValue"
[@zoomMotion]
[@.disabled]="noAnimation?.nzNoAnimation"
[nzNoAnimation]="noAnimation?.nzNoAnimation"
[removeIcon]="removeIcon"
[label]="item.nzLabel"
[disabled]="item.nzDisabled || disabled"
[contentTemplateOutlet]="item.contentTemplateOutlet"
[deletable]="true"
[contentTemplateOutletContext]="item.contentTemplateOutletContext"
(@zoomMotion.done)="onAnimationEnd()"
(delete)="onDeleteItem(item.contentTemplateOutletContext)"
></nz-select-item>
<nz-select-search
Expand Down Expand Up @@ -105,7 +99,6 @@ export class NzSelectTopControlComponent implements OnChanges {
@Input() tokenSeparators: string[] = [];
@Output() readonly tokenize = new EventEmitter<string[]>();
@Output() readonly inputValueChange = new EventEmitter<string>();
@Output() readonly animationEnd = new EventEmitter<void>();
@Output() readonly deleteItem = new EventEmitter<NzSelectItemInterface>();
@ViewChild(NzSelectSearchComponent) nzSelectSearchComponent!: NzSelectSearchComponent;
listOfSlicedItem: NzSelectTopControlItemType[] = [];
Expand Down Expand Up @@ -197,10 +190,6 @@ export class NzSelectTopControlComponent implements OnChanges {
}
}

onAnimationEnd(): void {
this.animationEnd.next();
}

constructor(private elementRef: ElementRef, @Host() @Optional() public noAnimation?: NzNoAnimationDirective) {
// TODO: move to host after View Engine deprecation
this.elementRef.nativeElement.classList.add('ant-select-selector');
Expand Down
15 changes: 5 additions & 10 deletions components/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { CdkConnectedOverlay, CdkOverlayOrigin, ConnectedOverlayPositionChange }
import { Platform } from '@angular/cdk/platform';
import {
AfterContentInit,
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Expand All @@ -31,6 +30,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';

import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { slideMotion } from 'ng-zorro-antd/core/animation';
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
Expand Down Expand Up @@ -90,7 +90,6 @@ export type NzSelectSizeType = 'large' | 'default' | 'small';
[listOfTopItem]="listOfTopItem"
(inputValueChange)="onInputValueChange($event)"
(tokenize)="onTokenSeparate($event)"
(animationEnd)="updateCdkConnectedOverlayPositions()"
(deleteItem)="onItemDelete($event)"
(keydown)="onKeyDown($event)"
></nz-select-top-control>
Expand Down Expand Up @@ -159,7 +158,7 @@ export type NzSelectSizeType = 'large' | 'default' | 'small';
'(click)': 'onHostClick()'
}
})
export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterViewInit, OnDestroy, AfterContentInit, OnChanges {
export class NzSelectComponent implements ControlValueAccessor, OnInit, OnDestroy, AfterContentInit, OnChanges {
readonly _nzModuleName: NzConfigKey = NZ_CONFIG_MODULE_NAME;

static ngAcceptInputType_nzAllowClear: BooleanInput;
Expand Down Expand Up @@ -483,9 +482,9 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
}

updateCdkConnectedOverlayPositions(): void {
if (this.cdkConnectedOverlay.overlayRef) {
this.cdkConnectedOverlay.overlayRef.updatePosition();
}
setTimeout(() => {
this.cdkConnectedOverlay?.overlayRef?.updatePosition();
});
}

constructor(
Expand Down Expand Up @@ -605,10 +604,6 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
this.dir = this.directionality.value;
}

ngAfterViewInit(): void {
this.updateCdkConnectedOverlayStatus();
}

ngAfterContentInit(): void {
if (!this.isReactiveDriven) {
merge(this.listOfNzOptionGroupComponent.changes, this.listOfNzOptionComponent.changes)
Expand Down
20 changes: 5 additions & 15 deletions components/tree-select/tree-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { FocusMonitor } from '@angular/cdk/a11y';

import { Direction, Directionality } from '@angular/cdk/bidi';
import { BACKSPACE, ESCAPE, TAB } from '@angular/cdk/keycodes';
import { CdkConnectedOverlay, CdkOverlayOrigin, ConnectedOverlayPositionChange } from '@angular/cdk/overlay';
import {
Expand All @@ -28,7 +30,7 @@ import {
ViewChild
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { slideMotion, zoomMotion } from 'ng-zorro-antd/core/animation';
import { slideMotion } from 'ng-zorro-antd/core/animation';
import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation';

Expand All @@ -47,8 +49,6 @@ import { NzTreeComponent } from 'ng-zorro-antd/tree';

import { merge, of as observableOf, Subject, Subscription } from 'rxjs';
import { filter, takeUntil, tap } from 'rxjs/operators';

import { Direction, Directionality } from '@angular/cdk/bidi';
import { NzTreeSelectService } from './tree-select.service';

export function higherOrderServiceFactory(injector: Injector): NzTreeBaseService {
Expand All @@ -61,7 +61,7 @@ const TREE_SELECT_DEFAULT_CLASS = 'ant-select-dropdown ant-select-tree-dropdown'
@Component({
selector: 'nz-tree-select',
exportAs: 'nzTreeSelect',
animations: [slideMotion, zoomMotion],
animations: [slideMotion],
template: `
<ng-template
cdkConnectedOverlay
Expand Down Expand Up @@ -129,22 +129,14 @@ const TREE_SELECT_DEFAULT_CLASS = 'ant-select-dropdown ant-select-tree-dropdown'
<ng-container *ngIf="isMultiple">
<nz-select-item
*ngFor="let node of selectedNodes | slice: 0:nzMaxTagCount; trackBy: trackValue"
[@zoomMotion]
[@.disabled]="noAnimation?.nzNoAnimation"
[nzNoAnimation]="noAnimation?.nzNoAnimation"
[deletable]="true"
[disabled]="node.isDisabled || nzDisabled"
[label]="nzDisplayWith(node)"
(@zoomMotion.done)="updatePosition()"
(delete)="removeSelected(node, true)"
></nz-select-item>
<nz-select-item
*ngIf="selectedNodes.length > nzMaxTagCount"
[@zoomMotion]
(@zoomMotion.done)="updatePosition()"
[@.disabled]="noAnimation?.nzNoAnimation"
[nzNoAnimation]="noAnimation?.nzNoAnimation"
[contentTemplateOutlet]="nzMaxTagPlaceholder"
[contentTemplateOutletContext]="selectedNodes | slice: nzMaxTagCount"
[deletable]="false"
Expand Down Expand Up @@ -557,9 +549,7 @@ export class NzTreeSelectComponent extends NzTreeBase implements ControlValueAcc

updatePosition(): void {
setTimeout(() => {
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) {
this.cdkConnectedOverlay.overlayRef.updatePosition();
}
this.cdkConnectedOverlay?.overlayRef?.updatePosition();
});
}

Expand Down

0 comments on commit 2222798

Please sign in to comment.