@kong-ui-public/analytics-chart 10.21.13 → 10.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20929,7 +20929,217 @@ const vA = /* @__PURE__ */ ue({
20929
20929
  ]), 1032, ["title-tag"]);
20930
20930
  };
20931
20931
  }
20932
- }), NP = /* @__PURE__ */ We(tP, [["__scopeId", "data-v-bd2cedcf"]]);
20932
+ }), NP = /* @__PURE__ */ We(tP, [["__scopeId", "data-v-bd2cedcf"]]), eP = { class: "container" }, nP = {
20933
+ key: 0,
20934
+ class: "no-data",
20935
+ "data-testid": "sparkline-empty"
20936
+ }, iP = ["title"], sP = /* @__PURE__ */ ue({
20937
+ __name: "SparklineChart",
20938
+ props: {
20939
+ chartKey: { default: () => {
20940
+ } },
20941
+ datasets: {},
20942
+ disableTooltip: { type: Boolean, default: !1 },
20943
+ enableBrushing: { type: Boolean, default: !1 },
20944
+ groupKey: { default: () => {
20945
+ } },
20946
+ maxCount: { default: () => {
20947
+ } },
20948
+ maxStamp: { default: () => {
20949
+ } },
20950
+ minCount: { default: () => {
20951
+ } },
20952
+ minStamp: { default: () => {
20953
+ } },
20954
+ pointRenderCount: { default: 24 },
20955
+ showLabel: { type: Boolean, default: !1 },
20956
+ tooltipTitle: { default: () => {
20957
+ } },
20958
+ type: { default: "sparkline_bar" }
20959
+ },
20960
+ setup(e) {
20961
+ const t = crypto.randomUUID(), { i18n: n } = bt.useI18n(), {
20962
+ syncedGroupSizeMs: i,
20963
+ syncedMinStamp: s,
20964
+ syncedMaxStamp: r,
20965
+ syncedMinCount: o,
20966
+ syncedMaxCount: a,
20967
+ syncedRenderPoints: l,
20968
+ syncedChartDatasets: c
20969
+ } = bt.useSparklineSync({
20970
+ chartKey: e.chartKey,
20971
+ datasets: e.datasets,
20972
+ groupKey: e.groupKey,
20973
+ minStamp: e.minStamp,
20974
+ maxStamp: e.maxStamp,
20975
+ minCount: e.minCount,
20976
+ maxCount: e.maxCount,
20977
+ renderPoints: e.pointRenderCount,
20978
+ type: e.type
20979
+ }), u = tr({
20980
+ showTooltip: !1,
20981
+ tooltipContext: 0,
20982
+ // Set in lineChartTooltipBehavior
20983
+ metricDisplay: "",
20984
+ tooltipSeries: [],
20985
+ left: "",
20986
+ top: "",
20987
+ units: "count",
20988
+ translateUnit: () => "",
20989
+ offsetX: 0,
20990
+ offsetY: 0,
20991
+ width: 0,
20992
+ height: 0,
20993
+ chartType: e.type === "sparkline_bar" ? "timeseries_bar" : "timeseries_line",
20994
+ chartID: t,
20995
+ interactionMode: "idle"
20996
+ }), d = ({ width: O, height: _ }) => {
20997
+ u.width = O, u.height = _;
20998
+ }, h = L(() => e.disableTooltip ? [] : [new lg({
20999
+ // if either groupKey or chartKey is undefined then brushing doesn't make any
21000
+ // sense as the data in this chart isn't related to any other data.
21001
+ enableBrushing: e.groupKey !== void 0 && e.chartKey !== void 0 && e.enableBrushing,
21002
+ brushStrategy: "group",
21003
+ brushGroup: e.groupKey
21004
+ })]), f = L(() => c.value.reduce((O, { data: _, label: b }) => ({
21005
+ ...O,
21006
+ [b]: _.reduce((w, { y: M }) => w + M, 0)
21007
+ }), {})), p = L(() => c.value.map(({ label: O }) => [
21008
+ f.value[O],
21009
+ `${O}: ${f.value[O]}`
21010
+ ]).sort(([O], [_]) => _ - O).map(([, O]) => O).join(", ")), m = L(() => Object.keys(f.value).map((O) => f.value[O]).reduce((O, _) => O + _, 0)), y = L(() => m.value > 0), x = L(() => ({
21011
+ labels: new Array(l.value).fill(""),
21012
+ datasets: c.value
21013
+ })), T = L(() => e.datasets.length > 1), C = `SparklineTooltipPosition-${t}`, D = L(() => {
21014
+ const O = e.type === "sparkline_bar", _ = O ? s.value - 1 : s.value, b = O ? r.value : r.value - i.value;
21015
+ return {
21016
+ maintainAspectRatio: !1,
21017
+ elements: {
21018
+ categoryPercentage: 1,
21019
+ barPercentage: 1,
21020
+ line: {
21021
+ tension: 0,
21022
+ stepped: e.type === "sparkline_step",
21023
+ borderWidth: 1
21024
+ },
21025
+ point: {
21026
+ radius: 0,
21027
+ pointHitRadius: 11,
21028
+ pointHoverRadius: 0
21029
+ }
21030
+ },
21031
+ interaction: {
21032
+ intersect: !1,
21033
+ mode: "index"
21034
+ },
21035
+ layout: {
21036
+ padding: {
21037
+ left: O ? 0 : 2,
21038
+ right: O ? 0 : 2,
21039
+ top: 2
21040
+ }
21041
+ },
21042
+ plugins: {
21043
+ legend: {
21044
+ display: !1
21045
+ },
21046
+ tooltip: {
21047
+ enabled: !1,
21048
+ position: C,
21049
+ external: (w) => {
21050
+ yp(u, w, "minutely", {
21051
+ contextFormatter: (M) => {
21052
+ const E = M + i.value;
21053
+ let j = "";
21054
+ return i.value > 1440 * 60 * 1e3 ? j = So(new Date(E), "MMM dd, yyy hh:mm a") : j = So(new Date(E), "hh:mm a"), `${nT(M)} - ${j}`;
21055
+ }
21056
+ });
21057
+ }
21058
+ }
21059
+ },
21060
+ scales: {
21061
+ x: {
21062
+ min: _,
21063
+ max: b,
21064
+ type: "timeseries",
21065
+ offset: !1,
21066
+ grid: {
21067
+ display: !1
21068
+ },
21069
+ display: !1,
21070
+ stacked: T.value
21071
+ },
21072
+ y: {
21073
+ min: Math.max(o.value - 1, 0),
21074
+ max: a.value,
21075
+ grid: {
21076
+ display: !1
21077
+ },
21078
+ display: !1,
21079
+ stacked: T.value
21080
+ }
21081
+ }
21082
+ };
21083
+ }), k = Vt("0"), A = Vt("0");
21084
+ return Qn(() => {
21085
+ He.positioners[C] = function(O, _) {
21086
+ if (!O.length || u.interactionMode === "interactive" || _.x === null)
21087
+ return !1;
21088
+ const b = 10, w = this.chart.canvas.getBoundingClientRect(), M = u.width || this.width, E = u.height || this.height, j = w.top - E > 0, H = j ? w.top - E - b : w.top + w.height + b, V = w.left > M / 2 - _.x, B = Math.max(b, window.innerWidth - b - M), $ = Math.min(B, V ? Math.floor(w.left - M / 2) + _.x : 0 + b);
21089
+ return k.value = `${H}px`, A.value = `${$}px`, {
21090
+ x: $,
21091
+ y: H,
21092
+ xAlign: "center",
21093
+ yAlign: j ? "top" : "bottom"
21094
+ };
21095
+ };
21096
+ }), Zn(() => {
21097
+ He.positioners[C] && delete He.positioners[C];
21098
+ }), (O, _) => (X(), at("div", eP, [
21099
+ y.value ? e.type === "sparkline_bar" ? (X(), It(Z(rg), {
21100
+ key: 1,
21101
+ "chart-id": Z(t),
21102
+ data: x.value,
21103
+ "data-testid": "sparkline-bar",
21104
+ options: D.value,
21105
+ plugins: h.value
21106
+ }, null, 8, ["chart-id", "data", "options", "plugins"])) : e.type === "sparkline_line" || e.type === "sparkline_step" ? (X(), It(Z(ag), {
21107
+ key: 2,
21108
+ "chart-id": Z(t),
21109
+ data: x.value,
21110
+ "data-testid": e.type === "sparkline_line" ? "sparkline-line" : "sparkline-step",
21111
+ options: D.value,
21112
+ plugins: h.value
21113
+ }, null, 8, ["chart-id", "data", "data-testid", "options", "plugins"])) : Nt("", !0) : (X(), at("div", nP, [
21114
+ ts(O.$slots, "empty", {}, () => [
21115
+ Ee(ut(Z(n).t("sparkline_no_data")), 1)
21116
+ ], !0)
21117
+ ])),
21118
+ e.disableTooltip ? Nt("", !0) : (X(), It(Vo, {
21119
+ key: 3,
21120
+ "absolute-left": A.value,
21121
+ "absolute-top": k.value,
21122
+ class: "tooltip",
21123
+ "data-testid": "sparkline-tooltip",
21124
+ state: u,
21125
+ "tooltip-title": e.tooltipTitle,
21126
+ onDimensions: d
21127
+ }, null, 8, ["absolute-left", "absolute-top", "state", "tooltip-title"])),
21128
+ y.value && e.showLabel ? (X(), at("div", {
21129
+ key: 4,
21130
+ class: "label",
21131
+ title: O.$slots.label ? "" : p.value
21132
+ }, [
21133
+ ts(O.$slots, "label", {
21134
+ total: m.value,
21135
+ totalByDataset: f.value
21136
+ }, () => [
21137
+ Ee(ut(p.value), 1)
21138
+ ], !0)
21139
+ ], 8, iP)) : Nt("", !0)
21140
+ ]));
21141
+ }
21142
+ }), FP = /* @__PURE__ */ We(sP, [["__scopeId", "data-v-ae8259b6"]]);
20933
21143
  var Ke = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
