Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function FieldValueList(props: FieldValueListProps) {
const formattedValue = formatItemValue(value);

return (
<Grid item xs={variant === 'stacked' ? 12 : 6} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
<Grid item xs={variant === 'stacked' || !name ? 12 : 6} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
{isHtml ? (
// eslint-disable-next-line react/no-danger
<div dangerouslySetInnerHTML={{ __html: formattedValue }} />
Expand All @@ -78,7 +78,7 @@ export default function FieldValueList(props: FieldValueListProps) {

return (
<Grid container spacing={4} justifyContent='space-between'>
{getGridItemLabel()}
{name ? getGridItemLabel() : null}
{getGridItemValue()}
</Grid>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -165,25 +165,31 @@ export default function Dropdown(props: DropdownProps) {

let readOnlyProp = {};

if (displayMode === 'LABELS_LEFT') {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
/>
);
}
const displayFn = (displayM, val) => {
if (displayM === 'LABELS_LEFT') {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
/>
);
}

if (displayM === 'STACKED_LARGE_VAL') {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
variant='stacked'
/>
);
}
};

if (displayMode === 'STACKED_LARGE_VAL') {
return (
<FieldValueList
name={hideLabel ? '' : label}
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
variant='stacked'
/>
);
if (displayMode) {
return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
}

if (readOnly) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
});

useEffect(() => {
if (editableMode && !allowEditingInModal) {
if ((editableMode || readOnlyMode) && !allowEditingInModal) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
buildElementsForTable();
}
}, [referenceList.length]);

useEffect(() => {
if (readOnlyMode || allowEditingInModal) {
if (allowEditingInModal) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
generateRowsData();
}
Expand Down Expand Up @@ -340,7 +340,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
const data: any = [];
rawFields.forEach(item => {
// 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 ? 'LABELS_LEFT' : undefined } };
const referenceListData = getReferenceList(pConn);
const isDatapage = referenceListData.startsWith('D_');
const pageReferenceValue = isDatapage
Expand Down Expand Up @@ -611,7 +611,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
</TableRow>
</TableHead>
<TableBody>
{editableMode &&
{(editableMode || readOnlyMode) &&
elements.map((row: any, index) => {
const theKey = `row-${index}`;
return (
Expand Down Expand Up @@ -640,7 +640,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
</TableRow>
);
})}
{(readOnlyMode || allowEditingInModal) &&
{allowEditingInModal &&
rowData &&
rowData.length > 0 &&
stableSort(rowData, getComparator(order, orderBy))
Expand Down Expand Up @@ -681,12 +681,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
})}
</TableBody>
</Table>
{readOnlyMode && rowData && rowData.length === 0 && (
<div className='no-records' id='no-records'>
No records found.
</div>
)}
{editableMode && referenceList && referenceList.length === 0 && (
{referenceList && referenceList.length === 0 && (
<div className='no-records' id='no-records'>
No records found.
</div>
Expand Down