Skip to content

Commit

Permalink
build: fix bugs block build (#1145)
Browse files Browse the repository at this point in the history
* build: fix bugs block build

* fix(module:modal): fix modal bug

* fix(module:modal): use overlay to handle modal by default

* fix(module:modal): set nzGetContainer default to undefined

* fix select in modal

* docs(changelog): complete modal's changelog
  • Loading branch information
vthinkxie authored Mar 15, 2018
1 parent c30c851 commit 30d6756
Show file tree
Hide file tree
Showing 101 changed files with 1,207 additions and 1,543 deletions.
56 changes: 46 additions & 10 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,82 @@

# NG-ZORRO
[![Travis branch](https://img.shields.io/travis/NG-ZORRO/ng-zorro-antd/0.7.0.svg?style=flat-square)](https://travis-ci.org/NG-ZORRO/ng-zorro-antd)
[![codecov](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd/branch/0.7.0/graph/badge.svg)](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd)
[![Codecov](https://img.shields.io/codecov/c/github/NG-ZORRO/ng-zorro-antd/0.7.0.svg?style=flat-square)](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd)
[![Gemnasium](https://img.shields.io/gemnasium/NG-ZORRO/ng-zorro-antd.svg?style=flat-square)](https://gemnasium.com/github.com/NG-ZORRO/ng-zorro-antd)
[![npm package](https://img.shields.io/npm/v/ng-zorro-antd.svg?style=flat-square)](https://www.npmjs.org/package/ng-zorro-antd)
[![GitHub Release Date](https://img.shields.io/github/release-date/NG-ZORRO/ng-zorro-antd.svg?style=flat-square)](https://github.com/NG-ZORRO/ng-zorro-antd/releases)
[![Issue Stats](https://img.shields.io/issuestats/i/github/NG-ZORRO/ng-zorro-antd.svg?style=flat-square)](https://github.com/NG-ZORRO/ng-zorro-antd/issues)
[![NPM downloads](http://img.shields.io/npm/dm/ng-zorro-antd.svg?style=flat-square)](https://npmjs.org/package/ng-zorro-antd)
[![Gitter](https://img.shields.io/gitter/room/ng-zorro/ng-zorro-antd.svg?style=flat-square)](https://gitter.im/ng-zorro/ng-zorro-antd)

这里是 Ant Design 的 Angular 5.0 实现,开发和服务于企业级后台产品。
这里是 Ant Design 的 Angular 实现,开发和服务于企业级后台产品。

[README in English](README.md)

## 特性

- 提炼自企业级中后台产品的交互语言和视觉风格,定期与Ant Design React版本保持更新一致
- 提炼自企业级中后台产品的交互语言和视觉风格。
- 开箱即用的高质量 Angular 组件。
- 使用 TypeScript 构建,提供完整的类型定义文件。

## 支持环境

* 现代浏览器和 IE9 以上(需要 [polyfills](https://angular.io/guide/browser-support))
* 现代浏览器和 IE9 及以上(需要 [polyfills](https://angular.io/guide/browser-support)

## 兼容版本
## 版本

当前支持Angular`^5.0.0`版本
- [![npm package](https://img.shields.io/npm/v/ng-zorro-antd.svg?style=flat-square)](https://www.npmjs.org/package/ng-zorro-antd)


## 安装

**我们推荐使用 npm 方式进行开发**,不仅可在开发环境轻松调试,也可放心地在生产环境打包部署使用,享受整个生态圈和工具链带来的诸多好处。
### 使用 npm 或 yarn 安装

**我们推荐使用 npm 或 yarn 的方式进行开发**,不仅可在开发环境轻松调试,也可放心地在生产环境打包部署使用,享受整个生态圈和工具链带来的诸多好处。

```bash
$ npm install ng-zorro-antd --save
```

```bash
$ yarn add ng-zorro-antd
```

如果你的网络环境不佳,推荐使用 [cnpm](https://github.com/cnpm/cnpm)

## 标准开发

实际项目开发中,你会需要对 TypeScript 代码的构建、调试、代理、打包部署等一系列工程化的需求。
我们推荐官方的 `@angular/cli` 工具链辅助进行开发
实际项目开发中,你会需要对 TypeScript 代码的构建、调试、代理、打包部署等一系列工程化的需求,我们强烈推荐官方的 `@angular/cli` 工具链辅助进行开发。
> 如果你想了解更多CLI工具链的功能和命令,建议访问 [Angular CLI](https://github.com/angular/angular-cli) 了解更多

## 链接

- [首页](http://ng.ant.design)
- [Angular官方文档](https://angular.io/)
- [开发脚手架](https://cli.angular.io/)
- [TypeScript](https://www.typescriptlang.org/)
- [RxJS](https://github.com/ReactiveX/rxjs)

## 谁在使用

- [阿里巴巴](http://www.alibaba.com/)
- [阿里云](http://www.aliyun.com/)

> 如果你的公司和产品使用了 NG-ZORRO,欢迎到 [这里](https://github.com/NG-ZORRO/ng-zorro-antd/issues/1142) 留言。
## 如何贡献

在任何形式的参与前,请先阅读 [贡献者文档](https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md)。如果你希望参与贡献,欢迎 [Pull Request](https://github.com/NG-ZORRO/ng-zorro-antd/pulls),或给我们 [报告 Bug](http://ng.ant.design/issue-helper/#/new-issue)

> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545)[《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
## 社区互助

如果您在使用的过程中碰到问题,可以通过下面几个途径寻求帮助,同时我们也鼓励资深用户通过下面的途径给新人提供帮助。

通过 Stack Overflow 或者 Segment Fault 提问时,建议加上 `ng-zorro` 标签。

如果你想了解更多CLI工具链的功能和命令,建议访问[Angular CLI](https://github.com/angular/angular-cli)了解更多
1. [<img alt="Stack Overflow" src="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.svg?v=2bb144720a66" width="140" />](https://stackoverflow.com/questions/tagged/ng-zorro)(English)
2. [<img alt="Segment Fault" src="http://static.segmentfault.com/global/img/logo.svg" width="100" />](https://segmentfault.com/t/ng-zorro)(中文)
3. [![Gitter](https://img.shields.io/gitter/room/ng-zorro/ng-zorro-antd.svg?style=flat-square)](https://gitter.im/ng-zorro/ng-zorro-antd)
46 changes: 27 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# NG-ZORRO
[![Travis branch](https://img.shields.io/travis/NG-ZORRO/ng-zorro-antd/0.7.0.svg?style=flat-square)](https://travis-ci.org/NG-ZORRO/ng-zorro-antd)
[![codecov](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd/branch/0.7.0/graph/badge.svg)](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd)
[![Codecov](https://img.shields.io/codecov/c/github/NG-ZORRO/ng-zorro-antd/0.7.0.svg?style=flat-square)](https://codecov.io/gh/NG-ZORRO/ng-zorro-antd)
[![Gemnasium](https://img.shields.io/gemnasium/NG-ZORRO/ng-zorro-antd.svg?style=flat-square)](https://gemnasium.com/github.com/NG-ZORRO/ng-zorro-antd)
[![npm package](https://img.shields.io/npm/v/ng-zorro-antd.svg?style=flat-square)](https://www.npmjs.org/package/ng-zorro-antd)
[![GitHub Release Date](https://img.shields.io/github/release-date/NG-ZORRO/ng-zorro-antd.svg?style=flat-square)](https://github.com/NG-ZORRO/ng-zorro-antd/releases)
Expand All @@ -23,42 +23,50 @@ An enterprise-class UI components based on Ant Design and Angular.

- An enterprise-class UI design language for web applications.
- A set of high-quality Angular components out of the box.
- Written in TypeScript with complete define types.
- Written in TypeScript with complete defined types.

## Environment Support

* Modern browsers and Internet Explorer 9+ (with [polyfills](https://angular.io/guide/browser-support)).
* Modern browsers and Internet Explorer 9+ (with [polyfills](https://angular.io/guide/browser-support))

## Angular Version Support
## Version

* Angular`^5.0.0`
- [![npm package](https://img.shields.io/npm/v/ng-zorro-antd.svg?style=flat-square)](https://www.npmjs.org/package/ng-zorro-antd)

## Installation

## Install
### Using npm or yarn

**We recommend using npm or yarn to install**,it not only makes development easier,but also allow you to take advantage of the rich ecosystem of Javascript packages and tooling.

```bash
$ npm install ng-zorro-antd --save
```

## Development

```bash
$ git clone git@github.com:NG-ZORRO/ng-zorro-antd.git
$ npm install
$ npm start
$ yarn add ng-zorro-antd
```

If you are in a bad network environment,you can try other registries and tools like [cnpm](https://github.com/cnpm/cnpm).

## Links

- [Home page](http://ng.ant.design)
- [Angular](https://angular.io)
- [Angular CLI](https://cli.angular.io/)
- [TypeScript](https://www.typescriptlang.org/)
- [RxJS](https://github.com/ReactiveX/rxjs)
## Companies using antd

- [Alibaba](http://www.alibaba.com/)
- [Aliyun](http://www.aliyun.com/)

> If your company or product uses NG-ZORRO, let us know [here](https://github.com/NG-ZORRO/ng-zorro-antd/issues/1142)!
## Contributing

We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md) first.
You can submit any ideas as [pull request](https://github.com/NG-ZORRO/ng-zorro-antd/pulls),or as [GitHub issues](https://github.com/NG-ZORRO/ng-zorro-antd/issues)
Please read our [CONTRIBUTING.md](https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md) first.

If you'd like to help us improve ng-zorro-antd, just create a [Pull Request](https://github.com/NG-ZORRO/ng-zorro-antd/pulls). Feel free to report bugs and issues [here](http://ng.ant.design/issue-helper/#/new-issue).

> If you're new to posting issues, we ask that you read [*How To Ask Questions The Smart Way*](http://www.catb.org/~esr/faqs/smart-questions.html) and [How to Ask a Question in Open Source Community](https://github.com/seajs/seajs/issues/545) and [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) prior to posting. Well written bug reports help us help you!
## Need Help?

For questions on how to use antd, please post questions to [<img alt="Stack Overflow" src="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.svg?v=2bb144720a66" width="140" />](http://stackoverflow.com/questions/tagged/ng-zorro) using the `antd` tag. If you're not finding what you need on stackoverflow, you can find us on [![Gitter](https://img.shields.io/gitter/room/ng-zorro/ng-zorro-antd.svg?style=flat-square)](https://gitter.im/ng-zorro/ng-zorro-antd) as well.

As always, we encourage experienced users to help those who are not familiar with `ng-zorro-antd`!
2 changes: 1 addition & 1 deletion build_scripts/generate-less.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ targetFolder.forEach(dir => {
)
wrench.copyDirSyncRecursive(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style'));
fs.writeFileSync(`${targetPath}/components.less`, componentsLessContent);
fs.writeFileSync(`${targetPath}/ng-zorro.less`, fs.readFileSync(`${sourcePath}/ng-zorro.less`));
fs.writeFileSync(`${targetPath}/ng-zorro-antd.less`, fs.readFileSync(`${sourcePath}/ng-zorro-antd.less`));
2 changes: 2 additions & 0 deletions build_scripts/replace-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sed 's/components\/ng-zorro-antd.module.ts/publish/g' site/src/tsconfig.app.json > site/src/tsconfig.app.json_back
mv site/src/tsconfig.app.json_back site/src/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ENTER, SPACE } from '@angular/cdk/keycodes';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand Down
37 changes: 20 additions & 17 deletions components/auto-complete/nz-autocomplete-trigger.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subscription } from 'rxjs/Subscription';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { merge } from 'rxjs/observable/merge';
import { delay, distinct, map } from 'rxjs/operators';
import { delay } from 'rxjs/operators/delay';
import { distinct } from 'rxjs/operators/distinct';
import { map } from 'rxjs/operators/map';

import { NzAutocompleteOptionComponent } from './nz-autocomplete-option.component';
import { NzAutocompleteComponent } from './nz-autocomplete.component';

export const NZ_AUTOCOMPLETE_VALUE_ACCESSOR: ExistingProvider = {
provide: NG_VALUE_ACCESSOR,
provide : NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NzAutocompleteTriggerDirective),
multi: true
multi : true
};

export function getNzAutocompleteMissingPanelError(): Error {
Expand All @@ -44,15 +46,15 @@ export function getNzAutocompleteMissingPanelError(): Error {
}

@Directive({
selector: `input[nzAutocomplete], textarea[nzAutocomplete]`,
providers: [NZ_AUTOCOMPLETE_VALUE_ACCESSOR],
host: {
'autocomplete': 'off',
selector : `input[nzAutocomplete], textarea[nzAutocomplete]`,
providers: [ NZ_AUTOCOMPLETE_VALUE_ACCESSOR ],
host : {
'autocomplete' : 'off',
'aria-autocomplete': 'list',
'(focusin)': 'handleFocus()',
'(blur)': 'handleBlur()',
'(input)': 'handleInput($event)',
'(keydown)': 'handleKeydown($event)'
'(focusin)' : 'handleFocus()',
'(blur)' : 'handleBlur()',
'(input)' : 'handleInput($event)',
'(keydown)' : 'handleKeydown($event)'
}
})
export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnDestroy {
Expand Down Expand Up @@ -86,7 +88,8 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD

constructor(private _element: ElementRef, private _overlay: Overlay,
private _viewContainerRef: ViewContainerRef,
@Optional() @Inject(DOCUMENT) private _document: Document) {
// tslint:disable-next-line:no-any
@Optional() @Inject(DOCUMENT) private _document: any) {
}

openPanel(): void {
Expand Down Expand Up @@ -177,7 +180,7 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
this.overlayRef = this._overlay.create(this.getOverlayConfig());
} else {
// 如果没有设置 nzDisplayWith 则使用 Host 元素的宽度
this.overlayRef.updateSize({width: this.nzAutocomplete.nzWidth || this.getHostWidth()});
this.overlayRef.updateSize({ width: this.nzAutocomplete.nzWidth || this.getHostWidth() });
}
this.overlayPositionChangeSubscription = this.subscribeOverlayPositionChange();
if (this.overlayRef && !this.overlayRef.hasAttached()) {
Expand All @@ -204,9 +207,9 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
private getOverlayConfig(): OverlayConfig {
return new OverlayConfig({
positionStrategy: this.getOverlayPosition(),
scrollStrategy: this._overlay.scrollStrategies.reposition(),
scrollStrategy : this._overlay.scrollStrategies.reposition(),
// 如果没有设置 nzWidth 则使用 Host 元素的宽度
width: this.nzAutocomplete.nzWidth || this.getHostWidth()
width : this.nzAutocomplete.nzWidth || this.getHostWidth()
});
}

Expand All @@ -221,9 +224,9 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
private getOverlayPosition(): PositionStrategy {
this.positionStrategy = this._overlay.position().connectedTo(
this.getConnectedElement(),
{originX: 'start', originY: 'bottom'}, {overlayX: 'start', overlayY: 'top'})
{ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' })
.withFallbackPosition(
{originX: 'start', originY: 'top'}, {overlayX: 'start', overlayY: 'bottom'}
{ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }
);
return this.positionStrategy;
}
Expand Down
57 changes: 36 additions & 21 deletions components/auto-complete/nz-autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { defer } from 'rxjs/observable/defer';
import { merge } from 'rxjs/observable/merge';
import { filter, switchMap, take } from 'rxjs/operators';
import { filter } from 'rxjs/operators/filter';
import { switchMap } from 'rxjs/operators/switchMap';
import { take } from 'rxjs/operators/take';

import { toBoolean } from '../core/util/convert';

Expand All @@ -38,29 +40,29 @@ export type AutocompleteDataSource = AutocompleteDataSourceItem[] | string[] | n
dropDownAnimation
],
template : `
<ng-template>
<div class="ant-select-dropdown ant-select-dropdown--single ant-select-dropdown-placement-bottomLeft"
#panel
[@dropDownAnimation]="dropDownPosition"
[class.ant-select-dropdown-hidden]="!showPanel">
<div style="overflow: auto;">
<ng-template>
<div class="ant-select-dropdown ant-select-dropdown--single ant-select-dropdown-placement-bottomLeft"
#panel
[@dropDownAnimation]="dropDownPosition"
[class.ant-select-dropdown-hidden]="!showPanel">
<div style="overflow: auto;">
<ul class="ant-select-dropdown-menu ant-select-dropdown-menu-root ant-select-dropdown-menu-vertical"
role="menu"
aria-activedescendant>
role="menu"
aria-activedescendant>
<ng-template *ngTemplateOutlet="nzDataSource ? optionsTemplate : contentTemplate"></ng-template>
</ul>
</div>
</div>
</div>
<ng-template #contentTemplate>
<ng-content></ng-content>
<ng-template #contentTemplate>
<ng-content></ng-content>
</ng-template>
<ng-template #optionsTemplate>
<nz-auto-option *ngFor="let option of nzDataSource" [nzValue]="option">{{option}}</nz-auto-option>
</ng-template>
</ng-template>
<ng-template #optionsTemplate>
<nz-auto-option *ngFor="let option of nzDataSource" [nzValue]="option">{{option}}</nz-auto-option>
</ng-template>
</ng-template>
`,
styles : [
`
`
:host {
position: relative;
display: inline-block;
Expand All @@ -85,6 +87,7 @@ export class NzAutocompleteComponent implements AfterViewInit {
isOpen: boolean = false;
activeItem: NzAutocompleteOptionComponent;
dropDownPosition: 'top' | 'center' | 'bottom' = 'bottom';

/** 组件支持设置 dataSource 和 content 设置 options
* 这个属性为其提供方便的访问方式 */
get options(): QueryList<NzAutocompleteOptionComponent> {
Expand Down Expand Up @@ -113,26 +116,38 @@ export class NzAutocompleteComponent implements AfterViewInit {

/** 是否默认高亮第一个选项,默认 `true` */
@Input()
get nzDefaultActiveFirstOption(): boolean { return this._defaultActiveFirstOption; }
get nzDefaultActiveFirstOption(): boolean {
return this._defaultActiveFirstOption;
}

set nzDefaultActiveFirstOption(value: boolean) {
this._defaultActiveFirstOption = toBoolean(value);
}

_defaultActiveFirstOption: boolean = true;

/** 使用键盘选择选项的时候把选中项回填到输入框中,默认 `false` */
@Input()
get nzBackfill(): boolean { return this._backfill; }
get nzBackfill(): boolean {
return this._backfill;
}

set nzBackfill(value: boolean) {
this._backfill = toBoolean(value);
}

_backfill: boolean = false;

/** 自动完成的数据源 */
@Input()
get nzDataSource(): AutocompleteDataSource { return this._dataSource; }
get nzDataSource(): AutocompleteDataSource {
return this._dataSource;
}

set nzDataSource(value: AutocompleteDataSource) {
this._dataSource = value;
}

_dataSource: AutocompleteDataSource;

/** 选择时发出的事件 */
Expand Down Expand Up @@ -161,7 +176,7 @@ export class NzAutocompleteComponent implements AfterViewInit {
}

setActiveItem(index: number): void {
const activeItem = this.options.toArray()[index];
const activeItem = this.options.toArray()[ index ];
if (activeItem && !activeItem.active) {
this.activeItem = activeItem;
this.activeItemIndex = index;
Expand Down
Loading

0 comments on commit 30d6756

Please sign in to comment.