@progress/kendo-angular-navigation
Version:
Kendo UI Navigation for Angular
109 lines (108 loc) • 4.51 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 { HostBinding, Input, ElementRef, Component } from '@angular/core';
import { isPresent } from '../../common/util';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { chevronRightIcon, chevronLeftIcon } from '@progress/kendo-svg-icons';
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
const DEFAULT_ICON = 'chevron-right';
const DEFAULT_RTL_ICON = 'chevron-left';
const DEFAULT_SVG_ICON = chevronRightIcon;
const DEFAULT_RTL_SVG_ICON = chevronLeftIcon;
/**
* @hidden
*/
export class BreadCrumbSeparatorDirective {
el;
localization;
set icon(icon) {
if (isPresent(icon)) {
this._icon = icon;
this.hasDefaultIcon = false;
}
else {
this._icon = this.direction === 'ltr' ? DEFAULT_ICON : DEFAULT_RTL_ICON;
this.hasDefaultIcon = true;
}
}
get icon() {
return this._icon;
}
set svgIcon(svgIcon) {
if (isPresent(svgIcon)) {
this._svgIcon = svgIcon;
this.hasDefaultSvgIcon = false;
}
else {
this._svgIcon = this.direction === 'ltr' ? DEFAULT_SVG_ICON : DEFAULT_RTL_SVG_ICON;
this.hasDefaultSvgIcon = true;
}
}
get svgIcon() {
return this._svgIcon;
}
ariaHidden = true;
_icon;
_svgIcon;
hasDefaultIcon;
hasDefaultSvgIcon;
direction = 'ltr';
localizationChangesSubscription;
constructor(el, localization) {
this.el = el;
this.localization = localization;
this.direction = this.localization.rtl ? 'rtl' : 'ltr';
}
ngOnInit() {
this.localizationChangesSubscription = this.localization.changes.subscribe(({ rtl }) => {
this.direction = rtl ? 'rtl' : 'ltr';
if (this.hasDefaultIcon) {
this.icon = undefined;
}
if (this.hasDefaultSvgIcon) {
this.svgIcon = undefined;
}
});
}
ngOnDestroy() {
this.localizationChangesSubscription.unsubscribe();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BreadCrumbSeparatorDirective, deps: [{ token: i0.ElementRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BreadCrumbSeparatorDirective, isStandalone: true, selector: "[kendoBreadCrumbSeparator]", inputs: { icon: "icon", svgIcon: "svgIcon" }, host: { properties: { "attr.aria-hidden": "this.ariaHidden" } }, ngImport: i0, template: `
<kendo-icon-wrapper
size='xsmall'
[name]="icon"
[svgIcon]="svgIcon"
innerCssClass="k-breadcrumb-delimiter-icon"
>
</kendo-icon-wrapper>
`, isInline: true, dependencies: [{ 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: BreadCrumbSeparatorDirective, decorators: [{
type: Component,
args: [{
selector: '[kendoBreadCrumbSeparator]',
template: `
<kendo-icon-wrapper
size='xsmall'
[name]="icon"
[svgIcon]="svgIcon"
innerCssClass="k-breadcrumb-delimiter-icon"
>
</kendo-icon-wrapper>
`,
standalone: true,
imports: [IconWrapperComponent]
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.LocalizationService }]; }, propDecorators: { icon: [{
type: Input
}], svgIcon: [{
type: Input
}], ariaHidden: [{
type: HostBinding,
args: ['attr.aria-hidden']
}] } });