diff options
Diffstat (limited to 'FrontEnd/src/views/common/input/InputPanel.tsx')
-rw-r--r-- | FrontEnd/src/views/common/input/InputPanel.tsx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/FrontEnd/src/views/common/input/InputPanel.tsx b/FrontEnd/src/views/common/input/InputPanel.tsx index 1270cc53..3ac0cb04 100644 --- a/FrontEnd/src/views/common/input/InputPanel.tsx +++ b/FrontEnd/src/views/common/input/InputPanel.tsx @@ -72,7 +72,17 @@ type MapInputListToValueTypeList<Tuple extends readonly Input[]> = { [Index in keyof Tuple]: MapInputToValueType<Tuple[Index]>; } & { length: Tuple["length"] }; -export type OperationInputError = (I18nText | null | undefined)[]; +export type InputPanelError = { + [index: number]: I18nText | null | undefined; +}; + +export function hasError(e: InputPanelError | null | undefined): boolean { + if (e == null) return false; + for (const key in e) { + if (e[key] != null) return true; + } + return false; +} export interface InputPanelProps<InputList extends readonly Input[]> { scheme: InputList; @@ -81,7 +91,7 @@ export interface InputPanelProps<InputList extends readonly Input[]> { values: MapInputListToValueTypeList<InputList>, index: number ) => void; - error?: OperationInputError; + error?: InputPanelError; disable?: boolean; } |