@@ -111,7 +111,7 @@ const Discovery = ({
opened={showAdvancedSearch}
setAdvancedSearchFilters={setAdvancedSearchTerms}
/> : false }
-
+
value;
};
-export const RenderArrayCellNegativePositive : CellRendererFunction = ({
+export const RenderArrayCellNegativePositive: CellRendererFunction = ({
value,
cell,
}: CellRenderFunctionProps) => {
@@ -56,7 +56,9 @@ export const RenderArrayCellNegativePositive : CellRendererFunction = ({
return {value as any};
};
-export const RenderLinkCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
+export const RenderLinkCell: CellRendererFunction = ({
+ value,
+}: CellRenderFunctionProps) => {
const content = value as string;
return (
{
+const RenderStringCell: CellRendererFunction = (
+ { value }: CellRenderFunctionProps,
+ params?: JSONObject,
+) => {
const content = value as string | string[];
if (content === undefined || content === null) {
- return {`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} ;
+ return (
+
+ {`${
+ params && params?.valueIfNotAvailable
+ ? params?.valueIfNotAvailable
+ : ''
+ }`}{' '}
+
+ );
}
if (content == '') {
- return {`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} ;
+ return (
+
+ {`${
+ params && params?.valueIfNotAvailable
+ ? params?.valueIfNotAvailable
+ : ''
+ }`}{' '}
+
+ );
}
return {isArray(content) ? content.join(', ') : content};
};
-const RenderNumberCell : CellRendererFunction = ({ value }: CellRenderFunctionProps, params? : JSONObject) => {
+const RenderNumberCell: CellRendererFunction = (
+ { value }: CellRenderFunctionProps,
+ params?: JSONObject,
+) => {
+ const isContentEmpty = value === undefined || value === null;
+ const paramsValueIfNotAvailable = params && params?.valueIfNotAvailable;
const content = value as number | number[];
- if (content === undefined || content === null) {
- return {`${params && params?.valueIfNotAvailable ? params?.valueIfNotAvailable : ''}`} ;
+
+ if (isContentEmpty) {
+ return (
+ {`${
+ paramsValueIfNotAvailable ? paramsValueIfNotAvailable : ''
+ }`}
+ );
}
- return (
-
- {isArray(content)
- ? content.map((v) => v ? v.toLocaleString() : "").join('; ')
- : content.toLocaleString()}
-
- );
+
+ let stringValue = '';
+ // check if content is an array of all numbers
+ if (isArray(content) && content.every((item) => typeof item === 'number')) {
+ stringValue = content.map((v) => (v ? v.toLocaleString() : '')).join('; ');
+ } else {
+ stringValue = content.toLocaleString();
+ }
+
+ return {stringValue};
};
-const RenderParagraphsCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
+const RenderParagraphsCell: CellRendererFunction = ({
+ value,
+}: CellRenderFunctionProps) => {
const content = value as string | string[];
return (
@@ -117,7 +153,9 @@ interface TagData {
// TODO Fix below
// eslint-disable-next-line react/prop-types
-export const RenderTagsCell : CellRendererFunction = ({ value }: CellRenderFunctionProps) => {
+export const RenderTagsCell: CellRendererFunction = ({
+ value,
+}: CellRenderFunctionProps) => {
const content = value as TagData[];
const { discoveryConfig: config } = useDiscoveryContext();
return (
@@ -128,7 +166,9 @@ export const RenderTagsCell : CellRendererFunction = ({ value }: CellRenderFunct