mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
modify(dataTable): filters
This commit is contained in:
parent
d89ce7d156
commit
2415b45290
@ -69,10 +69,10 @@ import NEmpty from '../../Empty'
|
||||
import NPagination from '../../Pagination'
|
||||
import formatLength from '../../_utils/css/formatLength'
|
||||
|
||||
function createShallowClonedArray (array) {
|
||||
if (Array.isArray(array)) return array.map(createShallowClonedObject)
|
||||
return array
|
||||
}
|
||||
// function createShallowClonedArray (array) {
|
||||
// if (Array.isArray(array)) return array.map(createShallowClonedObject)
|
||||
// return array
|
||||
// }
|
||||
|
||||
function createShallowClonedObject (object) {
|
||||
if (!object) return object
|
||||
@ -486,8 +486,15 @@ export default {
|
||||
this.$emit('sorter-change', createShallowClonedObject(sorter))
|
||||
},
|
||||
changeFilters (filters, sourceColumn) {
|
||||
this.internalActiveFilters = !filters ? {} : filters
|
||||
this.$emit('filters-change', createShallowClonedObject(this.internalActiveFilters), createShallowClonedObject(sourceColumn))
|
||||
if (!filters) {
|
||||
this.internalActiveFilters = {}
|
||||
this.$emit('filters-change', {}, createShallowClonedObject(sourceColumn))
|
||||
} else if (Object.prototype.toString.call(filters) === '[object Object]') {
|
||||
this.internalActiveFilters = filters
|
||||
this.$emit('filters-change', createShallowClonedObject(filters), createShallowClonedObject(sourceColumn))
|
||||
} else {
|
||||
console.error('[naive-ui/dataTable]: filters is not a Object')
|
||||
}
|
||||
},
|
||||
scrollMainTableBodyToTop () {
|
||||
const {
|
||||
|
@ -40,14 +40,6 @@ import NDataTableFilterMenu from './FilterMenu'
|
||||
import NPopover from '../../../Popover'
|
||||
import funnel from '../../../_icons/funnel'
|
||||
|
||||
// function createFilterOptionValues (activeFilters, column) {
|
||||
// // const activeFilterOptionValues = activeFilters
|
||||
// // .filter(filter => filter.columnKey === column.key)
|
||||
// // .map(filter => filter.filterOptionValue)
|
||||
// const activeFilterOptionValues = activeFilters[column.key]
|
||||
// return activeFilterOptionValues
|
||||
// }
|
||||
|
||||
function createActiveFilters (allFilters, columnKey, filterOptionValues) {
|
||||
if (!Array.isArray(filterOptionValues)) {
|
||||
filterOptionValues = [filterOptionValues]
|
||||
|
Loading…
Reference in New Issue
Block a user