diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 349d784a7..791b952c7 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,9 +1,20 @@ # CHANGELOG +## 1.1.2 (2020-05-19) +### Features +- Add content slot for `n-step`. +- Add `label` prop for `n-checkbox`. +### Performance Improvements +- All placeable components register listeners on demand. +- Use cache when finding scrollable parent node. +- Imporve performance of `n-button`'s beforeDestroy. +- Reduce the useless re-rendering of `n-checkbox` when checked status isn't changed. +- Imporve performance of text typed `n-avatar`. + ## 1.1.1 (2020-05-18) ### Fixes - Update css-render dependencies. - Color of default typed button icon. -### Performance Imporvements +### Performance Improvements - Reduce useless re-renders of `n-menu-item`. - Reduce useless re-renders of doc page. ### Refactors diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 43ce71003..856714c53 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,9 +1,20 @@ # CHANGELOG +## 1.1.2 (2020-05-19) +### Features +- 为 `n-step` 增加内容的 slot +- 为 `n-checkbox` 增加了 `label` prop +### Performance Improvements +- 所有定位组件按需注册监听器 +- 在寻找可滚动节点的过程中使用缓存 +- 提升了 `n-button` beforeDestroy 的性能 +- 减少了 `n-checkbox` 在值未改变时的重复渲染 +- 提升了文字内容的 `n-avatar` 的性能 + ## 1.1.1 (2020-05-18) ### Fixes - 更新 css-render 的依赖 - 默认类型的按钮的 icon 的颜色 -### Performance Imporvements +### Performance Improvements - 减少了 `n-menu-item` 没用的重复渲染 - 减少了文档页面没用的重复渲染 ### Refactors diff --git a/demo/documentation/components/checkbox/enUS/event.md b/demo/documentation/components/checkbox/enUS/event.md index a9e24d185..6b7b1ed69 100644 --- a/demo/documentation/components/checkbox/enUS/event.md +++ b/demo/documentation/components/checkbox/enUS/event.md @@ -1,11 +1,11 @@ # Event ```html -Event + - Beijing - Shanghai - Guangzhou - Shenzhen + + + + ``` ```js diff --git a/demo/documentation/components/checkbox/enUS/grid.md b/demo/documentation/components/checkbox/enUS/grid.md index 0e9e5c29a..ca2694569 100644 --- a/demo/documentation/components/checkbox/enUS/grid.md +++ b/demo/documentation/components/checkbox/enUS/grid.md @@ -4,50 +4,50 @@ Use checkbox with grid. - Prosperity + - Democracy + - Civility + - Harmony + - Freedom + - Equality + - Justice + - Rule of Law + - Patriotism + - Dedication + - Integrity + - Friendship + diff --git a/demo/documentation/components/checkbox/enUS/group.md b/demo/documentation/components/checkbox/enUS/group.md index 85f16677c..6f7c4ecf5 100644 --- a/demo/documentation/components/checkbox/enUS/group.md +++ b/demo/documentation/components/checkbox/enUS/group.md @@ -1,10 +1,10 @@ # Checkbox Group ```html - Beijing - Shanghai - Guangzhou - Shenzhen + + + + ``` ```js diff --git a/demo/documentation/components/checkbox/enUS/index.md b/demo/documentation/components/checkbox/enUS/index.md index bbb325db2..dfe88780a 100644 --- a/demo/documentation/components/checkbox/enUS/index.md +++ b/demo/documentation/components/checkbox/enUS/index.md @@ -28,6 +28,7 @@ event |value|`string \| number`|`null`|| |checked|`boolean`|`false`|| |disabled|`boolean`|`false`|| +|label|`string \| function`|`null`|Could be a render function.| ### Checkbox Group Props |Name|Type|Default|Description| @@ -38,6 +39,11 @@ event ## Slots ### Checkbox Slots + + + Don't use the slot in a massive checkbox group. Since it will cause re-rendering of all the checkboxes everytime when the group value changes. In that case you may use label prop instead. + + |Name|Parameters|Description| |-|-|-| |default|`()`|| diff --git a/demo/documentation/components/checkbox/zhCN/event.md b/demo/documentation/components/checkbox/zhCN/event.md index 7b415abf3..494bebccd 100644 --- a/demo/documentation/components/checkbox/zhCN/event.md +++ b/demo/documentation/components/checkbox/zhCN/event.md @@ -1,11 +1,11 @@ # 事件 ```html -事件 + - 北京 - 上海 - 广州 - 深圳 + + + + ``` ```js diff --git a/demo/documentation/components/checkbox/zhCN/grid.md b/demo/documentation/components/checkbox/zhCN/grid.md index 24679e283..d5e5d43c3 100644 --- a/demo/documentation/components/checkbox/zhCN/grid.md +++ b/demo/documentation/components/checkbox/zhCN/grid.md @@ -4,50 +4,50 @@ - 富强 + - 民主 + - 文明 + - 和谐 + - 自由 + - 平等 + - 公正 + - 法制 + - 爱国 + - 敬业 + - 诚信 + - 友善 + diff --git a/demo/documentation/components/checkbox/zhCN/group.md b/demo/documentation/components/checkbox/zhCN/group.md index f1d4c3c05..fc01f130d 100644 --- a/demo/documentation/components/checkbox/zhCN/group.md +++ b/demo/documentation/components/checkbox/zhCN/group.md @@ -1,10 +1,10 @@ # 选项组 ```html - 北京 - 上海 - 广州 - 深圳 + + + + ``` ```js diff --git a/demo/documentation/components/checkbox/zhCN/index.md b/demo/documentation/components/checkbox/zhCN/index.md index 2e983748d..985b79364 100644 --- a/demo/documentation/components/checkbox/zhCN/index.md +++ b/demo/documentation/components/checkbox/zhCN/index.md @@ -28,6 +28,7 @@ event |value|`string \| number`|`null`|| |checked|`boolean`|`false`|| |disabled|`boolean`|`false`|| +|label|`string \| function`|`null`|可以是渲染函数| ### Checkbox Group Props |名称|类型|默认值|说明| @@ -38,6 +39,12 @@ event ## Slots ### Checkbox Slots + + + 不要在一个巨量的选项组中使用 Checkbox 的 slot,因为它会导致每次选项组值变更的时候对每个 Checkbox 做一次重新渲染。在这种情况下你可以使用 label 属性来替代。 + + + |名称|参数|说明| |-|-|-| |default|`()`|| diff --git a/demo/documentation/components/steps/enUS/content.md b/demo/documentation/components/steps/enUS/content.md index ea1e2edf2..32b3c6c08 100644 --- a/demo/documentation/components/steps/enUS/content.md +++ b/demo/documentation/components/steps/enUS/content.md @@ -1,4 +1,4 @@ -# Custom +# Use Slot in Step ```html

