From 7796b0b6b9f2b16043915ec5b125c594d40006c8 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Thu, 21 Dec 2023 14:56:45 +0100 Subject: [PATCH] SONAR-21312 Migrate portfolio definition mode form to the new UI --- .../src/components/input/MultiSelectMenu.tsx | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx b/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx index abc668de03e..56794b4fe01 100644 --- a/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx +++ b/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import { difference } from 'lodash'; -import { PureComponent } from 'react'; +import React, { PureComponent } from 'react'; import { Key } from '../../helpers/keyboard'; import { ItemDivider, ItemHeader } from '../DropdownMenu'; import { InputSearch } from './InputSearch'; @@ -32,6 +32,7 @@ interface Props { createElementLabel: string; disableMessage?: string; elements: string[]; + elementsDisabled?: string[]; footerNode?: React.ReactNode; headerNode?: React.ReactNode; inputId?: string; @@ -271,6 +272,7 @@ export class MultiSelectMenu extends PureComponent { inputId, noResultsLabel, searchInputAriaLabel, + elementsDisabled, } = this.props; const { renderLabel } = this.props as PropsWithDefault; @@ -334,6 +336,18 @@ export class MultiSelectMenu extends PureComponent { renderLabel={renderLabel} /> ))} + {elementsDisabled?.map((element) => ( + + ))} {showNewElement && ( { onSelectChange={this.handleSelectChange} /> )} - {!showNewElement && selectedElements.length < 1 && unselectedElements.length < 1 && ( -
  • {noResultsLabel}
  • - )} + {!showNewElement && + selectedElements.length < 1 && + unselectedElements.length < 1 && + (elementsDisabled ?? []).length < 1 &&
  • {noResultsLabel}
  • } {hasFooter && }
    {footerNode}
    -- 2.39.5