@kong-ui-public/dashboard-renderer 7.6.8 → 7.6.10
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.
- package/dist/{GeoMapRenderer-NvV03kSZ.js → GeoMapRenderer-B9ELIHrp.js} +1 -1
- package/dist/dashboard-renderer.es.js +1 -1
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/{index-B20-hQXl.js → index-Dvjj5Eg5.js} +559 -572
- package/dist/types/components/QueryDataProvider.vue.d.ts +2 -2
- package/dist/types/components/QueryDataProvider.vue.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -3,33 +3,33 @@ var _t = (d) => {
|
|
|
3
3
|
throw TypeError(d);
|
|
4
4
|
};
|
|
5
5
|
var li = (d, e, t) => e in d ? ai(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
6
|
-
var bt = (d, e, t) => li(d, typeof e != "symbol" ? e + "" : e, t),
|
|
7
|
-
var _ = (d, e, t) => (
|
|
6
|
+
var bt = (d, e, t) => li(d, typeof e != "symbol" ? e + "" : e, t), st = (d, e, t) => e.has(d) || _t("Cannot " + t);
|
|
7
|
+
var _ = (d, e, t) => (st(d, e, "read from private field"), t ? t.call(d) : e.get(d)), F = (d, e, t) => e.has(d) ? _t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(d) : e.set(d, t), O = (d, e, t, i) => (st(d, e, "write to private field"), i ? i.call(d, t) : e.set(d, t), t), G = (d, e, t) => (st(d, e, "access private method"), t);
|
|
8
8
|
var ze = (d, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
|
-
|
|
10
|
+
O(d, e, s, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
13
|
return _(d, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as
|
|
17
|
-
import { msToGranularity as
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
16
|
+
import { ref as N, watchEffect as Mt, inject as ye, provide as hi, onMounted as lt, computed as T, watch as Ve, onUnmounted as ht, defineComponent as J, resolveComponent as me, createBlock as M, renderSlot as Se, createCommentVNode as Q, unref as x, openBlock as C, withCtx as q, createVNode as le, createTextVNode as Qe, toDisplayString as ne, createSlots as Ye, createElementVNode as oe, useCssVars as je, normalizeClass as Xe, mergeProps as It, createElementBlock as V, normalizeProps as ui, guardReactiveProps as di, defineAsyncComponent as qt, readonly as rt, toRef as wt, nextTick as ut, resolveDynamicComponent as Pt, toHandlers as ci, Fragment as $t, renderList as Ft, normalizeStyle as Et, mergeModels as xt, useModel as fi, getCurrentInstance as gi } from "vue";
|
|
17
|
+
import { msToGranularity as nt, getFieldDataSources as Gt, stripUnknownFilters as mi, Timeframe as pi, TimePeriods as Bt, TIMEFRAME_LOOKUP as yi, formatTime as Ct, EXPORT_RECORD_LIMIT as vi } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { handleQueryError as _i, SimpleChart as bi, AnalyticsChart as wi, TopNTable as Ei, CsvExportModal as xi } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import Ci from "swrv";
|
|
20
20
|
import "axios";
|
|
21
|
-
import { createI18n as
|
|
21
|
+
import { createI18n as Ri, i18nTComponent as ki } from "@kong-ui-public/i18n";
|
|
22
22
|
import { useAnalyticsConfigStore as dt } from "@kong-ui-public/analytics-config-store";
|
|
23
|
-
import { VisibilityOffIcon as
|
|
24
|
-
import { MetricsProvider as
|
|
23
|
+
import { VisibilityOffIcon as Ti, WarningIcon as zi, EditIcon as Si, MoreIcon as Di } from "@kong/icons";
|
|
24
|
+
import { MetricsProvider as Ni, MetricsConsumer as Li } from "@kong-ui-public/analytics-metric-provider";
|
|
25
25
|
var Ut = /* @__PURE__ */ ((d) => (d.VALIDATING = "VALIDATING", d.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", d.PENDING = "PENDING", d.SUCCESS = "SUCCESS", d.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", d.ERROR = "ERROR", d.STALE_IF_ERROR = "STALE_IF_ERROR", d))(Ut || {});
|
|
26
|
-
const
|
|
26
|
+
const Ai = (d) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
28
|
return d ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
29
|
((e = Object.keys(d)) != null && e.length || (t = d.data) != null && t.length || (s = (i = d.data) == null ? void 0 : i.data) != null && s.length || !((r = d.data) != null && r.data) && typeof d.data == "object" && Object.keys(d == null ? void 0 : d.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
const s =
|
|
31
|
+
function Hi(d = N({}), e, t, i = Ai) {
|
|
32
|
+
const s = N(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
@@ -65,7 +65,7 @@ function Ai(d = A({}), e, t, i = Li) {
|
|
|
65
65
|
swrvState: Ut
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const Oi = {
|
|
69
69
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
70
70
|
trendRange: {
|
|
71
71
|
"24h": "Last 24-hour summary",
|
|
@@ -78,10 +78,6 @@ const Hi = {
|
|
|
78
78
|
fullscreen: "Fullscreen",
|
|
79
79
|
remove: "Remove",
|
|
80
80
|
delete: "Delete"
|
|
81
|
-
}, Oi = {
|
|
82
|
-
forbidden: "To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator.",
|
|
83
|
-
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period",
|
|
84
|
-
timeout: "Query timed out. Consider querying a shorter time range."
|
|
85
81
|
}, Mi = {
|
|
86
82
|
defaultFilename: "Chart export",
|
|
87
83
|
exportAsCsv: "Export as CSV"
|
|
@@ -99,8 +95,7 @@ const Hi = {
|
|
|
99
95
|
weekly: "1 week",
|
|
100
96
|
unknown: "Unknown"
|
|
101
97
|
}, Fi = {
|
|
102
|
-
renderer:
|
|
103
|
-
queryDataProvider: Oi,
|
|
98
|
+
renderer: Oi,
|
|
104
99
|
csvExport: Mi,
|
|
105
100
|
jumpToExplore: Ii,
|
|
106
101
|
jumpToRequests: qi,
|
|
@@ -108,14 +103,14 @@ const Hi = {
|
|
|
108
103
|
granularities: $i
|
|
109
104
|
};
|
|
110
105
|
function Gi() {
|
|
111
|
-
const d =
|
|
106
|
+
const d = Ri("en-us", Fi);
|
|
112
107
|
return {
|
|
113
108
|
i18n: d,
|
|
114
|
-
i18nT:
|
|
109
|
+
i18nT: ki(d)
|
|
115
110
|
// Translation component <i18n-t>
|
|
116
111
|
};
|
|
117
112
|
}
|
|
118
|
-
const
|
|
113
|
+
const Ze = 170, Wt = 6, pe = "analytics-query-provider", Rt = "{entity-id}", Bi = "{cp-id}", Ui = "{timeframe}", Wi = 30 * 1e3, Ki = 3e5, Vi = 36e5;
|
|
119
114
|
function Qi() {
|
|
120
115
|
const d = ye(pe);
|
|
121
116
|
return {
|
|
@@ -163,9 +158,9 @@ var Kt = { exports: {} };
|
|
|
163
158
|
var u = t ? t + h : h, a = this._events[u];
|
|
164
159
|
return a ? a.fn ? 1 : a.length : 0;
|
|
165
160
|
}, n.prototype.emit = function(h, u, a, f, m, g) {
|
|
166
|
-
var
|
|
167
|
-
if (!this._events[
|
|
168
|
-
var p = this._events[
|
|
161
|
+
var y = t ? t + h : h;
|
|
162
|
+
if (!this._events[y]) return !1;
|
|
163
|
+
var p = this._events[y], S = arguments.length, I, R;
|
|
169
164
|
if (p.fn) {
|
|
170
165
|
switch (p.once && this.removeListener(h, p.fn, void 0, !0), S) {
|
|
171
166
|
case 1:
|
|
@@ -181,12 +176,12 @@ var Kt = { exports: {} };
|
|
|
181
176
|
case 6:
|
|
182
177
|
return p.fn.call(p.context, u, a, f, m, g), !0;
|
|
183
178
|
}
|
|
184
|
-
for (R = 1,
|
|
185
|
-
|
|
186
|
-
p.fn.apply(p.context,
|
|
179
|
+
for (R = 1, I = new Array(S - 1); R < S; R++)
|
|
180
|
+
I[R - 1] = arguments[R];
|
|
181
|
+
p.fn.apply(p.context, I);
|
|
187
182
|
} else {
|
|
188
|
-
var
|
|
189
|
-
for (R = 0; R <
|
|
183
|
+
var ee = p.length, B;
|
|
184
|
+
for (R = 0; R < ee; R++)
|
|
190
185
|
switch (p[R].once && this.removeListener(h, p[R].fn, void 0, !0), S) {
|
|
191
186
|
case 1:
|
|
192
187
|
p[R].fn.call(p[R].context);
|
|
@@ -201,9 +196,9 @@ var Kt = { exports: {} };
|
|
|
201
196
|
p[R].fn.call(p[R].context, u, a, f);
|
|
202
197
|
break;
|
|
203
198
|
default:
|
|
204
|
-
if (!
|
|
205
|
-
|
|
206
|
-
p[R].fn.apply(p[R].context,
|
|
199
|
+
if (!I) for (B = 1, I = new Array(S - 1); B < S; B++)
|
|
200
|
+
I[B - 1] = arguments[B];
|
|
201
|
+
p[R].fn.apply(p[R].context, I);
|
|
207
202
|
}
|
|
208
203
|
}
|
|
209
204
|
return !0;
|
|
@@ -220,8 +215,8 @@ var Kt = { exports: {} };
|
|
|
220
215
|
if (g.fn)
|
|
221
216
|
g.fn === u && (!f || g.once) && (!a || g.context === a) && o(this, m);
|
|
222
217
|
else {
|
|
223
|
-
for (var
|
|
224
|
-
(g[
|
|
218
|
+
for (var y = 0, p = [], S = g.length; y < S; y++)
|
|
219
|
+
(g[y].fn !== u || f && !g[y].once || a && g[y].context !== a) && p.push(g[y]);
|
|
225
220
|
p.length ? this._events[m] = p.length === 1 ? p[0] : p : o(this, m);
|
|
226
221
|
}
|
|
227
222
|
return this;
|
|
@@ -304,7 +299,7 @@ function es(d, e, t) {
|
|
|
304
299
|
var ie;
|
|
305
300
|
class ts {
|
|
306
301
|
constructor() {
|
|
307
|
-
|
|
302
|
+
F(this, ie, []);
|
|
308
303
|
}
|
|
309
304
|
enqueue(e, t) {
|
|
310
305
|
t = {
|
|
@@ -342,30 +337,30 @@ class ts {
|
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
339
|
ie = new WeakMap();
|
|
345
|
-
var we, Ee, ge,
|
|
340
|
+
var we, Ee, ge, Le, xe, Ae, se, Ce, K, He, re, Re, de, Oe, Ke, z, Qt, Yt, jt, Xt, Zt, qe, ot, at, Pe, Jt, $e;
|
|
346
341
|
class is extends Xi {
|
|
347
342
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
348
343
|
constructor(t) {
|
|
349
344
|
var i, s;
|
|
350
345
|
super();
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
346
|
+
F(this, z);
|
|
347
|
+
F(this, we);
|
|
348
|
+
F(this, Ee);
|
|
349
|
+
F(this, ge, 0);
|
|
350
|
+
F(this, Le);
|
|
351
|
+
F(this, xe);
|
|
352
|
+
F(this, Ae, 0);
|
|
353
|
+
F(this, se);
|
|
354
|
+
F(this, Ce);
|
|
355
|
+
F(this, K);
|
|
356
|
+
F(this, He);
|
|
357
|
+
F(this, re, 0);
|
|
363
358
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
359
|
+
F(this, Re);
|
|
360
|
+
F(this, de);
|
|
361
|
+
F(this, Oe);
|
|
367
362
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
368
|
-
|
|
363
|
+
F(this, Ke, 1n);
|
|
369
364
|
/**
|
|
370
365
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
371
366
|
|
|
@@ -384,7 +379,7 @@ class is extends Xi {
|
|
|
384
379
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i = t.intervalCap) == null ? void 0 : i.toString()) ?? ""}\` (${typeof t.intervalCap})`);
|
|
385
380
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
386
381
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
387
|
-
|
|
382
|
+
O(this, we, t.carryoverConcurrencyCount), O(this, Ee, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), O(this, Le, t.intervalCap), O(this, xe, t.interval), O(this, K, new t.queueClass()), O(this, He, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, O(this, Oe, t.throwOnTimeout === !0), O(this, de, t.autoStart === !1);
|
|
388
383
|
}
|
|
389
384
|
get concurrency() {
|
|
390
385
|
return _(this, Re);
|
|
@@ -392,7 +387,7 @@ class is extends Xi {
|
|
|
392
387
|
set concurrency(t) {
|
|
393
388
|
if (!(typeof t == "number" && t >= 1))
|
|
394
389
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
395
|
-
|
|
390
|
+
O(this, Re, t), G(this, z, Pe).call(this);
|
|
396
391
|
}
|
|
397
392
|
/**
|
|
398
393
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -431,21 +426,21 @@ class is extends Xi {
|
|
|
431
426
|
Here, the promise function with `id: '🦀'` executes last.
|
|
432
427
|
*/
|
|
433
428
|
setPriority(t, i) {
|
|
434
|
-
_(this,
|
|
429
|
+
_(this, K).setPriority(t, i);
|
|
435
430
|
}
|
|
436
431
|
async add(t, i = {}) {
|
|
437
|
-
return i.id ?? (i.id = (ze(this,
|
|
432
|
+
return i.id ?? (i.id = (ze(this, Ke)._++).toString()), i = {
|
|
438
433
|
timeout: this.timeout,
|
|
439
|
-
throwOnTimeout: _(this,
|
|
434
|
+
throwOnTimeout: _(this, Oe),
|
|
440
435
|
...i
|
|
441
436
|
}, new Promise((s, r) => {
|
|
442
|
-
_(this,
|
|
437
|
+
_(this, K).enqueue(async () => {
|
|
443
438
|
var o;
|
|
444
439
|
ze(this, re)._++, ze(this, ge)._++;
|
|
445
440
|
try {
|
|
446
441
|
(o = i.signal) == null || o.throwIfAborted();
|
|
447
442
|
let n = t({ signal: i.signal });
|
|
448
|
-
i.timeout && (n = Ji(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n,
|
|
443
|
+
i.timeout && (n = Ji(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, G(this, z, Jt).call(this, i.signal)]));
|
|
449
444
|
const l = await n;
|
|
450
445
|
s(l), this.emit("completed", l);
|
|
451
446
|
} catch (n) {
|
|
@@ -455,9 +450,9 @@ class is extends Xi {
|
|
|
455
450
|
}
|
|
456
451
|
r(n), this.emit("error", n);
|
|
457
452
|
} finally {
|
|
458
|
-
|
|
453
|
+
G(this, z, jt).call(this);
|
|
459
454
|
}
|
|
460
|
-
}, i), this.emit("add"),
|
|
455
|
+
}, i), this.emit("add"), G(this, z, qe).call(this);
|
|
461
456
|
});
|
|
462
457
|
}
|
|
463
458
|
async addAll(t, i) {
|
|
@@ -467,19 +462,19 @@ class is extends Xi {
|
|
|
467
462
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
468
463
|
*/
|
|
469
464
|
start() {
|
|
470
|
-
return _(this, de) ? (
|
|
465
|
+
return _(this, de) ? (O(this, de, !1), G(this, z, Pe).call(this), this) : this;
|
|
471
466
|
}
|
|
472
467
|
/**
|
|
473
468
|
Put queue execution on hold.
|
|
474
469
|
*/
|
|
475
470
|
pause() {
|
|
476
|
-
|
|
471
|
+
O(this, de, !0);
|
|
477
472
|
}
|
|
478
473
|
/**
|
|
479
474
|
Clear the queue.
|
|
480
475
|
*/
|
|
481
476
|
clear() {
|
|
482
|
-
|
|
477
|
+
O(this, K, new (_(this, He))());
|
|
483
478
|
}
|
|
484
479
|
/**
|
|
485
480
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -487,7 +482,7 @@ class is extends Xi {
|
|
|
487
482
|
@returns A promise that settles when the queue becomes empty.
|
|
488
483
|
*/
|
|
489
484
|
async onEmpty() {
|
|
490
|
-
_(this,
|
|
485
|
+
_(this, K).size !== 0 && await G(this, z, $e).call(this, "empty");
|
|
491
486
|
}
|
|
492
487
|
/**
|
|
493
488
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -497,7 +492,7 @@ class is extends Xi {
|
|
|
497
492
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
498
493
|
*/
|
|
499
494
|
async onSizeLessThan(t) {
|
|
500
|
-
_(this,
|
|
495
|
+
_(this, K).size < t || await G(this, z, $e).call(this, "next", () => _(this, K).size < t);
|
|
501
496
|
}
|
|
502
497
|
/**
|
|
503
498
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -505,13 +500,13 @@ class is extends Xi {
|
|
|
505
500
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
506
501
|
*/
|
|
507
502
|
async onIdle() {
|
|
508
|
-
_(this, re) === 0 && _(this,
|
|
503
|
+
_(this, re) === 0 && _(this, K).size === 0 || await G(this, z, $e).call(this, "idle");
|
|
509
504
|
}
|
|
510
505
|
/**
|
|
511
506
|
Size of the queue, the number of queued items waiting to run.
|
|
512
507
|
*/
|
|
513
508
|
get size() {
|
|
514
|
-
return _(this,
|
|
509
|
+
return _(this, K).size;
|
|
515
510
|
}
|
|
516
511
|
/**
|
|
517
512
|
Size of the queue, filtered by the given options.
|
|
@@ -519,7 +514,7 @@ class is extends Xi {
|
|
|
519
514
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
520
515
|
*/
|
|
521
516
|
sizeBy(t) {
|
|
522
|
-
return _(this,
|
|
517
|
+
return _(this, K).filter(t).length;
|
|
523
518
|
}
|
|
524
519
|
/**
|
|
525
520
|
Number of running items (no longer in the queue).
|
|
@@ -534,48 +529,48 @@ class is extends Xi {
|
|
|
534
529
|
return _(this, de);
|
|
535
530
|
}
|
|
536
531
|
}
|
|
537
|
-
we = new WeakMap(), Ee = new WeakMap(), ge = new WeakMap(),
|
|
538
|
-
return _(this, Ee) || _(this, ge) < _(this,
|
|
532
|
+
we = new WeakMap(), Ee = new WeakMap(), ge = new WeakMap(), Le = new WeakMap(), xe = new WeakMap(), Ae = new WeakMap(), se = new WeakMap(), Ce = new WeakMap(), K = new WeakMap(), He = new WeakMap(), re = new WeakMap(), Re = new WeakMap(), de = new WeakMap(), Oe = new WeakMap(), Ke = new WeakMap(), z = new WeakSet(), Qt = function() {
|
|
533
|
+
return _(this, Ee) || _(this, ge) < _(this, Le);
|
|
539
534
|
}, Yt = function() {
|
|
540
535
|
return _(this, re) < _(this, Re);
|
|
541
536
|
}, jt = function() {
|
|
542
|
-
ze(this, re)._--,
|
|
537
|
+
ze(this, re)._--, G(this, z, qe).call(this), this.emit("next");
|
|
543
538
|
}, Xt = function() {
|
|
544
|
-
|
|
539
|
+
G(this, z, at).call(this), G(this, z, ot).call(this), O(this, Ce, void 0);
|
|
545
540
|
}, Zt = function() {
|
|
546
541
|
const t = Date.now();
|
|
547
542
|
if (_(this, se) === void 0) {
|
|
548
|
-
const i = _(this,
|
|
543
|
+
const i = _(this, Ae) - t;
|
|
549
544
|
if (i < 0)
|
|
550
|
-
|
|
545
|
+
O(this, ge, _(this, we) ? _(this, re) : 0);
|
|
551
546
|
else
|
|
552
|
-
return _(this, Ce) === void 0 &&
|
|
553
|
-
|
|
547
|
+
return _(this, Ce) === void 0 && O(this, Ce, setTimeout(() => {
|
|
548
|
+
G(this, z, Xt).call(this);
|
|
554
549
|
}, i)), !0;
|
|
555
550
|
}
|
|
556
551
|
return !1;
|
|
557
|
-
},
|
|
558
|
-
if (_(this,
|
|
559
|
-
return _(this, se) && clearInterval(_(this, se)),
|
|
552
|
+
}, qe = function() {
|
|
553
|
+
if (_(this, K).size === 0)
|
|
554
|
+
return _(this, se) && clearInterval(_(this, se)), O(this, se, void 0), this.emit("empty"), _(this, re) === 0 && this.emit("idle"), !1;
|
|
560
555
|
if (!_(this, de)) {
|
|
561
|
-
const t = !_(this,
|
|
562
|
-
if (_(this,
|
|
563
|
-
const i = _(this,
|
|
564
|
-
return i ? (this.emit("active"), i(), t &&
|
|
556
|
+
const t = !_(this, z, Zt);
|
|
557
|
+
if (_(this, z, Qt) && _(this, z, Yt)) {
|
|
558
|
+
const i = _(this, K).dequeue();
|
|
559
|
+
return i ? (this.emit("active"), i(), t && G(this, z, ot).call(this), !0) : !1;
|
|
565
560
|
}
|
|
566
561
|
}
|
|
567
562
|
return !1;
|
|
568
|
-
}, nt = function() {
|
|
569
|
-
_(this, Ee) || _(this, se) !== void 0 || (I(this, se, setInterval(() => {
|
|
570
|
-
U(this, D, ot).call(this);
|
|
571
|
-
}, _(this, xe))), I(this, He, Date.now() + _(this, xe)));
|
|
572
563
|
}, ot = function() {
|
|
573
|
-
_(this,
|
|
564
|
+
_(this, Ee) || _(this, se) !== void 0 || (O(this, se, setInterval(() => {
|
|
565
|
+
G(this, z, at).call(this);
|
|
566
|
+
}, _(this, xe))), O(this, Ae, Date.now() + _(this, xe)));
|
|
567
|
+
}, at = function() {
|
|
568
|
+
_(this, ge) === 0 && _(this, re) === 0 && _(this, se) && (clearInterval(_(this, se)), O(this, se, void 0)), O(this, ge, _(this, we) ? _(this, re) : 0), G(this, z, Pe).call(this);
|
|
574
569
|
}, /**
|
|
575
570
|
Executes all queued functions until it reaches the limit.
|
|
576
571
|
*/
|
|
577
|
-
|
|
578
|
-
for (;
|
|
572
|
+
Pe = function() {
|
|
573
|
+
for (; G(this, z, qe).call(this); )
|
|
579
574
|
;
|
|
580
575
|
}, Jt = async function(t) {
|
|
581
576
|
return new Promise((i, s) => {
|
|
@@ -583,7 +578,7 @@ $e = function() {
|
|
|
583
578
|
s(t.reason);
|
|
584
579
|
}, { once: !0 });
|
|
585
580
|
});
|
|
586
|
-
},
|
|
581
|
+
}, $e = async function(t, i) {
|
|
587
582
|
return new Promise((s) => {
|
|
588
583
|
const r = () => {
|
|
589
584
|
i && !i() || (this.off(t, r), s());
|
|
@@ -617,72 +612,72 @@ function rs({
|
|
|
617
612
|
definition: t,
|
|
618
613
|
chartData: i
|
|
619
614
|
}) {
|
|
620
|
-
const { evaluateFeatureFlag: s } =
|
|
621
|
-
|
|
622
|
-
var
|
|
623
|
-
r.value = await ((
|
|
615
|
+
const { evaluateFeatureFlag: s } = ce.useEvaluateFeatureFlag(), r = N(""), o = N(""), n = N(void 0), l = N(void 0), h = s("analytics-chart-zoom-actions", !0), u = dt();
|
|
616
|
+
lt(async () => {
|
|
617
|
+
var k, L;
|
|
618
|
+
r.value = await ((k = d == null ? void 0 : d.exploreBaseUrl) == null ? void 0 : k.call(d)) ?? "", o.value = await ((L = d == null ? void 0 : d.requestsBaseUrl) == null ? void 0 : L.call(d)) ?? "";
|
|
624
619
|
});
|
|
625
|
-
const a =
|
|
626
|
-
var
|
|
627
|
-
const
|
|
628
|
-
return
|
|
629
|
-
}), S =
|
|
620
|
+
const a = T(() => u.analytics && u.percentiles), f = T(() => !["golden_signals", "top_n", "gauge"].includes(t.value.chart.type)), m = T(() => h && o.value && t.value.query && t.value.query.datasource !== "llm_usage" && a.value), g = T(() => r.value && t.value.query && ["basic", "api_usage", "llm_usage", void 0].includes(t.value.query.datasource) && a.value), y = T(() => i.value ? nt(i.value.meta.granularity_ms) : void 0), p = T(() => {
|
|
621
|
+
var Y;
|
|
622
|
+
const k = [...e.value.filters, ...t.value.query.filters ?? []], L = ((Y = t.value.query) == null ? void 0 : Y.datasource) ?? "api_usage";
|
|
623
|
+
return k.filter((U) => Gt(U.field).some((E) => L === E));
|
|
624
|
+
}), S = T(() => {
|
|
630
625
|
if (!g.value || !f.value)
|
|
631
626
|
return "";
|
|
632
|
-
const
|
|
633
|
-
return be(
|
|
634
|
-
}),
|
|
627
|
+
const k = p.value, L = t.value.query.time_range || e.value.timeSpec, Y = _e(L, k);
|
|
628
|
+
return be(Y);
|
|
629
|
+
}), I = T(() => {
|
|
635
630
|
if (!m.value || !f.value)
|
|
636
631
|
return "";
|
|
637
|
-
const
|
|
632
|
+
const k = p.value, L = ee(
|
|
638
633
|
t.value.query.time_range || e.value.timeSpec,
|
|
639
|
-
|
|
634
|
+
k
|
|
640
635
|
);
|
|
641
|
-
return R(
|
|
642
|
-
}), R = (
|
|
643
|
-
var
|
|
636
|
+
return R(L);
|
|
637
|
+
}), R = (k) => m.value ? `${o.value}?q=${JSON.stringify(k)}` : "", ee = (k, L) => {
|
|
638
|
+
var Y, U;
|
|
644
639
|
return {
|
|
645
|
-
filter:
|
|
640
|
+
filter: L,
|
|
646
641
|
timeframe: {
|
|
647
|
-
timePeriodsKey:
|
|
648
|
-
start:
|
|
649
|
-
end:
|
|
642
|
+
timePeriodsKey: k.type === "relative" ? k.time_range : "custom",
|
|
643
|
+
start: k.type === "absolute" ? (Y = i.value) == null ? void 0 : Y.meta.start_ms : void 0,
|
|
644
|
+
end: k.type === "absolute" ? (U = i.value) == null ? void 0 : U.meta.end_ms : void 0
|
|
650
645
|
}
|
|
651
646
|
};
|
|
652
|
-
},
|
|
653
|
-
filter:
|
|
647
|
+
}, B = (k, L) => ({
|
|
648
|
+
filter: L,
|
|
654
649
|
timeframe: {
|
|
655
|
-
timePeriodsKey:
|
|
656
|
-
start:
|
|
657
|
-
end:
|
|
650
|
+
timePeriodsKey: k.type === "relative" ? k.time_range : "custom",
|
|
651
|
+
start: k.type === "absolute" ? k.start : void 0,
|
|
652
|
+
end: k.type === "absolute" ? k.end : void 0
|
|
658
653
|
}
|
|
659
|
-
}), _e = (
|
|
660
|
-
const
|
|
654
|
+
}), _e = (k, L) => {
|
|
655
|
+
const Y = t.value.query.dimensions ?? [];
|
|
661
656
|
return {
|
|
662
|
-
filters:
|
|
657
|
+
filters: L,
|
|
663
658
|
metrics: t.value.query.metrics ?? [],
|
|
664
|
-
dimensions:
|
|
665
|
-
time_range:
|
|
666
|
-
granularity: t.value.query.granularity ||
|
|
659
|
+
dimensions: Y,
|
|
660
|
+
time_range: k,
|
|
661
|
+
granularity: t.value.query.granularity || y.value
|
|
667
662
|
};
|
|
668
|
-
}, be = (
|
|
663
|
+
}, be = (k) => {
|
|
669
664
|
if (!g.value)
|
|
670
665
|
return "";
|
|
671
|
-
const
|
|
672
|
-
return `${r.value}?q=${JSON.stringify(
|
|
666
|
+
const L = ["api_usage", "llm_usage"].includes(t.value.query.datasource) ? t.value.query.datasource : "api_usage";
|
|
667
|
+
return `${r.value}?q=${JSON.stringify(k)}&d=${L}&c=${t.value.chart.type}`;
|
|
673
668
|
};
|
|
674
|
-
return
|
|
675
|
-
|
|
669
|
+
return Ve([m, g], ([k, L]) => {
|
|
670
|
+
k && (n.value = { href: "" }), L && (l.value = { href: "" });
|
|
676
671
|
}), {
|
|
677
672
|
exploreLinkKebabMenu: S,
|
|
678
|
-
requestsLinkKebabMenu:
|
|
673
|
+
requestsLinkKebabMenu: I,
|
|
679
674
|
canShowKebabMenu: f,
|
|
680
675
|
canGenerateRequestsLink: m,
|
|
681
676
|
canGenerateExploreLink: g,
|
|
682
677
|
requestsLinkZoomActions: n,
|
|
683
678
|
exploreLinkZoomActions: l,
|
|
684
679
|
buildExploreQuery: _e,
|
|
685
|
-
buildRequestsQueryZoomActions:
|
|
680
|
+
buildRequestsQueryZoomActions: B,
|
|
686
681
|
buildExploreLink: be,
|
|
687
682
|
buildRequestLink: R
|
|
688
683
|
};
|
|
@@ -693,7 +688,7 @@ const ns = (d, e, t) => {
|
|
|
693
688
|
};
|
|
694
689
|
function os() {
|
|
695
690
|
const d = ye(pe), e = new AbortController();
|
|
696
|
-
return
|
|
691
|
+
return ht(() => {
|
|
697
692
|
e.abort();
|
|
698
693
|
}), { issueQuery: async (i, s, r) => {
|
|
699
694
|
if (!d)
|
|
@@ -723,13 +718,13 @@ function os() {
|
|
|
723
718
|
return d.queryFn(f, e);
|
|
724
719
|
} };
|
|
725
720
|
}
|
|
726
|
-
const
|
|
721
|
+
const ce = {
|
|
727
722
|
useContextLinks: rs,
|
|
728
723
|
useEvaluateFeatureFlag: Qi,
|
|
729
724
|
useI18n: Gi,
|
|
730
725
|
useIssueQuery: os,
|
|
731
726
|
useRequestQueue: ss
|
|
732
|
-
}, ct = /* @__PURE__ */
|
|
727
|
+
}, ct = /* @__PURE__ */ J({
|
|
733
728
|
__name: "QueryDataProvider",
|
|
734
729
|
props: {
|
|
735
730
|
context: {},
|
|
@@ -739,25 +734,12 @@ const ue = {
|
|
|
739
734
|
},
|
|
740
735
|
emits: ["chart-data", "queryComplete"],
|
|
741
736
|
setup(d, { emit: e }) {
|
|
742
|
-
const t = d, i = e, {
|
|
743
|
-
var p, S, L, R;
|
|
737
|
+
const t = d, i = e, { issueQuery: s } = ce.useIssueQuery(), r = ye(pe), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, { data: n, error: l, isValidating: h } = Ci(o, async () => {
|
|
744
738
|
try {
|
|
745
|
-
const
|
|
746
|
-
return
|
|
747
|
-
} catch (
|
|
748
|
-
throw
|
|
749
|
-
message: s.t("queryDataProvider.forbidden"),
|
|
750
|
-
type: "forbidden"
|
|
751
|
-
} : (k == null ? void 0 : k.status) === 408 ? m.value = {
|
|
752
|
-
message: s.t("queryDataProvider.timeout"),
|
|
753
|
-
type: "timeout"
|
|
754
|
-
} : ((S = (p = k == null ? void 0 : k.response) == null ? void 0 : p.data) == null ? void 0 : S.message) === "Range not allowed for this tier" ? m.value = {
|
|
755
|
-
message: s.t("queryDataProvider.timeRangeExceeded"),
|
|
756
|
-
type: "range_exceeded"
|
|
757
|
-
} : m.value = {
|
|
758
|
-
message: ((R = (L = k == null ? void 0 : k.response) == null ? void 0 : L.data) == null ? void 0 : R.message) || (k == null ? void 0 : k.message),
|
|
759
|
-
type: "other"
|
|
760
|
-
}, k;
|
|
739
|
+
const y = await s(t.query, t.context);
|
|
740
|
+
return f.value = null, y;
|
|
741
|
+
} catch (y) {
|
|
742
|
+
throw f.value = _i(y), y;
|
|
761
743
|
} finally {
|
|
762
744
|
i("queryComplete");
|
|
763
745
|
}
|
|
@@ -765,48 +747,53 @@ const ue = {
|
|
|
765
747
|
refreshInterval: t.context.refreshInterval,
|
|
766
748
|
revalidateOnFocus: !1,
|
|
767
749
|
shouldRetryOnError: !1
|
|
768
|
-
}), { state:
|
|
769
|
-
return
|
|
770
|
-
|
|
771
|
-
}), (
|
|
772
|
-
var
|
|
773
|
-
const
|
|
774
|
-
return
|
|
750
|
+
}), { state: u, swrvState: a } = Hi(n, l, h), f = N(null), m = T(() => u.value === a.ERROR || !!f.value), g = T(() => !t.queryReady || u.value === a.PENDING);
|
|
751
|
+
return Ve(n, (y) => {
|
|
752
|
+
y && i("chart-data", y);
|
|
753
|
+
}), (y, p) => {
|
|
754
|
+
var R;
|
|
755
|
+
const S = me("KSkeleton"), I = me("KEmptyState");
|
|
756
|
+
return g.value || !x(n) && !m.value ? (C(), M(S, {
|
|
775
757
|
key: 0,
|
|
776
758
|
class: "chart-skeleton",
|
|
777
759
|
type: "table"
|
|
778
|
-
})) :
|
|
760
|
+
})) : m.value && ((R = f.value) == null ? void 0 : R.type) === "forbidden" ? (C(), M(I, {
|
|
779
761
|
key: 1,
|
|
780
762
|
"action-button-visible": !1,
|
|
781
763
|
"data-testid": "chart-forbidden-state"
|
|
782
764
|
}, {
|
|
783
|
-
default:
|
|
784
|
-
|
|
765
|
+
default: q(() => [
|
|
766
|
+
Qe(ne(f.value.message), 1)
|
|
785
767
|
]),
|
|
786
|
-
icon:
|
|
787
|
-
|
|
768
|
+
icon: q(() => [
|
|
769
|
+
le(x(Ti))
|
|
788
770
|
]),
|
|
789
771
|
_: 1
|
|
790
|
-
})) :
|
|
772
|
+
})) : m.value && f.value ? (C(), M(I, {
|
|
791
773
|
key: 2,
|
|
792
774
|
"action-button-visible": !1,
|
|
793
775
|
"data-testid": "chart-empty-state",
|
|
794
776
|
"icon-variant": "error"
|
|
795
|
-
}, {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
777
|
+
}, Ye({
|
|
778
|
+
title: q(() => [
|
|
779
|
+
oe("p", null, ne(f.value.message), 1)
|
|
780
|
+
]),
|
|
781
|
+
_: 2
|
|
782
|
+
}, [
|
|
783
|
+
f.value.details ? {
|
|
784
|
+
name: "default",
|
|
785
|
+
fn: q(() => [
|
|
786
|
+
oe("p", null, ne(f.value.details), 1)
|
|
787
|
+
]),
|
|
788
|
+
key: "0"
|
|
789
|
+
} : void 0
|
|
790
|
+
]), 1024)) : x(n) ? Se(y.$slots, "default", {
|
|
804
791
|
key: 3,
|
|
805
|
-
data: x(
|
|
806
|
-
}) :
|
|
792
|
+
data: x(n)
|
|
793
|
+
}) : Q("", !0);
|
|
807
794
|
};
|
|
808
795
|
}
|
|
809
|
-
}), as = /* @__PURE__ */
|
|
796
|
+
}), as = /* @__PURE__ */ J({
|
|
810
797
|
__name: "SimpleChartRenderer",
|
|
811
798
|
props: {
|
|
812
799
|
query: {},
|
|
@@ -819,21 +806,21 @@ const ue = {
|
|
|
819
806
|
exploreLink: {}
|
|
820
807
|
},
|
|
821
808
|
setup(d) {
|
|
822
|
-
|
|
809
|
+
je((i) => ({
|
|
823
810
|
"088169ae": `${i.height}px`
|
|
824
811
|
}));
|
|
825
|
-
const e = d, t =
|
|
826
|
-
return (i, s) => (C(),
|
|
812
|
+
const e = d, t = T(() => e.chartOptions.type === "single_value");
|
|
813
|
+
return (i, s) => (C(), M(ct, {
|
|
827
814
|
context: i.context,
|
|
828
815
|
query: i.query,
|
|
829
816
|
"query-ready": i.queryReady,
|
|
830
817
|
"refresh-counter": i.refreshCounter
|
|
831
818
|
}, {
|
|
832
|
-
default:
|
|
833
|
-
|
|
834
|
-
class:
|
|
819
|
+
default: q(({ data: r }) => [
|
|
820
|
+
oe("div", {
|
|
821
|
+
class: Xe(["analytics-chart", { "single-value": t.value }])
|
|
835
822
|
}, [
|
|
836
|
-
|
|
823
|
+
le(x(bi), {
|
|
837
824
|
"chart-data": r,
|
|
838
825
|
"chart-options": i.chartOptions,
|
|
839
826
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.synthetics_data_key
|
|
@@ -848,7 +835,7 @@ const ue = {
|
|
|
848
835
|
for (const [i, s] of e)
|
|
849
836
|
t[i] = s;
|
|
850
837
|
return t;
|
|
851
|
-
}, zt = /* @__PURE__ */ ve(as, [["__scopeId", "data-v-1e9ff912"]]), ls = { class: "analytics-chart" }, hs = /* @__PURE__ */
|
|
838
|
+
}, zt = /* @__PURE__ */ ve(as, [["__scopeId", "data-v-1e9ff912"]]), ls = { class: "analytics-chart" }, hs = /* @__PURE__ */ J({
|
|
852
839
|
__name: "BaseAnalyticsChartRenderer",
|
|
853
840
|
props: {
|
|
854
841
|
query: {},
|
|
@@ -863,28 +850,28 @@ const ue = {
|
|
|
863
850
|
},
|
|
864
851
|
emits: ["edit-tile", "chart-data", "zoom-time-range", "view-requests", "select-chart-range"],
|
|
865
852
|
setup(d, { emit: e }) {
|
|
866
|
-
const t = d, i = e, { i18n: s } =
|
|
853
|
+
const t = d, i = e, { i18n: s } = ce.useI18n(), { evaluateFeatureFlag: r } = ce.useEvaluateFeatureFlag(), o = r("ma-4135-allow-zooming-all-dashboard-tiles", !1), n = T(() => ({
|
|
867
854
|
type: t.chartOptions.type,
|
|
868
855
|
stacked: t.chartOptions.stacked ?? !1,
|
|
869
856
|
chartDatasetColors: t.chartOptions.chart_dataset_colors,
|
|
870
857
|
threshold: t.chartOptions.threshold
|
|
871
|
-
})), l =
|
|
858
|
+
})), l = T(() => o ? t.context.zoomable : t.context.zoomable && !t.query.time_range), h = () => {
|
|
872
859
|
i("edit-tile");
|
|
873
860
|
}, u = (a) => {
|
|
874
861
|
i("chart-data", a);
|
|
875
862
|
};
|
|
876
863
|
return (a, f) => {
|
|
877
864
|
const m = me("KDropdownItem");
|
|
878
|
-
return C(),
|
|
865
|
+
return C(), M(ct, {
|
|
879
866
|
context: a.context,
|
|
880
867
|
query: a.query,
|
|
881
868
|
"query-ready": a.queryReady,
|
|
882
869
|
"refresh-counter": a.refreshCounter,
|
|
883
870
|
onChartData: u
|
|
884
871
|
}, {
|
|
885
|
-
default:
|
|
886
|
-
|
|
887
|
-
|
|
872
|
+
default: q(({ data: g }) => [
|
|
873
|
+
oe("div", ls, [
|
|
874
|
+
le(x(wi), It({
|
|
888
875
|
"chart-data": g,
|
|
889
876
|
"chart-options": n.value,
|
|
890
877
|
"explore-link": a.exploreLink,
|
|
@@ -894,15 +881,15 @@ const ue = {
|
|
|
894
881
|
"timeseries-zoom": l.value,
|
|
895
882
|
"tooltip-title": ""
|
|
896
883
|
}, a.extraProps, {
|
|
897
|
-
onSelectChartRange: f[0] || (f[0] = (
|
|
898
|
-
onZoomTimeRange: f[1] || (f[1] = (
|
|
899
|
-
}),
|
|
884
|
+
onSelectChartRange: f[0] || (f[0] = (y) => i("select-chart-range", y)),
|
|
885
|
+
onZoomTimeRange: f[1] || (f[1] = (y) => i("zoom-time-range", y))
|
|
886
|
+
}), Ye({ _: 2 }, [
|
|
900
887
|
a.context.editable ? {
|
|
901
888
|
name: "menu-items",
|
|
902
|
-
fn:
|
|
903
|
-
|
|
904
|
-
default:
|
|
905
|
-
|
|
889
|
+
fn: q(() => [
|
|
890
|
+
le(m, { onClick: h }, {
|
|
891
|
+
default: q(() => [
|
|
892
|
+
Qe(ne(x(s).t("renderer.edit")), 1)
|
|
906
893
|
]),
|
|
907
894
|
_: 1
|
|
908
895
|
})
|
|
@@ -916,7 +903,7 @@ const ue = {
|
|
|
916
903
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
917
904
|
};
|
|
918
905
|
}
|
|
919
|
-
}), ft = /* @__PURE__ */ ve(hs, [["__scopeId", "data-v-965790dd"]]),
|
|
906
|
+
}), ft = /* @__PURE__ */ ve(hs, [["__scopeId", "data-v-965790dd"]]), St = /* @__PURE__ */ J({
|
|
920
907
|
__name: "BarChartRenderer",
|
|
921
908
|
props: {
|
|
922
909
|
query: {},
|
|
@@ -929,7 +916,7 @@ const ue = {
|
|
|
929
916
|
exploreLink: {}
|
|
930
917
|
},
|
|
931
918
|
setup(d) {
|
|
932
|
-
return (e, t) => (C(),
|
|
919
|
+
return (e, t) => (C(), M(ft, {
|
|
933
920
|
"chart-options": e.chartOptions,
|
|
934
921
|
context: e.context,
|
|
935
922
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -939,7 +926,7 @@ const ue = {
|
|
|
939
926
|
"refresh-counter": e.refreshCounter
|
|
940
927
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
941
928
|
}
|
|
942
|
-
}),
|
|
929
|
+
}), Dt = /* @__PURE__ */ J({
|
|
943
930
|
__name: "TimeseriesChartRenderer",
|
|
944
931
|
props: {
|
|
945
932
|
query: {},
|
|
@@ -954,7 +941,7 @@ const ue = {
|
|
|
954
941
|
emits: ["zoom-time-range", "select-chart-range"],
|
|
955
942
|
setup(d, { emit: e }) {
|
|
956
943
|
const t = e;
|
|
957
|
-
return (i, s) => (C(),
|
|
944
|
+
return (i, s) => (C(), M(ft, {
|
|
958
945
|
"chart-options": i.chartOptions,
|
|
959
946
|
context: i.context,
|
|
960
947
|
"explore-link": i.exploreLink,
|
|
@@ -967,7 +954,7 @@ const ue = {
|
|
|
967
954
|
onZoomTimeRange: s[1] || (s[1] = (r) => t("zoom-time-range", r))
|
|
968
955
|
}, null, 8, ["chart-options", "context", "explore-link", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
969
956
|
}
|
|
970
|
-
}), us = { class: "metric-card-tile-wrapper" }, ds = /* @__PURE__ */
|
|
957
|
+
}), us = { class: "metric-card-tile-wrapper" }, ds = /* @__PURE__ */ J({
|
|
971
958
|
__name: "GoldenSignalsRenderer",
|
|
972
959
|
props: {
|
|
973
960
|
query: {},
|
|
@@ -980,7 +967,7 @@ const ue = {
|
|
|
980
967
|
exploreLink: {}
|
|
981
968
|
},
|
|
982
969
|
setup(d) {
|
|
983
|
-
const e = d, t =
|
|
970
|
+
const e = d, t = T(() => {
|
|
984
971
|
const s = e.context.timeSpec;
|
|
985
972
|
if (s.type === "absolute")
|
|
986
973
|
return new pi({
|
|
@@ -999,7 +986,7 @@ const ue = {
|
|
|
999
986
|
if (!r)
|
|
1000
987
|
throw new Error("Unknown time range");
|
|
1001
988
|
return r;
|
|
1002
|
-
}), i =
|
|
989
|
+
}), i = T(() => {
|
|
1003
990
|
var r, o;
|
|
1004
991
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
1005
992
|
if (s && s !== "api_usage" && s !== "basic")
|
|
@@ -1017,10 +1004,10 @@ const ue = {
|
|
|
1017
1004
|
refreshCounter: e.refreshCounter
|
|
1018
1005
|
};
|
|
1019
1006
|
});
|
|
1020
|
-
return (s, r) => (C(),
|
|
1021
|
-
|
|
1022
|
-
default:
|
|
1023
|
-
|
|
1007
|
+
return (s, r) => (C(), V("div", us, [
|
|
1008
|
+
le(x(Ni), ui(di(i.value)), {
|
|
1009
|
+
default: q(() => [
|
|
1010
|
+
le(x(Li))
|
|
1024
1011
|
]),
|
|
1025
1012
|
_: 1
|
|
1026
1013
|
}, 16)
|
|
@@ -1029,15 +1016,15 @@ const ue = {
|
|
|
1029
1016
|
}), cs = /* @__PURE__ */ ve(ds, [["__scopeId", "data-v-7e1b1cc1"]]), Nt = "#6c7489", fs = "12px", Lt = "20px", ei = "20px", gs = {
|
|
1030
1017
|
class: "fallback-entity-link",
|
|
1031
1018
|
"data-testid": "entity-link-parent"
|
|
1032
|
-
}, At = /* @__PURE__ */
|
|
1019
|
+
}, At = /* @__PURE__ */ J({
|
|
1033
1020
|
__name: "FallbackEntityLink",
|
|
1034
1021
|
props: {
|
|
1035
1022
|
entityLinkData: {}
|
|
1036
1023
|
},
|
|
1037
1024
|
setup(d) {
|
|
1038
|
-
return (e, t) => (C(),
|
|
1025
|
+
return (e, t) => (C(), V("div", gs, ne(e.entityLinkData.label), 1));
|
|
1039
1026
|
}
|
|
1040
|
-
}), ms = /* @__PURE__ */
|
|
1027
|
+
}), ms = /* @__PURE__ */ J({
|
|
1041
1028
|
__name: "TopNTableRenderer",
|
|
1042
1029
|
props: {
|
|
1043
1030
|
query: {},
|
|
@@ -1068,21 +1055,21 @@ const ue = {
|
|
|
1068
1055
|
return e.chartOptions.entity_link.replace(Rt, r.id);
|
|
1069
1056
|
return "";
|
|
1070
1057
|
};
|
|
1071
|
-
return (r, o) => (C(),
|
|
1058
|
+
return (r, o) => (C(), M(ct, {
|
|
1072
1059
|
context: r.context,
|
|
1073
1060
|
query: r.query,
|
|
1074
1061
|
"query-ready": r.queryReady,
|
|
1075
1062
|
"refresh-counter": r.refreshCounter
|
|
1076
1063
|
}, {
|
|
1077
|
-
default:
|
|
1078
|
-
|
|
1064
|
+
default: q(({ data: n }) => [
|
|
1065
|
+
le(x(Ei), {
|
|
1079
1066
|
data: n,
|
|
1080
1067
|
"synthetics-data-key": r.chartOptions.synthetics_data_key
|
|
1081
|
-
},
|
|
1068
|
+
}, Ye({ _: 2 }, [
|
|
1082
1069
|
e.chartOptions.entity_link ? {
|
|
1083
1070
|
name: "name",
|
|
1084
|
-
fn:
|
|
1085
|
-
|
|
1071
|
+
fn: q(({ record: l }) => [
|
|
1072
|
+
le(x(i), {
|
|
1086
1073
|
"entity-link-data": {
|
|
1087
1074
|
id: l.id,
|
|
1088
1075
|
label: l.name,
|
|
@@ -1098,7 +1085,7 @@ const ue = {
|
|
|
1098
1085
|
_: 1
|
|
1099
1086
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
1100
1087
|
}
|
|
1101
|
-
}), ps = /* @__PURE__ */
|
|
1088
|
+
}), ps = /* @__PURE__ */ J({
|
|
1102
1089
|
__name: "DonutChartRenderer",
|
|
1103
1090
|
props: {
|
|
1104
1091
|
query: {},
|
|
@@ -1111,7 +1098,7 @@ const ue = {
|
|
|
1111
1098
|
exploreLink: {}
|
|
1112
1099
|
},
|
|
1113
1100
|
setup(d) {
|
|
1114
|
-
return (e, t) => (C(),
|
|
1101
|
+
return (e, t) => (C(), M(ft, {
|
|
1115
1102
|
"chart-options": e.chartOptions,
|
|
1116
1103
|
context: e.context,
|
|
1117
1104
|
height: e.height,
|
|
@@ -1123,12 +1110,12 @@ const ue = {
|
|
|
1123
1110
|
}), ys = ["data-testid"], vs = {
|
|
1124
1111
|
key: 0,
|
|
1125
1112
|
class: "tile-header"
|
|
1126
|
-
}, _s = ["data-testid"], bs = { class: "badge-text" }, ws = ["data-testid"], Es = { class: "delete-option" }, xs = ["data-testid"], Cs = ["data-testid"], Rs = /* @__PURE__ */
|
|
1113
|
+
}, _s = ["data-testid"], bs = { class: "badge-text" }, ws = ["data-testid"], Es = { class: "delete-option" }, xs = ["data-testid"], Cs = ["data-testid"], Rs = /* @__PURE__ */ J({
|
|
1127
1114
|
__name: "DashboardTile",
|
|
1128
1115
|
props: {
|
|
1129
1116
|
definition: {},
|
|
1130
1117
|
context: {},
|
|
1131
|
-
height: { default:
|
|
1118
|
+
height: { default: Ze },
|
|
1132
1119
|
isFullscreen: { type: Boolean },
|
|
1133
1120
|
queryReady: { type: Boolean },
|
|
1134
1121
|
refreshCounter: {},
|
|
@@ -1136,35 +1123,35 @@ const ue = {
|
|
|
1136
1123
|
},
|
|
1137
1124
|
emits: ["edit-tile", "duplicate-tile", "remove-tile", "tile-time-range-zoom"],
|
|
1138
1125
|
setup(d, { emit: e }) {
|
|
1139
|
-
|
|
1140
|
-
"0b59d877": `${
|
|
1126
|
+
je((v) => ({
|
|
1127
|
+
"0b59d877": `${v.height}px`
|
|
1141
1128
|
}));
|
|
1142
|
-
const t = parseInt(ei, 10), i = d, s = e, r = qt(() => import("./GeoMapRenderer-
|
|
1143
|
-
exploreLinkKebabMenu:
|
|
1129
|
+
const t = parseInt(ei, 10), i = d, s = e, r = qt(() => import("./GeoMapRenderer-B9ELIHrp.js")), o = ye(pe), n = o == null ? void 0 : o.evaluateFeatureFlagFn("analytics-chart-zoom-actions", !1), { i18n: l } = ce.useI18n(), h = N(), u = N({ status: "loading" }), a = N(!1), f = N(), m = N(!1), g = N(!0), {
|
|
1130
|
+
exploreLinkKebabMenu: y,
|
|
1144
1131
|
requestsLinkKebabMenu: p,
|
|
1145
1132
|
canShowKebabMenu: S,
|
|
1146
|
-
canGenerateRequestsLink:
|
|
1133
|
+
canGenerateRequestsLink: I,
|
|
1147
1134
|
canGenerateExploreLink: R,
|
|
1148
|
-
requestsLinkZoomActions:
|
|
1149
|
-
exploreLinkZoomActions:
|
|
1135
|
+
requestsLinkZoomActions: ee,
|
|
1136
|
+
exploreLinkZoomActions: B,
|
|
1150
1137
|
buildExploreQuery: _e,
|
|
1151
1138
|
buildExploreLink: be,
|
|
1152
|
-
buildRequestLink:
|
|
1153
|
-
buildRequestsQueryZoomActions:
|
|
1154
|
-
} =
|
|
1139
|
+
buildRequestLink: k,
|
|
1140
|
+
buildRequestsQueryZoomActions: L
|
|
1141
|
+
} = ce.useContextLinks({
|
|
1155
1142
|
queryBridge: o,
|
|
1156
|
-
chartData:
|
|
1157
|
-
definition:
|
|
1158
|
-
context:
|
|
1159
|
-
}), { issueQuery:
|
|
1160
|
-
|
|
1143
|
+
chartData: rt(h),
|
|
1144
|
+
definition: rt(wt(i, "definition")),
|
|
1145
|
+
context: rt(wt(i, "context"))
|
|
1146
|
+
}), { issueQuery: Y } = ce.useIssueQuery();
|
|
1147
|
+
Ve(() => i.definition, async () => {
|
|
1161
1148
|
await ut(), f.value && (m.value = f.value.scrollWidth > f.value.clientWidth), g.value = !0;
|
|
1162
1149
|
}, { immediate: !0, deep: !0 });
|
|
1163
|
-
const
|
|
1164
|
-
timeseries_line:
|
|
1165
|
-
timeseries_bar:
|
|
1166
|
-
horizontal_bar:
|
|
1167
|
-
vertical_bar:
|
|
1150
|
+
const U = T(() => l.t("csvExport.defaultFilename")), Me = T(() => S.value && (E.value || i.context.editable) || !!j.value), E = T(() => !!y.value || ("allow_csv_export" in i.definition.chart ? i.definition.chart.allow_csv_export : !0) || i.context.editable), D = {
|
|
1151
|
+
timeseries_line: Dt,
|
|
1152
|
+
timeseries_bar: Dt,
|
|
1153
|
+
horizontal_bar: St,
|
|
1154
|
+
vertical_bar: St,
|
|
1168
1155
|
gauge: zt,
|
|
1169
1156
|
donut: ps,
|
|
1170
1157
|
golden_signals: cs,
|
|
@@ -1172,17 +1159,17 @@ const ue = {
|
|
|
1172
1159
|
slottable: void 0,
|
|
1173
1160
|
single_value: zt,
|
|
1174
1161
|
choropleth_map: r
|
|
1175
|
-
},
|
|
1176
|
-
var
|
|
1162
|
+
}, A = T(() => {
|
|
1163
|
+
var v, P;
|
|
1177
1164
|
return {
|
|
1178
|
-
...(
|
|
1179
|
-
...(P =
|
|
1165
|
+
...(v = H.value) != null && v.rendererEvents.supportsRequests ? { "select-chart-range": ni } : {},
|
|
1166
|
+
...(P = H.value) != null && P.rendererEvents.supportsZoom ? { "zoom-time-range": ri } : {}
|
|
1180
1167
|
};
|
|
1181
|
-
}),
|
|
1182
|
-
var te,
|
|
1183
|
-
const
|
|
1184
|
-
return
|
|
1185
|
-
component:
|
|
1168
|
+
}), H = T(() => {
|
|
1169
|
+
var te, X;
|
|
1170
|
+
const v = D[i.definition.chart.type], P = !!((te = v == null ? void 0 : v.emits) != null && te.includes("select-chart-range")), $ = !!((X = v == null ? void 0 : v.emits) != null && X.includes("zoom-time-range"));
|
|
1171
|
+
return v && {
|
|
1172
|
+
component: v,
|
|
1186
1173
|
rendererProps: {
|
|
1187
1174
|
query: i.definition.query,
|
|
1188
1175
|
context: i.context,
|
|
@@ -1190,202 +1177,202 @@ const ue = {
|
|
|
1190
1177
|
chartOptions: i.definition.chart,
|
|
1191
1178
|
height: i.height - t * 2,
|
|
1192
1179
|
refreshCounter: i.refreshCounter,
|
|
1193
|
-
requestsLink:
|
|
1194
|
-
exploreLink:
|
|
1180
|
+
requestsLink: ee.value,
|
|
1181
|
+
exploreLink: B.value
|
|
1195
1182
|
},
|
|
1196
1183
|
rendererEvents: {
|
|
1197
1184
|
supportsRequests: P,
|
|
1198
1185
|
supportsZoom: $
|
|
1199
1186
|
}
|
|
1200
1187
|
};
|
|
1201
|
-
}),
|
|
1188
|
+
}), j = T(() => {
|
|
1202
1189
|
var P;
|
|
1203
|
-
const
|
|
1204
|
-
if ((
|
|
1205
|
-
const $ = Bt.get(yi[
|
|
1206
|
-
return $ ? $.display : (console.warn("Did not recognize the given relative time range:",
|
|
1207
|
-
} else if ((
|
|
1208
|
-
const $ =
|
|
1209
|
-
return `${Ct(
|
|
1190
|
+
const v = (P = i.definition.query) == null ? void 0 : P.time_range;
|
|
1191
|
+
if ((v == null ? void 0 : v.type) === "relative") {
|
|
1192
|
+
const $ = Bt.get(yi[v.time_range]);
|
|
1193
|
+
return $ ? $.display : (console.warn("Did not recognize the given relative time range:", v.time_range), v.time_range);
|
|
1194
|
+
} else if ((v == null ? void 0 : v.type) === "absolute") {
|
|
1195
|
+
const $ = v.tz || "Etc/UTC";
|
|
1196
|
+
return `${Ct(v.start, { short: !0, tz: $ })} - ${Ct(v.end, { short: !0, tz: $ })}`;
|
|
1210
1197
|
}
|
|
1211
1198
|
return null;
|
|
1212
|
-
}), fe =
|
|
1199
|
+
}), fe = T(() => h.value ? nt(h.value.meta.granularity_ms) : void 0), Ie = T(() => ["timeseries_line", "timeseries_bar"].includes(i.definition.chart.type)), ke = T(() => {
|
|
1213
1200
|
var P, $;
|
|
1214
|
-
if (!
|
|
1201
|
+
if (!Ie.value || !i.queryReady || g.value)
|
|
1215
1202
|
return !1;
|
|
1216
|
-
const
|
|
1217
|
-
return !
|
|
1218
|
-
}), Te =
|
|
1219
|
-
var $, te,
|
|
1220
|
-
const
|
|
1203
|
+
const v = ($ = (P = i.definition) == null ? void 0 : P.query) == null ? void 0 : $.granularity;
|
|
1204
|
+
return !v || !fe.value ? !1 : v !== fe.value;
|
|
1205
|
+
}), Te = T(() => {
|
|
1206
|
+
var $, te, X;
|
|
1207
|
+
const v = nt((($ = h.value) == null ? void 0 : $.meta.granularity_ms) ?? 0) ?? "unknown", P = ((X = (te = i.definition) == null ? void 0 : te.query) == null ? void 0 : X.granularity) ?? "unknown";
|
|
1221
1208
|
return l.t("query_aged_out_warning", {
|
|
1222
|
-
currentGranularity: l.t(`granularities.${
|
|
1209
|
+
currentGranularity: l.t(`granularities.${v}`),
|
|
1223
1210
|
savedGranularity: l.t(`granularities.${P}`)
|
|
1224
1211
|
});
|
|
1225
|
-
}),
|
|
1212
|
+
}), et = T(() => {
|
|
1226
1213
|
var $, te;
|
|
1227
|
-
const
|
|
1228
|
-
return
|
|
1214
|
+
const v = [...i.context.filters, ...i.definition.query.filters ?? []], P = ((te = ($ = i.definition) == null ? void 0 : $.query) == null ? void 0 : te.datasource) ?? "api_usage";
|
|
1215
|
+
return v.filter((X) => Gt(X.field).some((oi) => P === oi));
|
|
1229
1216
|
}), pt = () => {
|
|
1230
1217
|
s("edit-tile", i.definition);
|
|
1231
|
-
}, et = () => {
|
|
1232
|
-
s("duplicate-tile", i.definition);
|
|
1233
1218
|
}, tt = () => {
|
|
1219
|
+
s("duplicate-tile", i.definition);
|
|
1220
|
+
}, it = () => {
|
|
1234
1221
|
s("remove-tile", i.definition);
|
|
1235
|
-
}, yt = (
|
|
1236
|
-
h.value =
|
|
1222
|
+
}, yt = (v) => {
|
|
1223
|
+
h.value = v, g.value = !1;
|
|
1237
1224
|
}, ii = () => {
|
|
1238
1225
|
a.value = !1;
|
|
1239
1226
|
}, si = async () => {
|
|
1240
|
-
a.value = !0, u.value = { status: "loading" },
|
|
1241
|
-
u.value = { status: "success", chartData:
|
|
1242
|
-
}).catch((
|
|
1243
|
-
u.value = { status: "error", error:
|
|
1227
|
+
a.value = !0, u.value = { status: "loading" }, Y(i.definition.query, i.context, vi).then((v) => {
|
|
1228
|
+
u.value = { status: "success", chartData: v };
|
|
1229
|
+
}).catch((v) => {
|
|
1230
|
+
u.value = { status: "error", error: v };
|
|
1244
1231
|
});
|
|
1245
|
-
}, ri = (
|
|
1232
|
+
}, ri = (v) => {
|
|
1246
1233
|
const P = {
|
|
1247
1234
|
tileId: i.tileId.toString(),
|
|
1248
|
-
timeRange:
|
|
1235
|
+
timeRange: v
|
|
1249
1236
|
};
|
|
1250
1237
|
s("tile-time-range-zoom", P);
|
|
1251
|
-
}, ni = (
|
|
1252
|
-
const P =
|
|
1253
|
-
|
|
1238
|
+
}, ni = (v) => {
|
|
1239
|
+
const P = et.value, $ = L(v, P), te = _e(v, P);
|
|
1240
|
+
ee.value = I.value ? { href: k($) } : void 0, B.value = R.value ? { href: be(te) } : void 0;
|
|
1254
1241
|
};
|
|
1255
|
-
return (
|
|
1256
|
-
const $ = me("KTooltip"), te = me("KBadge"),
|
|
1257
|
-
return C(),
|
|
1258
|
-
class:
|
|
1259
|
-
"data-testid": `tile-${
|
|
1242
|
+
return (v, P) => {
|
|
1243
|
+
const $ = me("KTooltip"), te = me("KBadge"), X = me("KDropdownItem"), vt = me("KDropdown");
|
|
1244
|
+
return C(), V("div", {
|
|
1245
|
+
class: Xe(["tile-boundary", { editable: v.context.editable }]),
|
|
1246
|
+
"data-testid": `tile-${v.tileId}`
|
|
1260
1247
|
}, [
|
|
1261
|
-
|
|
1262
|
-
|
|
1248
|
+
v.definition.chart.type !== "slottable" ? (C(), V("div", vs, [
|
|
1249
|
+
le($, {
|
|
1263
1250
|
class: "title-tooltip",
|
|
1264
1251
|
disabled: !m.value,
|
|
1265
1252
|
"max-width": "500",
|
|
1266
|
-
text:
|
|
1253
|
+
text: v.definition.chart.chart_title
|
|
1267
1254
|
}, {
|
|
1268
|
-
default:
|
|
1269
|
-
|
|
1255
|
+
default: q(() => [
|
|
1256
|
+
oe("div", {
|
|
1270
1257
|
ref_key: "titleRef",
|
|
1271
1258
|
ref: f,
|
|
1272
1259
|
class: "title"
|
|
1273
|
-
}, ne(
|
|
1260
|
+
}, ne(v.definition.chart.chart_title), 513)
|
|
1274
1261
|
]),
|
|
1275
1262
|
_: 1
|
|
1276
1263
|
}, 8, ["disabled", "text"]),
|
|
1277
|
-
|
|
1264
|
+
Me.value ? (C(), V("div", {
|
|
1278
1265
|
key: 0,
|
|
1279
1266
|
class: "tile-actions",
|
|
1280
|
-
"data-testid": `tile-actions-${
|
|
1267
|
+
"data-testid": `tile-actions-${v.tileId}`
|
|
1281
1268
|
}, [
|
|
1282
|
-
|
|
1269
|
+
j.value ? (C(), M(te, {
|
|
1283
1270
|
key: 0,
|
|
1284
1271
|
"data-testid": "time-range-badge",
|
|
1285
1272
|
tooltip: ke.value ? Te.value : void 0,
|
|
1286
1273
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1287
|
-
},
|
|
1288
|
-
default:
|
|
1289
|
-
|
|
1274
|
+
}, Ye({
|
|
1275
|
+
default: q(() => [
|
|
1276
|
+
oe("span", bs, ne(j.value), 1)
|
|
1290
1277
|
]),
|
|
1291
1278
|
_: 2
|
|
1292
1279
|
}, [
|
|
1293
1280
|
ke.value ? {
|
|
1294
1281
|
name: "icon",
|
|
1295
|
-
fn:
|
|
1296
|
-
|
|
1282
|
+
fn: q(() => [
|
|
1283
|
+
le(x(zi), { size: x(fs) }, null, 8, ["size"])
|
|
1297
1284
|
]),
|
|
1298
1285
|
key: "0"
|
|
1299
1286
|
} : void 0
|
|
1300
|
-
]), 1032, ["tooltip"])) :
|
|
1301
|
-
x(S) &&
|
|
1287
|
+
]), 1032, ["tooltip"])) : Q("", !0),
|
|
1288
|
+
x(S) && v.context.editable && !v.isFullscreen ? (C(), M(x(Si), {
|
|
1302
1289
|
key: 1,
|
|
1303
1290
|
class: "edit-icon",
|
|
1304
1291
|
color: x(Nt),
|
|
1305
|
-
"data-testid": `edit-tile-${
|
|
1292
|
+
"data-testid": `edit-tile-${v.tileId}`,
|
|
1306
1293
|
size: x(Lt),
|
|
1307
1294
|
onClick: pt
|
|
1308
|
-
}, null, 8, ["color", "data-testid", "size"])) :
|
|
1309
|
-
x(S) && E.value && !
|
|
1295
|
+
}, null, 8, ["color", "data-testid", "size"])) : Q("", !0),
|
|
1296
|
+
x(S) && E.value && !v.isFullscreen ? (C(), M(vt, {
|
|
1310
1297
|
key: 2,
|
|
1311
1298
|
class: "dropdown",
|
|
1312
|
-
"data-testid": `chart-action-menu-${
|
|
1299
|
+
"data-testid": `chart-action-menu-${v.tileId}`,
|
|
1313
1300
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1314
1301
|
}, {
|
|
1315
|
-
items:
|
|
1316
|
-
x(
|
|
1302
|
+
items: q(() => [
|
|
1303
|
+
x(y) ? (C(), M(X, {
|
|
1317
1304
|
key: 0,
|
|
1318
|
-
"data-testid": `chart-jump-to-explore-${
|
|
1319
|
-
item: { label: x(l).t("jumpToExplore"), to: x(
|
|
1320
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1321
|
-
x(n) && x(p) ? (C(),
|
|
1305
|
+
"data-testid": `chart-jump-to-explore-${v.tileId}`,
|
|
1306
|
+
item: { label: x(l).t("jumpToExplore"), to: x(y) }
|
|
1307
|
+
}, null, 8, ["data-testid", "item"])) : Q("", !0),
|
|
1308
|
+
x(n) && x(p) ? (C(), M(X, {
|
|
1322
1309
|
key: 1,
|
|
1323
|
-
"data-testid": `chart-jump-to-requests-${
|
|
1310
|
+
"data-testid": `chart-jump-to-requests-${v.tileId}`,
|
|
1324
1311
|
item: { label: x(l).t("jumpToRequests"), to: x(p) }
|
|
1325
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1326
|
-
!("allow_csv_export" in
|
|
1312
|
+
}, null, 8, ["data-testid", "item"])) : Q("", !0),
|
|
1313
|
+
!("allow_csv_export" in v.definition.chart) || v.definition.chart.allow_csv_export ? (C(), M(X, {
|
|
1327
1314
|
key: 2,
|
|
1328
1315
|
class: "chart-export-button",
|
|
1329
|
-
"data-testid": `chart-csv-export-${
|
|
1316
|
+
"data-testid": `chart-csv-export-${v.tileId}`,
|
|
1330
1317
|
onClick: si
|
|
1331
1318
|
}, {
|
|
1332
|
-
default:
|
|
1333
|
-
|
|
1319
|
+
default: q(() => [
|
|
1320
|
+
oe("span", {
|
|
1334
1321
|
class: "chart-export-trigger",
|
|
1335
|
-
"data-testid": `csv-export-button-${
|
|
1322
|
+
"data-testid": `csv-export-button-${v.tileId}`
|
|
1336
1323
|
}, ne(x(l).t("csvExport.exportAsCsv")), 9, ws)
|
|
1337
1324
|
]),
|
|
1338
1325
|
_: 1
|
|
1339
|
-
}, 8, ["data-testid"])) :
|
|
1340
|
-
|
|
1326
|
+
}, 8, ["data-testid"])) : Q("", !0),
|
|
1327
|
+
v.context.editable ? (C(), M(X, {
|
|
1341
1328
|
key: 3,
|
|
1342
|
-
"data-testid": `duplicate-tile-${
|
|
1343
|
-
onClick:
|
|
1329
|
+
"data-testid": `duplicate-tile-${v.tileId}`,
|
|
1330
|
+
onClick: tt
|
|
1344
1331
|
}, {
|
|
1345
|
-
default:
|
|
1346
|
-
|
|
1332
|
+
default: q(() => [
|
|
1333
|
+
Qe(ne(x(l).t("renderer.duplicateTile")), 1)
|
|
1347
1334
|
]),
|
|
1348
1335
|
_: 1
|
|
1349
|
-
}, 8, ["data-testid"])) :
|
|
1350
|
-
|
|
1336
|
+
}, 8, ["data-testid"])) : Q("", !0),
|
|
1337
|
+
v.context.editable ? (C(), M(X, {
|
|
1351
1338
|
key: 4,
|
|
1352
|
-
"data-testid": `remove-tile-${
|
|
1353
|
-
onClick:
|
|
1339
|
+
"data-testid": `remove-tile-${v.tileId}`,
|
|
1340
|
+
onClick: it
|
|
1354
1341
|
}, {
|
|
1355
|
-
default:
|
|
1356
|
-
|
|
1342
|
+
default: q(() => [
|
|
1343
|
+
oe("span", Es, ne(x(l).t("renderer.delete")), 1)
|
|
1357
1344
|
]),
|
|
1358
1345
|
_: 1
|
|
1359
|
-
}, 8, ["data-testid"])) :
|
|
1346
|
+
}, 8, ["data-testid"])) : Q("", !0)
|
|
1360
1347
|
]),
|
|
1361
|
-
default:
|
|
1362
|
-
|
|
1348
|
+
default: q(() => [
|
|
1349
|
+
le(x(Di), {
|
|
1363
1350
|
class: "kebab-action-menu",
|
|
1364
1351
|
color: x(Nt),
|
|
1365
|
-
"data-testid": `kebab-action-menu-${
|
|
1352
|
+
"data-testid": `kebab-action-menu-${v.tileId}`,
|
|
1366
1353
|
size: x(Lt)
|
|
1367
1354
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1368
1355
|
]),
|
|
1369
1356
|
_: 1
|
|
1370
|
-
}, 8, ["data-testid"])) :
|
|
1371
|
-
], 8, _s)) : "description" in
|
|
1357
|
+
}, 8, ["data-testid"])) : Q("", !0)
|
|
1358
|
+
], 8, _s)) : "description" in v.definition.chart ? (C(), V("div", {
|
|
1372
1359
|
key: 1,
|
|
1373
1360
|
class: "header-description",
|
|
1374
|
-
"data-testid": `tile-description-${
|
|
1375
|
-
}, ne(
|
|
1376
|
-
a.value ? (C(),
|
|
1361
|
+
"data-testid": `tile-description-${v.tileId}`
|
|
1362
|
+
}, ne(v.definition.chart.description), 9, xs)) : Q("", !0),
|
|
1363
|
+
a.value ? (C(), M(x(xi), {
|
|
1377
1364
|
key: 2,
|
|
1378
|
-
"data-testid": `csv-export-modal-${
|
|
1365
|
+
"data-testid": `csv-export-modal-${v.tileId}`,
|
|
1379
1366
|
"export-state": u.value,
|
|
1380
|
-
filename:
|
|
1367
|
+
filename: U.value,
|
|
1381
1368
|
onCloseModal: ii
|
|
1382
|
-
}, null, 8, ["data-testid", "export-state", "filename"])) :
|
|
1383
|
-
])) :
|
|
1384
|
-
|
|
1369
|
+
}, null, 8, ["data-testid", "export-state", "filename"])) : Q("", !0)
|
|
1370
|
+
])) : Q("", !0),
|
|
1371
|
+
oe("div", {
|
|
1385
1372
|
class: "tile-content",
|
|
1386
|
-
"data-testid": `tile-content-${
|
|
1373
|
+
"data-testid": `tile-content-${v.tileId}`
|
|
1387
1374
|
}, [
|
|
1388
|
-
|
|
1375
|
+
H.value ? (C(), M(Pt(H.value.component), It({ key: 0 }, H.value.rendererProps, ci(A.value), { onChartData: yt }), null, 16)) : Q("", !0)
|
|
1389
1376
|
], 8, Cs)
|
|
1390
1377
|
], 10, ys);
|
|
1391
1378
|
};
|
|
@@ -1401,13 +1388,13 @@ const ue = {
|
|
|
1401
1388
|
for (let r = 0; r < t; r++)
|
|
1402
1389
|
i.get(r) ? s.push("auto") : s.push(`${d}px`);
|
|
1403
1390
|
return s;
|
|
1404
|
-
}, zs = /* @__PURE__ */
|
|
1391
|
+
}, zs = /* @__PURE__ */ J({
|
|
1405
1392
|
__name: "GridLayout",
|
|
1406
1393
|
props: {
|
|
1407
1394
|
tileHeight: {
|
|
1408
1395
|
type: Number,
|
|
1409
1396
|
required: !1,
|
|
1410
|
-
default: () =>
|
|
1397
|
+
default: () => Ze
|
|
1411
1398
|
},
|
|
1412
1399
|
tiles: {
|
|
1413
1400
|
type: Array,
|
|
@@ -1415,21 +1402,21 @@ const ue = {
|
|
|
1415
1402
|
}
|
|
1416
1403
|
},
|
|
1417
1404
|
setup(d) {
|
|
1418
|
-
|
|
1405
|
+
je((n) => ({
|
|
1419
1406
|
"2a38e79e": x(Wt),
|
|
1420
1407
|
"4cc71de6": r.value
|
|
1421
1408
|
}));
|
|
1422
|
-
const e = d, t =
|
|
1409
|
+
const e = d, t = N(null), i = N(0), s = new ResizeObserver((n) => {
|
|
1423
1410
|
window.requestAnimationFrame(() => {
|
|
1424
1411
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1425
1412
|
});
|
|
1426
1413
|
});
|
|
1427
|
-
|
|
1414
|
+
lt(() => {
|
|
1428
1415
|
t.value && s.observe(t.value);
|
|
1429
|
-
}),
|
|
1416
|
+
}), ht(() => {
|
|
1430
1417
|
t.value && s.unobserve(t.value);
|
|
1431
1418
|
});
|
|
1432
|
-
const r =
|
|
1419
|
+
const r = T(() => Ts(e.tileHeight, e.tiles).join(" ")), o = T(() => e.tiles.map((n, l) => ({
|
|
1433
1420
|
key: `tile-${l}`,
|
|
1434
1421
|
tile: n,
|
|
1435
1422
|
style: {
|
|
@@ -1439,27 +1426,27 @@ const ue = {
|
|
|
1439
1426
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1440
1427
|
}
|
|
1441
1428
|
})));
|
|
1442
|
-
return (n, l) => (C(),
|
|
1429
|
+
return (n, l) => (C(), V("div", {
|
|
1443
1430
|
ref_key: "gridContainer",
|
|
1444
1431
|
ref: t,
|
|
1445
1432
|
class: "kong-ui-public-grid-layout"
|
|
1446
1433
|
}, [
|
|
1447
|
-
(C(!0),
|
|
1434
|
+
(C(!0), V($t, null, Ft(o.value, (h) => (C(), V("div", {
|
|
1448
1435
|
key: h.key,
|
|
1449
|
-
class:
|
|
1436
|
+
class: Xe(["grid-cell", {
|
|
1450
1437
|
"empty-cell": !h.tile
|
|
1451
1438
|
}]),
|
|
1452
1439
|
style: Et(h.style)
|
|
1453
1440
|
}, [
|
|
1454
|
-
|
|
1441
|
+
Se(n.$slots, "tile", {
|
|
1455
1442
|
style: Et(h.style),
|
|
1456
1443
|
tile: h.tile
|
|
1457
1444
|
}, void 0, !0)
|
|
1458
1445
|
], 6))), 128))
|
|
1459
1446
|
], 512));
|
|
1460
1447
|
}
|
|
1461
|
-
}),
|
|
1462
|
-
function
|
|
1448
|
+
}), Ss = /* @__PURE__ */ ve(zs, [["__scopeId", "data-v-354b7177"]]);
|
|
1449
|
+
function Ds(d, e, t, i, s) {
|
|
1463
1450
|
const r = (...o) => (console.warn("gridstack.js: Function `" + t + "` is deprecated in " + s + " and has been replaced with `" + i + "`. It will be **removed** in a future release"), e.apply(d, o));
|
|
1464
1451
|
return r.prototype = e.prototype, r;
|
|
1465
1452
|
}
|
|
@@ -1799,7 +1786,7 @@ class c {
|
|
|
1799
1786
|
return !(!e || e.w === e.h || e.locked || e.noResize || (t = e.grid) != null && t.opts.disableResize || e.minW && e.minW === e.maxW || e.minH && e.minH === e.maxH);
|
|
1800
1787
|
}
|
|
1801
1788
|
}
|
|
1802
|
-
class
|
|
1789
|
+
class he {
|
|
1803
1790
|
constructor(e = {}) {
|
|
1804
1791
|
this.addedNodes = [], this.removedNodes = [], this.defaultColumn = 12, this.column = e.column || this.defaultColumn, this.column > this.defaultColumn && (this.defaultColumn = this.column), this.maxRow = e.maxRow, this._float = e.float, this.nodes = e.nodes || [], this.onChange = e.onChange;
|
|
1805
1792
|
}
|
|
@@ -1977,7 +1964,7 @@ class le {
|
|
|
1977
1964
|
* @param resizing if out of bound, resize down or move into the grid to fit ?
|
|
1978
1965
|
*/
|
|
1979
1966
|
prepareNode(e, t) {
|
|
1980
|
-
e._id = e._id ??
|
|
1967
|
+
e._id = e._id ?? he._idSeq++;
|
|
1981
1968
|
const i = e.id;
|
|
1982
1969
|
if (i) {
|
|
1983
1970
|
let r = 1;
|
|
@@ -2072,7 +2059,7 @@ class le {
|
|
|
2072
2059
|
if (t.pack = !0, !this.maxRow)
|
|
2073
2060
|
return this.moveNode(e, t);
|
|
2074
2061
|
let i;
|
|
2075
|
-
const s = new
|
|
2062
|
+
const s = new he({
|
|
2076
2063
|
column: this.column,
|
|
2077
2064
|
float: this.float,
|
|
2078
2065
|
nodes: this.nodes.map((o) => o._id === e._id ? (i = { ...o }, i) : { ...o })
|
|
@@ -2094,7 +2081,7 @@ class le {
|
|
|
2094
2081
|
willItFit(e) {
|
|
2095
2082
|
if (delete e._willFitPos, !this.maxRow)
|
|
2096
2083
|
return !0;
|
|
2097
|
-
const t = new
|
|
2084
|
+
const t = new he({
|
|
2098
2085
|
column: this.column,
|
|
2099
2086
|
float: this.float,
|
|
2100
2087
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
@@ -2122,8 +2109,8 @@ class le {
|
|
|
2122
2109
|
const a = e._moving && !t.nested;
|
|
2123
2110
|
let f = a ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
2124
2111
|
if (a && f && ((u = (h = e.grid) == null ? void 0 : h.opts) != null && u.subGridDynamic) && !e.grid._isTemp) {
|
|
2125
|
-
const m = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect),
|
|
2126
|
-
m / (g <
|
|
2112
|
+
const m = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect), y = c.area(f._rect);
|
|
2113
|
+
m / (g < y ? g : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
2127
2114
|
}
|
|
2128
2115
|
f ? l = !this._fixCollisions(e, r, f, t) : (l = !1, i && delete t.pack);
|
|
2129
2116
|
}
|
|
@@ -2230,7 +2217,7 @@ class le {
|
|
|
2230
2217
|
return e.forEach((r, o) => {
|
|
2231
2218
|
if (r._id === void 0) {
|
|
2232
2219
|
const n = r.id ? this.nodes.find((l) => l.id === r.id) : void 0;
|
|
2233
|
-
r._id = (n == null ? void 0 : n._id) ??
|
|
2220
|
+
r._id = (n == null ? void 0 : n._id) ?? he._idSeq++;
|
|
2234
2221
|
}
|
|
2235
2222
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
2236
2223
|
}), this._layouts = i ? [] : this._layouts || [], this._layouts[t] = s, this;
|
|
@@ -2241,7 +2228,7 @@ class le {
|
|
|
2241
2228
|
* @param column corresponding column index to save it under
|
|
2242
2229
|
*/
|
|
2243
2230
|
cacheOneLayout(e, t) {
|
|
2244
|
-
e._id = e._id ??
|
|
2231
|
+
e._id = e._id ?? he._idSeq++;
|
|
2245
2232
|
const i = { x: e.x, y: e.y, w: e.w, _id: e._id };
|
|
2246
2233
|
(e.autoPosition || e.x === void 0) && (delete i.x, delete i.y, e.autoPosition && (i.autoPosition = !0)), this._layouts = this._layouts || [], this._layouts[t] = this._layouts[t] || [];
|
|
2247
2234
|
const s = this.findCacheLayout(e, t);
|
|
@@ -2265,8 +2252,8 @@ class le {
|
|
|
2265
2252
|
return this;
|
|
2266
2253
|
}
|
|
2267
2254
|
}
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2255
|
+
he._idSeq = 0;
|
|
2256
|
+
const Z = {
|
|
2270
2257
|
alwaysShowResizeHandle: "mobile",
|
|
2271
2258
|
animate: !0,
|
|
2272
2259
|
auto: !0,
|
|
@@ -2298,55 +2285,55 @@ const J = {
|
|
|
2298
2285
|
};
|
|
2299
2286
|
class w {
|
|
2300
2287
|
}
|
|
2301
|
-
const
|
|
2302
|
-
class
|
|
2288
|
+
const ae = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2289
|
+
class ue {
|
|
2303
2290
|
}
|
|
2304
|
-
function
|
|
2291
|
+
function Fe(d, e) {
|
|
2305
2292
|
d.touches.length > 1 || (d.cancelable && d.preventDefault(), c.simulateMouseEvent(d.changedTouches[0], e));
|
|
2306
2293
|
}
|
|
2307
2294
|
function ti(d, e) {
|
|
2308
2295
|
d.cancelable && d.preventDefault(), c.simulateMouseEvent(d, e);
|
|
2309
2296
|
}
|
|
2297
|
+
function Ge(d) {
|
|
2298
|
+
ue.touchHandled || (ue.touchHandled = !0, Fe(d, "mousedown"));
|
|
2299
|
+
}
|
|
2310
2300
|
function Be(d) {
|
|
2311
|
-
|
|
2301
|
+
ue.touchHandled && Fe(d, "mousemove");
|
|
2312
2302
|
}
|
|
2313
2303
|
function Ue(d) {
|
|
2314
|
-
|
|
2315
|
-
}
|
|
2316
|
-
function We(d) {
|
|
2317
|
-
if (!he.touchHandled)
|
|
2304
|
+
if (!ue.touchHandled)
|
|
2318
2305
|
return;
|
|
2319
|
-
|
|
2306
|
+
ue.pointerLeaveTimeout && (window.clearTimeout(ue.pointerLeaveTimeout), delete ue.pointerLeaveTimeout);
|
|
2320
2307
|
const e = !!w.dragElement;
|
|
2321
|
-
|
|
2308
|
+
Fe(d, "mouseup"), e || Fe(d, "click"), ue.touchHandled = !1;
|
|
2322
2309
|
}
|
|
2323
|
-
function
|
|
2310
|
+
function We(d) {
|
|
2324
2311
|
d.pointerType !== "mouse" && d.target.releasePointerCapture(d.pointerId);
|
|
2325
2312
|
}
|
|
2326
2313
|
function Ht(d) {
|
|
2327
2314
|
w.dragElement && d.pointerType !== "mouse" && ti(d, "mouseenter");
|
|
2328
2315
|
}
|
|
2329
2316
|
function Ot(d) {
|
|
2330
|
-
w.dragElement && d.pointerType !== "mouse" && (
|
|
2331
|
-
delete
|
|
2317
|
+
w.dragElement && d.pointerType !== "mouse" && (ue.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2318
|
+
delete ue.pointerLeaveTimeout, ti(d, "mouseleave");
|
|
2332
2319
|
}, 10));
|
|
2333
2320
|
}
|
|
2334
|
-
class
|
|
2321
|
+
class Je {
|
|
2335
2322
|
constructor(e, t, i) {
|
|
2336
2323
|
this.host = e, this.dir = t, this.option = i, this.moving = !1, this._mouseDown = this._mouseDown.bind(this), this._mouseMove = this._mouseMove.bind(this), this._mouseUp = this._mouseUp.bind(this), this._keyEvent = this._keyEvent.bind(this), this._init();
|
|
2337
2324
|
}
|
|
2338
2325
|
/** @internal */
|
|
2339
2326
|
_init() {
|
|
2340
2327
|
const e = this.el = document.createElement("div");
|
|
2341
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${
|
|
2328
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Je.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), ae && (this.el.addEventListener("touchstart", Ge), this.el.addEventListener("pointerdown", We)), this;
|
|
2342
2329
|
}
|
|
2343
2330
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2344
2331
|
destroy() {
|
|
2345
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown),
|
|
2332
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), ae && (this.el.removeEventListener("touchstart", Ge), this.el.removeEventListener("pointerdown", We)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2346
2333
|
}
|
|
2347
2334
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2348
2335
|
_mouseDown(e) {
|
|
2349
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0),
|
|
2336
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ae && (this.el.addEventListener("touchmove", Be), this.el.addEventListener("touchend", Ue)), e.stopPropagation(), e.preventDefault();
|
|
2350
2337
|
}
|
|
2351
2338
|
/** @internal */
|
|
2352
2339
|
_mouseMove(e) {
|
|
@@ -2355,7 +2342,7 @@ class Ze {
|
|
|
2355
2342
|
}
|
|
2356
2343
|
/** @internal */
|
|
2357
2344
|
_mouseUp(e) {
|
|
2358
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2345
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ae && (this.el.removeEventListener("touchmove", Be), this.el.removeEventListener("touchend", Ue)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2359
2346
|
}
|
|
2360
2347
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2361
2348
|
_keyEvent(e) {
|
|
@@ -2367,7 +2354,7 @@ class Ze {
|
|
|
2367
2354
|
return this.option[e] && this.option[e](t), this;
|
|
2368
2355
|
}
|
|
2369
2356
|
}
|
|
2370
|
-
|
|
2357
|
+
Je.prefix = "ui-resizable-";
|
|
2371
2358
|
class gt {
|
|
2372
2359
|
constructor() {
|
|
2373
2360
|
this._eventRegister = {};
|
|
@@ -2396,7 +2383,7 @@ class gt {
|
|
|
2396
2383
|
return this._eventRegister[e](t);
|
|
2397
2384
|
}
|
|
2398
2385
|
}
|
|
2399
|
-
class
|
|
2386
|
+
class De extends gt {
|
|
2400
2387
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2401
2388
|
constructor(e, t = {}) {
|
|
2402
2389
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2466,7 +2453,7 @@ class Ne extends gt {
|
|
|
2466
2453
|
}
|
|
2467
2454
|
/** @internal */
|
|
2468
2455
|
_setupHandlers() {
|
|
2469
|
-
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new
|
|
2456
|
+
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new Je(this.el, e, {
|
|
2470
2457
|
start: (t) => {
|
|
2471
2458
|
this._resizeStart(t);
|
|
2472
2459
|
},
|
|
@@ -2497,7 +2484,7 @@ class Ne extends gt {
|
|
|
2497
2484
|
}
|
|
2498
2485
|
/** @internal */
|
|
2499
2486
|
_setupHelper() {
|
|
2500
|
-
this.elOriginStyleVal =
|
|
2487
|
+
this.elOriginStyleVal = De._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2501
2488
|
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2502
2489
|
return this.rectScale = {
|
|
2503
2490
|
x: t.xScale,
|
|
@@ -2506,7 +2493,7 @@ class Ne extends gt {
|
|
|
2506
2493
|
}
|
|
2507
2494
|
/** @internal */
|
|
2508
2495
|
_cleanHelper() {
|
|
2509
|
-
return
|
|
2496
|
+
return De._originStyleProp.forEach((e, t) => {
|
|
2510
2497
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
2511
2498
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
2512
2499
|
}
|
|
@@ -2545,9 +2532,9 @@ class Ne extends gt {
|
|
|
2545
2532
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
2546
2533
|
}
|
|
2547
2534
|
}
|
|
2548
|
-
|
|
2535
|
+
De._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2549
2536
|
const Ns = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2550
|
-
class
|
|
2537
|
+
class Ne extends gt {
|
|
2551
2538
|
constructor(e, t = {}) {
|
|
2552
2539
|
var r;
|
|
2553
2540
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2567,12 +2554,12 @@ class Le extends gt {
|
|
|
2567
2554
|
}
|
|
2568
2555
|
enable() {
|
|
2569
2556
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2570
|
-
e.addEventListener("mousedown", this._mouseDown),
|
|
2557
|
+
e.addEventListener("mousedown", this._mouseDown), ae && (e.addEventListener("touchstart", Ge), e.addEventListener("pointerdown", We));
|
|
2571
2558
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2572
2559
|
}
|
|
2573
2560
|
disable(e = !1) {
|
|
2574
2561
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2575
|
-
t.removeEventListener("mousedown", this._mouseDown),
|
|
2562
|
+
t.removeEventListener("mousedown", this._mouseDown), ae && (t.removeEventListener("touchstart", Ge), t.removeEventListener("pointerdown", We));
|
|
2576
2563
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2577
2564
|
}
|
|
2578
2565
|
destroy() {
|
|
@@ -2584,7 +2571,7 @@ class Le extends gt {
|
|
|
2584
2571
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2585
2572
|
_mouseDown(e) {
|
|
2586
2573
|
if (!w.mouseHandled)
|
|
2587
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Ns) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete w.dragElement, delete w.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0),
|
|
2574
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Ns) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete w.dragElement, delete w.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ae && (e.currentTarget.addEventListener("touchmove", Be), e.currentTarget.addEventListener("touchend", Ue)), e.preventDefault(), document.activeElement && document.activeElement.blur(), w.mouseHandled = !0), !0;
|
|
2588
2575
|
}
|
|
2589
2576
|
/** @internal method to call actual drag event */
|
|
2590
2577
|
_callDrag(e) {
|
|
@@ -2615,7 +2602,7 @@ class Le extends gt {
|
|
|
2615
2602
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2616
2603
|
_mouseUp(e) {
|
|
2617
2604
|
var t, i;
|
|
2618
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2605
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ae && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", Be, !0), e.currentTarget.removeEventListener("touchend", Ue, !0)), this.dragging) {
|
|
2619
2606
|
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i = w.dropElement) == null ? void 0 : i.el) === this.el.parentElement && delete w.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
2620
2607
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2621
2608
|
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), w.dropElement && w.dropElement.drop(e);
|
|
@@ -2637,7 +2624,7 @@ class Le extends gt {
|
|
|
2637
2624
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
2638
2625
|
_createHelper() {
|
|
2639
2626
|
let e = this.el;
|
|
2640
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle =
|
|
2627
|
+
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle = Ne.originStyleProp.map((t) => this.el.style[t]), e;
|
|
2641
2628
|
}
|
|
2642
2629
|
/** @internal set the fix position of the dragged item */
|
|
2643
2630
|
_setupHelperStyle(e) {
|
|
@@ -2654,7 +2641,7 @@ class Le extends gt {
|
|
|
2654
2641
|
const e = (t = this.helper) == null ? void 0 : t.gridstackNode;
|
|
2655
2642
|
if (!(e != null && e._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
2656
2643
|
const i = this.helper, s = this.dragElementOriginStyle.transition || null;
|
|
2657
|
-
i.style.transition = this.dragElementOriginStyle.transition = "none",
|
|
2644
|
+
i.style.transition = this.dragElementOriginStyle.transition = "none", Ne.originStyleProp.forEach((r) => i.style[r] = this.dragElementOriginStyle[r] || null), setTimeout(() => i.style.transition = s, 50);
|
|
2658
2645
|
}
|
|
2659
2646
|
return delete this.dragElementOriginStyle, this;
|
|
2660
2647
|
}
|
|
@@ -2696,7 +2683,7 @@ class Le extends gt {
|
|
|
2696
2683
|
};
|
|
2697
2684
|
}
|
|
2698
2685
|
}
|
|
2699
|
-
|
|
2686
|
+
Ne.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2700
2687
|
class Ls extends gt {
|
|
2701
2688
|
constructor(e, t = {}) {
|
|
2702
2689
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
@@ -2708,10 +2695,10 @@ class Ls extends gt {
|
|
|
2708
2695
|
super.off(e);
|
|
2709
2696
|
}
|
|
2710
2697
|
enable() {
|
|
2711
|
-
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave),
|
|
2698
|
+
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave), ae && (this.el.addEventListener("pointerenter", Ht), this.el.addEventListener("pointerleave", Ot)));
|
|
2712
2699
|
}
|
|
2713
2700
|
disable(e = !1) {
|
|
2714
|
-
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave),
|
|
2701
|
+
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave), ae && (this.el.removeEventListener("pointerenter", Ht), this.el.removeEventListener("pointerleave", Ot)));
|
|
2715
2702
|
}
|
|
2716
2703
|
destroy() {
|
|
2717
2704
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2777,13 +2764,13 @@ class mt {
|
|
|
2777
2764
|
return this.ddDraggable && ["drag", "dragstart", "dragstop"].indexOf(e) > -1 ? this.ddDraggable.off(e) : this.ddDroppable && ["drop", "dropover", "dropout"].indexOf(e) > -1 ? this.ddDroppable.off(e) : this.ddResizable && ["resizestart", "resize", "resizestop"].indexOf(e) > -1 && this.ddResizable.off(e), this;
|
|
2778
2765
|
}
|
|
2779
2766
|
setupDraggable(e) {
|
|
2780
|
-
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new
|
|
2767
|
+
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new Ne(this.el, e), this;
|
|
2781
2768
|
}
|
|
2782
2769
|
cleanDraggable() {
|
|
2783
2770
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2784
2771
|
}
|
|
2785
2772
|
setupResizable(e) {
|
|
2786
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2773
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new De(this.el, e), this;
|
|
2787
2774
|
}
|
|
2788
2775
|
cleanResizable() {
|
|
2789
2776
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
@@ -2884,7 +2871,7 @@ class As {
|
|
|
2884
2871
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2885
2872
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2886
2873
|
*/
|
|
2887
|
-
const
|
|
2874
|
+
const W = new As();
|
|
2888
2875
|
class b {
|
|
2889
2876
|
/**
|
|
2890
2877
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2949,7 +2936,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2949
2936
|
/** @internal create placeholder DIV as needed */
|
|
2950
2937
|
get placeholder() {
|
|
2951
2938
|
if (!this._placeholder) {
|
|
2952
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2939
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, Z.itemClass, this.opts.itemClass]);
|
|
2953
2940
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2954
2941
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2955
2942
|
}
|
|
@@ -2970,42 +2957,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2970
2957
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2971
2958
|
const g = r.oneColumnSize || 768;
|
|
2972
2959
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2973
|
-
let
|
|
2974
|
-
|
|
2960
|
+
let y = s.find((p) => p.c === 1);
|
|
2961
|
+
y ? y.w = g : (y = { c: 1, w: g }, s.push(y, { c: 12, w: g + 1 }));
|
|
2975
2962
|
}
|
|
2976
2963
|
const o = t.columnOpts;
|
|
2977
|
-
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g,
|
|
2964
|
+
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g, y) => (y.w || 0) - (g.w || 0));
|
|
2978
2965
|
const n = {
|
|
2979
|
-
...c.cloneDeep(
|
|
2980
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2981
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2982
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2983
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2966
|
+
...c.cloneDeep(Z),
|
|
2967
|
+
column: c.toNumber(e.getAttribute("gs-column")) || Z.column,
|
|
2968
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || Z.minRow,
|
|
2969
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || Z.maxRow,
|
|
2970
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || Z.staticGrid,
|
|
2984
2971
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2985
2972
|
draggable: {
|
|
2986
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2973
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || Z.draggable.handle
|
|
2987
2974
|
},
|
|
2988
2975
|
removableOptions: {
|
|
2989
|
-
accept: t.itemClass ||
|
|
2990
|
-
decline:
|
|
2976
|
+
accept: t.itemClass || Z.removableOptions.accept,
|
|
2977
|
+
decline: Z.removableOptions.decline
|
|
2991
2978
|
}
|
|
2992
2979
|
};
|
|
2993
2980
|
e.getAttribute("gs-animate") && (n.animate = c.toBool(e.getAttribute("gs-animate"))), t = c.defaults(t, n), this._initMargin(), this.checkDynamicColumn(), this.el.classList.add("gs-" + t.column), t.rtl === "auto" && (t.rtl = e.style.direction === "rtl"), t.rtl && this.el.classList.add("grid-stack-rtl");
|
|
2994
|
-
const l = this.el.closest("." +
|
|
2995
|
-
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !==
|
|
2996
|
-
const u = t.engineClass || b.engineClass ||
|
|
2981
|
+
const l = this.el.closest("." + Z.itemClass), h = l == null ? void 0 : l.gridstackNode;
|
|
2982
|
+
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== Z.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = ae), this._styleSheetClass = "gs-id-" + he._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2983
|
+
const u = t.engineClass || b.engineClass || he;
|
|
2997
2984
|
if (this.engine = new u({
|
|
2998
2985
|
column: this.getColumn(),
|
|
2999
2986
|
float: t.float,
|
|
3000
2987
|
maxRow: t.maxRow,
|
|
3001
2988
|
onChange: (g) => {
|
|
3002
|
-
let
|
|
2989
|
+
let y = 0;
|
|
3003
2990
|
this.engine.nodes.forEach((p) => {
|
|
3004
|
-
|
|
2991
|
+
y = Math.max(y, p.y + p.h);
|
|
3005
2992
|
}), g.forEach((p) => {
|
|
3006
2993
|
const S = p.el;
|
|
3007
2994
|
S && (p._removeDOM ? (S && S.remove(), delete p._removeDOM) : this._writePosAttr(S, p));
|
|
3008
|
-
}), this._updateStyles(!1,
|
|
2995
|
+
}), this._updateStyles(!1, y);
|
|
3009
2996
|
}
|
|
3010
2997
|
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((g) => this._prepareElement(g)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
3011
2998
|
const g = t.children;
|
|
@@ -3062,13 +3049,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3062
3049
|
* @returns newly created grid
|
|
3063
3050
|
*/
|
|
3064
3051
|
makeSubGrid(e, t, i, s = !0) {
|
|
3065
|
-
var m, g,
|
|
3052
|
+
var m, g, y;
|
|
3066
3053
|
let r = e.gridstackNode;
|
|
3067
3054
|
if (r || (r = this.makeWidget(e).gridstackNode), (m = r.subGrid) != null && m.el)
|
|
3068
3055
|
return r.subGrid;
|
|
3069
3056
|
let o, n = this;
|
|
3070
3057
|
for (; n && !o; )
|
|
3071
|
-
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (
|
|
3058
|
+
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (y = n.parentGridNode) == null ? void 0 : y.grid;
|
|
3072
3059
|
t = c.cloneDeep({
|
|
3073
3060
|
// by default sub-grid inherit from us | parent, other than id, children, etc...
|
|
3074
3061
|
...this.opts,
|
|
@@ -3085,8 +3072,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3085
3072
|
t.column === "auto" && (l = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
3086
3073
|
let h = r.el.querySelector(".grid-stack-item-content"), u, a;
|
|
3087
3074
|
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 }, c.removeInternalForSave(a), delete a.subGridOpts, r.content && (a.content = r.content, delete r.content), b.addRemoveCB ? u = b.addRemoveCB(this.el, a, !0, !1) : (u = c.createDiv(["grid-stack-item"]), u.appendChild(h), h = c.createDiv(["grid-stack-item-content"], r.el)), this.prepareDragDrop(r.el)), i) {
|
|
3088
|
-
const p = l ? t.column : r.w, S = r.h + i.h,
|
|
3089
|
-
|
|
3075
|
+
const p = l ? t.column : r.w, S = r.h + i.h, I = r.el.style;
|
|
3076
|
+
I.transition = "none", this.update(r.el, { w: p, h: S }), setTimeout(() => I.transition = null);
|
|
3090
3077
|
}
|
|
3091
3078
|
const f = r.subGrid = b.addGrid(h, t);
|
|
3092
3079
|
return i != null && i._moving && (f._isTemp = !0), l && (f._autoColumn = !0), s && f.makeWidget(u, a), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
@@ -3127,7 +3114,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3127
3114
|
const r = c.cloneDeep(this.opts);
|
|
3128
3115
|
r.marginBottom === r.marginTop && r.marginRight === r.marginLeft && r.marginTop === r.marginRight && (r.margin = r.marginTop, delete r.marginTop, delete r.marginRight, delete r.marginBottom, delete r.marginLeft), r.rtl === (this.el.style.direction === "rtl") && (r.rtl = "auto"), this._isAutoCellHeight && (r.cellHeight = "auto"), this._autoColumn && (r.column = "auto");
|
|
3129
3116
|
const o = r._alwaysShowResizeHandle;
|
|
3130
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
3117
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, Z), r.children = s, r;
|
|
3131
3118
|
}
|
|
3132
3119
|
return s;
|
|
3133
3120
|
}
|
|
@@ -3507,8 +3494,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3507
3494
|
let h;
|
|
3508
3495
|
if (t.subGrid) {
|
|
3509
3496
|
h = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3510
|
-
const g = t.subGrid.el.getBoundingClientRect(),
|
|
3511
|
-
h += g.top -
|
|
3497
|
+
const g = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3498
|
+
h += g.top - y.top;
|
|
3512
3499
|
} else {
|
|
3513
3500
|
if ((m = (f = t.subGridOpts) == null ? void 0 : f.children) != null && m.length)
|
|
3514
3501
|
return;
|
|
@@ -3678,7 +3665,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3678
3665
|
}
|
|
3679
3666
|
/** @internal */
|
|
3680
3667
|
_prepareElement(e, t = !1, i) {
|
|
3681
|
-
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(
|
|
3668
|
+
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(Z.itemClass, this.opts.itemClass);
|
|
3682
3669
|
const s = c.shouldSizeToContent(i);
|
|
3683
3670
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), c.lazyLoad(i) || this.prepareDragDrop(i.el), this;
|
|
3684
3671
|
}
|
|
@@ -3784,7 +3771,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3784
3771
|
*/
|
|
3785
3772
|
/** get the global (but static to this code) DD implementation */
|
|
3786
3773
|
static getDD() {
|
|
3787
|
-
return
|
|
3774
|
+
return W;
|
|
3788
3775
|
}
|
|
3789
3776
|
/**
|
|
3790
3777
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3797,7 +3784,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3797
3784
|
*/
|
|
3798
3785
|
static setupDragIn(e, t, i, s = document) {
|
|
3799
3786
|
(t == null ? void 0 : t.pause) !== void 0 && (w.pauseDrag = t.pause), t = { appendTo: "body", helper: "clone", ...t || {} }, (typeof e == "string" ? c.getElements(e, s) : e).forEach((o, n) => {
|
|
3800
|
-
|
|
3787
|
+
W.isDraggable(o) || W.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3801
3788
|
});
|
|
3802
3789
|
}
|
|
3803
3790
|
/**
|
|
@@ -3876,12 +3863,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3876
3863
|
}
|
|
3877
3864
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3878
3865
|
_removeDD(e) {
|
|
3879
|
-
return
|
|
3866
|
+
return W.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3880
3867
|
}
|
|
3881
3868
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3882
3869
|
_setupAcceptWidget() {
|
|
3883
3870
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3884
|
-
return
|
|
3871
|
+
return W.droppable(this.el, "destroy"), this;
|
|
3885
3872
|
let e, t;
|
|
3886
3873
|
const i = (s, r, o) => {
|
|
3887
3874
|
var f;
|
|
@@ -3906,7 +3893,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3906
3893
|
if (n._temporaryRemoved) {
|
|
3907
3894
|
if (n.x = Math.max(0, Math.round(h / t)), n.y = Math.max(0, Math.round(l / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3908
3895
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3909
|
-
|
|
3896
|
+
W.off(r, "drag");
|
|
3910
3897
|
return;
|
|
3911
3898
|
}
|
|
3912
3899
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
@@ -3915,7 +3902,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3915
3902
|
} else
|
|
3916
3903
|
this._dragOrResize(o, s, a, n, t, e);
|
|
3917
3904
|
};
|
|
3918
|
-
return
|
|
3905
|
+
return W.droppable(this.el, {
|
|
3919
3906
|
accept: (s) => {
|
|
3920
3907
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3921
3908
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3954,12 +3941,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3954
3941
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3955
3942
|
const l = n.w || Math.round(o.offsetWidth / t) || 1, h = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3956
3943
|
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: l, h, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3957
|
-
n._temporaryRemoved = !0) : (n.w = l, n.h = h, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1),
|
|
3944
|
+
n._temporaryRemoved = !0) : (n.w = l, n.h = h, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1), W.on(r, "drag", i), i(s, r, o), !1;
|
|
3958
3945
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3959
3946
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3960
3947
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3961
3948
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3962
|
-
var m, g,
|
|
3949
|
+
var m, g, y;
|
|
3963
3950
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3964
3951
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3965
3952
|
return !1;
|
|
@@ -3972,9 +3959,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3972
3959
|
const p = a.grid;
|
|
3973
3960
|
p.engine.removeNodeFromLayoutCache(a), p.engine.removedNodes.push(a), p._triggerRemoveEvent()._triggerChangeEvent(), p.parentGridNode && !p.engine.nodes.length && p.opts.subGridDynamic && p.removeAsSubGrid();
|
|
3974
3961
|
}
|
|
3975
|
-
if (!n || (l && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp,
|
|
3962
|
+
if (!n || (l && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp, W.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !l))
|
|
3976
3963
|
return !1;
|
|
3977
|
-
const f = (
|
|
3964
|
+
const f = (y = (g = n.subGrid) == null ? void 0 : g.el) == null ? void 0 : y.gridstack;
|
|
3978
3965
|
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts || b.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, a && a.grid ? a : void 0, n), u && this.setAnimation(this.opts.animate, !0), !1;
|
|
3979
3966
|
}), this;
|
|
3980
3967
|
}
|
|
@@ -3990,7 +3977,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3990
3977
|
if (typeof this.opts.removable != "string")
|
|
3991
3978
|
return this;
|
|
3992
3979
|
const e = document.querySelector(this.opts.removable);
|
|
3993
|
-
return e ? (!this.opts.staticGrid && !
|
|
3980
|
+
return e ? (!this.opts.staticGrid && !W.isDroppable(e) && W.droppable(e, this.opts.removableOptions).on(e, "dropover", (t, i) => b._itemRemoving(i, !0)).on(e, "dropout", (t, i) => b._itemRemoving(i, !1)), this) : this;
|
|
3994
3981
|
}
|
|
3995
3982
|
/**
|
|
3996
3983
|
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
@@ -4015,14 +4002,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4015
4002
|
const m = i.w !== i._orig.w, g = f.target;
|
|
4016
4003
|
if (!(!g.gridstackNode || g.gridstackNode.grid !== this)) {
|
|
4017
4004
|
if (i.el = g, i._isAboutToRemove) {
|
|
4018
|
-
const
|
|
4019
|
-
|
|
4005
|
+
const y = e.gridstackNode.grid;
|
|
4006
|
+
y._gsEventHandler[f.type] && y._gsEventHandler[f.type](f, g), y.engine.nodes.push(i), y.removeWidget(e, !0, !0);
|
|
4020
4007
|
} else
|
|
4021
4008
|
c.removePositioningStyles(g), i._temporaryRemoved ? (c.copyPos(i, i._orig), this._writePosAttr(g, i), this.engine.addNode(i)) : this._writePosAttr(g, i), this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, g);
|
|
4022
4009
|
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(m, i));
|
|
4023
4010
|
}
|
|
4024
4011
|
};
|
|
4025
|
-
|
|
4012
|
+
W.draggable(e, {
|
|
4026
4013
|
start: h,
|
|
4027
4014
|
stop: a,
|
|
4028
4015
|
drag: u
|
|
@@ -4032,7 +4019,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4032
4019
|
resize: u
|
|
4033
4020
|
}), i._initDD = !0;
|
|
4034
4021
|
}
|
|
4035
|
-
return
|
|
4022
|
+
return W.draggable(e, s ? "disable" : "enable").resizable(e, r ? "disable" : "enable"), this;
|
|
4036
4023
|
}
|
|
4037
4024
|
/** @internal handles actual drag/resize start */
|
|
4038
4025
|
_onStartMoving(e, t, i, s, r, o) {
|
|
@@ -4051,7 +4038,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4051
4038
|
};
|
|
4052
4039
|
if (s.el = this.placeholder, s._lastUiPosition = i.position, s._prevYPix = i.position.top, s._moving = t.type === "dragstart", delete s._lastTried, t.type === "dropover" && s._temporaryRemoved && (this.engine.addNode(s), s._moving = !0), this.engine.cacheRects(r, o, this.opts.marginTop, this.opts.marginRight, this.opts.marginBottom, this.opts.marginLeft), t.type === "resizestart") {
|
|
4053
4040
|
const l = this.getColumn() - s.x, h = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
4054
|
-
|
|
4041
|
+
W.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, l)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, h)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, l)).resizable(e, "option", "maxWidthMoveLeft", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, s.x + s.w)).resizable(e, "option", "maxHeight", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, h)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
4055
4042
|
}
|
|
4056
4043
|
}
|
|
4057
4044
|
/** @internal handles actual drag/resize */
|
|
@@ -4064,13 +4051,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4064
4051
|
return;
|
|
4065
4052
|
const p = i.position.top - s._prevYPix;
|
|
4066
4053
|
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, p);
|
|
4067
|
-
const S = i.position.left + (i.position.left > s._lastUiPosition.left ? -u : h),
|
|
4068
|
-
n.x = Math.round(S / r), n.y = Math.round(
|
|
4054
|
+
const S = i.position.left + (i.position.left > s._lastUiPosition.left ? -u : h), I = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : a);
|
|
4055
|
+
n.x = Math.round(S / r), n.y = Math.round(I / o);
|
|
4069
4056
|
const R = this._extraDragRow;
|
|
4070
4057
|
if (this.engine.collide(s, n)) {
|
|
4071
|
-
const
|
|
4072
|
-
let
|
|
4073
|
-
this.opts.maxRow &&
|
|
4058
|
+
const ee = this.getRow();
|
|
4059
|
+
let B = Math.max(0, n.y + s.h - ee);
|
|
4060
|
+
this.opts.maxRow && ee + B > this.opts.maxRow && (B = Math.max(0, this.opts.maxRow - ee)), this._extraDragRow = B;
|
|
4074
4061
|
} else
|
|
4075
4062
|
this._extraDragRow = 0;
|
|
4076
4063
|
if (this._extraDragRow !== R && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
@@ -4082,13 +4069,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4082
4069
|
n.x = Math.round(p / r), n.y = Math.round(S / o), l = !0;
|
|
4083
4070
|
}
|
|
4084
4071
|
s._event = t, s._lastTried = n;
|
|
4085
|
-
const
|
|
4072
|
+
const y = {
|
|
4086
4073
|
x: i.position.left + h,
|
|
4087
4074
|
y: i.position.top + a,
|
|
4088
4075
|
w: (i.size ? i.size.width : s.w * r) - h - u,
|
|
4089
4076
|
h: (i.size ? i.size.height : s.h * o) - a - f
|
|
4090
4077
|
};
|
|
4091
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect:
|
|
4078
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing: l })) {
|
|
4092
4079
|
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a, u, f, h), delete s._skipDown, l && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
4093
4080
|
const p = t.target;
|
|
4094
4081
|
s._sidebarOrig || this._writePosAttr(p, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, p);
|
|
@@ -4101,7 +4088,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4101
4088
|
_leave(e, t) {
|
|
4102
4089
|
t = t || e;
|
|
4103
4090
|
const i = t.gridstackNode;
|
|
4104
|
-
if (!i || (t.style.transform = t.style.transformOrigin = null,
|
|
4091
|
+
if (!i || (t.style.transform = t.style.transformOrigin = null, W.off(e, "drag"), i._temporaryRemoved))
|
|
4105
4092
|
return;
|
|
4106
4093
|
i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e;
|
|
4107
4094
|
const s = i._sidebarOrig;
|
|
@@ -4109,7 +4096,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4109
4096
|
}
|
|
4110
4097
|
// legacy method removed
|
|
4111
4098
|
commit() {
|
|
4112
|
-
return
|
|
4099
|
+
return Ds(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
4113
4100
|
}
|
|
4114
4101
|
}
|
|
4115
4102
|
b.renderCB = (d, e) => {
|
|
@@ -4117,24 +4104,24 @@ b.renderCB = (d, e) => {
|
|
|
4117
4104
|
};
|
|
4118
4105
|
b.resizeToContentParent = ".grid-stack-item-content";
|
|
4119
4106
|
b.Utils = c;
|
|
4120
|
-
b.Engine =
|
|
4107
|
+
b.Engine = he;
|
|
4121
4108
|
b.GDRev = "11.5.1";
|
|
4122
|
-
const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { class: "grid-stack-item-content" }, Ms = /* @__PURE__ */
|
|
4109
|
+
const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { class: "grid-stack-item-content" }, Ms = /* @__PURE__ */ J({
|
|
4123
4110
|
__name: "DraggableGridLayout",
|
|
4124
4111
|
props: {
|
|
4125
4112
|
tiles: {},
|
|
4126
|
-
tileHeight: { default:
|
|
4113
|
+
tileHeight: { default: Ze }
|
|
4127
4114
|
},
|
|
4128
4115
|
emits: ["update-tiles"],
|
|
4129
4116
|
setup(d, { expose: e, emit: t }) {
|
|
4130
|
-
const i = d, s = t, r =
|
|
4117
|
+
const i = d, s = t, r = N(null), o = N(new Map(i.tiles.map((m) => [`${m.id}`, m])));
|
|
4131
4118
|
let n = null;
|
|
4132
4119
|
const l = (m) => `[data-id="${m}"]`, h = (m) => m.map((g) => {
|
|
4133
4120
|
var p;
|
|
4134
|
-
const
|
|
4135
|
-
if (
|
|
4121
|
+
const y = o.value.get(`${(p = g.el) == null ? void 0 : p.getAttribute("data-id")}`);
|
|
4122
|
+
if (y)
|
|
4136
4123
|
return {
|
|
4137
|
-
...
|
|
4124
|
+
...y,
|
|
4138
4125
|
layout: {
|
|
4139
4126
|
position: { col: Number(g.x), row: Number(g.y) },
|
|
4140
4127
|
size: { cols: Number(g.w), rows: Number(g.h) }
|
|
@@ -4145,12 +4132,12 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4145
4132
|
o.value.set(`${p.id}`, p);
|
|
4146
4133
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4147
4134
|
}, a = (m, g) => {
|
|
4148
|
-
g.forEach((
|
|
4135
|
+
g.forEach((y) => {
|
|
4149
4136
|
var p;
|
|
4150
|
-
o.value.delete(`${(p =
|
|
4137
|
+
o.value.delete(`${(p = y.el) == null ? void 0 : p.getAttribute("data-id")}`);
|
|
4151
4138
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
4152
4139
|
};
|
|
4153
|
-
|
|
4140
|
+
lt(() => {
|
|
4154
4141
|
r.value && (n = b.init({
|
|
4155
4142
|
margin: 10,
|
|
4156
4143
|
column: Wt,
|
|
@@ -4158,7 +4145,7 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4158
4145
|
resizable: { handles: "se, sw" },
|
|
4159
4146
|
handle: ".tile-header"
|
|
4160
4147
|
}, r.value), n.on("change", u), n.on("added", u), n.on("removed", a));
|
|
4161
|
-
}),
|
|
4148
|
+
}), ht(() => {
|
|
4162
4149
|
n && n.destroy(!1);
|
|
4163
4150
|
});
|
|
4164
4151
|
const f = (m) => {
|
|
@@ -4167,10 +4154,10 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4167
4154
|
g && n.removeWidget(g);
|
|
4168
4155
|
}
|
|
4169
4156
|
};
|
|
4170
|
-
return
|
|
4157
|
+
return Ve(() => i.tiles.length, async (m, g) => {
|
|
4171
4158
|
if (m > g && n) {
|
|
4172
|
-
const
|
|
4173
|
-
for (const p of
|
|
4159
|
+
const y = i.tiles.slice(g);
|
|
4160
|
+
for (const p of y)
|
|
4174
4161
|
o.value.set(`${p.id}`, p), await ut(), n.makeWidget(l(p.id), {
|
|
4175
4162
|
autoPosition: !0,
|
|
4176
4163
|
w: p.layout.size.cols,
|
|
@@ -4181,24 +4168,24 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4181
4168
|
i.tiles.forEach((m) => {
|
|
4182
4169
|
o.value.set(`${m.id}`, m);
|
|
4183
4170
|
});
|
|
4184
|
-
}), e({ removeWidget: f }), (m, g) => (C(),
|
|
4171
|
+
}), e({ removeWidget: f }), (m, g) => (C(), V("div", {
|
|
4185
4172
|
ref_key: "gridContainer",
|
|
4186
4173
|
ref: r,
|
|
4187
4174
|
class: "grid-stack"
|
|
4188
4175
|
}, [
|
|
4189
|
-
(C(!0),
|
|
4190
|
-
key:
|
|
4176
|
+
(C(!0), V($t, null, Ft(i.tiles, (y) => (C(), V("div", {
|
|
4177
|
+
key: y.id,
|
|
4191
4178
|
class: "grid-stack-item",
|
|
4192
|
-
"data-id": `${
|
|
4193
|
-
"data-testid": `grid-stack-item-${
|
|
4194
|
-
"gs-h":
|
|
4179
|
+
"data-id": `${y.id}`,
|
|
4180
|
+
"data-testid": `grid-stack-item-${y.id}`,
|
|
4181
|
+
"gs-h": y.layout.size.rows,
|
|
4195
4182
|
"gs-lazy-load": !0,
|
|
4196
|
-
"gs-w":
|
|
4197
|
-
"gs-x":
|
|
4198
|
-
"gs-y":
|
|
4183
|
+
"gs-w": y.layout.size.cols,
|
|
4184
|
+
"gs-x": y.layout.position.col,
|
|
4185
|
+
"gs-y": y.layout.position.row
|
|
4199
4186
|
}, [
|
|
4200
|
-
|
|
4201
|
-
|
|
4187
|
+
oe("div", Os, [
|
|
4188
|
+
Se(m.$slots, "tile", { tile: y }, void 0, !0)
|
|
4202
4189
|
])
|
|
4203
4190
|
], 8, Hs))), 128))
|
|
4204
4191
|
], 512));
|
|
@@ -4209,7 +4196,7 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4209
4196
|
}, Ps = {
|
|
4210
4197
|
key: 0,
|
|
4211
4198
|
class: "tile-container slottable-tile"
|
|
4212
|
-
}, $s = /* @__PURE__ */
|
|
4199
|
+
}, $s = /* @__PURE__ */ J({
|
|
4213
4200
|
__name: "DashboardRenderer",
|
|
4214
4201
|
props: /* @__PURE__ */ xt({
|
|
4215
4202
|
context: {}
|
|
@@ -4219,30 +4206,30 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4219
4206
|
}),
|
|
4220
4207
|
emits: /* @__PURE__ */ xt(["edit-tile", "tile-time-range-zoom"], ["update:modelValue"]),
|
|
4221
4208
|
setup(d, { expose: e, emit: t }) {
|
|
4222
|
-
|
|
4209
|
+
je((E) => ({
|
|
4223
4210
|
"82baf22a": a.value
|
|
4224
4211
|
}));
|
|
4225
|
-
const i = d, s = t, r = fi(d, "modelValue"), { i18n: o } =
|
|
4226
|
-
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),
|
|
4227
|
-
const m = dt(), g =
|
|
4212
|
+
const i = d, s = t, r = fi(d, "modelValue"), { i18n: o } = ce.useI18n(), n = N(0), l = N(null), h = N(), u = N(), a = N("scale(1)"), f = ye(pe);
|
|
4213
|
+
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ce.useRequestQueue();
|
|
4214
|
+
const m = dt(), g = T(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4228
4215
|
type: "relative",
|
|
4229
4216
|
time_range: m.defaultQueryTimeForOrg
|
|
4230
|
-
}),
|
|
4231
|
-
const
|
|
4232
|
-
return
|
|
4233
|
-
}, S =
|
|
4234
|
-
var
|
|
4235
|
-
let
|
|
4236
|
-
if ("description" in
|
|
4237
|
-
const
|
|
4217
|
+
}), y = T(() => !!i.context.timeSpec || !m.loading), p = (E, D) => {
|
|
4218
|
+
const A = E.layout.position.row - D.layout.position.row;
|
|
4219
|
+
return A !== 0 ? A : E.layout.position.col - D.layout.position.col;
|
|
4220
|
+
}, S = T(() => r.value.tiles.map((E) => {
|
|
4221
|
+
var A;
|
|
4222
|
+
let D = E.definition;
|
|
4223
|
+
if ("description" in D.chart) {
|
|
4224
|
+
const H = (A = D.chart.description) == null ? void 0 : A.replace(Ui, () => {
|
|
4238
4225
|
const fe = `renderer.trendRange.${g.value.type === "absolute" ? "custom" : g.value.time_range}`;
|
|
4239
4226
|
return o.te(fe) ? o.t(fe) : "";
|
|
4240
4227
|
});
|
|
4241
|
-
|
|
4242
|
-
...
|
|
4228
|
+
D = {
|
|
4229
|
+
...D,
|
|
4243
4230
|
chart: {
|
|
4244
|
-
...
|
|
4245
|
-
description:
|
|
4231
|
+
...D.chart,
|
|
4232
|
+
description: H
|
|
4246
4233
|
}
|
|
4247
4234
|
};
|
|
4248
4235
|
}
|
|
@@ -4252,48 +4239,48 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4252
4239
|
E
|
|
4253
4240
|
), {
|
|
4254
4241
|
layout: E.layout,
|
|
4255
|
-
meta:
|
|
4242
|
+
meta: D,
|
|
4256
4243
|
type: E.type,
|
|
4257
4244
|
// Add a unique key to each tile internally.
|
|
4258
4245
|
id: E.id ?? crypto.randomUUID()
|
|
4259
4246
|
};
|
|
4260
|
-
})),
|
|
4261
|
-
var fe,
|
|
4262
|
-
let { tz: E, refreshInterval:
|
|
4263
|
-
const
|
|
4264
|
-
if (E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone),
|
|
4247
|
+
})), I = T(() => {
|
|
4248
|
+
var fe, Ie, ke;
|
|
4249
|
+
let { tz: E, refreshInterval: D, editable: A } = i.context;
|
|
4250
|
+
const H = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
4251
|
+
if (E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), D === void 0 && (D = Wi), U.value) {
|
|
4265
4252
|
let Te = !1;
|
|
4266
4253
|
if (g.value.type === "relative")
|
|
4267
4254
|
Te = ["15m", "1h", "6h", "12h", "24h"].includes(g.value.time_range);
|
|
4268
4255
|
else {
|
|
4269
|
-
const
|
|
4270
|
-
Te = Math.abs(
|
|
4256
|
+
const tt = g.value.start.getTime(), it = g.value.end.getTime();
|
|
4257
|
+
Te = Math.abs(it - tt) <= 864e5;
|
|
4271
4258
|
}
|
|
4272
|
-
const
|
|
4273
|
-
g.value.type === "absolute" && g.value.end.getTime() <
|
|
4259
|
+
const et = (/* @__PURE__ */ new Date()).getTime();
|
|
4260
|
+
g.value.type === "absolute" && g.value.end.getTime() < et ? D = 0 : Te ? D = Ki : D = Vi;
|
|
4274
4261
|
}
|
|
4275
|
-
|
|
4276
|
-
const
|
|
4262
|
+
A === void 0 && (A = !1);
|
|
4263
|
+
const j = !!((ke = (Ie = (fe = gi()) == null ? void 0 : fe.vnode) == null ? void 0 : Ie.props) != null && ke.onTileTimeRangeZoom);
|
|
4277
4264
|
return {
|
|
4278
|
-
filters:
|
|
4265
|
+
filters: H,
|
|
4279
4266
|
tz: E,
|
|
4280
4267
|
timeSpec: g.value,
|
|
4281
|
-
refreshInterval:
|
|
4282
|
-
editable:
|
|
4283
|
-
zoomable:
|
|
4268
|
+
refreshInterval: D,
|
|
4269
|
+
editable: A,
|
|
4270
|
+
zoomable: j
|
|
4284
4271
|
};
|
|
4285
4272
|
}), R = (E) => {
|
|
4286
4273
|
s("edit-tile", E);
|
|
4287
|
-
},
|
|
4288
|
-
const
|
|
4274
|
+
}, ee = (E) => E.type === "slottable", B = (E) => {
|
|
4275
|
+
const D = ee(E.meta.chart) ? { ...E.meta.chart } : {
|
|
4289
4276
|
...E.meta.chart,
|
|
4290
4277
|
chart_title: E.meta.chart.chart_title ? `Copy of ${E.meta.chart.chart_title}` : ""
|
|
4291
|
-
},
|
|
4278
|
+
}, A = {
|
|
4292
4279
|
id: crypto.randomUUID(),
|
|
4293
4280
|
type: "chart",
|
|
4294
4281
|
definition: {
|
|
4295
4282
|
...E.meta,
|
|
4296
|
-
chart:
|
|
4283
|
+
chart: D
|
|
4297
4284
|
},
|
|
4298
4285
|
layout: {
|
|
4299
4286
|
position: {
|
|
@@ -4303,82 +4290,82 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { cl
|
|
|
4303
4290
|
size: E.layout.size
|
|
4304
4291
|
}
|
|
4305
4292
|
};
|
|
4306
|
-
r.value.tiles.push(
|
|
4293
|
+
r.value.tiles.push(A);
|
|
4307
4294
|
}, _e = (E) => {
|
|
4308
4295
|
l.value && l.value.removeWidget(E.id);
|
|
4309
4296
|
}, be = () => {
|
|
4310
4297
|
n.value++;
|
|
4311
|
-
},
|
|
4312
|
-
const
|
|
4313
|
-
id:
|
|
4314
|
-
type:
|
|
4315
|
-
layout:
|
|
4316
|
-
definition:
|
|
4298
|
+
}, k = (E) => {
|
|
4299
|
+
const D = E.map((A) => ({
|
|
4300
|
+
id: A.id,
|
|
4301
|
+
type: A.type,
|
|
4302
|
+
layout: A.layout,
|
|
4303
|
+
definition: A.meta
|
|
4317
4304
|
}));
|
|
4318
|
-
r.value.tiles =
|
|
4319
|
-
},
|
|
4305
|
+
r.value.tiles = D.sort(p);
|
|
4306
|
+
}, L = async () => {
|
|
4320
4307
|
if (a.value = "scale(1)", await ut(), u.value) {
|
|
4321
|
-
const { availWidth: E, availHeight:
|
|
4322
|
-
a.value = `scale(${
|
|
4308
|
+
const { availWidth: E, availHeight: D } = window.screen, { width: A, height: H } = u.value.getBoundingClientRect(), j = Math.min(D / H, E / A);
|
|
4309
|
+
a.value = `scale(${j})`;
|
|
4323
4310
|
}
|
|
4324
|
-
},
|
|
4311
|
+
}, Y = () => {
|
|
4325
4312
|
h.value && (document.fullscreenElement ? document.exitFullscreen() : h.value.requestFullscreen());
|
|
4326
|
-
},
|
|
4327
|
-
|
|
4313
|
+
}, U = N(!1), Me = () => {
|
|
4314
|
+
U.value = document.fullscreenElement !== null, U.value && L();
|
|
4328
4315
|
};
|
|
4329
4316
|
return e({
|
|
4330
4317
|
refresh: be,
|
|
4331
|
-
toggleFullscreen:
|
|
4332
|
-
}), (E,
|
|
4333
|
-
const
|
|
4334
|
-
return C(),
|
|
4318
|
+
toggleFullscreen: Y
|
|
4319
|
+
}), (E, D) => {
|
|
4320
|
+
const A = me("KAlert");
|
|
4321
|
+
return C(), V("div", {
|
|
4335
4322
|
ref_key: "dashboardContainer",
|
|
4336
4323
|
ref: h,
|
|
4337
|
-
class:
|
|
4338
|
-
onFullscreenchange:
|
|
4324
|
+
class: Xe(["kong-ui-public-dashboard-renderer", { "is-fullscreen": U.value }]),
|
|
4325
|
+
onFullscreenchange: Me
|
|
4339
4326
|
}, [
|
|
4340
|
-
|
|
4327
|
+
oe("div", {
|
|
4341
4328
|
ref_key: "layoutContainer",
|
|
4342
4329
|
ref: u,
|
|
4343
4330
|
class: "layout"
|
|
4344
4331
|
}, [
|
|
4345
|
-
x(f) &&
|
|
4346
|
-
|
|
4347
|
-
])) :
|
|
4348
|
-
x(f) ? (C(),
|
|
4332
|
+
x(f) && U.value ? (C(), V("div", qs, [
|
|
4333
|
+
Se(E.$slots, "fullscreenHeader", {}, void 0, !0)
|
|
4334
|
+
])) : Q("", !0),
|
|
4335
|
+
x(f) ? (C(), M(Pt(E.context.editable && !U.value ? Is : Ss), {
|
|
4349
4336
|
key: 2,
|
|
4350
4337
|
ref_key: "gridLayoutRef",
|
|
4351
4338
|
ref: l,
|
|
4352
4339
|
"tile-height": r.value.tile_height,
|
|
4353
4340
|
tiles: S.value,
|
|
4354
|
-
onUpdateTiles:
|
|
4341
|
+
onUpdateTiles: k
|
|
4355
4342
|
}, {
|
|
4356
|
-
tile:
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
])) : (C(),
|
|
4360
|
-
key:
|
|
4343
|
+
tile: q(({ tile: H }) => [
|
|
4344
|
+
H.meta.chart.type === "slottable" ? (C(), V("div", Ps, [
|
|
4345
|
+
Se(E.$slots, H.meta.chart.id, {}, void 0, !0)
|
|
4346
|
+
])) : (C(), M(ks, {
|
|
4347
|
+
key: U.value ? `${H.id}-tile` : `${H.id}-tile-fullscreen`,
|
|
4361
4348
|
class: "tile-container",
|
|
4362
|
-
context:
|
|
4363
|
-
definition:
|
|
4364
|
-
height:
|
|
4365
|
-
"is-fullscreen":
|
|
4366
|
-
"query-ready":
|
|
4349
|
+
context: I.value,
|
|
4350
|
+
definition: H.meta,
|
|
4351
|
+
height: H.layout.size.rows * (r.value.tile_height || x(Ze)) + parseInt(x(ei), 10),
|
|
4352
|
+
"is-fullscreen": U.value,
|
|
4353
|
+
"query-ready": y.value,
|
|
4367
4354
|
"refresh-counter": n.value,
|
|
4368
|
-
"tile-id":
|
|
4369
|
-
onDuplicateTile: (
|
|
4370
|
-
onEditTile: (
|
|
4371
|
-
onRemoveTile: (
|
|
4372
|
-
onTileTimeRangeZoom:
|
|
4355
|
+
"tile-id": H.id,
|
|
4356
|
+
onDuplicateTile: (j) => B(H),
|
|
4357
|
+
onEditTile: (j) => R(H),
|
|
4358
|
+
onRemoveTile: (j) => _e(H),
|
|
4359
|
+
onTileTimeRangeZoom: D[0] || (D[0] = (j) => s("tile-time-range-zoom", j))
|
|
4373
4360
|
}, null, 8, ["context", "definition", "height", "is-fullscreen", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4374
4361
|
]),
|
|
4375
4362
|
_: 3
|
|
4376
|
-
}, 40, ["tile-height", "tiles"])) : (C(),
|
|
4363
|
+
}, 40, ["tile-height", "tiles"])) : (C(), M(A, {
|
|
4377
4364
|
key: 1,
|
|
4378
4365
|
appearance: "danger"
|
|
4379
4366
|
}, {
|
|
4380
|
-
default:
|
|
4381
|
-
|
|
4367
|
+
default: q(() => [
|
|
4368
|
+
Qe(ne(x(o).t("renderer.noQueryBridge")), 1)
|
|
4382
4369
|
]),
|
|
4383
4370
|
_: 1
|
|
4384
4371
|
}))
|
|
@@ -4392,11 +4379,11 @@ export {
|
|
|
4392
4379
|
Xs as D,
|
|
4393
4380
|
Rt as E,
|
|
4394
4381
|
Ki as F,
|
|
4395
|
-
|
|
4382
|
+
Ss as G,
|
|
4396
4383
|
pe as I,
|
|
4397
4384
|
Ui as T,
|
|
4398
4385
|
ct as _,
|
|
4399
|
-
|
|
4386
|
+
Ze as a,
|
|
4400
4387
|
Wt as b,
|
|
4401
4388
|
Wi as c,
|
|
4402
4389
|
Vi as d
|