@progress/kendo-angular-navigation
Version:
Kendo UI Navigation for Angular
108 lines (107 loc) • 5.71 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, Input, TemplateRef, HostBinding } from "@angular/core";
import { NgIf, NgTemplateOutlet } from "@angular/common";
import { isPresent, hexColorRegex } from "../common/util";
import { IconWrapperComponent } from "@progress/kendo-angular-icons";
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class ActionSheetItemComponent {
itemTemplate;
item;
pointerClass = true;
manageIconClasses(item) {
const classes = ['k-actionsheet-item-icon'];
const isHexColor = isPresent(item.iconColor) && hexColorRegex.test(item.iconColor);
const isThemeColor = isPresent(item.iconColor) && item.iconColor !== '' && !isHexColor;
if (isThemeColor) {
classes.push(`k-text-${item.iconColor}`);
}
return classes.join(' ');
}
manageIconStyles(item) {
const isHexColor = isPresent(item.iconColor) && hexColorRegex.test(item.iconColor);
const isSizeSet = isPresent(item.iconSize) && item.iconSize !== '';
const styles = {};
if (isHexColor) {
styles.color = item.iconColor;
}
if (isSizeSet) {
styles.fontSize = item.iconSize;
}
return styles;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ActionSheetItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ActionSheetItemComponent, isStandalone: true, selector: "[kendoActionSheetItem]", inputs: { itemTemplate: "itemTemplate", item: "item" }, host: { properties: { "class.k-cursor-pointer": "this.pointerClass" } }, ngImport: i0, template: `
<ng-template *ngIf="itemTemplate; else defaultTemplate"
[ngTemplateOutlet]="itemTemplate"
[ngTemplateOutletContext]="{
$implicit: item
}">
</ng-template>
<ng-template #defaultTemplate>
<span class="k-actionsheet-action">
<span *ngIf="item.icon || item.iconClass || item.svgIcon" class="k-icon-wrap">
<kendo-icon-wrapper
[name]="item.icon"
[customFontClass]="item.iconClass"
[class]="manageIconClasses(item)"
[svgIcon]="item.svgIcon"
[style]="manageIconStyles(item)"
>
</kendo-icon-wrapper>
</span>
<span *ngIf="item.title || item.description" class="k-actionsheet-item-text">
<span *ngIf="item.title" class="k-actionsheet-item-title">{{item.title}}</span>
<span *ngIf="item.description" class="k-actionsheet-item-description">{{item.description}}</span>
</span>
</span>
</ng-template>
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ActionSheetItemComponent, decorators: [{
type: Component,
args: [{
// eslint-disable-next-line @angular-eslint/component-selector
selector: '[kendoActionSheetItem]',
template: `
<ng-template *ngIf="itemTemplate; else defaultTemplate"
[ngTemplateOutlet]="itemTemplate"
[ngTemplateOutletContext]="{
$implicit: item
}">
</ng-template>
<ng-template #defaultTemplate>
<span class="k-actionsheet-action">
<span *ngIf="item.icon || item.iconClass || item.svgIcon" class="k-icon-wrap">
<kendo-icon-wrapper
[name]="item.icon"
[customFontClass]="item.iconClass"
[class]="manageIconClasses(item)"
[svgIcon]="item.svgIcon"
[style]="manageIconStyles(item)"
>
</kendo-icon-wrapper>
</span>
<span *ngIf="item.title || item.description" class="k-actionsheet-item-text">
<span *ngIf="item.title" class="k-actionsheet-item-title">{{item.title}}</span>
<span *ngIf="item.description" class="k-actionsheet-item-description">{{item.description}}</span>
</span>
</span>
</ng-template>
`,
standalone: true,
imports: [NgIf, NgTemplateOutlet, IconWrapperComponent]
}]
}], propDecorators: { itemTemplate: [{
type: Input
}], item: [{
type: Input
}], pointerClass: [{
type: HostBinding,
args: ['class.k-cursor-pointer']
}] } });