'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * 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(['@waca/dashboard-common/js/core/APIFactory', '@waca/dashboard-livewidget/js/features/dashboard/queryService/api/ResultItemAPI', '@waca/dashboard-livewidget/js/widgets/livewidget/query/QueryResultDataItem', './QueryResultColumn', 'underscore'], function (APIFactory, ResultItemAPI, QueryResultDataItem, QueryResultColumn, _) { var ResultItem = function (_QueryResultDataItem) { _inherits(ResultItem, _QueryResultDataItem); function ResultItem(dataItemObject) { _classCallCheck(this, ResultItem); var _this = _possibleConstructorReturn(this, _QueryResultDataItem.call(this, dataItemObject)); _this.getRowCount = _this.getTupleCount.bind(_this); return _this; } ResultItem.prototype.getAPI = function getAPI() { if (!this.api) { this.api = APIFactory.createAPI(this, [ResultItemAPI]); } return this.api; }; ResultItem.prototype.getDataItemList = function getDataItemList() { var resultColumnList = this.getTupleHeaders()[0]; return _.map(resultColumnList, function (columnObj) { return new QueryResultColumn(columnObj).getAPI(); }); }; ResultItem.prototype.getId = function getId() { return this._getTupleHeaderObjects()[0].id; }; //TODO: delete memberObj.u and memberObj.d when all consumers are ready to new qeury APIs ResultItem.prototype.getValue = function getValue(rowIndex) { var tuple = this.getTuple(rowIndex); tuple.forEach(function (memberObj) { if (memberObj.value === undefined) { memberObj.value = memberObj.u; memberObj.label = memberObj.d; } }); return tuple; }; return ResultItem; }(QueryResultDataItem); return ResultItem; }); //# sourceMappingURL=ResultItem.js.map