(item: object, options: TooltipOptions)
| 72 | } |
| 73 | |
| 74 | function getRows(item: object, options: TooltipOptions) { |
| 75 | const rows: VegaDeckGl.controls.TableRow[] = []; |
| 76 | for (const columnName in item) { |
| 77 | if (columnName === GL_ORDINAL) { |
| 78 | continue; |
| 79 | } |
| 80 | if (isInternalFieldName(columnName)) { |
| 81 | continue; |
| 82 | } |
| 83 | if (options && options.exclude) { |
| 84 | if (options.exclude(columnName)) { |
| 85 | continue; |
| 86 | } |
| 87 | } |
| 88 | const value: any = item[columnName]; |
| 89 | let content: string | JSX.Element; |
| 90 | if (options && options.displayValue) { |
| 91 | content = options.displayValue(value); |
| 92 | } else { |
| 93 | switch (value) { |
| 94 | case null: |
| 95 | content = <i>null</i>; |
| 96 | break; |
| 97 | case undefined: |
| 98 | content = <i>undefined</i>; |
| 99 | break; |
| 100 | default: |
| 101 | content = value.toString(); |
| 102 | } |
| 103 | } |
| 104 | rows.push({ |
| 105 | cells: [ |
| 106 | { content: columnName + ':' }, |
| 107 | { content }, |
| 108 | ], |
| 109 | }); |
| 110 | } |
| 111 | return rows; |
| 112 | } |
| 113 | |
| 114 | const renderTooltip = (props: RenderProps) => { |
| 115 | return props.rows.length === 0 ? null : ( |
no test coverage detected