import * as React from 'react'; import { observer } from 'mobx-react'; import UpSet from './UpSet'; import { ComparisonGroup } from './GroupComparisonUtils'; import { action, makeObservable, observable } from 'mobx'; import autobind from 'autobind-decorator'; import CreateGroupFromOverlap from './CreateGroupFromOverlap'; import ComparisonStore from '../../shared/lib/comparison/ComparisonStore'; import GroupComparisonStore from './GroupComparisonStore'; import { SessionGroupData } from 'shared/api/session-service/sessionServiceModels'; export interface IOverlapUpsetProps { store: ComparisonStore; sideBySide: boolean; maxWidth: number; samplesVennPartition: { key: { [uid: string]: boolean }; value: string[]; }[]; patientsVennPartition: { key: { [uid: string]: boolean }; value: string[]; }[]; uidToGroup: { [uid: string]: ComparisonGroup }; } @observer export default class OverlapUpset extends React.Component< IOverlapUpsetProps, {} > { @observable.shallow sampleSelection: string[][] = []; @observable.shallow patientSelection: string[][] = []; @observable.ref sampleUpset: UpSet | null = null; @observable.ref patientUpset: UpSet | null = null; constructor(props: IOverlapUpsetProps) { super(props); makeObservable(this); } @action.bound private changeSelectedSampleRegions(combinations: string[][]) { this.sampleSelection = combinations; } @action.bound private changeSelectedPatientRegions(combinations: string[][]) { this.patientSelection = combinations; } @autobind private sampleUpsetRef(upset: UpSet | null) { this.sampleUpset = upset; } @autobind private patientUpsetRef(upset: UpSet | null) { this.patientUpset = upset; } @action.bound private submitSampleOverlapGroup( group: SessionGroupData, saveToUser: boolean ) { this.props.store.addGroup(group, saveToUser); this.sampleSelection = []; } @action.bound private submitPatientOverlapGroup( group: SessionGroupData, saveToUser: boolean ) { this.props.store.addGroup(group, saveToUser); this.patientSelection = []; } render() { return (
{this.sampleUpset && this.props.samplesVennPartition.length > 0 && ( )}
{this.patientUpset && this.props.patientsVennPartition.length > 0 && ( )}
); } }