forked from G-Research/fasttrackml-ui-aim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v3.17.5' of ssh://github.com/g-research/fasttra…
…ckml-ui-aim into release/v3.17.5
- Loading branch information
Showing
26 changed files
with
399 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/src/components/MultipleAxesPropsPopover/MultipleAxesPropsPopover.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { IBaseAxesPopoverProps } from '../AxesPropsPopover'; | ||
|
||
export interface IMultipleAxesPropsPopoverProps extends IBaseAxesPopoverProps { | ||
idsOptions: any[]; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/src/components/MultipleAxesPropsPopover/MultipleAxesPropsPopover.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@use 'src/styles/abstracts' as *; | ||
.MultipleAxesPropsPopover { | ||
width: 24.375rem; | ||
padding: $space-xs; | ||
padding-bottom: 0px; | ||
&__divider { | ||
border-bottom: 1px solid; | ||
color: #00000042; | ||
margin: $space-xs 0; | ||
} | ||
} | ||
|
||
.react-select__menu-list { | ||
max-height: 200px; | ||
overflow-y: auto; | ||
} | ||
|
||
.react-select__value-container { | ||
max-height: 100px; | ||
overflow-y: auto !important; | ||
} | ||
.react-select__indicators { | ||
max-height: 100px; | ||
overflow-y: auto; | ||
} |
91 changes: 91 additions & 0 deletions
91
src/src/components/MultipleAxesPropsPopover/MultipleAxesPropsPopover.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React, { useCallback, useState } from 'react'; | ||
import _ from 'lodash-es'; | ||
import Select from 'react-select'; | ||
|
||
import { Divider } from '@material-ui/core'; | ||
|
||
import AlignmentPopover from 'components/AxesPropsPopover/AxesPropsPopover'; | ||
import { Text, SelectDropdown } from 'components/kit'; | ||
import ErrorBoundary from 'components/ErrorBoundary/ErrorBoundary'; | ||
|
||
import { IMultipleAxesPropsPopoverProps } from './'; | ||
|
||
import './MultipleAxesPropsPopover.scss'; | ||
|
||
function MultipleAxesPropsPopover({ | ||
idsOptions, | ||
onAlignmentTypeChange, | ||
onAlignmentMetricChange, | ||
onAxesScaleRangeChange, | ||
alignmentConfigs, | ||
selectFormOptions, | ||
axesScaleRanges, | ||
}: IMultipleAxesPropsPopoverProps): React.FunctionComponentElement<React.ReactNode> { | ||
const [selectedIds, setSelectedIds] = useState<number[]>([]); | ||
|
||
const options = idsOptions.map((option: { value: any; label: any }) => ({ | ||
value: option.value, | ||
label: option.label, | ||
})); | ||
|
||
const selectAllOption = { value: '*', label: 'Select All' }; | ||
|
||
const handleChange = useCallback( | ||
(selectedOptions) => { | ||
if ( | ||
selectedOptions.some( | ||
(option: { value: string }) => option.value === '*', | ||
) | ||
) { | ||
if (selectedIds.length === idsOptions.length) { | ||
setSelectedIds([]); | ||
} else { | ||
setSelectedIds( | ||
idsOptions.map((option: { value: any }) => option.value), | ||
); | ||
} | ||
} else { | ||
setSelectedIds( | ||
selectedOptions.map((option: { value: any }) => option.value), | ||
); | ||
} | ||
}, | ||
[idsOptions, selectedIds], | ||
); | ||
|
||
const selectedOptions = options.filter((option: { value: number }) => | ||
selectedIds.includes(option.value), | ||
); | ||
|
||
return ( | ||
<ErrorBoundary> | ||
<div className='MultipleAxesPropsPopover'> | ||
<Text component='p' tint={50}> | ||
CHART ID: | ||
</Text> | ||
<Select | ||
isMulti | ||
value={selectedOptions} | ||
options={[selectAllOption, ...options]} | ||
onChange={handleChange} | ||
classNamePrefix='react-select' | ||
closeMenuOnSelect={false} | ||
hideSelectedOptions={false} | ||
className='react-select-container' | ||
/> | ||
<Divider className='MultipleAxesPropsPopover__divider' /> | ||
</div> | ||
<AlignmentPopover | ||
selectedIds={selectedIds} | ||
selectFormOptions={selectFormOptions} | ||
alignmentConfigs={alignmentConfigs} | ||
axesScaleRanges={axesScaleRanges} | ||
onAlignmentMetricChange={onAlignmentMetricChange} | ||
onAlignmentTypeChange={onAlignmentTypeChange} | ||
onAxesScaleRangeChange={onAxesScaleRangeChange} | ||
/> | ||
</ErrorBoundary> | ||
); | ||
} | ||
|
||
export default React.memo(MultipleAxesPropsPopover); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import MultipleAxesPropsPopover from './MultipleAxesPropsPopover'; | ||
|
||
export * from './MultipleAxesPropsPopover.d'; | ||
|
||
export default MultipleAxesPropsPopover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.