@kong-ui-public/dashboard-renderer 8.15.6 → 8.15.7
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.
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { isPlatformDatasource as
|
|
1
|
+
import { ref as L, watchEffect as Dt, inject as le, provide as oi, toRaw as ai, computed as b, isRef as li, isReactive as ui, toRef as be, hasInjectionContext as at, onMounted as Oe, watch as we, onUnmounted as Te, getCurrentInstance as hi, readonly as Ue, defineComponent as K, resolveComponent as te, unref as E, openBlock as w, createBlock as N, createSlots as Me, withCtx as M, createElementVNode as Q, toDisplayString as W, renderSlot as Ee, createCommentVNode as U, normalizeStyle as ze, normalizeClass as _e, createVNode as ae, mergeProps as zt, createTextVNode as Ke, createElementBlock as P, normalizeProps as di, guardReactiveProps as ci, defineAsyncComponent as Lt, Fragment as Ve, useCssVars as Qe, useModel as Nt, nextTick as Ye, resolveDynamicComponent as At, toHandlers as fi, mergeModels as Le, renderList as Ht, useTemplateRef as lt } from "vue";
|
|
2
|
+
import { isPlatformDatasource as It, msToGranularity as We, restoreAfterCapture as ut, prepareForCapture as gi, TimePeriods as mi, TIMEFRAME_LOOKUP as pi, formatTime as ht, EXPORT_RECORD_LIMIT as yi } from "@kong-ui-public/analytics-utilities";
|
|
3
3
|
import { handleQueryError as vi, SimpleChart as _i, AnalyticsChart as bi, TopNTable as wi, CsvExportModal as Ei } from "@kong-ui-public/analytics-chart";
|
|
4
4
|
import xi from "swrv";
|
|
5
5
|
import "axios";
|
|
6
6
|
import { createI18n as Ci, i18nTComponent as Ri } from "@kong-ui-public/i18n";
|
|
7
|
-
import { useAnalyticsConfigStore as je, useDatasourceConfigStore as
|
|
8
|
-
import { VisibilityOffIcon as
|
|
9
|
-
import { MetricsProvider as Ai, MetricsConsumer as
|
|
10
|
-
import { TableDataGrid as
|
|
11
|
-
var
|
|
7
|
+
import { useAnalyticsConfigStore as je, useDatasourceConfigStore as ke } from "@kong-ui-public/analytics-config-store";
|
|
8
|
+
import { VisibilityOffIcon as Ti, WarningOutlineIcon as ki, WarningIcon as Si, ProgressIcon as Di, RefreshIcon as zi, EditIcon as Li, MoreIcon as Ni } from "@kong/icons";
|
|
9
|
+
import { MetricsProvider as Ai, MetricsConsumer as Hi } from "@kong-ui-public/analytics-metric-provider";
|
|
10
|
+
import { TableDataGrid as Ii } from "@kong-ui-public/table-data-grid";
|
|
11
|
+
var qt = /* @__PURE__ */ ((a) => (a.VALIDATING = "VALIDATING", a.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", a.PENDING = "PENDING", a.SUCCESS = "SUCCESS", a.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", a.ERROR = "ERROR", a.STALE_IF_ERROR = "STALE_IF_ERROR", a))(qt || {});
|
|
12
12
|
const qi = (a) => a ? !!// TODO: revisit: currently only the first check ever matters?
|
|
13
13
|
(Object.keys(a)?.length || a.data?.length || a.data?.data?.length || !a.data?.data && typeof a.data == "object" && Object.keys(a?.data).length) : !1;
|
|
14
|
-
function
|
|
15
|
-
const s =
|
|
14
|
+
function Oi(a = L({}), e, t, i = qi) {
|
|
15
|
+
const s = L(
|
|
16
16
|
"PENDING"
|
|
17
17
|
/* PENDING */
|
|
18
18
|
);
|
|
19
|
-
return
|
|
19
|
+
return Dt(() => {
|
|
20
20
|
const r = i(a.value);
|
|
21
21
|
if (a.value && r && t.value) {
|
|
22
22
|
s.value = "VALIDATING_HAS_DATA";
|
|
@@ -45,7 +45,7 @@ function Ii(a = N({}), e, t, i = qi) {
|
|
|
45
45
|
a.value === void 0 && e && (s.value = "ERROR");
|
|
46
46
|
}), {
|
|
47
47
|
state: s,
|
|
48
|
-
swrvState:
|
|
48
|
+
swrvState: qt
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
const Mi = { not_configured: { title: "Chart is not fully configured", description: "Begin by choosing at least one metric" }, noQueryBridge: "No query bridge provided. Unable to render dashboard.", unexpectedError: "An unexpected error has occurred.", trendRange: { "24h": "Last 24-hour summary", "7d": "Last 7-day summary", "30d": "Last 30-day summary" }, edit: "Edit", duplicateTile: "Duplicate", exit_fullscreen: "Exit fullscreen", fullscreen: "Fullscreen", remove: "Remove", delete: "Delete", as_of_today: "As of today" }, Pi = { branding: "Kong Konnect", generated: "Generated {timestamp}", dashboardNote: "For a live, interactive experience, open this dashboard in Konnect", pageOf: "{page} / {total}" }, Bi = { defaultFilename: "Chart export", exportAsCsv: "Export as CSV" }, $i = { control_plane: "Control plane", data_plane_node_version: "Data plane node version", env: "Environment", gateway_service: "Gateway service", hostname: "Hostname", plugin: "Plugin", plugin_name: "Plugin name", plugin_scope: "Plugin scope", region: "Region", request_count: "Request count", route: "Route", status_code: "Status code", team: "Team", name: "Name" }, Fi = "Explore", Gi = "View requests", Ui = "This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.", Wi = { daily: "1 day", fiveMinutely: "5 minutes", hourly: "1 hour", minutely: "1 minute", tenMinutely: "10 minutes", tenSecondly: "10 seconds", thirtyMinutely: "30 minutes", thirtySecondly: "30 seconds", twelveHourly: "12 hours", twoHourly: "2 hours", weekly: "1 week", unknown: "Unknown" }, Ki = {
|
|
@@ -58,7 +58,7 @@ const Mi = { not_configured: { title: "Chart is not fully configured", descripti
|
|
|
58
58
|
query_aged_out_warning: Ui,
|
|
59
59
|
granularities: Wi
|
|
60
60
|
};
|
|
61
|
-
function
|
|
61
|
+
function Ot() {
|
|
62
62
|
const a = Ci("en-us", Ki);
|
|
63
63
|
return {
|
|
64
64
|
i18n: a,
|
|
@@ -66,8 +66,8 @@ function qt() {
|
|
|
66
66
|
// Translation component <i18n-t>
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
const Se = 170,
|
|
70
|
-
function
|
|
69
|
+
const Se = 170, Ze = 6, ce = "analytics-query-provider", dt = "{entity-id}", Vi = "{cp-id}", Qi = "{timeframe}", Yi = 30 * 1e3, ji = 3e5, Zi = 36e5;
|
|
70
|
+
function Xi() {
|
|
71
71
|
const a = le(ce);
|
|
72
72
|
return {
|
|
73
73
|
evaluateFeatureFlag: (t, i) => a ? a.evaluateFeatureFlagFn(t, i) : i
|
|
@@ -76,70 +76,70 @@ function Zi() {
|
|
|
76
76
|
function Ji(a) {
|
|
77
77
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
78
78
|
}
|
|
79
|
-
var Ge = { exports: {} },
|
|
79
|
+
var Ge = { exports: {} }, ct;
|
|
80
80
|
function es() {
|
|
81
|
-
return
|
|
81
|
+
return ct || (ct = 1, (function(a) {
|
|
82
82
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
83
83
|
function i() {
|
|
84
84
|
}
|
|
85
85
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
86
|
-
function s(
|
|
87
|
-
this.fn =
|
|
86
|
+
function s(h, l, u) {
|
|
87
|
+
this.fn = h, this.context = l, this.once = u || !1;
|
|
88
88
|
}
|
|
89
|
-
function r(
|
|
89
|
+
function r(h, l, u, d, f) {
|
|
90
90
|
if (typeof u != "function")
|
|
91
91
|
throw new TypeError("The listener must be a function");
|
|
92
|
-
var g = new s(u,
|
|
93
|
-
return
|
|
92
|
+
var g = new s(u, d || h, f), m = t ? t + l : l;
|
|
93
|
+
return h._events[m] ? h._events[m].fn ? h._events[m] = [h._events[m], g] : h._events[m].push(g) : (h._events[m] = g, h._eventsCount++), h;
|
|
94
94
|
}
|
|
95
|
-
function o(
|
|
96
|
-
--
|
|
95
|
+
function o(h, l) {
|
|
96
|
+
--h._eventsCount === 0 ? h._events = new i() : delete h._events[l];
|
|
97
97
|
}
|
|
98
98
|
function n() {
|
|
99
99
|
this._events = new i(), this._eventsCount = 0;
|
|
100
100
|
}
|
|
101
101
|
n.prototype.eventNames = function() {
|
|
102
|
-
var l = [], u,
|
|
102
|
+
var l = [], u, d;
|
|
103
103
|
if (this._eventsCount === 0) return l;
|
|
104
|
-
for (
|
|
105
|
-
e.call(u,
|
|
104
|
+
for (d in u = this._events)
|
|
105
|
+
e.call(u, d) && l.push(t ? d.slice(1) : d);
|
|
106
106
|
return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(u)) : l;
|
|
107
107
|
}, n.prototype.listeners = function(l) {
|
|
108
|
-
var u = t ? t + l : l,
|
|
109
|
-
if (!
|
|
110
|
-
if (
|
|
111
|
-
for (var f = 0, g =
|
|
112
|
-
m[f] =
|
|
108
|
+
var u = t ? t + l : l, d = this._events[u];
|
|
109
|
+
if (!d) return [];
|
|
110
|
+
if (d.fn) return [d.fn];
|
|
111
|
+
for (var f = 0, g = d.length, m = new Array(g); f < g; f++)
|
|
112
|
+
m[f] = d[f].fn;
|
|
113
113
|
return m;
|
|
114
114
|
}, n.prototype.listenerCount = function(l) {
|
|
115
|
-
var u = t ? t + l : l,
|
|
116
|
-
return
|
|
117
|
-
}, n.prototype.emit = function(l, u,
|
|
115
|
+
var u = t ? t + l : l, d = this._events[u];
|
|
116
|
+
return d ? d.fn ? 1 : d.length : 0;
|
|
117
|
+
}, n.prototype.emit = function(l, u, d, f, g, m) {
|
|
118
118
|
var v = t ? t + l : l;
|
|
119
119
|
if (!this._events[v]) return !1;
|
|
120
|
-
var p = this._events[v],
|
|
120
|
+
var p = this._events[v], k = arguments.length, x, y;
|
|
121
121
|
if (p.fn) {
|
|
122
|
-
switch (p.once && this.removeListener(l, p.fn, void 0, !0),
|
|
122
|
+
switch (p.once && this.removeListener(l, p.fn, void 0, !0), k) {
|
|
123
123
|
case 1:
|
|
124
124
|
return p.fn.call(p.context), !0;
|
|
125
125
|
case 2:
|
|
126
126
|
return p.fn.call(p.context, u), !0;
|
|
127
127
|
case 3:
|
|
128
|
-
return p.fn.call(p.context, u,
|
|
128
|
+
return p.fn.call(p.context, u, d), !0;
|
|
129
129
|
case 4:
|
|
130
|
-
return p.fn.call(p.context, u,
|
|
130
|
+
return p.fn.call(p.context, u, d, f), !0;
|
|
131
131
|
case 5:
|
|
132
|
-
return p.fn.call(p.context, u,
|
|
132
|
+
return p.fn.call(p.context, u, d, f, g), !0;
|
|
133
133
|
case 6:
|
|
134
|
-
return p.fn.call(p.context, u,
|
|
134
|
+
return p.fn.call(p.context, u, d, f, g, m), !0;
|
|
135
135
|
}
|
|
136
|
-
for (y = 1, x = new Array(
|
|
136
|
+
for (y = 1, x = new Array(k - 1); y < k; y++)
|
|
137
137
|
x[y - 1] = arguments[y];
|
|
138
138
|
p.fn.apply(p.context, x);
|
|
139
139
|
} else {
|
|
140
|
-
var
|
|
141
|
-
for (y = 0; y <
|
|
142
|
-
switch (p[y].once && this.removeListener(l, p[y].fn, void 0, !0),
|
|
140
|
+
var I = p.length, D;
|
|
141
|
+
for (y = 0; y < I; y++)
|
|
142
|
+
switch (p[y].once && this.removeListener(l, p[y].fn, void 0, !0), k) {
|
|
143
143
|
case 1:
|
|
144
144
|
p[y].fn.call(p[y].context);
|
|
145
145
|
break;
|
|
@@ -147,33 +147,33 @@ function es() {
|
|
|
147
147
|
p[y].fn.call(p[y].context, u);
|
|
148
148
|
break;
|
|
149
149
|
case 3:
|
|
150
|
-
p[y].fn.call(p[y].context, u,
|
|
150
|
+
p[y].fn.call(p[y].context, u, d);
|
|
151
151
|
break;
|
|
152
152
|
case 4:
|
|
153
|
-
p[y].fn.call(p[y].context, u,
|
|
153
|
+
p[y].fn.call(p[y].context, u, d, f);
|
|
154
154
|
break;
|
|
155
155
|
default:
|
|
156
|
-
if (!x) for (D = 1, x = new Array(
|
|
156
|
+
if (!x) for (D = 1, x = new Array(k - 1); D < k; D++)
|
|
157
157
|
x[D - 1] = arguments[D];
|
|
158
158
|
p[y].fn.apply(p[y].context, x);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
return !0;
|
|
162
|
-
}, n.prototype.on = function(l, u,
|
|
163
|
-
return r(this, l, u,
|
|
164
|
-
}, n.prototype.once = function(l, u,
|
|
165
|
-
return r(this, l, u,
|
|
166
|
-
}, n.prototype.removeListener = function(l, u,
|
|
162
|
+
}, n.prototype.on = function(l, u, d) {
|
|
163
|
+
return r(this, l, u, d, !1);
|
|
164
|
+
}, n.prototype.once = function(l, u, d) {
|
|
165
|
+
return r(this, l, u, d, !0);
|
|
166
|
+
}, n.prototype.removeListener = function(l, u, d, f) {
|
|
167
167
|
var g = t ? t + l : l;
|
|
168
168
|
if (!this._events[g]) return this;
|
|
169
169
|
if (!u)
|
|
170
170
|
return o(this, g), this;
|
|
171
171
|
var m = this._events[g];
|
|
172
172
|
if (m.fn)
|
|
173
|
-
m.fn === u && (!f || m.once) && (!
|
|
173
|
+
m.fn === u && (!f || m.once) && (!d || m.context === d) && o(this, g);
|
|
174
174
|
else {
|
|
175
|
-
for (var v = 0, p = [],
|
|
176
|
-
(m[v].fn !== u || f && !m[v].once ||
|
|
175
|
+
for (var v = 0, p = [], k = m.length; v < k; v++)
|
|
176
|
+
(m[v].fn !== u || f && !m[v].once || d && m[v].context !== d) && p.push(m[v]);
|
|
177
177
|
p.length ? this._events[g] = p.length === 1 ? p[0] : p : o(this, g);
|
|
178
178
|
}
|
|
179
179
|
return this;
|
|
@@ -185,67 +185,53 @@ function es() {
|
|
|
185
185
|
}
|
|
186
186
|
var ts = es();
|
|
187
187
|
const is = /* @__PURE__ */ Ji(ts);
|
|
188
|
-
class
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
class Xe extends Error {
|
|
189
|
+
name = "TimeoutError";
|
|
190
|
+
constructor(e, t) {
|
|
191
|
+
super(e, t), Error.captureStackTrace?.(this, Xe);
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
super(), this.name = "AbortError", this.message = e;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const ct = (a) => globalThis.DOMException === void 0 ? new ss(a) : new DOMException(a), ft = (a) => {
|
|
199
|
-
const e = a.reason === void 0 ? ct("This operation was aborted.") : a.reason;
|
|
200
|
-
return e instanceof Error ? e : ct(e);
|
|
201
|
-
};
|
|
202
|
-
function rs(a, e) {
|
|
194
|
+
const ft = (a) => a.reason ?? new DOMException("This operation was aborted.", "AbortError");
|
|
195
|
+
function ss(a, e) {
|
|
203
196
|
const {
|
|
204
197
|
milliseconds: t,
|
|
205
198
|
fallback: i,
|
|
206
199
|
message: s,
|
|
207
|
-
customTimers: r = { setTimeout, clearTimeout }
|
|
200
|
+
customTimers: r = { setTimeout, clearTimeout },
|
|
201
|
+
signal: o
|
|
208
202
|
} = e;
|
|
209
|
-
let
|
|
210
|
-
const
|
|
203
|
+
let n, h;
|
|
204
|
+
const u = new Promise((d, f) => {
|
|
211
205
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
212
206
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
g.aborted && h(ft(g)), n = () => {
|
|
216
|
-
h(ft(g));
|
|
217
|
-
}, g.addEventListener("abort", n, { once: !0 });
|
|
218
|
-
}
|
|
219
|
-
if (t === Number.POSITIVE_INFINITY) {
|
|
220
|
-
a.then(u, h);
|
|
207
|
+
if (o?.aborted) {
|
|
208
|
+
f(ft(o));
|
|
221
209
|
return;
|
|
222
210
|
}
|
|
223
|
-
|
|
224
|
-
|
|
211
|
+
if (o && (h = () => {
|
|
212
|
+
f(ft(o));
|
|
213
|
+
}, o.addEventListener("abort", h, { once: !0 })), a.then(d, f), t === Number.POSITIVE_INFINITY)
|
|
214
|
+
return;
|
|
215
|
+
const g = new Xe();
|
|
216
|
+
n = r.setTimeout.call(void 0, () => {
|
|
225
217
|
if (i) {
|
|
226
218
|
try {
|
|
227
|
-
|
|
228
|
-
} catch (
|
|
229
|
-
|
|
219
|
+
d(i());
|
|
220
|
+
} catch (m) {
|
|
221
|
+
f(m);
|
|
230
222
|
}
|
|
231
223
|
return;
|
|
232
224
|
}
|
|
233
|
-
typeof a.cancel == "function" && a.cancel(), s === !1 ?
|
|
234
|
-
}, t)
|
|
235
|
-
try {
|
|
236
|
-
u(await a);
|
|
237
|
-
} catch (g) {
|
|
238
|
-
h(g);
|
|
239
|
-
}
|
|
240
|
-
})();
|
|
225
|
+
typeof a.cancel == "function" && a.cancel(), s === !1 ? d() : s instanceof Error ? f(s) : (g.message = s ?? `Promise timed out after ${t} milliseconds`, f(g));
|
|
226
|
+
}, t);
|
|
241
227
|
}).finally(() => {
|
|
242
|
-
|
|
228
|
+
u.clear(), h && o && o.removeEventListener("abort", h);
|
|
243
229
|
});
|
|
244
|
-
return
|
|
245
|
-
r.clearTimeout.call(void 0,
|
|
246
|
-
},
|
|
230
|
+
return u.clear = () => {
|
|
231
|
+
r.clearTimeout.call(void 0, n), n = void 0;
|
|
232
|
+
}, u;
|
|
247
233
|
}
|
|
248
|
-
function
|
|
234
|
+
function rs(a, e, t) {
|
|
249
235
|
let i = 0, s = a.length;
|
|
250
236
|
for (; s > 0; ) {
|
|
251
237
|
const r = Math.trunc(s / 2);
|
|
@@ -254,148 +240,234 @@ function ns(a, e, t) {
|
|
|
254
240
|
}
|
|
255
241
|
return i;
|
|
256
242
|
}
|
|
257
|
-
|
|
258
|
-
|
|
243
|
+
const ns = 100;
|
|
244
|
+
class gt {
|
|
245
|
+
#t = [];
|
|
246
|
+
// The queue is stored as a sorted array, but dequeued items are left before `#head` until compaction. Only items from `#head` onward are live, which keeps repeated dequeues amortized O(1).
|
|
247
|
+
#e = 0;
|
|
259
248
|
enqueue(e, t) {
|
|
260
|
-
t = {
|
|
261
|
-
priority:
|
|
262
|
-
|
|
263
|
-
};
|
|
264
|
-
const i = {
|
|
265
|
-
priority: t.priority,
|
|
266
|
-
id: t.id,
|
|
249
|
+
const { priority: i = 0, id: s } = t ?? {}, { size: r } = this, o = {
|
|
250
|
+
priority: i,
|
|
251
|
+
id: s,
|
|
267
252
|
run: e
|
|
268
253
|
};
|
|
269
|
-
if (
|
|
270
|
-
this.#e.push(
|
|
254
|
+
if (r === 0) {
|
|
255
|
+
this.#t.length = 0, this.#e = 0, this.#t.push(o);
|
|
271
256
|
return;
|
|
272
257
|
}
|
|
273
|
-
|
|
274
|
-
|
|
258
|
+
if (this.#t.at(-1).priority >= i) {
|
|
259
|
+
this.#t.push(o);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.#n();
|
|
263
|
+
const n = rs(this.#t, o, (h, l) => l.priority - h.priority);
|
|
264
|
+
this.#t.splice(n, 0, o);
|
|
275
265
|
}
|
|
276
266
|
setPriority(e, t) {
|
|
277
|
-
const i = this.#
|
|
267
|
+
const i = this.#t.findIndex((r, o) => o >= this.#e && r.id === e);
|
|
278
268
|
if (i === -1)
|
|
279
269
|
throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
280
|
-
const [s] = this.#
|
|
270
|
+
const [s] = this.#t.splice(i, 1);
|
|
281
271
|
this.enqueue(s.run, { priority: t, id: e });
|
|
282
272
|
}
|
|
273
|
+
remove(e) {
|
|
274
|
+
const t = this.#t.findIndex((i, s) => s < this.#e ? !1 : typeof e == "string" ? i.id === e : i.run === e);
|
|
275
|
+
t !== -1 && this.#t.splice(t, 1);
|
|
276
|
+
}
|
|
283
277
|
dequeue() {
|
|
284
|
-
|
|
278
|
+
if (this.#e === this.#t.length)
|
|
279
|
+
return;
|
|
280
|
+
const e = this.#t[this.#e];
|
|
281
|
+
return this.#e++, this.#e === this.#t.length ? (this.#t.length = 0, this.#e = 0) : this.#e > ns && this.#e > this.#t.length / 2 && this.#n(), e?.run;
|
|
285
282
|
}
|
|
286
283
|
filter(e) {
|
|
287
|
-
|
|
284
|
+
const t = [];
|
|
285
|
+
for (let i = this.#e; i < this.#t.length; i++) {
|
|
286
|
+
const s = this.#t[i];
|
|
287
|
+
s.priority === e.priority && t.push(s.run);
|
|
288
|
+
}
|
|
289
|
+
return t;
|
|
288
290
|
}
|
|
289
291
|
get size() {
|
|
290
|
-
return this.#
|
|
292
|
+
return this.#t.length - this.#e;
|
|
293
|
+
}
|
|
294
|
+
#n() {
|
|
295
|
+
this.#e !== 0 && (this.#t.splice(0, this.#e), this.#e = 0);
|
|
291
296
|
}
|
|
292
297
|
}
|
|
293
|
-
class
|
|
298
|
+
class os extends is {
|
|
299
|
+
#t;
|
|
294
300
|
#e;
|
|
295
|
-
#o;
|
|
296
301
|
#n = 0;
|
|
297
302
|
#f;
|
|
303
|
+
#m = !1;
|
|
304
|
+
#_ = !1;
|
|
305
|
+
#l;
|
|
306
|
+
#k = 0;
|
|
307
|
+
#b = 0;
|
|
308
|
+
#u;
|
|
309
|
+
#h;
|
|
298
310
|
#a;
|
|
299
|
-
|
|
311
|
+
// Circular buffer implementation for better performance
|
|
312
|
+
#o = [];
|
|
313
|
+
#r = 0;
|
|
300
314
|
#i;
|
|
301
|
-
#
|
|
302
|
-
#t;
|
|
303
|
-
#m;
|
|
315
|
+
#S;
|
|
304
316
|
#s = 0;
|
|
305
317
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
306
|
-
#u;
|
|
307
|
-
#r;
|
|
308
318
|
#p;
|
|
319
|
+
#d;
|
|
309
320
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
310
|
-
#
|
|
321
|
+
#A = 1n;
|
|
322
|
+
// Track currently running tasks for debugging
|
|
323
|
+
#y = /* @__PURE__ */ new Map();
|
|
324
|
+
#w = /* @__PURE__ */ new Set();
|
|
311
325
|
/**
|
|
312
|
-
|
|
326
|
+
Get or set the default timeout for all tasks. Can be changed at runtime.
|
|
327
|
+
|
|
328
|
+
Operations will throw a `TimeoutError` if they don't complete within the specified time.
|
|
329
|
+
|
|
330
|
+
The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.
|
|
331
|
+
|
|
332
|
+
@example
|
|
333
|
+
```
|
|
334
|
+
const queue = new PQueue({timeout: 5000});
|
|
313
335
|
|
|
314
|
-
|
|
336
|
+
// Change timeout for all future tasks
|
|
337
|
+
queue.timeout = 10000;
|
|
338
|
+
```
|
|
315
339
|
*/
|
|
316
340
|
timeout;
|
|
317
|
-
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
318
341
|
constructor(e) {
|
|
319
342
|
if (super(), e = {
|
|
320
|
-
|
|
343
|
+
carryoverIntervalCount: !1,
|
|
321
344
|
intervalCap: Number.POSITIVE_INFINITY,
|
|
322
345
|
interval: 0,
|
|
323
346
|
concurrency: Number.POSITIVE_INFINITY,
|
|
324
347
|
autoStart: !0,
|
|
325
|
-
queueClass:
|
|
348
|
+
queueClass: gt,
|
|
349
|
+
strict: !1,
|
|
326
350
|
...e
|
|
327
351
|
}, !(typeof e.intervalCap == "number" && e.intervalCap >= 1))
|
|
328
352
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString() ?? ""}\` (${typeof e.intervalCap})`);
|
|
329
353
|
if (e.interval === void 0 || !(Number.isFinite(e.interval) && e.interval >= 0))
|
|
330
354
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString() ?? ""}\` (${typeof e.interval})`);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
355
|
+
if (e.strict && e.interval === 0)
|
|
356
|
+
throw new TypeError("The `strict` option requires a non-zero `interval`");
|
|
357
|
+
if (e.strict && e.intervalCap === Number.POSITIVE_INFINITY)
|
|
358
|
+
throw new TypeError("The `strict` option requires a finite `intervalCap`");
|
|
359
|
+
if (this.#t = e.carryoverIntervalCount ?? e.carryoverConcurrencyCount ?? !1, this.#e = e.intervalCap === Number.POSITIVE_INFINITY || e.interval === 0, this.#f = e.intervalCap, this.#l = e.interval, this.#a = e.strict, this.#i = new e.queueClass(), this.#S = e.queueClass, this.concurrency = e.concurrency, e.timeout !== void 0 && !(Number.isFinite(e.timeout) && e.timeout > 0))
|
|
360
|
+
throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);
|
|
361
|
+
this.timeout = e.timeout, this.#d = e.autoStart === !1, this.#$();
|
|
362
|
+
}
|
|
363
|
+
#E(e) {
|
|
364
|
+
for (; this.#r < this.#o.length; ) {
|
|
365
|
+
const i = this.#o[this.#r];
|
|
366
|
+
if (i !== void 0 && e - i >= this.#l)
|
|
367
|
+
this.#r++;
|
|
368
|
+
else
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
(this.#r > 100 && this.#r > this.#o.length / 2 || this.#r === this.#o.length) && (this.#o = this.#o.slice(this.#r), this.#r = 0);
|
|
335
372
|
}
|
|
336
|
-
|
|
337
|
-
|
|
373
|
+
// Helper methods for interval consumption
|
|
374
|
+
#H(e) {
|
|
375
|
+
this.#a ? this.#o.push(e) : this.#n++;
|
|
338
376
|
}
|
|
339
|
-
#
|
|
340
|
-
this.#
|
|
377
|
+
#I() {
|
|
378
|
+
this.#a ? this.#o.length > this.#r && this.#o.pop() : this.#n > 0 && this.#n--;
|
|
341
379
|
}
|
|
342
380
|
#x() {
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
get #
|
|
346
|
-
|
|
347
|
-
if (this.#i === void 0) {
|
|
348
|
-
const t = this.#g - e;
|
|
349
|
-
if (t < 0)
|
|
350
|
-
this.#n = this.#e ? this.#s : 0;
|
|
351
|
-
else
|
|
352
|
-
return this.#l === void 0 && (this.#l = setTimeout(() => {
|
|
353
|
-
this.#x();
|
|
354
|
-
}, t)), !0;
|
|
355
|
-
}
|
|
356
|
-
return !1;
|
|
381
|
+
return this.#o.length - this.#r;
|
|
382
|
+
}
|
|
383
|
+
get #q() {
|
|
384
|
+
return this.#e ? !0 : this.#a ? this.#x() < this.#f : this.#n < this.#f;
|
|
357
385
|
}
|
|
358
|
-
#
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
386
|
+
get #O() {
|
|
387
|
+
return this.#s < this.#p;
|
|
388
|
+
}
|
|
389
|
+
#M() {
|
|
390
|
+
this.#s--, this.#s === 0 && this.emit("pendingZero"), this.#v(), this.emit("next");
|
|
391
|
+
}
|
|
392
|
+
#P() {
|
|
393
|
+
this.#h = void 0, this.#L(), this.#z();
|
|
394
|
+
}
|
|
395
|
+
#B(e) {
|
|
396
|
+
if (this.#a) {
|
|
397
|
+
if (this.#E(e), this.#x() >= this.#f) {
|
|
398
|
+
const i = this.#o[this.#r], s = this.#l - (e - i);
|
|
399
|
+
return this.#C(s), !0;
|
|
366
400
|
}
|
|
401
|
+
return !1;
|
|
402
|
+
}
|
|
403
|
+
if (this.#u === void 0) {
|
|
404
|
+
const t = this.#k - e;
|
|
405
|
+
if (t < 0) {
|
|
406
|
+
if (this.#b > 0) {
|
|
407
|
+
const i = e - this.#b;
|
|
408
|
+
if (i < this.#l)
|
|
409
|
+
return this.#C(this.#l - i), !0;
|
|
410
|
+
}
|
|
411
|
+
this.#n = this.#t ? this.#s : 0;
|
|
412
|
+
} else
|
|
413
|
+
return this.#C(t), !0;
|
|
367
414
|
}
|
|
368
415
|
return !1;
|
|
369
416
|
}
|
|
370
|
-
#
|
|
371
|
-
this.#
|
|
372
|
-
this.#
|
|
373
|
-
},
|
|
417
|
+
#C(e) {
|
|
418
|
+
this.#h === void 0 && (this.#h = setTimeout(() => {
|
|
419
|
+
this.#P();
|
|
420
|
+
}, e));
|
|
421
|
+
}
|
|
422
|
+
#R() {
|
|
423
|
+
this.#u && (clearInterval(this.#u), this.#u = void 0);
|
|
424
|
+
}
|
|
425
|
+
#D() {
|
|
426
|
+
this.#h && (clearTimeout(this.#h), this.#h = void 0);
|
|
374
427
|
}
|
|
375
428
|
#v() {
|
|
376
|
-
|
|
429
|
+
if (this.#i.size === 0) {
|
|
430
|
+
if (this.#R(), this.emit("empty"), this.#s === 0) {
|
|
431
|
+
if (this.#D(), this.#a && this.#r > 0) {
|
|
432
|
+
const t = Date.now();
|
|
433
|
+
this.#E(t);
|
|
434
|
+
}
|
|
435
|
+
this.emit("idle");
|
|
436
|
+
}
|
|
437
|
+
return !1;
|
|
438
|
+
}
|
|
439
|
+
let e = !1;
|
|
440
|
+
if (!this.#d) {
|
|
441
|
+
const t = Date.now(), i = !this.#B(t);
|
|
442
|
+
if (this.#q && this.#O) {
|
|
443
|
+
const s = this.#i.dequeue();
|
|
444
|
+
this.#e || (this.#H(t), this.#g()), this.emit("active"), s(), i && this.#z(), e = !0;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return e;
|
|
448
|
+
}
|
|
449
|
+
#z() {
|
|
450
|
+
this.#e || this.#u !== void 0 || this.#a || (this.#u = setInterval(() => {
|
|
451
|
+
this.#L();
|
|
452
|
+
}, this.#l), this.#k = Date.now() + this.#l);
|
|
453
|
+
}
|
|
454
|
+
#L() {
|
|
455
|
+
this.#a || (this.#n === 0 && this.#s === 0 && this.#u && this.#R(), this.#n = this.#t ? this.#s : 0), this.#T(), this.#g();
|
|
377
456
|
}
|
|
378
457
|
/**
|
|
379
458
|
Executes all queued functions until it reaches the limit.
|
|
380
459
|
*/
|
|
381
|
-
#
|
|
382
|
-
for (; this.#
|
|
460
|
+
#T() {
|
|
461
|
+
for (; this.#v(); )
|
|
383
462
|
;
|
|
384
463
|
}
|
|
385
464
|
get concurrency() {
|
|
386
|
-
return this.#
|
|
465
|
+
return this.#p;
|
|
387
466
|
}
|
|
388
467
|
set concurrency(e) {
|
|
389
468
|
if (!(typeof e == "number" && e >= 1))
|
|
390
469
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);
|
|
391
|
-
this.#
|
|
392
|
-
}
|
|
393
|
-
async #R(e) {
|
|
394
|
-
return new Promise((t, i) => {
|
|
395
|
-
e.addEventListener("abort", () => {
|
|
396
|
-
i(e.reason);
|
|
397
|
-
}, { once: !0 });
|
|
398
|
-
});
|
|
470
|
+
this.#p = e, this.#T();
|
|
399
471
|
}
|
|
400
472
|
/**
|
|
401
473
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -434,32 +506,81 @@ class as extends is {
|
|
|
434
506
|
Here, the promise function with `id: '🦀'` executes last.
|
|
435
507
|
*/
|
|
436
508
|
setPriority(e, t) {
|
|
437
|
-
|
|
509
|
+
if (typeof t != "number" || !Number.isFinite(t))
|
|
510
|
+
throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);
|
|
511
|
+
this.#i.setPriority(e, t);
|
|
438
512
|
}
|
|
439
513
|
async add(e, t = {}) {
|
|
440
|
-
|
|
514
|
+
if (t = {
|
|
441
515
|
timeout: this.timeout,
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
516
|
+
...t,
|
|
517
|
+
// Assign unique ID if not provided
|
|
518
|
+
id: t.id ?? (this.#A++).toString()
|
|
519
|
+
}, t.timeout !== void 0 && !(Number.isFinite(t.timeout) && t.timeout > 0))
|
|
520
|
+
throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);
|
|
521
|
+
return new Promise((i, s) => {
|
|
522
|
+
const r = /* @__PURE__ */ Symbol(`task-${t.id}`);
|
|
523
|
+
let o = () => {
|
|
524
|
+
};
|
|
525
|
+
const n = async () => {
|
|
526
|
+
o(), this.#s++, this.#y.set(r, {
|
|
527
|
+
id: t.id,
|
|
528
|
+
priority: t.priority ?? 0,
|
|
529
|
+
// Match priority-queue default
|
|
530
|
+
startTime: Date.now(),
|
|
531
|
+
timeout: t.timeout
|
|
532
|
+
});
|
|
533
|
+
let l;
|
|
447
534
|
try {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
535
|
+
try {
|
|
536
|
+
t.signal?.throwIfAborted();
|
|
537
|
+
} catch (f) {
|
|
538
|
+
throw this.#F(), this.#y.delete(r), f;
|
|
539
|
+
}
|
|
540
|
+
this.#b = Date.now();
|
|
541
|
+
let u = e({ signal: t.signal });
|
|
542
|
+
if (t.timeout !== void 0 && (u = ss(Promise.resolve(u), {
|
|
543
|
+
milliseconds: t.timeout,
|
|
544
|
+
message: `Task timed out after ${t.timeout}ms (queue has ${this.#s} running, ${this.#i.size} waiting)`
|
|
545
|
+
})), t.signal) {
|
|
546
|
+
const { signal: f } = t;
|
|
547
|
+
u = Promise.race([u, new Promise((g, m) => {
|
|
548
|
+
l = () => {
|
|
549
|
+
m(f.reason);
|
|
550
|
+
}, f.addEventListener("abort", l, { once: !0 });
|
|
551
|
+
})]);
|
|
457
552
|
}
|
|
458
|
-
|
|
553
|
+
const d = await u;
|
|
554
|
+
i(d), this.emit("completed", d);
|
|
555
|
+
} catch (u) {
|
|
556
|
+
s(u), this.emit("error", u);
|
|
459
557
|
} finally {
|
|
460
|
-
this.#
|
|
558
|
+
l && t.signal?.removeEventListener("abort", l), this.#y.delete(r), queueMicrotask(() => {
|
|
559
|
+
this.#M();
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
this.#i.enqueue(n, t);
|
|
564
|
+
const h = () => {
|
|
565
|
+
if (this.#i instanceof gt) {
|
|
566
|
+
this.#i.remove(n);
|
|
567
|
+
return;
|
|
461
568
|
}
|
|
462
|
-
|
|
569
|
+
this.#i.remove?.(t.id);
|
|
570
|
+
};
|
|
571
|
+
if (t.signal) {
|
|
572
|
+
const { signal: l } = t, u = () => {
|
|
573
|
+
o(), h(), s(l.reason), this.#v(), this.emit("next");
|
|
574
|
+
};
|
|
575
|
+
if (o = () => {
|
|
576
|
+
l.removeEventListener("abort", u), this.#w.delete(o);
|
|
577
|
+
}, l.aborted) {
|
|
578
|
+
u();
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
l.addEventListener("abort", u, { once: !0 }), this.#w.add(o);
|
|
582
|
+
}
|
|
583
|
+
this.emit("add"), this.#v();
|
|
463
584
|
});
|
|
464
585
|
}
|
|
465
586
|
async addAll(e, t) {
|
|
@@ -469,19 +590,21 @@ class as extends is {
|
|
|
469
590
|
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.)
|
|
470
591
|
*/
|
|
471
592
|
start() {
|
|
472
|
-
return this.#
|
|
593
|
+
return this.#d ? (this.#d = !1, this.#T(), this) : this;
|
|
473
594
|
}
|
|
474
595
|
/**
|
|
475
596
|
Put queue execution on hold.
|
|
476
597
|
*/
|
|
477
598
|
pause() {
|
|
478
|
-
this.#
|
|
599
|
+
this.#d = !0;
|
|
479
600
|
}
|
|
480
601
|
/**
|
|
481
602
|
Clear the queue.
|
|
482
603
|
*/
|
|
483
604
|
clear() {
|
|
484
|
-
|
|
605
|
+
for (const e of this.#w)
|
|
606
|
+
e();
|
|
607
|
+
this.#i = new this.#S(), this.#R(), this.#N(), this.emit("empty"), this.#s === 0 && (this.#D(), this.emit("idle")), this.emit("next");
|
|
485
608
|
}
|
|
486
609
|
/**
|
|
487
610
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -489,7 +612,7 @@ class as extends is {
|
|
|
489
612
|
@returns A promise that settles when the queue becomes empty.
|
|
490
613
|
*/
|
|
491
614
|
async onEmpty() {
|
|
492
|
-
this.#
|
|
615
|
+
this.#i.size !== 0 && await this.#c("empty");
|
|
493
616
|
}
|
|
494
617
|
/**
|
|
495
618
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -499,7 +622,7 @@ class as extends is {
|
|
|
499
622
|
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.
|
|
500
623
|
*/
|
|
501
624
|
async onSizeLessThan(e) {
|
|
502
|
-
this.#
|
|
625
|
+
this.#i.size < e || await this.#c(["next", "active"], () => this.#i.size < e);
|
|
503
626
|
}
|
|
504
627
|
/**
|
|
505
628
|
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.
|
|
@@ -507,21 +630,85 @@ class as extends is {
|
|
|
507
630
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
508
631
|
*/
|
|
509
632
|
async onIdle() {
|
|
510
|
-
this.#s === 0 && this.#
|
|
633
|
+
this.#s === 0 && this.#i.size === 0 || await this.#c("idle");
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.
|
|
637
|
+
|
|
638
|
+
@returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.
|
|
639
|
+
*/
|
|
640
|
+
async onPendingZero() {
|
|
641
|
+
this.#s !== 0 && await this.#c("pendingZero");
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
@returns A promise that settles when the queue becomes rate-limited due to intervalCap.
|
|
645
|
+
*/
|
|
646
|
+
async onRateLimit() {
|
|
647
|
+
this.isRateLimited || await this.#c("rateLimit");
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
@returns A promise that settles when the queue is no longer rate-limited.
|
|
651
|
+
*/
|
|
652
|
+
async onRateLimitCleared() {
|
|
653
|
+
this.isRateLimited && await this.#c("rateLimitCleared");
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
@returns A promise that rejects when any task in the queue errors.
|
|
657
|
+
|
|
658
|
+
Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.
|
|
659
|
+
|
|
660
|
+
Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.
|
|
661
|
+
|
|
662
|
+
@example
|
|
663
|
+
```
|
|
664
|
+
import PQueue from 'p-queue';
|
|
665
|
+
|
|
666
|
+
const queue = new PQueue({concurrency: 2});
|
|
667
|
+
|
|
668
|
+
queue.add(() => fetchData(1)).catch(() => {});
|
|
669
|
+
queue.add(() => fetchData(2)).catch(() => {});
|
|
670
|
+
queue.add(() => fetchData(3)).catch(() => {});
|
|
671
|
+
|
|
672
|
+
// Stop processing on first error
|
|
673
|
+
try {
|
|
674
|
+
await Promise.race([
|
|
675
|
+
queue.onError(),
|
|
676
|
+
queue.onIdle()
|
|
677
|
+
]);
|
|
678
|
+
} catch (error) {
|
|
679
|
+
queue.pause(); // Stop processing remaining tasks
|
|
680
|
+
console.error('Queue failed:', error);
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
*/
|
|
684
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
685
|
+
onError() {
|
|
686
|
+
return new Promise((e, t) => {
|
|
687
|
+
const i = (s) => {
|
|
688
|
+
this.off("error", i), t(s);
|
|
689
|
+
};
|
|
690
|
+
this.on("error", i);
|
|
691
|
+
});
|
|
511
692
|
}
|
|
512
693
|
async #c(e, t) {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
694
|
+
const i = Array.isArray(e) ? e : [e];
|
|
695
|
+
return new Promise((s) => {
|
|
696
|
+
const r = () => {
|
|
697
|
+
if (!(t && !t())) {
|
|
698
|
+
for (const o of i)
|
|
699
|
+
this.off(o, r);
|
|
700
|
+
s();
|
|
701
|
+
}
|
|
516
702
|
};
|
|
517
|
-
|
|
703
|
+
for (const o of i)
|
|
704
|
+
this.on(o, r);
|
|
518
705
|
});
|
|
519
706
|
}
|
|
520
707
|
/**
|
|
521
708
|
Size of the queue, the number of queued items waiting to run.
|
|
522
709
|
*/
|
|
523
710
|
get size() {
|
|
524
|
-
return this.#
|
|
711
|
+
return this.#i.size;
|
|
525
712
|
}
|
|
526
713
|
/**
|
|
527
714
|
Size of the queue, filtered by the given options.
|
|
@@ -529,7 +716,7 @@ class as extends is {
|
|
|
529
716
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
530
717
|
*/
|
|
531
718
|
sizeBy(e) {
|
|
532
|
-
return this.#
|
|
719
|
+
return this.#i.filter(e).length;
|
|
533
720
|
}
|
|
534
721
|
/**
|
|
535
722
|
Number of running items (no longer in the queue).
|
|
@@ -541,10 +728,112 @@ class as extends is {
|
|
|
541
728
|
Whether the queue is currently paused.
|
|
542
729
|
*/
|
|
543
730
|
get isPaused() {
|
|
544
|
-
return this.#
|
|
731
|
+
return this.#d;
|
|
732
|
+
}
|
|
733
|
+
#$() {
|
|
734
|
+
this.#e || (this.on("add", () => {
|
|
735
|
+
this.#i.size > 0 && this.#g();
|
|
736
|
+
}), this.on("next", () => {
|
|
737
|
+
this.#g();
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
#g() {
|
|
741
|
+
this.#e || this.#_ || (this.#_ = !0, queueMicrotask(() => {
|
|
742
|
+
this.#_ = !1, this.#N();
|
|
743
|
+
}));
|
|
744
|
+
}
|
|
745
|
+
#F() {
|
|
746
|
+
this.#e || (this.#I(), this.#g());
|
|
747
|
+
}
|
|
748
|
+
#N() {
|
|
749
|
+
const e = this.#m;
|
|
750
|
+
if (this.#e || this.#i.size === 0) {
|
|
751
|
+
e && (this.#m = !1, this.emit("rateLimitCleared"));
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
let t;
|
|
755
|
+
if (this.#a) {
|
|
756
|
+
const s = Date.now();
|
|
757
|
+
this.#E(s), t = this.#x();
|
|
758
|
+
} else
|
|
759
|
+
t = this.#n;
|
|
760
|
+
const i = t >= this.#f;
|
|
761
|
+
i !== e && (this.#m = i, this.emit(i ? "rateLimit" : "rateLimitCleared"));
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
Whether the queue is currently rate-limited due to intervalCap.
|
|
765
|
+
*/
|
|
766
|
+
get isRateLimited() {
|
|
767
|
+
return this.#m;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
Whether the queue is saturated. Returns `true` when:
|
|
771
|
+
- All concurrency slots are occupied and tasks are waiting, OR
|
|
772
|
+
- The queue is rate-limited and tasks are waiting
|
|
773
|
+
|
|
774
|
+
Useful for detecting backpressure and potential hanging tasks.
|
|
775
|
+
|
|
776
|
+
```js
|
|
777
|
+
import PQueue from 'p-queue';
|
|
778
|
+
|
|
779
|
+
const queue = new PQueue({concurrency: 2});
|
|
780
|
+
|
|
781
|
+
// Backpressure handling
|
|
782
|
+
if (queue.isSaturated) {
|
|
783
|
+
console.log('Queue is saturated, waiting for capacity...');
|
|
784
|
+
await queue.onSizeLessThan(queue.concurrency);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// Monitoring for stuck tasks
|
|
788
|
+
setInterval(() => {
|
|
789
|
+
if (queue.isSaturated) {
|
|
790
|
+
console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);
|
|
791
|
+
}
|
|
792
|
+
}, 60000);
|
|
793
|
+
```
|
|
794
|
+
*/
|
|
795
|
+
get isSaturated() {
|
|
796
|
+
return this.#s === this.#p && this.#i.size > 0 || this.isRateLimited && this.#i.size > 0;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, `timeout` (if set), and `timeoutRemaining` (milliseconds until the task times out, or `undefined` if no timeout is set).
|
|
800
|
+
|
|
801
|
+
Returns an array of task info objects.
|
|
802
|
+
|
|
803
|
+
```js
|
|
804
|
+
import PQueue from 'p-queue';
|
|
805
|
+
|
|
806
|
+
const queue = new PQueue({concurrency: 2, timeout: 10000});
|
|
807
|
+
|
|
808
|
+
// Add tasks with IDs for better debugging
|
|
809
|
+
queue.add(() => fetchUser(123), {id: 'user-123'});
|
|
810
|
+
queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});
|
|
811
|
+
|
|
812
|
+
// Check what's running
|
|
813
|
+
console.log(queue.runningTasks);
|
|
814
|
+
// => [{
|
|
815
|
+
// id: 'user-123',
|
|
816
|
+
// priority: 0,
|
|
817
|
+
// startTime: 1759253001716,
|
|
818
|
+
// timeout: 10000,
|
|
819
|
+
// timeoutRemaining: 9700
|
|
820
|
+
// }, {
|
|
821
|
+
// id: 'posts-456',
|
|
822
|
+
// priority: 1,
|
|
823
|
+
// startTime: 1759253001916,
|
|
824
|
+
// timeout: 10000,
|
|
825
|
+
// timeoutRemaining: 9900
|
|
826
|
+
// }]
|
|
827
|
+
```
|
|
828
|
+
*/
|
|
829
|
+
get runningTasks() {
|
|
830
|
+
return [...this.#y.values()].map((e) => ({
|
|
831
|
+
...e,
|
|
832
|
+
timeoutRemaining: e.timeout ? Math.max(0, e.startTime + e.timeout - Date.now()) : void 0
|
|
833
|
+
}));
|
|
545
834
|
}
|
|
546
835
|
}
|
|
547
|
-
const
|
|
836
|
+
const as = () => {
|
|
548
837
|
const a = je(), e = le(ce);
|
|
549
838
|
if (!e)
|
|
550
839
|
return;
|
|
@@ -552,7 +841,7 @@ const ls = () => {
|
|
|
552
841
|
console.warn("Detected incorrect use of useRequestQueue. This composable should not be used in nested components. Please discuss with team-data or report an issue if you feel you have a use case.");
|
|
553
842
|
return;
|
|
554
843
|
}
|
|
555
|
-
const t = new
|
|
844
|
+
const t = new os({
|
|
556
845
|
carryoverConcurrencyCount: !0,
|
|
557
846
|
concurrency: a.maxParallelRequests,
|
|
558
847
|
interval: a.requestInterval,
|
|
@@ -560,21 +849,21 @@ const ls = () => {
|
|
|
560
849
|
}), i = {
|
|
561
850
|
...e,
|
|
562
851
|
queryFnOverride: !0,
|
|
563
|
-
queryFn: (s, r) => t.add(() => e.queryFn(s, r)
|
|
852
|
+
queryFn: (s, r) => t.add(() => e.queryFn(s, r))
|
|
564
853
|
};
|
|
565
854
|
oi(ce, i);
|
|
566
855
|
};
|
|
567
|
-
const
|
|
568
|
-
let
|
|
856
|
+
const ls = typeof window < "u";
|
|
857
|
+
let mt;
|
|
569
858
|
process.env.NODE_ENV;
|
|
570
|
-
const
|
|
859
|
+
const pt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
571
860
|
/* istanbul ignore next */
|
|
572
861
|
/* @__PURE__ */ Symbol()
|
|
573
862
|
);
|
|
574
|
-
var
|
|
863
|
+
var yt;
|
|
575
864
|
(function(a) {
|
|
576
865
|
a.direct = "direct", a.patchObject = "patch object", a.patchFunction = "patch function";
|
|
577
|
-
})(
|
|
866
|
+
})(yt || (yt = {}));
|
|
578
867
|
process.env.NODE_ENV;
|
|
579
868
|
function xe(a) {
|
|
580
869
|
const e = ai(a), t = {};
|
|
@@ -591,7 +880,7 @@ function xe(a) {
|
|
|
591
880
|
}
|
|
592
881
|
return t;
|
|
593
882
|
}
|
|
594
|
-
const
|
|
883
|
+
const Z = (a) => a?.chart.type === "table", us = [
|
|
595
884
|
"basic",
|
|
596
885
|
"api_usage",
|
|
597
886
|
"llm_usage",
|
|
@@ -599,89 +888,89 @@ const X = (a) => a?.chart.type === "table", ds = [
|
|
|
599
888
|
"platform",
|
|
600
889
|
"platform_usage",
|
|
601
890
|
void 0
|
|
602
|
-
], hs = (a) =>
|
|
603
|
-
function
|
|
891
|
+
], hs = (a) => us.includes(a);
|
|
892
|
+
function ds({
|
|
604
893
|
queryBridge: a,
|
|
605
894
|
context: e,
|
|
606
895
|
definition: t,
|
|
607
896
|
chartData: i
|
|
608
897
|
}) {
|
|
609
|
-
const s =
|
|
610
|
-
|
|
898
|
+
const s = L(""), r = L(""), o = L(void 0), n = L(void 0), h = je(), l = ke(), { stripUnknownFilters: u, loading: d } = xe(l), f = b(() => Z(t.value));
|
|
899
|
+
Oe(async () => {
|
|
611
900
|
s.value = await a?.exploreBaseUrl?.() ?? "", r.value = await a?.requestsBaseUrl?.() ?? "";
|
|
612
901
|
});
|
|
613
|
-
const g = b(() =>
|
|
902
|
+
const g = b(() => h.analytics && h.percentiles), m = b(() => {
|
|
614
903
|
const R = t.value.chart.type;
|
|
615
904
|
return ["golden_signals", "gauge"].includes(R) ? !1 : R === "top_n" ? e.value.editable || e.value.showTileActions : !0;
|
|
616
|
-
}), v = b(() => r.value && t.value.query && !f.value && t.value.query.datasource !== "llm_usage" && !
|
|
617
|
-
const R = t.value,
|
|
905
|
+
}), v = b(() => r.value && t.value.query && !f.value && t.value.query.datasource !== "llm_usage" && !It(t.value.query.datasource) && g.value && !d.value), p = b(() => s.value && t.value.query && hs(t.value.query.datasource) && g.value && !d.value), k = b(() => i.value ? We(i.value.meta.granularity_ms) : void 0), x = b(() => {
|
|
906
|
+
const R = t.value, O = [...e.value.filters, ...R.query.filters ?? []], q = "metrics" in R.query ? R.query.metrics : void 0, V = R.query?.datasource ?? "api_usage";
|
|
618
907
|
return u.value({
|
|
619
908
|
datasource: V,
|
|
620
|
-
filters:
|
|
909
|
+
filters: O,
|
|
621
910
|
queryFields: q
|
|
622
911
|
});
|
|
623
912
|
}), y = b(() => {
|
|
624
913
|
if (!p.value || !m.value)
|
|
625
914
|
return "";
|
|
626
915
|
const R = t.value;
|
|
627
|
-
if (
|
|
916
|
+
if (Z(R))
|
|
628
917
|
return re({
|
|
629
918
|
...R.query,
|
|
630
919
|
filters: x.value
|
|
631
920
|
});
|
|
632
|
-
const
|
|
921
|
+
const O = R.query.time_range || e.value.timeSpec, q = se(O, x.value);
|
|
633
922
|
return re(q);
|
|
634
|
-
}),
|
|
923
|
+
}), I = b(() => {
|
|
635
924
|
if (!v.value || !m.value)
|
|
636
925
|
return "";
|
|
637
|
-
const R = x.value,
|
|
638
|
-
if (
|
|
926
|
+
const R = x.value, O = t.value;
|
|
927
|
+
if (Z(O))
|
|
639
928
|
return "";
|
|
640
|
-
const q =
|
|
641
|
-
|
|
929
|
+
const q = X(
|
|
930
|
+
O.query.time_range || e.value.timeSpec,
|
|
642
931
|
R
|
|
643
932
|
);
|
|
644
933
|
return D(q);
|
|
645
|
-
}), D = (R) => v.value ? `${r.value}?q=${JSON.stringify(R)}` : "",
|
|
934
|
+
}), D = (R) => v.value ? `${r.value}?q=${JSON.stringify(R)}` : "", X = (R, O) => {
|
|
646
935
|
const q = i.value?.meta?.start ? new Date(i.value.meta.start) : void 0, V = i.value?.meta?.end ? new Date(i.value.meta.end) : void 0;
|
|
647
936
|
return {
|
|
648
|
-
filter:
|
|
937
|
+
filter: O,
|
|
649
938
|
timeframe: {
|
|
650
939
|
timePeriodsKey: R.type === "relative" ? R.time_range : "custom",
|
|
651
940
|
start: R.type === "absolute" ? q : void 0,
|
|
652
941
|
end: R.type === "absolute" ? V : void 0
|
|
653
942
|
}
|
|
654
943
|
};
|
|
655
|
-
}, ue = (R,
|
|
656
|
-
filter:
|
|
944
|
+
}, ue = (R, O) => ({
|
|
945
|
+
filter: O,
|
|
657
946
|
timeframe: {
|
|
658
947
|
timePeriodsKey: R.type === "relative" ? R.time_range : "custom",
|
|
659
948
|
start: R.type === "absolute" ? R.start : void 0,
|
|
660
949
|
end: R.type === "absolute" ? R.end : void 0
|
|
661
950
|
}
|
|
662
|
-
}), se = (R,
|
|
951
|
+
}), se = (R, O) => {
|
|
663
952
|
const q = t.value;
|
|
664
|
-
if (
|
|
953
|
+
if (Z(q))
|
|
665
954
|
throw new Error("Cannot build a chart explore query for table chart definitions");
|
|
666
|
-
const V = [...q.query.dimensions ?? []],
|
|
955
|
+
const V = [...q.query.dimensions ?? []], he = [...q.query.metrics ?? []];
|
|
667
956
|
return {
|
|
668
|
-
filters:
|
|
669
|
-
metrics:
|
|
957
|
+
filters: O,
|
|
958
|
+
metrics: he,
|
|
670
959
|
dimensions: V,
|
|
671
960
|
time_range: R,
|
|
672
|
-
granularity: q.query.granularity ||
|
|
961
|
+
granularity: q.query.granularity || k.value || void 0
|
|
673
962
|
};
|
|
674
963
|
}, re = (R) => {
|
|
675
964
|
if (!p.value)
|
|
676
965
|
return "";
|
|
677
|
-
const
|
|
678
|
-
return `${s.value}?q=${JSON.stringify(R)}&d=${
|
|
966
|
+
const O = t.value.query.datasource && t.value.query.datasource !== "basic" ? t.value.query.datasource : "api_usage";
|
|
967
|
+
return `${s.value}?q=${JSON.stringify(R)}&d=${O}&c=${t.value.chart.type}`;
|
|
679
968
|
};
|
|
680
|
-
return we([v, p], ([R,
|
|
681
|
-
R && (o.value = { href: "" }),
|
|
969
|
+
return we([v, p], ([R, O]) => {
|
|
970
|
+
R && (o.value = { href: "" }), O && (n.value = { href: "" });
|
|
682
971
|
}), {
|
|
683
972
|
exploreLinkKebabMenu: y,
|
|
684
|
-
requestsLinkKebabMenu:
|
|
973
|
+
requestsLinkKebabMenu: I,
|
|
685
974
|
canShowKebabMenu: m,
|
|
686
975
|
canGenerateRequestsLink: v,
|
|
687
976
|
canGenerateExploreLink: p,
|
|
@@ -693,21 +982,21 @@ function cs({
|
|
|
693
982
|
buildRequestLink: D
|
|
694
983
|
};
|
|
695
984
|
}
|
|
696
|
-
function
|
|
697
|
-
const a = le(ce), e =
|
|
985
|
+
function cs() {
|
|
986
|
+
const a = le(ce), e = ke(), { stripUnknownFilters: t } = xe(e);
|
|
698
987
|
let i = null;
|
|
699
|
-
return
|
|
988
|
+
return Te(() => {
|
|
700
989
|
i?.abort();
|
|
701
990
|
}), { issueQuery: async (r, o, n) => {
|
|
702
991
|
if (!a)
|
|
703
992
|
throw new Error("Query bridge is not defined");
|
|
704
993
|
i?.abort();
|
|
705
|
-
const
|
|
706
|
-
i =
|
|
994
|
+
const h = new AbortController();
|
|
995
|
+
i = h, await e.isReady();
|
|
707
996
|
const {
|
|
708
997
|
datasource: l,
|
|
709
998
|
limit: u,
|
|
710
|
-
...
|
|
999
|
+
...d
|
|
711
1000
|
} = r, f = l || "basic", g = t.value({
|
|
712
1001
|
datasource: f,
|
|
713
1002
|
filters: [
|
|
@@ -727,44 +1016,44 @@ function fs() {
|
|
|
727
1016
|
const v = {
|
|
728
1017
|
datasource: f,
|
|
729
1018
|
query: {
|
|
730
|
-
...
|
|
1019
|
+
...d,
|
|
731
1020
|
time_range: m,
|
|
732
1021
|
filters: g,
|
|
733
1022
|
limit: n ?? u
|
|
734
1023
|
}
|
|
735
1024
|
};
|
|
736
|
-
return a.queryFn(v,
|
|
1025
|
+
return a.queryFn(v, h);
|
|
737
1026
|
} };
|
|
738
1027
|
}
|
|
739
|
-
function
|
|
1028
|
+
function fs({
|
|
740
1029
|
context: a,
|
|
741
|
-
globalFilters: e =
|
|
742
|
-
isFullscreen: t =
|
|
743
|
-
preview: i =
|
|
1030
|
+
globalFilters: e = L([]),
|
|
1031
|
+
isFullscreen: t = L(!1),
|
|
1032
|
+
preview: i = L(!1)
|
|
744
1033
|
}) {
|
|
745
|
-
const s = je(), r =
|
|
1034
|
+
const s = je(), r = ke(), { loading: o } = xe(s), { loading: n } = xe(r), h = b(() => a.value.timeSpec ? a.value.timeSpec : {
|
|
746
1035
|
type: "relative",
|
|
747
1036
|
time_range: s.defaultQueryTimeForOrg
|
|
748
1037
|
}), l = b(() => {
|
|
749
|
-
let { tz:
|
|
1038
|
+
let { tz: d, refreshInterval: f, editable: g, showTileActions: m } = a.value;
|
|
750
1039
|
const v = [...a.value.filters ?? [], ...e.value];
|
|
751
|
-
if (
|
|
752
|
-
let
|
|
753
|
-
if (
|
|
754
|
-
|
|
1040
|
+
if (d || (d = new Intl.DateTimeFormat().resolvedOptions().timeZone), f === void 0 && (f = Yi), t.value) {
|
|
1041
|
+
let k = !1;
|
|
1042
|
+
if (h.value.type === "relative")
|
|
1043
|
+
k = ["15m", "1h", "6h", "12h", "24h"].includes(h.value.time_range);
|
|
755
1044
|
else {
|
|
756
|
-
const
|
|
757
|
-
|
|
1045
|
+
const I = h.value.start.getTime(), D = h.value.end.getTime();
|
|
1046
|
+
k = Math.abs(D - I) <= 864e5;
|
|
758
1047
|
}
|
|
759
1048
|
const x = (/* @__PURE__ */ new Date()).getTime();
|
|
760
|
-
|
|
1049
|
+
h.value.type === "absolute" && h.value.end.getTime() < x || h.value.type === "relative" && ["previous_week", "previous_month"].includes(h.value.time_range) ? f = 0 : k ? f = ji : f = Zi;
|
|
761
1050
|
}
|
|
762
1051
|
(g === void 0 || i.value) && (g = !1), m === void 0 && (m = !0);
|
|
763
|
-
const p = !i.value && !!
|
|
1052
|
+
const p = !i.value && !!hi()?.vnode?.props?.onTileTimeRangeZoom;
|
|
764
1053
|
return {
|
|
765
1054
|
filters: v,
|
|
766
|
-
tz:
|
|
767
|
-
timeSpec:
|
|
1055
|
+
tz: d,
|
|
1056
|
+
timeSpec: h.value,
|
|
768
1057
|
refreshInterval: f,
|
|
769
1058
|
editable: g,
|
|
770
1059
|
showTileActions: m && !i.value,
|
|
@@ -777,16 +1066,16 @@ function gs({
|
|
|
777
1066
|
queryReady: u
|
|
778
1067
|
};
|
|
779
1068
|
}
|
|
780
|
-
const
|
|
781
|
-
function
|
|
782
|
-
const { pageWidth: t, pageHeight: i, margin: s } = e, r = s + 1, o = s + e.headerHeight - 3, n = i - s - Mt + 3,
|
|
783
|
-
e.title && (a.setFont("helvetica", "bold"), a.setFontSize(11), a.setTextColor(60), a.text(e.title, s, r)), a.setFont("helvetica", "normal"), a.setFontSize(8), a.setTextColor(120), a.text(e.generatedAt, t - s, r, { align: "right" }), e.subtitle && a.text(e.subtitle, s, r + Pt), a.setDrawColor(220), a.line(s, o, t - s, o), a.line(s, n, t - s, n), a.setFont("helvetica", "bold"), a.setTextColor(60), a.text(e.branding, s,
|
|
1069
|
+
const gs = 6, Mt = 6, Pt = 4;
|
|
1070
|
+
function ms(a, e) {
|
|
1071
|
+
const { pageWidth: t, pageHeight: i, margin: s } = e, r = s + 1, o = s + e.headerHeight - 3, n = i - s - Mt + 3, h = n + 4;
|
|
1072
|
+
e.title && (a.setFont("helvetica", "bold"), a.setFontSize(11), a.setTextColor(60), a.text(e.title, s, r)), a.setFont("helvetica", "normal"), a.setFontSize(8), a.setTextColor(120), a.text(e.generatedAt, t - s, r, { align: "right" }), e.subtitle && a.text(e.subtitle, s, r + Pt), a.setDrawColor(220), a.line(s, o, t - s, o), a.line(s, n, t - s, n), a.setFont("helvetica", "bold"), a.setTextColor(60), a.text(e.branding, s, h);
|
|
784
1073
|
const l = a.getTextWidth(e.branding);
|
|
785
1074
|
a.setFont("helvetica", "normal");
|
|
786
1075
|
const u = ` ${e.dashboardNote}`;
|
|
787
|
-
e.dashboardUrl ? (a.setTextColor(0, 68, 204), a.textWithLink(u, s + l,
|
|
1076
|
+
e.dashboardUrl ? (a.setTextColor(0, 68, 204), a.textWithLink(u, s + l, h, { url: e.dashboardUrl })) : (a.setTextColor(120), a.text(u, s + l, h)), a.setTextColor(120), a.text(e.pageLabel, t - s, h, { align: "right" });
|
|
788
1077
|
}
|
|
789
|
-
function
|
|
1078
|
+
function ps(a) {
|
|
790
1079
|
const e = a.querySelector(".kong-ui-public-grid-layout, .grid-stack");
|
|
791
1080
|
if (!e)
|
|
792
1081
|
return [];
|
|
@@ -795,46 +1084,46 @@ function ys(a) {
|
|
|
795
1084
|
return [];
|
|
796
1085
|
const i = a.getBoundingClientRect().top, s = /* @__PURE__ */ new Map();
|
|
797
1086
|
return t.forEach((r) => {
|
|
798
|
-
const o = r.getBoundingClientRect(), n = Math.round(o.top - i),
|
|
799
|
-
s.set(n, l !== void 0 ? Math.max(l,
|
|
1087
|
+
const o = r.getBoundingClientRect(), n = Math.round(o.top - i), h = Math.round(o.bottom - i), l = s.get(n);
|
|
1088
|
+
s.set(n, l !== void 0 ? Math.max(l, h) : h);
|
|
800
1089
|
}), [...s.entries()].map(([r, o]) => ({ top: r, bottom: o })).sort((r, o) => r.top - o.top);
|
|
801
1090
|
}
|
|
802
|
-
function
|
|
1091
|
+
function ys(a, e, t, i) {
|
|
803
1092
|
if (!a.length) {
|
|
804
1093
|
const o = [];
|
|
805
1094
|
let n = 0;
|
|
806
1095
|
for (; n < e; ) {
|
|
807
|
-
const
|
|
808
|
-
o.push({ startY: n, height:
|
|
1096
|
+
const h = Math.min(t, e - n);
|
|
1097
|
+
o.push({ startY: n, height: h }), n += h;
|
|
809
1098
|
}
|
|
810
1099
|
return o;
|
|
811
1100
|
}
|
|
812
1101
|
const s = [];
|
|
813
1102
|
let r = 0;
|
|
814
1103
|
for (const o of a) {
|
|
815
|
-
const n = o.top * i,
|
|
816
|
-
|
|
1104
|
+
const n = o.top * i, h = o.bottom * i;
|
|
1105
|
+
h - r > t && (n > r ? (s.push({ startY: r, height: n - r }), r = n) : (s.push({ startY: r, height: h - r }), r = h));
|
|
817
1106
|
}
|
|
818
1107
|
return r < e && s.push({ startY: r, height: e - r }), s;
|
|
819
1108
|
}
|
|
820
|
-
function
|
|
821
|
-
const { i18n: e } =
|
|
1109
|
+
function vs(a) {
|
|
1110
|
+
const { i18n: e } = Ot(), t = L({ status: "idle" });
|
|
822
1111
|
async function i(s = {}) {
|
|
823
1112
|
const {
|
|
824
1113
|
filename: r = "dashboard-export",
|
|
825
1114
|
title: o,
|
|
826
1115
|
subtitle: n,
|
|
827
|
-
dashboardUrl:
|
|
1116
|
+
dashboardUrl: h,
|
|
828
1117
|
orientation: l = "landscape",
|
|
829
1118
|
pageSize: u = "letter",
|
|
830
|
-
margin:
|
|
1119
|
+
margin: d = 4,
|
|
831
1120
|
scale: f = 2,
|
|
832
1121
|
exclude: g = [".tile-actions", ".tooltip", ".popover", ".dropdown-popover"],
|
|
833
1122
|
output: m = "download",
|
|
834
1123
|
onBeforeCapture: v,
|
|
835
1124
|
onAfterCapture: p
|
|
836
|
-
} = s,
|
|
837
|
-
if (!
|
|
1125
|
+
} = s, k = a.value;
|
|
1126
|
+
if (!k) {
|
|
838
1127
|
t.value = { status: "error", error: new Error("Dashboard layout container not found.") };
|
|
839
1128
|
return;
|
|
840
1129
|
}
|
|
@@ -845,35 +1134,35 @@ function _s(a) {
|
|
|
845
1134
|
import("jspdf")
|
|
846
1135
|
]);
|
|
847
1136
|
t.value = { status: "capturing" };
|
|
848
|
-
const
|
|
1137
|
+
const I = {
|
|
849
1138
|
name: "kong-webgl-snapshot",
|
|
850
1139
|
beforeClone: () => gi(),
|
|
851
|
-
afterClone: () =>
|
|
852
|
-
}, D = await x.toCanvas(
|
|
1140
|
+
afterClone: () => ut()
|
|
1141
|
+
}, D = await x.toCanvas(k, {
|
|
853
1142
|
scale: f,
|
|
854
1143
|
exclude: g,
|
|
855
1144
|
embedFonts: !0,
|
|
856
|
-
plugins: [
|
|
857
|
-
}),
|
|
1145
|
+
plugins: [I]
|
|
1146
|
+
}), X = ps(k), ue = k.getBoundingClientRect().width, se = ue ? D.width / ue : f;
|
|
858
1147
|
t.value = { status: "generating" };
|
|
859
|
-
const re = /* @__PURE__ */ new Date(), R = new y({ orientation: l, unit: "mm", format: u }),
|
|
1148
|
+
const re = /* @__PURE__ */ new Date(), R = new y({ orientation: l, unit: "mm", format: u }), O = R.internal.pageSize.getWidth(), q = R.internal.pageSize.getHeight(), V = gs + (n ? Pt : 0), he = O - d * 2, J = q - d * 2 - V - Mt, ye = D.width / he, S = J * ye, z = ys(X, D.height, S, se), B = {
|
|
860
1149
|
title: o,
|
|
861
1150
|
subtitle: n,
|
|
862
|
-
dashboardUrl:
|
|
1151
|
+
dashboardUrl: h,
|
|
863
1152
|
generatedAt: e.t("pdfExport.generated", {
|
|
864
1153
|
timestamp: re.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" })
|
|
865
1154
|
}),
|
|
866
1155
|
branding: e.t("pdfExport.branding"),
|
|
867
1156
|
dashboardNote: e.t("pdfExport.dashboardNote"),
|
|
868
|
-
pageWidth:
|
|
1157
|
+
pageWidth: O,
|
|
869
1158
|
pageHeight: q,
|
|
870
1159
|
headerHeight: V,
|
|
871
|
-
margin:
|
|
1160
|
+
margin: d
|
|
872
1161
|
};
|
|
873
|
-
for (let
|
|
874
|
-
|
|
875
|
-
const { startY: $, height: ee } = z[
|
|
876
|
-
|
|
1162
|
+
for (let H = 0; H < z.length; H++) {
|
|
1163
|
+
H > 0 && R.addPage();
|
|
1164
|
+
const { startY: $, height: ee } = z[H], de = document.createElement("canvas");
|
|
1165
|
+
de.width = D.width, de.height = ee, de.getContext("2d").drawImage(
|
|
877
1166
|
D,
|
|
878
1167
|
0,
|
|
879
1168
|
$,
|
|
@@ -884,26 +1173,26 @@ function _s(a) {
|
|
|
884
1173
|
D.width,
|
|
885
1174
|
ee
|
|
886
1175
|
), R.addImage(
|
|
887
|
-
|
|
1176
|
+
de.toDataURL("image/png"),
|
|
888
1177
|
"PNG",
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1178
|
+
d,
|
|
1179
|
+
d + V,
|
|
1180
|
+
he,
|
|
892
1181
|
ee / ye
|
|
893
|
-
),
|
|
1182
|
+
), ms(R, {
|
|
894
1183
|
...B,
|
|
895
|
-
pageLabel: e.t("pdfExport.pageOf", { page: String(
|
|
1184
|
+
pageLabel: e.t("pdfExport.pageOf", { page: String(H + 1), total: String(z.length) })
|
|
896
1185
|
});
|
|
897
1186
|
}
|
|
898
1187
|
if (m === "blob") {
|
|
899
|
-
const
|
|
900
|
-
return t.value = { status: "complete", pageCount: z.length },
|
|
1188
|
+
const H = R.output("blob");
|
|
1189
|
+
return t.value = { status: "complete", pageCount: z.length }, H;
|
|
901
1190
|
}
|
|
902
1191
|
R.save(r), t.value = { status: "complete", pageCount: z.length };
|
|
903
1192
|
} catch (x) {
|
|
904
1193
|
t.value = { status: "error", error: x };
|
|
905
1194
|
} finally {
|
|
906
|
-
|
|
1195
|
+
ut(), await p?.();
|
|
907
1196
|
}
|
|
908
1197
|
}
|
|
909
1198
|
return {
|
|
@@ -912,14 +1201,14 @@ function _s(a) {
|
|
|
912
1201
|
};
|
|
913
1202
|
}
|
|
914
1203
|
const j = {
|
|
915
|
-
useContextLinks:
|
|
916
|
-
useDashboardInternalContext:
|
|
917
|
-
useEvaluateFeatureFlag:
|
|
918
|
-
useExportPdf:
|
|
919
|
-
useI18n:
|
|
920
|
-
useIssueQuery:
|
|
921
|
-
useRequestQueue:
|
|
922
|
-
},
|
|
1204
|
+
useContextLinks: ds,
|
|
1205
|
+
useDashboardInternalContext: fs,
|
|
1206
|
+
useEvaluateFeatureFlag: Xi,
|
|
1207
|
+
useExportPdf: vs,
|
|
1208
|
+
useI18n: Ot,
|
|
1209
|
+
useIssueQuery: cs,
|
|
1210
|
+
useRequestQueue: as
|
|
1211
|
+
}, Je = /* @__PURE__ */ K({
|
|
923
1212
|
__name: "QueryDataProvider",
|
|
924
1213
|
props: {
|
|
925
1214
|
context: {},
|
|
@@ -930,7 +1219,7 @@ const j = {
|
|
|
930
1219
|
},
|
|
931
1220
|
emits: ["chart-data", "query-complete"],
|
|
932
1221
|
setup(a, { emit: e }) {
|
|
933
|
-
const t = a, i = e, { i18n: s } = j.useI18n(), { issueQuery: r } = j.useIssueQuery(), o = le(ce), n = () => t.queryReady && o ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, { data:
|
|
1222
|
+
const t = a, i = e, { i18n: s } = j.useI18n(), { issueQuery: r } = j.useIssueQuery(), o = le(ce), n = () => t.queryReady && o ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, { data: h, error: l, isValidating: u } = xi(n, async () => {
|
|
934
1223
|
const x = n();
|
|
935
1224
|
try {
|
|
936
1225
|
const y = await r(t.query, t.context, t.limitOverride);
|
|
@@ -946,22 +1235,22 @@ const j = {
|
|
|
946
1235
|
refreshInterval: t.context.refreshInterval,
|
|
947
1236
|
revalidateOnFocus: !1,
|
|
948
1237
|
shouldRetryOnError: !1
|
|
949
|
-
}), { state:
|
|
950
|
-
return we([() =>
|
|
1238
|
+
}), { state: d, swrvState: f } = Oi(h, l, u), g = L(null), m = b(() => d.value === f.ERROR || !!g.value), v = b(() => !t.queryReady || d.value === f.PENDING), p = L(), k = b(() => h.value ?? (t.queryReady && d.value === f.PENDING ? p.value : void 0));
|
|
1239
|
+
return we([() => h.value, () => d.value], ([x, y]) => {
|
|
951
1240
|
x && (y === "SUCCESS_HAS_DATA" || y === "SUCCESS") && x !== p.value && (p.value = x, i("chart-data", x));
|
|
952
1241
|
}), (x, y) => {
|
|
953
|
-
const
|
|
954
|
-
return (v.value || !E(
|
|
1242
|
+
const I = te("KSkeleton"), D = te("KEmptyState");
|
|
1243
|
+
return (v.value || !E(h) && !m.value) && !k.value ? (w(), N(I, {
|
|
955
1244
|
key: 0,
|
|
956
1245
|
class: "chart-skeleton",
|
|
957
1246
|
type: "table"
|
|
958
|
-
})) : m.value && !v.value ? (w(),
|
|
1247
|
+
})) : m.value && !v.value ? (w(), N(D, {
|
|
959
1248
|
key: 1,
|
|
960
1249
|
"action-button-visible": !1,
|
|
961
1250
|
"data-testid": "chart-empty-state"
|
|
962
1251
|
}, Me({
|
|
963
1252
|
icon: M(() => [
|
|
964
|
-
g.value?.type === "forbidden" ? (w(),
|
|
1253
|
+
g.value?.type === "forbidden" ? (w(), N(E(Ti), { key: 0 })) : (w(), N(E(ki), { key: 1 }))
|
|
965
1254
|
]),
|
|
966
1255
|
title: M(() => [
|
|
967
1256
|
Q("p", null, W(g.value?.message || E(s).t("renderer.unexpectedError")), 1)
|
|
@@ -975,13 +1264,13 @@ const j = {
|
|
|
975
1264
|
]),
|
|
976
1265
|
key: "0"
|
|
977
1266
|
} : void 0
|
|
978
|
-
]), 1024)) :
|
|
1267
|
+
]), 1024)) : k.value ? Ee(x.$slots, "default", {
|
|
979
1268
|
key: 2,
|
|
980
|
-
data:
|
|
1269
|
+
data: k.value
|
|
981
1270
|
}) : U("", !0);
|
|
982
1271
|
};
|
|
983
1272
|
}
|
|
984
|
-
}),
|
|
1273
|
+
}), _s = /* @__PURE__ */ K({
|
|
985
1274
|
__name: "SimpleChartRenderer",
|
|
986
1275
|
props: {
|
|
987
1276
|
query: {},
|
|
@@ -995,7 +1284,7 @@ const j = {
|
|
|
995
1284
|
},
|
|
996
1285
|
setup(a) {
|
|
997
1286
|
const e = a, t = b(() => e.chartOptions.type === "single_value");
|
|
998
|
-
return (i, s) => (w(),
|
|
1287
|
+
return (i, s) => (w(), N(Je, {
|
|
999
1288
|
context: a.context,
|
|
1000
1289
|
query: a.query,
|
|
1001
1290
|
"query-ready": a.queryReady,
|
|
@@ -1021,7 +1310,7 @@ const j = {
|
|
|
1021
1310
|
for (const [i, s] of e)
|
|
1022
1311
|
t[i] = s;
|
|
1023
1312
|
return t;
|
|
1024
|
-
},
|
|
1313
|
+
}, vt = /* @__PURE__ */ fe(_s, [["__scopeId", "data-v-2cbfac70"]]), bs = { class: "analytics-chart" }, ws = /* @__PURE__ */ K({
|
|
1025
1314
|
__name: "BaseAnalyticsChartRenderer",
|
|
1026
1315
|
props: {
|
|
1027
1316
|
query: {},
|
|
@@ -1044,21 +1333,21 @@ const j = {
|
|
|
1044
1333
|
hideTruncationWarning: t.query.limit !== void 0 && t.query.limit > 0
|
|
1045
1334
|
})), o = b(() => t.context.zoomable), n = () => {
|
|
1046
1335
|
i("edit-tile");
|
|
1047
|
-
},
|
|
1336
|
+
}, h = (l) => {
|
|
1048
1337
|
i("chart-data", l);
|
|
1049
1338
|
};
|
|
1050
1339
|
return (l, u) => {
|
|
1051
|
-
const
|
|
1052
|
-
return w(),
|
|
1340
|
+
const d = te("KDropdownItem");
|
|
1341
|
+
return w(), N(Je, {
|
|
1053
1342
|
context: a.context,
|
|
1054
1343
|
query: a.query,
|
|
1055
1344
|
"query-ready": a.queryReady,
|
|
1056
1345
|
"refresh-counter": a.refreshCounter,
|
|
1057
|
-
onChartData:
|
|
1346
|
+
onChartData: h
|
|
1058
1347
|
}, {
|
|
1059
1348
|
default: M(({ data: f }) => [
|
|
1060
|
-
Q("div",
|
|
1061
|
-
ae(E(bi),
|
|
1349
|
+
Q("div", bs, [
|
|
1350
|
+
ae(E(bi), zt({
|
|
1062
1351
|
"chart-data": f,
|
|
1063
1352
|
"chart-options": r.value,
|
|
1064
1353
|
"explore-link": a.exploreLink,
|
|
@@ -1074,7 +1363,7 @@ const j = {
|
|
|
1074
1363
|
a.context.editable ? {
|
|
1075
1364
|
name: "menu-items",
|
|
1076
1365
|
fn: M(() => [
|
|
1077
|
-
ae(
|
|
1366
|
+
ae(d, { onClick: n }, {
|
|
1078
1367
|
default: M(() => [
|
|
1079
1368
|
Ke(W(E(s).t("renderer.edit")), 1)
|
|
1080
1369
|
]),
|
|
@@ -1090,7 +1379,7 @@ const j = {
|
|
|
1090
1379
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
1091
1380
|
};
|
|
1092
1381
|
}
|
|
1093
|
-
}),
|
|
1382
|
+
}), et = /* @__PURE__ */ fe(ws, [["__scopeId", "data-v-e1e7f610"]]), _t = /* @__PURE__ */ K({
|
|
1094
1383
|
__name: "BarChartRenderer",
|
|
1095
1384
|
props: {
|
|
1096
1385
|
query: {},
|
|
@@ -1103,7 +1392,7 @@ const j = {
|
|
|
1103
1392
|
exploreLink: {}
|
|
1104
1393
|
},
|
|
1105
1394
|
setup(a) {
|
|
1106
|
-
return (e, t) => (w(),
|
|
1395
|
+
return (e, t) => (w(), N(et, {
|
|
1107
1396
|
"chart-options": a.chartOptions,
|
|
1108
1397
|
context: a.context,
|
|
1109
1398
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -1113,7 +1402,7 @@ const j = {
|
|
|
1113
1402
|
"refresh-counter": a.refreshCounter
|
|
1114
1403
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
1115
1404
|
}
|
|
1116
|
-
}),
|
|
1405
|
+
}), bt = /* @__PURE__ */ K({
|
|
1117
1406
|
__name: "TimeseriesChartRenderer",
|
|
1118
1407
|
props: {
|
|
1119
1408
|
query: {},
|
|
@@ -1128,7 +1417,7 @@ const j = {
|
|
|
1128
1417
|
emits: ["zoom-time-range", "select-chart-range"],
|
|
1129
1418
|
setup(a, { emit: e }) {
|
|
1130
1419
|
const t = e;
|
|
1131
|
-
return (i, s) => (w(),
|
|
1420
|
+
return (i, s) => (w(), N(et, {
|
|
1132
1421
|
"chart-options": a.chartOptions,
|
|
1133
1422
|
context: a.context,
|
|
1134
1423
|
"explore-link": a.exploreLink,
|
|
@@ -1141,7 +1430,7 @@ const j = {
|
|
|
1141
1430
|
onZoomTimeRange: s[1] || (s[1] = (r) => t("zoom-time-range", r))
|
|
1142
1431
|
}, null, 8, ["chart-options", "context", "explore-link", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
1143
1432
|
}
|
|
1144
|
-
}),
|
|
1433
|
+
}), Es = /* @__PURE__ */ K({
|
|
1145
1434
|
__name: "GoldenSignalsRenderer",
|
|
1146
1435
|
props: {
|
|
1147
1436
|
query: {},
|
|
@@ -1173,26 +1462,26 @@ const j = {
|
|
|
1173
1462
|
return (i, s) => (w(), P("div", {
|
|
1174
1463
|
class: _e(["metric-card-tile-wrapper", { titled: !!e.chartOptions.chart_title }])
|
|
1175
1464
|
}, [
|
|
1176
|
-
ae(E(Ai),
|
|
1465
|
+
ae(E(Ai), di(ci(t.value)), {
|
|
1177
1466
|
default: M(() => [
|
|
1178
|
-
ae(E(
|
|
1467
|
+
ae(E(Hi))
|
|
1179
1468
|
]),
|
|
1180
1469
|
_: 1
|
|
1181
1470
|
}, 16)
|
|
1182
1471
|
], 2));
|
|
1183
1472
|
}
|
|
1184
|
-
}),
|
|
1473
|
+
}), xs = /* @__PURE__ */ fe(Es, [["__scopeId", "data-v-b77f52b8"]]), Cs = {
|
|
1185
1474
|
class: "fallback-entity-link",
|
|
1186
1475
|
"data-testid": "entity-link-parent"
|
|
1187
|
-
},
|
|
1476
|
+
}, wt = /* @__PURE__ */ K({
|
|
1188
1477
|
__name: "FallbackEntityLink",
|
|
1189
1478
|
props: {
|
|
1190
1479
|
entityLinkData: {}
|
|
1191
1480
|
},
|
|
1192
1481
|
setup(a) {
|
|
1193
|
-
return (e, t) => (w(), P("div",
|
|
1482
|
+
return (e, t) => (w(), P("div", Cs, W(a.entityLinkData.label), 1));
|
|
1194
1483
|
}
|
|
1195
|
-
}),
|
|
1484
|
+
}), Rs = { key: 0 }, Ts = { key: 1 }, ks = /* @__PURE__ */ K({
|
|
1196
1485
|
__name: "TopNTableRenderer",
|
|
1197
1486
|
props: {
|
|
1198
1487
|
query: {},
|
|
@@ -1205,54 +1494,54 @@ const j = {
|
|
|
1205
1494
|
exploreLink: {}
|
|
1206
1495
|
},
|
|
1207
1496
|
setup(a) {
|
|
1208
|
-
const e = a, t = le(ce), i =
|
|
1497
|
+
const e = a, t = le(ce), i = Lt(async () => {
|
|
1209
1498
|
if (t?.fetchComponent)
|
|
1210
1499
|
try {
|
|
1211
1500
|
return await t.fetchComponent("EntityLink");
|
|
1212
1501
|
} catch {
|
|
1213
|
-
return
|
|
1502
|
+
return wt;
|
|
1214
1503
|
}
|
|
1215
|
-
return
|
|
1504
|
+
return wt;
|
|
1216
1505
|
}), s = b(() => !!e.chartOptions.entity_link || !!Object.keys(e.chartOptions.entity_links || {}).length), r = (l) => {
|
|
1217
1506
|
const u = e.chartOptions.entity_links;
|
|
1218
|
-
return u && (u[l] || Object.entries(u).find(([
|
|
1507
|
+
return u && (u[l] || Object.entries(u).find(([d]) => d.toLowerCase() === l.toLowerCase())?.[1]) || "";
|
|
1219
1508
|
}, o = (l) => {
|
|
1220
1509
|
const u = l.dimensions?.[0]?.dimension;
|
|
1221
1510
|
return !u || u === l.dimension;
|
|
1222
|
-
}, n = (l) => r(l.dimension) || o(l) && e.chartOptions.entity_link || "",
|
|
1511
|
+
}, n = (l) => r(l.dimension) || o(l) && e.chartOptions.entity_link || "", h = (l) => {
|
|
1223
1512
|
const u = n(l);
|
|
1224
1513
|
if (u)
|
|
1225
1514
|
if (l.id.includes(":")) {
|
|
1226
|
-
const [
|
|
1227
|
-
return u.replace(Vi,
|
|
1515
|
+
const [d, f] = l.id.split(":");
|
|
1516
|
+
return u.replace(Vi, d).replace(dt, f);
|
|
1228
1517
|
} else
|
|
1229
1518
|
return u.replace(dt, l.id);
|
|
1230
1519
|
return "";
|
|
1231
1520
|
};
|
|
1232
|
-
return (l, u) => (w(),
|
|
1521
|
+
return (l, u) => (w(), N(Je, {
|
|
1233
1522
|
context: a.context,
|
|
1234
1523
|
query: a.query,
|
|
1235
1524
|
"query-ready": a.queryReady,
|
|
1236
1525
|
"refresh-counter": a.refreshCounter
|
|
1237
1526
|
}, {
|
|
1238
|
-
default: M(({ data:
|
|
1527
|
+
default: M(({ data: d }) => [
|
|
1239
1528
|
ae(E(wi), {
|
|
1240
|
-
data:
|
|
1529
|
+
data: d,
|
|
1241
1530
|
"synthetics-data-key": a.chartOptions.synthetics_data_key
|
|
1242
1531
|
}, Me({ _: 2 }, [
|
|
1243
1532
|
s.value ? {
|
|
1244
1533
|
name: "name",
|
|
1245
1534
|
fn: M(({ record: f }) => [
|
|
1246
|
-
!f.isEmpty && n(f) ? (w(),
|
|
1535
|
+
!f.isEmpty && n(f) ? (w(), N(E(i), {
|
|
1247
1536
|
key: 0,
|
|
1248
1537
|
"entity-link-data": {
|
|
1249
1538
|
id: f.id,
|
|
1250
1539
|
label: f.name,
|
|
1251
1540
|
deleted: f.deleted
|
|
1252
1541
|
},
|
|
1253
|
-
"external-link":
|
|
1542
|
+
"external-link": h(f)
|
|
1254
1543
|
}, null, 8, ["entity-link-data", "external-link"])) : (w(), P(Ve, { key: 1 }, [
|
|
1255
|
-
f.name === "empty" ? (w(), P("i",
|
|
1544
|
+
f.name === "empty" ? (w(), P("i", Rs, W(f.name), 1)) : (w(), P("span", Ts, W(f.name), 1))
|
|
1256
1545
|
], 64))
|
|
1257
1546
|
]),
|
|
1258
1547
|
key: "0"
|
|
@@ -1262,7 +1551,7 @@ const j = {
|
|
|
1262
1551
|
_: 1
|
|
1263
1552
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
1264
1553
|
}
|
|
1265
|
-
}),
|
|
1554
|
+
}), Ss = (a) => a.records.map((e) => {
|
|
1266
1555
|
const t = { ...e };
|
|
1267
1556
|
return Object.entries(e).forEach(([i, s]) => {
|
|
1268
1557
|
if (s === null)
|
|
@@ -1270,7 +1559,7 @@ const j = {
|
|
|
1270
1559
|
const r = a.meta.display?.[i]?.[String(s)]?.name;
|
|
1271
1560
|
r && (t[i] = r);
|
|
1272
1561
|
}), t;
|
|
1273
|
-
}),
|
|
1562
|
+
}), Et = ({
|
|
1274
1563
|
canTranslate: a,
|
|
1275
1564
|
columns: e,
|
|
1276
1565
|
translate: t
|
|
@@ -1280,11 +1569,11 @@ const j = {
|
|
|
1280
1569
|
key: i,
|
|
1281
1570
|
label: a(s) ? t(s) : i
|
|
1282
1571
|
};
|
|
1283
|
-
}),
|
|
1572
|
+
}), Ds = {
|
|
1284
1573
|
/** @deprecated Use `platform_usage`. */
|
|
1285
|
-
platform:
|
|
1286
|
-
platform_usage:
|
|
1287
|
-
},
|
|
1574
|
+
platform: Et,
|
|
1575
|
+
platform_usage: Et
|
|
1576
|
+
}, xt = async ({
|
|
1288
1577
|
abortController: a,
|
|
1289
1578
|
context: e,
|
|
1290
1579
|
cursor: t,
|
|
@@ -1296,32 +1585,32 @@ const j = {
|
|
|
1296
1585
|
}) => {
|
|
1297
1586
|
if (!n)
|
|
1298
1587
|
throw new Error("AnalyticsBridge.tabularQueryFn is not defined");
|
|
1299
|
-
const
|
|
1588
|
+
const h = s.query, l = o({
|
|
1300
1589
|
datasource: s.datasource,
|
|
1301
1590
|
filters: [
|
|
1302
|
-
...
|
|
1591
|
+
...h.filters ?? [],
|
|
1303
1592
|
...e.filters
|
|
1304
1593
|
],
|
|
1305
|
-
queryFields:
|
|
1594
|
+
queryFields: h.entity === void 0 ? void 0 : [h.entity]
|
|
1306
1595
|
}), u = await n({
|
|
1307
1596
|
datasource: s.datasource,
|
|
1308
1597
|
query: {
|
|
1309
|
-
columns:
|
|
1310
|
-
cursor: t === void 0 ?
|
|
1311
|
-
entity:
|
|
1598
|
+
columns: h.columns,
|
|
1599
|
+
cursor: t === void 0 ? h.cursor : String(t),
|
|
1600
|
+
entity: h.entity,
|
|
1312
1601
|
filters: l,
|
|
1313
1602
|
page_size: i
|
|
1314
1603
|
}
|
|
1315
1604
|
}, a);
|
|
1316
1605
|
return u.meta.columns?.length && r?.(u.meta.columns), {
|
|
1317
|
-
data:
|
|
1606
|
+
data: Ss(u),
|
|
1318
1607
|
cursor: u.meta.cursor,
|
|
1319
1608
|
hasMore: !!u.meta.cursor
|
|
1320
1609
|
};
|
|
1321
|
-
},
|
|
1610
|
+
}, zs = {
|
|
1322
1611
|
/** @deprecated Use `platform_usage`. */
|
|
1323
|
-
platform:
|
|
1324
|
-
platform_usage:
|
|
1612
|
+
platform: xt,
|
|
1613
|
+
platform_usage: xt
|
|
1325
1614
|
}, Ls = /* @__PURE__ */ K({
|
|
1326
1615
|
__name: "TableDataGridRenderer",
|
|
1327
1616
|
props: {
|
|
@@ -1333,7 +1622,7 @@ const j = {
|
|
|
1333
1622
|
},
|
|
1334
1623
|
emits: ["loading-change"],
|
|
1335
1624
|
setup(a, { emit: e }) {
|
|
1336
|
-
const t = a, i = e, s = le(ce), r =
|
|
1625
|
+
const t = a, i = e, s = le(ce), r = ke(), { i18n: o } = j.useI18n(), n = new AbortController(), h = L([]), l = L(!1), u = b(() => t.height === void 0 ? void 0 : { height: `${t.height}px` }), d = b(() => ({
|
|
1337
1626
|
datasource: t.query.datasource,
|
|
1338
1627
|
query: {
|
|
1339
1628
|
columns: t.query.columns,
|
|
@@ -1357,29 +1646,29 @@ const j = {
|
|
|
1357
1646
|
tz: t.context.tz
|
|
1358
1647
|
}
|
|
1359
1648
|
}));
|
|
1360
|
-
|
|
1649
|
+
Te(() => {
|
|
1361
1650
|
n.abort();
|
|
1362
1651
|
});
|
|
1363
|
-
const g = b(() =>
|
|
1652
|
+
const g = b(() => Ds[t.query.datasource]({
|
|
1364
1653
|
// query.columns are optional in the API. If not provided, backend will return default columns.
|
|
1365
1654
|
// If query columns are not provided, fallback to using columns from the response metadata for header configuration.
|
|
1366
|
-
columns: t.query.columns?.length ? t.query.columns :
|
|
1655
|
+
columns: t.query.columns?.length ? t.query.columns : h.value,
|
|
1367
1656
|
translate: (p) => o.t(p),
|
|
1368
1657
|
canTranslate: (p) => o.te(p)
|
|
1369
|
-
})), m = b(() => async ({ cursor: p, pageSize:
|
|
1658
|
+
})), m = b(() => async ({ cursor: p, pageSize: k }) => {
|
|
1370
1659
|
try {
|
|
1371
1660
|
await r.isReady();
|
|
1372
|
-
const x =
|
|
1661
|
+
const x = zs[d.value.datasource];
|
|
1373
1662
|
if (!x)
|
|
1374
|
-
throw new Error(`No table data grid fetcher found for datasource: ${
|
|
1663
|
+
throw new Error(`No table data grid fetcher found for datasource: ${d.value.datasource}`);
|
|
1375
1664
|
const y = await x({
|
|
1376
1665
|
abortController: n,
|
|
1377
1666
|
context: t.context,
|
|
1378
1667
|
cursor: p,
|
|
1379
|
-
pageSize:
|
|
1380
|
-
query:
|
|
1381
|
-
onResponseColumns: (
|
|
1382
|
-
|
|
1668
|
+
pageSize: k,
|
|
1669
|
+
query: d.value,
|
|
1670
|
+
onResponseColumns: (I) => {
|
|
1671
|
+
h.value = I;
|
|
1383
1672
|
},
|
|
1384
1673
|
stripUnknownFilters: r.stripUnknownFilters,
|
|
1385
1674
|
tabularQueryFn: s?.tabularQueryFn
|
|
@@ -1391,13 +1680,13 @@ const j = {
|
|
|
1391
1680
|
}), v = (p) => {
|
|
1392
1681
|
p.state === "error" && (l.value = !0), i("loading-change", p.state === "loading");
|
|
1393
1682
|
};
|
|
1394
|
-
return (p,
|
|
1683
|
+
return (p, k) => {
|
|
1395
1684
|
const x = te("KSkeleton");
|
|
1396
1685
|
return w(), P("div", {
|
|
1397
1686
|
class: "table-data-grid-renderer",
|
|
1398
1687
|
style: ze(u.value)
|
|
1399
1688
|
}, [
|
|
1400
|
-
a.queryReady ? (w(),
|
|
1689
|
+
a.queryReady ? (w(), N(E(Ii), {
|
|
1401
1690
|
key: 1,
|
|
1402
1691
|
error: l.value,
|
|
1403
1692
|
fetcher: m.value,
|
|
@@ -1405,7 +1694,7 @@ const j = {
|
|
|
1405
1694
|
"page-size": a.query.page_size,
|
|
1406
1695
|
"refresh-key": f.value,
|
|
1407
1696
|
onState: v
|
|
1408
|
-
}, null, 8, ["error", "fetcher", "headers", "page-size", "refresh-key"])) : (w(),
|
|
1697
|
+
}, null, 8, ["error", "fetcher", "headers", "page-size", "refresh-key"])) : (w(), N(x, {
|
|
1409
1698
|
key: 0,
|
|
1410
1699
|
"data-testid": "table-skeleton",
|
|
1411
1700
|
type: "table"
|
|
@@ -1413,7 +1702,7 @@ const j = {
|
|
|
1413
1702
|
], 4);
|
|
1414
1703
|
};
|
|
1415
1704
|
}
|
|
1416
|
-
}),
|
|
1705
|
+
}), Ns = /* @__PURE__ */ fe(Ls, [["__scopeId", "data-v-c49ff2eb"]]), Ct = "#6c7489", As = "12px", Rt = "20px", Tt = "32px", Bt = "20px", Hs = /* @__PURE__ */ K({
|
|
1417
1706
|
__name: "DonutChartRenderer",
|
|
1418
1707
|
props: {
|
|
1419
1708
|
query: {},
|
|
@@ -1426,7 +1715,7 @@ const j = {
|
|
|
1426
1715
|
exploreLink: {}
|
|
1427
1716
|
},
|
|
1428
1717
|
setup(a) {
|
|
1429
|
-
return (e, t) => (w(),
|
|
1718
|
+
return (e, t) => (w(), N(et, {
|
|
1430
1719
|
"chart-options": a.chartOptions,
|
|
1431
1720
|
context: a.context,
|
|
1432
1721
|
height: a.height,
|
|
@@ -1435,12 +1724,12 @@ const j = {
|
|
|
1435
1724
|
"refresh-counter": a.refreshCounter
|
|
1436
1725
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
1437
1726
|
}
|
|
1438
|
-
}),
|
|
1727
|
+
}), Is = ["data-testid"], qs = {
|
|
1439
1728
|
key: 0,
|
|
1440
1729
|
class: "tile-header"
|
|
1441
|
-
},
|
|
1730
|
+
}, Os = { class: "badge-container" }, Ms = { class: "badge-text" }, Ps = { key: 0 }, Bs = ["data-testid"], $s = ["data-testid"], Fs = { class: "delete-option" }, Gs = ["data-testid"], Us = ["data-testid"], Ws = /* @__PURE__ */ K({
|
|
1442
1731
|
__name: "DashboardTile",
|
|
1443
|
-
props: /* @__PURE__ */
|
|
1732
|
+
props: /* @__PURE__ */ Le({
|
|
1444
1733
|
context: {},
|
|
1445
1734
|
definition: {},
|
|
1446
1735
|
height: { default: Se },
|
|
@@ -1455,21 +1744,21 @@ const j = {
|
|
|
1455
1744
|
refreshCounter: { default: 0 },
|
|
1456
1745
|
refreshCounterModifiers: {}
|
|
1457
1746
|
}),
|
|
1458
|
-
emits: /* @__PURE__ */
|
|
1747
|
+
emits: /* @__PURE__ */ Le(["chart-data", "tile-loaded", "edit-tile", "duplicate-tile", "remove-tile", "tile-time-range-zoom", "tile-bounds-change"], ["update:refreshCounter"]),
|
|
1459
1748
|
setup(a, { expose: e, emit: t }) {
|
|
1460
|
-
Qe((
|
|
1461
|
-
v6ce74284: `${
|
|
1749
|
+
Qe((T) => ({
|
|
1750
|
+
v6ce74284: `${T.height}px`
|
|
1462
1751
|
}));
|
|
1463
1752
|
const i = parseInt(Bt, 10), s = a, r = Nt(a, "refreshCounter"), o = () => {
|
|
1464
1753
|
x.value = !0, r.value++;
|
|
1465
|
-
}, n = t,
|
|
1754
|
+
}, n = t, h = Lt(() => import("./GeoMapRenderer-DY2m4Z8z.js")), l = le(ce), u = ke(), { stripUnknownFilters: d } = xe(u), { i18n: f } = j.useI18n(), g = L(), m = L({ status: "loading" }), v = L(!1), p = L(), k = L(!1), x = L(!0), y = b(() => s.definition.chart), I = b(() => "chart_title" in y.value ? y.value.chart_title : void 0), D = b(() => "description" in y.value ? y.value.description : void 0), X = b(() => y.value.type === "slottable"), ue = b(() => Z(s.definition) ? !1 : !("allow_csv_export" in y.value) || y.value.allow_csv_export !== !1), {
|
|
1466
1755
|
exploreLinkKebabMenu: se,
|
|
1467
1756
|
requestsLinkKebabMenu: re,
|
|
1468
1757
|
canShowKebabMenu: R,
|
|
1469
|
-
canGenerateRequestsLink:
|
|
1758
|
+
canGenerateRequestsLink: O,
|
|
1470
1759
|
canGenerateExploreLink: q,
|
|
1471
1760
|
requestsLinkZoomActions: V,
|
|
1472
|
-
exploreLinkZoomActions:
|
|
1761
|
+
exploreLinkZoomActions: he,
|
|
1473
1762
|
buildExploreQuery: J,
|
|
1474
1763
|
buildExploreLink: ye,
|
|
1475
1764
|
buildRequestLink: S,
|
|
@@ -1480,42 +1769,42 @@ const j = {
|
|
|
1480
1769
|
definition: be(s, "definition"),
|
|
1481
1770
|
context: Ue(be(s, "context"))
|
|
1482
1771
|
}), { issueQuery: B } = j.useIssueQuery();
|
|
1483
|
-
we(() => s.definition, async (
|
|
1484
|
-
await Ye(), p.value && (
|
|
1772
|
+
we(() => s.definition, async (T, A) => {
|
|
1773
|
+
await Ye(), p.value && (k.value = p.value.scrollWidth > p.value.clientWidth);
|
|
1485
1774
|
try {
|
|
1486
|
-
JSON.stringify(
|
|
1775
|
+
JSON.stringify(T?.query) !== JSON.stringify(A?.query) && (x.value = !0);
|
|
1487
1776
|
} catch {
|
|
1488
1777
|
}
|
|
1489
1778
|
}, { immediate: !0, deep: !0 });
|
|
1490
|
-
const
|
|
1491
|
-
timeseries_line:
|
|
1492
|
-
timeseries_bar:
|
|
1493
|
-
horizontal_bar:
|
|
1494
|
-
vertical_bar:
|
|
1495
|
-
gauge:
|
|
1779
|
+
const H = b(() => f.t("csvExport.defaultFilename")), $ = b(() => !!se.value || ue.value || s.context.editable), ee = b(() => !s.hideActions && R.value && $.value), de = b(() => ee.value && $.value && !s.isFullscreen), Be = b(() => y.value.type === "golden_signals" && !!D.value), De = {
|
|
1780
|
+
timeseries_line: bt,
|
|
1781
|
+
timeseries_bar: bt,
|
|
1782
|
+
horizontal_bar: _t,
|
|
1783
|
+
vertical_bar: _t,
|
|
1784
|
+
gauge: vt,
|
|
1496
1785
|
donut: Hs,
|
|
1497
|
-
golden_signals:
|
|
1498
|
-
top_n:
|
|
1499
|
-
table:
|
|
1786
|
+
golden_signals: xs,
|
|
1787
|
+
top_n: ks,
|
|
1788
|
+
table: Ns,
|
|
1500
1789
|
slottable: void 0,
|
|
1501
|
-
single_value:
|
|
1502
|
-
choropleth_map:
|
|
1790
|
+
single_value: vt,
|
|
1791
|
+
choropleth_map: h
|
|
1503
1792
|
}, Gt = b(() => ({
|
|
1504
1793
|
...ge.value?.rendererEvents.supportsRequests ? { "select-chart-range": si } : {},
|
|
1505
1794
|
...ge.value?.rendererEvents.supportsZoom ? { "zoom-time-range": ti } : {},
|
|
1506
1795
|
...ge.value?.rendererEvents.supportsBounds ? { "bounds-change": ii } : {},
|
|
1507
|
-
...ge.value?.rendererEvents.supportsLoadingChange ? { "loading-change":
|
|
1796
|
+
...ge.value?.rendererEvents.supportsLoadingChange ? { "loading-change": Xt } : {}
|
|
1508
1797
|
})), ge = b(() => {
|
|
1509
|
-
const
|
|
1510
|
-
query:
|
|
1798
|
+
const T = s.definition, A = De[T.chart.type], F = Z(T), me = !!A?.emits?.includes("select-chart-range"), ve = !!A?.emits?.includes("zoom-time-range"), pe = T.chart.type === "choropleth_map", Fe = !!A?.emits?.includes("loading-change"), ri = {
|
|
1799
|
+
query: T.query,
|
|
1511
1800
|
context: s.context,
|
|
1512
1801
|
queryReady: s.queryReady,
|
|
1513
1802
|
height: s.height - i * 2,
|
|
1514
1803
|
refreshCounter: r.value
|
|
1515
1804
|
}, ni = {
|
|
1516
|
-
chartOptions:
|
|
1805
|
+
chartOptions: T.chart,
|
|
1517
1806
|
requestsLink: s.hideZoomActions ? void 0 : V.value,
|
|
1518
|
-
exploreLink: s.hideZoomActions ? void 0 :
|
|
1807
|
+
exploreLink: s.hideZoomActions ? void 0 : he.value
|
|
1519
1808
|
};
|
|
1520
1809
|
return A && {
|
|
1521
1810
|
component: A,
|
|
@@ -1531,39 +1820,39 @@ const j = {
|
|
|
1531
1820
|
}
|
|
1532
1821
|
};
|
|
1533
1822
|
}), $e = b(() => {
|
|
1534
|
-
if (
|
|
1823
|
+
if (Z(s.definition))
|
|
1535
1824
|
return null;
|
|
1536
|
-
const
|
|
1537
|
-
if (
|
|
1825
|
+
const T = s.definition.query, A = T?.time_range;
|
|
1826
|
+
if (It(T?.datasource) && !T.dimensions?.includes("time"))
|
|
1538
1827
|
return f.t("renderer.as_of_today");
|
|
1539
1828
|
if (A?.type === "relative") {
|
|
1540
1829
|
const F = mi.get(pi[A.time_range]);
|
|
1541
1830
|
return F ? F.display : (console.warn("Did not recognize the given relative time range:", A.time_range), A.time_range);
|
|
1542
1831
|
} else if (A?.type === "absolute") {
|
|
1543
1832
|
const F = A.tz || "Etc/UTC";
|
|
1544
|
-
return `${
|
|
1833
|
+
return `${ht(A.start, { short: !0, tz: F })} - ${ht(A.end, { short: !0, tz: F })}`;
|
|
1545
1834
|
}
|
|
1546
1835
|
return null;
|
|
1547
|
-
}),
|
|
1548
|
-
!!
|
|
1549
|
-
|
|
1836
|
+
}), st = b(() => X.value ? !1 : [
|
|
1837
|
+
!!I.value,
|
|
1838
|
+
de.value,
|
|
1550
1839
|
!!$e.value,
|
|
1551
1840
|
Be.value,
|
|
1552
1841
|
s.showRefresh
|
|
1553
|
-
].some(Boolean)),
|
|
1554
|
-
if (
|
|
1842
|
+
].some(Boolean)), rt = b(() => g.value ? We(g.value.meta.granularity_ms) : void 0), Ut = b(() => ["timeseries_line", "timeseries_bar"].includes(y.value.type)), nt = b(() => {
|
|
1843
|
+
if (Z(s.definition) || !Ut.value || !s.queryReady || x.value)
|
|
1555
1844
|
return !1;
|
|
1556
|
-
const
|
|
1557
|
-
return !
|
|
1845
|
+
const T = s.definition.query.granularity;
|
|
1846
|
+
return !T || !rt.value ? !1 : T !== rt.value;
|
|
1558
1847
|
}), Wt = b(() => {
|
|
1559
|
-
const
|
|
1848
|
+
const T = We(g.value?.meta.granularity_ms ?? 0) ?? "unknown", A = Z(s.definition) ? "unknown" : s.definition.query.granularity ?? "unknown";
|
|
1560
1849
|
return f.t("query_aged_out_warning", {
|
|
1561
|
-
currentGranularity: f.t(`granularities.${
|
|
1850
|
+
currentGranularity: f.t(`granularities.${T}`),
|
|
1562
1851
|
savedGranularity: f.t(`granularities.${A}`)
|
|
1563
1852
|
});
|
|
1564
1853
|
}), Kt = b(() => {
|
|
1565
|
-
const
|
|
1566
|
-
return
|
|
1854
|
+
const T = s.definition, A = [...s.context.filters, ...T.query.filters ?? []], F = "metrics" in T.query ? T.query.metrics : void 0, me = T.query.datasource ?? "api_usage";
|
|
1855
|
+
return d.value({
|
|
1567
1856
|
datasource: me,
|
|
1568
1857
|
filters: A,
|
|
1569
1858
|
queryFields: F
|
|
@@ -1574,17 +1863,17 @@ const j = {
|
|
|
1574
1863
|
n("duplicate-tile", s.definition);
|
|
1575
1864
|
}, Yt = () => {
|
|
1576
1865
|
n("remove-tile", s.definition);
|
|
1577
|
-
}, jt = (
|
|
1578
|
-
g.value =
|
|
1579
|
-
},
|
|
1866
|
+
}, jt = (T) => {
|
|
1867
|
+
g.value = T, x.value = !1, n("chart-data", T), n("tile-loaded");
|
|
1868
|
+
}, Zt = () => {
|
|
1580
1869
|
x.value = !1, n("tile-loaded");
|
|
1581
|
-
},
|
|
1582
|
-
x.value =
|
|
1870
|
+
}, Xt = (T) => {
|
|
1871
|
+
x.value = T, T || n("tile-loaded");
|
|
1583
1872
|
}, Jt = () => {
|
|
1584
1873
|
v.value = !1;
|
|
1585
|
-
},
|
|
1586
|
-
const
|
|
1587
|
-
return l?.staticConfig?.increaseCsvExportLimit !== !1 && !
|
|
1874
|
+
}, ot = () => {
|
|
1875
|
+
const T = s.definition.query.datasource?.startsWith("goap");
|
|
1876
|
+
return l?.staticConfig?.increaseCsvExportLimit !== !1 && !T ? B(s.definition.query, s.context, yi) : g.value ? Promise.resolve(g.value) : new Promise((F) => {
|
|
1588
1877
|
const me = we(g, (ve) => {
|
|
1589
1878
|
ve && (F(ve), me());
|
|
1590
1879
|
});
|
|
@@ -1592,76 +1881,76 @@ const j = {
|
|
|
1592
1881
|
}, ei = async () => {
|
|
1593
1882
|
v.value = !0, m.value = { status: "loading" };
|
|
1594
1883
|
try {
|
|
1595
|
-
const
|
|
1596
|
-
m.value = { status: "success", chartData:
|
|
1597
|
-
} catch (
|
|
1598
|
-
m.value = { status: "error", error:
|
|
1884
|
+
const T = await ot();
|
|
1885
|
+
m.value = { status: "success", chartData: T };
|
|
1886
|
+
} catch (T) {
|
|
1887
|
+
m.value = { status: "error", error: T };
|
|
1599
1888
|
}
|
|
1600
|
-
}, ti = (
|
|
1889
|
+
}, ti = (T) => {
|
|
1601
1890
|
const A = {
|
|
1602
1891
|
tileId: s.tileId.toString(),
|
|
1603
|
-
timeRange:
|
|
1892
|
+
timeRange: T
|
|
1604
1893
|
};
|
|
1605
1894
|
n("tile-time-range-zoom", A);
|
|
1606
|
-
}, ii = (
|
|
1895
|
+
}, ii = (T) => {
|
|
1607
1896
|
const A = {
|
|
1608
1897
|
tileId: s.tileId.toString(),
|
|
1609
|
-
bounds:
|
|
1898
|
+
bounds: T
|
|
1610
1899
|
};
|
|
1611
1900
|
n("tile-bounds-change", A);
|
|
1612
|
-
}, si = (
|
|
1613
|
-
const A = Kt.value, F = J(
|
|
1614
|
-
|
|
1901
|
+
}, si = (T) => {
|
|
1902
|
+
const A = Kt.value, F = J(T, A);
|
|
1903
|
+
he.value = q.value ? { href: ye(F) } : void 0, V.value = O.value ? { href: S(z(T, A)) } : void 0;
|
|
1615
1904
|
};
|
|
1616
|
-
return e({ getExportData:
|
|
1905
|
+
return e({ getExportData: ot }), (T, A) => {
|
|
1617
1906
|
const F = te("KTooltip"), me = te("KBadge"), ve = te("KButton"), pe = te("KDropdownItem"), Fe = te("KDropdown");
|
|
1618
1907
|
return w(), P("div", {
|
|
1619
1908
|
class: _e(["tile-boundary", {
|
|
1620
1909
|
editable: a.context.editable,
|
|
1621
|
-
headless: !
|
|
1910
|
+
headless: !st.value
|
|
1622
1911
|
}]),
|
|
1623
1912
|
"data-testid": `tile-${a.tileId}`
|
|
1624
1913
|
}, [
|
|
1625
|
-
|
|
1914
|
+
st.value && !X.value ? (w(), P("div", qs, [
|
|
1626
1915
|
ae(F, {
|
|
1627
1916
|
class: "title-tooltip",
|
|
1628
|
-
disabled: !
|
|
1917
|
+
disabled: !k.value,
|
|
1629
1918
|
"max-width": "500",
|
|
1630
|
-
text:
|
|
1919
|
+
text: I.value
|
|
1631
1920
|
}, {
|
|
1632
1921
|
default: M(() => [
|
|
1633
1922
|
Q("div", {
|
|
1634
1923
|
ref_key: "titleRef",
|
|
1635
1924
|
ref: p,
|
|
1636
1925
|
class: "title"
|
|
1637
|
-
}, W(
|
|
1926
|
+
}, W(I.value), 513)
|
|
1638
1927
|
]),
|
|
1639
1928
|
_: 1
|
|
1640
1929
|
}, 8, ["disabled", "text"]),
|
|
1641
|
-
Q("div",
|
|
1642
|
-
$e.value ? (w(),
|
|
1930
|
+
Q("div", Os, [
|
|
1931
|
+
$e.value ? (w(), N(me, {
|
|
1643
1932
|
key: 0,
|
|
1644
1933
|
"data-testid": "time-range-badge",
|
|
1645
|
-
tooltip:
|
|
1934
|
+
tooltip: nt.value ? Wt.value : void 0,
|
|
1646
1935
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1647
1936
|
}, Me({
|
|
1648
1937
|
default: M(() => [
|
|
1649
|
-
Q("span",
|
|
1938
|
+
Q("span", Ms, W($e.value), 1)
|
|
1650
1939
|
]),
|
|
1651
1940
|
_: 2
|
|
1652
1941
|
}, [
|
|
1653
|
-
|
|
1942
|
+
nt.value ? {
|
|
1654
1943
|
name: "icon",
|
|
1655
1944
|
fn: M(() => [
|
|
1656
1945
|
ae(E(Si), {
|
|
1657
|
-
size: `var(--kui-icon-size-20, ${E(
|
|
1946
|
+
size: `var(--kui-icon-size-20, ${E(As)})`
|
|
1658
1947
|
}, null, 8, ["size"])
|
|
1659
1948
|
]),
|
|
1660
1949
|
key: "0"
|
|
1661
1950
|
} : void 0
|
|
1662
1951
|
]), 1032, ["tooltip"])) : U("", !0)
|
|
1663
1952
|
]),
|
|
1664
|
-
a.showRefresh ? (w(), P("div",
|
|
1953
|
+
a.showRefresh ? (w(), P("div", Ps, [
|
|
1665
1954
|
ae(ve, {
|
|
1666
1955
|
appearance: "secondary",
|
|
1667
1956
|
class: "refresh-button",
|
|
@@ -1672,15 +1961,15 @@ const j = {
|
|
|
1672
1961
|
onClick: o
|
|
1673
1962
|
}, {
|
|
1674
1963
|
default: M(() => [
|
|
1675
|
-
x.value ? (w(),
|
|
1964
|
+
x.value ? (w(), N(E(Di), {
|
|
1676
1965
|
key: 0,
|
|
1677
1966
|
role: "button",
|
|
1678
|
-
size: `var(--kui-icon-size-60, ${E(
|
|
1967
|
+
size: `var(--kui-icon-size-60, ${E(Tt)})`,
|
|
1679
1968
|
tabindex: "0"
|
|
1680
|
-
}, null, 8, ["size"])) : (w(),
|
|
1969
|
+
}, null, 8, ["size"])) : (w(), N(E(zi), {
|
|
1681
1970
|
key: 1,
|
|
1682
1971
|
role: "button",
|
|
1683
|
-
size: `var(--kui-icon-size-60, ${E(
|
|
1972
|
+
size: `var(--kui-icon-size-60, ${E(Tt)})`,
|
|
1684
1973
|
tabindex: "0"
|
|
1685
1974
|
}, null, 8, ["size"]))
|
|
1686
1975
|
]),
|
|
@@ -1692,32 +1981,32 @@ const j = {
|
|
|
1692
1981
|
class: "tile-actions",
|
|
1693
1982
|
"data-testid": `tile-actions-${a.tileId}`
|
|
1694
1983
|
}, [
|
|
1695
|
-
ee.value && a.context.editable && !a.isFullscreen ? (w(),
|
|
1984
|
+
ee.value && a.context.editable && !a.isFullscreen ? (w(), N(E(Li), {
|
|
1696
1985
|
key: 0,
|
|
1697
1986
|
class: "edit-icon",
|
|
1698
|
-
color: `var(--kui-color-text-neutral, ${E(
|
|
1987
|
+
color: `var(--kui-color-text-neutral, ${E(Ct)})`,
|
|
1699
1988
|
"data-testid": `edit-tile-${a.tileId}`,
|
|
1700
|
-
size: `var(--kui-icon-size-40, ${E(
|
|
1989
|
+
size: `var(--kui-icon-size-40, ${E(Rt)})`,
|
|
1701
1990
|
onClick: Vt
|
|
1702
1991
|
}, null, 8, ["color", "data-testid", "size"])) : U("", !0),
|
|
1703
|
-
ee.value && $.value && !a.isFullscreen ? (w(),
|
|
1992
|
+
ee.value && $.value && !a.isFullscreen ? (w(), N(Fe, {
|
|
1704
1993
|
key: 1,
|
|
1705
1994
|
class: "dropdown",
|
|
1706
1995
|
"data-testid": `chart-action-menu-${a.tileId}`,
|
|
1707
1996
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1708
1997
|
}, {
|
|
1709
1998
|
items: M(() => [
|
|
1710
|
-
E(se) ? (w(),
|
|
1999
|
+
E(se) ? (w(), N(pe, {
|
|
1711
2000
|
key: 0,
|
|
1712
2001
|
"data-testid": `chart-jump-to-explore-${a.tileId}`,
|
|
1713
2002
|
item: { label: E(f).t("jumpToExplore"), to: E(se) }
|
|
1714
2003
|
}, null, 8, ["data-testid", "item"])) : U("", !0),
|
|
1715
|
-
!E(
|
|
2004
|
+
!E(Z)(a.definition) && E(re) ? (w(), N(pe, {
|
|
1716
2005
|
key: 1,
|
|
1717
2006
|
"data-testid": `chart-jump-to-requests-${a.tileId}`,
|
|
1718
2007
|
item: { label: E(f).t("jumpToRequests"), to: E(re) }
|
|
1719
2008
|
}, null, 8, ["data-testid", "item"])) : U("", !0),
|
|
1720
|
-
ue.value ? (w(),
|
|
2009
|
+
ue.value ? (w(), N(pe, {
|
|
1721
2010
|
key: 2,
|
|
1722
2011
|
class: "chart-export-button",
|
|
1723
2012
|
"data-testid": `chart-csv-export-${a.tileId}`,
|
|
@@ -1727,11 +2016,11 @@ const j = {
|
|
|
1727
2016
|
Q("span", {
|
|
1728
2017
|
class: "chart-export-trigger",
|
|
1729
2018
|
"data-testid": `csv-export-button-${a.tileId}`
|
|
1730
|
-
}, W(E(f).t("csvExport.exportAsCsv")), 9,
|
|
2019
|
+
}, W(E(f).t("csvExport.exportAsCsv")), 9, $s)
|
|
1731
2020
|
]),
|
|
1732
2021
|
_: 1
|
|
1733
2022
|
}, 8, ["data-testid"])) : U("", !0),
|
|
1734
|
-
a.context.editable ? (w(),
|
|
2023
|
+
a.context.editable ? (w(), N(pe, {
|
|
1735
2024
|
key: 3,
|
|
1736
2025
|
"data-testid": `duplicate-tile-${a.tileId}`,
|
|
1737
2026
|
onClick: Qt
|
|
@@ -1741,37 +2030,37 @@ const j = {
|
|
|
1741
2030
|
]),
|
|
1742
2031
|
_: 1
|
|
1743
2032
|
}, 8, ["data-testid"])) : U("", !0),
|
|
1744
|
-
a.context.editable ? (w(),
|
|
2033
|
+
a.context.editable ? (w(), N(pe, {
|
|
1745
2034
|
key: 4,
|
|
1746
2035
|
"data-testid": `remove-tile-${a.tileId}`,
|
|
1747
2036
|
onClick: Yt
|
|
1748
2037
|
}, {
|
|
1749
2038
|
default: M(() => [
|
|
1750
|
-
Q("span",
|
|
2039
|
+
Q("span", Fs, W(E(f).t("renderer.delete")), 1)
|
|
1751
2040
|
]),
|
|
1752
2041
|
_: 1
|
|
1753
2042
|
}, 8, ["data-testid"])) : U("", !0)
|
|
1754
2043
|
]),
|
|
1755
2044
|
default: M(() => [
|
|
1756
|
-
ae(E(
|
|
2045
|
+
ae(E(Ni), {
|
|
1757
2046
|
class: "kebab-action-menu",
|
|
1758
|
-
color: `var(--kui-color-text-neutral, ${E(
|
|
2047
|
+
color: `var(--kui-color-text-neutral, ${E(Ct)})`,
|
|
1759
2048
|
"data-testid": `kebab-action-menu-${a.tileId}`,
|
|
1760
|
-
size: `var(--kui-icon-size-40, ${E(
|
|
2049
|
+
size: `var(--kui-icon-size-40, ${E(Rt)})`
|
|
1761
2050
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1762
2051
|
]),
|
|
1763
2052
|
_: 1
|
|
1764
2053
|
}, 8, ["data-testid"])) : U("", !0)
|
|
1765
|
-
], 8,
|
|
2054
|
+
], 8, Bs)) : D.value ? (w(), P("div", {
|
|
1766
2055
|
key: 2,
|
|
1767
2056
|
class: "header-description",
|
|
1768
2057
|
"data-testid": `tile-description-${a.tileId}`
|
|
1769
|
-
}, W(D.value), 9,
|
|
1770
|
-
v.value ? (w(),
|
|
2058
|
+
}, W(D.value), 9, Gs)) : U("", !0),
|
|
2059
|
+
v.value ? (w(), N(E(Ei), {
|
|
1771
2060
|
key: 3,
|
|
1772
2061
|
"data-testid": `csv-export-modal-${a.tileId}`,
|
|
1773
2062
|
"export-state": m.value,
|
|
1774
|
-
filename:
|
|
2063
|
+
filename: H.value,
|
|
1775
2064
|
onCloseModal: Jt
|
|
1776
2065
|
}, null, 8, ["data-testid", "export-state", "filename"])) : U("", !0)
|
|
1777
2066
|
])) : U("", !0),
|
|
@@ -1779,26 +2068,26 @@ const j = {
|
|
|
1779
2068
|
class: _e(["tile-content", `type-${a.tileType}-${y.value.type}`]),
|
|
1780
2069
|
"data-testid": `tile-content-${a.tileId}`
|
|
1781
2070
|
}, [
|
|
1782
|
-
ge.value ? (w(),
|
|
2071
|
+
ge.value ? (w(), N(At(ge.value.component), zt({ key: 0 }, ge.value.rendererProps, fi(Gt.value), {
|
|
1783
2072
|
onChartData: jt,
|
|
1784
|
-
onQueryComplete:
|
|
2073
|
+
onQueryComplete: Zt
|
|
1785
2074
|
}), null, 16)) : U("", !0)
|
|
1786
|
-
], 10,
|
|
1787
|
-
], 10,
|
|
2075
|
+
], 10, Us)
|
|
2076
|
+
], 10, Is);
|
|
1788
2077
|
};
|
|
1789
2078
|
}
|
|
1790
|
-
}), $t = /* @__PURE__ */ fe(
|
|
2079
|
+
}), $t = /* @__PURE__ */ fe(Ws, [["__scopeId", "data-v-fb1aa747"]]), Ks = (a, e) => {
|
|
1791
2080
|
let t = 0;
|
|
1792
2081
|
const i = /* @__PURE__ */ new Map();
|
|
1793
2082
|
e.forEach((r) => {
|
|
1794
|
-
const o = r.layout.position.row, n = i.get(o),
|
|
1795
|
-
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o,
|
|
2083
|
+
const o = r.layout.position.row, n = i.get(o), h = r.layout.size.rows === 1 && !!r.layout.size.fit_to_content;
|
|
2084
|
+
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o, h) : i.set(o, n && h);
|
|
1796
2085
|
});
|
|
1797
2086
|
const s = [];
|
|
1798
2087
|
for (let r = 0; r < t; r++)
|
|
1799
2088
|
i.get(r) ? s.push("auto") : s.push(`${a}px`);
|
|
1800
2089
|
return s;
|
|
1801
|
-
},
|
|
2090
|
+
}, Vs = /* @__PURE__ */ K({
|
|
1802
2091
|
__name: "GridLayout",
|
|
1803
2092
|
props: {
|
|
1804
2093
|
tileHeight: {
|
|
@@ -1809,7 +2098,7 @@ const j = {
|
|
|
1809
2098
|
columns: {
|
|
1810
2099
|
type: Number,
|
|
1811
2100
|
required: !1,
|
|
1812
|
-
default: () =>
|
|
2101
|
+
default: () => Ze
|
|
1813
2102
|
},
|
|
1814
2103
|
tiles: {
|
|
1815
2104
|
type: Array,
|
|
@@ -1821,18 +2110,18 @@ const j = {
|
|
|
1821
2110
|
v821fda82: e.columns,
|
|
1822
2111
|
v0870d42d: r.value
|
|
1823
2112
|
}));
|
|
1824
|
-
const e = a, t =
|
|
2113
|
+
const e = a, t = L(null), i = L(0), s = new ResizeObserver((n) => {
|
|
1825
2114
|
window.requestAnimationFrame(() => {
|
|
1826
2115
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1827
2116
|
});
|
|
1828
2117
|
});
|
|
1829
|
-
|
|
2118
|
+
Oe(() => {
|
|
1830
2119
|
t.value && s.observe(t.value);
|
|
1831
|
-
}),
|
|
2120
|
+
}), Te(() => {
|
|
1832
2121
|
t.value && s.unobserve(t.value);
|
|
1833
2122
|
});
|
|
1834
|
-
const r = b(() =>
|
|
1835
|
-
key: `tile-${
|
|
2123
|
+
const r = b(() => Ks(e.tileHeight, e.tiles).join(" ")), o = b(() => e.tiles.map((n, h) => ({
|
|
2124
|
+
key: `tile-${h}`,
|
|
1836
2125
|
tile: n,
|
|
1837
2126
|
style: {
|
|
1838
2127
|
"grid-column-start": n.layout.position.col + 1,
|
|
@@ -1841,12 +2130,12 @@ const j = {
|
|
|
1841
2130
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1842
2131
|
}
|
|
1843
2132
|
})));
|
|
1844
|
-
return (n,
|
|
2133
|
+
return (n, h) => (w(), P("div", {
|
|
1845
2134
|
ref_key: "gridContainer",
|
|
1846
2135
|
ref: t,
|
|
1847
2136
|
class: "kong-ui-public-grid-layout"
|
|
1848
2137
|
}, [
|
|
1849
|
-
(w(!0), P(Ve, null,
|
|
2138
|
+
(w(!0), P(Ve, null, Ht(o.value, (l) => (w(), P("div", {
|
|
1850
2139
|
key: l.key,
|
|
1851
2140
|
class: _e(["grid-cell", {
|
|
1852
2141
|
"empty-cell": !l.tile
|
|
@@ -1860,8 +2149,8 @@ const j = {
|
|
|
1860
2149
|
], 6))), 128))
|
|
1861
2150
|
], 512));
|
|
1862
2151
|
}
|
|
1863
|
-
}),
|
|
1864
|
-
function
|
|
2152
|
+
}), Qs = /* @__PURE__ */ fe(Vs, [["__scopeId", "data-v-0271a8b9"]]);
|
|
2153
|
+
function Ys(a, e, t, i, s) {
|
|
1865
2154
|
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(a, o));
|
|
1866
2155
|
return r.prototype = e.prototype, r;
|
|
1867
2156
|
}
|
|
@@ -2067,10 +2356,10 @@ class c {
|
|
|
2067
2356
|
static updateScrollPosition(e, t, i) {
|
|
2068
2357
|
const s = e.getBoundingClientRect(), r = window.innerHeight || document.documentElement.clientHeight;
|
|
2069
2358
|
if (s.top < 0 || s.bottom > r) {
|
|
2070
|
-
const o = s.bottom - r, n = s.top,
|
|
2071
|
-
if (
|
|
2072
|
-
const l =
|
|
2073
|
-
s.top < 0 && i < 0 ? e.offsetHeight > r ?
|
|
2359
|
+
const o = s.bottom - r, n = s.top, h = this.getScrollElement(e);
|
|
2360
|
+
if (h !== null) {
|
|
2361
|
+
const l = h.scrollTop;
|
|
2362
|
+
s.top < 0 && i < 0 ? e.offsetHeight > r ? h.scrollTop += i : h.scrollTop += Math.abs(n) > Math.abs(i) ? i : n : i > 0 && (e.offsetHeight > r ? h.scrollTop += i : h.scrollTop += o > i ? i : o), t.top += h.scrollTop - l;
|
|
2074
2363
|
}
|
|
2075
2364
|
}
|
|
2076
2365
|
}
|
|
@@ -2082,8 +2371,8 @@ class c {
|
|
|
2082
2371
|
* @param distance Distance from the V edges to start scrolling
|
|
2083
2372
|
*/
|
|
2084
2373
|
static updateScrollResize(e, t, i) {
|
|
2085
|
-
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o,
|
|
2086
|
-
|
|
2374
|
+
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o, h = n < i, l = n > r - i;
|
|
2375
|
+
h ? s.scrollBy({ behavior: "smooth", top: n - i }) : l && s.scrollBy({ behavior: "smooth", top: i - (r - n) });
|
|
2087
2376
|
}
|
|
2088
2377
|
/** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
|
|
2089
2378
|
static clone(e) {
|
|
@@ -2221,9 +2510,9 @@ class ne {
|
|
|
2221
2510
|
!this._loading && this._useEntireRowArea(e, t) && (r = { x: 0, w: this.column, y: t.y, h: t.h }, i = this.collide(e, r, s.skip));
|
|
2222
2511
|
let o = !1;
|
|
2223
2512
|
const n = { nested: !0, pack: !1 };
|
|
2224
|
-
let
|
|
2513
|
+
let h = 0;
|
|
2225
2514
|
for (; i = i || this.collide(e, r, s.skip); ) {
|
|
2226
|
-
if (
|
|
2515
|
+
if (h++ > this.nodes.length * 2)
|
|
2227
2516
|
throw new Error("Infinite collide check");
|
|
2228
2517
|
let l;
|
|
2229
2518
|
if (i.locked || this._loading || e._moving && !e._skipDown && t.y > e.y && !this.float && // can take space we had, or before where we're going
|
|
@@ -2255,14 +2544,14 @@ class ne {
|
|
|
2255
2544
|
const s = e._rect, r = { ...t.rect };
|
|
2256
2545
|
r.y > s.y ? (r.h += r.y - s.y, r.y = s.y) : r.h += s.y - r.y, r.x > s.x ? (r.w += r.x - s.x, r.x = s.x) : r.w += s.x - r.x;
|
|
2257
2546
|
let o, n = 0.5;
|
|
2258
|
-
for (let
|
|
2259
|
-
if (
|
|
2547
|
+
for (let h of i) {
|
|
2548
|
+
if (h.locked || !h._rect)
|
|
2260
2549
|
break;
|
|
2261
|
-
const l =
|
|
2262
|
-
let u = Number.MAX_VALUE,
|
|
2263
|
-
s.y < l.y ? u = (r.y + r.h - l.y) / l.h : s.y + s.h > l.y + l.h && (u = (l.y + l.h - r.y) / l.h), s.x < l.x ?
|
|
2264
|
-
const f = Math.min(
|
|
2265
|
-
f > n && (n = f, o =
|
|
2550
|
+
const l = h._rect;
|
|
2551
|
+
let u = Number.MAX_VALUE, d = Number.MAX_VALUE;
|
|
2552
|
+
s.y < l.y ? u = (r.y + r.h - l.y) / l.h : s.y + s.h > l.y + l.h && (u = (l.y + l.h - r.y) / l.h), s.x < l.x ? d = (r.x + r.w - l.x) / l.w : s.x + s.w > l.x + l.w && (d = (l.x + l.w - r.x) / l.w);
|
|
2553
|
+
const f = Math.min(d, u);
|
|
2554
|
+
f > n && (n = f, o = h);
|
|
2266
2555
|
}
|
|
2267
2556
|
return t.collide = o, o;
|
|
2268
2557
|
}
|
|
@@ -2336,9 +2625,9 @@ class ne {
|
|
|
2336
2625
|
const s = this._inColumnResize;
|
|
2337
2626
|
s || (this._inColumnResize = !0);
|
|
2338
2627
|
const r = this.nodes;
|
|
2339
|
-
return this.nodes = [], r.forEach((o, n,
|
|
2628
|
+
return this.nodes = [], r.forEach((o, n, h) => {
|
|
2340
2629
|
let l;
|
|
2341
|
-
o.locked || (o.autoPosition = !0, e === "list" && n && (l =
|
|
2630
|
+
o.locked || (o.autoPosition = !0, e === "list" && n && (l = h[n - 1])), this.addNode(o, !1, l);
|
|
2342
2631
|
}), s || delete this._inColumnResize, i || this.batchUpdate(!1), this;
|
|
2343
2632
|
}
|
|
2344
2633
|
/** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */
|
|
@@ -2436,11 +2725,11 @@ class ne {
|
|
|
2436
2725
|
const r = s ? s.y * i + (s.x + s.w) : 0;
|
|
2437
2726
|
let o = !1;
|
|
2438
2727
|
for (let n = r; !o; ++n) {
|
|
2439
|
-
const
|
|
2440
|
-
if (
|
|
2728
|
+
const h = n % i, l = Math.floor(n / i);
|
|
2729
|
+
if (h + e.w > i)
|
|
2441
2730
|
continue;
|
|
2442
|
-
const u = { x:
|
|
2443
|
-
t.find((
|
|
2731
|
+
const u = { x: h, y: l, w: e.w, h: e.h };
|
|
2732
|
+
t.find((d) => c.isIntercepted(u, d)) || ((e.x !== h || e.y !== l) && (e._dirty = !0), e.x = h, e.y = l, delete e.autoPosition, o = !0);
|
|
2444
2733
|
}
|
|
2445
2734
|
return o;
|
|
2446
2735
|
}
|
|
@@ -2486,7 +2775,7 @@ class ne {
|
|
|
2486
2775
|
return this._notify(), !0;
|
|
2487
2776
|
}
|
|
2488
2777
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
2489
|
-
const n = this.nodes.find((
|
|
2778
|
+
const n = this.nodes.find((h) => h._id === o._id);
|
|
2490
2779
|
n && (c.copyPos(n, o), n._dirty = !0);
|
|
2491
2780
|
}), this._notify(), !0) : !1;
|
|
2492
2781
|
}
|
|
@@ -2516,17 +2805,17 @@ class ne {
|
|
|
2516
2805
|
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
2517
2806
|
return !1;
|
|
2518
2807
|
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
2519
|
-
let
|
|
2808
|
+
let h = !0;
|
|
2520
2809
|
if (n.length) {
|
|
2521
2810
|
const l = e._moving && !t.nested;
|
|
2522
2811
|
let u = l ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
2523
2812
|
if (l && u && e.grid?.opts?.subGridDynamic && !e.grid._isTemp) {
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2813
|
+
const d = c.areaIntercept(t.rect, u._rect), f = c.area(t.rect), g = c.area(u._rect);
|
|
2814
|
+
d / (f < g ? f : g) > 0.8 && (u.grid.makeSubGrid(u.el, void 0, e), u = void 0);
|
|
2526
2815
|
}
|
|
2527
|
-
u ?
|
|
2816
|
+
u ? h = !this._fixCollisions(e, r, u, t) : (h = !1, i && delete t.pack);
|
|
2528
2817
|
}
|
|
2529
|
-
return
|
|
2818
|
+
return h && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
2530
2819
|
}
|
|
2531
2820
|
getRow() {
|
|
2532
2821
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -2543,8 +2832,8 @@ class ne {
|
|
|
2543
2832
|
save(e = !0, t) {
|
|
2544
2833
|
const i = this._layouts?.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
2545
2834
|
return this.sortNodes(), this.nodes.forEach((o) => {
|
|
2546
|
-
const n = s?.find((l) => l._id === o._id),
|
|
2547
|
-
c.removeInternalForSave(
|
|
2835
|
+
const n = s?.find((l) => l._id === o._id), h = { ...o, ...n || {} };
|
|
2836
|
+
c.removeInternalForSave(h, !e), t && t(o, h), r.push(h);
|
|
2548
2837
|
}), r;
|
|
2549
2838
|
}
|
|
2550
2839
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -2582,19 +2871,19 @@ class ne {
|
|
|
2582
2871
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
2583
2872
|
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
2584
2873
|
if (t > e && this._layouts) {
|
|
2585
|
-
const n = this._layouts[t] || [],
|
|
2586
|
-
!n.length && e !==
|
|
2587
|
-
const u = o.find((
|
|
2874
|
+
const n = this._layouts[t] || [], h = this._layouts.length - 1;
|
|
2875
|
+
!n.length && e !== h && this._layouts[h]?.length && (e = h, this._layouts[h].forEach((l) => {
|
|
2876
|
+
const u = o.find((d) => d._id === l._id);
|
|
2588
2877
|
u && (!s && !l.autoPosition && (u.x = l.x ?? u.x, u.y = l.y ?? u.y), u.w = l.w ?? u.w, (l.x == null || l.y === void 0) && (u.autoPosition = !0));
|
|
2589
2878
|
})), n.forEach((l) => {
|
|
2590
|
-
const u = o.findIndex((
|
|
2879
|
+
const u = o.findIndex((d) => d._id === l._id);
|
|
2591
2880
|
if (u !== -1) {
|
|
2592
|
-
const
|
|
2881
|
+
const d = o[u];
|
|
2593
2882
|
if (s) {
|
|
2594
|
-
|
|
2883
|
+
d.w = l.w;
|
|
2595
2884
|
return;
|
|
2596
2885
|
}
|
|
2597
|
-
(l.autoPosition || isNaN(l.x) || isNaN(l.y)) && this.findEmptyPosition(l, r), l.autoPosition || (
|
|
2886
|
+
(l.autoPosition || isNaN(l.x) || isNaN(l.y)) && this.findEmptyPosition(l, r), l.autoPosition || (d.x = l.x ?? d.x, d.y = l.y ?? d.y, d.w = l.w ?? d.w, r.push(d)), o.splice(u, 1);
|
|
2598
2887
|
}
|
|
2599
2888
|
});
|
|
2600
2889
|
}
|
|
@@ -2605,9 +2894,9 @@ class ne {
|
|
|
2605
2894
|
if (typeof i == "function")
|
|
2606
2895
|
i(t, e, r, o);
|
|
2607
2896
|
else {
|
|
2608
|
-
const n = s || i === "none" ? 1 : t / e,
|
|
2897
|
+
const n = s || i === "none" ? 1 : t / e, h = i === "move" || i === "moveScale", l = i === "scale" || i === "moveScale";
|
|
2609
2898
|
o.forEach((u) => {
|
|
2610
|
-
u.x = t === 1 ? 0 :
|
|
2899
|
+
u.x = t === 1 ? 0 : h ? Math.round(u.x * n) : Math.min(u.x, t - 1), u.w = t === 1 || e === 1 ? 1 : l ? Math.round(u.w * n) || 1 : Math.min(u.w, t), r.push(u);
|
|
2611
2900
|
}), o = [];
|
|
2612
2901
|
}
|
|
2613
2902
|
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((n) => {
|
|
@@ -2626,7 +2915,7 @@ class ne {
|
|
|
2626
2915
|
const s = [];
|
|
2627
2916
|
return e.forEach((r, o) => {
|
|
2628
2917
|
if (r._id === void 0) {
|
|
2629
|
-
const n = r.id ? this.nodes.find((
|
|
2918
|
+
const n = r.id ? this.nodes.find((h) => h.id === r.id) : void 0;
|
|
2630
2919
|
r._id = n?._id ?? ne._idSeq++;
|
|
2631
2920
|
}
|
|
2632
2921
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
@@ -2697,24 +2986,24 @@ class C {
|
|
|
2697
2986
|
const ie = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2698
2987
|
class oe {
|
|
2699
2988
|
}
|
|
2700
|
-
function
|
|
2989
|
+
function Ne(a, e) {
|
|
2701
2990
|
a.touches.length > 1 || (a.cancelable && a.preventDefault(), c.simulateMouseEvent(a.changedTouches[0], e));
|
|
2702
2991
|
}
|
|
2703
2992
|
function Ft(a, e) {
|
|
2704
2993
|
a.cancelable && a.preventDefault(), c.simulateMouseEvent(a, e);
|
|
2705
2994
|
}
|
|
2706
2995
|
function Ae(a) {
|
|
2707
|
-
oe.touchHandled || (oe.touchHandled = !0,
|
|
2708
|
-
}
|
|
2709
|
-
function Oe(a) {
|
|
2710
|
-
oe.touchHandled && Le(a, "mousemove");
|
|
2996
|
+
oe.touchHandled || (oe.touchHandled = !0, Ne(a, "mousedown"));
|
|
2711
2997
|
}
|
|
2712
2998
|
function He(a) {
|
|
2999
|
+
oe.touchHandled && Ne(a, "mousemove");
|
|
3000
|
+
}
|
|
3001
|
+
function Ie(a) {
|
|
2713
3002
|
if (!oe.touchHandled)
|
|
2714
3003
|
return;
|
|
2715
3004
|
oe.pointerLeaveTimeout && (window.clearTimeout(oe.pointerLeaveTimeout), delete oe.pointerLeaveTimeout);
|
|
2716
3005
|
const e = !!C.dragElement;
|
|
2717
|
-
|
|
3006
|
+
Ne(a, "mouseup"), e || Ne(a, "click"), oe.touchHandled = !1;
|
|
2718
3007
|
}
|
|
2719
3008
|
function qe(a) {
|
|
2720
3009
|
a.pointerType !== "mouse" && a.target.releasePointerCapture(a.pointerId);
|
|
@@ -2722,7 +3011,7 @@ function qe(a) {
|
|
|
2722
3011
|
function kt(a) {
|
|
2723
3012
|
C.dragElement && a.pointerType !== "mouse" && Ft(a, "mouseenter");
|
|
2724
3013
|
}
|
|
2725
|
-
function
|
|
3014
|
+
function St(a) {
|
|
2726
3015
|
C.dragElement && a.pointerType !== "mouse" && (oe.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2727
3016
|
delete oe.pointerLeaveTimeout, Ft(a, "mouseleave");
|
|
2728
3017
|
}, 10));
|
|
@@ -2742,7 +3031,7 @@ class Pe {
|
|
|
2742
3031
|
}
|
|
2743
3032
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2744
3033
|
_mouseDown(e) {
|
|
2745
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (this.el.addEventListener("touchmove",
|
|
3034
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (this.el.addEventListener("touchmove", He), this.el.addEventListener("touchend", Ie)), e.stopPropagation(), e.preventDefault();
|
|
2746
3035
|
}
|
|
2747
3036
|
/** @internal */
|
|
2748
3037
|
_mouseMove(e) {
|
|
@@ -2751,7 +3040,7 @@ class Pe {
|
|
|
2751
3040
|
}
|
|
2752
3041
|
/** @internal */
|
|
2753
3042
|
_mouseUp(e) {
|
|
2754
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && (this.el.removeEventListener("touchmove",
|
|
3043
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && (this.el.removeEventListener("touchmove", He), this.el.removeEventListener("touchend", Ie)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2755
3044
|
}
|
|
2756
3045
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2757
3046
|
_keyEvent(e) {
|
|
@@ -2763,7 +3052,7 @@ class Pe {
|
|
|
2763
3052
|
}
|
|
2764
3053
|
}
|
|
2765
3054
|
Pe.prefix = "ui-resizable-";
|
|
2766
|
-
class
|
|
3055
|
+
class tt {
|
|
2767
3056
|
constructor() {
|
|
2768
3057
|
this._eventRegister = {};
|
|
2769
3058
|
}
|
|
@@ -2791,7 +3080,7 @@ class et {
|
|
|
2791
3080
|
return this._eventRegister[e](t);
|
|
2792
3081
|
}
|
|
2793
3082
|
}
|
|
2794
|
-
class Ce extends
|
|
3083
|
+
class Ce extends tt {
|
|
2795
3084
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2796
3085
|
constructor(e, t = {}) {
|
|
2797
3086
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2913,15 +3202,15 @@ class Ce extends et {
|
|
|
2913
3202
|
left: this.originalRect.left,
|
|
2914
3203
|
top: this.originalRect.top - this.scrolled
|
|
2915
3204
|
}, r = e.clientX - i.clientX, o = this.sizeToContent ? 0 : e.clientY - i.clientY;
|
|
2916
|
-
let n,
|
|
2917
|
-
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o,
|
|
2918
|
-
const l = this._constrainSize(s.width, s.height, n,
|
|
3205
|
+
let n, h;
|
|
3206
|
+
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o, h = !0);
|
|
3207
|
+
const l = this._constrainSize(s.width, s.height, n, h);
|
|
2919
3208
|
return Math.round(s.width) !== Math.round(l.width) && (t.indexOf("w") > -1 && (s.left += s.width - l.width), s.width = l.width), Math.round(s.height) !== Math.round(l.height) && (t.indexOf("n") > -1 && (s.top += s.height - l.height), s.height = l.height), s;
|
|
2920
3209
|
}
|
|
2921
3210
|
/** @internal constrain the size to the set min/max values */
|
|
2922
3211
|
_constrainSize(e, t, i, s) {
|
|
2923
|
-
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e,
|
|
2924
|
-
return { width: u, height:
|
|
3212
|
+
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e, h = (s ? r.maxHeightMoveUp : r.maxHeight) || Number.MAX_SAFE_INTEGER, l = r.minHeight / this.rectScale.y || t, u = Math.min(o, Math.max(n, e)), d = Math.min(h, Math.max(l, t));
|
|
3213
|
+
return { width: u, height: d };
|
|
2925
3214
|
}
|
|
2926
3215
|
/** @internal */
|
|
2927
3216
|
_applyChange() {
|
|
@@ -2941,8 +3230,8 @@ class Ce extends et {
|
|
|
2941
3230
|
}
|
|
2942
3231
|
}
|
|
2943
3232
|
Ce._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2944
|
-
const
|
|
2945
|
-
class Re extends
|
|
3233
|
+
const js = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
3234
|
+
class Re extends tt {
|
|
2946
3235
|
constructor(e, t = {}) {
|
|
2947
3236
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
2948
3237
|
xScale: 1,
|
|
@@ -2978,7 +3267,7 @@ class Re extends et {
|
|
|
2978
3267
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2979
3268
|
_mouseDown(e) {
|
|
2980
3269
|
if (!C.mouseHandled)
|
|
2981
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
3270
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(js) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete C.dragElement, delete C.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (e.currentTarget.addEventListener("touchmove", He), e.currentTarget.addEventListener("touchend", Ie)), e.preventDefault(), document.activeElement && document.activeElement.blur(), C.mouseHandled = !0), !0;
|
|
2982
3271
|
}
|
|
2983
3272
|
/** @internal method to call actual drag event */
|
|
2984
3273
|
_callDrag(e) {
|
|
@@ -3007,7 +3296,7 @@ class Re extends et {
|
|
|
3007
3296
|
}
|
|
3008
3297
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
3009
3298
|
_mouseUp(e) {
|
|
3010
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && e.currentTarget && (e.currentTarget.removeEventListener("touchmove",
|
|
3299
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", He, !0), e.currentTarget.removeEventListener("touchend", Ie, !0)), this.dragging) {
|
|
3011
3300
|
delete this.dragging, delete this.el.gridstackNode?._origRotate, document.removeEventListener("keydown", this._keyEvent), C.dropElement?.el === this.el.parentElement && delete C.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
3012
3301
|
const t = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
3013
3302
|
this.option.stop && this.option.stop(t), this.triggerEvent("dragstop", t), C.dropElement && C.dropElement.drop(e);
|
|
@@ -3085,7 +3374,7 @@ class Re extends et {
|
|
|
3085
3374
|
}
|
|
3086
3375
|
}
|
|
3087
3376
|
Re.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
3088
|
-
class Zs extends
|
|
3377
|
+
class Zs extends tt {
|
|
3089
3378
|
constructor(e, t = {}) {
|
|
3090
3379
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
3091
3380
|
}
|
|
@@ -3096,10 +3385,10 @@ class Zs extends et {
|
|
|
3096
3385
|
super.off(e);
|
|
3097
3386
|
}
|
|
3098
3387
|
enable() {
|
|
3099
|
-
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), ie && (this.el.addEventListener("pointerenter", kt), this.el.addEventListener("pointerleave",
|
|
3388
|
+
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), ie && (this.el.addEventListener("pointerenter", kt), this.el.addEventListener("pointerleave", St)));
|
|
3100
3389
|
}
|
|
3101
3390
|
disable(e = !1) {
|
|
3102
|
-
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), ie && (this.el.removeEventListener("pointerenter", kt), this.el.removeEventListener("pointerleave",
|
|
3391
|
+
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), ie && (this.el.removeEventListener("pointerenter", kt), this.el.removeEventListener("pointerleave", St)));
|
|
3103
3392
|
}
|
|
3104
3393
|
destroy() {
|
|
3105
3394
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -3150,9 +3439,9 @@ class Zs extends et {
|
|
|
3150
3439
|
};
|
|
3151
3440
|
}
|
|
3152
3441
|
}
|
|
3153
|
-
class
|
|
3442
|
+
class it {
|
|
3154
3443
|
static init(e) {
|
|
3155
|
-
return e.ddElement || (e.ddElement = new
|
|
3444
|
+
return e.ddElement || (e.ddElement = new it(e)), e.ddElement;
|
|
3156
3445
|
}
|
|
3157
3446
|
constructor(e) {
|
|
3158
3447
|
this.el = e;
|
|
@@ -3182,7 +3471,7 @@ class tt {
|
|
|
3182
3471
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
3183
3472
|
}
|
|
3184
3473
|
}
|
|
3185
|
-
class
|
|
3474
|
+
class Xs {
|
|
3186
3475
|
resizable(e, t, i, s) {
|
|
3187
3476
|
return this._getDDElements(e, t).forEach((r) => {
|
|
3188
3477
|
if (t === "disable" || t === "enable")
|
|
@@ -3193,12 +3482,12 @@ class Js {
|
|
|
3193
3482
|
r.setupResizable({ [i]: s });
|
|
3194
3483
|
else {
|
|
3195
3484
|
const n = r.el.gridstackNode.grid;
|
|
3196
|
-
let
|
|
3197
|
-
|
|
3485
|
+
let h = r.el.getAttribute("gs-resize-handles") || n.opts.resizable.handles || "e,s,se";
|
|
3486
|
+
h === "all" && (h = "n,e,s,w,se,sw,ne,nw");
|
|
3198
3487
|
const l = !n.opts.alwaysShowResizeHandle;
|
|
3199
3488
|
r.setupResizable({
|
|
3200
3489
|
...n.opts.resizable,
|
|
3201
|
-
handles:
|
|
3490
|
+
handles: h,
|
|
3202
3491
|
autoHide: l,
|
|
3203
3492
|
start: t.start,
|
|
3204
3493
|
stop: t.stop,
|
|
@@ -3258,10 +3547,10 @@ class Js {
|
|
|
3258
3547
|
/** @internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable */
|
|
3259
3548
|
_getDDElements(e, t) {
|
|
3260
3549
|
const i = e.gridstack || t !== "destroy" && t !== "disable", s = c.getElements(e);
|
|
3261
|
-
return s.length ? s.map((o) => o.ddElement || (i ?
|
|
3550
|
+
return s.length ? s.map((o) => o.ddElement || (i ? it.init(o) : null)).filter((o) => o) : [];
|
|
3262
3551
|
}
|
|
3263
3552
|
}
|
|
3264
|
-
const G = new
|
|
3553
|
+
const G = new Xs();
|
|
3265
3554
|
class _ {
|
|
3266
3555
|
/**
|
|
3267
3556
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -3344,13 +3633,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3344
3633
|
let s = t.columnOpts?.breakpoints;
|
|
3345
3634
|
const r = t;
|
|
3346
3635
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
3347
|
-
const
|
|
3636
|
+
const d = r.oneColumnSize || 768;
|
|
3348
3637
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
3349
3638
|
let f = s.find((g) => g.c === 1);
|
|
3350
|
-
f ? f.w =
|
|
3639
|
+
f ? f.w = d : (f = { c: 1, w: d }, s.push(f, { c: 12, w: d + 1 }));
|
|
3351
3640
|
}
|
|
3352
3641
|
const o = t.columnOpts;
|
|
3353
|
-
o && (!o.columnWidth && !o.breakpoints?.length ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), s?.length > 1 && s.sort((
|
|
3642
|
+
o && (!o.columnWidth && !o.breakpoints?.length ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), s?.length > 1 && s.sort((d, f) => (f.w || 0) - (d.w || 0));
|
|
3354
3643
|
const n = {
|
|
3355
3644
|
...c.cloneDeep(Y),
|
|
3356
3645
|
column: c.toNumber(e.getAttribute("gs-column")) || Y.column,
|
|
@@ -3374,18 +3663,18 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3374
3663
|
column: this.getColumn(),
|
|
3375
3664
|
float: t.float,
|
|
3376
3665
|
maxRow: t.maxRow,
|
|
3377
|
-
onChange: (
|
|
3666
|
+
onChange: (d) => {
|
|
3378
3667
|
let f = 0;
|
|
3379
3668
|
this.engine.nodes.forEach((g) => {
|
|
3380
3669
|
f = Math.max(f, g.y + g.h);
|
|
3381
|
-
}),
|
|
3670
|
+
}), d.forEach((g) => {
|
|
3382
3671
|
const m = g.el;
|
|
3383
3672
|
m && (g._removeDOM ? (m && m.remove(), delete g._removeDOM) : this._writePosAttr(m, g));
|
|
3384
3673
|
}), this._updateStyles(!1, f);
|
|
3385
3674
|
}
|
|
3386
|
-
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((
|
|
3387
|
-
const
|
|
3388
|
-
delete t.children,
|
|
3675
|
+
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((d) => this._prepareElement(d)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
3676
|
+
const d = t.children;
|
|
3677
|
+
delete t.children, d.length && this.load(d);
|
|
3389
3678
|
}
|
|
3390
3679
|
this.setAnimation(), t.subGridDynamic && !C.pauseDrag && (C.pauseDrag = !0), t.draggable?.pause !== void 0 && (C.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
3391
3680
|
}
|
|
@@ -3452,15 +3741,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3452
3741
|
...o || {},
|
|
3453
3742
|
...t || r.subGridOpts || {}
|
|
3454
3743
|
}), r.subGridOpts = t;
|
|
3455
|
-
let
|
|
3456
|
-
t.column === "auto" && (
|
|
3457
|
-
let l = r.el.querySelector(".grid-stack-item-content"), u,
|
|
3458
|
-
if (s && (this._removeDD(r.el),
|
|
3459
|
-
const g =
|
|
3744
|
+
let h;
|
|
3745
|
+
t.column === "auto" && (h = !0, t.column = Math.max(r.w || 1, i?.w || 1), delete t.columnOpts);
|
|
3746
|
+
let l = r.el.querySelector(".grid-stack-item-content"), u, d;
|
|
3747
|
+
if (s && (this._removeDD(r.el), d = { ...r, x: 0, y: 0 }, c.removeInternalForSave(d), delete d.subGridOpts, r.content && (d.content = r.content, delete r.content), _.addRemoveCB ? u = _.addRemoveCB(this.el, d, !0, !1) : (u = c.createDiv(["grid-stack-item"]), u.appendChild(l), l = c.createDiv(["grid-stack-item-content"], r.el)), this.prepareDragDrop(r.el)), i) {
|
|
3748
|
+
const g = h ? t.column : r.w, m = r.h + i.h, v = r.el.style;
|
|
3460
3749
|
v.transition = "none", this.update(r.el, { w: g, h: m }), setTimeout(() => v.transition = null);
|
|
3461
3750
|
}
|
|
3462
3751
|
const f = r.subGrid = _.addGrid(l, t);
|
|
3463
|
-
return i?._moving && (f._isTemp = !0),
|
|
3752
|
+
return i?._moving && (f._isTemp = !0), h && (f._autoColumn = !0), s && f.makeWidget(u, d), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
3464
3753
|
}
|
|
3465
3754
|
/**
|
|
3466
3755
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -3530,13 +3819,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3530
3819
|
return;
|
|
3531
3820
|
c.find(e, u.id) || (_.addRemoveCB && _.addRemoveCB(this.el, u, !1, !1), o.push(u), this.removeWidget(u.el, !0, !1));
|
|
3532
3821
|
}), this.engine._loading = !0;
|
|
3533
|
-
const
|
|
3534
|
-
return this.engine.nodes = this.engine.nodes.filter((l) => c.find(e, l.id) ? (
|
|
3535
|
-
const u = c.find(
|
|
3822
|
+
const h = [];
|
|
3823
|
+
return this.engine.nodes = this.engine.nodes.filter((l) => c.find(e, l.id) ? (h.push(l), !1) : !0), e.forEach((l) => {
|
|
3824
|
+
const u = c.find(h, l.id);
|
|
3536
3825
|
if (u) {
|
|
3537
3826
|
if (c.shouldSizeToContent(u) && (l.h = u.h), this.engine.nodeBoundFix(l), (l.autoPosition || l.x === void 0 || l.y === void 0) && (l.w = l.w || u.w, l.h = l.h || u.h, this.engine.findEmptyPosition(l)), this.engine.nodes.push(u), c.samePos(u, l) && this.engine.nodes.length > 1 && (this.moveNode(u, { ...l, forceCollide: !0 }), c.copyPos(l, u)), this.update(u.el, l), l.subGridOpts?.children) {
|
|
3538
|
-
const
|
|
3539
|
-
|
|
3827
|
+
const d = u.el.querySelector(".grid-stack");
|
|
3828
|
+
d && d.gridstack && d.gridstack.load(l.subGridOpts.children);
|
|
3540
3829
|
}
|
|
3541
3830
|
} else t && this.addWidget(l);
|
|
3542
3831
|
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? _.addRemoveCB = r : delete _.addRemoveCB, n && this.opts?.animate && this.setAnimation(this.opts.animate, !0), this;
|
|
@@ -3694,8 +3983,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3694
3983
|
const i = this.el.getBoundingClientRect();
|
|
3695
3984
|
let s;
|
|
3696
3985
|
t ? s = { top: i.top + document.documentElement.scrollTop, left: i.left } : s = { top: this.el.offsetTop, left: this.el.offsetLeft };
|
|
3697
|
-
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(),
|
|
3698
|
-
return { x: Math.floor(r / n), y: Math.floor(o /
|
|
3986
|
+
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(), h = i.height / parseInt(this.el.getAttribute("gs-current-row"));
|
|
3987
|
+
return { x: Math.floor(r / n), y: Math.floor(o / h) };
|
|
3699
3988
|
}
|
|
3700
3989
|
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
3701
3990
|
getRow() {
|
|
@@ -3829,14 +4118,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3829
4118
|
const u = i.querySelector(".grid-stack-item-content");
|
|
3830
4119
|
u && u.textContent !== r.content && (s.content = r.content, _.renderCB(u, r), s.subGrid?.el && (u.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3831
4120
|
}
|
|
3832
|
-
let
|
|
4121
|
+
let h = !1, l = !1;
|
|
3833
4122
|
for (const u in r)
|
|
3834
|
-
u[0] !== "_" && s[u] !== r[u] && (s[u] = r[u],
|
|
4123
|
+
u[0] !== "_" && s[u] !== r[u] && (s[u] = r[u], h = !0, l = l || !this.opts.staticGrid && (u === "noResize" || u === "noMove" || u === "locked"));
|
|
3835
4124
|
if (c.sanitizeMinMax(s), n) {
|
|
3836
4125
|
const u = n.w !== void 0 && n.w !== s.w;
|
|
3837
4126
|
this.moveNode(s, n), u && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(u, s), delete s._orig;
|
|
3838
4127
|
}
|
|
3839
|
-
(n ||
|
|
4128
|
+
(n || h) && this._writeAttr(i, s), l && this.prepareDragDrop(s.el);
|
|
3840
4129
|
}), this;
|
|
3841
4130
|
}
|
|
3842
4131
|
moveNode(e, t) {
|
|
@@ -3864,7 +4153,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3864
4153
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3865
4154
|
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(_.resizeToContentParent)), !o)
|
|
3866
4155
|
return;
|
|
3867
|
-
const n = e.clientHeight - o.clientHeight,
|
|
4156
|
+
const n = e.clientHeight - o.clientHeight, h = t.h ? t.h * s - n : o.clientHeight;
|
|
3868
4157
|
let l;
|
|
3869
4158
|
if (t.subGrid) {
|
|
3870
4159
|
l = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
@@ -3879,15 +4168,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3879
4168
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3880
4169
|
return;
|
|
3881
4170
|
}
|
|
3882
|
-
l = f.getBoundingClientRect().height ||
|
|
4171
|
+
l = f.getBoundingClientRect().height || h;
|
|
3883
4172
|
}
|
|
3884
4173
|
}
|
|
3885
|
-
if (
|
|
4174
|
+
if (h === l)
|
|
3886
4175
|
return;
|
|
3887
|
-
r += l -
|
|
4176
|
+
r += l - h;
|
|
3888
4177
|
let u = Math.ceil(r / s);
|
|
3889
|
-
const
|
|
3890
|
-
|
|
4178
|
+
const d = Number.isInteger(t.sizeToContent) ? t.sizeToContent : 0;
|
|
4179
|
+
d && u > d && (u = d, e.classList.add("size-to-content-max")), t.minH && u < t.minH ? u = t.minH : t.maxH && u > t.maxH && (u = t.maxH), u !== t.h && (i._ignoreLayoutsNodeChange = !0, i.moveNode(t, { h: u }), delete i._ignoreLayoutsNodeChange);
|
|
3891
4180
|
}
|
|
3892
4181
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3893
4182
|
resizeToContentCBCheck(e) {
|
|
@@ -3904,8 +4193,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3904
4193
|
return;
|
|
3905
4194
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3906
4195
|
if (t) {
|
|
3907
|
-
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0,
|
|
3908
|
-
r.x = s.x + n - (s.h - (
|
|
4196
|
+
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0, h = t.top > 0 ? Math.floor(t.top / this.opts.cellHeight) : 0;
|
|
4197
|
+
r.x = s.x + n - (s.h - (h + 1)), r.y = s.y + h - n;
|
|
3909
4198
|
}
|
|
3910
4199
|
Object.keys(r).forEach((n) => {
|
|
3911
4200
|
r[n] === void 0 && delete r[n];
|
|
@@ -4006,8 +4295,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4006
4295
|
}), !this._styles)
|
|
4007
4296
|
return this;
|
|
4008
4297
|
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
4009
|
-
const n = this.opts.marginTop + this.opts.marginUnit,
|
|
4010
|
-
c.addCSSRule(this._styles,
|
|
4298
|
+
const n = this.opts.marginTop + this.opts.marginUnit, h = this.opts.marginBottom + this.opts.marginUnit, l = this.opts.marginRight + this.opts.marginUnit, u = this.opts.marginLeft + this.opts.marginUnit, d = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
4299
|
+
c.addCSSRule(this._styles, d, `top: ${n}; right: ${l}; bottom: ${h}; left: ${u};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${l}; bottom: ${h}; left: ${u};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${l}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${l}; bottom: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${u}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${u}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${u}; bottom: ${h}`);
|
|
4011
4300
|
}
|
|
4012
4301
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
4013
4302
|
const o = (n) => i * n + s;
|
|
@@ -4251,26 +4540,26 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4251
4540
|
const f = o.getBoundingClientRect();
|
|
4252
4541
|
o.style.left = f.x + (this.dragTransform.xScale - 1) * (s.clientX - f.x) / this.dragTransform.xScale + "px", o.style.top = f.y + (this.dragTransform.yScale - 1) * (s.clientY - f.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
4253
4542
|
}
|
|
4254
|
-
let { top:
|
|
4543
|
+
let { top: h, left: l } = o.getBoundingClientRect();
|
|
4255
4544
|
const u = this.el.getBoundingClientRect();
|
|
4256
|
-
l -= u.left,
|
|
4257
|
-
const
|
|
4545
|
+
l -= u.left, h -= u.top;
|
|
4546
|
+
const d = {
|
|
4258
4547
|
position: {
|
|
4259
|
-
top:
|
|
4548
|
+
top: h * this.dragTransform.xScale,
|
|
4260
4549
|
left: l * this.dragTransform.yScale
|
|
4261
4550
|
}
|
|
4262
4551
|
};
|
|
4263
4552
|
if (n._temporaryRemoved) {
|
|
4264
|
-
if (n.x = Math.max(0, Math.round(l / t)), n.y = Math.max(0, Math.round(
|
|
4553
|
+
if (n.x = Math.max(0, Math.round(l / t)), n.y = Math.max(0, Math.round(h / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
4265
4554
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
4266
4555
|
G.off(r, "drag");
|
|
4267
4556
|
return;
|
|
4268
4557
|
}
|
|
4269
4558
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
4270
4559
|
}
|
|
4271
|
-
this._onStartMoving(o, s,
|
|
4560
|
+
this._onStartMoving(o, s, d, n, t, e);
|
|
4272
4561
|
} else
|
|
4273
|
-
this._dragOrResize(o, s,
|
|
4562
|
+
this._dragOrResize(o, s, d, n, t, e);
|
|
4274
4563
|
};
|
|
4275
4564
|
return G.droppable(this.el, {
|
|
4276
4565
|
accept: (s) => {
|
|
@@ -4309,9 +4598,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4309
4598
|
n || (n = this._readAttr(o)), n._sidebarOrig = { w: n.w, h: n.h };
|
|
4310
4599
|
}
|
|
4311
4600
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
4312
|
-
const
|
|
4313
|
-
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w:
|
|
4314
|
-
n._temporaryRemoved = !0) : (n.w =
|
|
4601
|
+
const h = n.w || Math.round(o.offsetWidth / t) || 1, l = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
4602
|
+
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: h, h: l, 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
|
|
4603
|
+
n._temporaryRemoved = !0) : (n.w = h, n.h = l, n._temporaryRemoved = !0), _._itemRemoving(n.el, !1), G.on(r, "drag", i), i(s, r, o), !1;
|
|
4315
4604
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
4316
4605
|
const n = o?.gridstackNode || r.gridstackNode;
|
|
4317
4606
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
@@ -4319,19 +4608,19 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4319
4608
|
const n = o?.gridstackNode || r.gridstackNode;
|
|
4320
4609
|
if (n?.grid === this && !n._isExternal)
|
|
4321
4610
|
return !1;
|
|
4322
|
-
const
|
|
4611
|
+
const h = !!this.placeholder.parentElement, l = r !== o;
|
|
4323
4612
|
this.placeholder.remove(), delete this.placeholder.gridstackNode;
|
|
4324
|
-
const u =
|
|
4613
|
+
const u = h && this.opts.animate;
|
|
4325
4614
|
u && this.setAnimation(!1);
|
|
4326
|
-
const
|
|
4327
|
-
if (delete r._gridstackNodeOrig,
|
|
4328
|
-
const g =
|
|
4329
|
-
g.engine.removeNodeFromLayoutCache(
|
|
4615
|
+
const d = r._gridstackNodeOrig;
|
|
4616
|
+
if (delete r._gridstackNodeOrig, h && d?.grid && d.grid !== this) {
|
|
4617
|
+
const g = d.grid;
|
|
4618
|
+
g.engine.removeNodeFromLayoutCache(d), g.engine.removedNodes.push(d), g._triggerRemoveEvent()._triggerChangeEvent(), g.parentGridNode && !g.engine.nodes.length && g.opts.subGridDynamic && g.removeAsSubGrid();
|
|
4330
4619
|
}
|
|
4331
|
-
if (!n || (
|
|
4620
|
+
if (!n || (h && (this.engine.cleanupNode(n), n.grid = this), delete n.grid?._isTemp, G.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !h))
|
|
4332
4621
|
return !1;
|
|
4333
4622
|
const f = n.subGrid?.el?.gridstack;
|
|
4334
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), l && (n.content || n.subGridOpts || _.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" },
|
|
4623
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), l && (n.content || n.subGridOpts || _.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" }, d && d.grid ? d : void 0, n), u && this.setAnimation(this.opts.animate, !0), !1;
|
|
4335
4624
|
}), this;
|
|
4336
4625
|
}
|
|
4337
4626
|
/** @internal mark item for removal */
|
|
@@ -4361,12 +4650,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4361
4650
|
if ((t || o) && (i._initDD && (this._removeDD(e), delete i._initDD), o && e.classList.add("ui-draggable-disabled", "ui-resizable-disabled"), !t))
|
|
4362
4651
|
return this;
|
|
4363
4652
|
if (!i._initDD) {
|
|
4364
|
-
let n,
|
|
4653
|
+
let n, h;
|
|
4365
4654
|
const l = (f, g) => {
|
|
4366
|
-
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(),
|
|
4655
|
+
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(), h = this.getCellHeight(!0), this._onStartMoving(e, f, g, i, n, h);
|
|
4367
4656
|
}, u = (f, g) => {
|
|
4368
|
-
this._dragOrResize(e, f, g, i, n,
|
|
4369
|
-
},
|
|
4657
|
+
this._dragOrResize(e, f, g, i, n, h);
|
|
4658
|
+
}, d = (f) => {
|
|
4370
4659
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete i._moving, delete i._event, delete i._lastTried;
|
|
4371
4660
|
const g = i.w !== i._orig.w, m = f.target;
|
|
4372
4661
|
if (!(!m.gridstackNode || m.gridstackNode.grid !== this)) {
|
|
@@ -4380,11 +4669,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4380
4669
|
};
|
|
4381
4670
|
G.draggable(e, {
|
|
4382
4671
|
start: l,
|
|
4383
|
-
stop:
|
|
4672
|
+
stop: d,
|
|
4384
4673
|
drag: u
|
|
4385
4674
|
}).resizable(e, {
|
|
4386
4675
|
start: l,
|
|
4387
|
-
stop:
|
|
4676
|
+
stop: d,
|
|
4388
4677
|
resize: u
|
|
4389
4678
|
}), i._initDD = !0;
|
|
4390
4679
|
}
|
|
@@ -4405,46 +4694,46 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4405
4694
|
yOffset: 0
|
|
4406
4695
|
};
|
|
4407
4696
|
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") {
|
|
4408
|
-
const n = this.getColumn() - s.x,
|
|
4409
|
-
G.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, n)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1,
|
|
4697
|
+
const n = this.getColumn() - s.x, h = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
4698
|
+
G.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, n)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, h)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, n)).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));
|
|
4410
4699
|
}
|
|
4411
4700
|
}
|
|
4412
4701
|
/** @internal handles actual drag/resize */
|
|
4413
4702
|
_dragOrResize(e, t, i, s, r, o) {
|
|
4414
4703
|
const n = { ...s._orig };
|
|
4415
|
-
let
|
|
4704
|
+
let h, l = this.opts.marginLeft, u = this.opts.marginRight, d = this.opts.marginTop, f = this.opts.marginBottom;
|
|
4416
4705
|
const g = Math.round(o * 0.1), m = Math.round(r * 0.1);
|
|
4417
|
-
if (l = Math.min(l, m), u = Math.min(u, m),
|
|
4706
|
+
if (l = Math.min(l, m), u = Math.min(u, m), d = Math.min(d, g), f = Math.min(f, g), t.type === "drag") {
|
|
4418
4707
|
if (s._temporaryRemoved)
|
|
4419
4708
|
return;
|
|
4420
4709
|
const p = i.position.top - s._prevYPix;
|
|
4421
4710
|
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, p);
|
|
4422
|
-
const
|
|
4423
|
-
n.x = Math.round(
|
|
4711
|
+
const k = i.position.left + (i.position.left > s._lastUiPosition.left ? -u : l), x = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : d);
|
|
4712
|
+
n.x = Math.round(k / r), n.y = Math.round(x / o);
|
|
4424
4713
|
const y = this._extraDragRow;
|
|
4425
4714
|
if (this.engine.collide(s, n)) {
|
|
4426
|
-
const
|
|
4427
|
-
let D = Math.max(0, n.y + s.h -
|
|
4428
|
-
this.opts.maxRow &&
|
|
4715
|
+
const I = this.getRow();
|
|
4716
|
+
let D = Math.max(0, n.y + s.h - I);
|
|
4717
|
+
this.opts.maxRow && I + D > this.opts.maxRow && (D = Math.max(0, this.opts.maxRow - I)), this._extraDragRow = D;
|
|
4429
4718
|
} else
|
|
4430
4719
|
this._extraDragRow = 0;
|
|
4431
4720
|
if (this._extraDragRow !== y && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
4432
4721
|
return;
|
|
4433
4722
|
} else if (t.type === "resize") {
|
|
4434
|
-
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - l) / r), n.h = Math.round((i.size.height -
|
|
4723
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - l) / r), n.h = Math.round((i.size.height - d) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
4435
4724
|
return;
|
|
4436
|
-
const p = i.position.left + l,
|
|
4437
|
-
n.x = Math.round(p / r), n.y = Math.round(
|
|
4725
|
+
const p = i.position.left + l, k = i.position.top + d;
|
|
4726
|
+
n.x = Math.round(p / r), n.y = Math.round(k / o), h = !0;
|
|
4438
4727
|
}
|
|
4439
4728
|
s._event = t, s._lastTried = n;
|
|
4440
4729
|
const v = {
|
|
4441
4730
|
x: i.position.left + l,
|
|
4442
|
-
y: i.position.top +
|
|
4731
|
+
y: i.position.top + d,
|
|
4443
4732
|
w: (i.size ? i.size.width : s.w * r) - l - u,
|
|
4444
|
-
h: (i.size ? i.size.height : s.h * o) -
|
|
4733
|
+
h: (i.size ? i.size.height : s.h * o) - d - f
|
|
4445
4734
|
};
|
|
4446
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: v, resizing:
|
|
4447
|
-
s._lastUiPosition = i.position, this.engine.cacheRects(r, o,
|
|
4735
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: v, resizing: h })) {
|
|
4736
|
+
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, d, u, f, l), delete s._skipDown, h && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
4448
4737
|
const p = t.target;
|
|
4449
4738
|
s._sidebarOrig || this._writePosAttr(p, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, p);
|
|
4450
4739
|
}
|
|
@@ -4464,7 +4753,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4464
4753
|
}
|
|
4465
4754
|
// legacy method removed
|
|
4466
4755
|
commit() {
|
|
4467
|
-
return
|
|
4756
|
+
return Ys(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
4468
4757
|
}
|
|
4469
4758
|
}
|
|
4470
4759
|
_.renderCB = (a, e) => {
|
|
@@ -4474,18 +4763,18 @@ _.resizeToContentParent = ".grid-stack-item-content";
|
|
|
4474
4763
|
_.Utils = c;
|
|
4475
4764
|
_.Engine = ne;
|
|
4476
4765
|
_.GDRev = "11.5.1";
|
|
4477
|
-
const
|
|
4766
|
+
const Js = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], er = { class: "grid-stack-item-content" }, tr = /* @__PURE__ */ K({
|
|
4478
4767
|
__name: "DraggableGridLayout",
|
|
4479
4768
|
props: {
|
|
4480
4769
|
tiles: {},
|
|
4481
4770
|
tileHeight: { default: Se },
|
|
4482
|
-
columns: { default:
|
|
4771
|
+
columns: { default: Ze }
|
|
4483
4772
|
},
|
|
4484
4773
|
emits: ["update-tiles"],
|
|
4485
4774
|
setup(a, { expose: e, emit: t }) {
|
|
4486
|
-
const i = a, s = t, r =
|
|
4775
|
+
const i = a, s = t, r = L(null), o = L(new Map(i.tiles.map((g) => [`${g.id}`, g])));
|
|
4487
4776
|
let n = null;
|
|
4488
|
-
const
|
|
4777
|
+
const h = (g) => `[data-id="${g}"]`, l = (g) => g.map((m) => {
|
|
4489
4778
|
const v = o.value.get(`${m.el?.getAttribute("data-id")}`);
|
|
4490
4779
|
if (v)
|
|
4491
4780
|
return {
|
|
@@ -4499,25 +4788,25 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4499
4788
|
n && (l(m).forEach((p) => {
|
|
4500
4789
|
o.value.set(`${p.id}`, p);
|
|
4501
4790
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4502
|
-
},
|
|
4791
|
+
}, d = (g, m) => {
|
|
4503
4792
|
m.forEach((v) => {
|
|
4504
4793
|
o.value.delete(`${v.el?.getAttribute("data-id")}`);
|
|
4505
4794
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
4506
4795
|
};
|
|
4507
|
-
|
|
4796
|
+
Oe(() => {
|
|
4508
4797
|
r.value && (n = _.init({
|
|
4509
4798
|
margin: 10,
|
|
4510
4799
|
column: i.columns,
|
|
4511
4800
|
cellHeight: i.tileHeight,
|
|
4512
4801
|
resizable: { handles: "se, sw" },
|
|
4513
4802
|
handle: ".tile-header"
|
|
4514
|
-
}, r.value), n.on("change", u), n.on("added", u), n.on("removed",
|
|
4515
|
-
}),
|
|
4803
|
+
}, r.value), n.on("change", u), n.on("added", u), n.on("removed", d));
|
|
4804
|
+
}), Te(() => {
|
|
4516
4805
|
n && n.destroy(!1);
|
|
4517
4806
|
});
|
|
4518
4807
|
const f = (g) => {
|
|
4519
4808
|
if (n && r.value) {
|
|
4520
|
-
const m = r.value.querySelector(
|
|
4809
|
+
const m = r.value.querySelector(h(g));
|
|
4521
4810
|
m && n.removeWidget(m);
|
|
4522
4811
|
}
|
|
4523
4812
|
};
|
|
@@ -4525,13 +4814,13 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4525
4814
|
if (g > m && n) {
|
|
4526
4815
|
const v = i.tiles.slice(m);
|
|
4527
4816
|
for (const p of v)
|
|
4528
|
-
o.value.set(`${p.id}`, p), await Ye(), n.makeWidget(
|
|
4817
|
+
o.value.set(`${p.id}`, p), await Ye(), n.makeWidget(h(p.id), {
|
|
4529
4818
|
autoPosition: !0,
|
|
4530
4819
|
w: p.layout.size.cols,
|
|
4531
4820
|
h: p.layout.size.rows
|
|
4532
4821
|
});
|
|
4533
4822
|
}
|
|
4534
|
-
}),
|
|
4823
|
+
}), Dt(() => {
|
|
4535
4824
|
i.tiles.forEach((g) => {
|
|
4536
4825
|
o.value.set(`${g.id}`, g);
|
|
4537
4826
|
});
|
|
@@ -4540,7 +4829,7 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4540
4829
|
ref: r,
|
|
4541
4830
|
class: "grid-stack"
|
|
4542
4831
|
}, [
|
|
4543
|
-
(w(!0), P(Ve, null,
|
|
4832
|
+
(w(!0), P(Ve, null, Ht(i.tiles, (v) => (w(), P("div", {
|
|
4544
4833
|
key: v.id,
|
|
4545
4834
|
class: "grid-stack-item",
|
|
4546
4835
|
"data-id": `${v.id}`,
|
|
@@ -4551,13 +4840,13 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4551
4840
|
"gs-x": v.layout.position.col,
|
|
4552
4841
|
"gs-y": v.layout.position.row
|
|
4553
4842
|
}, [
|
|
4554
|
-
Q("div",
|
|
4843
|
+
Q("div", er, [
|
|
4555
4844
|
Ee(g.$slots, "tile", { tile: v }, void 0, !0)
|
|
4556
4845
|
])
|
|
4557
|
-
], 8,
|
|
4846
|
+
], 8, Js))), 128))
|
|
4558
4847
|
], 512));
|
|
4559
4848
|
}
|
|
4560
|
-
}),
|
|
4849
|
+
}), ir = /* @__PURE__ */ fe(tr, [["__scopeId", "data-v-1fdec94c"]]), sr = (a) => {
|
|
4561
4850
|
const e = {
|
|
4562
4851
|
...a.meta,
|
|
4563
4852
|
chart: { ...a.meta.chart }
|
|
@@ -4574,47 +4863,47 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4574
4863
|
size: a.layout.size
|
|
4575
4864
|
}
|
|
4576
4865
|
};
|
|
4577
|
-
},
|
|
4866
|
+
}, rr = {
|
|
4578
4867
|
key: 0,
|
|
4579
4868
|
class: "fullscreen-header"
|
|
4580
|
-
},
|
|
4869
|
+
}, nr = {
|
|
4581
4870
|
key: 0,
|
|
4582
4871
|
class: "tile-container slottable-tile"
|
|
4583
|
-
},
|
|
4872
|
+
}, or = /* @__PURE__ */ K({
|
|
4584
4873
|
__name: "DashboardRenderer",
|
|
4585
|
-
props: /* @__PURE__ */
|
|
4874
|
+
props: /* @__PURE__ */ Le({
|
|
4586
4875
|
context: {},
|
|
4587
4876
|
preview: { type: Boolean, default: !1 }
|
|
4588
4877
|
}, {
|
|
4589
4878
|
modelValue: { required: !0 },
|
|
4590
4879
|
modelModifiers: {}
|
|
4591
4880
|
}),
|
|
4592
|
-
emits: /* @__PURE__ */
|
|
4881
|
+
emits: /* @__PURE__ */ Le(["edit-tile", "tile-time-range-zoom", "tiles-loaded"], ["update:modelValue"]),
|
|
4593
4882
|
setup(a, { expose: e, emit: t }) {
|
|
4594
4883
|
Qe((S) => ({
|
|
4595
4884
|
v021bbed1: u.value
|
|
4596
4885
|
}));
|
|
4597
|
-
const i = t, s = Nt(a, "modelValue"), { i18n: r } = j.useI18n(), o =
|
|
4886
|
+
const i = t, s = Nt(a, "modelValue"), { i18n: r } = j.useI18n(), o = L(0), n = L(null), h = L(), l = L(), u = L("scale(1)"), d = /* @__PURE__ */ new Set(), f = le(ce);
|
|
4598
4887
|
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")), j.useRequestQueue();
|
|
4599
4888
|
const { exportPdf: g, exportState: m } = j.useExportPdf(l), v = (S) => {
|
|
4600
|
-
|
|
4601
|
-
const z =
|
|
4602
|
-
|
|
4889
|
+
d.add(S.id);
|
|
4890
|
+
const z = k.value.filter((B) => !y(B)).length;
|
|
4891
|
+
d.size >= z && i("tiles-loaded", !0);
|
|
4603
4892
|
}, p = (S, z) => {
|
|
4604
4893
|
const B = S.layout.position.row - z.layout.position.row;
|
|
4605
4894
|
return B !== 0 ? B : S.layout.position.col - z.layout.position.col;
|
|
4606
|
-
},
|
|
4895
|
+
}, k = b(() => s.value.tiles.map((S) => {
|
|
4607
4896
|
let z = S.definition;
|
|
4608
|
-
const B = S.type ?? "chart",
|
|
4609
|
-
if (B === "chart" && "description" in
|
|
4610
|
-
const $ = z, ee =
|
|
4611
|
-
const { timeSpec:
|
|
4897
|
+
const B = S.type ?? "chart", H = z.chart;
|
|
4898
|
+
if (B === "chart" && "description" in H) {
|
|
4899
|
+
const $ = z, ee = H.description?.replace(Qi, () => {
|
|
4900
|
+
const { timeSpec: de } = J.value, De = `renderer.trendRange.${de.type === "absolute" ? "custom" : de.time_range}`;
|
|
4612
4901
|
return r.te(De) ? r.t(De) : "";
|
|
4613
4902
|
});
|
|
4614
4903
|
z = {
|
|
4615
4904
|
...$,
|
|
4616
4905
|
chart: {
|
|
4617
|
-
...
|
|
4906
|
+
...H,
|
|
4618
4907
|
description: ee
|
|
4619
4908
|
}
|
|
4620
4909
|
};
|
|
@@ -4632,20 +4921,20 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4632
4921
|
};
|
|
4633
4922
|
})), x = (S) => {
|
|
4634
4923
|
i("edit-tile", S);
|
|
4635
|
-
}, y = (S) => S.type === "chart" && S.meta.chart.type === "slottable",
|
|
4924
|
+
}, y = (S) => S.type === "chart" && S.meta.chart.type === "slottable", I = (S) => S.type === "slottable", D = (S) => {
|
|
4636
4925
|
const z = S.meta.chart;
|
|
4637
|
-
return
|
|
4638
|
-
},
|
|
4926
|
+
return I(z) ? z.id : void 0;
|
|
4927
|
+
}, X = (S) => {
|
|
4639
4928
|
try {
|
|
4640
|
-
const z =
|
|
4929
|
+
const z = sr(S);
|
|
4641
4930
|
s.value.tiles.push(JSON.parse(JSON.stringify(z)));
|
|
4642
4931
|
} catch (z) {
|
|
4643
4932
|
console.warn(z);
|
|
4644
4933
|
}
|
|
4645
4934
|
}, ue = (S) => {
|
|
4646
|
-
n.value && n.value.removeWidget(S.id),
|
|
4935
|
+
n.value && n.value.removeWidget(S.id), d.delete(S.id);
|
|
4647
4936
|
}, se = () => {
|
|
4648
|
-
|
|
4937
|
+
d.clear(), o.value++;
|
|
4649
4938
|
}, re = (S) => {
|
|
4650
4939
|
const z = S.map((B) => ({
|
|
4651
4940
|
id: B.id,
|
|
@@ -4656,29 +4945,29 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4656
4945
|
s.value.tiles = z.sort(p);
|
|
4657
4946
|
}, R = async () => {
|
|
4658
4947
|
if (u.value = "scale(1)", await Ye(), l.value) {
|
|
4659
|
-
const { availWidth: S, availHeight: z } = window.screen, { width: B, height:
|
|
4948
|
+
const { availWidth: S, availHeight: z } = window.screen, { width: B, height: H } = l.value.getBoundingClientRect(), $ = Math.min(z / H, S / B);
|
|
4660
4949
|
u.value = `scale(${$})`;
|
|
4661
4950
|
}
|
|
4662
|
-
},
|
|
4663
|
-
|
|
4664
|
-
}, q =
|
|
4951
|
+
}, O = () => {
|
|
4952
|
+
h.value && (document.fullscreenElement ? document.exitFullscreen() : h.value.requestFullscreen());
|
|
4953
|
+
}, q = L(!1), V = () => {
|
|
4665
4954
|
q.value = document.fullscreenElement !== null, q.value && R();
|
|
4666
|
-
},
|
|
4667
|
-
globalFilters:
|
|
4955
|
+
}, he = b(() => s.value.preset_filters ?? []), { internalContext: J, queryReady: ye } = j.useDashboardInternalContext({
|
|
4956
|
+
globalFilters: he,
|
|
4668
4957
|
context: b(() => a.context),
|
|
4669
4958
|
isFullscreen: q,
|
|
4670
4959
|
preview: b(() => a.preview)
|
|
4671
4960
|
});
|
|
4672
4961
|
return e({
|
|
4673
4962
|
refresh: se,
|
|
4674
|
-
toggleFullscreen:
|
|
4963
|
+
toggleFullscreen: O,
|
|
4675
4964
|
exportPdf: g,
|
|
4676
4965
|
pdfExportState: m
|
|
4677
4966
|
}), (S, z) => {
|
|
4678
4967
|
const B = te("KAlert");
|
|
4679
4968
|
return w(), P("div", {
|
|
4680
4969
|
ref_key: "dashboardContainer",
|
|
4681
|
-
ref:
|
|
4970
|
+
ref: h,
|
|
4682
4971
|
class: _e(["kong-ui-public-dashboard-renderer", { "is-fullscreen": q.value }]),
|
|
4683
4972
|
onFullscreenchange: V
|
|
4684
4973
|
}, [
|
|
@@ -4687,44 +4976,44 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4687
4976
|
ref: l,
|
|
4688
4977
|
class: "layout"
|
|
4689
4978
|
}, [
|
|
4690
|
-
E(f) && q.value ? (w(), P("div",
|
|
4979
|
+
E(f) && q.value ? (w(), P("div", rr, [
|
|
4691
4980
|
Ee(S.$slots, "fullscreenHeader", {}, void 0, !0)
|
|
4692
4981
|
])) : U("", !0),
|
|
4693
|
-
E(f) ? (w(),
|
|
4982
|
+
E(f) ? (w(), N(At(E(J).editable && !q.value ? ir : Qs), {
|
|
4694
4983
|
key: 2,
|
|
4695
4984
|
ref_key: "gridLayoutRef",
|
|
4696
4985
|
ref: n,
|
|
4697
4986
|
columns: s.value.columns,
|
|
4698
4987
|
"tile-height": s.value.tile_height,
|
|
4699
|
-
tiles:
|
|
4988
|
+
tiles: k.value,
|
|
4700
4989
|
onUpdateTiles: re
|
|
4701
4990
|
}, {
|
|
4702
|
-
tile: M(({ tile:
|
|
4703
|
-
y(
|
|
4704
|
-
Ee(S.$slots, D(
|
|
4705
|
-
])) : (w(),
|
|
4706
|
-
key: q.value ? `${
|
|
4991
|
+
tile: M(({ tile: H }) => [
|
|
4992
|
+
y(H) ? (w(), P("div", nr, [
|
|
4993
|
+
Ee(S.$slots, D(H), {}, void 0, !0)
|
|
4994
|
+
])) : (w(), N($t, {
|
|
4995
|
+
key: q.value ? `${H.id}-tile` : `${H.id}-tile-fullscreen`,
|
|
4707
4996
|
"refresh-counter": o.value,
|
|
4708
4997
|
"onUpdate:refreshCounter": z[0] || (z[0] = ($) => o.value = $),
|
|
4709
4998
|
class: "tile-container",
|
|
4710
4999
|
context: E(J),
|
|
4711
|
-
definition:
|
|
4712
|
-
height:
|
|
5000
|
+
definition: H.meta,
|
|
5001
|
+
height: H.layout.size.rows * (s.value.tile_height || E(Se)) + parseInt(E(Bt), 10),
|
|
4713
5002
|
"hide-actions": !E(J).showTileActions,
|
|
4714
5003
|
"hide-zoom-actions": !E(J).showTileZoomActions,
|
|
4715
5004
|
"is-fullscreen": q.value,
|
|
4716
5005
|
"query-ready": E(ye),
|
|
4717
|
-
"tile-id":
|
|
4718
|
-
"tile-type":
|
|
4719
|
-
onDuplicateTile: ($) =>
|
|
4720
|
-
onEditTile: ($) => x(
|
|
4721
|
-
onRemoveTile: ($) => ue(
|
|
4722
|
-
onTileLoaded: ($) => v(
|
|
5006
|
+
"tile-id": H.id,
|
|
5007
|
+
"tile-type": H.type,
|
|
5008
|
+
onDuplicateTile: ($) => X(H),
|
|
5009
|
+
onEditTile: ($) => x(H),
|
|
5010
|
+
onRemoveTile: ($) => ue(H),
|
|
5011
|
+
onTileLoaded: ($) => v(H),
|
|
4723
5012
|
onTileTimeRangeZoom: z[1] || (z[1] = ($) => i("tile-time-range-zoom", $))
|
|
4724
5013
|
}, null, 8, ["refresh-counter", "context", "definition", "height", "hide-actions", "hide-zoom-actions", "is-fullscreen", "query-ready", "tile-id", "tile-type", "onDuplicateTile", "onEditTile", "onRemoveTile", "onTileLoaded"]))
|
|
4725
5014
|
]),
|
|
4726
5015
|
_: 3
|
|
4727
|
-
}, 40, ["columns", "tile-height", "tiles"])) : (w(),
|
|
5016
|
+
}, 40, ["columns", "tile-height", "tiles"])) : (w(), N(B, {
|
|
4728
5017
|
key: 1,
|
|
4729
5018
|
appearance: "danger"
|
|
4730
5019
|
}, {
|
|
@@ -4737,7 +5026,7 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4737
5026
|
], 34);
|
|
4738
5027
|
};
|
|
4739
5028
|
}
|
|
4740
|
-
}),
|
|
5029
|
+
}), br = /* @__PURE__ */ fe(or, [["__scopeId", "data-v-f028130a"]]), wr = /* @__PURE__ */ K({
|
|
4741
5030
|
__name: "DashboardTilePreview",
|
|
4742
5031
|
props: {
|
|
4743
5032
|
context: {},
|
|
@@ -4747,39 +5036,39 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4747
5036
|
},
|
|
4748
5037
|
emits: ["chart-data", "tile-time-range-zoom", "tile-bounds-change"],
|
|
4749
5038
|
setup(a, { expose: e, emit: t }) {
|
|
4750
|
-
const i =
|
|
5039
|
+
const i = lt("root"), s = lt("dashboard-tile"), r = crypto.randomUUID(), o = t, n = (y) => {
|
|
4751
5040
|
o("tile-time-range-zoom", y);
|
|
4752
|
-
},
|
|
5041
|
+
}, h = (y) => {
|
|
4753
5042
|
o("chart-data", y);
|
|
4754
5043
|
}, l = (y) => {
|
|
4755
5044
|
o("tile-bounds-change", y);
|
|
4756
|
-
}, { i18n: u } = j.useI18n(), { internalContext:
|
|
5045
|
+
}, { i18n: u } = j.useI18n(), { internalContext: d, queryReady: f } = j.useDashboardInternalContext({
|
|
4757
5046
|
globalFilters: be(() => a.globalFilters),
|
|
4758
5047
|
context: be(() => a.context),
|
|
4759
5048
|
preview: b(() => a.preview)
|
|
4760
|
-
}), g = b(() =>
|
|
5049
|
+
}), g = b(() => Z(a.definition)), m = b(() => g.value ? "columns" in a.definition.query && !a.definition.query.columns?.length : !("metrics" in a.definition.query) || !a.definition.query.metrics || a.definition.query.metrics.length === 0), v = L(Se);
|
|
4761
5050
|
let p;
|
|
4762
|
-
|
|
5051
|
+
Oe(() => {
|
|
4763
5052
|
const y = i.value?.parentElement;
|
|
4764
|
-
y && (v.value = y.getBoundingClientRect().height, p = new ResizeObserver(([
|
|
4765
|
-
const { height: D } =
|
|
5053
|
+
y && (v.value = y.getBoundingClientRect().height, p = new ResizeObserver(([I]) => {
|
|
5054
|
+
const { height: D } = I.contentRect;
|
|
4766
5055
|
v.value = D;
|
|
4767
5056
|
}), p.observe(y));
|
|
4768
|
-
}),
|
|
4769
|
-
const
|
|
5057
|
+
}), Te(() => p?.disconnect());
|
|
5058
|
+
const k = L(0);
|
|
4770
5059
|
return e({
|
|
4771
5060
|
refresh: () => {
|
|
4772
|
-
|
|
5061
|
+
k.value++;
|
|
4773
5062
|
},
|
|
4774
5063
|
getExportData: () => s.value?.getExportData()
|
|
4775
|
-
}), (y,
|
|
5064
|
+
}), (y, I) => {
|
|
4776
5065
|
const D = te("KEmptyState");
|
|
4777
5066
|
return w(), P("div", {
|
|
4778
5067
|
ref_key: "root",
|
|
4779
5068
|
ref: i,
|
|
4780
5069
|
"data-testid": "dashboard-tile-preview-root"
|
|
4781
5070
|
}, [
|
|
4782
|
-
m.value ? (w(),
|
|
5071
|
+
m.value ? (w(), N(D, {
|
|
4783
5072
|
key: 0,
|
|
4784
5073
|
"action-button-visible": !1,
|
|
4785
5074
|
"data-testid": "chart-not-configured-empty-state"
|
|
@@ -4791,13 +5080,13 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4791
5080
|
Q("p", null, W(E(u).t("renderer.not_configured.description")), 1)
|
|
4792
5081
|
]),
|
|
4793
5082
|
_: 1
|
|
4794
|
-
})) : (w(),
|
|
5083
|
+
})) : (w(), N($t, {
|
|
4795
5084
|
key: 1,
|
|
4796
5085
|
ref: "dashboard-tile",
|
|
4797
|
-
"refresh-counter":
|
|
4798
|
-
"onUpdate:refreshCounter":
|
|
5086
|
+
"refresh-counter": k.value,
|
|
5087
|
+
"onUpdate:refreshCounter": I[0] || (I[0] = (X) => k.value = X),
|
|
4799
5088
|
context: {
|
|
4800
|
-
...E(
|
|
5089
|
+
...E(d),
|
|
4801
5090
|
editable: !1
|
|
4802
5091
|
},
|
|
4803
5092
|
definition: a.definition,
|
|
@@ -4806,14 +5095,14 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4806
5095
|
"query-ready": E(f),
|
|
4807
5096
|
"show-refresh": "",
|
|
4808
5097
|
"tile-id": E(r),
|
|
4809
|
-
onChartData:
|
|
5098
|
+
onChartData: h,
|
|
4810
5099
|
onTileBoundsChange: l,
|
|
4811
5100
|
onTileTimeRangeZoom: n
|
|
4812
5101
|
}, null, 8, ["refresh-counter", "context", "definition", "height", "query-ready", "tile-id"]))
|
|
4813
5102
|
], 512);
|
|
4814
5103
|
};
|
|
4815
5104
|
}
|
|
4816
|
-
}),
|
|
5105
|
+
}), ar = (a) => {
|
|
4817
5106
|
const e = a.definition?.query;
|
|
4818
5107
|
if (!e)
|
|
4819
5108
|
return a;
|
|
@@ -4822,8 +5111,8 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4822
5111
|
return;
|
|
4823
5112
|
}
|
|
4824
5113
|
return a;
|
|
4825
|
-
},
|
|
4826
|
-
if (
|
|
5114
|
+
}, lr = (a) => {
|
|
5115
|
+
if (Z(a.definition))
|
|
4827
5116
|
return a;
|
|
4828
5117
|
const e = a.definition?.query;
|
|
4829
5118
|
if (!e)
|
|
@@ -4839,13 +5128,13 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4839
5128
|
query: t
|
|
4840
5129
|
}
|
|
4841
5130
|
};
|
|
4842
|
-
},
|
|
5131
|
+
}, ur = (a, e = Ze) => {
|
|
4843
5132
|
if (!a.length)
|
|
4844
5133
|
return [];
|
|
4845
5134
|
let t = 0, i = 0, s = 0;
|
|
4846
5135
|
const r = [];
|
|
4847
5136
|
for (const o of a) {
|
|
4848
|
-
const n = o.layout?.size?.cols ?? 1,
|
|
5137
|
+
const n = o.layout?.size?.cols ?? 1, h = o.layout?.size?.rows ?? 1;
|
|
4849
5138
|
i + n > e && (t += s, i = 0, s = 0);
|
|
4850
5139
|
const l = {
|
|
4851
5140
|
...o,
|
|
@@ -4858,18 +5147,18 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4858
5147
|
}
|
|
4859
5148
|
}
|
|
4860
5149
|
};
|
|
4861
|
-
r.push(l), i += n, s = Math.max(s,
|
|
5150
|
+
r.push(l), i += n, s = Math.max(s, h);
|
|
4862
5151
|
}
|
|
4863
5152
|
return r;
|
|
4864
|
-
},
|
|
5153
|
+
}, Er = (a, e) => {
|
|
4865
5154
|
if (e) {
|
|
4866
|
-
const s = a.tiles.map(
|
|
5155
|
+
const s = a.tiles.map(lr);
|
|
4867
5156
|
return {
|
|
4868
5157
|
...a,
|
|
4869
5158
|
tiles: s
|
|
4870
5159
|
};
|
|
4871
5160
|
}
|
|
4872
|
-
const t = a.tiles.map(
|
|
5161
|
+
const t = a.tiles.map(ar).filter((s) => s !== void 0), i = ur(t, a.columns);
|
|
4873
5162
|
return {
|
|
4874
5163
|
...a,
|
|
4875
5164
|
tiles: i
|
|
@@ -4877,17 +5166,17 @@ const er = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], tr = { cl
|
|
|
4877
5166
|
};
|
|
4878
5167
|
export {
|
|
4879
5168
|
Vi as C,
|
|
4880
|
-
|
|
5169
|
+
Ze as D,
|
|
4881
5170
|
dt as E,
|
|
4882
|
-
|
|
4883
|
-
|
|
5171
|
+
Zi as F,
|
|
5172
|
+
Qs as G,
|
|
4884
5173
|
ce as I,
|
|
4885
5174
|
Qi as T,
|
|
4886
|
-
|
|
5175
|
+
Je as _,
|
|
4887
5176
|
Se as a,
|
|
4888
5177
|
Yi as b,
|
|
4889
|
-
|
|
4890
|
-
|
|
5178
|
+
br as c,
|
|
5179
|
+
wr as d,
|
|
4891
5180
|
ji as e,
|
|
4892
|
-
|
|
5181
|
+
Er as f
|
|
4893
5182
|
};
|