|
|
|
@ -7,7 +7,7 @@ import { end } from 'xaop';
|
|
|
|
|
import { app } from '../../../ApplicationServices/Application';
|
|
|
|
|
import { KeyWord } from '../../../Common/InputState';
|
|
|
|
|
import { KeyBoard } from '../../../Common/KeyEnum';
|
|
|
|
|
import { ArrayRemove, FixIndex, IsChar, IsNumble } from '../../../Common/Utils';
|
|
|
|
|
import { ArrayRemove, FixIndex, IsChar, IsNumble, isNum, isLetter } from '../../../Common/Utils';
|
|
|
|
|
|
|
|
|
|
interface InputHintProps
|
|
|
|
|
{
|
|
|
|
@ -103,16 +103,20 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (inputCmd == "")
|
|
|
|
|
let isIntell = inputCmd.split("").every((str: string) =>
|
|
|
|
|
{
|
|
|
|
|
return isLetter(str) || isNum(str);
|
|
|
|
|
})
|
|
|
|
|
if (inputCmd == "" || !isIntell)
|
|
|
|
|
{
|
|
|
|
|
this.setState({ intelliSenseCommand: [] });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inputCmd = inputCmd.toUpperCase();
|
|
|
|
|
// 动态生成正则表达式
|
|
|
|
|
let searchReg: RegExp;
|
|
|
|
|
// 拼接动态正则表达式
|
|
|
|
|
let m_comTmp: string = '^' + inputCmd.toUpperCase().split('').join('\\w*') + '\\w*$';
|
|
|
|
|
let m_comTmp: string = '^' + inputCmd.split('').join('\\w*') + '\\w*$';
|
|
|
|
|
searchReg = new RegExp(m_comTmp, 'i');
|
|
|
|
|
|
|
|
|
|
let intelliSenseCmdList: string[] = [];
|
|
|
|
@ -121,27 +125,13 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
if (cmdName.indexOf(inputCmd) !== -1)
|
|
|
|
|
{
|
|
|
|
|
intelliSenseCmdList.push(cmdName);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (searchReg.test(cmdName))
|
|
|
|
|
{
|
|
|
|
|
intelliSenseCmdList.push(cmdName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// while (true)
|
|
|
|
|
// {
|
|
|
|
|
// console.log(m_comTmp);
|
|
|
|
|
// tmpStr = m_comTmp.splice(i, 0, "\\w*").toString()
|
|
|
|
|
// if (RegExp(tmpStr, "i").test(cmdName))
|
|
|
|
|
// {
|
|
|
|
|
// intelliSenseCmdList.push({
|
|
|
|
|
// level: i,
|
|
|
|
|
// cmd: cmdName
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// i += 2;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
intelliSenseCmdList.sort((c1, c2) =>
|
|
|
|
|
{
|
|
|
|
|
return c1.length < c2.length ? -1 : 1;
|
|
|
|
|