Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module:message): support standalone component #8241

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion components/message/message-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
*/

import { Direction } from '@angular/cdk/bidi';
import { NgForOf } from '@angular/common';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ViewEncapsulation } from '@angular/core';
import { takeUntil } from 'rxjs/operators';

import { MessageConfig, NzConfigService } from 'ng-zorro-antd/core/config';
import { toCssPixel } from 'ng-zorro-antd/core/util';

import { NzMNContainerComponent } from './base';
import { NzMessageComponent } from './message.component';

const NZ_CONFIG_COMPONENT_NAME = 'message';

Expand All @@ -37,7 +39,9 @@ const NZ_MESSAGE_DEFAULT_CONFIG: Required<MessageConfig> = {
(destroyed)="remove($event.id, $event.userAction)"
></nz-message>
</div>
`
`,
imports: [NzMessageComponent, NgForOf],
standalone: true
})
export class NzMessageContainerComponent extends NzMNContainerComponent {
dir: Direction = 'ltr';
Expand Down
7 changes: 6 additions & 1 deletion components/message/message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { NgClass, NgSwitch, NgSwitchCase } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -16,6 +17,8 @@ import {
} from '@angular/core';

import { moveUpMotion } from 'ng-zorro-antd/core/animation';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import { NzIconModule } from 'ng-zorro-antd/icon';

import { NzMNComponent } from './base';
import { NzMessageData } from './typings';
Expand Down Expand Up @@ -50,7 +53,9 @@ import { NzMessageData } from './typings';
</div>
</div>
</div>
`
`,
imports: [NgClass, NgSwitch, NgSwitchCase, NzIconModule, NzOutletModule],
standalone: true
})
export class NzMessageComponent extends NzMNComponent implements OnInit, OnDestroy {
@Input() override instance!: Required<NzMessageData>;
Expand Down
9 changes: 1 addition & 8 deletions components/message/message.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { BidiModule } from '@angular/cdk/bidi';
import { OverlayModule } from '@angular/cdk/overlay';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import { NzIconModule } from 'ng-zorro-antd/icon';

import { NzMessageContainerComponent } from './message-container.component';
import { NzMessageComponent } from './message.component';

@NgModule({
imports: [BidiModule, CommonModule, OverlayModule, NzIconModule, NzOutletModule],
declarations: [NzMessageContainerComponent, NzMessageComponent]
imports: [NzMessageContainerComponent, NzMessageComponent]
})
export class NzMessageModule {}