@kong-ui-public/dashboard-renderer 7.6.27 → 7.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GeoMapRenderer-CZGNK8sS.js → GeoMapRenderer-BbtUsI11.js} +1 -1
- package/dist/dashboard-renderer.es.js +1 -1
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/{index-B4zkjJup.js → index-LCsvzmZQ.js} +834 -834
- package/dist/style.css +1 -1
- package/dist/types/components/BaseAnalyticsChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/composables/useContextLinks.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var _t = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var oi = Object.defineProperty;
|
|
2
|
+
var _t = (u) => {
|
|
3
|
+
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var bt = (
|
|
7
|
-
var _ = (
|
|
8
|
-
var
|
|
5
|
+
var ai = (u, e, t) => e in u ? oi(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
6
|
+
var bt = (u, e, t) => ai(u, typeof e != "symbol" ? e + "" : e, t), it = (u, e, t) => e.has(u) || _t("Cannot " + t);
|
|
7
|
+
var _ = (u, e, t) => (it(u, e, "read from private field"), t ? t.call(u) : e.get(u)), G = (u, e, t) => e.has(u) ? _t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(u) : e.set(u, t), H = (u, e, t, i) => (it(u, e, "write to private field"), i ? i.call(u, t) : e.set(u, t), t), F = (u, e, t) => (it(u, e, "access private method"), t);
|
|
8
|
+
var Te = (u, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
|
-
|
|
10
|
+
H(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 { msToGranularity as rt, getFieldDataSources as
|
|
18
|
-
import { handleQueryError as
|
|
19
|
-
import
|
|
16
|
+
import { ref as A, watchEffect as Mt, inject as ve, provide as li, onMounted as at, computed as k, watch as Ve, onUnmounted as lt, defineComponent as Z, resolveComponent as ge, createBlock as L, renderSlot as ze, createCommentVNode as V, unref as x, openBlock as C, createSlots as Qe, withCtx as $, createElementVNode as oe, toDisplayString as ne, useCssVars as Ye, normalizeClass as je, createVNode as de, mergeProps as It, createTextVNode as ht, createElementBlock as K, normalizeProps as hi, guardReactiveProps as di, defineAsyncComponent as qt, readonly as st, toRef as wt, nextTick as dt, resolveDynamicComponent as Pt, toHandlers as ui, Fragment as $t, renderList as Gt, normalizeStyle as Et, mergeModels as xt, useModel as ci, getCurrentInstance as fi } from "vue";
|
|
17
|
+
import { msToGranularity as rt, getFieldDataSources as Ft, stripUnknownFilters as gi, Timeframe as pi, TimePeriods as Bt, TIMEFRAME_LOOKUP as mi, formatTime as Ct, EXPORT_RECORD_LIMIT as yi } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { handleQueryError as vi, SimpleChart as _i, AnalyticsChart as bi, TopNTable as wi, CsvExportModal as Ei } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import xi from "swrv";
|
|
20
20
|
import "axios";
|
|
21
|
-
import { createI18n as
|
|
22
|
-
import { useAnalyticsConfigStore as
|
|
23
|
-
import { VisibilityOffIcon as
|
|
24
|
-
import { MetricsProvider as
|
|
25
|
-
var Ut = /* @__PURE__ */ ((
|
|
26
|
-
const
|
|
21
|
+
import { createI18n as Ci, i18nTComponent as Ri } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as ut } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { VisibilityOffIcon as ki, WarningOutlineIcon as Ti, WarningIcon as zi, EditIcon as Si, MoreIcon as Di } from "@kong/icons";
|
|
24
|
+
import { MetricsProvider as Ni, MetricsConsumer as Li } from "@kong-ui-public/analytics-metric-provider";
|
|
25
|
+
var Ut = /* @__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))(Ut || {});
|
|
26
|
+
const Ai = (u) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
|
-
return
|
|
29
|
-
((e = Object.keys(
|
|
28
|
+
return u ? !!// TODO: revisit: currently only the first check ever matters?
|
|
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 Oi(u = A({}), e, t, i = Ai) {
|
|
32
|
+
const s = A(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
36
|
return Mt(() => {
|
|
37
|
-
const r = i(
|
|
38
|
-
if (
|
|
37
|
+
const r = i(u.value);
|
|
38
|
+
if (u.value && r && t.value) {
|
|
39
39
|
s.value = "VALIDATING_HAS_DATA";
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (u.value && t.value) {
|
|
43
43
|
s.value = "VALIDATING";
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (u.value && e.value) {
|
|
47
47
|
s.value = "STALE_IF_ERROR";
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
50
|
+
if (u.value === void 0 && !e.value) {
|
|
51
51
|
s.value = "PENDING";
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (u.value && !e.value && r) {
|
|
55
55
|
s.value = "SUCCESS_HAS_DATA";
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (u.value && !e.value) {
|
|
59
59
|
s.value = "SUCCESS";
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
u.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
65
|
swrvState: Ut
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const Hi = {
|
|
69
69
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
70
70
|
trendRange: {
|
|
71
71
|
"24h": "Last 24-hour summary",
|
|
@@ -78,10 +78,10 @@ const Mi = {
|
|
|
78
78
|
fullscreen: "Fullscreen",
|
|
79
79
|
remove: "Remove",
|
|
80
80
|
delete: "Delete"
|
|
81
|
-
},
|
|
81
|
+
}, Mi = {
|
|
82
82
|
defaultFilename: "Chart export",
|
|
83
83
|
exportAsCsv: "Export as CSV"
|
|
84
|
-
},
|
|
84
|
+
}, Ii = "Explore", qi = "View requests", Pi = "This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.", $i = {
|
|
85
85
|
daily: "1 day",
|
|
86
86
|
fiveMinutely: "5 minutes",
|
|
87
87
|
hourly: "1 hour",
|
|
@@ -95,153 +95,153 @@ const Mi = {
|
|
|
95
95
|
weekly: "1 week",
|
|
96
96
|
unknown: "Unknown"
|
|
97
97
|
}, Gi = {
|
|
98
|
-
renderer:
|
|
99
|
-
csvExport:
|
|
100
|
-
jumpToExplore:
|
|
101
|
-
jumpToRequests:
|
|
102
|
-
query_aged_out_warning:
|
|
103
|
-
granularities:
|
|
98
|
+
renderer: Hi,
|
|
99
|
+
csvExport: Mi,
|
|
100
|
+
jumpToExplore: Ii,
|
|
101
|
+
jumpToRequests: qi,
|
|
102
|
+
query_aged_out_warning: Pi,
|
|
103
|
+
granularities: $i
|
|
104
104
|
};
|
|
105
|
-
function
|
|
106
|
-
const
|
|
105
|
+
function Fi() {
|
|
106
|
+
const u = Ci("en-us", Gi);
|
|
107
107
|
return {
|
|
108
|
-
i18n:
|
|
109
|
-
i18nT:
|
|
108
|
+
i18n: u,
|
|
109
|
+
i18nT: Ri(u)
|
|
110
110
|
// Translation component <i18n-t>
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const Xe = 170, Wt = 6, pe = "analytics-query-provider", Rt = "{entity-id}",
|
|
114
|
-
function
|
|
115
|
-
const
|
|
113
|
+
const Xe = 170, Wt = 6, pe = "analytics-query-provider", Rt = "{entity-id}", Bi = "{cp-id}", Ui = "{timeframe}", Wi = 30 * 1e3, Ki = 3e5, Vi = 36e5;
|
|
114
|
+
function Qi() {
|
|
115
|
+
const u = ve(pe);
|
|
116
116
|
return {
|
|
117
|
-
evaluateFeatureFlag: (t, i) =>
|
|
117
|
+
evaluateFeatureFlag: (t, i) => u ? u.evaluateFeatureFlagFn(t, i) : i
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
120
|
+
function Yi(u) {
|
|
121
|
+
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
122
122
|
}
|
|
123
123
|
var Kt = { exports: {} };
|
|
124
|
-
(function(
|
|
124
|
+
(function(u) {
|
|
125
125
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
126
126
|
function i() {
|
|
127
127
|
}
|
|
128
128
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
129
|
-
function s(l, h
|
|
130
|
-
this.fn =
|
|
129
|
+
function s(d, l, h) {
|
|
130
|
+
this.fn = d, this.context = l, this.once = h || !1;
|
|
131
131
|
}
|
|
132
|
-
function r(l, h,
|
|
133
|
-
if (typeof
|
|
132
|
+
function r(d, l, h, a, f) {
|
|
133
|
+
if (typeof h != "function")
|
|
134
134
|
throw new TypeError("The listener must be a function");
|
|
135
|
-
var
|
|
136
|
-
return
|
|
135
|
+
var p = new s(h, a || d, f), g = t ? t + l : l;
|
|
136
|
+
return d._events[g] ? d._events[g].fn ? d._events[g] = [d._events[g], p] : d._events[g].push(p) : (d._events[g] = p, d._eventsCount++), d;
|
|
137
137
|
}
|
|
138
|
-
function o(
|
|
139
|
-
--
|
|
138
|
+
function o(d, l) {
|
|
139
|
+
--d._eventsCount === 0 ? d._events = new i() : delete d._events[l];
|
|
140
140
|
}
|
|
141
141
|
function n() {
|
|
142
142
|
this._events = new i(), this._eventsCount = 0;
|
|
143
143
|
}
|
|
144
144
|
n.prototype.eventNames = function() {
|
|
145
|
-
var
|
|
146
|
-
if (this._eventsCount === 0) return
|
|
147
|
-
for (a in
|
|
148
|
-
e.call(
|
|
149
|
-
return Object.getOwnPropertySymbols ?
|
|
150
|
-
}, n.prototype.listeners = function(
|
|
151
|
-
var
|
|
145
|
+
var l = [], h, a;
|
|
146
|
+
if (this._eventsCount === 0) return l;
|
|
147
|
+
for (a in h = this._events)
|
|
148
|
+
e.call(h, a) && l.push(t ? a.slice(1) : a);
|
|
149
|
+
return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(h)) : l;
|
|
150
|
+
}, n.prototype.listeners = function(l) {
|
|
151
|
+
var h = t ? t + l : l, a = this._events[h];
|
|
152
152
|
if (!a) return [];
|
|
153
153
|
if (a.fn) return [a.fn];
|
|
154
|
-
for (var f = 0,
|
|
154
|
+
for (var f = 0, p = a.length, g = new Array(p); f < p; f++)
|
|
155
155
|
g[f] = a[f].fn;
|
|
156
156
|
return g;
|
|
157
|
-
}, n.prototype.listenerCount = function(
|
|
158
|
-
var
|
|
157
|
+
}, n.prototype.listenerCount = function(l) {
|
|
158
|
+
var h = t ? t + l : l, a = this._events[h];
|
|
159
159
|
return a ? a.fn ? 1 : a.length : 0;
|
|
160
|
-
}, n.prototype.emit = function(
|
|
161
|
-
var y = t ? t +
|
|
160
|
+
}, n.prototype.emit = function(l, h, a, f, p, g) {
|
|
161
|
+
var y = t ? t + l : l;
|
|
162
162
|
if (!this._events[y]) return !1;
|
|
163
|
-
var
|
|
164
|
-
if (
|
|
165
|
-
switch (
|
|
163
|
+
var m = this._events[y], S = arguments.length, M, z;
|
|
164
|
+
if (m.fn) {
|
|
165
|
+
switch (m.once && this.removeListener(l, m.fn, void 0, !0), S) {
|
|
166
166
|
case 1:
|
|
167
|
-
return
|
|
167
|
+
return m.fn.call(m.context), !0;
|
|
168
168
|
case 2:
|
|
169
|
-
return
|
|
169
|
+
return m.fn.call(m.context, h), !0;
|
|
170
170
|
case 3:
|
|
171
|
-
return
|
|
171
|
+
return m.fn.call(m.context, h, a), !0;
|
|
172
172
|
case 4:
|
|
173
|
-
return
|
|
173
|
+
return m.fn.call(m.context, h, a, f), !0;
|
|
174
174
|
case 5:
|
|
175
|
-
return
|
|
175
|
+
return m.fn.call(m.context, h, a, f, p), !0;
|
|
176
176
|
case 6:
|
|
177
|
-
return
|
|
177
|
+
return m.fn.call(m.context, h, a, f, p, g), !0;
|
|
178
178
|
}
|
|
179
|
-
for (
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
for (z = 1, M = new Array(S - 1); z < S; z++)
|
|
180
|
+
M[z - 1] = arguments[z];
|
|
181
|
+
m.fn.apply(m.context, M);
|
|
182
182
|
} else {
|
|
183
|
-
var
|
|
184
|
-
for (
|
|
185
|
-
switch (
|
|
183
|
+
var Q = m.length, B;
|
|
184
|
+
for (z = 0; z < Q; z++)
|
|
185
|
+
switch (m[z].once && this.removeListener(l, m[z].fn, void 0, !0), S) {
|
|
186
186
|
case 1:
|
|
187
|
-
|
|
187
|
+
m[z].fn.call(m[z].context);
|
|
188
188
|
break;
|
|
189
189
|
case 2:
|
|
190
|
-
|
|
190
|
+
m[z].fn.call(m[z].context, h);
|
|
191
191
|
break;
|
|
192
192
|
case 3:
|
|
193
|
-
|
|
193
|
+
m[z].fn.call(m[z].context, h, a);
|
|
194
194
|
break;
|
|
195
195
|
case 4:
|
|
196
|
-
|
|
196
|
+
m[z].fn.call(m[z].context, h, a, f);
|
|
197
197
|
break;
|
|
198
198
|
default:
|
|
199
|
-
if (!
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
if (!M) for (B = 1, M = new Array(S - 1); B < S; B++)
|
|
200
|
+
M[B - 1] = arguments[B];
|
|
201
|
+
m[z].fn.apply(m[z].context, M);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
return !0;
|
|
205
|
-
}, n.prototype.on = function(
|
|
206
|
-
return r(this,
|
|
207
|
-
}, n.prototype.once = function(
|
|
208
|
-
return r(this,
|
|
209
|
-
}, n.prototype.removeListener = function(
|
|
210
|
-
var
|
|
211
|
-
if (!this._events[
|
|
212
|
-
if (!
|
|
213
|
-
return o(this,
|
|
214
|
-
var g = this._events[
|
|
205
|
+
}, n.prototype.on = function(l, h, a) {
|
|
206
|
+
return r(this, l, h, a, !1);
|
|
207
|
+
}, n.prototype.once = function(l, h, a) {
|
|
208
|
+
return r(this, l, h, a, !0);
|
|
209
|
+
}, n.prototype.removeListener = function(l, h, a, f) {
|
|
210
|
+
var p = t ? t + l : l;
|
|
211
|
+
if (!this._events[p]) return this;
|
|
212
|
+
if (!h)
|
|
213
|
+
return o(this, p), this;
|
|
214
|
+
var g = this._events[p];
|
|
215
215
|
if (g.fn)
|
|
216
|
-
g.fn ===
|
|
216
|
+
g.fn === h && (!f || g.once) && (!a || g.context === a) && o(this, p);
|
|
217
217
|
else {
|
|
218
|
-
for (var y = 0,
|
|
219
|
-
(g[y].fn !==
|
|
220
|
-
|
|
218
|
+
for (var y = 0, m = [], S = g.length; y < S; y++)
|
|
219
|
+
(g[y].fn !== h || f && !g[y].once || a && g[y].context !== a) && m.push(g[y]);
|
|
220
|
+
m.length ? this._events[p] = m.length === 1 ? m[0] : m : o(this, p);
|
|
221
221
|
}
|
|
222
222
|
return this;
|
|
223
|
-
}, n.prototype.removeAllListeners = function(
|
|
224
|
-
var
|
|
225
|
-
return
|
|
226
|
-
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n,
|
|
223
|
+
}, n.prototype.removeAllListeners = function(l) {
|
|
224
|
+
var h;
|
|
225
|
+
return l ? (h = t ? t + l : l, this._events[h] && o(this, h)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
226
|
+
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n, u.exports = n;
|
|
227
227
|
})(Kt);
|
|
228
|
-
var
|
|
229
|
-
const
|
|
228
|
+
var ji = Kt.exports;
|
|
229
|
+
const Xi = /* @__PURE__ */ Yi(ji);
|
|
230
230
|
class Vt extends Error {
|
|
231
231
|
constructor(e) {
|
|
232
232
|
super(e), this.name = "TimeoutError";
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
class
|
|
235
|
+
class Zi extends Error {
|
|
236
236
|
constructor(e) {
|
|
237
237
|
super(), this.name = "AbortError", this.message = e;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const kt = (
|
|
241
|
-
const e =
|
|
240
|
+
const kt = (u) => globalThis.DOMException === void 0 ? new Zi(u) : new DOMException(u), Tt = (u) => {
|
|
241
|
+
const e = u.reason === void 0 ? kt("This operation was aborted.") : u.reason;
|
|
242
242
|
return e instanceof Error ? e : kt(e);
|
|
243
243
|
};
|
|
244
|
-
function
|
|
244
|
+
function Ji(u, e) {
|
|
245
245
|
const {
|
|
246
246
|
milliseconds: t,
|
|
247
247
|
fallback: i,
|
|
@@ -249,57 +249,57 @@ function es(d, e) {
|
|
|
249
249
|
customTimers: r = { setTimeout, clearTimeout }
|
|
250
250
|
} = e;
|
|
251
251
|
let o, n;
|
|
252
|
-
const
|
|
252
|
+
const l = new Promise((h, a) => {
|
|
253
253
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
254
254
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
255
255
|
if (e.signal) {
|
|
256
|
-
const { signal:
|
|
257
|
-
|
|
258
|
-
a(Tt(
|
|
259
|
-
},
|
|
256
|
+
const { signal: p } = e;
|
|
257
|
+
p.aborted && a(Tt(p)), n = () => {
|
|
258
|
+
a(Tt(p));
|
|
259
|
+
}, p.addEventListener("abort", n, { once: !0 });
|
|
260
260
|
}
|
|
261
261
|
if (t === Number.POSITIVE_INFINITY) {
|
|
262
|
-
|
|
262
|
+
u.then(h, a);
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
const f = new Vt();
|
|
266
266
|
o = r.setTimeout.call(void 0, () => {
|
|
267
267
|
if (i) {
|
|
268
268
|
try {
|
|
269
|
-
|
|
270
|
-
} catch (
|
|
271
|
-
a(
|
|
269
|
+
h(i());
|
|
270
|
+
} catch (p) {
|
|
271
|
+
a(p);
|
|
272
272
|
}
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
typeof
|
|
275
|
+
typeof u.cancel == "function" && u.cancel(), s === !1 ? h() : s instanceof Error ? a(s) : (f.message = s ?? `Promise timed out after ${t} milliseconds`, a(f));
|
|
276
276
|
}, t), (async () => {
|
|
277
277
|
try {
|
|
278
|
-
|
|
279
|
-
} catch (
|
|
280
|
-
a(
|
|
278
|
+
h(await u);
|
|
279
|
+
} catch (p) {
|
|
280
|
+
a(p);
|
|
281
281
|
}
|
|
282
282
|
})();
|
|
283
283
|
}).finally(() => {
|
|
284
|
-
|
|
284
|
+
l.clear(), n && e.signal && e.signal.removeEventListener("abort", n);
|
|
285
285
|
});
|
|
286
|
-
return
|
|
286
|
+
return l.clear = () => {
|
|
287
287
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
288
|
-
},
|
|
288
|
+
}, l;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
let i = 0, s =
|
|
290
|
+
function es(u, e, t) {
|
|
291
|
+
let i = 0, s = u.length;
|
|
292
292
|
for (; s > 0; ) {
|
|
293
293
|
const r = Math.trunc(s / 2);
|
|
294
294
|
let o = i + r;
|
|
295
|
-
t(
|
|
295
|
+
t(u[o], e) <= 0 ? (i = ++o, s -= r + 1) : s = r;
|
|
296
296
|
}
|
|
297
297
|
return i;
|
|
298
298
|
}
|
|
299
299
|
var ie;
|
|
300
|
-
class
|
|
300
|
+
class ts {
|
|
301
301
|
constructor() {
|
|
302
|
-
|
|
302
|
+
G(this, ie, []);
|
|
303
303
|
}
|
|
304
304
|
enqueue(e, t) {
|
|
305
305
|
t = {
|
|
@@ -315,7 +315,7 @@ class is {
|
|
|
315
315
|
_(this, ie).push(i);
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
const s =
|
|
318
|
+
const s = es(_(this, ie), i, (r, o) => o.priority - r.priority);
|
|
319
319
|
_(this, ie).splice(s, 0, i);
|
|
320
320
|
}
|
|
321
321
|
setPriority(e, t) {
|
|
@@ -337,30 +337,30 @@ class is {
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
ie = new WeakMap();
|
|
340
|
-
var
|
|
341
|
-
class
|
|
340
|
+
var be, we, fe, Ne, Ee, Le, se, xe, W, Ae, re, Ce, ce, Oe, Ke, T, Qt, Yt, jt, Xt, Zt, qe, nt, ot, Pe, Jt, $e;
|
|
341
|
+
class is extends Xi {
|
|
342
342
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
343
343
|
constructor(t) {
|
|
344
344
|
var i, s;
|
|
345
345
|
super();
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
346
|
+
G(this, T);
|
|
347
|
+
G(this, be);
|
|
348
|
+
G(this, we);
|
|
349
|
+
G(this, fe, 0);
|
|
350
|
+
G(this, Ne);
|
|
351
|
+
G(this, Ee);
|
|
352
|
+
G(this, Le, 0);
|
|
353
|
+
G(this, se);
|
|
354
|
+
G(this, xe);
|
|
355
|
+
G(this, W);
|
|
356
|
+
G(this, Ae);
|
|
357
|
+
G(this, re, 0);
|
|
358
358
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
G(this, Ce);
|
|
360
|
+
G(this, ce);
|
|
361
|
+
G(this, Oe);
|
|
362
362
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
363
|
-
|
|
363
|
+
G(this, Ke, 1n);
|
|
364
364
|
/**
|
|
365
365
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
366
366
|
|
|
@@ -373,21 +373,21 @@ class ss extends Zi {
|
|
|
373
373
|
interval: 0,
|
|
374
374
|
concurrency: Number.POSITIVE_INFINITY,
|
|
375
375
|
autoStart: !0,
|
|
376
|
-
queueClass:
|
|
376
|
+
queueClass: ts,
|
|
377
377
|
...t
|
|
378
378
|
}, !(typeof t.intervalCap == "number" && t.intervalCap >= 1))
|
|
379
379
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i = t.intervalCap) == null ? void 0 : i.toString()) ?? ""}\` (${typeof t.intervalCap})`);
|
|
380
380
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
381
381
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
382
|
-
|
|
382
|
+
H(this, be, t.carryoverConcurrencyCount), H(this, we, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), H(this, Ne, t.intervalCap), H(this, Ee, t.interval), H(this, W, new t.queueClass()), H(this, Ae, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, H(this, Oe, t.throwOnTimeout === !0), H(this, ce, t.autoStart === !1);
|
|
383
383
|
}
|
|
384
384
|
get concurrency() {
|
|
385
|
-
return _(this,
|
|
385
|
+
return _(this, Ce);
|
|
386
386
|
}
|
|
387
387
|
set concurrency(t) {
|
|
388
388
|
if (!(typeof t == "number" && t >= 1))
|
|
389
389
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
390
|
-
|
|
390
|
+
H(this, Ce, t), F(this, T, Pe).call(this);
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -426,23 +426,23 @@ class ss extends Zi {
|
|
|
426
426
|
Here, the promise function with `id: '🦀'` executes last.
|
|
427
427
|
*/
|
|
428
428
|
setPriority(t, i) {
|
|
429
|
-
_(this,
|
|
429
|
+
_(this, W).setPriority(t, i);
|
|
430
430
|
}
|
|
431
431
|
async add(t, i = {}) {
|
|
432
|
-
return i.id ?? (i.id = (
|
|
432
|
+
return i.id ?? (i.id = (Te(this, Ke)._++).toString()), i = {
|
|
433
433
|
timeout: this.timeout,
|
|
434
|
-
throwOnTimeout: _(this,
|
|
434
|
+
throwOnTimeout: _(this, Oe),
|
|
435
435
|
...i
|
|
436
436
|
}, new Promise((s, r) => {
|
|
437
|
-
_(this,
|
|
437
|
+
_(this, W).enqueue(async () => {
|
|
438
438
|
var o;
|
|
439
|
-
|
|
439
|
+
Te(this, re)._++, Te(this, fe)._++;
|
|
440
440
|
try {
|
|
441
441
|
(o = i.signal) == null || o.throwIfAborted();
|
|
442
442
|
let n = t({ signal: i.signal });
|
|
443
|
-
i.timeout && (n =
|
|
444
|
-
const
|
|
445
|
-
s(
|
|
443
|
+
i.timeout && (n = Ji(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, F(this, T, Jt).call(this, i.signal)]));
|
|
444
|
+
const d = await n;
|
|
445
|
+
s(d), this.emit("completed", d);
|
|
446
446
|
} catch (n) {
|
|
447
447
|
if (n instanceof Vt && !i.throwOnTimeout) {
|
|
448
448
|
s();
|
|
@@ -450,9 +450,9 @@ class ss extends Zi {
|
|
|
450
450
|
}
|
|
451
451
|
r(n), this.emit("error", n);
|
|
452
452
|
} finally {
|
|
453
|
-
|
|
453
|
+
F(this, T, jt).call(this);
|
|
454
454
|
}
|
|
455
|
-
}, i), this.emit("add"),
|
|
455
|
+
}, i), this.emit("add"), F(this, T, qe).call(this);
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
458
|
async addAll(t, i) {
|
|
@@ -462,19 +462,19 @@ class ss extends Zi {
|
|
|
462
462
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
463
463
|
*/
|
|
464
464
|
start() {
|
|
465
|
-
return _(this,
|
|
465
|
+
return _(this, ce) ? (H(this, ce, !1), F(this, T, Pe).call(this), this) : this;
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
468
468
|
Put queue execution on hold.
|
|
469
469
|
*/
|
|
470
470
|
pause() {
|
|
471
|
-
|
|
471
|
+
H(this, ce, !0);
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
474
474
|
Clear the queue.
|
|
475
475
|
*/
|
|
476
476
|
clear() {
|
|
477
|
-
|
|
477
|
+
H(this, W, new (_(this, Ae))());
|
|
478
478
|
}
|
|
479
479
|
/**
|
|
480
480
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -482,7 +482,7 @@ class ss extends Zi {
|
|
|
482
482
|
@returns A promise that settles when the queue becomes empty.
|
|
483
483
|
*/
|
|
484
484
|
async onEmpty() {
|
|
485
|
-
_(this,
|
|
485
|
+
_(this, W).size !== 0 && await F(this, T, $e).call(this, "empty");
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -492,7 +492,7 @@ class ss extends Zi {
|
|
|
492
492
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
493
493
|
*/
|
|
494
494
|
async onSizeLessThan(t) {
|
|
495
|
-
_(this,
|
|
495
|
+
_(this, W).size < t || await F(this, T, $e).call(this, "next", () => _(this, W).size < t);
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
498
498
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -500,13 +500,13 @@ class ss extends Zi {
|
|
|
500
500
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
501
501
|
*/
|
|
502
502
|
async onIdle() {
|
|
503
|
-
_(this, re) === 0 && _(this,
|
|
503
|
+
_(this, re) === 0 && _(this, W).size === 0 || await F(this, T, $e).call(this, "idle");
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
506
506
|
Size of the queue, the number of queued items waiting to run.
|
|
507
507
|
*/
|
|
508
508
|
get size() {
|
|
509
|
-
return _(this,
|
|
509
|
+
return _(this, W).size;
|
|
510
510
|
}
|
|
511
511
|
/**
|
|
512
512
|
Size of the queue, filtered by the given options.
|
|
@@ -514,7 +514,7 @@ class ss extends Zi {
|
|
|
514
514
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
515
515
|
*/
|
|
516
516
|
sizeBy(t) {
|
|
517
|
-
return _(this,
|
|
517
|
+
return _(this, W).filter(t).length;
|
|
518
518
|
}
|
|
519
519
|
/**
|
|
520
520
|
Number of running items (no longer in the queue).
|
|
@@ -526,51 +526,51 @@ class ss extends Zi {
|
|
|
526
526
|
Whether the queue is currently paused.
|
|
527
527
|
*/
|
|
528
528
|
get isPaused() {
|
|
529
|
-
return _(this,
|
|
529
|
+
return _(this, ce);
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
|
|
533
|
-
return _(this,
|
|
532
|
+
be = new WeakMap(), we = new WeakMap(), fe = new WeakMap(), Ne = new WeakMap(), Ee = new WeakMap(), Le = new WeakMap(), se = new WeakMap(), xe = new WeakMap(), W = new WeakMap(), Ae = new WeakMap(), re = new WeakMap(), Ce = new WeakMap(), ce = new WeakMap(), Oe = new WeakMap(), Ke = new WeakMap(), T = new WeakSet(), Qt = function() {
|
|
533
|
+
return _(this, we) || _(this, fe) < _(this, Ne);
|
|
534
534
|
}, Yt = function() {
|
|
535
|
-
return _(this, re) < _(this,
|
|
535
|
+
return _(this, re) < _(this, Ce);
|
|
536
536
|
}, jt = function() {
|
|
537
|
-
|
|
537
|
+
Te(this, re)._--, F(this, T, qe).call(this), this.emit("next");
|
|
538
538
|
}, Xt = function() {
|
|
539
|
-
|
|
539
|
+
F(this, T, ot).call(this), F(this, T, nt).call(this), H(this, xe, void 0);
|
|
540
540
|
}, Zt = function() {
|
|
541
541
|
const t = Date.now();
|
|
542
542
|
if (_(this, se) === void 0) {
|
|
543
|
-
const i = _(this,
|
|
543
|
+
const i = _(this, Le) - t;
|
|
544
544
|
if (i < 0)
|
|
545
|
-
|
|
545
|
+
H(this, fe, _(this, be) ? _(this, re) : 0);
|
|
546
546
|
else
|
|
547
|
-
return _(this,
|
|
548
|
-
|
|
547
|
+
return _(this, xe) === void 0 && H(this, xe, setTimeout(() => {
|
|
548
|
+
F(this, T, Xt).call(this);
|
|
549
549
|
}, i)), !0;
|
|
550
550
|
}
|
|
551
551
|
return !1;
|
|
552
552
|
}, qe = function() {
|
|
553
|
-
if (_(this,
|
|
554
|
-
return _(this, se) && clearInterval(_(this, se)),
|
|
555
|
-
if (!_(this,
|
|
553
|
+
if (_(this, W).size === 0)
|
|
554
|
+
return _(this, se) && clearInterval(_(this, se)), H(this, se, void 0), this.emit("empty"), _(this, re) === 0 && this.emit("idle"), !1;
|
|
555
|
+
if (!_(this, ce)) {
|
|
556
556
|
const t = !_(this, T, Zt);
|
|
557
557
|
if (_(this, T, Qt) && _(this, T, Yt)) {
|
|
558
|
-
const i = _(this,
|
|
559
|
-
return i ? (this.emit("active"), i(), t &&
|
|
558
|
+
const i = _(this, W).dequeue();
|
|
559
|
+
return i ? (this.emit("active"), i(), t && F(this, T, nt).call(this), !0) : !1;
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
return !1;
|
|
563
563
|
}, nt = function() {
|
|
564
|
-
_(this,
|
|
565
|
-
|
|
566
|
-
}, _(this,
|
|
564
|
+
_(this, we) || _(this, se) !== void 0 || (H(this, se, setInterval(() => {
|
|
565
|
+
F(this, T, ot).call(this);
|
|
566
|
+
}, _(this, Ee))), H(this, Le, Date.now() + _(this, Ee)));
|
|
567
567
|
}, ot = function() {
|
|
568
|
-
_(this,
|
|
568
|
+
_(this, fe) === 0 && _(this, re) === 0 && _(this, se) && (clearInterval(_(this, se)), H(this, se, void 0)), H(this, fe, _(this, be) ? _(this, re) : 0), F(this, T, Pe).call(this);
|
|
569
569
|
}, /**
|
|
570
570
|
Executes all queued functions until it reaches the limit.
|
|
571
571
|
*/
|
|
572
572
|
Pe = function() {
|
|
573
|
-
for (;
|
|
573
|
+
for (; F(this, T, qe).call(this); )
|
|
574
574
|
;
|
|
575
575
|
}, Jt = async function(t) {
|
|
576
576
|
return new Promise((i, s) => {
|
|
@@ -586,118 +586,118 @@ Pe = function() {
|
|
|
586
586
|
this.on(t, r);
|
|
587
587
|
});
|
|
588
588
|
};
|
|
589
|
-
const
|
|
590
|
-
const
|
|
589
|
+
const ss = () => {
|
|
590
|
+
const u = ut(), e = ve(pe);
|
|
591
591
|
if (!e)
|
|
592
592
|
return;
|
|
593
593
|
if (e.queryFnOverride) {
|
|
594
594
|
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.");
|
|
595
595
|
return;
|
|
596
596
|
}
|
|
597
|
-
const t = new
|
|
597
|
+
const t = new is({
|
|
598
598
|
carryoverConcurrencyCount: !0,
|
|
599
|
-
concurrency:
|
|
600
|
-
interval:
|
|
601
|
-
intervalCap:
|
|
599
|
+
concurrency: u.maxParallelRequests,
|
|
600
|
+
interval: u.requestInterval,
|
|
601
|
+
intervalCap: u.requestIntervalCap
|
|
602
602
|
}), i = {
|
|
603
603
|
...e,
|
|
604
604
|
queryFnOverride: !0,
|
|
605
605
|
queryFn: (s, r) => t.add(() => e.queryFn(s, r), { throwOnTimeout: !0 })
|
|
606
606
|
};
|
|
607
|
-
|
|
607
|
+
li(pe, i);
|
|
608
608
|
};
|
|
609
|
-
function
|
|
610
|
-
queryBridge:
|
|
609
|
+
function rs({
|
|
610
|
+
queryBridge: u,
|
|
611
611
|
context: e,
|
|
612
612
|
definition: t,
|
|
613
613
|
chartData: i
|
|
614
614
|
}) {
|
|
615
|
-
const
|
|
615
|
+
const s = A(""), r = A(""), o = A(void 0), n = A(void 0), d = ut();
|
|
616
616
|
at(async () => {
|
|
617
|
-
var R,
|
|
618
|
-
|
|
617
|
+
var R, O;
|
|
618
|
+
s.value = await ((R = u == null ? void 0 : u.exploreBaseUrl) == null ? void 0 : R.call(u)) ?? "", r.value = await ((O = u == null ? void 0 : u.requestsBaseUrl) == null ? void 0 : O.call(u)) ?? "";
|
|
619
619
|
});
|
|
620
|
-
const
|
|
620
|
+
const l = k(() => d.analytics && d.percentiles), h = k(() => !["golden_signals", "top_n", "gauge"].includes(t.value.chart.type)), a = k(() => r.value && t.value.query && t.value.query.datasource !== "llm_usage" && l.value), f = k(() => s.value && t.value.query && ["basic", "api_usage", "llm_usage", void 0].includes(t.value.query.datasource) && l.value), p = k(() => i.value ? rt(i.value.meta.granularity_ms) : void 0), g = k(() => {
|
|
621
621
|
var Y;
|
|
622
|
-
const R = [...e.value.filters, ...t.value.query.filters ?? []],
|
|
623
|
-
return R.filter((
|
|
624
|
-
}),
|
|
625
|
-
if (!
|
|
622
|
+
const R = [...e.value.filters, ...t.value.query.filters ?? []], O = ((Y = t.value.query) == null ? void 0 : Y.datasource) ?? "api_usage";
|
|
623
|
+
return R.filter((ue) => Ft(ue.field).some((J) => O === J));
|
|
624
|
+
}), y = k(() => {
|
|
625
|
+
if (!f.value || !h.value)
|
|
626
626
|
return "";
|
|
627
|
-
const R =
|
|
628
|
-
return
|
|
629
|
-
}),
|
|
630
|
-
if (!
|
|
627
|
+
const R = g.value, O = t.value.query.time_range || e.value.timeSpec, Y = Q(O, R);
|
|
628
|
+
return B(Y);
|
|
629
|
+
}), m = k(() => {
|
|
630
|
+
if (!a.value || !h.value)
|
|
631
631
|
return "";
|
|
632
|
-
const R =
|
|
632
|
+
const R = g.value, O = M(
|
|
633
633
|
t.value.query.time_range || e.value.timeSpec,
|
|
634
634
|
R
|
|
635
635
|
);
|
|
636
|
-
return S(
|
|
637
|
-
}), S = (R) =>
|
|
638
|
-
var Y,
|
|
636
|
+
return S(O);
|
|
637
|
+
}), S = (R) => a.value ? `${r.value}?q=${JSON.stringify(R)}` : "", M = (R, O) => {
|
|
638
|
+
var Y, ue;
|
|
639
639
|
return {
|
|
640
|
-
filter:
|
|
640
|
+
filter: O,
|
|
641
641
|
timeframe: {
|
|
642
642
|
timePeriodsKey: R.type === "relative" ? R.time_range : "custom",
|
|
643
643
|
start: R.type === "absolute" ? (Y = i.value) == null ? void 0 : Y.meta.start_ms : void 0,
|
|
644
|
-
end: R.type === "absolute" ? (
|
|
644
|
+
end: R.type === "absolute" ? (ue = i.value) == null ? void 0 : ue.meta.end_ms : void 0
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
},
|
|
648
|
-
filter:
|
|
647
|
+
}, z = (R, O) => ({
|
|
648
|
+
filter: O,
|
|
649
649
|
timeframe: {
|
|
650
650
|
timePeriodsKey: R.type === "relative" ? R.time_range : "custom",
|
|
651
651
|
start: R.type === "absolute" ? R.start : void 0,
|
|
652
652
|
end: R.type === "absolute" ? R.end : void 0
|
|
653
653
|
}
|
|
654
|
-
}),
|
|
654
|
+
}), Q = (R, O) => {
|
|
655
655
|
const Y = t.value.query.dimensions ?? [];
|
|
656
656
|
return {
|
|
657
|
-
filters:
|
|
657
|
+
filters: O,
|
|
658
658
|
metrics: t.value.query.metrics ?? [],
|
|
659
659
|
dimensions: Y,
|
|
660
660
|
time_range: R,
|
|
661
|
-
granularity: t.value.query.granularity ||
|
|
661
|
+
granularity: t.value.query.granularity || p.value
|
|
662
662
|
};
|
|
663
|
-
},
|
|
664
|
-
if (!
|
|
663
|
+
}, B = (R) => {
|
|
664
|
+
if (!f.value)
|
|
665
665
|
return "";
|
|
666
|
-
const
|
|
667
|
-
return `${
|
|
666
|
+
const O = ["api_usage", "llm_usage"].includes(t.value.query.datasource) ? t.value.query.datasource : "api_usage";
|
|
667
|
+
return `${s.value}?q=${JSON.stringify(R)}&d=${O}&c=${t.value.chart.type}`;
|
|
668
668
|
};
|
|
669
|
-
return Ve([
|
|
670
|
-
R && (
|
|
669
|
+
return Ve([a, f], ([R, O]) => {
|
|
670
|
+
R && (o.value = { href: "" }), O && (n.value = { href: "" });
|
|
671
671
|
}), {
|
|
672
|
-
exploreLinkKebabMenu:
|
|
673
|
-
requestsLinkKebabMenu:
|
|
674
|
-
canShowKebabMenu:
|
|
675
|
-
canGenerateRequestsLink:
|
|
676
|
-
canGenerateExploreLink:
|
|
677
|
-
requestsLinkZoomActions:
|
|
678
|
-
exploreLinkZoomActions:
|
|
679
|
-
buildExploreQuery:
|
|
680
|
-
buildRequestsQueryZoomActions:
|
|
681
|
-
buildExploreLink:
|
|
672
|
+
exploreLinkKebabMenu: y,
|
|
673
|
+
requestsLinkKebabMenu: m,
|
|
674
|
+
canShowKebabMenu: h,
|
|
675
|
+
canGenerateRequestsLink: a,
|
|
676
|
+
canGenerateExploreLink: f,
|
|
677
|
+
requestsLinkZoomActions: o,
|
|
678
|
+
exploreLinkZoomActions: n,
|
|
679
|
+
buildExploreQuery: Q,
|
|
680
|
+
buildRequestsQueryZoomActions: z,
|
|
681
|
+
buildExploreLink: B,
|
|
682
682
|
buildRequestLink: S
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const ns = (u, e, t) => {
|
|
686
686
|
const i = [];
|
|
687
|
-
return e && i.push(...e), i.push(...
|
|
687
|
+
return e && i.push(...e), i.push(...gi(u, t)), i;
|
|
688
688
|
};
|
|
689
|
-
function
|
|
690
|
-
const
|
|
689
|
+
function os() {
|
|
690
|
+
const u = ve(pe), e = new AbortController();
|
|
691
691
|
return lt(() => {
|
|
692
692
|
e.abort();
|
|
693
693
|
}), { issueQuery: async (i, s, r) => {
|
|
694
|
-
if (!
|
|
694
|
+
if (!u)
|
|
695
695
|
throw new Error("Query bridge is not defined");
|
|
696
696
|
const {
|
|
697
697
|
datasource: o,
|
|
698
698
|
limit: n,
|
|
699
|
-
...
|
|
700
|
-
} = i,
|
|
699
|
+
...d
|
|
700
|
+
} = i, l = o || "basic", h = ns(l, i.filters, s.filters);
|
|
701
701
|
let a = i.time_range;
|
|
702
702
|
a ? a.tz || (a = {
|
|
703
703
|
...a,
|
|
@@ -707,24 +707,24 @@ function as() {
|
|
|
707
707
|
tz: s.tz
|
|
708
708
|
};
|
|
709
709
|
const f = {
|
|
710
|
-
datasource:
|
|
710
|
+
datasource: l,
|
|
711
711
|
query: {
|
|
712
|
-
...
|
|
712
|
+
...d,
|
|
713
713
|
time_range: a,
|
|
714
|
-
filters:
|
|
714
|
+
filters: h,
|
|
715
715
|
limit: r ?? n
|
|
716
716
|
}
|
|
717
717
|
};
|
|
718
|
-
return
|
|
718
|
+
return u.queryFn(f, e);
|
|
719
719
|
} };
|
|
720
720
|
}
|
|
721
|
-
const
|
|
722
|
-
useContextLinks:
|
|
723
|
-
useEvaluateFeatureFlag:
|
|
724
|
-
useI18n:
|
|
725
|
-
useIssueQuery:
|
|
726
|
-
useRequestQueue:
|
|
727
|
-
}, ct = /* @__PURE__ */
|
|
721
|
+
const ye = {
|
|
722
|
+
useContextLinks: rs,
|
|
723
|
+
useEvaluateFeatureFlag: Qi,
|
|
724
|
+
useI18n: Fi,
|
|
725
|
+
useIssueQuery: os,
|
|
726
|
+
useRequestQueue: ss
|
|
727
|
+
}, ct = /* @__PURE__ */ Z({
|
|
728
728
|
__name: "QueryDataProvider",
|
|
729
729
|
props: {
|
|
730
730
|
context: {},
|
|
@@ -734,13 +734,13 @@ const ce = {
|
|
|
734
734
|
refreshCounter: {}
|
|
735
735
|
},
|
|
736
736
|
emits: ["chart-data", "queryComplete"],
|
|
737
|
-
setup(
|
|
738
|
-
const t =
|
|
737
|
+
setup(u, { emit: e }) {
|
|
738
|
+
const t = u, i = e, { issueQuery: s } = ye.useIssueQuery(), r = ve(pe), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, { data: n, error: d, isValidating: l } = xi(o, async () => {
|
|
739
739
|
try {
|
|
740
740
|
const y = await s(t.query, t.context, t.limitOverride);
|
|
741
741
|
return f.value = null, y;
|
|
742
742
|
} catch (y) {
|
|
743
|
-
throw f.value =
|
|
743
|
+
throw f.value = vi(y), y;
|
|
744
744
|
} finally {
|
|
745
745
|
i("queryComplete");
|
|
746
746
|
}
|
|
@@ -748,22 +748,22 @@ const ce = {
|
|
|
748
748
|
refreshInterval: t.context.refreshInterval,
|
|
749
749
|
revalidateOnFocus: !1,
|
|
750
750
|
shouldRetryOnError: !1
|
|
751
|
-
}), { state:
|
|
751
|
+
}), { state: h, swrvState: a } = Oi(n, d, l), f = A(null), p = k(() => h.value === a.ERROR || !!f.value), g = k(() => !t.queryReady || h.value === a.PENDING);
|
|
752
752
|
return Ve(n, (y) => {
|
|
753
753
|
y && i("chart-data", y);
|
|
754
|
-
}), (y,
|
|
755
|
-
const
|
|
756
|
-
return g.value || !x(n) && !
|
|
754
|
+
}), (y, m) => {
|
|
755
|
+
const S = ge("KSkeleton"), M = ge("KEmptyState");
|
|
756
|
+
return g.value || !x(n) && !p.value ? (C(), L(S, {
|
|
757
757
|
key: 0,
|
|
758
758
|
class: "chart-skeleton",
|
|
759
759
|
type: "table"
|
|
760
|
-
})) :
|
|
760
|
+
})) : p.value && f.value ? (C(), L(M, {
|
|
761
761
|
key: 1,
|
|
762
762
|
"action-button-visible": !1,
|
|
763
763
|
"data-testid": "chart-empty-state"
|
|
764
764
|
}, Qe({
|
|
765
765
|
icon: $(() => [
|
|
766
|
-
f.value.type === "forbidden" ? (C(),
|
|
766
|
+
f.value.type === "forbidden" ? (C(), L(x(ki), { key: 0 })) : (C(), L(x(Ti), { key: 1 }))
|
|
767
767
|
]),
|
|
768
768
|
title: $(() => [
|
|
769
769
|
oe("p", null, ne(f.value.message), 1)
|
|
@@ -777,13 +777,13 @@ const ce = {
|
|
|
777
777
|
]),
|
|
778
778
|
key: "0"
|
|
779
779
|
} : void 0
|
|
780
|
-
]), 1024)) : x(n) ?
|
|
780
|
+
]), 1024)) : x(n) ? ze(y.$slots, "default", {
|
|
781
781
|
key: 2,
|
|
782
782
|
data: x(n)
|
|
783
|
-
}) :
|
|
783
|
+
}) : V("", !0);
|
|
784
784
|
};
|
|
785
785
|
}
|
|
786
|
-
}),
|
|
786
|
+
}), as = /* @__PURE__ */ Z({
|
|
787
787
|
__name: "SimpleChartRenderer",
|
|
788
788
|
props: {
|
|
789
789
|
query: {},
|
|
@@ -795,12 +795,12 @@ const ce = {
|
|
|
795
795
|
requestsLink: {},
|
|
796
796
|
exploreLink: {}
|
|
797
797
|
},
|
|
798
|
-
setup(
|
|
798
|
+
setup(u) {
|
|
799
799
|
Ye((i) => ({
|
|
800
800
|
"088169ae": `${i.height}px`
|
|
801
801
|
}));
|
|
802
|
-
const e =
|
|
803
|
-
return (i, s) => (C(),
|
|
802
|
+
const e = u, t = k(() => e.chartOptions.type === "single_value");
|
|
803
|
+
return (i, s) => (C(), L(ct, {
|
|
804
804
|
context: i.context,
|
|
805
805
|
query: i.query,
|
|
806
806
|
"query-ready": i.queryReady,
|
|
@@ -810,7 +810,7 @@ const ce = {
|
|
|
810
810
|
oe("div", {
|
|
811
811
|
class: je(["analytics-chart", { "single-value": t.value }])
|
|
812
812
|
}, [
|
|
813
|
-
|
|
813
|
+
de(x(_i), {
|
|
814
814
|
"chart-data": r,
|
|
815
815
|
"chart-options": i.chartOptions,
|
|
816
816
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.synthetics_data_key
|
|
@@ -820,12 +820,12 @@ const ce = {
|
|
|
820
820
|
_: 1
|
|
821
821
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
822
822
|
}
|
|
823
|
-
}),
|
|
824
|
-
const t =
|
|
823
|
+
}), _e = (u, e) => {
|
|
824
|
+
const t = u.__vccOpts || u;
|
|
825
825
|
for (const [i, s] of e)
|
|
826
826
|
t[i] = s;
|
|
827
827
|
return t;
|
|
828
|
-
}, zt = /* @__PURE__ */
|
|
828
|
+
}, zt = /* @__PURE__ */ _e(as, [["__scopeId", "data-v-1e9ff912"]]), ls = { class: "analytics-chart" }, hs = /* @__PURE__ */ Z({
|
|
829
829
|
__name: "BaseAnalyticsChartRenderer",
|
|
830
830
|
props: {
|
|
831
831
|
query: {},
|
|
@@ -839,45 +839,45 @@ const ce = {
|
|
|
839
839
|
extraProps: {}
|
|
840
840
|
},
|
|
841
841
|
emits: ["edit-tile", "chart-data", "zoom-time-range", "view-requests", "select-chart-range"],
|
|
842
|
-
setup(
|
|
843
|
-
const t =
|
|
842
|
+
setup(u, { emit: e }) {
|
|
843
|
+
const t = u, i = e, { i18n: s } = ye.useI18n(), r = k(() => ({
|
|
844
844
|
type: t.chartOptions.type,
|
|
845
845
|
stacked: t.chartOptions.stacked ?? !1,
|
|
846
846
|
chartDatasetColors: t.chartOptions.chart_dataset_colors,
|
|
847
847
|
threshold: t.chartOptions.threshold
|
|
848
|
-
})),
|
|
848
|
+
})), o = k(() => t.context.zoomable), n = () => {
|
|
849
849
|
i("edit-tile");
|
|
850
|
-
},
|
|
851
|
-
i("chart-data",
|
|
850
|
+
}, d = (l) => {
|
|
851
|
+
i("chart-data", l);
|
|
852
852
|
};
|
|
853
|
-
return (
|
|
854
|
-
const
|
|
855
|
-
return C(),
|
|
856
|
-
context:
|
|
857
|
-
query:
|
|
858
|
-
"query-ready":
|
|
859
|
-
"refresh-counter":
|
|
860
|
-
onChartData:
|
|
853
|
+
return (l, h) => {
|
|
854
|
+
const a = ge("KDropdownItem");
|
|
855
|
+
return C(), L(ct, {
|
|
856
|
+
context: l.context,
|
|
857
|
+
query: l.query,
|
|
858
|
+
"query-ready": l.queryReady,
|
|
859
|
+
"refresh-counter": l.refreshCounter,
|
|
860
|
+
onChartData: d
|
|
861
861
|
}, {
|
|
862
|
-
default: $(({ data:
|
|
863
|
-
oe("div",
|
|
864
|
-
|
|
865
|
-
"chart-data":
|
|
866
|
-
"chart-options":
|
|
867
|
-
"explore-link":
|
|
862
|
+
default: $(({ data: f }) => [
|
|
863
|
+
oe("div", ls, [
|
|
864
|
+
de(x(bi), It({
|
|
865
|
+
"chart-data": f,
|
|
866
|
+
"chart-options": r.value,
|
|
867
|
+
"explore-link": l.exploreLink,
|
|
868
868
|
"legend-position": "bottom",
|
|
869
|
-
"requests-link":
|
|
870
|
-
"synthetics-data-key":
|
|
871
|
-
"timeseries-zoom":
|
|
869
|
+
"requests-link": l.requestsLink,
|
|
870
|
+
"synthetics-data-key": l.chartOptions.synthetics_data_key,
|
|
871
|
+
"timeseries-zoom": o.value,
|
|
872
872
|
"tooltip-title": ""
|
|
873
|
-
},
|
|
874
|
-
onSelectChartRange:
|
|
875
|
-
onZoomTimeRange:
|
|
873
|
+
}, l.extraProps, {
|
|
874
|
+
onSelectChartRange: h[0] || (h[0] = (p) => i("select-chart-range", p)),
|
|
875
|
+
onZoomTimeRange: h[1] || (h[1] = (p) => i("zoom-time-range", p))
|
|
876
876
|
}), Qe({ _: 2 }, [
|
|
877
|
-
|
|
877
|
+
l.context.editable ? {
|
|
878
878
|
name: "menu-items",
|
|
879
879
|
fn: $(() => [
|
|
880
|
-
|
|
880
|
+
de(a, { onClick: n }, {
|
|
881
881
|
default: $(() => [
|
|
882
882
|
ht(ne(x(s).t("renderer.edit")), 1)
|
|
883
883
|
]),
|
|
@@ -893,7 +893,7 @@ const ce = {
|
|
|
893
893
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
|
-
}), ft = /* @__PURE__ */
|
|
896
|
+
}), ft = /* @__PURE__ */ _e(hs, [["__scopeId", "data-v-65bbb93b"]]), St = /* @__PURE__ */ Z({
|
|
897
897
|
__name: "BarChartRenderer",
|
|
898
898
|
props: {
|
|
899
899
|
query: {},
|
|
@@ -905,8 +905,8 @@ const ce = {
|
|
|
905
905
|
requestsLink: {},
|
|
906
906
|
exploreLink: {}
|
|
907
907
|
},
|
|
908
|
-
setup(
|
|
909
|
-
return (e, t) => (C(),
|
|
908
|
+
setup(u) {
|
|
909
|
+
return (e, t) => (C(), L(ft, {
|
|
910
910
|
"chart-options": e.chartOptions,
|
|
911
911
|
context: e.context,
|
|
912
912
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -916,7 +916,7 @@ const ce = {
|
|
|
916
916
|
"refresh-counter": e.refreshCounter
|
|
917
917
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
918
918
|
}
|
|
919
|
-
}), Dt = /* @__PURE__ */
|
|
919
|
+
}), Dt = /* @__PURE__ */ Z({
|
|
920
920
|
__name: "TimeseriesChartRenderer",
|
|
921
921
|
props: {
|
|
922
922
|
query: {},
|
|
@@ -929,9 +929,9 @@ const ce = {
|
|
|
929
929
|
exploreLink: {}
|
|
930
930
|
},
|
|
931
931
|
emits: ["zoom-time-range", "select-chart-range"],
|
|
932
|
-
setup(
|
|
932
|
+
setup(u, { emit: e }) {
|
|
933
933
|
const t = e;
|
|
934
|
-
return (i, s) => (C(),
|
|
934
|
+
return (i, s) => (C(), L(ft, {
|
|
935
935
|
"chart-options": i.chartOptions,
|
|
936
936
|
context: i.context,
|
|
937
937
|
"explore-link": i.exploreLink,
|
|
@@ -944,7 +944,7 @@ const ce = {
|
|
|
944
944
|
onZoomTimeRange: s[1] || (s[1] = (r) => t("zoom-time-range", r))
|
|
945
945
|
}, null, 8, ["chart-options", "context", "explore-link", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
946
946
|
}
|
|
947
|
-
}), ds = { class: "metric-card-tile-wrapper" },
|
|
947
|
+
}), ds = { class: "metric-card-tile-wrapper" }, us = /* @__PURE__ */ Z({
|
|
948
948
|
__name: "GoldenSignalsRenderer",
|
|
949
949
|
props: {
|
|
950
950
|
query: {},
|
|
@@ -956,8 +956,8 @@ const ce = {
|
|
|
956
956
|
requestsLink: {},
|
|
957
957
|
exploreLink: {}
|
|
958
958
|
},
|
|
959
|
-
setup(
|
|
960
|
-
const e =
|
|
959
|
+
setup(u) {
|
|
960
|
+
const e = u, t = k(() => {
|
|
961
961
|
const s = e.context.timeSpec;
|
|
962
962
|
if (s.type === "absolute")
|
|
963
963
|
return new pi({
|
|
@@ -994,27 +994,27 @@ const ce = {
|
|
|
994
994
|
refreshCounter: e.refreshCounter
|
|
995
995
|
};
|
|
996
996
|
});
|
|
997
|
-
return (s, r) => (C(),
|
|
998
|
-
|
|
997
|
+
return (s, r) => (C(), K("div", ds, [
|
|
998
|
+
de(x(Ni), hi(di(i.value)), {
|
|
999
999
|
default: $(() => [
|
|
1000
|
-
|
|
1000
|
+
de(x(Li))
|
|
1001
1001
|
]),
|
|
1002
1002
|
_: 1
|
|
1003
1003
|
}, 16)
|
|
1004
1004
|
]));
|
|
1005
1005
|
}
|
|
1006
|
-
}),
|
|
1006
|
+
}), cs = /* @__PURE__ */ _e(us, [["__scopeId", "data-v-7e1b1cc1"]]), Nt = "#6c7489", fs = "12px", Lt = "20px", ei = "20px", gs = {
|
|
1007
1007
|
class: "fallback-entity-link",
|
|
1008
1008
|
"data-testid": "entity-link-parent"
|
|
1009
|
-
}, At = /* @__PURE__ */
|
|
1009
|
+
}, At = /* @__PURE__ */ Z({
|
|
1010
1010
|
__name: "FallbackEntityLink",
|
|
1011
1011
|
props: {
|
|
1012
1012
|
entityLinkData: {}
|
|
1013
1013
|
},
|
|
1014
|
-
setup(
|
|
1015
|
-
return (e, t) => (C(),
|
|
1014
|
+
setup(u) {
|
|
1015
|
+
return (e, t) => (C(), K("div", gs, ne(e.entityLinkData.label), 1));
|
|
1016
1016
|
}
|
|
1017
|
-
}), ps = /* @__PURE__ */
|
|
1017
|
+
}), ps = /* @__PURE__ */ Z({
|
|
1018
1018
|
__name: "TopNTableRenderer",
|
|
1019
1019
|
props: {
|
|
1020
1020
|
query: {},
|
|
@@ -1026,8 +1026,8 @@ const ce = {
|
|
|
1026
1026
|
requestsLink: {},
|
|
1027
1027
|
exploreLink: {}
|
|
1028
1028
|
},
|
|
1029
|
-
setup(
|
|
1030
|
-
const e =
|
|
1029
|
+
setup(u) {
|
|
1030
|
+
const e = u, t = ve(pe), i = qt(async () => {
|
|
1031
1031
|
if (t != null && t.fetchComponent)
|
|
1032
1032
|
try {
|
|
1033
1033
|
return await t.fetchComponent("EntityLink");
|
|
@@ -1039,33 +1039,33 @@ const ce = {
|
|
|
1039
1039
|
var o;
|
|
1040
1040
|
if ((o = e.chartOptions) != null && o.entity_link)
|
|
1041
1041
|
if (r.id.includes(":")) {
|
|
1042
|
-
const [n,
|
|
1043
|
-
return e.chartOptions.entity_link.replace(
|
|
1042
|
+
const [n, d] = r.id.split(":");
|
|
1043
|
+
return e.chartOptions.entity_link.replace(Bi, n).replace(Rt, d);
|
|
1044
1044
|
} else
|
|
1045
1045
|
return e.chartOptions.entity_link.replace(Rt, r.id);
|
|
1046
1046
|
return "";
|
|
1047
1047
|
};
|
|
1048
|
-
return (r, o) => (C(),
|
|
1048
|
+
return (r, o) => (C(), L(ct, {
|
|
1049
1049
|
context: r.context,
|
|
1050
1050
|
query: r.query,
|
|
1051
1051
|
"query-ready": r.queryReady,
|
|
1052
1052
|
"refresh-counter": r.refreshCounter
|
|
1053
1053
|
}, {
|
|
1054
1054
|
default: $(({ data: n }) => [
|
|
1055
|
-
|
|
1055
|
+
de(x(wi), {
|
|
1056
1056
|
data: n,
|
|
1057
1057
|
"synthetics-data-key": r.chartOptions.synthetics_data_key
|
|
1058
1058
|
}, Qe({ _: 2 }, [
|
|
1059
1059
|
e.chartOptions.entity_link ? {
|
|
1060
1060
|
name: "name",
|
|
1061
|
-
fn: $(({ record:
|
|
1062
|
-
|
|
1061
|
+
fn: $(({ record: d }) => [
|
|
1062
|
+
de(x(i), {
|
|
1063
1063
|
"entity-link-data": {
|
|
1064
|
-
id:
|
|
1065
|
-
label:
|
|
1066
|
-
deleted:
|
|
1064
|
+
id: d.id,
|
|
1065
|
+
label: d.name,
|
|
1066
|
+
deleted: d.deleted
|
|
1067
1067
|
},
|
|
1068
|
-
"external-link": s(
|
|
1068
|
+
"external-link": s(d)
|
|
1069
1069
|
}, null, 8, ["entity-link-data", "external-link"])
|
|
1070
1070
|
]),
|
|
1071
1071
|
key: "0"
|
|
@@ -1075,7 +1075,7 @@ const ce = {
|
|
|
1075
1075
|
_: 1
|
|
1076
1076
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
1077
1077
|
}
|
|
1078
|
-
}),
|
|
1078
|
+
}), ms = /* @__PURE__ */ Z({
|
|
1079
1079
|
__name: "DonutChartRenderer",
|
|
1080
1080
|
props: {
|
|
1081
1081
|
query: {},
|
|
@@ -1087,8 +1087,8 @@ const ce = {
|
|
|
1087
1087
|
requestsLink: {},
|
|
1088
1088
|
exploreLink: {}
|
|
1089
1089
|
},
|
|
1090
|
-
setup(
|
|
1091
|
-
return (e, t) => (C(),
|
|
1090
|
+
setup(u) {
|
|
1091
|
+
return (e, t) => (C(), L(ft, {
|
|
1092
1092
|
"chart-options": e.chartOptions,
|
|
1093
1093
|
context: e.context,
|
|
1094
1094
|
height: e.height,
|
|
@@ -1097,10 +1097,10 @@ const ce = {
|
|
|
1097
1097
|
"refresh-counter": e.refreshCounter
|
|
1098
1098
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
1099
1099
|
}
|
|
1100
|
-
}),
|
|
1100
|
+
}), ys = ["data-testid"], vs = {
|
|
1101
1101
|
key: 0,
|
|
1102
1102
|
class: "tile-header"
|
|
1103
|
-
},
|
|
1103
|
+
}, _s = ["data-testid"], bs = { class: "badge-text" }, ws = ["data-testid"], Es = { class: "delete-option" }, xs = ["data-testid"], Cs = ["data-testid"], Rs = /* @__PURE__ */ Z({
|
|
1104
1104
|
__name: "DashboardTile",
|
|
1105
1105
|
props: {
|
|
1106
1106
|
definition: {},
|
|
@@ -1112,52 +1112,52 @@ const ce = {
|
|
|
1112
1112
|
tileId: {}
|
|
1113
1113
|
},
|
|
1114
1114
|
emits: ["edit-tile", "duplicate-tile", "remove-tile", "tile-time-range-zoom"],
|
|
1115
|
-
setup(
|
|
1115
|
+
setup(u, { emit: e }) {
|
|
1116
1116
|
Ye((v) => ({
|
|
1117
|
-
"
|
|
1117
|
+
"07613616": `${v.height}px`
|
|
1118
1118
|
}));
|
|
1119
|
-
const t = parseInt(ei, 10), i =
|
|
1120
|
-
exploreLinkKebabMenu:
|
|
1121
|
-
requestsLinkKebabMenu:
|
|
1122
|
-
canShowKebabMenu:
|
|
1123
|
-
canGenerateRequestsLink:
|
|
1124
|
-
canGenerateExploreLink:
|
|
1125
|
-
requestsLinkZoomActions:
|
|
1126
|
-
exploreLinkZoomActions:
|
|
1127
|
-
buildExploreQuery:
|
|
1128
|
-
buildExploreLink:
|
|
1129
|
-
buildRequestLink:
|
|
1130
|
-
buildRequestsQueryZoomActions:
|
|
1131
|
-
} =
|
|
1119
|
+
const t = parseInt(ei, 10), i = u, s = e, r = qt(() => import("./GeoMapRenderer-BbtUsI11.js")), o = ve(pe), { i18n: n } = ye.useI18n(), d = A(), l = A({ status: "loading" }), h = A(!1), a = A(), f = A(!1), p = A(!0), {
|
|
1120
|
+
exploreLinkKebabMenu: g,
|
|
1121
|
+
requestsLinkKebabMenu: y,
|
|
1122
|
+
canShowKebabMenu: m,
|
|
1123
|
+
canGenerateRequestsLink: S,
|
|
1124
|
+
canGenerateExploreLink: M,
|
|
1125
|
+
requestsLinkZoomActions: z,
|
|
1126
|
+
exploreLinkZoomActions: Q,
|
|
1127
|
+
buildExploreQuery: B,
|
|
1128
|
+
buildExploreLink: R,
|
|
1129
|
+
buildRequestLink: O,
|
|
1130
|
+
buildRequestsQueryZoomActions: Y
|
|
1131
|
+
} = ye.useContextLinks({
|
|
1132
1132
|
queryBridge: o,
|
|
1133
|
-
chartData: st(
|
|
1133
|
+
chartData: st(d),
|
|
1134
1134
|
definition: st(wt(i, "definition")),
|
|
1135
1135
|
context: st(wt(i, "context"))
|
|
1136
|
-
}), { issueQuery:
|
|
1136
|
+
}), { issueQuery: ue } = ye.useIssueQuery();
|
|
1137
1137
|
Ve(() => i.definition, async () => {
|
|
1138
|
-
await
|
|
1138
|
+
await dt(), a.value && (f.value = a.value.scrollWidth > a.value.clientWidth), p.value = !0;
|
|
1139
1139
|
}, { immediate: !0, deep: !0 });
|
|
1140
|
-
const
|
|
1140
|
+
const He = k(() => n.t("csvExport.defaultFilename")), J = k(() => m.value && (Me.value || i.context.editable) || !!I.value), Me = k(() => !!g.value || ("allow_csv_export" in i.definition.chart ? i.definition.chart.allow_csv_export : !0) || i.context.editable), E = {
|
|
1141
1141
|
timeseries_line: Dt,
|
|
1142
1142
|
timeseries_bar: Dt,
|
|
1143
1143
|
horizontal_bar: St,
|
|
1144
1144
|
vertical_bar: St,
|
|
1145
1145
|
gauge: zt,
|
|
1146
|
-
donut:
|
|
1147
|
-
golden_signals:
|
|
1146
|
+
donut: ms,
|
|
1147
|
+
golden_signals: cs,
|
|
1148
1148
|
top_n: ps,
|
|
1149
1149
|
slottable: void 0,
|
|
1150
1150
|
single_value: zt,
|
|
1151
1151
|
choropleth_map: r
|
|
1152
|
-
},
|
|
1152
|
+
}, D = k(() => {
|
|
1153
1153
|
var v, q;
|
|
1154
1154
|
return {
|
|
1155
|
-
...(v =
|
|
1156
|
-
...(q =
|
|
1155
|
+
...(v = N.value) != null && v.rendererEvents.supportsRequests ? { "select-chart-range": ri } : {},
|
|
1156
|
+
...(q = N.value) != null && q.rendererEvents.supportsZoom ? { "zoom-time-range": si } : {}
|
|
1157
1157
|
};
|
|
1158
|
-
}),
|
|
1159
|
-
var te,
|
|
1160
|
-
const v =
|
|
1158
|
+
}), N = k(() => {
|
|
1159
|
+
var te, j;
|
|
1160
|
+
const v = E[i.definition.chart.type], q = !!((te = v == null ? void 0 : v.emits) != null && te.includes("select-chart-range")), P = !!((j = v == null ? void 0 : v.emits) != null && j.includes("zoom-time-range"));
|
|
1161
1161
|
return v && {
|
|
1162
1162
|
component: v,
|
|
1163
1163
|
rendererProps: {
|
|
@@ -1167,176 +1167,176 @@ const ce = {
|
|
|
1167
1167
|
chartOptions: i.definition.chart,
|
|
1168
1168
|
height: i.height - t * 2,
|
|
1169
1169
|
refreshCounter: i.refreshCounter,
|
|
1170
|
-
requestsLink:
|
|
1171
|
-
exploreLink:
|
|
1170
|
+
requestsLink: z.value,
|
|
1171
|
+
exploreLink: Q.value
|
|
1172
1172
|
},
|
|
1173
1173
|
rendererEvents: {
|
|
1174
1174
|
supportsRequests: q,
|
|
1175
1175
|
supportsZoom: P
|
|
1176
1176
|
}
|
|
1177
1177
|
};
|
|
1178
|
-
}),
|
|
1178
|
+
}), I = k(() => {
|
|
1179
1179
|
var q;
|
|
1180
1180
|
const v = (q = i.definition.query) == null ? void 0 : q.time_range;
|
|
1181
1181
|
if ((v == null ? void 0 : v.type) === "relative") {
|
|
1182
|
-
const P = Bt.get(
|
|
1182
|
+
const P = Bt.get(mi[v.time_range]);
|
|
1183
1183
|
return P ? P.display : (console.warn("Did not recognize the given relative time range:", v.time_range), v.time_range);
|
|
1184
1184
|
} else if ((v == null ? void 0 : v.type) === "absolute") {
|
|
1185
1185
|
const P = v.tz || "Etc/UTC";
|
|
1186
1186
|
return `${Ct(v.start, { short: !0, tz: P })} - ${Ct(v.end, { short: !0, tz: P })}`;
|
|
1187
1187
|
}
|
|
1188
1188
|
return null;
|
|
1189
|
-
}),
|
|
1189
|
+
}), ee = k(() => d.value ? rt(d.value.meta.granularity_ms) : void 0), me = k(() => ["timeseries_line", "timeseries_bar"].includes(i.definition.chart.type)), Re = k(() => {
|
|
1190
1190
|
var q, P;
|
|
1191
|
-
if (!
|
|
1191
|
+
if (!me.value || !i.queryReady || p.value)
|
|
1192
1192
|
return !1;
|
|
1193
1193
|
const v = (P = (q = i.definition) == null ? void 0 : q.query) == null ? void 0 : P.granularity;
|
|
1194
|
-
return !v || !
|
|
1195
|
-
}),
|
|
1196
|
-
var P, te,
|
|
1197
|
-
const v = rt(((P =
|
|
1198
|
-
return
|
|
1199
|
-
currentGranularity:
|
|
1200
|
-
savedGranularity:
|
|
1194
|
+
return !v || !ee.value ? !1 : v !== ee.value;
|
|
1195
|
+
}), Ie = k(() => {
|
|
1196
|
+
var P, te, j;
|
|
1197
|
+
const v = rt(((P = d.value) == null ? void 0 : P.meta.granularity_ms) ?? 0) ?? "unknown", q = ((j = (te = i.definition) == null ? void 0 : te.query) == null ? void 0 : j.granularity) ?? "unknown";
|
|
1198
|
+
return n.t("query_aged_out_warning", {
|
|
1199
|
+
currentGranularity: n.t(`granularities.${v}`),
|
|
1200
|
+
savedGranularity: n.t(`granularities.${q}`)
|
|
1201
1201
|
});
|
|
1202
|
-
}),
|
|
1202
|
+
}), ke = k(() => {
|
|
1203
1203
|
var P, te;
|
|
1204
1204
|
const v = [...i.context.filters, ...i.definition.query.filters ?? []], q = ((te = (P = i.definition) == null ? void 0 : P.query) == null ? void 0 : te.datasource) ?? "api_usage";
|
|
1205
|
-
return v.filter((
|
|
1206
|
-
}),
|
|
1205
|
+
return v.filter((j) => Ft(j.field).some((ni) => q === ni));
|
|
1206
|
+
}), Je = () => {
|
|
1207
1207
|
s("edit-tile", i.definition);
|
|
1208
|
-
},
|
|
1208
|
+
}, mt = () => {
|
|
1209
1209
|
s("duplicate-tile", i.definition);
|
|
1210
|
-
},
|
|
1210
|
+
}, et = () => {
|
|
1211
1211
|
s("remove-tile", i.definition);
|
|
1212
|
-
},
|
|
1213
|
-
|
|
1214
|
-
},
|
|
1215
|
-
|
|
1216
|
-
},
|
|
1217
|
-
|
|
1218
|
-
|
|
1212
|
+
}, tt = (v) => {
|
|
1213
|
+
d.value = v, p.value = !1;
|
|
1214
|
+
}, yt = () => {
|
|
1215
|
+
h.value = !1;
|
|
1216
|
+
}, ii = async () => {
|
|
1217
|
+
h.value = !0, l.value = { status: "loading" }, ue(i.definition.query, i.context, yi).then((v) => {
|
|
1218
|
+
l.value = { status: "success", chartData: v };
|
|
1219
1219
|
}).catch((v) => {
|
|
1220
|
-
|
|
1220
|
+
l.value = { status: "error", error: v };
|
|
1221
1221
|
});
|
|
1222
|
-
},
|
|
1222
|
+
}, si = (v) => {
|
|
1223
1223
|
const q = {
|
|
1224
1224
|
tileId: i.tileId.toString(),
|
|
1225
1225
|
timeRange: v
|
|
1226
1226
|
};
|
|
1227
1227
|
s("tile-time-range-zoom", q);
|
|
1228
|
-
},
|
|
1229
|
-
const q =
|
|
1230
|
-
|
|
1228
|
+
}, ri = (v) => {
|
|
1229
|
+
const q = ke.value, P = Y(v, q), te = B(v, q);
|
|
1230
|
+
z.value = S.value ? { href: O(P) } : void 0, Q.value = M.value ? { href: R(te) } : void 0;
|
|
1231
1231
|
};
|
|
1232
1232
|
return (v, q) => {
|
|
1233
|
-
const P =
|
|
1234
|
-
return C(),
|
|
1233
|
+
const P = ge("KTooltip"), te = ge("KBadge"), j = ge("KDropdownItem"), vt = ge("KDropdown");
|
|
1234
|
+
return C(), K("div", {
|
|
1235
1235
|
class: je(["tile-boundary", { editable: v.context.editable }]),
|
|
1236
1236
|
"data-testid": `tile-${v.tileId}`
|
|
1237
1237
|
}, [
|
|
1238
|
-
v.definition.chart.type !== "slottable" ? (C(),
|
|
1239
|
-
|
|
1238
|
+
v.definition.chart.type !== "slottable" ? (C(), K("div", vs, [
|
|
1239
|
+
de(P, {
|
|
1240
1240
|
class: "title-tooltip",
|
|
1241
|
-
disabled: !
|
|
1241
|
+
disabled: !f.value,
|
|
1242
1242
|
"max-width": "500",
|
|
1243
1243
|
text: v.definition.chart.chart_title
|
|
1244
1244
|
}, {
|
|
1245
1245
|
default: $(() => [
|
|
1246
1246
|
oe("div", {
|
|
1247
1247
|
ref_key: "titleRef",
|
|
1248
|
-
ref:
|
|
1248
|
+
ref: a,
|
|
1249
1249
|
class: "title"
|
|
1250
1250
|
}, ne(v.definition.chart.chart_title), 513)
|
|
1251
1251
|
]),
|
|
1252
1252
|
_: 1
|
|
1253
1253
|
}, 8, ["disabled", "text"]),
|
|
1254
|
-
|
|
1254
|
+
J.value ? (C(), K("div", {
|
|
1255
1255
|
key: 0,
|
|
1256
1256
|
class: "tile-actions",
|
|
1257
1257
|
"data-testid": `tile-actions-${v.tileId}`
|
|
1258
1258
|
}, [
|
|
1259
|
-
|
|
1259
|
+
I.value ? (C(), L(te, {
|
|
1260
1260
|
key: 0,
|
|
1261
1261
|
"data-testid": "time-range-badge",
|
|
1262
|
-
tooltip:
|
|
1262
|
+
tooltip: Re.value ? Ie.value : void 0,
|
|
1263
1263
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1264
1264
|
}, Qe({
|
|
1265
1265
|
default: $(() => [
|
|
1266
|
-
oe("span",
|
|
1266
|
+
oe("span", bs, ne(I.value), 1)
|
|
1267
1267
|
]),
|
|
1268
1268
|
_: 2
|
|
1269
1269
|
}, [
|
|
1270
|
-
|
|
1270
|
+
Re.value ? {
|
|
1271
1271
|
name: "icon",
|
|
1272
1272
|
fn: $(() => [
|
|
1273
|
-
|
|
1273
|
+
de(x(zi), { size: x(fs) }, null, 8, ["size"])
|
|
1274
1274
|
]),
|
|
1275
1275
|
key: "0"
|
|
1276
1276
|
} : void 0
|
|
1277
|
-
]), 1032, ["tooltip"])) :
|
|
1278
|
-
x(
|
|
1277
|
+
]), 1032, ["tooltip"])) : V("", !0),
|
|
1278
|
+
x(m) && v.context.editable && !v.isFullscreen ? (C(), L(x(Si), {
|
|
1279
1279
|
key: 1,
|
|
1280
1280
|
class: "edit-icon",
|
|
1281
1281
|
color: x(Nt),
|
|
1282
1282
|
"data-testid": `edit-tile-${v.tileId}`,
|
|
1283
1283
|
size: x(Lt),
|
|
1284
|
-
onClick:
|
|
1285
|
-
}, null, 8, ["color", "data-testid", "size"])) :
|
|
1286
|
-
x(
|
|
1284
|
+
onClick: Je
|
|
1285
|
+
}, null, 8, ["color", "data-testid", "size"])) : V("", !0),
|
|
1286
|
+
x(m) && Me.value && !v.isFullscreen ? (C(), L(vt, {
|
|
1287
1287
|
key: 2,
|
|
1288
1288
|
class: "dropdown",
|
|
1289
1289
|
"data-testid": `chart-action-menu-${v.tileId}`,
|
|
1290
1290
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1291
1291
|
}, {
|
|
1292
1292
|
items: $(() => [
|
|
1293
|
-
x(
|
|
1293
|
+
x(g) ? (C(), L(j, {
|
|
1294
1294
|
key: 0,
|
|
1295
1295
|
"data-testid": `chart-jump-to-explore-${v.tileId}`,
|
|
1296
|
-
item: { label: x(
|
|
1297
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1298
|
-
x(
|
|
1296
|
+
item: { label: x(n).t("jumpToExplore"), to: x(g) }
|
|
1297
|
+
}, null, 8, ["data-testid", "item"])) : V("", !0),
|
|
1298
|
+
x(y) ? (C(), L(j, {
|
|
1299
1299
|
key: 1,
|
|
1300
1300
|
"data-testid": `chart-jump-to-requests-${v.tileId}`,
|
|
1301
|
-
item: { label: x(
|
|
1302
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1303
|
-
!("allow_csv_export" in v.definition.chart) || v.definition.chart.allow_csv_export ? (C(),
|
|
1301
|
+
item: { label: x(n).t("jumpToRequests"), to: x(y) }
|
|
1302
|
+
}, null, 8, ["data-testid", "item"])) : V("", !0),
|
|
1303
|
+
!("allow_csv_export" in v.definition.chart) || v.definition.chart.allow_csv_export ? (C(), L(j, {
|
|
1304
1304
|
key: 2,
|
|
1305
1305
|
class: "chart-export-button",
|
|
1306
1306
|
"data-testid": `chart-csv-export-${v.tileId}`,
|
|
1307
|
-
onClick:
|
|
1307
|
+
onClick: ii
|
|
1308
1308
|
}, {
|
|
1309
1309
|
default: $(() => [
|
|
1310
1310
|
oe("span", {
|
|
1311
1311
|
class: "chart-export-trigger",
|
|
1312
1312
|
"data-testid": `csv-export-button-${v.tileId}`
|
|
1313
|
-
}, ne(x(
|
|
1313
|
+
}, ne(x(n).t("csvExport.exportAsCsv")), 9, ws)
|
|
1314
1314
|
]),
|
|
1315
1315
|
_: 1
|
|
1316
|
-
}, 8, ["data-testid"])) :
|
|
1317
|
-
v.context.editable ? (C(),
|
|
1316
|
+
}, 8, ["data-testid"])) : V("", !0),
|
|
1317
|
+
v.context.editable ? (C(), L(j, {
|
|
1318
1318
|
key: 3,
|
|
1319
1319
|
"data-testid": `duplicate-tile-${v.tileId}`,
|
|
1320
|
-
onClick:
|
|
1320
|
+
onClick: mt
|
|
1321
1321
|
}, {
|
|
1322
1322
|
default: $(() => [
|
|
1323
|
-
ht(ne(x(
|
|
1323
|
+
ht(ne(x(n).t("renderer.duplicateTile")), 1)
|
|
1324
1324
|
]),
|
|
1325
1325
|
_: 1
|
|
1326
|
-
}, 8, ["data-testid"])) :
|
|
1327
|
-
v.context.editable ? (C(),
|
|
1326
|
+
}, 8, ["data-testid"])) : V("", !0),
|
|
1327
|
+
v.context.editable ? (C(), L(j, {
|
|
1328
1328
|
key: 4,
|
|
1329
1329
|
"data-testid": `remove-tile-${v.tileId}`,
|
|
1330
|
-
onClick:
|
|
1330
|
+
onClick: et
|
|
1331
1331
|
}, {
|
|
1332
1332
|
default: $(() => [
|
|
1333
|
-
oe("span",
|
|
1333
|
+
oe("span", Es, ne(x(n).t("renderer.delete")), 1)
|
|
1334
1334
|
]),
|
|
1335
1335
|
_: 1
|
|
1336
|
-
}, 8, ["data-testid"])) :
|
|
1336
|
+
}, 8, ["data-testid"])) : V("", !0)
|
|
1337
1337
|
]),
|
|
1338
1338
|
default: $(() => [
|
|
1339
|
-
|
|
1339
|
+
de(x(Di), {
|
|
1340
1340
|
class: "kebab-action-menu",
|
|
1341
1341
|
color: x(Nt),
|
|
1342
1342
|
"data-testid": `kebab-action-menu-${v.tileId}`,
|
|
@@ -1344,41 +1344,41 @@ const ce = {
|
|
|
1344
1344
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1345
1345
|
]),
|
|
1346
1346
|
_: 1
|
|
1347
|
-
}, 8, ["data-testid"])) :
|
|
1348
|
-
], 8,
|
|
1347
|
+
}, 8, ["data-testid"])) : V("", !0)
|
|
1348
|
+
], 8, _s)) : "description" in v.definition.chart ? (C(), K("div", {
|
|
1349
1349
|
key: 1,
|
|
1350
1350
|
class: "header-description",
|
|
1351
1351
|
"data-testid": `tile-description-${v.tileId}`
|
|
1352
|
-
}, ne(v.definition.chart.description), 9,
|
|
1353
|
-
|
|
1352
|
+
}, ne(v.definition.chart.description), 9, xs)) : V("", !0),
|
|
1353
|
+
h.value ? (C(), L(x(Ei), {
|
|
1354
1354
|
key: 2,
|
|
1355
1355
|
"data-testid": `csv-export-modal-${v.tileId}`,
|
|
1356
|
-
"export-state":
|
|
1357
|
-
filename:
|
|
1358
|
-
onCloseModal:
|
|
1359
|
-
}, null, 8, ["data-testid", "export-state", "filename"])) :
|
|
1360
|
-
])) :
|
|
1356
|
+
"export-state": l.value,
|
|
1357
|
+
filename: He.value,
|
|
1358
|
+
onCloseModal: yt
|
|
1359
|
+
}, null, 8, ["data-testid", "export-state", "filename"])) : V("", !0)
|
|
1360
|
+
])) : V("", !0),
|
|
1361
1361
|
oe("div", {
|
|
1362
1362
|
class: "tile-content",
|
|
1363
1363
|
"data-testid": `tile-content-${v.tileId}`
|
|
1364
1364
|
}, [
|
|
1365
|
-
|
|
1366
|
-
], 8,
|
|
1367
|
-
], 10,
|
|
1365
|
+
N.value ? (C(), L(Pt(N.value.component), It({ key: 0 }, N.value.rendererProps, ui(D.value), { onChartData: tt }), null, 16)) : V("", !0)
|
|
1366
|
+
], 8, Cs)
|
|
1367
|
+
], 10, ys);
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
|
-
}),
|
|
1370
|
+
}), ks = /* @__PURE__ */ _e(Rs, [["__scopeId", "data-v-e965ac92"]]), Ts = (u, e) => {
|
|
1371
1371
|
let t = 0;
|
|
1372
1372
|
const i = /* @__PURE__ */ new Map();
|
|
1373
1373
|
e.forEach((r) => {
|
|
1374
|
-
const o = r.layout.position.row, n = i.get(o),
|
|
1375
|
-
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o,
|
|
1374
|
+
const o = r.layout.position.row, n = i.get(o), d = r.layout.size.rows === 1 && !!r.layout.size.fit_to_content;
|
|
1375
|
+
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o, d) : i.set(o, n && d);
|
|
1376
1376
|
});
|
|
1377
1377
|
const s = [];
|
|
1378
1378
|
for (let r = 0; r < t; r++)
|
|
1379
|
-
i.get(r) ? s.push("auto") : s.push(`${
|
|
1379
|
+
i.get(r) ? s.push("auto") : s.push(`${u}px`);
|
|
1380
1380
|
return s;
|
|
1381
|
-
},
|
|
1381
|
+
}, zs = /* @__PURE__ */ Z({
|
|
1382
1382
|
__name: "GridLayout",
|
|
1383
1383
|
props: {
|
|
1384
1384
|
tileHeight: {
|
|
@@ -1391,12 +1391,12 @@ const ce = {
|
|
|
1391
1391
|
required: !0
|
|
1392
1392
|
}
|
|
1393
1393
|
},
|
|
1394
|
-
setup(
|
|
1394
|
+
setup(u) {
|
|
1395
1395
|
Ye((n) => ({
|
|
1396
1396
|
"2a38e79e": x(Wt),
|
|
1397
1397
|
"4cc71de6": r.value
|
|
1398
1398
|
}));
|
|
1399
|
-
const e =
|
|
1399
|
+
const e = u, t = A(null), i = A(0), s = new ResizeObserver((n) => {
|
|
1400
1400
|
window.requestAnimationFrame(() => {
|
|
1401
1401
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1402
1402
|
});
|
|
@@ -1406,8 +1406,8 @@ const ce = {
|
|
|
1406
1406
|
}), lt(() => {
|
|
1407
1407
|
t.value && s.unobserve(t.value);
|
|
1408
1408
|
});
|
|
1409
|
-
const r = k(() =>
|
|
1410
|
-
key: `tile-${
|
|
1409
|
+
const r = k(() => Ts(e.tileHeight, e.tiles).join(" ")), o = k(() => e.tiles.map((n, d) => ({
|
|
1410
|
+
key: `tile-${d}`,
|
|
1411
1411
|
tile: n,
|
|
1412
1412
|
style: {
|
|
1413
1413
|
"grid-column-start": n.layout.position.col + 1,
|
|
@@ -1416,28 +1416,28 @@ const ce = {
|
|
|
1416
1416
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1417
1417
|
}
|
|
1418
1418
|
})));
|
|
1419
|
-
return (n,
|
|
1419
|
+
return (n, d) => (C(), K("div", {
|
|
1420
1420
|
ref_key: "gridContainer",
|
|
1421
1421
|
ref: t,
|
|
1422
1422
|
class: "kong-ui-public-grid-layout"
|
|
1423
1423
|
}, [
|
|
1424
|
-
(C(!0),
|
|
1425
|
-
key:
|
|
1424
|
+
(C(!0), K($t, null, Gt(o.value, (l) => (C(), K("div", {
|
|
1425
|
+
key: l.key,
|
|
1426
1426
|
class: je(["grid-cell", {
|
|
1427
|
-
"empty-cell": !
|
|
1427
|
+
"empty-cell": !l.tile
|
|
1428
1428
|
}]),
|
|
1429
|
-
style: Et(
|
|
1429
|
+
style: Et(l.style)
|
|
1430
1430
|
}, [
|
|
1431
|
-
|
|
1432
|
-
style: Et(
|
|
1433
|
-
tile:
|
|
1431
|
+
ze(n.$slots, "tile", {
|
|
1432
|
+
style: Et(l.style),
|
|
1433
|
+
tile: l.tile
|
|
1434
1434
|
}, void 0, !0)
|
|
1435
1435
|
], 6))), 128))
|
|
1436
1436
|
], 512));
|
|
1437
1437
|
}
|
|
1438
|
-
}),
|
|
1439
|
-
function
|
|
1440
|
-
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(
|
|
1438
|
+
}), Ss = /* @__PURE__ */ _e(zs, [["__scopeId", "data-v-354b7177"]]);
|
|
1439
|
+
function Ds(u, e, t, i, s) {
|
|
1440
|
+
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));
|
|
1441
1441
|
return r.prototype = e.prototype, r;
|
|
1442
1442
|
}
|
|
1443
1443
|
class c {
|
|
@@ -1643,10 +1643,10 @@ class c {
|
|
|
1643
1643
|
static updateScrollPosition(e, t, i) {
|
|
1644
1644
|
const s = e.getBoundingClientRect(), r = window.innerHeight || document.documentElement.clientHeight;
|
|
1645
1645
|
if (s.top < 0 || s.bottom > r) {
|
|
1646
|
-
const o = s.bottom - r, n = s.top,
|
|
1647
|
-
if (
|
|
1648
|
-
const
|
|
1649
|
-
s.top < 0 && i < 0 ? e.offsetHeight > r ?
|
|
1646
|
+
const o = s.bottom - r, n = s.top, d = this.getScrollElement(e);
|
|
1647
|
+
if (d !== null) {
|
|
1648
|
+
const l = d.scrollTop;
|
|
1649
|
+
s.top < 0 && i < 0 ? e.offsetHeight > r ? d.scrollTop += i : d.scrollTop += Math.abs(n) > Math.abs(i) ? i : n : i > 0 && (e.offsetHeight > r ? d.scrollTop += i : d.scrollTop += o > i ? i : o), t.top += d.scrollTop - l;
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
@@ -1658,8 +1658,8 @@ class c {
|
|
|
1658
1658
|
* @param distance Distance from the V edges to start scrolling
|
|
1659
1659
|
*/
|
|
1660
1660
|
static updateScrollResize(e, t, i) {
|
|
1661
|
-
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o,
|
|
1662
|
-
|
|
1661
|
+
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o, d = n < i, l = n > r - i;
|
|
1662
|
+
d ? s.scrollBy({ behavior: "smooth", top: n - i }) : l && s.scrollBy({ behavior: "smooth", top: i - (r - n) });
|
|
1663
1663
|
}
|
|
1664
1664
|
/** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
|
|
1665
1665
|
static clone(e) {
|
|
@@ -1798,19 +1798,19 @@ class le {
|
|
|
1798
1798
|
!this._loading && this._useEntireRowArea(e, t) && (r = { x: 0, w: this.column, y: t.y, h: t.h }, i = this.collide(e, r, s.skip));
|
|
1799
1799
|
let o = !1;
|
|
1800
1800
|
const n = { nested: !0, pack: !1 };
|
|
1801
|
-
let
|
|
1801
|
+
let d = 0;
|
|
1802
1802
|
for (; i = i || this.collide(e, r, s.skip); ) {
|
|
1803
|
-
if (
|
|
1803
|
+
if (d++ > this.nodes.length * 2)
|
|
1804
1804
|
throw new Error("Infinite collide check");
|
|
1805
|
-
let
|
|
1805
|
+
let l;
|
|
1806
1806
|
if (i.locked || this._loading || e._moving && !e._skipDown && t.y > e.y && !this.float && // can take space we had, or before where we're going
|
|
1807
1807
|
(!this.collide(i, { ...i, y: e.y }, e) || !this.collide(i, { ...i, y: t.y - i.h }, e))) {
|
|
1808
1808
|
e._skipDown = e._skipDown || t.y > e.y;
|
|
1809
|
-
const
|
|
1810
|
-
|
|
1809
|
+
const h = { ...t, y: i.y + i.h, ...n };
|
|
1810
|
+
l = this._loading && c.samePos(e, h) ? !0 : this.moveNode(e, h), (i.locked || this._loading) && l ? c.copyPos(t, e) : !i.locked && l && s.pack && (this._packNodes(), t.y = i.y + i.h, c.copyPos(e, t)), o = o || l;
|
|
1811
1811
|
} else
|
|
1812
|
-
|
|
1813
|
-
if (!
|
|
1812
|
+
l = this.moveNode(i, { ...i, y: t.y + t.h, skip: e, ...n });
|
|
1813
|
+
if (!l)
|
|
1814
1814
|
return o;
|
|
1815
1815
|
i = void 0;
|
|
1816
1816
|
}
|
|
@@ -1832,14 +1832,14 @@ class le {
|
|
|
1832
1832
|
const s = e._rect, r = { ...t.rect };
|
|
1833
1833
|
r.y > s.y ? (r.h += r.y - s.y, r.y = s.y) : r.h += s.y - r.y, r.x > s.x ? (r.w += r.x - s.x, r.x = s.x) : r.w += s.x - r.x;
|
|
1834
1834
|
let o, n = 0.5;
|
|
1835
|
-
for (let
|
|
1836
|
-
if (
|
|
1835
|
+
for (let d of i) {
|
|
1836
|
+
if (d.locked || !d._rect)
|
|
1837
1837
|
break;
|
|
1838
|
-
const
|
|
1839
|
-
let
|
|
1840
|
-
s.y <
|
|
1841
|
-
const f = Math.min(a,
|
|
1842
|
-
f > n && (n = f, o =
|
|
1838
|
+
const l = d._rect;
|
|
1839
|
+
let h = Number.MAX_VALUE, a = Number.MAX_VALUE;
|
|
1840
|
+
s.y < l.y ? h = (r.y + r.h - l.y) / l.h : s.y + s.h > l.y + l.h && (h = (l.y + l.h - r.y) / l.h), s.x < l.x ? a = (r.x + r.w - l.x) / l.w : s.x + s.w > l.x + l.w && (a = (l.x + l.w - r.x) / l.w);
|
|
1841
|
+
const f = Math.min(a, h);
|
|
1842
|
+
f > n && (n = f, o = d);
|
|
1843
1843
|
}
|
|
1844
1844
|
return t.collide = o, o;
|
|
1845
1845
|
}
|
|
@@ -1913,9 +1913,9 @@ class le {
|
|
|
1913
1913
|
const s = this._inColumnResize;
|
|
1914
1914
|
s || (this._inColumnResize = !0);
|
|
1915
1915
|
const r = this.nodes;
|
|
1916
|
-
return this.nodes = [], r.forEach((o, n,
|
|
1917
|
-
let
|
|
1918
|
-
o.locked || (o.autoPosition = !0, e === "list" && n && (
|
|
1916
|
+
return this.nodes = [], r.forEach((o, n, d) => {
|
|
1917
|
+
let l;
|
|
1918
|
+
o.locked || (o.autoPosition = !0, e === "list" && n && (l = d[n - 1])), this.addNode(o, !1, l);
|
|
1919
1919
|
}), s || delete this._inColumnResize, i || this.batchUpdate(!1), this;
|
|
1920
1920
|
}
|
|
1921
1921
|
/** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */
|
|
@@ -2013,11 +2013,11 @@ class le {
|
|
|
2013
2013
|
const r = s ? s.y * i + (s.x + s.w) : 0;
|
|
2014
2014
|
let o = !1;
|
|
2015
2015
|
for (let n = r; !o; ++n) {
|
|
2016
|
-
const
|
|
2017
|
-
if (
|
|
2016
|
+
const d = n % i, l = Math.floor(n / i);
|
|
2017
|
+
if (d + e.w > i)
|
|
2018
2018
|
continue;
|
|
2019
|
-
const
|
|
2020
|
-
t.find((a) => c.isIntercepted(
|
|
2019
|
+
const h = { x: d, y: l, w: e.w, h: e.h };
|
|
2020
|
+
t.find((a) => c.isIntercepted(h, a)) || ((e.x !== d || e.y !== l) && (e._dirty = !0), e.x = d, e.y = l, delete e.autoPosition, o = !0);
|
|
2021
2021
|
}
|
|
2022
2022
|
return o;
|
|
2023
2023
|
}
|
|
@@ -2063,7 +2063,7 @@ class le {
|
|
|
2063
2063
|
return this._notify(), !0;
|
|
2064
2064
|
}
|
|
2065
2065
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
2066
|
-
const n = this.nodes.find((
|
|
2066
|
+
const n = this.nodes.find((d) => d._id === o._id);
|
|
2067
2067
|
n && (c.copyPos(n, o), n._dirty = !0);
|
|
2068
2068
|
}), this._notify(), !0) : !1;
|
|
2069
2069
|
}
|
|
@@ -2084,7 +2084,7 @@ class le {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
/** return true if the passed in node was actually moved (checks for no-op and locked) */
|
|
2086
2086
|
moveNode(e, t) {
|
|
2087
|
-
var
|
|
2087
|
+
var l, h;
|
|
2088
2088
|
if (!e || /*node.locked ||*/
|
|
2089
2089
|
!t)
|
|
2090
2090
|
return !1;
|
|
@@ -2094,17 +2094,17 @@ class le {
|
|
|
2094
2094
|
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
2095
2095
|
return !1;
|
|
2096
2096
|
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
2097
|
-
let
|
|
2097
|
+
let d = !0;
|
|
2098
2098
|
if (n.length) {
|
|
2099
2099
|
const a = e._moving && !t.nested;
|
|
2100
2100
|
let f = a ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
2101
|
-
if (a && f && ((
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2101
|
+
if (a && f && ((h = (l = e.grid) == null ? void 0 : l.opts) != null && h.subGridDynamic) && !e.grid._isTemp) {
|
|
2102
|
+
const p = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect), y = c.area(f._rect);
|
|
2103
|
+
p / (g < y ? g : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
2104
2104
|
}
|
|
2105
|
-
f ?
|
|
2105
|
+
f ? d = !this._fixCollisions(e, r, f, t) : (d = !1, i && delete t.pack);
|
|
2106
2106
|
}
|
|
2107
|
-
return
|
|
2107
|
+
return d && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
2108
2108
|
}
|
|
2109
2109
|
getRow() {
|
|
2110
2110
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -2122,8 +2122,8 @@ class le {
|
|
|
2122
2122
|
var o;
|
|
2123
2123
|
const i = (o = this._layouts) == null ? void 0 : o.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
2124
2124
|
return this.sortNodes(), this.nodes.forEach((n) => {
|
|
2125
|
-
const
|
|
2126
|
-
c.removeInternalForSave(
|
|
2125
|
+
const d = s == null ? void 0 : s.find((h) => h._id === n._id), l = { ...n, ...d || {} };
|
|
2126
|
+
c.removeInternalForSave(l, !e), t && t(n, l), r.push(l);
|
|
2127
2127
|
}), r;
|
|
2128
2128
|
}
|
|
2129
2129
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -2162,19 +2162,19 @@ class le {
|
|
|
2162
2162
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
2163
2163
|
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
2164
2164
|
if (t > e && this._layouts) {
|
|
2165
|
-
const
|
|
2166
|
-
!
|
|
2167
|
-
const a = o.find((f) => f._id ===
|
|
2168
|
-
a && (!s && !
|
|
2169
|
-
})),
|
|
2170
|
-
const a = o.findIndex((f) => f._id ===
|
|
2165
|
+
const d = this._layouts[t] || [], l = this._layouts.length - 1;
|
|
2166
|
+
!d.length && e !== l && ((n = this._layouts[l]) != null && n.length) && (e = l, this._layouts[l].forEach((h) => {
|
|
2167
|
+
const a = o.find((f) => f._id === h._id);
|
|
2168
|
+
a && (!s && !h.autoPosition && (a.x = h.x ?? a.x, a.y = h.y ?? a.y), a.w = h.w ?? a.w, (h.x == null || h.y === void 0) && (a.autoPosition = !0));
|
|
2169
|
+
})), d.forEach((h) => {
|
|
2170
|
+
const a = o.findIndex((f) => f._id === h._id);
|
|
2171
2171
|
if (a !== -1) {
|
|
2172
2172
|
const f = o[a];
|
|
2173
2173
|
if (s) {
|
|
2174
|
-
f.w =
|
|
2174
|
+
f.w = h.w;
|
|
2175
2175
|
return;
|
|
2176
2176
|
}
|
|
2177
|
-
(
|
|
2177
|
+
(h.autoPosition || isNaN(h.x) || isNaN(h.y)) && this.findEmptyPosition(h, r), h.autoPosition || (f.x = h.x ?? f.x, f.y = h.y ?? f.y, f.w = h.w ?? f.w, r.push(f)), o.splice(a, 1);
|
|
2178
2178
|
}
|
|
2179
2179
|
});
|
|
2180
2180
|
}
|
|
@@ -2185,16 +2185,16 @@ class le {
|
|
|
2185
2185
|
if (typeof i == "function")
|
|
2186
2186
|
i(t, e, r, o);
|
|
2187
2187
|
else {
|
|
2188
|
-
const
|
|
2188
|
+
const d = s || i === "none" ? 1 : t / e, l = i === "move" || i === "moveScale", h = i === "scale" || i === "moveScale";
|
|
2189
2189
|
o.forEach((a) => {
|
|
2190
|
-
a.x = t === 1 ? 0 :
|
|
2190
|
+
a.x = t === 1 ? 0 : l ? Math.round(a.x * d) : Math.min(a.x, t - 1), a.w = t === 1 || e === 1 ? 1 : h ? Math.round(a.w * d) || 1 : Math.min(a.w, t), r.push(a);
|
|
2191
2191
|
}), o = [];
|
|
2192
2192
|
}
|
|
2193
|
-
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((
|
|
2194
|
-
this.addNode(
|
|
2193
|
+
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((d) => {
|
|
2194
|
+
this.addNode(d, !1), delete d._orig;
|
|
2195
2195
|
});
|
|
2196
2196
|
}
|
|
2197
|
-
return this.nodes.forEach((
|
|
2197
|
+
return this.nodes.forEach((d) => delete d._orig), this.batchUpdate(!1, !s), delete this._inColumnResize, this;
|
|
2198
2198
|
}
|
|
2199
2199
|
/**
|
|
2200
2200
|
* call to cache the given layout internally to the given location so we can restore back when column changes size
|
|
@@ -2206,7 +2206,7 @@ class le {
|
|
|
2206
2206
|
const s = [];
|
|
2207
2207
|
return e.forEach((r, o) => {
|
|
2208
2208
|
if (r._id === void 0) {
|
|
2209
|
-
const n = r.id ? this.nodes.find((
|
|
2209
|
+
const n = r.id ? this.nodes.find((d) => d.id === r.id) : void 0;
|
|
2210
2210
|
r._id = (n == null ? void 0 : n._id) ?? le._idSeq++;
|
|
2211
2211
|
}
|
|
2212
2212
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
@@ -2243,7 +2243,7 @@ class le {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
2245
|
le._idSeq = 0;
|
|
2246
|
-
const
|
|
2246
|
+
const X = {
|
|
2247
2247
|
alwaysShowResizeHandle: "mobile",
|
|
2248
2248
|
animate: !0,
|
|
2249
2249
|
auto: !0,
|
|
@@ -2278,34 +2278,34 @@ class w {
|
|
|
2278
2278
|
const ae = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2279
2279
|
class he {
|
|
2280
2280
|
}
|
|
2281
|
-
function
|
|
2282
|
-
|
|
2281
|
+
function Ge(u, e) {
|
|
2282
|
+
u.touches.length > 1 || (u.cancelable && u.preventDefault(), c.simulateMouseEvent(u.changedTouches[0], e));
|
|
2283
2283
|
}
|
|
2284
|
-
function ti(
|
|
2285
|
-
|
|
2284
|
+
function ti(u, e) {
|
|
2285
|
+
u.cancelable && u.preventDefault(), c.simulateMouseEvent(u, e);
|
|
2286
2286
|
}
|
|
2287
|
-
function
|
|
2288
|
-
he.touchHandled || (he.touchHandled = !0,
|
|
2287
|
+
function Fe(u) {
|
|
2288
|
+
he.touchHandled || (he.touchHandled = !0, Ge(u, "mousedown"));
|
|
2289
2289
|
}
|
|
2290
|
-
function Be(
|
|
2291
|
-
he.touchHandled &&
|
|
2290
|
+
function Be(u) {
|
|
2291
|
+
he.touchHandled && Ge(u, "mousemove");
|
|
2292
2292
|
}
|
|
2293
|
-
function Ue(
|
|
2293
|
+
function Ue(u) {
|
|
2294
2294
|
if (!he.touchHandled)
|
|
2295
2295
|
return;
|
|
2296
2296
|
he.pointerLeaveTimeout && (window.clearTimeout(he.pointerLeaveTimeout), delete he.pointerLeaveTimeout);
|
|
2297
2297
|
const e = !!w.dragElement;
|
|
2298
|
-
|
|
2298
|
+
Ge(u, "mouseup"), e || Ge(u, "click"), he.touchHandled = !1;
|
|
2299
2299
|
}
|
|
2300
|
-
function We(
|
|
2301
|
-
|
|
2300
|
+
function We(u) {
|
|
2301
|
+
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
2302
2302
|
}
|
|
2303
|
-
function Ot(
|
|
2304
|
-
w.dragElement &&
|
|
2303
|
+
function Ot(u) {
|
|
2304
|
+
w.dragElement && u.pointerType !== "mouse" && ti(u, "mouseenter");
|
|
2305
2305
|
}
|
|
2306
|
-
function Ht(
|
|
2307
|
-
w.dragElement &&
|
|
2308
|
-
delete he.pointerLeaveTimeout, ti(
|
|
2306
|
+
function Ht(u) {
|
|
2307
|
+
w.dragElement && u.pointerType !== "mouse" && (he.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2308
|
+
delete he.pointerLeaveTimeout, ti(u, "mouseleave");
|
|
2309
2309
|
}, 10));
|
|
2310
2310
|
}
|
|
2311
2311
|
class Ze {
|
|
@@ -2315,11 +2315,11 @@ class Ze {
|
|
|
2315
2315
|
/** @internal */
|
|
2316
2316
|
_init() {
|
|
2317
2317
|
const e = this.el = document.createElement("div");
|
|
2318
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Ze.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), ae && (this.el.addEventListener("touchstart",
|
|
2318
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Ze.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), ae && (this.el.addEventListener("touchstart", Fe), this.el.addEventListener("pointerdown", We)), this;
|
|
2319
2319
|
}
|
|
2320
2320
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2321
2321
|
destroy() {
|
|
2322
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), ae && (this.el.removeEventListener("touchstart",
|
|
2322
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), ae && (this.el.removeEventListener("touchstart", Fe), this.el.removeEventListener("pointerdown", We)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2323
2323
|
}
|
|
2324
2324
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2325
2325
|
_mouseDown(e) {
|
|
@@ -2373,7 +2373,7 @@ class gt {
|
|
|
2373
2373
|
return this._eventRegister[e](t);
|
|
2374
2374
|
}
|
|
2375
2375
|
}
|
|
2376
|
-
class
|
|
2376
|
+
class Se extends gt {
|
|
2377
2377
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2378
2378
|
constructor(e, t = {}) {
|
|
2379
2379
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2474,7 +2474,7 @@ class De extends gt {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
/** @internal */
|
|
2476
2476
|
_setupHelper() {
|
|
2477
|
-
this.elOriginStyleVal =
|
|
2477
|
+
this.elOriginStyleVal = Se._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2478
2478
|
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2479
2479
|
return this.rectScale = {
|
|
2480
2480
|
x: t.xScale,
|
|
@@ -2483,7 +2483,7 @@ class De extends gt {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
/** @internal */
|
|
2485
2485
|
_cleanHelper() {
|
|
2486
|
-
return
|
|
2486
|
+
return Se._originStyleProp.forEach((e, t) => {
|
|
2487
2487
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
2488
2488
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
2489
2489
|
}
|
|
@@ -2495,15 +2495,15 @@ class De extends gt {
|
|
|
2495
2495
|
left: this.originalRect.left,
|
|
2496
2496
|
top: this.originalRect.top - this.scrolled
|
|
2497
2497
|
}, r = e.clientX - i.clientX, o = this.sizeToContent ? 0 : e.clientY - i.clientY;
|
|
2498
|
-
let n,
|
|
2499
|
-
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o,
|
|
2500
|
-
const
|
|
2501
|
-
return Math.round(s.width) !== Math.round(
|
|
2498
|
+
let n, d;
|
|
2499
|
+
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o, d = !0);
|
|
2500
|
+
const l = this._constrainSize(s.width, s.height, n, d);
|
|
2501
|
+
return Math.round(s.width) !== Math.round(l.width) && (t.indexOf("w") > -1 && (s.left += s.width - l.width), s.width = l.width), Math.round(s.height) !== Math.round(l.height) && (t.indexOf("n") > -1 && (s.top += s.height - l.height), s.height = l.height), s;
|
|
2502
2502
|
}
|
|
2503
2503
|
/** @internal constrain the size to the set min/max values */
|
|
2504
2504
|
_constrainSize(e, t, i, s) {
|
|
2505
|
-
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e,
|
|
2506
|
-
return { width:
|
|
2505
|
+
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e, d = (s ? r.maxHeightMoveUp : r.maxHeight) || Number.MAX_SAFE_INTEGER, l = r.minHeight / this.rectScale.y || t, h = Math.min(o, Math.max(n, e)), a = Math.min(d, Math.max(l, t));
|
|
2506
|
+
return { width: h, height: a };
|
|
2507
2507
|
}
|
|
2508
2508
|
/** @internal */
|
|
2509
2509
|
_applyChange() {
|
|
@@ -2522,9 +2522,9 @@ class De extends gt {
|
|
|
2522
2522
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
|
|
2526
|
-
const
|
|
2527
|
-
class
|
|
2525
|
+
Se._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2526
|
+
const Ns = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2527
|
+
class De extends gt {
|
|
2528
2528
|
constructor(e, t = {}) {
|
|
2529
2529
|
var r;
|
|
2530
2530
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2544,12 +2544,12 @@ class Ne extends gt {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
enable() {
|
|
2546
2546
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2547
|
-
e.addEventListener("mousedown", this._mouseDown), ae && (e.addEventListener("touchstart",
|
|
2547
|
+
e.addEventListener("mousedown", this._mouseDown), ae && (e.addEventListener("touchstart", Fe), e.addEventListener("pointerdown", We));
|
|
2548
2548
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2549
2549
|
}
|
|
2550
2550
|
disable(e = !1) {
|
|
2551
2551
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2552
|
-
t.removeEventListener("mousedown", this._mouseDown), ae && (t.removeEventListener("touchstart",
|
|
2552
|
+
t.removeEventListener("mousedown", this._mouseDown), ae && (t.removeEventListener("touchstart", Fe), t.removeEventListener("pointerdown", We));
|
|
2553
2553
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2554
2554
|
}
|
|
2555
2555
|
destroy() {
|
|
@@ -2561,7 +2561,7 @@ class Ne extends gt {
|
|
|
2561
2561
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2562
2562
|
_mouseDown(e) {
|
|
2563
2563
|
if (!w.mouseHandled)
|
|
2564
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
2564
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Ns) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete w.dragElement, delete w.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ae && (e.currentTarget.addEventListener("touchmove", Be), e.currentTarget.addEventListener("touchend", Ue)), e.preventDefault(), document.activeElement && document.activeElement.blur(), w.mouseHandled = !0), !0;
|
|
2565
2565
|
}
|
|
2566
2566
|
/** @internal method to call actual drag event */
|
|
2567
2567
|
_callDrag(e) {
|
|
@@ -2614,7 +2614,7 @@ class Ne extends gt {
|
|
|
2614
2614
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
2615
2615
|
_createHelper() {
|
|
2616
2616
|
let e = this.el;
|
|
2617
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle =
|
|
2617
|
+
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle = De.originStyleProp.map((t) => this.el.style[t]), e;
|
|
2618
2618
|
}
|
|
2619
2619
|
/** @internal set the fix position of the dragged item */
|
|
2620
2620
|
_setupHelperStyle(e) {
|
|
@@ -2631,7 +2631,7 @@ class Ne extends gt {
|
|
|
2631
2631
|
const e = (t = this.helper) == null ? void 0 : t.gridstackNode;
|
|
2632
2632
|
if (!(e != null && e._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
2633
2633
|
const i = this.helper, s = this.dragElementOriginStyle.transition || null;
|
|
2634
|
-
i.style.transition = this.dragElementOriginStyle.transition = "none",
|
|
2634
|
+
i.style.transition = this.dragElementOriginStyle.transition = "none", De.originStyleProp.forEach((r) => i.style[r] = this.dragElementOriginStyle[r] || null), setTimeout(() => i.style.transition = s, 50);
|
|
2635
2635
|
}
|
|
2636
2636
|
return delete this.dragElementOriginStyle, this;
|
|
2637
2637
|
}
|
|
@@ -2673,8 +2673,8 @@ class Ne extends gt {
|
|
|
2673
2673
|
};
|
|
2674
2674
|
}
|
|
2675
2675
|
}
|
|
2676
|
-
|
|
2677
|
-
class
|
|
2676
|
+
De.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2677
|
+
class Ls extends gt {
|
|
2678
2678
|
constructor(e, t = {}) {
|
|
2679
2679
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2680
2680
|
}
|
|
@@ -2740,9 +2740,9 @@ class As extends gt {
|
|
|
2740
2740
|
};
|
|
2741
2741
|
}
|
|
2742
2742
|
}
|
|
2743
|
-
class
|
|
2743
|
+
class pt {
|
|
2744
2744
|
static init(e) {
|
|
2745
|
-
return e.ddElement || (e.ddElement = new
|
|
2745
|
+
return e.ddElement || (e.ddElement = new pt(e)), e.ddElement;
|
|
2746
2746
|
}
|
|
2747
2747
|
constructor(e) {
|
|
2748
2748
|
this.el = e;
|
|
@@ -2754,25 +2754,25 @@ class mt {
|
|
|
2754
2754
|
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;
|
|
2755
2755
|
}
|
|
2756
2756
|
setupDraggable(e) {
|
|
2757
|
-
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new
|
|
2757
|
+
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new De(this.el, e), this;
|
|
2758
2758
|
}
|
|
2759
2759
|
cleanDraggable() {
|
|
2760
2760
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2761
2761
|
}
|
|
2762
2762
|
setupResizable(e) {
|
|
2763
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2763
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new Se(this.el, e), this;
|
|
2764
2764
|
}
|
|
2765
2765
|
cleanResizable() {
|
|
2766
2766
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2767
2767
|
}
|
|
2768
2768
|
setupDroppable(e) {
|
|
2769
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2769
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Ls(this.el, e), this;
|
|
2770
2770
|
}
|
|
2771
2771
|
cleanDroppable() {
|
|
2772
2772
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2773
2773
|
}
|
|
2774
2774
|
}
|
|
2775
|
-
class
|
|
2775
|
+
class As {
|
|
2776
2776
|
resizable(e, t, i, s) {
|
|
2777
2777
|
return this._getDDElements(e, t).forEach((r) => {
|
|
2778
2778
|
if (t === "disable" || t === "enable")
|
|
@@ -2783,13 +2783,13 @@ class Os {
|
|
|
2783
2783
|
r.setupResizable({ [i]: s });
|
|
2784
2784
|
else {
|
|
2785
2785
|
const n = r.el.gridstackNode.grid;
|
|
2786
|
-
let
|
|
2787
|
-
|
|
2788
|
-
const
|
|
2786
|
+
let d = r.el.getAttribute("gs-resize-handles") || n.opts.resizable.handles || "e,s,se";
|
|
2787
|
+
d === "all" && (d = "n,e,s,w,se,sw,ne,nw");
|
|
2788
|
+
const l = !n.opts.alwaysShowResizeHandle;
|
|
2789
2789
|
r.setupResizable({
|
|
2790
2790
|
...n.opts.resizable,
|
|
2791
|
-
handles:
|
|
2792
|
-
autoHide:
|
|
2791
|
+
handles: d,
|
|
2792
|
+
autoHide: l,
|
|
2793
2793
|
start: t.start,
|
|
2794
2794
|
stop: t.stop,
|
|
2795
2795
|
resize: t.resize
|
|
@@ -2851,7 +2851,7 @@ class Os {
|
|
|
2851
2851
|
/** @internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable */
|
|
2852
2852
|
_getDDElements(e, t) {
|
|
2853
2853
|
const i = e.gridstack || t !== "destroy" && t !== "disable", s = c.getElements(e);
|
|
2854
|
-
return s.length ? s.map((o) => o.ddElement || (i ?
|
|
2854
|
+
return s.length ? s.map((o) => o.ddElement || (i ? pt.init(o) : null)).filter((o) => o) : [];
|
|
2855
2855
|
}
|
|
2856
2856
|
}
|
|
2857
2857
|
/*!
|
|
@@ -2861,7 +2861,7 @@ class Os {
|
|
|
2861
2861
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2862
2862
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2863
2863
|
*/
|
|
2864
|
-
const
|
|
2864
|
+
const U = new As();
|
|
2865
2865
|
class b {
|
|
2866
2866
|
/**
|
|
2867
2867
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2926,7 +2926,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2926
2926
|
/** @internal create placeholder DIV as needed */
|
|
2927
2927
|
get placeholder() {
|
|
2928
2928
|
if (!this._placeholder) {
|
|
2929
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2929
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, X.itemClass, this.opts.itemClass]);
|
|
2930
2930
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2931
2931
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2932
2932
|
}
|
|
@@ -2938,7 +2938,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2938
2938
|
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
2939
2939
|
*/
|
|
2940
2940
|
constructor(e, t = {}) {
|
|
2941
|
-
var a, f,
|
|
2941
|
+
var a, f, p;
|
|
2942
2942
|
this.el = e, this.opts = t, this.animationDelay = 310, this._gsEventHandler = {}, this._extraDragRow = 0, this.dragTransform = { xScale: 1, yScale: 1, xOffset: 0, yOffset: 0 }, e.gridstack = this, this.opts = t = t || {}, e.classList.contains("grid-stack") || this.el.classList.add("grid-stack"), t.row && (t.minRow = t.maxRow = t.row, delete t.row);
|
|
2943
2943
|
const i = c.toNumber(e.getAttribute("gs-row"));
|
|
2944
2944
|
t.column === "auto" && delete t.column, t.alwaysShowResizeHandle !== void 0 && (t._alwaysShowResizeHandle = t.alwaysShowResizeHandle);
|
|
@@ -2947,48 +2947,48 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2947
2947
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2948
2948
|
const g = r.oneColumnSize || 768;
|
|
2949
2949
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2950
|
-
let y = s.find((
|
|
2950
|
+
let y = s.find((m) => m.c === 1);
|
|
2951
2951
|
y ? y.w = g : (y = { c: 1, w: g }, s.push(y, { c: 12, w: g + 1 }));
|
|
2952
2952
|
}
|
|
2953
2953
|
const o = t.columnOpts;
|
|
2954
2954
|
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g, y) => (y.w || 0) - (g.w || 0));
|
|
2955
2955
|
const n = {
|
|
2956
|
-
...c.cloneDeep(
|
|
2957
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2958
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2959
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2960
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2956
|
+
...c.cloneDeep(X),
|
|
2957
|
+
column: c.toNumber(e.getAttribute("gs-column")) || X.column,
|
|
2958
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || X.minRow,
|
|
2959
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || X.maxRow,
|
|
2960
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || X.staticGrid,
|
|
2961
2961
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2962
2962
|
draggable: {
|
|
2963
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2963
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || X.draggable.handle
|
|
2964
2964
|
},
|
|
2965
2965
|
removableOptions: {
|
|
2966
|
-
accept: t.itemClass ||
|
|
2967
|
-
decline:
|
|
2966
|
+
accept: t.itemClass || X.removableOptions.accept,
|
|
2967
|
+
decline: X.removableOptions.decline
|
|
2968
2968
|
}
|
|
2969
2969
|
};
|
|
2970
2970
|
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");
|
|
2971
|
-
const
|
|
2972
|
-
|
|
2973
|
-
const
|
|
2974
|
-
if (this.engine = new
|
|
2971
|
+
const d = this.el.closest("." + X.itemClass), l = d == null ? void 0 : d.gridstackNode;
|
|
2972
|
+
l && (l.subGrid = this, this.parentGridNode = l, this.el.classList.add("grid-stack-nested"), l.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 !== X.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = ae), this._styleSheetClass = "gs-id-" + le._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2973
|
+
const h = t.engineClass || b.engineClass || le;
|
|
2974
|
+
if (this.engine = new h({
|
|
2975
2975
|
column: this.getColumn(),
|
|
2976
2976
|
float: t.float,
|
|
2977
2977
|
maxRow: t.maxRow,
|
|
2978
2978
|
onChange: (g) => {
|
|
2979
2979
|
let y = 0;
|
|
2980
|
-
this.engine.nodes.forEach((
|
|
2981
|
-
y = Math.max(y,
|
|
2982
|
-
}), g.forEach((
|
|
2983
|
-
const
|
|
2984
|
-
|
|
2980
|
+
this.engine.nodes.forEach((m) => {
|
|
2981
|
+
y = Math.max(y, m.y + m.h);
|
|
2982
|
+
}), g.forEach((m) => {
|
|
2983
|
+
const S = m.el;
|
|
2984
|
+
S && (m._removeDOM ? (S && S.remove(), delete m._removeDOM) : this._writePosAttr(S, m));
|
|
2985
2985
|
}), this._updateStyles(!1, y);
|
|
2986
2986
|
}
|
|
2987
2987
|
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((g) => this._prepareElement(g)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
2988
2988
|
const g = t.children;
|
|
2989
2989
|
delete t.children, g.length && this.load(g);
|
|
2990
2990
|
}
|
|
2991
|
-
this.setAnimation(), t.subGridDynamic && !w.pauseDrag && (w.pauseDrag = !0), ((
|
|
2991
|
+
this.setAnimation(), t.subGridDynamic && !w.pauseDrag && (w.pauseDrag = !0), ((p = t.draggable) == null ? void 0 : p.pause) !== void 0 && (w.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
2992
2992
|
}
|
|
2993
2993
|
/**
|
|
2994
2994
|
* add a new widget and returns it.
|
|
@@ -3039,9 +3039,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3039
3039
|
* @returns newly created grid
|
|
3040
3040
|
*/
|
|
3041
3041
|
makeSubGrid(e, t, i, s = !0) {
|
|
3042
|
-
var
|
|
3042
|
+
var p, g, y;
|
|
3043
3043
|
let r = e.gridstackNode;
|
|
3044
|
-
if (r || (r = this.makeWidget(e).gridstackNode), (
|
|
3044
|
+
if (r || (r = this.makeWidget(e).gridstackNode), (p = r.subGrid) != null && p.el)
|
|
3045
3045
|
return r.subGrid;
|
|
3046
3046
|
let o, n = this;
|
|
3047
3047
|
for (; n && !o; )
|
|
@@ -3058,15 +3058,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3058
3058
|
...o || {},
|
|
3059
3059
|
...t || r.subGridOpts || {}
|
|
3060
3060
|
}), r.subGridOpts = t;
|
|
3061
|
-
let
|
|
3062
|
-
t.column === "auto" && (
|
|
3063
|
-
let
|
|
3064
|
-
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 }, c.removeInternalForSave(a), delete a.subGridOpts, r.content && (a.content = r.content, delete r.content), b.addRemoveCB ?
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3061
|
+
let d;
|
|
3062
|
+
t.column === "auto" && (d = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
3063
|
+
let l = r.el.querySelector(".grid-stack-item-content"), h, a;
|
|
3064
|
+
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 }, c.removeInternalForSave(a), delete a.subGridOpts, r.content && (a.content = r.content, delete r.content), b.addRemoveCB ? h = b.addRemoveCB(this.el, a, !0, !1) : (h = c.createDiv(["grid-stack-item"]), h.appendChild(l), l = c.createDiv(["grid-stack-item-content"], r.el)), this.prepareDragDrop(r.el)), i) {
|
|
3065
|
+
const m = d ? t.column : r.w, S = r.h + i.h, M = r.el.style;
|
|
3066
|
+
M.transition = "none", this.update(r.el, { w: m, h: S }), setTimeout(() => M.transition = null);
|
|
3067
3067
|
}
|
|
3068
|
-
const f = r.subGrid = b.addGrid(
|
|
3069
|
-
return i != null && i._moving && (f._isTemp = !0),
|
|
3068
|
+
const f = r.subGrid = b.addGrid(l, t);
|
|
3069
|
+
return i != null && i._moving && (f._isTemp = !0), d && (f._autoColumn = !0), s && f.makeWidget(h, a), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
3070
3070
|
}
|
|
3071
3071
|
/**
|
|
3072
3072
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -3104,7 +3104,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3104
3104
|
const r = c.cloneDeep(this.opts);
|
|
3105
3105
|
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");
|
|
3106
3106
|
const o = r._alwaysShowResizeHandle;
|
|
3107
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
3107
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, X), r.children = s, r;
|
|
3108
3108
|
}
|
|
3109
3109
|
return s;
|
|
3110
3110
|
}
|
|
@@ -3119,15 +3119,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3119
3119
|
* see http://gridstackjs.com/demo/serialization.html
|
|
3120
3120
|
*/
|
|
3121
3121
|
load(e, t = b.addRemoveCB || !0) {
|
|
3122
|
-
var
|
|
3122
|
+
var l;
|
|
3123
3123
|
e = c.cloneDeep(e);
|
|
3124
3124
|
const i = this.getColumn();
|
|
3125
|
-
e.forEach((
|
|
3126
|
-
|
|
3125
|
+
e.forEach((h) => {
|
|
3126
|
+
h.w = h.w || 1, h.h = h.h || 1;
|
|
3127
3127
|
}), e = c.sort(e), this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = !0;
|
|
3128
3128
|
let s = 0;
|
|
3129
|
-
e.forEach((
|
|
3130
|
-
s = Math.max(s, (
|
|
3129
|
+
e.forEach((h) => {
|
|
3130
|
+
s = Math.max(s, (h.x || 0) + h.w);
|
|
3131
3131
|
}), s > this.engine.defaultColumn && (this.engine.defaultColumn = s), s > i && this.engine.cacheLayout(e, s, !0);
|
|
3132
3132
|
const r = b.addRemoveCB;
|
|
3133
3133
|
typeof t == "function" && (b.addRemoveCB = t);
|
|
@@ -3139,17 +3139,17 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3139
3139
|
return;
|
|
3140
3140
|
c.find(e, a.id) || (b.addRemoveCB && b.addRemoveCB(this.el, a, !1, !1), o.push(a), this.removeWidget(a.el, !0, !1));
|
|
3141
3141
|
}), this.engine._loading = !0;
|
|
3142
|
-
const
|
|
3143
|
-
return this.engine.nodes = this.engine.nodes.filter((
|
|
3142
|
+
const d = [];
|
|
3143
|
+
return this.engine.nodes = this.engine.nodes.filter((h) => c.find(e, h.id) ? (d.push(h), !1) : !0), e.forEach((h) => {
|
|
3144
3144
|
var f;
|
|
3145
|
-
const a = c.find(
|
|
3145
|
+
const a = c.find(d, h.id);
|
|
3146
3146
|
if (a) {
|
|
3147
|
-
if (c.shouldSizeToContent(a) && (
|
|
3148
|
-
const
|
|
3149
|
-
|
|
3147
|
+
if (c.shouldSizeToContent(a) && (h.h = a.h), this.engine.nodeBoundFix(h), (h.autoPosition || h.x === void 0 || h.y === void 0) && (h.w = h.w || a.w, h.h = h.h || a.h, this.engine.findEmptyPosition(h)), this.engine.nodes.push(a), c.samePos(a, h) && this.engine.nodes.length > 1 && (this.moveNode(a, { ...h, forceCollide: !0 }), c.copyPos(h, a)), this.update(a.el, h), (f = h.subGridOpts) != null && f.children) {
|
|
3148
|
+
const p = a.el.querySelector(".grid-stack");
|
|
3149
|
+
p && p.gridstack && p.gridstack.load(h.subGridOpts.children);
|
|
3150
3150
|
}
|
|
3151
|
-
} else t && this.addWidget(
|
|
3152
|
-
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? b.addRemoveCB = r : delete b.addRemoveCB, n && ((
|
|
3151
|
+
} else t && this.addWidget(h);
|
|
3152
|
+
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? b.addRemoveCB = r : delete b.addRemoveCB, n && ((l = this.opts) != null && l.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
3153
3153
|
}
|
|
3154
3154
|
/**
|
|
3155
3155
|
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
@@ -3229,7 +3229,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3229
3229
|
i = e.breakpoints[n++].c || t;
|
|
3230
3230
|
}
|
|
3231
3231
|
if (i !== t) {
|
|
3232
|
-
const n = (o = e.breakpoints) == null ? void 0 : o.find((
|
|
3232
|
+
const n = (o = e.breakpoints) == null ? void 0 : o.find((d) => d.c === i);
|
|
3233
3233
|
return this.column(i, (n == null ? void 0 : n.layout) || e.layout), !0;
|
|
3234
3234
|
}
|
|
3235
3235
|
return !1;
|
|
@@ -3307,8 +3307,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3307
3307
|
const i = this.el.getBoundingClientRect();
|
|
3308
3308
|
let s;
|
|
3309
3309
|
t ? s = { top: i.top + document.documentElement.scrollTop, left: i.left } : s = { top: this.el.offsetTop, left: this.el.offsetLeft };
|
|
3310
|
-
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(),
|
|
3311
|
-
return { x: Math.floor(r / n), y: Math.floor(o /
|
|
3310
|
+
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(), d = i.height / parseInt(this.el.getAttribute("gs-current-row"));
|
|
3311
|
+
return { x: Math.floor(r / n), y: Math.floor(o / d) };
|
|
3312
3312
|
}
|
|
3313
3313
|
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
3314
3314
|
getRow() {
|
|
@@ -3430,7 +3430,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3430
3430
|
*/
|
|
3431
3431
|
update(e, t) {
|
|
3432
3432
|
return b.getElements(e).forEach((i) => {
|
|
3433
|
-
var
|
|
3433
|
+
var h;
|
|
3434
3434
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3435
3435
|
if (!s)
|
|
3436
3436
|
return;
|
|
@@ -3442,16 +3442,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3442
3442
|
n[a] = r[a] !== void 0 ? r[a] : s[a], delete r[a];
|
|
3443
3443
|
})), !n && (r.minW || r.minH || r.maxW || r.maxH) && (n = {}), r.content !== void 0) {
|
|
3444
3444
|
const a = i.querySelector(".grid-stack-item-content");
|
|
3445
|
-
a && a.textContent !== r.content && (s.content = r.content, b.renderCB(a, r), (
|
|
3445
|
+
a && a.textContent !== r.content && (s.content = r.content, b.renderCB(a, r), (h = s.subGrid) != null && h.el && (a.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3446
3446
|
}
|
|
3447
|
-
let
|
|
3447
|
+
let d = !1, l = !1;
|
|
3448
3448
|
for (const a in r)
|
|
3449
|
-
a[0] !== "_" && s[a] !== r[a] && (s[a] = r[a],
|
|
3449
|
+
a[0] !== "_" && s[a] !== r[a] && (s[a] = r[a], d = !0, l = l || !this.opts.staticGrid && (a === "noResize" || a === "noMove" || a === "locked"));
|
|
3450
3450
|
if (c.sanitizeMinMax(s), n) {
|
|
3451
3451
|
const a = n.w !== void 0 && n.w !== s.w;
|
|
3452
3452
|
this.moveNode(s, n), a && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(a, s), delete s._orig;
|
|
3453
3453
|
}
|
|
3454
|
-
(n ||
|
|
3454
|
+
(n || d) && this._writeAttr(i, s), l && this.prepareDragDrop(s.el);
|
|
3455
3455
|
}), this;
|
|
3456
3456
|
}
|
|
3457
3457
|
moveNode(e, t) {
|
|
@@ -3465,7 +3465,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3465
3465
|
* @param useNodeH set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
|
|
3466
3466
|
*/
|
|
3467
3467
|
resizeToContent(e) {
|
|
3468
|
-
var f,
|
|
3468
|
+
var f, p;
|
|
3469
3469
|
if (!e || (e.classList.remove("size-to-content-max"), !e.clientHeight))
|
|
3470
3470
|
return;
|
|
3471
3471
|
const t = e.gridstackNode;
|
|
@@ -3480,14 +3480,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3480
3480
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3481
3481
|
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(b.resizeToContentParent)), !o)
|
|
3482
3482
|
return;
|
|
3483
|
-
const n = e.clientHeight - o.clientHeight,
|
|
3484
|
-
let
|
|
3483
|
+
const n = e.clientHeight - o.clientHeight, d = t.h ? t.h * s - n : o.clientHeight;
|
|
3484
|
+
let l;
|
|
3485
3485
|
if (t.subGrid) {
|
|
3486
|
-
|
|
3486
|
+
l = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3487
3487
|
const g = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3488
|
-
|
|
3488
|
+
l += g.top - y.top;
|
|
3489
3489
|
} else {
|
|
3490
|
-
if ((
|
|
3490
|
+
if ((p = (f = t.subGridOpts) == null ? void 0 : f.children) != null && p.length)
|
|
3491
3491
|
return;
|
|
3492
3492
|
{
|
|
3493
3493
|
const g = o.firstElementChild;
|
|
@@ -3495,15 +3495,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3495
3495
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3496
3496
|
return;
|
|
3497
3497
|
}
|
|
3498
|
-
|
|
3498
|
+
l = g.getBoundingClientRect().height || d;
|
|
3499
3499
|
}
|
|
3500
3500
|
}
|
|
3501
|
-
if (
|
|
3501
|
+
if (d === l)
|
|
3502
3502
|
return;
|
|
3503
|
-
r +=
|
|
3504
|
-
let
|
|
3503
|
+
r += l - d;
|
|
3504
|
+
let h = Math.ceil(r / s);
|
|
3505
3505
|
const a = Number.isInteger(t.sizeToContent) ? t.sizeToContent : 0;
|
|
3506
|
-
a &&
|
|
3506
|
+
a && h > a && (h = a, e.classList.add("size-to-content-max")), t.minH && h < t.minH ? h = t.minH : t.maxH && h > t.maxH && (h = t.maxH), h !== t.h && (i._ignoreLayoutsNodeChange = !0, i.moveNode(t, { h }), delete i._ignoreLayoutsNodeChange);
|
|
3507
3507
|
}
|
|
3508
3508
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3509
3509
|
resizeToContentCBCheck(e) {
|
|
@@ -3520,8 +3520,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3520
3520
|
return;
|
|
3521
3521
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3522
3522
|
if (t) {
|
|
3523
|
-
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0,
|
|
3524
|
-
r.x = s.x + n - (s.h - (
|
|
3523
|
+
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0, d = t.top > 0 ? Math.floor(t.top / this.opts.cellHeight) : 0;
|
|
3524
|
+
r.x = s.x + n - (s.h - (d + 1)), r.y = s.y + d - n;
|
|
3525
3525
|
}
|
|
3526
3526
|
Object.keys(r).forEach((n) => {
|
|
3527
3527
|
r[n] === void 0 && delete r[n];
|
|
@@ -3624,8 +3624,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3624
3624
|
}), !this._styles)
|
|
3625
3625
|
return this;
|
|
3626
3626
|
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
3627
|
-
const n = this.opts.marginTop + this.opts.marginUnit,
|
|
3628
|
-
c.addCSSRule(this._styles, a, `top: ${n}; right: ${
|
|
3627
|
+
const n = this.opts.marginTop + this.opts.marginUnit, d = this.opts.marginBottom + this.opts.marginUnit, l = this.opts.marginRight + this.opts.marginUnit, h = this.opts.marginLeft + this.opts.marginUnit, a = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
3628
|
+
c.addCSSRule(this._styles, a, `top: ${n}; right: ${l}; bottom: ${d}; left: ${h};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${l}; bottom: ${d}; left: ${h};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${l}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${l}; bottom: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${h}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${h}; bottom: ${d}`);
|
|
3629
3629
|
}
|
|
3630
3630
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
3631
3631
|
const o = (n) => i * n + s;
|
|
@@ -3655,7 +3655,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3655
3655
|
}
|
|
3656
3656
|
/** @internal */
|
|
3657
3657
|
_prepareElement(e, t = !1, i) {
|
|
3658
|
-
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(
|
|
3658
|
+
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(X.itemClass, this.opts.itemClass);
|
|
3659
3659
|
const s = c.shouldSizeToContent(i);
|
|
3660
3660
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), c.lazyLoad(i) || this.prepareDragDrop(i.el), this;
|
|
3661
3661
|
}
|
|
@@ -3761,7 +3761,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3761
3761
|
*/
|
|
3762
3762
|
/** get the global (but static to this code) DD implementation */
|
|
3763
3763
|
static getDD() {
|
|
3764
|
-
return
|
|
3764
|
+
return U;
|
|
3765
3765
|
}
|
|
3766
3766
|
/**
|
|
3767
3767
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3774,7 +3774,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3774
3774
|
*/
|
|
3775
3775
|
static setupDragIn(e, t, i, s = document) {
|
|
3776
3776
|
(t == null ? void 0 : t.pause) !== void 0 && (w.pauseDrag = t.pause), t = { appendTo: "body", helper: "clone", ...t || {} }, (typeof e == "string" ? c.getElements(e, s) : e).forEach((o, n) => {
|
|
3777
|
-
|
|
3777
|
+
U.isDraggable(o) || U.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3778
3778
|
});
|
|
3779
3779
|
}
|
|
3780
3780
|
/**
|
|
@@ -3853,12 +3853,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3853
3853
|
}
|
|
3854
3854
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3855
3855
|
_removeDD(e) {
|
|
3856
|
-
return
|
|
3856
|
+
return U.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3857
3857
|
}
|
|
3858
3858
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3859
3859
|
_setupAcceptWidget() {
|
|
3860
3860
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3861
|
-
return
|
|
3861
|
+
return U.droppable(this.el, "destroy"), this;
|
|
3862
3862
|
let e, t;
|
|
3863
3863
|
const i = (s, r, o) => {
|
|
3864
3864
|
var f;
|
|
@@ -3868,22 +3868,22 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3868
3868
|
return;
|
|
3869
3869
|
if (!((f = n.grid) != null && f.el)) {
|
|
3870
3870
|
o.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;
|
|
3871
|
-
const
|
|
3872
|
-
o.style.left =
|
|
3871
|
+
const p = o.getBoundingClientRect();
|
|
3872
|
+
o.style.left = p.x + (this.dragTransform.xScale - 1) * (s.clientX - p.x) / this.dragTransform.xScale + "px", o.style.top = p.y + (this.dragTransform.yScale - 1) * (s.clientY - p.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
3873
3873
|
}
|
|
3874
|
-
let { top:
|
|
3875
|
-
const
|
|
3876
|
-
|
|
3874
|
+
let { top: d, left: l } = o.getBoundingClientRect();
|
|
3875
|
+
const h = this.el.getBoundingClientRect();
|
|
3876
|
+
l -= h.left, d -= h.top;
|
|
3877
3877
|
const a = {
|
|
3878
3878
|
position: {
|
|
3879
|
-
top:
|
|
3880
|
-
left:
|
|
3879
|
+
top: d * this.dragTransform.xScale,
|
|
3880
|
+
left: l * this.dragTransform.yScale
|
|
3881
3881
|
}
|
|
3882
3882
|
};
|
|
3883
3883
|
if (n._temporaryRemoved) {
|
|
3884
|
-
if (n.x = Math.max(0, Math.round(
|
|
3884
|
+
if (n.x = Math.max(0, Math.round(l / t)), n.y = Math.max(0, Math.round(d / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3885
3885
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3886
|
-
|
|
3886
|
+
U.off(r, "drag");
|
|
3887
3887
|
return;
|
|
3888
3888
|
}
|
|
3889
3889
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
@@ -3892,7 +3892,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3892
3892
|
} else
|
|
3893
3893
|
this._dragOrResize(o, s, a, n, t, e);
|
|
3894
3894
|
};
|
|
3895
|
-
return
|
|
3895
|
+
return U.droppable(this.el, {
|
|
3896
3896
|
accept: (s) => {
|
|
3897
3897
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3898
3898
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3917,42 +3917,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3917
3917
|
if ((n == null ? void 0 : n.grid) === this && !n._temporaryRemoved)
|
|
3918
3918
|
return !1;
|
|
3919
3919
|
if (n != null && n._sidebarOrig && (n.w = n._sidebarOrig.w, n.h = n._sidebarOrig.h), n != null && n.grid && n.grid !== this && !n._temporaryRemoved && n.grid._leave(r, o), o = o || r, t = this.cellWidth(), e = this.getCellHeight(!0), !n) {
|
|
3920
|
-
const
|
|
3921
|
-
if (
|
|
3920
|
+
const h = o.getAttribute("data-gs-widget") || o.getAttribute("gridstacknode");
|
|
3921
|
+
if (h) {
|
|
3922
3922
|
try {
|
|
3923
|
-
n = JSON.parse(
|
|
3923
|
+
n = JSON.parse(h);
|
|
3924
3924
|
} catch {
|
|
3925
|
-
console.error("Gridstack dropover: Bad JSON format: ",
|
|
3925
|
+
console.error("Gridstack dropover: Bad JSON format: ", h);
|
|
3926
3926
|
}
|
|
3927
3927
|
o.removeAttribute("data-gs-widget"), o.removeAttribute("gridstacknode");
|
|
3928
3928
|
}
|
|
3929
3929
|
n || (n = this._readAttr(o)), n._sidebarOrig = { w: n.w, h: n.h };
|
|
3930
3930
|
}
|
|
3931
3931
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3932
|
-
const
|
|
3933
|
-
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w:
|
|
3934
|
-
n._temporaryRemoved = !0) : (n.w =
|
|
3932
|
+
const d = n.w || Math.round(o.offsetWidth / t) || 1, l = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3933
|
+
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: d, h: l, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3934
|
+
n._temporaryRemoved = !0) : (n.w = d, n.h = l, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1), U.on(r, "drag", i), i(s, r, o), !1;
|
|
3935
3935
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3936
3936
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3937
3937
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3938
3938
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3939
|
-
var
|
|
3939
|
+
var p, g, y;
|
|
3940
3940
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3941
3941
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3942
3942
|
return !1;
|
|
3943
|
-
const
|
|
3943
|
+
const d = !!this.placeholder.parentElement, l = r !== o;
|
|
3944
3944
|
this.placeholder.remove(), delete this.placeholder.gridstackNode;
|
|
3945
|
-
const
|
|
3946
|
-
|
|
3945
|
+
const h = d && this.opts.animate;
|
|
3946
|
+
h && this.setAnimation(!1);
|
|
3947
3947
|
const a = r._gridstackNodeOrig;
|
|
3948
|
-
if (delete r._gridstackNodeOrig,
|
|
3949
|
-
const
|
|
3950
|
-
|
|
3948
|
+
if (delete r._gridstackNodeOrig, d && (a != null && a.grid) && a.grid !== this) {
|
|
3949
|
+
const m = a.grid;
|
|
3950
|
+
m.engine.removeNodeFromLayoutCache(a), m.engine.removedNodes.push(a), m._triggerRemoveEvent()._triggerChangeEvent(), m.parentGridNode && !m.engine.nodes.length && m.opts.subGridDynamic && m.removeAsSubGrid();
|
|
3951
3951
|
}
|
|
3952
|
-
if (!n || (
|
|
3952
|
+
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (p = n.grid) == null || delete p._isTemp, U.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !d))
|
|
3953
3953
|
return !1;
|
|
3954
3954
|
const f = (y = (g = n.subGrid) == null ? void 0 : g.el) == null ? void 0 : y.gridstack;
|
|
3955
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r),
|
|
3955
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), l && (n.content || n.subGridOpts || b.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, a && a.grid ? a : void 0, n), h && this.setAnimation(this.opts.animate, !0), !1;
|
|
3956
3956
|
}), this;
|
|
3957
3957
|
}
|
|
3958
3958
|
/** @internal mark item for removal */
|
|
@@ -3967,7 +3967,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3967
3967
|
if (typeof this.opts.removable != "string")
|
|
3968
3968
|
return this;
|
|
3969
3969
|
const e = document.querySelector(this.opts.removable);
|
|
3970
|
-
return e ? (!this.opts.staticGrid && !
|
|
3970
|
+
return e ? (!this.opts.staticGrid && !U.isDroppable(e) && U.droppable(e, this.opts.removableOptions).on(e, "dropover", (t, i) => b._itemRemoving(i, !0)).on(e, "dropout", (t, i) => b._itemRemoving(i, !1)), this) : this;
|
|
3971
3971
|
}
|
|
3972
3972
|
/**
|
|
3973
3973
|
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
@@ -3982,34 +3982,34 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3982
3982
|
if ((t || o) && (i._initDD && (this._removeDD(e), delete i._initDD), o && e.classList.add("ui-draggable-disabled", "ui-resizable-disabled"), !t))
|
|
3983
3983
|
return this;
|
|
3984
3984
|
if (!i._initDD) {
|
|
3985
|
-
let n,
|
|
3986
|
-
const
|
|
3987
|
-
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(),
|
|
3988
|
-
},
|
|
3989
|
-
this._dragOrResize(e, f,
|
|
3985
|
+
let n, d;
|
|
3986
|
+
const l = (f, p) => {
|
|
3987
|
+
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(), d = this.getCellHeight(!0), this._onStartMoving(e, f, p, i, n, d);
|
|
3988
|
+
}, h = (f, p) => {
|
|
3989
|
+
this._dragOrResize(e, f, p, i, n, d);
|
|
3990
3990
|
}, a = (f) => {
|
|
3991
3991
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete i._moving, delete i._event, delete i._lastTried;
|
|
3992
|
-
const
|
|
3992
|
+
const p = i.w !== i._orig.w, g = f.target;
|
|
3993
3993
|
if (!(!g.gridstackNode || g.gridstackNode.grid !== this)) {
|
|
3994
3994
|
if (i.el = g, i._isAboutToRemove) {
|
|
3995
3995
|
const y = e.gridstackNode.grid;
|
|
3996
3996
|
y._gsEventHandler[f.type] && y._gsEventHandler[f.type](f, g), y.engine.nodes.push(i), y.removeWidget(e, !0, !0);
|
|
3997
3997
|
} else
|
|
3998
3998
|
c.removePositioningStyles(g), i._temporaryRemoved ? (c.copyPos(i, i._orig), this._writePosAttr(g, i), this.engine.addNode(i)) : this._writePosAttr(g, i), this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, g);
|
|
3999
|
-
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(
|
|
3999
|
+
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(p, i));
|
|
4000
4000
|
}
|
|
4001
4001
|
};
|
|
4002
|
-
|
|
4003
|
-
start:
|
|
4002
|
+
U.draggable(e, {
|
|
4003
|
+
start: l,
|
|
4004
4004
|
stop: a,
|
|
4005
|
-
drag:
|
|
4005
|
+
drag: h
|
|
4006
4006
|
}).resizable(e, {
|
|
4007
|
-
start:
|
|
4007
|
+
start: l,
|
|
4008
4008
|
stop: a,
|
|
4009
|
-
resize:
|
|
4009
|
+
resize: h
|
|
4010
4010
|
}), i._initDD = !0;
|
|
4011
4011
|
}
|
|
4012
|
-
return
|
|
4012
|
+
return U.draggable(e, s ? "disable" : "enable").resizable(e, r ? "disable" : "enable"), this;
|
|
4013
4013
|
}
|
|
4014
4014
|
/** @internal handles actual drag/resize start */
|
|
4015
4015
|
_onStartMoving(e, t, i, s, r, o) {
|
|
@@ -4017,8 +4017,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4017
4017
|
if (this.engine.cleanNodes().beginUpdate(s), this._writePosAttr(this.placeholder, s), this.el.appendChild(this.placeholder), this.placeholder.gridstackNode = s, (n = s.grid) != null && n.el)
|
|
4018
4018
|
this.dragTransform = c.getValuesFromTransformedElement(e);
|
|
4019
4019
|
else if (this.placeholder && this.placeholder.closest(".grid-stack")) {
|
|
4020
|
-
const
|
|
4021
|
-
this.dragTransform = c.getValuesFromTransformedElement(
|
|
4020
|
+
const d = this.placeholder.closest(".grid-stack");
|
|
4021
|
+
this.dragTransform = c.getValuesFromTransformedElement(d);
|
|
4022
4022
|
} else
|
|
4023
4023
|
this.dragTransform = {
|
|
4024
4024
|
xScale: 1,
|
|
@@ -4027,48 +4027,48 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4027
4027
|
yOffset: 0
|
|
4028
4028
|
};
|
|
4029
4029
|
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") {
|
|
4030
|
-
const
|
|
4031
|
-
|
|
4030
|
+
const d = this.getColumn() - s.x, l = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
4031
|
+
U.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, d)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, l)).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, l)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
4032
4032
|
}
|
|
4033
4033
|
}
|
|
4034
4034
|
/** @internal handles actual drag/resize */
|
|
4035
4035
|
_dragOrResize(e, t, i, s, r, o) {
|
|
4036
4036
|
const n = { ...s._orig };
|
|
4037
|
-
let
|
|
4038
|
-
const
|
|
4039
|
-
if (
|
|
4037
|
+
let d, l = this.opts.marginLeft, h = this.opts.marginRight, a = this.opts.marginTop, f = this.opts.marginBottom;
|
|
4038
|
+
const p = Math.round(o * 0.1), g = Math.round(r * 0.1);
|
|
4039
|
+
if (l = Math.min(l, g), h = Math.min(h, g), a = Math.min(a, p), f = Math.min(f, p), t.type === "drag") {
|
|
4040
4040
|
if (s._temporaryRemoved)
|
|
4041
4041
|
return;
|
|
4042
|
-
const
|
|
4043
|
-
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position,
|
|
4044
|
-
const
|
|
4045
|
-
n.x = Math.round(
|
|
4046
|
-
const
|
|
4042
|
+
const m = i.position.top - s._prevYPix;
|
|
4043
|
+
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, m);
|
|
4044
|
+
const S = i.position.left + (i.position.left > s._lastUiPosition.left ? -h : l), M = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : a);
|
|
4045
|
+
n.x = Math.round(S / r), n.y = Math.round(M / o);
|
|
4046
|
+
const z = this._extraDragRow;
|
|
4047
4047
|
if (this.engine.collide(s, n)) {
|
|
4048
|
-
const
|
|
4049
|
-
let B = Math.max(0, n.y + s.h -
|
|
4050
|
-
this.opts.maxRow &&
|
|
4048
|
+
const Q = this.getRow();
|
|
4049
|
+
let B = Math.max(0, n.y + s.h - Q);
|
|
4050
|
+
this.opts.maxRow && Q + B > this.opts.maxRow && (B = Math.max(0, this.opts.maxRow - Q)), this._extraDragRow = B;
|
|
4051
4051
|
} else
|
|
4052
4052
|
this._extraDragRow = 0;
|
|
4053
|
-
if (this._extraDragRow !==
|
|
4053
|
+
if (this._extraDragRow !== z && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
4054
4054
|
return;
|
|
4055
4055
|
} else if (t.type === "resize") {
|
|
4056
|
-
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width -
|
|
4056
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - l) / r), n.h = Math.round((i.size.height - a) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
4057
4057
|
return;
|
|
4058
|
-
const
|
|
4059
|
-
n.x = Math.round(
|
|
4058
|
+
const m = i.position.left + l, S = i.position.top + a;
|
|
4059
|
+
n.x = Math.round(m / r), n.y = Math.round(S / o), d = !0;
|
|
4060
4060
|
}
|
|
4061
4061
|
s._event = t, s._lastTried = n;
|
|
4062
4062
|
const y = {
|
|
4063
|
-
x: i.position.left +
|
|
4063
|
+
x: i.position.left + l,
|
|
4064
4064
|
y: i.position.top + a,
|
|
4065
|
-
w: (i.size ? i.size.width : s.w * r) -
|
|
4065
|
+
w: (i.size ? i.size.width : s.w * r) - l - h,
|
|
4066
4066
|
h: (i.size ? i.size.height : s.h * o) - a - f
|
|
4067
4067
|
};
|
|
4068
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing:
|
|
4069
|
-
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a,
|
|
4070
|
-
const
|
|
4071
|
-
s._sidebarOrig || this._writePosAttr(
|
|
4068
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing: d })) {
|
|
4069
|
+
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a, h, f, l), delete s._skipDown, d && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
4070
|
+
const m = t.target;
|
|
4071
|
+
s._sidebarOrig || this._writePosAttr(m, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, m);
|
|
4072
4072
|
}
|
|
4073
4073
|
}
|
|
4074
4074
|
/** @internal called when item leaving our area by either cursor dropout event
|
|
@@ -4078,7 +4078,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4078
4078
|
_leave(e, t) {
|
|
4079
4079
|
t = t || e;
|
|
4080
4080
|
const i = t.gridstackNode;
|
|
4081
|
-
if (!i || (t.style.transform = t.style.transformOrigin = null,
|
|
4081
|
+
if (!i || (t.style.transform = t.style.transformOrigin = null, U.off(e, "drag"), i._temporaryRemoved))
|
|
4082
4082
|
return;
|
|
4083
4083
|
i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e;
|
|
4084
4084
|
const s = i._sidebarOrig;
|
|
@@ -4086,29 +4086,29 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4086
4086
|
}
|
|
4087
4087
|
// legacy method removed
|
|
4088
4088
|
commit() {
|
|
4089
|
-
return
|
|
4089
|
+
return Ds(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
4090
4090
|
}
|
|
4091
4091
|
}
|
|
4092
|
-
b.renderCB = (
|
|
4093
|
-
|
|
4092
|
+
b.renderCB = (u, e) => {
|
|
4093
|
+
u && (e != null && e.content) && (u.textContent = e.content);
|
|
4094
4094
|
};
|
|
4095
4095
|
b.resizeToContentParent = ".grid-stack-item-content";
|
|
4096
4096
|
b.Utils = c;
|
|
4097
4097
|
b.Engine = le;
|
|
4098
4098
|
b.GDRev = "11.5.1";
|
|
4099
|
-
const
|
|
4099
|
+
const Os = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Hs = { class: "grid-stack-item-content" }, Ms = /* @__PURE__ */ Z({
|
|
4100
4100
|
__name: "DraggableGridLayout",
|
|
4101
4101
|
props: {
|
|
4102
4102
|
tiles: {},
|
|
4103
4103
|
tileHeight: { default: Xe }
|
|
4104
4104
|
},
|
|
4105
4105
|
emits: ["update-tiles"],
|
|
4106
|
-
setup(
|
|
4107
|
-
const i =
|
|
4106
|
+
setup(u, { expose: e, emit: t }) {
|
|
4107
|
+
const i = u, s = t, r = A(null), o = A(new Map(i.tiles.map((p) => [`${p.id}`, p])));
|
|
4108
4108
|
let n = null;
|
|
4109
|
-
const
|
|
4110
|
-
var
|
|
4111
|
-
const y = o.value.get(`${(
|
|
4109
|
+
const d = (p) => `[data-id="${p}"]`, l = (p) => p.map((g) => {
|
|
4110
|
+
var m;
|
|
4111
|
+
const y = o.value.get(`${(m = g.el) == null ? void 0 : m.getAttribute("data-id")}`);
|
|
4112
4112
|
if (y)
|
|
4113
4113
|
return {
|
|
4114
4114
|
...y,
|
|
@@ -4117,14 +4117,14 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4117
4117
|
size: { cols: Number(g.w), rows: Number(g.h) }
|
|
4118
4118
|
}
|
|
4119
4119
|
};
|
|
4120
|
-
}).filter((g) => g !== void 0),
|
|
4121
|
-
n && (
|
|
4122
|
-
o.value.set(`${
|
|
4120
|
+
}).filter((g) => g !== void 0), h = (p, g) => {
|
|
4121
|
+
n && (l(g).forEach((m) => {
|
|
4122
|
+
o.value.set(`${m.id}`, m);
|
|
4123
4123
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4124
|
-
}, a = (
|
|
4124
|
+
}, a = (p, g) => {
|
|
4125
4125
|
g.forEach((y) => {
|
|
4126
|
-
var
|
|
4127
|
-
o.value.delete(`${(
|
|
4126
|
+
var m;
|
|
4127
|
+
o.value.delete(`${(m = y.el) == null ? void 0 : m.getAttribute("data-id")}`);
|
|
4128
4128
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
4129
4129
|
};
|
|
4130
4130
|
at(() => {
|
|
@@ -4134,36 +4134,36 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4134
4134
|
cellHeight: i.tileHeight,
|
|
4135
4135
|
resizable: { handles: "se, sw" },
|
|
4136
4136
|
handle: ".tile-header"
|
|
4137
|
-
}, r.value), n.on("change",
|
|
4137
|
+
}, r.value), n.on("change", h), n.on("added", h), n.on("removed", a));
|
|
4138
4138
|
}), lt(() => {
|
|
4139
4139
|
n && n.destroy(!1);
|
|
4140
4140
|
});
|
|
4141
|
-
const f = (
|
|
4141
|
+
const f = (p) => {
|
|
4142
4142
|
if (n && r.value) {
|
|
4143
|
-
const g = r.value.querySelector(
|
|
4143
|
+
const g = r.value.querySelector(d(p));
|
|
4144
4144
|
g && n.removeWidget(g);
|
|
4145
4145
|
}
|
|
4146
4146
|
};
|
|
4147
|
-
return Ve(() => i.tiles.length, async (
|
|
4148
|
-
if (
|
|
4147
|
+
return Ve(() => i.tiles.length, async (p, g) => {
|
|
4148
|
+
if (p > g && n) {
|
|
4149
4149
|
const y = i.tiles.slice(g);
|
|
4150
|
-
for (const
|
|
4151
|
-
o.value.set(`${
|
|
4150
|
+
for (const m of y)
|
|
4151
|
+
o.value.set(`${m.id}`, m), await dt(), n.makeWidget(d(m.id), {
|
|
4152
4152
|
autoPosition: !0,
|
|
4153
|
-
w:
|
|
4154
|
-
h:
|
|
4153
|
+
w: m.layout.size.cols,
|
|
4154
|
+
h: m.layout.size.rows
|
|
4155
4155
|
});
|
|
4156
4156
|
}
|
|
4157
4157
|
}), Mt(() => {
|
|
4158
|
-
i.tiles.forEach((
|
|
4159
|
-
o.value.set(`${
|
|
4158
|
+
i.tiles.forEach((p) => {
|
|
4159
|
+
o.value.set(`${p.id}`, p);
|
|
4160
4160
|
});
|
|
4161
|
-
}), e({ removeWidget: f }), (
|
|
4161
|
+
}), e({ removeWidget: f }), (p, g) => (C(), K("div", {
|
|
4162
4162
|
ref_key: "gridContainer",
|
|
4163
4163
|
ref: r,
|
|
4164
4164
|
class: "grid-stack"
|
|
4165
4165
|
}, [
|
|
4166
|
-
(C(!0),
|
|
4166
|
+
(C(!0), K($t, null, Gt(i.tiles, (y) => (C(), K("div", {
|
|
4167
4167
|
key: y.id,
|
|
4168
4168
|
class: "grid-stack-item",
|
|
4169
4169
|
"data-id": `${y.id}`,
|
|
@@ -4174,19 +4174,19 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4174
4174
|
"gs-x": y.layout.position.col,
|
|
4175
4175
|
"gs-y": y.layout.position.row
|
|
4176
4176
|
}, [
|
|
4177
|
-
oe("div",
|
|
4178
|
-
|
|
4177
|
+
oe("div", Hs, [
|
|
4178
|
+
ze(p.$slots, "tile", { tile: y }, void 0, !0)
|
|
4179
4179
|
])
|
|
4180
|
-
], 8,
|
|
4180
|
+
], 8, Os))), 128))
|
|
4181
4181
|
], 512));
|
|
4182
4182
|
}
|
|
4183
|
-
}),
|
|
4183
|
+
}), Is = /* @__PURE__ */ _e(Ms, [["__scopeId", "data-v-a68d6821"]]), qs = {
|
|
4184
4184
|
key: 0,
|
|
4185
4185
|
class: "fullscreen-header"
|
|
4186
|
-
},
|
|
4186
|
+
}, Ps = {
|
|
4187
4187
|
key: 0,
|
|
4188
4188
|
class: "tile-container slottable-tile"
|
|
4189
|
-
},
|
|
4189
|
+
}, $s = /* @__PURE__ */ Z({
|
|
4190
4190
|
__name: "DashboardRenderer",
|
|
4191
4191
|
props: /* @__PURE__ */ xt({
|
|
4192
4192
|
context: {}
|
|
@@ -4195,31 +4195,31 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4195
4195
|
modelModifiers: {}
|
|
4196
4196
|
}),
|
|
4197
4197
|
emits: /* @__PURE__ */ xt(["edit-tile", "tile-time-range-zoom"], ["update:modelValue"]),
|
|
4198
|
-
setup(
|
|
4198
|
+
setup(u, { expose: e, emit: t }) {
|
|
4199
4199
|
Ye((E) => ({
|
|
4200
4200
|
"82baf22a": a.value
|
|
4201
4201
|
}));
|
|
4202
|
-
const i =
|
|
4203
|
-
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),
|
|
4204
|
-
const
|
|
4202
|
+
const i = u, s = t, r = ci(u, "modelValue"), { i18n: o } = ye.useI18n(), n = A(0), d = A(null), l = A(), h = A(), a = A("scale(1)"), f = ve(pe);
|
|
4203
|
+
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ye.useRequestQueue();
|
|
4204
|
+
const p = ut(), g = k(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4205
4205
|
type: "relative",
|
|
4206
|
-
time_range:
|
|
4207
|
-
}), y = k(() => !!i.context.timeSpec || !
|
|
4208
|
-
const
|
|
4209
|
-
return
|
|
4210
|
-
},
|
|
4211
|
-
var
|
|
4206
|
+
time_range: p.defaultQueryTimeForOrg
|
|
4207
|
+
}), y = k(() => !!i.context.timeSpec || !p.loading), m = (E, D) => {
|
|
4208
|
+
const N = E.layout.position.row - D.layout.position.row;
|
|
4209
|
+
return N !== 0 ? N : E.layout.position.col - D.layout.position.col;
|
|
4210
|
+
}, S = k(() => r.value.tiles.map((E) => {
|
|
4211
|
+
var N;
|
|
4212
4212
|
let D = E.definition;
|
|
4213
4213
|
if ("description" in D.chart) {
|
|
4214
|
-
const
|
|
4215
|
-
const
|
|
4216
|
-
return o.te(
|
|
4214
|
+
const I = (N = D.chart.description) == null ? void 0 : N.replace(Ui, () => {
|
|
4215
|
+
const me = `renderer.trendRange.${g.value.type === "absolute" ? "custom" : g.value.time_range}`;
|
|
4216
|
+
return o.te(me) ? o.t(me) : "";
|
|
4217
4217
|
});
|
|
4218
4218
|
D = {
|
|
4219
4219
|
...D,
|
|
4220
4220
|
chart: {
|
|
4221
4221
|
...D.chart,
|
|
4222
|
-
description:
|
|
4222
|
+
description: I
|
|
4223
4223
|
}
|
|
4224
4224
|
};
|
|
4225
4225
|
}
|
|
@@ -4234,38 +4234,38 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4234
4234
|
// Add a unique key to each tile internally.
|
|
4235
4235
|
id: E.id ?? crypto.randomUUID()
|
|
4236
4236
|
};
|
|
4237
|
-
})),
|
|
4238
|
-
var
|
|
4239
|
-
let { tz: E, refreshInterval: D, editable:
|
|
4240
|
-
const
|
|
4241
|
-
if (E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), D === void 0 && (D =
|
|
4242
|
-
let
|
|
4237
|
+
})), M = k(() => {
|
|
4238
|
+
var me, Re, Ie;
|
|
4239
|
+
let { tz: E, refreshInterval: D, editable: N } = i.context;
|
|
4240
|
+
const I = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
4241
|
+
if (E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), D === void 0 && (D = Wi), J.value) {
|
|
4242
|
+
let ke = !1;
|
|
4243
4243
|
if (g.value.type === "relative")
|
|
4244
|
-
|
|
4244
|
+
ke = ["15m", "1h", "6h", "12h", "24h"].includes(g.value.time_range);
|
|
4245
4245
|
else {
|
|
4246
4246
|
const et = g.value.start.getTime(), tt = g.value.end.getTime();
|
|
4247
|
-
|
|
4247
|
+
ke = Math.abs(tt - et) <= 864e5;
|
|
4248
4248
|
}
|
|
4249
4249
|
const Je = (/* @__PURE__ */ new Date()).getTime();
|
|
4250
|
-
g.value.type === "absolute" && g.value.end.getTime() < Je ? D = 0 :
|
|
4250
|
+
g.value.type === "absolute" && g.value.end.getTime() < Je ? D = 0 : ke ? D = Ki : D = Vi;
|
|
4251
4251
|
}
|
|
4252
|
-
|
|
4253
|
-
const
|
|
4252
|
+
N === void 0 && (N = !1);
|
|
4253
|
+
const ee = !!((Ie = (Re = (me = fi()) == null ? void 0 : me.vnode) == null ? void 0 : Re.props) != null && Ie.onTileTimeRangeZoom);
|
|
4254
4254
|
return {
|
|
4255
|
-
filters:
|
|
4255
|
+
filters: I,
|
|
4256
4256
|
tz: E,
|
|
4257
4257
|
timeSpec: g.value,
|
|
4258
4258
|
refreshInterval: D,
|
|
4259
|
-
editable:
|
|
4260
|
-
zoomable:
|
|
4259
|
+
editable: N,
|
|
4260
|
+
zoomable: ee
|
|
4261
4261
|
};
|
|
4262
|
-
}),
|
|
4262
|
+
}), z = (E) => {
|
|
4263
4263
|
s("edit-tile", E);
|
|
4264
|
-
},
|
|
4265
|
-
const D =
|
|
4264
|
+
}, Q = (E) => E.type === "slottable", B = (E) => {
|
|
4265
|
+
const D = Q(E.meta.chart) ? { ...E.meta.chart } : {
|
|
4266
4266
|
...E.meta.chart,
|
|
4267
4267
|
chart_title: E.meta.chart.chart_title ? `Copy of ${E.meta.chart.chart_title}` : ""
|
|
4268
|
-
},
|
|
4268
|
+
}, N = {
|
|
4269
4269
|
id: crypto.randomUUID(),
|
|
4270
4270
|
type: "chart",
|
|
4271
4271
|
definition: {
|
|
@@ -4280,77 +4280,77 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4280
4280
|
size: E.layout.size
|
|
4281
4281
|
}
|
|
4282
4282
|
};
|
|
4283
|
-
r.value.tiles.push(
|
|
4284
|
-
}, _e = (E) => {
|
|
4285
|
-
l.value && l.value.removeWidget(E.id);
|
|
4286
|
-
}, be = () => {
|
|
4287
|
-
n.value++;
|
|
4283
|
+
r.value.tiles.push(N);
|
|
4288
4284
|
}, R = (E) => {
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4285
|
+
d.value && d.value.removeWidget(E.id);
|
|
4286
|
+
}, O = () => {
|
|
4287
|
+
n.value++;
|
|
4288
|
+
}, Y = (E) => {
|
|
4289
|
+
const D = E.map((N) => ({
|
|
4290
|
+
id: N.id,
|
|
4291
|
+
type: N.type,
|
|
4292
|
+
layout: N.layout,
|
|
4293
|
+
definition: N.meta
|
|
4294
4294
|
}));
|
|
4295
|
-
r.value.tiles = D.sort(
|
|
4296
|
-
},
|
|
4297
|
-
if (a.value = "scale(1)", await
|
|
4298
|
-
const { availWidth: E, availHeight: D } = window.screen, { width:
|
|
4299
|
-
a.value = `scale(${
|
|
4295
|
+
r.value.tiles = D.sort(m);
|
|
4296
|
+
}, ue = async () => {
|
|
4297
|
+
if (a.value = "scale(1)", await dt(), h.value) {
|
|
4298
|
+
const { availWidth: E, availHeight: D } = window.screen, { width: N, height: I } = h.value.getBoundingClientRect(), ee = Math.min(D / I, E / N);
|
|
4299
|
+
a.value = `scale(${ee})`;
|
|
4300
4300
|
}
|
|
4301
|
-
},
|
|
4302
|
-
|
|
4303
|
-
},
|
|
4304
|
-
|
|
4301
|
+
}, He = () => {
|
|
4302
|
+
l.value && (document.fullscreenElement ? document.exitFullscreen() : l.value.requestFullscreen());
|
|
4303
|
+
}, J = A(!1), Me = () => {
|
|
4304
|
+
J.value = document.fullscreenElement !== null, J.value && ue();
|
|
4305
4305
|
};
|
|
4306
4306
|
return e({
|
|
4307
|
-
refresh:
|
|
4308
|
-
toggleFullscreen:
|
|
4307
|
+
refresh: O,
|
|
4308
|
+
toggleFullscreen: He
|
|
4309
4309
|
}), (E, D) => {
|
|
4310
|
-
const
|
|
4311
|
-
return C(),
|
|
4310
|
+
const N = ge("KAlert");
|
|
4311
|
+
return C(), K("div", {
|
|
4312
4312
|
ref_key: "dashboardContainer",
|
|
4313
|
-
ref:
|
|
4314
|
-
class: je(["kong-ui-public-dashboard-renderer", { "is-fullscreen":
|
|
4313
|
+
ref: l,
|
|
4314
|
+
class: je(["kong-ui-public-dashboard-renderer", { "is-fullscreen": J.value }]),
|
|
4315
4315
|
onFullscreenchange: Me
|
|
4316
4316
|
}, [
|
|
4317
4317
|
oe("div", {
|
|
4318
4318
|
ref_key: "layoutContainer",
|
|
4319
|
-
ref:
|
|
4319
|
+
ref: h,
|
|
4320
4320
|
class: "layout"
|
|
4321
4321
|
}, [
|
|
4322
|
-
x(f) &&
|
|
4323
|
-
|
|
4324
|
-
])) :
|
|
4325
|
-
x(f) ? (C(),
|
|
4322
|
+
x(f) && J.value ? (C(), K("div", qs, [
|
|
4323
|
+
ze(E.$slots, "fullscreenHeader", {}, void 0, !0)
|
|
4324
|
+
])) : V("", !0),
|
|
4325
|
+
x(f) ? (C(), L(Pt(E.context.editable && !J.value ? Is : Ss), {
|
|
4326
4326
|
key: 2,
|
|
4327
4327
|
ref_key: "gridLayoutRef",
|
|
4328
|
-
ref:
|
|
4328
|
+
ref: d,
|
|
4329
4329
|
"tile-height": r.value.tile_height,
|
|
4330
|
-
tiles:
|
|
4331
|
-
onUpdateTiles:
|
|
4330
|
+
tiles: S.value,
|
|
4331
|
+
onUpdateTiles: Y
|
|
4332
4332
|
}, {
|
|
4333
|
-
tile: $(({ tile:
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
])) : (C(),
|
|
4337
|
-
key:
|
|
4333
|
+
tile: $(({ tile: I }) => [
|
|
4334
|
+
I.meta.chart.type === "slottable" ? (C(), K("div", Ps, [
|
|
4335
|
+
ze(E.$slots, I.meta.chart.id, {}, void 0, !0)
|
|
4336
|
+
])) : (C(), L(ks, {
|
|
4337
|
+
key: J.value ? `${I.id}-tile` : `${I.id}-tile-fullscreen`,
|
|
4338
4338
|
class: "tile-container",
|
|
4339
|
-
context:
|
|
4340
|
-
definition:
|
|
4341
|
-
height:
|
|
4342
|
-
"is-fullscreen":
|
|
4339
|
+
context: M.value,
|
|
4340
|
+
definition: I.meta,
|
|
4341
|
+
height: I.layout.size.rows * (r.value.tile_height || x(Xe)) + parseInt(x(ei), 10),
|
|
4342
|
+
"is-fullscreen": J.value,
|
|
4343
4343
|
"query-ready": y.value,
|
|
4344
4344
|
"refresh-counter": n.value,
|
|
4345
|
-
"tile-id":
|
|
4346
|
-
onDuplicateTile: (
|
|
4347
|
-
onEditTile: (
|
|
4348
|
-
onRemoveTile: (
|
|
4349
|
-
onTileTimeRangeZoom: D[0] || (D[0] = (
|
|
4345
|
+
"tile-id": I.id,
|
|
4346
|
+
onDuplicateTile: (ee) => B(I),
|
|
4347
|
+
onEditTile: (ee) => z(I),
|
|
4348
|
+
onRemoveTile: (ee) => R(I),
|
|
4349
|
+
onTileTimeRangeZoom: D[0] || (D[0] = (ee) => s("tile-time-range-zoom", ee))
|
|
4350
4350
|
}, null, 8, ["context", "definition", "height", "is-fullscreen", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4351
4351
|
]),
|
|
4352
4352
|
_: 3
|
|
4353
|
-
}, 40, ["tile-height", "tiles"])) : (C(), N
|
|
4353
|
+
}, 40, ["tile-height", "tiles"])) : (C(), L(N, {
|
|
4354
4354
|
key: 1,
|
|
4355
4355
|
appearance: "danger"
|
|
4356
4356
|
}, {
|
|
@@ -4363,18 +4363,18 @@ const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ms = { cl
|
|
|
4363
4363
|
], 34);
|
|
4364
4364
|
};
|
|
4365
4365
|
}
|
|
4366
|
-
}),
|
|
4366
|
+
}), Xs = /* @__PURE__ */ _e($s, [["__scopeId", "data-v-8d8a6181"]]);
|
|
4367
4367
|
export {
|
|
4368
|
-
|
|
4369
|
-
|
|
4368
|
+
Bi as C,
|
|
4369
|
+
Xs as D,
|
|
4370
4370
|
Rt as E,
|
|
4371
|
-
|
|
4372
|
-
|
|
4371
|
+
Ki as F,
|
|
4372
|
+
Ss as G,
|
|
4373
4373
|
pe as I,
|
|
4374
|
-
|
|
4374
|
+
Ui as T,
|
|
4375
4375
|
ct as _,
|
|
4376
4376
|
Xe as a,
|
|
4377
4377
|
Wt as b,
|
|
4378
|
-
|
|
4379
|
-
|
|
4378
|
+
Wi as c,
|
|
4379
|
+
Vi as d
|
|
4380
4380
|
};
|