Skip to content

Commit

Permalink
feat(abc:notice-icon): support standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Jan 11, 2024
1 parent d2798a0 commit 2ee634e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/abc/error-collect/error-collect.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { NzIconDirective } from 'ng-zorro-antd/icon';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [NzIconDirective]
imports: [NzIconDirective, NzIconDirective]
})
export class ErrorCollectComponent implements OnInit {
private formEl: HTMLFormElement | null = null;
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/media/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const alainConfig: AlainConfig = {

## API

### media
### [media]:standalone

| Property | Description | Type | Default | Global Config |
|----------|-------------|------|---------|---------------|
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/media/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const alainConfig: AlainConfig = {

## API

### media
### [media]:standalone

| 成员 | 说明 | 类型 | 默认值 | 全局配置 |
|----|----|----|-----|------|
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/notice-icon/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ title: 通知图标
```ts
import { Component } from '@angular/core';

import { NoticeIconModule } from '@delon/abc/notice-icon';
import { NoticeIconComponent } from '@delon/abc/notice-icon';

@Component({
selector: 'app-demo',
template: ` <notice-icon count="5" /> `,
standalone: true,
imports: [NoticeIconModule]
imports: [NoticeIconComponent]
})
export class DemoComponent {}
```
4 changes: 2 additions & 2 deletions packages/abc/notice-icon/demo/popover.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Component, TemplateRef, ViewChild, inject } from '@angular/core';

import { add, formatDistanceToNow, parse } from 'date-fns';

import { NoticeIconList, NoticeIconModule, NoticeIconSelect, NoticeItem } from '@delon/abc/notice-icon';
import { NoticeIconList, NoticeIconComponent, NoticeIconSelect, NoticeItem } from '@delon/abc/notice-icon';
import { NzI18nService } from 'ng-zorro-antd/i18n';
import { NzMessageService } from 'ng-zorro-antd/message';

Expand All @@ -36,7 +36,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
</div>
`,
standalone: true,
imports: [NoticeIconModule]
imports: [NoticeIconComponent]
})
export class DemoComponent {
private readonly msg = inject(NzMessageService);
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/notice-icon/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Used on the navigation toolbar as a unified notification center for the entire p

## API

### notice-icon
### notice-icon:standalone

| Property | Description | Type | Default |
|----------|-------------|------|---------|
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/notice-icon/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module: import { NoticeIconModule } from '@delon/abc/notice-icon';

## API

### notice-icon
### notice-icon:standalone

| 参数 | 说明 | 类型 | 默认值 |
|----|----|----|-----|
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/notice-icon/notice-icon-tab.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ng-template #listTpl>
<nz-list [nzDataSource]="data.list" [nzRenderItem]="item">
<ng-template #item let-item>
<nz-list-item (click)="onClick(item)" [ngClass]="{ 'notice-icon__item-read': item.read }">
<nz-list-item (click)="onClick(item)" [class.notice-icon__item-read]="item.read">
<nz-list-item-meta [nzTitle]="nzTitle" [nzDescription]="nzDescription" [nzAvatar]="item.avatar">
<ng-template #nzTitle>
<ng-container *nzStringTemplateOutlet="item.title; context: { $implicit: item }">
Expand Down
8 changes: 7 additions & 1 deletion packages/abc/notice-icon/notice-icon-tab.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { NgTemplateOutlet } from '@angular/common';
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';

import { LocaleData } from '@delon/theme';
import { NzStringTemplateOutletDirective } from 'ng-zorro-antd/core/outlet';
import { NzListModule } from 'ng-zorro-antd/list';
import { NzTagComponent } from 'ng-zorro-antd/tag';

import { NoticeIconSelect, NoticeItem } from './notice-icon.types';

Expand All @@ -9,7 +13,9 @@ import { NoticeIconSelect, NoticeItem } from './notice-icon.types';
exportAs: 'noticeIconTab',
templateUrl: './notice-icon-tab.component.html',
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [NgTemplateOutlet, NzStringTemplateOutletDirective, NzListModule, NzTagComponent]
})
export class NoticeIconTabComponent {
@Input() locale: LocaleData = {};
Expand Down
19 changes: 18 additions & 1 deletion packages/abc/notice-icon/notice-icon.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NgClass } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -14,8 +15,14 @@ import { Subscription } from 'rxjs';

import { DelonLocaleService, LocaleData } from '@delon/theme';
import { BooleanInput, InputBoolean, InputNumber, NumberInput } from '@delon/util/decorator';
import { NzBadgeComponent } from 'ng-zorro-antd/badge';
import type { NgClassType } from 'ng-zorro-antd/core/types';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { NzIconDirective } from 'ng-zorro-antd/icon';
import { NzSpinComponent } from 'ng-zorro-antd/spin';
import { NzTabsModule } from 'ng-zorro-antd/tabs';

import { NoticeIconTabComponent } from './notice-icon-tab.component';
import { NoticeIconSelect, NoticeItem } from './notice-icon.types';

@Component({
Expand All @@ -25,7 +32,17 @@ import { NoticeIconSelect, NoticeItem } from './notice-icon.types';
host: { '[class.notice-icon__btn]': 'true' },
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [
NgClass,
NzBadgeComponent,
NzIconDirective,
NzDropDownModule,
NzSpinComponent,
NzTabsModule,
NoticeIconTabComponent
]
})
export class NoticeIconComponent implements OnInit, OnChanges, OnDestroy {
static ngAcceptInputType_count: NumberInput;
Expand Down
5 changes: 3 additions & 2 deletions packages/abc/notice-icon/notice-icon.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const COMPONENTS = [NoticeIconComponent];
NzSpinModule,
NzTabsModule,
NzTagModule,
NzOutletModule
NzOutletModule,
...COMPONENTS,
NoticeIconTabComponent
],
declarations: [...COMPONENTS, NoticeIconTabComponent],
exports: COMPONENTS
})
export class NoticeIconModule {}

0 comments on commit 2ee634e

Please sign in to comment.