src/ui/toolbar/controls/toolbar-control/smart-toolbar-control.component.ts
ToolBarToolComponent
| changeDetection | ChangeDetectionStrategy.Eager |
| providers |
)
|
| selector | smart-toolbar-control |
| styleUrls | ./smart-toolbar-control.component.css |
| templateUrl | ./smart-toolbar-control.component.html |
Properties |
Inputs |
Outputs |
Accessors |
| isLast |
Type : boolean
|
|
Sets whether this is the last control in the toolbar. |
| isLastVisible |
Type : boolean
|
|
Sets whether this is the last visible control in the toolbar. |
| sourceControl |
Type : any
|
|
Sets the source control instance for the toolbar control. |
| onClick |
Type : EventEmitter<void>
|
| destroyed$ |
Type : Subject<boolean>
|
Default value : new Subject()
|
| popupTemplate |
Type : TemplateRef<any>
|
Decorators :
@ViewChild('toolTemplate', {static: true})
|
| toolbarTemplate |
Type : TemplateRef<any>
|
Decorators :
@ViewChild('toolTemplate', {read: TemplateRef, static: true})
|
| sourceControl | ||||||||
getsourceControl()
|
||||||||
|
Returns the source control instance for the toolbar control.
Returns :
any
|
||||||||
setsourceControl(value: any)
|
||||||||
|
Sets the source control instance for the toolbar control.
Parameters :
Returns :
void
|
| isLast | ||||||||
getisLast()
|
||||||||
|
Returns whether this is the last control in the toolbar.
Returns :
boolean
|
||||||||
setisLast(value: boolean)
|
||||||||
|
Sets whether this is the last control in the toolbar.
Parameters :
Returns :
void
|
| isLastVisible | ||||||||
getisLastVisible()
|
||||||||
|
Returns whether this is the last visible control in the toolbar.
Returns :
boolean
|
||||||||
setisLastVisible(value: boolean)
|
||||||||
|
Sets whether this is the last visible control in the toolbar.
Parameters :
Returns :
void
|
| controlType |
getcontrolType()
|
|
Returns the control type.
Returns :
"separator" | "button" | "dropdown" | "custom" | undefined
|
| comboEditor | ||||||
setcomboEditor(value: SmartComboEditorComponent)
|
||||||
|
Parameters :
Returns :
void
|
| comboEditorDomElement | ||||||
setcomboEditorDomElement(value: ElementRef
|
||||||
|
Parameters :
Returns :
void
|
| comboContentdomElement | ||||||
setcomboContentdomElement(value: ElementRef)
|
||||||
|
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 : smart-toolbar-control.component.html
Purpose : Template for Smart Toolbar Control.
Author(s) : Radu Nicoara
Created : Dec 09, 2022
--------------------------------------------------------------------------
-->
<ng-template #toolTemplate>
<div
class="align-items-center"
[class.d-flex]="overflows"
[class.is-last]="_isLastSignal()"
[class.gap-1]="!overflows">
@switch (controlTypeSignal() || 'none') {
@case ('button') {
<button
[imageUrl]="_sourceControlSignal()._imageUrlSignal()"
[iconClass]="_sourceControlSignal()._buttonIconSignal()"
[title]="_sourceControlSignal().tooltip || _sourceControlSignal().label?.replace(_sourceControlSignal().label.charAt(0), _sourceControlSignal().label.charAt(0).toUpperCase())"
class="smart-toolbar-button smart-toolbar-item d-flex align-items-center"
[class.is-popup]="overflows"
[class.w-100]="overflows"
[class.text-start]="overflows"
[class.justify-content-center]="!overflows"
[class.justify-content-start]="overflows"
#buttonControl
type="button"
kendoButton
[disabled]="_sourceControlSignal().disabled === true"
[fillMode]="'flat'"
(click)="_sourceControlSignal().onClick.next() && buttonControl.blur()">
@if ((!!_sourceControlSignal()._imageUrlSignal() || !!_sourceControlSignal()._buttonIconSignal()) && !!_sourceControlSignal().label && _sourceControlSignal().label !== '') {
<span class="me-2"></span>
}
<span class="toolbar-button-text">{{_sourceControlSignal().label}}</span>
</button>
}
@case ('separator') {
@if (!_isLastVisibleSignal() || !overflows) {
<div [class.is-popup]="overflows" [class.mx-2]="!overflows">
<div class="smart-toolbar-separator smart-toolbar-item"></div>
</div>
}
}
@case ('dropdown') {
<div #comboContent class="combo-btn-wrap" [class.is-popup]="overflows" [class.d-flex]="overflows" [class.flex-fill]="overflows">
<smart-combo-editor
#toolbarCombo
[class.is-popup]="overflows" [class.w-100]="overflows"
[value-list]="_sourceControlSignal().valueList"
[value-list-pair]="_sourceControlSignal().valueListPair"
class="smart-toolbar-item smart-combo-button">
</smart-combo-editor>
</div>
}
@case ('custom') {
<smart-toolbar-item-renderer
[componentId]="_sourceControlSignal().componentId"
[componentContext]="_sourceControlSignal().bindingContext"
class="d-flex align-items-center">
</smart-toolbar-item-renderer>
}
@default {
<div></div>
}
}
</div>
</ng-template>
./smart-toolbar-control.component.css
/**********************************************************************
* 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-toolbar-control.component.css
Purpose : Styles for Smart Toolbar Control.
Author(s) : Oana Sucigan
Created : Sep 05, 2023
----------------------------------------------------------------------*/
.is-popup {
flex: 1;
}
button.is-popup {
text-align: left;
display: flex !important;
align-items: center;
justify-content: flex-start !important;
background-color: var(--kendo-color-surface, #ffffff);
border: 1px solid var(--kendo-color-border, #d7d2d0);
border-radius: var(--kendo-border-radius-sm, 0.125rem);
padding: var(--kendo-spacing-2, 0.5rem) var(--kendo-spacing-3, 0.75rem);
color: var(--kendo-color-on-app-surface, #3d3d3d);
width: 100%;
margin-bottom: var(--kendo-spacing-1, 0.25rem);
min-height: var(--kendo-spacing-8, 2rem);
}
button.is-popup:hover {
background-color: var(--kendo-color-base-hover, #f5f5f5);
}
button.is-popup:focus {
background-color: var(--kendo-color-base-hover, #f5f5f5);
outline: 2px solid var(--kendo-color-primary, #0078d4);
outline-offset: -2px;
}
/* Ensure icon and text spacing in popup buttons */
button.is-popup .toolbar-button-text {
flex: 1;
text-align: left;
}
/* Icon spacing for popup buttons */
button.is-popup .k-icon,
button.is-popup .k-svg-icon,
button.is-popup [class*="fa-"] {
margin-right: var(--kendo-spacing-3, 0.75rem) !important;
}
.smart-toolbar-separator.is-popup {
border-right: none !important;
border-left: none !important;
}
.smart-toolbar-separator {
margin-right: 0px !important;
}
::ng-deep kendo-popup .smart-toolbar-item {
margin: var(--kendo-spacing-2, 0.5rem) var(--kendo-spacing-2, 0.5rem) 0 var(--kendo-spacing-2, 0.5rem) !important;
}
::ng-deep kendo-popup .is-last .smart-toolbar-item {
margin-bottom: var(--kendo-spacing-2, 0.5rem) !important;
}