@senx/discovery-widgets
Version:
Discovery Widgets Elements
1,112 lines (1,111 loc) • 49.4 kB
JavaScript
/*
* Copyright 2022-2025 SenX S.A.S.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { h } from "@stencil/core";
import { Param } from "../../model/param";
import { Logger } from "../../utils/logger";
import { Utils } from "../../utils/utils";
import { GTSLib } from "../../utils/gts.lib";
import elementResizeEvent from "element-resize-event";
import { PluginManager } from "../../utils/PluginManager";
import { v4 } from "uuid";
export class DiscoveryTileResultComponent {
constructor() {
this.options = new Param();
this.debug = false;
this.unit = '';
this.language = 'warpscript';
this.vars = '{}';
this.standalone = true;
this.execTime = 0;
this.innerOptions = new Param();
this.ready = false;
this.innerVars = {};
}
updateType(newValue) {
if (newValue !== this.innerType) {
setTimeout(() => {
this.innerType = this.type;
this.selfType.emit(this.innerType);
});
}
}
updateRes(newValue) {
var _a;
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['updateRes'], 'could be huge');
this.innerResult = GTSLib.getData(newValue);
this.parseResult();
}
optionsUpdate(newValue, oldValue) {
var _a, _b, _c, _d;
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['optionsUpdate'], this.innerType, newValue, oldValue);
let opts = newValue;
if (!!newValue && typeof newValue === 'string') {
opts = JSON.parse(newValue);
}
opts = Utils.mergeDeep(opts !== null && opts !== void 0 ? opts : {}, (_c = (_b = this.innerResult) === null || _b === void 0 ? void 0 : _b.globalParams) !== null && _c !== void 0 ? _c : {});
if (!Utils.deepEqual(opts, this.innerOptions)) {
this.innerOptions = Utils.clone(opts);
this.handleCSSColors();
(_d = this.LOG) === null || _d === void 0 ? void 0 : _d.debug(['optionsUpdate 2'], this.type, { options: this.innerOptions, newValue, oldValue });
}
}
varsUpdate(newValue, oldValue) {
var _a;
if (!!this.vars && typeof this.vars === 'string') {
const vars = JSON.parse(this.vars);
if (!Utils.deepEqual(this.innerVars, vars)) {
this.innerVars = Utils.clone(vars);
}
}
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['varsUpdate'], { innerVars: this.innerVars, newValue, oldValue });
}
discoveryEventHandler(event) {
var _a, _b, _c, _d;
if (!((_a = this.innerOptions) === null || _a === void 0 ? void 0 : _a.eventHandler)) {
return;
}
const res = Utils.parseEventData(event.detail, (_c = (_b = this.innerOptions) === null || _b === void 0 ? void 0 : _b.eventHandler) !== null && _c !== void 0 ? _c : '', this.componentId);
if (res.hasEvent) {
(_d = this.LOG) === null || _d === void 0 ? void 0 : _d.debug(['discoveryEventHandler'], {
type: event.detail.type,
event: event.detail,
});
if (res.data) {
this.innerResult = res.data;
this.parseResult();
}
if (res.style) {
this.innerStyle = Utils.clone(Object.assign(Object.assign({}, this.innerStyle), res.style));
}
if (res.zoom) {
void this.setZoom(res.zoom).then(() => {
// empty
});
}
if (res.focus) {
if (res.focus.date) {
void this.setFocus(res.focus.name, res.focus.date, res.focus.value).then(() => {
// empty
});
}
else {
void this.unFocus().then(() => {
// empty
});
}
}
if (res.margin) {
this.innerOptions = Utils.clone(Object.assign(Object.assign({}, this.innerOptions), { leftMargin: res.margin }));
}
if (res.bounds) {
this.innerOptions = Object.assign(Object.assign({}, this.innerOptions), { bounds: Object.assign(Object.assign({}, this.innerOptions.bounds), { minDate: res.bounds.min, maxDate: res.bounds.max }) });
}
}
}
onDrawHandler() {
if (this.tile) {
if (this.tile.resize) {
(this.tile).resize();
}
}
}
onLeftMarginComputed(event) {
(this.innerResult.events || [])
.filter(e => e.type === 'margin')
.forEach(e => this.discoveryEvent.emit({
source: this.componentId,
type: 'margin',
tags: e.tags,
value: event.detail,
}));
}
onTimeBounds(event) {
(this.innerResult.events || [])
.filter(e => e.type === 'bounds')
.forEach(e => this.discoveryEvent.emit({
source: this.componentId,
type: 'bounds',
tags: e.tags,
value: event.detail,
}));
}
// noinspection JSUnusedGlobalSymbols
componentWillLoad() {
var _a, _b, _c, _d, _e, _f;
this.LOG = new Logger(DiscoveryTileResultComponent, this.debug);
this.componentId = this.el.id || v4();
this.innerType = this.type;
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['componentWillLoad'], {
type: this.type,
options: this.innerOptions,
result: this.result,
});
this.innerResult = GTSLib.getData(this.result);
this.innerVars = JSON.parse((_b = this.vars) !== null && _b !== void 0 ? _b : '{}');
this.innerType = (_e = (_d = (_c = this.innerResult.globalParams) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : this.innerOptions.type) !== null && _e !== void 0 ? _e : this.innerType;
this.selfType.emit(this.innerType);
(_f = this.LOG) === null || _f === void 0 ? void 0 : _f.debug(['componentWillLoad 2'], {
type: this.innerType,
options: this.innerOptions,
result: this.innerResult,
});
this.ready = true;
}
// noinspection JSUnusedGlobalSymbols
componentDidLoad() {
this.parseResult();
elementResizeEvent.unbind(this.tileElem);
elementResizeEvent(this.tileElem, async () => await this.resize());
}
// noinspection JSUnusedGlobalSymbols
disconnectedCallback() {
elementResizeEvent.unbind(this.tileElem);
}
handleZoom(event) {
(this.innerResult.events || [])
.filter(e => e.type === 'zoom')
.forEach(e => {
e.value = event.detail;
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id }));
});
}
handleDataPointOver(event) {
var _a;
((_a = this.innerResult.events) !== null && _a !== void 0 ? _a : [])
.filter(e => e.type === 'focus')
.forEach(e => {
e.value = event.detail;
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id }));
});
}
handleDataSelected(event) {
var _a;
((_a = this.innerResult.events) !== null && _a !== void 0 ? _a : [])
.filter(e => e.type === 'selected')
.forEach(e => {
e.value = event.detail;
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id, eventId: v4() })); // the eventId allow the user to be sure to filter out events, or be sure to refire a popup, for example
});
}
handlePoi(event) {
var _a;
((_a = this.innerResult.events) !== null && _a !== void 0 ? _a : [])
.filter(e => e.type === 'poi')
.forEach(e => {
e.value = event.detail;
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id }));
});
}
handleGeoBounds(event) {
var _a;
((_a = this.innerResult.events) !== null && _a !== void 0 ? _a : [])
.filter(e => e.type === 'bounds')
.forEach(e => {
e.value = event.detail;
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id }));
});
}
getView() {
var _a, _b;
switch (this.innerType) {
case 'line':
case 'area':
case 'scatter':
case 'spline-area':
case 'step-area':
case 'spline':
case 'step':
case 'step-after':
case 'step-before':
return h("discovery-line", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, debug: this.debug, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e), onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), onPoi: event => this.handlePoi(event), ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, id: this.componentId });
case 'annotation':
return h("discovery-annotation", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), onPoi: event => this.handlePoi(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'bar':
return h("discovery-bar", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), onPoi: event => this.handlePoi(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'bar-polar':
return h("discovery-bar-polar", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'boxplot':
return h("discovery-boxplot", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el || this.tile, onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'display':
return h("discovery-display", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'map':
return h("discovery-map", { result: this.innerResult, type: this.innerType, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), onGeoBounds: event => this.handleGeoBounds(event), onPoi: event => this.handlePoi(event), debug: this.debug, id: this.componentId });
case 'image':
return h("discovery-image", { result: this.innerResult, type: this.innerType, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'button':
case 'button:radio':
case 'button:group':
return h("discovery-button", { result: this.innerResult, url: this.url, type: this.innerType, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, vars: JSON.stringify(this.innerVars), language: this.language, onExecError: e => this.handleExecError(e), debug: this.debug, id: this.componentId });
case 'gauge':
case 'circle':
case 'compass':
return h("discovery-gauge", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId });
case 'linear-gauge':
return h("discovery-linear-gauge", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), debug: this.debug, id: this.componentId });
case 'pie':
case 'doughnut':
case 'rose':
return h("discovery-pie", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'tabular':
return h("discovery-tabular", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'svg':
return h("discovery-svg", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'input:text':
case 'input:textarea':
case 'input:autocomplete':
case 'input:list':
case 'input:secret':
case 'input:slider':
case 'input:date':
case 'input:date-range':
case 'input:multi':
case 'input:multi-cb':
case 'input:chips':
case 'input:chips-autocomplete':
case 'input:file':
case 'input:number':
return h("discovery-input", { result: this.innerResult, type: this.innerType, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'hidden':
return h("discovery-hidden", { result: this.innerResult, type: this.innerType, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId });
case 'calendar':
return h("discovery-calendar", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'heatmap':
return h("discovery-heatmap", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'profile':
return h("discovery-profile", { result: this.innerResult, type: this.innerType, unit: this.unit, options: this.innerOptions, ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onDataZoom: event => this.handleZoom(event), onDataPointOver: event => this.handleDataPointOver(event), onDataPointSelected: event => this.handleDataSelected(event), debug: this.debug, id: this.componentId, vars: JSON.stringify(this.innerVars), language: this.language, url: this.url, onExecError: e => this.handleExecError(e) });
case 'dashboard':
case 'dashboard:flex':
case 'dashboard:scada':
const sub = this.innerType.split(':');
let dashBoardType = 'dashboard';
if (sub.length > 1) {
dashBoardType = sub[1];
}
return h("discovery-dashboard", { data: GTSLib.getData(this.innerResult).data, vars: JSON.stringify(this.innerVars), type: dashBoardType, url: this.url, inTile: true, options: JSON.stringify(this.innerOptions), ref: el => this.tile = el !== null && el !== void 0 ? el : this.tile, onRendered: () => this.draw.emit(), debug: this.debug, id: this.componentId });
default:
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['getView'], PluginManager.getInstance().registry);
if (PluginManager.getInstance().has(this.innerType)) {
(_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['getView', 'type'], this.innerType);
const Tag = PluginManager.getInstance().get(this.innerType).tag;
return h(Tag, { result: this.innerResult, type: this.innerType, options: this.innerOptions, height: this.height, width: this.width, vars: JSON.stringify(this.innerVars), url: this.url, ref: (el) => this.tile = el !== null && el !== void 0 ? el : this.tile, debug: this.debug, id: this.componentId, onExecError: (e) => this.handleExecError(e) });
}
return '';
}
}
async resize() {
setTimeout(() => {
if (!!this.tile && !!this.tile.resize) {
(this.tile).resize();
}
}, 500);
return Promise.resolve();
}
async setZoom(dataZoom) {
if (this.tile) {
(this.tile).setZoom(dataZoom);
}
return Promise.resolve();
}
async show(regexp) {
if (this.tile && this.tile['show']) {
await (this.tile).show(regexp);
}
}
async showById(id) {
if (this.tile && this.tile['showById']) {
await (this.tile).showById(id);
}
}
async hide(regexp) {
if (this.tile && this.tile['hide']) {
await (this.tile).hide(regexp);
}
}
async hideById(id) {
if (this.tile && this.tile['hideById']) {
await (this.tile).hideById(id);
}
}
async setFocus(regexp, ts, value) {
if (this.tile && this.tile['setFocus']) {
await (this.tile).setFocus(regexp, ts, value);
}
}
async unFocus() {
if (this.tile && this.tile['unFocus']) {
await (this.tile).unFocus();
}
}
async export(type = 'png') {
if (this.tile && this.tile['export']) {
const dataUrl = await (this.tile).export(type);
return { dataUrl, bgColor: Utils.getCSSColor(this.tileElem, '--warp-view-tile-background', '#fff') };
}
else {
return undefined;
}
}
render() {
var _a, _b;
this.handleCSSColors();
return [
h("style", { key: 'c054213efe1762be6a7d99a170d69192dc59e776' }, this.generateStyle(this.innerStyle)),
h("div", { key: '413dd0e95369b184e935806d57f4c14ae640e7ec', class: "discovery-tile", ref: el => this.tileElem = el, style: {
background: this.bgColor,
color: this.fontColor,
height: '100%', width: '100%',
} }, this.innerTitle && this.innerTitle !== ''
? h("h2", { class: "tile-title" }, (_a = this.innerTitle) !== null && _a !== void 0 ? _a : '')
: '', this.chartDescription && this.chartDescription !== ''
? h("p", { class: "tile-desc" }, (_b = this.chartDescription) !== null && _b !== void 0 ? _b : '')
: '', this.ready ? h("div", { class: "discovery-chart-wrapper" }, this.getView()) : ''),
];
}
async parseEvents() {
var _a, _b, _c;
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['parseEvents'], { discoveryEvents: ((_c = (_b = this.innerResult) === null || _b === void 0 ? void 0 : _b.events) !== null && _c !== void 0 ? _c : []) });
setTimeout(() => {
var _a, _b;
return ((_b = (_a = this.innerResult) === null || _a === void 0 ? void 0 : _a.events) !== null && _b !== void 0 ? _b : [])
.filter(e => e.value !== undefined)
.filter(e => !['zoom', 'margin', 'selected'].includes(e.type))
.forEach(e => {
var _a, _b, _c;
if (this.LOG) {
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['parseEvents', 'emit'], { discoveryEvent: e });
}
if (!(this.type.startsWith('input') && ((_c = (_b = this.innerOptions) === null || _b === void 0 ? void 0 : _b.input) === null || _c === void 0 ? void 0 : _c.showButton))) {
this.discoveryEvent.emit(Object.assign(Object.assign({}, e), { source: this.el.id }));
}
});
});
return Promise.resolve();
}
parseResult() {
var _a, _b, _c, _d;
let options = new Param();
if (!!this.options && typeof this.options === 'string' && this.options !== 'undefined') {
options = Object.assign(Object.assign({}, options), JSON.parse(this.options));
}
else {
options = Object.assign(Object.assign({}, options), ((_a = this.options) !== null && _a !== void 0 ? _a : {}));
}
options = Utils.mergeDeep(options !== null && options !== void 0 ? options : {}, (_c = (_b = this.innerResult) === null || _b === void 0 ? void 0 : _b.globalParams) !== null && _c !== void 0 ? _c : {});
setTimeout(() => {
void (async () => {
var _a, _b, _c, _d, _e, _f, _g;
this.unit = (_a = this.options.unit) !== null && _a !== void 0 ? _a : this.unit;
this.innerType = (_d = (_c = (_b = this.innerResult) === null || _b === void 0 ? void 0 : _b.globalParams) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : this.innerType;
this.innerOptions = Utils.clone(options);
this.selfType.emit(this.innerType);
this.innerTitle = (_g = (_f = (_e = this.innerOptions) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : this.chartTitle) !== null && _g !== void 0 ? _g : '';
this.handleCSSColors();
await this.parseEvents();
})();
});
if (this.LOG) {
(_d = this.LOG) === null || _d === void 0 ? void 0 : _d.debug(['parseResult'], { type: this.innerType, options: this.options });
}
}
generateStyle(styles) {
var _a, _b;
this.innerStyles = Utils.clone(Object.assign(Object.assign(Object.assign({}, this.innerStyles), styles), (_a = this.innerOptions.customStyles) !== null && _a !== void 0 ? _a : {}));
return Object.keys((_b = this.innerStyles) !== null && _b !== void 0 ? _b : {}).map(k => `${k} { ${this.innerStyles[k]} }`).join('\n');
}
handleCSSColors() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
let fontColor = Utils.getCSSColor(this.tileElem, '--warp-view-font-color', '#404040');
fontColor = (_b = (_a = this.innerOptions) === null || _a === void 0 ? void 0 : _a.fontColor) !== null && _b !== void 0 ? _b : fontColor;
let bgColor = Utils.getCSSColor(this.tileElem, '--warp-view-bg-color', 'transparent');
bgColor = (_d = (_c = this.innerOptions) === null || _c === void 0 ? void 0 : _c.bgColor) !== null && _d !== void 0 ? _d : bgColor;
this.bgColor = (_g = (_f = (_e = this.innerResult) === null || _e === void 0 ? void 0 : _e.globalParams) === null || _f === void 0 ? void 0 : _f.bgColor) !== null && _g !== void 0 ? _g : bgColor;
this.fontColor = (_k = (_j = (_h = this.innerResult) === null || _h === void 0 ? void 0 : _h.globalParams) === null || _j === void 0 ? void 0 : _j.fontColor) !== null && _k !== void 0 ? _k : fontColor;
if (this.tileElem) {
const rs = getComputedStyle(this.tileElem);
if ('' === rs.getPropertyValue('--warp-view-font-color').trim()) {
this.tileElem.style.setProperty('--warp-view-font-color', this.fontColor);
}
if ('' === rs.getPropertyValue('--warp-view-chart-label-color').trim()) {
this.tileElem.style.setProperty('--warp-view-chart-label-color', this.fontColor);
}
if ('#8e8e8e' === rs.getPropertyValue('--warp-view-chart-grid-color').trim()) {
this.tileElem.style.setProperty('--warp-view-chart-grid-color', this.fontColor);
}
}
}
handleExecError(e) {
this.execError.emit(e.detail);
}
static get is() { return "discovery-tile-result"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["discovery-tile-result.scss"]
};
}
static get styleUrls() {
return {
"$": ["discovery-tile-result.css"]
};
}
static get properties() {
return {
"result": {
"type": "string",
"mutable": true,
"complexType": {
"original": "DataModel | string",
"resolved": "DataModel | string",
"references": {
"DataModel": {
"location": "import",
"path": "../../model/types",
"id": "src/model/types.ts::DataModel"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "result",
"reflect": false
},
"type": {
"type": "string",
"mutable": true,
"complexType": {
"original": "ChartType",
"resolved": "string",
"references": {
"ChartType": {
"location": "import",
"path": "../../model/types",
"id": "src/model/types.ts::ChartType"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "type",
"reflect": false
},
"start": {
"type": "number",
"mutable": false,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "start",
"reflect": false
},
"options": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Param | string",
"resolved": "Param | string",
"references": {
"Param": {
"location": "import",
"path": "../../model/param",
"id": "src/model/param.ts::Param"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "options",
"reflect": false,
"defaultValue": "new Param()"
},
"width": {
"type": "number",
"mutable": true,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "width",
"reflect": false
},
"height": {
"type": "number",
"mutable": true,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "height",
"reflect": false
},
"debug": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "debug",
"reflect": false,
"defaultValue": "false"
},
"unit": {
"type": "string",
"mutable": true,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "unit",
"reflect": false,
"defaultValue": "''"
},
"url": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "url",
"reflect": false
},
"chartTitle": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "chart-title",
"reflect": false
},
"chartDescription": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "chart-description",
"reflect": false
},
"language": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'warpscript' | 'flows'",
"resolved": "\"flows\" | \"warpscript\"",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "language",
"reflect": false,
"defaultValue": "'warpscript'"
},
"vars": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "vars",
"reflect": false,
"defaultValue": "'{}'"
},
"standalone": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"getter": false,
"setter": false,
"attribute": "standalone",
"reflect": false,
"defaultValue": "true"
}
};
}
static get states() {
return {
"execTime": {},
"bgColor": {},
"fontColor": {},
"innerResult": {},
"innerOptions": {},
"innerStyle": {},
"innerType": {},
"innerTitle": {},
"ready": {}
};
}
static get events() {
return [{
"method": "discoveryEvent",
"name": "discoveryEvent",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "DiscoveryEvent",
"resolved": "DiscoveryEvent",
"references": {
"DiscoveryEvent": {
"location": "import",
"path": "../../model/types",
"id": "src/model/types.ts::DiscoveryEvent"
}
}
}
}, {
"method": "draw",
"name": "draw",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "void",
"resolved": "void",
"references": {}
}
}, {
"method": "selfType",
"name": "selfType",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "ChartType",
"resolved": "string",
"references": {
"ChartType": {
"location": "import",
"path": "../../model/types",
"id": "src/model/types.ts::ChartType"
}
}
}
}, {
"method": "execError",
"name": "execError",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any[]",
"resolved": "any[]",
"references": {}
}
}];
}
static get methods() {
return {
"resize": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"setZoom": {
"complexType": {
"signature": "(dataZoom: { start?: number; end?: number; type?: string; }) => Promise<void>",
"parameters": [{
"name": "dataZoom",
"type": "{ start?: number; end?: number; type?: string; }",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"show": {
"complexType": {
"signature": "(regexp: string) => Promise<void>",
"parameters": [{
"name": "regexp",
"type": "string",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"showById": {
"complexType": {
"signature": "(id: number) => Promise<void>",
"parameters": [{
"name": "id",
"type": "number",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"hide": {
"complexType": {
"signature": "(regexp: string) => Promise<void>",
"parameters": [{
"name": "regexp",
"type": "string",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"hideById": {
"complexType": {
"signature": "(id: number) => Promise<void>",
"parameters": [{
"name": "id",
"type": "number",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"setFocus": {
"complexType": {
"signature": "(regexp: string, ts: number, value?: number) => Promise<void>",
"parameters": [{
"name": "regexp",
"type": "string",
"docs": ""
}, {
"name": "ts",
"type": "number",
"docs": ""
}, {
"name": "value",
"type": "number",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"unFocus": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
},
"export": {
"complexType": {
"signature": "(type?: \"png\" | \"svg\") => Promise<{ dataUrl: string; bgColor: string; }>",
"parameters": [{
"name": "type",
"type": "\"svg\" | \"png\"",
"docs": ""
}],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<{ dataUrl: string; bgColor: string; }>"
},
"docs": {
"text": "",
"tags": []
}
},
"parseEvents": {
"complexType": {
"signature": "() => Promise<void>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
},
"DataModel": {
"location": "import",
"path": "../../model/types",
"id": "src/model/types.ts::DataModel"
}
},
"return": "Promise<void>"
},
"docs": {
"text": "",
"tags": []
}
}
};
}
static get elementRef() { return "el"; }
static get watchers() {
return [{
"propName": "type",
"methodName": "updateType"
}, {
"propName": "result",
"methodName": "updateRes"
}, {
"propName": "options",
"methodName": "optionsUpdate"
}, {
"propName": "vars",
"methodName": "varsUpdate"
}];
}
static get listeners() {
return [{
"name": "discoveryEvent",
"method": "discoveryEventHandler",
"target": "window",
"capture": false,
"passive": false
}, {
"name": "draw",
"method": "onDrawHandler",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "rendered",
"method": "onDrawHandler",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "leftMarginComputed",
"method": "onLeftMarginComputed",
"target": undefined,
"capture": false,
"passive": false
}, {
"name": "timeBounds",
"method": "onTimeBounds",
"target": undefined,
"capture": false,
"passive": false
}];
}
}
//# sourceMappingURL=discovery-tile-result.js.map