mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Merge pull request #8431 from igrowp/fix-search-sort-panel
fix: editor组件面板排序问题
This commit is contained in:
commit
e92878229a
@ -201,9 +201,15 @@ export default class SearchPanel extends React.Component<
|
|||||||
curSearchResult.push(item);
|
curSearchResult.push(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
const searchMap = new Map<string, any>();
|
||||||
matchSorter(allResult, keywords, {
|
matchSorter(allResult, keywords, {
|
||||||
keys: ['name', 'description', 'scaffold.type', 'searchKeywords']
|
keys: ['name', 'description', 'scaffold.type', 'searchKeywords']
|
||||||
}).forEach(item => {
|
}).forEach(item => {
|
||||||
|
searchMap.set(item.id, item);
|
||||||
|
});
|
||||||
|
|
||||||
|
allResult.forEach(item => {
|
||||||
|
if (searchMap.has(item.id)) {
|
||||||
if (item[curTagKey]) {
|
if (item[curTagKey]) {
|
||||||
const tags = Array.isArray(item[curTagKey])
|
const tags = Array.isArray(item[curTagKey])
|
||||||
? item[curTagKey].concat()
|
? item[curTagKey].concat()
|
||||||
@ -217,6 +223,7 @@ export default class SearchPanel extends React.Component<
|
|||||||
} else {
|
} else {
|
||||||
curSearchResult.push(item);
|
curSearchResult.push(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,9 +692,15 @@ export const MainStore = types
|
|||||||
[propName: string]: Array<SubRendererInfo>;
|
[propName: string]: Array<SubRendererInfo>;
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
|
const searchMap = new Map<string, any>();
|
||||||
matchSorter(subRenderers, keywords, {
|
matchSorter(subRenderers, keywords, {
|
||||||
keys: ['name', 'description', 'scaffold.type', 'searchKeywords']
|
keys: ['name', 'description', 'scaffold.type', 'searchKeywords']
|
||||||
}).forEach(item => {
|
}).forEach(item => {
|
||||||
|
searchMap.set(item.id, item);
|
||||||
|
});
|
||||||
|
|
||||||
|
subRenderers.forEach(item => {
|
||||||
|
if (searchMap.has(item.id)) {
|
||||||
const tags = Array.isArray(item.tags)
|
const tags = Array.isArray(item.tags)
|
||||||
? item.tags.concat()
|
? item.tags.concat()
|
||||||
: item.tags
|
: item.tags
|
||||||
@ -705,6 +711,7 @@ export const MainStore = types
|
|||||||
grouped[tag] = grouped[tag] || [];
|
grouped[tag] = grouped[tag] || [];
|
||||||
grouped[tag].push(item);
|
grouped[tag].push(item);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return grouped;
|
return grouped;
|
||||||
|
Loading…
Reference in New Issue
Block a user