UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

71 lines 3.8 kB
"use strict"; 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 __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); // (C) 2019-2020 GoodData Corporation var React = require("react"); var react_intl_1 = require("react-intl"); var Overlay_1 = require("@gooddata/goodstrap/lib/core/Overlay"); var IntlWrapper_1 = require("../../core/base/IntlWrapper"); var DropdownBody_1 = require("./DropdownBody"); var Operator = require("../../../constants/measureValueFilterOperators"); var DropdownControl_1 = require("../../../internal/components/configurationControls/DropdownControl"); var DropdownWrapped = /** @class */ (function (_super) { __extends(DropdownWrapped, _super); function DropdownWrapped() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.onApply = function (operator, value, treatNullValuesAsZero) { _this.props.onApply(operator, value, treatNullValuesAsZero); }; return _this; } DropdownWrapped.prototype.render = function () { var _a = this.props, operator = _a.operator, value = _a.value, usePercentage = _a.usePercentage, warningMessage = _a.warningMessage, locale = _a.locale, onCancel = _a.onCancel, anchorEl = _a.anchorEl, separators = _a.separators, displayTreatNullAsZeroOption = _a.displayTreatNullAsZeroOption, treatNullAsZeroValue = _a.treatNullAsZeroValue; var selectedOperator = operator !== null ? operator : Operator.ALL; return (React.createElement(Overlay_1.default, { alignTo: anchorEl, alignPoints: DropdownControl_1.DROPDOWN_ALIGMENTS, closeOnOutsideClick: true, closeOnParentScroll: true, closeOnMouseDrag: true, onClose: onCancel }, React.createElement(DropdownBody_1.DropdownBody, { operator: selectedOperator, value: value, usePercentage: usePercentage, warningMessage: warningMessage, locale: locale, onCancel: onCancel, onApply: this.onApply, separators: separators, displayTreatNullAsZeroOption: displayTreatNullAsZeroOption, treatNullAsZeroValue: treatNullAsZeroValue }))); }; DropdownWrapped.defaultProps = { value: {}, operator: null, displayTreatNullAsZeroOption: false, treatNullAsZeroValue: false, }; return DropdownWrapped; }(React.PureComponent)); exports.DropdownWithIntl = react_intl_1.injectIntl(DropdownWrapped); var Dropdown = /** @class */ (function (_super) { __extends(Dropdown, _super); function Dropdown() { return _super !== null && _super.apply(this, arguments) || this; } Dropdown.prototype.render = function () { return (React.createElement(IntlWrapper_1.IntlWrapper, { locale: this.props.locale }, React.createElement(exports.DropdownWithIntl, __assign({}, this.props)))); }; return Dropdown; }(React.PureComponent)); exports.Dropdown = Dropdown; //# sourceMappingURL=Dropdown.js.map