vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
900 lines (899 loc) • 83.7 kB
JavaScript
import { a7 as P, t as z, l as T, w as U, i as V, j as X, v as j, A as Y, e as W, F as J, u as K, p as Z } from "./index-q-LPw2IT.js";
import q from "./vue-ui-xy-Bsh6AmS0.js";
import Q from "./vue-ui-donut-CdLAu_O5.js";
import { resolveComponent as x, createElementBlock as u, openBlock as c, normalizeStyle as g, createElementVNode as a, createCommentVNode as b, toDisplayString as d, Fragment as I, renderList as _, normalizeClass as p, createTextVNode as w, withDirectives as O, vModelText as S, withKeys as L, withModifiers as A, vModelSelect as $, createBlock as E, createVNode as ee } from "vue";
import { _ as te } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const se = {
name: "vue-ui-table",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Object,
default() {
return {};
}
}
},
components: { VueUiXy: q, VueUiDonut: Q },
data() {
return {
uid: `vue-ui-table-${Math.random()}`,
bodyCopy: JSON.parse(JSON.stringify(this.dataset.body)).map((s, r) => ({
...s,
absoluteIndex: r
})),
buttonTimeout: null,
canMoveChart: !1,
chart: {
height: 316,
type: "bar",
width: 512
},
constants: {
ASC: 1,
BAR: "bar",
DATE: "date",
DESC: -1,
DONUT: "donut",
LINE: "line",
NUMERIC: "numeric",
PERCENTAGE: "percentage",
TEXT: "text"
},
clientX: 100,
clientY: 100,
dragOffsetX: 0,
dragOffsetY: 0,
modalWidth: 400,
modalHeight: 200,
cssClass: {
CELL: "smart-td-selected",
FIRST_TD: "smart-td-selected-first",
LAST_TD: "smart-td-selected-last",
ROW: "smart-td-selected-neighbor"
},
currentDonut: void 0,
currentFilter: void 0,
currentSearch: void 0,
currentSelectionSpan: {
col: void 0,
rows: []
},
currentPage: 0,
dates: {},
filteredDatesIndexes: {},
hasNaN: {},
iconColor: "#2D353C",
iconSize: 20,
immutableRangeFilters: {},
isExportRequest: !1,
isLoading: !1,
itemsPerPage: this.config.rowsPerPage ? this.config.rowsPerPage : 25,
multiselects: {},
paginatorOptions: [.../* @__PURE__ */ new Set([10, 25, 50, 100, 250, 500, this.config.rowsPerPage ? this.config.rowsPerPage : 25, this.dataset.body.length])].sort((s, r) => s - r),
palette: Z,
percentages: {},
rafId: null,
rangeFilters: {},
searches: {},
selectedColumn: void 0,
selectedDonutCategory: void 0,
selectedPlot: void 0,
showChart: !1,
showDonutOptions: !1,
sorts: {},
tableBody: JSON.parse(JSON.stringify(this.dataset.body)).map((s, r) => ({
...s,
absoluteIndex: r
})),
tableHead: JSON.parse(JSON.stringify(this.dataset.header)).map((s) => ({
average: Object.hasOwn(s, "average") ? s.average : !1,
decimals: Object.hasOwn(s, "decimals") ? s.decimals : 0,
isMultiselect: Object.hasOwn(s, "isMultiselect") ? s.isMultiselect : !1,
isPercentage: Object.hasOwn(s, "isPercentage") ? s.isPercentage : !1,
isSearch: Object.hasOwn(s, "isSearch") ? s.isSearch : !1,
isSort: Object.hasOwn(s, "isSort") ? s.isSort : !1,
name: s.name,
// this attribute is mandatory
percentageTo: Object.hasOwn(s, "percentageTo") ? s.percentageTo : void 0,
prefix: Object.hasOwn(s, "prefix") ? s.prefix : "",
rangeFilter: Object.hasOwn(s, "rangeFilter") ? s.rangeFilter : !1,
suffix: Object.hasOwn(s, "suffix") ? s.suffix : "",
sum: Object.hasOwn(s, "sum") ? s.sum : !1,
type: s.type
// this attribute is mandatory
}))
};
},
mounted() {
if (this.dataset.header.length === 0)
throw new Error(`vue-ui-table error: missing header data.
Provide an array of objects of type:
{
name: string;
type: string; ('text' | 'numeric' | 'date')
average: boolean;
decimals: number | undefined;
sum: boolean;
isSort:boolean;
isSearch: boolean;
isMultiselect: boolean;
isPercentage: boolean;
percentageTo: string; (or '')
}`);
if (this.dataset.body.length === 0)
throw new Error("vue-ui-table error: missing body data");
this.isLoading = !0, this.promiseWithAsyncFunction(this.prepareBodyCopy, () => {
this.$forceUpdate(), this.isLoading = !1;
}), document.addEventListener("keydown", (n) => {
const s = document.activeElement;
(s && Array.from(s.classList).includes("td-focusable") && n.key.includes("Arrow") || n.code === "Space") && n.preventDefault();
});
},
watch: {
showChart: function(n) {
n && this.$nextTick(() => {
this.closeDragElement();
});
},
dataset: {
handler(n) {
this.isLoading = !0, this.bodyCopy = JSON.parse(JSON.stringify(n.body)).map((s, r) => ({
...s,
absoluteIndex: r
})), this.tableBody = JSON.parse(JSON.stringify(n.body)).map((s, r) => ({
...s,
absoluteIndex: r
})), this.tableHead = JSON.parse(JSON.stringify(n.header)).map((s) => ({
average: Object.hasOwn(s, "average") ? s.average : !1,
decimals: Object.hasOwn(s, "decimals") ? s.decimals : 0,
isMultiselect: Object.hasOwn(s, "isMultiselect") ? s.isMultiselect : !1,
isPercentage: Object.hasOwn(s, "isPercentage") ? s.isPercentage : !1,
isSearch: Object.hasOwn(s, "isSearch") ? s.isSearch : !1,
isSort: Object.hasOwn(s, "isSort") ? s.isSort : !1,
name: s.name,
percentageTo: Object.hasOwn(s, "percentageTo") ? s.percentageTo : void 0,
prefix: Object.hasOwn(s, "prefix") ? s.prefix : "",
rangeFilter: Object.hasOwn(s, "rangeFilter") ? s.rangeFilter : !1,
suffix: Object.hasOwn(s, "suffix") ? s.suffix : "",
sum: Object.hasOwn(s, "sum") ? s.sum : !1,
type: s.type
})), this.currentSelectionSpan = { col: void 0, rows: [] }, this.selectedColumn = void 0, this.itemsPerPage = this.config.rowsPerPage ? this.config.rowsPerPage : 25, this.percentages = {}, this.dates = {}, this.filteredDatesIndexes = {}, this.hasNaN = {}, this.immutableRangeFilters = {}, this.rangeFilters = {}, this.multiselects = {}, this.searches = {}, this.sorts = {}, this.showChart = !1, this.currentDonut = void 0, this.selectedDonutCategory = void 0, this.selectedPlot = void 0, this.showDonutOptions = !1, this.currentSelectionSpan.col = void 0, this.currentSelectionSpan.rows = [], this.promiseWithAsyncFunction(this.prepareBodyCopy, () => {
this.$forceUpdate(), this.updateCurrentPage(), this.isLoading = !1;
});
},
deep: !0,
// In case dataset.body/header are updated in-place
immediate: !1
}
},
computed: {
availableDonutCategories() {
return Object.keys(this.multiselects).map((n) => ({
index: n,
name: this.dataset.header[n].name,
options: this.multiselects[n]
}));
},
canChart() {
return this.FINAL_CONFIG.useChart && this.currentSelectionSpan.rows.length > 1;
},
chartData() {
if (!this.canChart) return [];
const n = 316, s = 512, r = this.currentSelectionSpan.rows.length, i = s / r, t = Math.max(...this.currentSelectionSpan.rows.map((v) => v.value)), e = Math.min(...this.currentSelectionSpan.rows.map((v) => v.value)), y = this.dataset.header[this.currentSelectionSpan.col].isPercentage && this.dataset.header[this.currentSelectionSpan.col].percentageTo, f = this.chart.type === this.constants.DONUT && this.selectedDonutCategory && this.selectedDonutCategory.name, l = this.dataset.header[this.currentSelectionSpan.col].name + (y ? ` / ${this.dataset.header[this.percentages[this.currentSelectionSpan.col].referenceIndex].name}` : "") + (f ? ` ${this.FINAL_CONFIG.translations.by} ${this.selectedDonutCategory.name}` : ""), o = this.dataset.header[this.currentSelectionSpan.col].prefix, h = this.dataset.header[this.currentSelectionSpan.col].suffix, m = [
{
name: l,
series: this.currentSelectionSpan.rows.map((v) => v.value),
type: "line",
useProgression: !0,
smooth: this.FINAL_CONFIG.style.chart.layout.line.smooth,
color: this.FINAL_CONFIG.style.chart.layout.line.stroke,
useArea: this.FINAL_CONFIG.style.chart.layout.line.useArea
}
], F = [
{
name: l,
series: this.currentSelectionSpan.rows.map((v) => v.value),
type: "bar",
useProgression: !0,
color: this.FINAL_CONFIG.style.chart.layout.bar.fill
}
], k = this.FINAL_CONFIG.style.chart.modal.backgroundColor, N = this.adaptColorToBackground(k), C = this.dataset.header[this.currentSelectionSpan.col].decimals, B = {
chart: {
backgroundColor: k,
color: N,
labels: {
fontSize: 18,
prefix: o,
suffix: h
},
grid: {
stroke: T(N, 0.5),
labels: {
color: N,
xAxisLabels: { show: !1 }
}
},
highlighter: {
color: N
},
legend: {
color: N
},
title: {
text: l,
color: N,
fontSize: 18
},
tooltip: {
showTimeLabel: !1,
backgroundOpacity: 30,
color: N,
backgroundColor: k,
showPercentage: !1,
roundingValue: C
},
userOptions: {
position: "left",
buttons: {
pdf: !1,
csv: !1,
table: !1,
annotator: !1
}
},
zoom: { show: !1 }
},
line: {
labels: {
show: !0,
color: N,
rounding: C
},
dot: {
useSerieColor: !1,
fill: this.FINAL_CONFIG.style.chart.layout.line.plot.fill,
strokeWidth: this.FINAL_CONFIG.style.chart.layout.line.plot.strokeWidth
}
},
bar: {
useGradient: !1,
border: {
useSerieColor: !1,
stroke: this.FINAL_CONFIG.style.chart.layout.bar.stroke,
strokeWidth: this.FINAL_CONFIG.style.chart.layout.bar.strokeWidth
},
labels: {
show: !0,
color: N,
rounding: C
}
}
}, D = e >= 0 ? 0 : Math.abs(e), H = t + D, M = this.dataset.header[this.currentSelectionSpan.col].isPercentage, G = this.currentSelectionSpan.rows.map((v, R) => ({
x: i * R + i / 2,
y: (1 - (v.value + D) / H) * n,
value: M ? v.value * 100 : v.value,
suffix: M ? "%" : this.dataset.header[this.currentSelectionSpan.col].suffix ? this.dataset.header[this.currentSelectionSpan.col].suffix : "",
prefix: this.dataset.header[this.currentSelectionSpan.col].prefix ? this.dataset.header[this.currentSelectionSpan.col].prefix : "",
index: v.index,
absoluteValue: M ? Math.abs(v.value) * 100 : Math.abs(v.value)
}));
return {
donutConfig: {
userOptions: {
position: "left",
buttons: {
pdf: !1,
csv: !1,
table: !1,
annotator: !1
}
},
style: {
chart: {
backgroundColor: k,
color: N,
layout: {
curvedMarkers: !0,
donut: {
strokeWidth: 64
},
labels: {
dataLabels: {
suffix: M ? "%" : "",
prefix: o
},
value: {
rounding: C
},
percentage: {
color: N,
rounding: C
},
name: {
color: N
},
hollow: {
average: {
color: N,
text: this.FINAL_CONFIG.translations.average,
value: {
color: N
}
},
total: {
color: N,
offsetY: -12,
text: this.FINAL_CONFIG.translations.total,
value: {
color: N,
offsetY: -12
}
}
}
}
},
legend: {
backgroundColor: k,
color: N,
roundingValue: C,
roundingPercentage: C
},
padding: {
left: 12,
right: 12
},
title: {
text: l,
color: N,
fontSize: 18
},
tooltip: {
backgroundOpacity: 30,
color: N,
backgroundColor: k,
roundingValue: C,
roundingValue: C
}
}
}
},
xyConfig: B,
xyDatasetLine: m,
xyDatasetBar: F,
progression: G.length >= 2 ? this.calcLinearProgression(G) : !1
};
},
hasNumericTypes() {
return this.dataset.header.map((n) => n.type).includes(this.constants.NUMERIC);
},
icons() {
return {
arrowSort: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 9l4 -4l4 4m-4 -4v14" /><path d="M21 15l-4 4l-4 -4m4 4v-14" /></svg>`,
bar: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M4 20l14 0" /></svg>`,
chart: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 19l16 0" /><path d="M4 15l4 -6l4 2l4 -5l4 4" /></svg>`,
chevronDown: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>`,
chevronLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 1.6}" height="${this.iconSize * 1.6}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 6l-6 6l6 6" /></svg>`,
chevronRight: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 1.6}" height="${this.iconSize * 1.6}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>`,
donut: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 3v5m4 4h5" /><path d="M8.929 14.582l-3.429 2.918" /><path d="M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /></svg>`,
export: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5" /><path d="M3 10h18" /><path d="M10 3v18" /><path d="M16 19h6" /><path d="M19 16l3 3l-3 3" /></svg>`,
fileDownload: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /><path d="M12 17v-6" /><path d="M9.5 14.5l2.5 2.5l2.5 -2.5" /></svg>`,
filter: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" /></svg>`,
move: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 9l3 3l-3 3" /><path d="M15 12h6" /><path d="M6 9l-3 3l3 3" /><path d="M3 12h6" /><path d="M9 18l3 3l3 -3" /><path d="M12 15v6" /><path d="M15 6l-3 -3l-3 3" /><path d="M12 3v6" /></svg>`,
sort09: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /><path d="M17 3a2 2 0 0 1 2 2v3a2 2 0 1 1 -4 0v-3a2 2 0 0 1 2 -2z" /><path d="M17 16m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19 16v3a2 2 0 0 1 -2 2h-1.5" /></svg>`,
sort90: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /><path d="M17 14a2 2 0 0 1 2 2v3a2 2 0 1 1 -4 0v-3a2 2 0 0 1 2 -2z" /><path d="M17 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" /><path d="M19 5v3a2 2 0 0 1 -2 2h-1.5" /></svg>`,
sortAZ: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 10v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4" /><path d="M19 21h-4l4 -7h-4" /><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /></svg>`,
sortZA: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 21v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4" /><path d="M19 10h-4l4 -7h-4" /><path d="M4 15l3 3l3 -3" /><path d="M7 6v12" /></svg>`,
sum: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>`,
table: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" fill="white" d="M 10 2, 21 2, 21 21, 10 21Z"/><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" /><path d="M3 10h18" /><path d="M10 3v18" /></svg>`,
warning: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize * 0.8}" height="${this.iconSize * 0.8}" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z" /><path d="M12 9v4" /><path d="M12 17h.01" /></svg>`,
grip: `<svg xmlns="http://www.w3.org/2000/svg" width="${this.iconSize}" height="${this.iconSize}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M5 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M5 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>`
};
},
pages() {
const n = [];
if (this.bodyCopy.length)
for (let s = 0; s < this.bodyCopy.length; s += this.itemsPerPage)
n.push(this.bodyCopy.slice(s, s + this.itemsPerPage));
return n;
},
rows() {
return this.bodyCopy.map((n) => n.td);
},
selectedCellsCalculations() {
return {
sumPercentage: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) * 100).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
sumRegular: Number(this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
averagePercentage: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) / this.currentSelectionSpan.rows.length * 100).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString(),
averageRegular: Number((this.currentSelectionSpan.rows.map((n) => n.value).reduce((n, s) => n + s, 0) / this.currentSelectionSpan.rows.length).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString()
};
},
FINAL_CONFIG() {
const { vue_ui_table: n } = K();
if (!Object.keys(this.config || {}).length)
return n;
const s = this.treeShake({
defaultConfig: n,
userConfig: this.config
});
return this.convertConfigColors(s);
},
visibleRows() {
return this.pages[this.currentPage];
}
},
methods: {
// lib
adaptColorToBackground: J,
convertColorToHex: W,
convertConfigColors: Y,
createCsvContent: j,
darkenHexColor: X,
dataLabel: V,
downloadCsv: U,
lightenHexColor: T,
treeShake: z,
// specific
applyDonutOption() {
const n = this.selectedDonutCategory.options.map((s, r) => ({
name: s,
color: this.palette[r] || this.palette[r % this.palette.length],
values: [this.visibleRows.filter((i, t) => i.td[this.selectedDonutCategory.index] === s && this.currentSelectionSpan.rows.map((e) => e.index).includes(t)).map((i) => i.td[this.currentSelectionSpan.col]).reduce((i, t) => Math.abs(i) + Math.abs(t), 0)],
absoluteValue: this.visibleRows.filter((i, t) => i.td[this.selectedDonutCategory.index] === s && this.currentSelectionSpan.rows.map((e) => e.index).includes(t)).map((i) => i.td[this.currentSelectionSpan.col]).reduce((i, t) => i + t, 0)
})).sort((s, r) => r.value - s.value);
this.currentDonut = n, this.$nextTick(() => {
this.chart.type = this.constants.DONUT, this.showDonutOptions = !1;
});
},
calcRectY(n, s) {
return n >= 0 ? s : this.chartData.zero;
},
canResetColumn(n, s) {
return !this.hasNaN[n] && (s.isSort || s.isSearch || s.isMultiselect || s.rangeFilter) && ![this.constants.DATE].includes(s.type);
},
createXls(n = "all") {
const s = this.dataset.header.map((e) => e.name), r = n === "all" ? this.bodyCopy.map((e) => e.td) : this.visibleRows.map((e) => e.td), i = [s].concat(r), t = this.createCsvContent(i);
this.downloadCsv({ csvContent: t, title: "vue-ui-table" });
},
calcLinearProgression: P,
closeAllDropdowns() {
const n = document.getElementsByClassName("th-dropdown");
n.length && Array.from(n).forEach((s) => {
s.dataset.isOpen = !1;
});
},
debounce(n, s) {
let r;
clearTimeout(r), r = setTimeout(n, s);
},
filterBody() {
this.bodyCopy = this.tableBody.filter((n) => {
for (const s in this.searches)
if (!n.td[s].toUpperCase().includes(this.searches[s].toUpperCase()))
return !1;
for (const s in this.multiselects)
if (!this.multiselects[s].some((i) => i === n.td[s]))
return !1;
for (const s in this.dates) {
const r = new Date(n.td[s]), i = new Date(this.dates[s].from), t = new Date(this.dates[s].to);
if (r < i || r > t)
return !1;
}
return !0;
}), this.sortBody();
},
getAverage(n) {
return this.rows.map((s) => s[n]).map((s) => isNaN(Number(s)) ? 0 : s).reduce((s, r) => s + r, 0) / this.bodyCopy.length;
},
getDatesRange(n) {
const s = this.dataset.body.map((F) => new Date(F.td[n])), r = new Date(Math.min(...s)), i = new Date(Math.max(...s)), t = r.getFullYear(), e = i.getFullYear(), y = String(r.getMonth() + 1).padStart(2, "0"), f = String(i.getMonth() + 1).padStart(2, "0"), l = String(r.getDate()).padStart(2, "0"), o = String(i.getDate()).padStart(2, "0"), h = `${t}-${y}-${l}`, m = `${e}-${f}-${o}`;
return {
from: h,
to: m
};
},
getDonutLegendValue(n) {
return Number((n * (this.dataset.header[this.currentSelectionSpan.col].isPercentage ? 100 : 1)).toFixed(this.dataset.header[this.currentSelectionSpan.col].decimals)).toLocaleString();
},
getDropdownOptions(n) {
return [...new Set(this.dataset.body.map((s) => s.td[n]))];
},
getSum(n) {
return this.rows.map((s) => s[n]).map((s) => isNaN(Number(s)) ? 0 : s).reduce((s, r) => s + r, 0);
},
includesNaN(n) {
return n.includes(NaN);
},
isDropdownOptionSelected(n, s) {
return this.multiselects[s] ? this.multiselects[s].includes(n) : !0;
},
isNumeric(n) {
return !isNaN(Number(String(n).replaceAll("%", "")));
},
isResetDisabled(n, s) {
const r = s.isSort, i = s.isSearch, t = s.isMultiselect && this.multiselects[n], e = s.rangeFilter, y = (f) => {
if (e && this.rangeFilters[f])
return Math.round(this.rangeFilters[f].min) === this.immutableRangeFilters[f].min && Math.round(this.rangeFilters[f].max) === this.immutableRangeFilters[f].max;
};
if (r && i && t && e)
return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
if (r && i && t)
return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
if (r && i && e)
return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]) && y(n);
if (r && i)
return ["", void 0].includes(this.searches[n]) && [void 0].includes(this.sorts[n]);
if (r && t && e)
return [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
if (r && t)
return [void 0].includes(this.sorts[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
if (i && t && e)
return ["", void 0].includes(this.searches[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
if (i && t)
return ["", void 0].includes(this.searches[n]) && this.multiselects[n].length === this.getDropdownOptions(n).length;
if (i && e)
return ["", void 0].includes(this.searches[n]) && y(n);
if (i)
return ["", void 0].includes(this.searches[n]);
if (r && e)
return [void 0].includes(this.sorts[n]) && y(n);
if (r)
return [void 0].includes(this.sorts[n]);
if (t && e)
return this.multiselects[n].length === this.getDropdownOptions(n).length && y(n);
if (t)
return this.multiselects[n].length === this.getDropdownOptions(n).length;
},
navigate(n) {
this.resetSelection(), n === "next" && this.currentPage < this.pages.length ? this.currentPage += 1 : n === "previous" && this.currentPage >= 1 ? this.currentPage -= 1 : this.currentPage = n - 1, this.$refs.tableWrapper.scrollTo({
top: 0,
left: 0,
behavior: "smooth"
});
},
navigateCell(n) {
n.preventDefault();
const s = n.keyCode, r = 38, i = 40, t = 37, e = 39;
if (![r, i, t, e].includes(s)) return;
const y = n.target.id, f = /cell_(\d+)_(\d+)_vue-ui-table-(\d+)/, l = y.match(f), o = parseInt(l[1]), h = parseInt(l[2]), m = document.getElementById(`cell_${o}_${h + 1}_${this.uid}`), F = document.getElementById(`cell_${o}_${h - 1}_${this.uid}`), k = document.getElementById(`cell_${o + 1}_${h}_${this.uid}`), N = document.getElementById(`cell_${o - 1}_${h}_${this.uid}`);
let C;
switch (!0) {
case s === e:
C = m;
break;
case s === t:
C = F;
break;
case s === r:
C = N;
break;
case s === i:
C = k;
break;
default:
return;
}
C && (C.focus(), C.scrollIntoView({ behavior: "smooth", block: "center" }));
},
openDonutOptions() {
this.selectedDonutCategory = this.availableDonutCategories[0], this.showDonutOptions = !0;
},
placeLabelOnTopOrBottom({ previousPlot: n, currentPlot: s, nextPlot: r }) {
const i = s.y - 38, t = s.y + 16;
return n && r ? n.value < s.value && r.value < s.value ? i : n.value > s.value && r.value > s.value ? t : (n.value > s.value && r.value < s.value || n.value < s.value && r.value > s.value, i) : n && !r ? n.value > s.value ? t : i : !n && r && r.value > s.value ? t : i;
},
async prepareBodyCopy() {
return new Promise((n) => {
const s = [];
this.tableHead.forEach((r, i) => {
if (r.isSearch && Object.assign(this.searches, { [i]: "" }), r.isMultiselect && Object.assign(this.multiselects, { [i]: this.getDropdownOptions(i) }), r.type === this.constants.DATE && (Object.assign(this.dates, { [i]: this.getDatesRange(i) }), Object.assign(this.filteredDatesIndexes, { [i]: !1 })), (r.isPercentage || r.percentageTo) && Object.assign(this.percentages, {
[i]: {
reference: r.percentageTo,
referenceIndex: this.dataset.header.map((t) => t.name).indexOf(r.percentageTo)
}
}), r.rangeFilter && (Object.assign(this.rangeFilters, {
[i]: {
min: Math.round(Math.min(...this.dataset.body.map((t) => t.td).map((t) => t[i]))),
max: Math.round(Math.max(...this.dataset.body.map((t) => t.td).map((t) => t[i])))
}
}), Object.assign(this.immutableRangeFilters, {
[i]: {
min: Math.round(Math.min(...this.dataset.body.map((t) => t.td).map((t) => t[i]))),
max: Math.round(Math.max(...this.dataset.body.map((t) => t.td).map((t) => t[i])))
}
})), r.isPercentage) {
const t = this.dataset.header.map((y) => y.name).indexOf(r.percentageTo), e = this.dataset.body.map((y) => y.td[t]).reduce((y, f) => y + f, 0);
s.push([i, t, e]);
}
r.type === this.constants.NUMERIC && !r.isPercentage && Object.assign(this.hasNaN, { [i]: this.includesNaN(this.dataset.body.map((t) => Number(t.td[i]))) });
}), this.bodyCopy.forEach((r, i) => {
s.map((t) => {
const [e, y, f] = t;
r.td[e] = r.td[y] / f;
}), r.td.forEach((t, e) => {
this.dataset.header[e].type === this.constants.TEXT && this.dataset.header[e].isSearch && (r[e] = this.stringToNumber(t)), this.dataset.header[e].type === this.constants.DATE && (r[e] = new Date(t).getTime()), this.dataset.header[e].type === this.constants.NUMERIC && (r[e] = isNaN(Number(t)) ? e : t), this.tableBody[i][e] = r[e];
});
}), n(!0);
});
},
promiseWithAsyncFunction(n, s) {
return new Promise((r, i) => {
n().then((t) => {
try {
const e = s(t);
r(e);
} catch (e) {
i(e);
}
}).catch((t) => {
i(t);
});
});
},
resetDates(n) {
this.dates[n] = {
from: this.getDatesRange(n).from,
to: this.getDatesRange(n).to
}, this.filteredDatesIndexes[n] = !1, this.$forceUpdate(), this.filterBody();
},
resetFilter(n, s, r) {
const i = r.currentTarget;
clearTimeout(this.buttonTimeout), i.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
i.classList.remove("clicked");
}, 200), this.currentFilter = void 0, s.rangeFilter && (this.rangeFilters[n].min = this.immutableRangeFilters[n].min, this.rangeFilters[n].max = this.immutableRangeFilters[n].max), s.isMultiselect ? (this.multiselects[n] = this.getDropdownOptions(n), s.type === this.constants.TEXT && (this.sorts[n] = void 0), s.isSearch && (this.searches[n] = "")) : s.type === this.constants.NUMERIC ? this.sorts[n] = void 0 : s.type === this.constants.TEXT ? (this.sorts[n] = void 0, this.searches[n] = "") : s.type === this.constants.DATE && (this.sorts[n] = void 0), this.filterBody();
},
resetSelection() {
const n = document.getElementsByClassName(`tr_${this.uid}`);
Array.from(n).forEach((s) => {
Array.from(s.getElementsByTagName("td")).forEach((r) => {
r.dataset.row === "even" ? (r.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, r.style.color = this.FINAL_CONFIG.style.rows.even.color) : (r.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, r.style.color = this.FINAL_CONFIG.style.rows.odd.color);
});
}), Array.from(n).forEach((s) => s.dataset.selected = "false"), this.currentPage > this.pages.length - 1 && (this.currentPage = this.pages.length - 1), this.showChart = !1, this.currentDonut = void 0, this.selectedColumn = void 0, this.chart.type = this.constants.BAR, this.currentSelectionSpan = {
col: void 0,
rows: []
}, this.clientX = 100, this.clientY = 100;
},
selectColumn(n) {
this.currentSelectionSpan.col !== n ? (this.visibleRows.forEach((s, r) => {
this.selectTd({
td: s.td[n],
rowIndex: r,
colIndex: n,
headerType: this.constants.NUMERIC,
event: {
currentTarget: document.getElementById(`cell_${r}_${n}_${this.uid}`)
}
});
}), this.selectedColumn = n) : (this.selectedColumn = void 0, this.resetSelection());
},
selectDropdownOption(n, s) {
this.multiselects[s].includes(n) ? this.multiselects[s] = this.multiselects[s].filter((r) => r !== n) : this.multiselects[s].push(n), this.$forceUpdate(), this.filterBody();
},
selectTd({ td: n, rowIndex: s, colIndex: r, headerType: i, event: t }) {
if (i !== this.constants.NUMERIC || isNaN(Number(n))) {
this.resetSelection();
return;
}
this.currentSelectionSpan.col !== r && this.resetSelection();
const e = t.currentTarget.parentNode;
this.currentSelectionSpan.col = r, this.currentSelectionSpan.rows.map((y) => y.index).includes(s) ? (e.dataset.selected = "false", this.currentSelectionSpan.rows = this.currentSelectionSpan.rows.filter((y) => y.index !== s), t.currentTarget.classList.remove(this.cssClass.CELL), Array.from(e.children).forEach((y, f) => {
y.dataset.row === "even" ? (y.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.even.olor) : (y.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.odd.color);
}), t.currentTarget.dataset.row === "even" ? (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.even.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.even.color) : (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.odd.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.odd.color)) : (e.dataset.selected = "true", this.currentSelectionSpan.rows.push({
index: s,
value: n
}), Array.from(e.children).forEach((y, f) => {
y.dataset.row === "even" ? (y.style.background = this.FINAL_CONFIG.style.rows.even.selectedNeighbors.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.even.selectedNeighbors.color) : (y.style.background = this.FINAL_CONFIG.style.rows.odd.selectedNeighbors.backgroundColor, y.style.color = this.FINAL_CONFIG.style.rows.odd.selectedNeighbors.color);
}), t.currentTarget.dataset.row === "odd" ? (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.odd.selectedCell.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.odd.selectedCell.color) : (t.currentTarget.style.background = this.FINAL_CONFIG.style.rows.even.selectedCell.backgroundColor, t.currentTarget.style.color = this.FINAL_CONFIG.style.rows.even.selectedCell.color)), this.currentSelectionSpan.rows = this.currentSelectionSpan.rows.sort((y, f) => y.index - f.index), this.chart.type === this.constants.DONUT && this.currentSelectionSpan.rows.length > 0 && this.applyDonutOption();
},
setFilterDatesIndexes(n) {
this.filteredDatesIndexes[n] = !(this.getDatesRange(n).from === this.dates[n].from && this.getDatesRange(n).to === this.dates[n].to);
},
sortBody() {
this.resetSelection(), Object.keys(this.rangeFilters).forEach((n) => {
this.filterByRange(this.bodyCopy, n);
}), Object.keys(this.sorts).forEach((n) => {
this.sortByNumber(this.bodyCopy, n);
}), this.currentFilter !== void 0 && this.sortByNumber(this.bodyCopy, this.currentFilter), this.dataset.header.forEach((n, s) => {
if (n.isPercentage) {
const r = this.percentages[s].referenceIndex, i = this.bodyCopy.map((t) => t.td[r]).reduce((t, e) => t + e, 0);
this.bodyCopy.forEach((t) => {
t.td[s] = t.td[r] / i;
});
}
}), this.currentPage > this.pages.length - 1 && (this.currentPage = this.pages.length - 1), [-1].includes(this.currentPage) && (this.currentPage = 0), this.$forceUpdate();
},
filterByRange(n, s) {
this.bodyCopy = n.filter((r) => r.td[s] >= this.rangeFilters[s].min && r[s] <= this.rangeFilters[s].max);
},
sortByNumber(n, s) {
if (this.sorts[s] === this.constants.ASC && (n = n.sort((r, i) => r[s] - i[s])), this.sorts[s] === this.constants.DESC)
n = n.sort((r, i) => i[s] - r[s]);
else
return 0;
},
sortTh(n, s) {
this.currentFilter = n;
const r = s.currentTarget;
clearTimeout(this.buttonTimeout), r.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
r.classList.remove("clicked");
}, 200), this.sorts[n] === 1 ? this.sorts[n] = this.constants.DESC : this.sorts[n] = this.constants.ASC, this.sortBody();
},
stringToNumber(n) {
let s = 0;
for (let r = 0; r < n.length; r += 1)
s += n.charCodeAt(r);
return s;
},
toggleMultiselect(n, s, r) {
const i = r.currentTarget;
clearTimeout(this.buttonTimeout), i.classList.add("clicked"), this.buttonTimeout = setTimeout(() => {
i.classList.remove("clicked");
}, 200);
const t = document.getElementById(`th_dropdown_${n}`);
t.dataset.isOpen === "false" ? t.dataset.isOpen = "true" : t.dataset.isOpen = "false";
},
updateCurrentPage(n) {
this.resetSelection(), !n || !n.target.value ? this.currentPage = 0 : this.currentPage = Number(n.target.value);
},
// DONUTS
calcDonutMarkerConnectorColor(n) {
return n.proportion * 100 > 3 ? n.color : "transparent";
},
calcDonutMarkerLabelPositionX(n) {
return n.center.endX + this.calcMarkerOffset(n, 50);
},
calcMarkerOffset(n, s) {
return n.center.endX - s >= 0 ? 3 : -2;
},
displayArcPercentage(n, s) {
return isNaN(n.value / this.sumValues(s)) ? 0 : (n.value / this.sumValues(s) * 100).toFixed(0) + "%";
},
isArcBigEnough(n) {
return n.proportion * 100 > 3;
},
sumValues(n) {
return [...n].map((s) => s.value).reduce((s, r) => s + r, 0);
},
// CHART DRAGGING METHODS
closeDragElement() {
document.onmouseup = null, document.onmousemove = null;
},
dragMouseDown(n) {
n = n || window.event, n.preventDefault();
const r = this.$refs.chartModal.getBoundingClientRect();
this.dragOffsetX = n.clientX - r.left, this.dragOffsetY = n.clientY - r.top, this.modalWidth = r.width, this.modalHeight = r.height, document.onmouseup = this.closeDragElement, document.onmousemove = this.elementDrag;
},
elementDrag(n) {
if (this.rafId) return;
const r = this.$refs.chartModal.getBoundingClientRect();
this.clientX = n.clientX - this.dragOffsetX, this.clientY = n.clientY - this.dragOffsetY - 40, this.clientX < 0 && (this.clientX = 0), this.clientX + r.width > window.innerWidth && (this.clientX = window.innerWidth - r.width - 48), this.clientY < 0 && (this.clientY = 0), this.clientY + r.height > window.innerHeight && (this.clientY = window.innerHeight - r.height - 24);
}
}
}, ne = { class: "vue-ui-table-export-hub" }, re = ["innerHTML"], oe = ["data-is-open"], le = { class: "vue-ui-table-export-hub-options" }, ae = { class: "vue-ui-table-export-hub-option-wrapper" }, ie = { class: "label" }, ce = ["innerHTML"], ue = { class: "vue-ui-table-export-hub-option-wrapper" }, he = { class: "label" }, de = ["innerHTML"], ge = { class: "vue-ui-table" }, ye = { id: "tableHead" }, me = { key: 0 }, be = { key: 0 }, fe = { key: 1 }, Ne = {
key: 0,
style: { display: "flex", "align-items": "center", "justify-content": "flex-end" }
}, pe = ["innerHTML"], Ce = {
key: 0,
style: { "margin-left": "3px" }
}, Ie = { key: 0 }, Fe = { class: "th-filter" }, ve = {
key: 0,
class: "th-date"
}, we = { class: "date-wrapper--inputs" }, _e = { class: "date-fieldset" }, ke = ["for"], Oe = ["id", "onUpdate:modelValue", "onInput"], Se = { class: "date-fieldset" }, Le = ["for"], Ae = ["id", "onUpdate:modelValue", "onInput"], Me = { class: "date-wrapper--button" }, De = ["onClick"], Ge = ["innerHTML"], Te = ["innerHTML"], xe = ["innerHTML"], Ee = ["onClick", "disabled"], Be = ["placeholder", "onUpdate:modelValue", "name"], He = ["onClick"], Re = ["innerHTML"], Pe = ["innerHTML"], ze = ["innerHTML"], Ue = ["onClick", "innerHTML"], Ve = ["innerHTML"], Xe = {
key: 5,
class: "th-range-filter"
}, je = ["for"], Ye = ["id", "max", "min", "onUpdate:modelValue"], We = ["id", "max", "min", "onUpdate:modelValue"], Je = ["for"], Ke = ["onClick", "disabled"], Ze = ["id"], qe = ["onClick"], Qe = ["onClick", "onKeyup"], $e = ["innerHTML", "onClick", "onKeyup"], et = ["data-row"], tt = ["data-row"], st = ["data-row", "onClick", "onKeyup", "id"], nt = ["innerHTML"], rt = { key: 1 }, ot = { key: 2 }, lt = { key: 5 }, at = ["innerHTML"], it = { key: 0 }, ct = { style: { "margin-left": "12px" } }, ut = { class: "format-num" }, ht = { style: { "margin-left": "12px" } }, dt = {
key: 0,
class: "format-num"
}, gt = {
key: 1,
class: "format-num"
}, yt = { key: 2 }, mt = { style: { "margin-left": "12px" } }, bt = {
key: 0,
class: "format-num"
}, ft = {
key: 1,
class: "format-num"
}, Nt = { key: 2 }, pt = {
key: 0,
class: "vue-ui-table-paginator format-num"
}, Ct = {
key: 1,
class: "vue-ui-table-size-warning"
}, It = ["innerHTML"], Ft = {
key: 3,
class: "vue-ui-table-pagination format-num"
}, vt = ["innerHTML", "disabled"], wt = ["disabled"], _t = {
key: 0,
class: "vue-ui-table-page-scroller-wrapper"
}, kt = {
for: "pageScroller",
style: { "font-size": "14px" }
}, Ot = ["max", "value"], St = { key: 1 }, Lt = ["disabled"], At = ["innerHTML", "disabled"], Mt = ["innerHTML"], Dt = { class: "chart-modal-options" }, Gt = ["innerHTML"], Tt = ["innerHTML"], xt = ["innerHTML"], Et = {
style: { width: "100%", height: "fit-content" },
ref: "chartModal"
}, Bt = { class: "vue-ui-table-fieldset" }, Ht = { class: "vue-ui-table-fieldset-wrapper" }, Rt = ["name", "id", "checked", "onInput"], Pt = ["for"], zt = ["disabled"], Ut = ["innerHTML"], Vt = { style: { width: "100%", "margin-bottom": "12px" } }, Xt = {
key: 2,
style: { width: "100%", "margin-bottom": "32px" }
};
function jt(n, s, r, i, t, e) {
const y = x("VueUiXy"), f = x("VueUiDonut");
return c(), u("div", {
class: "vue-ui-table-main",
style: g(`font-family: ${e.FINAL_CONFIG.fontFamily}`)
}, [
a("div", ne, [
a("button", {
onClick: s[0] || (s[0] = (l) => t.isExportRequest = !t.isExportRequest),
innerHTML: e.icons.export,
style: g(`background:${e.FINAL_CONFIG.style.exportMenu.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.color}`)
}, null, 12, re),
a("div", {
class: "vue-ui-table-export-hub-dropdown",
"data-is-open": t.isExportRequest || "false",
style: g(`background:${e.FINAL_CONFIG.style.exportMenu.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.color}`)
}, [
s[25] || (s[25] = a("b", { class: "vue-ui-table-export-hub-title" }, " Export ", -1)),
a("button", {
class: "close-dropdown",
onClick: s[1] || (s[1] = (l) => t.isExportRequest = !1),
style: g(`background:${e.FINAL_CONFIG.style.closeButtons.backgroundColor};color:${e.FINAL_CONFIG.style.closeButtons.color};border-radius:${e.FINAL_CONFIG.style.closeButtons.borderRadius}`)
}, " ✖ ", 4),
a("div", le, [
a("div", ae, [
a("div", ie, d(e.FINAL_CONFIG.translations.exportAllLabel) + " (" + d(t.bodyCopy.length) + ") ", 1),
a("button", {
id: "exportAll",
onClick: s[2] || (s[2] = (l) => e.createXls("all")),
style: g(`background:${e.FINAL_CONFIG.style.exportMenu.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.buttons.color}`)
}, [
a("div", {
innerHTML: e.icons.fileDownload
}, null, 8, ce),
a("span", null, d(e.FINAL_CONFIG.translations.exportAllButton), 1)
], 4)
]),
a("div", ue, [
a("div", he, d(e.FINAL_CONFIG.translations.exportPageLabel), 1),
a("button", {
id: "exportPage",
onClick: s[3] || (s[3] = (l) => e.createXls("page")),
style: g(`background:${e.FINAL_CONFIG.style.exportMenu.buttons.backgroundColor};color:${e.FINAL_CONFIG.style.exportMenu.buttons.color}`)
}, [
a("div", {
innerHTML: e.icons.fileDownload
}, null, 8, de),
a("span", null, d(e.FINAL_CONFIG.translations.exportPageButton), 1)
], 4)
])
])
], 12, oe)
]),
a("div", {
class: "vue-ui-table__wrapper",
style: g(`max-height:${e.FINAL_CONFIG.maxHeight}px`),
ref: "tableWrapper"
}, [
a("table", ge, [
a("thead", ye, [
a("tr", null, [
s[26] || (s[26] = a("th", { class: "invisible-cell" }, null, -1)),
(c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {
key: `thead_${o}`,
style: g(`overflow: visible;background:${e.FINAL_CONFIG.style.th.backgroundColor};color:${e.FINAL_CONFIG.style.th.color};outline:${e.FINAL_CONFIG.style.th.outline}`),
class: p({ "th-has-nan": t.hasNaN[o] })
}, [
e.hasNumericTypes && ([t.constants.TEXT, t.constants.DATE].includes(l.type) || l.isPercentage) ? (c(), u("span", me, [
w(d(l.name) + " ", 1),
l.isPercentage ? (c(), u("span", be, " / " + d(l.percentageTo), 1)) : b("", !0)
])) : (c(), u("span", fe, d(l.name), 1))
], 6))), 128))
]),
e.hasNumericTypes ? (c(), u(I, { key: 0 }, [
a("tr", null, [
s[27] || (s[27] = a("th", { class: "invisible-cell" }, null, -1)),
(c(!0), u(I, null, _(t.tableHead, (l, o) => (c(), u("th", {