Update field select forms. Created new hooks.

This commit is contained in:
Mike Cao 2024-03-25 13:50:04 -07:00
parent 5daad2726e
commit 8bc1dcb4b3
18 changed files with 282 additions and 254 deletions

View file

@ -4,8 +4,7 @@ import { REPORT_PARAMETERS } from 'lib/constants';
import PopupForm from './PopupForm';
import FieldSelectForm from './FieldSelectForm';
import FieldAggregateForm from './FieldAggregateForm';
import FieldFilterForm from './FieldFilterForm';
import styles from './FieldAddForm.module.css';
import FieldFilterEditForm from './FieldFilterEditForm';
export function FieldAddForm({
fields = [],
@ -38,13 +37,13 @@ export function FieldAddForm({
};
return createPortal(
<PopupForm className={styles.popup}>
<PopupForm>
{!selected && <FieldSelectForm fields={fields} onSelect={handleSelect} />}
{selected && group === REPORT_PARAMETERS.fields && (
<FieldAggregateForm {...selected} onSelect={handleSave} />
)}
{selected && group === REPORT_PARAMETERS.filters && (
<FieldFilterForm {...selected} onSelect={handleSave} />
<FieldFilterEditForm {...selected} onChange={handleSave} />
)}
</PopupForm>,
document.body,