Skip to content

Commit

Permalink
Added props control disabled so the search and close buttons are not …
Browse files Browse the repository at this point in the history
…available at all
  • Loading branch information
Victor Sanchez authored and Victor Sanchez committed Dec 8, 2021
1 parent 81c2e0e commit c82081f
Show file tree
Hide file tree
Showing 2 changed files with 8,380 additions and 45 deletions.
28 changes: 18 additions & 10 deletions MultiselectRecordsEntity/MultiselectRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,20 @@ const MultiselectRecords = (props: IMultiselectProps) => {
<Stack gap="5" horizontal wrap maxWidth={props.widthProp}>
{myItems != null && myItems.length > 0 && myItems.map((item: any) => {
const theItem = JSON.parse(item);
return (
<Stack horizontal style={{ border: "1px solid #106EBE" }}>
<PrimaryButton className="buttonContainer" style={{ borderRadius: 0 }} key={theItem.id} data-id={theItem.id} text={theItem.name} onClick={triggerItemClick} />
<IconButton primary iconProps={clearIcon} title="Clear" ariaLabel="Clear" onClick={removeFieldValue} data-custom-id="button-custom-clear" />
</Stack>
)
if (!props.isControlDisabled) {
return (
<Stack horizontal style={{ border: "1px solid #106EBE" }}>
<PrimaryButton className="buttonContainer" style={{ borderRadius: 0 }} key={theItem.id} data-id={theItem.id} text={theItem.name} onClick={triggerItemClick} />
<IconButton primary iconProps={clearIcon} title="Clear" ariaLabel="Clear" onClick={removeFieldValue} data-custom-id="button-custom-clear" />
</Stack>
)
} else {
return (
<Stack horizontal style={{ border: "1px solid #106EBE" }}>
<PrimaryButton className="buttonContainer" style={{ borderRadius: 0 }} key={theItem.id} data-id={theItem.id} text={theItem.name} onClick={triggerItemClick} />
</Stack>
)
}
})}
</Stack>
);
Expand All @@ -256,7 +264,7 @@ const MultiselectRecords = (props: IMultiselectProps) => {
* Renders the search box
*/
const _showSearchTextField = (): JSX.Element => {
if (props.isControlVisible) {
if (props.isControlVisible && !props.isControlDisabled) {
return (
<>
<TextField className={"text"}
Expand Down Expand Up @@ -372,8 +380,8 @@ const MultiselectRecords = (props: IMultiselectProps) => {
</Sticky>
</Stack>
)


} else {
return (
<></>
Expand Down Expand Up @@ -654,7 +662,7 @@ const MultiselectRecords = (props: IMultiselectProps) => {
</div>
</div>
);

}

export default MultiselectRecords;
Loading

0 comments on commit c82081f

Please sign in to comment.