@engie-group/fluid-design-system-angular
Version:
Fluid Design System Angular
103 lines (102 loc) • 3.52 kB
HTML
<nj-form-item
[]="hasError"
[]="hasSuccess"
[]="hasHint"
[]="isDisabled"
[]="hasCustomIcon"
[]="isFloatingLabel"
[]="iconName"
[]="size"
[]="true"
[]="getAdditionalClass()"
[]="inputId"
(focusout)="handleFocusOut($event)"
>
<input
type="text"
readonly
[]="formattedInputValue"
[]="inputId"
[]="isDisabled"
tabindex="-1"
aria-hidden="true"
njFormField
/>
<ng-content njFormLabel select="[njFormLabel]"></ng-content>
<ng-content njFormSubscript select="[njFormSubscript]"></ng-content>
<ng-container njFormAdditionalContent>
<p [id]="getInstructionsId()" hidden>{{ listNavigationLabel }}</p>
<button
type="button"
class="nj-form-item__custom-list-button"
aria-haspopup="listbox"
[]="isOpen"
role="combobox"
[]="buttonLabel"
[]="isOpen ? -1 : null"
[]="getDescriptionId()"
(click)="toggleIsOpen()">
<span class="nj-sr-only">{{buttonLabel}}</span>
</button>
<div class="nj-form-item__selected-tags" (click)="toggleIsOpen()">
<ng-container *ngIf="selectIndexAsArray?.length as numOfSelected">
<ng-container *ngIf="displaySelectedItems">
<nj-tag *ngFor="let optionIndex of selectedIndexesToShow; let i = index"
[]="tagColor"
[]="tagSize"
[]="true"
[]="false"
[]="getTagCloseLabel(optionIndex)"
(closeClick)="toggleByIndex($event, optionIndex, i)">
{{getLabelAtIndex(optionIndex)}}
</nj-tag>
<nj-tag *ngIf="maxTagsToDisplay && numOfSelected > maxTagsToDisplay"
[]="tagColor"
[]="tagSize">
+{{numOfSelected - maxTagsToDisplay}}
</nj-tag>
</ng-container>
<ng-container *ngIf="!displaySelectedItems">
<nj-tag
*ngIf="numOfSelected === 1"
[]="tagColor"
[]="tagSize"
[]="true"
[]="false"
[]="getTagCloseLabel(selectIndexAsArray?.[0])"
(closeClick)="toggleByIndex($event, selectIndexAsArray?.[0], 0)">
{{getLabelAtIndex(selectIndexAsArray?.[0])}}
</nj-tag>
<nj-tag
*ngIf="numOfSelected > 1"
[]="tagColor"
[]="true"
[]="false"
[]="tagSize"
[]="tagResetSelectionLabel"
(closeClick)="resetSelection($event)">
{{numOfSelected}} {{selectedText}}
</nj-tag>
</ng-container>
</ng-container>
</div>
<nj-list-group
class="nj-form-item__list nj-form-item__list--no-animate"
[]="!isOpen"
[@transformList]="isOpen ? 'open': 'void'"
[]="true"
[]="false"
[]="true"
[]="true"
[]="true"
tabindex="-1"
[]="fieldLabel"
(keydown)="handleListKeydown($event)"
>
<ng-content select="[njSelectOptions]"></ng-content>
</nj-list-group>
</ng-container>
</nj-form-item>