Skip to content

Commit babc954

Browse files
committed
fix(components): filter with kebab-case, closes #1729
1 parent b513878 commit babc954

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

packages/app-backend-vue2/src/components/tree.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AppRecord, BackendContext, DevtoolsApi } from '@vue-devtools/app-backend-api'
2-
import { classify } from '@vue-devtools/shared-utils'
2+
import { classify, kebabize } from '@vue-devtools/shared-utils'
33
import { ComponentTreeNode, ComponentInstance } from '@vue/devtools-api'
44
import { getRootElementsFromComponentInstance } from './el'
55
import { getInstanceName, getRenderKey, getUniqueId, isBeingDestroyed } from './util'
@@ -120,8 +120,9 @@ function getInternalInstanceChildren (instance): any[] {
120120
* Check if an instance is qualified.
121121
*/
122122
function isQualified (instance): boolean {
123-
const name = classify(getInstanceName(instance)).toLowerCase()
124-
return name.indexOf(filter) > -1
123+
const name = getInstanceName(instance)
124+
return classify(name).toLowerCase().indexOf(filter) > -1 ||
125+
kebabize(name).toLowerCase().indexOf(filter) > -1
125126
}
126127

127128
function flatten<T> (items: any[]): T[] {

packages/app-backend-vue3/src/components/filter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { classify } from '@vue-devtools/shared-utils'
1+
import { classify, kebabize } from '@vue-devtools/shared-utils'
22
import { getInstanceName } from './util'
33

44
export class ComponentFilter {
@@ -15,7 +15,8 @@ export class ComponentFilter {
1515
* @return {Boolean}
1616
*/
1717
isQualified (instance) {
18-
const name = classify(getInstanceName(instance)).toLowerCase()
19-
return name.indexOf(this.filter) > -1
18+
const name = getInstanceName(instance)
19+
return classify(name).toLowerCase().indexOf(this.filter) > -1 ||
20+
kebabize(name).toLowerCase().indexOf(this.filter) > -1
2021
}
2122
}

packages/shell-dev-vue3/src/FormSection.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<script>
2+
export default {
3+
// eslint-disable-next-line vue/name-property-casing
4+
name: 'form-section',
5+
}
6+
</script>
7+
18
<template>
29
<fieldset>
310
<legend>Form section</legend>

0 commit comments

Comments
 (0)