UNPKG

@gooddata/react-components

Version:

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

56 lines 2.53 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); // (C) 2007-2019 GoodData Corporation var React = require("react"); var react_intl_1 = require("react-intl"); var Button_1 = require("@gooddata/goodstrap/lib/Button/Button"); var TableControlsClass = /** @class */ (function (_super) { __extends(TableControlsClass, _super); function TableControlsClass() { return _super !== null && _super.apply(this, arguments) || this; } TableControlsClass.prototype.render = function () { return (React.createElement("div", { className: "indigo-button-bar" }, this.renderMore(), this.renderLess())); }; TableControlsClass.prototype.getMessage = function (id) { return this.props.intl.formatMessage({ id: "visualizations." + id }); }; TableControlsClass.prototype.renderMore = function () { if (!this.props.isMoreButtonVisible || this.props.isMoreButtonDisabled) { return null; } var label = this.getMessage("more"); return (React.createElement(Button_1.default, { className: "gd-button-secondary gd-button-small", onClick: this.props.onMore, value: label, title: label })); }; TableControlsClass.prototype.renderLess = function () { if (!this.props.isLessButtonVisible) { return null; } var label = this.getMessage("less"); return (React.createElement(Button_1.default, { className: "gd-button-small gd-button-link-dimmed", onClick: this.props.onLess, value: label, title: label })); }; TableControlsClass.defaultProps = { isMoreButtonDisabled: false, isMoreButtonVisible: false, isLessButtonVisible: false, }; return TableControlsClass; }(React.Component)); exports.TableControlsClass = TableControlsClass; exports.TableControls = react_intl_1.injectIntl(TableControlsClass); //# sourceMappingURL=TableControls.js.map