fix: 修复组件移动别的区块后出错 修复单选框点击出错 (#680)

Reviewed-on: daoyoucloud/tachycode#680
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-04-11 11:50:00 +08:00 committed by sealday
parent 8b42fecb38
commit f0a0505695

View File

@ -8,11 +8,13 @@ import { canBeOptionalField } from '../../utils';
export const useTabSearchFieldItemProps = () => {
const fieldSchema = useFieldSchema();
const collection = useCollection();
const optionalFieldList = useOptionalFieldList();
const cm = useCollectionManager();
const collectionField = useMemo(() => collection?.getField(fieldSchema.name as any), [collection, fieldSchema.name]);
const { onSelected } = useTabSearchCollapsibleInputItem();
const result = { list: null, valueKey: '', labelKey: '', filterKey: '' };
if (!collection) return;
result.valueKey = collectionField?.target ? cm.getCollection(collectionField.target)?.getPrimaryKey() : 'id';
result.labelKey = fieldSchema['x-component-props']?.fieldNames?.label || result.valueKey;
const fieldInterface = fieldSchema['x-component-props'].interface;
@ -21,9 +23,10 @@ export const useTabSearchFieldItemProps = () => {
const operatorMap = {
select: '$in',
multipleSelect: '$anyOf',
checkbox: '$in',
checkboxGroup: '$anyOf',
radioGroup: '$in',
};
const _list = field?.uiSchema?.enum || [];
result.valueKey = 'value';
result.labelKey = 'label';