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