UNPKG

armisa-models

Version:
57 lines (56 loc) 2.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolStripFactory = void 0; class ToolStripFactory { get any() { return this; } get toolStripItems() { return this._toolStripItems; } constructor(elementsOfFormFactory) { this.elementsOfFormFactory = elementsOfFormFactory; this.refreshDisabled = () => { if (this._toolStripItems && this._toolStripItems.length) { this._toolStripItems.forEach(item => { if (typeof item.refreshDisabled === 'function') { item.disabled = item.refreshDisabled(); } }); } }; this.refreshVisible = () => { if (this._toolStripItems && this._toolStripItems.length) { this._toolStripItems.forEach(item => { if (typeof item.refreshVisible === 'function') { item.visible = item.refreshVisible(); } }); } }; this.forceUpdateToolStripButtonItems = () => { }; this.forceUpdateToolStripItem = () => { }; this.forceUpdateToolStackMenu = () => { }; this.addToolStripItem = (item) => { this._toolStripItems.push(item); this._toolStripItems.sort((a, b) => a.tabIndex - b.tabIndex); if (typeof item.tabIndex === 'number') { this.elementsOfFormFactory.tabbing.toolboxTabbing.mainFocusAbleToolbox.push(item); this.elementsOfFormFactory.tabbing.toolboxTabbing.mainFocusAbleToolbox.sort((a, b) => a.tabIndex - b.tabIndex); } }; this.removeToolStripItem = (icon) => { delete this.any[icon.factoryFieldName]; this._toolStripItems = this._toolStripItems.filter(i => i !== icon); this.elementsOfFormFactory.tabbing.toolboxTabbing.mainFocusAbleToolbox = this.elementsOfFormFactory.tabbing.toolboxTabbing.mainFocusAbleToolbox.filter(i => i !== icon); this._toolStripItems.sort((a, b) => a.tabIndex - b.tabIndex); }; this.focusToThisToolStripItem = (toolStripItem) => { this.elementsOfFormFactory.tabbing.toolboxTabbing.focuseToThisToolStripItem(toolStripItem); }; this.mainStateFactory = this.elementsOfFormFactory.mainStateFactory; this.mainStateManager = this.elementsOfFormFactory.mainStateManager; this._toolStripItems = []; } } exports.ToolStripFactory = ToolStripFactory;