diff --git a/components/affix/demo/target.ts b/components/affix/demo/target.ts index d0fdcf5284a..a4c9ff08378 100644 --- a/components/affix/demo/target.ts +++ b/components/affix/demo/target.ts @@ -14,12 +14,12 @@ import { Component } from '@angular/core'; `, styles: [` - :host ::ng-deep .scrollable-container { + .scrollable-container { height: 100px; overflow-y: scroll; } - :host ::ng-deep .background { + .background { padding-top: 60px; height: 300px; background-image: url(//zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg); diff --git a/components/alert/demo/banner.ts b/components/alert/demo/banner.ts index 4ee0ee22d98..f7a6d1cf846 100644 --- a/components/alert/demo/banner.ts +++ b/components/alert/demo/banner.ts @@ -4,6 +4,17 @@ import { Component } from '@angular/core'; selector: 'nz-demo-alert-banner', template: ` - ` + + + + `, + styles : [ + ` + nz-alert { + margin-bottom: 12px; + } + ` + ] }) -export class NzDemoAlertBannerComponent { } +export class NzDemoAlertBannerComponent { +} diff --git a/components/avatar/demo/basic.ts b/components/avatar/demo/basic.ts index f34e86c9164..f60ebb8f66a 100644 --- a/components/avatar/demo/basic.ts +++ b/components/avatar/demo/basic.ts @@ -17,7 +17,7 @@ import { Component } from '@angular/core'; `, styles: [` - :host ::ng-deep .ant-avatar { + nz-avatar { margin-top: 16px; margin-right: 16px; } diff --git a/components/avatar/demo/type.ts b/components/avatar/demo/type.ts index d3b741b8586..010d0518fe6 100644 --- a/components/avatar/demo/type.ts +++ b/components/avatar/demo/type.ts @@ -11,7 +11,7 @@ import { Component } from '@angular/core'; `, styles: [` - :host ::ng-deep .ant-avatar { + nz-avatar { margin-top: 16px; margin-right: 16px; } diff --git a/components/back-top/demo/basic.ts b/components/back-top/demo/basic.ts index ceec448134e..78eb49468bc 100644 --- a/components/back-top/demo/basic.ts +++ b/components/back-top/demo/basic.ts @@ -9,7 +9,7 @@ import { Component } from '@angular/core'; button. `, styles : [ ` - :host ::ng-deep strong { + strong { color: rgba(64, 64, 64, 0.6); } ` ] diff --git a/components/back-top/demo/custom.ts b/components/back-top/demo/custom.ts index bf303084b37..98bbba17bb5 100644 --- a/components/back-top/demo/custom.ts +++ b/components/back-top/demo/custom.ts @@ -13,11 +13,7 @@ import { Component } from '@angular/core'; button. `, styles : [ ` - :host ::ng-deep .ant-back-top { - bottom: 100px; - } - - :host ::ng-deep .ant-back-top-inner { + .ant-back-top-inner { height: 40px; width: 40px; line-height: 40px; @@ -28,7 +24,7 @@ import { Component } from '@angular/core'; font-size: 20px; } - :host ::ng-deep strong { + strong { color: #1088e9; } ` ] diff --git a/components/back-top/demo/target.ts b/components/back-top/demo/target.ts index 9d5d92f3564..dd36ad71e90 100644 --- a/components/back-top/demo/target.ts +++ b/components/back-top/demo/target.ts @@ -12,21 +12,21 @@ import { Component } from '@angular/core'; `, styles : [ ` - :host ::ng-deep .long-div { + .long-div { height: 300px; overflow-y: scroll; background-image: url(//zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg); } - :host ::ng-deep .long-div-inner { + .long-div-inner { height: 1500px; } - :host ::ng-deep .long-div .ant-back-top { + nz-back-top { right: 150px; } - :host ::ng-deep strong { + strong { color: rgba(64, 64, 64, 0.6); } ` ] diff --git a/components/dropdown/demo/placement.ts b/components/dropdown/demo/placement.ts index 0c06eabed04..7d0ff6adf43 100644 --- a/components/dropdown/demo/placement.ts +++ b/components/dropdown/demo/placement.ts @@ -91,7 +91,7 @@ import { Component } from '@angular/core'; `, styles : [ ` - :host ::ng-deep .ant-btn { + [nz-button] { margin-right: 8px; margin-bottom: 8px; } diff --git a/components/layout/demo/basic.ts b/components/layout/demo/basic.ts index 3b231f630cf..e05a4d579c2 100644 --- a/components/layout/demo/basic.ts +++ b/components/layout/demo/basic.ts @@ -41,34 +41,33 @@ import { Component } from '@angular/core'; text-align: center; } - :host ::ng-deep .ant-layout-header, - :host ::ng-deep .ant-layout-footer { + nz-header,nz-footer { background: #7dbcea; color: #fff; } - :host ::ng-deep .ant-layout-footer { + nz-footer { line-height: 1.5; } - :host ::ng-deep .ant-layout-sider { + nz-sider { background: #3ba0e9; color: #fff; line-height: 120px; } - :host ::ng-deep .ant-layout-content { + nz-content { background: rgba(16, 142, 233, 1); color: #fff; min-height: 120px; line-height: 120px; } - :host > ::ng-deep .ant-layout { + nz-layout { margin-bottom: 48px; } - :host ::ng-deep .ant-layout:last-child { + nz-layout:last-child { margin: 0; } ` ] diff --git a/components/layout/demo/custom-trigger.ts b/components/layout/demo/custom-trigger.ts index 6fe2b494cee..6c0f5b2925d 100644 --- a/components/layout/demo/custom-trigger.ts +++ b/components/layout/demo/custom-trigger.ts @@ -39,7 +39,7 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; Bill is a cat. - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular @@ -48,7 +48,7 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; `, styles : [ ` - :host ::ng-deep .trigger { + .trigger { font-size: 18px; line-height: 64px; padding: 0 24px; @@ -56,11 +56,11 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; transition: color .3s; } - :host ::ng-deep .trigger:hover { + .trigger:hover { color: #1890ff; } - :host ::ng-deep .logo { + .logo { height: 32px; background: rgba(255, 255, 255, .2); margin: 16px; diff --git a/components/layout/demo/fixed-sider.ts b/components/layout/demo/fixed-sider.ts index 40bff4c1937..45599ba027a 100644 --- a/components/layout/demo/fixed-sider.ts +++ b/components/layout/demo/fixed-sider.ts @@ -37,7 +37,7 @@ import { Component } from '@angular/core'; content - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular `, diff --git a/components/layout/demo/fixed.ts b/components/layout/demo/fixed.ts index 9bbe654ad84..4bcfca8740f 100644 --- a/components/layout/demo/fixed.ts +++ b/components/layout/demo/fixed.ts @@ -20,7 +20,7 @@ import { Component } from '@angular/core';
Content
- Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular `, styles : [ ` diff --git a/components/layout/demo/responsive.ts b/components/layout/demo/responsive.ts index 43f99be35c7..e135026e1d6 100644 --- a/components/layout/demo/responsive.ts +++ b/components/layout/demo/responsive.ts @@ -4,7 +4,7 @@ import { Component } from '@angular/core'; selector: 'nz-demo-layout-responsive', template: ` - +
    @@ -22,13 +22,16 @@ import { Component } from '@angular/core'; Content - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular + + + `, styles : [ ` - :host ::ng-deep .logo { + .logo { height: 32px; background: rgba(255,255,255,.2); margin: 16px; diff --git a/components/layout/demo/side.ts b/components/layout/demo/side.ts index a48b604d1e3..2d897725318 100644 --- a/components/layout/demo/side.ts +++ b/components/layout/demo/side.ts @@ -37,13 +37,13 @@ import { Component } from '@angular/core'; Bill is a cat. - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular `, styles : [ ` - :host ::ng-deep .logo { + .logo { height: 32px; background: rgba(255, 255, 255, .2); margin: 16px; diff --git a/components/layout/demo/top-side.ts b/components/layout/demo/top-side.ts index 44f17bba11d..1a03c2634c1 100644 --- a/components/layout/demo/top-side.ts +++ b/components/layout/demo/top-side.ts @@ -52,7 +52,7 @@ import { Component } from '@angular/core'; Content - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular `, diff --git a/components/layout/demo/top.ts b/components/layout/demo/top.ts index 04ca0589bb6..42139636188 100644 --- a/components/layout/demo/top.ts +++ b/components/layout/demo/top.ts @@ -20,7 +20,7 @@ import { Component } from '@angular/core';
    Content
    - Ant Design ©2017 Implement By Angular + Ant Design ©2019 Implement By Angular `, styles : [ diff --git a/components/layout/doc/index.en-US.md b/components/layout/doc/index.en-US.md index cbad5666b24..23dc560d73c 100755 --- a/components/layout/doc/index.en-US.md +++ b/components/layout/doc/index.en-US.md @@ -82,6 +82,7 @@ The sidebar. | `[nzCollapsed]` | the collapsed status can be double binding | `boolean` | `false` | | `[nzReverseArrow]` | reverse direction of arrow, for a sider that expands from the right | `boolean` | `false` | | `[nzTrigger]` | specify the customized trigger, set to null to hide the trigger | `string|TemplateRef` | - | +| `[nzZeroTrigger]` | specify the customized trigger when nzCollapsedWidth setting to `0` | `TemplateRef` | - | | `[nzWidth]` | width of the sidebar | `number|string` | `200` | | `[nzTheme]` | color theme of the sidebar | `'light'|'dark'` | `dark` | | `(nzCollapsedChange)` | the callback function | `EventEmitter` | - | diff --git a/components/layout/doc/index.zh-CN.md b/components/layout/doc/index.zh-CN.md index 71cc7c9e99b..47983a5b27b 100755 --- a/components/layout/doc/index.zh-CN.md +++ b/components/layout/doc/index.zh-CN.md @@ -82,7 +82,8 @@ title: Layout | `[nzCollapsible]` | 是否可收起 | `boolean` | `false` | | `[nzCollapsed]` | 当前收起状态,可双向绑定 | `boolean` | `false` | | `[nzReverseArrow]` | 翻转折叠提示箭头的方向,当 Sider 在右边时可以使用 | `boolean` | `false` | -| `[nzTrigger]` | 自定义 trigger,设置为 null 时隐藏 trigger | `string|TemplateRef` | - | +| `[nzTrigger]` | 自定义 trigger,设置为 null 时隐藏 trigger | `TemplateRef` | - | +| `[nzZeroTrigger]` | 自定义 nzCollapsedWidth 为 0 时的 特殊trigger | `TemplateRef` | - | | `[nzWidth]` | 宽度 | `number|string` | `200` | | `[nzTheme]` | 主题颜色 | `'light'|'dark'` | `dark` | | `(nzCollapsedChange)` | 展开-收起时的回调函数 | `EventEmitter` | - | diff --git a/components/layout/nz-layout.spec.ts b/components/layout/nz-layout.spec.ts index 9bcdf2597a4..cc7cbb0eb3c 100644 --- a/components/layout/nz-layout.spec.ts +++ b/components/layout/nz-layout.spec.ts @@ -207,7 +207,9 @@ describe('layout', () => { fixture.detectChanges(); discardPeriodicTasks(); fixture.detectChanges(); - expect(sider.nativeElement.style.cssText === 'flex: 0 0 80px; max-width: 80px; min-width: 80px; width: 80px;').toBe(true); + console.log(sider.nativeElement.style.cssText); + expect(sider.nativeElement.style.cssText === 'flex: 0 0 0px; max-width: 0px; min-width: 0px; width: 0px;').toBe(true); + expect(sider.nativeElement.querySelector('.ant-layout-sider-zero-width-trigger').firstElementChild.getAttribute('type')).toBe('menu-fold'); })); }); }); diff --git a/components/layout/nz-sider.component.html b/components/layout/nz-sider.component.html index e1208937d4a..8499f640cf6 100644 --- a/components/layout/nz-sider.component.html +++ b/components/layout/nz-sider.component.html @@ -1,10 +1,8 @@
    - - + +
    + + + \ No newline at end of file diff --git a/components/layout/nz-sider.component.ts b/components/layout/nz-sider.component.ts index 9015953433a..7701d5ca64a 100644 --- a/components/layout/nz-sider.component.ts +++ b/components/layout/nz-sider.component.ts @@ -6,7 +6,6 @@ import { ElementRef, EventEmitter, Host, - HostBinding, Input, NgZone, OnDestroy, @@ -37,6 +36,7 @@ export type NzBreakPoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; host : { '[class.ant-layout-sider-zero-width]': 'nzCollapsed && nzCollapsedWidth === 0', '[class.ant-layout-sider-light]' : `nzTheme === 'light'`, + '[class.ant-layout-sider-collapsed]' : 'nzCollapsed', '[style.flex]' : 'flexSetting', '[style.max-width.px]' : 'widthSetting', '[style.min-width.px]' : 'widthSetting', @@ -58,10 +58,11 @@ export class NzSiderComponent implements OnInit, AfterViewInit, OnDestroy { @Input() nzTheme: 'light' | 'dark' = 'dark'; @Input() nzCollapsedWidth = 80; @Input() nzBreakpoint: NzBreakPoint; + @Input() nzZeroTrigger: TemplateRef; + @Input() @ViewChild('defaultTrigger') nzTrigger: TemplateRef; @Input() @InputBoolean() nzReverseArrow = false; @Input() @InputBoolean() nzCollapsible = false; - @Input() @ViewChild('defaultTrigger') nzTrigger: TemplateRef; - @Input() @InputBoolean() @HostBinding('class.ant-layout-sider-collapsed') nzCollapsed = false; + @Input() @InputBoolean() nzCollapsed = false; @Output() readonly nzCollapsedChange = new EventEmitter(); get flexSetting(): string { @@ -86,7 +87,9 @@ export class NzSiderComponent implements OnInit, AfterViewInit, OnDestroy { this.below = matchBelow; this.nzCollapsed = matchBelow; this.nzCollapsedChange.emit(matchBelow); - this.cdr.markForCheck(); + this.ngZone.run(() => { + this.cdr.markForCheck(); + }); } } @@ -96,11 +99,11 @@ export class NzSiderComponent implements OnInit, AfterViewInit, OnDestroy { } get isZeroTrigger(): boolean { - return this.nzCollapsible && this.nzTrigger && (this.nzCollapsedWidth === 0) && ((this.nzBreakpoint && this.below) || (!this.nzBreakpoint)); + return this.nzCollapsible && this.nzTrigger && this.nzCollapsedWidth === 0 && ((this.nzBreakpoint && this.below) || (!this.nzBreakpoint)); } get isSiderTrigger(): boolean { - return this.nzCollapsible && this.nzTrigger && (this.nzCollapsedWidth !== 0); + return this.nzCollapsible && this.nzTrigger && this.nzCollapsedWidth !== 0; } constructor(@Optional() @Host() private nzLayoutComponent: NzLayoutComponent, private mediaMatcher: MediaMatcher, private ngZone: NgZone, private platform: Platform, private cdr: ChangeDetectorRef, renderer: Renderer2, elementRef: ElementRef) { diff --git a/components/list/demo/infinite-load.ts b/components/list/demo/infinite-load.ts index f435cf2f2a1..4c508c6247e 100644 --- a/components/list/demo/infinite-load.ts +++ b/components/list/demo/infinite-load.ts @@ -36,7 +36,7 @@ import { BehaviorSubject, Observable, Subscription } from 'rxjs'; `, styles: [ ` - :host ::ng-deep .demo-infinite-container { + .demo-infinite-container { height: 300px; border: 1px solid #e8e8e8; border-radius: 4px; diff --git a/components/list/demo/loadmore.ts b/components/list/demo/loadmore.ts index dbb19273057..2295d3529a9 100644 --- a/components/list/demo/loadmore.ts +++ b/components/list/demo/loadmore.ts @@ -40,10 +40,10 @@ const fakeDataUrl = 'https://randomuser.me/api/?results=5&inc=name,gender,email, `, styles: [ ` - :host ::ng-deep .demo-loadmore-list { + .demo-loadmore-list { min-height: 350px; } - :host ::ng-deep .loadmore { + .loadmore { text-align: center; margin-top: 12px; height: 32px; diff --git a/components/notification/demo/with-icon.ts b/components/notification/demo/with-icon.ts index fa5e89e1b75..f2cce88bf2d 100644 --- a/components/notification/demo/with-icon.ts +++ b/components/notification/demo/with-icon.ts @@ -11,7 +11,7 @@ import { NzNotificationService } from 'ng-zorro-antd'; `, styles : [ ` - :host ::ng-deep .ant-btn { + button { margin-right: 1em; } ` diff --git a/components/popconfirm/demo/placement.ts b/components/popconfirm/demo/placement.ts index 76be9134a5b..8da70d2e455 100644 --- a/components/popconfirm/demo/placement.ts +++ b/components/popconfirm/demo/placement.ts @@ -26,14 +26,6 @@ import { NzMessageService } from 'ng-zorro-antd';
    `, styles : [ ` - :host ::ng-deep .demo { - overflow: auto; - } - - :host ::ng-deep .ant-popover-wrap > a { - margin-right: 8px; - } - button { margin-right: 8px; margin-bottom: 8px; diff --git a/components/table/demo/dynamic-settings.ts b/components/table/demo/dynamic-settings.ts index 1f80011f4d2..8fdb120a253 100644 --- a/components/table/demo/dynamic-settings.ts +++ b/components/table/demo/dynamic-settings.ts @@ -118,11 +118,11 @@ import { Component, OnInit } from '@angular/core'; styles : [ ` .components-table-demo-control-bar { - margin-bottom: 10px; + margin-bottom: 12px; } - .components-table-demo-control-bar ::ng-deep .ant-form-item { - margin-right: 15px; + .nz-form-item { + margin-right: 16px; margin-bottom: 8px; } ` diff --git a/components/upload/demo/avatar.ts b/components/upload/demo/avatar.ts index 6652a5f0d50..f44ef112681 100644 --- a/components/upload/demo/avatar.ts +++ b/components/upload/demo/avatar.ts @@ -13,7 +13,7 @@ import { Observable, Observer } from 'rxjs'; [nzBeforeUpload]="beforeUpload" (nzChange)="handleChange($event)"> - +
    Upload
    @@ -21,15 +21,15 @@ import { Observable, Observer } from 'rxjs'; `, styles: [ ` - :host ::ng-deep .avatar-uploader > .ant-upload, :host ::ng-deep .avatar { + .avatar { width: 128px; height: 128px; } - :host ::ng-deep .ant-upload-select-picture-card i { + .upload-icon { font-size: 32px; color: #999; } - :host ::ng-deep .ant-upload-select-picture-card .ant-upload-text { + .ant-upload-text { margin-top: 8px; color: #666; } diff --git a/components/upload/demo/drag.ts b/components/upload/demo/drag.ts index 0064f5cac58..adcabecdae3 100644 --- a/components/upload/demo/drag.ts +++ b/components/upload/demo/drag.ts @@ -16,13 +16,7 @@ import { NzMessageService, UploadFile } from 'ng-zorro-antd';

    Click or drag file to this area to upload

    Support for a single or bulk upload. Strictly prohibit from uploading company data or other band files

    - `, - styles: [ - ` - :host ::ng-deep nz-upload { display: block; } - :host ::ng-deep .ant-upload.ant-upload-drag { height: 180px; } ` - ] }) export class NzDemoUploadDragComponent { constructor(private msg: NzMessageService) {} diff --git a/components/upload/demo/picture-card.ts b/components/upload/demo/picture-card.ts index accd26f7413..f40d105e871 100644 --- a/components/upload/demo/picture-card.ts +++ b/components/upload/demo/picture-card.ts @@ -24,11 +24,11 @@ import { NzMessageService, UploadFile } from 'ng-zorro-antd'; `, styles: [ ` - :host ::ng-deep i { + i[nz-icon] { font-size: 32px; color: #999; } - :host ::ng-deep .ant-upload-text { + .ant-upload-text { margin-top: 8px; color: #666; } diff --git a/ngsw-config.json b/ngsw-config.json index 50afcd84401..b0fc3d70dea 100644 --- a/ngsw-config.json +++ b/ngsw-config.json @@ -28,6 +28,6 @@ "!/**/*.*", "!/**/*__*", "!/**/*__*/**", - "!/**/(version|issue-helper)/**" + "!/**/(version|issue-helper|iframe)/**" ] } diff --git a/scripts/site/utils/generate-code-box.js b/scripts/site/utils/generate-code-box.js index 2de98f16afa..5fc35606415 100644 --- a/scripts/site/utils/generate-code-box.js +++ b/scripts/site/utils/generate-code-box.js @@ -14,7 +14,7 @@ module.exports = function generateCodeBox(component, demoName, key, title, doc, if (iframe.source) { output = output.replace(/{{iframeSource}}/g, iframe.source); } else { - output = output.replace(/{{iframeSource}}/g, `/iframe/#/${component}-${key}`); + output = output.replace(/{{iframeSource}}/g, `/iframe/index.html/#/${component}-${key}`); } if (iframe.height) { output = output.replace(/{{iframeHeight}}/g, iframe.height);