@progress/kendo-angular-menu
Version:
Kendo UI Angular Menu component
47 lines (46 loc) • 2.1 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 { Directive } from '@angular/core';
import { MenuBase } from '../menu-base';
import * as i0 from "@angular/core";
import * as i1 from "../menu-base";
const ITEM_FIELDS = ['textField', 'urlField', 'iconField', 'svgIconField', 'disabledField', 'cssClassField', 'cssStyleField', 'separatorField'];
/**
* @hidden
*/
export class BindingDirectiveBase {
menu;
data;
fields;
constructor(menu) {
this.menu = menu;
}
ngOnChanges() {
this.rebind();
}
/**
* Rebinds the Menu items.
*/
rebind() {
const fields = this.fields = [];
for (let idx = 0; idx < ITEM_FIELDS.length; idx++) {
const inputName = ITEM_FIELDS[idx];
const inputValue = this[inputName];
if (inputValue) {
fields.push({ target: inputName.replace('Field', ''), source: inputValue });
}
}
this.menu.items = this.data ? this.mapItems(this.data) : [];
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BindingDirectiveBase, deps: [{ token: i1.MenuBase }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: BindingDirectiveBase, selector: "kendoBindingBase", usesOnChanges: true, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BindingDirectiveBase, decorators: [{
type: Directive,
args: [{
// eslint-disable-next-line
selector: 'kendoBindingBase'
}]
}], ctorParameters: function () { return [{ type: i1.MenuBase }]; } });