123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- '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; }
- define(['./error/ErrorView', 'jquery', 'underscore', '../lib/@waca/core-client/js/core-client/utils/BrowserUtils', '../widgets/livewidget/StandaloneLiveWidget'], function (ErrorView, $, _, BrowserUtils, StandaloneLiveWidget) {
- var STATICVIEW = {
- 'com.ibm.vis.rave2bundletiledmap': 'dashboard-analytics/images/placeholders/map.svg'
- };
- var LiveWidgetPreview = function (_StandaloneLiveWidget) {
- _inherits(LiveWidgetPreview, _StandaloneLiveWidget);
- function LiveWidgetPreview(options) {
- _classCallCheck(this, LiveWidgetPreview);
- return _possibleConstructorReturn(this, _StandaloneLiveWidget.call(this, options));
- }
-
- LiveWidgetPreview.prototype.render = function render() {
- this.contentNode = document.createElement('div');
- this.contentNode.setAttribute('class', 'liveWidgetPreview');
- this.contentNode.setAttribute('style', 'width:100%;height:100%; padding:0px');
- this.contentNode.setAttribute('data-vis-id', this.spec.visId);
- if (this._isStaticView()) {
- var staticView = this._getStaticView();
- this.contentNode.appendChild(staticView);
- this.node.appendChild(this.contentNode);
- return Promise.resolve();
- } else {
- var options = {
- id: this.spec.id,
- el: this.contentNode,
- errorView: new ErrorView(),
-
- featureSet: this.featureSet || [],
- interactivitySettings: this.interactivitySettings,
- optimizeForSize: true,
- forceDisabledThumbnail: true,
- isPreview: true,
- isPredictPreview: this.isPredictPreview,
- predictData: this.predictData,
- managesOwnQueries: this._managesOwnQueries
- };
- return _StandaloneLiveWidget.prototype.render.call(this, options);
- }
- };
- LiveWidgetPreview.prototype._isStaticView = function _isStaticView() {
- if (BrowserUtils.isIE() && STATICVIEW[this.spec.visId]) {
- return true;
- }
- return false;
- };
- LiveWidgetPreview.prototype._getStaticView = function _getStaticView() {
- var iconUrl = STATICVIEW[this.spec.visId];
- if (iconUrl) {
- return $('<div class="vis-icon-view-snapshot-container"><img class="snapshot" src="' + STATICVIEW[this.spec.visId] + '"></img></div>')[0];
- }
- };
- return LiveWidgetPreview;
- }(StandaloneLiveWidget);
- return LiveWidgetPreview;
- });
|