Repository navigation
Dheeraj_CTM_656 #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: qa
Are you sure you want to change the base?
Dheeraj_CTM_656 #212
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,8 +37,8 @@ const CtimsDropdownWithExcludeToggle = (props: WidgetProps) => { | |
|
|
||
| useEffect(() => { | ||
| if (value) { | ||
| setValueState(value?.replace('!', '')); | ||
| setIsNegated(value?.startsWith('!')); | ||
| setValueState(value.replace('!', '')); | ||
| setIsNegated(value.startsWith('!')); | ||
| } | ||
| }, [value]); | ||
|
|
||
|
|
@@ -59,7 +59,11 @@ const CtimsDropdownWithExcludeToggle = (props: WidgetProps) => { | |
| }, [valueState, isNegated]); | ||
|
|
||
| const handleDropdownChange = (e: { value: any }) => { | ||
| setValueState(e.value); | ||
| const selectedValue = e.value; | ||
| setValueState(selectedValue); | ||
| if (!selectedValue) { | ||
| setIsNegated(false); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same as setIsNegated(selectedValue)? or do you only want to trigger this when selectedValue is false?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is one case when the selected value is empty, let's say when a user selects an empty value in a dropdown, so this condition makes sure the taggle is disabled. |
||
| }; | ||
|
|
||
| const handleToggleChange = (checked: boolean) => { | ||
|
|
@@ -110,7 +114,7 @@ const CtimsDropdownWithExcludeToggle = (props: WidgetProps) => { | |
| <div className={styles.label}>Exclude this criteria from matches.</div> | ||
| <div style={{ marginLeft: 'auto', marginTop: '10px' }}> | ||
| <IOSSwitch | ||
| disabled={!valueState} | ||
| disabled={!valueState} | ||
| value={isNegated} | ||
| onChange={handleToggleChange} | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is not much difference with CtimsDropDown, consider consolidating into 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a multiselect within the Dropdown component, which we don't need in CTIMSDropDownwithExcludeToggle. So its better we have separate components for both.