mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-08-07 21:39:05 +00:00
fix(editor): 优化组件列表与图层面板搜索过滤
支持大小写不敏感匹配,组件列表扩展 desc、type 字段搜索。
This commit is contained in:
parent
6f0a41f2db
commit
7777c205b9
@ -71,7 +71,11 @@ const stage = computed(() => editorService.get('stage'));
|
||||
const list = computed<ComponentGroup[]>(() =>
|
||||
componentListService.getList().map((group: ComponentGroup) => ({
|
||||
...group,
|
||||
items: group.items.filter((item: ComponentItem) => item.text.includes(searchText.value)),
|
||||
items: group.items.filter((item: ComponentItem) =>
|
||||
`${item.text || ''}${item.desc || ''}${item.type}`
|
||||
.toLocaleLowerCase()
|
||||
.includes(searchText.value.toLocaleLowerCase()),
|
||||
),
|
||||
})),
|
||||
);
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ const filterNodeMethod = (v: string, data: MNode): boolean => {
|
||||
name = 'container';
|
||||
}
|
||||
|
||||
return `${data.id}${name}${data.type}`.includes(v);
|
||||
return `${data.id}${name}${data.type || ''}`.toLocaleLowerCase().includes(v.toLocaleLowerCase());
|
||||
};
|
||||
|
||||
const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user