Skip to content

Commit

Permalink
feat(module:message): support standalone component (#8241)
Browse files Browse the repository at this point in the history
  • Loading branch information
ParsaArvanehPA authored Dec 7, 2023
1 parent b9cf3b0 commit c2120b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
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 {}

0 comments on commit c2120b2

Please sign in to comment.