Al through the day, I me mine I me mine, I me mine

- click me + + Next +

When I find myself in times of trouble Mother Mary comes to me

- click me + + Next +

Here come old flat top He come grooving up slowly

- click me + + Next +

Something in the way she moves Attracts me like no other lover

- click me + + Next +
@@ -34,13 +58,13 @@ Error - + Process - + Wait - + Finish @@ -61,30 +85,21 @@ export default { currentStatus: 'error' } }, + computed: { + buttonType () { + switch (this.currentStatus) { + case 'error': + return 'error' + case 'finish': + return 'success' + default: + return 'default' + } + } + }, methods: { - handleButton1Click() { - if(this.current === 1) { - console.log('click 1, do something') - this.current++ - } - }, - handleButton2Click() { - if(this.current === 2) { - console.log('click 2, do something') - this.current++ - } - }, - handleButton3Click() { - if(this.current === 3) { - console.log('click 3, do something') - this.current++ - } - }, - handleButton4Click() { - if(this.current === 4) { - console.log('click 4, do something') - this.current = 1 - } + handleButtonClick() { + this.current = (this.current % 4) + 1 } } } diff --git a/demo/documentation/components/steps/zhCN/content.md b/demo/documentation/components/steps/zhCN/content.md index 53d8c9f5e..5109fc2eb 100644 --- a/demo/documentation/components/steps/zhCN/content.md +++ b/demo/documentation/components/steps/zhCN/content.md @@ -1,4 +1,4 @@ -# 自定义内容 +# 使用 Step 的 Slot ```html

