Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(KtTable): cleanup of unfinished/unused filter feature #847

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/documentation/pages/components/tables.vue
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ Sometimes you may need to access the table's store and control it from outside.
While `ref` may work if your modifications are in the _same_ component, your controller component may be elsewhere.

For that purpose, we introduce `KtTableProvider`/`KtTableConsumer`. The provider exposes the `store`, from which you can access many props from the store.
It also directly exposes `columns`, `filteredColumns`, `sortedColumns`, `hiddenColumns`, for faster accesss, and methods: `hideColumn`, `showAllColumns`, `orderBeforeColumn`.
It also directly exposes `columns`, `sortedColumns`, `hiddenColumns`, for faster accesss, and methods: `hideColumn`, `showAllColumns`, `orderBeforeColumn`.

`<KtTableProvider />` takes the same props as `<KtTable/>`.

Expand Down Expand Up @@ -969,7 +969,6 @@ The above code for `orderBeforeColumn` function, is meant to map the UI drag/dro
| `disableRow` | disable some rows if the function is true | `Function` | — | — |
| `emptyText` | text to show when table is empty | `String` | — | — |
| `expandMultiple` | allow for expanding multiple rows at once | `Boolean` | — | `false` |
| `filterdColumns` | prop for changing filterd columns | `Array` | [{ prop, filter }] | `[]` |
| `hiddenColumns` | prop for changing hidden columns | `Array` | [{ prop, hidden }] | `[]` |
| `id` | for when using nested providers | `String` | — | null |
| `isInteractive` | allow clicking/keyboard focusing table rows | `Boolean` | — | `false` |
Expand Down Expand Up @@ -1077,7 +1076,7 @@ The above code for `orderBeforeColumn` function, is meant to map the UI drag/dro

| Slot Name | Description | Scope |
| :-------- | :---------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
| `default` | provide a table's store and other methods | `{store, columns, hiddenColumns, sortedColumns, filteredColumns, hideColumn, showAllColumns, orderBeforeColumn}` |
| `default` | provide a table's store and other methods | `{store, columns, hiddenColumns, sortedColumns, hideColumn, showAllColumns, orderBeforeColumn}` |

</template>

Expand Down
10 changes: 0 additions & 10 deletions packages/kotti-ui/source/kotti-table/src/KtTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const INITIAL_TABLE_STORE_PROPS = [
'sortable',
'sortedColumns',
'hiddenColumns',
'filteredColumns',
]

export default {
Expand All @@ -71,7 +70,6 @@ export default {
useQuickSortControl: { default: false, type: Boolean },

sortedColumns: { type: [Array, undefined] },
filteredColumns: { type: [Array, undefined] },
hiddenColumns: { type: [Array, undefined] },
orderedColumns: { type: [Array, undefined] },

Expand Down Expand Up @@ -243,14 +241,6 @@ export default {
}
},
},
filteredColumns: {
immediate: true,
handler(value, oldValue) {
if (value && !deepEql(value, oldValue)) {
this.store.commit('setFilteredColumns', value)
}
},
},
orderedColumns: {
immediate: true,
handler(value, oldValue) {
Expand Down
2 changes: 0 additions & 2 deletions packages/kotti-ui/source/kotti-table/src/TableConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const KtTableConsumer = {
KtTableColumns: columns,
KtTableHiddenColumns: hiddenColumns,
KtTableSortedColumns: sortedColumns,
KtTableFilteredColumns: filteredColumns,
KtTableHideColumn: hideColumn,
KtTableShowAllColumns: showAllColumns,
KtTableOrderBeforeColumn: orderBeforeColumn,
Expand All @@ -31,7 +30,6 @@ const KtTableConsumer = {
columns,
hiddenColumns,
sortedColumns,
filteredColumns,
hideColumn,
showAllColumns,
orderBeforeColumn,
Expand Down
4 changes: 0 additions & 4 deletions packages/kotti-ui/source/kotti-table/src/logic/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Vue from 'vue'

import { SORT_NONE, PUBLIC_COLUMN_PROPS } from '../constants'

import { setFilteredColumn } from './filter'
import { setHiddenColumn, getResolvedHiddenColumns } from './hide'
import { resolveColumnsOrder, getOrderedColumns } from './order'
import { setSortedColumn } from './sort'
Expand Down Expand Up @@ -51,9 +50,6 @@ export function setColumn(state, { column, index, deleted }) {
if (newColumn.hidden === true) {
setHiddenColumn(state, newColumn)
}
if (newColumn.filter !== undefined) {
setFilteredColumn(state, newColumn)
}

return newColumn
}
Expand Down
26 changes: 0 additions & 26 deletions packages/kotti-ui/source/kotti-table/src/logic/filter.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kotti-ui/source/kotti-table/src/logic/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import pickBy from 'lodash/pickBy'
import * as column from './column'
import * as disable from './disable'
import * as expand from './expand'
import * as filter from './filter'
import * as hide from './hide'
import * as order from './order'
import * as rows from './row'
Expand All @@ -26,7 +25,6 @@ export class TableStore {
...select.defaultState,
...hide.defaultState,
...sort.defaultState,
...filter.defaultState,
})
this.setInitialState(initialState)

Expand All @@ -39,7 +37,6 @@ export class TableStore {
...select.mutations,
...hide.mutations,
...sort.mutations,
...filter.mutations,
}

this.getters = {
Expand All @@ -51,7 +48,6 @@ export class TableStore {
...select.getters,
...hide.getters,
...sort.getters,
...filter.getters,
}
}
setTable(table) {
Expand Down
3 changes: 0 additions & 3 deletions packages/kotti-ui/source/kotti-table/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export const TableColumnsStateMixin = {
KtTableSortedColumns() {
return this.KtTableStore.state.sortedColumns
},
KtTableFilteredColumns() {
return this.KtTableStore.state.filteredColumns
},
},
methods: {
KtTableHideColumn(column, toggle = true) {
Expand Down
Loading