Skip to content

Commit

Permalink
chore: add exportAs in components (NG-ZORRO#3301)
Browse files Browse the repository at this point in the history
* chore: add `exportAs` in components

close NG-ZORRO#2417, ref NG-ZORRO#2474

* build: fix check scripts

* chore: add `exportAs` in autocomplete trigger directive

* build: fix script name
  • Loading branch information
hsuanxyz authored and vthinkxie committed Apr 18, 2019
1 parent e599c6f commit 3ce69f1
Show file tree
Hide file tree
Showing 162 changed files with 253 additions and 19 deletions.
1 change: 1 addition & 0 deletions components/affix/nz-affix.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { throttleByAnimationFrameDecorator } from '../core/util/throttleByAnimat

@Component({
selector: 'nz-affix',
exportAs: 'nzAffix',
templateUrl: './nz-affix.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
styles: [
Expand Down
1 change: 1 addition & 0 deletions components/alert/nz-alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { InputBoolean } from '../core/util/convert';

@Component({
selector: 'nz-alert',
exportAs: 'nzAlert',
animations: [slideAlertMotion],
templateUrl: './nz-alert.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
1 change: 1 addition & 0 deletions components/anchor/nz-anchor-link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { NzAnchorComponent } from './nz-anchor.component';

@Component({
selector: 'nz-link',
exportAs: 'nzLink',
preserveWhitespaces: false,
templateUrl: './nz-anchor-link.component.html',
host: {
Expand Down
1 change: 1 addition & 0 deletions components/anchor/nz-anchor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const sharpMatcherRegx = /#([^#]+)$/;

@Component({
selector: 'nz-anchor',
exportAs: 'nzAnchor',
preserveWhitespaces: false,
templateUrl: './nz-anchor.component.html',
encapsulation: ViewEncapsulation.None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Input, TemplateRef, ViewEncapsulati

@Component({
selector: 'nz-auto-optgroup',
exportAs: 'nzAutoOptgroup',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class NzOptionSelectionChange {

@Component({
selector: 'nz-auto-option',
exportAs: 'nzAutoOption',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function getNzAutocompleteMissingPanelError(): Error {

@Directive({
selector: `input[nzAutocomplete], textarea[nzAutocomplete]`,
exportAs: 'nzAutocompleteTrigger',
providers: [NZ_AUTOCOMPLETE_VALUE_ACCESSOR],
host: {
autocomplete: 'off',
Expand Down
1 change: 1 addition & 0 deletions components/auto-complete/nz-autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type AutocompleteDataSource = AutocompleteDataSourceItem[] | string[] | n

@Component({
selector: 'nz-autocomplete',
exportAs: 'nzAutocomplete',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
1 change: 1 addition & 0 deletions components/avatar/nz-avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface NzAvatarSizeMap {

@Component({
selector: 'nz-avatar',
exportAs: 'nzAvatar',
templateUrl: './nz-avatar.component.html',
providers: [NzUpdateHostClassService],
preserveWhitespaces: false,
Expand Down
1 change: 1 addition & 0 deletions components/back-top/nz-back-top.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { toNumber } from '../core/util/convert';

@Component({
selector: 'nz-back-top',
exportAs: 'nzBackTop',
animations: [fadeMotion],
templateUrl: './nz-back-top.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
1 change: 1 addition & 0 deletions components/badge/nz-badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type NzBadgeStatusType = 'success' | 'processing' | 'default' | 'error' |

@Component({
selector: 'nz-badge',
exportAs: 'nzBadge',
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
1 change: 1 addition & 0 deletions components/breadcrumb/nz-breadcrumb-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NzBreadCrumbComponent } from './nz-breadcrumb.component';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-breadcrumb-item',
exportAs: 'nzBreadcrumbItem',
preserveWhitespaces: false,
templateUrl: 'nz-breadcrumb-item.component.html',
styles: [
Expand Down
1 change: 1 addition & 0 deletions components/breadcrumb/nz-breadcrumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface BreadcrumbOption {
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-breadcrumb',
exportAs: 'nzBreadcrumb',
preserveWhitespaces: false,
templateUrl: './nz-breadcrumb.component.html',
styles: [
Expand Down
1 change: 1 addition & 0 deletions components/button/nz-button-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NzSizeLDSType } from '../core/types/size';

@Component({
selector: 'nz-button-group',
exportAs: 'nzButtonGroup',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
Expand Down
1 change: 1 addition & 0 deletions components/button/nz-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type NzButtonShape = 'circle' | 'round' | null;

@Component({
selector: '[nz-button]',
exportAs: 'nzButton',
providers: [NzUpdateHostClassService],
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
12 changes: 8 additions & 4 deletions components/calendar/nz-calendar-cells.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { Directive } from '@angular/core';

@Directive({
selector: '[nzDateCell]'
selector: '[nzDateCell]',
exportAs: 'nzDateCell'
})
export class NzDateCellDirective {}

@Directive({
selector: '[nzMonthCell]'
selector: '[nzMonthCell]',
exportAs: 'nzMonthCell'
})
export class NzMonthCellDirective {}

@Directive({
selector: '[nzDateFullCell]'
selector: '[nzDateFullCell]',
exportAs: 'nzDateFullCell'
})
export class NzDateFullCellDirective {}

@Directive({
selector: '[nzMonthFullCell]'
selector: '[nzMonthFullCell]',
exportAs: 'nzMonthFullCell'
})
export class NzMonthFullCellDirective {}
1 change: 1 addition & 0 deletions components/calendar/nz-calendar-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { NzI18nService as I18n } from '../i18n/nz-i18n.service';
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'nz-calendar-header',
exportAs: 'nzCalendarHeader',
templateUrl: './nz-calendar-header.component.html',
host: {
'[style.display]': `'block'`,
Expand Down
1 change: 1 addition & 0 deletions components/calendar/nz-calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type ModeType = 'month' | 'year';
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'nz-calendar',
exportAs: 'nzCalendar',
templateUrl: './nz-calendar.component.html',
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzCalendarComponent), multi: true }]
})
Expand Down
3 changes: 2 additions & 1 deletion components/card/nz-card-grid.directive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Directive, ElementRef, Renderer2 } from '@angular/core';

@Directive({
selector: '[nz-card-grid]'
selector: '[nz-card-grid]',
exportAs: 'nzCardGrid'
})
export class NzCardGridDirective {
constructor(elementRef: ElementRef, renderer: Renderer2) {
Expand Down
1 change: 1 addition & 0 deletions components/card/nz-card-loading.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsul

@Component({
selector: 'nz-card-loading',
exportAs: 'nzCardLoading',
templateUrl: './nz-card-loading.component.html',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
1 change: 1 addition & 0 deletions components/card/nz-card-meta.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {

@Component({
selector: 'nz-card-meta',
exportAs: 'nzCardMeta',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
1 change: 1 addition & 0 deletions components/card/nz-card-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, TemplateRef, ViewChild, ViewEncapsu

@Component({
selector: 'nz-card-tab',
exportAs: 'nzCardTab',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './nz-card-tab.component.html'
Expand Down
1 change: 1 addition & 0 deletions components/card/nz-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { NzCardTabComponent } from './nz-card-tab.component';

@Component({
selector: 'nz-card',
exportAs: 'nzCard',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
3 changes: 2 additions & 1 deletion components/carousel/nz-carousel-content.directive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Directive, ElementRef, Renderer2 } from '@angular/core';

@Directive({
selector: '[nz-carousel-content]'
selector: '[nz-carousel-content]',
exportAs: 'nzCarouselContent'
})
export class NzCarouselContentDirective {
el: HTMLElement = this.elementRef.nativeElement;
Expand Down
1 change: 1 addition & 0 deletions components/carousel/nz-carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { NzCarouselTransformStrategy } from './strategies/transform-strategy';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-carousel',
exportAs: 'nzCarousel',
preserveWhitespaces: false,
templateUrl: './nz-carousel.component.html',
host: {
Expand Down
1 change: 1 addition & 0 deletions components/cascader/nz-cascader-li.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CascaderOption } from './nz-cascader-definitions';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: '[nz-cascader-option]',
exportAs: 'nzCascaderOption',
templateUrl: './nz-cascader-li.component.html',
host: {
'[attr.title]': 'option.title || getOptionLabel()',
Expand Down
1 change: 1 addition & 0 deletions components/cascader/nz-cascader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const defaultDisplayRender = (labels: string[]) => labels.join(' / ');
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-cascader,[nz-cascader]',
exportAs: 'nzCascader',
preserveWhitespaces: false,
templateUrl: './nz-cascader.component.html',
animations: [slideMotion],
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/nz-checkbox-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface NzCheckBoxOptionInterface {

@Component({
selector: 'nz-checkbox-group',
exportAs: 'nzCheckboxGroup',
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
templateUrl: './nz-checkbox-group.component.html',
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/nz-checkbox-wrapper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { NzCheckboxComponent } from './nz-checkbox.component';

@Component({
selector: 'nz-checkbox-wrapper',
exportAs: 'nzCheckboxWrapper',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/nz-checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { NzCheckboxWrapperComponent } from './nz-checkbox-wrapper.component';

@Component({
selector: '[nz-checkbox]',
exportAs: 'nzCheckbox',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
1 change: 1 addition & 0 deletions components/collapse/nz-collapse-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { NzCollapseComponent } from './nz-collapse.component';

@Component({
selector: 'nz-collapse-panel',
exportAs: 'nzCollapsePanel',
templateUrl: './nz-collapse-panel.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
1 change: 1 addition & 0 deletions components/collapse/nz-collapse.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NzCollapsePanelComponent } from './nz-collapse-panel.component';

@Component({
selector: 'nz-collapse',
exportAs: 'nzCollapse',
templateUrl: './nz-collapse.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Expand Down
8 changes: 6 additions & 2 deletions components/comment/nz-comment-cells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ import {
} from '@angular/core';

@Directive({
selector: 'nz-avatar[nz-comment-avatar]'
selector: 'nz-avatar[nz-comment-avatar]',
exportAs: 'nzCommentAvatar'
})
export class NzCommentAvatarDirective {}

@Directive({
selector: 'nz-comment-content, [nz-comment-content]',
exportAs: 'nzCommentContent',
host: { class: 'ant-comment-content-detail' }
})
export class NzCommentContentDirective {}

@Directive({
selector: '[nzCommentActionHost]'
selector: '[nzCommentActionHost]',
exportAs: 'nzCommentActionHost'
})
export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnInit, OnDestroy {
@Input() nzCommentActionHost: TemplatePortal | null;
Expand All @@ -46,6 +49,7 @@ export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnI

@Component({
selector: 'nz-comment-action',
exportAs: 'nzCommentAction',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-template><ng-content></ng-content></ng-template>'
Expand Down
1 change: 1 addition & 0 deletions components/comment/nz-comment.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NzCommentActionComponent as CommentAction } from './nz-comment-cells';

@Component({
selector: 'nz-comment',
exportAs: 'nzComment',
templateUrl: './nz-comment.component.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
3 changes: 2 additions & 1 deletion components/core/addon/classlist_add.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';

@Directive({
selector: '[nzClassListAdd]'
selector: '[nzClassListAdd]',
exportAs: 'nzClassListAdd'
})
export class NzClassListAddDirective {
classList: string[] = [];
Expand Down
3 changes: 2 additions & 1 deletion components/core/addon/string_template_outlet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef } from '@angular/core';

@Directive({
selector: '[nzStringTemplateOutlet]'
selector: '[nzStringTemplateOutlet]',
exportAs: 'nzStringTemplateOutlet'
})
export class NzStringTemplateOutletDirective {
private isTemplate: boolean;
Expand Down
1 change: 1 addition & 0 deletions components/core/no-animation/nz-no-animation.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const DISABLED_CLASSNAME = 'nz-animate-disabled';

@Directive({
selector: '[nzNoAnimation]',
exportAs: 'nzNoAnimation',
host: {
'[@.disabled]': 'nzNoAnimation'
}
Expand Down
3 changes: 2 additions & 1 deletion components/core/overlay/nz-connected-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { CdkConnectedOverlay } from '@angular/cdk/overlay';
import { Directive } from '@angular/core';

@Directive({
selector: '[cdkConnectedOverlay][nzConnectedOverlay]'
selector: '[cdkConnectedOverlay][nzConnectedOverlay]',
exportAs: 'nzConnectedOverlay'
})
export class NzConnectedOverlayDirective {
constructor(private cdkConnectedOverlay: CdkConnectedOverlay) {
Expand Down
3 changes: 2 additions & 1 deletion components/core/wave/nz-wave.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export function NZ_WAVE_GLOBAL_CONFIG_FACTORY(): NzWaveConfig {
}

@Directive({
selector: '[nz-wave]'
selector: '[nz-wave]',
exportAs: 'nzWave'
})
export class NzWaveDirective implements OnInit, OnDestroy {
@Input() nzWaveExtraNode = false;
Expand Down
1 change: 1 addition & 0 deletions components/date-picker/date-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DateRangePickerComponent } from './date-range-picker.component';
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'nz-date-picker',
exportAs: 'nzDatePicker',
templateUrl: './date-range-picker.component.html',
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { CandyDate } from '../candy-date';
changeDetection: ChangeDetectionStrategy.OnPush,
// tslint:disable-next-line:component-selector
selector: 'calendar-footer',
exportAs: 'calendarFooter',
templateUrl: 'calendar-footer.component.html'
})
export class CalendarFooterComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CandyDate } from '../candy-date';
changeDetection: ChangeDetectionStrategy.OnPush,
// tslint:disable-next-line:component-selector
selector: 'calendar-header',
exportAs: 'calendarHeader',
templateUrl: 'calendar-header.component.html'
})
export class CalendarHeaderComponent implements OnInit, OnChanges {
Expand Down
Loading

0 comments on commit 3ce69f1

Please sign in to comment.