File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/ui/navigationpanel/src/navigation.js
Back
import { Dom, Tag, Type } from 'main.core'; import NavigationItem from './item'; import 'ui.fonts.opensans'; import './style.css'; export default class NavigationPanel { constructor(options) { this.target = Type.isDomNode(options.target) ? options.target : null; this.items = Type.isArray(options.items) ? options.items : []; this.container = null; this.keys = []; } adjustItem() { this.items = this.items.map((item) => { this.keys.push(item.id); return new NavigationItem({ id: item.id ? item.id : null, title: item.title ? item.title : null, active: item.active ? item.active : false, events: item.events ? item.events : null, link: item.link ? item.link : null, }); }) } getItemById(value) { if (value) { const id = this.keys.indexOf(value); return this.items[id]; } } getContainer() { if (!this.container) { this.container = Tag.render` <div class="ui-nav-panel ui-nav-panel__scope"></div> `; } return this.container; } render() { this.items.forEach((item) => { if (item instanceof NavigationItem) { this.getContainer().appendChild(item.getContainer()); } }) Dom.clean(this.target); this.target.appendChild(this.getContainer()); } init() { this.adjustItem(); this.render(); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings