'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 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['react', 'ca-ui-toolkit', 'prop-types', './CustomVisualsContentComponent', './CustomVisualsComponentHeader', '../../../widgets/livewidget/nls/StringResources'], function (React, UI_Toolkit, PropTypes, CustomVisualsContentComponent, CustomVisualsComponentHeader, StringResources) { var Component = React.Component; var Label = UI_Toolkit.Label; var VSpacer = UI_Toolkit.VSpacer, FlexLayout = UI_Toolkit.FlexLayout, FlexItem = UI_Toolkit.FlexItem; var CustomVisualsComponent = function (_Component) { _inherits(CustomVisualsComponent, _Component); function CustomVisualsComponent(props) { _classCallCheck(this, CustomVisualsComponent); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _this.state = { items: _this.props.items, isRefreshing: _this.props.isRefreshing }; return _this; } CustomVisualsComponent.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { this.setState({ items: nextProps.items, isRefreshing: nextProps.isRefreshing }); }; CustomVisualsComponent.prototype.render = function render() { var customVisAction = this.props.customVisAction; var _state = this.state, items = _state.items, isRefreshing = _state.isRefreshing; var _props = this.props, handlers = _props.handlers, dashboardApi = _props.dashboardApi; return React.createElement( FlexLayout, { fullHeight: true, direction: 'column', justifyContent: 'flex-start' }, React.createElement( FlexItem, { grow: 5, className: 'vis-custom-visuals-container' }, React.createElement( FlexLayout, { fullHeight: true, direction: 'column', justifyContent: 'flex-start' }, React.createElement( FlexItem, null, React.createElement( FlexLayout, { direction: 'row', justifyContent: 'space-between' }, React.createElement( FlexItem, { alignSelf: 'flex-start' }, React.createElement(Label, { className: 'vis-custom-vis-visuals-label', label: StringResources.get('extVisCustomVisuals') }) ), customVisAction.canManage() && React.createElement( FlexItem, { alignSelf: 'flex-end', title: StringResources.get('extVisAddCustomVisual') }, React.createElement(CustomVisualsComponentHeader, { customVisAction: customVisAction, handlers: handlers }) ) ) ), React.createElement( FlexItem, null, React.createElement(VSpacer, { size: 2 }) ), React.createElement( FlexItem, { basis: '0%', grow: 1, shrink: 1 }, React.createElement(CustomVisualsContentComponent, { items: items, handlers: handlers, isRefreshing: isRefreshing, customVisAction: customVisAction, dashboardApi: dashboardApi }) ), React.createElement( FlexItem, null, React.createElement(VSpacer, { size: 2 }) ) ) ) ); }; return CustomVisualsComponent; }(Component); CustomVisualsComponent.propTypes = { items: PropTypes.array.isRequired, handlers: PropTypes.shape({ componentDidMountCallback: PropTypes.func.isRequired, componentWillUnmountCallback: PropTypes.func.isRequired, refreshCustomVisDefinitions: PropTypes.func.isRequired }).isRequired, isRefreshing: PropTypes.bool, dashboardApi: PropTypes.object.isRequired, customVisAction: PropTypes.object.isRequired }; CustomVisualsComponent.defaultProps = { isRefreshing: false }; return CustomVisualsComponent; }); //# sourceMappingURL=CustomVisualsComponent.js.map