123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- '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'], function (Class) {
- var METHODS = {
- API_METHODS: ['getId', 'getChildren', 'render', 'getSelfRatio', 'getParentLayout', 'getWidgetAPI']
- };
- var LayoutAPI = 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;
- },
- /**
- * 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;
- }
- });
- LayoutAPI.API_METHODS = METHODS.API_METHODS;
- return LayoutAPI;
- });
- //# sourceMappingURL=LayoutApi.js.map
|