fix: the drop-down multiple selection fields are not displayed as title fields when inherited collection (#2257)
* fix: inherit field override association field option field * fix: inherit field override association field option field
This commit is contained in:
parent
fa2de8e806
commit
d2a9e4acee
@ -70,7 +70,7 @@ const InternalFileManager = (props) => {
|
||||
const [options, setOptions] = useState([]);
|
||||
const { getField } = useCollection();
|
||||
const collectionField = getField(field.props.name);
|
||||
const labelUiSchema = useLabelUiSchema(collectionField, fieldNames?.label || 'label');
|
||||
const labelUiSchema = useLabelUiSchema(collectionField?.target, fieldNames?.label || 'label');
|
||||
const compile = useCompile();
|
||||
const getFilter = () => {
|
||||
const targetKey = collectionField?.targetKey || 'id';
|
||||
@ -192,7 +192,7 @@ const FileManageReadPretty = connect((props) => {
|
||||
const fieldNames = useFieldNames(props);
|
||||
const { getField } = useCollection();
|
||||
const collectionField = getField(field.props.name);
|
||||
const labelUiSchema = useLabelUiSchema(collectionField, fieldNames?.label || 'label');
|
||||
const labelUiSchema = useLabelUiSchema(collectionField?.target, fieldNames?.label || 'label');
|
||||
const showFilePicker = isShowFilePicker(labelUiSchema);
|
||||
|
||||
if (showFilePicker) {
|
||||
@ -202,4 +202,4 @@ const FileManageReadPretty = connect((props) => {
|
||||
}
|
||||
});
|
||||
|
||||
export { InternalFileManager, FileManageReadPretty };
|
||||
export { FileManageReadPretty, InternalFileManager };
|
||||
|
@ -37,13 +37,16 @@ export const ReadPrettyInternalViewer: React.FC = observer(
|
||||
const [record, setRecord] = useState({});
|
||||
const compile = useCompile();
|
||||
const { designable } = useDesignable();
|
||||
const labelUiSchema = useLabelUiSchema(collectionField, fieldNames?.label || 'label');
|
||||
const { snapshot } = useActionContext();
|
||||
const ellipsisWithTooltipRef = useRef<IEllipsisWithTooltipRef>();
|
||||
|
||||
const renderRecords = () =>
|
||||
toArr(props.value).map((record, index, arr) => {
|
||||
const val = toValue(compile(record?.[fieldNames?.label || 'label']), 'N/A');
|
||||
const labelUiSchema = useLabelUiSchema(
|
||||
record?.__collection || collectionField?.target,
|
||||
fieldNames?.label || 'label',
|
||||
);
|
||||
const text = getLabelFormatValue(compile(labelUiSchema), val, true);
|
||||
return (
|
||||
<Fragment key={`${record.id}_${index}`}>
|
||||
|
@ -5,12 +5,12 @@ import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { CollectionFieldOptions, useCollectionManager } from '../../../collection-manager';
|
||||
|
||||
export const useLabelUiSchema = (collectionField: CollectionFieldOptions, label: string): ISchema => {
|
||||
export const useLabelUiSchema = (collectionName: string, label: string): ISchema => {
|
||||
const { getCollectionJoinField } = useCollectionManager();
|
||||
if (!collectionField) {
|
||||
if (!collectionName) {
|
||||
return;
|
||||
}
|
||||
const labelField = getCollectionJoinField(`${collectionField.target}.${label}`) as CollectionFieldOptions;
|
||||
const labelField = getCollectionJoinField(`${collectionName}.${label}`) as CollectionFieldOptions;
|
||||
return labelField?.uiSchema;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user