feat: support bool type variable frontend (#24437)
Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com>
This commit is contained in:
parent
b5c2756261
commit
dac72b078d
126 changed files with 3832 additions and 512 deletions
|
|
@ -45,7 +45,7 @@ export const getNewVarInWorkflow = (key: string, type = InputVarType.textInput)
|
|||
}
|
||||
}
|
||||
|
||||
export const checkKey = (key: string, canBeEmpty?: boolean) => {
|
||||
export const checkKey = (key: string, canBeEmpty?: boolean, keys?: string[]) => {
|
||||
if (key.length === 0 && !canBeEmpty)
|
||||
return 'canNoBeEmpty'
|
||||
|
||||
|
|
@ -82,6 +82,17 @@ export const checkKeys = (keys: string[], canBeEmpty?: boolean) => {
|
|||
return { isValid, errorKey, errorMessageKey }
|
||||
}
|
||||
|
||||
export const hasDuplicateStr = (strArr: string[]) => {
|
||||
const strObj: Record<string, number> = {}
|
||||
strArr.forEach((str) => {
|
||||
if (strObj[str])
|
||||
strObj[str] += 1
|
||||
else
|
||||
strObj[str] = 1
|
||||
})
|
||||
return !!Object.keys(strObj).find(key => strObj[key] > 1)
|
||||
}
|
||||
|
||||
const varRegex = /\{\{([a-zA-Z_]\w*)\}\}/g
|
||||
export const getVars = (value: string) => {
|
||||
if (!value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue