From eb0f18967a1b069869575807b86e0b2a4b6a125d Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Wed, 26 Feb 2020 18:39:41 +0800 Subject: [PATCH 1/2] refactor(module:typography): refactor --- .../typography/nz-text-copy.component.html | 10 ----- .../typography/nz-text-edit.component.html | 25 ----------- .../typography/nz-typography.component.html | 43 ------------------- components/typography/public-api.ts | 8 ++-- ...py.component.ts => text-copy.component.ts} | 13 +++++- ...it.component.ts => text-edit.component.ts} | 21 ++++++++- ...y.component.ts => typography.component.ts} | 28 ++++++++++-- ...ography.module.ts => typography.module.ts} | 6 +-- ...-typography.spec.ts => typography.spec.ts} | 4 +- 9 files changed, 66 insertions(+), 92 deletions(-) delete mode 100644 components/typography/nz-text-copy.component.html delete mode 100644 components/typography/nz-text-edit.component.html delete mode 100644 components/typography/nz-typography.component.html rename components/typography/{nz-text-copy.component.ts => text-copy.component.ts} (86%) rename components/typography/{nz-text-edit.component.ts => text-edit.component.ts} (80%) rename components/typography/{nz-typography.component.ts => typography.component.ts} (87%) rename components/typography/{nz-typography.module.ts => typography.module.ts} (84%) rename components/typography/{nz-typography.spec.ts => typography.spec.ts} (99%) diff --git a/components/typography/nz-text-copy.component.html b/components/typography/nz-text-copy.component.html deleted file mode 100644 index 0241b9ccb58..00000000000 --- a/components/typography/nz-text-copy.component.html +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/components/typography/nz-text-edit.component.html b/components/typography/nz-text-edit.component.html deleted file mode 100644 index efcf65bfe3c..00000000000 --- a/components/typography/nz-text-edit.component.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/components/typography/nz-typography.component.html b/components/typography/nz-typography.component.html deleted file mode 100644 index a03c2760cca..00000000000 --- a/components/typography/nz-typography.component.html +++ /dev/null @@ -1,43 +0,0 @@ - - - {{ content }} - - - - - - - - - {{ ellipsisStr }} - {{ nzSuffix }} - {{ locale?.expand }} - - - - - - - diff --git a/components/typography/public-api.ts b/components/typography/public-api.ts index 8ee00bd1b5a..0a1dd6c9a6d 100644 --- a/components/typography/public-api.ts +++ b/components/typography/public-api.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ -export { NzTypographyModule } from './nz-typography.module'; -export { NzTypographyComponent } from './nz-typography.component'; -export { NzTextCopyComponent } from './nz-text-copy.component'; -export { NzTextEditComponent } from './nz-text-edit.component'; +export { NzTypographyModule } from './typography.module'; +export { NzTypographyComponent } from './typography.component'; +export { NzTextCopyComponent } from './text-copy.component'; +export { NzTextEditComponent } from './text-edit.component'; diff --git a/components/typography/nz-text-copy.component.ts b/components/typography/text-copy.component.ts similarity index 86% rename from components/typography/nz-text-copy.component.ts rename to components/typography/text-copy.component.ts index 988c106e1eb..a146a7fc095 100644 --- a/components/typography/nz-text-copy.component.ts +++ b/components/typography/text-copy.component.ts @@ -27,7 +27,18 @@ import { takeUntil } from 'rxjs/operators'; @Component({ selector: 'nz-text-copy', exportAs: 'nzTextCopy', - templateUrl: './nz-text-copy.component.html', + template: ` + + `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false diff --git a/components/typography/nz-text-edit.component.ts b/components/typography/text-edit.component.ts similarity index 80% rename from components/typography/nz-text-edit.component.ts rename to components/typography/text-edit.component.ts index 726bb82a446..a4734ce8e15 100644 --- a/components/typography/nz-text-edit.component.ts +++ b/components/typography/text-edit.component.ts @@ -29,7 +29,26 @@ import { NzAutosizeDirective } from 'ng-zorro-antd/input'; @Component({ selector: 'nz-text-edit', exportAs: 'nzTextEdit', - templateUrl: './nz-text-edit.component.html', + template: ` + + + + + + `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false diff --git a/components/typography/nz-typography.component.ts b/components/typography/typography.component.ts similarity index 87% rename from components/typography/nz-typography.component.ts rename to components/typography/typography.component.ts index 5eff2ee50c0..31cc5457b81 100644 --- a/components/typography/nz-typography.component.ts +++ b/components/typography/typography.component.ts @@ -46,8 +46,8 @@ import { } from 'ng-zorro-antd/core'; import { NzI18nService } from 'ng-zorro-antd/i18n'; -import { NzTextCopyComponent } from './nz-text-copy.component'; -import { NzTextEditComponent } from './nz-text-edit.component'; +import { NzTextCopyComponent } from './text-copy.component'; +import { NzTextEditComponent } from './text-edit.component'; const NZ_CONFIG_COMPONENT_NAME = 'typography'; const EXPAND_ELEMENT_CLASSNAME = 'ant-typography-expand'; @@ -61,7 +61,29 @@ const EXPAND_ELEMENT_CLASSNAME = 'ant-typography-expand'; h1[nz-title], h2[nz-title], h3[nz-title], h4[nz-title] `, exportAs: 'nzTypography', - templateUrl: './nz-typography.component.html', + template: ` + + + {{ content }} + + + + + + + + + {{ ellipsisStr }} + {{ nzSuffix }} + {{ locale?.expand }} + + + + + + + + `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, diff --git a/components/typography/nz-typography.module.ts b/components/typography/typography.module.ts similarity index 84% rename from components/typography/nz-typography.module.ts rename to components/typography/typography.module.ts index 496ee4bf49c..8cbcda8ec87 100644 --- a/components/typography/nz-typography.module.ts +++ b/components/typography/typography.module.ts @@ -15,9 +15,9 @@ import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzInputModule } from 'ng-zorro-antd/input'; import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; -import { NzTextCopyComponent } from './nz-text-copy.component'; -import { NzTextEditComponent } from './nz-text-edit.component'; -import { NzTypographyComponent } from './nz-typography.component'; +import { NzTextCopyComponent } from './text-copy.component'; +import { NzTextEditComponent } from './text-edit.component'; +import { NzTypographyComponent } from './typography.component'; @NgModule({ imports: [CommonModule, NzIconModule, NzToolTipModule, NzInputModule, NzI18nModule, NzTransButtonModule, NzCopyToClipboardServiceModule], diff --git a/components/typography/nz-typography.spec.ts b/components/typography/typography.spec.ts similarity index 99% rename from components/typography/nz-typography.spec.ts rename to components/typography/typography.spec.ts index 9e83aa4fa47..39c51571bbc 100644 --- a/components/typography/nz-typography.spec.ts +++ b/components/typography/typography.spec.ts @@ -5,8 +5,8 @@ import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core import { createKeyboardEvent, dispatchFakeEvent, typeInElement } from 'ng-zorro-antd/core'; import { NzIconTestModule } from 'ng-zorro-antd/icon/testing'; -import { NzTypographyComponent } from './nz-typography.component'; -import { NzTypographyModule } from './nz-typography.module'; +import { NzTypographyComponent } from './typography.component'; +import { NzTypographyModule } from './typography.module'; // tslint:disable-next-line no-any declare const viewport: any; From 30a0cdebe3372a1086b1192efa7d0eb869f3dc7a Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Thu, 27 Feb 2020 16:08:36 +0800 Subject: [PATCH 2/2] docs: change selectors --- components/typography/demo/basic.ts | 33 ++++++++++++----------- components/typography/demo/ellipsis.ts | 6 ++--- components/typography/demo/interactive.ts | 6 ++--- components/typography/demo/suffix.ts | 2 +- components/typography/demo/text.ts | 20 +++++++------- components/typography/demo/title.ts | 8 +++--- components/typography/doc/index.en-US.md | 2 -- components/typography/doc/index.zh-CN.md | 2 -- 8 files changed, 38 insertions(+), 41 deletions(-) diff --git a/components/typography/demo/basic.ts b/components/typography/demo/basic.ts index ebdbd9af74c..7642a915d0e 100644 --- a/components/typography/demo/basic.ts +++ b/components/typography/demo/basic.ts @@ -4,27 +4,27 @@ import { Component } from '@angular/core'; selector: 'nz-demo-typography-basic', template: `
-

Introduction

-

+

Introduction

+

In the process of internal desktop applications development, many different design specs and implementations would be involved, which might cause designers and developers difficulties and duplication and reduce the efficiency of development.

-

+

After massive project practice and summaries, Ant Design, a design language for backgroundapplications, is refined by Ant UED Team, which aims to - uniform the user interface specs for internal background projects, lower the unnecessary cost of design differences and implementation and liberate the resources ofdesign and front-end development.

-

Guidelines and Resources

-

- We supply a series of design principles, practical patterns and high quality design resources (Guidelines and Resources +

+ We supply a series of design principles, practical patterns and high quality design resources (Sketch - and AxureAxure), to help people create their product prototypes beautifully and efficiently.

@@ -41,23 +41,24 @@ import { Component } from '@angular/core';
-

介绍

-

+

介绍

+

蚂蚁的企业级产品是一个庞大且复杂的体系。这类产品不仅量级巨大且功能复杂,而且变动和并发频繁,常常需要设计与开发能够快速的做出响应。 同时这类产品中有存在很多类似的页面以及组件,可以通过抽象得到一些稳定且高复用性的内容。

-

+

随着商业化的趋势,越来越多的企业级产品对更好的用户体验有了进一步的要求。带着这样的一个终极目标,我们(蚂蚁金服体验技术部) - 经过大量的项目实践和总结,逐步打磨出一个服务于企业级产品的设计体系 Ant Design。 基于『确定』和『自然』的设计价值观,通过模块化的解决方案,降低冗余的生产成本, 让设计者专注于更好的用户体验的设计价值观,通过模块化的解决方案,降低冗余的生产成本, 让设计者专注于更好的用户体验

-

+

设计资源

-

- 我们提供完善的设计原则、最佳实践和设计资源文件 (SketchAxure + 我们提供完善的设计原则、最佳实践和设计资源文件 (Sketch 和 + Axure),来帮助业务快速设计出高质 量的产品原型。

diff --git a/components/typography/demo/ellipsis.ts b/components/typography/demo/ellipsis.ts index 32b1e053679..28e7a04fcc0 100644 --- a/components/typography/demo/ellipsis.ts +++ b/components/typography/demo/ellipsis.ts @@ -3,21 +3,21 @@ import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-typography-ellipsis', template: ` -

+

Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team.


-

+

Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team. Ant Design, a design language for background applications, is refined by Ant UED Team.


-

+

` }) export class NzDemoTypographyEllipsisComponent { diff --git a/components/typography/demo/interactive.ts b/components/typography/demo/interactive.ts index b4f5a831a20..22ed2ef7f0e 100644 --- a/components/typography/demo/interactive.ts +++ b/components/typography/demo/interactive.ts @@ -3,9 +3,9 @@ import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-typography-interactive', template: ` -

-

-

Replace copy text.

+

+

+

Replace copy text.

` }) export class NzDemoTypographyInteractiveComponent { diff --git a/components/typography/demo/suffix.ts b/components/typography/demo/suffix.ts index 9d71c0869f2..473a02b438d 100644 --- a/components/typography/demo/suffix.ts +++ b/components/typography/demo/suffix.ts @@ -4,7 +4,7 @@ import { Component } from '@angular/core'; selector: 'nz-demo-typography-suffix', template: ` -

+

{{ content }}

` diff --git a/components/typography/demo/text.ts b/components/typography/demo/text.ts index 0f66085e6bf..0aa9f4aee7d 100644 --- a/components/typography/demo/text.ts +++ b/components/typography/demo/text.ts @@ -3,25 +3,25 @@ import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-typography-text', template: ` - Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design
- Ant Design + Ant Design `, styles: [] }) diff --git a/components/typography/demo/title.ts b/components/typography/demo/title.ts index 42bd75f4467..23630129f62 100644 --- a/components/typography/demo/title.ts +++ b/components/typography/demo/title.ts @@ -3,10 +3,10 @@ import { Component } from '@angular/core'; @Component({ selector: 'nz-demo-typography-title', template: ` -

h1. Ant Design

-

h2. Ant Design

-

h3. Ant Design

-

h4. Ant Design

+

h1. Ant Design

+

h2. Ant Design

+

h3. Ant Design

+

h4. Ant Design

`, styles: [] }) diff --git a/components/typography/doc/index.en-US.md b/components/typography/doc/index.en-US.md index 26eb83b63ca..188094cdcf0 100644 --- a/components/typography/doc/index.en-US.md +++ b/components/typography/doc/index.en-US.md @@ -16,8 +16,6 @@ Basic text writing, including headings, body text, lists, and more. ### [nz-typography] -> `p[nz-paragraph]`, `span[nz-text]`, `h1[nz-title]`, `h2[nz-title]`, `h3[nz-title]`, `h4[nz-title]` are used in the same way as the `[nz-typography]` - | Property | Description | Type | Default | Global Config | | -------- | ----------- | ---- | ------- | ------------- | | `[nzContent]` | Component content | `string` | - || diff --git a/components/typography/doc/index.zh-CN.md b/components/typography/doc/index.zh-CN.md index 2f091a2b15b..7c87c1e5ff5 100644 --- a/components/typography/doc/index.zh-CN.md +++ b/components/typography/doc/index.zh-CN.md @@ -16,8 +16,6 @@ cols: 1 ### [nz-typography] -> `p[nz-paragraph]`, `span[nz-text]`, `h1[nz-title]`, `h2[nz-title]`, `h3[nz-title]`, `h4[nz-title]` 的使用方法与 `[nz-typography]` 相同 - | 参数 | 说明 | 类型 | 默认值 | 全局配置 | | --- | --- | --- | --- | --- | | `[nzContent]` | 组件内容 | `string` | - |