|
|
@ -42,6 +42,7 @@ const buildEntryList = ({ |
|
|
|
maxDepth, |
|
|
|
maxDepth, |
|
|
|
renderEntry, |
|
|
|
renderEntry, |
|
|
|
renderEntryValue, |
|
|
|
renderEntryValue, |
|
|
|
|
|
|
|
skip, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
depth?: number; |
|
|
|
depth?: number; |
|
|
|
entries: FormEntries; |
|
|
|
entries: FormEntries; |
|
|
@ -52,6 +53,7 @@ const buildEntryList = ({ |
|
|
|
maxDepth: number; |
|
|
|
maxDepth: number; |
|
|
|
renderEntry: RenderFormEntryFunction; |
|
|
|
renderEntry: RenderFormEntryFunction; |
|
|
|
renderEntryValue: RenderFormValueFunction; |
|
|
|
renderEntryValue: RenderFormValueFunction; |
|
|
|
|
|
|
|
skip: Exclude<FormSummaryOptionalProps['skip'], undefined>; |
|
|
|
}): ReactElement => { |
|
|
|
}): ReactElement => { |
|
|
|
const result: ReactElement[] = []; |
|
|
|
const result: ReactElement[] = []; |
|
|
|
|
|
|
|
|
|
|
@ -59,13 +61,21 @@ const buildEntryList = ({ |
|
|
|
const itemId = `form-summary-entry-${itemKey}`; |
|
|
|
const itemId = `form-summary-entry-${itemKey}`; |
|
|
|
|
|
|
|
|
|
|
|
const nest = entry !== null && typeof entry === 'object'; |
|
|
|
const nest = entry !== null && typeof entry === 'object'; |
|
|
|
|
|
|
|
|
|
|
|
const value = nest ? null : entry; |
|
|
|
const value = nest ? null : entry; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fnArgs: CommonFormEntryHandlerArgs = { |
|
|
|
|
|
|
|
depth, |
|
|
|
|
|
|
|
entry: value, |
|
|
|
|
|
|
|
key: itemKey, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (skip(({ key }) => !/confirm/i.test(key), fnArgs)) { |
|
|
|
result.push( |
|
|
|
result.push( |
|
|
|
<MUIListItem |
|
|
|
<MUIListItem |
|
|
|
key={itemId} |
|
|
|
key={itemId} |
|
|
|
sx={{ paddingLeft: `${depth}em` }} |
|
|
|
sx={{ paddingLeft: `${depth}em` }} |
|
|
|
{...getListItemProps?.call(null, { depth, entry: value, key: itemKey })} |
|
|
|
{...getListItemProps?.call(null, fnArgs)} |
|
|
|
> |
|
|
|
> |
|
|
|
{renderEntry({ |
|
|
|
{renderEntry({ |
|
|
|
depth, |
|
|
|
depth, |
|
|
@ -77,6 +87,7 @@ const buildEntryList = ({ |
|
|
|
})} |
|
|
|
})} |
|
|
|
</MUIListItem>, |
|
|
|
</MUIListItem>, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (nest && depth < maxDepth) { |
|
|
|
if (nest && depth < maxDepth) { |
|
|
|
result.push( |
|
|
|
result.push( |
|
|
@ -88,6 +99,7 @@ const buildEntryList = ({ |
|
|
|
maxDepth, |
|
|
|
maxDepth, |
|
|
|
renderEntry, |
|
|
|
renderEntry, |
|
|
|
renderEntryValue, |
|
|
|
renderEntryValue, |
|
|
|
|
|
|
|
skip, |
|
|
|
}), |
|
|
|
}), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -134,6 +146,7 @@ const FormSummary = <T extends FormEntries>({ |
|
|
|
? renderEntryValueWithPassword(args) |
|
|
|
? renderEntryValueWithPassword(args) |
|
|
|
: renderEntryValueWithMono(args); |
|
|
|
: renderEntryValueWithMono(args); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
skip = (base, ...args) => base(...args), |
|
|
|
}: FormSummaryProps<T>): ReturnType<FC<FormSummaryProps<T>>> => |
|
|
|
}: FormSummaryProps<T>): ReturnType<FC<FormSummaryProps<T>>> => |
|
|
|
buildEntryList({ |
|
|
|
buildEntryList({ |
|
|
|
entries, |
|
|
|
entries, |
|
|
@ -143,6 +156,7 @@ const FormSummary = <T extends FormEntries>({ |
|
|
|
maxDepth, |
|
|
|
maxDepth, |
|
|
|
renderEntry, |
|
|
|
renderEntry, |
|
|
|
renderEntryValue, |
|
|
|
renderEntryValue, |
|
|
|
|
|
|
|
skip, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
export default FormSummary; |
|
|
|
export default FormSummary; |
|
|
|