import { Report , ReportFilter , ReportFilterJoint } from '@/services/data/tuples/report-types' ; import { Subject } from '@/services/data/tuples/subject-types' ; import { useForceUpdate } from '@/widgets/basic/utils' ; import { v4 } from 'uuid' ; import { useFilterEventBus } from '../filter-event-bus' ; import { FilterEventTypes } from '../filter-event-bus-types' ; import { FilterEdit } from './filter-edit' ; export const SubFilters = ( props ) => { const { subject , report , joint } = props ; const { fire } = useFilterEventBus ( ) ; const forceUpdate = useForceUpdate ( ) ; const onRemove = ( filter ) => ( ) => { forceUpdate ( ) ; fire ( FilterEventTypes . FILTER_REMOVED , filter ) ; } ; const notifyChangeToParent = ( ) => { fire ( FilterEventTypes . CONTENT_CHANGED , joint ) ; } ; return < > { joint . filters . map ( filter => { return < FilterEdit subject = { subject } report = { report } filter = { filter } parentJoint = { joint } onRemoveMe = { onRemove ( filter ) } notifyChangeToParent = { notifyChangeToParent } key = { v4 ( ) } / > ; } ) } < />; } ;