UNPKG

@opengis/bi

Version:

BI data visualization module

72 lines (71 loc) 2.76 kB
import { _ as m, c as f, d as _, a as b } from "./import-file-XFI3CaVb.js"; import { createElementBlock as a, openBlock as r, createElementVNode as s, Fragment as n, renderList as c, toDisplayString as d } from "vue"; const x = { name: "VsTable", mixins: [f], data() { return { values: null, xs: null, products: null }; }, async mounted() { await this.getData(), this.prepareData(); }, methods: { onChangedData() { try { this.sourceData && this.prepareData(); } catch { } }, prepareData() { try { const t = Array.from( new Set(this.sourceData.map((e) => e[this.dimensions[0]])) ); this.dimensions[0].includes("date") ? this.xs = t.map((e) => _(e)) : this.xs = [...t], this.products = this.dimensions.filter((e, o) => o != 0), this.values = this.products.map((e, o) => ({ name: e, data: this.sourceData.filter((l) => parseFloat(l[e])).map((l) => b(parseFloat(l[e]))) })); } catch (t) { console.error(t); } } } }, y = { class: "flex flex-col h-full pt-[16px] pb-[16px] space-y-4 rounded-xl" }, g = { class: "overflow-auto h-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300" }, w = { class: "inline-block min-w-full align-middle" }, k = { class: "relative min-w-full divide-y divide-gray-200 text-[12px]" }, v = { class: "sticky top-0 bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200" }, D = { class: "space-x-2" }, $ = { scope: "col", class: "xl:min-w-[120px] min-w-48" }, F = { class: "flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1" }, T = { class: "divide-y divide-gray-200" }, B = { class: "text-gray-600" }; function E(t, e, o, l, N, S) { return r(), a("div", y, [ s("div", g, [ s("div", w, [ s("table", k, [ s("thead", v, [ s("tr", D, [ (r(!0), a(n, null, c(t.dimensions, (i) => (r(), a("th", $, [ s("div", F, d(i), 1) ]))), 256)) ]) ]), s("tbody", T, [ (r(!0), a(n, null, c(t.sourceData, (i, p) => (r(), a("tr", { key: p }, [ (r(!0), a(n, null, c(t.dimensions, (u, h) => (r(), a("td", { key: h, class: "py-3 whitespace-nowrap" }, [ s("span", B, d(i == null ? void 0 : i[u]), 1) ]))), 128)) ]))), 128)) ]) ]) ]) ]) ]); } const C = /* @__PURE__ */ m(x, [["render", E]]); export { C as default };