diff --git a/packages/react-sdk-components/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx b/packages/react-sdk-components/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx index 728c17f7..dd03fdcc 100644 --- a/packages/react-sdk-components/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +++ b/packages/react-sdk-components/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx @@ -63,7 +63,7 @@ export default function FieldValueList(props: FieldValueListProps) { const formattedValue = formatItemValue(value); return ( - + {isHtml ? ( // eslint-disable-next-line react/no-danger
@@ -78,7 +78,7 @@ export default function FieldValueList(props: FieldValueListProps) { return ( - {getGridItemLabel()} + {name ? getGridItemLabel() : null} {getGridItemValue()} ); diff --git a/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx b/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx index a43afddc..cfe4371a 100644 --- a/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx +++ b/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx @@ -137,7 +137,7 @@ export default function Dropdown(props: DropdownProps) { }, [theDatasource]); useEffect(() => { - if (!displayMode && listType !== 'associated' && typeof datasource === 'string') { + if (listType !== 'associated' && typeof datasource === 'string') { getDataPage(datasource, parameters, context).then((results: any) => { const optionsData: any[] = []; const displayColumn = getDisplayFieldsMetaData(columns); @@ -165,23 +165,31 @@ export default function Dropdown(props: DropdownProps) { let readOnlyProp = {}; - if (displayMode === 'DISPLAY_ONLY') { - return ( - - ); - } + const displayFn = (displayM, val) => { + if (displayM === 'DISPLAY_ONLY') { + return ( + + ); + } + + if (displayM === 'STACKED_LARGE_VAL') { + return ( + + ); + } + }; - if (displayMode === 'STACKED_LARGE_VAL') { - return ( - - ); + if (displayMode) { + return displayFn(displayMode, options.find(option => option.key === value)?.value || value); } if (readOnly) { diff --git a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx index 9f69ee2a..17077847 100644 --- a/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +++ b/packages/react-sdk-components/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx @@ -1,4 +1,3 @@ -/* eslint-disable no-nested-ternary */ import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; @@ -193,13 +192,8 @@ export default function SimpleTableManual(props: PropsWithChildren { - if (editableMode && !allowEditingInModal) { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - buildElementsForTable(); - } - }, [referenceList.length]); - - useEffect(() => { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + buildElementsForTable(); if (readOnlyMode || allowEditingInModal) { // eslint-disable-next-line @typescript-eslint/no-use-before-define generateRowsData(); @@ -364,7 +358,7 @@ export default function SimpleTableManual(props: PropsWithChildren { // removing label field from config to hide title in the table cell - item = { ...item, config: { ...item.config, label: '' } }; + item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } }; const referenceListData = getReferenceList(pConn); const isDatapage = referenceListData.startsWith('D_'); const pageReferenceValue = isDatapage @@ -428,7 +422,11 @@ export default function SimpleTableManual(props: PropsWithChildren el[0]); + const newElements = new Array(stabilizedThis.length); + stabilizedThis.forEach((el, index) => { + newElements[index] = elements[el[1]]; + }); + return newElements; } function _menuClick(event, columnId: string, columnType: string, labelValue: string) { @@ -609,7 +607,7 @@ export default function SimpleTableManual(props: PropsWithChildren { return ( - {readOnlyMode ? ( + {(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
{editableMode && + !allowEditingInModal && elements.map((row: any, index) => { const theKey = `row-${index}`; return ( @@ -677,44 +676,37 @@ export default function SimpleTableManual(props: PropsWithChildren - {displayedColumns.map(colKey => { + {row.map((item, childIndex) => { + const theColKey = displayedColumns[childIndex]; return ( - - {showDeleteButton && colKey === 'DeleteIcon' ? ( -
- { - editMenuClick(event, index); - }} - /> - - editRecord()}>Edit - deleteRecord()}>Delete - -
- ) : typeof row[colKey] === 'boolean' && !row[colKey] ? ( - 'False' - ) : typeof row[colKey] === 'boolean' && row[colKey] ? ( - 'True' - ) : ( - row[colKey] || '---' - )} + + {item} ); })} + {showDeleteButton && ( + +
+ { + editMenuClick(event, index); + }} + /> + + editRecord()}>Edit + deleteRecord()}>Delete + +
+
+ )} ); })}
- {readOnlyMode && rowData && rowData.length === 0 && ( -
- No records found. -
- )} - {editableMode && referenceList && referenceList.length === 0 && ( + {referenceList && referenceList.length === 0 && (
No records found.