Skip to content

Commit

Permalink
fix(module:*): fix style error with 3.23.6 (NG-ZORRO#4258)
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie authored and Ricbet committed Apr 9, 2020
1 parent dae3a31 commit 6848f4f
Show file tree
Hide file tree
Showing 29 changed files with 412 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ end_of_line=lf
trim_trailing_whitespace=true
insert_final_newline=false
indent_style=space
indent_size=4
indent_size=2

[{*.ng,*.sht,*.html,*.shtm,*.shtml,*.htm}]
indent_style=space
Expand Down
1 change: 1 addition & 0 deletions components/breadcrumb/style/entry.less
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import './index.less';
@import './patch.less';
7 changes: 7 additions & 0 deletions components/breadcrumb/style/patch.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.@{breadcrumb-prefix-cls} {
&-link {
.@{iconfont-css-prefix} + span {
margin-left: 4px;
}
}
}
1 change: 1 addition & 0 deletions components/button/demo/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Component } from '@angular/core';
selector: 'nz-demo-button-icon',
template: `
<button nz-button nzType="primary" nzShape="circle"><i nz-icon nzType="search"></i></button>
<button nz-button nzType="primary" nzShape="circle">A</button>
<button nz-button nzType="primary"><i nz-icon nzType="search"></i>Search</button>
<button nz-button nzType="default" nzShape="circle"><i nz-icon nzType="search"></i></button>
<button nz-button nzType="default"><i nz-icon nzType="search"></i>Search</button>
Expand Down
2 changes: 2 additions & 0 deletions components/button/demo/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { Component } from '@angular/core';
<button nz-button [nzSize]="size" nzType="danger">Danger</button>
<button nz-button [nzSize]="size" nzType="link">Link</button>
<br />
<button nz-button nzType="primary" [nzSize]="size"><i nz-icon nzType="download"></i></button>
<button nz-button nzType="primary" [nzSize]="size" nzShape="circle"><i nz-icon nzType="download"></i></button>
<button nz-button nzType="primary" [nzSize]="size" nzShape="round"><i nz-icon nzType="download"></i></button>
<button nz-button nzType="primary" [nzSize]="size" nzShape="round">
<i nz-icon nzType="download"></i>Download
</button>
Expand Down
2 changes: 2 additions & 0 deletions components/button/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { NzButtonModule } from 'ng-zorro-antd/button';

### [nz-button]

> Note:nz-button is Directive, it accepts all props which native button [support](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button).
To get a customized button, just set `nzType`/`nzShape`/`nzSize`/`nzLoading`/`disabled`.

| Property | Description | Type | Default | Global Config |
Expand Down
2 changes: 2 additions & 0 deletions components/button/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { NzButtonModule } from 'ng-zorro-antd/button';

### [nz-button]

> 注意:nz-button 是一个 Directive,除以下表格之外还支持例如 disabled 等原生 button 的[所有属性](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/button)
通过设置 Button 的属性来产生不同的按钮样式,推荐顺序为:`nzType` -> `nzShape` -> `nzSize` -> `nzLoading` -> `disabled`

按钮的属性说明如下:
Expand Down
2 changes: 2 additions & 0 deletions components/button/nz-button-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { NzSizeLDSType, NzUpdateHostClassService } from 'ng-zorro-antd/core';
})
export class NzButtonGroupComponent implements OnInit {
private _size: NzSizeLDSType;
isInDropdown = false;

@Input()
get nzSize(): NzSizeLDSType {
Expand All @@ -37,6 +38,7 @@ export class NzButtonGroupComponent implements OnInit {
const prefixCls = 'ant-btn-group';
const classMap = {
[prefixCls]: true,
[`ant-dropdown-button`]: this.isInDropdown,
[`${prefixCls}-lg`]: this.nzSize === 'large',
[`${prefixCls}-sm`]: this.nzSize === 'small'
};
Expand Down
4 changes: 2 additions & 2 deletions components/button/nz-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class NzButtonComponent implements AfterContentInit, OnInit, OnDestroy, O
@Input() @WithConfig('default') nzSize: NzSizeLDSType;

readonly el: HTMLElement = this.elementRef.nativeElement;

isInDropdown = false;
private iconElement: HTMLElement;
private iconOnly = false;
private destroy$ = new Subject<void>();
Expand All @@ -95,7 +95,7 @@ export class NzButtonComponent implements AfterContentInit, OnInit, OnDestroy, O
[`${prefixCls}-${this.nzShape}`]: this.nzShape,
[`${prefixCls}-${sizeMap[this.nzSize]}`]: sizeMap[this.nzSize],
[`${prefixCls}-loading`]: this.nzLoading,
[`${prefixCls}-icon-only`]: this.iconOnly,
[`${prefixCls}-icon-only`]: this.iconOnly && !this.nzSearch && !this.isInDropdown,
[`${prefixCls}-background-ghost`]: this.nzGhost,
[`${prefixCls}-block`]: this.nzBlock,
[`ant-input-search-button`]: this.nzSearch
Expand Down
6 changes: 3 additions & 3 deletions components/button/nz-button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ describe('button', () => {
fixture.detectChanges();
expect(buttons[0].nativeElement.classList.contains('ant-btn-icon-only')).toBe(true);
expect(buttons[0].nativeElement.classList.contains('ant-btn-circle')).toBe(true);
expect(buttons[1].nativeElement.classList.contains('ant-btn-icon-only')).toBe(false);
expect(buttons[1].nativeElement.firstElementChild!.classList.contains('anticon-search')).toBe(true);
expect(buttons[1].nativeElement.firstElementChild.style.cssText).toBe('display: inline-block;');
expect(buttons[2].nativeElement.classList.contains('ant-btn-icon-only')).toBe(false);
expect(buttons[2].nativeElement.firstElementChild!.classList.contains('anticon-search')).toBe(true);
expect(buttons[2].nativeElement.firstElementChild.style.cssText).toBe('display: inline-block;');
}));
});

Expand Down
2 changes: 1 addition & 1 deletion components/button/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ a.@{btn-prefix-cls} {
&-sm {
line-height: @btn-height-sm - 2px;
}
}
}
2 changes: 1 addition & 1 deletion components/button/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,4 @@
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
}
5 changes: 5 additions & 0 deletions components/card/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ import { NzCardModule } from 'ng-zorro-antd/card';
| `[nzTitle]` | title content | `string\|TemplateRef<void>` | - |

### [nz-card-grid]

| Property | Description | Type | Default | Global Config |
| -------- | ----------- | ---- | ------- | ------------- |
| `[nzHoverable]` | Lift up when hovering card | `boolean` | `true` | - |

Area for grid style card

### nz-card-tab
Expand Down
4 changes: 4 additions & 0 deletions components/card/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ import { NzCardModule } from 'ng-zorro-antd/card';


### [nz-card-grid]
| 参数 | 说明 | 类型 | 默认值 | 支持全局配置 |
| --- | --- | --- | --- | --- |
| `[nzHoverable]` | 鼠标移过时可浮起 | `boolean` | `true` | - |

分隔卡片内容区域

### nz-card-tab
Expand Down
9 changes: 7 additions & 2 deletions components/card/nz-card-grid.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { Directive, ElementRef, Renderer2 } from '@angular/core';
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { InputBoolean } from 'ng-zorro-antd/core';

@Directive({
selector: '[nz-card-grid]',
exportAs: 'nzCardGrid'
exportAs: 'nzCardGrid',
host: {
'[class.ant-card-hoverable]': 'nzHoverable'
}
})
export class NzCardGridDirective {
@Input() @InputBoolean() nzHoverable: boolean = true;
constructor(elementRef: ElementRef, renderer: Renderer2) {
renderer.addClass(elementRef.nativeElement, 'ant-card-grid');
}
Expand Down
8 changes: 6 additions & 2 deletions components/core/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ function consoleCommonBehavior(consoleFunc: (...args: any) => void, ...args: any
export const warn = (...args: any[]) => consoleCommonBehavior((...arg: any[]) => console.warn(PREFIX, ...arg), ...args);

export const warnDeprecation = (...args: any[]) => {
const stack = new Error().stack;
return consoleCommonBehavior((...arg: any[]) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);
if (!environment.isTestMode) {
const stack = new Error().stack;
return consoleCommonBehavior((...arg: any[]) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);
} else {
return () => {};
}
};

// Log should only be printed in dev mode.
Expand Down
46 changes: 22 additions & 24 deletions components/dropdown/demo/dropdown-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@ import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-dropdown-dropdown-button',
template: `
<div style="height: 28px;">
<nz-button-group>
<button nz-button (click)="log()">DropDown</button>
<button nz-button nz-dropdown [nzDropdownMenu]="menu1" nzPlacement="bottomRight">
<i nz-icon nzType="ellipsis"></i>
</button>
</nz-button-group>
<nz-button-group>
<button nz-button (click)="log()">DropDown</button>
<button nz-button nz-dropdown [nzDropdownMenu]="menu2" nzPlacement="bottomRight">
<i nz-icon nzType="user"></i>
</button>
</nz-button-group>
<nz-button-group>
<button nz-button disabled>DropDown</button>
<button nz-button disabled nz-dropdown [nzDropdownMenu]="menu3" nzPlacement="bottomRight">
<i nz-icon nzType="ellipsis"></i>
</button>
</nz-button-group>
<button nz-button nz-dropdown [nzDropdownMenu]="menu4">
Button
<i nz-icon nzType="down"></i>
<nz-button-group>
<button nz-button (click)="log()">DropDown</button>
<button nz-button nz-dropdown [nzDropdownMenu]="menu1" nzPlacement="bottomRight">
<i nz-icon nzType="ellipsis"></i>
</button>
</div>
</nz-button-group>
<nz-button-group>
<button nz-button (click)="log()">DropDown</button>
<button nz-button nz-dropdown [nzDropdownMenu]="menu2" nzPlacement="bottomRight">
<i nz-icon nzType="user"></i>
</button>
</nz-button-group>
<nz-button-group>
<button nz-button disabled>DropDown</button>
<button nz-button disabled nz-dropdown [nzDropdownMenu]="menu3" nzPlacement="bottomRight">
<i nz-icon nzType="ellipsis"></i>
</button>
</nz-button-group>
<button nz-button nz-dropdown [nzDropdownMenu]="menu4">
Button
<i nz-icon nzType="down"></i>
</button>
<nz-dropdown-menu #menu1="nzDropdownMenu">
<ul nz-menu>
<li nz-menu-item>menu1 1st menu item</li>
Expand Down Expand Up @@ -59,7 +57,7 @@ import { Component } from '@angular/core';
styles: [
`
nz-button-group {
margin-right: 8px;
margin: 0 8px 8px 0;
}
`
]
Expand Down
11 changes: 11 additions & 0 deletions components/dropdown/nz-dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ import {
Directive,
ElementRef,
EventEmitter,
Host,
Input,
OnChanges,
OnDestroy,
Optional,
Output,
Renderer2,
SimpleChanges,
ViewContainerRef
} from '@angular/core';
import { NzButtonComponent, NzButtonGroupComponent } from 'ng-zorro-antd/button';
import { DEFAULT_DROPDOWN_POSITIONS, InputBoolean, POSITION_MAP } from 'ng-zorro-antd/core';
import { combineLatest, fromEvent, merge, EMPTY, Observable, Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged, filter, map, mapTo, takeUntil, tap } from 'rxjs/operators';
Expand Down Expand Up @@ -237,9 +240,17 @@ export class NzDropDownDirective implements AfterViewInit, OnDestroy, OnChanges
private renderer: Renderer2,
private overlay: Overlay,
private platform: Platform,
@Optional() @Host() private nzButtonComponent: NzButtonComponent,
@Optional() private nzButtonGroupComponent: NzButtonGroupComponent,
private viewContainerRef: ViewContainerRef
) {
renderer.addClass(elementRef.nativeElement, 'ant-dropdown-trigger');
if (this.nzButtonComponent) {
this.nzButtonComponent.isInDropdown = true;
}
if (this.nzButtonGroupComponent) {
this.nzButtonGroupComponent.isInDropdown = true;
}
}

