@kong-ui-public/dashboard-renderer 5.1.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard-renderer.es.js +614 -581
- package/dist/dashboard-renderer.umd.js +4 -4
- package/dist/style.css +1 -1
- package/dist/types/components/DashboardRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts +296 -0
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Lt = Object.defineProperty;
|
|
2
|
+
var Je = (u) => {
|
|
3
3
|
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var Mt = (u, e, t) => e in u ? Lt(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
6
|
+
var et = (u, e, t) => Mt(u, typeof e != "symbol" ? e + "" : e, t), qe = (u, e, t) => e.has(u) || Je("Cannot " + t);
|
|
7
|
+
var _ = (u, e, t) => (qe(u, e, "read from private field"), t ? t.call(u) : e.get(u)), M = (u, e, t) => e.has(u) ? Je("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(u) : e.set(u, t), A = (u, e, t, i) => (qe(u, e, "write to private field"), i ? i.call(u, t) : e.set(u, t), t), I = (u, e, t) => (qe(u, e, "access private method"), t);
|
|
8
|
+
var we = (u, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
|
-
|
|
10
|
+
A(u, e, s, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return
|
|
13
|
+
return _(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as
|
|
17
|
-
import { stripUnknownFilters as
|
|
18
|
-
import { SimpleChart as
|
|
19
|
-
import
|
|
16
|
+
import { ref as U, watchEffect as mt, inject as _e, provide as It, defineComponent as W, onUnmounted as Ue, computed as O, watch as Fe, resolveComponent as oe, unref as S, openBlock as C, createBlock as H, withCtx as P, createTextVNode as ue, toDisplayString as J, renderSlot as Me, createCommentVNode as V, useCssVars as Ge, createElementVNode as ce, normalizeClass as We, createVNode as se, mergeProps as pt, createSlots as yt, createElementBlock as F, normalizeProps as Pt, guardReactiveProps as qt, defineAsyncComponent as Bt, onMounted as Ve, nextTick as vt, resolveDynamicComponent as _t, Fragment as wt, renderList as bt, normalizeStyle as tt, mergeModels as it, useModel as $t } from "vue";
|
|
17
|
+
import { stripUnknownFilters as Ut, Timeframe as Ft, TimePeriods as Et, TIMEFRAME_LOOKUP as Gt, formatTime as st, msToGranularity as Wt } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { SimpleChart as Vt, AnalyticsChart as Kt, TopNTable as Yt, CsvExportModal as Xt } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import jt from "swrv";
|
|
20
20
|
import "axios";
|
|
21
|
-
import { createI18n as
|
|
22
|
-
import { useAnalyticsConfigStore as
|
|
23
|
-
import { MetricsProvider as
|
|
24
|
-
import { EditIcon as
|
|
25
|
-
var
|
|
26
|
-
const
|
|
21
|
+
import { createI18n as Qt, i18nTComponent as Zt } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as xt } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { MetricsProvider as Jt, MetricsConsumer as ei } from "@kong-ui-public/analytics-metric-provider";
|
|
24
|
+
import { EditIcon as ti, MoreIcon as ii } from "@kong/icons";
|
|
25
|
+
var Ct = /* @__PURE__ */ ((u) => (u.VALIDATING = "VALIDATING", u.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", u.PENDING = "PENDING", u.SUCCESS = "SUCCESS", u.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", u.ERROR = "ERROR", u.STALE_IF_ERROR = "STALE_IF_ERROR", u))(Ct || {});
|
|
26
|
+
const si = (u) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
28
|
return u ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
29
|
((e = Object.keys(u)) != null && e.length || (t = u.data) != null && t.length || (s = (i = u.data) == null ? void 0 : i.data) != null && s.length || !((r = u.data) != null && r.data) && typeof u.data == "object" && Object.keys(u == null ? void 0 : u.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
const s =
|
|
31
|
+
function ri(u = U({}), e, t, i = si) {
|
|
32
|
+
const s = U(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
|
-
return
|
|
36
|
+
return mt(() => {
|
|
37
37
|
const r = i(u.value);
|
|
38
38
|
if (u.value && r && t.value) {
|
|
39
39
|
s.value = "VALIDATING_HAS_DATA";
|
|
@@ -62,10 +62,10 @@ function si(u = $({}), e, t, i = ii) {
|
|
|
62
62
|
u.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
|
-
swrvState:
|
|
65
|
+
swrvState: Ct
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const ni = {
|
|
69
69
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
70
70
|
trendRange: {
|
|
71
71
|
"24h": "Last 24-Hour Summary",
|
|
@@ -73,37 +73,38 @@ const ri = {
|
|
|
73
73
|
"30d": "Last 30-Day Summary"
|
|
74
74
|
},
|
|
75
75
|
edit: "Edit",
|
|
76
|
+
duplicateTile: "Duplicate",
|
|
76
77
|
remove: "Remove"
|
|
77
|
-
}, ni = {
|
|
78
|
-
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
79
78
|
}, oi = {
|
|
79
|
+
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
80
|
+
}, ai = {
|
|
80
81
|
defaultFilename: "Chart Export",
|
|
81
82
|
exportAsCsv: "Export as CSV"
|
|
82
|
-
},
|
|
83
|
-
renderer:
|
|
84
|
-
queryDataProvider:
|
|
85
|
-
csvExport:
|
|
86
|
-
jumpToExplore:
|
|
83
|
+
}, li = "Explore", hi = {
|
|
84
|
+
renderer: ni,
|
|
85
|
+
queryDataProvider: oi,
|
|
86
|
+
csvExport: ai,
|
|
87
|
+
jumpToExplore: li
|
|
87
88
|
};
|
|
88
|
-
function
|
|
89
|
-
const u =
|
|
89
|
+
function di() {
|
|
90
|
+
const u = Qt("en-us", hi);
|
|
90
91
|
return {
|
|
91
92
|
i18n: u,
|
|
92
|
-
i18nT:
|
|
93
|
+
i18nT: Zt(u)
|
|
93
94
|
// Translation component <i18n-t>
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
|
-
const
|
|
97
|
-
function
|
|
98
|
-
const u =
|
|
97
|
+
const Ke = 170, le = "analytics-query-provider", rt = "{entity-id}", ui = "{cp-id}", ci = "{timeframe}", fi = 30 * 1e3;
|
|
98
|
+
function gi() {
|
|
99
|
+
const u = _e(le);
|
|
99
100
|
return {
|
|
100
101
|
evaluateFeatureFlag: (t, i) => u ? u.evaluateFeatureFlagFn(t, i) : i
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function mi(u) {
|
|
104
105
|
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
105
106
|
}
|
|
106
|
-
var
|
|
107
|
+
var Rt = { exports: {} };
|
|
107
108
|
(function(u) {
|
|
108
109
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
109
110
|
function i() {
|
|
@@ -143,7 +144,7 @@ var Ct = { exports: {} };
|
|
|
143
144
|
}, n.prototype.emit = function(h, a, l, f, m, p) {
|
|
144
145
|
var y = t ? t + h : h;
|
|
145
146
|
if (!this._events[y]) return !1;
|
|
146
|
-
var g = this._events[y], R = arguments.length,
|
|
147
|
+
var g = this._events[y], R = arguments.length, k, E;
|
|
147
148
|
if (g.fn) {
|
|
148
149
|
switch (g.once && this.removeListener(h, g.fn, void 0, !0), R) {
|
|
149
150
|
case 1:
|
|
@@ -159,29 +160,29 @@ var Ct = { exports: {} };
|
|
|
159
160
|
case 6:
|
|
160
161
|
return g.fn.call(g.context, a, l, f, m, p), !0;
|
|
161
162
|
}
|
|
162
|
-
for (
|
|
163
|
-
|
|
164
|
-
g.fn.apply(g.context,
|
|
163
|
+
for (E = 1, k = new Array(R - 1); E < R; E++)
|
|
164
|
+
k[E - 1] = arguments[E];
|
|
165
|
+
g.fn.apply(g.context, k);
|
|
165
166
|
} else {
|
|
166
|
-
var
|
|
167
|
-
for (
|
|
168
|
-
switch (g[
|
|
167
|
+
var L = g.length, D;
|
|
168
|
+
for (E = 0; E < L; E++)
|
|
169
|
+
switch (g[E].once && this.removeListener(h, g[E].fn, void 0, !0), R) {
|
|
169
170
|
case 1:
|
|
170
|
-
g[
|
|
171
|
+
g[E].fn.call(g[E].context);
|
|
171
172
|
break;
|
|
172
173
|
case 2:
|
|
173
|
-
g[
|
|
174
|
+
g[E].fn.call(g[E].context, a);
|
|
174
175
|
break;
|
|
175
176
|
case 3:
|
|
176
|
-
g[
|
|
177
|
+
g[E].fn.call(g[E].context, a, l);
|
|
177
178
|
break;
|
|
178
179
|
case 4:
|
|
179
|
-
g[
|
|
180
|
+
g[E].fn.call(g[E].context, a, l, f);
|
|
180
181
|
break;
|
|
181
182
|
default:
|
|
182
|
-
if (!
|
|
183
|
-
|
|
184
|
-
g[
|
|
183
|
+
if (!k) for (D = 1, k = new Array(R - 1); D < R; D++)
|
|
184
|
+
k[D - 1] = arguments[D];
|
|
185
|
+
g[E].fn.apply(g[E].context, k);
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
return !0;
|
|
@@ -207,24 +208,24 @@ var Ct = { exports: {} };
|
|
|
207
208
|
var a;
|
|
208
209
|
return h ? (a = t ? t + h : h, this._events[a] && o(this, a)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
209
210
|
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n, u.exports = n;
|
|
210
|
-
})(
|
|
211
|
-
var
|
|
212
|
-
const
|
|
213
|
-
class
|
|
211
|
+
})(Rt);
|
|
212
|
+
var pi = Rt.exports;
|
|
213
|
+
const yi = /* @__PURE__ */ mi(pi);
|
|
214
|
+
class Tt extends Error {
|
|
214
215
|
constructor(e) {
|
|
215
216
|
super(e), this.name = "TimeoutError";
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
class
|
|
219
|
+
class vi extends Error {
|
|
219
220
|
constructor(e) {
|
|
220
221
|
super(), this.name = "AbortError", this.message = e;
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
const
|
|
224
|
-
const e = u.reason === void 0 ?
|
|
225
|
-
return e instanceof Error ? e :
|
|
224
|
+
const nt = (u) => globalThis.DOMException === void 0 ? new vi(u) : new DOMException(u), ot = (u) => {
|
|
225
|
+
const e = u.reason === void 0 ? nt("This operation was aborted.") : u.reason;
|
|
226
|
+
return e instanceof Error ? e : nt(e);
|
|
226
227
|
};
|
|
227
|
-
function
|
|
228
|
+
function _i(u, e) {
|
|
228
229
|
const {
|
|
229
230
|
milliseconds: t,
|
|
230
231
|
fallback: i,
|
|
@@ -237,15 +238,15 @@ function vi(u, e) {
|
|
|
237
238
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
238
239
|
if (e.signal) {
|
|
239
240
|
const { signal: m } = e;
|
|
240
|
-
m.aborted && l(
|
|
241
|
-
l(
|
|
241
|
+
m.aborted && l(ot(m)), n = () => {
|
|
242
|
+
l(ot(m));
|
|
242
243
|
}, m.addEventListener("abort", n, { once: !0 });
|
|
243
244
|
}
|
|
244
245
|
if (t === Number.POSITIVE_INFINITY) {
|
|
245
246
|
u.then(a, l);
|
|
246
247
|
return;
|
|
247
248
|
}
|
|
248
|
-
const f = new
|
|
249
|
+
const f = new Tt();
|
|
249
250
|
o = r.setTimeout.call(void 0, () => {
|
|
250
251
|
if (i) {
|
|
251
252
|
try {
|
|
@@ -270,7 +271,7 @@ function vi(u, e) {
|
|
|
270
271
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
271
272
|
}, h;
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
+
function wi(u, e, t) {
|
|
274
275
|
let i = 0, s = u.length;
|
|
275
276
|
for (; s > 0; ) {
|
|
276
277
|
const r = Math.trunc(s / 2);
|
|
@@ -279,10 +280,10 @@ function _i(u, e, t) {
|
|
|
279
280
|
}
|
|
280
281
|
return i;
|
|
281
282
|
}
|
|
282
|
-
var
|
|
283
|
-
class
|
|
283
|
+
var K;
|
|
284
|
+
class bi {
|
|
284
285
|
constructor() {
|
|
285
|
-
|
|
286
|
+
M(this, K, []);
|
|
286
287
|
}
|
|
287
288
|
enqueue(e, t) {
|
|
288
289
|
t = {
|
|
@@ -294,83 +295,83 @@ class wi {
|
|
|
294
295
|
id: t.id,
|
|
295
296
|
run: e
|
|
296
297
|
};
|
|
297
|
-
if (this.size === 0 ||
|
|
298
|
-
|
|
298
|
+
if (this.size === 0 || _(this, K)[this.size - 1].priority >= t.priority) {
|
|
299
|
+
_(this, K).push(i);
|
|
299
300
|
return;
|
|
300
301
|
}
|
|
301
|
-
const s =
|
|
302
|
-
|
|
302
|
+
const s = wi(_(this, K), i, (r, o) => o.priority - r.priority);
|
|
303
|
+
_(this, K).splice(s, 0, i);
|
|
303
304
|
}
|
|
304
305
|
setPriority(e, t) {
|
|
305
|
-
const i =
|
|
306
|
+
const i = _(this, K).findIndex((r) => r.id === e);
|
|
306
307
|
if (i === -1)
|
|
307
308
|
throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
308
|
-
const [s] =
|
|
309
|
+
const [s] = _(this, K).splice(i, 1);
|
|
309
310
|
this.enqueue(s.run, { priority: t, id: e });
|
|
310
311
|
}
|
|
311
312
|
dequeue() {
|
|
312
|
-
const e =
|
|
313
|
+
const e = _(this, K).shift();
|
|
313
314
|
return e == null ? void 0 : e.run;
|
|
314
315
|
}
|
|
315
316
|
filter(e) {
|
|
316
|
-
return
|
|
317
|
+
return _(this, K).filter((t) => t.priority === e.priority).map((t) => t.run);
|
|
317
318
|
}
|
|
318
319
|
get size() {
|
|
319
|
-
return
|
|
320
|
+
return _(this, K).length;
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
|
-
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
K = new WeakMap();
|
|
324
|
+
var fe, ge, ne, xe, me, Ce, Y, pe, $, Re, X, ye, ie, Te, Le, T, zt, Dt, St, kt, Nt, ze, Be, $e, De, At, Se;
|
|
325
|
+
class Ei extends yi {
|
|
325
326
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
326
327
|
constructor(t) {
|
|
327
328
|
var i, s;
|
|
328
329
|
super();
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
330
|
+
M(this, T);
|
|
331
|
+
M(this, fe);
|
|
332
|
+
M(this, ge);
|
|
333
|
+
M(this, ne, 0);
|
|
334
|
+
M(this, xe);
|
|
335
|
+
M(this, me);
|
|
336
|
+
M(this, Ce, 0);
|
|
337
|
+
M(this, Y);
|
|
338
|
+
M(this, pe);
|
|
339
|
+
M(this, $);
|
|
340
|
+
M(this, Re);
|
|
341
|
+
M(this, X, 0);
|
|
341
342
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
M(this, ye);
|
|
344
|
+
M(this, ie);
|
|
345
|
+
M(this, Te);
|
|
345
346
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
346
|
-
|
|
347
|
+
M(this, Le, 1n);
|
|
347
348
|
/**
|
|
348
349
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
349
350
|
|
|
350
351
|
Applies to each future operation.
|
|
351
352
|
*/
|
|
352
|
-
|
|
353
|
+
et(this, "timeout");
|
|
353
354
|
if (t = {
|
|
354
355
|
carryoverConcurrencyCount: !1,
|
|
355
356
|
intervalCap: Number.POSITIVE_INFINITY,
|
|
356
357
|
interval: 0,
|
|
357
358
|
concurrency: Number.POSITIVE_INFINITY,
|
|
358
359
|
autoStart: !0,
|
|
359
|
-
queueClass:
|
|
360
|
+
queueClass: bi,
|
|
360
361
|
...t
|
|
361
362
|
}, !(typeof t.intervalCap == "number" && t.intervalCap >= 1))
|
|
362
363
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i = t.intervalCap) == null ? void 0 : i.toString()) ?? ""}\` (${typeof t.intervalCap})`);
|
|
363
364
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
364
365
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
365
|
-
|
|
366
|
+
A(this, fe, t.carryoverConcurrencyCount), A(this, ge, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), A(this, xe, t.intervalCap), A(this, me, t.interval), A(this, $, new t.queueClass()), A(this, Re, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, A(this, Te, t.throwOnTimeout === !0), A(this, ie, t.autoStart === !1);
|
|
366
367
|
}
|
|
367
368
|
get concurrency() {
|
|
368
|
-
return
|
|
369
|
+
return _(this, ye);
|
|
369
370
|
}
|
|
370
371
|
set concurrency(t) {
|
|
371
372
|
if (!(typeof t == "number" && t >= 1))
|
|
372
373
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
373
|
-
|
|
374
|
+
A(this, ye, t), I(this, T, De).call(this);
|
|
374
375
|
}
|
|
375
376
|
/**
|
|
376
377
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -409,33 +410,33 @@ class bi extends pi {
|
|
|
409
410
|
Here, the promise function with `id: '🦀'` executes last.
|
|
410
411
|
*/
|
|
411
412
|
setPriority(t, i) {
|
|
412
|
-
|
|
413
|
+
_(this, $).setPriority(t, i);
|
|
413
414
|
}
|
|
414
415
|
async add(t, i = {}) {
|
|
415
|
-
return i.id ?? (i.id = (
|
|
416
|
+
return i.id ?? (i.id = (we(this, Le)._++).toString()), i = {
|
|
416
417
|
timeout: this.timeout,
|
|
417
|
-
throwOnTimeout:
|
|
418
|
+
throwOnTimeout: _(this, Te),
|
|
418
419
|
...i
|
|
419
420
|
}, new Promise((s, r) => {
|
|
420
|
-
|
|
421
|
+
_(this, $).enqueue(async () => {
|
|
421
422
|
var o;
|
|
422
|
-
|
|
423
|
+
we(this, X)._++, we(this, ne)._++;
|
|
423
424
|
try {
|
|
424
425
|
(o = i.signal) == null || o.throwIfAborted();
|
|
425
426
|
let n = t({ signal: i.signal });
|
|
426
|
-
i.timeout && (n =
|
|
427
|
+
i.timeout && (n = _i(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, I(this, T, At).call(this, i.signal)]));
|
|
427
428
|
const d = await n;
|
|
428
429
|
s(d), this.emit("completed", d);
|
|
429
430
|
} catch (n) {
|
|
430
|
-
if (n instanceof
|
|
431
|
+
if (n instanceof Tt && !i.throwOnTimeout) {
|
|
431
432
|
s();
|
|
432
433
|
return;
|
|
433
434
|
}
|
|
434
435
|
r(n), this.emit("error", n);
|
|
435
436
|
} finally {
|
|
436
|
-
|
|
437
|
+
I(this, T, St).call(this);
|
|
437
438
|
}
|
|
438
|
-
}, i), this.emit("add"),
|
|
439
|
+
}, i), this.emit("add"), I(this, T, ze).call(this);
|
|
439
440
|
});
|
|
440
441
|
}
|
|
441
442
|
async addAll(t, i) {
|
|
@@ -445,19 +446,19 @@ class bi extends pi {
|
|
|
445
446
|
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.)
|
|
446
447
|
*/
|
|
447
448
|
start() {
|
|
448
|
-
return
|
|
449
|
+
return _(this, ie) ? (A(this, ie, !1), I(this, T, De).call(this), this) : this;
|
|
449
450
|
}
|
|
450
451
|
/**
|
|
451
452
|
Put queue execution on hold.
|
|
452
453
|
*/
|
|
453
454
|
pause() {
|
|
454
|
-
|
|
455
|
+
A(this, ie, !0);
|
|
455
456
|
}
|
|
456
457
|
/**
|
|
457
458
|
Clear the queue.
|
|
458
459
|
*/
|
|
459
460
|
clear() {
|
|
460
|
-
|
|
461
|
+
A(this, $, new (_(this, Re))());
|
|
461
462
|
}
|
|
462
463
|
/**
|
|
463
464
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -465,7 +466,7 @@ class bi extends pi {
|
|
|
465
466
|
@returns A promise that settles when the queue becomes empty.
|
|
466
467
|
*/
|
|
467
468
|
async onEmpty() {
|
|
468
|
-
|
|
469
|
+
_(this, $).size !== 0 && await I(this, T, Se).call(this, "empty");
|
|
469
470
|
}
|
|
470
471
|
/**
|
|
471
472
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -475,7 +476,7 @@ class bi extends pi {
|
|
|
475
476
|
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.
|
|
476
477
|
*/
|
|
477
478
|
async onSizeLessThan(t) {
|
|
478
|
-
|
|
479
|
+
_(this, $).size < t || await I(this, T, Se).call(this, "next", () => _(this, $).size < t);
|
|
479
480
|
}
|
|
480
481
|
/**
|
|
481
482
|
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.
|
|
@@ -483,13 +484,13 @@ class bi extends pi {
|
|
|
483
484
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
484
485
|
*/
|
|
485
486
|
async onIdle() {
|
|
486
|
-
|
|
487
|
+
_(this, X) === 0 && _(this, $).size === 0 || await I(this, T, Se).call(this, "idle");
|
|
487
488
|
}
|
|
488
489
|
/**
|
|
489
490
|
Size of the queue, the number of queued items waiting to run.
|
|
490
491
|
*/
|
|
491
492
|
get size() {
|
|
492
|
-
return
|
|
493
|
+
return _(this, $).size;
|
|
493
494
|
}
|
|
494
495
|
/**
|
|
495
496
|
Size of the queue, filtered by the given options.
|
|
@@ -497,71 +498,71 @@ class bi extends pi {
|
|
|
497
498
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
498
499
|
*/
|
|
499
500
|
sizeBy(t) {
|
|
500
|
-
return
|
|
501
|
+
return _(this, $).filter(t).length;
|
|
501
502
|
}
|
|
502
503
|
/**
|
|
503
504
|
Number of running items (no longer in the queue).
|
|
504
505
|
*/
|
|
505
506
|
get pending() {
|
|
506
|
-
return
|
|
507
|
+
return _(this, X);
|
|
507
508
|
}
|
|
508
509
|
/**
|
|
509
510
|
Whether the queue is currently paused.
|
|
510
511
|
*/
|
|
511
512
|
get isPaused() {
|
|
512
|
-
return
|
|
513
|
+
return _(this, ie);
|
|
513
514
|
}
|
|
514
515
|
}
|
|
515
|
-
|
|
516
|
-
return
|
|
517
|
-
}, Tt = function() {
|
|
518
|
-
return v(this, K) < v(this, fe);
|
|
516
|
+
fe = new WeakMap(), ge = new WeakMap(), ne = new WeakMap(), xe = new WeakMap(), me = new WeakMap(), Ce = new WeakMap(), Y = new WeakMap(), pe = new WeakMap(), $ = new WeakMap(), Re = new WeakMap(), X = new WeakMap(), ye = new WeakMap(), ie = new WeakMap(), Te = new WeakMap(), Le = new WeakMap(), T = new WeakSet(), zt = function() {
|
|
517
|
+
return _(this, ge) || _(this, ne) < _(this, xe);
|
|
519
518
|
}, Dt = function() {
|
|
520
|
-
|
|
519
|
+
return _(this, X) < _(this, ye);
|
|
521
520
|
}, St = function() {
|
|
522
|
-
|
|
521
|
+
we(this, X)._--, I(this, T, ze).call(this), this.emit("next");
|
|
523
522
|
}, kt = function() {
|
|
523
|
+
I(this, T, $e).call(this), I(this, T, Be).call(this), A(this, pe, void 0);
|
|
524
|
+
}, Nt = function() {
|
|
524
525
|
const t = Date.now();
|
|
525
|
-
if (
|
|
526
|
-
const i =
|
|
526
|
+
if (_(this, Y) === void 0) {
|
|
527
|
+
const i = _(this, Ce) - t;
|
|
527
528
|
if (i < 0)
|
|
528
|
-
|
|
529
|
+
A(this, ne, _(this, fe) ? _(this, X) : 0);
|
|
529
530
|
else
|
|
530
|
-
return
|
|
531
|
-
|
|
531
|
+
return _(this, pe) === void 0 && A(this, pe, setTimeout(() => {
|
|
532
|
+
I(this, T, kt).call(this);
|
|
532
533
|
}, i)), !0;
|
|
533
534
|
}
|
|
534
535
|
return !1;
|
|
535
536
|
}, ze = function() {
|
|
536
|
-
if (
|
|
537
|
-
return
|
|
538
|
-
if (!
|
|
539
|
-
const t = !
|
|
540
|
-
if (
|
|
541
|
-
const i =
|
|
542
|
-
return i ? (this.emit("active"), i(), t &&
|
|
537
|
+
if (_(this, $).size === 0)
|
|
538
|
+
return _(this, Y) && clearInterval(_(this, Y)), A(this, Y, void 0), this.emit("empty"), _(this, X) === 0 && this.emit("idle"), !1;
|
|
539
|
+
if (!_(this, ie)) {
|
|
540
|
+
const t = !_(this, T, Nt);
|
|
541
|
+
if (_(this, T, zt) && _(this, T, Dt)) {
|
|
542
|
+
const i = _(this, $).dequeue();
|
|
543
|
+
return i ? (this.emit("active"), i(), t && I(this, T, Be).call(this), !0) : !1;
|
|
543
544
|
}
|
|
544
545
|
}
|
|
545
546
|
return !1;
|
|
546
|
-
}, qe = function() {
|
|
547
|
-
v(this, de) || v(this, V) !== void 0 || (N(this, V, setInterval(() => {
|
|
548
|
-
L(this, T, Be).call(this);
|
|
549
|
-
}, v(this, ue))), N(this, Ee, Date.now() + v(this, ue)));
|
|
550
547
|
}, Be = function() {
|
|
551
|
-
|
|
548
|
+
_(this, ge) || _(this, Y) !== void 0 || (A(this, Y, setInterval(() => {
|
|
549
|
+
I(this, T, $e).call(this);
|
|
550
|
+
}, _(this, me))), A(this, Ce, Date.now() + _(this, me)));
|
|
551
|
+
}, $e = function() {
|
|
552
|
+
_(this, ne) === 0 && _(this, X) === 0 && _(this, Y) && (clearInterval(_(this, Y)), A(this, Y, void 0)), A(this, ne, _(this, fe) ? _(this, X) : 0), I(this, T, De).call(this);
|
|
552
553
|
}, /**
|
|
553
554
|
Executes all queued functions until it reaches the limit.
|
|
554
555
|
*/
|
|
555
|
-
|
|
556
|
-
for (;
|
|
556
|
+
De = function() {
|
|
557
|
+
for (; I(this, T, ze).call(this); )
|
|
557
558
|
;
|
|
558
|
-
},
|
|
559
|
+
}, At = async function(t) {
|
|
559
560
|
return new Promise((i, s) => {
|
|
560
561
|
t.addEventListener("abort", () => {
|
|
561
562
|
s(t.reason);
|
|
562
563
|
}, { once: !0 });
|
|
563
564
|
});
|
|
564
|
-
},
|
|
565
|
+
}, Se = async function(t, i) {
|
|
565
566
|
return new Promise((s) => {
|
|
566
567
|
const r = () => {
|
|
567
568
|
i && !i() || (this.off(t, r), s());
|
|
@@ -569,15 +570,15 @@ Te = function() {
|
|
|
569
570
|
this.on(t, r);
|
|
570
571
|
});
|
|
571
572
|
};
|
|
572
|
-
const
|
|
573
|
-
const u =
|
|
573
|
+
const xi = () => {
|
|
574
|
+
const u = xt(), e = _e(le);
|
|
574
575
|
if (!e)
|
|
575
576
|
return;
|
|
576
577
|
if (e.queryFnOverride) {
|
|
577
578
|
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.");
|
|
578
579
|
return;
|
|
579
580
|
}
|
|
580
|
-
const t = new
|
|
581
|
+
const t = new Ei({
|
|
581
582
|
carryoverConcurrencyCount: !0,
|
|
582
583
|
concurrency: u.maxParallelRequests,
|
|
583
584
|
interval: u.requestInterval,
|
|
@@ -587,12 +588,12 @@ const Ei = () => {
|
|
|
587
588
|
queryFnOverride: !0,
|
|
588
589
|
queryFn: (s, r) => t.add(() => e.queryFn(s, r), { throwOnTimeout: !0 })
|
|
589
590
|
};
|
|
590
|
-
|
|
591
|
-
},
|
|
592
|
-
useI18n:
|
|
593
|
-
useEvaluateFeatureFlag:
|
|
594
|
-
useRequestQueue:
|
|
595
|
-
},
|
|
591
|
+
It(le, i);
|
|
592
|
+
}, ve = {
|
|
593
|
+
useI18n: di,
|
|
594
|
+
useEvaluateFeatureFlag: gi,
|
|
595
|
+
useRequestQueue: xi
|
|
596
|
+
}, Ye = /* @__PURE__ */ W({
|
|
596
597
|
__name: "QueryDataProvider",
|
|
597
598
|
props: {
|
|
598
599
|
context: {},
|
|
@@ -602,73 +603,73 @@ const Ei = () => {
|
|
|
602
603
|
},
|
|
603
604
|
emits: ["chart-data", "queryComplete"],
|
|
604
605
|
setup(u, { emit: e }) {
|
|
605
|
-
const t = u, i = e, { i18n: s } =
|
|
606
|
-
|
|
606
|
+
const t = u, i = e, { i18n: s } = ve.useI18n(), r = _e(le), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, n = new AbortController();
|
|
607
|
+
Ue(() => {
|
|
607
608
|
n.abort();
|
|
608
609
|
});
|
|
609
|
-
const d = (R,
|
|
610
|
-
const
|
|
611
|
-
return
|
|
612
|
-
}, { data: h, error: a, isValidating: l } =
|
|
613
|
-
var R,
|
|
610
|
+
const d = (R, k, E) => {
|
|
611
|
+
const L = [];
|
|
612
|
+
return k && L.push(...k), L.push(...Ut(R, E)), L;
|
|
613
|
+
}, { data: h, error: a, isValidating: l } = jt(o, async () => {
|
|
614
|
+
var R, k, E, L;
|
|
614
615
|
try {
|
|
615
616
|
let {
|
|
616
|
-
datasource:
|
|
617
|
-
...
|
|
617
|
+
datasource: D,
|
|
618
|
+
...x
|
|
618
619
|
} = t.query;
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
let
|
|
622
|
-
|
|
623
|
-
...
|
|
620
|
+
D || (D = "basic");
|
|
621
|
+
const N = d(D, t.query.filters, t.context.filters);
|
|
622
|
+
let z = t.query.time_range;
|
|
623
|
+
z ? z.tz || (z = {
|
|
624
|
+
...z,
|
|
624
625
|
tz: t.context.tz
|
|
625
|
-
}) :
|
|
626
|
+
}) : z = {
|
|
626
627
|
...t.context.timeSpec,
|
|
627
628
|
tz: t.context.tz
|
|
628
629
|
};
|
|
629
|
-
const
|
|
630
|
-
datasource:
|
|
630
|
+
const q = {
|
|
631
|
+
datasource: D,
|
|
631
632
|
query: {
|
|
632
|
-
...
|
|
633
|
-
time_range:
|
|
634
|
-
filters:
|
|
633
|
+
...x,
|
|
634
|
+
time_range: z,
|
|
635
|
+
filters: N
|
|
635
636
|
}
|
|
636
637
|
};
|
|
637
|
-
return r == null ? void 0 : r.queryFn(
|
|
638
|
-
} catch (
|
|
639
|
-
p.value = ((
|
|
638
|
+
return r == null ? void 0 : r.queryFn(q, n);
|
|
639
|
+
} catch (D) {
|
|
640
|
+
p.value = ((k = (R = D == null ? void 0 : D.response) == null ? void 0 : R.data) == null ? void 0 : k.message) === "Range not allowed for this tier" ? s.t("queryDataProvider.timeRangeExceeded") : ((L = (E = D == null ? void 0 : D.response) == null ? void 0 : E.data) == null ? void 0 : L.message) || (D == null ? void 0 : D.message);
|
|
640
641
|
} finally {
|
|
641
642
|
i("queryComplete");
|
|
642
643
|
}
|
|
643
644
|
}, {
|
|
644
645
|
refreshInterval: t.context.refreshInterval,
|
|
645
646
|
revalidateOnFocus: !1
|
|
646
|
-
}), { state: f, swrvState: m } =
|
|
647
|
+
}), { state: f, swrvState: m } = ri(h, a, l), p = U(null), y = O(() => f.value === m.ERROR || !!p.value), g = O(() => !t.queryReady || f.value === m.PENDING);
|
|
647
648
|
return Fe(h, (R) => {
|
|
648
649
|
R && i("chart-data", R);
|
|
649
|
-
}), (R,
|
|
650
|
-
const
|
|
651
|
-
return g.value || !
|
|
650
|
+
}), (R, k) => {
|
|
651
|
+
const E = oe("KSkeleton"), L = oe("KEmptyState");
|
|
652
|
+
return g.value || !S(h) && !y.value ? (C(), H(E, {
|
|
652
653
|
key: 0,
|
|
653
654
|
class: "chart-skeleton",
|
|
654
655
|
type: "table"
|
|
655
|
-
})) : y.value ? (
|
|
656
|
+
})) : y.value ? (C(), H(L, {
|
|
656
657
|
key: 1,
|
|
657
658
|
"action-button-visible": !1,
|
|
658
659
|
"data-testid": "chart-empty-state",
|
|
659
660
|
"icon-variant": "error"
|
|
660
661
|
}, {
|
|
661
|
-
default:
|
|
662
|
-
|
|
662
|
+
default: P(() => [
|
|
663
|
+
ue(J(p.value), 1)
|
|
663
664
|
]),
|
|
664
665
|
_: 1
|
|
665
|
-
})) :
|
|
666
|
+
})) : S(h) ? Me(R.$slots, "default", {
|
|
666
667
|
key: 2,
|
|
667
|
-
data:
|
|
668
|
-
}) :
|
|
668
|
+
data: S(h)
|
|
669
|
+
}) : V("", !0);
|
|
669
670
|
};
|
|
670
671
|
}
|
|
671
|
-
}),
|
|
672
|
+
}), Ci = /* @__PURE__ */ W({
|
|
672
673
|
__name: "SimpleChartRenderer",
|
|
673
674
|
props: {
|
|
674
675
|
query: {},
|
|
@@ -679,21 +680,21 @@ const Ei = () => {
|
|
|
679
680
|
refreshCounter: {}
|
|
680
681
|
},
|
|
681
682
|
setup(u) {
|
|
682
|
-
|
|
683
|
+
Ge((i) => ({
|
|
683
684
|
"35a26ebf": `${i.height}px`
|
|
684
685
|
}));
|
|
685
|
-
const e = u, t =
|
|
686
|
-
return (i, s) => (
|
|
686
|
+
const e = u, t = O(() => e.chartOptions.type === "single_value");
|
|
687
|
+
return (i, s) => (C(), H(Ye, {
|
|
687
688
|
context: i.context,
|
|
688
689
|
query: i.query,
|
|
689
690
|
"query-ready": i.queryReady,
|
|
690
691
|
"refresh-counter": i.refreshCounter
|
|
691
692
|
}, {
|
|
692
|
-
default:
|
|
693
|
-
|
|
694
|
-
class:
|
|
693
|
+
default: P(({ data: r }) => [
|
|
694
|
+
ce("div", {
|
|
695
|
+
class: We(["analytics-chart", { "single-value": t.value }])
|
|
695
696
|
}, [
|
|
696
|
-
|
|
697
|
+
se(S(Vt), {
|
|
697
698
|
"chart-data": r,
|
|
698
699
|
"chart-options": i.chartOptions,
|
|
699
700
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.syntheticsDataKey
|
|
@@ -703,12 +704,12 @@ const Ei = () => {
|
|
|
703
704
|
_: 1
|
|
704
705
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
705
706
|
}
|
|
706
|
-
}),
|
|
707
|
+
}), he = (u, e) => {
|
|
707
708
|
const t = u.__vccOpts || u;
|
|
708
709
|
for (const [i, s] of e)
|
|
709
710
|
t[i] = s;
|
|
710
711
|
return t;
|
|
711
|
-
},
|
|
712
|
+
}, at = /* @__PURE__ */ he(Ci, [["__scopeId", "data-v-65cc8607"]]), Ri = { class: "analytics-chart" }, Ti = /* @__PURE__ */ W({
|
|
712
713
|
__name: "BaseAnalyticsChartRenderer",
|
|
713
714
|
props: {
|
|
714
715
|
query: {},
|
|
@@ -721,7 +722,7 @@ const Ei = () => {
|
|
|
721
722
|
},
|
|
722
723
|
emits: ["edit-tile", "chart-data", "zoom-time-range"],
|
|
723
724
|
setup(u, { emit: e }) {
|
|
724
|
-
const t = u, i = e, { i18n: s } =
|
|
725
|
+
const t = u, i = e, { i18n: s } = ve.useI18n(), { evaluateFeatureFlag: r } = ve.useEvaluateFeatureFlag(), o = r("explore-v4-fine-granularity", !1), n = O(() => ({
|
|
725
726
|
type: t.chartOptions.type,
|
|
726
727
|
stacked: t.chartOptions.stacked ?? !1,
|
|
727
728
|
chartDatasetColors: t.chartOptions.chartDatasetColors,
|
|
@@ -732,34 +733,34 @@ const Ei = () => {
|
|
|
732
733
|
i("chart-data", a);
|
|
733
734
|
};
|
|
734
735
|
return (a, l) => {
|
|
735
|
-
const f =
|
|
736
|
-
return
|
|
736
|
+
const f = oe("KDropdownItem");
|
|
737
|
+
return C(), H(Ye, {
|
|
737
738
|
context: a.context,
|
|
738
739
|
query: a.query,
|
|
739
740
|
"query-ready": a.queryReady,
|
|
740
741
|
"refresh-counter": a.refreshCounter,
|
|
741
742
|
onChartData: h
|
|
742
743
|
}, {
|
|
743
|
-
default:
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
default: P(({ data: m }) => [
|
|
745
|
+
ce("div", Ri, [
|
|
746
|
+
se(S(Kt), pt({
|
|
746
747
|
"allow-csv-export": a.chartOptions.allowCsvExport,
|
|
747
748
|
"chart-data": m,
|
|
748
749
|
"chart-options": n.value,
|
|
749
750
|
"legend-position": "bottom",
|
|
750
751
|
"show-menu": a.context.editable,
|
|
751
752
|
"synthetics-data-key": a.chartOptions.syntheticsDataKey,
|
|
752
|
-
"timeseries-zoom":
|
|
753
|
+
"timeseries-zoom": S(o) && !a.query.time_range,
|
|
753
754
|
"tooltip-title": ""
|
|
754
755
|
}, a.extraProps, {
|
|
755
756
|
onZoomTimeRange: l[0] || (l[0] = (p) => i("zoom-time-range", p))
|
|
756
|
-
}),
|
|
757
|
+
}), yt({ _: 2 }, [
|
|
757
758
|
a.context.editable ? {
|
|
758
759
|
name: "menu-items",
|
|
759
|
-
fn:
|
|
760
|
-
|
|
761
|
-
default:
|
|
762
|
-
|
|
760
|
+
fn: P(() => [
|
|
761
|
+
se(f, { onClick: d }, {
|
|
762
|
+
default: P(() => [
|
|
763
|
+
ue(J(S(s).t("renderer.edit")), 1)
|
|
763
764
|
]),
|
|
764
765
|
_: 1
|
|
765
766
|
})
|
|
@@ -773,7 +774,7 @@ const Ei = () => {
|
|
|
773
774
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
774
775
|
};
|
|
775
776
|
}
|
|
776
|
-
}),
|
|
777
|
+
}), Xe = /* @__PURE__ */ he(Ti, [["__scopeId", "data-v-a9ee3db9"]]), lt = /* @__PURE__ */ W({
|
|
777
778
|
__name: "BarChartRenderer",
|
|
778
779
|
props: {
|
|
779
780
|
query: {},
|
|
@@ -784,7 +785,7 @@ const Ei = () => {
|
|
|
784
785
|
refreshCounter: {}
|
|
785
786
|
},
|
|
786
787
|
setup(u) {
|
|
787
|
-
return (e, t) => (
|
|
788
|
+
return (e, t) => (C(), H(Xe, {
|
|
788
789
|
"chart-options": e.chartOptions,
|
|
789
790
|
context: e.context,
|
|
790
791
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -794,7 +795,7 @@ const Ei = () => {
|
|
|
794
795
|
"refresh-counter": e.refreshCounter
|
|
795
796
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
796
797
|
}
|
|
797
|
-
}),
|
|
798
|
+
}), ht = /* @__PURE__ */ W({
|
|
798
799
|
__name: "TimeseriesChartRenderer",
|
|
799
800
|
props: {
|
|
800
801
|
query: {},
|
|
@@ -807,7 +808,7 @@ const Ei = () => {
|
|
|
807
808
|
emits: ["zoom-time-range"],
|
|
808
809
|
setup(u, { emit: e }) {
|
|
809
810
|
const t = e;
|
|
810
|
-
return (i, s) => (
|
|
811
|
+
return (i, s) => (C(), H(Xe, {
|
|
811
812
|
"chart-options": i.chartOptions,
|
|
812
813
|
context: i.context,
|
|
813
814
|
height: i.height,
|
|
@@ -817,7 +818,7 @@ const Ei = () => {
|
|
|
817
818
|
onZoomTimeRange: s[0] || (s[0] = (r) => t("zoom-time-range", r))
|
|
818
819
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
819
820
|
}
|
|
820
|
-
}), zi = { class: "metric-card-tile-wrapper" },
|
|
821
|
+
}), zi = { class: "metric-card-tile-wrapper" }, Di = /* @__PURE__ */ W({
|
|
821
822
|
__name: "GoldenSignalsRenderer",
|
|
822
823
|
props: {
|
|
823
824
|
query: {},
|
|
@@ -828,7 +829,7 @@ const Ei = () => {
|
|
|
828
829
|
refreshCounter: {}
|
|
829
830
|
},
|
|
830
831
|
setup(u) {
|
|
831
|
-
const e = u, t =
|
|
832
|
+
const e = u, t = O(() => {
|
|
832
833
|
const s = e.context.timeSpec;
|
|
833
834
|
if (s.type === "absolute")
|
|
834
835
|
return new Ft({
|
|
@@ -843,11 +844,11 @@ const Ei = () => {
|
|
|
843
844
|
isRelative: !1,
|
|
844
845
|
allowedTiers: ["free", "plus", "enterprise"]
|
|
845
846
|
});
|
|
846
|
-
const r =
|
|
847
|
+
const r = Et.get(s.time_range);
|
|
847
848
|
if (!r)
|
|
848
849
|
throw new Error("Unknown time range");
|
|
849
850
|
return r;
|
|
850
|
-
}), i =
|
|
851
|
+
}), i = O(() => {
|
|
851
852
|
var r, o;
|
|
852
853
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
853
854
|
if (s && s !== "advanced" && s !== "basic")
|
|
@@ -865,27 +866,27 @@ const Ei = () => {
|
|
|
865
866
|
refreshCounter: e.refreshCounter
|
|
866
867
|
};
|
|
867
868
|
});
|
|
868
|
-
return (s, r) => (
|
|
869
|
-
|
|
870
|
-
default:
|
|
871
|
-
|
|
869
|
+
return (s, r) => (C(), F("div", zi, [
|
|
870
|
+
se(S(Jt), Pt(qt(i.value)), {
|
|
871
|
+
default: P(() => [
|
|
872
|
+
se(S(ei))
|
|
872
873
|
]),
|
|
873
874
|
_: 1
|
|
874
875
|
}, 16)
|
|
875
876
|
]));
|
|
876
877
|
}
|
|
877
|
-
}),
|
|
878
|
+
}), Si = /* @__PURE__ */ he(Di, [["__scopeId", "data-v-bd5889d1"]]), dt = "#6c7489", ut = "20px", Ht = "20px", ki = {
|
|
878
879
|
class: "fallback-entity-link",
|
|
879
880
|
"data-testid": "entity-link-parent"
|
|
880
|
-
},
|
|
881
|
+
}, ct = /* @__PURE__ */ W({
|
|
881
882
|
__name: "FallbackEntityLink",
|
|
882
883
|
props: {
|
|
883
884
|
entityLinkData: {}
|
|
884
885
|
},
|
|
885
886
|
setup(u) {
|
|
886
|
-
return (e, t) => (
|
|
887
|
+
return (e, t) => (C(), F("div", ki, J(e.entityLinkData.label), 1));
|
|
887
888
|
}
|
|
888
|
-
}),
|
|
889
|
+
}), Ni = /* @__PURE__ */ W({
|
|
889
890
|
__name: "TopNTableRenderer",
|
|
890
891
|
props: {
|
|
891
892
|
query: {},
|
|
@@ -896,39 +897,39 @@ const Ei = () => {
|
|
|
896
897
|
refreshCounter: {}
|
|
897
898
|
},
|
|
898
899
|
setup(u) {
|
|
899
|
-
const e = u, t =
|
|
900
|
+
const e = u, t = _e(le), i = Bt(async () => {
|
|
900
901
|
if (t != null && t.fetchComponent)
|
|
901
902
|
try {
|
|
902
903
|
return await t.fetchComponent("EntityLink");
|
|
903
904
|
} catch {
|
|
904
|
-
return
|
|
905
|
+
return ct;
|
|
905
906
|
}
|
|
906
|
-
return
|
|
907
|
+
return ct;
|
|
907
908
|
}), s = (r) => {
|
|
908
909
|
var o;
|
|
909
910
|
if ((o = e.chartOptions) != null && o.entityLink)
|
|
910
911
|
if (r.id.includes(":")) {
|
|
911
912
|
const [n, d] = r.id.split(":");
|
|
912
|
-
return e.chartOptions.entityLink.replace(
|
|
913
|
+
return e.chartOptions.entityLink.replace(ui, n).replace(rt, d);
|
|
913
914
|
} else
|
|
914
|
-
return e.chartOptions.entityLink.replace(
|
|
915
|
+
return e.chartOptions.entityLink.replace(rt, r.id);
|
|
915
916
|
return "";
|
|
916
917
|
};
|
|
917
|
-
return (r, o) => (
|
|
918
|
+
return (r, o) => (C(), H(Ye, {
|
|
918
919
|
context: r.context,
|
|
919
920
|
query: r.query,
|
|
920
921
|
"query-ready": r.queryReady,
|
|
921
922
|
"refresh-counter": r.refreshCounter
|
|
922
923
|
}, {
|
|
923
|
-
default:
|
|
924
|
-
|
|
924
|
+
default: P(({ data: n }) => [
|
|
925
|
+
se(S(Yt), {
|
|
925
926
|
data: n,
|
|
926
927
|
"synthetics-data-key": r.chartOptions.syntheticsDataKey
|
|
927
|
-
},
|
|
928
|
+
}, yt({ _: 2 }, [
|
|
928
929
|
e.chartOptions.entityLink ? {
|
|
929
930
|
name: "name",
|
|
930
|
-
fn:
|
|
931
|
-
|
|
931
|
+
fn: P(({ record: d }) => [
|
|
932
|
+
se(S(i), {
|
|
932
933
|
"entity-link-data": {
|
|
933
934
|
id: d.id,
|
|
934
935
|
label: d.name,
|
|
@@ -944,7 +945,7 @@ const Ei = () => {
|
|
|
944
945
|
_: 1
|
|
945
946
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
946
947
|
}
|
|
947
|
-
}),
|
|
948
|
+
}), Ai = /* @__PURE__ */ W({
|
|
948
949
|
__name: "DonutChartRenderer",
|
|
949
950
|
props: {
|
|
950
951
|
query: {},
|
|
@@ -955,7 +956,7 @@ const Ei = () => {
|
|
|
955
956
|
refreshCounter: {}
|
|
956
957
|
},
|
|
957
958
|
setup(u) {
|
|
958
|
-
return (e, t) => (
|
|
959
|
+
return (e, t) => (C(), H(Xe, {
|
|
959
960
|
"chart-options": e.chartOptions,
|
|
960
961
|
context: e.context,
|
|
961
962
|
height: e.height,
|
|
@@ -964,60 +965,60 @@ const Ei = () => {
|
|
|
964
965
|
"refresh-counter": e.refreshCounter
|
|
965
966
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
966
967
|
}
|
|
967
|
-
}),
|
|
968
|
+
}), Hi = ["data-testid"], Oi = {
|
|
968
969
|
key: 0,
|
|
969
970
|
class: "tile-header"
|
|
970
|
-
},
|
|
971
|
+
}, Li = ["data-testid"], Mi = ["data-testid"], Ii = ["data-testid"], Pi = ["data-testid"], qi = /* @__PURE__ */ W({
|
|
971
972
|
__name: "DashboardTile",
|
|
972
973
|
props: {
|
|
973
974
|
definition: {},
|
|
974
975
|
context: {},
|
|
975
|
-
height: { default:
|
|
976
|
+
height: { default: Ke },
|
|
976
977
|
queryReady: { type: Boolean },
|
|
977
978
|
refreshCounter: {},
|
|
978
979
|
tileId: {}
|
|
979
980
|
},
|
|
980
|
-
emits: ["edit-tile", "remove-tile", "zoom-time-range"],
|
|
981
|
+
emits: ["edit-tile", "duplicate-tile", "remove-tile", "zoom-time-range"],
|
|
981
982
|
setup(u, { emit: e }) {
|
|
982
|
-
|
|
983
|
-
"
|
|
983
|
+
Ge((v) => ({
|
|
984
|
+
"32c3e459": `${v.height}px`
|
|
984
985
|
}));
|
|
985
|
-
const t = parseInt(
|
|
986
|
-
|
|
987
|
-
var
|
|
988
|
-
l.value = await ((
|
|
986
|
+
const t = parseInt(Ht, 10), i = u, s = e, r = _e(le), { i18n: o } = ve.useI18n(), n = U(), d = U(!1), h = U(), a = U(!1), l = U("");
|
|
987
|
+
Ve(async () => {
|
|
988
|
+
var v;
|
|
989
|
+
l.value = await ((v = r == null ? void 0 : r.exploreBaseUrl) == null ? void 0 : v.call(r)) ?? "";
|
|
989
990
|
}), Fe(() => i.definition, async () => {
|
|
990
|
-
await
|
|
991
|
+
await vt(), h.value && (a.value = h.value.scrollWidth > h.value.clientWidth);
|
|
991
992
|
}, { immediate: !0, deep: !0 });
|
|
992
|
-
const f =
|
|
993
|
+
const f = O(() => {
|
|
993
994
|
if (!l.value || !i.definition.query || !y.value)
|
|
994
995
|
return "";
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
996
|
+
const v = [...i.context.filters, ...i.definition.query.filters ?? []], Z = i.definition.query.dimensions ?? [], j = /* @__PURE__ */ new Set(["portal", "api"]);
|
|
997
|
+
if (v.some((re) => "dimension" in re && j.has(re.dimension) || "field" in re && j.has(re.field)) || Z.some((re) => j.has(re)))
|
|
997
998
|
return "";
|
|
998
|
-
const
|
|
999
|
-
filters:
|
|
999
|
+
const Pe = {
|
|
1000
|
+
filters: v,
|
|
1000
1001
|
metrics: i.definition.query.metrics ?? [],
|
|
1001
|
-
dimensions:
|
|
1002
|
+
dimensions: Z,
|
|
1002
1003
|
time_range: i.definition.query.time_range || i.context.timeSpec,
|
|
1003
|
-
granularity: i.definition.query.granularity ||
|
|
1004
|
-
},
|
|
1005
|
-
return `${l.value}?q=${JSON.stringify(
|
|
1006
|
-
}), m =
|
|
1007
|
-
timeseries_line:
|
|
1008
|
-
timeseries_bar:
|
|
1009
|
-
horizontal_bar:
|
|
1010
|
-
vertical_bar:
|
|
1011
|
-
gauge:
|
|
1012
|
-
donut:
|
|
1013
|
-
golden_signals:
|
|
1014
|
-
top_n:
|
|
1004
|
+
granularity: i.definition.query.granularity || L.value
|
|
1005
|
+
}, de = ["advanced", "ai"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "advanced";
|
|
1006
|
+
return `${l.value}?q=${JSON.stringify(Pe)}&d=${de}&c=${i.definition.chart.type}`;
|
|
1007
|
+
}), m = O(() => o.t("csvExport.defaultFilename")), p = O(() => y.value && (g.value || i.context.editable) || !!E.value), y = O(() => !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), g = O(() => !!f.value || "allowCsvExport" in i.definition.chart && i.definition.chart.allowCsvExport || i.context.editable), R = {
|
|
1008
|
+
timeseries_line: ht,
|
|
1009
|
+
timeseries_bar: ht,
|
|
1010
|
+
horizontal_bar: lt,
|
|
1011
|
+
vertical_bar: lt,
|
|
1012
|
+
gauge: at,
|
|
1013
|
+
donut: Ai,
|
|
1014
|
+
golden_signals: Si,
|
|
1015
|
+
top_n: Ni,
|
|
1015
1016
|
slottable: void 0,
|
|
1016
|
-
single_value:
|
|
1017
|
-
},
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1020
|
-
component:
|
|
1017
|
+
single_value: at
|
|
1018
|
+
}, k = O(() => {
|
|
1019
|
+
const v = R[i.definition.chart.type];
|
|
1020
|
+
return v && {
|
|
1021
|
+
component: v,
|
|
1021
1022
|
rendererProps: {
|
|
1022
1023
|
query: i.definition.query,
|
|
1023
1024
|
context: i.context,
|
|
@@ -1027,142 +1028,154 @@ const Ei = () => {
|
|
|
1027
1028
|
refreshCounter: i.refreshCounter
|
|
1028
1029
|
}
|
|
1029
1030
|
};
|
|
1030
|
-
}),
|
|
1031
|
-
var
|
|
1032
|
-
const
|
|
1033
|
-
if ((
|
|
1034
|
-
const
|
|
1035
|
-
return
|
|
1036
|
-
} else if ((
|
|
1037
|
-
const
|
|
1038
|
-
return `${
|
|
1031
|
+
}), E = O(() => {
|
|
1032
|
+
var Z;
|
|
1033
|
+
const v = (Z = i.definition.query) == null ? void 0 : Z.time_range;
|
|
1034
|
+
if ((v == null ? void 0 : v.type) === "relative") {
|
|
1035
|
+
const j = Et.get(Gt[v.time_range]);
|
|
1036
|
+
return j ? j.display : (console.warn("Did not recognize the given relative time range:", v.time_range), v.time_range);
|
|
1037
|
+
} else if ((v == null ? void 0 : v.type) === "absolute") {
|
|
1038
|
+
const j = v.tz || "Etc/UTC";
|
|
1039
|
+
return `${st(v.start, { short: !0, tz: j })} - ${st(v.end, { short: !0, tz: j })}`;
|
|
1039
1040
|
}
|
|
1040
1041
|
return null;
|
|
1041
|
-
}),
|
|
1042
|
+
}), L = O(() => n.value ? Wt(n.value.meta.granularity_ms) : void 0), D = () => {
|
|
1042
1043
|
s("edit-tile", i.definition);
|
|
1043
|
-
},
|
|
1044
|
+
}, x = () => {
|
|
1045
|
+
s("duplicate-tile", i.definition);
|
|
1046
|
+
}, N = () => {
|
|
1044
1047
|
s("remove-tile", i.definition);
|
|
1045
|
-
},
|
|
1046
|
-
n.value =
|
|
1047
|
-
},
|
|
1048
|
-
d.value =
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1048
|
+
}, z = (v) => {
|
|
1049
|
+
n.value = v;
|
|
1050
|
+
}, q = (v) => {
|
|
1051
|
+
d.value = v;
|
|
1052
|
+
}, ae = () => {
|
|
1053
|
+
q(!0);
|
|
1051
1054
|
};
|
|
1052
|
-
return (
|
|
1053
|
-
const
|
|
1054
|
-
return
|
|
1055
|
-
class:
|
|
1056
|
-
"data-testid": `tile-${
|
|
1055
|
+
return (v, Z) => {
|
|
1056
|
+
const j = oe("KTooltip"), Pe = oe("KBadge"), de = oe("KDropdownItem"), re = oe("KDropdown");
|
|
1057
|
+
return C(), F("div", {
|
|
1058
|
+
class: We(["tile-boundary", { editable: v.context.editable }]),
|
|
1059
|
+
"data-testid": `tile-${v.tileId}`
|
|
1057
1060
|
}, [
|
|
1058
|
-
|
|
1059
|
-
|
|
1061
|
+
v.definition.chart.type !== "slottable" ? (C(), F("div", Oi, [
|
|
1062
|
+
se(j, {
|
|
1060
1063
|
class: "title-tooltip",
|
|
1061
1064
|
disabled: !a.value,
|
|
1062
1065
|
"max-width": "500",
|
|
1063
|
-
text:
|
|
1066
|
+
text: v.definition.chart.chartTitle
|
|
1064
1067
|
}, {
|
|
1065
|
-
default:
|
|
1066
|
-
|
|
1068
|
+
default: P(() => [
|
|
1069
|
+
ce("div", {
|
|
1067
1070
|
ref_key: "titleRef",
|
|
1068
1071
|
ref: h,
|
|
1069
1072
|
class: "title"
|
|
1070
|
-
},
|
|
1073
|
+
}, J(v.definition.chart.chartTitle), 513)
|
|
1071
1074
|
]),
|
|
1072
1075
|
_: 1
|
|
1073
1076
|
}, 8, ["disabled", "text"]),
|
|
1074
|
-
p.value ? (
|
|
1077
|
+
p.value ? (C(), F("div", {
|
|
1075
1078
|
key: 0,
|
|
1076
1079
|
class: "tile-actions",
|
|
1077
|
-
"data-testid": `tile-actions-${
|
|
1080
|
+
"data-testid": `tile-actions-${v.tileId}`
|
|
1078
1081
|
}, [
|
|
1079
|
-
|
|
1080
|
-
default:
|
|
1081
|
-
|
|
1082
|
+
E.value ? (C(), H(Pe, { key: 0 }, {
|
|
1083
|
+
default: P(() => [
|
|
1084
|
+
ue(J(E.value), 1)
|
|
1082
1085
|
]),
|
|
1083
1086
|
_: 1
|
|
1084
|
-
})) :
|
|
1085
|
-
y.value &&
|
|
1087
|
+
})) : V("", !0),
|
|
1088
|
+
y.value && v.context.editable ? (C(), H(S(ti), {
|
|
1086
1089
|
key: 1,
|
|
1087
1090
|
class: "edit-icon",
|
|
1088
|
-
color:
|
|
1089
|
-
"data-testid": `edit-tile-${
|
|
1090
|
-
size:
|
|
1091
|
-
onClick:
|
|
1092
|
-
}, null, 8, ["color", "data-testid", "size"])) :
|
|
1093
|
-
y.value && g.value ? (
|
|
1091
|
+
color: S(dt),
|
|
1092
|
+
"data-testid": `edit-tile-${v.tileId}`,
|
|
1093
|
+
size: S(ut),
|
|
1094
|
+
onClick: D
|
|
1095
|
+
}, null, 8, ["color", "data-testid", "size"])) : V("", !0),
|
|
1096
|
+
y.value && g.value ? (C(), H(re, {
|
|
1094
1097
|
key: 2,
|
|
1095
1098
|
class: "dropdown",
|
|
1096
|
-
"data-testid": `chart-action-menu-${
|
|
1099
|
+
"data-testid": `chart-action-menu-${v.tileId}`,
|
|
1097
1100
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1098
1101
|
}, {
|
|
1099
|
-
items:
|
|
1100
|
-
f.value ? (
|
|
1102
|
+
items: P(() => [
|
|
1103
|
+
f.value ? (C(), H(de, {
|
|
1101
1104
|
key: 0,
|
|
1102
|
-
"data-testid": `chart-jump-to-explore-${
|
|
1103
|
-
item: { label:
|
|
1104
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1105
|
-
!("allowCsvExport" in
|
|
1105
|
+
"data-testid": `chart-jump-to-explore-${v.tileId}`,
|
|
1106
|
+
item: { label: S(o).t("jumpToExplore"), to: f.value }
|
|
1107
|
+
}, null, 8, ["data-testid", "item"])) : V("", !0),
|
|
1108
|
+
!("allowCsvExport" in v.definition.chart) || v.definition.chart.allowCsvExport ? (C(), H(de, {
|
|
1106
1109
|
key: 1,
|
|
1107
1110
|
class: "chart-export-button",
|
|
1108
|
-
"data-testid": `chart-csv-export-${
|
|
1109
|
-
onClick:
|
|
1111
|
+
"data-testid": `chart-csv-export-${v.tileId}`,
|
|
1112
|
+
onClick: Z[0] || (Z[0] = (Ze) => ae())
|
|
1110
1113
|
}, {
|
|
1111
|
-
default:
|
|
1112
|
-
|
|
1114
|
+
default: P(() => [
|
|
1115
|
+
ce("span", {
|
|
1113
1116
|
class: "chart-export-trigger",
|
|
1114
|
-
"data-testid": `csv-export-button-${
|
|
1115
|
-
},
|
|
1117
|
+
"data-testid": `csv-export-button-${v.tileId}`
|
|
1118
|
+
}, J(S(o).t("csvExport.exportAsCsv")), 9, Mi)
|
|
1116
1119
|
]),
|
|
1117
1120
|
_: 1
|
|
1118
|
-
}, 8, ["data-testid"])) :
|
|
1119
|
-
|
|
1121
|
+
}, 8, ["data-testid"])) : V("", !0),
|
|
1122
|
+
v.context.editable ? (C(), H(de, {
|
|
1120
1123
|
key: 2,
|
|
1121
|
-
"data-testid": `
|
|
1122
|
-
onClick:
|
|
1124
|
+
"data-testid": `duplicate-tile-${v.tileId}`,
|
|
1125
|
+
onClick: x
|
|
1126
|
+
}, {
|
|
1127
|
+
default: P(() => [
|
|
1128
|
+
ue(J(S(o).t("renderer.duplicateTile")), 1)
|
|
1129
|
+
]),
|
|
1130
|
+
_: 1
|
|
1131
|
+
}, 8, ["data-testid"])) : V("", !0),
|
|
1132
|
+
v.context.editable ? (C(), H(de, {
|
|
1133
|
+
key: 3,
|
|
1134
|
+
"data-testid": `remove-tile-${v.tileId}`,
|
|
1135
|
+
onClick: N
|
|
1123
1136
|
}, {
|
|
1124
|
-
default:
|
|
1125
|
-
|
|
1137
|
+
default: P(() => [
|
|
1138
|
+
ue(J(S(o).t("renderer.remove")), 1)
|
|
1126
1139
|
]),
|
|
1127
1140
|
_: 1
|
|
1128
|
-
}, 8, ["data-testid"])) :
|
|
1141
|
+
}, 8, ["data-testid"])) : V("", !0)
|
|
1129
1142
|
]),
|
|
1130
|
-
default:
|
|
1131
|
-
|
|
1143
|
+
default: P(() => [
|
|
1144
|
+
se(S(ii), {
|
|
1132
1145
|
class: "kebab-action-menu",
|
|
1133
|
-
color:
|
|
1134
|
-
"data-testid": `kebab-action-menu-${
|
|
1135
|
-
size:
|
|
1146
|
+
color: S(dt),
|
|
1147
|
+
"data-testid": `kebab-action-menu-${v.tileId}`,
|
|
1148
|
+
size: S(ut)
|
|
1136
1149
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1137
1150
|
]),
|
|
1138
1151
|
_: 1
|
|
1139
|
-
}, 8, ["data-testid"])) :
|
|
1140
|
-
], 8,
|
|
1152
|
+
}, 8, ["data-testid"])) : V("", !0)
|
|
1153
|
+
], 8, Li)) : "description" in v.definition.chart ? (C(), F("div", {
|
|
1141
1154
|
key: 1,
|
|
1142
1155
|
class: "header-description",
|
|
1143
|
-
"data-testid": `tile-description-${
|
|
1144
|
-
},
|
|
1145
|
-
d.value ? (
|
|
1156
|
+
"data-testid": `tile-description-${v.tileId}`
|
|
1157
|
+
}, J(v.definition.chart.description), 9, Ii)) : V("", !0),
|
|
1158
|
+
d.value ? (C(), H(S(Xt), {
|
|
1146
1159
|
key: 2,
|
|
1147
1160
|
"chart-data": n.value,
|
|
1148
|
-
"data-testid": `csv-export-modal-${
|
|
1161
|
+
"data-testid": `csv-export-modal-${v.tileId}`,
|
|
1149
1162
|
filename: m.value,
|
|
1150
|
-
onToggleModal:
|
|
1151
|
-
}, null, 8, ["chart-data", "data-testid", "filename"])) :
|
|
1152
|
-
])) :
|
|
1153
|
-
|
|
1163
|
+
onToggleModal: q
|
|
1164
|
+
}, null, 8, ["chart-data", "data-testid", "filename"])) : V("", !0)
|
|
1165
|
+
])) : V("", !0),
|
|
1166
|
+
ce("div", {
|
|
1154
1167
|
class: "tile-content",
|
|
1155
|
-
"data-testid": `tile-content-${
|
|
1168
|
+
"data-testid": `tile-content-${v.tileId}`
|
|
1156
1169
|
}, [
|
|
1157
|
-
|
|
1158
|
-
onChartData:
|
|
1159
|
-
onZoomTimeRange:
|
|
1160
|
-
}), null, 16)) :
|
|
1161
|
-
], 8,
|
|
1162
|
-
], 10,
|
|
1170
|
+
k.value ? (C(), H(_t(k.value.component), pt({ key: 0 }, k.value.rendererProps, {
|
|
1171
|
+
onChartData: z,
|
|
1172
|
+
onZoomTimeRange: Z[1] || (Z[1] = (Ze) => s("zoom-time-range", Ze))
|
|
1173
|
+
}), null, 16)) : V("", !0)
|
|
1174
|
+
], 8, Pi)
|
|
1175
|
+
], 10, Hi);
|
|
1163
1176
|
};
|
|
1164
1177
|
}
|
|
1165
|
-
}),
|
|
1178
|
+
}), Bi = /* @__PURE__ */ he(qi, [["__scopeId", "data-v-e670d00d"]]), $i = (u, e, t) => {
|
|
1166
1179
|
const i = /* @__PURE__ */ new Map();
|
|
1167
1180
|
t.forEach((r) => {
|
|
1168
1181
|
const o = r.layout.position.row, n = i.get(o), d = r.layout.size.rows === 1 && !!r.layout.size.fitToContent;
|
|
@@ -1172,7 +1185,7 @@ const Ei = () => {
|
|
|
1172
1185
|
for (let r = 0; r < u; r++)
|
|
1173
1186
|
i.get(r) ? s.push("auto") : s.push(`${e}px`);
|
|
1174
1187
|
return s;
|
|
1175
|
-
},
|
|
1188
|
+
}, Ui = /* @__PURE__ */ W({
|
|
1176
1189
|
__name: "GridLayout",
|
|
1177
1190
|
props: {
|
|
1178
1191
|
gridSize: {
|
|
@@ -1182,7 +1195,7 @@ const Ei = () => {
|
|
|
1182
1195
|
tileHeight: {
|
|
1183
1196
|
type: Number,
|
|
1184
1197
|
required: !1,
|
|
1185
|
-
default: () =>
|
|
1198
|
+
default: () => Ke
|
|
1186
1199
|
},
|
|
1187
1200
|
tiles: {
|
|
1188
1201
|
type: Array,
|
|
@@ -1190,24 +1203,24 @@ const Ei = () => {
|
|
|
1190
1203
|
}
|
|
1191
1204
|
},
|
|
1192
1205
|
setup(u) {
|
|
1193
|
-
|
|
1206
|
+
Ge((n) => ({
|
|
1194
1207
|
"3bc5e939": u.gridSize.cols,
|
|
1195
1208
|
"77aa3028": r.value
|
|
1196
1209
|
}));
|
|
1197
|
-
const e = u, t =
|
|
1210
|
+
const e = u, t = U(null), i = U(0), s = new ResizeObserver((n) => {
|
|
1198
1211
|
window.requestAnimationFrame(() => {
|
|
1199
1212
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1200
1213
|
});
|
|
1201
1214
|
});
|
|
1202
|
-
|
|
1215
|
+
Ve(() => {
|
|
1203
1216
|
t.value && s.observe(t.value);
|
|
1204
|
-
}),
|
|
1217
|
+
}), Ue(() => {
|
|
1205
1218
|
t.value && s.unobserve(t.value);
|
|
1206
1219
|
});
|
|
1207
|
-
const r =
|
|
1220
|
+
const r = O(() => {
|
|
1208
1221
|
var d;
|
|
1209
|
-
return
|
|
1210
|
-
}), o =
|
|
1222
|
+
return $i((d = e.gridSize) == null ? void 0 : d.rows, e.tileHeight, e.tiles).join(" ");
|
|
1223
|
+
}), o = O(() => e.tiles.map((n, d) => ({
|
|
1211
1224
|
key: `tile-${d}`,
|
|
1212
1225
|
tile: n,
|
|
1213
1226
|
style: {
|
|
@@ -1217,27 +1230,27 @@ const Ei = () => {
|
|
|
1217
1230
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1218
1231
|
}
|
|
1219
1232
|
})));
|
|
1220
|
-
return (n, d) => (
|
|
1233
|
+
return (n, d) => (C(), F("div", {
|
|
1221
1234
|
ref_key: "gridContainer",
|
|
1222
1235
|
ref: t,
|
|
1223
1236
|
class: "kong-ui-public-grid-layout"
|
|
1224
1237
|
}, [
|
|
1225
|
-
(
|
|
1238
|
+
(C(!0), F(wt, null, bt(o.value, (h) => (C(), F("div", {
|
|
1226
1239
|
key: h.key,
|
|
1227
|
-
class:
|
|
1240
|
+
class: We(["grid-cell", {
|
|
1228
1241
|
"empty-cell": !h.tile
|
|
1229
1242
|
}]),
|
|
1230
|
-
style:
|
|
1243
|
+
style: tt(h.style)
|
|
1231
1244
|
}, [
|
|
1232
|
-
|
|
1233
|
-
style:
|
|
1245
|
+
Me(n.$slots, "tile", {
|
|
1246
|
+
style: tt(h.style),
|
|
1234
1247
|
tile: h.tile
|
|
1235
1248
|
}, void 0, !0)
|
|
1236
1249
|
], 6))), 128))
|
|
1237
1250
|
], 512));
|
|
1238
1251
|
}
|
|
1239
|
-
}), Fi = /* @__PURE__ */
|
|
1240
|
-
function
|
|
1252
|
+
}), Fi = /* @__PURE__ */ he(Ui, [["__scopeId", "data-v-f43eb7b8"]]);
|
|
1253
|
+
function Gi(u, e, t, i, s) {
|
|
1241
1254
|
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(u, o));
|
|
1242
1255
|
return r.prototype = e.prototype, r;
|
|
1243
1256
|
}
|
|
@@ -1278,11 +1291,11 @@ class c {
|
|
|
1278
1291
|
const i = c.createDiv(["grid-stack-item", e]), s = c.createDiv(["grid-stack-item-content"], i);
|
|
1279
1292
|
return t.lazyLoad || ((n = (o = t.grid) == null ? void 0 : o.opts) == null ? void 0 : n.lazyLoad) && t.lazyLoad !== !1 ? t.visibleObservable || (t.visibleObservable = new IntersectionObserver(([d]) => {
|
|
1280
1293
|
var h;
|
|
1281
|
-
d.isIntersecting && ((h = t.visibleObservable) == null || h.disconnect(), delete t.visibleObservable,
|
|
1294
|
+
d.isIntersecting && ((h = t.visibleObservable) == null || h.disconnect(), delete t.visibleObservable, w.renderCB(s, t));
|
|
1282
1295
|
}), window.setTimeout(() => {
|
|
1283
1296
|
var d;
|
|
1284
1297
|
return (d = t.visibleObservable) == null ? void 0 : d.observe(i);
|
|
1285
|
-
})) :
|
|
1298
|
+
})) : w.renderCB(s, t), i;
|
|
1286
1299
|
}
|
|
1287
1300
|
/** create a div with the given classes */
|
|
1288
1301
|
static createDiv(e, t) {
|
|
@@ -1599,7 +1612,7 @@ class c {
|
|
|
1599
1612
|
return !(!e || e.w === e.h || e.locked || e.noResize || (t = e.grid) != null && t.opts.disableResize || e.minW && e.minW === e.maxW || e.minH && e.minH === e.maxH);
|
|
1600
1613
|
}
|
|
1601
1614
|
}
|
|
1602
|
-
class
|
|
1615
|
+
class ee {
|
|
1603
1616
|
constructor(e = {}) {
|
|
1604
1617
|
this.addedNodes = [], this.removedNodes = [], this.defaultColumn = 12, this.column = e.column || this.defaultColumn, this.column > this.defaultColumn && (this.defaultColumn = this.column), this.maxRow = e.maxRow, this._float = e.float, this.nodes = e.nodes || [], this.onChange = e.onChange;
|
|
1605
1618
|
}
|
|
@@ -1777,7 +1790,7 @@ class Z {
|
|
|
1777
1790
|
* @param resizing if out of bound, resize down or move into the grid to fit ?
|
|
1778
1791
|
*/
|
|
1779
1792
|
prepareNode(e, t) {
|
|
1780
|
-
e._id = e._id ??
|
|
1793
|
+
e._id = e._id ?? ee._idSeq++;
|
|
1781
1794
|
const i = e.id;
|
|
1782
1795
|
if (i) {
|
|
1783
1796
|
let r = 1;
|
|
@@ -1872,7 +1885,7 @@ class Z {
|
|
|
1872
1885
|
if (t.pack = !0, !this.maxRow)
|
|
1873
1886
|
return this.moveNode(e, t);
|
|
1874
1887
|
let i;
|
|
1875
|
-
const s = new
|
|
1888
|
+
const s = new ee({
|
|
1876
1889
|
column: this.column,
|
|
1877
1890
|
float: this.float,
|
|
1878
1891
|
nodes: this.nodes.map((o) => o._id === e._id ? (i = { ...o }, i) : { ...o })
|
|
@@ -1894,7 +1907,7 @@ class Z {
|
|
|
1894
1907
|
willItFit(e) {
|
|
1895
1908
|
if (delete e._willFitPos, !this.maxRow)
|
|
1896
1909
|
return !0;
|
|
1897
|
-
const t = new
|
|
1910
|
+
const t = new ee({
|
|
1898
1911
|
column: this.column,
|
|
1899
1912
|
float: this.float,
|
|
1900
1913
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
@@ -2030,7 +2043,7 @@ class Z {
|
|
|
2030
2043
|
return e.forEach((r, o) => {
|
|
2031
2044
|
if (r._id === void 0) {
|
|
2032
2045
|
const n = r.id ? this.nodes.find((d) => d.id === r.id) : void 0;
|
|
2033
|
-
r._id = (n == null ? void 0 : n._id) ??
|
|
2046
|
+
r._id = (n == null ? void 0 : n._id) ?? ee._idSeq++;
|
|
2034
2047
|
}
|
|
2035
2048
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
2036
2049
|
}), this._layouts = i ? [] : this._layouts || [], this._layouts[t] = s, this;
|
|
@@ -2041,7 +2054,7 @@ class Z {
|
|
|
2041
2054
|
* @param column corresponding column index to save it under
|
|
2042
2055
|
*/
|
|
2043
2056
|
cacheOneLayout(e, t) {
|
|
2044
|
-
e._id = e._id ??
|
|
2057
|
+
e._id = e._id ?? ee._idSeq++;
|
|
2045
2058
|
const i = { x: e.x, y: e.y, w: e.w, _id: e._id };
|
|
2046
2059
|
(e.autoPosition || e.x === void 0) && (delete i.x, delete i.y, e.autoPosition && (i.autoPosition = !0)), this._layouts = this._layouts || [], this._layouts[t] = this._layouts[t] || [];
|
|
2047
2060
|
const s = this.findCacheLayout(e, t);
|
|
@@ -2065,8 +2078,8 @@ class Z {
|
|
|
2065
2078
|
return this;
|
|
2066
2079
|
}
|
|
2067
2080
|
}
|
|
2068
|
-
|
|
2069
|
-
const
|
|
2081
|
+
ee._idSeq = 0;
|
|
2082
|
+
const G = {
|
|
2070
2083
|
alwaysShowResizeHandle: "mobile",
|
|
2071
2084
|
animate: !0,
|
|
2072
2085
|
auto: !0,
|
|
@@ -2098,10 +2111,10 @@ const U = {
|
|
|
2098
2111
|
};
|
|
2099
2112
|
class b {
|
|
2100
2113
|
}
|
|
2101
|
-
const
|
|
2102
|
-
class
|
|
2114
|
+
const Q = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2115
|
+
class te {
|
|
2103
2116
|
}
|
|
2104
|
-
function
|
|
2117
|
+
function ke(u, e) {
|
|
2105
2118
|
if (u.touches.length > 1)
|
|
2106
2119
|
return;
|
|
2107
2120
|
u.cancelable && u.preventDefault();
|
|
@@ -2139,7 +2152,7 @@ function Se(u, e) {
|
|
|
2139
2152
|
// relatedTarget
|
|
2140
2153
|
), u.target.dispatchEvent(i);
|
|
2141
2154
|
}
|
|
2142
|
-
function
|
|
2155
|
+
function Ot(u, e) {
|
|
2143
2156
|
u.cancelable && u.preventDefault();
|
|
2144
2157
|
const t = document.createEvent("MouseEvents");
|
|
2145
2158
|
t.initMouseEvent(
|
|
@@ -2175,46 +2188,46 @@ function Ht(u, e) {
|
|
|
2175
2188
|
// relatedTarget
|
|
2176
2189
|
), u.target.dispatchEvent(t);
|
|
2177
2190
|
}
|
|
2178
|
-
function ke(u) {
|
|
2179
|
-
J.touchHandled || (J.touchHandled = !0, Se(u, "mousedown"));
|
|
2180
|
-
}
|
|
2181
2191
|
function Ne(u) {
|
|
2182
|
-
|
|
2192
|
+
te.touchHandled || (te.touchHandled = !0, ke(u, "mousedown"));
|
|
2183
2193
|
}
|
|
2184
2194
|
function Ae(u) {
|
|
2185
|
-
|
|
2195
|
+
te.touchHandled && ke(u, "mousemove");
|
|
2196
|
+
}
|
|
2197
|
+
function He(u) {
|
|
2198
|
+
if (!te.touchHandled)
|
|
2186
2199
|
return;
|
|
2187
|
-
|
|
2200
|
+
te.pointerLeaveTimeout && (window.clearTimeout(te.pointerLeaveTimeout), delete te.pointerLeaveTimeout);
|
|
2188
2201
|
const e = !!b.dragElement;
|
|
2189
|
-
|
|
2202
|
+
ke(u, "mouseup"), e || ke(u, "click"), te.touchHandled = !1;
|
|
2190
2203
|
}
|
|
2191
|
-
function
|
|
2204
|
+
function Oe(u) {
|
|
2192
2205
|
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
2193
2206
|
}
|
|
2194
|
-
function ct(u) {
|
|
2195
|
-
b.dragElement && u.pointerType !== "mouse" && Ht(u, "mouseenter");
|
|
2196
|
-
}
|
|
2197
2207
|
function ft(u) {
|
|
2198
|
-
b.dragElement && u.pointerType !== "mouse" && (
|
|
2199
|
-
|
|
2208
|
+
b.dragElement && u.pointerType !== "mouse" && Ot(u, "mouseenter");
|
|
2209
|
+
}
|
|
2210
|
+
function gt(u) {
|
|
2211
|
+
b.dragElement && u.pointerType !== "mouse" && (te.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2212
|
+
delete te.pointerLeaveTimeout, Ot(u, "mouseleave");
|
|
2200
2213
|
}, 10));
|
|
2201
2214
|
}
|
|
2202
|
-
class
|
|
2215
|
+
class Ie {
|
|
2203
2216
|
constructor(e, t, i) {
|
|
2204
2217
|
this.host = e, this.dir = t, this.option = i, this.moving = !1, this._mouseDown = this._mouseDown.bind(this), this._mouseMove = this._mouseMove.bind(this), this._mouseUp = this._mouseUp.bind(this), this._keyEvent = this._keyEvent.bind(this), this._init();
|
|
2205
2218
|
}
|
|
2206
2219
|
/** @internal */
|
|
2207
2220
|
_init() {
|
|
2208
2221
|
const e = this.el = document.createElement("div");
|
|
2209
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${
|
|
2222
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Ie.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), Q && (this.el.addEventListener("touchstart", Ne), this.el.addEventListener("pointerdown", Oe)), this;
|
|
2210
2223
|
}
|
|
2211
2224
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2212
2225
|
destroy() {
|
|
2213
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown),
|
|
2226
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), Q && (this.el.removeEventListener("touchstart", Ne), this.el.removeEventListener("pointerdown", Oe)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2214
2227
|
}
|
|
2215
2228
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2216
2229
|
_mouseDown(e) {
|
|
2217
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0),
|
|
2230
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), Q && (this.el.addEventListener("touchmove", Ae), this.el.addEventListener("touchend", He)), e.stopPropagation(), e.preventDefault();
|
|
2218
2231
|
}
|
|
2219
2232
|
/** @internal */
|
|
2220
2233
|
_mouseMove(e) {
|
|
@@ -2223,7 +2236,7 @@ class Me {
|
|
|
2223
2236
|
}
|
|
2224
2237
|
/** @internal */
|
|
2225
2238
|
_mouseUp(e) {
|
|
2226
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2239
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), Q && (this.el.removeEventListener("touchmove", Ae), this.el.removeEventListener("touchend", He)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2227
2240
|
}
|
|
2228
2241
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2229
2242
|
_keyEvent(e) {
|
|
@@ -2235,8 +2248,8 @@ class Me {
|
|
|
2235
2248
|
return this.option[e] && this.option[e](t), this;
|
|
2236
2249
|
}
|
|
2237
2250
|
}
|
|
2238
|
-
|
|
2239
|
-
class
|
|
2251
|
+
Ie.prefix = "ui-resizable-";
|
|
2252
|
+
class je {
|
|
2240
2253
|
constructor() {
|
|
2241
2254
|
this._eventRegister = {};
|
|
2242
2255
|
}
|
|
@@ -2264,7 +2277,7 @@ class Xe {
|
|
|
2264
2277
|
return this._eventRegister[e](t);
|
|
2265
2278
|
}
|
|
2266
2279
|
}
|
|
2267
|
-
class
|
|
2280
|
+
class be extends je {
|
|
2268
2281
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2269
2282
|
constructor(e, t = {}) {
|
|
2270
2283
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2334,7 +2347,7 @@ class _e extends Xe {
|
|
|
2334
2347
|
}
|
|
2335
2348
|
/** @internal */
|
|
2336
2349
|
_setupHandlers() {
|
|
2337
|
-
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new
|
|
2350
|
+
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new Ie(this.el, e, {
|
|
2338
2351
|
start: (t) => {
|
|
2339
2352
|
this._resizeStart(t);
|
|
2340
2353
|
},
|
|
@@ -2365,7 +2378,7 @@ class _e extends Xe {
|
|
|
2365
2378
|
}
|
|
2366
2379
|
/** @internal */
|
|
2367
2380
|
_setupHelper() {
|
|
2368
|
-
this.elOriginStyleVal =
|
|
2381
|
+
this.elOriginStyleVal = be._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2369
2382
|
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2370
2383
|
return this.rectScale = {
|
|
2371
2384
|
x: t.xScale,
|
|
@@ -2374,7 +2387,7 @@ class _e extends Xe {
|
|
|
2374
2387
|
}
|
|
2375
2388
|
/** @internal */
|
|
2376
2389
|
_cleanHelper() {
|
|
2377
|
-
return
|
|
2390
|
+
return be._originStyleProp.forEach((e, t) => {
|
|
2378
2391
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
2379
2392
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
2380
2393
|
}
|
|
@@ -2413,9 +2426,9 @@ class _e extends Xe {
|
|
|
2413
2426
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
2414
2427
|
}
|
|
2415
2428
|
}
|
|
2416
|
-
|
|
2417
|
-
const
|
|
2418
|
-
class
|
|
2429
|
+
be._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2430
|
+
const Wi = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2431
|
+
class Ee extends je {
|
|
2419
2432
|
constructor(e, t = {}) {
|
|
2420
2433
|
var r;
|
|
2421
2434
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2435,12 +2448,12 @@ class we extends Xe {
|
|
|
2435
2448
|
}
|
|
2436
2449
|
enable() {
|
|
2437
2450
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2438
|
-
e.addEventListener("mousedown", this._mouseDown),
|
|
2451
|
+
e.addEventListener("mousedown", this._mouseDown), Q && (e.addEventListener("touchstart", Ne), e.addEventListener("pointerdown", Oe));
|
|
2439
2452
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2440
2453
|
}
|
|
2441
2454
|
disable(e = !1) {
|
|
2442
2455
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2443
|
-
t.removeEventListener("mousedown", this._mouseDown),
|
|
2456
|
+
t.removeEventListener("mousedown", this._mouseDown), Q && (t.removeEventListener("touchstart", Ne), t.removeEventListener("pointerdown", Oe));
|
|
2444
2457
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2445
2458
|
}
|
|
2446
2459
|
destroy() {
|
|
@@ -2452,7 +2465,7 @@ class we extends Xe {
|
|
|
2452
2465
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2453
2466
|
_mouseDown(e) {
|
|
2454
2467
|
if (!b.mouseHandled)
|
|
2455
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
2468
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Wi) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete b.dragElement, delete b.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), Q && (e.currentTarget.addEventListener("touchmove", Ae), e.currentTarget.addEventListener("touchend", He)), e.preventDefault(), document.activeElement && document.activeElement.blur(), b.mouseHandled = !0), !0;
|
|
2456
2469
|
}
|
|
2457
2470
|
/** @internal method to call actual drag event */
|
|
2458
2471
|
_callDrag(e) {
|
|
@@ -2483,7 +2496,7 @@ class we extends Xe {
|
|
|
2483
2496
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2484
2497
|
_mouseUp(e) {
|
|
2485
2498
|
var t, i;
|
|
2486
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2499
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), Q && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", Ae, !0), e.currentTarget.removeEventListener("touchend", He, !0)), this.dragging) {
|
|
2487
2500
|
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i = b.dropElement) == null ? void 0 : i.el) === this.el.parentElement && delete b.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
2488
2501
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2489
2502
|
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), b.dropElement && b.dropElement.drop(e);
|
|
@@ -2505,7 +2518,7 @@ class we extends Xe {
|
|
|
2505
2518
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
2506
2519
|
_createHelper() {
|
|
2507
2520
|
let e = this.el;
|
|
2508
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), document.body.contains(e) || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle =
|
|
2521
|
+
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), document.body.contains(e) || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle = Ee.originStyleProp.map((t) => this.el.style[t]), e;
|
|
2509
2522
|
}
|
|
2510
2523
|
/** @internal set the fix position of the dragged item */
|
|
2511
2524
|
_setupHelperStyle(e) {
|
|
@@ -2522,7 +2535,7 @@ class we extends Xe {
|
|
|
2522
2535
|
const e = (t = this.helper) == null ? void 0 : t.gridstackNode;
|
|
2523
2536
|
if (!(e != null && e._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
2524
2537
|
const i = this.helper, s = this.dragElementOriginStyle.transition || null;
|
|
2525
|
-
i.style.transition = this.dragElementOriginStyle.transition = "none",
|
|
2538
|
+
i.style.transition = this.dragElementOriginStyle.transition = "none", Ee.originStyleProp.forEach((r) => i.style[r] = this.dragElementOriginStyle[r] || null), setTimeout(() => i.style.transition = s, 50);
|
|
2526
2539
|
}
|
|
2527
2540
|
return delete this.dragElementOriginStyle, this;
|
|
2528
2541
|
}
|
|
@@ -2564,8 +2577,8 @@ class we extends Xe {
|
|
|
2564
2577
|
};
|
|
2565
2578
|
}
|
|
2566
2579
|
}
|
|
2567
|
-
|
|
2568
|
-
class
|
|
2580
|
+
Ee.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2581
|
+
class Vi extends je {
|
|
2569
2582
|
constructor(e, t = {}) {
|
|
2570
2583
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2571
2584
|
}
|
|
@@ -2576,10 +2589,10 @@ class Wi extends Xe {
|
|
|
2576
2589
|
super.off(e);
|
|
2577
2590
|
}
|
|
2578
2591
|
enable() {
|
|
2579
|
-
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),
|
|
2592
|
+
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), Q && (this.el.addEventListener("pointerenter", ft), this.el.addEventListener("pointerleave", gt)));
|
|
2580
2593
|
}
|
|
2581
2594
|
disable(e = !1) {
|
|
2582
|
-
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),
|
|
2595
|
+
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), Q && (this.el.removeEventListener("pointerenter", ft), this.el.removeEventListener("pointerleave", gt)));
|
|
2583
2596
|
}
|
|
2584
2597
|
destroy() {
|
|
2585
2598
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2631,9 +2644,9 @@ class Wi extends Xe {
|
|
|
2631
2644
|
};
|
|
2632
2645
|
}
|
|
2633
2646
|
}
|
|
2634
|
-
class
|
|
2647
|
+
class Qe {
|
|
2635
2648
|
static init(e) {
|
|
2636
|
-
return e.ddElement || (e.ddElement = new
|
|
2649
|
+
return e.ddElement || (e.ddElement = new Qe(e)), e.ddElement;
|
|
2637
2650
|
}
|
|
2638
2651
|
constructor(e) {
|
|
2639
2652
|
this.el = e;
|
|
@@ -2645,25 +2658,25 @@ class je {
|
|
|
2645
2658
|
return this.ddDraggable && ["drag", "dragstart", "dragstop"].indexOf(e) > -1 ? this.ddDraggable.off(e) : this.ddDroppable && ["drop", "dropover", "dropout"].indexOf(e) > -1 ? this.ddDroppable.off(e) : this.ddResizable && ["resizestart", "resize", "resizestop"].indexOf(e) > -1 && this.ddResizable.off(e), this;
|
|
2646
2659
|
}
|
|
2647
2660
|
setupDraggable(e) {
|
|
2648
|
-
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new
|
|
2661
|
+
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new Ee(this.el, e), this;
|
|
2649
2662
|
}
|
|
2650
2663
|
cleanDraggable() {
|
|
2651
2664
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2652
2665
|
}
|
|
2653
2666
|
setupResizable(e) {
|
|
2654
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2667
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new be(this.el, e), this;
|
|
2655
2668
|
}
|
|
2656
2669
|
cleanResizable() {
|
|
2657
2670
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2658
2671
|
}
|
|
2659
2672
|
setupDroppable(e) {
|
|
2660
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2673
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Vi(this.el, e), this;
|
|
2661
2674
|
}
|
|
2662
2675
|
cleanDroppable() {
|
|
2663
2676
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2664
2677
|
}
|
|
2665
2678
|
}
|
|
2666
|
-
class
|
|
2679
|
+
class Ki {
|
|
2667
2680
|
resizable(e, t, i, s) {
|
|
2668
2681
|
return this._getDDElements(e).forEach((r) => {
|
|
2669
2682
|
if (t === "disable" || t === "enable")
|
|
@@ -2744,7 +2757,7 @@ class Vi {
|
|
|
2744
2757
|
const i = c.getElements(e);
|
|
2745
2758
|
if (!i.length)
|
|
2746
2759
|
return [];
|
|
2747
|
-
const s = i.map((r) => r.ddElement || (t ?
|
|
2760
|
+
const s = i.map((r) => r.ddElement || (t ? Qe.init(r) : null));
|
|
2748
2761
|
return t || s.filter((r) => r), s;
|
|
2749
2762
|
}
|
|
2750
2763
|
}
|
|
@@ -2755,8 +2768,8 @@ class Vi {
|
|
|
2755
2768
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2756
2769
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2757
2770
|
*/
|
|
2758
|
-
const
|
|
2759
|
-
class
|
|
2771
|
+
const B = new Ki();
|
|
2772
|
+
class w {
|
|
2760
2773
|
/**
|
|
2761
2774
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
2762
2775
|
* simply return the existing instance (ignore any passed options). There is also an initAll() version that support
|
|
@@ -2773,8 +2786,8 @@ class _ {
|
|
|
2773
2786
|
static init(e = {}, t = ".grid-stack") {
|
|
2774
2787
|
if (typeof document > "u")
|
|
2775
2788
|
return null;
|
|
2776
|
-
const i =
|
|
2777
|
-
return i ? (i.gridstack || (i.gridstack = new
|
|
2789
|
+
const i = w.getGridElement(t);
|
|
2790
|
+
return i ? (i.gridstack || (i.gridstack = new w(i, c.cloneDeep(e))), i.gridstack) : (console.error(typeof t == "string" ? 'GridStack.initAll() no grid was found with selector "' + t + `" - element missing or wrong selector ?
|
|
2778
2791
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.` : "GridStack.init() no grid element was passed."), null);
|
|
2779
2792
|
}
|
|
2780
2793
|
/**
|
|
@@ -2788,8 +2801,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2788
2801
|
*/
|
|
2789
2802
|
static initAll(e = {}, t = ".grid-stack") {
|
|
2790
2803
|
const i = [];
|
|
2791
|
-
return typeof document > "u" || (
|
|
2792
|
-
s.gridstack || (s.gridstack = new
|
|
2804
|
+
return typeof document > "u" || (w.getGridElements(t).forEach((s) => {
|
|
2805
|
+
s.gridstack || (s.gridstack = new w(s, c.cloneDeep(e))), i.push(s.gridstack);
|
|
2793
2806
|
}), i.length === 0 && console.error('GridStack.initAll() no grid was found with selector "' + t + `" - element missing or wrong selector ?
|
|
2794
2807
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)), i;
|
|
2795
2808
|
}
|
|
@@ -2808,19 +2821,19 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2808
2821
|
const o = i.gridstack;
|
|
2809
2822
|
return t && (o.opts = { ...o.opts, ...t }), t.children !== void 0 && o.load(t.children), o;
|
|
2810
2823
|
}
|
|
2811
|
-
return (!e.classList.contains("grid-stack") ||
|
|
2824
|
+
return (!e.classList.contains("grid-stack") || w.addRemoveCB) && (w.addRemoveCB ? i = w.addRemoveCB(e, t, !0, !0) : i = c.createDiv(["grid-stack", t.class], e)), w.init(t, i);
|
|
2812
2825
|
}
|
|
2813
2826
|
/** call this method to register your engine instead of the default one.
|
|
2814
2827
|
* See instead `GridStackOptions.engineClass` if you only need to
|
|
2815
2828
|
* replace just one instance.
|
|
2816
2829
|
*/
|
|
2817
2830
|
static registerEngine(e) {
|
|
2818
|
-
|
|
2831
|
+
w.engineClass = e;
|
|
2819
2832
|
}
|
|
2820
2833
|
/** @internal create placeholder DIV as needed */
|
|
2821
2834
|
get placeholder() {
|
|
2822
2835
|
if (!this._placeholder) {
|
|
2823
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2836
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, G.itemClass, this.opts.itemClass]);
|
|
2824
2837
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2825
2838
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2826
2839
|
}
|
|
@@ -2847,24 +2860,24 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2847
2860
|
const o = t.columnOpts;
|
|
2848
2861
|
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((p, y) => (y.w || 0) - (p.w || 0));
|
|
2849
2862
|
const n = {
|
|
2850
|
-
...c.cloneDeep(
|
|
2851
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2852
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2853
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2854
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2863
|
+
...c.cloneDeep(G),
|
|
2864
|
+
column: c.toNumber(e.getAttribute("gs-column")) || G.column,
|
|
2865
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || G.minRow,
|
|
2866
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || G.maxRow,
|
|
2867
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || G.staticGrid,
|
|
2855
2868
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2856
2869
|
draggable: {
|
|
2857
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2870
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || G.draggable.handle
|
|
2858
2871
|
},
|
|
2859
2872
|
removableOptions: {
|
|
2860
|
-
accept: t.itemClass ||
|
|
2861
|
-
decline:
|
|
2873
|
+
accept: t.itemClass || G.removableOptions.accept,
|
|
2874
|
+
decline: G.removableOptions.decline
|
|
2862
2875
|
}
|
|
2863
2876
|
};
|
|
2864
2877
|
e.getAttribute("gs-animate") && (n.animate = c.toBool(e.getAttribute("gs-animate"))), t = c.defaults(t, n), this._initMargin(), this.checkDynamicColumn(), this.el.classList.add("gs-" + t.column), t.rtl === "auto" && (t.rtl = e.style.direction === "rtl"), t.rtl && this.el.classList.add("grid-stack-rtl");
|
|
2865
|
-
const d = this.el.closest("." +
|
|
2866
|
-
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !==
|
|
2867
|
-
const a = t.engineClass ||
|
|
2878
|
+
const d = this.el.closest("." + G.itemClass), h = d == null ? void 0 : d.gridstackNode;
|
|
2879
|
+
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== G.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = Q), this._styleSheetClass = "gs-id-" + ee._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2880
|
+
const a = t.engineClass || w.engineClass || ee;
|
|
2868
2881
|
if (this.engine = new a({
|
|
2869
2882
|
column: this.getColumn(),
|
|
2870
2883
|
float: t.float,
|
|
@@ -2905,7 +2918,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2905
2918
|
if (e.ELEMENT_NODE)
|
|
2906
2919
|
return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"), this.makeWidget(e);
|
|
2907
2920
|
let t, i = e;
|
|
2908
|
-
if (i.grid = this, i != null && i.el ? t = i.el :
|
|
2921
|
+
if (i.grid = this, i != null && i.el ? t = i.el : w.addRemoveCB ? t = w.addRemoveCB(this.el, e, !0, !1) : t = c.createWidgetDivs(this.opts.itemClass, i), !t)
|
|
2909
2922
|
return;
|
|
2910
2923
|
if (i = t.gridstackNode, i && t.parentElement === this.el && this.engine.nodes.find((r) => r._id === i._id))
|
|
2911
2924
|
return t;
|
|
@@ -2944,11 +2957,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2944
2957
|
let d;
|
|
2945
2958
|
t.column === "auto" && (d = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
2946
2959
|
let h = r.el.querySelector(".grid-stack-item-content"), a, l;
|
|
2947
|
-
if (s && (this._removeDD(r.el), l = { ...r, x: 0, y: 0 }, c.removeInternalForSave(l), delete l.subGridOpts, r.content && (l.content = r.content, delete r.content),
|
|
2948
|
-
const g = d ? t.column : r.w, R = r.h + i.h,
|
|
2949
|
-
|
|
2960
|
+
if (s && (this._removeDD(r.el), l = { ...r, x: 0, y: 0 }, c.removeInternalForSave(l), delete l.subGridOpts, r.content && (l.content = r.content, delete r.content), w.addRemoveCB ? a = w.addRemoveCB(this.el, l, !0, !1) : (a = c.createDiv(["grid-stack-item"]), a.appendChild(h), h = c.createDiv(["grid-stack-item-content"], r.el)), this._prepareDragDropByNode(r)), i) {
|
|
2961
|
+
const g = d ? t.column : r.w, R = r.h + i.h, k = r.el.style;
|
|
2962
|
+
k.transition = "none", this.update(r.el, { w: g, h: R }), setTimeout(() => k.transition = null);
|
|
2950
2963
|
}
|
|
2951
|
-
const f = r.subGrid =
|
|
2964
|
+
const f = r.subGrid = w.addGrid(h, t);
|
|
2952
2965
|
return i != null && i._moving && (f._isTemp = !0), d && (f._autoColumn = !0), s && f.makeWidget(a, l), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
2953
2966
|
}
|
|
2954
2967
|
/**
|
|
@@ -2971,7 +2984,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2971
2984
|
* @param saveCB callback for each node -> widget, so application can insert additional data to be saved into the widget data structure.
|
|
2972
2985
|
* @returns list of widgets or full grid option, including .children list of widgets
|
|
2973
2986
|
*/
|
|
2974
|
-
save(e = !0, t = !1, i =
|
|
2987
|
+
save(e = !0, t = !1, i = w.saveCB) {
|
|
2975
2988
|
const s = this.engine.save(e, i);
|
|
2976
2989
|
if (s.forEach((r) => {
|
|
2977
2990
|
var o;
|
|
@@ -2987,7 +3000,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2987
3000
|
const r = c.cloneDeep(this.opts);
|
|
2988
3001
|
r.marginBottom === r.marginTop && r.marginRight === r.marginLeft && r.marginTop === r.marginRight && (r.margin = r.marginTop, delete r.marginTop, delete r.marginRight, delete r.marginBottom, delete r.marginLeft), r.rtl === (this.el.style.direction === "rtl") && (r.rtl = "auto"), this._isAutoCellHeight && (r.cellHeight = "auto"), this._autoColumn && (r.column = "auto");
|
|
2989
3002
|
const o = r._alwaysShowResizeHandle;
|
|
2990
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
3003
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, G), r.children = s, r;
|
|
2991
3004
|
}
|
|
2992
3005
|
return s;
|
|
2993
3006
|
}
|
|
@@ -3001,7 +3014,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3001
3014
|
* @example
|
|
3002
3015
|
* see http://gridstackjs.com/demo/serialization.html
|
|
3003
3016
|
*/
|
|
3004
|
-
load(e, t =
|
|
3017
|
+
load(e, t = w.addRemoveCB || !0) {
|
|
3005
3018
|
var h;
|
|
3006
3019
|
e = c.cloneDeep(e);
|
|
3007
3020
|
const i = this.getColumn();
|
|
@@ -3012,15 +3025,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3012
3025
|
e.forEach((a) => {
|
|
3013
3026
|
s = Math.max(s, (a.x || 0) + a.w);
|
|
3014
3027
|
}), s > this.engine.defaultColumn && (this.engine.defaultColumn = s), s > i && this.engine.cacheLayout(e, s, !0);
|
|
3015
|
-
const r =
|
|
3016
|
-
typeof t == "function" && (
|
|
3028
|
+
const r = w.addRemoveCB;
|
|
3029
|
+
typeof t == "function" && (w.addRemoveCB = t);
|
|
3017
3030
|
const o = [];
|
|
3018
3031
|
this.batchUpdate();
|
|
3019
3032
|
const n = !this.engine.nodes.length;
|
|
3020
3033
|
n && this.setAnimation(!1), !n && t && [...this.engine.nodes].forEach((l) => {
|
|
3021
3034
|
if (!l.id)
|
|
3022
3035
|
return;
|
|
3023
|
-
c.find(e, l.id) || (
|
|
3036
|
+
c.find(e, l.id) || (w.addRemoveCB && w.addRemoveCB(this.el, l, !1, !1), o.push(l), this.removeWidget(l.el, !0, !1));
|
|
3024
3037
|
}), this.engine._loading = !0;
|
|
3025
3038
|
const d = [];
|
|
3026
3039
|
return this.engine.nodes = this.engine.nodes.filter((a) => c.find(e, a.id) ? (d.push(a), !1) : !0), e.forEach((a) => {
|
|
@@ -3032,7 +3045,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3032
3045
|
m && m.gridstack && m.gridstack.load(a.subGridOpts.children);
|
|
3033
3046
|
}
|
|
3034
3047
|
} else t && this.addWidget(a);
|
|
3035
|
-
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ?
|
|
3048
|
+
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? w.addRemoveCB = r : delete w.addRemoveCB, n && ((h = this.opts) != null && h.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
3036
3049
|
}
|
|
3037
3050
|
/**
|
|
3038
3051
|
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
@@ -3221,7 +3234,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3221
3234
|
* grid.makeWidget('2', {w:2, content: 'hello'});
|
|
3222
3235
|
*/
|
|
3223
3236
|
makeWidget(e, t) {
|
|
3224
|
-
const i =
|
|
3237
|
+
const i = w.getElement(e);
|
|
3225
3238
|
if (!i)
|
|
3226
3239
|
return;
|
|
3227
3240
|
i.parentElement || this.el.appendChild(i), this._prepareElement(i, !0, t);
|
|
@@ -3253,11 +3266,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3253
3266
|
* @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
|
|
3254
3267
|
*/
|
|
3255
3268
|
removeWidget(e, t = !0, i = !0) {
|
|
3256
|
-
return e ? (
|
|
3269
|
+
return e ? (w.getElements(e).forEach((s) => {
|
|
3257
3270
|
if (s.parentElement && s.parentElement !== this.el)
|
|
3258
3271
|
return;
|
|
3259
3272
|
let r = s.gridstackNode;
|
|
3260
|
-
r || (r = this.engine.nodes.find((o) => s === o.el)), r && (t &&
|
|
3273
|
+
r || (r = this.engine.nodes.find((o) => s === o.el)), r && (t && w.addRemoveCB && w.addRemoveCB(this.el, r, !1, !1), delete s.gridstackNode, this._removeDD(s), this.engine.removeNode(r, t, i), t && s.parentElement && s.remove());
|
|
3261
3274
|
}), i && (this._triggerRemoveEvent(), this._triggerChangeEvent()), this) : (console.error("Error: GridStack.removeWidget(undefined) called"), this);
|
|
3262
3275
|
}
|
|
3263
3276
|
/**
|
|
@@ -3267,7 +3280,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3267
3280
|
*/
|
|
3268
3281
|
removeAll(e = !0, t = !0) {
|
|
3269
3282
|
return this.engine.nodes.forEach((i) => {
|
|
3270
|
-
e &&
|
|
3283
|
+
e && w.addRemoveCB && w.addRemoveCB(this.el, i, !1, !1), delete i.el.gridstackNode, this.opts.staticGrid || this._removeDD(i.el);
|
|
3271
3284
|
}), this.engine.removeAll(e, t), t && this._triggerRemoveEvent(), this;
|
|
3272
3285
|
}
|
|
3273
3286
|
/**
|
|
@@ -3308,7 +3321,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3308
3321
|
let s = 1;
|
|
3309
3322
|
return t = { x: i[s++], y: i[s++], w: i[s++], h: i[s++] }, this.update(e, t);
|
|
3310
3323
|
}
|
|
3311
|
-
return
|
|
3324
|
+
return w.getElements(e).forEach((i) => {
|
|
3312
3325
|
var a;
|
|
3313
3326
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3314
3327
|
if (!s)
|
|
@@ -3321,7 +3334,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3321
3334
|
n[l] = r[l] !== void 0 ? r[l] : s[l], delete r[l];
|
|
3322
3335
|
})), !n && (r.minW || r.minH || r.maxW || r.maxH) && (n = {}), r.content !== void 0) {
|
|
3323
3336
|
const l = i.querySelector(".grid-stack-item-content");
|
|
3324
|
-
l && l.textContent !== r.content && (s.content = r.content,
|
|
3337
|
+
l && l.textContent !== r.content && (s.content = r.content, w.renderCB(l, r), (a = s.subGrid) != null && a.el && (l.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3325
3338
|
}
|
|
3326
3339
|
let d = !1, h = !1;
|
|
3327
3340
|
for (const l in r)
|
|
@@ -3357,7 +3370,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3357
3370
|
if (!s)
|
|
3358
3371
|
return;
|
|
3359
3372
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3360
|
-
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(
|
|
3373
|
+
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(w.resizeToContentParent)), !o)
|
|
3361
3374
|
return;
|
|
3362
3375
|
const n = e.clientHeight - o.clientHeight, d = t.h ? t.h * s - n : o.clientHeight;
|
|
3363
3376
|
let h;
|
|
@@ -3371,7 +3384,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3371
3384
|
{
|
|
3372
3385
|
const p = o.firstElementChild;
|
|
3373
3386
|
if (!p) {
|
|
3374
|
-
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${
|
|
3387
|
+
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${w.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3375
3388
|
return;
|
|
3376
3389
|
}
|
|
3377
3390
|
h = p.getBoundingClientRect().height || d;
|
|
@@ -3386,14 +3399,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3386
3399
|
}
|
|
3387
3400
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3388
3401
|
resizeToContentCBCheck(e) {
|
|
3389
|
-
|
|
3402
|
+
w.resizeToContentCB ? w.resizeToContentCB(e) : this.resizeToContent(e);
|
|
3390
3403
|
}
|
|
3391
3404
|
/** rotate (by swapping w & h) the passed in node - called when user press 'r' during dragging
|
|
3392
3405
|
* @param els widget or selector of objects to modify
|
|
3393
3406
|
* @param relative optional pixel coord relative to upper/left corner to rotate around (will keep that cell under cursor)
|
|
3394
3407
|
*/
|
|
3395
3408
|
rotate(e, t) {
|
|
3396
|
-
return
|
|
3409
|
+
return w.getElements(e).forEach((i) => {
|
|
3397
3410
|
const s = i.gridstackNode;
|
|
3398
3411
|
if (!c.canBeRotated(s))
|
|
3399
3412
|
return;
|
|
@@ -3534,7 +3547,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3534
3547
|
}
|
|
3535
3548
|
/** @internal */
|
|
3536
3549
|
_prepareElement(e, t = !1, i) {
|
|
3537
|
-
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(
|
|
3550
|
+
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(G.itemClass, this.opts.itemClass);
|
|
3538
3551
|
const s = c.shouldSizeToContent(i);
|
|
3539
3552
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), this._prepareDragDropByNode(i), this;
|
|
3540
3553
|
}
|
|
@@ -3620,7 +3633,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3620
3633
|
}
|
|
3621
3634
|
/** @internal */
|
|
3622
3635
|
static getGridElement(e) {
|
|
3623
|
-
return
|
|
3636
|
+
return w.getElement(e);
|
|
3624
3637
|
}
|
|
3625
3638
|
/** @internal */
|
|
3626
3639
|
static getGridElements(e) {
|
|
@@ -3638,7 +3651,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3638
3651
|
*/
|
|
3639
3652
|
/** get the global (but static to this code) DD implementation */
|
|
3640
3653
|
static getDD() {
|
|
3641
|
-
return
|
|
3654
|
+
return B;
|
|
3642
3655
|
}
|
|
3643
3656
|
/**
|
|
3644
3657
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3651,7 +3664,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3651
3664
|
*/
|
|
3652
3665
|
static setupDragIn(e, t, i, s = document) {
|
|
3653
3666
|
(t == null ? void 0 : t.pause) !== void 0 && (b.pauseDrag = t.pause), t = { appendTo: "body", helper: "clone", ...t || {} }, (typeof e == "string" ? c.getElements(e, s) : e).forEach((o, n) => {
|
|
3654
|
-
|
|
3667
|
+
B.isDraggable(o) || B.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3655
3668
|
});
|
|
3656
3669
|
}
|
|
3657
3670
|
/**
|
|
@@ -3661,7 +3674,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3661
3674
|
* @param val if true widget will be draggable, assuming the parent grid isn't noMove or static.
|
|
3662
3675
|
*/
|
|
3663
3676
|
movable(e, t) {
|
|
3664
|
-
return this.opts.staticGrid ? this : (
|
|
3677
|
+
return this.opts.staticGrid ? this : (w.getElements(e).forEach((i) => {
|
|
3665
3678
|
const s = i.gridstackNode;
|
|
3666
3679
|
s && (t ? delete s.noMove : s.noMove = !0, this._prepareDragDropByNode(s));
|
|
3667
3680
|
}), this);
|
|
@@ -3672,7 +3685,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3672
3685
|
* @param val if true widget will be resizable, assuming the parent grid isn't noResize or static.
|
|
3673
3686
|
*/
|
|
3674
3687
|
resizable(e, t) {
|
|
3675
|
-
return this.opts.staticGrid ? this : (
|
|
3688
|
+
return this.opts.staticGrid ? this : (w.getElements(e).forEach((i) => {
|
|
3676
3689
|
const s = i.gridstackNode;
|
|
3677
3690
|
s && (t ? delete s.noResize : s.noResize = !0, this._prepareDragDropByNode(s));
|
|
3678
3691
|
}), this);
|
|
@@ -3726,16 +3739,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3726
3739
|
cancelDrag() {
|
|
3727
3740
|
var t;
|
|
3728
3741
|
const e = (t = this._placeholder) == null ? void 0 : t.gridstackNode;
|
|
3729
|
-
e && (e._isExternal ? (e._isAboutToRemove = !0, this.engine.removeNode(e)) : e._isAboutToRemove &&
|
|
3742
|
+
e && (e._isExternal ? (e._isAboutToRemove = !0, this.engine.removeNode(e)) : e._isAboutToRemove && w._itemRemoving(e.el, !1), this.engine.restoreInitial());
|
|
3730
3743
|
}
|
|
3731
3744
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3732
3745
|
_removeDD(e) {
|
|
3733
|
-
return
|
|
3746
|
+
return B.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3734
3747
|
}
|
|
3735
3748
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3736
3749
|
_setupAcceptWidget() {
|
|
3737
3750
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3738
|
-
return
|
|
3751
|
+
return B.droppable(this.el, "destroy"), this;
|
|
3739
3752
|
let e, t;
|
|
3740
3753
|
const i = (s, r, o) => {
|
|
3741
3754
|
var f;
|
|
@@ -3760,7 +3773,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3760
3773
|
if (n._temporaryRemoved) {
|
|
3761
3774
|
if (n.x = Math.max(0, Math.round(h / t)), n.y = Math.max(0, Math.round(d / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3762
3775
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3763
|
-
|
|
3776
|
+
B.off(r, "drag");
|
|
3764
3777
|
return;
|
|
3765
3778
|
}
|
|
3766
3779
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
@@ -3769,7 +3782,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3769
3782
|
} else
|
|
3770
3783
|
this._dragOrResize(o, s, l, n, t, e);
|
|
3771
3784
|
};
|
|
3772
|
-
return
|
|
3785
|
+
return B.droppable(this.el, {
|
|
3773
3786
|
accept: (s) => {
|
|
3774
3787
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3775
3788
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3808,7 +3821,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3808
3821
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3809
3822
|
const d = n.w || Math.round(o.offsetWidth / t) || 1, h = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3810
3823
|
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: d, h, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3811
|
-
n._temporaryRemoved = !0) : (n.w = d, n.h = h, n._temporaryRemoved = !0),
|
|
3824
|
+
n._temporaryRemoved = !0) : (n.w = d, n.h = h, n._temporaryRemoved = !0), w._itemRemoving(n.el, !1), B.on(r, "drag", i), i(s, r, o), !1;
|
|
3812
3825
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3813
3826
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3814
3827
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
@@ -3826,10 +3839,10 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3826
3839
|
const g = l.grid;
|
|
3827
3840
|
g.engine.removeNodeFromLayoutCache(l), g.engine.removedNodes.push(l), g._triggerRemoveEvent()._triggerChangeEvent(), g.parentGridNode && !g.engine.nodes.length && g.opts.subGridDynamic && g.removeAsSubGrid();
|
|
3828
3841
|
}
|
|
3829
|
-
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp,
|
|
3842
|
+
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp, B.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !d))
|
|
3830
3843
|
return !1;
|
|
3831
3844
|
const f = (y = (p = n.subGrid) == null ? void 0 : p.el) == null ? void 0 : y.gridstack;
|
|
3832
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts ||
|
|
3845
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts || w.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" }, l && l.grid ? l : void 0, n), a && this.setAnimation(this.opts.animate, !0), !1;
|
|
3833
3846
|
}), this;
|
|
3834
3847
|
}
|
|
3835
3848
|
/** @internal mark item for removal */
|
|
@@ -3844,7 +3857,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3844
3857
|
if (typeof this.opts.removable != "string")
|
|
3845
3858
|
return this;
|
|
3846
3859
|
const e = document.querySelector(this.opts.removable);
|
|
3847
|
-
return e ? (!this.opts.staticGrid && !
|
|
3860
|
+
return e ? (!this.opts.staticGrid && !B.isDroppable(e) && B.droppable(e, this.opts.removableOptions).on(e, "dropover", (t, i) => w._itemRemoving(i, !0)).on(e, "dropout", (t, i) => w._itemRemoving(i, !1)), this) : this;
|
|
3848
3861
|
}
|
|
3849
3862
|
/** @internal prepares the element for drag&drop */
|
|
3850
3863
|
_prepareDragDropByNode(e) {
|
|
@@ -3869,7 +3882,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3869
3882
|
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), a.type === "resizestop" && (Number.isInteger(e.sizeToContent) && (e.sizeToContent = e.h), this.resizeToContentCheck(l, e));
|
|
3870
3883
|
}
|
|
3871
3884
|
};
|
|
3872
|
-
|
|
3885
|
+
B.draggable(t, {
|
|
3873
3886
|
start: n,
|
|
3874
3887
|
stop: h,
|
|
3875
3888
|
drag: d
|
|
@@ -3879,7 +3892,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3879
3892
|
resize: d
|
|
3880
3893
|
}), e._initDD = !0;
|
|
3881
3894
|
}
|
|
3882
|
-
return
|
|
3895
|
+
return B.draggable(t, i ? "disable" : "enable").resizable(t, s ? "disable" : "enable"), this;
|
|
3883
3896
|
}
|
|
3884
3897
|
/** @internal handles actual drag/resize start */
|
|
3885
3898
|
_onStartMoving(e, t, i, s, r, o) {
|
|
@@ -3898,7 +3911,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3898
3911
|
};
|
|
3899
3912
|
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") {
|
|
3900
3913
|
const d = this.getColumn() - s.x, h = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
3901
|
-
|
|
3914
|
+
B.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, d)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, h)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, d)).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));
|
|
3902
3915
|
}
|
|
3903
3916
|
}
|
|
3904
3917
|
/** @internal handles actual drag/resize */
|
|
@@ -3911,16 +3924,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3911
3924
|
return;
|
|
3912
3925
|
const g = i.position.top - s._prevYPix;
|
|
3913
3926
|
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, g);
|
|
3914
|
-
const R = i.position.left + (i.position.left > s._lastUiPosition.left ? -a : h),
|
|
3915
|
-
n.x = Math.round(R / r), n.y = Math.round(
|
|
3916
|
-
const
|
|
3927
|
+
const R = i.position.left + (i.position.left > s._lastUiPosition.left ? -a : h), k = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : l);
|
|
3928
|
+
n.x = Math.round(R / r), n.y = Math.round(k / o);
|
|
3929
|
+
const E = this._extraDragRow;
|
|
3917
3930
|
if (this.engine.collide(s, n)) {
|
|
3918
|
-
const
|
|
3919
|
-
let
|
|
3920
|
-
this.opts.maxRow &&
|
|
3931
|
+
const L = this.getRow();
|
|
3932
|
+
let D = Math.max(0, n.y + s.h - L);
|
|
3933
|
+
this.opts.maxRow && L + D > this.opts.maxRow && (D = Math.max(0, this.opts.maxRow - L)), this._extraDragRow = D;
|
|
3921
3934
|
} else
|
|
3922
3935
|
this._extraDragRow = 0;
|
|
3923
|
-
if (this._extraDragRow !==
|
|
3936
|
+
if (this._extraDragRow !== E && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
3924
3937
|
return;
|
|
3925
3938
|
} else if (t.type === "resize") {
|
|
3926
3939
|
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - h) / r), n.h = Math.round((i.size.height - l) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
@@ -3948,21 +3961,21 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3948
3961
|
_leave(e, t) {
|
|
3949
3962
|
t = t || e;
|
|
3950
3963
|
const i = t.gridstackNode;
|
|
3951
|
-
i && (t.style.transform = t.style.transformOrigin = null,
|
|
3964
|
+
i && (t.style.transform = t.style.transformOrigin = null, B.off(e, "drag"), !i._temporaryRemoved && (i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e, i._isExternal && this.engine.cleanupNode(i), this.opts.removable === !0 && w._itemRemoving(e, !0), e._gridstackNodeOrig ? (e.gridstackNode = e._gridstackNodeOrig, delete e._gridstackNodeOrig) : i._isExternal && this.engine.restoreInitial()));
|
|
3952
3965
|
}
|
|
3953
3966
|
// legacy method removed
|
|
3954
3967
|
commit() {
|
|
3955
|
-
return
|
|
3968
|
+
return Gi(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
3956
3969
|
}
|
|
3957
3970
|
}
|
|
3958
|
-
|
|
3971
|
+
w.renderCB = (u, e) => {
|
|
3959
3972
|
u && (e != null && e.content) && (u.textContent = e.content);
|
|
3960
3973
|
};
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
const
|
|
3974
|
+
w.resizeToContentParent = ".grid-stack-item-content";
|
|
3975
|
+
w.Utils = c;
|
|
3976
|
+
w.Engine = ee;
|
|
3977
|
+
w.GDRev = "11.3.0";
|
|
3978
|
+
const Yi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Xi = { class: "grid-stack-item-content" }, ji = /* @__PURE__ */ W({
|
|
3966
3979
|
__name: "DraggableGridLayout",
|
|
3967
3980
|
props: {
|
|
3968
3981
|
tiles: {},
|
|
@@ -3971,7 +3984,7 @@ const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { cl
|
|
|
3971
3984
|
},
|
|
3972
3985
|
emits: ["update-tiles"],
|
|
3973
3986
|
setup(u, { expose: e, emit: t }) {
|
|
3974
|
-
const i = u, s = t, r =
|
|
3987
|
+
const i = u, s = t, r = U(null), o = U(new Map(i.tiles.map((m) => [`${m.id}`, m])));
|
|
3975
3988
|
let n = null;
|
|
3976
3989
|
const d = (m) => `[data-id="${m}"]`, h = (m) => m.map((p) => {
|
|
3977
3990
|
var g;
|
|
@@ -3994,14 +4007,14 @@ const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { cl
|
|
|
3994
4007
|
o.value.delete(`${(g = y.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
3995
4008
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
3996
4009
|
};
|
|
3997
|
-
|
|
3998
|
-
r.value && (n =
|
|
4010
|
+
Ve(() => {
|
|
4011
|
+
r.value && (n = w.init({
|
|
3999
4012
|
column: i.gridSize.cols,
|
|
4000
4013
|
cellHeight: i.tileHeight,
|
|
4001
4014
|
resizable: { handles: "se, sw" },
|
|
4002
4015
|
handle: ".tile-header"
|
|
4003
4016
|
}, r.value), n.on("change", a), n.on("added", a), n.on("removed", l));
|
|
4004
|
-
}),
|
|
4017
|
+
}), Ue(() => {
|
|
4005
4018
|
n && n.destroy(!1);
|
|
4006
4019
|
});
|
|
4007
4020
|
const f = (m) => {
|
|
@@ -4014,22 +4027,22 @@ const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { cl
|
|
|
4014
4027
|
if (m > p && n) {
|
|
4015
4028
|
const y = i.tiles.slice(p);
|
|
4016
4029
|
for (const g of y)
|
|
4017
|
-
o.value.set(`${g.id}`, g), await
|
|
4030
|
+
o.value.set(`${g.id}`, g), await vt(), n.makeWidget(d(g.id), {
|
|
4018
4031
|
autoPosition: !0,
|
|
4019
4032
|
w: g.layout.size.cols,
|
|
4020
4033
|
h: g.layout.size.rows
|
|
4021
4034
|
});
|
|
4022
4035
|
}
|
|
4023
|
-
}),
|
|
4036
|
+
}), mt(() => {
|
|
4024
4037
|
i.tiles.forEach((m) => {
|
|
4025
4038
|
o.value.set(`${m.id}`, m);
|
|
4026
4039
|
});
|
|
4027
|
-
}), e({ removeWidget: f }), (m, p) => (
|
|
4040
|
+
}), e({ removeWidget: f }), (m, p) => (C(), F("div", {
|
|
4028
4041
|
ref_key: "gridContainer",
|
|
4029
4042
|
ref: r,
|
|
4030
4043
|
class: "grid-stack"
|
|
4031
4044
|
}, [
|
|
4032
|
-
(
|
|
4045
|
+
(C(!0), F(wt, null, bt(i.tiles, (y) => (C(), F("div", {
|
|
4033
4046
|
key: y.id,
|
|
4034
4047
|
class: "grid-stack-item",
|
|
4035
4048
|
"data-id": `${y.id}`,
|
|
@@ -4040,46 +4053,46 @@ const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { cl
|
|
|
4040
4053
|
"gs-x": y.layout.position.col,
|
|
4041
4054
|
"gs-y": y.layout.position.row
|
|
4042
4055
|
}, [
|
|
4043
|
-
|
|
4044
|
-
|
|
4056
|
+
ce("div", Xi, [
|
|
4057
|
+
Me(m.$slots, "tile", { tile: y }, void 0, !0)
|
|
4045
4058
|
])
|
|
4046
|
-
], 8,
|
|
4059
|
+
], 8, Yi))), 128))
|
|
4047
4060
|
], 512));
|
|
4048
4061
|
}
|
|
4049
|
-
}),
|
|
4062
|
+
}), Qi = /* @__PURE__ */ he(ji, [["__scopeId", "data-v-f4f87f74"]]), Zi = { class: "kong-ui-public-dashboard-renderer" }, Ji = {
|
|
4050
4063
|
key: 0,
|
|
4051
4064
|
class: "tile-container slottable-tile"
|
|
4052
|
-
},
|
|
4065
|
+
}, es = /* @__PURE__ */ W({
|
|
4053
4066
|
__name: "DashboardRenderer",
|
|
4054
|
-
props: /* @__PURE__ */
|
|
4067
|
+
props: /* @__PURE__ */ it({
|
|
4055
4068
|
context: {}
|
|
4056
4069
|
}, {
|
|
4057
4070
|
modelValue: { required: !0 },
|
|
4058
4071
|
modelModifiers: {}
|
|
4059
4072
|
}),
|
|
4060
|
-
emits: /* @__PURE__ */
|
|
4073
|
+
emits: /* @__PURE__ */ it(["edit-tile", "zoom-time-range"], ["update:modelValue"]),
|
|
4061
4074
|
setup(u, { expose: e, emit: t }) {
|
|
4062
|
-
const i = u, s = t, r =
|
|
4063
|
-
h || (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")),
|
|
4064
|
-
const a =
|
|
4075
|
+
const i = u, s = t, r = $t(u, "modelValue"), { i18n: o } = ve.useI18n(), n = U(0), d = U(null), h = _e(le);
|
|
4076
|
+
h || (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")), ve.useRequestQueue();
|
|
4077
|
+
const a = xt(), l = O(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4065
4078
|
type: "relative",
|
|
4066
4079
|
time_range: a.defaultQueryTimeForOrg
|
|
4067
|
-
}), f =
|
|
4068
|
-
const
|
|
4069
|
-
return
|
|
4070
|
-
}, p =
|
|
4071
|
-
var
|
|
4072
|
-
let
|
|
4073
|
-
if ("description" in
|
|
4074
|
-
const
|
|
4075
|
-
const
|
|
4076
|
-
return o.te(
|
|
4080
|
+
}), f = O(() => !!i.context.timeSpec || !a.loading), m = (x, N) => {
|
|
4081
|
+
const z = x.layout.position.row - N.layout.position.row;
|
|
4082
|
+
return z !== 0 ? z : x.layout.position.col - N.layout.position.col;
|
|
4083
|
+
}, p = O(() => r.value.tiles.map((x) => {
|
|
4084
|
+
var z;
|
|
4085
|
+
let N = x.definition;
|
|
4086
|
+
if ("description" in N.chart) {
|
|
4087
|
+
const q = (z = N.chart.description) == null ? void 0 : z.replace(ci, () => {
|
|
4088
|
+
const v = `renderer.trendRange.${l.value.type === "absolute" ? "custom" : l.value.time_range}`;
|
|
4089
|
+
return o.te(v) ? o.t(v) : "";
|
|
4077
4090
|
});
|
|
4078
|
-
|
|
4079
|
-
...
|
|
4091
|
+
N = {
|
|
4092
|
+
...N,
|
|
4080
4093
|
chart: {
|
|
4081
|
-
...
|
|
4082
|
-
description:
|
|
4094
|
+
...N.chart,
|
|
4095
|
+
description: q
|
|
4083
4096
|
}
|
|
4084
4097
|
};
|
|
4085
4098
|
}
|
|
@@ -4089,83 +4102,103 @@ const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { cl
|
|
|
4089
4102
|
x
|
|
4090
4103
|
), {
|
|
4091
4104
|
layout: x.layout,
|
|
4092
|
-
meta:
|
|
4105
|
+
meta: N,
|
|
4093
4106
|
// Add a unique key to each tile internally.
|
|
4094
4107
|
id: x.id ?? crypto.randomUUID()
|
|
4095
4108
|
};
|
|
4096
|
-
})), y =
|
|
4097
|
-
let { tz: x, refreshInterval:
|
|
4098
|
-
return x || (x = new Intl.DateTimeFormat().resolvedOptions().timeZone),
|
|
4109
|
+
})), y = O(() => {
|
|
4110
|
+
let { tz: x, refreshInterval: N, editable: z } = i.context;
|
|
4111
|
+
return x || (x = new Intl.DateTimeFormat().resolvedOptions().timeZone), N === void 0 && (N = fi), z === void 0 && (z = !1), {
|
|
4099
4112
|
...i.context,
|
|
4100
4113
|
tz: x,
|
|
4101
4114
|
timeSpec: l.value,
|
|
4102
|
-
refreshInterval:
|
|
4103
|
-
editable:
|
|
4115
|
+
refreshInterval: N,
|
|
4116
|
+
editable: z
|
|
4104
4117
|
};
|
|
4105
4118
|
}), g = (x) => {
|
|
4106
4119
|
s("edit-tile", x);
|
|
4107
|
-
}, R = (x) => {
|
|
4120
|
+
}, R = (x) => x.type === "slottable", k = (x) => {
|
|
4121
|
+
const N = R(x.meta.chart) ? { ...x.meta.chart } : {
|
|
4122
|
+
...x.meta.chart,
|
|
4123
|
+
chartTitle: x.meta.chart.chartTitle ? `Copy of ${x.meta.chart.chartTitle}` : ""
|
|
4124
|
+
}, z = {
|
|
4125
|
+
id: crypto.randomUUID(),
|
|
4126
|
+
definition: {
|
|
4127
|
+
...x.meta,
|
|
4128
|
+
chart: N
|
|
4129
|
+
},
|
|
4130
|
+
layout: {
|
|
4131
|
+
position: {
|
|
4132
|
+
col: 0,
|
|
4133
|
+
row: 0
|
|
4134
|
+
},
|
|
4135
|
+
size: x.layout.size
|
|
4136
|
+
}
|
|
4137
|
+
};
|
|
4138
|
+
r.value.tiles.push(z);
|
|
4139
|
+
}, E = (x) => {
|
|
4108
4140
|
d.value && d.value.removeWidget(x.id);
|
|
4109
|
-
},
|
|
4141
|
+
}, L = () => {
|
|
4110
4142
|
n.value++;
|
|
4111
|
-
},
|
|
4112
|
-
const
|
|
4113
|
-
id:
|
|
4114
|
-
layout:
|
|
4115
|
-
definition:
|
|
4143
|
+
}, D = (x) => {
|
|
4144
|
+
const N = x.map((z) => ({
|
|
4145
|
+
id: z.id,
|
|
4146
|
+
layout: z.layout,
|
|
4147
|
+
definition: z.meta
|
|
4116
4148
|
}));
|
|
4117
|
-
r.value.gridSize.rows = Math.max(1, ...
|
|
4149
|
+
r.value.gridSize.rows = Math.max(1, ...N.map((z) => z.layout.position.row + z.layout.size.rows)), r.value.tiles = N.sort(m);
|
|
4118
4150
|
};
|
|
4119
|
-
return e({ refresh:
|
|
4120
|
-
const
|
|
4121
|
-
return
|
|
4122
|
-
|
|
4151
|
+
return e({ refresh: L }), (x, N) => {
|
|
4152
|
+
const z = oe("KAlert");
|
|
4153
|
+
return C(), F("div", Zi, [
|
|
4154
|
+
S(h) ? (C(), H(_t(x.context.editable ? Qi : Fi), {
|
|
4123
4155
|
key: 1,
|
|
4124
4156
|
ref_key: "gridLayoutRef",
|
|
4125
4157
|
ref: d,
|
|
4126
4158
|
"grid-size": r.value.gridSize,
|
|
4127
4159
|
"tile-height": r.value.tileHeight,
|
|
4128
4160
|
tiles: p.value,
|
|
4129
|
-
onUpdateTiles:
|
|
4161
|
+
onUpdateTiles: D
|
|
4130
4162
|
}, {
|
|
4131
|
-
tile:
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
])) : (
|
|
4163
|
+
tile: P(({ tile: q }) => [
|
|
4164
|
+
q.meta.chart.type === "slottable" ? (C(), F("div", Ji, [
|
|
4165
|
+
Me(x.$slots, q.meta.chart.id, {}, void 0, !0)
|
|
4166
|
+
])) : (C(), H(Bi, {
|
|
4135
4167
|
key: 1,
|
|
4136
4168
|
class: "tile-container",
|
|
4137
4169
|
context: y.value,
|
|
4138
|
-
definition:
|
|
4139
|
-
height:
|
|
4170
|
+
definition: q.meta,
|
|
4171
|
+
height: q.layout.size.rows * (r.value.tileHeight || S(Ke)) + parseInt(S(Ht), 10),
|
|
4140
4172
|
"query-ready": f.value,
|
|
4141
4173
|
"refresh-counter": n.value,
|
|
4142
|
-
"tile-id":
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4174
|
+
"tile-id": q.id,
|
|
4175
|
+
onDuplicateTile: (ae) => k(q),
|
|
4176
|
+
onEditTile: (ae) => g(q),
|
|
4177
|
+
onRemoveTile: (ae) => E(q),
|
|
4178
|
+
onZoomTimeRange: N[0] || (N[0] = (ae) => s("zoom-time-range", ae))
|
|
4179
|
+
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4147
4180
|
]),
|
|
4148
4181
|
_: 3
|
|
4149
|
-
}, 40, ["grid-size", "tile-height", "tiles"])) : (
|
|
4182
|
+
}, 40, ["grid-size", "tile-height", "tiles"])) : (C(), H(z, {
|
|
4150
4183
|
key: 0,
|
|
4151
4184
|
appearance: "danger"
|
|
4152
4185
|
}, {
|
|
4153
|
-
default:
|
|
4154
|
-
|
|
4186
|
+
default: P(() => [
|
|
4187
|
+
ue(J(S(o).t("renderer.noQueryBridge")), 1)
|
|
4155
4188
|
]),
|
|
4156
4189
|
_: 1
|
|
4157
4190
|
}))
|
|
4158
4191
|
]);
|
|
4159
4192
|
};
|
|
4160
4193
|
}
|
|
4161
|
-
}),
|
|
4194
|
+
}), us = /* @__PURE__ */ he(es, [["__scopeId", "data-v-d31fa719"]]);
|
|
4162
4195
|
export {
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4196
|
+
ui as CP_ID_TOKEN,
|
|
4197
|
+
Ke as DEFAULT_TILE_HEIGHT,
|
|
4198
|
+
fi as DEFAULT_TILE_REFRESH_INTERVAL_MS,
|
|
4199
|
+
us as DashboardRenderer,
|
|
4200
|
+
rt as ENTITY_ID_TOKEN,
|
|
4168
4201
|
Fi as GridLayout,
|
|
4169
|
-
|
|
4170
|
-
|
|
4202
|
+
le as INJECT_QUERY_PROVIDER,
|
|
4203
|
+
ci as TIMEFRAME_TOKEN
|
|
4171
4204
|
};
|