src/ui/multiselect/multiselect.component.ts
A multiselect dropdown component that mirrors smart combo editor value list resolution and item rendering. Supports multiple input sources: simple arrays, value list pairs, and smart value lists from the backend service. Implements Angular's ControlValueAccessor to integrate seamlessly with reactive and template-driven forms.
Example :<smart-multiselect
[valueList]="items"
[(smartSelectedValues)]="selectedItems"
smart-selection-mode="multiple">
</smart-multiselect>
| changeDetection | ChangeDetectionStrategy.OnPush |
| encapsulation | ViewEncapsulation.None |
| providers |
SmartMultiselectComponent
|
| selector | smart-multiselect |
| styleUrls | ./multiselect.component.scss |
| templateUrl | ./multiselect.component.html |
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
constructor()
|
| smart-help-url |
Type : string
|
|
Sets the Smart Help URL metadata on the host element. |
| selectedValues |
Type : string[]
|
Default value : [], { alias: 'smart-selected-values' }
|
| selectionMode |
Type : "single" | "multiple"
|
Default value : 'multiple', { alias: 'smart-selection-mode' }
|
| smartValueList |
Type : string | null
|
Default value : null, { alias: 'smart-value-list' }
|
| valueList |
Type : string[] | null
|
Default value : null, { alias: 'value-list' }
|
| valueListDisplayText |
Type : ValueListDisplayText | null
|
Default value : null, { alias: 'smart-value-list-display-text' }
|
| valueListPair |
Type : string[] | null
|
Default value : null, { alias: 'value-list-pair' }
|
| selectedValues |
Type : string[]
|
| keydown | ||||
Arguments : '$event'
|
||||
keydown(event: KeyboardEvent)
|
||||
|
CTRL+A select-all support
Parameters :
|
| callNativeMethod | |||||||||||||||
callNativeMethod(methodName: string, args: any[])
|
|||||||||||||||
|
Calls a native method on the component's element or its grid content.
Parameters :
Returns :
any
The result of the method call |
| clear |
clear()
|
|
Clears all selected values and removes the 'data-clear' attribute.
Returns :
void
|
| getNativeProperty | ||||||||
getNativeProperty(propertyName: string)
|
||||||||
|
Gets a native property from the component's element. Handles special cases like 'style.display', 'disabled', 'value', and 'type'.
Parameters :
Returns :
any
The property value |
| registerOnChange | ||||||||
registerOnChange(fn: (value: string) => void)
|
||||||||
|
Registers a callback for value change events (ControlValueAccessor implementation).
Parameters :
Returns :
void
|
| registerOnTouched | ||||||||
registerOnTouched(fn: () => void)
|
||||||||
|
Registers a callback for touch events (ControlValueAccessor implementation).
Parameters :
Returns :
void
|
| setDisabledState | ||||||||
setDisabledState(isDisabled: boolean)
|
||||||||
|
Sets the disabled state of the component (ControlValueAccessor implementation).
Parameters :
Returns :
void
|
| setNativeProperty | ||||||||||||
setNativeProperty(propertyName: string, value: any)
|
||||||||||||
|
Sets a native property on the component's element. Handles special cases like 'style.display', 'disabled', and 'value'.
Parameters :
Returns :
void
|
| writeValue | ||||||||
writeValue(value: string | string[] | null)
|
||||||||
|
Writes the component value (ControlValueAccessor implementation).
Parameters :
Returns :
void
|
| helpUrl | ||||||||
gethelpUrl()
|
||||||||
|
Gets the current Smart Help URL.
Returns :
string
|
||||||||
sethelpUrl(value: string)
|
||||||||
|
Sets the Smart Help URL metadata on the host element.
Parameters :
Returns :
void
|
<!--
***************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") - *
* www.consultingwerk.com and other contributors as listed *
* below. All Rights Reserved. *
* *
* Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY *
* KIND, either express or implied. *
* *
* Contributors: *
* *
***************************************************************************
---------------------------------------------------------------------------
File : multiselect.component.html
Purpose : Template for the SmartMultiselect component.
Author(s) : Radu Nicoara
Created : Mar 16, 2026
---------------------------------------------------------------------------
-->
<kendo-grid
#grid
[hideHeader]="true"
[hidden]="!visible()"
[class.smart-multiselect-disabled]="disabled()"
[attr.aria-disabled]="disabled()"
[class.k-disabled]="disabled()"
[style.width]="'100%'"
[style.height]="'100%'"
[data]="items()"
[selectable]="selectionSettings()"
kendoGridSelectBy="value"
[kendoGridBinding]="items()"
[selectedKeys]="gridSelectedKeys()"
(selectionChange)="onSelectionChange($event)">
<kendo-grid-column>
<ng-template kendoGridCellTemplate let-dataItem>
<span class="multiselect-item">
@if (dataItem.icon) {
<span>
<i class="item-icon" [ngClass]="dataItem.icon"></i>
</span>
} @else if (dataItem.image) {
<span class="template">
<img class="item-image" [src]="dataItem.image">
</span>
}
{{ dataItem.display }}
</span>
</ng-template>
</kendo-grid-column>
</kendo-grid>
./multiselect.component.scss
/**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") - *
* www.consultingwerk.com and other contributors as listed *
* below. All Rights Reserved. *
* *
* Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY *
* KIND, either express or implied. *
* *
* Contributors: *
* *
**************************************************************************/
/*-------------------------------------------------------------------------
File : multiselect.component.scss
Purpose : Styles for Smart Multiselect item rendering.
Author(s) : Radu Nicoara
Created : Mar 16, 2026
-------------------------------------------------------------------------*/
:host {
display: block;
width: 100%;
height: 100%;
min-height: 0;
cursor: default;
}
.smart-multiselect-disabled {
pointer-events: none;
cursor: default;
}
.smart-multiselect-disabled .k-grid-content,
.smart-multiselect-disabled .k-table-tbody,
.smart-multiselect-disabled .k-master-row {
pointer-events: none;
cursor: default;
}
:host ::ng-deep .k-grid {
height: 100%;
min-height: 0;
cursor: default;
}
:host ::ng-deep .k-grid-content {
overflow: auto;
cursor: default;
}
:host ::ng-deep .k-grid-content tr,
:host ::ng-deep .k-table-tbody > .k-master-row,
:host ::ng-deep .k-grid-content td {
cursor: pointer;
}
:host ::ng-deep smart-multiselect kendo-grid tr td.k-focus,
:host ::ng-deep smart-multiselect kendo-grid tr.k-focus,
:host ::ng-deep smart-multiselect kendo-grid th.k-focus {
border: revert !important;
outline: revert !important;
box-shadow: none !important;
}
.multiselect-item {
display: inline-flex;
align-items: center;
cursor: inherit;
-webkit-user-select: none;
user-select: none;
}
.template {
display: inline-flex;
align-items: center;
width: var(--kendo-spacing-4, 1rem);
margin-right: var(--kendo-spacing-1, 0.25rem);
}
.item-image {
height: var(--kendo-spacing-4, 1rem);
width: auto;
max-width: 100%;
}
.item-icon {
margin-right: var(--kendo-spacing-1, 0.25rem);
}