MCPcopy
hub / github.com/microsoft/SandDance / getRows

Function getRows

packages/sanddance/src/tooltip.tsx:74–112  ·  view source on GitHub ↗
(item: object, options: TooltipOptions)

Source from the content-addressed store, hash-verified

72}
73
74function 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
114const renderTooltip = (props: RenderProps) => {
115 return props.rows.length === 0 ? null : (

Callers 1

constructorMethod · 0.70

Calls 2

isInternalFieldNameFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected