diff --git a/src/hooks/Rule/KeysInRule.ts b/src/hooks/Rule/KeysInRule.ts index 2e096318a..3b9078b7e 100644 --- a/src/hooks/Rule/KeysInRule.ts +++ b/src/hooks/Rule/KeysInRule.ts @@ -2,7 +2,7 @@ import RuleFunc from './RuleFunc.json' import RuleField from './RuleField.json' const funcList = RuleFunc.reduce((arr: Array, { list }): Array => { - list.forEach(({ name }: { name: string }) => arr.push(name)) + list?.forEach(({ name }: { name: string }) => arr.push(name)) return arr }, []) diff --git a/src/hooks/Rule/RuleFunc.json b/src/hooks/Rule/RuleFunc.json index 961046de9..5fde129ed 100644 --- a/src/hooks/Rule/RuleFunc.json +++ b/src/hooks/Rule/RuleFunc.json @@ -1087,6 +1087,26 @@ "required": true } ] + }, + { + "name": "str_utf16_le", + "args": [ + { + "name": "Data", + "type": "string", + "required": true + } + ] + }, + { + "name": "sqlserver_bin2hexstr", + "args": [ + { + "name": "Data", + "type": "string", + "required": true + } + ] } ] }, diff --git a/src/hooks/Rule/bridge/useComponentsHandlers.ts b/src/hooks/Rule/bridge/useComponentsHandlers.ts index 79a070b1b..9be62d6b9 100644 --- a/src/hooks/Rule/bridge/useComponentsHandlers.ts +++ b/src/hooks/Rule/bridge/useComponentsHandlers.ts @@ -81,6 +81,7 @@ export default ( } else if (prop.type === 'boolean' && prop.is_template) { prop.type = 'enum' prop.symbols = [true, false] + prop.default ??= '' } else if (prop.type === 'object' && !prop.properties && prop.is_template) { setComponentProps(prop, { supportPlaceholder: ['key', 'value'] }) } diff --git a/src/i18n/RuleSyntax.js b/src/i18n/RuleSyntax.js index bf93aea7b..06f1741c8 100644 --- a/src/i18n/RuleSyntax.js +++ b/src/i18n/RuleSyntax.js @@ -1188,4 +1188,28 @@ Typical JQ programs describe simple transformations or filters for JSON data, bu zh: 'Map 的大小', en: 'The size of the map', }, + strUtf16LeDesc: { + zh: '将 UTF-8 字符串转换为 UTF-16 小端序编码', + en: 'Convert a UTF-8 string to UTF-16 little-endian' + }, + strUtf16LeParams: { + zh: '要转换的字符串', + en: 'String to convert' + }, + strUtf16LeReturns: { + zh: 'UTF-16 小端序编码的字符串', + en: 'UTF-16 little-endian encoded string' + }, + sqlserverBin2HexstrDesc: { + zh: '将字符串或二进制转换为 SQL Server 十六进制格式(带 0x 前缀)', + en: 'Convert string or binary to SQL Server hex format with 0x prefix' + }, + sqlserverBin2HexstrParams: { + zh: '要转换的数据', + en: 'Data to convert' + }, + sqlserverBin2HexstrReturns: { + zh: 'SQL Server 格式的十六进制字符串', + en: 'Hex string in SQL Server format' + } }