-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmulti-select.component.html
More file actions
149 lines (148 loc) · 3.99 KB
/
multi-select.component.html
File metadata and controls
149 lines (148 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<div
[class]="rootClass"
[ngClass]="{
isDisabled: disabled,
isFocused: focused,
isClearable: displayClearBtn,
withHeightLimit: maxRowCount > 0,
isReadonly: readonly,
}"
#selectRef
#tooltipRef="auiTooltip"
[auiTooltip]="templateRef"
auiTooltipAnimType="scaleY"
[auiTooltipDisabled]="disabled"
auiTooltipTrigger="click"
auiTooltipPosition="bottom start"
auiTooltipType="plain"
(auiTooltipVisibleChange)="onVisibleOptions($event)"
(mousedown)="$event.preventDefault()"
[style.max-height]="maxHeight"
>
<div class="aui-multi-select__suffix">
<span class="aui-multi-select__icon-container">
<aui-icon
class="aui-multi-select__indicator"
[icon]="loading ? 'spinner' : 'caret_down_s'"
></aui-icon>
<aui-icon
class="aui-multi-select__clear"
icon="xmark_small"
(click)="clearValue($event)"
></aui-icon>
</span>
</div>
<span
[hidden]="model.length || inputRef.value.length"
[class]="bem.element('placeholder')"
>
{{ placeholder }}
</span>
<aui-tag
*ngFor="let option of selectedOptions$ | async; trackBy: trackByValue"
type="info"
[round]="false"
[border]="false"
[size]="tagSize"
[closeable]="!disabled && !option.disabled"
(close)="removeValue(option.value)"
[ngClass]="tagClassFn && tagClassFn(option.label, option.value)"
>
<ng-container
*ngIf="isTemplateRef(option.label); else label"
[ngTemplateOutlet]="option.label"
[ngTemplateOutletContext]="option.labelContext"
></ng-container>
<ng-template #label>
{{ option.label }}
</ng-template>
</aui-tag>
<input
#inputRef
autocomplete="off"
[readonly]="readonly"
[class]="inputClass"
(focus)="onInputFocus()"
(blur)="onInputBlur()"
(keydown)="onKeyDown($event)"
(input)="onInput($event)"
/>
<span
#inputValueMirror
[class]="bem.element('mirror')"
>
{{ inputValue }}
</span>
</div>
<ng-template #templateRef>
<div
class="aui-option-container"
[style.minWidth]="containerWidth"
(mousedown)="$event.preventDefault()"
>
<div
#optionListRef
class="aui-option-container__content"
>
<ng-container
*ngIf="
allowSelectAll &&
(hasEnabledOptions$ | async) &&
((hasVisibleOption$ | async) ||
(allowCreate && (customCreatedOptions$ | async).length) ||
(allowCreate && filterString))
"
>
<div
class="aui-option"
[class]="bemSelectAll.block(size$ | async)"
[class.isDisabled]="disabled"
[class.isSelected]="!!(selectAllStatus$ | async)"
[class.isIndeterminate]="
(selectAllStatus$ | async) === 'indeterminate'
"
[class.isMulti]="true"
(click)="onSelectAllClick()"
>
<i class="aui-option__pointer">
<aui-icon
*ngIf="(selectAllStatus$ | async) === 'checked'"
icon="check"
></aui-icon>
</i>
{{ 'select_all' | auiI18n }}
</div>
<div class="aui-option__divider"></div>
</ng-container>
<aui-option
#inputtingOption
*ngIf="allowCreate && filterString && !(hasMatchedOption$ | async)"
[value]="filterString"
>
{{ filterString }}
</aui-option>
<ng-container *ngIf="allowCreate">
<aui-option
*ngFor="let option of customCreatedOptions$ | async"
[label]="option.label"
[value]="option.value"
>
{{ option.label }}
</aui-option>
</ng-container>
<ng-content></ng-content>
</div>
<div
*ngIf="
!(
(hasVisibleOption$ | async) ||
(allowCreate && (customCreatedOptions$ | async).length) ||
(allowCreate && filterString)
)
"
class="aui-option-container__placeholder"
>
<ng-content select="aui-option-placeholder"></ng-content>
</div>
</div>
</ng-template>