fix(client): styling of the filter component

This commit is contained in:
chenos 2022-04-07 19:19:08 +08:00
parent e67a686231
commit 3e574662cb
3 changed files with 21 additions and 12 deletions

View File

@ -29,7 +29,8 @@ export const Filter: any = observer((props: any) => {
<FilterContext.Provider
value={{ field, fieldSchema, dynamicComponent, options: options || field.dataSource || [] }}
>
<FilterGroup {...props} />
<FilterGroup {...props} bordered={false} />
{/* <pre>{JSON.stringify(field.value, null, 2)}</pre> */}
</FilterContext.Provider>
</div>
);

View File

@ -8,6 +8,7 @@ import { FilterLogicContext, RemoveConditionContext } from './context';
import { FilterItems } from './FilterItems';
export const FilterGroup = connect((props) => {
const { bordered = true } = props;
const field = useField<ObjectFieldModel>();
const remove = useContext(RemoveConditionContext);
const { t } = useTranslation();
@ -19,25 +20,30 @@ export const FilterGroup = connect((props) => {
[value]: [...(obj[logic] || [])],
};
};
console.log('logic', logic);
return (
<FilterLogicContext.Provider value={logic}>
<div
style={{
style={bordered ? {
position: 'relative',
border: '1px dashed #dedede',
padding: 14,
marginBottom: 8,
} : {
position: 'relative',
marginBottom: 8,
}}
>
{remove && (
<a>
<CloseCircleOutlined
style={{
position: 'absolute',
right: 10,
top: 10,
}}
onClick={() => remove()}
/>
</a>
)}
<div style={{ marginBottom: 8 }}>
<Trans>

View File

@ -43,12 +43,14 @@ export const FilterItem = observer((props: any) => {
{!operator?.noValue &&
React.createElement(DynamicComponent, {
value,
schema,
schema: {},
onChange(value) {
setValue(value);
},
})}
<a>
<CloseCircleOutlined onClick={() => remove()} />
</a>
</Space>
</div>
);