123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- '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(<dataItemId>)
- * @example slots.getDataItemList()[<index>]
- * @example slots.getMappingInfoList()[<index>].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
|