9.0.0-beta.1
2020-03-15
Intro
Note: We are still in beta version now, this version is not recommend to use in prod environment, if you meet any problems, please submit an issue to us.
Welcome to the 9.0.0-beta.1
version of ng-zorro-antd
,some APIs were deprecated in version 8.x, and warning message was given under dev mode. All deprecated APIs is removed in 9.0.0, if you have fixed all warnings in the 8.x version, you can follow these steps to upgrade your version.
- Upgrade to Angular 9.0, ref https://update.angular.io/
- Upgrade to ng-zorro-antd@next, we will provide official
ng update
in9.0.0
version - We use
date-fns
2.x
version now, and provide compatible tools for ng-zorro-antd components.
date-fns update
We have upgraded date-fns
to v2. When you switch to date-fns
, some date formats will have a breaking change. Such as:
<!-- datefns v1 -->
<nz-date-picker nzFormat="YYYY-MM-DD"></nz-date-picker>
<!-- datefns v2 -->
<nz-date-picker nzFormat="yyyy-MM-dd"></nz-date-picker>
We recommend using date-fns
v2 date format. If you don't want to use the new date format, you can use NZ_DATE_FNS_COMPATIBLE
. When set to true
, ng-zorro-antd
will convert the format of v1 to v2. See the comparison of the old and new formats here.
providers: [
{ provide: NZ_DATE_FNS_COMPATIBLE, useValue: true }
]
Note: NZ_DATE_FNS_COMPATIBLE
won't be kept for too long, we will remove the support for date-fns
v1 format until ng-zorro-antd
v10, we hope you can update the date-fns
date format in time. For date-fns
upgrade guide, see here.
Bug Fixes
- auto-complete: close the panel when tapping scrollb… (#4551) (387ebc1), closes #4333
- auto-complete: default value not selected (#4366) (09f1ec6), closes #4362
- breadcrumb: fix breadcrumb link style (#4880) (2553328)
- button: fix button animation bug caused by angular (9e0df2a), closes #2697
- calendar: correct expected class name in test (#4369) (12111e5)
- cascader: fix not showing empty when there's no options (#4565) (9d8d7e6), closes #4562
- code-editor: fix config (#4436) (5283a32)
- core: add type guard for isNotNil (#4431) (b3c686c)
- core: fix global config not working in prod mode (#4325) (cc9308d), closes #4319
- date-picker:
nzDefaultOpenValue
not work in time panel (#4357) (dfa3d39), closes #4331 - date-picker: animation start after overlay open (#4315) (931fd48)
- date-picker: select date but nzDefaultOpenValue not work (#4490) (2397819)
- drawer: content overflow when placement is top or bottom (#4423) (9451de5), closes #4354
- drawer: disable transition animation when placement change (#4609) (e539096), closes #4224
- drawer: fix the HTML structure of the drawer header (#4311) (5cdd5db), closes #4304
- dropdown: fix ghost menu with contextmenu (39487f1), closes #3971 #4684
- dropdown: fix menu group style in dropdown (d928a8c), closes #4505
- layout: fix layout demo height style (bed60ff), closes #4676
- layout: fix responsive sider not work (9f951f8)
- mention: unable to select on mobile device (#4309) (1be6d51), closes #4281
- menu: fix menu overflow detection & replace ul with div (4c8032b), closes #3412 #4227 #3687
- message: fix message and notification error in prod (#4884) (3e2f85d)
- modal:
nzMaskClosable
not working in the confirm mode (#4347) (475bbc4), closes #4344 - page-header: fix break change on the style (#4303) (4c10e5b)
- page-header: has footer or breadcrumb style bug (#4363) (dcc7deb)
- pagination: replace full-width character with half-width (#4371) (cc3868e)
- select: prevent hidden options from being selected (#4382) (cf22133), closes #4377 #4377
- table:
nzFilters
can is not null (#4595) (2c26e9f) - table: fix table data type (#4608) (70b1440), closes #4593
- table: fix table nzWidth bug without the first column (#4329) (c6bdf15), closes #4312
- table: support nzWidthConfig null undefined value (#4342) (761e8e0)
- timeline: fix reverse bug (#4690) (09bf8f4), closes #4509
- transfer: fix transfer nzTargetKeys property (#4670) (31089a1), closes #4641 #4360 #4210
- fix github workflow action (10a772f)
- tooltip: fix hiding when hover popover (#4418) (a6b5901), closes #4417
- tooltip: fix not undefined value not updated (#4392) (2a71c43)
- tooltip: fix tooltip accessing destroyed view (#4387) (8e9e6a9), closes #3875 #4317 #4386
- tree-select: click label behavior is incorrect in strict mode (#4424) (7a11124), closes #4422
- tree-select: default tags incorrect in strictly mode (#4368) (a6547a0), closes #4364
- calendar: delete deprecated input nzCard (#4464) (aed2e7d)
- carousel: remove vertical api (#4376) (37aa921)
- empty: remove injection token (#4465) (cc8018a)
- icon: remove old api (#4375) (91e52ab)
- message,notification: remove old injection tokens (#4404) (f9b0e75)
- tooltip,popover,popconfirm: remove component API (#4390) (f82e8a6)
- tree, tree-select: remove deprecated API (#4601) (1ec18e4)
- code-editor: fix wrong initialization with diff mode (#4485) (#4532) (021cf22)
Features
- breadcrumb: support indenpendent separator (#4713) (1f490e9)
- collapse: support nzExpandIconPosition (#4781) (760512a)
- date-picker: add some inputs (#4843) (af4051e)
- date-picker: support parse input value (#4833) (6a523ba), closes #4028 #3976 #2492 #4101
- grid: support nzFlex and nzGutter array, deprecated nzType (c4d2694)
- i18n: support for Armenian (#4611) (038691f)
- i18n: support for Georgian locale (#4491) (d96ebe0)
- icon: support add icon in feat modules (#4711) (0bcd2a9)
- input: support textarea with clear icon (0af9242), closes #4623
- input-number: support nzPrecisionMode mode (#4185) (bfe089f), closes #4173
- input-number: trigger ngModelChange at once (#4769) (299ba6d), closes #3039 #3773
- menu: auto nzInlineCollapsed when sider collapsed (51fbf5e), closes #4680
- menu: menu with nzMatchRouter work with CanDeactivate (7560563), closes #4407
- code-editor: support static loading (#4341) (29f732b)
- notification: add close icon prop (#4495) (80a0b26), closes #4494
- page-header: add
nzGhost
property (#4306) (4c78cca), closes #4303 - pagination: nzItemRender support prev_5 and next_5 (#4754) (41c4860)
- progress: support steps (#4637) (fe8b469), closes #4635
- progress: support TemplateRef for nzFormat (#4598) (edf0e9c), closes #4596
- select: refactor the select to support virutal scroll (40daee9), closes #4585 #3497
- skeleton: add nz-skeleton-element (#4859) (8dc2ff3)
- tabs: add nzCanDeactivate hook (#4476) (a533980), closes #4432
- tag: support status colors (#4628) (aa22c0f), closes #4622 #4413
- tooltip: support changing trigger (#4397) (48d7122), closes #4365
- tree-select: support
nzDropdownClassName
property (#4552) (df8c125), closes #4508 - typography: support
nzSuffix
property (#4629) (ca02a07), closes #4620 - schematics: add locale option in 'ng-add' (#4786) (dcd01cb)
- schematics: add v9 migration rules for dropdown (#4466) (aebad87)
- schematics: add v9 migration rules for icon and calendar (#4467) (3c5d24e)
- schematics: add v9 migration rules for tooltip-like (#4402) (313f7b8)
Performance Improvements
- checkbox: use css empty selector instead of observeContent (#4761) (da8821a)
- input: improve input-group perf (7af643b), closes #3950
- radio: refactor radio group data flow (#4770) (423a382)
BREAKING CHANGES
Note: All break changes are warned in the latest version of 8.x, if you have fixed all warnings in 8.x, there will no break changes for you. Official ng update
tools will be provided in version 9.0.0
.
- form:
nz-form-extra
is removed. Please usenzExtra
isnz-form-control
instead.nz-form-explain
is removed. Please usenzSuccessTip | nzWarningTip | nzErrorTip | nzValidatingTip
isnz-form-control
instead.
- input-number:
- ngModelChange trigger at once when user typing
- pagination:
- prev_5 and next_5 is needed when use nzItemRender
- 'pre' typo was corrected to 'prev'
- tree, tree-select: * tree
- Removed
[nzDefaultExpandAll]
use[nzExpandAll]
instead. - Removed
[nzDefaultExpandedKeys]
use[nzExpandedKeys]
instead. - Removed
[nzDefaultSelectedKeys]
use[nzSelectedKeys]
instead. - Removed
[nzDefaultCheckedKeys]
use[nzCheckedKeys]
instead. - Removed
(nzOnSearchNode)
use(nzSearchValueChange)
instead.
- Removed
- tree-select
- Removed
[nzDefaultExpandedKeys]
use[nzExpandedKeys]
instead.
- Removed
- message,notification:
NZ_MESSAGE_CONFIG
is removed. Please useNzGlobalConfigService
instead.NZ_NOTIFICATION_CONFIG
is removed. Please useNzGlobalConfigService
instead.config
method ofNzMessageService
andNzNotificationService
is removed. Please useset
method ofNzGlobalConfigService
instead.
- empty:
NZ_DEFAULT_EMPTY_CONTENT
is removed. Please useNzConfigService
instead.
- carousel: Carousel
nzVertical
is removed. Please use 'nzDotPosition' instead.
- icon:
NZ_ICON_DEFAULT_TWOTONE_COLOR
is removed. UseNzGlobalConfigService
instead.i[nz-icon]
:twoToneColor
theme
spin
iconfont
type
inputs has been removed, usenzTwoToneColor
nzTheme
nzSpin
nzIconfont
nzType
instead.i.anticon
selector has been removed, usei[nz-icon]
instead.
- calendar:
<nz-calendar>
nzCard
input has been removed, usenzFullscreen
instead.
- tooltip,popover,popconfirm:
<nz-tooltip>
<nz-popover>
<nz-popconfirm>
components has been removed, use its directives instead.
- Removed deprecated API
NgZorroAntdModule.forRoot()
9.0.0-beta.1
2020-03-15
请注意,目前版本仍然是 beta 版本,不建议在生产环境中使用,如果使用中碰到任何问题,欢迎给我们提 issue。
欢迎来到 ng-zorro-antd
的 9.0.0-beta.1
版本,升级到最新版本之后,开发者不仅可以享受到最新版本 Angular 的支持,还可以获得最新特性和更好的性能。
ng-zorro-antd 的部分 API 在 8.x 版本进入弃用状态,并且在开发环境中给出了警告提醒,所有之前弃用 API 在 9.0.0 不再支持,如果你之前已经根据告警信息修改了对应组件的使用方式,那么 9.0.0 版本升级不会有任何障碍,请按照以下步骤进行。
- 升级 Angular 主版本号至 9.0.0 版本,可以参考 https://update.angular.io/
- 手动升级 ng-zorro-antd 至 最新版本,我们将会在 9.0.0 正式版中提供官方自动 ng update 工具。
- 在 9.0.0 之后 ng-zorro-antd 使用了 date-fns 的 2.x 版本,我们提供了组件内部的输入格式兼容工具。
date-fns 升级
当你切换至 date-fns
时,一些日期格式会有 breaking change。比如:
<!-- datefns v1 -->
<nz-date-picker nzFormat="YYYY-MM-DD"></nz-date-picker>
<!-- datefns v2 -->
<nz-date-picker nzFormat="yyyy-MM-dd"></nz-date-picker>
我们推荐使用 date-fns
v2 的日期格式。如果你不想使用新日期格式,你可以用 NZ_DATE_FNS_COMPATIBLE
,当设置为 true
时,ng-zorro-antd
会把 v1 的格式转为 v2,新旧格式的对比看这里。
providers: [
{ provide: NZ_DATE_FNS_COMPATIBLE, useValue: true }
]
但 NZ_DATE_FNS_COMPATIBLE
不会保留太久,到 ng-zorro-antd
v10 将会移除对 date-fns
v1 日期格式的支持,希望你能及时更新 date-fns
日期格式。关于 date-fns
升级指南看这里,如果业务中使用了 date-fns,可以参考 date-fns 官方兼容工具 查看。
Bug Fixes
- auto-complete: 修复滚动条拖拽时自动关闭问题 (#4551) (387ebc1), closes #4333
- auto-complete: 修复默认值显示问题 (#4366) (09f1ec6), closes #4362
- breadcrumb: 修复面包屑显示问题 (#4880) (2553328)
- button: 修复 transition 显示问题 (9e0df2a), closes #2697
- cascader: 修复无选项时的显示问题 (#4565) (9d8d7e6), closes #4562
- code-editor: 修复配置选项 (#4436) (5283a32)
- date-picker: 修复 nzDefaultOpenValue 无效问题 (#4357) (dfa3d39), closes #4331
- date-picker: 修复展开动画效果 (#4315) (931fd48)
- drawer: 修复 overflow 样式问题 (#4423) (9451de5), closes #4354
- drawer: 修复位置变化时的动画问题 (#4609) (e539096), closes #4224
- drawer: 修复 header 结构样式问题 (#4311) (5cdd5db), closes #4304
- dropdown: 修复 contextmenu 多重打开问题 (39487f1), closes #3971 #4684
- dropdown: 修复 menu group 在 dropdown 样式问题你 (d928a8c), closes #4505
- layout: 修复 layout 高度问题 (bed60ff), closes #4676
- layout: 修复 responsive 无效问题 (9f951f8)
- mention: 修复移动端选择问题 (#4309) (1be6d51), closes #4281
- menu: 修复在屏幕越界时的显示问题 (4c8032b), closes #3412 #4227 #3687
- message: 修复 prod 下 message 与 notification 的问题 (#4884) (3e2f85d)
- modal: 修复
nzMaskClosable
在 confirm 模式下不工作的问题 (#4347) (475bbc4), closes #4344 - pagination: 修复半角字符问题 (#4371) (cc3868e)
- select: 修复 hidden 的选项可以被选中的问题 (#4382) (cf22133), closes #4377 #4377
- table: 修复
nzFilters
为 null 时的报错 (#4595) (2c26e9f) - table: 修复 Table 导出的 data 数据类型问题 (#4608) (70b1440), closes #4593
- table: 修复 Table nzWidth 的问题 (#4329) (c6bdf15), closes #4312
- timeline: 修复 reverse 下的展示问题 (#4690) (09bf8f4), closes #4509
- transfer: 修复 nzTargetKeys 无效问题 (#4670) (31089a1), closes #4641 #4360 #4210
- tooltip: 修复 hover popover 时时隐藏的问题 (#4418) (a6b5901), closes #4417
- tooltip: 修复 undefined 不生效的问题 (#4392) (2a71c43)
- tooltip: 修复 tooltip 销毁时报错的问题 (#4387) (8e9e6a9), closes #3875 #4317 #4386
- tree-select: 修复点击 label 在 strict 模式下的问题 (#4424) (7a11124), closes #4422
- tree-select: 修复 tags 在 strict 模式下的问题 (#4368) (a6547a0), closes #4364
- code-editor: 修复 diff 模式下的问题 (#4485) (#4532) (021cf22)
Features
- breadcrumb: 支持独立 separator (#4713) (1f490e9)
- collapse: 支持 nzExpandIconPosition (#4781) (760512a)
- date-picker: 支持更多的 inputs (#4843) (af4051e)
- date-picker: 支持对 input 数据的解析 (#4833) (6a523ba), closes #4028 #3976 #2492 #4101
- grid: 支持 nzFlex 与 nzGutter 数组输入 (c4d2694)
- i18n: 支持 Armenian 语言 (#4611) (038691f)
- i18n: 支持 Georgian 语言 (#4491) (d96ebe0)
- icon: 支持在 feature module 中导入 icons (#4711) (0bcd2a9)
- input: 支持 textarea 带 clear 图标的效果 (0af9242), closes #4623
- input-number: 支持 nzPrecisionMode 模式 (#4185) (bfe089f), closes #4173
- input-number: 支持 ngModelChange 在输入时立即触发 (#4769) (299ba6d), closes #3039 #3773
- menu: 当 sider 收起时,自动触发 nzInlineCollapsed模式 (51fbf5e), closes #4680
- menu: 支持 nzMatchRouter 与 CanDeactivate 配合工作 (7560563), closes #4407
- code-editor: 支持静态导入 (#4341) (29f732b)
- notification: 支持 close icon 选项 (#4495) (80a0b26), closes #4494
- page-header: 增加
nzGhost
选项 (#4306) (4c78cca), closes #4303 - pagination: nzItemRender 支持 prev_5 与 next_5 图标定制 (#4754) (41c4860)
- progress: 支持 steps 模式 (#4637) (fe8b469), closes #4635
- progress: 支持 nzFormat 传入 TemplateRef (#4598) (edf0e9c), closes #4596
- select: select 支持 virutal scroll 模式 (40daee9), closes #4585 #3497
- skeleton: 增加 nz-skeleton-element (#4859) (8dc2ff3)
- tabs: 增加了 nzCanDeactivate 钩子 (#4476) (a533980), closes #4432
- tag: 增加 status colors 选项 (#4628) (aa22c0f), closes #4622 #4413
- tooltip: 支持改变 trigger 位置 (#4397) (48d7122), closes #4365
- tree-select: 支持
nzDropdownClassName
选项 (#4552) (df8c125), closes #4508 - typography: 支持
nzSuffix
选项 (#4629) (ca02a07), closes #4620
Performance Improvements
- checkbox: 使用 css empty selector 代替了 observeContent (#4761) (da8821a)
- input: 提升 input 性能 (7af643b), closes #3950
- radio: 重构了数据流 (#4770) (423a382)
BREAKING CHANGES
注意: 所有不兼容改动均在 8.x 最新版本中给出了 warning,如果你在 8.x 最新版本中修复了所有 warning,9.x 可以直接升级的,ng update
工具在 9.0 正式版会提供。
- form:
nz-form-extra
被移除,请使用nzExtra
中的nz-form-control
代替。nz-form-explain
被移除,请使用nzSuccessTip | nzWarningTip | nzErrorTip | nzValidatingTip
中的nz-form-control
代替。
- input-number:
- ngModelChange 会在用户输入时立刻触发
- pagination:
- 当定制 nzItemRender 时,需要考虑 prev_5 and next_5
- 'pre' 被修改为 'prev'
- tree, tree-select: * tree
- 移除了
[nzDefaultExpandAll]
请使用[nzExpandAll]
代替。 - 移除了
[nzDefaultExpandedKeys]
请使用[nzExpandedKeys]
代替。 - 移除了
[nzDefaultSelectedKeys]
请使用[nzSelectedKeys]
代替。 - 移除了
[nzDefaultCheckedKeys]
请使用[nzCheckedKeys]
代替。 - 移除了
(nzOnSearchNode)
请使用(nzSearchValueChange)
代替。
- 移除了
- tree-select
- 移除了
[nzDefaultExpandedKeys]
请使用[nzExpandedKeys]
代替。
- 移除了
- message,notification:
NZ_MESSAGE_CONFIG
被移除,请使用NzGlobalConfigService
代替。NZ_NOTIFICATION_CONFIG
被移除,请使用NzGlobalConfigService
代替。config
method ofNzMessageService
andNzNotificationService
被移除,请使用set
method ofNzGlobalConfigService
代替。
- empty:
NZ_DEFAULT_EMPTY_CONTENT
被移除,请使用NzConfigService
代替。
- carousel: Carousel
nzVertical
被移除,请使用 'nzDotPosition' 代替。
- icon:
i[nz-icon]
:twoToneColor
theme
spin
iconfont
type
输入被移除, 请使用nzTwoToneColor
nzTheme
nzSpin
nzIconfont
nzType
代替。i.anticon
被移除, 请使用i[nz-icon]
代替。NZ_ICON_DEFAULT_TWOTONE_COLOR
被移除, 请使用NzGlobalConfigService
。
- calendar:
<nz-calendar>
nzCard
被移除了, 请使用nzFullscreen
代替。
- tooltip,popover,popconfirm:
-<nz-tooltip>
<nz-popover>
<nz-popconfirm>
组件被移除, 请使用对应的 directives 代替。 - 移除了无用的 API
NgZorroAntdModule.forRoot()