1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Dashboard
- * (C) Copyright IBM Corp. 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['react', 'prop-types'], function (React, PropTypes) {
- /**
- * @class GridContentRenderer
- * @classdesc React component to display grid cell content consisting of a value and an optional shape
- */
- var GridContentRenderer = function (_React$Component) {
- _inherits(GridContentRenderer, _React$Component);
- function GridContentRenderer(props) {
- _classCallCheck(this, GridContentRenderer);
- return _possibleConstructorReturn(this, _React$Component.call(this, props));
- }
- GridContentRenderer.prototype.render = function render() {
- var displayValue = this.props.displayValue;
- var shapeId = this.props.shapeId;
- var isShapeCol = 'shapeId' in this.props;
- var classNames = ['dashboard-text-cell'];
- if (isShapeCol) {
- classNames.push('grid-shape-right');
- if (!shapeId) {
- classNames.push('noShape');
- }
- }
- return React.createElement(
- React.Fragment,
- null,
- React.createElement(
- 'div',
- { className: classNames.join(' ') },
- displayValue
- ),
- shapeId && React.createElement(
- 'svg',
- { className: 'dashboard-grid-shape' },
- React.createElement('use', { xlinkHref: '#' + shapeId }),
- React.createElement(
- 'title',
- null,
- shapeId
- )
- )
- );
- };
- return GridContentRenderer;
- }(React.Component);
- GridContentRenderer.propTypes = {
- /** The value to display in the cell*/
- displayValue: PropTypes.string.isRequired,
- /** The optional shape id to render in the cell.*/
- shapeId: PropTypes.string
- };
- return GridContentRenderer;
- });
- //# sourceMappingURL=GridContentRenderer.js.map
|