20934
21144
  function cg(e) {
20935
21145
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -20937,7 +21147,7 @@ function cg(e) {
20937
21147
  var Ys = { exports: {} };
20938
21148
  Ys.exports;
20939
21149
  var wh;
20940
- function eP() {
21150
+ function rP() {
20941
21151
  return wh || (wh = 1, (function(e, t) {
20942
21152
  var n = 200, i = "Expected a function", s = "__lodash_hash_undefined__", r = 1, o = 2, a = 9007199254740991, l = "[object Arguments]", c = "[object Array]", u = "[object Boolean]", d = "[object Date]", h = "[object Error]", f = "[object Function]", p = "[object GeneratorFunction]", m = "[object Map]", y = "[object Number]", x = "[object Object]", T = "[object Promise]", C = "[object RegExp]", D = "[object Set]", k = "[object String]", A = "[object Symbol]", O = "[object WeakMap]", _ = "[object ArrayBuffer]", b = "[object DataView]", w = "[object Float32Array]", M = "[object Float64Array]", E = "[object Int8Array]", j = "[object Int16Array]", H = "[object Int32Array]", V = "[object Uint8Array]", B = "[object Uint8ClampedArray]", $ = "[object Uint16Array]", R = "[object Uint32Array]", z = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, U = /^\w*$/, P = /^\./, N = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, W = /[\\^$.*+?()[\]{}|]/g, tt = /\\(\\)?/g, Q = /^\[object .+?Constructor\]$/, q = /^(?:0|[1-9]\d*)$/, G = {};
20943
21153
  G[w] = G[M] = G[E] = G[j] = G[H] = G[V] = G[B] = G[$] = G[R] = !0, G[l] = G[c] = G[_] = G[u] = G[b] = G[d] = G[h] = G[f] = G[m] = G[y] = G[x] = G[C] = G[D] = G[k] = G[O] = !1;
@@ -21525,10 +21735,10 @@ function eP() {
21525
21735
  e.exports = ws;
21526
21736
  })(Ys, Ys.exports)), Ys.exports;
21527
21737
  }
21528
- var nP = eP();
21529
- const iP = /* @__PURE__ */ cg(nP);
21738
+ var oP = rP();
21739
+ const aP = /* @__PURE__ */ cg(oP);
21530
21740
  var pl, Sh;
21531
- function sP() {
21741
+ function lP() {
21532
21742
  if (Sh) return pl;
21533
21743
  Sh = 1;
21534
21744
  var e = 9007199254740991, t = "[object Arguments]", n = "[object Function]", i = "[object GeneratorFunction]", s = "[object Symbol]", r = typeof Ke == "object" && Ke && Ke.Object === Object && Ke, o = typeof self == "object" && self && self.Object === Object && self, a = r || o || Function("return this")();
@@ -21627,14 +21837,14 @@ function sP() {
21627
21837
  });
21628
21838
  return pl = $, pl;
21629
21839
  }
21630
- var rP = sP();
21631
- const oP = /* @__PURE__ */ cg(rP);
21632
- var co = { exports: {} }, aP = co.exports, Th;
21633
- function lP() {
21840
+ var cP = lP();
21841
+ const uP = /* @__PURE__ */ cg(cP);
21842
+ var co = { exports: {} }, dP = co.exports, Th;
21843
+ function hP() {
21634
21844
  return Th || (Th = 1, (function(e, t) {
21635
21845
  (function(n, i) {
21636
21846
  i();
21637
- })(aP, function() {
21847
+ })(dP, function() {
21638
21848
  function n(c, u) {
21639
21849
  return typeof u > "u" ? u = { autoBom: !1 } : typeof u != "object" && (console.warn("Deprecated: Expected third argument to be a object"), u = { autoBom: !u }), u.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type) ? new Blob(["\uFEFF", c], { type: c.type }) : c;
21640
21850
  }
@@ -21700,13 +21910,13 @@ function lP() {
21700
21910
  });
21701
21911
  })(co)), co.exports;
21702
21912
  }
21703
- var cP = lP(), uo = { exports: {} };
21704
- var uP = uo.exports, Mh;
21705
- function dP() {
21913
+ var fP = hP(), uo = { exports: {} };
21914
+ var pP = uo.exports, Mh;
21915
+ function gP() {
21706
21916
  return Mh || (Mh = 1, (function(e, t) {
21707
21917
  ((n, i) => {
21708
21918
  e.exports = i();
21709
- })(uP, function n() {
21919
+ })(pP, function n() {
21710
21920
  var i = typeof self < "u" ? self : typeof window < "u" ? window : i !== void 0 ? i : {}, s, r = !i.document && !!i.postMessage, o = i.IS_PAPA_WORKER || !1, a = {}, l = 0, c = {};
21711
21921
  function u(_) {
21712
21922
  this._handle = null, this._finished = !1, this._completed = !1, this._halted = !1, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = !0, this._completeResults = { data: [], errors: [], meta: {} }, (function(b) {
@@ -22112,8 +22322,8 @@ function dP() {
22112
22322
  });
22113
22323
  })(uo)), uo.exports;
22114
22324
  }
22115
- var hP = dP();
22116
- const fP = ["id"], pP = /* @__PURE__ */ ue({
22325
+ var mP = gP();
22326
+ const yP = ["id"], bP = /* @__PURE__ */ ue({
22117
22327
  __name: "VueJsonCsv",
22118
22328
  props: {
22119
22329
  data: {
@@ -22178,12 +22388,12 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22178
22388
  const u = i.labels;
22179
22389
  if (typeof i.fields !== Gi.Object)
22180
22390
  throw new Error("Labels needs to be a object containing key / value pairs.");
22181
- return typeof u === Gi.Object ? (d) => iP(d, (h, f) => u[f] || f) : (d) => d;
22391
+ return typeof u === Gi.Object ? (d) => aP(d, (h, f) => u[f] || f) : (d) => d;
22182
22392
  }, a = () => {
22183
22393
  const u = i.fields;
22184
22394
  if (typeof i.fields !== Gi.Object && !Array.isArray(u))
22185
22395
  throw new Error("Fields needs to be an array of strings.");
22186
- return Array.isArray(u) ? (d) => oP(d, u) : (d) => d;
22396
+ return Array.isArray(u) ? (d) => uP(d, u) : (d) => d;
22187
22397
  }, l = () => {
22188
22398
  if (typeof i.fields === Gi.Undefined && typeof i.labels === Gi.Undefined)
22189
22399
  return i.data;
@@ -22195,7 +22405,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22195
22405
  return;
22196
22406
  }
22197
22407
  n("export-started", r.value);
22198
- let u = hP.unparse(r.value, Object.assign({
22408
+ let u = mP.unparse(r.value, Object.assign({
22199
22409
  delimiter: i.delimiter,
22200
22410
  encoding: i.encoding
22201
22411
  }));
@@ -22204,7 +22414,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22204
22414
  const d = new Blob([u], {
22205
22415
  type: "text/csv;charset=" + i.encoding
22206
22416
  });
22207
- cP.saveAs(d, i.filename);
22417
+ fP.saveAs(d, i.filename);
22208
22418
  }
22209
22419
  };
22210
22420
  return (u, d) => (X(), at("div", {
@@ -22215,9 +22425,9 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22215
22425
  ts(u.$slots, "default", {}, () => [
22216
22426
  Ee("Download " + ut(e.filename), 1)
22217
22427
  ])
22218
- ], 8, fP));
22428
+ ], 8, yP));
22219
22429
  }
22220
- }), gP = /* @__PURE__ */ ue({
22430
+ }), _P = /* @__PURE__ */ ue({
22221
22431
  __name: "DownloadCsv",
22222
22432
  props: {
22223
22433
  rows: {},
@@ -22227,7 +22437,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22227
22437
  setup(e) {
22228
22438
  const t = e, n = L(() => Object.keys(t.headers));
22229
22439
  return (i, s) => (X(), at("div", null, [
22230
- Xt(pP, {
22440
+ Xt(bP, {
22231
22441
  data: e.rows,
22232
22442
  fields: n.value,
22233
22443
  filename: e.filename,
@@ -22240,14 +22450,14 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22240
22450
  }, 8, ["data", "fields", "filename", "labels"])
22241
22451
  ]));
22242
22452
  }
22243
- }), mP = { class: "kong-ui-public-csv-export-modal" }, yP = {
22453
+ }), vP = { class: "kong-ui-public-csv-export-modal" }, xP = {
22244
22454
  key: 0,
22245
22455
  class: "selected-range"
22246
- }, bP = {
22456
+ }, wP = {
22247
22457
  key: 4,
22248
22458
  class: "text-muted",
22249
22459
  tag: "span"
22250
- }, Dh = 3, FP = /* @__PURE__ */ ue({
22460
+ }, Dh = 3, zP = /* @__PURE__ */ ue({
22251
22461
  __name: "CsvExportModal",
22252
22462
  props: {
22253
22463
  exportState: {},
@@ -22320,7 +22530,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22320
22530
  o.value++;
22321
22531
  }), (p, m) => {
22322
22532
  const y = Re("KSkeleton"), x = Re("KEmptyState"), T = Re("KTableData"), C = Re("KTooltip"), D = Re("KButton"), k = Re("KModal");
22323
- return X(), at("div", mP, [
22533
+ return X(), at("div", vP, [
22324
22534
  Xt(k, {
22325
22535
  class: "vitals-report",
22326
22536
  "data-testid": "csv-export-modal",
@@ -22332,7 +22542,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22332
22542
  }, {
22333
22543
  default: Ut(() => [
22334
22544
  lt("div", null, [
22335
- e.exportState.status === "success" && l.value ? (X(), at("div", yP, [
22545
+ e.exportState.status === "success" && l.value ? (X(), at("div", xP, [
22336
22546
  lt("p", null, ut(e.modalDescription ? e.modalDescription : Z(n).t("csvExport.exportDescription")), 1),
22337
22547
  lt("p", null, ut(Z(n).t("csvExport.exportTimeRange")) + ": " + ut(c.value), 1)
22338
22548
  ])) : Nt("", !0),
@@ -22371,7 +22581,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22371
22581
  ]),
22372
22582
  _: 1
22373
22583
  })) : Nt("", !0),
22374
- e.exportState.status === "success" && l.value ? (X(), at("div", bP, [
22584
+ e.exportState.status === "success" && l.value ? (X(), at("div", wP, [
22375
22585
  Ee(ut(u.value) + " ", 1),
22376
22586
  Xt(C, {
22377
22587
  class: "preview-tooltip",
@@ -22400,7 +22610,7 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22400
22610
  ]),
22401
22611
  _: 1
22402
22612
  }),
22403
- Xt(gP, {
22613
+ Xt(_P, {
22404
22614
  class: "vitals-report-export-button",
22405
22615
  filename: r,
22406
22616
  headers: h.value.csvHeaders,
@@ -22426,227 +22636,17 @@ const fP = ["id"], pP = /* @__PURE__ */ ue({
22426
22636
  ]);
22427
22637
  };
22428
22638
  }
22429
- }), _P = { class: "container" }, vP = {
22430
- key: 0,
22431
- class: "no-data",
22432
- "data-testid": "sparkline-empty"
22433
- }, xP = ["title"], wP = /* @__PURE__ */ ue({
22434
- __name: "SparklineChart",
22435
- props: {
22436
- chartKey: { default: () => {
22437
- } },
22438
- datasets: {},
22439
- disableTooltip: { type: Boolean, default: !1 },
22440
- enableBrushing: { type: Boolean, default: !1 },
22441
- groupKey: { default: () => {
22442
- } },
22443
- maxCount: { default: () => {
22444
- } },
22445
- maxStamp: { default: () => {
22446
- } },
22447
- minCount: { default: () => {
22448
- } },
22449
- minStamp: { default: () => {
22450
- } },
22451
- pointRenderCount: { default: 24 },
22452
- showLabel: { type: Boolean, default: !1 },
22453
- tooltipTitle: { default: () => {
22454
- } },
22455
- type: { default: "sparkline_bar" }
22456
- },
22457
- setup(e) {
22458
- const t = crypto.randomUUID(), { i18n: n } = bt.useI18n(), {
22459
- syncedGroupSizeMs: i,
22460
- syncedMinStamp: s,
22461
- syncedMaxStamp: r,
22462
- syncedMinCount: o,
22463
- syncedMaxCount: a,
22464
- syncedRenderPoints: l,
22465
- syncedChartDatasets: c
22466
- } = bt.useSparklineSync({
22467
- chartKey: e.chartKey,
22468
- datasets: e.datasets,
22469
- groupKey: e.groupKey,
22470
- minStamp: e.minStamp,
22471
- maxStamp: e.maxStamp,
22472
- minCount: e.minCount,
22473
- maxCount: e.maxCount,
22474
- renderPoints: e.pointRenderCount,
22475
- type: e.type
22476
- }), u = tr({
22477
- showTooltip: !1,
22478
- tooltipContext: 0,
22479
- // Set in lineChartTooltipBehavior
22480
- metricDisplay: "",
22481
- tooltipSeries: [],
22482
- left: "",
22483
- top: "",
22484
- units: "count",
22485
- translateUnit: () => "",
22486
- offsetX: 0,
22487
- offsetY: 0,
22488
- width: 0,
22489
- height: 0,
22490
- chartType: e.type === "sparkline_bar" ? "timeseries_bar" : "timeseries_line",
22491
- chartID: t,
22492
- interactionMode: "idle"
22493
- }), d = ({ width: O, height: _ }) => {
22494
- u.width = O, u.height = _;
22495
- }, h = L(() => e.disableTooltip ? [] : [new lg({
22496
- // if either groupKey or chartKey is undefined then brushing doesn't make any
22497
- // sense as the data in this chart isn't related to any other data.
22498
- enableBrushing: e.groupKey !== void 0 && e.chartKey !== void 0 && e.enableBrushing,
22499
- brushStrategy: "group",
22500
- brushGroup: e.groupKey
22501
- })]), f = L(() => c.value.reduce((O, { data: _, label: b }) => ({
22502
- ...O,
22503
- [b]: _.reduce((w, { y: M }) => w + M, 0)
22504
- }), {})), p = L(() => c.value.map(({ label: O }) => [
22505
- f.value[O],
22506
- `${O}: ${f.value[O]}`
22507
- ]).sort(([O], [_]) => _ - O).map(([, O]) => O).join(", ")), m = L(() => Object.keys(f.value).map((O) => f.value[O]).reduce((O, _) => O + _, 0)), y = L(() => m.value > 0), x = L(() => ({
22508
- labels: new Array(l.value).fill(""),
22509
- datasets: c.value
22510
- })), T = L(() => e.datasets.length > 1), C = `SparklineTooltipPosition-${t}`, D = L(() => {
22511
- const O = e.type === "sparkline_bar", _ = O ? s.value - 1 : s.value, b = O ? r.value : r.value - i.value;
22512
- return {
22513
- maintainAspectRatio: !1,
22514
- elements: {
22515
- categoryPercentage: 1,
22516
- barPercentage: 1,
22517
- line: {
22518
- tension: 0,
22519
- stepped: e.type === "sparkline_step",
22520
- borderWidth: 1
22521
- },
22522
- point: {
22523
- radius: 0,
22524
- pointHitRadius: 11,
22525
- pointHoverRadius: 0
22526
- }
22527
- },
22528
- interaction: {
22529
- intersect: !1,
22530
- mode: "index"
22531
- },
22532
- layout: {
22533
- padding: {
22534
- left: O ? 0 : 2,
22535
- right: O ? 0 : 2,
22536
- top: 2
22537
- }
22538
- },
22539
- plugins: {
22540
- legend: {
22541
- display: !1
22542
- },
22543
- tooltip: {
22544
- enabled: !1,
22545
- position: C,
22546
- external: (w) => {
22547
- yp(u, w, "minutely", {
22548
- contextFormatter: (M) => {
22549
- const E = M + i.value;
22550
- let j = "";
22551
- return i.value > 1440 * 60 * 1e3 ? j = So(new Date(E), "MMM dd, yyy hh:mm a") : j = So(new Date(E), "hh:mm a"), `${nT(M)} - ${j}`;
22552
- }
22553
- });
22554
- }
22555
- }
22556
- },
22557
- scales: {
22558
- x: {
22559
- min: _,
22560
- max: b,
22561
- type: "timeseries",
22562
- offset: !1,
22563
- grid: {
22564
- display: !1
22565
- },
22566
- display: !1,
22567
- stacked: T.value
22568
- },
22569
- y: {
22570
- min: Math.max(o.value - 1, 0),
22571
- max: a.value,
22572
- grid: {
22573
- display: !1
22574
- },
22575
- display: !1,
22576
- stacked: T.value
22577
- }
22578
- }
22579
- };
22580
- }), k = Vt("0"), A = Vt("0");
22581
- return Qn(() => {
22582
- He.positioners[C] = function(O, _) {
22583
- if (!O.length || u.interactionMode === "interactive" || _.x === null)
22584
- return !1;
22585
- const b = 10, w = this.chart.canvas.getBoundingClientRect(), M = u.width || this.width, E = u.height || this.height, j = w.top - E > 0, H = j ? w.top - E - b : w.top + w.height + b, V = w.left > M / 2 - _.x, B = Math.max(b, window.innerWidth - b - M), $ = Math.min(B, V ? Math.floor(w.left - M / 2) + _.x : 0 + b);
22586
- return k.value = `${H}px`, A.value = `${$}px`, {
22587
- x: $,
22588
- y: H,
22589
- xAlign: "center",
22590
- yAlign: j ? "top" : "bottom"
22591
- };
22592
- };
22593
- }), Zn(() => {
22594
- He.positioners[C] && delete He.positioners[C];
22595
- }), (O, _) => (X(), at("div", _P, [
22596
- y.value ? e.type === "sparkline_bar" ? (X(), It(Z(rg), {
22597
- key: 1,
22598
- "chart-id": Z(t),
22599
- data: x.value,
22600
- "data-testid": "sparkline-bar",
22601
- options: D.value,
22602
- plugins: h.value
22603
- }, null, 8, ["chart-id", "data", "options", "plugins"])) : e.type === "sparkline_line" || e.type === "sparkline_step" ? (X(), It(Z(ag), {
22604
- key: 2,
22605
- "chart-id": Z(t),
22606
- data: x.value,
22607
- "data-testid": e.type === "sparkline_line" ? "sparkline-line" : "sparkline-step",
22608
- options: D.value,
22609
- plugins: h.value
22610
- }, null, 8, ["chart-id", "data", "data-testid", "options", "plugins"])) : Nt("", !0) : (X(), at("div", vP, [
22611
- ts(O.$slots, "empty", {}, () => [
22612
- Ee(ut(Z(n).t("sparkline_no_data")), 1)
22613
- ], !0)
22614
- ])),
22615
- e.disableTooltip ? Nt("", !0) : (X(), It(Vo, {
22616
- key: 3,
22617
- "absolute-left": A.value,
22618
- "absolute-top": k.value,
22619
- class: "tooltip",
22620
- "data-testid": "sparkline-tooltip",
22621
- state: u,
22622
- "tooltip-title": e.tooltipTitle,
22623
- onDimensions: d
22624
- }, null, 8, ["absolute-left", "absolute-top", "state", "tooltip-title"])),
22625
- y.value && e.showLabel ? (X(), at("div", {
22626
- key: 4,
22627
- class: "label",
22628
- title: O.$slots.label ? "" : p.value
22629
- }, [
22630
- ts(O.$slots, "label", {
22631
- total: m.value,
22632
- totalByDataset: f.value
22633
- }, () => [
22634
- Ee(ut(p.value), 1)
22635
- ], !0)
22636
- ], 8, xP)) : Nt("", !0)
22637
- ]));
22638
- }
22639
- }), zP = /* @__PURE__ */ We(wP, [["__scopeId", "data-v-ae8259b6"]]);
22639
+ });
22640
22640
  export {
22641
22641
  IP as AnalyticsChart,
22642
22642
  Be as ChartLegendPosition,
22643
- FP as CsvExportModal,
22643
+ zP as CsvExportModal,
22644
22644
  OP as DECIMAL_DISPLAY,
22645
22645
  ST as FONT_SIZE_REGULAR,
22646
22646
  wT as FONT_SIZE_SMALL,
22647
22647
  Il as MAX_LABEL_LENGTH,
22648
22648
  LP as SimpleChart,
22649
- zP as SparklineChart,
22649
+ FP as SparklineChart,
22650
22650
  NP as TopNTable,
22651
22651
  Gi as ValidType,
22652
22652
  RP as chartTypes,