Skip to content

Commit db5d5f4

Browse files
feat(module:back-top): support standalone component (#8195)
* feat(module:back-top): support standalone component * feat(module:back-top): support standalone component
1 parent 548e842 commit db5d5f4

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

components/back-top/back-top.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { Direction, Directionality } from '@angular/cdk/bidi';
77
import { Platform, normalizePassiveListenerOptions } from '@angular/cdk/platform';
8-
import { DOCUMENT } from '@angular/common';
8+
import { DOCUMENT, NgIf, NgTemplateOutlet } from '@angular/common';
99
import {
1010
ChangeDetectionStrategy,
1111
ChangeDetectorRef,
@@ -33,6 +33,7 @@ import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/con
3333
import { NzDestroyService, NzScrollService } from 'ng-zorro-antd/core/services';
3434
import { NumberInput, NzSafeAny } from 'ng-zorro-antd/core/types';
3535
import { InputNumber } from 'ng-zorro-antd/core/util';
36+
import { NzIconModule } from 'ng-zorro-antd/icon';
3637

3738
const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'backTop';
3839

@@ -42,6 +43,8 @@ const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: t
4243
selector: 'nz-back-top',
4344
exportAs: 'nzBackTop',
4445
animations: [fadeMotion],
46+
standalone: true,
47+
imports: [NgIf, NgTemplateOutlet, NzIconModule],
4548
template: `
4649
<div #backTop class="ant-back-top" [class.ant-back-top-rtl]="dir === 'rtl'" @fadeMotion *ngIf="visible">
4750
<ng-template #defaultContent>

components/back-top/back-top.module.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6-
import { BidiModule } from '@angular/cdk/bidi';
7-
import { PlatformModule } from '@angular/cdk/platform';
8-
import { CommonModule } from '@angular/common';
96
import { NgModule } from '@angular/core';
107

11-
import { NzIconModule } from 'ng-zorro-antd/icon';
12-
138
import { NzBackTopComponent } from './back-top.component';
149

1510
@NgModule({
16-
declarations: [NzBackTopComponent],
1711
exports: [NzBackTopComponent],
18-
imports: [BidiModule, CommonModule, PlatformModule, NzIconModule]
12+
imports: [NzBackTopComponent]
1913
})
2014
export class NzBackTopModule {}

components/back-top/doc/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { NzBackTopModule } from 'ng-zorro-antd/back-top';
1818

1919
## API
2020

21-
### nz-back-top
21+
### nz-back-top:standalone
2222

2323
> The distance to the bottom is set to `50px` by default, which is overridable.
2424
> If you decide to use custom styles, please note the size limit: no more than `40px * 40px`.

components/back-top/doc/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { NzBackTopModule } from 'ng-zorro-antd/back-top';
1919

2020
## API
2121

22-
### nz-back-top
22+
### nz-back-top:standalone
2323

2424
> 有默认样式,距离底部 `50px`,可覆盖。
2525
> 自定义样式宽高不大于 `40px * 40px`

0 commit comments

Comments
 (0)