@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
67 lines • 4.11 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2019-2020 GoodData Corporation
var React = require("react");
var react_intl_1 = require("react-intl");
var noop = require("lodash/noop");
var Headline_1 = require("../headline/Headline");
var drilldownEventing_1 = require("../utils/drilldownEventing");
var drilldownEventingLegacy_1 = require("../utils/drilldownEventingLegacy");
var headerPredicate_1 = require("../../../helpers/headerPredicate");
var XirrTransformationUtils_1 = require("./utils/XirrTransformationUtils");
var XirrTransformation = /** @class */ (function (_super) {
__extends(XirrTransformation, _super);
function XirrTransformation() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getDisableDrillUnderlineFromConfig = function () {
return _this.props.config ? _this.props.config.disableDrillUnderline : false;
};
// legacy drill handling
_this.handleFiredDrillEvent = function (item, target) {
var _a = _this.props, onFiredDrillEvent = _a.onFiredDrillEvent, executionRequest = _a.executionRequest, executionResponse = _a.executionResponse;
var drillEventDataExtended = XirrTransformationUtils_1.buildDrillEventData(item, executionRequest, executionResponse);
var executionContext = drillEventDataExtended.executionContext, drillContext = drillEventDataExtended.drillContext;
var drillEventDataOld = {
executionContext: executionContext,
drillContext: drilldownEventingLegacy_1.convertDrillContextToLegacy(drillContext, executionContext),
};
drilldownEventing_1.fireDrillEvent(onFiredDrillEvent, drillEventDataOld, target);
};
_this.handleOnDrill = function (item) {
var _a = _this.props, executionRequest = _a.executionRequest, executionResponse = _a.executionResponse, onDrill = _a.onDrill;
var drillEventDataExtended = XirrTransformationUtils_1.buildDrillEventData(item, executionRequest, executionResponse);
onDrill(drillEventDataExtended);
};
return _this;
}
XirrTransformation.prototype.render = function () {
var _a = this.props, executionRequest = _a.executionRequest, executionResponse = _a.executionResponse, executionResult = _a.executionResult, drillableItems = _a.drillableItems, config = _a.config, onAfterRender = _a.onAfterRender;
var drillablePredicates = headerPredicate_1.convertDrillableItemsToPredicates(drillableItems);
var data = XirrTransformationUtils_1.getHeadlineData(executionResponse, executionResult);
var dataWithUpdatedDrilling = XirrTransformationUtils_1.applyDrillableItems(data, drillablePredicates, executionRequest, executionResponse);
var disableDrillUnderline = this.getDisableDrillUnderlineFromConfig();
return (React.createElement(Headline_1.default, { data: dataWithUpdatedDrilling, config: config, onFiredDrillEvent: this.handleFiredDrillEvent, onDrill: this.handleOnDrill, onAfterRender: onAfterRender, disableDrillUnderline: disableDrillUnderline }));
};
XirrTransformation.defaultProps = {
drillableItems: [],
onFiredDrillEvent: function () { return true; },
onDrill: noop,
onAfterRender: noop,
};
return XirrTransformation;
}(React.Component));
exports.default = react_intl_1.injectIntl(XirrTransformation);
//# sourceMappingURL=XirrTransformation.js.map