Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jsx/DataTable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type TableRow = (string|null)[]

type Field = {
show: boolean
label: string
label: string | ReactNode
}

type hideOptions = {
Expand Down
15 changes: 14 additions & 1 deletion modules/dataquery/jsx/getdictionarydescription.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import {FullDictionary} from './types';

/**
* Parses string to remove HTML tags and return raw text
*
* @param {string} html - input string
* @returns {string} - parsed string
*/
function stripHTML(html: string): string {
if (!html) return '';
const doc = new DOMParser().parseFromString(html, 'text/html');
return doc.body.textContent || html.replace(/<\/?[a-zA-Z][^>]*>?/gm, '');
}

/**
* Get the dictionary for a given term
*
Expand All @@ -23,7 +35,8 @@ function getDictionaryDescription(
return fieldname;
}

return dict[module][category][fieldname].description;
const desc = dict[module][category][fieldname].description;
return stripHTML(desc);
}

export default getDictionaryDescription;
21 changes: 19 additions & 2 deletions modules/dataquery/jsx/viewdata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ function ViewData(props: {
rowNumLabel={t('Row Number')}
fields={organizedData.headers.map(
(val: string) => {
return {show: true, label: val};
return {
show: true,
label: <div className="header-text">{val}</div>,
};
})
}
data={organizedData.data}
Expand Down Expand Up @@ -436,7 +439,21 @@ function ViewData(props: {
}
/>
: <div />);
return <div>
return <div className='dataquery-view-container'>
<style>{`
.dataquery-view-container .header-text {
max-height: 250px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 12;
display: -webkit-box;
}
.dataquery-view-container table th,
.dataquery-view-container table td {
min-width: 150px;
}
`}</style>
<SelectElement
name='headerdisplay'
options={{
Expand Down
Loading