( sheetDefinition: SheetDefinition, columnDefinition: SheetColumnDefinition, value: ImporterOutputFieldType, enumLabelDict: EnumLabelDict )
| 160 | } |
| 161 | |
| 162 | export function getColumnDisplayValue( |
| 163 | sheetDefinition: SheetDefinition, |
| 164 | columnDefinition: SheetColumnDefinition, |
| 165 | value: ImporterOutputFieldType, |
| 166 | enumLabelDict: EnumLabelDict |
| 167 | ): ImporterOutputFieldType { |
| 168 | if (columnDefinition.type === 'enum') { |
| 169 | return getLabelDictValue( |
| 170 | enumLabelDict[sheetDefinition.id]?.[columnDefinition.id] ?? {}, |
| 171 | value |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | if (columnDefinition.type === 'reference' && value != null) { |
| 176 | return getLabelDictValue( |
| 177 | getLabelDict(columnDefinition, enumLabelDict), |
| 178 | value |
| 179 | ); |
| 180 | } |
| 181 | |
| 182 | if (columnDefinition.type === 'boolean') { |
| 183 | if (value === true) { |
| 184 | return ( |
| 185 | columnDefinition.typeArguments?.trueLabel ?? DEFAULT_BOOLEAN_TRUE_LABEL |
| 186 | ); |
| 187 | } |
| 188 | if (value === false) { |
| 189 | return ( |
| 190 | columnDefinition.typeArguments?.falseLabel ?? |
| 191 | DEFAULT_BOOLEAN_FALSE_LABEL |
| 192 | ); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | return value; |
| 197 | } |
| 198 | |
| 199 | export function getSubmittedSheetData( |
| 200 | sheets: SheetDefinition[], |
no test coverage detected