123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- '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. 2019, 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore', '../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../api/DataItemAPI', './api/QueryDataItemAPI'], function (_, APIFactory, DataItemAPI, QueryDataItemAPI) {
- var QueryDataItem = function (_QueryDataItemAPI) {
- _inherits(QueryDataItem, _QueryDataItemAPI);
- function QueryDataItem(metadataColumn, dataItemId, dataItem) {
- _classCallCheck(this, QueryDataItem);
- var _this = _possibleConstructorReturn(this, _QueryDataItemAPI.call(this, metadataColumn, dataItem));
- if (!metadataColumn) {
- throw new Error('Missing parameter: MetadataColumnAPI');
- }
- _this.metadataColumn = metadataColumn;
- _this.dataItemId = dataItemId;
- // declare the defaults
- _this.projected = true;
- _this.commandList = [];
- // apply the spec to the data item instance
- if (dataItem) {
- _.extend(_this, dataItem);
- }
- return _this;
- }
- QueryDataItem.prototype.getAPI = function getAPI() {
- if (!this.api) {
- this.api = APIFactory.createAPI(this, [DataItemAPI, QueryDataItemAPI]);
- }
- return this.api;
- };
- ///////////////////////////////////
- // QueryDataItemAPI implementation
- QueryDataItem.prototype.getProjected = function getProjected() {
- return this.projected;
- };
- QueryDataItem.prototype.setProjected = function setProjected(projected) {
- this.projected = projected;
- };
- QueryDataItem.prototype.getCommandList = function getCommandList() {
- return this.commandList;
- };
- QueryDataItem.prototype.addCommand = function addCommand(command) {
- this.commandList.push(command);
- };
- QueryDataItem.prototype.setType = function setType(type) {
- this.type = type;
- };
- ///////////////////////////////////
- // DataItemAPI implementation
- QueryDataItem.prototype.getId = function getId() {
- return this.dataItemId;
- };
- QueryDataItem.prototype.getLabel = function getLabel() {
- return this.metadataColumn.getLabel();
- };
- QueryDataItem.prototype.getColumnId = function getColumnId() {
- return this.metadataColumn.getId();
- };
- QueryDataItem.prototype.getDataType = function getDataType() {
- return this.metadataColumn.getDataType();
- };
- QueryDataItem.prototype.isDateOrTimeType = function isDateOrTimeType() {
- return this.metadataColumn.isDateTimeDataType();
- };
- QueryDataItem.prototype.getType = function getType() {
- return this.type || this.metadataColumn.getType();
- };
- QueryDataItem.prototype.getAggregation = function getAggregation() {
- return typeof this.aggregation !== 'undefined' ? this.aggregation : this._getDefaultAggregation();
- };
- QueryDataItem.prototype.setAggregation = function setAggregation() {
- var aggregation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- this.aggregation = aggregation;
- };
- QueryDataItem.prototype.getSort = function getSort() {
- if (this.sort) {
- return this.sort;
- }
- var metadataColumnSortType = this.metadataColumn.getDefaultSortType();
- if (metadataColumnSortType) {
- return {
- type: metadataColumnSortType,
- priority: 1
- };
- }
- };
- QueryDataItem.prototype.getTopBottom = function getTopBottom() {
- return this.topBottom;
- };
- QueryDataItem.prototype.getMetadataColumn = function getMetadataColumn() {
- return this.metadataColumn;
- };
- QueryDataItem.prototype.getFormat = function getFormat(options) {
- return this.format || this.metadataColumn.getFormat(options);
- };
- QueryDataItem.prototype.getBinning = function getBinning() {
- return this.binning;
- };
- QueryDataItem.prototype.getDrillUpValue = function getDrillUpValue() {
- return this.drillUpValue;
- };
- QueryDataItem.prototype.getDrillDownValue = function getDrillDownValue() {
- return this.drillDownValue;
- };
- QueryDataItem.prototype.hasDefaultAggregation = function hasDefaultAggregation() {
- return typeof this.aggregation === 'undefined';
- };
- QueryDataItem.prototype.hasDefaultSort = function hasDefaultSort() {
- return !this.sort;
- };
- QueryDataItem.prototype.hasDefaultFormat = function hasDefaultFormat() {
- return !this.format;
- };
- QueryDataItem.prototype.setSort = function setSort(sortSpec) {
- this.sort = sortSpec;
- };
- QueryDataItem.prototype.setFormat = function setFormat(formatSpec) {
- this.format = formatSpec;
- };
- QueryDataItem.prototype.setTopBottom = function setTopBottom(topBottomInfo) {
- this.topBottom = topBottomInfo;
- };
- QueryDataItem.prototype.setBinning = function setBinning(binningSpec) {
- this.binning = binningSpec;
- };
- QueryDataItem.prototype.canDrillDown = function canDrillDown() {
- return false;
- };
- QueryDataItem.prototype.drillUp = function drillUp(value) {
- this.drillUpValue = value;
- };
- QueryDataItem.prototype.drillDown = function drillDown(value) {
- this.drillDownValue = value;
- };
- QueryDataItem.prototype.clearDrill = function clearDrill() {
- delete this.drillUpValue;
- delete this.drillDownValue;
- };
- //////////////////////////////
- //QueryDataItem private function(s)
- QueryDataItem.prototype._getDefaultAggregation = function _getDefaultAggregation() {
- return this.metadataColumn.getDefaultAggregation();
- };
- return QueryDataItem;
- }(QueryDataItemAPI);
- return QueryDataItem;
- });
- //# sourceMappingURL=QueryDataItem.js.map
|