modify(document & changelog)

This commit is contained in:
songwanli2025@163.com 2020-03-27 17:32:53 +08:00
parent fa613efa0b
commit 8116425765
5 changed files with 17 additions and 14 deletions

View File

@ -1,10 +1,14 @@
# CHANGELOG
## 1.0.4 (2020-03-27)
## 1.0.5 (2020-03-27)
### Features
- Change the data type of `n-data-table`'s filters from Array to Object.
### Fixes
- `n-data-table` cannot be filtered correctly when there are multiple filtered columns.
## 1.0.4 (2020-03-26)
### Features
- Filter menu in `n-data-table` is scrollable when there are too many items.
## 1.0.3 (2020-03-25)
### Features
- `$NMessage`, `$NNotification`, `$NConfirm`'s theme will be applied on their children components.

View File

@ -1,10 +1,14 @@
# CHANGELOG
## 1.0.4 (2020-03-27)
## 1.0.5 (2020-03-27)
### Features
- 改变 `n-data-table` 的 filters 的数据类型, 从数组改变成对象.
### Fixes
- `n-data-table`在有多列筛选的情况下数据不能被正确筛选.
## 1.0.4 (2020-03-26)
### Features
- 当选项过多时,`n-data-table` 过滤菜单的内容可以滚动
## 1.0.3 (2020-03-25)
### Features
- `$NMessage`, `$NNotification`, `$NConfirm` 的获取到的主题会应用到他们的内部组件

View File

@ -55,8 +55,8 @@ These methods can help you control table in an uncontrolled manner. However, it'
|Name|Type|Description|
|-|-|-|
|filters|`(filters: { (string \| number): Array<string \| number> })`|Key is the key of the column, value is the filterOptionValues.|
|sort|`(columnKey: string \| null, order: 'ascend' \| 'descend' \| false)`|If columnKey set to `null`, it is same as clearSorter|
|filters|`(filters: { [string \| number]: Array<string \| number> }) => void`|Key is the key of the column, value is the filterOptionValues.|
|sort|`(columnKey: string \| null, order: 'ascend' \| 'descend' \| false) => void`|If columnKey set to `null`, it is same as clearSorter|
|page|`(page: number) => void`||
|clearFilters|`() => void`||
|clearSorter|`() => void`||
@ -65,7 +65,7 @@ These methods can help you control table in an uncontrolled manner. However, it'
## Events
|Name|Parameters|Description|
|-|-|-|
|filters-change|`(filters: { (string \| number): Array<string \| number> }, initiatorColumn: object)`||
|filters-change|`(filters: { [string \| number]: Array<string \| number> }, initiatorColumn: object)`||
|sorter-change|`({ columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|If there won't be a active sorter after change, sorter-change will emit `null`|
|page-change|`(page: number)`||
|page-size-change|`(pageSize: number)`||

View File

@ -55,8 +55,8 @@ ajaxUsage
|名称|参数|说明|
|-|-|-|
|filters|`(filters: { (string \| number): Array<string \| number> })`| Key 是列的 key, value 是 filterOptionValues.|
|sort|`(columnKey: string \| null, order: 'ascend' \| 'descend' \| false)`|如果 columnKey 设为 `null`,那它和 clearSorter 效果一致|
|filters|`(filters: { [string \| number]: Array<string \| number> }) => void`| Key 是列的 key, value 是 filterOptionValues.|
|sort|`(columnKey: string \| null, order: 'ascend' \| 'descend' \| false) => void`|如果 columnKey 设为 `null`,那它和 clearSorter 效果一致|
|page|`(page: number) => void`||
|clearFilters|`() => void`||
|clearSorter|`() => void`||
@ -65,7 +65,7 @@ ajaxUsage
## Events
|名称|参数|说明|
|-|-|-|
|filters-change|`(filters: { (string \| number): Array<string \| number> }, initiatorColumn: object)`||
|filters-change|`(filters: { [string \| number]: Array<string \| number> }, initiatorColumn: object)`||
|sorter-change|`({ columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|如果在变动后没有激活的排序,那么 sorter-change 将发出 `null`|
|page-change|`(page: number)`||
|page-size-change|`(pageSize: number)`||

View File

@ -70,11 +70,6 @@ import NPagination from '../../Pagination'
import formatLength from '../../_utils/css/formatLength'
import isPlainObject from 'lodash-es/isPlainObject'
// function createShallowClonedArray (array) {
// if (Array.isArray(array)) return array.map(createShallowClonedObject)
// return array
// }
function createShallowClonedObject (object) {
if (!object) return object
if (typeof object === 'object') {
@ -495,7 +490,7 @@ export default {
this.internalActiveFilters = filters
this.$emit('filters-change', createShallowClonedObject(filters), createShallowClonedObject(sourceColumn))
} else {
console.error('[naive-ui/dataTable]: filters is not an Object')
console.error('[naive-ui/n-data-table]: filters is not an object')
}
},
scrollMainTableBodyToTop () {