src/ui/combo-editor/smart-combo-editor.component.ts
AbstractSmartViewerFieldComponent
| changeDetection | ChangeDetectionStrategy.Eager |
| selector | smart-combo-editor |
| styleUrls | ./smart-combo-editor.component.scss |
| templateUrl | ./smart-combo-editor.component.html |
constructor(serviceAdapter: SmartServiceAdapter, elementRef: ElementRef, dsRegistry: DataSourceRegistry, errorHandler: SmartErrorHandlerService, widgetFacadeFactory: WidgetFacadeFactory, changeDetector: ChangeDetectorRef, formInstanceService: SmartFormInstanceService, viewerHelper: SmartViewerHelperService<AbstractFrameComponent>, inputDirective: InputFacadeDirective)
|
||||||||||||||||||||||||||||||
|
Parameters :
|
| autoCompleteMode |
Type : string
|
|
Sets the autocomplete mode. |
| autoSuggestFilterMode |
Type : string
|
|
Sets the autosuggest filter mode. |
| display-column-name |
Type : string
|
|
Sets the field which should be used to display the combo editor's value |
| display-fields |
Type : string
|
|
Sets the fields that will be used to render the Combo Editor's item template |
| display-substitute |
Type : string
|
|
Sets the pattern that will be used to render the Combo Editor's item template Example: [Field1] - [Field2] |
| enabled |
Type : boolean
|
|
Sets whether the component is enabled |
| id |
Type : string
|
|
The component ID. |
| image-field-name |
Type : string
|
|
Sets the image field name |
| image-substitute |
Type : string
|
|
Sets the image substitute pattern |
| key-column-name |
Type : string
|
|
Sets the key field by which the combo editor should filter its data source |
| provide-foreign-field-value |
Type : void | string
|
|
Sets the provider for foreign field values. |
| selected |
Type : any
|
|
Sets the selected record |
| smart-business-entity-name |
Type : string
|
|
Sets the business entity name |
| smart-combo-allow-filter |
Type : boolean
|
|
Sets whether filtering (ComboBox) is enabled |
| smart-data-source |
Type : string
|
|
Sets the parent data source name |
| smart-entity-table |
Type : string
|
|
Sets the entity table name |
| smart-entity-view |
Type : string
|
|
Sets the entity view name |
| smart-field-binding |
Type : any
|
|
Sets the field binding expression. |
| smart-filter |
Type : any
|
|
Sets the filter expression |
| smart-flag-image |
Type : string
|
|
Sets the flag image URL. |
| smart-flag-label |
Type : string
|
|
Sets the flag label. |
| smart-flag-value |
Type : string
|
|
Sets the flag value. |
| smart-foreign-fields |
Type : string
|
|
Sets the foreign fields for query string filtering |
| smart-help-url |
Type : string
|
|
Sets the help URL for the component |
| smart-limit-to-list |
Type : boolean
|
|
Sets whether entries are limited to predefined list values |
| smart-partial-dataset |
Type : boolean
|
|
Deprecated no-op. Partial dataset handling is derived from the JSDO table reference root-table metadata. |
| smart-query-string |
Type : string
|
|
Sets the query string for filtering |
| smart-sort |
Type : any
|
|
Sets the sort expression |
| smart-value-list |
Type : string
|
|
The SmartValueList that this combo editor should bind to. |
| smart-value-list-display-text |
Type : ValueListDisplayText
|
|
Sets the display text mode for value lists. |
| smartModel |
Type : any
|
|
Sets the ngModel value and updates the combo when dropdown list is ready |
| style |
Type : any
|
|
Sets the component style |
| value-list |
Type : [] | null
|
|
The value list array. |
| value-list-entries |
Type : [] | null
|
|
Repository value list entries. |
| value-list-pair |
Type : [] | null
|
|
The value list pair array. |
| editorButtons |
Type : EditorButton[]
|
Default value : []
|
| smart-viewer-unbound-field |
Type : boolean
|
| smart-instance-name |
Type : string
|
|
The instance name of the component |
| smart-object-name |
Type : string
|
|
The object name of the component |
| blur |
Type : EventEmitter<void>
|
| focus |
Type : EventEmitter<void>
|
| smartModelChange |
Type : EventEmitter<string>
|
| onEditorButtonClicked |
Type : EditorButton
|
| callNativeMethod | ||||||||||||
callNativeMethod(methodName: string, args: any[])
|
||||||||||||
|
Calls a native method on the combo input element
Parameters :
Returns :
any
The result of the method call |
| clear |
clear()
|
|
Clears the combo editor value
Returns :
void
|
| Public getImageUrl | ||||||||
getImageUrl(key: string)
|
||||||||
|
Gets the image URL for the given key
Parameters :
Returns :
string
The resolved image URL |
| getNativeProperty | ||||||||
getNativeProperty(propertyName: string)
|
||||||||
|
Gets a native property from the combo input element
Parameters :
Returns :
any
The property value |
| Public onBlur |
onBlur()
|
|
Handles blur events on the combo editor
Returns :
void
|
| Public onComboSelectionChange | ||||||||
onComboSelectionChange(value: unknown)
|
||||||||
|
Handles combo selection change events
Parameters :
Returns :
void
|
| setNativeProperty | ||||||||||||
setNativeProperty(propertyName: string, value: any)
|
||||||||||||
|
Sets a native property on the combo input element
Parameters :
Returns :
void
|
| setQueryStringFilter |
setQueryStringFilter()
|
|
Sets the query string filter and triggers data refresh if needed
Returns :
void
|
| Public updateSelectedItem | ||||||||
updateSelectedItem(value: any)
|
||||||||
|
Updates only the selected item without fetching data
Parameters :
Returns :
void
|
| Readonly autoCompleteModeSignal |
Type : Signal<string>
|
Default value : this._autoCompleteModeSignal.asReadonly()
|
| Readonly autoSuggestFilterModeSignal |
Type : Signal<string>
|
Default value : this._autoSuggestFilterModeSignal.asReadonly()
|
| comboNgModel |
Type : NgModel
|
Decorators :
@ViewChild('comboModelDirective')
|
| dataSourceId |
Type : string
|
| Readonly fieldBindingSignal |
Type : Signal<any>
|
Default value : this._fieldBindingSignal.asReadonly()
|
| Readonly flagImageSignal |
Type : Signal<string>
|
Default value : this._flagImageSignal.asReadonly()
|
| Readonly flagLabelSignal |
Type : Signal<string>
|
Default value : this._flagLabelSignal.asReadonly()
|
| Readonly flagValueSignal |
Type : Signal<string>
|
Default value : this._flagValueSignal.asReadonly()
|
| Readonly idSignal |
Type : Signal<string>
|
Default value : this._id.asReadonly()
|
|
Readonly signal exposing the component ID. |
| previousSelection |
Type : ComboOption
|
| Readonly provideForeignFieldValueSignal |
Type : Signal<void | string>
|
Default value : this._provideForeignFieldValueSignal.asReadonly()
|
| Readonly valueListDisplayTextSignal |
Type : Signal<ValueListDisplayText>
|
Default value : this._valueListDisplayTextSignal.asReadonly()
|
| Readonly valueListPairSignal |
Type : Signal<string[]>
|
Default value : this._valueListPair.asReadonly()
|
|
Readonly signal exposing the value list pair. |
| Readonly valueListSignal |
Type : Signal<string[]>
|
Default value : this._valueList.asReadonly()
|
|
Readonly signal exposing the value list. |
| visible | ||||||||
getvisible()
|
||||||||
|
Gets the component visibility
Returns :
boolean
|
||||||||
setvisible(value: boolean)
|
||||||||
|
Sets the component visibility
Parameters :
Returns :
void
|
| selectedItem | ||||||||
getselectedItem()
|
||||||||
|
Returns the selected combo option item.
Returns :
ComboOption
|
||||||||
setselectedItem(value: ComboOption)
|
||||||||
|
Sets the selected combo option item.
Parameters :
Returns :
void
|
| formContainer | ||||||||
getformContainer()
|
||||||||
|
Gets the form container view reference
Returns :
"root" | ViewContainerRef
|
||||||||
setformContainer(value: "root" | ViewContainerRef)
|
||||||||
|
Sets the form container view reference
Parameters :
Returns :
void
|
| enabled | ||||||||
getenabled()
|
||||||||
|
Gets whether the component is enabled
Returns :
boolean
|
||||||||
setenabled(value: boolean)
|
||||||||
|
Sets whether the component is enabled
Parameters :
Returns :
void
|
| id | ||||||
getid()
|
||||||
|
Returns the component ID.
Returns :
string
|
||||||
setid(value: string)
|
||||||
|
The component ID.
Parameters :
Returns :
void
|
| style | ||||||||
getstyle()
|
||||||||
|
Gets the component style
Returns :
any
|
||||||||
setstyle(value: any)
|
||||||||
|
Sets the component style
Parameters :
Returns :
void
|
| helpUrl | ||||||||
gethelpUrl()
|
||||||||
|
Gets the help URL for the component
Returns :
string
|
||||||||
sethelpUrl(value: string)
|
||||||||
|
Sets the help URL for the component
Parameters :
Returns :
void
|
| ngModel | ||||||||
getngModel()
|
||||||||
|
Gets the ngModel value |
||||||||
setngModel(value: any)
|
||||||||
|
Sets the ngModel value and updates the combo when dropdown list is ready
Parameters :
Returns :
void
|
| smartValueList | ||||||||
setsmartValueList(value: string)
|
||||||||
|
The SmartValueList that this combo editor should bind to.
Parameters :
Returns :
void
|
| valueListPair | ||||||
getvalueListPair()
|
||||||
|
Returns the value list pair array.
Returns :
[] | null
|
||||||
setvalueListPair(value: string[] | null)
|
||||||
|
The value list pair array.
Parameters :
Returns :
void
|
| valueList | ||||||
getvalueList()
|
||||||
|
Returns the value list array.
Returns :
[] | null
|
||||||
setvalueList(value: string[] | null)
|
||||||
|
The value list array.
Parameters :
Returns :
void
|
| valueListEntries | ||||||
getvalueListEntries()
|
||||||
|
Returns the repository value list entries.
Returns :
[] | null
|
||||||
setvalueListEntries(value: SmartValueListEntry[] | null)
|
||||||
|
Repository value list entries.
Parameters :
Returns :
void
|
| keyField | ||||||||
getkeyField()
|
||||||||
|
Gets the key field by which the combo editor filters its data source
Returns :
string
|
||||||||
setkeyField(value: string)
|
||||||||
|
Sets the key field by which the combo editor should filter its data source
Parameters :
Returns :
void
|
| displayColumnName | ||||||||
getdisplayColumnName()
|
||||||||
|
Gets the field which should be used to display the combo editor's value
Returns :
string
|
||||||||
setdisplayColumnName(value: string)
|
||||||||
|
Sets the field which should be used to display the combo editor's value
Parameters :
Returns :
void
|
| imageFieldName | ||||||||
getimageFieldName()
|
||||||||
|
Gets the image field name
Returns :
string
|
||||||||
setimageFieldName(value: string)
|
||||||||
|
Sets the image field name
Parameters :
Returns :
void
|
| imageSubstitute | ||||||||
getimageSubstitute()
|
||||||||
|
Gets the image substitute pattern
Returns :
string
|
||||||||
setimageSubstitute(value: string)
|
||||||||
|
Sets the image substitute pattern
Parameters :
Returns :
void
|
| displayFields | ||||||||
getdisplayFields()
|
||||||||
|
Gets the fields that will be used to render the Combo Editor's item template
Returns :
string
|
||||||||
setdisplayFields(value: string)
|
||||||||
|
Sets the fields that will be used to render the Combo Editor's item template
Parameters :
Returns :
void
|
| displaySubstitute | ||||||||
getdisplaySubstitute()
|
||||||||
|
Gets the pattern that will be used to render the Combo Editor's item template
Returns :
string
|
||||||||
setdisplaySubstitute(value: string)
|
||||||||
|
Sets the pattern that will be used to render the Combo Editor's item template Example: [Field1] - [Field2]
Parameters :
Returns :
void
|
| table | ||||||
gettable()
|
||||||
|
Gets the entity table name
Returns :
string
|
||||||
settable(value: string)
|
||||||
|
Sets the entity table name
Parameters :
Returns :
void
|
| tableView | ||||||||
gettableView()
|
||||||||
|
Gets the entity view name
Returns :
string
|
||||||||
settableView(value: string)
|
||||||||
|
Sets the entity view name
Parameters :
Returns :
void
|
| businessEntity | ||||||||
getbusinessEntity()
|
||||||||
|
Gets the business entity name
Returns :
string
|
||||||||
setbusinessEntity(value: string)
|
||||||||
|
Sets the business entity name
Parameters :
Returns :
void
|
| partialDataset | ||||||||
getpartialDataset()
|
||||||||
|
Gets the deprecated partial dataset compatibility value.
Returns :
boolean
|
||||||||
setpartialDataset(value: boolean)
|
||||||||
|
Deprecated no-op. Partial dataset handling is derived from the JSDO table reference root-table metadata.
Parameters :
Returns :
void
|
| selected | ||||||||
getselected()
|
||||||||
|
Gets the selected record
Returns :
any
|
||||||||
setselected(value: any)
|
||||||||
|
Sets the selected record
Parameters :
Returns :
void
|
| filter | ||||||||
getfilter()
|
||||||||
|
Gets the filter expression
Returns :
any
|
||||||||
setfilter(value: any)
|
||||||||
|
Sets the filter expression
Parameters :
Returns :
void
|
| sort | ||||||||
getsort()
|
||||||||
|
Gets the sort expression
Returns :
any
|
||||||||
setsort(value: any)
|
||||||||
|
Sets the sort expression
Parameters :
Returns :
void
|
| parentDs | ||||||||
getparentDs()
|
||||||||
|
Gets the parent data source name
Returns :
string
|
||||||||
setparentDs(value: string)
|
||||||||
|
Sets the parent data source name
Parameters :
Returns :
void
|
| allowFiltering | ||||||||
getallowFiltering()
|
||||||||
|
Gets whether filtering (ComboBox) is enabled
Returns :
boolean
|
||||||||
setallowFiltering(value: boolean)
|
||||||||
|
Sets whether filtering (ComboBox) is enabled
Parameters :
Returns :
void
|
| valueListDisplayText | ||||||||
getvalueListDisplayText()
|
||||||||
|
Returns the display text mode for value lists.
Returns :
ValueListDisplayText
|
||||||||
setvalueListDisplayText(value: ValueListDisplayText)
|
||||||||
|
Sets the display text mode for value lists.
Parameters :
Returns :
void
|
| autoCompleteMode | ||||||||
getautoCompleteMode()
|
||||||||
|
Returns the autocomplete mode.
Returns :
string
|
||||||||
setautoCompleteMode(value: string)
|
||||||||
|
Sets the autocomplete mode.
Parameters :
Returns :
void
|
| autoSuggestFilterMode | ||||||||
getautoSuggestFilterMode()
|
||||||||
|
Returns the autosuggest filter mode.
Returns :
string
|
||||||||
setautoSuggestFilterMode(value: string)
|
||||||||
|
Sets the autosuggest filter mode.
Parameters :
Returns :
void
|
| limitToList | ||||||||
getlimitToList()
|
||||||||
|
Gets whether entries are limited to predefined list values
Returns :
boolean
|
||||||||
setlimitToList(value: boolean)
|
||||||||
|
Sets whether entries are limited to predefined list values
Parameters :
Returns :
void
|
| foreignFields | ||||||||
getforeignFields()
|
||||||||
|
Gets the foreign fields for query string filtering
Returns :
string
|
||||||||
setforeignFields(value: string)
|
||||||||
|
Sets the foreign fields for query string filtering
Parameters :
Returns :
void
|
| fieldBinding | ||||||||
getfieldBinding()
|
||||||||
|
Returns the field binding expression.
Returns :
any
|
||||||||
setfieldBinding(value: any)
|
||||||||
|
Sets the field binding expression.
Parameters :
Returns :
void
|
| flagValue | ||||||||
getflagValue()
|
||||||||
|
Returns the flag value.
Returns :
string
|
||||||||
setflagValue(value: string)
|
||||||||
|
Sets the flag value.
Parameters :
Returns :
void
|
| flagLabel | ||||||||
getflagLabel()
|
||||||||
|
Returns the flag label.
Returns :
string
|
||||||||
setflagLabel(value: string)
|
||||||||
|
Sets the flag label.
Parameters :
Returns :
void
|
| flagImage | ||||||||
getflagImage()
|
||||||||
|
Returns the flag image URL.
Returns :
string
|
||||||||
setflagImage(value: string)
|
||||||||
|
Sets the flag image URL.
Parameters :
Returns :
void
|
| queryString | ||||||||
getqueryString()
|
||||||||
|
Gets the query string for filtering
Returns :
string
|
||||||||
setqueryString(value: string)
|
||||||||
|
Sets the query string for filtering
Parameters :
Returns :
void
|
| provideForeignFieldValue | ||||||||
getprovideForeignFieldValue()
|
||||||||
|
Returns the provider for foreign field values.
Returns :
void | string
|
||||||||
setprovideForeignFieldValue(value: (ev: ProvideForeignFieldValue) => void)
|
||||||||
|
Sets the provider for foreign field values.
Parameters :
Returns :
void
|
| dropdownList | ||||||||
getdropdownList()
|
||||||||
|
Gets the dropdown list options
Returns :
ComboOption[]
|
||||||||
setdropdownList(value: ComboOption[])
|
||||||||
|
Sets the dropdown list options and adds flag option if configured
Parameters :
Returns :
void
|
| combo | ||||||||
getcombo()
|
||||||||
|
Gets the combo component reference
Returns :
ComboBoxComponent
|
||||||||
setcombo(value: ComboBoxComponent)
|
||||||||
|
Sets the combo component reference
Parameters :
Returns :
void
|
| dropdown | ||||||||
getdropdown()
|
||||||||
|
Gets the dropdown component reference
Returns :
DropDownListComponent
|
||||||||
setdropdown(value: DropDownListComponent)
|
||||||||
|
Sets the dropdown component reference
Parameters :
Returns :
void
|
| comboBoxComponent |
getcomboBoxComponent()
|
|
Gets the combo box component reference
Returns :
ComboBoxComponent
|
| dropDownListComponent |
getdropDownListComponent()
|
|
Gets the drop down list component reference
Returns :
DropDownListComponent
|
<!--
**************************************************************************
* 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 : smart-combo-editor.component.html
Purpose : Template for Smart Combo Editor.
Author(s) : Radu Nicoara
Created : Dec 07, 2017
--------------------------------------------------------------------------
-->
@let allowCustomInput = allowCustom$();
@let coercedModel = coercedNgModel$();
<ng-template #itemContent let-dataItem>
@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}}
</ng-template>
@if (allowFiltering !== false) {
<kendo-combobox
#combo
(blur)="onBlur()"
(focus)="focus.next()"
[clearButton]="false"
[ngStyle]="_styleSignal() || {}"
[hidden]="!_visibleSignal()"
[disabled]="!_enabledSignal()"
[allowCustom]="allowCustomInput"
[valuePrimitive]="allowCustomInput"
[value]="allowCustomInput ? coercedModel : _selectedItemSignal()"
[data]="_dropdownListSignal()"
[ngModel]="allowCustomInput ? coercedModel : _selectedItemSignal()"
[textField]="'display'"
[valueField]="'value'"
[popupSettings]="{ appendTo: _formContainerSignal() || 'component' }"
(open)="setQueryStringFilter()"
(valueChange)="onComboSelectionChange($event)"
>
<ng-template kendoComboBoxItemTemplate let-dataItem>
<ng-container [ngTemplateOutlet]="itemContent"
[ngTemplateOutletContext]="{ $implicit: dataItem }">
</ng-container>
</ng-template>
<ng-template kendoSuffixTemplate>
@for (button of editorButtons(); track button.key) {
<button
kendoButton
fillMode="flat"
themeColor="base"
[iconClass]="button.icon"
[smartEditorButton]="button"
(editorButtonClicked)="onEditorButtonClicked.emit($event)">
{{ button.label }}
</button>
}
</ng-template>
</kendo-combobox>
} @else {
<div class="unfilterable-combobox-wrapper">
<kendo-dropdownlist
#dropdown
(blur)="onBlur()"
(focus)="focus.next()"
[ngStyle]="_styleSignal() || {}"
[hidden]="!_visibleSignal()"
[disabled]="!_enabledSignal()"
[value]="_selectedItemSignal()"
[data]="_dropdownListSignal()"
[ngModel]="_selectedItemSignal()"
[valuePrimitive]="false"
[textField]="'display'"
[valueField]="'value'"
(open)="setQueryStringFilter()"
[popupSettings]="{ appendTo: _formContainerSignal() || 'component' }"
(valueChange)="onComboSelectionChange($event)">
<ng-template kendoDropDownListItemTemplate let-dataItem>
<ng-container [ngTemplateOutlet]="itemContent"
[ngTemplateOutletContext]="{ $implicit: dataItem }">
</ng-container>
</ng-template>
<ng-template kendoDropDownListValueTemplate let-dataItem>
<ng-container [ngTemplateOutlet]="itemContent"
[ngTemplateOutletContext]="{ $implicit: dataItem }">
</ng-container>
</ng-template>
</kendo-dropdownlist>
@for (button of editorButtons(); track button.key) {
<button
kendoButton
[iconClass]="button.icon"
[disabled]="!_enabledSignal()"
[smartEditorButton]="button"
[standaloneEditorButton]="true"
(editorButtonClicked)="onEditorButtonClicked.emit($event)">
{{ button.label }}
</button>
}
</div>
}
@if (dataSourceId$() && _businessEntitySignal() && _tableSignal()) {
<smart-data-source
[smart-instance-name]="dataSourceId$()"
[smart-business-entity-name]="_businessEntitySignal()"
[smart-entity-table]="_tableSignal()"
[smart-entity-view]="_tableViewSignal()"
[smart-partial-dataset]="_partialDatasetSignal()"
[smart-filter]="_filterSignal()"
[smart-sort]="_sortSignal()"
[smart-data-source]="_parentDsSignal()"
[smart-auto-fetch]="false"
[smart-read-requests-cancellable]="true">
</smart-data-source>
}
./smart-combo-editor.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 : smart-combo-editor.component.css
Purpose : Styles for Smart Combo Editor.
Author(s) : Radu Nicoara
Created : Dec 07, 2017
----------------------------------------------------------------------*/
::ng-deep [hidden] {
display: none !important;
}
/* the classes are not applied */
.popup-visible {
display: block;
}
.popup-hidden {
display: none;
}
/* Target the Kendo UI container that holds both image and text */
::ng-deep .k-input-value-text {
display: flex;
align-items: center;
}
/* Target dropdown list items in the popup */
::ng-deep .k-list-item {
display: flex;
align-items: center;
}
.template {
display: inline-flex;
align-items: center;
width: var(--kendo-spacing-4, 1rem); /* 16px equivalent */
margin-right: var(--kendo-spacing-1, 0.25rem); /* Add some spacing between image and text */
}
.item-image {
height: var(--kendo-spacing-4, 1rem); /* 16px equivalent */
width: auto;
max-width: 100%;
}
.item-icon {
margin-right: var(--kendo-spacing-1, 0.25rem);
}
.unfilterable-combobox-wrapper {
display: flex;
flex-direction: row;
gap: var(--kendo-spacing-1, 0.25rem);
.k-dropdownlist {
flex: 1;
}
}