diff --git a/components/affix/affix.spec.ts b/components/affix/affix.spec.ts index 5492c4fecea..a9b36174f07 100644 --- a/components/affix/affix.spec.ts +++ b/components/affix/affix.spec.ts @@ -2,7 +2,7 @@ import { Component, DebugElement, ViewChild } from '@angular/core'; import { discardPeriodicTasks, fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NzScrollService } from '../core/scroll/nz-scroll.service'; +import { NzScrollService } from 'ng-zorro-antd/core'; import { NzAffixComponent } from './nz-affix.component'; import { NzAffixModule } from './nz-affix.module'; diff --git a/components/affix/doc/index.en-US.md b/components/affix/doc/index.en-US.md index 50389e39912..068a1445856 100755 --- a/components/affix/doc/index.en-US.md +++ b/components/affix/doc/index.en-US.md @@ -14,6 +14,14 @@ Please note that Affix should not cover other content on the page, especially wh ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzAffixModule } from 'ng-zorro-antd'; +``` + ### nz-affix | Property | Description | Type | Default | diff --git a/components/affix/doc/index.zh-CN.md b/components/affix/doc/index.zh-CN.md index 748f0b7244d..ee09136253f 100755 --- a/components/affix/doc/index.zh-CN.md +++ b/components/affix/doc/index.zh-CN.md @@ -15,6 +15,14 @@ title: Affix ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzAffixModule } from 'ng-zorro-antd'; +``` + ### nz-affix | 成员 | 说明 | 类型 | 默认值 | diff --git a/components/affix/nz-affix.component.ts b/components/affix/nz-affix.component.ts index d5fc1d26375..c10f565d5a9 100644 --- a/components/affix/nz-affix.component.ts +++ b/components/affix/nz-affix.component.ts @@ -12,12 +12,13 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; - -import { NzScrollService } from '../core/scroll/nz-scroll.service'; -import { NGStyleInterface } from '../core/types/ng-class'; -import { shallowEqual } from '../core/util/check'; -import { toNumber } from '../core/util/convert'; -import { throttleByAnimationFrameDecorator } from '../core/util/throttleByAnimationFrame'; +import { + shallowEqual, + throttleByAnimationFrameDecorator, + toNumber, + NzScrollService, + NGStyleInterface +} from 'ng-zorro-antd/core'; @Component({ selector: 'nz-affix', diff --git a/components/affix/nz-affix.module.ts b/components/affix/nz-affix.module.ts index feeb36d565f..1611543f3f9 100644 --- a/components/affix/nz-affix.module.ts +++ b/components/affix/nz-affix.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { SCROLL_SERVICE_PROVIDER } from '../core/scroll/nz-scroll.service'; +import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core'; import { NzAffixComponent } from './nz-affix.component'; diff --git a/components/affix/package.json b/components/affix/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/affix/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/affix/style/entry.less b/components/affix/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/affix/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/alert/doc/index.en-US.md b/components/alert/doc/index.en-US.md index 3de30fc904b..50fbdfc8616 100644 --- a/components/alert/doc/index.en-US.md +++ b/components/alert/doc/index.en-US.md @@ -13,6 +13,14 @@ Alert component for feedback. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzAlertModule } from 'ng-zorro-antd'; +``` + ### nz-alert | Property | Description | Type | Default | diff --git a/components/alert/doc/index.zh-CN.md b/components/alert/doc/index.zh-CN.md index 145390fff41..6d705535251 100644 --- a/components/alert/doc/index.zh-CN.md +++ b/components/alert/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Alert ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzAlertModule } from 'ng-zorro-antd'; +``` + ### nz-alert | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/alert/nz-alert.component.ts b/components/alert/nz-alert.component.ts index 125f3a9197c..1ff45821f6a 100644 --- a/components/alert/nz-alert.component.ts +++ b/components/alert/nz-alert.component.ts @@ -9,9 +9,7 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { slideAlertMotion } from '../core/animation/slide'; -import { NgClassType } from '../core/types/ng-class'; -import { InputBoolean } from '../core/util/convert'; +import { slideAlertMotion, InputBoolean, NgClassType } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-alert', diff --git a/components/alert/nz-alert.module.ts b/components/alert/nz-alert.module.ts index 8643895fdf8..16a59d6ef0f 100644 --- a/components/alert/nz-alert.module.ts +++ b/components/alert/nz-alert.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzAlertComponent } from './nz-alert.component'; diff --git a/components/alert/package.json b/components/alert/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/alert/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/alert/style/entry.less b/components/alert/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/alert/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/anchor/anchor.spec.ts b/components/anchor/anchor.spec.ts index 5981a9e00aa..fef0d6ca446 100644 --- a/components/anchor/anchor.spec.ts +++ b/components/anchor/anchor.spec.ts @@ -4,7 +4,7 @@ import { Component, DebugElement, ViewChild } from '@angular/core'; import { By } from '@angular/platform-browser'; import { NzAnchorModule } from './nz-anchor.module'; import { NzAnchorComponent } from './nz-anchor.component'; -import { NzScrollService } from '../core/scroll/nz-scroll.service'; +import { NzScrollService } from 'ng-zorro-antd/core'; const throttleTime = 51; diff --git a/components/anchor/doc/index.en-US.md b/components/anchor/doc/index.en-US.md index f5d20181faf..82fffb6d62e 100755 --- a/components/anchor/doc/index.en-US.md +++ b/components/anchor/doc/index.en-US.md @@ -12,6 +12,14 @@ For displaying anchor hyperlinks on page and jumping between them. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzAnchorModule } from 'ng-zorro-antd'; +``` + ### nz-anchor | Property | Description | Type | Default | diff --git a/components/anchor/doc/index.zh-CN.md b/components/anchor/doc/index.zh-CN.md index 300ce0bba48..b74492ffa35 100755 --- a/components/anchor/doc/index.zh-CN.md +++ b/components/anchor/doc/index.zh-CN.md @@ -13,6 +13,14 @@ title: Anchor ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzAnchorModule } from 'ng-zorro-antd'; +``` + ### nz-anchor | 成员 | 说明 | 类型 | 默认值 | diff --git a/components/anchor/nz-anchor.component.ts b/components/anchor/nz-anchor.component.ts index 83858ec802d..eeb1c142cd2 100644 --- a/components/anchor/nz-anchor.component.ts +++ b/components/anchor/nz-anchor.component.ts @@ -15,9 +15,8 @@ import { } from '@angular/core'; import { fromEvent, Subscription } from 'rxjs'; import { distinctUntilChanged, throttleTime } from 'rxjs/operators'; -import { NzScrollService } from '../core/scroll/nz-scroll.service'; -import { NGStyleInterface } from '../core/types/ng-class'; -import { toNumber, InputBoolean, InputNumber } from '../core/util/convert'; + +import { toNumber, InputBoolean, InputNumber, NzScrollService, NGStyleInterface } from 'ng-zorro-antd/core'; import { NzAnchorLinkComponent } from './nz-anchor-link.component'; diff --git a/components/anchor/nz-anchor.module.ts b/components/anchor/nz-anchor.module.ts index 8fdc029047e..00a66350ef6 100644 --- a/components/anchor/nz-anchor.module.ts +++ b/components/anchor/nz-anchor.module.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAffixModule } from '../affix/nz-affix.module'; -import { SCROLL_SERVICE_PROVIDER } from '../core/scroll/nz-scroll.service'; +import { NzAffixModule } from 'ng-zorro-antd/affix'; +import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core'; import { NzAnchorLinkComponent } from './nz-anchor-link.component'; import { NzAnchorComponent } from './nz-anchor.component'; diff --git a/components/anchor/package.json b/components/anchor/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/anchor/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/anchor/style/entry.less b/components/anchor/style/entry.less new file mode 100644 index 00000000000..42b7ca01612 --- /dev/null +++ b/components/anchor/style/entry.less @@ -0,0 +1,2 @@ +@import './index.less'; +@import '../../affix/style/index.less'; diff --git a/components/auto-complete/doc/index.en-US.md b/components/auto-complete/doc/index.en-US.md index b8b7bcc1bb6..4b6481fe84d 100644 --- a/components/auto-complete/doc/index.en-US.md +++ b/components/auto-complete/doc/index.en-US.md @@ -26,6 +26,14 @@ When there is a need for autocomplete functionality. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzAutocompleteModule } from 'ng-zorro-antd'; +``` + ### [nzAutocomplete] | Property | Description | Type | Default | diff --git a/components/auto-complete/doc/index.zh-CN.md b/components/auto-complete/doc/index.zh-CN.md index 192e6d6ed1c..4ff383ad0b2 100644 --- a/components/auto-complete/doc/index.zh-CN.md +++ b/components/auto-complete/doc/index.zh-CN.md @@ -27,6 +27,14 @@ subtitle: 自动完成 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzAutocompleteModule } from 'ng-zorro-antd'; +``` + ### [nzAutocomplete] | 属性 | 说明 | 类型 | 默认值 | diff --git a/components/auto-complete/nz-autocomplete-option.component.ts b/components/auto-complete/nz-autocomplete-option.component.ts index f6dfcb14dc8..fc3f62745fb 100644 --- a/components/auto-complete/nz-autocomplete-option.component.ts +++ b/components/auto-complete/nz-autocomplete-option.component.ts @@ -9,8 +9,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; -import { scrollIntoView } from '../core/util/scroll-into-view-if-needed'; +import { scrollIntoView, InputBoolean } from 'ng-zorro-antd/core'; export class NzOptionSelectionChange { constructor(public source: NzAutocompleteOptionComponent, public isUserInput: boolean = false) {} diff --git a/components/auto-complete/nz-autocomplete.component.ts b/components/auto-complete/nz-autocomplete.component.ts index d059f92c66a..77fcbd9763b 100644 --- a/components/auto-complete/nz-autocomplete.component.ts +++ b/components/auto-complete/nz-autocomplete.component.ts @@ -21,10 +21,8 @@ import { import { defer, merge, Observable, Subscription } from 'rxjs'; import { filter, switchMap, take } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzDropDownPosition } from '../core/types/drop-down-position'; -import { InputBoolean } from '../core/util/convert'; +import { slideMotion, InputBoolean, NzDropDownPosition, NzNoAnimationDirective } from 'ng-zorro-antd/core'; + import { NzAutocompleteOptionComponent, NzOptionSelectionChange } from './nz-autocomplete-option.component'; export interface AutocompleteDataSourceItem { diff --git a/components/auto-complete/nz-autocomplete.module.ts b/components/auto-complete/nz-autocomplete.module.ts index 4657c7105c1..71c7e4d7ce4 100644 --- a/components/auto-complete/nz-autocomplete.module.ts +++ b/components/auto-complete/nz-autocomplete.module.ts @@ -3,8 +3,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; +import { NzAddOnModule, NzNoAnimationModule } from 'ng-zorro-antd/core'; import { NzAutocompleteOptgroupComponent } from './nz-autocomplete-optgroup.component'; import { NzAutocompleteOptionComponent } from './nz-autocomplete-option.component'; diff --git a/components/auto-complete/nz-autocomplete.spec.ts b/components/auto-complete/nz-autocomplete.spec.ts index 181b1148584..288999dc113 100644 --- a/components/auto-complete/nz-autocomplete.spec.ts +++ b/components/auto-complete/nz-autocomplete.spec.ts @@ -15,7 +15,7 @@ import { dispatchKeyboardEvent, typeInElement, MockNgZone -} from '../core/testing'; +} from 'ng-zorro-antd/core'; import { NzAutocompleteComponent, diff --git a/components/auto-complete/package.json b/components/auto-complete/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/auto-complete/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/auto-complete/style/entry.less b/components/auto-complete/style/entry.less new file mode 100644 index 00000000000..b4722f2bff3 --- /dev/null +++ b/components/auto-complete/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../select/style/index.less'; +@import '../../input/style/index.less'; diff --git a/components/avatar/doc/index.en-US.md b/components/avatar/doc/index.en-US.md index 0c6b953dcc0..ef64ad3440a 100644 --- a/components/avatar/doc/index.en-US.md +++ b/components/avatar/doc/index.en-US.md @@ -8,6 +8,14 @@ Avatars can be used to represent people or objects. It supports images, `Icon`s, ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzAvatarModule } from 'ng-zorro-antd'; +``` + ### nz-avatar | Property | Description | Type | Default | diff --git a/components/avatar/doc/index.zh-CN.md b/components/avatar/doc/index.zh-CN.md index 54ed40b9a11..68dd72d8472 100644 --- a/components/avatar/doc/index.zh-CN.md +++ b/components/avatar/doc/index.zh-CN.md @@ -9,6 +9,14 @@ title: Avatar ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzAvatarModule } from 'ng-zorro-antd'; +``` + ### nz-avatar | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/avatar/nz-avatar.component.ts b/components/avatar/nz-avatar.component.ts index 422df1c51b5..2cb895779d2 100644 --- a/components/avatar/nz-avatar.component.ts +++ b/components/avatar/nz-avatar.component.ts @@ -11,8 +11,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzSizeLDSType, NzSizeMap } from '../core/types/size'; +import { NzSizeLDSType, NzSizeMap, NzUpdateHostClassService } from 'ng-zorro-antd/core'; export type NzAvatarShape = 'square' | 'circle'; export type NzAvatarSize = NzSizeLDSType | number; diff --git a/components/avatar/nz-avatar.module.ts b/components/avatar/nz-avatar.module.ts index e65eff83609..4c60738bb90 100644 --- a/components/avatar/nz-avatar.module.ts +++ b/components/avatar/nz-avatar.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzAvatarComponent } from './nz-avatar.component'; diff --git a/components/avatar/package.json b/components/avatar/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/avatar/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/avatar/style/entry.less b/components/avatar/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/avatar/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/back-top/back-top.spec.ts b/components/back-top/back-top.spec.ts index 6a30a456fcc..f662a10e068 100644 --- a/components/back-top/back-top.spec.ts +++ b/components/back-top/back-top.spec.ts @@ -3,7 +3,7 @@ import { fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testin import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { NzScrollService } from '../core/scroll/nz-scroll.service'; +import { NzScrollService } from 'ng-zorro-antd/core'; import { NzBackTopComponent } from './nz-back-top.component'; import { NzBackTopModule } from './nz-back-top.module'; diff --git a/components/back-top/doc/index.en-US.md b/components/back-top/doc/index.en-US.md index f990c584fba..ff6ba61f336 100644 --- a/components/back-top/doc/index.en-US.md +++ b/components/back-top/doc/index.en-US.md @@ -13,6 +13,14 @@ title: BackTop ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzBackTopModule } from 'ng-zorro-antd'; +``` + ### nz-back-top > The distance to the bottom is set to `50px` by default, which is overridable. diff --git a/components/back-top/doc/index.zh-CN.md b/components/back-top/doc/index.zh-CN.md index ab2a0fc8796..530918f1a55 100644 --- a/components/back-top/doc/index.zh-CN.md +++ b/components/back-top/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: BackTop ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzBackTopModule } from 'ng-zorro-antd'; +``` + ### nz-back-top > 有默认样式,距离底部 `50px`,可覆盖。 diff --git a/components/back-top/nz-back-top.component.ts b/components/back-top/nz-back-top.component.ts index cb9506816f4..33101e18f5e 100644 --- a/components/back-top/nz-back-top.component.ts +++ b/components/back-top/nz-back-top.component.ts @@ -13,12 +13,9 @@ import { ViewEncapsulation } from '@angular/core'; +import { fadeMotion, toNumber, NzScrollService } from 'ng-zorro-antd/core'; import { fromEvent, Subscription } from 'rxjs'; import { distinctUntilChanged, throttleTime } from 'rxjs/operators'; -import { fadeMotion } from '../core/animation/fade'; - -import { NzScrollService } from '../core/scroll/nz-scroll.service'; -import { toNumber } from '../core/util/convert'; @Component({ selector: 'nz-back-top', diff --git a/components/back-top/nz-back-top.module.ts b/components/back-top/nz-back-top.module.ts index fab86d2e555..b25b52e607d 100644 --- a/components/back-top/nz-back-top.module.ts +++ b/components/back-top/nz-back-top.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { SCROLL_SERVICE_PROVIDER } from '../core/scroll/nz-scroll.service'; +import { SCROLL_SERVICE_PROVIDER } from 'ng-zorro-antd/core'; import { NzBackTopComponent } from './nz-back-top.component'; diff --git a/components/back-top/package.json b/components/back-top/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/back-top/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/back-top/style/entry.less b/components/back-top/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/back-top/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/badge/doc/index.en-US.md b/components/badge/doc/index.en-US.md index 19197431dad..6048a6e16c8 100644 --- a/components/badge/doc/index.en-US.md +++ b/components/badge/doc/index.en-US.md @@ -22,6 +22,14 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzBadgeModule } from 'ng-zorro-antd'; +``` + ### nz-badge | Property | Description | Type | Default | diff --git a/components/badge/doc/index.zh-CN.md b/components/badge/doc/index.zh-CN.md index d235e747e15..54a25cb77f6 100644 --- a/components/badge/doc/index.zh-CN.md +++ b/components/badge/doc/index.zh-CN.md @@ -23,6 +23,14 @@ title: Badge ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzBadgeModule } from 'ng-zorro-antd'; +``` + ### nz-badge | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/badge/nz-badge.component.ts b/components/badge/nz-badge.component.ts index b9b4aa6170f..0940fb26d75 100644 --- a/components/badge/nz-badge.component.ts +++ b/components/badge/nz-badge.component.ts @@ -12,9 +12,7 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; -import { zoomBadgeMotion } from '../core/animation/zoom'; -import { isEmpty } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; +import { isEmpty, zoomBadgeMotion, InputBoolean } from 'ng-zorro-antd/core'; export type NzBadgeStatusType = 'success' | 'processing' | 'default' | 'error' | 'warning'; diff --git a/components/badge/nz-badge.module.ts b/components/badge/nz-badge.module.ts index 09a4d014603..196ceab635d 100644 --- a/components/badge/nz-badge.module.ts +++ b/components/badge/nz-badge.module.ts @@ -1,7 +1,8 @@ import { ObserversModule } from '@angular/cdk/observers'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; + +import { NzAddOnModule } from 'ng-zorro-antd/core'; import { NzBadgeComponent } from './nz-badge.component'; diff --git a/components/badge/nz-badge.spec.ts b/components/badge/nz-badge.spec.ts index e60903bac77..c7a256993a4 100644 --- a/components/badge/nz-badge.spec.ts +++ b/components/badge/nz-badge.spec.ts @@ -3,7 +3,7 @@ import { fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testin import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { NGStyleInterface } from '../core/types/ng-class'; +import { NGStyleInterface } from 'ng-zorro-antd/core'; import { NzBadgeComponent } from './nz-badge.component'; import { NzBadgeModule } from './nz-badge.module'; diff --git a/components/badge/package.json b/components/badge/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/badge/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/badge/style/entry.less b/components/badge/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/badge/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/breadcrumb/doc/index.en-US.md b/components/breadcrumb/doc/index.en-US.md index 66736b76798..6239b1b4bf4 100755 --- a/components/breadcrumb/doc/index.en-US.md +++ b/components/breadcrumb/doc/index.en-US.md @@ -15,6 +15,14 @@ A breadcrumb displays the current location within a hierarchy. It allows going b ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzBreadCrumbModule } from 'ng-zorro-antd'; +``` + ### nz-breadcrumb | Property | Description | Type | Default | diff --git a/components/breadcrumb/doc/index.zh-CN.md b/components/breadcrumb/doc/index.zh-CN.md index 81b6b374a4e..b40abb46ff1 100755 --- a/components/breadcrumb/doc/index.zh-CN.md +++ b/components/breadcrumb/doc/index.zh-CN.md @@ -15,6 +15,14 @@ title: Breadcrumb ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzBreadCrumbModule } from 'ng-zorro-antd'; +``` + ### nz-breadcrumb | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/breadcrumb/nz-breadcrumb.component.ts b/components/breadcrumb/nz-breadcrumb.component.ts index de69b985b93..f042ef6546d 100755 --- a/components/breadcrumb/nz-breadcrumb.component.ts +++ b/components/breadcrumb/nz-breadcrumb.component.ts @@ -16,7 +16,7 @@ import { ActivatedRoute, Params, PRIMARY_OUTLET, Router } from '@angular/router' import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { InputBoolean } from '../core/util'; +import { InputBoolean } from 'ng-zorro-antd/core'; export const NZ_ROUTE_DATA_BREADCRUMB = 'breadcrumb'; diff --git a/components/breadcrumb/nz-breadcrumb.module.ts b/components/breadcrumb/nz-breadcrumb.module.ts index f0847c5d716..b675de66c4b 100644 --- a/components/breadcrumb/nz-breadcrumb.module.ts +++ b/components/breadcrumb/nz-breadcrumb.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; import { NzBreadCrumbItemComponent } from './nz-breadcrumb-item.component'; import { NzBreadCrumbComponent } from './nz-breadcrumb.component'; diff --git a/components/breadcrumb/nz-breadcrumb.spec.ts b/components/breadcrumb/nz-breadcrumb.spec.ts index 6f26b28d106..bed4bb779e0 100644 --- a/components/breadcrumb/nz-breadcrumb.spec.ts +++ b/components/breadcrumb/nz-breadcrumb.spec.ts @@ -5,7 +5,7 @@ import { By } from '@angular/platform-browser'; import { Router, Routes } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzDemoBreadcrumbBasicComponent } from './demo/basic'; diff --git a/components/breadcrumb/package.json b/components/breadcrumb/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/breadcrumb/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/breadcrumb/style/entry.less b/components/breadcrumb/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/breadcrumb/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/button/doc/index.en-US.md b/components/button/doc/index.en-US.md index 4f210edce63..ab84ad5ca39 100644 --- a/components/button/doc/index.en-US.md +++ b/components/button/doc/index.en-US.md @@ -12,6 +12,14 @@ A button means an operation (or a series of operations). Clicking a button will ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzButtonModule } from 'ng-zorro-antd'; +``` + ### [nz-button] To get a customized button, just set `nzType`/`nzShape`/`nzSize`/`nzLoading`/`disabled`. diff --git a/components/button/doc/index.zh-CN.md b/components/button/doc/index.zh-CN.md index 49c92bf46b0..c9f5334a568 100644 --- a/components/button/doc/index.zh-CN.md +++ b/components/button/doc/index.zh-CN.md @@ -13,6 +13,14 @@ subtitle: 按钮 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzButtonModule } from 'ng-zorro-antd'; +``` + ### [nz-button] 通过设置 Button 的属性来产生不同的按钮样式,推荐顺序为:`nzType` -> `nzShape` -> `nzSize` -> `nzLoading` -> `disabled` diff --git a/components/button/nz-button-group.component.ts b/components/button/nz-button-group.component.ts index 0b70447846c..52f3bd97163 100644 --- a/components/button/nz-button-group.component.ts +++ b/components/button/nz-button-group.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzSizeLDSType } from '../core/types/size'; + +import { NzSizeLDSType, NzUpdateHostClassService } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-button-group', diff --git a/components/button/nz-button.component.ts b/components/button/nz-button.component.ts index fceded4162b..c0c786e3ee6 100644 --- a/components/button/nz-button.component.ts +++ b/components/button/nz-button.component.ts @@ -21,13 +21,19 @@ import { } from '@angular/core'; import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzSizeLDSType, NzSizeMap } from '../core/types/size'; -import { isEmpty } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; -import { findFirstNotEmptyNode, findLastNotEmptyNode } from '../core/util/dom'; -import { NzWaveConfig, NzWaveDirective, NZ_WAVE_GLOBAL_CONFIG } from '../core/wave/nz-wave.directive'; -import { NzIconDirective } from '../icon/nz-icon.directive'; +import { + findFirstNotEmptyNode, + findLastNotEmptyNode, + isEmpty, + InputBoolean, + NzSizeLDSType, + NzSizeMap, + NzUpdateHostClassService, + NzWaveConfig, + NzWaveDirective, + NZ_WAVE_GLOBAL_CONFIG +} from 'ng-zorro-antd/core'; +import { NzIconDirective } from 'ng-zorro-antd/icon'; export type NzButtonType = 'primary' | 'dashed' | 'danger' | 'default'; export type NzButtonShape = 'circle' | 'round' | null; diff --git a/components/button/nz-button.module.ts b/components/button/nz-button.module.ts index fb1c664831b..93d47ca182d 100644 --- a/components/button/nz-button.module.ts +++ b/components/button/nz-button.module.ts @@ -1,8 +1,9 @@ import { ObserversModule } from '@angular/cdk/observers'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzWaveModule } from '../core/wave/nz-wave.module'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzWaveModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzButtonGroupComponent } from './nz-button-group.component'; import { NzButtonComponent } from './nz-button.component'; diff --git a/components/button/package.json b/components/button/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/button/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/button/style/entry.less b/components/button/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/button/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/calendar/doc/index.en-US.md b/components/calendar/doc/index.en-US.md index 3060abcacaa..4d4c442792b 100644 --- a/components/calendar/doc/index.en-US.md +++ b/components/calendar/doc/index.en-US.md @@ -36,6 +36,14 @@ registerLocaleData(en); {{ date | date:'d'}} ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCalendarModule } from 'ng-zorro-antd'; +``` + ### nz-calendar | Property | Description | Type | Default | diff --git a/components/calendar/doc/index.zh-CN.md b/components/calendar/doc/index.zh-CN.md index eba2c2916de..0b9ff674f6a 100644 --- a/components/calendar/doc/index.zh-CN.md +++ b/components/calendar/doc/index.zh-CN.md @@ -37,6 +37,14 @@ registerLocaleData(zh); {{ date | date:'d'}} ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCalendarModule } from 'ng-zorro-antd'; +``` + ### nz-calendar | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/calendar/nz-calendar-header.component.ts b/components/calendar/nz-calendar-header.component.ts index 7ef608e6c84..f46f7bf5ac4 100644 --- a/components/calendar/nz-calendar-header.component.ts +++ b/components/calendar/nz-calendar-header.component.ts @@ -8,8 +8,7 @@ import { ViewEncapsulation } from '@angular/core'; import setMonth from 'date-fns/set_month'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { NzI18nService as I18n } from '../i18n/nz-i18n.service'; +import { DateHelperService, NzI18nService as I18n } from 'ng-zorro-antd/i18n'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/calendar/nz-calendar.component.ts b/components/calendar/nz-calendar.component.ts index 1e280d66549..59ab37c7b80 100644 --- a/components/calendar/nz-calendar.component.ts +++ b/components/calendar/nz-calendar.component.ts @@ -29,8 +29,9 @@ import setYear from 'date-fns/set_year'; import startOfMonth from 'date-fns/start_of_month'; import startOfWeek from 'date-fns/start_of_week'; import startOfYear from 'date-fns/start_of_year'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; + import { NzDateCellDirective as DateCell, NzDateFullCellDirective as DateFullCell, diff --git a/components/calendar/nz-calendar.module.ts b/components/calendar/nz-calendar.module.ts index 08182017cd0..a03fb59c727 100644 --- a/components/calendar/nz-calendar.module.ts +++ b/components/calendar/nz-calendar.module.ts @@ -1,9 +1,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzRadioModule } from '../radio/nz-radio.module'; -import { NzSelectModule } from '../select/nz-select.module'; + +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzRadioModule } from 'ng-zorro-antd/radio'; +import { NzSelectModule } from 'ng-zorro-antd/select'; + import { NzDateCellDirective, NzDateFullCellDirective, diff --git a/components/calendar/package.json b/components/calendar/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/calendar/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/calendar/public-api.ts b/components/calendar/public-api.ts index b440d5f9449..b0587fc7082 100644 --- a/components/calendar/public-api.ts +++ b/components/calendar/public-api.ts @@ -1,2 +1,4 @@ -export * from './nz-calendar.component'; export * from './nz-calendar.module'; +export * from './nz-calendar.component'; +export * from './nz-calendar-cells'; +export * from './nz-calendar-header.component'; diff --git a/components/calendar/style/entry.less b/components/calendar/style/entry.less new file mode 100644 index 00000000000..18d749c7146 --- /dev/null +++ b/components/calendar/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../select/style/index.less'; +@import '../../radio/style/index.less'; diff --git a/components/card/doc/index.en-US.md b/components/card/doc/index.en-US.md index 866571f6461..9f528362d5a 100644 --- a/components/card/doc/index.en-US.md +++ b/components/card/doc/index.en-US.md @@ -17,6 +17,14 @@ A card can be used to display content related to a single subject. The content c 卡片内容 ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCardModule } from 'ng-zorro-antd'; +``` + ### nz-card | Property | Description | Type | Default | diff --git a/components/card/doc/index.zh-CN.md b/components/card/doc/index.zh-CN.md index cef3edbe979..1d99a6d28c6 100644 --- a/components/card/doc/index.zh-CN.md +++ b/components/card/doc/index.zh-CN.md @@ -18,6 +18,16 @@ cols: 1 卡片内容 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +```ts +import { NzCardModule } from 'ng-zorro-antd'; +``` +``` + ### nz-card | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/card/nz-card.component.ts b/components/card/nz-card.component.ts index 3715e66db4f..690cd40ad38 100755 --- a/components/card/nz-card.component.ts +++ b/components/card/nz-card.component.ts @@ -8,7 +8,7 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { NzCardTabComponent } from './nz-card-tab.component'; @Component({ diff --git a/components/card/nz-card.module.ts b/components/card/nz-card.module.ts index b2ad7ef7529..d20e6b48e50 100644 --- a/components/card/nz-card.module.ts +++ b/components/card/nz-card.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; import { NzCardGridDirective } from './nz-card-grid.directive'; import { NzCardLoadingComponent } from './nz-card-loading.component'; diff --git a/components/card/package.json b/components/card/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/card/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/card/style/entry.less b/components/card/style/entry.less new file mode 100644 index 00000000000..8929c6bd8f0 --- /dev/null +++ b/components/card/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../tabs/style/index.less'; +@import '../../grid/style/index.less'; \ No newline at end of file diff --git a/components/carousel/doc/index.en-US.md b/components/carousel/doc/index.en-US.md index e656c3f7395..4e094b216f0 100644 --- a/components/carousel/doc/index.en-US.md +++ b/components/carousel/doc/index.en-US.md @@ -14,6 +14,14 @@ A carousel component. Scales with its container. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCarouselModule } from 'ng-zorro-antd'; +``` + ### nz-carousel | Property | Description | Type | Default | diff --git a/components/carousel/doc/index.zh-CN.md b/components/carousel/doc/index.zh-CN.md index 6cde2a1c3c7..05fa7c03eda 100644 --- a/components/carousel/doc/index.zh-CN.md +++ b/components/carousel/doc/index.zh-CN.md @@ -15,6 +15,14 @@ subtitle: 走马灯 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCarouselModule } from 'ng-zorro-antd'; +``` + ### nz-carousel | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/carousel/nz-carousel.component.ts b/components/carousel/nz-carousel.component.ts index 885c8c420dc..26538dc0abf 100755 --- a/components/carousel/nz-carousel.component.ts +++ b/components/carousel/nz-carousel.component.ts @@ -24,10 +24,9 @@ import { ViewEncapsulation } from '@angular/core'; import { fromEvent, Subject } from 'rxjs'; -import { take, takeUntil, throttleTime } from 'rxjs/operators'; -import { InputBoolean, InputNumber } from '../core/util/convert'; -import { isTouchEvent } from '../core/util/dom'; +import { isTouchEvent, InputBoolean, InputNumber } from 'ng-zorro-antd/core'; +import { take, takeUntil, throttleTime } from 'rxjs/operators'; import { NzCarouselContentDirective } from './nz-carousel-content.directive'; import { FromToInterface, NzCarouselEffects, PointerVector } from './nz-carousel-definitions'; diff --git a/components/carousel/nz-carousel.spec.ts b/components/carousel/nz-carousel.spec.ts index 5d8ba4c67c6..88503f63b64 100644 --- a/components/carousel/nz-carousel.spec.ts +++ b/components/carousel/nz-carousel.spec.ts @@ -3,7 +3,7 @@ import { Component, DebugElement, ViewChild } from '@angular/core'; import { fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { dispatchKeyboardEvent } from '../core/testing'; +import { dispatchKeyboardEvent } from 'ng-zorro-antd/core'; import { NzCarouselContentDirective } from './nz-carousel-content.directive'; import { NzCarouselComponent } from './nz-carousel.component'; diff --git a/components/carousel/package.json b/components/carousel/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/carousel/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/carousel/style/entry.less b/components/carousel/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/carousel/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/cascader/doc/index.en-US.md b/components/cascader/doc/index.en-US.md index 6381cf57a04..f8a6a67ee19 100755 --- a/components/cascader/doc/index.en-US.md +++ b/components/cascader/doc/index.en-US.md @@ -18,6 +18,14 @@ Cascade selection box. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCascaderModule } from 'ng-zorro-antd'; +``` + ### nz-cascader | Property | Description | Type | Default | diff --git a/components/cascader/doc/index.zh-CN.md b/components/cascader/doc/index.zh-CN.md index 8a6d75d68ee..a8b2932dddc 100755 --- a/components/cascader/doc/index.zh-CN.md +++ b/components/cascader/doc/index.zh-CN.md @@ -19,6 +19,14 @@ subtitle: 级联选择 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCascaderModule } from 'ng-zorro-antd'; +``` + ### nz-cascader | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/cascader/nz-cascader-definitions.ts b/components/cascader/nz-cascader-definitions.ts index 7a9f9b3c92f..39b22f54f3c 100644 --- a/components/cascader/nz-cascader-definitions.ts +++ b/components/cascader/nz-cascader-definitions.ts @@ -3,7 +3,6 @@ export type NzCascaderTriggerType = 'click' | 'hover'; export type NzCascaderSize = 'small' | 'large' | 'default'; export type NzCascaderFilter = (searchValue: string, path: CascaderOption[]) => boolean; - export type NzCascaderSorter = (a: CascaderOption[], b: CascaderOption[], inputValue: string) => number; export interface CascaderOption { diff --git a/components/cascader/nz-cascader-li.component.ts b/components/cascader/nz-cascader-li.component.ts index 19d0640f783..06dbf9f5c64 100644 --- a/components/cascader/nz-cascader-li.component.ts +++ b/components/cascader/nz-cascader-li.component.ts @@ -8,6 +8,7 @@ import { ViewEncapsulation } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; + import { CascaderOption } from './nz-cascader-definitions'; @Component({ diff --git a/components/cascader/nz-cascader.component.ts b/components/cascader/nz-cascader.component.ts index ebf1ac41372..c4b5b05b19f 100644 --- a/components/cascader/nz-cascader.component.ts +++ b/components/cascader/nz-cascader.component.ts @@ -25,12 +25,14 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { DEFAULT_CASCADER_POSITIONS } from '../core/overlay/overlay-position'; -import { NgClassType } from '../core/types/ng-class'; -import { toArray } from '../core/util/array'; -import { InputBoolean } from '../core/util/convert'; +import { + slideMotion, + toArray, + DEFAULT_DROPDOWN_POSITIONS, + InputBoolean, + NgClassType, + NzNoAnimationDirective +} from 'ng-zorro-antd/core'; import { CascaderOption, @@ -136,7 +138,7 @@ export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit, labelRenderContext = {}; onChange = Function.prototype; onTouched = Function.prototype; - positions: ConnectionPositionPair[] = [...DEFAULT_CASCADER_POSITIONS]; + positions: ConnectionPositionPair[] = [...DEFAULT_DROPDOWN_POSITIONS]; dropdownWidthStyle: string; isFocused = false; diff --git a/components/cascader/nz-cascader.module.ts b/components/cascader/nz-cascader.module.ts index 70c3be1e3bb..906e3497ebd 100644 --- a/components/cascader/nz-cascader.module.ts +++ b/components/cascader/nz-cascader.module.ts @@ -3,11 +3,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzEmptyModule } from '../empty/nz-empty.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzInputModule } from '../input/nz-input.module'; +import { NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzInputModule } from 'ng-zorro-antd/input'; + import { NzCascaderOptionComponent } from './nz-cascader-li.component'; import { NzCascaderComponent } from './nz-cascader.component'; diff --git a/components/cascader/nz-cascader.service.ts b/components/cascader/nz-cascader.service.ts index ed69af75be3..c596bcd9212 100644 --- a/components/cascader/nz-cascader.service.ts +++ b/components/cascader/nz-cascader.service.ts @@ -1,6 +1,7 @@ import { Injectable, OnDestroy } from '@angular/core'; import { BehaviorSubject, Subject } from 'rxjs'; -import { arraysEqual } from '../core/util/array'; + +import { arraysEqual } from 'ng-zorro-antd/core'; import { isShowSearchObject, diff --git a/components/cascader/nz-cascader.spec.ts b/components/cascader/nz-cascader.spec.ts index 43e12b67d2e..5f568dcffcb 100644 --- a/components/cascader/nz-cascader.spec.ts +++ b/components/cascader/nz-cascader.spec.ts @@ -11,7 +11,7 @@ import { dispatchEvent, dispatchKeyboardEvent, dispatchMouseEvent -} from '../core/testing'; +} from 'ng-zorro-antd/core'; import { CascaderOption, NzShowSearchOptions } from './nz-cascader-definitions'; import { NzCascaderComponent } from './nz-cascader.component'; diff --git a/components/cascader/package.json b/components/cascader/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/cascader/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/cascader/public-api.ts b/components/cascader/public-api.ts index 6b2f9364592..b8626b593e2 100644 --- a/components/cascader/public-api.ts +++ b/components/cascader/public-api.ts @@ -3,3 +3,4 @@ export * from './nz-cascader-utils'; export * from './nz-cascader.component'; export * from './nz-cascader.module'; export * from './nz-cascader.service'; +export * from './nz-cascader-li.component'; diff --git a/components/cascader/style/entry.less b/components/cascader/style/entry.less new file mode 100644 index 00000000000..03f5202ce9b --- /dev/null +++ b/components/cascader/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../empty/style/index.less'; +@import '../../input/style/index.less'; diff --git a/components/cascader/types.ts b/components/cascader/types.ts deleted file mode 100644 index 51ee4a620ec..00000000000 --- a/components/cascader/types.ts +++ /dev/null @@ -1,35 +0,0 @@ -export type NzCascaderExpandTrigger = 'click' | 'hover'; - -export type NzCascaderTriggerType = 'click' | 'hover'; - -export type NzCascaderSize = 'small' | 'large' | 'default'; - -export interface CascaderOption { - value?: any; // tslint:disable-line:no-any - label?: string; - title?: string; - disabled?: boolean; - loading?: boolean; - isLeaf?: boolean; - parent?: CascaderOption; - children?: CascaderOption[]; - - [key: string]: any; // tslint:disable-line:no-any -} - -export interface CascaderSearchOption extends CascaderOption { - path: CascaderOption[]; -} - -export type NzCascaderSorterFunction = (a: CascaderOption[], b: CascaderOption[], inputValue: string) => number; - -export type NzCascaderFilterFunction = (inputValue: string, p: CascaderOption[]) => boolean; - -export interface NzShowSearchOptions { - filter?: NzCascaderFilterFunction; - sorter?: NzCascaderSorterFunction; -} - -export const isNzShowSearchOptions = (option: boolean | NzShowSearchOptions): option is NzShowSearchOptions => { - return option instanceof Object; -}; diff --git a/components/checkbox/doc/index.en-US.md b/components/checkbox/doc/index.en-US.md index e1678ea7a71..b1c54b5b6b7 100755 --- a/components/checkbox/doc/index.en-US.md +++ b/components/checkbox/doc/index.en-US.md @@ -13,6 +13,14 @@ Checkbox. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCheckboxModule } from 'ng-zorro-antd'; +``` + ### [nz-checkbox] | Property | Description | Type | Default | diff --git a/components/checkbox/doc/index.zh-CN.md b/components/checkbox/doc/index.zh-CN.md index d1db903672a..e85af7c49bf 100755 --- a/components/checkbox/doc/index.zh-CN.md +++ b/components/checkbox/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Checkbox ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCheckboxModule } from 'ng-zorro-antd'; +``` + ### [nz-checkbox] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/checkbox/nz-checkbox-group.component.ts b/components/checkbox/nz-checkbox-group.component.ts index 7740601d878..396aa366547 100644 --- a/components/checkbox/nz-checkbox-group.component.ts +++ b/components/checkbox/nz-checkbox-group.component.ts @@ -10,7 +10,8 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { InputBoolean } from '../core/util/convert'; + +import { InputBoolean } from 'ng-zorro-antd/core'; export interface NzCheckBoxOptionInterface { label: string; diff --git a/components/checkbox/nz-checkbox.component.ts b/components/checkbox/nz-checkbox.component.ts index 4e5f3f8e1f9..fb9cfc09f64 100644 --- a/components/checkbox/nz-checkbox.component.ts +++ b/components/checkbox/nz-checkbox.component.ts @@ -19,8 +19,9 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { isEmpty } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; + +import { isEmpty, InputBoolean } from 'ng-zorro-antd/core'; + import { NzCheckboxWrapperComponent } from './nz-checkbox-wrapper.component'; @Component({ diff --git a/components/checkbox/package.json b/components/checkbox/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/checkbox/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/checkbox/style/entry.less b/components/checkbox/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/checkbox/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/collapse/doc/index.en-US.md b/components/collapse/doc/index.en-US.md index 70fca8a1509..dc57c76c680 100755 --- a/components/collapse/doc/index.en-US.md +++ b/components/collapse/doc/index.en-US.md @@ -14,6 +14,14 @@ A content area which can be collapsed and expanded. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCollapseModule } from 'ng-zorro-antd'; +``` + ### nz-collapse | Property | Description | Type | Default | diff --git a/components/collapse/doc/index.zh-CN.md b/components/collapse/doc/index.zh-CN.md index 645f647bd20..c493f18b82f 100755 --- a/components/collapse/doc/index.zh-CN.md +++ b/components/collapse/doc/index.zh-CN.md @@ -15,6 +15,14 @@ cols: 1 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCollapseModule } from 'ng-zorro-antd'; +``` + ### nz-collapse | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/collapse/nz-collapse-panel.component.ts b/components/collapse/nz-collapse-panel.component.ts index 904186927ef..856d49fb174 100644 --- a/components/collapse/nz-collapse-panel.component.ts +++ b/components/collapse/nz-collapse-panel.component.ts @@ -14,9 +14,9 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { collapseMotion } from '../core/animation/collapse'; -import { InputBoolean } from '../core/util/convert'; +import { collapseMotion, InputBoolean } from 'ng-zorro-antd/core'; + import { NzCollapseComponent } from './nz-collapse.component'; @Component({ diff --git a/components/collapse/nz-collapse.component.ts b/components/collapse/nz-collapse.component.ts index c347344f755..1bd8362d777 100644 --- a/components/collapse/nz-collapse.component.ts +++ b/components/collapse/nz-collapse.component.ts @@ -1,5 +1,7 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; + +import { InputBoolean } from 'ng-zorro-antd/core'; + import { NzCollapsePanelComponent } from './nz-collapse-panel.component'; @Component({ diff --git a/components/collapse/nz-collapse.module.ts b/components/collapse/nz-collapse.module.ts index 2363082bbfc..a37a591810f 100644 --- a/components/collapse/nz-collapse.module.ts +++ b/components/collapse/nz-collapse.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzCollapsePanelComponent } from './nz-collapse-panel.component'; import { NzCollapseComponent } from './nz-collapse.component'; diff --git a/components/collapse/package.json b/components/collapse/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/collapse/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/collapse/style/entry.less b/components/collapse/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/collapse/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/comment/doc/index.en-US.md b/components/comment/doc/index.en-US.md index fe735326c94..c687eb5b819 100644 --- a/components/comment/doc/index.en-US.md +++ b/components/comment/doc/index.en-US.md @@ -18,6 +18,14 @@ Comments can be used to enable discussions on an entity such as a page, blog pos | [nzAuthor] | The element to display as the comment author | `string|TemplateRef` | - | | [nzDatetime] | A datetime element containing the time to be displayed | `string|TemplateRef` | - | +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzCommentModule } from 'ng-zorro-antd'; +``` + ### Comment sections | Element | Description | | ----- | ----------- | diff --git a/components/comment/doc/index.zh-CN.md b/components/comment/doc/index.zh-CN.md index 651fcd28760..f10954533e5 100644 --- a/components/comment/doc/index.zh-CN.md +++ b/components/comment/doc/index.zh-CN.md @@ -19,6 +19,14 @@ cols: 1 | [nzAuthor] | 显示评论的作者 | `string|TemplateRef` | - | | [nzDatetime] | 展示时间描述 | `string|TemplateRef` | - | +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzCommentModule } from 'ng-zorro-antd'; +``` + ### 评论组成部分 | 元素 | 说明 | | ----- | ----------- | diff --git a/components/comment/nz-comment.component.ts b/components/comment/nz-comment.component.ts index fd0e5f5bb5d..1c278e0d4f8 100644 --- a/components/comment/nz-comment.component.ts +++ b/components/comment/nz-comment.component.ts @@ -7,6 +7,7 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; + import { NzCommentActionComponent as CommentAction } from './nz-comment-cells'; @Component({ diff --git a/components/comment/nz-comment.module.ts b/components/comment/nz-comment.module.ts index b084b41287d..956871a24a0 100644 --- a/components/comment/nz-comment.module.ts +++ b/components/comment/nz-comment.module.ts @@ -1,6 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; + +import { NzAddOnModule } from 'ng-zorro-antd/core'; + import { NzCommentActionComponent, NzCommentActionHostDirective, diff --git a/components/comment/package.json b/components/comment/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/comment/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/comment/style/entry.less b/components/comment/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/comment/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/components.less b/components/components.less index a014fdbcbcb..1a1e6687ecb 100644 --- a/components/components.less +++ b/components/components.less @@ -1,57 +1,57 @@ -@import "./affix/style/index.less"; -@import "./alert/style/index.less"; -@import "./anchor/style/index.less"; -@import "./avatar/style/index.less"; -@import "./back-top/style/index.less"; -@import "./badge/style/index.less"; -@import "./breadcrumb/style/index.less"; -@import "./button/style/index.less"; -@import "./card/style/index.less"; -@import "./carousel/style/index.less"; -@import "./checkbox/style/index.less"; -@import "./collapse/style/index.less"; -@import "./comment/style/index.less"; +@import "./affix/style/entry.less"; +@import "./alert/style/entry.less"; +@import "./anchor/style/entry.less"; +@import "./avatar/style/entry.less"; +@import "./back-top/style/entry.less"; +@import "./badge/style/entry.less"; +@import "./breadcrumb/style/entry.less"; +@import "./button/style/entry.less"; +@import "./card/style/entry.less"; +@import "./carousel/style/entry.less"; +@import "./checkbox/style/entry.less"; +@import "./collapse/style/entry.less"; +@import "./comment/style/entry.less"; @import "./core/style/index.less"; -@import "./date-picker/style/index.less"; -@import "./divider/style/index.less"; -@import "./drawer/style/index"; -@import "./dropdown/style/index.less"; -@import "./empty/style/index.less"; -@import "./grid/style/index.less"; -@import "./input/style/index.less"; -@import "./input-number/style/index.less"; -@import "./layout/style/index.less"; -@import "./form/style/index.less"; -@import "./list/style/index.less"; -@import "./menu/style/index.less"; -@import "./mention/style/index.less"; -@import "./message/style/index.less"; -@import "./modal/style/index.less"; -@import "./notification/style/index.less"; -@import "./page-header/style/index.less"; -@import "./pagination/style/index.less"; -@import "./popconfirm/style/index.less"; -@import "./popover/style/index.less"; -@import "./progress/style/index.less"; -@import "./radio/style/index.less"; -@import "./rate/style/index.less"; -@import "./select/style/index.less"; -@import "./skeleton/style/index.less"; -@import "./slider/style/index.less"; -@import "./spin/style/index.less"; -@import "./statistic/style/index.less"; -@import "./steps/style/index.less"; -@import "./switch/style/index.less"; -@import "./table/style/index.less"; -@import "./tabs/style/index.less"; -@import "./tag/style/index.less"; -@import "./time-picker/style/index.less"; -@import "./timeline/style/index.less"; -@import "./tooltip/style/index.less"; -@import "./transfer/style/index.less"; -@import "./upload/style/index.less"; -@import "./auto-complete/style/index.less"; -@import "./cascader/style/index.less"; -@import "./tree/style/index.less"; -@import "./tree-select/style/index.less"; -@import "./calendar/style/index.less"; +@import "./date-picker/style/entry.less"; +@import "./divider/style/entry.less"; +@import "./drawer/style/entry.less"; +@import "./dropdown/style/entry.less"; +@import "./empty/style/entry.less"; +@import "./grid/style/entry.less"; +@import "./input/style/entry.less"; +@import "./input-number/style/entry.less"; +@import "./layout/style/entry.less"; +@import "./form/style/entry.less"; +@import "./list/style/entry.less"; +@import "./menu/style/entry.less"; +@import "./mention/style/entry.less"; +@import "./message/style/entry.less"; +@import "./modal/style/entry.less"; +@import "./notification/style/entry.less"; +@import "./page-header/style/entry.less"; +@import "./pagination/style/entry.less"; +@import "./popconfirm/style/entry.less"; +@import "./popover/style/entry.less"; +@import "./progress/style/entry.less"; +@import "./radio/style/entry.less"; +@import "./rate/style/entry.less"; +@import "./select/style/entry.less"; +@import "./skeleton/style/entry.less"; +@import "./slider/style/entry.less"; +@import "./spin/style/entry.less"; +@import "./statistic/style/entry.less"; +@import "./steps/style/entry.less"; +@import "./switch/style/entry.less"; +@import "./table/style/entry.less"; +@import "./tabs/style/entry.less"; +@import "./tag/style/entry.less"; +@import "./time-picker/style/entry.less"; +@import "./timeline/style/entry.less"; +@import "./tooltip/style/entry.less"; +@import "./transfer/style/entry.less"; +@import "./upload/style/entry.less"; +@import "./auto-complete/style/entry.less"; +@import "./cascader/style/entry.less"; +@import "./tree/style/entry.less"; +@import "./tree-select/style/entry.less"; +@import "./calendar/style/entry.less"; diff --git a/components/core/addon/index.ts b/components/core/addon/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/addon/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/addon/public-api.ts b/components/core/addon/public-api.ts new file mode 100644 index 00000000000..19d7d9a5bbc --- /dev/null +++ b/components/core/addon/public-api.ts @@ -0,0 +1,3 @@ +export { NzAddOnModule } from './addon.module'; +export { NzClassListAddDirective } from './classlist_add'; +export { NzStringTemplateOutletDirective } from './string_template_outlet'; diff --git a/components/core/animation/animation.ts b/components/core/animation/animation-consts.ts similarity index 100% rename from components/core/animation/animation.ts rename to components/core/animation/animation-consts.ts diff --git a/components/core/animation/collapse.ts b/components/core/animation/collapse.ts index bb463907ec7..c089a2d721e 100644 --- a/components/core/animation/collapse.ts +++ b/components/core/animation/collapse.ts @@ -1,5 +1,5 @@ import { animate, state, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationCurves } from './animation'; +import { AnimationCurves } from './animation-consts'; export const collapseMotion: AnimationTriggerMetadata = trigger('collapseMotion', [ state('expanded', style({ height: '*' })), diff --git a/components/core/animation/fade.ts b/components/core/animation/fade.ts index b2fea79fa81..de775ea5320 100644 --- a/components/core/animation/fade.ts +++ b/components/core/animation/fade.ts @@ -1,5 +1,5 @@ import { animate, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationDuration } from './animation'; +import { AnimationDuration } from './animation-consts'; export const fadeMotion: AnimationTriggerMetadata = trigger('fadeMotion', [ transition(':enter', [style({ opacity: 0 }), animate(`${AnimationDuration.BASE}`, style({ opacity: 1 }))]), diff --git a/components/core/animation/help.ts b/components/core/animation/help.ts index d7a2627f088..23023aeeab9 100644 --- a/components/core/animation/help.ts +++ b/components/core/animation/help.ts @@ -1,5 +1,5 @@ import { animate, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationCurves, AnimationDuration } from './animation'; +import { AnimationCurves, AnimationDuration } from './animation-consts'; export const helpMotion: AnimationTriggerMetadata = trigger('helpMotion', [ transition(':enter', [ diff --git a/components/core/animation/index.ts b/components/core/animation/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/animation/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/animation/move.ts b/components/core/animation/move.ts index c397d9ae3ae..55b817e830b 100644 --- a/components/core/animation/move.ts +++ b/components/core/animation/move.ts @@ -1,5 +1,5 @@ import { animate, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationDuration } from './animation'; +import { AnimationDuration } from './animation-consts'; export const moveUpMotion: AnimationTriggerMetadata = trigger('moveUpMotion', [ transition('* => enter', [ diff --git a/components/core/animation/public-api.ts b/components/core/animation/public-api.ts new file mode 100644 index 00000000000..7b855aca03a --- /dev/null +++ b/components/core/animation/public-api.ts @@ -0,0 +1,8 @@ +export * from './animation-consts'; +export * from './collapse'; +export * from './fade'; +export * from './help'; +export * from './move'; +export * from './notification'; +export * from './slide'; +export * from './zoom'; diff --git a/components/core/animation/slide.ts b/components/core/animation/slide.ts index d739f005577..5de030d7401 100755 --- a/components/core/animation/slide.ts +++ b/components/core/animation/slide.ts @@ -1,5 +1,5 @@ import { animate, state, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationCurves, AnimationDuration } from './animation'; +import { AnimationCurves, AnimationDuration } from './animation-consts'; const ANIMATION_TRANSITION_IN = `${AnimationDuration.BASE} ${AnimationCurves.EASE_OUT_QUINT}`; const ANIMATION_TRANSITION_OUT = `${AnimationDuration.BASE} ${AnimationCurves.EASE_IN_QUINT}`; diff --git a/components/core/animation/zoom.ts b/components/core/animation/zoom.ts index b825193afdd..46a1802debb 100644 --- a/components/core/animation/zoom.ts +++ b/components/core/animation/zoom.ts @@ -1,5 +1,5 @@ import { animate, style, transition, trigger, AnimationTriggerMetadata } from '@angular/animations'; -import { AnimationCurves, AnimationDuration } from './animation'; +import { AnimationCurves, AnimationDuration } from './animation-consts'; export const zoomMotion: AnimationTriggerMetadata = trigger('zoomMotion', [ transition(':enter', [ diff --git a/components/core/dropdown/index.ts b/components/core/dropdown/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/dropdown/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/dropdown/nz-dropdown-service.resolver.ts b/components/core/dropdown/nz-dropdown-service.resolver.ts new file mode 100644 index 00000000000..b546704de82 --- /dev/null +++ b/components/core/dropdown/nz-dropdown-service.resolver.ts @@ -0,0 +1,5 @@ +import { InjectionToken } from '@angular/core'; + +import { NzMenuBaseService } from './nz-menu-base.service'; + +export const NzDropdownHigherOrderServiceToken = new InjectionToken('NzTreeHigherOrder'); diff --git a/components/core/dropdown/nz-menu-base.service.ts b/components/core/dropdown/nz-menu-base.service.ts new file mode 100644 index 00000000000..e4cd93e1a04 --- /dev/null +++ b/components/core/dropdown/nz-menu-base.service.ts @@ -0,0 +1,38 @@ +import { Injectable } from '@angular/core'; +import { merge, BehaviorSubject, Subject } from 'rxjs'; + +import { NzDirectionVHIType } from '../types'; + +@Injectable() +export class NzMenuBaseService { + isInDropDown: boolean; + menuItemClick$ = new Subject(); // tslint:disable-line no-any + theme$ = new Subject(); + mode$ = new BehaviorSubject('vertical'); + inlineIndent$ = new BehaviorSubject(24); + check$ = merge(this.theme$, this.mode$, this.inlineIndent$); + theme: 'light' | 'dark' = 'light'; + mode: NzDirectionVHIType = 'vertical'; + inlineIndent = 24; + menuOpen$ = new BehaviorSubject(false); + + // tslint:disable-next-line no-any + onMenuItemClick(menu: any): void { + this.menuItemClick$.next(menu); + } + + setMode(mode: NzDirectionVHIType): void { + this.mode = mode; + this.mode$.next(mode); + } + + setTheme(theme: 'light' | 'dark'): void { + this.theme = theme; + this.theme$.next(theme); + } + + setInlineIndent(indent: number): void { + this.inlineIndent = indent; + this.inlineIndent$.next(indent); + } +} diff --git a/components/core/dropdown/public-api.ts b/components/core/dropdown/public-api.ts new file mode 100644 index 00000000000..0e8e4b473e0 --- /dev/null +++ b/components/core/dropdown/public-api.ts @@ -0,0 +1,2 @@ +export * from './nz-menu-base.service'; +export * from './nz-dropdown-service.resolver'; diff --git a/components/core/index.ts b/components/core/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/logger/index.ts b/components/core/logger/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/logger/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/util/logger/logger.module.ts b/components/core/logger/logger.module.ts similarity index 100% rename from components/core/util/logger/logger.module.ts rename to components/core/logger/logger.module.ts diff --git a/components/core/util/logger/logger.service.ts b/components/core/logger/logger.service.ts similarity index 100% rename from components/core/util/logger/logger.service.ts rename to components/core/logger/logger.service.ts diff --git a/components/core/logger/public-api.ts b/components/core/logger/public-api.ts new file mode 100644 index 00000000000..0c62539ae68 --- /dev/null +++ b/components/core/logger/public-api.ts @@ -0,0 +1,7 @@ +export { LoggerModule } from './logger.module'; +export { + LoggerService, + NZ_LOGGER_STATE, + LOGGER_SERVICE_PROVIDER, + LOGGER_SERVICE_PROVIDER_FACTORY +} from './logger.service'; diff --git a/components/core/no-animation/nz-no-animation.directive.ts b/components/core/no-animation/nz-no-animation.directive.ts index 7327883c2d2..1524c7a56a9 100644 --- a/components/core/no-animation/nz-no-animation.directive.ts +++ b/components/core/no-animation/nz-no-animation.directive.ts @@ -1,6 +1,7 @@ import { coerceElement } from '@angular/cdk/coercion'; import { AfterViewInit, Directive, ElementRef, Inject, Input, OnChanges, Optional, Renderer2 } from '@angular/core'; import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations'; + import { InputBoolean } from '../util/convert'; const DISABLED_CLASSNAME = 'nz-animate-disabled'; diff --git a/components/core/no-animation/nz-no-animation.module.ts b/components/core/no-animation/nz-no-animation.module.ts index e2010446e40..9dffe5be04b 100644 --- a/components/core/no-animation/nz-no-animation.module.ts +++ b/components/core/no-animation/nz-no-animation.module.ts @@ -1,5 +1,6 @@ -import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; + import { NzNoAnimationDirective } from './nz-no-animation.directive'; @NgModule({ diff --git a/components/core/overlay/index.ts b/components/core/overlay/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/overlay/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/overlay/public-api.ts b/components/core/overlay/public-api.ts new file mode 100644 index 00000000000..52e89225603 --- /dev/null +++ b/components/core/overlay/public-api.ts @@ -0,0 +1,3 @@ +export * from './nz-connected-overlay'; +export * from './nz-overlay.module'; +export * from './overlay-position'; diff --git a/components/core/package.json b/components/core/package.json new file mode 100644 index 00000000000..54c27fb98f1 --- /dev/null +++ b/components/core/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "./public-api.ts" + } + } +} diff --git a/components/core/polyfill/index.ts b/components/core/polyfill/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/polyfill/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/polyfill/public-api.ts b/components/core/polyfill/public-api.ts new file mode 100644 index 00000000000..858ba1134e3 --- /dev/null +++ b/components/core/polyfill/public-api.ts @@ -0,0 +1 @@ +export * from './request-animation'; diff --git a/components/core/public-api.ts b/components/core/public-api.ts new file mode 100644 index 00000000000..0937d77591d --- /dev/null +++ b/components/core/public-api.ts @@ -0,0 +1,15 @@ +export * from './addon/public-api'; +export * from './animation/public-api'; +export * from './no-animation/public-api'; +export * from './overlay/public-api'; +export * from './overlay/public-api'; +export * from './polyfill/public-api'; +export * from './scroll/public-api'; +export * from './services/public-api'; +export * from './testing/public-api'; +export * from './tree/public-api'; +export * from './types/public-api'; +export * from './util/public-api'; +export * from './wave/public-api'; +export * from './dropdown/public-api'; +export * from './logger/public-api'; diff --git a/components/core/scroll/index.ts b/components/core/scroll/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/scroll/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/scroll/public-api.ts b/components/core/scroll/public-api.ts new file mode 100644 index 00000000000..e78c3b45183 --- /dev/null +++ b/components/core/scroll/public-api.ts @@ -0,0 +1 @@ +export * from './nz-scroll.service'; diff --git a/components/core/services/index.ts b/components/core/services/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/services/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/services/public-api.ts b/components/core/services/public-api.ts new file mode 100644 index 00000000000..e046b94ca97 --- /dev/null +++ b/components/core/services/public-api.ts @@ -0,0 +1,2 @@ +export * from './nz-measure-scrollbar.service'; +export * from './update-host-class.service'; diff --git a/components/core/services/update-host-class.service.ts b/components/core/services/update-host-class.service.ts index 2244e966835..84e6d89a0f6 100644 --- a/components/core/services/update-host-class.service.ts +++ b/components/core/services/update-host-class.service.ts @@ -13,7 +13,7 @@ export class NzUpdateHostClassService { this.addClass(el, this.classMap, this.renderer); } - private removeClass(el: HTMLElement, classMap: object, renderer: Renderer2): void { + private removeClass(el: HTMLElement, classMap: NgClassInterface, renderer: Renderer2): void { for (const i in classMap) { if (classMap.hasOwnProperty(i)) { renderer.removeClass(el, i); @@ -23,10 +23,8 @@ export class NzUpdateHostClassService { private addClass(el: HTMLElement, classMap: NgClassInterface, renderer: Renderer2): void { for (const i in classMap) { - if (classMap.hasOwnProperty(i)) { - if (classMap[i]) { - renderer.addClass(el, i); - } + if (classMap.hasOwnProperty(i) && classMap[i]) { + renderer.addClass(el, i); } } } diff --git a/components/core/style/index.less b/components/core/style/index.less index b2770b945c7..e8f3a418ee6 100644 --- a/components/core/style/index.less +++ b/components/core/style/index.less @@ -1,7 +1,6 @@ @import "../../style/themes/default"; // cdk overlay - .cdk-overlay-container { pointer-events: none; top: 0; @@ -66,206 +65,6 @@ } } -.ant-dropdown-menu { - & > ul { - list-style: none; - margin: 0; - padding: 0; - } -} - -@table-prefix-cls: ~'@{ant-prefix}-table'; -@table-td-cls: ~'@{table-prefix-cls}-td'; -@table-th-cls: ~'@{table-prefix-cls}-th'; -@table-th-left-cls: ~'@{table-th-cls}-left'; -@table-th-right-cls: ~'@{table-th-cls}-right'; -@table-td-left-cls: ~'@{table-td-cls}-left'; -@table-td-right-cls: ~'@{table-td-cls}-right'; - -nz-table { - .@{table-prefix-cls} { - table { - border-collapse: separate; - border-spacing: 0; - } - } -} - -.box-shadow-left() { - .@{table-th-right-cls}-sticky, - .@{table-td-right-cls}-sticky { - box-shadow: -6px 0 6px 0px rgba(0, 0, 0, .05); - } -} - -.box-shadow-right() { - .@{table-th-left-cls}-sticky, - .@{table-td-left-cls}-sticky { - box-shadow: 6px 0 6px 0px rgba(0, 0, 0, .05); - } -} - -.border-left() { - .@{table-th-right-cls}-sticky, - .@{table-td-right-cls}-sticky { - border-right: @border-width-base @border-style-base @border-color-split; - } -} - -.border-right() { - .@{table-th-left-cls}-sticky, - .@{table-td-left-cls}-sticky { - border-left: @border-width-base @border-style-base @border-color-split; - } -} - -.@{table-prefix-cls}-scroll-position-middle, -.@{table-prefix-cls}-scroll-position-left { - .@{table-td-right-cls}-sticky + .@{table-td-right-cls}-sticky { - box-shadow: none; - } - - .@{table-th-right-cls}-sticky + .@{table-th-right-cls}-sticky { - box-shadow: none; - } -} - - -.@{table-th-left-cls}-sticky, -.@{table-th-right-cls}-sticky, -.@{table-td-right-cls}-sticky, -.@{table-td-left-cls}-sticky { - position: sticky !important; - z-index: 1; -} - -.@{table-td-left-cls}-sticky, -.@{table-td-right-cls}-sticky { - background: @component-background; -} - -.@{table-prefix-cls}-tbody { - & > tr { - &:hover { - & > td { - &.@{table-td-left-cls}-sticky { - background: @table-row-hover-bg; - } - - &.@{table-td-right-cls}-sticky { - background: @table-row-hover-bg; - } - } - } - } -} - -.@{table-prefix-cls}-thead > tr > th .@{table-prefix-cls}-column-sorters > nz-dropdown { - position: static !important; -} - -.@{table-prefix-cls}-scroll-position-middle { - .box-shadow-right; - .box-shadow-left; -} - -.@{table-prefix-cls}-scroll-position-left { - .box-shadow-left; -} - -.@{table-prefix-cls}-scroll-position-right { - .box-shadow-right; -} - -.@{table-prefix-cls}-bordered { - &.@{table-prefix-cls}-scroll-position-middle { - .border-right; - .border-left; - } - - &.@{table-prefix-cls}-scroll-position-left { - .border-left; - } - - &.@{table-prefix-cls}-scroll-position-right { - .border-right; - } -} - - -.@{table-prefix-cls}-middle { - > .@{table-prefix-cls}-content { - > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > .cdk-virtual-scroll-content-wrapper > table { - > .@{table-prefix-cls}-thead > tr > th, - > .@{table-prefix-cls}-tbody > tr > td { - padding: @table-padding-vertical-md @table-padding-horizontal-md; - } - } - } -} - -.@{table-prefix-cls}-small { - > .@{table-prefix-cls}-content { - > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-header > table, - > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > table, - > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > .cdk-virtual-scroll-content-wrapper > table { - border: 0; - - > .@{table-prefix-cls}-thead > tr > th { - &.@{table-th-left-cls}-sticky, - &.@{table-th-right-cls}-sticky { - background: @component-background; - } - } - - > .@{table-prefix-cls}-thead > tr > th, - > .@{table-prefix-cls}-tbody > tr > td { - padding: @table-padding-vertical-sm @table-padding-horizontal-sm; - } - } - } -} - -/** https://github.com/NG-ZORRO/ng-zorro-antd/issues/3241 **/ -.cdk-overlay-pane { - &.nz-dropdown-panel { - display: block; - } -} - -// hack tree css -.ant-tree { - &.ant-tree-show-line { - > nz-tree-node:not(:last-child), .ant-tree-child-tree > nz-tree-node:not(:last-child) { - > li:before { - content: ' '; - width: 1px; - border-left: 1px solid @border-color-base; - height: 100%; - position: absolute; - left: 12px; - margin: 22px 0; - } - } - - .ant-tree-child-tree > nz-tree-node:last-child { - > li:before { - content: ' '; - width: 1px; - border-left: 0px solid @border-color-base; - height: 100%; - position: absolute; - left: 12px; - margin: 22px 0; - } - } - } - - .font-highlight { - color: @highlight-color; - } -} - textarea.cdk-textarea-autosize-measuring { height: auto !important; overflow: hidden !important; @@ -275,9 +74,7 @@ textarea.cdk-textarea-autosize-measuring { box-sizing: content-box !important; } - .nz-animate-disabled { - // drawer &.ant-drawer { &.ant-drawer-open .ant-drawer-mask { @@ -332,6 +129,4 @@ textarea.cdk-textarea-autosize-measuring { transition: none; } } - - } diff --git a/components/core/testing/public-api.ts b/components/core/testing/public-api.ts index 7922e59e492..846a6e237b6 100644 --- a/components/core/testing/public-api.ts +++ b/components/core/testing/public-api.ts @@ -1,11 +1,3 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - export * from './dispatch-events'; export * from './event-objects'; export * from './type-in-element'; diff --git a/components/core/tree/index.ts b/components/core/tree/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/tree/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/tree/nz-tree-node.ts b/components/core/tree/nz-tree-base-node.ts similarity index 98% rename from components/tree/nz-tree-node.ts rename to components/core/tree/nz-tree-base-node.ts index 05d5be53007..dd9c65e9923 100644 --- a/components/tree/nz-tree-node.ts +++ b/components/core/tree/nz-tree-base-node.ts @@ -1,5 +1,5 @@ +import { NzTreeNodeBaseComponent } from './nz-tree-base.definitions'; import { NzTreeBaseService } from './nz-tree-base.service'; -import { NzTreeNodeComponent } from './nz-tree-node.component'; export interface NzTreeNodeOptions { title: string; @@ -43,7 +43,7 @@ export class NzTreeNode { isMatched: boolean; service: NzTreeBaseService | null; - component: NzTreeNodeComponent; + component: NzTreeNodeBaseComponent; get treeService(): NzTreeBaseService | null { return this.service || (this.parentNode && this.parentNode.treeService); diff --git a/components/tree/nz-tree-util.ts b/components/core/tree/nz-tree-base-util.ts similarity index 86% rename from components/tree/nz-tree-util.ts rename to components/core/tree/nz-tree-base-util.ts index b24c978027b..57804e297bf 100644 --- a/components/tree/nz-tree-util.ts +++ b/components/core/tree/nz-tree-base-util.ts @@ -1,4 +1,4 @@ -import { NzTreeNode } from './nz-tree-node'; +import { NzTreeNode } from './nz-tree-base-node'; export function isCheckDisabled(node: NzTreeNode): boolean { const { isDisabled, isDisableCheckbox } = node; diff --git a/components/tree/interface.ts b/components/core/tree/nz-tree-base.definitions.ts similarity index 73% rename from components/tree/interface.ts rename to components/core/tree/nz-tree-base.definitions.ts index a4902c618ef..54a5b8a29c8 100644 --- a/components/tree/interface.ts +++ b/components/core/tree/nz-tree-base.definitions.ts @@ -1,4 +1,4 @@ -import { NzTreeNode } from './nz-tree-node'; +import { NzTreeNode } from './nz-tree-base-node'; export interface NzFormatEmitEvent { eventName: string; @@ -17,3 +17,8 @@ export interface NzFormatBeforeDropEvent { node: NzTreeNode; pos: number; } + +export interface NzTreeNodeBaseComponent { + setClassMap(): void; + markForCheck(): void; +} diff --git a/components/tree/nz-tree-base.service.ts b/components/core/tree/nz-tree-base.service.ts similarity index 98% rename from components/tree/nz-tree-base.service.ts rename to components/core/tree/nz-tree-base.service.ts index 2e88491bb5d..2e473db115b 100644 --- a/components/tree/nz-tree-base.service.ts +++ b/components/core/tree/nz-tree-base.service.ts @@ -1,9 +1,11 @@ import { Injectable, OnDestroy } from '@angular/core'; import { Observable, Subject } from 'rxjs'; -import { isNotNil } from '../core/util/check'; -import { NzFormatEmitEvent } from './interface'; -import { NzTreeNode } from './nz-tree-node'; -import { isCheckDisabled, isInArray } from './nz-tree-util'; + +import { isNotNil } from '../util'; + +import { NzTreeNode } from './nz-tree-base-node'; +import { isCheckDisabled, isInArray } from './nz-tree-base-util'; +import { NzFormatEmitEvent } from './nz-tree-base.definitions'; @Injectable() export class NzTreeBaseService implements OnDestroy { diff --git a/components/core/tree/nz-tree-service.resolver.ts b/components/core/tree/nz-tree-service.resolver.ts new file mode 100644 index 00000000000..be65407d4e1 --- /dev/null +++ b/components/core/tree/nz-tree-service.resolver.ts @@ -0,0 +1,5 @@ +import { InjectionToken } from '@angular/core'; + +import { NzTreeBaseService } from './nz-tree-base.service'; + +export const NzTreeHigherOrderServiceToken = new InjectionToken('NzTreeHigherOrder'); diff --git a/components/core/tree/public-api.ts b/components/core/tree/public-api.ts new file mode 100644 index 00000000000..8dee94e3ab8 --- /dev/null +++ b/components/core/tree/public-api.ts @@ -0,0 +1,4 @@ +export * from './nz-tree-base-node'; +export * from './nz-tree-base.definitions'; +export * from './nz-tree-base.service'; +export * from './nz-tree-service.resolver'; diff --git a/components/core/types/index.ts b/components/core/types/index.ts new file mode 100644 index 00000000000..7e1a213e3ea --- /dev/null +++ b/components/core/types/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/components/core/types/public-api.ts b/components/core/types/public-api.ts new file mode 100644 index 00000000000..9a01832e7ef --- /dev/null +++ b/components/core/types/public-api.ts @@ -0,0 +1,6 @@ +export * from './common-wrap'; +export * from './direction'; +export * from './drop-down-position'; +export * from './indexable'; +export * from './ng-class'; +export * from './size'; diff --git a/components/core/util/check.ts b/components/core/util/check.ts index ac2cae1c77a..fc28eab3273 100644 --- a/components/core/util/check.ts +++ b/components/core/util/check.ts @@ -1,4 +1,5 @@ import { TemplateRef, Type } from '@angular/core'; + import { IndexableObject } from '../types/indexable'; // tslint:disable-next-line:no-any @@ -74,17 +75,17 @@ export function filterNotEmptyNode(node: Node): Node | null { return null; } +// tslint:disable-next-line:no-any export function isNonEmptyString(value: any): boolean { - // tslint:disable-line:no-any return typeof value === 'string' && value !== ''; } +// tslint:disable-next-line:no-any export function isTemplateRef(value: any): boolean { - // tslint:disable-line:no-any return value instanceof TemplateRef; } +// tslint:disable-next-line:no-any export function isComponent(value: any): boolean { - // tslint:disable-line:no-any return value instanceof Type; } diff --git a/components/core/util/convert.ts b/components/core/util/convert.ts index d11c57ce5e7..bdca1cbbac4 100644 --- a/components/core/util/convert.ts +++ b/components/core/util/convert.ts @@ -1,4 +1,5 @@ import { coerceBooleanProperty, coerceCssPixelValue, _isNumberValue } from '@angular/cdk/coercion'; + import { FunctionProp } from '../types/common-wrap'; export function toBoolean(value: boolean | string): boolean { @@ -15,9 +16,11 @@ export function toCssPixel(value: number | string): string { return coerceCssPixelValue(value); } -// Get the function-property type's value +/** + * Get the function-property type's value + */ +// tslint:disable-next-line: no-any export function valueFunctionProp(prop: FunctionProp, ...args: any[]): T { - // tslint:disable-line: no-any return typeof prop === 'function' ? prop(...args) : prop; } @@ -60,21 +63,22 @@ function propDecoratorFactory(name: string, fallback: (v: T) => D): (targe * * // Act as below: * // @Input() - * // get visible() { return this.__visibile; } + * // get visible() { return this.__visible; } * // set visible(value) { this.__visible = value; } * // __visible = false; * ``` */ +// tslint:disable-next-line: no-any export function InputBoolean(): any { - // tslint:disable-line: no-any return propDecoratorFactory('InputBoolean', toBoolean); } +// tslint:disable-next-line: no-any export function InputCssPixel(): any { - // tslint:disable-line: no-any return propDecoratorFactory('InputCssPixel', toCssPixel); } +// tslint:disable-next-line: no-any export function InputNumber(): any { // tslint:disable-line: no-any return propDecoratorFactory('InputNumber', toNumber); diff --git a/components/core/util/logger/index.ts b/components/core/util/logger/index.ts deleted file mode 100644 index a354094041d..00000000000 --- a/components/core/util/logger/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { LoggerModule } from './logger.module'; -export { LoggerService, NZ_LOGGER_STATE } from './logger.service'; diff --git a/components/core/util/public-api.ts b/components/core/util/public-api.ts index 505099c70e3..c5dfe3d5643 100644 --- a/components/core/util/public-api.ts +++ b/components/core/util/public-api.ts @@ -1,7 +1,12 @@ +export * from './array'; export * from './check'; export * from './convert'; +export * from './dom'; export * from './getMentions'; export * from './string'; +export * from './is-promise'; +export * from './number'; +export * from './scroll-into-view-if-needed'; export * from './textarea-caret-position'; export * from './throttleByAnimationFrame'; export * from './time'; diff --git a/components/date-picker/abstract-picker.component.ts b/components/date-picker/abstract-picker.component.ts index 2cb87f20e96..5331e00b82c 100644 --- a/components/date-picker/abstract-picker.component.ts +++ b/components/date-picker/abstract-picker.component.ts @@ -10,15 +10,13 @@ import { ViewChild } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; - import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { InputBoolean } from '../core/util/convert'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { NzDatePickerI18nInterface } from '../i18n/nz-i18n.interface'; -import { NzI18nService } from '../i18n/nz-i18n.service'; -import { CandyDate } from './lib/candy-date'; + +import { InputBoolean, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzDatePickerI18nInterface, NzI18nService } from 'ng-zorro-antd/i18n'; + +import { CandyDate } from './lib/candy-date/candy-date'; import { NzPickerComponent } from './picker.component'; const POPUP_STYLE_PATCH = { position: 'relative' }; // Aim to override antd's style to support overlay's position strategy (position:absolute will cause it not working beacuse the overlay can't get the height/width of it's content) diff --git a/components/date-picker/date-picker.component.spec.ts b/components/date-picker/date-picker.component.spec.ts index a7c25550c51..4cc79f21c7c 100644 --- a/components/date-picker/date-picker.component.spec.ts +++ b/components/date-picker/date-picker.component.spec.ts @@ -9,11 +9,10 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import isSameDay from 'date-fns/is_same_day'; -import { dispatchKeyboardEvent, dispatchMouseEvent } from '../core/testing'; -import { NGStyleInterface } from '../core/types/ng-class'; +import { dispatchKeyboardEvent, dispatchMouseEvent, NGStyleInterface } from 'ng-zorro-antd/core'; import en_US from '../i18n/languages/en_US'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { NzI18nModule, NzI18nService } from 'ng-zorro-antd/i18n'; import { NzDatePickerModule } from './date-picker.module'; registerLocaleData(zh); diff --git a/components/date-picker/date-picker.component.ts b/components/date-picker/date-picker.component.ts index edfdd3092bb..a94f8b9daa2 100644 --- a/components/date-picker/date-picker.component.ts +++ b/components/date-picker/date-picker.component.ts @@ -11,9 +11,8 @@ import { } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; import { DateRangePickerComponent } from './date-range-picker.component'; diff --git a/components/date-picker/date-picker.module.ts b/components/date-picker/date-picker.module.ts index 8a2d2db2718..9d69ead3536 100644 --- a/components/date-picker/date-picker.module.ts +++ b/components/date-picker/date-picker.module.ts @@ -2,9 +2,8 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { LibPackerModule } from './lib/lib-packer.module'; diff --git a/components/date-picker/date-range-picker.component.ts b/components/date-picker/date-range-picker.component.ts index 78fd6764be9..1ebb4cf9f23 100644 --- a/components/date-picker/date-range-picker.component.ts +++ b/components/date-picker/date-range-picker.component.ts @@ -10,14 +10,11 @@ import { TemplateRef } from '@angular/core'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { FunctionProp } from '../core/types/common-wrap'; -import { toBoolean, valueFunctionProp, InputBoolean } from '../core/util/convert'; -import { NzI18nService } from '../i18n/nz-i18n.service'; -import { CandyDate } from './lib/candy-date'; +import { toBoolean, valueFunctionProp, FunctionProp, InputBoolean, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; -import { DateHelperService } from '../i18n/date-helper.service'; import { AbstractPickerComponent, CompatibleDate } from './abstract-picker.component'; +import { CandyDate } from './lib/candy-date/candy-date'; import { DisabledTimeFn, PanelMode, PresetRanges } from './standard-types'; @Component({ diff --git a/components/date-picker/doc/index.en-US.md b/components/date-picker/doc/index.en-US.md index 844c1d17200..55b898a4b9d 100644 --- a/components/date-picker/doc/index.en-US.md +++ b/components/date-picker/doc/index.en-US.md @@ -30,6 +30,14 @@ There are four kinds of picker: **Note:** All input and output date objects are [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), you can manpulate it with [date-fns](https://date-fns.org/). +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzDatePickerModule } from 'ng-zorro-antd'; +``` + ### Common API The following APIs are shared by nz-date-picker, nz-month-picker, nz-range-picker, nz-week-picker. diff --git a/components/date-picker/doc/index.zh-CN.md b/components/date-picker/doc/index.zh-CN.md index 12752d028c3..ff22cdecc89 100644 --- a/components/date-picker/doc/index.zh-CN.md +++ b/components/date-picker/doc/index.zh-CN.md @@ -30,6 +30,14 @@ registerLocaleData(zh); **注意:** 所有输入输出日期对象均为 [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),你可以通过 [date-fns](https://date-fns.org/) 工具库获得你需要的数据。 +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzDatePickerModule } from 'ng-zorro-antd'; +``` + ### 共同的 API 以下 API 为 nz-date-picker、nz-month-picker、nz-range-picker, nz-week-picker 共享的 API。 diff --git a/components/date-picker/header-picker.component.ts b/components/date-picker/header-picker.component.ts index 030d53770a3..dc7ce7b1f16 100644 --- a/components/date-picker/header-picker.component.ts +++ b/components/date-picker/header-picker.component.ts @@ -1,12 +1,10 @@ import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { FunctionProp } from '../core/types/common-wrap'; -import { valueFunctionProp } from '../core/util/convert'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { valueFunctionProp, FunctionProp, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; + import { AbstractPickerComponent } from './abstract-picker.component'; -import { CandyDate } from './lib/candy-date'; +import { CandyDate } from './lib/candy-date/candy-date'; import { PanelMode } from './standard-types'; /** diff --git a/components/date-picker/lib/calendar/calendar-footer.component.ts b/components/date-picker/lib/calendar/calendar-footer.component.ts index 4fc546e1f31..7b1e23fb429 100644 --- a/components/date-picker/lib/calendar/calendar-footer.component.ts +++ b/components/date-picker/lib/calendar/calendar-footer.component.ts @@ -8,9 +8,9 @@ import { ViewEncapsulation } from '@angular/core'; -import { isNonEmptyString, isTemplateRef } from '../../../core/util/check'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { isNonEmptyString, isTemplateRef } from 'ng-zorro-antd/core'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/calendar/calendar-header.component.ts b/components/date-picker/lib/calendar/calendar-header.component.ts index 15a3e0f926e..7ab8b1f2370 100644 --- a/components/date-picker/lib/calendar/calendar-header.component.ts +++ b/components/date-picker/lib/calendar/calendar-header.component.ts @@ -10,10 +10,10 @@ import { ViewEncapsulation } from '@angular/core'; -import { DateHelperByDatePipe, DateHelperService } from '../../../i18n/date-helper.service'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; +import { DateHelperByDatePipe, DateHelperService, NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; + import { PanelMode } from '../../standard-types'; -import { CandyDate } from '../candy-date'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/calendar/calendar-input.component.ts b/components/date-picker/lib/calendar/calendar-input.component.ts index ccd1e747d27..bac24cc9734 100644 --- a/components/date-picker/lib/calendar/calendar-input.component.ts +++ b/components/date-picker/lib/calendar/calendar-input.component.ts @@ -8,9 +8,9 @@ import { ViewEncapsulation } from '@angular/core'; -import { DateHelperService } from '../../../i18n/date-helper.service'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { DateHelperService } from 'ng-zorro-antd/i18n'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/calendar/ok-button.component.ts b/components/date-picker/lib/calendar/ok-button.component.ts index 8a808edda85..8c278d11960 100644 --- a/components/date-picker/lib/calendar/ok-button.component.ts +++ b/components/date-picker/lib/calendar/ok-button.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/calendar/time-picker-button.component.ts b/components/date-picker/lib/calendar/time-picker-button.component.ts index 2257af326ce..af30eff0095 100644 --- a/components/date-picker/lib/calendar/time-picker-button.component.ts +++ b/components/date-picker/lib/calendar/time-picker-button.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/calendar/today-button.component.ts b/components/date-picker/lib/calendar/today-button.component.ts index 52189f64131..4645da57c5b 100644 --- a/components/date-picker/lib/calendar/today-button.component.ts +++ b/components/date-picker/lib/calendar/today-button.component.ts @@ -10,9 +10,9 @@ import { ViewEncapsulation } from '@angular/core'; -import { DateHelperByDatePipe, DateHelperService } from '../../../i18n/date-helper.service'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { DateHelperByDatePipe, DateHelperService } from 'ng-zorro-antd/i18n'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/candy-date/candy-date.ts b/components/date-picker/lib/candy-date/candy-date.ts index 1f14a0ab36e..c9df4411bd1 100644 --- a/components/date-picker/lib/candy-date/candy-date.ts +++ b/components/date-picker/lib/candy-date/candy-date.ts @@ -3,7 +3,7 @@ import addYears from 'date-fns/add_years'; import endOfMonth from 'date-fns/end_of_month'; import setDay from 'date-fns/set_day'; import setMonth from 'date-fns/set_month'; -import { IndexableObject } from '../../../core/types/indexable'; +import { IndexableObject } from 'ng-zorro-antd/core'; /** * Wrapping kind APIs for date operating and unify diff --git a/components/date-picker/lib/candy-date/index.ts b/components/date-picker/lib/candy-date/index.ts deleted file mode 100644 index 6ee45b65a5c..00000000000 --- a/components/date-picker/lib/candy-date/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './candy-date'; diff --git a/components/date-picker/lib/date/date-table.component.ts b/components/date-picker/lib/date/date-table.component.ts index 6897c0bb2a6..9d20deef9a4 100644 --- a/components/date-picker/lib/date/date-table.component.ts +++ b/components/date-picker/lib/date/date-table.component.ts @@ -12,13 +12,9 @@ import { ViewEncapsulation } from '@angular/core'; -import { FunctionProp } from '../../../core/types/common-wrap'; -import { isNonEmptyString, isTemplateRef } from '../../../core/util/check'; -import { valueFunctionProp } from '../../../core/util/convert'; -import { DateHelperByDatePipe, DateHelperService } from '../../../i18n/date-helper.service'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { NzI18nService } from '../../../i18n/nz-i18n.service'; -import { CandyDate } from '../candy-date'; +import { isNonEmptyString, isTemplateRef, valueFunctionProp, FunctionProp } from 'ng-zorro-antd/core'; +import { DateHelperByDatePipe, DateHelperService, NzCalendarI18nInterface, NzI18nService } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; const DATE_ROW_NUM = 6; const DATE_COL_NUM = 7; diff --git a/components/date-picker/lib/decade/decade-panel.component.ts b/components/date-picker/lib/decade/decade-panel.component.ts index 5279a3d7c0e..2f2f1b0d2ec 100644 --- a/components/date-picker/lib/decade/decade-panel.component.ts +++ b/components/date-picker/lib/decade/decade-panel.component.ts @@ -9,8 +9,8 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; const MAX_ROW = 4; const MAX_COL = 3; diff --git a/components/date-picker/lib/lib-packer-supplements.spec.ts b/components/date-picker/lib/lib-packer-supplements.spec.ts index 0270435cfa1..b5bdb603c9d 100644 --- a/components/date-picker/lib/lib-packer-supplements.spec.ts +++ b/components/date-picker/lib/lib-packer-supplements.spec.ts @@ -8,7 +8,7 @@ import { NzI18nService } from '../../i18n/nz-i18n.service'; import { AbstractPickerComponent } from '../abstract-picker.component'; import { CalendarHeaderComponent } from './calendar/calendar-header.component'; import { TodayButtonComponent } from './calendar/today-button.component'; -import { CandyDate } from './candy-date'; +import { CandyDate } from './candy-date/candy-date'; import { DateTableComponent } from './date/date-table.component'; import { LibPackerModule } from './lib-packer.module'; import { MonthTableComponent } from './month/month-table.component'; diff --git a/components/date-picker/lib/lib-packer.module.ts b/components/date-picker/lib/lib-packer.module.ts index 1ee74ae3911..a61c9fd3b9e 100644 --- a/components/date-picker/lib/lib-packer.module.ts +++ b/components/date-picker/lib/lib-packer.module.ts @@ -6,8 +6,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzI18nModule } from '../../i18n/nz-i18n.module'; -import { NzTimePickerModule } from '../../time-picker/nz-time-picker.module'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzTimePickerModule } from 'ng-zorro-antd/time-picker'; import { CalendarFooterComponent } from './calendar/calendar-footer.component'; import { CalendarHeaderComponent } from './calendar/calendar-header.component'; diff --git a/components/date-picker/lib/month/month-panel.component.ts b/components/date-picker/lib/month/month-panel.component.ts index 54c56c058f6..6029f400910 100644 --- a/components/date-picker/lib/month/month-panel.component.ts +++ b/components/date-picker/lib/month/month-panel.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/month/month-table.component.ts b/components/date-picker/lib/month/month-table.component.ts index 321d6582733..fcb9257ec27 100644 --- a/components/date-picker/lib/month/month-table.component.ts +++ b/components/date-picker/lib/month/month-table.component.ts @@ -10,8 +10,8 @@ import { ViewEncapsulation } from '@angular/core'; -import { DateHelperService } from '../../../i18n/date-helper.service'; -import { CandyDate } from '../candy-date'; +import { DateHelperService } from 'ng-zorro-antd/i18n'; +import { CandyDate } from '../candy-date/candy-date'; const MAX_ROW = 4; const MAX_COL = 3; diff --git a/components/date-picker/lib/popups/date-range-popup.component.ts b/components/date-picker/lib/popups/date-range-popup.component.ts index e999d725bfb..90dc59f0471 100644 --- a/components/date-picker/lib/popups/date-range-popup.component.ts +++ b/components/date-picker/lib/popups/date-range-popup.component.ts @@ -11,8 +11,8 @@ import { ViewEncapsulation } from '@angular/core'; -import { FunctionProp } from '../../../core/types/common-wrap'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; +import { FunctionProp } from 'ng-zorro-antd/core'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; import { DisabledDateFn, DisabledTimeConfig, @@ -22,7 +22,7 @@ import { PresetRanges, SupportTimeOptions } from '../../standard-types'; -import { CandyDate } from '../candy-date'; +import { CandyDate } from '../candy-date/candy-date'; import { getTimeConfig, isAllowedDate } from '../util'; @Component({ diff --git a/components/date-picker/lib/popups/inner-popup.component.ts b/components/date-picker/lib/popups/inner-popup.component.ts index 518d655faaa..7e9fdddfb35 100644 --- a/components/date-picker/lib/popups/inner-popup.component.ts +++ b/components/date-picker/lib/popups/inner-popup.component.ts @@ -11,10 +11,10 @@ import { ViewEncapsulation } from '@angular/core'; -import { FunctionProp } from '../../../core/types/common-wrap'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; +import { FunctionProp } from 'ng-zorro-antd/core'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; import { DisabledDateFn, PanelMode } from '../../standard-types'; -import { CandyDate } from '../candy-date'; +import { CandyDate } from '../candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/lib/util.spec.ts b/components/date-picker/lib/util.spec.ts index 02fae575bf6..2b9ae465f00 100644 --- a/components/date-picker/lib/util.spec.ts +++ b/components/date-picker/lib/util.spec.ts @@ -1,4 +1,4 @@ -import { CandyDate } from './candy-date'; +import { CandyDate } from './candy-date/candy-date'; import { isAllowedDate } from './util'; describe('util.ts coverage supplements', () => { diff --git a/components/date-picker/lib/util.ts b/components/date-picker/lib/util.ts index 7ba1c6c6f8c..2f0cb0101c0 100644 --- a/components/date-picker/lib/util.ts +++ b/components/date-picker/lib/util.ts @@ -1,5 +1,5 @@ import { DisabledDateFn, DisabledTimeConfig, DisabledTimeFn } from '../standard-types'; -import { CandyDate } from './candy-date'; +import { CandyDate } from './candy-date/candy-date'; const defaultDisabledTime: DisabledTimeConfig = { nzDisabledHours(): number[] { diff --git a/components/date-picker/lib/year/year-panel.component.ts b/components/date-picker/lib/year/year-panel.component.ts index 3ce1f1ec88c..aa935814180 100644 --- a/components/date-picker/lib/year/year-panel.component.ts +++ b/components/date-picker/lib/year/year-panel.component.ts @@ -9,8 +9,9 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzCalendarI18nInterface } from '../../../i18n/nz-i18n.interface'; -import { CandyDate } from '../candy-date'; +import { NzCalendarI18nInterface } from 'ng-zorro-antd/i18n'; + +import { CandyDate } from '../candy-date/candy-date'; const MAX_ROW = 4; const MAX_COL = 3; diff --git a/components/date-picker/month-picker.component.spec.ts b/components/date-picker/month-picker.component.spec.ts index e6256d12917..524fc11e3c0 100644 --- a/components/date-picker/month-picker.component.spec.ts +++ b/components/date-picker/month-picker.component.spec.ts @@ -6,11 +6,11 @@ import { fakeAsync, flush, inject, tick, ComponentFixture, TestBed } from '@angu import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - import isBefore from 'date-fns/is_before'; -import { dispatchMouseEvent } from '../core/testing'; -import { NGStyleInterface } from '../core/types/ng-class'; -import { NzInputModule } from '../input/nz-input.module'; + +import { dispatchMouseEvent, NGStyleInterface } from 'ng-zorro-antd/core'; +import { NzInputModule } from 'ng-zorro-antd/input'; + import { NzDatePickerModule } from './date-picker.module'; registerLocaleData(zh); diff --git a/components/date-picker/month-picker.component.ts b/components/date-picker/month-picker.component.ts index 3195ef89bad..728d5d25dff 100644 --- a/components/date-picker/month-picker.component.ts +++ b/components/date-picker/month-picker.component.ts @@ -12,10 +12,9 @@ import { } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; -import { DateHelperService } from '../i18n/date-helper.service'; import { HeaderPickerComponent, SupportHeaderPanel } from './header-picker.component'; @Component({ diff --git a/components/date-picker/package.json b/components/date-picker/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/date-picker/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/date-picker/picker.component.ts b/components/date-picker/picker.component.ts index d5581b7efd4..57ce668dcbd 100644 --- a/components/date-picker/picker.component.ts +++ b/components/date-picker/picker.component.ts @@ -18,9 +18,10 @@ import { ViewEncapsulation } from '@angular/core'; -import { slideMotion } from '../core/animation/slide'; -import { DateHelperService } from '../i18n/date-helper.service'; -import { CandyDate } from './lib/candy-date'; +import { slideMotion } from 'ng-zorro-antd/core'; +import { DateHelperService } from 'ng-zorro-antd/i18n'; + +import { CandyDate } from './lib/candy-date/candy-date'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/date-picker/public-api.ts b/components/date-picker/public-api.ts index b2172ccb67a..67d2c308771 100644 --- a/components/date-picker/public-api.ts +++ b/components/date-picker/public-api.ts @@ -1,4 +1,4 @@ -export { CandyDate } from './lib/candy-date'; +export { CandyDate } from './lib/candy-date/candy-date'; export { PickerResult, PickerResultSingle, PickerResultRange, PresetRanges, PanelMode } from './standard-types'; export { NzDatePickerModule } from './date-picker.module'; diff --git a/components/date-picker/range-picker.component.spec.ts b/components/date-picker/range-picker.component.spec.ts index 29ae3d2e136..5d802228d1b 100644 --- a/components/date-picker/range-picker.component.spec.ts +++ b/components/date-picker/range-picker.component.spec.ts @@ -9,10 +9,10 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import differenceInDays from 'date-fns/difference_in_days'; import isSameDay from 'date-fns/is_same_day'; -import { dispatchMouseEvent } from '../core/testing'; -import { NGStyleInterface } from '../core/types/ng-class'; +import { dispatchMouseEvent, NGStyleInterface } from 'ng-zorro-antd/core'; + import { NzDatePickerModule } from './date-picker.module'; -import { CandyDate } from './lib/candy-date'; +import { CandyDate } from './lib/candy-date/candy-date'; registerLocaleData(zh); diff --git a/components/date-picker/range-picker.component.ts b/components/date-picker/range-picker.component.ts index 6bbc471f4a1..945c789d8b5 100644 --- a/components/date-picker/range-picker.component.ts +++ b/components/date-picker/range-picker.component.ts @@ -11,10 +11,9 @@ import { } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; -import { DateHelperService } from '../i18n/date-helper.service'; import { DateRangePickerComponent } from './date-range-picker.component'; @Component({ diff --git a/components/date-picker/standard-types.ts b/components/date-picker/standard-types.ts index 9b2e0d7e811..de14fe47c93 100644 --- a/components/date-picker/standard-types.ts +++ b/components/date-picker/standard-types.ts @@ -1,6 +1,6 @@ import { TemplateRef } from '@angular/core'; -import { CandyDate } from './lib/candy-date'; +import { CandyDate } from './lib/candy-date/candy-date'; // The common result data format (the range-picker's props can be result as array) export interface PickerResultSingle { diff --git a/components/date-picker/style/entry.less b/components/date-picker/style/entry.less new file mode 100644 index 00000000000..f1e0d591676 --- /dev/null +++ b/components/date-picker/style/entry.less @@ -0,0 +1,6 @@ +@import './index.less'; +// style dependencies +// deps-lint-skip: input +@import '../../input/style/index.less'; +@import '../../time-picker/style/index.less'; +@import '../../tag/style/index.less'; diff --git a/components/date-picker/week-picker.component.spec.ts b/components/date-picker/week-picker.component.spec.ts index 2602fb17a82..d3019437c03 100644 --- a/components/date-picker/week-picker.component.spec.ts +++ b/components/date-picker/week-picker.component.spec.ts @@ -4,7 +4,7 @@ import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/cor import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NzDatePickerModule } from './date-picker.module'; describe('NzWeekPickerComponent', () => { diff --git a/components/date-picker/week-picker.component.ts b/components/date-picker/week-picker.component.ts index 53724449d5b..030f51e5c7e 100644 --- a/components/date-picker/week-picker.component.ts +++ b/components/date-picker/week-picker.component.ts @@ -11,10 +11,9 @@ import { } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; -import { DateHelperService } from '../i18n/date-helper.service'; import { DateRangePickerComponent } from './date-range-picker.component'; @Component({ diff --git a/components/date-picker/year-picker.component.spec.ts b/components/date-picker/year-picker.component.spec.ts index 18545546b7b..3dbf7cea34d 100644 --- a/components/date-picker/year-picker.component.spec.ts +++ b/components/date-picker/year-picker.component.spec.ts @@ -5,9 +5,9 @@ import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; -import { NGStyleInterface } from '../core/types/ng-class'; -import { NzInputModule } from '../input/nz-input.module'; +import { dispatchMouseEvent, NGStyleInterface } from 'ng-zorro-antd/core'; +import { NzInputModule } from 'ng-zorro-antd/input'; + import { NzDatePickerModule } from './date-picker.module'; describe('NzYearPickerComponent', () => { diff --git a/components/date-picker/year-picker.component.ts b/components/date-picker/year-picker.component.ts index ba467872898..0883a48528b 100644 --- a/components/date-picker/year-picker.component.ts +++ b/components/date-picker/year-picker.component.ts @@ -12,10 +12,9 @@ import { } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { DateHelperService, NzI18nService } from 'ng-zorro-antd/i18n'; -import { DateHelperService } from '../i18n/date-helper.service'; import { HeaderPickerComponent, SupportHeaderPanel } from './header-picker.component'; @Component({ diff --git a/components/divider/doc/index.en-US.md b/components/divider/doc/index.en-US.md index 6cbf33b5ad9..fafcd359394 100644 --- a/components/divider/doc/index.en-US.md +++ b/components/divider/doc/index.en-US.md @@ -13,7 +13,13 @@ A divider line separates different content. ## API -### Divider +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzDividerModule } from 'ng-zorro-antd'; +``` ### nz-divider diff --git a/components/divider/doc/index.zh-CN.md b/components/divider/doc/index.zh-CN.md index 50079b4e8ba..0c60148a7d7 100644 --- a/components/divider/doc/index.zh-CN.md +++ b/components/divider/doc/index.zh-CN.md @@ -14,6 +14,14 @@ subtitle: 分割线 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzDividerModule } from 'ng-zorro-antd'; +``` + ### nz-divider | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/divider/nz-divider.component.ts b/components/divider/nz-divider.component.ts index e0891c8a783..f04c41d1ca4 100644 --- a/components/divider/nz-divider.component.ts +++ b/components/divider/nz-divider.component.ts @@ -9,8 +9,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { InputBoolean } from '../core/util'; +import { InputBoolean, NzUpdateHostClassService } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-divider', diff --git a/components/divider/nz-divider.module.ts b/components/divider/nz-divider.module.ts index 4464a9af825..38274b555b7 100644 --- a/components/divider/nz-divider.module.ts +++ b/components/divider/nz-divider.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; import { NzDividerComponent } from './nz-divider.component'; @NgModule({ diff --git a/components/divider/package.json b/components/divider/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/divider/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/divider/style/entry.less b/components/divider/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/divider/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/drawer/doc/index.en-US.md b/components/drawer/doc/index.en-US.md index 822656cf93e..8d1172694dc 100755 --- a/components/drawer/doc/index.en-US.md +++ b/components/drawer/doc/index.en-US.md @@ -15,6 +15,14 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzDrawerModule } from 'ng-zorro-antd'; +``` + ### nz-drawer | Props | Description | Type | Default | diff --git a/components/drawer/doc/index.zh-CN.md b/components/drawer/doc/index.zh-CN.md index 81a8ef3b4d8..e4e79cffc28 100755 --- a/components/drawer/doc/index.zh-CN.md +++ b/components/drawer/doc/index.zh-CN.md @@ -16,6 +16,14 @@ title: Drawer ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzDrawerModule } from 'ng-zorro-antd'; +``` + ### nz-drawer | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/drawer/nz-drawer.component.ts b/components/drawer/nz-drawer.component.ts index ebbcdf9dd30..731d4a41c7b 100644 --- a/components/drawer/nz-drawer.component.ts +++ b/components/drawer/nz-drawer.component.ts @@ -27,7 +27,7 @@ import { CdkPortalOutlet, ComponentPortal, PortalInjector, TemplatePortal } from import { Observable, Subject } from 'rxjs'; -import { toCssPixel, InputBoolean } from '../core/util/convert'; +import { toCssPixel, InputBoolean } from 'ng-zorro-antd/core'; import { NzDrawerOptions, NzDrawerPlacement } from './nz-drawer-options'; import { NzDrawerRef } from './nz-drawer-ref'; diff --git a/components/drawer/nz-drawer.module.ts b/components/drawer/nz-drawer.module.ts index 844ab0082df..922bc129845 100644 --- a/components/drawer/nz-drawer.module.ts +++ b/components/drawer/nz-drawer.module.ts @@ -2,10 +2,9 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { PortalModule } from '@angular/cdk/portal'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; +import { NzAddOnModule, NzNoAnimationModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzDrawerComponent } from './nz-drawer.component'; import { NzDrawerService } from './nz-drawer.service'; diff --git a/components/drawer/package.json b/components/drawer/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/drawer/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/drawer/style/entry.less b/components/drawer/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/drawer/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/dropdown/doc/index.en-US.md b/components/dropdown/doc/index.en-US.md index c47d1639217..96bf846441c 100755 --- a/components/dropdown/doc/index.en-US.md +++ b/components/dropdown/doc/index.en-US.md @@ -12,6 +12,14 @@ If there are too many operations to display, you can wrap them in a `Dropdown`. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzDropDownModule } from 'ng-zorro-antd'; +``` + ### nz-dropdown > You should add `[nz-dropdown]` to the element that trigger dropdown diff --git a/components/dropdown/doc/index.zh-CN.md b/components/dropdown/doc/index.zh-CN.md index 024274496e8..7626b1fb3ee 100755 --- a/components/dropdown/doc/index.zh-CN.md +++ b/components/dropdown/doc/index.zh-CN.md @@ -13,6 +13,13 @@ title: Dropdown ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzDropDownModule } from 'ng-zorro-antd'; +``` ### nz-dropdown diff --git a/components/dropdown/nz-dropdown-button.component.ts b/components/dropdown/nz-dropdown-button.component.ts index 6d8381c43b6..866639e2cd7 100644 --- a/components/dropdown/nz-dropdown-button.component.ts +++ b/components/dropdown/nz-dropdown-button.component.ts @@ -5,18 +5,20 @@ import { Component, EventEmitter, Host, + Injector, Input, OnChanges, OnDestroy, Optional, Output, + Self, ViewChild, ViewEncapsulation } from '@angular/core'; -import { slideMotion } from '../core/animation/slide'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzDropDownComponent } from './nz-dropdown.component'; +import { slideMotion, NzDropdownHigherOrderServiceToken, NzNoAnimationDirective } from 'ng-zorro-antd/core'; + +import { menuServiceFactory, NzDropDownComponent } from './nz-dropdown.component'; import { NzDropDownDirective } from './nz-dropdown.directive'; import { NzMenuDropdownService } from './nz-menu-dropdown.service'; @@ -27,7 +29,14 @@ import { NzMenuDropdownService } from './nz-menu-dropdown.service'; animations: [slideMotion], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, - providers: [NzMenuDropdownService], + providers: [ + NzMenuDropdownService, + { + provide: NzDropdownHigherOrderServiceToken, + useFactory: menuServiceFactory, + deps: [[new Self(), Injector]] + } + ], templateUrl: './nz-dropdown-button.component.html', styles: [ ` diff --git a/components/dropdown/nz-dropdown-context.component.ts b/components/dropdown/nz-dropdown-context.component.ts index 80a8e3c19db..6b8a08cf031 100644 --- a/components/dropdown/nz-dropdown-context.component.ts +++ b/components/dropdown/nz-dropdown-context.component.ts @@ -9,7 +9,9 @@ import { } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; + +import { slideMotion } from 'ng-zorro-antd/core'; + import { NzDropdownService } from './nz-dropdown.service'; import { NzMenuDropdownService } from './nz-menu-dropdown.service'; diff --git a/components/dropdown/nz-dropdown.component.ts b/components/dropdown/nz-dropdown.component.ts index 5fc962ee307..79a8e5ad674 100644 --- a/components/dropdown/nz-dropdown.component.ts +++ b/components/dropdown/nz-dropdown.component.ts @@ -7,32 +7,53 @@ import { ContentChild, EventEmitter, Host, + Injector, Input, OnChanges, OnDestroy, Optional, Output, + Self, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core'; + import { combineLatest, merge, EMPTY, Observable, Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, map, mapTo, takeUntil } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { DEFAULT_DROPDOWN_POSITIONS, POSITION_MAP } from '../core/overlay/overlay-position'; -import { InputBoolean } from '../core/util/convert'; -import { NzMenuDirective } from '../menu/nz-menu.directive'; + +import { + slideMotion, + DEFAULT_DROPDOWN_POSITIONS, + InputBoolean, + NzDropdownHigherOrderServiceToken, + NzMenuBaseService, + NzNoAnimationDirective, + POSITION_MAP +} from 'ng-zorro-antd/core'; +import { NzMenuDirective } from 'ng-zorro-antd/menu'; + import { NzDropDownDirective } from './nz-dropdown.directive'; import { NzMenuDropdownService } from './nz-menu-dropdown.service'; export type NzPlacement = 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'; +export function menuServiceFactory(injector: Injector): NzMenuBaseService { + return injector.get(NzMenuDropdownService); +} + @Component({ selector: 'nz-dropdown', exportAs: 'nzDropdown', preserveWhitespaces: false, - providers: [NzMenuDropdownService], + providers: [ + NzMenuDropdownService, + { + provide: NzDropdownHigherOrderServiceToken, + useFactory: menuServiceFactory, + deps: [[new Self(), Injector]] + } + ], animations: [slideMotion], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/components/dropdown/nz-dropdown.module.ts b/components/dropdown/nz-dropdown.module.ts index f50ac6a4d24..745733e0b1e 100644 --- a/components/dropdown/nz-dropdown.module.ts +++ b/components/dropdown/nz-dropdown.module.ts @@ -3,17 +3,17 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzMenuModule } from 'ng-zorro-antd/menu'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzMenuModule } from '../menu/nz-menu.module'; import { NzDropDownADirective } from './nz-dropdown-a.directive'; import { NzDropDownButtonComponent } from './nz-dropdown-button.component'; import { NzDropdownContextComponent } from './nz-dropdown-context.component'; import { NzDropDownComponent } from './nz-dropdown.component'; import { NzDropDownDirective } from './nz-dropdown.directive'; +import { NzDropdownService } from './nz-dropdown.service'; @NgModule({ imports: [ @@ -34,6 +34,7 @@ import { NzDropDownDirective } from './nz-dropdown.directive'; NzDropDownADirective, NzDropdownContextComponent ], - exports: [NzDropDownComponent, NzDropDownButtonComponent, NzDropDownDirective, NzDropDownADirective] + exports: [NzMenuModule, NzDropDownComponent, NzDropDownButtonComponent, NzDropDownDirective, NzDropDownADirective], + providers: [NzDropdownService] }) export class NzDropDownModule {} diff --git a/components/dropdown/nz-dropdown.service.ts b/components/dropdown/nz-dropdown.service.ts index e9dd9286b6f..6b50ecdd162 100644 --- a/components/dropdown/nz-dropdown.service.ts +++ b/components/dropdown/nz-dropdown.service.ts @@ -12,9 +12,7 @@ import { fromEvent } from 'rxjs'; import { filter, take } from 'rxjs/operators'; import { NzDropdownContextComponent } from './nz-dropdown-context.component'; -@Injectable({ - providedIn: 'root' -}) +@Injectable() export class NzDropdownService { private overlayRef: OverlayRef | null; diff --git a/components/dropdown/nz-dropdown.spec.ts b/components/dropdown/nz-dropdown.spec.ts index 251479aeb64..6459ba27796 100644 --- a/components/dropdown/nz-dropdown.spec.ts +++ b/components/dropdown/nz-dropdown.spec.ts @@ -7,7 +7,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Subject } from 'rxjs'; -import { createMouseEvent, dispatchFakeEvent } from '../core/testing'; +import { createMouseEvent, dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzMenuModule } from '../menu/nz-menu.module'; import { NzSubMenuComponent } from '../menu/nz-submenu.component'; diff --git a/components/dropdown/nz-menu-dropdown.service.ts b/components/dropdown/nz-menu-dropdown.service.ts index 97395dddbac..83710e3a279 100644 --- a/components/dropdown/nz-menu-dropdown.service.ts +++ b/components/dropdown/nz-menu-dropdown.service.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core'; -import { NzMenuService } from '../menu/nz-menu.service'; + +import { NzMenuBaseService } from 'ng-zorro-antd/core'; @Injectable() -export class NzMenuDropdownService extends NzMenuService { +export class NzMenuDropdownService extends NzMenuBaseService { isInDropDown = true; } diff --git a/components/dropdown/package.json b/components/dropdown/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/dropdown/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/dropdown/public-api.ts b/components/dropdown/public-api.ts index 60a3b14f0ce..6c74e745e1d 100644 --- a/components/dropdown/public-api.ts +++ b/components/dropdown/public-api.ts @@ -4,3 +4,5 @@ export * from './nz-dropdown.directive'; export * from './nz-dropdown.service'; export * from './nz-dropdown-button.component'; export * from './nz-dropdown.module'; +export * from './nz-menu-dropdown.service'; +export * from './nz-dropdown-a.directive'; diff --git a/components/dropdown/style/entry.less b/components/dropdown/style/entry.less new file mode 100644 index 00000000000..6dca35ba9f8 --- /dev/null +++ b/components/dropdown/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +@import './patch.less'; +// style dependencies +@import '../../button/style/index.less'; diff --git a/components/dropdown/style/patch.less b/components/dropdown/style/patch.less new file mode 100644 index 00000000000..a8d92282009 --- /dev/null +++ b/components/dropdown/style/patch.less @@ -0,0 +1,7 @@ +.ant-dropdown-menu { + & > ul { + list-style: none; + margin: 0; + padding: 0; + } +} diff --git a/components/empty/doc/index.en-US.md b/components/empty/doc/index.en-US.md index 4bc3febadd6..dc301a363fd 100644 --- a/components/empty/doc/index.en-US.md +++ b/components/empty/doc/index.en-US.md @@ -13,6 +13,14 @@ When there is no data provided, display for friendly tips. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzEmptyModule } from 'ng-zorro-antd'; +``` + ### nz-empty | Property | Description | Type | Default | diff --git a/components/empty/doc/index.zh-CN.md b/components/empty/doc/index.zh-CN.md index c854b47f3e0..6490270cecb 100644 --- a/components/empty/doc/index.zh-CN.md +++ b/components/empty/doc/index.zh-CN.md @@ -14,6 +14,14 @@ cols: 1 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzEmptyModule } from 'ng-zorro-antd'; +``` + ### nz-empty | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/empty/nz-empty.component.ts b/components/empty/nz-empty.component.ts index de3c73a7eae..c629bc91133 100644 --- a/components/empty/nz-empty.component.ts +++ b/components/empty/nz-empty.component.ts @@ -13,7 +13,8 @@ import { import { DomSanitizer } from '@angular/platform-browser'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { NzI18nService } from 'ng-zorro-antd/i18n'; import { emptyImage } from './nz-empty-config'; diff --git a/components/empty/nz-empty.module.ts b/components/empty/nz-empty.module.ts index fa05eee8113..662024e8ab8 100644 --- a/components/empty/nz-empty.module.ts +++ b/components/empty/nz-empty.module.ts @@ -1,8 +1,10 @@ import { PortalModule } from '@angular/cdk/portal'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; + +import { NzI18nModule } from 'ng-zorro-antd/i18n'; + import { NzEmbedEmptyComponent } from './nz-embed-empty.component'; import { NzEmptyComponent } from './nz-empty.component'; diff --git a/components/empty/package.json b/components/empty/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/empty/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/empty/style/entry.less b/components/empty/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/empty/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/form/doc/index.en-US.md b/components/form/doc/index.en-US.md index f86dd42fabf..531589d48ef 100644 --- a/components/form/doc/index.en-US.md +++ b/components/form/doc/index.en-US.md @@ -45,6 +45,14 @@ A form consists of one or more form fields whose type includes input, textarea, ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzFormModule } from 'ng-zorro-antd'; +``` + ### nz-form diff --git a/components/form/doc/index.zh-CN.md b/components/form/doc/index.zh-CN.md index 8a8339f03e3..5f31ad2981b 100644 --- a/components/form/doc/index.zh-CN.md +++ b/components/form/doc/index.zh-CN.md @@ -44,6 +44,14 @@ title: Form ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzFormModule } from 'ng-zorro-antd'; +``` + ### nz-form | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/form/nz-form-control.component.ts b/components/form/nz-form-control.component.ts index 864ec04aa14..a114bdb5671 100644 --- a/components/form/nz-form-control.component.ts +++ b/components/form/nz-form-control.component.ts @@ -17,11 +17,10 @@ import { import { FormControl, FormControlName, NgControl } from '@angular/forms'; import { Subscription } from 'rxjs'; import { startWith } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NgClassType } from '../core/types/ng-class'; -import { toBoolean } from '../core/util/convert'; -import { NzColDirective } from '../grid/nz-col.directive'; -import { NzRowDirective } from '../grid/nz-row.directive'; + +import { toBoolean, NgClassType, NzUpdateHostClassService } from 'ng-zorro-antd/core'; +import { NzColDirective, NzRowDirective } from 'ng-zorro-antd/grid'; + import { NzFormItemComponent } from './nz-form-item.component'; @Component({ diff --git a/components/form/nz-form-explain.component.ts b/components/form/nz-form-explain.component.ts index e3a6ffdcfec..687bf362675 100644 --- a/components/form/nz-form-explain.component.ts +++ b/components/form/nz-form-explain.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewEncapsulation } from '@angular/core'; -import { helpMotion } from '../core/animation/help'; +import { helpMotion } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-form-explain', diff --git a/components/form/nz-form-item.component.ts b/components/form/nz-form-item.component.ts index febb38b7d25..6aff9460c28 100644 --- a/components/form/nz-form-item.component.ts +++ b/components/form/nz-form-item.component.ts @@ -15,9 +15,10 @@ import { ViewEncapsulation } from '@angular/core'; import { takeUntil } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { toBoolean } from '../core/util/convert'; -import { NzRowDirective } from '../grid/nz-row.directive'; + +import { toBoolean, NzUpdateHostClassService } from 'ng-zorro-antd/core'; +import { NzRowDirective } from 'ng-zorro-antd/grid'; + import { NzFormExplainComponent } from './nz-form-explain.component'; /** should add nz-row directive to host, track https://github.com/angular/angular/issues/8785 **/ diff --git a/components/form/nz-form-label.component.ts b/components/form/nz-form-label.component.ts index 592207b4d78..cb69840f290 100644 --- a/components/form/nz-form-label.component.ts +++ b/components/form/nz-form-label.component.ts @@ -10,10 +10,10 @@ import { Renderer2, ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { InputBoolean } from '../core/util/convert'; -import { NzColDirective } from '../grid/nz-col.directive'; -import { NzRowDirective } from '../grid/nz-row.directive'; + +import { InputBoolean, NzUpdateHostClassService } from 'ng-zorro-antd/core'; +import { NzColDirective, NzRowDirective } from 'ng-zorro-antd/grid'; + import { NzFormItemComponent } from './nz-form-item.component'; @Component({ diff --git a/components/form/nz-form.directive.ts b/components/form/nz-form.directive.ts index 0aef8d0bdd8..dda33d3bb1a 100644 --- a/components/form/nz-form.directive.ts +++ b/components/form/nz-form.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, Input, OnChanges, OnInit, Renderer2 } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; +import { NzUpdateHostClassService } from 'ng-zorro-antd/core'; @Directive({ selector: '[nz-form]', diff --git a/components/form/nz-form.module.ts b/components/form/nz-form.module.ts index 8720fdc6471..b060e576190 100644 --- a/components/form/nz-form.module.ts +++ b/components/form/nz-form.module.ts @@ -1,10 +1,11 @@ +import { LayoutModule } from '@angular/cdk/layout'; +import { PlatformModule } from '@angular/cdk/platform'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { LayoutModule } from '@angular/cdk/layout'; -import { PlatformModule } from '@angular/cdk/platform'; -import { NzGridModule } from '../grid/nz-grid.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzGridModule } from 'ng-zorro-antd/grid'; +import { NzIconModule } from 'ng-zorro-antd/icon'; + import { NzFormControlComponent } from './nz-form-control.component'; import { NzFormExplainComponent } from './nz-form-explain.component'; import { NzFormExtraComponent } from './nz-form-extra.component'; diff --git a/components/form/package.json b/components/form/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/form/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/form/style/entry.less b/components/form/style/entry.less new file mode 100644 index 00000000000..116a9e08e68 --- /dev/null +++ b/components/form/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../grid/style/index.less'; diff --git a/components/grid/doc/index.en-US.md b/components/grid/doc/index.en-US.md index b76b6a0a9ab..2331d665a44 100755 --- a/components/grid/doc/index.en-US.md +++ b/components/grid/doc/index.en-US.md @@ -81,6 +81,14 @@ Flex layout uses a 24 grid layout to define the width of each "box", but does no ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzGridModule } from 'ng-zorro-antd'; +``` + ### [nz-row] | Property | Description | Type | Default | diff --git a/components/grid/doc/index.zh-CN.md b/components/grid/doc/index.zh-CN.md index 3cfb022721a..d3c9c627cf6 100755 --- a/components/grid/doc/index.zh-CN.md +++ b/components/grid/doc/index.zh-CN.md @@ -80,6 +80,14 @@ Flex 布局是基于 24 栅格来定义每一个『盒子』的宽度,但排 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzGridModule } from 'ng-zorro-antd'; +``` + ### [nz-row] | 成员 | 说明 | 类型 | 默认值 | diff --git a/components/grid/nz-col.directive.ts b/components/grid/nz-col.directive.ts index 55f0e895007..16e2cb74ff2 100644 --- a/components/grid/nz-col.directive.ts +++ b/components/grid/nz-col.directive.ts @@ -13,9 +13,7 @@ import { import { Subject } from 'rxjs'; import { startWith, takeUntil } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NgClassInterface } from '../core/types/ng-class'; -import { isNotNil } from '../core/util/check'; +import { isNotNil, NgClassInterface, NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { NzRowDirective } from './nz-row.directive'; diff --git a/components/grid/nz-row.directive.ts b/components/grid/nz-row.directive.ts index 7331dd132b9..45091b3ecaf 100644 --- a/components/grid/nz-row.directive.ts +++ b/components/grid/nz-row.directive.ts @@ -15,8 +15,8 @@ import { MediaMatcher } from '@angular/cdk/layout'; import { Platform } from '@angular/cdk/platform'; import { fromEvent, Subject } from 'rxjs'; import { auditTime, takeUntil } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { IndexableObject } from '../core/types/indexable'; + +import { IndexableObject, NzUpdateHostClassService } from 'ng-zorro-antd/core'; export type NzJustify = 'start' | 'end' | 'center' | 'space-around' | 'space-between'; export type NzAlign = 'top' | 'middle' | 'bottom'; diff --git a/components/grid/package.json b/components/grid/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/grid/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/grid/style/entry.less b/components/grid/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/grid/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/i18n/date-config.ts b/components/i18n/date-config.ts index 36dee32ef09..aaac9167211 100644 --- a/components/i18n/date-config.ts +++ b/components/i18n/date-config.ts @@ -10,8 +10,6 @@ export function mergeDateConfig(config: NzDateConfig): NzDateConfig { return { ...NZ_DATE_CONFIG_DEFAULT, ...config }; } -//////////// - export interface NzDateConfig { /** Customize the first day of a week */ firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6; diff --git a/components/i18n/nz-i18n.module.ts b/components/i18n/nz-i18n.module.ts index 3484256fa46..04521a1811b 100644 --- a/components/i18n/nz-i18n.module.ts +++ b/components/i18n/nz-i18n.module.ts @@ -1,15 +1,14 @@ import { DatePipe } from '@angular/common'; import { NgModule } from '@angular/core'; -import { LoggerModule } from '../core/util/logger/logger.module'; +import { LoggerModule } from 'ng-zorro-antd/core'; import { NzI18nPipe } from './nz-i18n.pipe'; -import { NZ_DATE_LOCALE, NZ_I18N } from './nz-i18n.token'; @NgModule({ imports: [LoggerModule], declarations: [NzI18nPipe], exports: [NzI18nPipe], - providers: [DatePipe, { provide: NZ_I18N, useValue: null }, { provide: NZ_DATE_LOCALE, useValue: null }] + providers: [DatePipe] }) export class NzI18nModule {} diff --git a/components/i18n/nz-i18n.service.ts b/components/i18n/nz-i18n.service.ts index 2f2c795b669..33c97fafa60 100644 --- a/components/i18n/nz-i18n.service.ts +++ b/components/i18n/nz-i18n.service.ts @@ -1,6 +1,7 @@ -import { Inject, Injectable } from '@angular/core'; +import { Inject, Injectable, Optional } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { IndexableObject } from '../core/types/indexable'; + +import { IndexableObject } from 'ng-zorro-antd/core'; import zh_CN from './languages/zh_CN'; import { DateLocale, NzI18nInterface } from './nz-i18n.interface'; @@ -18,7 +19,10 @@ export class NzI18nService { return this._change.asObservable(); } - constructor(@Inject(NZ_I18N) locale: NzI18nInterface, @Inject(NZ_DATE_LOCALE) dateLocale: DateLocale) { + constructor( + @Optional() @Inject(NZ_I18N) locale: NzI18nInterface, + @Optional() @Inject(NZ_DATE_LOCALE) dateLocale: DateLocale + ) { this.setLocale(locale || zh_CN); this.setDateLocale(dateLocale || null); } diff --git a/components/i18n/package.json b/components/i18n/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/i18n/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/i18n/public-api.ts b/components/i18n/public-api.ts index e7f0fcc885e..e9b108fc809 100644 --- a/components/i18n/public-api.ts +++ b/components/i18n/public-api.ts @@ -1,10 +1,10 @@ export { NzI18nModule } from './nz-i18n.module'; export { NzI18nService } from './nz-i18n.service'; export { NZ_DATE_CONFIG, NzDateConfig } from './date-config'; -export { DateHelperService } from './date-helper.service'; - export * from './nz-i18n.interface'; export * from './nz-i18n.token'; +export * from './date-helper.service'; +export * from './nz-i18n.pipe'; export { default as ar_EG } from './languages/ar_EG'; export { default as bg_BG } from './languages/bg_BG'; diff --git a/components/icon/doc/index.en-US.md b/components/icon/doc/index.en-US.md index a4972d156d9..58a6cbfa153 100755 --- a/components/icon/doc/index.en-US.md +++ b/components/icon/doc/index.en-US.md @@ -20,6 +20,14 @@ We are still adding two-tone icons right now, syncing to [antd](https://ant.desi ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzIconModule } from 'ng-zorro-antd'; +``` + ### [nz-icon] | Property | Description | Type | Default | diff --git a/components/icon/doc/index.zh-CN.md b/components/icon/doc/index.zh-CN.md index ac354cad617..c3589311481 100755 --- a/components/icon/doc/index.zh-CN.md +++ b/components/icon/doc/index.zh-CN.md @@ -21,6 +21,14 @@ hasPageDemo: true ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzIconModule } from 'ng-zorro-antd'; +``` + ### [nz-icon] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/icon/nz-icon.directive.ts b/components/icon/nz-icon.directive.ts index 7d6d7da1256..7d88165f4fe 100644 --- a/components/icon/nz-icon.directive.ts +++ b/components/icon/nz-icon.directive.ts @@ -10,7 +10,7 @@ import { SimpleChanges } from '@angular/core'; import { IconDirective, ThemeType } from '@ant-design/icons-angular'; -import { InputBoolean } from '../core/util'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { NzIconService } from './nz-icon.service'; const iconTypeRE = /^anticon\-\w/; diff --git a/components/icon/package.json b/components/icon/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/icon/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/icon/page/index.ts b/components/icon/page/index.ts index b882782d1fc..dfec56b01f1 100644 --- a/components/icon/page/index.ts +++ b/components/icon/page/index.ts @@ -2,7 +2,8 @@ import { DOCUMENT } from '@angular/common'; import { Component, Inject, OnInit } from '@angular/core'; import { manifest } from '@ant-design/icons-angular'; import { AccountBookFill } from '@ant-design/icons-angular/icons'; -import { NzIconService } from 'ng-zorro-antd'; + +import { NzIconService } from 'ng-zorro-antd/icon'; const categories: { [key: string]: string[] } = { direction: [ diff --git a/components/icon/style/entry.less b/components/icon/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/icon/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/icon/style/index.less b/components/icon/style/index.less new file mode 100644 index 00000000000..373c41968cd --- /dev/null +++ b/components/icon/style/index.less @@ -0,0 +1,4 @@ +@import '../../style/themes/default'; +@import '../../style/mixins/index'; + +@icon-prefix-cls: ~'@{ant-prefix}-icon'; diff --git a/components/input-number/doc/index.en-US.md b/components/input-number/doc/index.en-US.md index 62b223304a0..21eea3cb934 100755 --- a/components/input-number/doc/index.en-US.md +++ b/components/input-number/doc/index.en-US.md @@ -14,6 +14,14 @@ When a numeric value needs to be provided. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzInputNumberModule } from 'ng-zorro-antd'; +``` + ### nz-input-number | property | description | type | default | diff --git a/components/input-number/doc/index.zh-CN.md b/components/input-number/doc/index.zh-CN.md index 79498b38e8e..0759fb1ded7 100755 --- a/components/input-number/doc/index.zh-CN.md +++ b/components/input-number/doc/index.zh-CN.md @@ -17,6 +17,14 @@ title: InputNumber 属性如下 +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzInputNumberModule } from 'ng-zorro-antd'; +``` + ### nz-input-number | 成员 | 说明 | 类型 | 默认值 | diff --git a/components/input-number/nz-input-number.component.ts b/components/input-number/nz-input-number.component.ts index d3aa81151f4..95541265913 100644 --- a/components/input-number/nz-input-number.component.ts +++ b/components/input-number/nz-input-number.component.ts @@ -19,10 +19,8 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzSizeLDSType } from '../core/types/size'; -import { isNotNil } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; +import { isNotNil, InputBoolean, NzSizeLDSType } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-input-number', diff --git a/components/input-number/nz-input-number.module.ts b/components/input-number/nz-input-number.module.ts index 216e5b656b2..cc0af3866fd 100644 --- a/components/input-number/nz-input-number.module.ts +++ b/components/input-number/nz-input-number.module.ts @@ -1,7 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzInputNumberComponent } from './nz-input-number.component'; diff --git a/components/input-number/nz-input-number.spec.ts b/components/input-number/nz-input-number.spec.ts index a4eb5668c5f..9a0abb6640c 100644 --- a/components/input-number/nz-input-number.spec.ts +++ b/components/input-number/nz-input-number.spec.ts @@ -3,7 +3,7 @@ import { fakeAsync, flush, tick, ComponentFixture, TestBed } from '@angular/core import { FormsModule, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchEvent, dispatchFakeEvent } from '../core/testing'; +import { dispatchEvent, dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzInputNumberComponent } from './nz-input-number.component'; import { NzInputNumberModule } from './nz-input-number.module'; diff --git a/components/input-number/package.json b/components/input-number/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/input-number/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/input-number/style/entry.less b/components/input-number/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/input-number/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/input/doc/index.en-US.md b/components/input/doc/index.en-US.md index 8e1d6d7c42c..c7fadac4337 100755 --- a/components/input/doc/index.en-US.md +++ b/components/input/doc/index.en-US.md @@ -14,6 +14,14 @@ Keyboard and mouse can be used for providing or changing data. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzInputModule } from 'ng-zorro-antd'; +``` + ### [nz-input] All props of input supported by [w3c standards](https://www.w3schools.com/tags/tag_input.asp) and Angular can used in `nz-input`. diff --git a/components/input/doc/index.zh-CN.md b/components/input/doc/index.zh-CN.md index 3698feb5299..de0423ddca7 100755 --- a/components/input/doc/index.zh-CN.md +++ b/components/input/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Input ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzInputModule } from 'ng-zorro-antd'; +``` + ### [nz-input] nz-input 可以使用所有的W3C标准下的所有 [使用方式](https://www.w3schools.com/tags/tag_input.asp) 和 Angular对 input 的全部额外功能支持。 diff --git a/components/input/nz-autosize.spec.ts b/components/input/nz-autosize.spec.ts index dfea91ed308..01cd07e37a8 100644 --- a/components/input/nz-autosize.spec.ts +++ b/components/input/nz-autosize.spec.ts @@ -2,7 +2,7 @@ import { Component, ViewEncapsulation } from '@angular/core'; import { async, fakeAsync, flush, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchFakeEvent } from '../core/testing'; +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzAutosizeDirective } from './nz-autosize.directive'; import { NzInputModule } from './nz-input.module'; diff --git a/components/input/nz-input-group.component.ts b/components/input/nz-input-group.component.ts index 82c2040b0b3..97518432c56 100644 --- a/components/input/nz-input-group.component.ts +++ b/components/input/nz-input-group.component.ts @@ -8,9 +8,7 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { NgClassType } from '../core/types/ng-class'; -import { NzSizeLDSType } from '../core/types/size'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean, NgClassType, NzSizeLDSType } from 'ng-zorro-antd/core'; import { NzInputDirective } from './nz-input.directive'; @Component({ diff --git a/components/input/nz-input.directive.ts b/components/input/nz-input.directive.ts index c95f4bb800b..b495b72e7f5 100644 --- a/components/input/nz-input.directive.ts +++ b/components/input/nz-input.directive.ts @@ -1,7 +1,6 @@ import { Directive, ElementRef, Input, Optional, Renderer2, Self } from '@angular/core'; import { NgControl } from '@angular/forms'; -import { NzSizeLDSType } from '../core/types/size'; -import { toBoolean } from '../core/util/convert'; +import { toBoolean, NzSizeLDSType } from 'ng-zorro-antd/core'; @Directive({ selector: '[nz-input]', diff --git a/components/input/nz-input.module.ts b/components/input/nz-input.module.ts index fd5a8bb4a7d..269973739ac 100644 --- a/components/input/nz-input.module.ts +++ b/components/input/nz-input.module.ts @@ -1,9 +1,9 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzAddOnModule } from '../core/addon/addon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { PlatformModule } from '@angular/cdk/platform'; import { NzAutosizeDirective } from './nz-autosize.directive'; diff --git a/components/input/package.json b/components/input/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/input/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/input/public-api.ts b/components/input/public-api.ts index 48d3cefc594..8d9299bf82f 100644 --- a/components/input/public-api.ts +++ b/components/input/public-api.ts @@ -2,3 +2,4 @@ export * from './nz-input-group.component'; export * from './nz-input.module'; export * from './nz-input-group.component'; export * from './nz-input.directive'; +export * from './nz-autosize.directive'; diff --git a/components/input/style/entry.less b/components/input/style/entry.less new file mode 100644 index 00000000000..8d6c97e9eb9 --- /dev/null +++ b/components/input/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../button/style/index.less'; diff --git a/components/layout/doc/index.en-US.md b/components/layout/doc/index.en-US.md index 23dc560d73c..aadbccab300 100755 --- a/components/layout/doc/index.en-US.md +++ b/components/layout/doc/index.en-US.md @@ -69,6 +69,14 @@ The first level navigation is inclined left near a logo, and the secondary menu ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzLayoutModule } from 'ng-zorro-antd'; +``` + ### nz-sider The sidebar. diff --git a/components/layout/doc/index.zh-CN.md b/components/layout/doc/index.zh-CN.md index df6748b1b6f..a3b149163aa 100755 --- a/components/layout/doc/index.zh-CN.md +++ b/components/layout/doc/index.zh-CN.md @@ -70,6 +70,14 @@ title: Layout ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzLayoutModule } from 'ng-zorro-antd'; +``` + ### nz-sider 侧边栏。 diff --git a/components/layout/nz-layout.module.ts b/components/layout/nz-layout.module.ts index 2b00dcc2a70..f64e9eff17d 100644 --- a/components/layout/nz-layout.module.ts +++ b/components/layout/nz-layout.module.ts @@ -2,7 +2,8 @@ import { LayoutModule } from '@angular/cdk/layout'; import { PlatformModule } from '@angular/cdk/platform'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzContentComponent } from './nz-content.component'; import { NzFooterComponent } from './nz-footer.component'; diff --git a/components/layout/nz-sider.component.ts b/components/layout/nz-sider.component.ts index be68f9778ac..74e529a46fb 100644 --- a/components/layout/nz-sider.component.ts +++ b/components/layout/nz-sider.component.ts @@ -22,7 +22,9 @@ import { MediaMatcher } from '@angular/cdk/layout'; import { Platform } from '@angular/cdk/platform'; import { fromEvent, Subject } from 'rxjs'; import { auditTime, takeUntil } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; + +import { InputBoolean } from 'ng-zorro-antd/core'; + import { NzLayoutComponent } from './nz-layout.component'; export type NzBreakPoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; diff --git a/components/layout/package.json b/components/layout/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/layout/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/layout/style/entry.less b/components/layout/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/layout/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/list/doc/index.en-US.md b/components/list/doc/index.en-US.md index b0e693710dd..afaa9ff7384 100644 --- a/components/list/doc/index.en-US.md +++ b/components/list/doc/index.en-US.md @@ -13,6 +13,14 @@ A list can be used to display content related to a single subject. The content c ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzListModule } from 'ng-zorro-antd'; +``` + ### nz-list | Property | Description | Type | Default diff --git a/components/list/doc/index.zh-CN.md b/components/list/doc/index.zh-CN.md index 8a24d19c75e..32f7034a189 100644 --- a/components/list/doc/index.zh-CN.md +++ b/components/list/doc/index.zh-CN.md @@ -14,6 +14,14 @@ cols: 1 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzListModule } from 'ng-zorro-antd'; +``` + ### nz-list | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/list/nz-list.component.ts b/components/list/nz-list.component.ts index 3e8cdddb719..c709fb7c094 100644 --- a/components/list/nz-list.component.ts +++ b/components/list/nz-list.component.ts @@ -9,9 +9,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzSizeLDSType } from '../core/types/size'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean, NzSizeLDSType, NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { NzListGrid } from './interface'; diff --git a/components/list/nz-list.module.ts b/components/list/nz-list.module.ts index d81584191b1..f64ffc28524 100644 --- a/components/list/nz-list.module.ts +++ b/components/list/nz-list.module.ts @@ -1,11 +1,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAvatarModule } from '../avatar/nz-avatar.module'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzEmptyModule } from '../empty/nz-empty.module'; -import { NzGridModule } from '../grid/nz-grid.module'; -import { NzSpinModule } from '../spin/nz-spin.module'; +import { NzAvatarModule } from 'ng-zorro-antd/avatar'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzGridModule } from 'ng-zorro-antd/grid'; +import { NzSpinModule } from 'ng-zorro-antd/spin'; import { NzListItemMetaComponent } from './nz-list-item-meta.component'; import { NzListItemComponent } from './nz-list-item.component'; diff --git a/components/list/package.json b/components/list/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/list/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/list/style/entry.less b/components/list/style/entry.less new file mode 100644 index 00000000000..7b9c9a53bff --- /dev/null +++ b/components/list/style/entry.less @@ -0,0 +1,5 @@ +@import './index.less'; +@import '../../empty/style/index.less'; +@import '../../spin/style/index.less'; +@import '../../pagination/style/index.less'; +@import '../../grid/style/index.less'; diff --git a/components/mention/doc/index.en-US.md b/components/mention/doc/index.en-US.md index 37c7f440e14..0dc05d8eef1 100644 --- a/components/mention/doc/index.en-US.md +++ b/components/mention/doc/index.en-US.md @@ -22,6 +22,14 @@ When need to mention someone or something. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzMentionModule } from 'ng-zorro-antd'; +``` + ### nz-mention | Property | Description | Type | Default | diff --git a/components/mention/doc/index.zh-CN.md b/components/mention/doc/index.zh-CN.md index 1b88d96248b..32c47a2fcae 100644 --- a/components/mention/doc/index.zh-CN.md +++ b/components/mention/doc/index.zh-CN.md @@ -23,6 +23,14 @@ title: Mention ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzMentionModule } from 'ng-zorro-antd'; +``` + ### nz-mention | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/mention/nz-mention.component.ts b/components/mention/nz-mention.component.ts index 220d9986bc5..91c10ed3770 100644 --- a/components/mention/nz-mention.component.ts +++ b/components/mention/nz-mention.component.ts @@ -30,10 +30,7 @@ import { } from '@angular/core'; import { fromEvent, merge, Subscription } from 'rxjs'; -import { DEFAULT_MENTION_POSITIONS } from '../core/overlay/overlay-position'; -import { InputBoolean } from '../core/util'; -import { getMentions } from '../core/util/getMentions'; -import { getCaretCoordinates } from '../core/util/textarea-caret-position'; +import { getCaretCoordinates, getMentions, DEFAULT_MENTION_POSITIONS, InputBoolean } from 'ng-zorro-antd/core'; import { NzMentionSuggestionDirective } from './nz-mention-suggestions'; import { NzMentionTriggerDirective } from './nz-mention-trigger'; diff --git a/components/mention/nz-mention.module.ts b/components/mention/nz-mention.module.ts index aee52e501f2..df71d286775 100644 --- a/components/mention/nz-mention.module.ts +++ b/components/mention/nz-mention.module.ts @@ -2,7 +2,7 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzMentionSuggestionDirective } from './nz-mention-suggestions'; import { NzMentionTriggerDirective } from './nz-mention-trigger'; import { NzMentionComponent } from './nz-mention.component'; diff --git a/components/mention/nz-mention.spec.ts b/components/mention/nz-mention.spec.ts index 53c20922322..1c5b1adc9a3 100644 --- a/components/mention/nz-mention.spec.ts +++ b/components/mention/nz-mention.spec.ts @@ -15,7 +15,7 @@ import { dispatchKeyboardEvent, typeInElement, MockNgZone -} from '../core/testing'; +} from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzInputModule } from '../input'; diff --git a/components/mention/package.json b/components/mention/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/mention/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/mention/style/entry.less b/components/mention/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/mention/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/menu/doc/index.en-US.md b/components/menu/doc/index.en-US.md index 8c88e1da3f9..45f1ded53fe 100755 --- a/components/menu/doc/index.en-US.md +++ b/components/menu/doc/index.en-US.md @@ -27,6 +27,14 @@ More layouts with navigation: [layout](/components/layout/en). ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzMenuModule } from 'ng-zorro-antd'; +``` + ### [nz-menu] | Param | Description | Type | Default value | diff --git a/components/menu/doc/index.zh-CN.md b/components/menu/doc/index.zh-CN.md index 4e86568c6c6..4cd3390141b 100755 --- a/components/menu/doc/index.zh-CN.md +++ b/components/menu/doc/index.zh-CN.md @@ -28,6 +28,14 @@ subtitle: 导航菜单 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzMenuModule } from 'ng-zorro-antd'; +``` + ### [nz-menu] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/menu/nz-menu-item.directive.ts b/components/menu/nz-menu-item.directive.ts index 1b69187b10a..92f227c1f9c 100644 --- a/components/menu/nz-menu-item.directive.ts +++ b/components/menu/nz-menu-item.directive.ts @@ -9,13 +9,12 @@ import { Renderer2, SimpleChanges } from '@angular/core'; + import { merge, EMPTY, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { isNotNil } from '../core/util'; -import { InputBoolean } from '../core/util/convert'; -import { NzMenuService } from './nz-menu.service'; +import { isNotNil, InputBoolean, NzMenuBaseService, NzUpdateHostClassService } from 'ng-zorro-antd/core'; + import { NzSubmenuService } from './nz-submenu.service'; @Directive({ @@ -65,7 +64,7 @@ export class NzMenuItemDirective implements OnInit, OnChanges, OnDestroy { constructor( private nzUpdateHostClassService: NzUpdateHostClassService, - private nzMenuService: NzMenuService, + private nzMenuService: NzMenuBaseService, @Optional() private nzSubmenuService: NzSubmenuService, private renderer: Renderer2, private elementRef: ElementRef diff --git a/components/menu/nz-menu-menu.service.ts b/components/menu/nz-menu-menu.service.ts deleted file mode 100644 index 42024d3bc0f..00000000000 --- a/components/menu/nz-menu-menu.service.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Injectable } from '@angular/core'; -import { NzMenuService } from './nz-menu.service'; - -@Injectable() -export class NzMenuMenuService extends NzMenuService { - isInDropDown = false; -} diff --git a/components/menu/nz-menu.directive.ts b/components/menu/nz-menu.directive.ts index 76982058822..afde1823e93 100644 --- a/components/menu/nz-menu.directive.ts +++ b/components/menu/nz-menu.directive.ts @@ -14,31 +14,33 @@ import { SimpleChanges, SkipSelf } from '@angular/core'; + import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzDirectionVHIType } from '../core/types/direction'; -import { InputBoolean } from '../core/util/convert'; -import { NzMenuDropdownService } from '../dropdown/nz-menu-dropdown.service'; + +import { + InputBoolean, + NzDirectionVHIType, + NzDropdownHigherOrderServiceToken, + NzMenuBaseService, + NzUpdateHostClassService +} from 'ng-zorro-antd/core'; + import { NzMenuItemDirective } from './nz-menu-item.directive'; -import { NzMenuMenuService } from './nz-menu-menu.service'; +import { NzMenuServiceFactory } from './nz-menu.resolver'; import { NzMenuService } from './nz-menu.service'; import { NzSubMenuComponent } from './nz-submenu.component'; -export function NzMenuFactory(dropService: NzMenuDropdownService, menuService: NzMenuMenuService): NzMenuService { - return dropService ? dropService : menuService; -} - @Directive({ selector: '[nz-menu]', exportAs: 'nzMenu', providers: [ NzUpdateHostClassService, - NzMenuMenuService, + NzMenuService, { - provide: NzMenuService, - useFactory: NzMenuFactory, - deps: [[new SkipSelf(), new Optional(), NzMenuDropdownService], NzMenuMenuService] + provide: NzMenuBaseService, + useFactory: NzMenuServiceFactory, + deps: [[new SkipSelf(), new Optional(), NzDropdownHigherOrderServiceToken], NzMenuService] } ] }) @@ -86,7 +88,7 @@ export class NzMenuDirective implements AfterContentInit, OnInit, OnChanges, OnD constructor( public elementRef: ElementRef, - private nzMenuService: NzMenuService, + private nzMenuService: NzMenuBaseService, private nzUpdateHostClassService: NzUpdateHostClassService ) {} diff --git a/components/menu/nz-menu.module.ts b/components/menu/nz-menu.module.ts index 363dad81965..8b170e309aa 100644 --- a/components/menu/nz-menu.module.ts +++ b/components/menu/nz-menu.module.ts @@ -3,15 +3,15 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzNoAnimationModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzMenuDividerDirective } from '../menu/nz-menu-divider.directive'; -import { NzMenuGroupComponent } from '../menu/nz-menu-group.component'; -import { NzMenuItemDirective } from '../menu/nz-menu-item.directive'; -import { NzMenuDirective } from '../menu/nz-menu.directive'; -import { NzSubMenuComponent } from '../menu/nz-submenu.component'; +import { NzMenuDividerDirective } from './nz-menu-divider.directive'; +import { NzMenuGroupComponent } from './nz-menu-group.component'; +import { NzMenuItemDirective } from './nz-menu-item.directive'; +import { NzMenuDirective } from './nz-menu.directive'; +import { NzSubMenuComponent } from './nz-submenu.component'; @NgModule({ imports: [CommonModule, FormsModule, NzButtonModule, OverlayModule, NzIconModule, NzNoAnimationModule], diff --git a/components/menu/nz-menu.resolver.ts b/components/menu/nz-menu.resolver.ts new file mode 100644 index 00000000000..a5438552cc1 --- /dev/null +++ b/components/menu/nz-menu.resolver.ts @@ -0,0 +1,10 @@ +import { NzMenuBaseService } from 'ng-zorro-antd/core'; + +import { NzMenuService } from './nz-menu.service'; + +export function NzMenuServiceFactory( + higherOrderService: NzMenuBaseService, + menuService: NzMenuService +): NzMenuBaseService { + return higherOrderService ? higherOrderService : menuService; +} diff --git a/components/menu/nz-menu.service.ts b/components/menu/nz-menu.service.ts index c5cd4ecae18..c6c17ad55bc 100644 --- a/components/menu/nz-menu.service.ts +++ b/components/menu/nz-menu.service.ts @@ -1,37 +1,8 @@ import { Injectable } from '@angular/core'; -import { merge, BehaviorSubject, Subject } from 'rxjs'; -import { NzDirectionVHIType } from '../core/types/direction'; -import { NzMenuItemDirective } from './nz-menu-item.directive'; -@Injectable() -export class NzMenuService { - isInDropDown: boolean; - menuItemClick$ = new Subject(); - theme$ = new Subject(); - mode$ = new BehaviorSubject('vertical'); - inlineIndent$ = new BehaviorSubject(24); - check$ = merge(this.theme$, this.mode$, this.inlineIndent$); - theme: 'light' | 'dark' = 'light'; - mode: NzDirectionVHIType = 'vertical'; - inlineIndent = 24; - menuOpen$ = new BehaviorSubject(false); - - onMenuItemClick(menu: NzMenuItemDirective): void { - this.menuItemClick$.next(menu); - } - - setMode(mode: NzDirectionVHIType): void { - this.mode = mode; - this.mode$.next(mode); - } +import { NzMenuBaseService } from 'ng-zorro-antd/core'; - setTheme(theme: 'light' | 'dark'): void { - this.theme = theme; - this.theme$.next(theme); - } - - setInlineIndent(indent: number): void { - this.inlineIndent = indent; - this.inlineIndent$.next(indent); - } +@Injectable() +export class NzMenuService extends NzMenuBaseService { + isInDropDown = false; } diff --git a/components/menu/nz-menu.spec.ts b/components/menu/nz-menu.spec.ts index 8c81697160d..dcaae62cbc8 100644 --- a/components/menu/nz-menu.spec.ts +++ b/components/menu/nz-menu.spec.ts @@ -15,7 +15,7 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Subject } from 'rxjs'; -import { dispatchFakeEvent } from '../core/testing'; +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzDemoMenuHorizontalComponent } from './demo/horizontal'; diff --git a/components/menu/nz-submenu.component.ts b/components/menu/nz-submenu.component.ts index 8123d0f7048..fb7577181e4 100644 --- a/components/menu/nz-submenu.component.ts +++ b/components/menu/nz-submenu.component.ts @@ -22,15 +22,21 @@ import { import { combineLatest, merge, Subject } from 'rxjs'; import { flatMap, map, startWith, takeUntil } from 'rxjs/operators'; -import { collapseMotion } from '../core/animation/collapse'; -import { slideMotion } from '../core/animation/slide'; -import { zoomBigMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { getPlacementName, DEFAULT_SUBMENU_POSITIONS, POSITION_MAP } from '../core/overlay/overlay-position'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { InputBoolean } from '../core/util/convert'; + +import { + collapseMotion, + getPlacementName, + slideMotion, + zoomBigMotion, + DEFAULT_SUBMENU_POSITIONS, + InputBoolean, + NzMenuBaseService, + NzNoAnimationDirective, + NzUpdateHostClassService, + POSITION_MAP +} from 'ng-zorro-antd/core'; + import { NzMenuItemDirective } from './nz-menu-item.directive'; -import { NzMenuService } from './nz-menu.service'; import { NzSubmenuService } from './nz-submenu.service'; @Component({ @@ -125,7 +131,7 @@ export class NzSubMenuComponent implements OnInit, OnDestroy, AfterContentInit, constructor( private elementRef: ElementRef, - public nzMenuService: NzMenuService, + public nzMenuService: NzMenuBaseService, private cdr: ChangeDetectorRef, public nzSubmenuService: NzSubmenuService, private nzUpdateHostClassService: NzUpdateHostClassService, diff --git a/components/menu/nz-submenu.service.ts b/components/menu/nz-submenu.service.ts index 91c67ad276a..f305f50388d 100644 --- a/components/menu/nz-submenu.service.ts +++ b/components/menu/nz-submenu.service.ts @@ -1,7 +1,9 @@ import { Injectable, Optional, SkipSelf } from '@angular/core'; import { combineLatest, BehaviorSubject, Subject } from 'rxjs'; import { auditTime, distinctUntilChanged, map, tap } from 'rxjs/operators'; -import { NzDirectionVHIType } from '../core/types/direction'; + +import { NzDirectionVHIType } from 'ng-zorro-antd/core'; + import { NzMenuService } from './nz-menu.service'; @Injectable() diff --git a/components/menu/package.json b/components/menu/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/menu/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/menu/public-api.ts b/components/menu/public-api.ts index 85b4f0c8a9e..227f87fd632 100644 --- a/components/menu/public-api.ts +++ b/components/menu/public-api.ts @@ -4,3 +4,6 @@ export * from './nz-menu-divider.directive'; export * from './nz-menu-item.directive'; export * from './nz-submenu.component'; export * from './nz-menu.module'; +export * from './nz-menu.service'; +export * from './nz-submenu.service'; +export * from './nz-menu.resolver'; diff --git a/components/menu/style/entry.less b/components/menu/style/entry.less new file mode 100644 index 00000000000..e6293155214 --- /dev/null +++ b/components/menu/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +// deps-lint-skip: layout +@import '../../tooltip/style/index.less'; diff --git a/components/message/doc/index.en-US.md b/components/message/doc/index.en-US.md index 73d86014cb8..473e5264019 100644 --- a/components/message/doc/index.en-US.md +++ b/components/message/doc/index.en-US.md @@ -29,6 +29,14 @@ The default global configuration is: ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzMessageModule } from 'ng-zorro-antd'; +``` + ### NzMessageService This components provides some service methods, with usage and arguments as following: diff --git a/components/message/doc/index.zh-CN.md b/components/message/doc/index.zh-CN.md index 8b24715f7a8..43ae6b4e97d 100644 --- a/components/message/doc/index.zh-CN.md +++ b/components/message/doc/index.zh-CN.md @@ -30,6 +30,14 @@ title: Message ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzMessageModule } from 'ng-zorro-antd'; +``` + ### NzMessageService 组件提供了一些服务方法,使用方式和参数如下: diff --git a/components/message/nz-message-container.component.ts b/components/message/nz-message-container.component.ts index 429cc31b559..5dcf69ac486 100644 --- a/components/message/nz-message-container.component.ts +++ b/components/message/nz-message-container.component.ts @@ -8,7 +8,7 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; -import { toCssPixel } from '../core/util'; +import { toCssPixel } from 'ng-zorro-antd/core'; import { NzMessageConfig, NZ_MESSAGE_CONFIG, NZ_MESSAGE_DEFAULT_CONFIG } from './nz-message-config'; import { NzMessageDataFilled, NzMessageDataOptions } from './nz-message.definitions'; diff --git a/components/message/nz-message.component.ts b/components/message/nz-message.component.ts index 7713386d7ce..5893449e269 100644 --- a/components/message/nz-message.component.ts +++ b/components/message/nz-message.component.ts @@ -7,7 +7,9 @@ import { OnInit, ViewEncapsulation } from '@angular/core'; -import { moveUpMotion } from '../core/animation/move'; + +import { moveUpMotion } from 'ng-zorro-antd/core'; + import { NzMessageContainerComponent } from './nz-message-container.component'; import { NzMessageDataFilled, NzMessageDataOptions } from './nz-message.definitions'; diff --git a/components/message/nz-message.module.ts b/components/message/nz-message.module.ts index cbaf4dc77f8..19de246f96b 100644 --- a/components/message/nz-message.module.ts +++ b/components/message/nz-message.module.ts @@ -1,8 +1,8 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NZ_MESSAGE_DEFAULT_CONFIG_PROVIDER } from './nz-message-config'; import { NzMessageContainerComponent } from './nz-message-container.component'; diff --git a/components/message/nz-message.spec.ts b/components/message/nz-message.spec.ts index 831de8dda70..41307964716 100644 --- a/components/message/nz-message.spec.ts +++ b/components/message/nz-message.spec.ts @@ -3,7 +3,7 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NZ_MESSAGE_CONFIG } from './nz-message-config'; import { NzMessageModule } from './nz-message.module'; diff --git a/components/message/package.json b/components/message/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/message/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/message/style/entry.less b/components/message/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/message/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/modal/doc/index.en-US.md b/components/modal/doc/index.en-US.md index 5e7904dae44..206f087e662 100644 --- a/components/modal/doc/index.en-US.md +++ b/components/modal/doc/index.en-US.md @@ -18,6 +18,14 @@ It is recommended to use the `Component` way to pop up the Modal, so that the co ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzModalModule } from 'ng-zorro-antd'; +``` + ### NzModalService The dialog is currently divided into 2 modes, `normal mode` and `confirm box mode` (ie the `Confirm` dialog, which is called by calling `confirm/info/success/error/warning`). The degree of API support for the two modes is slightly different. diff --git a/components/modal/doc/index.zh-CN.md b/components/modal/doc/index.zh-CN.md index 9c2fbc722f4..6b02db20b97 100644 --- a/components/modal/doc/index.zh-CN.md +++ b/components/modal/doc/index.zh-CN.md @@ -19,6 +19,14 @@ title: Modal ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzModalModule } from 'ng-zorro-antd'; +``` + ### NzModalService 对话框当前分为2种模式,`普通模式` 和 `确认框模式`(即`Confirm`对话框,通过调用`confirm/info/success/error/warning`弹出),两种模式对API的支持程度稍有不同。 diff --git a/components/modal/nz-modal.component.ts b/components/modal/nz-modal.component.ts index 5705650da7b..e562d9f0977 100644 --- a/components/modal/nz-modal.component.ts +++ b/components/modal/nz-modal.component.ts @@ -30,9 +30,9 @@ import { import { fromEvent, Observable, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; -import { isPromise } from '../core/util/is-promise'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { isPromise, InputBoolean } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; + import ModalUtil from './modal-util'; import { NzModalConfig, NZ_MODAL_CONFIG } from './nz-modal-config'; import { NzModalControlService } from './nz-modal-control.service'; diff --git a/components/modal/nz-modal.module.ts b/components/modal/nz-modal.module.ts index 8f0030edb0a..3524d8d612f 100644 --- a/components/modal/nz-modal.module.ts +++ b/components/modal/nz-modal.module.ts @@ -2,11 +2,10 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { LoggerModule } from '../core/util/logger/logger.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { LoggerModule, NzNoAnimationModule } from 'ng-zorro-antd/core'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { CssUnitPipe } from './css-unit.pipe'; import { NzModalControlService } from './nz-modal-control.service'; diff --git a/components/modal/nz-modal.service.ts b/components/modal/nz-modal.service.ts index 3f3896fd90c..f649f552f5b 100644 --- a/components/modal/nz-modal.service.ts +++ b/components/modal/nz-modal.service.ts @@ -2,9 +2,8 @@ import { Overlay, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; import { ComponentRef, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { IndexableObject } from '../core/types/indexable'; -import { LoggerService } from '../core/util/logger/logger.service'; +import { IndexableObject, LoggerService } from 'ng-zorro-antd/core'; import { NzModalControlService } from './nz-modal-control.service'; import { NzModalRef } from './nz-modal-ref.class'; diff --git a/components/modal/nz-modal.spec.ts b/components/modal/nz-modal.spec.ts index e42d30d6634..74ce543e832 100644 --- a/components/modal/nz-modal.spec.ts +++ b/components/modal/nz-modal.spec.ts @@ -1,21 +1,19 @@ /* TODO: Sort out and rewrite for more standardized */ +import { ESCAPE } from '@angular/cdk/keycodes'; +import { OverlayContainer } from '@angular/cdk/overlay'; import { Component, ElementRef, EventEmitter, Input } from '@angular/core'; import { async, fakeAsync, flush, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { OverlayContainer } from '@angular/cdk/overlay'; -import { NzButtonComponent } from '../button/nz-button.component'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; - -import { ESCAPE } from '@angular/cdk/keycodes'; -import { dispatchKeyboardEvent } from '../core/testing'; +import { NzButtonComponent, NzButtonModule } from 'ng-zorro-antd/button'; +import { dispatchKeyboardEvent, NzMeasureScrollbarService } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; import en_US from '../i18n/languages/en_US'; -import { NzI18nService } from '../i18n/nz-i18n.service'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; + import { CssUnitPipe } from './css-unit.pipe'; import { NZ_MODAL_CONFIG } from './nz-modal-config'; import { NzModalControlService } from './nz-modal-control.service'; diff --git a/components/modal/package.json b/components/modal/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/modal/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/modal/public-api.ts b/components/modal/public-api.ts index b7166d02206..2c6f83740cd 100644 --- a/components/modal/public-api.ts +++ b/components/modal/public-api.ts @@ -3,4 +3,6 @@ export { NzModalRef } from './nz-modal-ref.class'; export { NzModalModule } from './nz-modal.module'; export { NzModalService } from './nz-modal.service'; export { NZ_MODAL_CONFIG, NzModalConfig } from './nz-modal-config'; +export { NzModalControlService } from './nz-modal-control.service'; +export { CssUnitPipe } from './css-unit.pipe'; export * from './nz-modal.type'; diff --git a/components/modal/style/entry.less b/components/modal/style/entry.less new file mode 100644 index 00000000000..8d6c97e9eb9 --- /dev/null +++ b/components/modal/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../button/style/index.less'; diff --git a/components/ng-package.json b/components/ng-package.json index 6f4bff77cdc..3e2eeeca2cd 100644 --- a/components/ng-package.json +++ b/components/ng-package.json @@ -3,12 +3,7 @@ "dest": "../publish", "deleteDestPath": true, "lib": { - "entryFile": "ng-zorro-antd.module.ts" + "entryFile": "./ng-zorro-antd.module.ts" }, - "whitelistedNonPeerDependencies": [ - "tslib", - "angular", - "date-fns", - "@ant-design/icons-angular" - ] + "whitelistedNonPeerDependencies": ["tslib", "angular", "date-fns", "@ant-design/icons-angular"] } diff --git a/components/ng-zorro-antd.module.ts b/components/ng-zorro-antd.module.ts index d461c9709f6..f5ffc7d29bb 100644 --- a/components/ng-zorro-antd.module.ts +++ b/components/ng-zorro-antd.module.ts @@ -1,130 +1,128 @@ import { ModuleWithProviders, NgModule } from '@angular/core'; -import { NzAffixModule } from './affix/nz-affix.module'; -import { NzAlertModule } from './alert/nz-alert.module'; -import { NzAnchorModule } from './anchor/nz-anchor.module'; -import { NzAutocompleteModule } from './auto-complete/nz-autocomplete.module'; -import { NzAvatarModule } from './avatar/nz-avatar.module'; -import { NzBackTopModule } from './back-top/nz-back-top.module'; -import { NzBadgeModule } from './badge/nz-badge.module'; -import { NzBreadCrumbModule } from './breadcrumb/nz-breadcrumb.module'; -import { NzButtonModule } from './button/nz-button.module'; -import { NzCalendarModule } from './calendar/nz-calendar.module'; -import { NzCardModule } from './card/nz-card.module'; -import { NzCarouselModule } from './carousel/nz-carousel.module'; -import { NzCascaderModule } from './cascader/nz-cascader.module'; -import { NzCheckboxModule } from './checkbox/nz-checkbox.module'; -import { NzCollapseModule } from './collapse/nz-collapse.module'; -import { NzCommentModule } from './comment/nz-comment.module'; -import { NzNoAnimationModule } from './core/no-animation/nz-no-animation.module'; -import { NzWaveModule } from './core/wave/nz-wave.module'; -import { NzDatePickerModule } from './date-picker/date-picker.module'; -import { NzDividerModule } from './divider/nz-divider.module'; -import { NzDrawerModule } from './drawer/nz-drawer.module'; -import { NzDropDownModule } from './dropdown/nz-dropdown.module'; -import { NzEmptyModule } from './empty/nz-empty.module'; -import { NzFormModule } from './form/nz-form.module'; -import { NzGridModule } from './grid/nz-grid.module'; -import { NzI18nModule } from './i18n/nz-i18n.module'; -import { NzIconModule } from './icon/nz-icon.module'; -import { NzInputNumberModule } from './input-number/nz-input-number.module'; -import { NzInputModule } from './input/nz-input.module'; -import { NzLayoutModule } from './layout/nz-layout.module'; -import { NzListModule } from './list/nz-list.module'; -import { NzMentionModule } from './mention/nz-mention.module'; -import { NzMenuModule } from './menu/nz-menu.module'; -import { NzMessageModule } from './message/nz-message.module'; -import { NzModalModule } from './modal/nz-modal.module'; -import { NzNotificationModule } from './notification/nz-notification.module'; -import { NzPageHeaderModule } from './page-header/nz-page-header.module'; -import { NzPaginationModule } from './pagination/nz-pagination.module'; -import { NzPopconfirmModule } from './popconfirm/nz-popconfirm.module'; -import { NzPopoverModule } from './popover/nz-popover.module'; -import { NzProgressModule } from './progress/nz-progress.module'; -import { NzRadioModule } from './radio/nz-radio.module'; -import { NzRateModule } from './rate/nz-rate.module'; -import { NzSelectModule } from './select/nz-select.module'; -import { NzSkeletonModule } from './skeleton/nz-skeleton.module'; -import { NzSliderModule } from './slider/nz-slider.module'; -import { NzSpinModule } from './spin/nz-spin.module'; -import { NzStatisticModule } from './statistic/nz-statistic.module'; -import { NzStepsModule } from './steps/nz-steps.module'; -import { NzSwitchModule } from './switch/nz-switch.module'; -import { NzTableModule } from './table/nz-table.module'; -import { NzTabsModule } from './tabs/nz-tabs.module'; -import { NzTagModule } from './tag/nz-tag.module'; -import { NzTimePickerModule } from './time-picker/nz-time-picker.module'; -import { NzTimelineModule } from './timeline/nz-timeline.module'; -import { NzToolTipModule } from './tooltip/nz-tooltip.module'; -import { NzTransferModule } from './transfer/nz-transfer.module'; -import { NzTreeSelectModule } from './tree-select/nz-tree-select.module'; -import { NzTreeModule } from './tree/nz-tree.module'; -import { NzUploadModule } from './upload/nz-upload.module'; +import { NzAffixModule } from 'ng-zorro-antd/affix'; +import { NzAlertModule } from 'ng-zorro-antd/alert'; +import { NzAnchorModule } from 'ng-zorro-antd/anchor'; +import { NzAutocompleteModule } from 'ng-zorro-antd/auto-complete'; +import { NzAvatarModule } from 'ng-zorro-antd/avatar'; +import { NzBackTopModule } from 'ng-zorro-antd/back-top'; +import { NzBadgeModule } from 'ng-zorro-antd/badge'; +import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzCalendarModule } from 'ng-zorro-antd/calendar'; +import { NzCardModule } from 'ng-zorro-antd/card'; +import { NzCarouselModule } from 'ng-zorro-antd/carousel'; +import { NzCascaderModule } from 'ng-zorro-antd/cascader'; +import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; +import { NzCollapseModule } from 'ng-zorro-antd/collapse'; +import { NzCommentModule } from 'ng-zorro-antd/comment'; +import { NzNoAnimationModule, NzWaveModule } from 'ng-zorro-antd/core'; +import { NzDatePickerModule } from 'ng-zorro-antd/date-picker'; +import { NzDividerModule } from 'ng-zorro-antd/divider'; +import { NzDrawerModule } from 'ng-zorro-antd/drawer'; +import { NzDropDownModule } from 'ng-zorro-antd/dropdown'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzFormModule } from 'ng-zorro-antd/form'; +import { NzGridModule } from 'ng-zorro-antd/grid'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzInputModule } from 'ng-zorro-antd/input'; +import { NzInputNumberModule } from 'ng-zorro-antd/input-number'; +import { NzLayoutModule } from 'ng-zorro-antd/layout'; +import { NzListModule } from 'ng-zorro-antd/list'; +import { NzMentionModule } from 'ng-zorro-antd/mention'; +import { NzMenuModule } from 'ng-zorro-antd/menu'; +import { NzMessageModule } from 'ng-zorro-antd/message'; +import { NzModalModule } from 'ng-zorro-antd/modal'; +import { NzNotificationModule } from 'ng-zorro-antd/notification'; +import { NzPageHeaderModule } from 'ng-zorro-antd/page-header'; +import { NzPaginationModule } from 'ng-zorro-antd/pagination'; +import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm'; +import { NzPopoverModule } from 'ng-zorro-antd/popover'; +import { NzProgressModule } from 'ng-zorro-antd/progress'; +import { NzRadioModule } from 'ng-zorro-antd/radio'; +import { NzRateModule } from 'ng-zorro-antd/rate'; +import { NzSelectModule } from 'ng-zorro-antd/select'; +import { NzSkeletonModule } from 'ng-zorro-antd/skeleton'; +import { NzSliderModule } from 'ng-zorro-antd/slider'; +import { NzSpinModule } from 'ng-zorro-antd/spin'; +import { NzStatisticModule } from 'ng-zorro-antd/statistic'; +import { NzStepsModule } from 'ng-zorro-antd/steps'; +import { NzSwitchModule } from 'ng-zorro-antd/switch'; +import { NzTableModule } from 'ng-zorro-antd/table'; +import { NzTabsModule } from 'ng-zorro-antd/tabs'; +import { NzTagModule } from 'ng-zorro-antd/tag'; +import { NzTimePickerModule } from 'ng-zorro-antd/time-picker'; +import { NzTimelineModule } from 'ng-zorro-antd/timeline'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; +import { NzTransferModule } from 'ng-zorro-antd/transfer'; +import { NzTreeModule } from 'ng-zorro-antd/tree'; +import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; +import { NzUploadModule } from 'ng-zorro-antd/upload'; + +export * from 'ng-zorro-antd/affix'; +export * from 'ng-zorro-antd/alert'; +export * from 'ng-zorro-antd/anchor'; +export * from 'ng-zorro-antd/auto-complete'; +export * from 'ng-zorro-antd/avatar'; +export * from 'ng-zorro-antd/back-top'; +export * from 'ng-zorro-antd/badge'; +export * from 'ng-zorro-antd/breadcrumb'; +export * from 'ng-zorro-antd/button'; +export * from 'ng-zorro-antd/calendar'; +export * from 'ng-zorro-antd/card'; +export * from 'ng-zorro-antd/carousel'; +export * from 'ng-zorro-antd/cascader'; +export * from 'ng-zorro-antd/checkbox'; +export * from 'ng-zorro-antd/collapse'; +export * from 'ng-zorro-antd/comment'; +export * from 'ng-zorro-antd/core'; +export * from 'ng-zorro-antd/date-picker'; +export * from 'ng-zorro-antd/divider'; +export * from 'ng-zorro-antd/drawer'; +export * from 'ng-zorro-antd/drawer'; +export * from 'ng-zorro-antd/dropdown'; +export * from 'ng-zorro-antd/empty'; +export * from 'ng-zorro-antd/form'; +export * from 'ng-zorro-antd/grid'; +export * from 'ng-zorro-antd/i18n'; +export * from 'ng-zorro-antd/icon'; +export * from 'ng-zorro-antd/input-number'; +export * from 'ng-zorro-antd/input'; +export * from 'ng-zorro-antd/layout'; +export * from 'ng-zorro-antd/list'; +export * from 'ng-zorro-antd/mention'; +export * from 'ng-zorro-antd/menu'; +export * from 'ng-zorro-antd/message'; +export * from 'ng-zorro-antd/modal'; +export * from 'ng-zorro-antd/notification'; +export * from 'ng-zorro-antd/page-header'; +export * from 'ng-zorro-antd/pagination'; +export * from 'ng-zorro-antd/popconfirm'; +export * from 'ng-zorro-antd/popover'; +export * from 'ng-zorro-antd/progress'; +export * from 'ng-zorro-antd/radio'; +export * from 'ng-zorro-antd/rate'; +export * from 'ng-zorro-antd/select'; +export * from 'ng-zorro-antd/skeleton'; +export * from 'ng-zorro-antd/slider'; +export * from 'ng-zorro-antd/spin'; +export * from 'ng-zorro-antd/statistic'; +export * from 'ng-zorro-antd/steps'; +export * from 'ng-zorro-antd/switch'; +export * from 'ng-zorro-antd/table'; +export * from 'ng-zorro-antd/tabs'; +export * from 'ng-zorro-antd/tag'; +export * from 'ng-zorro-antd/time-picker'; +export * from 'ng-zorro-antd/time-picker'; +export * from 'ng-zorro-antd/timeline'; +export * from 'ng-zorro-antd/tooltip'; +export * from 'ng-zorro-antd/transfer'; +export * from 'ng-zorro-antd/tree-select'; +export * from 'ng-zorro-antd/tree'; +export * from 'ng-zorro-antd/upload'; -export * from './affix'; -export * from './alert'; -export * from './anchor'; -export * from './avatar'; -export * from './back-top'; -export * from './badge'; -export * from './breadcrumb'; -export * from './button'; -export * from './calendar'; -export * from './card'; -export * from './carousel'; -export * from './checkbox'; -export * from './collapse'; -export * from './comment'; -export * from './date-picker'; -export * from './divider'; -export * from './drawer'; -export * from './dropdown'; -export * from './drawer'; -export * from './empty'; -export * from './form'; -export * from './grid'; -export * from './i18n'; -export * from './icon'; -export * from './input'; -export * from './input-number'; -export * from './layout'; -export * from './list'; -export * from './mention'; -export * from './menu'; -export * from './page-header'; -export * from './pagination'; -export * from './progress'; -export * from './radio'; -export * from './rate'; -export * from './select'; -export * from './spin'; -export * from './statistic'; -export * from './steps'; -export * from './switch'; -export * from './table'; -export * from './tabs'; -export * from './timeline'; -export * from './transfer'; -export * from './upload'; -export * from './tag'; -export * from './auto-complete'; -export * from './message'; -export * from './time-picker'; -export * from './tooltip'; -export * from './skeleton'; -export * from './slider'; -export * from './popover'; -export * from './notification'; -export * from './popconfirm'; -export * from './modal'; -export * from './cascader'; -export * from './tree'; -export * from './tree-select'; -export * from './time-picker'; export * from './version'; -export * from './core/wave'; -export * from './core/util'; -export * from './core/no-animation'; @NgModule({ exports: [ diff --git a/components/notification/doc/index.en-US.md b/components/notification/doc/index.en-US.md index 9638ee1f4b4..629dbb1ec29 100644 --- a/components/notification/doc/index.en-US.md +++ b/components/notification/doc/index.en-US.md @@ -37,6 +37,14 @@ The default global configuration is: ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzNotificationModule } from 'ng-zorro-antd'; +``` + ### NzNotificationService The component provides a number of service methods using the following methods and parameters: diff --git a/components/notification/doc/index.zh-CN.md b/components/notification/doc/index.zh-CN.md index be3267c9c93..5217b347b15 100644 --- a/components/notification/doc/index.zh-CN.md +++ b/components/notification/doc/index.zh-CN.md @@ -36,6 +36,14 @@ subtitle: 通知提醒框 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzNotificationModule } from 'ng-zorro-antd'; +``` + ### NzNotificationService 组件提供了一些服务方法,使用方式和参数如下: diff --git a/components/notification/nz-notification-config.ts b/components/notification/nz-notification-config.ts index 45917f63ea2..c2e8fff37a5 100644 --- a/components/notification/nz-notification-config.ts +++ b/components/notification/nz-notification-config.ts @@ -1,6 +1,6 @@ import { InjectionToken } from '@angular/core'; -import { NzMessageConfig } from '../message/nz-message-config'; +import { NzMessageConfig } from 'ng-zorro-antd/message'; export interface NzNotificationConfig extends NzMessageConfig { nzTop?: string | number; diff --git a/components/notification/nz-notification-container.component.ts b/components/notification/nz-notification-container.component.ts index 1afdfb157b1..8dd5b3e3557 100644 --- a/components/notification/nz-notification-container.component.ts +++ b/components/notification/nz-notification-container.component.ts @@ -8,8 +8,8 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; -import { toCssPixel } from '../core/util'; -import { NzMessageContainerComponent } from '../message/nz-message-container.component'; +import { toCssPixel } from 'ng-zorro-antd/core'; +import { NzMessageContainerComponent } from 'ng-zorro-antd/message'; import { NzNotificationConfig, NZ_NOTIFICATION_CONFIG, NZ_NOTIFICATION_DEFAULT_CONFIG } from './nz-notification-config'; import { NzNotificationDataFilled, NzNotificationDataOptions } from './nz-notification.definitions'; diff --git a/components/notification/nz-notification.component.ts b/components/notification/nz-notification.component.ts index 618a234c793..d6cecfc2d69 100644 --- a/components/notification/nz-notification.component.ts +++ b/components/notification/nz-notification.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular/core'; -import { notificationMotion } from '../core/animation/notification'; -import { NzMessageComponent } from '../message/nz-message.component'; +import { notificationMotion } from 'ng-zorro-antd/core'; +import { NzMessageComponent } from 'ng-zorro-antd/message'; import { NzNotificationContainerComponent } from './nz-notification-container.component'; import { NzNotificationDataFilled } from './nz-notification.definitions'; diff --git a/components/notification/nz-notification.definitions.ts b/components/notification/nz-notification.definitions.ts index 89a5a949d08..9fd7a611a25 100644 --- a/components/notification/nz-notification.definitions.ts +++ b/components/notification/nz-notification.definitions.ts @@ -1,7 +1,7 @@ import { TemplateRef } from '@angular/core'; import { Subject } from 'rxjs'; -import { NzMessageData, NzMessageDataOptions } from '../message/nz-message.definitions'; +import { NzMessageData, NzMessageDataOptions } from 'ng-zorro-antd/message'; export interface NzNotificationData extends NzMessageData { template?: TemplateRef<{}>; diff --git a/components/notification/nz-notification.module.ts b/components/notification/nz-notification.module.ts index a3eb01e7347..42107ded2ec 100644 --- a/components/notification/nz-notification.module.ts +++ b/components/notification/nz-notification.module.ts @@ -1,7 +1,7 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER } from './nz-notification-config'; import { NzNotificationContainerComponent } from './nz-notification-container.component'; diff --git a/components/notification/nz-notification.service.ts b/components/notification/nz-notification.service.ts index a133a5ebc88..704d584a729 100644 --- a/components/notification/nz-notification.service.ts +++ b/components/notification/nz-notification.service.ts @@ -1,7 +1,7 @@ import { Overlay } from '@angular/cdk/overlay'; import { ApplicationRef, ComponentFactoryResolver, Injectable, Injector, TemplateRef } from '@angular/core'; -import { NzMessageBaseService } from '../message/nz-message.service'; +import { NzMessageBaseService } from 'ng-zorro-antd/message'; import { NzNotificationConfig } from './nz-notification-config'; import { NzNotificationContainerComponent } from './nz-notification-container.component'; diff --git a/components/notification/nz-notification.spec.ts b/components/notification/nz-notification.spec.ts index c442b4879e6..36c18d71114 100644 --- a/components/notification/nz-notification.spec.ts +++ b/components/notification/nz-notification.spec.ts @@ -3,7 +3,7 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NZ_NOTIFICATION_CONFIG } from './nz-notification-config'; import { NzNotificationModule } from './nz-notification.module'; diff --git a/components/notification/package.json b/components/notification/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/notification/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/notification/style/entry.less b/components/notification/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/notification/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/page-header/doc/index.en-US.md b/components/page-header/doc/index.en-US.md index 1d6d13f0f66..26ab8470dbf 100644 --- a/components/page-header/doc/index.en-US.md +++ b/components/page-header/doc/index.en-US.md @@ -17,6 +17,14 @@ Use when you need the user to quickly understand what the current page is and wh ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzPageHeaderModule } from 'ng-zorro-antd'; +``` + ### nz-page-header | Param | Description | Type | Default value | | ----- | ----------- | ---- | ------------- | diff --git a/components/page-header/doc/index.zh-CN.md b/components/page-header/doc/index.zh-CN.md index b90b222c9f4..349183d73c7 100644 --- a/components/page-header/doc/index.zh-CN.md +++ b/components/page-header/doc/index.zh-CN.md @@ -18,6 +18,14 @@ subtitle: 页头 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzPageHeaderModule } from 'ng-zorro-antd'; +``` + ### nz-page-header | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | diff --git a/components/page-header/nz-page-header.module.ts b/components/page-header/nz-page-header.module.ts index 2aaf9849418..b398d8c2b64 100644 --- a/components/page-header/nz-page-header.module.ts +++ b/components/page-header/nz-page-header.module.ts @@ -1,8 +1,10 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzDividerModule } from '../divider/nz-divider.module'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzDividerModule } from 'ng-zorro-antd/divider'; +import { NzIconModule } from 'ng-zorro-antd/icon'; + import { NzPageHeaderBreadcrumbDirective, NzPageHeaderContentDirective, diff --git a/components/page-header/package.json b/components/page-header/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/page-header/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/page-header/style/entry.less b/components/page-header/style/entry.less new file mode 100644 index 00000000000..a7bbd72d9da --- /dev/null +++ b/components/page-header/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../divider/style/index.less'; +@import '../../breadcrumb/style/index.less'; diff --git a/components/pagination/doc/index.en-US.md b/components/pagination/doc/index.en-US.md index bc6c0feba1f..50f331a460e 100755 --- a/components/pagination/doc/index.en-US.md +++ b/components/pagination/doc/index.en-US.md @@ -18,6 +18,14 @@ A long list can be divided into several pages by `Pagination`, and only one page ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzPaginationModule } from 'ng-zorro-antd'; +``` + ### nz-pagination | Property | Description | Type | Default | diff --git a/components/pagination/doc/index.zh-CN.md b/components/pagination/doc/index.zh-CN.md index 04cff2933ff..d9fbfd81e05 100755 --- a/components/pagination/doc/index.zh-CN.md +++ b/components/pagination/doc/index.zh-CN.md @@ -19,6 +19,14 @@ cols: 1 ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzPaginationModule } from 'ng-zorro-antd'; +``` + ### nz-pagination | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/pagination/nz-pagination.component.ts b/components/pagination/nz-pagination.component.ts index 87de4608fe3..5844c9e50a1 100644 --- a/components/pagination/nz-pagination.component.ts +++ b/components/pagination/nz-pagination.component.ts @@ -15,9 +15,9 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { isInteger } from '../core/util/check'; -import { toNumber, InputBoolean, InputNumber } from '../core/util/convert'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { isInteger, toNumber, InputBoolean, InputNumber } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; @Component({ selector: 'nz-pagination', diff --git a/components/pagination/nz-pagination.module.ts b/components/pagination/nz-pagination.module.ts index 81483bbcc7b..60f37c29f08 100644 --- a/components/pagination/nz-pagination.module.ts +++ b/components/pagination/nz-pagination.module.ts @@ -2,9 +2,9 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzSelectModule } from '../select/nz-select.module'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzSelectModule } from 'ng-zorro-antd/select'; import { NzPaginationComponent } from './nz-pagination.component'; diff --git a/components/pagination/package.json b/components/pagination/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/pagination/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/pagination/style/entry.less b/components/pagination/style/entry.less new file mode 100644 index 00000000000..d9e2fe34e62 --- /dev/null +++ b/components/pagination/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../select/style/index.less'; diff --git a/components/popconfirm/doc/index.en-US.md b/components/popconfirm/doc/index.en-US.md index 9c0f447c8db..a140aa56715 100644 --- a/components/popconfirm/doc/index.en-US.md +++ b/components/popconfirm/doc/index.en-US.md @@ -14,6 +14,14 @@ The difference with the `confirm` modal dialog is that it's more lightweight tha ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzPopconfirmModule } from 'ng-zorro-antd'; +``` + ### [nz-popconfirm] | Param | Description | Type | Default value | diff --git a/components/popconfirm/doc/index.zh-CN.md b/components/popconfirm/doc/index.zh-CN.md index 2f5da99c31d..afc0f27da90 100644 --- a/components/popconfirm/doc/index.zh-CN.md +++ b/components/popconfirm/doc/index.zh-CN.md @@ -15,6 +15,14 @@ title: Popconfirm ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzPopconfirmModule } from 'ng-zorro-antd'; +``` + ### [nz-popconfirm] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/popconfirm/nz-popconfirm.component.ts b/components/popconfirm/nz-popconfirm.component.ts index 95311b0943d..80db73947d3 100644 --- a/components/popconfirm/nz-popconfirm.component.ts +++ b/components/popconfirm/nz-popconfirm.component.ts @@ -10,10 +10,9 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { zoomBigMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { InputBoolean } from '../core/util/convert'; -import { NzToolTipComponent } from '../tooltip/nz-tooltip.component'; + +import { zoomBigMotion, InputBoolean, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { NzToolTipComponent } from 'ng-zorro-antd/tooltip'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/components/popconfirm/nz-popconfirm.directive.ts b/components/popconfirm/nz-popconfirm.directive.ts index d7163754864..477ab396125 100644 --- a/components/popconfirm/nz-popconfirm.directive.ts +++ b/components/popconfirm/nz-popconfirm.directive.ts @@ -16,9 +16,9 @@ import { import { distinctUntilChanged } from 'rxjs/operators'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { InputBoolean } from '../core/util/convert'; -import { NzTooltipDirective } from '../tooltip/nz-tooltip.directive'; +import { InputBoolean, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { NzTooltipDirective } from 'ng-zorro-antd/tooltip'; + import { NzPopconfirmComponent } from './nz-popconfirm.component'; @Directive({ diff --git a/components/popconfirm/nz-popconfirm.module.ts b/components/popconfirm/nz-popconfirm.module.ts index 3541e8fa05d..bf8b9135952 100644 --- a/components/popconfirm/nz-popconfirm.module.ts +++ b/components/popconfirm/nz-popconfirm.module.ts @@ -2,12 +2,11 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzAddOnModule, NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { NzPopconfirmComponent } from './nz-popconfirm.component'; import { NzPopconfirmDirective } from './nz-popconfirm.directive'; @@ -23,7 +22,8 @@ import { NzPopconfirmDirective } from './nz-popconfirm.directive'; NzIconModule, NzAddOnModule, NzOverlayModule, - NzNoAnimationModule + NzNoAnimationModule, + NzToolTipModule ], entryComponents: [NzPopconfirmComponent] }) diff --git a/components/popconfirm/nz-popconfirm.spec.ts b/components/popconfirm/nz-popconfirm.spec.ts index d5348c4c1d5..b4a08921c11 100644 --- a/components/popconfirm/nz-popconfirm.spec.ts +++ b/components/popconfirm/nz-popconfirm.spec.ts @@ -3,7 +3,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'; import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; import { NzPopconfirmModule } from './nz-popconfirm.module'; diff --git a/components/popconfirm/package.json b/components/popconfirm/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/popconfirm/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/popconfirm/style/entry.less b/components/popconfirm/style/entry.less new file mode 100644 index 00000000000..9bed7670618 --- /dev/null +++ b/components/popconfirm/style/entry.less @@ -0,0 +1,4 @@ +// style dependencies +// deps-lint-skip: tooltip, popover +@import '../../popover/style/index.less'; +@import '../../button/style/index.less'; diff --git a/components/popover/doc/index.en-US.md b/components/popover/doc/index.en-US.md index ccc20e76660..2fb4841fe8d 100644 --- a/components/popover/doc/index.en-US.md +++ b/components/popover/doc/index.en-US.md @@ -14,6 +14,14 @@ Comparing with `Tooltip`, besides information `Popover` card can also provide ac ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzPopoverModule } from 'ng-zorro-antd'; +``` + ### [nz-popover] | Param | Description | Type | Default value | diff --git a/components/popover/doc/index.zh-CN.md b/components/popover/doc/index.zh-CN.md index 3cca42656e9..5b3479c3024 100644 --- a/components/popover/doc/index.zh-CN.md +++ b/components/popover/doc/index.zh-CN.md @@ -15,6 +15,14 @@ title: Popover ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzPopoverModule } from 'ng-zorro-antd'; +``` + ### [nz-popover] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/popover/nz-popover.component.ts b/components/popover/nz-popover.component.ts index 8d2fb37c27c..e66189add8b 100644 --- a/components/popover/nz-popover.component.ts +++ b/components/popover/nz-popover.component.ts @@ -10,10 +10,8 @@ import { ViewEncapsulation } from '@angular/core'; -import { zoomBigMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { isNotNil } from '../core/util'; -import { NzToolTipComponent } from '../tooltip/nz-tooltip.component'; +import { isNotNil, zoomBigMotion, NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { NzToolTipComponent } from 'ng-zorro-antd/tooltip'; @Component({ selector: 'nz-popover', diff --git a/components/popover/nz-popover.directive.ts b/components/popover/nz-popover.directive.ts index df68c16a0d0..39ead10e0e7 100644 --- a/components/popover/nz-popover.directive.ts +++ b/components/popover/nz-popover.directive.ts @@ -9,8 +9,9 @@ import { ViewContainerRef } from '@angular/core'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzTooltipDirective } from '../tooltip/nz-tooltip.directive'; +import { NzNoAnimationDirective } from 'ng-zorro-antd/core'; +import { NzTooltipDirective } from 'ng-zorro-antd/tooltip'; + import { NzPopoverComponent } from './nz-popover.component'; @Directive({ diff --git a/components/popover/nz-popover.module.ts b/components/popover/nz-popover.module.ts index b493b52438d..3fdedd1759f 100644 --- a/components/popover/nz-popover.module.ts +++ b/components/popover/nz-popover.module.ts @@ -2,9 +2,8 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; +import { NzAddOnModule, NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { NzPopoverComponent } from './nz-popover.component'; import { NzPopoverDirective } from './nz-popover.directive'; @@ -13,6 +12,6 @@ import { NzPopoverDirective } from './nz-popover.directive'; entryComponents: [NzPopoverComponent], exports: [NzPopoverDirective, NzPopoverComponent], declarations: [NzPopoverDirective, NzPopoverComponent], - imports: [CommonModule, OverlayModule, NzAddOnModule, NzOverlayModule, NzNoAnimationModule] + imports: [CommonModule, OverlayModule, NzAddOnModule, NzOverlayModule, NzNoAnimationModule, NzToolTipModule] }) export class NzPopoverModule {} diff --git a/components/popover/nz-popover.spec.ts b/components/popover/nz-popover.spec.ts index 3d7d702edc2..4de25058367 100644 --- a/components/popover/nz-popover.spec.ts +++ b/components/popover/nz-popover.spec.ts @@ -3,7 +3,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'; import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; import { NzPopoverDirective } from './nz-popover.directive'; diff --git a/components/popover/package.json b/components/popover/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/popover/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/popover/style/entry.less b/components/popover/style/entry.less new file mode 100644 index 00000000000..0afc1757c01 --- /dev/null +++ b/components/popover/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +// deps-lint-skip: tooltip diff --git a/components/progress/doc/index.en-US.md b/components/progress/doc/index.en-US.md index a2d8761db39..02cf8b1a083 100644 --- a/components/progress/doc/index.en-US.md +++ b/components/progress/doc/index.en-US.md @@ -15,6 +15,14 @@ If it will take a long time to complete an operation, you can use `Progress` to ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzProgressModule } from 'ng-zorro-antd'; +``` + ### nz-progress | Property | Description | Type | Default | diff --git a/components/progress/doc/index.zh-CN.md b/components/progress/doc/index.zh-CN.md index 8440b155af8..539bfb80354 100644 --- a/components/progress/doc/index.zh-CN.md +++ b/components/progress/doc/index.zh-CN.md @@ -16,6 +16,14 @@ title: Progress ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzProgressModule } from 'ng-zorro-antd'; +``` + ### nz-progress | 属性 | 说明 | 类型 | 默认值 | diff --git a/components/progress/nz-progress.component.ts b/components/progress/nz-progress.component.ts index 3ac54537a31..7857e710f60 100644 --- a/components/progress/nz-progress.component.ts +++ b/components/progress/nz-progress.component.ts @@ -8,8 +8,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { InputNumber } from '../core/util'; -import { isNotNil } from '../core/util/check'; +import { isNotNil, InputNumber } from 'ng-zorro-antd/core'; export type NzProgressGapPositionType = 'top' | 'bottom' | 'left' | 'right'; export type NzProgressStatusType = 'success' | 'exception' | 'active' | 'normal'; diff --git a/components/progress/nz-progress.module.ts b/components/progress/nz-progress.module.ts index 747bb99801a..c303b7436bb 100644 --- a/components/progress/nz-progress.module.ts +++ b/components/progress/nz-progress.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzProgressComponent } from './nz-progress.component'; diff --git a/components/progress/package.json b/components/progress/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/progress/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/progress/style/entry.less b/components/progress/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/progress/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/radio/doc/index.en-US.md b/components/radio/doc/index.en-US.md index a825f3104b5..034e1119eaa 100644 --- a/components/radio/doc/index.en-US.md +++ b/components/radio/doc/index.en-US.md @@ -13,6 +13,14 @@ Radio. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzRadioModule } from 'ng-zorro-antd'; +``` + ### [nz-radio] | [nz-radio-button] | Property | Description | Type | Default | diff --git a/components/radio/doc/index.zh-CN.md b/components/radio/doc/index.zh-CN.md index 32f11f851b2..e9a9bb844fd 100644 --- a/components/radio/doc/index.zh-CN.md +++ b/components/radio/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Radio ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzRadioModule } from 'ng-zorro-antd'; +``` + ### [nz-radio] | [nz-radio-button] | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/radio/nz-radio-group.component.ts b/components/radio/nz-radio-group.component.ts index fd5b48faeed..82c571b7c73 100644 --- a/components/radio/nz-radio-group.component.ts +++ b/components/radio/nz-radio-group.component.ts @@ -17,9 +17,9 @@ import { import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { merge, Subject, Subscription } from 'rxjs'; import { startWith, takeUntil } from 'rxjs/operators'; -import { NzSizeLDSType } from '../core/types/size'; -import { isNotNil } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; + +import { isNotNil, InputBoolean, NzSizeLDSType } from 'ng-zorro-antd/core'; + import { NzRadioComponent } from './nz-radio.component'; export type NzRadioButtonStyle = 'outline' | 'solid'; diff --git a/components/radio/nz-radio.component.ts b/components/radio/nz-radio.component.ts index 55c424289b9..4325c15745b 100644 --- a/components/radio/nz-radio.component.ts +++ b/components/radio/nz-radio.component.ts @@ -16,7 +16,8 @@ import { } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Subject } from 'rxjs'; -import { InputBoolean } from '../core/util/convert'; + +import { InputBoolean } from 'ng-zorro-antd/core'; @Component({ selector: '[nz-radio]', diff --git a/components/radio/package.json b/components/radio/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/radio/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/radio/style/entry.less b/components/radio/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/radio/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/rate/doc/index.en-US.md b/components/rate/doc/index.en-US.md index 4087c162b87..9bdd6432439 100644 --- a/components/rate/doc/index.en-US.md +++ b/components/rate/doc/index.en-US.md @@ -13,6 +13,14 @@ Rate component. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzRateModule } from 'ng-zorro-antd'; +``` + ### nz-rate | Property | Description | type | Default | diff --git a/components/rate/doc/index.zh-CN.md b/components/rate/doc/index.zh-CN.md index 9e8da3dc511..36420487754 100644 --- a/components/rate/doc/index.zh-CN.md +++ b/components/rate/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Rate ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzRateModule } from 'ng-zorro-antd'; +``` + ### nz-rate | 属性 | 说明 | 类型 | 默认值 | diff --git a/components/rate/nz-rate-item.component.ts b/components/rate/nz-rate-item.component.ts index d21864315ae..0df1f768394 100644 --- a/components/rate/nz-rate-item.component.ts +++ b/components/rate/nz-rate-item.component.ts @@ -7,7 +7,7 @@ import { TemplateRef, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util'; +import { InputBoolean } from 'ng-zorro-antd/core'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/components/rate/nz-rate.component.ts b/components/rate/nz-rate.component.ts index c8a66d0b9a4..702c78fb109 100644 --- a/components/rate/nz-rate.component.ts +++ b/components/rate/nz-rate.component.ts @@ -18,9 +18,8 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NgClassType } from '../core/types/ng-class'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean, NgClassType } from 'ng-zorro-antd/core'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/components/rate/nz-rate.module.ts b/components/rate/nz-rate.module.ts index 2baa329061f..3e812333682 100644 --- a/components/rate/nz-rate.module.ts +++ b/components/rate/nz-rate.module.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { NzRateItemComponent } from './nz-rate-item.component'; import { NzRateComponent } from './nz-rate.component'; diff --git a/components/rate/nz-rate.spec.ts b/components/rate/nz-rate.spec.ts index 2912e885d98..1c20581d103 100644 --- a/components/rate/nz-rate.spec.ts +++ b/components/rate/nz-rate.spec.ts @@ -3,7 +3,7 @@ import { fakeAsync, flush, ComponentFixture, TestBed } from '@angular/core/testi import { FormsModule, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchFakeEvent, dispatchKeyboardEvent } from '../core/testing'; +import { dispatchFakeEvent, dispatchKeyboardEvent } from 'ng-zorro-antd/core'; import { LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes'; import { NzRateComponent } from './nz-rate.component'; diff --git a/components/rate/package.json b/components/rate/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/rate/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/rate/public-api.ts b/components/rate/public-api.ts index 386d63ae333..07747b904f9 100644 --- a/components/rate/public-api.ts +++ b/components/rate/public-api.ts @@ -1,2 +1,3 @@ export * from './nz-rate.component'; export * from './nz-rate.module'; +export * from './nz-rate-item.component'; diff --git a/components/rate/style/entry.less b/components/rate/style/entry.less new file mode 100644 index 00000000000..fca13534209 --- /dev/null +++ b/components/rate/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../tooltip/style/index.less'; diff --git a/components/select/doc/index.en-US.md b/components/select/doc/index.en-US.md index 10aab11feda..27e561a30a9 100644 --- a/components/select/doc/index.en-US.md +++ b/components/select/doc/index.en-US.md @@ -19,6 +19,14 @@ Select component to select value from options. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzSelectModule } from 'ng-zorro-antd'; +``` + ### nz-select | Property | Description | Type | Default | diff --git a/components/select/doc/index.zh-CN.md b/components/select/doc/index.zh-CN.md index 32b475f9092..485641ece70 100644 --- a/components/select/doc/index.zh-CN.md +++ b/components/select/doc/index.zh-CN.md @@ -20,6 +20,14 @@ title: Select ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzSelectModule } from 'ng-zorro-antd'; +``` + ### nz-select | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/select/nz-option-container.spec.ts b/components/select/nz-option-container.spec.ts index aad883430ec..176a47b9d53 100644 --- a/components/select/nz-option-container.spec.ts +++ b/components/select/nz-option-container.spec.ts @@ -3,7 +3,9 @@ import { fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testin import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ReplaySubject, Subject } from 'rxjs'; -import { dispatchFakeEvent } from '../core/testing'; + +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; + import { NzOptionContainerComponent } from './nz-option-container.component'; import { NzOptionGroupComponent } from './nz-option-group.component'; import { NzOptionComponent } from './nz-option.component'; diff --git a/components/select/nz-option-li.component.ts b/components/select/nz-option-li.component.ts index cb7c8481967..7da692a87d2 100644 --- a/components/select/nz-option-li.component.ts +++ b/components/select/nz-option-li.component.ts @@ -12,7 +12,9 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { isNotNil } from '../core/util/check'; + +import { isNotNil } from 'ng-zorro-antd/core'; + import { NzOptionComponent } from './nz-option.component'; import { NzSelectService } from './nz-select.service'; diff --git a/components/select/nz-option-li.spec.ts b/components/select/nz-option-li.spec.ts index f10b9aa06c7..f7f3d4aff1a 100644 --- a/components/select/nz-option-li.spec.ts +++ b/components/select/nz-option-li.spec.ts @@ -2,7 +2,9 @@ import { Component, DebugElement } from '@angular/core'; import { fakeAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { ReplaySubject, Subject } from 'rxjs'; -import { dispatchFakeEvent } from '../core/testing'; + +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; + import { NzOptionLiComponent } from './nz-option-li.component'; import { NzOptionComponent } from './nz-option.component'; import { NzSelectService } from './nz-select.service'; diff --git a/components/select/nz-option.component.ts b/components/select/nz-option.component.ts index 622d24e53b9..1626d2185d1 100644 --- a/components/select/nz-option.component.ts +++ b/components/select/nz-option.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-option', diff --git a/components/select/nz-select-top-control.component.ts b/components/select/nz-select-top-control.component.ts index 82c482ec8dc..9b2511bc4d8 100644 --- a/components/select/nz-select-top-control.component.ts +++ b/components/select/nz-select-top-control.component.ts @@ -15,8 +15,9 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { zoomMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; + +import { zoomMotion, NzNoAnimationDirective } from 'ng-zorro-antd/core'; + import { NzOptionComponent } from './nz-option.component'; import { NzSelectService } from './nz-select.service'; diff --git a/components/select/nz-select-top-control.spec.ts b/components/select/nz-select-top-control.spec.ts index 5957cb5d36d..ecb2e0b3d71 100644 --- a/components/select/nz-select-top-control.spec.ts +++ b/components/select/nz-select-top-control.spec.ts @@ -3,7 +3,9 @@ import { fakeAsync, flush, ComponentFixture, TestBed } from '@angular/core/testi import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Subject } from 'rxjs'; -import { dispatchFakeEvent } from '../core/testing'; + +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; + import { createListOfOption } from './nz-option-container.spec'; import { NzSelectTopControlComponent } from './nz-select-top-control.component'; import { NzSelectModule } from './nz-select.module'; diff --git a/components/select/nz-select.component.spec.ts b/components/select/nz-select.component.spec.ts index 554fb321805..2bd536b8efa 100644 --- a/components/select/nz-select.component.spec.ts +++ b/components/select/nz-select.component.spec.ts @@ -4,7 +4,7 @@ import { async, fakeAsync, flush, inject, tick, ComponentFixture, TestBed } from import { FormsModule, FormBuilder, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchKeyboardEvent } from '../core/testing'; +import { dispatchKeyboardEvent } from 'ng-zorro-antd/core'; import { NzOptionComponent } from './nz-option.component'; import { OverlayContainer } from '@angular/cdk/overlay'; diff --git a/components/select/nz-select.component.ts b/components/select/nz-select.component.ts index 442f556c954..2156e8d073f 100644 --- a/components/select/nz-select.component.ts +++ b/components/select/nz-select.component.ts @@ -25,11 +25,16 @@ import { import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { merge, EMPTY, Subject } from 'rxjs'; import { flatMap, startWith, takeUntil } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzSizeLDSType } from '../core/types/size'; -import { isNotNil } from '../core/util/check'; -import { toBoolean, InputBoolean } from '../core/util/convert'; + +import { + isNotNil, + slideMotion, + toBoolean, + InputBoolean, + NzNoAnimationDirective, + NzSizeLDSType +} from 'ng-zorro-antd/core'; + import { NzOptionGroupComponent } from './nz-option-group.component'; import { NzOptionComponent } from './nz-option.component'; import { TFilterOption } from './nz-option.pipe'; diff --git a/components/select/nz-select.module.ts b/components/select/nz-select.module.ts index 8fa81aeb794..7361a3197f1 100644 --- a/components/select/nz-select.module.ts +++ b/components/select/nz-select.module.ts @@ -2,12 +2,12 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzEmptyModule } from '../empty/nz-empty.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzAddOnModule, NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; + import { NzOptionContainerComponent } from './nz-option-container.component'; import { NzOptionGroupComponent } from './nz-option-group.component'; import { NzOptionLiComponent } from './nz-option-li.component'; diff --git a/components/select/nz-select.service.ts b/components/select/nz-select.service.ts index 7365cffa275..f12811e08ec 100644 --- a/components/select/nz-select.service.ts +++ b/components/select/nz-select.service.ts @@ -2,7 +2,9 @@ import { BACKSPACE, DOWN_ARROW, ENTER, SPACE, TAB, UP_ARROW } from '@angular/cdk import { Injectable } from '@angular/core'; import { combineLatest, merge, BehaviorSubject, ReplaySubject, Subject } from 'rxjs'; import { distinctUntilChanged, filter, map, share, skip, tap } from 'rxjs/operators'; -import { isNil, isNotNil } from '../core/util'; + +import { isNil, isNotNil } from 'ng-zorro-antd/core'; + import { NzOptionGroupComponent } from './nz-option-group.component'; import { NzOptionComponent } from './nz-option.component'; import { defaultFilterOption, NzFilterOptionPipe, TFilterOption } from './nz-option.pipe'; diff --git a/components/select/package.json b/components/select/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/select/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/select/public-api.ts b/components/select/public-api.ts index 0488f4267c7..a71bf2ce17e 100644 --- a/components/select/public-api.ts +++ b/components/select/public-api.ts @@ -3,3 +3,8 @@ export * from './nz-option-container.component'; export * from './nz-option.component'; export * from './nz-select.component'; export * from './nz-select.module'; +export * from './nz-option-li.component'; +export * from './nz-option.pipe'; +export * from './nz-select-top-control.component'; +export * from './nz-select-unselectable.directive'; +export * from './nz-select.service'; diff --git a/components/select/style/entry.less b/components/select/style/entry.less new file mode 100644 index 00000000000..517e66a923a --- /dev/null +++ b/components/select/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../empty/style/index.less'; diff --git a/components/skeleton/doc/index.en-US.md b/components/skeleton/doc/index.en-US.md index df9f4993832..80381765489 100644 --- a/components/skeleton/doc/index.en-US.md +++ b/components/skeleton/doc/index.en-US.md @@ -14,6 +14,14 @@ Provide a placeholder at the place which need waiting for loading. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzSkeletonModule } from 'ng-zorro-antd'; +``` + ### nz-skeleton | Property | Description | Type | Default | diff --git a/components/skeleton/doc/index.zh-CN.md b/components/skeleton/doc/index.zh-CN.md index 9424aa06ea4..7e47b402ff2 100644 --- a/components/skeleton/doc/index.zh-CN.md +++ b/components/skeleton/doc/index.zh-CN.md @@ -16,6 +16,14 @@ cols: 1 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzSkeletonModule } from 'ng-zorro-antd'; +``` + ### nz-skeleton | 属性 | 说明 | 类型 | 默认值 | diff --git a/components/skeleton/nz-skeleton.component.ts b/components/skeleton/nz-skeleton.component.ts index 98bee9cb2c9..fe9127eb8d9 100644 --- a/components/skeleton/nz-skeleton.component.ts +++ b/components/skeleton/nz-skeleton.component.ts @@ -11,7 +11,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { toCssPixel } from '../core/util'; +import { toCssPixel } from 'ng-zorro-antd/core'; import { AvatarShape, AvatarSize, NzSkeletonAvatar, NzSkeletonParagraph, NzSkeletonTitle } from './nz-skeleton.type'; @Component({ diff --git a/components/skeleton/package.json b/components/skeleton/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/skeleton/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/skeleton/style/entry.less b/components/skeleton/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/skeleton/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/slider/doc/index.en-US.md b/components/slider/doc/index.en-US.md index e24f2c21641..7e8401226ff 100644 --- a/components/slider/doc/index.en-US.md +++ b/components/slider/doc/index.en-US.md @@ -12,6 +12,14 @@ To input a value in a range. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzSliderModule } from 'ng-zorro-antd'; +``` + ### nz-slider | Property | Description | Type | Default | diff --git a/components/slider/doc/index.zh-CN.md b/components/slider/doc/index.zh-CN.md index 64523efb32b..8c9eff38959 100644 --- a/components/slider/doc/index.zh-CN.md +++ b/components/slider/doc/index.zh-CN.md @@ -13,6 +13,14 @@ title: Slider ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzSliderModule } from 'ng-zorro-antd'; +``` + ### nz-slider | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/slider/nz-slider-handle.component.ts b/components/slider/nz-slider-handle.component.ts index 20f21d6b0bd..bb2b97c5079 100644 --- a/components/slider/nz-slider-handle.component.ts +++ b/components/slider/nz-slider-handle.component.ts @@ -10,10 +10,9 @@ import { ViewEncapsulation } from '@angular/core'; import { Subscription } from 'rxjs'; -import { NGStyleInterface } from '../core/types/ng-class'; -import { InputBoolean } from '../core/util/convert'; -import { NzToolTipComponent } from '../tooltip/nz-tooltip.component'; +import { InputBoolean, NGStyleInterface } from 'ng-zorro-antd/core'; +import { NzToolTipComponent } from 'ng-zorro-antd/tooltip'; import { SliderShowTooltip } from './nz-slider-definitions'; import { NzSliderComponent } from './nz-slider.component'; diff --git a/components/slider/nz-slider-marks.component.ts b/components/slider/nz-slider-marks.component.ts index 8f887fdfaf9..a5fa696f30d 100644 --- a/components/slider/nz-slider-marks.component.ts +++ b/components/slider/nz-slider-marks.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { isConfigAObject, DisplayedMark, ExtendedMark, Mark } from './nz-slider-definitions'; diff --git a/components/slider/nz-slider-step.component.ts b/components/slider/nz-slider-step.component.ts index e07a468e1a6..2d4a29daa0b 100644 --- a/components/slider/nz-slider-step.component.ts +++ b/components/slider/nz-slider-step.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { DisplayedStep, ExtendedMark } from './nz-slider-definitions'; diff --git a/components/slider/nz-slider-track.component.ts b/components/slider/nz-slider-track.component.ts index ec26743679b..2c45e891290 100644 --- a/components/slider/nz-slider-track.component.ts +++ b/components/slider/nz-slider-track.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { InputBoolean, InputNumber } from '../core/util/convert'; +import { InputBoolean, InputNumber } from 'ng-zorro-antd/core'; export interface NzSliderTrackStyle { bottom?: string | null; diff --git a/components/slider/nz-slider.component.ts b/components/slider/nz-slider.component.ts index 7906bba62b4..bc54b474ad0 100644 --- a/components/slider/nz-slider.component.ts +++ b/components/slider/nz-slider.component.ts @@ -18,11 +18,17 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { fromEvent, merge, Observable, Subscription } from 'rxjs'; import { distinctUntilChanged, filter, map, pluck, takeUntil, tap } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; -import { getElementOffset, silentEvent, MouseTouchObserverConfig } from '../core/util/dom'; - -import { arraysEqual, shallowCopyArray } from '../core/util/array'; -import { ensureNumberInRange, getPercent, getPrecision } from '../core/util/number'; +import { + arraysEqual, + ensureNumberInRange, + getElementOffset, + getPercent, + getPrecision, + shallowCopyArray, + silentEvent, + InputBoolean, + MouseTouchObserverConfig +} from 'ng-zorro-antd/core'; import { isValueARange, diff --git a/components/slider/nz-slider.module.ts b/components/slider/nz-slider.module.ts index a7e167b3810..64ca87e7cc3 100644 --- a/components/slider/nz-slider.module.ts +++ b/components/slider/nz-slider.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { NzSliderHandleComponent } from './nz-slider-handle.component'; import { NzSliderMarksComponent } from './nz-slider-marks.component'; diff --git a/components/slider/nz-slider.spec.ts b/components/slider/nz-slider.spec.ts index 80f1e8ecc55..b09070de709 100644 --- a/components/slider/nz-slider.spec.ts +++ b/components/slider/nz-slider.spec.ts @@ -5,7 +5,7 @@ import { AbstractControl, FormsModule, FormBuilder, FormGroup, ReactiveFormsModu import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { SliderShowTooltip } from './nz-slider-definitions'; import { NzSliderComponent } from './nz-slider.component'; import { NzSliderModule } from './nz-slider.module'; diff --git a/components/slider/package.json b/components/slider/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/slider/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/slider/style/entry.less b/components/slider/style/entry.less new file mode 100644 index 00000000000..fca13534209 --- /dev/null +++ b/components/slider/style/entry.less @@ -0,0 +1,3 @@ +@import './index.less'; +// style dependencies +@import '../../tooltip/style/index.less'; diff --git a/components/spin/doc/index.en-US.md b/components/spin/doc/index.en-US.md index e2194d44c5f..b87185c45fb 100644 --- a/components/spin/doc/index.en-US.md +++ b/components/spin/doc/index.en-US.md @@ -12,6 +12,14 @@ When part of the page is waiting for asynchronous data or during a rendering pro ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzSpinModule } from 'ng-zorro-antd'; +``` + ### nz-spin | Property | Description | Type | Default Value | diff --git a/components/spin/doc/index.zh-CN.md b/components/spin/doc/index.zh-CN.md index 91c2978deb8..d406e2676f6 100644 --- a/components/spin/doc/index.zh-CN.md +++ b/components/spin/doc/index.zh-CN.md @@ -13,6 +13,14 @@ subtitle: 加载中 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzSpinModule } from 'ng-zorro-antd'; +``` + ### nz-spin | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/spin/nz-spin.component.ts b/components/spin/nz-spin.component.ts index 652450015bd..4c9da9e6844 100644 --- a/components/spin/nz-spin.component.ts +++ b/components/spin/nz-spin.component.ts @@ -12,9 +12,8 @@ import { } from '@angular/core'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; -import { NzSizeLDSType } from '../core/types/size'; -import { InputBoolean, InputNumber } from '../core/util/convert'; +import { InputBoolean, InputNumber, NzSizeLDSType } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-spin', diff --git a/components/spin/package.json b/components/spin/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/spin/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/spin/style/entry.less b/components/spin/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/spin/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/statistic/doc/index.en-US.md b/components/statistic/doc/index.en-US.md index b90e46cee2a..d628d8e2f1c 100644 --- a/components/statistic/doc/index.en-US.md +++ b/components/statistic/doc/index.en-US.md @@ -13,6 +13,14 @@ Display statistic number. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzStatisticModule } from 'ng-zorro-antd'; +``` + ### nz-statistic | Property | Description | Type | Default | diff --git a/components/statistic/doc/index.zh-CN.md b/components/statistic/doc/index.zh-CN.md index 6db981d71d7..ea76627f52b 100644 --- a/components/statistic/doc/index.zh-CN.md +++ b/components/statistic/doc/index.zh-CN.md @@ -14,6 +14,14 @@ type: 数据展示 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzStatisticModule } from 'ng-zorro-antd'; +``` + ### nz-statistic | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/statistic/nz-statistic.module.ts b/components/statistic/nz-statistic.module.ts index 687841af8dd..98a5245b257 100644 --- a/components/statistic/nz-statistic.module.ts +++ b/components/statistic/nz-statistic.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; import { NzCountdownComponent } from './nz-countdown.component'; import { NzStatisticNumberComponent } from './nz-statistic-number.component'; import { NzStatisticComponent } from './nz-statistic.component'; diff --git a/components/statistic/nz-time-range.pipe.ts b/components/statistic/nz-time-range.pipe.ts index aca1c1c2a7f..4d493d734b1 100644 --- a/components/statistic/nz-time-range.pipe.ts +++ b/components/statistic/nz-time-range.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { padStart, timeUnits } from '../core/util'; +import { padStart, timeUnits } from 'ng-zorro-antd/core'; @Pipe({ name: 'nzTimeRange', diff --git a/components/statistic/package.json b/components/statistic/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/statistic/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/statistic/public-api.ts b/components/statistic/public-api.ts index a8402dfb125..15ae2831036 100644 --- a/components/statistic/public-api.ts +++ b/components/statistic/public-api.ts @@ -1,3 +1,5 @@ export * from './nz-countdown.component'; export * from './nz-statistic.component'; export * from './nz-statistic.module'; +export * from './nz-statistic-number.component'; +export * from './nz-time-range.pipe'; diff --git a/components/statistic/style/entry.less b/components/statistic/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/statistic/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/steps/doc/index.en-US.md b/components/steps/doc/index.en-US.md index d1584cb02da..a920bb9cdf0 100755 --- a/components/steps/doc/index.en-US.md +++ b/components/steps/doc/index.en-US.md @@ -21,6 +21,14 @@ When the task is complicated or has a certain sequence in the series of subtasks ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzStepsModule } from 'ng-zorro-antd'; +``` + ### nz-steps The whole of the step bar. diff --git a/components/steps/doc/index.zh-CN.md b/components/steps/doc/index.zh-CN.md index 342b0f2367f..b1a1d6a3e5e 100755 --- a/components/steps/doc/index.zh-CN.md +++ b/components/steps/doc/index.zh-CN.md @@ -22,6 +22,14 @@ title: Steps ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzStepsModule } from 'ng-zorro-antd'; +``` + ### nz-steps 整体步骤条。 diff --git a/components/steps/nz-step.component.ts b/components/steps/nz-step.component.ts index d468e8bd280..4905fa52a74 100644 --- a/components/steps/nz-step.component.ts +++ b/components/steps/nz-step.component.ts @@ -10,7 +10,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NgClassType } from '../core/types/ng-class'; +import { NgClassType } from 'ng-zorro-antd/core'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/components/steps/nz-steps.component.ts b/components/steps/nz-steps.component.ts index 50a5f2e106a..553f4d27473 100644 --- a/components/steps/nz-steps.component.ts +++ b/components/steps/nz-steps.component.ts @@ -15,9 +15,7 @@ import { import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NgClassType } from '../core/types/ng-class'; -import { NzSizeDSType } from '../core/types/size'; -import { toBoolean } from '../core/util/convert'; +import { toBoolean, NgClassType, NzSizeDSType } from 'ng-zorro-antd/core'; import { NzStepComponent } from './nz-step.component'; diff --git a/components/steps/nz-steps.module.ts b/components/steps/nz-steps.module.ts index 1a01d1cff1d..553b11b7635 100644 --- a/components/steps/nz-steps.module.ts +++ b/components/steps/nz-steps.module.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzStepComponent } from './nz-step.component'; import { NzStepsComponent } from './nz-steps.component'; diff --git a/components/steps/package.json b/components/steps/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/steps/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/steps/style/entry.less b/components/steps/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/steps/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/switch/doc/index.en-US.md b/components/switch/doc/index.en-US.md index 185ad274b2a..5e2b43c400b 100755 --- a/components/switch/doc/index.en-US.md +++ b/components/switch/doc/index.en-US.md @@ -13,6 +13,14 @@ Switching Selector. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzSwitchModule } from 'ng-zorro-antd'; +``` + ### nz-switch | Property | Description | Type | Default | diff --git a/components/switch/doc/index.zh-CN.md b/components/switch/doc/index.zh-CN.md index 1b09c9bb58d..6508b01c767 100755 --- a/components/switch/doc/index.zh-CN.md +++ b/components/switch/doc/index.zh-CN.md @@ -14,6 +14,14 @@ title: Switch ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzSwitchModule } from 'ng-zorro-antd'; +``` + ### nz-switch | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/switch/nz-switch.component.ts b/components/switch/nz-switch.component.ts index 1d1f83591d8..46e27d6c6b7 100644 --- a/components/switch/nz-switch.component.ts +++ b/components/switch/nz-switch.component.ts @@ -13,9 +13,8 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { NzSizeDSType } from '../core/types/size'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean, NzSizeDSType } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-switch', diff --git a/components/switch/nz-switch.module.ts b/components/switch/nz-switch.module.ts index 95ce1f9b8b2..abc789cc926 100644 --- a/components/switch/nz-switch.module.ts +++ b/components/switch/nz-switch.module.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzWaveModule } from '../core/wave/nz-wave.module'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzAddOnModule, NzWaveModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzSwitchComponent } from './nz-switch.component'; diff --git a/components/switch/nz-switch.spec.ts b/components/switch/nz-switch.spec.ts index 14c8a901048..b57eb249c2b 100644 --- a/components/switch/nz-switch.spec.ts +++ b/components/switch/nz-switch.spec.ts @@ -4,7 +4,7 @@ import { fakeAsync, flush, ComponentFixture, TestBed } from '@angular/core/testi import { FormsModule, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchKeyboardEvent } from '../core/testing'; +import { dispatchKeyboardEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzSwitchComponent } from './nz-switch.component'; diff --git a/components/switch/package.json b/components/switch/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/switch/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/switch/style/entry.less b/components/switch/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/switch/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/table/doc/index.en-US.md b/components/table/doc/index.en-US.md index f7384271e74..29fa797351f 100644 --- a/components/table/doc/index.en-US.md +++ b/components/table/doc/index.en-US.md @@ -55,6 +55,14 @@ The data passed to `[nzData]` will be export with [Template Context](https://ang ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTableModule } from 'ng-zorro-antd'; +``` + ### nz-table | Property | Description | Type | Default | diff --git a/components/table/doc/index.zh-CN.md b/components/table/doc/index.zh-CN.md index 64451c9834c..d972ae2ffa3 100644 --- a/components/table/doc/index.zh-CN.md +++ b/components/table/doc/index.zh-CN.md @@ -56,6 +56,14 @@ Table 组件同时具备了易用性和高度可定制性 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTableModule } from 'ng-zorro-antd'; +``` + ### nz-table | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/table/nz-table.component.ts b/components/table/nz-table.component.ts index 5c5c80f91d9..1b2c7aed803 100644 --- a/components/table/nz-table.component.ts +++ b/components/table/nz-table.component.ts @@ -24,10 +24,10 @@ import { } from '@angular/core'; import { fromEvent, merge, EMPTY, Subject } from 'rxjs'; import { flatMap, startWith, takeUntil } from 'rxjs/operators'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; -import { NzSizeMDSType } from '../core/types/size'; -import { InputBoolean, InputNumber } from '../core/util/convert'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { InputBoolean, InputNumber, NzMeasureScrollbarService, NzSizeMDSType } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; + import { NzThComponent } from './nz-th.component'; import { NzTheadComponent } from './nz-thead.component'; import { NzVirtualScrollDirective } from './nz-virtual-scroll.directive'; diff --git a/components/table/nz-table.module.ts b/components/table/nz-table.module.ts index ef03709c979..a1a28237def 100644 --- a/components/table/nz-table.module.ts +++ b/components/table/nz-table.module.ts @@ -2,16 +2,17 @@ import { ScrollingModule } from '@angular/cdk/scrolling'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzCheckboxModule } from '../checkbox/nz-checkbox.module'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzDropDownModule } from '../dropdown/nz-dropdown.module'; -import { NzEmptyModule } from '../empty/nz-empty.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzMenuModule } from '../menu/nz-menu.module'; -import { NzPaginationModule } from '../pagination/nz-pagination.module'; -import { NzRadioModule } from '../radio/nz-radio.module'; -import { NzSpinModule } from '../spin/nz-spin.module'; + +import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzDropDownModule } from 'ng-zorro-antd/dropdown'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzMenuModule } from 'ng-zorro-antd/menu'; +import { NzPaginationModule } from 'ng-zorro-antd/pagination'; +import { NzRadioModule } from 'ng-zorro-antd/radio'; +import { NzSpinModule } from 'ng-zorro-antd/spin'; import { NzTableComponent } from './nz-table.component'; import { NzTbodyDirective } from './nz-tbody.directive'; diff --git a/components/table/nz-tbody.spec.ts b/components/table/nz-tbody.spec.ts index 47d4486b788..79a8b745663 100644 --- a/components/table/nz-tbody.spec.ts +++ b/components/table/nz-tbody.spec.ts @@ -1,7 +1,7 @@ import { Component, DebugElement } from '@angular/core'; import { fakeAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; +import { NzMeasureScrollbarService } from 'ng-zorro-antd/core'; import { NzTableModule } from './nz-table.module'; import { NzTbodyDirective } from './nz-tbody.directive'; diff --git a/components/table/nz-td.component.ts b/components/table/nz-td.component.ts index cae8f23f3cf..1b44431f838 100644 --- a/components/table/nz-td.component.ts +++ b/components/table/nz-td.component.ts @@ -9,10 +9,8 @@ import { SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { isNotNil } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; +import { isNotNil, InputBoolean, NzUpdateHostClassService } from 'ng-zorro-antd/core'; @Component({ // tslint:disable-next-line:component-selector diff --git a/components/table/nz-td.spec.ts b/components/table/nz-td.spec.ts index 30bb599e3cc..d619ed013ea 100644 --- a/components/table/nz-td.spec.ts +++ b/components/table/nz-td.spec.ts @@ -2,8 +2,10 @@ import { Component, DebugElement } from '@angular/core'; import { fakeAsync, flush, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { NzCheckboxModule } from '../checkbox'; -import { createFakeEvent } from '../core/testing'; + +import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; +import { createFakeEvent } from 'ng-zorro-antd/core'; + import { NzTdComponent } from './nz-td.component'; describe('nz-td', () => { diff --git a/components/table/nz-th.component.ts b/components/table/nz-th.component.ts index cb3a77b3d82..90fc7427b1f 100644 --- a/components/table/nz-th.component.ts +++ b/components/table/nz-th.component.ts @@ -14,11 +14,10 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { isNotNil } from '../core/util/check'; -import { InputBoolean } from '../core/util/convert'; -import { NzDropDownComponent } from '../dropdown/nz-dropdown.component'; -import { NzI18nInterface } from '../i18n/nz-i18n.interface'; -import { NzI18nService } from '../i18n/nz-i18n.service'; + +import { isNotNil, InputBoolean } from 'ng-zorro-antd/core'; +import { NzDropDownComponent } from 'ng-zorro-antd/dropdown'; +import { NzI18nInterface, NzI18nService } from 'ng-zorro-antd/i18n'; /* tslint:disable-next-line:no-any */ export type NzThFilterType = Array<{ text: string; value: any; byDefault?: boolean }>; diff --git a/components/table/nz-thead.component.ts b/components/table/nz-thead.component.ts index 3b0faeb1922..d9ef71b047b 100644 --- a/components/table/nz-thead.component.ts +++ b/components/table/nz-thead.component.ts @@ -17,10 +17,11 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; - import { merge, Subject } from 'rxjs'; import { flatMap, startWith, takeUntil } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; + +import { InputBoolean } from 'ng-zorro-antd/core'; + import { NzTableComponent } from './nz-table.component'; import { NzThComponent } from './nz-th.component'; diff --git a/components/table/nz-thead.spec.ts b/components/table/nz-thead.spec.ts index 614a63e52cd..0109e24aee5 100644 --- a/components/table/nz-thead.spec.ts +++ b/components/table/nz-thead.spec.ts @@ -1,7 +1,7 @@ import { Component, DebugElement } from '@angular/core'; import { fakeAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; +import { NzMeasureScrollbarService } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzTableComponent } from './nz-table.component'; import { NzTableModule } from './nz-table.module'; diff --git a/components/table/nz-tr.directive.ts b/components/table/nz-tr.directive.ts index 06d43cab44c..11b0c5eddd9 100644 --- a/components/table/nz-tr.directive.ts +++ b/components/table/nz-tr.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, Host, Input, Optional, Renderer2 } from '@angular/core'; -import { toBoolean } from '../core/util/convert'; +import { toBoolean } from 'ng-zorro-antd/core'; import { NzTableComponent } from './nz-table.component'; @Directive({ diff --git a/components/table/nz-tr.spec.ts b/components/table/nz-tr.spec.ts index 425c2ac6c3e..1c12ef291d3 100644 --- a/components/table/nz-tr.spec.ts +++ b/components/table/nz-tr.spec.ts @@ -1,7 +1,7 @@ import { Component, DebugElement } from '@angular/core'; import { fakeAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NzMeasureScrollbarService } from '../core/services/nz-measure-scrollbar.service'; +import { NzMeasureScrollbarService } from 'ng-zorro-antd/core'; import { NzTableModule } from './nz-table.module'; import { NzTrDirective } from './nz-tr.directive'; diff --git a/components/table/package.json b/components/table/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/table/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/table/public-api.ts b/components/table/public-api.ts index 39bda9bb7f4..1c0f96a8f0e 100644 --- a/components/table/public-api.ts +++ b/components/table/public-api.ts @@ -5,3 +5,4 @@ export * from './nz-td.component'; export * from './nz-th.component'; export * from './nz-thead.component'; export * from './nz-tr.directive'; +export * from './nz-virtual-scroll.directive'; diff --git a/components/table/style/entry.less b/components/table/style/entry.less new file mode 100644 index 00000000000..d89fc8c6485 --- /dev/null +++ b/components/table/style/entry.less @@ -0,0 +1,10 @@ +@import './index.less'; +@import './patch.less'; +// style dependencies +// deps-lint-skip: menu +@import '../../empty/style/index.less'; +@import '../../radio/style/index.less'; +@import '../../checkbox/style/index.less'; +@import '../../dropdown/style/index.less'; +@import '../../spin/style/index.less'; +@import '../../pagination/style/index.less'; diff --git a/components/table/style/patch.less b/components/table/style/patch.less new file mode 100644 index 00000000000..8a0f8ea17c1 --- /dev/null +++ b/components/table/style/patch.less @@ -0,0 +1,153 @@ +@import "./size"; + +@table-prefix-cls: ~'@{ant-prefix}-table'; +@table-td-cls: ~'@{table-prefix-cls}-td'; +@table-th-cls: ~'@{table-prefix-cls}-th'; +@table-th-left-cls: ~'@{table-th-cls}-left'; +@table-th-right-cls: ~'@{table-th-cls}-right'; +@table-td-left-cls: ~'@{table-td-cls}-left'; +@table-td-right-cls: ~'@{table-td-cls}-right'; + +nz-table { + .@{table-prefix-cls} { + table { + border-collapse: separate; + border-spacing: 0; + } + } +} + +.box-shadow-left() { + .@{table-th-right-cls}-sticky, + .@{table-td-right-cls}-sticky { + box-shadow: -6px 0 6px 0px rgba(0, 0, 0, .05); + } +} + +.box-shadow-right() { + .@{table-th-left-cls}-sticky, + .@{table-td-left-cls}-sticky { + box-shadow: 6px 0 6px 0px rgba(0, 0, 0, .05); + } +} + +.border-left() { + .@{table-th-right-cls}-sticky, + .@{table-td-right-cls}-sticky { + border-right: @border-width-base @border-style-base @border-color-split; + } +} + +.border-right() { + .@{table-th-left-cls}-sticky, + .@{table-td-left-cls}-sticky { + border-left: @border-width-base @border-style-base @border-color-split; + } +} + +.@{table-prefix-cls}-scroll-position-middle, +.@{table-prefix-cls}-scroll-position-left { + .@{table-td-right-cls}-sticky + .@{table-td-right-cls}-sticky { + box-shadow: none; + } + + .@{table-th-right-cls}-sticky + .@{table-th-right-cls}-sticky { + box-shadow: none; + } +} + + +.@{table-th-left-cls}-sticky, +.@{table-th-right-cls}-sticky, +.@{table-td-right-cls}-sticky, +.@{table-td-left-cls}-sticky { + position: sticky !important; + z-index: 1; +} + +.@{table-td-left-cls}-sticky, +.@{table-td-right-cls}-sticky { + background: @component-background; +} + +.@{table-prefix-cls}-tbody { + & > tr { + &:hover { + & > td { + &.@{table-td-left-cls}-sticky { + background: @table-row-hover-bg; + } + + &.@{table-td-right-cls}-sticky { + background: @table-row-hover-bg; + } + } + } + } +} + +.@{table-prefix-cls}-thead > tr > th .@{table-prefix-cls}-column-sorters > nz-dropdown { + position: static !important; +} + +.@{table-prefix-cls}-scroll-position-middle { + .box-shadow-right; + .box-shadow-left; +} + +.@{table-prefix-cls}-scroll-position-left { + .box-shadow-left; +} + +.@{table-prefix-cls}-scroll-position-right { + .box-shadow-right; +} + +.@{table-prefix-cls}-bordered { + &.@{table-prefix-cls}-scroll-position-middle { + .border-right; + .border-left; + } + + &.@{table-prefix-cls}-scroll-position-left { + .border-left; + } + + &.@{table-prefix-cls}-scroll-position-right { + .border-right; + } +} + + +.@{table-prefix-cls}-middle { + > .@{table-prefix-cls}-content { + > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > .cdk-virtual-scroll-content-wrapper > table { + > .@{table-prefix-cls}-thead > tr > th, + > .@{table-prefix-cls}-tbody > tr > td { + padding: @table-padding-vertical-md @table-padding-horizontal-md; + } + } + } +} + +.@{table-prefix-cls}-small { + > .@{table-prefix-cls}-content { + > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-header > table, + > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > table, + > .@{table-prefix-cls}-scroll > .@{table-prefix-cls}-body > .cdk-virtual-scroll-content-wrapper > table { + border: 0; + + > .@{table-prefix-cls}-thead > tr > th { + &.@{table-th-left-cls}-sticky, + &.@{table-th-right-cls}-sticky { + background: @component-background; + } + } + + > .@{table-prefix-cls}-thead > tr > th, + > .@{table-prefix-cls}-tbody > tr > td { + padding: @table-padding-vertical-sm @table-padding-horizontal-sm; + } + } + } +} diff --git a/components/tabs/doc/index.en-US.md b/components/tabs/doc/index.en-US.md index 2f1bea4ee00..b5fda7c6489 100644 --- a/components/tabs/doc/index.en-US.md +++ b/components/tabs/doc/index.en-US.md @@ -17,6 +17,14 @@ Ant Design has 3 types of Tabs for different situations. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTabsModule } from 'ng-zorro-antd'; +``` + ### nz-tabset | Property | Description | Type | Default | diff --git a/components/tabs/doc/index.zh-CN.md b/components/tabs/doc/index.zh-CN.md index 26e461f44f4..7a2bc7253ac 100644 --- a/components/tabs/doc/index.zh-CN.md +++ b/components/tabs/doc/index.zh-CN.md @@ -20,6 +20,14 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTabsModule } from 'ng-zorro-antd'; +``` + ### nz-tabset | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/tabs/nz-tab-label.directive.ts b/components/tabs/nz-tab-label.directive.ts index a626b2c0a22..50f3e82cbfe 100644 --- a/components/tabs/nz-tab-label.directive.ts +++ b/components/tabs/nz-tab-label.directive.ts @@ -1,6 +1,6 @@ import { Directive, ElementRef, Input, Renderer2 } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; @Directive({ selector: '[nz-tab-label]', diff --git a/components/tabs/nz-tab.component.ts b/components/tabs/nz-tab.component.ts index 7cb48dff057..350dde2461d 100644 --- a/components/tabs/nz-tab.component.ts +++ b/components/tabs/nz-tab.component.ts @@ -16,7 +16,7 @@ import { } from '@angular/core'; import { Subject } from 'rxjs'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { NzTabDirective } from './nz-tab.directive'; @Component({ diff --git a/components/tabs/nz-tabs-ink-bar.directive.ts b/components/tabs/nz-tabs-ink-bar.directive.ts index f1a8d3a9703..a75787dea09 100755 --- a/components/tabs/nz-tabs-ink-bar.directive.ts +++ b/components/tabs/nz-tabs-ink-bar.directive.ts @@ -1,6 +1,6 @@ import { Directive, ElementRef, Input, NgZone, Renderer2 } from '@angular/core'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { NzTabPositionMode } from './nz-tabset.component'; diff --git a/components/tabs/nz-tabs-nav.component.ts b/components/tabs/nz-tabs-nav.component.ts index 2074aa67a5e..b7067b510e4 100644 --- a/components/tabs/nz-tabs-nav.component.ts +++ b/components/tabs/nz-tabs-nav.component.ts @@ -22,7 +22,7 @@ import { import { fromEvent, merge, of as observableOf, Subscription } from 'rxjs'; import { auditTime, startWith } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; +import { InputBoolean } from 'ng-zorro-antd/core'; import { NzTabLabelDirective } from './nz-tab-label.directive'; import { NzTabsInkBarDirective } from './nz-tabs-ink-bar.directive'; diff --git a/components/tabs/nz-tabs-nav.spec.ts b/components/tabs/nz-tabs-nav.spec.ts index e9300e0d8b2..22f65933db0 100644 --- a/components/tabs/nz-tabs-nav.spec.ts +++ b/components/tabs/nz-tabs-nav.spec.ts @@ -7,7 +7,7 @@ import { async, discardPeriodicTasks, fakeAsync, tick, ComponentFixture, TestBed import { By } from '@angular/platform-browser'; import { Subject } from 'rxjs'; -import { dispatchFakeEvent } from '../core/testing'; +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzTabsNavComponent } from './nz-tabs-nav.component'; import { NzTabsModule } from './nz-tabs.module'; diff --git a/components/tabs/nz-tabs.module.ts b/components/tabs/nz-tabs.module.ts index f42f4a93df6..0f4ce85cec2 100644 --- a/components/tabs/nz-tabs.module.ts +++ b/components/tabs/nz-tabs.module.ts @@ -1,8 +1,8 @@ import { ObserversModule } from '@angular/cdk/observers'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzTabBodyComponent } from './nz-tab-body.component'; import { NzTabLabelDirective } from './nz-tab-label.directive'; diff --git a/components/tabs/nz-tabs.spec.ts b/components/tabs/nz-tabs.spec.ts index 6a815e7330d..370711972d5 100644 --- a/components/tabs/nz-tabs.spec.ts +++ b/components/tabs/nz-tabs.spec.ts @@ -1,7 +1,7 @@ import { Component, DebugElement, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NGStyleInterface } from '../core/types/ng-class'; +import { NGStyleInterface } from 'ng-zorro-antd/core'; import { NzTabsModule } from './nz-tabs.module'; import { NzAnimatedInterface, NzTabSetComponent } from './nz-tabset.component'; diff --git a/components/tabs/nz-tabset.component.ts b/components/tabs/nz-tabset.component.ts index b3294877ec3..2b27f742a72 100644 --- a/components/tabs/nz-tabset.component.ts +++ b/components/tabs/nz-tabset.component.ts @@ -24,9 +24,7 @@ import { } from '@angular/core'; import { merge, Subscription } from 'rxjs'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { NzSizeLDSType } from '../core/types/size'; -import { toNumber } from '../core/util/convert'; +import { toNumber, NzSizeLDSType, NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { NzTabComponent } from './nz-tab.component'; import { NzTabsNavComponent } from './nz-tabs-nav.component'; diff --git a/components/tabs/package.json b/components/tabs/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/tabs/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/tabs/public-api.ts b/components/tabs/public-api.ts index 2627f1c2182..339215addd2 100644 --- a/components/tabs/public-api.ts +++ b/components/tabs/public-api.ts @@ -5,3 +5,4 @@ export * from './nz-tabs-ink-bar.directive'; export * from './nz-tabs.module'; export * from './nz-tabs-nav.component'; export * from './nz-tabset.component'; +export * from './nz-tab.directive'; diff --git a/components/tabs/style/entry.less b/components/tabs/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/tabs/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/tag/doc/index.en-US.md b/components/tag/doc/index.en-US.md index c148b290256..3fda96d7166 100644 --- a/components/tag/doc/index.en-US.md +++ b/components/tag/doc/index.en-US.md @@ -14,6 +14,14 @@ Tag for categorizing or markup. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTagModule } from 'ng-zorro-antd'; +``` + ### Tag | Property | Description | Type | Default | diff --git a/components/tag/doc/index.zh-CN.md b/components/tag/doc/index.zh-CN.md index bc842fec337..0f60a23e4ba 100644 --- a/components/tag/doc/index.zh-CN.md +++ b/components/tag/doc/index.zh-CN.md @@ -14,6 +14,16 @@ title: Tag ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +```ts +import { NzTagModule } from 'ng-zorro-antd'; +``` +``` + ### nz-tag | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/tag/nz-tag.component.ts b/components/tag/nz-tag.component.ts index 0bd4de62a7a..1ae4743813b 100644 --- a/components/tag/nz-tag.component.ts +++ b/components/tag/nz-tag.component.ts @@ -11,9 +11,8 @@ import { Renderer2, ViewEncapsulation } from '@angular/core'; -import { fadeMotion } from '../core/animation/fade'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; -import { InputBoolean } from '../core/util/convert'; + +import { fadeMotion, InputBoolean, NzUpdateHostClassService } from 'ng-zorro-antd/core'; @Component({ selector: 'nz-tag', diff --git a/components/tag/nz-tag.module.ts b/components/tag/nz-tag.module.ts index 3a83a506ac1..fa1ff2ecaa0 100644 --- a/components/tag/nz-tag.module.ts +++ b/components/tag/nz-tag.module.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzTagComponent } from './nz-tag.component'; diff --git a/components/tag/package.json b/components/tag/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/tag/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/tag/style/entry.less b/components/tag/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/tag/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/time-picker/doc/index.en-US.md b/components/time-picker/doc/index.en-US.md index adba8b6d98d..57881c0e9dd 100644 --- a/components/time-picker/doc/index.en-US.md +++ b/components/time-picker/doc/index.en-US.md @@ -16,6 +16,14 @@ By clicking the input box, you can select a time from a popup panel. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTimePickerModule } from 'ng-zorro-antd'; +``` + ### nz-time-picker | Property | Description | Type | Default | diff --git a/components/time-picker/doc/index.zh-CN.md b/components/time-picker/doc/index.zh-CN.md index 3424d3f53dd..93f2fbf484e 100644 --- a/components/time-picker/doc/index.zh-CN.md +++ b/components/time-picker/doc/index.zh-CN.md @@ -17,6 +17,14 @@ title: TimePicker ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTimePickerModule } from 'ng-zorro-antd'; +``` + ### nz-time-picker | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/time-picker/nz-time-picker-panel.component.ts b/components/time-picker/nz-time-picker-panel.component.ts index 4644cfa04e3..8d470d301a9 100644 --- a/components/time-picker/nz-time-picker-panel.component.ts +++ b/components/time-picker/nz-time-picker-panel.component.ts @@ -18,10 +18,8 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { reqAnimFrame } from '../core/polyfill/request-animation'; -import { NzUpdateHostClassService as UpdateCls } from '../core/services/update-host-class.service'; -import { InputBoolean } from '../core/util'; -import { isNotNil } from '../core/util/check'; +import { isNotNil, reqAnimFrame, InputBoolean, NzUpdateHostClassService as UpdateCls } from 'ng-zorro-antd/core'; + import { NzTimeValueAccessorDirective } from './nz-time-value-accessor.directive'; import { TimeHolder } from './time-holder'; diff --git a/components/time-picker/nz-time-picker.component.ts b/components/time-picker/nz-time-picker.component.ts index 43336e4b8ab..2b596a0abc5 100644 --- a/components/time-picker/nz-time-picker.component.ts +++ b/components/time-picker/nz-time-picker.component.ts @@ -17,10 +17,8 @@ import { ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { slideMotion } from '../core/animation/slide'; -import { NzUpdateHostClassService as UpdateCls } from '../core/services/update-host-class.service'; -import { isNotNil } from '../core/util/check'; -import { toBoolean } from '../core/util/convert'; + +import { isNotNil, slideMotion, toBoolean, NzUpdateHostClassService as UpdateCls } from 'ng-zorro-antd/core'; @Component({ encapsulation: ViewEncapsulation.None, diff --git a/components/time-picker/nz-time-picker.module.ts b/components/time-picker/nz-time-picker.module.ts index dd77b869a16..47a05d26298 100644 --- a/components/time-picker/nz-time-picker.module.ts +++ b/components/time-picker/nz-time-picker.module.ts @@ -2,9 +2,11 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzOverlayModule } from 'ng-zorro-antd/core'; + +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; + import { NzTimePickerPanelComponent } from './nz-time-picker-panel.component'; import { NzTimePickerComponent } from './nz-time-picker.component'; import { NzTimeValueAccessorDirective } from './nz-time-value-accessor.directive'; diff --git a/components/time-picker/nz-time-value-accessor.directive.spec.ts b/components/time-picker/nz-time-value-accessor.directive.spec.ts index 8e6869d17f1..45d4940b728 100644 --- a/components/time-picker/nz-time-value-accessor.directive.spec.ts +++ b/components/time-picker/nz-time-value-accessor.directive.spec.ts @@ -5,7 +5,7 @@ import { async, fakeAsync, flush, ComponentFixture, TestBed } from '@angular/cor import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; -import { dispatchFakeEvent } from '../core/testing'; +import { dispatchFakeEvent } from 'ng-zorro-antd/core'; import { NzI18nModule } from '../i18n/nz-i18n.module'; import { NzTimeValueAccessorDirective } from './nz-time-value-accessor.directive'; diff --git a/components/time-picker/nz-time-value-accessor.directive.ts b/components/time-picker/nz-time-value-accessor.directive.ts index 831d948c410..eda267a96ba 100644 --- a/components/time-picker/nz-time-value-accessor.directive.ts +++ b/components/time-picker/nz-time-value-accessor.directive.ts @@ -1,6 +1,7 @@ import { Directive, ElementRef, HostListener, Input } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { DateHelperService } from '../i18n/date-helper.service'; + +import { DateHelperService } from 'ng-zorro-antd/i18n'; @Directive({ selector: 'input[nzTime]', diff --git a/components/time-picker/package.json b/components/time-picker/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/time-picker/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/time-picker/public-api.ts b/components/time-picker/public-api.ts index f6da319587a..33b5a175c8c 100644 --- a/components/time-picker/public-api.ts +++ b/components/time-picker/public-api.ts @@ -1,2 +1,4 @@ export * from './nz-time-picker.component'; export * from './nz-time-picker.module'; +export * from './nz-time-picker-panel.component'; +export * from './nz-time-value-accessor.directive'; diff --git a/components/time-picker/style/entry.less b/components/time-picker/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/time-picker/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/time-picker/time-holder.ts b/components/time-picker/time-holder.ts index e69ec3ecb25..e63164c8511 100644 --- a/components/time-picker/time-holder.ts +++ b/components/time-picker/time-holder.ts @@ -1,6 +1,6 @@ import { Observable, Subject } from 'rxjs'; -import { isNotNil } from '../core/util/check'; +import { isNotNil } from 'ng-zorro-antd/core'; export class TimeHolder { private _seconds: number | undefined = undefined; diff --git a/components/timeline/doc/index.en-US.md b/components/timeline/doc/index.en-US.md index 46a479d0825..f3255d784b7 100644 --- a/components/timeline/doc/index.en-US.md +++ b/components/timeline/doc/index.en-US.md @@ -22,6 +22,14 @@ Vertical display timeline. ``` +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTimelineModule } from 'ng-zorro-antd'; +``` + ### nz-timeline Timeline diff --git a/components/timeline/doc/index.zh-CN.md b/components/timeline/doc/index.zh-CN.md index 132d32e57ab..136b43cbc9c 100644 --- a/components/timeline/doc/index.zh-CN.md +++ b/components/timeline/doc/index.zh-CN.md @@ -23,6 +23,14 @@ title: Timeline ``` +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTimelineModule } from 'ng-zorro-antd'; +``` + ### nz-timeline 时间轴。 diff --git a/components/timeline/nz-timeline.component.ts b/components/timeline/nz-timeline.component.ts index 60b759ed4f6..66631846f9d 100644 --- a/components/timeline/nz-timeline.component.ts +++ b/components/timeline/nz-timeline.component.ts @@ -18,7 +18,8 @@ import { import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { reverseChildNodes } from '../core/util/dom'; +import { reverseChildNodes } from 'ng-zorro-antd/core'; + import { NzTimelineItemComponent } from './nz-timeline-item.component'; export type NzTimelineMode = 'left' | 'alternate' | 'right'; diff --git a/components/timeline/nz-timeline.module.ts b/components/timeline/nz-timeline.module.ts index ccce08dfdca..1edc6c9ff34 100644 --- a/components/timeline/nz-timeline.module.ts +++ b/components/timeline/nz-timeline.module.ts @@ -1,8 +1,8 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzIconModule } from '../icon/nz-icon.module'; +import { NzAddOnModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzTimelineItemComponent } from './nz-timeline-item.component'; import { NzTimelineComponent } from './nz-timeline.component'; diff --git a/components/timeline/package.json b/components/timeline/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/timeline/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/timeline/style/entry.less b/components/timeline/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/timeline/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/tooltip/doc/index.en-US.md b/components/tooltip/doc/index.en-US.md index df6de8e8849..4901c41e045 100644 --- a/components/tooltip/doc/index.en-US.md +++ b/components/tooltip/doc/index.en-US.md @@ -13,6 +13,14 @@ A simple text popup tip. ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTooltipModule } from 'ng-zorro-antd'; +``` + ### nz-tooltip | Property | Description | Type | Default | diff --git a/components/tooltip/doc/index.zh-CN.md b/components/tooltip/doc/index.zh-CN.md index c23c4cb4abc..c874ebf5e69 100644 --- a/components/tooltip/doc/index.zh-CN.md +++ b/components/tooltip/doc/index.zh-CN.md @@ -15,6 +15,14 @@ title: Tooltip ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTooltipModule } from 'ng-zorro-antd'; +``` + ### nz-tooltip | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/tooltip/nz-tooltip.component.ts b/components/tooltip/nz-tooltip.component.ts index f89944ac649..e3420e10906 100644 --- a/components/tooltip/nz-tooltip.component.ts +++ b/components/tooltip/nz-tooltip.component.ts @@ -21,11 +21,16 @@ import { ViewEncapsulation } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { zoomBigMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { getPlacementName, DEFAULT_TOOLTIP_POSITIONS, POSITION_MAP } from '../core/overlay/overlay-position'; -import { isNotNil } from '../core/util/check'; -import { toBoolean } from '../core/util/convert'; + +import { + getPlacementName, + isNotNil, + toBoolean, + zoomBigMotion, + DEFAULT_TOOLTIP_POSITIONS, + NzNoAnimationDirective, + POSITION_MAP +} from 'ng-zorro-antd/core'; @Component({ selector: 'nz-tooltip', diff --git a/components/tooltip/nz-tooltip.directive.ts b/components/tooltip/nz-tooltip.directive.ts index 99f673f761f..eb350861dd1 100644 --- a/components/tooltip/nz-tooltip.directive.ts +++ b/components/tooltip/nz-tooltip.directive.ts @@ -21,8 +21,7 @@ import { import { Subscription } from 'rxjs'; import { distinctUntilChanged } from 'rxjs/operators'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { isNotNil } from '../core/util/check'; +import { isNotNil, NzNoAnimationDirective } from 'ng-zorro-antd/core'; import { NzToolTipComponent } from './nz-tooltip.component'; diff --git a/components/tooltip/nz-tooltip.module.ts b/components/tooltip/nz-tooltip.module.ts index 3ac85051d14..a60979095d4 100644 --- a/components/tooltip/nz-tooltip.module.ts +++ b/components/tooltip/nz-tooltip.module.ts @@ -2,9 +2,8 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; +import { NzAddOnModule, NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; + // NOTE: the `t` is not uppercase in directive. Change this would however introduce break change. import { NzToolTipComponent } from './nz-tooltip.component'; import { NzTooltipDirective } from './nz-tooltip.directive'; diff --git a/components/tooltip/nz-tooltip.spec.ts b/components/tooltip/nz-tooltip.spec.ts index ae55ead4581..0da77826690 100644 --- a/components/tooltip/nz-tooltip.spec.ts +++ b/components/tooltip/nz-tooltip.spec.ts @@ -3,7 +3,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'; import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/core/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { dispatchMouseEvent } from '../core/testing'; +import { dispatchMouseEvent } from 'ng-zorro-antd/core'; import { NzIconTestModule } from '../icon/nz-icon-test.module'; import { NzTooltipDirective } from './nz-tooltip.directive'; diff --git a/components/tooltip/package.json b/components/tooltip/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/tooltip/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/tooltip/style/entry.less b/components/tooltip/style/entry.less new file mode 100644 index 00000000000..06547c43acd --- /dev/null +++ b/components/tooltip/style/entry.less @@ -0,0 +1 @@ +@import './index.less'; diff --git a/components/transfer/doc/index.en-US.md b/components/transfer/doc/index.en-US.md index 850188d5b1e..601bd411938 100644 --- a/components/transfer/doc/index.en-US.md +++ b/components/transfer/doc/index.en-US.md @@ -15,6 +15,14 @@ One or more elements can be selected from either column, one click on the proper ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTransferModule } from 'ng-zorro-antd'; +``` + ### nz-transfer | Property | Description | Type | Default | diff --git a/components/transfer/doc/index.zh-CN.md b/components/transfer/doc/index.zh-CN.md index 63c9fec7ad2..da9d916eebf 100644 --- a/components/transfer/doc/index.zh-CN.md +++ b/components/transfer/doc/index.zh-CN.md @@ -17,6 +17,14 @@ title: Transfer ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTransferModule } from 'ng-zorro-antd'; +``` + ### nz-transfer | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/transfer/nz-transfer-list.component.ts b/components/transfer/nz-transfer-list.component.ts index 8ff6001dad4..05ae7f55b1b 100644 --- a/components/transfer/nz-transfer-list.component.ts +++ b/components/transfer/nz-transfer-list.component.ts @@ -13,7 +13,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; +import { NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { TransferItem } from './interface'; diff --git a/components/transfer/nz-transfer.component.ts b/components/transfer/nz-transfer.component.ts index 68e5dfd462a..75268b86f0b 100644 --- a/components/transfer/nz-transfer.component.ts +++ b/components/transfer/nz-transfer.component.ts @@ -20,8 +20,8 @@ import { import { of, Observable, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { InputBoolean } from '../core/util/convert'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { InputBoolean } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; import { TransferCanMove, TransferChange, TransferItem, TransferSearchChange, TransferSelectChange } from './interface'; import { NzTransferListComponent } from './nz-transfer-list.component'; diff --git a/components/transfer/nz-transfer.module.ts b/components/transfer/nz-transfer.module.ts index 7314d176431..0675e3adb79 100644 --- a/components/transfer/nz-transfer.module.ts +++ b/components/transfer/nz-transfer.module.ts @@ -2,13 +2,13 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzButtonModule } from '../button/nz-button.module'; -import { NzCheckboxModule } from '../checkbox/nz-checkbox.module'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzInputModule } from '../input/nz-input.module'; +import { NzButtonModule } from 'ng-zorro-antd/button'; +import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzInputModule } from 'ng-zorro-antd/input'; -import { NzEmptyModule } from '../empty/nz-empty.module'; import { NzTransferListComponent } from './nz-transfer-list.component'; import { NzTransferSearchComponent } from './nz-transfer-search.component'; import { NzTransferComponent } from './nz-transfer.component'; diff --git a/components/transfer/package.json b/components/transfer/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/transfer/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/transfer/style/entry.less b/components/transfer/style/entry.less new file mode 100644 index 00000000000..0b877e65da3 --- /dev/null +++ b/components/transfer/style/entry.less @@ -0,0 +1,6 @@ +@import './index.less'; +// style dependencies +@import '../../empty/style/index.less'; +@import '../../checkbox/style/index.less'; +@import '../../button/style/index.less'; +@import '../../input/style/index.less'; diff --git a/components/tree-select/doc/index.en-US.md b/components/tree-select/doc/index.en-US.md index 8520c95ba36..001f62f40fa 100755 --- a/components/tree-select/doc/index.en-US.md +++ b/components/tree-select/doc/index.en-US.md @@ -13,6 +13,14 @@ Any data whose entries are defined in a hierarchical manner is fit to use this c ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTreeSelectModule } from 'ng-zorro-antd'; +``` + ### nz-tree-select | Property | Description | Type | Default | diff --git a/components/tree-select/doc/index.zh-CN.md b/components/tree-select/doc/index.zh-CN.md index 034c40a7f88..3ecb1da55d5 100755 --- a/components/tree-select/doc/index.zh-CN.md +++ b/components/tree-select/doc/index.zh-CN.md @@ -13,6 +13,14 @@ title: TreeSelect ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTreeSelectModule } from 'ng-zorro-antd'; +``` + ### nz-tree-select | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/tree-select/nz-tree-select.component.ts b/components/tree-select/nz-tree-select.component.ts index 92bf6e25b29..1d225942bbe 100644 --- a/components/tree-select/nz-tree-select.component.ts +++ b/components/tree-select/nz-tree-select.component.ts @@ -7,6 +7,7 @@ import { ElementRef, EventEmitter, Host, + Injector, Input, OnChanges, OnDestroy, @@ -14,6 +15,7 @@ import { Optional, Output, Renderer2, + Self, SimpleChanges, TemplateRef, ViewChild @@ -23,17 +25,27 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { merge, of as observableOf, Subscription } from 'rxjs'; import { filter, tap } from 'rxjs/operators'; -import { slideMotion } from '../core/animation/slide'; -import { zoomMotion } from '../core/animation/zoom'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { NzSizeLDSType } from '../core/types/size'; -import { isNotNil } from '../core/util'; -import { InputBoolean } from '../core/util/convert'; -import { NzFormatEmitEvent } from '../tree/interface'; -import { NzTreeNode, NzTreeNodeOptions } from '../tree/nz-tree-node'; -import { NzTreeComponent } from '../tree/nz-tree.component'; +import { + isNotNil, + slideMotion, + zoomMotion, + InputBoolean, + NzFormatEmitEvent, + NzNoAnimationDirective, + NzSizeLDSType, + NzTreeBaseService, + NzTreeHigherOrderServiceToken, + NzTreeNode, + NzTreeNodeOptions +} from 'ng-zorro-antd/core'; +import { NzTreeComponent } from 'ng-zorro-antd/tree'; + import { NzTreeSelectService } from './nz-tree-select.service'; +export function higherOrderServiceFactory(injector: Injector): NzTreeBaseService { + return injector.get(NzTreeSelectService); +} + @Component({ selector: 'nz-tree-select', exportAs: 'nzTreeSelect', @@ -41,6 +53,11 @@ import { NzTreeSelectService } from './nz-tree-select.service'; templateUrl: './nz-tree-select.component.html', providers: [ NzTreeSelectService, + { + provide: NzTreeHigherOrderServiceToken, + useFactory: higherOrderServiceFactory, + deps: [[new Self(), Injector]] + }, { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzTreeSelectComponent), diff --git a/components/tree-select/nz-tree-select.module.ts b/components/tree-select/nz-tree-select.module.ts index 96f22617c6e..340e425bc0e 100644 --- a/components/tree-select/nz-tree-select.module.ts +++ b/components/tree-select/nz-tree-select.module.ts @@ -2,11 +2,12 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzOverlayModule } from '../core/overlay/nz-overlay.module'; -import { NzEmptyModule } from '../empty/nz-empty.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzTreeModule } from '../tree/nz-tree.module'; + +import { NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; +import { NzEmptyModule } from 'ng-zorro-antd/empty'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzTreeModule } from 'ng-zorro-antd/tree'; + import { NzTreeSelectComponent } from './nz-tree-select.component'; @NgModule({ diff --git a/components/tree-select/nz-tree-select.service.ts b/components/tree-select/nz-tree-select.service.ts index 772d7e76b64..e4153219cb4 100644 --- a/components/tree-select/nz-tree-select.service.ts +++ b/components/tree-select/nz-tree-select.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; -import { NzTreeBaseService } from '../tree/nz-tree-base.service'; + +import { NzTreeBaseService } from 'ng-zorro-antd/core'; @Injectable() export class NzTreeSelectService extends NzTreeBaseService {} diff --git a/components/tree-select/nz-tree-select.spec.ts b/components/tree-select/nz-tree-select.spec.ts index 89de0404913..5c201e0b793 100644 --- a/components/tree-select/nz-tree-select.spec.ts +++ b/components/tree-select/nz-tree-select.spec.ts @@ -5,8 +5,15 @@ import { async, fakeAsync, flush, inject, tick, ComponentFixture, TestBed } from import { FormsModule, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { createKeyboardEvent, dispatchFakeEvent, dispatchMouseEvent, typeInElement } from '../core/testing'; -import { NzTreeNode } from '../tree'; + +import { + createKeyboardEvent, + dispatchFakeEvent, + dispatchMouseEvent, + typeInElement, + NzTreeNode +} from 'ng-zorro-antd/core'; + import { NzTreeSelectComponent } from './nz-tree-select.component'; import { NzTreeSelectModule } from './nz-tree-select.module'; diff --git a/components/tree-select/package.json b/components/tree-select/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/tree-select/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/tree-select/public-api.ts b/components/tree-select/public-api.ts index 9f298c0c6ae..23cc1d5d88a 100644 --- a/components/tree-select/public-api.ts +++ b/components/tree-select/public-api.ts @@ -1,2 +1,3 @@ export * from './nz-tree-select.component'; export * from './nz-tree-select.module'; +export * from './nz-tree-select.service'; diff --git a/components/tree-select/style/entry.less b/components/tree-select/style/entry.less new file mode 100644 index 00000000000..580b38c62b1 --- /dev/null +++ b/components/tree-select/style/entry.less @@ -0,0 +1,6 @@ +@import './index.less'; +// style dependencies +// deps-lint-skip: select +@import '../../tree/style/entry.less'; +@import '../../select/style/index.less'; +@import '../../empty/style/index.less'; diff --git a/components/tree/doc/index.en-US.md b/components/tree/doc/index.en-US.md index ed83f42fc57..fe897186fe8 100644 --- a/components/tree/doc/index.en-US.md +++ b/components/tree/doc/index.en-US.md @@ -10,6 +10,14 @@ Almost anything can be represented in a tree structure. Examples include directo ## API +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzTreeModule } from 'ng-zorro-antd'; +``` + ### nz-tree | Property | Description | Type | Default | diff --git a/components/tree/doc/index.zh-CN.md b/components/tree/doc/index.zh-CN.md index 6e489211c6f..8c01f995c2e 100644 --- a/components/tree/doc/index.zh-CN.md +++ b/components/tree/doc/index.zh-CN.md @@ -11,6 +11,14 @@ subtitle: 树形控件 ## API +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzTreeModule } from 'ng-zorro-antd'; +``` + ### nz-tree | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/tree/nz-tree-node.component.ts b/components/tree/nz-tree-node.component.ts index e2d2dfaa46a..96379bd867f 100644 --- a/components/tree/nz-tree-node.component.ts +++ b/components/tree/nz-tree-node.component.ts @@ -17,12 +17,15 @@ import { } from '@angular/core'; import { fromEvent, Observable, Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; -import { collapseMotion } from '../core/animation/collapse'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { InputBoolean } from '../core/util/convert'; -import { NzFormatBeforeDropEvent } from '../tree/interface'; -import { NzTreeBaseService } from './nz-tree-base.service'; -import { NzTreeNode } from './nz-tree-node'; + +import { + collapseMotion, + InputBoolean, + NzFormatBeforeDropEvent, + NzNoAnimationDirective, + NzTreeBaseService, + NzTreeNode +} from 'ng-zorro-antd/core'; @Component({ selector: 'nz-tree-node', diff --git a/components/tree/nz-tree.component.ts b/components/tree/nz-tree.component.ts index 23567d15d31..a58800ad26b 100644 --- a/components/tree/nz-tree.component.ts +++ b/components/tree/nz-tree.component.ts @@ -19,20 +19,26 @@ import { import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Observable, ReplaySubject, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; -import { isNotNil } from '../core/util/check'; -import { toBoolean, InputBoolean } from '../core/util/convert'; -import { NzTreeSelectService } from '../tree-select/nz-tree-select.service'; -import { NzFormatBeforeDropEvent, NzFormatEmitEvent } from '../tree/interface'; -import { NzTreeBaseService } from './nz-tree-base.service'; -import { NzTreeNode } from './nz-tree-node'; + +import { + isNotNil, + toBoolean, + InputBoolean, + NzFormatBeforeDropEvent, + NzFormatEmitEvent, + NzNoAnimationDirective, + NzTreeBaseService, + NzTreeHigherOrderServiceToken, + NzTreeNode +} from 'ng-zorro-antd/core'; + import { NzTreeService } from './nz-tree.service'; export function NzTreeServiceFactory( - treeSelectService: NzTreeSelectService, + higherOrderService: NzTreeBaseService, treeService: NzTreeService ): NzTreeBaseService { - return treeSelectService ? treeSelectService : treeService; + return higherOrderService ? higherOrderService : treeService; } @Component({ @@ -45,7 +51,7 @@ export function NzTreeServiceFactory( { provide: NzTreeBaseService, useFactory: NzTreeServiceFactory, - deps: [[new SkipSelf(), new Optional(), NzTreeSelectService], NzTreeService] + deps: [[new SkipSelf(), new Optional(), NzTreeHigherOrderServiceToken], NzTreeService] }, { provide: NG_VALUE_ACCESSOR, @@ -67,6 +73,7 @@ export class NzTreeComponent implements OnInit, OnDestroy, ControlValueAccessor, @Input() @InputBoolean() nzSelectMode = false; @Input() @InputBoolean() nzCheckStrictly = false; @Input() @InputBoolean() nzBlockNode = false; + /** * @deprecated use * nzExpandAll instead diff --git a/components/tree/nz-tree.module.ts b/components/tree/nz-tree.module.ts index 61e9c4dab66..c1589342105 100644 --- a/components/tree/nz-tree.module.ts +++ b/components/tree/nz-tree.module.ts @@ -1,8 +1,9 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzAddOnModule } from '../core/addon/addon.module'; -import { NzNoAnimationModule } from '../core/no-animation/nz-no-animation.module'; -import { NzIconModule } from '../icon/nz-icon.module'; + +import { NzAddOnModule, NzNoAnimationModule } from 'ng-zorro-antd/core'; +import { NzIconModule } from 'ng-zorro-antd/icon'; + import { NzTreeNodeComponent } from './nz-tree-node.component'; import { NzTreeComponent } from './nz-tree.component'; diff --git a/components/tree/nz-tree.service.ts b/components/tree/nz-tree.service.ts index ffd7addf992..5896f345120 100644 --- a/components/tree/nz-tree.service.ts +++ b/components/tree/nz-tree.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { NzTreeBaseService } from './nz-tree-base.service'; +import { NzTreeBaseService } from 'ng-zorro-antd/core'; @Injectable() export class NzTreeService extends NzTreeBaseService {} diff --git a/components/tree/nz-tree.spec.ts b/components/tree/nz-tree.spec.ts index c9d856d3548..46f5c8b15c4 100644 --- a/components/tree/nz-tree.spec.ts +++ b/components/tree/nz-tree.spec.ts @@ -5,11 +5,16 @@ import { By } from '@angular/platform-browser'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { of, Observable } from 'rxjs'; -import { dispatchMouseEvent, dispatchTouchEvent } from '../core/testing'; +import { + dispatchMouseEvent, + dispatchTouchEvent, + NzTreeBaseService, + NzTreeNode, + NzTreeNodeOptions +} from 'ng-zorro-antd/core'; + import { NzIconTestModule } from '../icon/nz-icon-test.module'; -import { NzTreeBaseService } from './nz-tree-base.service'; -import { NzTreeNode, NzTreeNodeOptions } from './nz-tree-node'; import { NzTreeComponent } from './nz-tree.component'; import { NzTreeModule } from './nz-tree.module'; @@ -654,12 +659,12 @@ describe('nz-tree', () => { [nzExpandAll]="expandAll" [nzExpandedIcon]="expandedIcon" [nzAsyncData]="asyncData" - (nzSearchValueChange)="nzEvent($event)" - (nzClick)="nzEvent($event)" - (nzDblClick)="nzEvent($event)" - (nzContextMenu)="nzEvent($event)" - (nzExpandChange)="nzEvent($event)" - (nzCheckBoxChange)="nzEvent($event)" + (nzSearchValueChange)="nzEvent()" + (nzClick)="nzEvent()" + (nzDblClick)="nzEvent()" + (nzContextMenu)="nzEvent()" + (nzExpandChange)="nzEvent()" + (nzCheckBoxChange)="nzEvent()" > ` @@ -739,12 +744,12 @@ export class NzTestTreeBasicControlledComponent { [nzData]="nodes" nzDraggable="true" [nzBeforeDrop]="beforeDrop" - (nzOnDragStart)="onDragStart($event)" - (nzOnDragEnter)="onDragEnter($event)" - (nzOnDragLeave)="onDragLeave($event)" - (nzOnDragOver)="onDragOver($event)" - (nzOnDrop)="onDrop($event)" - (nzOnDragEnd)="onDragEnd($event)" + (nzOnDragStart)="onDragStart()" + (nzOnDragEnter)="onDragEnter()" + (nzOnDragLeave)="onDragLeave()" + (nzOnDragOver)="onDragOver()" + (nzOnDrop)="onDrop()" + (nzOnDragEnd)="onDragEnd()" > ` @@ -852,7 +857,6 @@ export class NzTestTreeOlderComponent implements OnInit { selectedKeys = ['10001', '100011']; multiple = true; expandDefault = false; - showExpand = true; searchValue = ''; modelNodes: NzTreeNode[]; diff --git a/components/tree/package.json b/components/tree/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/tree/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/tree/public-api.ts b/components/tree/public-api.ts index fa31d728fe4..c28823312c2 100644 --- a/components/tree/public-api.ts +++ b/components/tree/public-api.ts @@ -1,8 +1,4 @@ -export * from './interface'; export * from './nz-tree.module'; export * from './nz-tree.component'; export * from './nz-tree-node.component'; -export * from './nz-tree-node'; -export * from './nz-tree-base.service'; export * from './nz-tree.service'; -export * from './nz-tree-util'; diff --git a/components/tree/style/entry.less b/components/tree/style/entry.less new file mode 100644 index 00000000000..96cebe33bff --- /dev/null +++ b/components/tree/style/entry.less @@ -0,0 +1,2 @@ +@import './index.less'; +@import './patch.less'; diff --git a/components/tree/style/patch.less b/components/tree/style/patch.less new file mode 100644 index 00000000000..adce7cea729 --- /dev/null +++ b/components/tree/style/patch.less @@ -0,0 +1,39 @@ +/* + * @license + * Copyright Alibaba.com All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE + */ + +.ant-tree { + &.ant-tree-show-line { + > nz-tree-node:not(:last-child), .ant-tree-child-tree > nz-tree-node:not(:last-child) { + > li:before { + content: ' '; + width: 1px; + border-left: 1px solid @border-color-base; + height: 100%; + position: absolute; + left: 12px; + margin: 22px 0; + } + } + + .ant-tree-child-tree > nz-tree-node:last-child { + > li:before { + content: ' '; + width: 1px; + border-left: 0px solid @border-color-base; + height: 100%; + position: absolute; + left: 12px; + margin: 22px 0; + } + } + } + + .font-highlight { + color: @highlight-color; + } +} diff --git a/components/tsconfig.json b/components/tsconfig.json index e8eb3e4f3fb..7f6c6cddebc 100644 --- a/components/tsconfig.json +++ b/components/tsconfig.json @@ -1,6 +1,8 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "baseUrl": "./", + "rootDir": "./", "target": "es5", "module": "es2015", "sourceMap": false, @@ -9,11 +11,13 @@ "experimentalDecorators": true, "declaration": true, "outDir": "../release", - "lib": ["es2015", "dom"] + "lib": ["es2015", "dom"], + "paths": { + "ng-zorro-antd": ["./ng-zorro-antd.module"], + "ng-zorro-antd/*": ["./*"] + } }, - "files": [ - "./ng-zorro-antd.module.ts" - ], + "files": ["./ng-zorro-antd.module.ts"], "angularCompilerOptions": { "skipTemplateCodegen": true } diff --git a/components/upload/doc/index.en-US.md b/components/upload/doc/index.en-US.md index 362e9533249..d594f71eb01 100644 --- a/components/upload/doc/index.en-US.md +++ b/components/upload/doc/index.en-US.md @@ -18,6 +18,14 @@ Uploading is the process of publishing information (web pages, text, pictures, v > You can consult [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload/wiki) about how to implement server side upload interface. +### Import this Component Individually + +[Note](/docs/getting-started/en#import-a-component-individually). + +```ts +import { NzUploadModule } from 'ng-zorro-antd'; +``` + ### nz-upload | Property | Description | Type | Default | diff --git a/components/upload/doc/index.zh-CN.md b/components/upload/doc/index.zh-CN.md index fcc27a13721..1daddc3a9b6 100644 --- a/components/upload/doc/index.zh-CN.md +++ b/components/upload/doc/index.zh-CN.md @@ -19,6 +19,14 @@ title: Upload > 服务端上传接口实现可以参考 [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload/wiki)。 +### 单独引入此组件 + +[说明](/docs/getting-started/zh#单独引入某个组件)。 + +```ts +import { NzUploadModule } from 'ng-zorro-antd'; +``` + ### nz-upload | 参数 | 说明 | 类型 | 默认值 | diff --git a/components/upload/interface.ts b/components/upload/interface.ts index 7c5ae54e524..37eaf27fdc1 100644 --- a/components/upload/interface.ts +++ b/components/upload/interface.ts @@ -1,6 +1,7 @@ // tslint:disable:no-any prefer-method-signature import { Observable, Subscription } from 'rxjs'; -import { IndexableObject } from '../core/types/indexable'; + +import { IndexableObject } from 'ng-zorro-antd/core'; /** 状态 */ export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'; diff --git a/components/upload/nz-upload-btn.component.ts b/components/upload/nz-upload-btn.component.ts index bb33fc94896..ed632964496 100644 --- a/components/upload/nz-upload-btn.component.ts +++ b/components/upload/nz-upload-btn.component.ts @@ -15,7 +15,7 @@ import { import { of, Observable, Subscription } from 'rxjs'; import { switchMap } from 'rxjs/operators'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; +import { NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { UploadFile, UploadXHRArgs, ZipButtonOptions } from './interface'; diff --git a/components/upload/nz-upload-list.component.ts b/components/upload/nz-upload-list.component.ts index a4be22b6909..2033625e93f 100644 --- a/components/upload/nz-upload-list.component.ts +++ b/components/upload/nz-upload-list.component.ts @@ -9,7 +9,7 @@ import { ViewEncapsulation } from '@angular/core'; -import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; +import { NzUpdateHostClassService } from 'ng-zorro-antd/core'; import { ShowUploadListInterface, UploadFile, UploadListType } from './interface'; diff --git a/components/upload/nz-upload.component.ts b/components/upload/nz-upload.component.ts index f42e7a442ea..26498cad7c9 100644 --- a/components/upload/nz-upload.component.ts +++ b/components/upload/nz-upload.component.ts @@ -16,8 +16,8 @@ import { import { of, Observable, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { toBoolean, InputBoolean, InputNumber } from '../core/util/convert'; -import { NzI18nService } from '../i18n/nz-i18n.service'; +import { toBoolean, InputBoolean, InputNumber } from 'ng-zorro-antd/core'; +import { NzI18nService } from 'ng-zorro-antd/i18n'; import { ShowUploadListInterface, diff --git a/components/upload/nz-upload.module.ts b/components/upload/nz-upload.module.ts index cb0078f63aa..be82245cd6b 100644 --- a/components/upload/nz-upload.module.ts +++ b/components/upload/nz-upload.module.ts @@ -2,11 +2,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { NzI18nModule } from '../i18n/nz-i18n.module'; -import { NzIconModule } from '../icon/nz-icon.module'; -import { NzToolTipModule } from '../tooltip/nz-tooltip.module'; +import { NzI18nModule } from 'ng-zorro-antd/i18n'; +import { NzIconModule } from 'ng-zorro-antd/icon'; +import { NzProgressModule } from 'ng-zorro-antd/progress'; +import { NzToolTipModule } from 'ng-zorro-antd/tooltip'; -import { NzProgressModule } from './../progress/nz-progress.module'; import { NzUploadBtnComponent } from './nz-upload-btn.component'; import { NzUploadListComponent } from './nz-upload-list.component'; import { NzUploadComponent } from './nz-upload.component'; diff --git a/components/upload/package.json b/components/upload/package.json new file mode 100644 index 00000000000..ded1e7a9fdf --- /dev/null +++ b/components/upload/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "public-api.ts" + } + } +} diff --git a/components/upload/style/entry.less b/components/upload/style/entry.less new file mode 100644 index 00000000000..a67a294db5f --- /dev/null +++ b/components/upload/style/entry.less @@ -0,0 +1,4 @@ +@import './index.less'; +// style dependencies +@import '../../progress/style/index.less'; +@import '../../tooltip/style/index.less'; diff --git a/docs/getting-started.en-US.md b/docs/getting-started.en-US.md index 0704a2f47dd..8eaeced853b 100755 --- a/docs/getting-started.en-US.md +++ b/docs/getting-started.en-US.md @@ -138,3 +138,58 @@ You can get more info about how to customize styles at [customize theme](/docs/c ## Customization * [Customize Theme](/docs/customize-theme/en) * [Local Iconfont](/docs/customize-theme/en) + +## Import a Component Individually + +From version 7.3.0, you can import a component's module and style files to use that component. For example, if you only want to use the `Button` component, you can import `NzButtonModule` instead of `NgZorroAntdModule`, and `Button`'s style file instead of `ng-zorro-antd.css`. + +In your modules: + +```typescript +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { NzButtonModule } from 'ng-zorro-antd'; + +@NgModule({ + declarations: [ + ... + ], + imports: [ + CommonModule, + NzButtonModule + ] +}) +export class YourModule { } +``` + +In style.css: + +```css +@import "~ng-zorro-antd/style/index.min.css"; /* Import basic styles */ +@import "~ng-zorro-antd/button/style/index.min.css"; /* Import styles of the component */ +``` + +If you want to import several components, it is recommended to use less instead of CSS. In styles.less: + +```less +@import "~ng-zorro-antd/style/index.less"; /* Import basic styles */ +@import "~ng-zorro-antd/button/style/entry.less"; /* Import styles of the component */ +``` + +> Importing CSS files of several components may result in code redundancy because style files of components have dependency relationships like TypeScript files. + +### A comparison of Importing individually and Importing All + +| Importing all | Importing individually | +| --- | --- | +| Just import NgZorroAntdModule no matter what component you want to use | Import styles and modules of components you want | +| Larger package size | Smaller package size | +| ng-zorro-antd would be bundled into main.js | It may be bundled into lazy loading module according to your usage | + +Importing individually is recommended if you: + +* Only use a small part of the components of ng-zorro-antd (You can use a shared module to wrap those components). +* Use ng-zorro-antd along with others component kits and get error because of conflicts. + +Of course, if you import NgZorroAntdModule in your modules, you don't have to import sub modules individually. diff --git a/docs/getting-started.zh-CN.md b/docs/getting-started.zh-CN.md index 85211631a98..2a0fdf3cdae 100755 --- a/docs/getting-started.zh-CN.md +++ b/docs/getting-started.zh-CN.md @@ -144,3 +144,60 @@ export class AppModule { } * [自定义主题](/docs/customize-theme/zh) * [使用本地字体](/docs/customize-theme/zh) + +## 单独引入某个组件 + +从 7.3.0 版本起,你可以引入子 module 和单独打包的 CSS/less 文件来单独使用某个组件。 + +例如,你只想使用 Button 组件,那么你就可以引入 `NzButtonModule` 而不是 `NgZorroAntdModule`,在 `style.css` 里导入组件对应的样式文件而不是全部的样式文件。 + +在 module 文件里: + +```typescript +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { NzButtonModule } from 'ng-zorro-antd/button'; + +@NgModule({ + declarations: [ + ... + ], + imports: [ + CommonModule, + NzButtonModule + ] +}) +export class YourModule { } +``` + +在 style.css 文件里: + +```css +@import "~ng-zorro-antd/style/index.min.css"; /* 引入基本样式 */ +@import "~ng-zorro-antd/button/style/index.min.css"; /* 引入组件样式 */ +``` + +另:如果你想单独引入多个组件,我们建议使用 less,在你的 style.less 里导入各个组件的 entry.less 文件: + +```less +@import "~ng-zorro-antd/style/index.less"; /* 引入基本样式 */ +@import "~ng-zorro-antd/button/style/entry.less"; /* 引入组件样式 */ +``` + +> 由于组件之间的样式也存在依赖关系,单独引入多个组件的 CSS 可能导致 CSS 的冗余。 + +### 比较单独引入和传统的全部引入方式 + +| 全部引入 | 单独引入 | +| --- | --- | +| 不管要使用何种组件只需要导入 NgZorroAntdModule 和全部样式 | 按照你想用的组件导入 module 和样式文件 | +| 打包体积较大 | 打包体积较小 | +| ng-zorro-antd 的组件会被打包到 main.js 文件中 | 按照实际引用情况,可能被打包到懒加载 module 中 | + +如果你符合或遇到了如下情形,推荐你使用单独引入: + +* 你的项目中仅仅用到了少数几个组件(你可以使用 ShareModule 来包装你需要用到的组件) +* 你的项目同时使用了 ng-zorro-antd 和别的组件,而且你遇到了冲突 + +当然,如果你已经在 module 中引入了 NgZorroAntdModule,单独引入各个组件的子 module 就没有意义了。 diff --git a/package.json b/package.json index f8efcd6063a..8abe1252a7d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint": "tslint -c tslint.json 'components/*/*.ts'", "migration-styles": "node ./scripts/build/migration-styles.js", "ng": "ng", - "postgenerate": "node ./scripts/build/generate-less.js && cp README.md publish/README.md && npm run migration-styles && npm run schematic:generate", + "postgenerate": "node scripts/build/compile-styles.js && cp README.md publish/README.md && npm run migration-styles && npm run schematic:generate", "pre-release": "npm run site:init && bash ./scripts/build/replace-publish.sh && npm run generate && npm run build-site && npm run build-iframe && npm run helper", "release": "node ./scripts/publish/publish.js", "schematic:build": "node ./scripts/schematics/set-theme.js && node ./scripts/schematics/set-version.js && npm run schematic:tsc && node ./scripts/schematics/copy-resources", diff --git a/scripts/build/compile-styles.js b/scripts/build/compile-styles.js new file mode 100644 index 00000000000..1b2a81631f4 --- /dev/null +++ b/scripts/build/compile-styles.js @@ -0,0 +1,88 @@ +const fs = require('fs-extra'); +const path = require('path'); +const less = require('less'); +const LessPluginCleanCSS = require('less-plugin-clean-css'); +const NpmImportPlugin = require('less-plugin-npm-import'); + +function compileLess(content, savePath, min, sub, rootPath) { + return new Promise((resolve, reject) => { + const plugins = []; + const lessOptions = { plugins: plugins, javascriptEnabled: true }; + + if (min) { + plugins.push(new LessPluginCleanCSS({ advanced: true })); + } + + if (sub) { + lessOptions.paths = [path.dirname(rootPath)]; + lessOptions.filename = rootPath; + plugins.push( + new NpmImportPlugin({ + prefix: '~' + }) + ); + } + + return less + .render(content, lessOptions) + .then(({ css }) => { + fs.writeFileSync(savePath, css); + resolve(); + }) + .catch(err => reject(err)); + }); +} + +const sourcePath = path.resolve(__dirname, '../../components'); +const targetPath = path.resolve(__dirname, '../../publish'); +const componentFolders = fs.readdirSync(targetPath); + +// Export each component's style in `component.less` and copy it to the target dir. +let componentsLessContent = ''; + +componentFolders.forEach(dir => { + if (fs.existsSync(`${sourcePath}/${dir}/style/index.less`)) { + // Copy style files for each component. + componentsLessContent += `@import "./${path.posix.join(dir, 'style', 'index.less')}";\n`; + fs.copySync(`${sourcePath}/${dir}/style`, `${targetPath}/${dir}/style`); + + // Compile less files to CSS and delete the `entry.less` file. + const buildFilePath = `${sourcePath}/${dir}/style/entry.less`; + if (fs.existsSync(buildFilePath)) { + compileLess( + fs.readFileSync(buildFilePath, { encoding: 'utf8' }), + path.join(targetPath, dir, 'style', `index.css`), + false, + true, + buildFilePath + ).catch(e => console.log(e)); + compileLess( + fs.readFileSync(buildFilePath, { encoding: 'utf8' }), + path.join(targetPath, dir, 'style', `index.min.css`), + true, + true, + buildFilePath + ).catch(e => console.log(e)); + } + } +}); + +// Copy concentrated less files. +fs.copySync(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style')); +fs.writeFileSync(`${targetPath}/components.less`, componentsLessContent); +fs.writeFileSync(`${targetPath}/ng-zorro-antd.less`, fs.readFileSync(`${sourcePath}/ng-zorro-antd.less`)); + +// Compile concentrated less file to CSS file. +const lessContent = `@import "${path.posix.join(targetPath, 'ng-zorro-antd.less')}";`; +compileLess(lessContent, path.join(targetPath, 'ng-zorro-antd.css'), false); +compileLess(lessContent, path.join(targetPath, 'ng-zorro-antd.min.css'), true); + +// Compile css file that doesn't have component-specific styles. +const cssIndexPath = path.join(sourcePath, 'style', 'index.less'); +const cssIndex = fs.readFileSync(cssIndexPath, { encoding: 'utf8' }) + `@import '../core/style/index.less';\n`; // Compile patch. +compileLess(cssIndex, path.join(targetPath, 'style', 'index.css'), false, true, cssIndexPath).catch(e => + console.log(e) +); +compileLess(cssIndex, path.join(targetPath, 'style', 'index.min.css'), true, true, cssIndexPath).catch(e => + console.log(e) +); diff --git a/scripts/build/generate-less.js b/scripts/build/generate-less.js deleted file mode 100644 index 14909df649a..00000000000 --- a/scripts/build/generate-less.js +++ /dev/null @@ -1,41 +0,0 @@ -const fs = require('fs-extra'); -const path = require('path'); -const less = require('less'); -const LessPluginCleanCSS = require('less-plugin-clean-css'); - -function compileLess(content, savePath, min) { - return new Promise((resolve, reject) => { - const plugins = []; - if (min) { - const cleanCSSPlugin = new LessPluginCleanCSS({advanced: true}); - plugins.push(cleanCSSPlugin); - } - return less.render - .call(less, content, {plugins: plugins, javascriptEnabled: true}) - .then(({css}) => { - fs.writeFileSync(savePath, css); - resolve(); - }) - .catch(err => reject(err)); - }); -} - -const sourcePath = path.resolve(__dirname, '../../components'); -const targetPath = path.resolve(__dirname, '../../publish'); - -const targetFolder = fs.readdirSync(targetPath); -let componentsLessContent = ''; -targetFolder.forEach(dir => { - if (fs.existsSync(`${sourcePath}/${dir}/style/index.less`)) { - componentsLessContent += `@import "./${path.posix.join(dir, 'style', 'index.less')}";\n`; - fs.copySync(`${sourcePath}/${dir}/style`, `${targetPath}/${dir}/style`); - } - } -); -fs.copySync(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style')); -fs.writeFileSync(`${targetPath}/components.less`, componentsLessContent); -fs.writeFileSync(`${targetPath}/ng-zorro-antd.less`, fs.readFileSync(`${sourcePath}/ng-zorro-antd.less`)); - -const lessContent = `@import "${path.posix.join(targetPath, 'ng-zorro-antd.less')}";`; -compileLess(lessContent, path.join(targetPath, 'ng-zorro-antd.css'), false); -compileLess(lessContent, path.join(targetPath, 'ng-zorro-antd.min.css'), true); diff --git a/scripts/build/replace-publish.sh b/scripts/build/replace-publish.sh index 1804792ed17..54ed94726c5 100755 --- a/scripts/build/replace-publish.sh +++ b/scripts/build/replace-publish.sh @@ -1,2 +1,3 @@ -sed 's/components\/ng-zorro-antd.module.ts/publish/g' site/tsconfig.app.json > site/tsconfig.app.json_back +sed 's/components\/ng-zorro-antd.module.ts/publish/g +s/components/publish/g' site/tsconfig.app.json > site/tsconfig.app.json_back mv site/tsconfig.app.json_back site/tsconfig.app.json diff --git a/scripts/site/_site/tsconfig.app.json b/scripts/site/_site/tsconfig.app.json index ddf8789156a..1b10bef25c8 100644 --- a/scripts/site/_site/tsconfig.app.json +++ b/scripts/site/_site/tsconfig.app.json @@ -7,6 +7,7 @@ "types": [], "paths": { "ng-zorro-antd": [ "../components/ng-zorro-antd.module.ts" ], + "ng-zorro-antd/*": [ "../components/*" ], "ngx-color/sketch": [ "../node_modules/ngx-color/sketch" ] } },