| 9 | import {propTypes} from '../DataTable'; |
| 10 | |
| 11 | const DataTable = props => { |
| 12 | const ctx = window.dash_component_api.useDashContext(); |
| 13 | const isLoading = ctx.useLoading({ |
| 14 | filterFunc: loading => |
| 15 | loading.property === 'data' || |
| 16 | loading.property === '' || |
| 17 | loading.property === undefined |
| 18 | }); |
| 19 | const id = useMemo(() => id || genRandomId('table-'), [id]); |
| 20 | const sanitizer = useMemo(() => new Sanitizer(), []); |
| 21 | |
| 22 | if (!isValidProps(props)) { |
| 23 | return <div>Invalid props combination</div>; |
| 24 | } |
| 25 | |
| 26 | const sanitizedProps = sanitizer.sanitize(props, isLoading); |
| 27 | return props.id ? ( |
| 28 | <RealTable {...sanitizedProps} /> |
| 29 | ) : ( |
| 30 | <RealTable {...sanitizedProps} id={id} /> |
| 31 | ); |
| 32 | }; |
| 33 | |
| 34 | DataTable.propTypes = propTypes; |
| 35 |
nothing calls this directly
no test coverage detected
searching dependent graphs…