'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2021 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @interface DataItemAPI * @classdesc API class that is used to work with data items. * @example slots.getDataItem() * @example slots.getDataItemList()[] * @example slots.getMappingInfoList()[].dataItem */ define([], function () { var DataItemAPI = function () { function DataItemAPI() { _classCallCheck(this, DataItemAPI); } /** * @description Returns the unique ID that identifies the given data item. * * @function DataItemAPI#getId * @public * * @return {String} ID of the data item */ DataItemAPI.prototype.getId = function getId() {}; // setLabel is not exposed as API. It is not needed for now. // /** // * @description Set dataitem label. // * // * @function DataItemAPI#setLabel // * @private // * // * @param {String} label // */ // setLabel() { } /** * @description Returns the data item label. * * @function DataItemAPI#getLabel * @public * * @return {String} Label of the data item */ DataItemAPI.prototype.getLabel = function getLabel() {}; /** * @description Returns the item ID that this data item references. An item ID is the metadata columnId. * * @function DataItemAPI#getColumnId * @public * * @return {String} columnId */ DataItemAPI.prototype.getColumnId = function getColumnId() {}; /** * @description Returns the navigation path ID associated with this data item. * * @function DataItemAPI#getNavigationPathId * @private * * @return {String} navigationPathId */ DataItemAPI.prototype.getNavigationPathId = function getNavigationPathId() {}; /** * @description Sets the navigation path ID associated with this data item. * * @function DataItemAPI#setNavigationPathId * @private * * @param {String} id * @param {transactionToken} [transactionToken] * */ DataItemAPI.prototype.setNavigationPathId = function setNavigationPathId() {}; /** * @description Returns the item data type. * @function DataItemAPI#getDataType * @public * * @return {String} dataType { 'string' | 'decimal' } */ DataItemAPI.prototype.getDataType = function getDataType() {}; /** * @description Returns true if the data item is a data or time type. Data or time types include: date, datetime, time, year. * @function DataItemAPI#isDateOrTimeType * @private * * @return {Boolean} isDateOrTimeType */ DataItemAPI.prototype.isDateOrTimeType = function isDateOrTimeType() {}; /** * @description Returns the type of the data item. The type can be either 'attribute' or 'fact'. * @function DataItemAPI#getType * @public * * @return {String} type */ DataItemAPI.prototype.getType = function getType() {}; /** * @description Returns the data item aggregation type. * @function DataItemAPI#getAggregation * @public * * @return {String} aggregationType is explicitly set, or has a value, otherwise the default metadata aggregation value * */ DataItemAPI.prototype.getAggregation = function getAggregation() {}; /** * @description Sets the data item aggregation type. * @function DataItemAPI#setAggregation * @public * * @param {aggregation} [aggregation = null] * @param {transactionToken} [transactionToken] */ DataItemAPI.prototype.setAggregation = function setAggregation() /*aggregation, transactionToken*/{}; /** * @description Returns true if the data item aggregation type was not explicitly set. * @function DataItemAPI#hasDefaultAggregation * @public * * @return {Boolean} hasDefaultAggregation * */ DataItemAPI.prototype.hasDefaultAggregation = function hasDefaultAggregation() {}; /** * @description Returns true if the data item sort type was not explicitly set. * @function DataItemAPI#hasDefaultSort * @public * * @return {Boolean} hasDefaultSort * */ DataItemAPI.prototype.hasDefaultSort = function hasDefaultSort() {}; /** * @description Returns true if the data item format type was not explicitly set. * @function DataItemAPI#hasDefaultFormat * @public * * @return {Boolean} hasDefaultFormat * */ DataItemAPI.prototype.hasDefaultFormat = function hasDefaultFormat() {}; /** * @description Returns the column metadata that is associated with this data item. * * @function DataItemAPI#getMetadataColumn * @private * * @return {MetadataColumnAPI} columnMetadata returns null if the metadata item is not available */ DataItemAPI.prototype.getMetadataColumn = function getMetadataColumn() {}; /** * @description Returns the data format for this data item. * @function DataItemAPI#getFormat * @public * * @param {Object} options ignoreDefaultFormatting (ignore any default formatting) * @return {FormatSpec} Format spec */ DataItemAPI.prototype.getFormat = function getFormat() /* options */{}; /** * @description Sets the format spec for the given data item. * @function DataItemAPI#setFormat * @public * * @param {FormatSpec} formatSpec * @param {transactionToken} transactionToken * */ DataItemAPI.prototype.setFormat = function setFormat() /*formatSpec, transactionToken*/{}; /** * @description Gets the effective sort spec. If a user sort is set, then it is returned. Otherwise, the default sort is returned. * * @function DataItemAPI#getSort * @public * @return {SortSpec} * * @example * { * type: String ('asc' | 'desc' | 'null'), * priority: Number, * by: String ('caption' | 'value'), * context: String (column id used for the sort context) * custom: Object (specify sort overrides) * custom.top: String[] (Use values of members to move to the top of the sorted list) * custom.enabled: Boolean (indicate if custom sort is enabled) * } * */ DataItemAPI.prototype.getSort = function getSort() {}; /** * @description Gets the top/bottom information that is set on the data item. * @function DataItemAPI#getTopBottom * @public * @example * { * type: String ('topcount' | 'toppercent' | 'bottomcount' | 'bottompercent'), * value: Number, * rank: boolean * context: Object (with itemId and aggregate) * } * * @return {TopBottomInfo} * */ DataItemAPI.prototype.getTopBottom = function getTopBottom() {}; /** * @description Sets the top/bottom information on the data item. * @function DataItemAPI#setTopBottom * @public * * @example * { * type: String ('topcount' | 'toppercent' | 'bottomcount' | 'bottompercent'), * value: Number, * rank: boolean, * context: measure (column id) can be used when the topbottom applied on the categories * } * * @param {TopBottomInfo} topBottomInfo * @param {transactionToken} transactionToken * */ DataItemAPI.prototype.setTopBottom = function setTopBottom() /* topBottomInfo, transactionToken */{}; /** * @description Returns true if the data item is a hierarchy and we can drill down. * @function DataItemAPI#canDrillDown * @public * * @return {Boolean} canDrillDown */ DataItemAPI.prototype.canDrillDown = function canDrillDown() {}; /** * @description Drill down in a data item. * * @function DataItemAPI#drillDown * @public * * @param {String} value * @param {transactionToken} transactionToken * * */ DataItemAPI.prototype.drillDown = function drillDown() /* value, transactionToken */{}; /** * @description Gets the drill down value (member id) if a drill down is set. * * @function DataItemAPI#getDrillDownValue * @public * * @return {String} drillDown value */ DataItemAPI.prototype.getDrillDownValue = function getDrillDownValue() {}; /** * @description Drill up in a data item. * * @function DataItemAPI#drillUp * @public * * @param {String} value * @param {transactionToken} transactionToken * * */ DataItemAPI.prototype.drillUp = function drillUp() /* value, transactionToken */{}; /** * @description Gets the drill up value (member id) if a drill up is set. * * @function DataItemAPI#getDrillDownValue * @public * * @return {String} drillUp value */ DataItemAPI.prototype.getDrillUpValue = function getDrillUpValue() {}; /** * @description Clears the drill up or down selection. * * @function DataItemAPI#clearDrill * @public * * @param {transactionToken} transactionToken */ DataItemAPI.prototype.clearDrill = function clearDrill() {}; /** * @description Enables binning in the data item. * @function DataItemAPI#setBinning * @private * * @param {BinningSpec} binningSpec - null to clear the binning * @param {transactionToken} transactionToken * */ DataItemAPI.prototype.setBinning = function setBinning() /* binningSpec, transactionToken */{}; /** * @description Gets the binning json object if specified for this data item. * @function DataItemAPI#getBinning * @private * * @return {BinningSpec} Returns binning spec. If there is no binning, returns undefined. */ DataItemAPI.prototype.getBinning = function getBinning() {}; /** * @description Returns true if the model sort type has been set. * @function DataItemAPI#hasModelSort * @private * * @return {Boolean} hasModelSort */ DataItemAPI.prototype.hasModelSort = function hasModelSort() {}; /** * @description Sets the type, sort-by method and priority of sort on the data item. * * @function DataItemAPI#setSort * @public * @param {SortSpec} sortSpec * @param {transactionToken} transactionToken * */ DataItemAPI.prototype.setSort = function setSort() /* sortSpec, transactionToken */{}; /** * @description Gets the union information that is set on the data item. * @function DataItemAPI#getUnion * @private * @return {UnionAPI} */ DataItemAPI.prototype.getUnion = function getUnion() {}; /** * @description Indicates if the data item is not available. Returns true if the column was deleted or hidden. * @function DataItemAPI#isUnavailable * @public * @return {Boolean} */ DataItemAPI.prototype.isColumnUnavailable = function isColumnUnavailable() {}; /** * @description Serialize the set of actions/parameters applied to a dataItem (eg sort or topbottom) as a JSON object array. * This function can be used to make API calls to re-apply actions to re-construct a basic dataItem with columnId from scratch * in a widgetspec-agnostic way. * @function DataItemAPI#serializeActions * @example * [{ * name: 'setSort', * params: [{ type: 'desc' }] * },{ * name: 'setTopBottom', * params: [{ type: 'topcount', value: '2', context: { itemId: 'Sales.Revenue' }}] * }] * @return {Object} the actions serialized as a JSON object. */ DataItemAPI.prototype.serializeActions = function serializeActions() {}; return DataItemAPI; }(); /** * @description Enum for all supported topbottom type. * @readonly * @enum {String} * @constant * @memberOf DataItemAPI */ DataItemAPI.TOPBOTTOM_TYPE = { topcount: 'topcount', toppercent: 'toppercent', bottomcount: 'bottomcount', bottompercent: 'bottompercent' }; /** * @description Enum for all supported aggregation type. * @readonly * @enum {String} * @constant * @memberOf DataItemAPI */ DataItemAPI.AGGREGATION_TYPE = { none: 'none', average: 'avg', automatic: 'automatic', calculated: 'calculated', count: 'count', countDistinct: 'countdistinct', maximum: 'max', median: 'median', minimum: 'min', standardDeviation: 'stddev', total: 'sum', variance: 'variance' }; return DataItemAPI; }); //# sourceMappingURL=DataItemAPI.js.map