(definition: TableFieldDefinition<T>)
| 205 | } |
| 206 | |
| 207 | const getLabelFor = <T extends object>(definition: TableFieldDefinition<T>): string => { |
| 208 | if (typeof definition !== 'object') { |
| 209 | return convertToLabel(definition.toString()) |
| 210 | } |
| 211 | |
| 212 | if (definition.label) { |
| 213 | return definition.label |
| 214 | } |
| 215 | |
| 216 | if ('value' in definition) { |
| 217 | return definition.label |
| 218 | } |
| 219 | |
| 220 | if ('prop' in definition) { |
| 221 | return convertToLabel(definition.prop.toString()) |
| 222 | } |
| 223 | |
| 224 | return convertToLabel(definition.path) |
| 225 | } |
| 226 | |
| 227 | const getDisplayValueFor = <T extends object>(item: T, definition: TableFieldDefinition<T>): string | undefined => { |
| 228 | if (typeof definition === 'object' && 'value' in definition) { |
no test coverage detected