chore: scaffolds relationship filter
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
@import '../../../../../scss/styles.scss';
|
||||
|
||||
.condition-value-relationship {
|
||||
@include formInput;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import { Props } from './types';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
const baseClass = 'condition-value-relationship';
|
||||
|
||||
const RelationshipField: React.FC<Props> = (props) => {
|
||||
const { onChange, value } = props;
|
||||
console.log(props);
|
||||
return (
|
||||
<input
|
||||
placeholder="Enter a value"
|
||||
className={baseClass}
|
||||
type="number"
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
value={value}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RelationshipField;
|
||||
@@ -0,0 +1,4 @@
|
||||
export type Props = {
|
||||
onChange: (val: string) => void,
|
||||
value: string,
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import Button from '../../Button';
|
||||
import Date from './Date';
|
||||
import Number from './Number';
|
||||
import Text from './Text';
|
||||
import Relationship from './Relationship';
|
||||
import useDebounce from '../../../../hooks/useDebounce';
|
||||
import { FieldCondition } from '../types';
|
||||
|
||||
@@ -15,6 +16,7 @@ const valueFields = {
|
||||
Date,
|
||||
Number,
|
||||
Text,
|
||||
Relationship,
|
||||
};
|
||||
|
||||
const baseClass = 'condition';
|
||||
@@ -93,6 +95,7 @@ const Condition: React.FC<Props> = (props) => {
|
||||
DefaultComponent={ValueComponent}
|
||||
componentProps={{
|
||||
...activeField?.props,
|
||||
operator: operatorValue,
|
||||
value: internalValue,
|
||||
onChange: setInternalValue,
|
||||
}}
|
||||
|
||||
@@ -100,7 +100,7 @@ const fieldTypeConditions = {
|
||||
operators: [...base],
|
||||
},
|
||||
relationship: {
|
||||
component: 'Text',
|
||||
component: 'Relationship',
|
||||
operators: [...base],
|
||||
},
|
||||
select: {
|
||||
|
||||
Reference in New Issue
Block a user