Al through the day, I me mine I me mine, I me mine

- click me + + Next +

When I find myself in times of trouble Mother Mary comes to me

- click me + + Next +

Here come old flat top He come grooving up slowly

- click me + + Next +

Something in the way she moves Attracts me like no other lover

- click me + + Next +
@@ -34,13 +58,13 @@ Error - + Process - + Wait - + Finish @@ -61,30 +85,21 @@ export default { currentStatus: 'error' } }, + computed: { + buttonType () { + switch (this.currentStatus) { + case 'error': + return 'error' + case 'finish': + return 'success' + default: + return 'default' + } + } + }, methods: { - handleButton1Click() { - if(this.current === 1) { - console.log('click 1, do something') - this.current++ - } - }, - handleButton2Click() { - if(this.current === 2) { - console.log('click 2, do something') - this.current++ - } - }, - handleButton3Click() { - if(this.current === 3) { - console.log('click 3, do something') - this.current++ - } - }, - handleButton4Click() { - if(this.current === 4) { - console.log('click 4, do something') - this.current = 1 - } + handleButtonClick() { + this.current = (this.current % 4) + 1 } } } diff --git a/demo/entry.vue b/demo/entry.vue index 05df9d581..c8f293b66 100644 --- a/demo/entry.vue +++ b/demo/entry.vue @@ -24,14 +24,14 @@ import DocHeader from './header.vue' import menuOptions from './menuOptions' import { i18n } from './init' import { state } from './store' -import staputed from '../src/_mixins/staputed' +import simulatedComputed from '../src/_mixins/simulatedComputed' export default { components: { DocHeader }, mixins: [ - staputed({ + simulatedComputed({ menuGenerationOptions: { get () { return { diff --git a/package.json b/package.json index 86995c0f8..76173a5ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "naive-ui", - "version": "1.1.0", + "version": "1.1.2", "description": "A Vue UI Framework. Caring About Styles, Themed, Batteries Included, Not Rather Slow.", "main": "lib/index.js", "module": "es/index.js", @@ -40,7 +40,6 @@ "@babel/cli": "^7.8.4", "@babel/core": "^7.8.4", "@babel/preset-env": "^7.8.4", - "@css-render/plugin-bem": "^0.7.5", "@kazupon/vue-i18n-loader": "^0.4.1", "@rollup/plugin-node-resolve": "^6.1.0", "@rollup/plugin-strip": "^1.3.2", @@ -63,7 +62,6 @@ "cors": "^2.8.5", "cross-env": "^5.2.1", "css-loader": "^2.1.1", - "css-render": "^0.7.5", "cssnano": "^4.1.10", "emoji-regex": "^8.0.0", "emoji-unicode": "^1.1.0", @@ -122,7 +120,9 @@ "webpack-dev-server": "^3.10.3" }, "dependencies": { + "@css-render/plugin-bem": "^0.8.0", "async-validator": "^1.11.5", + "css-render": "^0.8.0", "date-fns": "^2.9.0", "highlight.js": "^9.18.1", "lodash-es": "^4.17.15", diff --git a/src/Anchor/src/BaseAnchor.vue b/src/Anchor/src/BaseAnchor.vue index c13705ca5..ab9d2c20b 100644 --- a/src/Anchor/src/BaseAnchor.vue +++ b/src/Anchor/src/BaseAnchor.vue @@ -143,8 +143,8 @@ export default { slotEl.style.top = `${offsetTop}px` slotEl.style.height = `${offsetHeight}px` slotEl.style.maxWidth = `${offsetWidth + offsetLeft}px` - barEl.getBoundingClientRect() - slotEl.getBoundingClientRect() + void barEl.offsetHeight + void slotEl.offsetHeight if (!transition) { barEl.style.transition = null diff --git a/src/Anchor/src/Link.vue b/src/Anchor/src/Link.vue index badeeab57..c705e7725 100644 --- a/src/Anchor/src/Link.vue +++ b/src/Anchor/src/Link.vue @@ -19,6 +19,7 @@