Browse Source
* commit '31a9ba4f671632262ab634b1f89aa22931838804': REPORT-93847 fix: 数据连接样式问题 REPORT-93628 fix:修改下文件上传的组件样式 无JIRA任务,顺带处理下数据连接样式 REPORT-93627【迭代】【平台视觉适配】数据连接管理-模式选择处有滚动条 fix: 并非这次迭代导致,之前就有问题。 调整一下间距的设置大小,防止挤出滚动条 REPORT-93628【迭代】【平台视觉适配】数据连接管理-修改下密码处的视觉展示 fix: 其实适配6.0的改动不涉及数据连接部分。 但是主风格改为输入框border-bottom风格了,那么这里也需要同步改一下。 REPORT-91727 对用户输入的参数进行统一校验 feat:dcm仓库里面有两个场景,这里引入进来补充release/11.0
superman
2 years ago
12 changed files with 101 additions and 21 deletions
@ -0,0 +1,44 @@
|
||||
/* |
||||
https://work.fineres.com/browse/REPORT-91724 用于参数统一校验
|
||||
*/ |
||||
import { ILLEGAL_STRINGS } from "./constant"; |
||||
export type CheckResult = { |
||||
legal: boolean, |
||||
errorMsg: string, |
||||
} |
||||
export const CHECK_CORRECT: CheckResult = { |
||||
legal: true, |
||||
errorMsg: "", |
||||
}; |
||||
|
||||
/** |
||||
* 检测非法字符,返回错误提示 |
||||
* @param value 要校验的字符串 |
||||
*/ |
||||
export function checkIllegalStrings(value: string): CheckResult { |
||||
// 后端传入的校验开关,如果没传,那也默认开启
|
||||
const enabled = Dec.system.enableParameterVerify ?? true; |
||||
if (enabled) { |
||||
const illegalStringIndex = ILLEGAL_STRINGS.findIndex(s => value.includes(s)); |
||||
if (illegalStringIndex === -1) { |
||||
return CHECK_CORRECT; |
||||
} |
||||
|
||||
return { |
||||
legal: false, |
||||
errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${ILLEGAL_STRINGS[illegalStringIndex]}`, |
||||
}; |
||||
} |
||||
|
||||
return CHECK_CORRECT; |
||||
} |
||||
|
||||
export function checkIllegalStringsInWidgetAndShowError(widget: any) { |
||||
const value = widget.getValue(); |
||||
const result = checkIllegalStrings(value); |
||||
if (!result.legal) { |
||||
widget.showError(result.errorMsg); |
||||
} |
||||
|
||||
return result.legal; |
||||
} |
@ -0,0 +1,15 @@
|
||||
/** |
||||
* 参数检验的非法字符数组 |
||||
*/ |
||||
export const ILLEGAL_STRINGS = [ |
||||
"\"", |
||||
"<", |
||||
">", |
||||
"&", |
||||
"/script", |
||||
"javascript:", |
||||
"onblur", |
||||
"getRuntime", |
||||
"ProcessBuilder", |
||||
"java.lang.ProcessImpl", |
||||
]; |
@ -0,0 +1 @@
|
||||
export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings" |
Loading…
Reference in new issue