mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:26:45 +00:00
fix: filter operators bug
This commit is contained in:
parent
18825af43d
commit
996e87daa7
@ -400,7 +400,7 @@ export function FilterItem(props: FilterItemProps) {
|
|||||||
const defaultField: any =
|
const defaultField: any =
|
||||||
fields.find(field => field.name === props.dataSource.column) || {};
|
fields.find(field => field.name === props.dataSource.column) || {};
|
||||||
const componentType = getComponentTypeByField(defaultField);
|
const componentType = getComponentTypeByField(defaultField);
|
||||||
const [type, setType] = useState(defaultField.interface || 'string');
|
// const [type, setType] = useState(defaultField.interface || 'string');
|
||||||
const [field, setField] = useState<any>({});
|
const [field, setField] = useState<any>({});
|
||||||
const [dataSource, setDataSource] = useState(props.dataSource || {});
|
const [dataSource, setDataSource] = useState(props.dataSource || {});
|
||||||
const [valueType, setValueType] = useState('custom');
|
const [valueType, setValueType] = useState('custom');
|
||||||
@ -408,17 +408,14 @@ export function FilterItem(props: FilterItemProps) {
|
|||||||
const field = fields.find(field => field.name === props.dataSource.column);
|
const field = fields.find(field => field.name === props.dataSource.column);
|
||||||
if (field) {
|
if (field) {
|
||||||
setField(field);
|
setField(field);
|
||||||
let componentType = field.component.type;
|
// let componentType = getComponentTypeByField(field);
|
||||||
if (field.component.type === 'select' && field.multiple) {
|
// setType(componentType);
|
||||||
componentType = 'multipleSelect';
|
|
||||||
}
|
|
||||||
setType(componentType);
|
|
||||||
}
|
}
|
||||||
setDataSource({ ...props.dataSource });
|
setDataSource({ ...props.dataSource });
|
||||||
if (/^{{.+}}$/.test(props.dataSource.value)) {
|
if (/^{{.+}}$/.test(props.dataSource.value)) {
|
||||||
setValueType('ref');
|
setValueType('ref');
|
||||||
}
|
}
|
||||||
}, [props.dataSource, type]);
|
}, [props.dataSource]);
|
||||||
let ValueControl = controls[componentType] || controls.string;
|
let ValueControl = controls[componentType] || controls.string;
|
||||||
if (
|
if (
|
||||||
['$null', '$notNull', '$isTruly', '$isFalsy'].indexOf(dataSource.op) !== -1
|
['$null', '$notNull', '$isTruly', '$isFalsy'].indexOf(dataSource.op) !== -1
|
||||||
@ -430,7 +427,7 @@ export function FilterItem(props: FilterItemProps) {
|
|||||||
}
|
}
|
||||||
// let multiple = true;
|
// let multiple = true;
|
||||||
// if ()
|
// if ()
|
||||||
const opOptions = op[defaultField.interface || 'string'] || op.string;
|
const opOptions = op[componentType || 'string'] || op.string;
|
||||||
console.log({ componentType, defaultField, field, valueType, opOptions });
|
console.log({ componentType, defaultField, field, valueType, opOptions });
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
@ -438,11 +435,8 @@ export function FilterItem(props: FilterItemProps) {
|
|||||||
value={dataSource.column}
|
value={dataSource.column}
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
const field = fields.find(field => field.name === value);
|
const field = fields.find(field => field.name === value);
|
||||||
let componentType = field.component.type;
|
let componentType = getComponentTypeByField(field);
|
||||||
if (field.component.type === 'select' && field.multiple) {
|
// setType(componentType);
|
||||||
componentType = 'multipleSelect';
|
|
||||||
}
|
|
||||||
setType(componentType);
|
|
||||||
setValueType('custom');
|
setValueType('custom');
|
||||||
onChange({
|
onChange({
|
||||||
...dataSource,
|
...dataSource,
|
||||||
|
Loading…
Reference in New Issue
Block a user