@nodata/render
Version:
Allows to dynamically render nodata components
1 lines • 1.73 kB
JavaScript
;var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.FallbackRendererPlugin=void 0;var theme_1=require("@nodata/theme"),witchart_renderer_plugin_1=require("./witchart-renderer-plugin"),utils_1=require("../utils"),FallbackRendererPlugin=function(t){function e(e){var r=t.call(this)||this;return r.fallbackMessage=e,r}return __extends(e,t),e.prototype.initialize=function(t,e,r){return this.configureTooltip(),this.convertViewToGrid(e),this.updateData(r),this},e.prototype.convertViewToGrid=function(t){this.updateTitleText(t.label),this.updateType("grid");for(var e=(0,utils_1.getOutputs)(t.descriptor),r=0;r<e.length;++r)this.updateSeriesDimensionColumn(r,0,e[r].name),this.updateSeriesLabel(r,e[r].name),this.updateGridSeriesHeaderColor(r,theme_1.colors["color-buffon"])},e.prototype.configureTooltip=function(){if(this.fallbackMessage){var t=this.targetElementSelector();if(!t)return;var e=t.getAttribute("id");e||(e=Date.now().toString(),t.setAttribute("id",e)),t.setAttribute("data-toggle","tooltip"),t.setAttribute("data-original-title",this.fallbackMessage),(0,theme_1.loadTooltips)(e)}},e}(witchart_renderer_plugin_1.WitchartRendererPlugin);exports.FallbackRendererPlugin=FallbackRendererPlugin;