1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- '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: BI Cloud (C) Copyright IBM Corp. 2019, 2021
- * 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) {
- var _class, _temp;
- return _temp = _class = function (_React$Component) {
- _inherits(SkeletonPlaceholder, _React$Component);
- function SkeletonPlaceholder() {
- _classCallCheck(this, SkeletonPlaceholder);
- return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
- }
- SkeletonPlaceholder.prototype.remove = function remove() {
- this.props.shown = false;
- };
- SkeletonPlaceholder.prototype.render = function render() {
- if (this.props.shown) {
- if (this.props.placeholderImage) {
- var img = this.props.placeholderImage;
- return React.createElement(
- 'div',
- { className: 'skeletonPlaceholder' },
- React.createElement(
- 'div',
- { className: 'shimmer' },
- React.createElement('img', { src: img, alt: this.props.alt })
- )
- );
- } else if (this.props.placeholderSVG) {
- return React.createElement(
- 'div',
- { className: 'skeletonPlaceholder' },
- React.createElement(
- 'div',
- { className: 'shimmer' },
- React.createElement(
- 'svg',
- { className: 'shimmer', x: '0px', y: '0px', width: '256px', height: '256px', viewBox: '0 0 256 256' },
- React.createElement('use', { xlinkHref: this.props.placeholderSVG })
- )
- )
- );
- } else if (this.props.placeholderText) {
- return React.createElement(
- 'div',
- { className: 'skeletonPlaceholder placeholderText' },
- this.props.placeholderText
- );
- } else {
- return React.createElement('div', { className: 'skeletonPlaceholder noimage' });
- }
- } else {
- return null;
- }
- };
- return SkeletonPlaceholder;
- }(React.Component), _class.propTypes = {
- placeholderImage: PropTypes.img,
- placeholderSVG: PropTypes.svg,
- alt: PropTypes.string,
- shown: PropTypes.bool,
- placeholderText: PropTypes.string
- }, _temp;
- });
- //# sourceMappingURL=SkeletonPlaceholder.js.map
|