ngAfterViewInit(): void {
Expand Down
1 change: 1 addition & 0 deletions components/grid/nz-col.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class NzColDirective implements OnInit, OnChanges, AfterViewInit, OnDestr
/** temp solution since no method add classMap to host https://github.com/angular/angular/issues/7289*/
setClassMap(): void {
const classMap = {
[`${this.prefixCls}`]: true,
[`${this.prefixCls}-${this.nzSpan}`]: isNotNil(this.nzSpan),
[`${this.prefixCls}-order-${this.nzOrder}`]: isNotNil(this.nzOrder),
[`${this.prefixCls}-offset-${this.nzOffset}`]: isNotNil(this.nzOffset),
Expand Down
34 changes: 21 additions & 13 deletions components/grid/nz-grid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ describe('grid', () => {
it('should have correct style', () => {
fixture.detectChanges();
expect(rows.every(row => row.nativeElement.classList.contains('ant-row'))).toBe(true);
expect(cols[0].nativeElement.className).toBe('ant-col-8');
expect(cols[1].nativeElement.className).toBe('ant-col-8 ant-col-offset-8');
expect(cols[2].nativeElement.className).toBe('ant-col-6 ant-col-offset-6');
expect(cols[3].nativeElement.className).toBe('ant-col-6 ant-col-offset-6');
expect(cols[4].nativeElement.className).toBe('ant-col-12 ant-col-offset-6');
expect(cols[0].nativeElement.className).toBe('ant-col ant-col-8');
expect(cols[1].nativeElement.className).toBe('ant-col ant-col-8 ant-col-offset-8');
expect(cols[2].nativeElement.className).toBe('ant-col ant-col-6 ant-col-offset-6');
expect(cols[3].nativeElement.className).toBe('ant-col ant-col-6 ant-col-offset-6');
expect(cols[4].nativeElement.className).toBe('ant-col ant-col-12 ant-col-offset-6');
});
});

Expand All @@ -250,11 +250,15 @@ describe('grid', () => {

it('should have correct style', () => {
fixture.detectChanges();
expect(cols[0].nativeElement.className).toBe('ant-col-xs-2 ant-col-sm-4 ant-col-md-6 ant-col-lg-8 ant-col-xl-10');
expect(cols[0].nativeElement.className).toBe(
'ant-col ant-col-xs-2 ant-col-sm-4 ant-col-md-6 ant-col-lg-8 ant-col-xl-10'
);
expect(cols[1].nativeElement.className).toBe(
'ant-col-xs-20 ant-col-sm-16 ant-col-md-12 ant-col-lg-8 ant-col-xl-4'
'ant-col ant-col-xs-20 ant-col-sm-16 ant-col-md-12 ant-col-lg-8 ant-col-xl-4'
);
expect(cols[2].nativeElement.className).toBe(
'ant-col ant-col-xs-2 ant-col-sm-4 ant-col-md-6 ant-col-lg-8 ant-col-xl-10'
);
expect(cols[2].nativeElement.className).toBe('ant-col-xs-2 ant-col-sm-4 ant-col-md-6 ant-col-lg-8 ant-col-xl-10');
});
});

Expand All @@ -276,11 +280,15 @@ describe('grid', () => {
});
it('should have correct style', () => {
fixture.detectChanges();
expect(cols[0].nativeElement.className).toBe('ant-col-xs-5 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2');
expect(cols[0].nativeElement.className).toBe(
'ant-col ant-col-xs-5 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2'
);
expect(cols[1].nativeElement.className).toBe(
'ant-col-xs-11 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2'
'ant-col ant-col-xs-11 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2'
);
expect(cols[2].nativeElement.className).toBe(
'ant-col ant-col-xs-5 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2'
);
expect(cols[2].nativeElement.className).toBe('ant-col-xs-5 ant-col-xs-offset-1 ant-col-lg-6 ant-col-lg-offset-2');
});
});

Expand All @@ -303,8 +311,8 @@ describe('grid', () => {

it('should have correct style', () => {
fixture.detectChanges();
expect(cols[0].nativeElement.className).toBe('ant-col-18 ant-col-push-6');
expect(cols[1].nativeElement.className).toBe('ant-col-6 ant-col-pull-18');
expect(cols[0].nativeElement.className).toBe('ant-col ant-col-18 ant-col-push-6');
expect(cols[1].nativeElement.className).toBe('ant-col ant-col-6 ant-col-pull-18');
});
});

Expand Down
2 changes: 1 addition & 1 deletion components/input/demo/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Component } from '@angular/core';
selector: 'nz-demo-input-group',
template: `
<nz-input-group [nzSize]="'large'">
<div nz-col nzSpan="4">
<div nz-col nzSpan="5">
<input type="text" nz-input [ngModel]="'0571'" />
</div>
<div nz-col nzSpan="8">
Expand Down
11 changes: 8 additions & 3 deletions components/input/demo/presuffix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-input-presuffix',
template: `
<nz-input-group [nzSuffix]="suffixTemplate" [nzPrefix]="prefixTemplate">
<nz-input-group [nzSuffix]="suffixTemplateInfo" [nzPrefix]="prefixTemplateUser">
<input type="text" nz-input placeholder="Enter your username" />
</nz-input-group>
<ng-template #prefixTemplate><i nz-icon nzType="user"></i></ng-template>
<ng-template #suffixTemplate
<ng-template #prefixTemplateUser><i nz-icon nzType="user"></i></ng-template>
<ng-template #suffixTemplateInfo
><i nz-icon nz-tooltip nzTitle="Extra information" nzType="info-circle"></i
></ng-template>
<br />
<br />
<nz-input-group nzSuffix="RMB" nzPrefix="¥">
<input type="text" nz-input />
</nz-input-group>
`
})
export class NzDemoInputPresuffixComponent {}
2 changes: 1 addition & 1 deletion components/input/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nz-input 可以使用所有的W3C标准下的所有 [使用方式](https://www.w
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| `[nzAddOnAfter]` | 带标签的 input,设置后置标签,可以与 `nzAddOnBefore` 配合使用 | `string \| TemplateRef<void>` | - |
| `[nzAddOnBefore]` | 带标签的 input,设置前置标签,可以与 `nzAddOnBefore` 配合使用 | `string \| TemplateRef<void>` | - |
| `[nzAddOnBefore]` | 带标签的 input,设置前置标签,可以与 `nzAddOnAfter` 配合使用 | `string \| TemplateRef<void>` | - |
| `[nzPrefix]` | 带有前缀图标的 input,可以与 `nzSuffix` 配合使用 | `string \| TemplateRef<void>` | - |
| `[nzSuffix]` | 带有后缀图标的 input,可以与 `nzPrefix` 配合使用 | `string \| TemplateRef<void>` | - |
| `[nzCompact]` | 是否用紧凑模式 | `boolean` | `false` |
Expand Down
3 changes: 1 addition & 2 deletions components/skeleton/nz-skeleton.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<ng-container *ngIf="nzLoading">
<div class="ant-skeleton-header">
<div class="ant-skeleton-header" *ngIf="!!nzAvatar">
<span
*ngIf="!!nzAvatar"
class="ant-skeleton-avatar"
[class.ant-skeleton-avatar-lg]="avatar.size === 'large'"
[class.ant-skeleton-avatar-sm]="avatar.size === 'small'"
Expand Down
Loading

0 comments on commit 6848f4f

Please sign in to comment.