UNPKG

@gooddata/react-components

Version:

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

62 lines 2.56 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-2020 GoodData Corporation var React = require("react"); var PropTypes = require("prop-types"); var classNames = require("classnames"); var AttributeFilterItem = /** @class */ (function (_super) { __extends(AttributeFilterItem, _super); function AttributeFilterItem() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.handleSelect = function () { var item = _this.props.item; item.onSelect(item.source); }; return _this; } AttributeFilterItem.prototype.render = function () { var item = this.props.item; if (!item || item.source.empty) { return this.renderLoadingItem(); } var classes = classNames("gd-list-item", "s-attribute-filter-list-item"); return (React.createElement("div", { className: classes, onClick: this.handleSelect }, React.createElement("input", { type: "checkbox", className: "gd-input-checkbox", readOnly: true, checked: item.selected }), React.createElement("span", null, item.source.title))); }; AttributeFilterItem.prototype.renderLoadingItem = function () { return React.createElement("div", { className: "gd-list-item gd-list-item-not-loaded" }); }; AttributeFilterItem.propTypes = { classname: PropTypes.string, item: PropTypes.shape({ selected: PropTypes.bool, onSelect: PropTypes.func, source: PropTypes.shape({ uri: PropTypes.string, title: PropTypes.string, empty: PropTypes.bool, }), }), }; AttributeFilterItem.defaultProps = { item: null, classname: "", }; return AttributeFilterItem; }(React.PureComponent)); exports.AttributeFilterItem = AttributeFilterItem; //# sourceMappingURL=AttributeFilterItem.js.map