'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2018 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['./LayoutBaseView'], function (BaseClass) { var Widget = null; Widget = BaseClass.extend({ init: function init(options) { Widget.inherited('init', this, arguments); this.widgetChromeEventRouter = options.widgetChromeEventRouter || this.consumeView.widgetChromeEventRouter; //overrides this.specializeConsumeView(['getContextToolbarItems', 'onSelect', 'onDeselect', 'onShow']); this._aHandles = []; if (this.widgetChromeEventRouter) { this.widgetChromeEventRouter.trigger('widget:onAuthoringMode'); } }, destroy: function destroy() { this.commonAuthoringFeature.destroy(); for (var i = 0, iLen = this._aHandles.length; i < iLen; i++) { this._aHandles[i].off(); } this._aHandles = null; Widget.inherited('destroy', this, arguments); if (this.widgetChromeEventRouter) { var eventName; if (this.layoutController.isEventGroupMode) { eventName = 'widget:onEventGroupMode'; } else { eventName = 'widget:onConsumeMode'; } this.widgetChromeEventRouter.trigger(eventName); } }, onResizeStep: function onResizeStep() { this.commonAuthoringFeature.onResizeStep(); }, getContextToolbarItems: function getContextToolbarItems() { var includeToolbaritems = this.consumeView.widgetAPI && !this.consumeView.widgetAPI.getError(); return { items: includeToolbaritems ? this.consumeView.widgetAPI.getContextToolbarItems() : [] }; }, onSelect: function onSelect(isGroupSelect) { if (this.widgetChromeEventRouter) { this.widgetChromeEventRouter.trigger('widgetchrome:selected', isGroupSelect); } }, onDeselect: function onDeselect() { if (this.widgetChromeEventRouter) { this.widgetChromeEventRouter.trigger('widgetchrome:deselected'); } }, onShow: function onShow(options) { this.overridden.onShow(options); } }); return Widget; }); //# sourceMappingURL=Widget.js.map