Skip to content

Commit 03067e4

Browse files
authored
Merge branch 'dev' into feat-code-refactoring
2 parents 465ecbf + ff10335 commit 03067e4

File tree

7 files changed

+198
-119
lines changed

7 files changed

+198
-119
lines changed

.github/renovate.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"extends": ["@nuxtjs"],
33
"labels": ["Type: Dependencies"],
44
"packageRules": [
5+
{
6+
"packageNames": ["autoprefixer"],
7+
"allowedVersions": "<10.0.0"
8+
},
59
{
610
"packageNames": ["bootstrap"],
711
"allowedVersions": "<5.0.0"
@@ -14,6 +18,10 @@
1418
"packageNames": ["highlight.js"],
1519
"allowedVersions": "<10.0.0"
1620
},
21+
{
22+
"packageNames": ["postcss"],
23+
"allowedVersions": "<8.0.0"
24+
},
1725
{
1826
"packageNames": ["prettier"],
1927
"allowedVersions": "<=1.14.3"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
"marked": "^1.1.1",
150150
"node-sass": "^4.14.1",
151151
"nuxt": "^2.14.5",
152+
"postcss": "^7.0.32",
152153
"postcss-cli": "^7.1.2",
153154
"prettier": "1.14.3",
154155
"require-context": "^1.1.0",

src/components/table/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3000,7 +3000,7 @@ your app handles the various inconsistencies with events.
30003000
:current-page="currentPage"
30013001
:per-page="perPage"
30023002
:filter="filter"
3003-
:filterIncludedFields="filterOn"
3003+
:filter-included-fields="filterOn"
30043004
:sort-by.sync="sortBy"
30053005
:sort-desc.sync="sortDesc"
30063006
:sort-direction="sortDirection"

src/components/table/helpers/mixin-filtering.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export default {
4949
},
5050
computed: {
5151
computedFilterIgnored() {
52-
return this.filterIgnoredFields ? concat(this.filterIgnoredFields).filter(identity) : null
52+
return concat(this.filterIgnoredFields || []).filter(identity)
5353
},
5454
computedFilterIncluded() {
55-
return this.filterIncludedFields ? concat(this.filterIncludedFields).filter(identity) : null
55+
return concat(this.filterIncludedFields || []).filter(identity)
5656
},
5757
computedFilterDebounce() {
5858
const ms = toInteger(this.filterDebounce, 0)

src/components/table/helpers/sanitize-row.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const sanitizeRow = (row, ignoreFields, includeFields, fieldsObj = {}) => {
3131
const allowedKeys = keys(formattedRow).filter(
3232
key =>
3333
!IGNORED_FIELD_KEYS[key] &&
34-
!(isArray(ignoreFields) && arrayIncludes(ignoreFields, key)) &&
35-
!(isArray(includeFields) && !arrayIncludes(includeFields, key))
34+
!(isArray(ignoreFields) && ignoreFields.length > 0 && arrayIncludes(ignoreFields, key)) &&
35+
!(isArray(includeFields) && includeFields.length > 0 && !arrayIncludes(includeFields, key))
3636
)
3737

3838
return pick(formattedRow, allowedKeys)

src/components/table/table-filtering.spec.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,63 @@ describe('table > filtering', () => {
207207
wrapper.destroy()
208208
})
209209

210+
it('`filter-ignored-fields` prop works', async () => {
211+
const wrapper = mount(BTable, {
212+
propsData: {
213+
fields: testFields,
214+
items: testItems,
215+
filter: '',
216+
filterIgnoredFields: []
217+
}
218+
})
219+
220+
expect(wrapper).toBeDefined()
221+
await waitNT(wrapper.vm)
222+
223+
expect(wrapper.findAll('tbody > tr').length).toBe(3)
224+
225+
// Search for a value in "a" column
226+
await wrapper.setProps({ filter: '3' })
227+
await waitNT(wrapper.vm)
228+
expect(wrapper.findAll('tbody > tr').length).toBe(1)
229+
230+
// Ignore "a" column from filtering
231+
await wrapper.setProps({ filterIgnoredFields: ['a'] })
232+
await waitNT(wrapper.vm)
233+
expect(wrapper.findAll('tbody > tr').length).toBe(0)
234+
235+
wrapper.destroy()
236+
})
237+
238+
it('`filter-included-fields` prop works', async () => {
239+
const wrapper = mount(BTable, {
240+
propsData: {
241+
fields: testFields,
242+
// Add a extra item with a duplicated value in another field
243+
items: [...testItems, { a: 4, b: 'y', c: 'a' }],
244+
filter: '',
245+
filterIncludedFields: []
246+
}
247+
})
248+
249+
expect(wrapper).toBeDefined()
250+
await waitNT(wrapper.vm)
251+
252+
expect(wrapper.findAll('tbody > tr').length).toBe(4)
253+
254+
// Search for "a"
255+
await wrapper.setProps({ filter: 'a' })
256+
await waitNT(wrapper.vm)
257+
expect(wrapper.findAll('tbody > tr').length).toBe(2)
258+
259+
// Only include "a" and "b" fields
260+
await wrapper.setProps({ filterIncludedFields: ['a', 'b'] })
261+
await waitNT(wrapper.vm)
262+
expect(wrapper.findAll('tbody > tr').length).toBe(1)
263+
264+
wrapper.destroy()
265+
})
266+
210267
it('should filter for formatted values for keys which are not present in row', async () => {
211268
const wrapper = mount(BTable, {
212269
propsData: {

0 commit comments

Comments
 (0)