'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2019 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../lib/@waca/core-client/js/core-client/ui/core/Class', 'underscore', '../../lib/@waca/dashboard-common/dist/core/APIFactory', '../LayoutAPI', '../deprecated/LayoutAPI'], function (Class, _, APIFactory, LayoutAPI, DeprecatedLayoutAPI) { var LayoutAPIImpl = Class.extend({ model: null, controller: null, /** * Constructor * * @param {LayoutController} controller - layout controller */ init: function init(controller) { this.model = controller.model; this.controller = controller; this.layoutController = controller.layoutController; }, destroy: function destroy() { this.model = null; this.controller = null; this.layoutController = null; }, /** * Layout id getter * @return {string} layout id */ getId: function getId() { return this.model.id; }, /** * Get layout children * * @return {LayoutAPI[]} array of children layout APIs */ getChildren: function getChildren() { var _this = this; return this.model.items.map(function (_ref) { var id = _ref.id; var layout = _this.layoutController.getView(id); if (layout && layout.view && layout.view.getAPI) { return layout.view.getAPI(); } }).filter(function (item) { return !!item; }); }, /** * Show layout * * @param {object} options - Rendering Options * Supported options: * isBackgroundRun:true|false // Indicate that the rendering is non-interactive (for use by thumbnails) * */ render: function render(options) { this.controller.render(options); }, /** * Get layout ratio from parent layout * @return {Object} ratio; has properties `width` and `height` with the appropriate ratios */ getSelfRatio: function getSelfRatio() { return this.controller.getSelfRatio(); }, /** * Get parent layout API * * @return {Object} */ getParentLayout: function getParentLayout() { return this.controller.getParentLayout(); }, /** * Get widget API * * @return {WidgetAPI} widget API */ getWidgetAPI: function getWidgetAPI() { return this.controller.widgetAPI; }, getAPI: function getAPI() { return APIFactory.createAPI(this, [LayoutAPI, DeprecatedLayoutAPI]); }, getChildrenList: function getChildrenList() { return this.getChildren(); }, getWidget: function getWidget() { return this.getWidgetAPI(); } }); return LayoutAPIImpl; }); //# sourceMappingURL=Layout.js.map