fix(filter): fix $in operatror (#3235)
This commit is contained in:
parent
a6c23d58a1
commit
c2f3cfd6ce
@ -83,8 +83,8 @@ export const transformToFilter = (
|
||||
|
||||
values = flatten(values, {
|
||||
breakOn({ value, path }) {
|
||||
// 日期字段的 `$dateBetween` 操作符的值是一个数组,需要特殊处理
|
||||
if (operators[path] === '$dateBetween') {
|
||||
// 下面操作符的值是一个数组,需要特殊处理
|
||||
if (['$dateBetween', '$in'].includes(operators[path])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -525,34 +525,40 @@ export const EditOperator = () => {
|
||||
['x-uid']: uid,
|
||||
['x-filter-operators']: storedOperators,
|
||||
};
|
||||
let componentProps = {};
|
||||
|
||||
// 根据操作符的配置,设置组件的属性
|
||||
if (operator?.schema?.['x-component']) {
|
||||
_.set(fieldSchema, 'x-component-props.component', operator.schema['x-component']);
|
||||
_.set(field, 'componentProps.component', operator.schema['x-component']);
|
||||
field.reset();
|
||||
componentProps = {
|
||||
component: operator.schema['x-component'],
|
||||
...operator.schema['x-component-props'],
|
||||
};
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
['x-uid']: fieldSchema['x-uid'],
|
||||
['x-component-props']: {
|
||||
component: operator.schema['x-component'],
|
||||
},
|
||||
['x-component-props']: componentProps,
|
||||
},
|
||||
});
|
||||
} else if (fieldSchema['x-component-props']?.component) {
|
||||
_.set(fieldSchema, 'x-component-props.component', null);
|
||||
_.set(field, 'componentProps.component', null);
|
||||
field.reset();
|
||||
componentProps = {
|
||||
component: null,
|
||||
...operator.schema['x-component-props'],
|
||||
};
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
['x-uid']: fieldSchema['x-uid'],
|
||||
['x-component-props']: {
|
||||
component: null,
|
||||
},
|
||||
['x-component-props']: componentProps,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
field.componentProps = componentProps;
|
||||
dn.emit('patch', {
|
||||
schema,
|
||||
});
|
||||
|
@ -6,11 +6,11 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useAPIClient } from '../../../api-client';
|
||||
import { findFormBlock } from '../../../block-provider';
|
||||
import { useFormBlockContext } from '../../../block-provider/FormBlockProvider';
|
||||
import { useCollectionManager } from '../../../collection-manager';
|
||||
import { compatibleDataId } from '../../../schema-settings/DataTemplates/FormDataTemplates';
|
||||
import { useToken } from '../__builtins__';
|
||||
import { RemoteSelect } from '../remote-select';
|
||||
import { useFormBlockContext } from '../../../block-provider/FormBlockProvider';
|
||||
|
||||
export interface ITemplate {
|
||||
config?: {
|
||||
@ -40,7 +40,6 @@ const useDataTemplates = () => {
|
||||
const { t } = useTranslation();
|
||||
const { duplicateData } = useFormBlockContext();
|
||||
const { getCollectionJoinField } = useCollectionManager();
|
||||
console.log(useFormBlockContext());
|
||||
if (duplicateData) {
|
||||
return duplicateData;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user