@railzai/railz-visualizations
Version:
Railz.ai Visualizations
216 lines (211 loc) • 8.79 kB
JavaScript
/*!
* Accounting Data as a Service™ is the solution that makes sense of your business customers' financial data.
* Built with Stencil
* Copyright (c) FIS.
*/
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { g as getConfiguration, C as ConfigurationInstance, a as getFilter, y as isCreditScore, E as isIncomeStatements, F as isStatements, N as isTransactions } from './chart.utils.js';
import { e as RVReportTypes } from './financial-ratios.js';
import { d as defineCustomElement$h } from './bank-accounts.js';
import { d as defineCustomElement$g } from './bank-reconciliation.js';
import { d as defineCustomElement$f } from './business-valuations.js';
import { d as defineCustomElement$e } from './credit-score.js';
import { d as defineCustomElement$d } from './error-image.js';
import { d as defineCustomElement$c } from './financial-ratios2.js';
import { d as defineCustomElement$b } from './gauge-chart.js';
import { d as defineCustomElement$a } from './income-statements.js';
import { d as defineCustomElement$9 } from './loading.js';
import { d as defineCustomElement$8 } from './percentage.js';
import { d as defineCustomElement$7 } from './progress-bar.js';
import { d as defineCustomElement$6 } from './select.js';
import { d as defineCustomElement$5 } from './sparkline-chart.js';
import { d as defineCustomElement$4 } from './statements-chart.js';
import { d as defineCustomElement$3 } from './tooltip.js';
import { d as defineCustomElement$2 } from './transactions-control.js';
import { i as isEqual } from './isEqual.js';
const coreCss = "@font-face{font-family:Inter;src:url(\"../assets/fonts/Inter-italic-var.woff2\");font-family:Inter;src:url(\"../assets/fonts/Inter-upright-var.woff2\")}body,div[class^=railz-],div[class*=\" railz-\"]{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-container{display:flex;padding:16px;position:relative;border:1px solid #eee;border-radius:7px;flex-direction:column;height:202px;overflow:auto;line-height:21px;box-sizing:border-box}.rv-container *{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}";
const Core = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.propsUpdated = () => {
this.validateParams(this.configuration, this.filter);
};
/**
* Validates if configuration was passed correctly before setting filter
* @param configuration - Config for authentication
* @param filter - filter to decide chart type to show
*/
this.validateParams = (configuration, filter) => {
this._configuration = getConfiguration(configuration);
if (this._configuration) {
ConfigurationInstance.configuration = this._configuration;
this._filter = getFilter(filter);
if (!this._filter) {
this.errorStatusCode = 204;
}
}
else {
this.errorStatusCode = 0;
}
};
}
watchFilter(newValue, oldValue) {
if (newValue && oldValue && !isEqual(oldValue, newValue)) {
this.validateParams(this.configuration, newValue);
}
}
watchConfiguration(newValue, oldValue) {
if (newValue && oldValue && !isEqual(oldValue, newValue)) {
this.validateParams(newValue, this.filter);
}
}
componentDidLoad() {
this.propsUpdated && this.propsUpdated();
}
render() {
var _a;
if (this.errorStatusCode === 0) {
return null;
}
if (this.errorStatusCode !== undefined) {
return (h("div", { class: "rv-container" }, h("railz-error-image", { statusCode: this.errorStatusCode || 500 })));
}
const reportType = (_a = this._filter) === null || _a === void 0 ? void 0 : _a.reportType;
if (RVReportTypes.BANK_RECONCILIATION === reportType) {
return (h("railz-bank-reconciliation", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.BUSINESS_VALUATIONS === reportType) {
return (h("railz-business-valuations", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.BANK_ACCOUNT === reportType) {
return (h("railz-bank-accounts", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (RVReportTypes.FINANCIAL_RATIO === reportType) {
return (h("railz-financial-ratios", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isCreditScore(reportType)) {
return (h("railz-credit-score", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isIncomeStatements(reportType)) {
return (h("railz-income-statements", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isStatements(reportType)) {
return (h("railz-statements-chart", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
if (isTransactions(reportType)) {
return (h("railz-transactions-control", { configuration: this.configuration, filter: this.filter, options: this.options }));
}
return h("span", null);
}
static get watchers() { return {
"filter": ["watchFilter"],
"configuration": ["watchConfiguration"]
}; }
static get style() { return coreCss; }
}, [1, "railz-visualizations", {
"configuration": [16],
"filter": [16],
"options": [16],
"_filter": [32],
"_configuration": [32],
"errorStatusCode": [32]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["railz-visualizations", "railz-bank-accounts", "railz-bank-reconciliation", "railz-business-valuations", "railz-credit-score", "railz-error-image", "railz-financial-ratios", "railz-gauge-chart", "railz-income-statements", "railz-loading", "railz-percentage", "railz-progress-bar", "railz-select", "railz-sparkline-chart", "railz-statements-chart", "railz-tooltip", "railz-transactions-control"];
components.forEach(tagName => { switch (tagName) {
case "railz-visualizations":
if (!customElements.get(tagName)) {
customElements.define(tagName, Core);
}
break;
case "railz-bank-accounts":
if (!customElements.get(tagName)) {
defineCustomElement$h();
}
break;
case "railz-bank-reconciliation":
if (!customElements.get(tagName)) {
defineCustomElement$g();
}
break;
case "railz-business-valuations":
if (!customElements.get(tagName)) {
defineCustomElement$f();
}
break;
case "railz-credit-score":
if (!customElements.get(tagName)) {
defineCustomElement$e();
}
break;
case "railz-error-image":
if (!customElements.get(tagName)) {
defineCustomElement$d();
}
break;
case "railz-financial-ratios":
if (!customElements.get(tagName)) {
defineCustomElement$c();
}
break;
case "railz-gauge-chart":
if (!customElements.get(tagName)) {
defineCustomElement$b();
}
break;
case "railz-income-statements":
if (!customElements.get(tagName)) {
defineCustomElement$a();
}
break;
case "railz-loading":
if (!customElements.get(tagName)) {
defineCustomElement$9();
}
break;
case "railz-percentage":
if (!customElements.get(tagName)) {
defineCustomElement$8();
}
break;
case "railz-progress-bar":
if (!customElements.get(tagName)) {
defineCustomElement$7();
}
break;
case "railz-select":
if (!customElements.get(tagName)) {
defineCustomElement$6();
}
break;
case "railz-sparkline-chart":
if (!customElements.get(tagName)) {
defineCustomElement$5();
}
break;
case "railz-statements-chart":
if (!customElements.get(tagName)) {
defineCustomElement$4();
}
break;
case "railz-tooltip":
if (!customElements.get(tagName)) {
defineCustomElement$3();
}
break;
case "railz-transactions-control":
if (!customElements.get(tagName)) {
defineCustomElement$2();
}
break;
} });
}
const RailzVisualizations = Core;
const defineCustomElement = defineCustomElement$1;
export { RailzVisualizations, defineCustomElement };
//# sourceMappingURL=railz-visualizations.js.map