This commit is contained in:
katherinehhh
2025-10-12 11:47:04 +08:00
parent 29632e43fa
commit 22f36bca84
2 changed files with 4 additions and 4 deletions
@@ -703,6 +703,7 @@ export class CollectionField {
multiple: target ? ['belongsToMany', 'hasMany', 'belongsToArray'].includes(type) : undefined,
maxCount: target && !['belongsToMany', 'hasMany', 'belongsToArray'].includes(type) ? 1 : undefined,
target: target,
template: this.targetCollection?.template,
},
_.isUndefined,
);
@@ -230,11 +230,10 @@ const Preview = (props) => {
};
export class DisplayPreviewFieldModel extends FieldModel {
render(): any {
const { value, titleField, target } = this.props;
if (titleField && target !== 'file') {
const { value, titleField, template } = this.props;
if (titleField && template !== 'file') {
return castArray(value).flatMap((v, idx) => {
const res = v?.[titleField];
const result = typeof res === 'object' ? res : v;
const result = v?.[titleField];
const content = result ? (
<Preview key={idx} {...this.props} value={castArray(result)} />
) : (