/*! * Copyright (c) Microsoft. All rights reserved. * Licensed under the MIT license. See LICENSE file in the project. */ import { DataType } from '@datashaper/schema' import { memo } from 'react' import { Case, Default, Switch } from 'react-if' import { getValue, isBlank, isEmpty } from '../ArqueroDetailsList.utils.js' import { useNumberMagnitude } from '../hooks/useNumberMagnitude.js' import { BlankCell } from './BlankCell.js' import { CellContainer } from './CellContainer.js' import { EmptyCell } from './EmptyCell.js' import { BooleanSymbolCell, DateCell, NumberMagnitudeCell, ObjectCell, SmartArrayCell, TextCell, } from './index.js' import type { RichCellProps } from './types.js' /** * Chooses what to render based on data type. */ export const SmartCell: React.FC = memo(function SmartCell( props, ) { const { field, metadata, item, column, onSelect } = props const type = field?.type const value = getValue(item, column) const magnitude = useNumberMagnitude(value, metadata, type) return ( ) })