|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import { Button, InputGroup, Intent, Menu, MenuItem, Popover, Position, Tab, Tabs, Tooltip } from "@blueprintjs/core";
|
|
|
|
|
import { autorun, observable } from "mobx";
|
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
|
import { pinyin } from "pinyin-pro";
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { DndProvider } from "react-dnd";
|
|
|
|
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
|
|
@ -263,10 +264,36 @@ export class ConfigList extends React.Component<IConfigListProps>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
filterConfigsNames()
|
|
|
|
|
{
|
|
|
|
|
const pinyinMap = new Map<string, string[]>();
|
|
|
|
|
this.props.store.configsNames.forEach(name =>
|
|
|
|
|
{
|
|
|
|
|
const py = pinyin(name, { toneType: 'none', type: 'array' }).join("");
|
|
|
|
|
const pyInitial = pinyin(name, { pattern: 'initial', type: 'array' }).join("");
|
|
|
|
|
pinyinMap.set(name, [py, pyInitial]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const name1 = []; //原名称搜索先显示
|
|
|
|
|
const name2 = []; //拼音缩写搜索第二显示
|
|
|
|
|
const name3 = []; //拼音全拼第三显示
|
|
|
|
|
for (const [name, [py, pyInitial]] of pinyinMap.entries())
|
|
|
|
|
{
|
|
|
|
|
if (CompareIsEqual(name, this.searchName, ECompareType.Include))
|
|
|
|
|
name1.push(name);
|
|
|
|
|
if (CompareIsEqual(pyInitial, this.searchName, ECompareType.Include))
|
|
|
|
|
name2.push(name);
|
|
|
|
|
if (CompareIsEqual(py, this.searchName, ECompareType.Include))
|
|
|
|
|
name3.push(name);
|
|
|
|
|
}
|
|
|
|
|
const configsNames = [...new Set(name1.concat(name2, name3))];
|
|
|
|
|
return configsNames;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigListTag = (errorMsg: string) =>
|
|
|
|
|
{
|
|
|
|
|
const { store, type } = this.props;
|
|
|
|
|
const configsNames = store.configsNames.filter(name => CompareIsEqual(name, this.searchName, ECompareType.Include));
|
|
|
|
|
const configsNames = this.filterConfigsNames();
|
|
|
|
|
return (
|
|
|
|
|
<div className='config-list'>
|
|
|
|
|
<div className="flex-between">
|
|
|
|
|