@kong-ui-public/dashboard-renderer 7.4.14 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GeoMapRenderer-w7iU0t2K.js → GeoMapRenderer-NvV03kSZ.js} +1 -1
- package/dist/dashboard-renderer.es.js +1 -1
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/{index-CGjBNwEk.js → index-B20-hQXl.js} +977 -964
- package/dist/style.css +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/components/QueryDataProvider.vue.d.ts.map +1 -1
- package/dist/types/composables/index.d.ts +4 -2
- package/dist/types/composables/index.d.ts.map +1 -1
- package/dist/types/composables/useIssueQuery.d.ts +6 -0
- package/dist/types/composables/useIssueQuery.d.ts.map +1 -0
- package/package.json +13 -13
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var ai = Object.defineProperty;
|
|
2
|
+
var _t = (d) => {
|
|
3
|
+
throw TypeError(d);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _ = (
|
|
8
|
-
var
|
|
5
|
+
var li = (d, e, t) => e in d ? ai(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
6
|
+
var bt = (d, e, t) => li(d, typeof e != "symbol" ? e + "" : e, t), it = (d, e, t) => e.has(d) || _t("Cannot " + t);
|
|
7
|
+
var _ = (d, e, t) => (it(d, e, "read from private field"), t ? t.call(d) : e.get(d)), B = (d, e, t) => e.has(d) ? _t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(d) : e.set(d, t), I = (d, e, t, i) => (it(d, e, "write to private field"), i ? i.call(d, t) : e.set(d, t), t), U = (d, e, t) => (it(d, e, "access private method"), t);
|
|
8
|
+
var ze = (d, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
|
-
I(
|
|
10
|
+
I(d, e, s, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return _(
|
|
13
|
+
return _(d, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as
|
|
17
|
-
import { msToGranularity as rt, getFieldDataSources as
|
|
18
|
-
import { SimpleChart as
|
|
19
|
-
import
|
|
16
|
+
import { ref as A, watchEffect as Mt, inject as ye, provide as hi, onMounted as at, computed as z, watch as Qe, onUnmounted as lt, defineComponent as ee, resolveComponent as me, createBlock as q, renderSlot as De, createCommentVNode as Y, unref as x, openBlock as C, withCtx as F, createVNode as ae, createTextVNode as Se, toDisplayString as ne, useCssVars as Ye, createElementVNode as ce, normalizeClass as je, mergeProps as It, createSlots as ht, createElementBlock as Q, normalizeProps as ui, guardReactiveProps as di, defineAsyncComponent as qt, readonly as st, toRef as wt, nextTick as ut, resolveDynamicComponent as Pt, toHandlers as ci, Fragment as $t, renderList as Ft, normalizeStyle as Et, mergeModels as xt, useModel as fi, getCurrentInstance as gi } from "vue";
|
|
17
|
+
import { msToGranularity as rt, getFieldDataSources as Gt, stripUnknownFilters as mi, Timeframe as pi, TimePeriods as Bt, TIMEFRAME_LOOKUP as yi, formatTime as Ct, EXPORT_RECORD_LIMIT as vi } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { 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
|
|
26
|
-
const
|
|
21
|
+
import { createI18n as Ci, i18nTComponent as Ri } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as dt } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { VisibilityOffIcon as ki, WarningIcon as Ti, EditIcon as zi, MoreIcon as Di } from "@kong/icons";
|
|
24
|
+
import { MetricsProvider as Si, MetricsConsumer as Ni } from "@kong-ui-public/analytics-metric-provider";
|
|
25
|
+
var Ut = /* @__PURE__ */ ((d) => (d.VALIDATING = "VALIDATING", d.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", d.PENDING = "PENDING", d.SUCCESS = "SUCCESS", d.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", d.ERROR = "ERROR", d.STALE_IF_ERROR = "STALE_IF_ERROR", d))(Ut || {});
|
|
26
|
+
const Li = (d) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
|
-
return
|
|
29
|
-
((e = Object.keys(
|
|
28
|
+
return d ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
|
+
((e = Object.keys(d)) != null && e.length || (t = d.data) != null && t.length || (s = (i = d.data) == null ? void 0 : i.data) != null && s.length || !((r = d.data) != null && r.data) && typeof d.data == "object" && Object.keys(d == null ? void 0 : d.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
const s =
|
|
31
|
+
function Ai(d = A({}), e, t, i = Li) {
|
|
32
|
+
const s = A(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
const r = i(
|
|
38
|
-
if (
|
|
36
|
+
return Mt(() => {
|
|
37
|
+
const r = i(d.value);
|
|
38
|
+
if (d.value && r && t.value) {
|
|
39
39
|
s.value = "VALIDATING_HAS_DATA";
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (d.value && t.value) {
|
|
43
43
|
s.value = "VALIDATING";
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (d.value && e.value) {
|
|
47
47
|
s.value = "STALE_IF_ERROR";
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
50
|
+
if (d.value === void 0 && !e.value) {
|
|
51
51
|
s.value = "PENDING";
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (d.value && !e.value && r) {
|
|
55
55
|
s.value = "SUCCESS_HAS_DATA";
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (d.value && !e.value) {
|
|
59
59
|
s.value = "SUCCESS";
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
d.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
|
-
swrvState:
|
|
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,14 +78,14 @@ const Ni = {
|
|
|
78
78
|
fullscreen: "Fullscreen",
|
|
79
79
|
remove: "Remove",
|
|
80
80
|
delete: "Delete"
|
|
81
|
-
},
|
|
81
|
+
}, Oi = {
|
|
82
82
|
forbidden: "To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator.",
|
|
83
83
|
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period",
|
|
84
84
|
timeout: "Query timed out. Consider querying a shorter time range."
|
|
85
|
-
},
|
|
85
|
+
}, Mi = {
|
|
86
86
|
defaultFilename: "Chart export",
|
|
87
87
|
exportAsCsv: "Export as CSV"
|
|
88
|
-
},
|
|
88
|
+
}, 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 = {
|
|
89
89
|
daily: "1 day",
|
|
90
90
|
fiveMinutely: "5 minutes",
|
|
91
91
|
hourly: "1 hour",
|
|
@@ -98,155 +98,155 @@ const Ni = {
|
|
|
98
98
|
twoHourly: "2 hours",
|
|
99
99
|
weekly: "1 week",
|
|
100
100
|
unknown: "Unknown"
|
|
101
|
-
},
|
|
102
|
-
renderer:
|
|
103
|
-
queryDataProvider:
|
|
104
|
-
csvExport:
|
|
105
|
-
jumpToExplore:
|
|
106
|
-
jumpToRequests:
|
|
107
|
-
query_aged_out_warning:
|
|
108
|
-
granularities:
|
|
101
|
+
}, Fi = {
|
|
102
|
+
renderer: Hi,
|
|
103
|
+
queryDataProvider: Oi,
|
|
104
|
+
csvExport: Mi,
|
|
105
|
+
jumpToExplore: Ii,
|
|
106
|
+
jumpToRequests: qi,
|
|
107
|
+
query_aged_out_warning: Pi,
|
|
108
|
+
granularities: $i
|
|
109
109
|
};
|
|
110
|
-
function
|
|
111
|
-
const
|
|
110
|
+
function Gi() {
|
|
111
|
+
const d = Ci("en-us", Fi);
|
|
112
112
|
return {
|
|
113
|
-
i18n:
|
|
114
|
-
i18nT:
|
|
113
|
+
i18n: d,
|
|
114
|
+
i18nT: Ri(d)
|
|
115
115
|
// Translation component <i18n-t>
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
const
|
|
119
|
-
function
|
|
120
|
-
const
|
|
118
|
+
const Xe = 170, Wt = 6, pe = "analytics-query-provider", Rt = "{entity-id}", Bi = "{cp-id}", Ui = "{timeframe}", Wi = 30 * 1e3, Ki = 3e5, Vi = 36e5;
|
|
119
|
+
function Qi() {
|
|
120
|
+
const d = ye(pe);
|
|
121
121
|
return {
|
|
122
|
-
evaluateFeatureFlag: (t, i) =>
|
|
122
|
+
evaluateFeatureFlag: (t, i) => d ? d.evaluateFeatureFlagFn(t, i) : i
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
125
|
+
function Yi(d) {
|
|
126
|
+
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
127
127
|
}
|
|
128
|
-
var
|
|
129
|
-
(function(
|
|
128
|
+
var Kt = { exports: {} };
|
|
129
|
+
(function(d) {
|
|
130
130
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
131
131
|
function i() {
|
|
132
132
|
}
|
|
133
133
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
134
|
-
function s(
|
|
135
|
-
this.fn =
|
|
134
|
+
function s(l, h, u) {
|
|
135
|
+
this.fn = l, this.context = h, this.once = u || !1;
|
|
136
136
|
}
|
|
137
|
-
function r(
|
|
138
|
-
if (typeof
|
|
137
|
+
function r(l, h, u, a, f) {
|
|
138
|
+
if (typeof u != "function")
|
|
139
139
|
throw new TypeError("The listener must be a function");
|
|
140
|
-
var m = new s(
|
|
141
|
-
return
|
|
140
|
+
var m = new s(u, a || l, f), g = t ? t + h : h;
|
|
141
|
+
return l._events[g] ? l._events[g].fn ? l._events[g] = [l._events[g], m] : l._events[g].push(m) : (l._events[g] = m, l._eventsCount++), l;
|
|
142
142
|
}
|
|
143
|
-
function o(
|
|
144
|
-
--
|
|
143
|
+
function o(l, h) {
|
|
144
|
+
--l._eventsCount === 0 ? l._events = new i() : delete l._events[h];
|
|
145
145
|
}
|
|
146
146
|
function n() {
|
|
147
147
|
this._events = new i(), this._eventsCount = 0;
|
|
148
148
|
}
|
|
149
149
|
n.prototype.eventNames = function() {
|
|
150
|
-
var
|
|
151
|
-
if (this._eventsCount === 0) return
|
|
152
|
-
for (a in
|
|
153
|
-
e.call(
|
|
154
|
-
return Object.getOwnPropertySymbols ?
|
|
155
|
-
}, n.prototype.listeners = function(
|
|
156
|
-
var
|
|
150
|
+
var h = [], u, a;
|
|
151
|
+
if (this._eventsCount === 0) return h;
|
|
152
|
+
for (a in u = this._events)
|
|
153
|
+
e.call(u, a) && h.push(t ? a.slice(1) : a);
|
|
154
|
+
return Object.getOwnPropertySymbols ? h.concat(Object.getOwnPropertySymbols(u)) : h;
|
|
155
|
+
}, n.prototype.listeners = function(h) {
|
|
156
|
+
var u = t ? t + h : h, a = this._events[u];
|
|
157
157
|
if (!a) return [];
|
|
158
158
|
if (a.fn) return [a.fn];
|
|
159
159
|
for (var f = 0, m = a.length, g = new Array(m); f < m; f++)
|
|
160
160
|
g[f] = a[f].fn;
|
|
161
161
|
return g;
|
|
162
|
-
}, n.prototype.listenerCount = function(
|
|
163
|
-
var
|
|
162
|
+
}, n.prototype.listenerCount = function(h) {
|
|
163
|
+
var u = t ? t + h : h, a = this._events[u];
|
|
164
164
|
return a ? a.fn ? 1 : a.length : 0;
|
|
165
|
-
}, n.prototype.emit = function(
|
|
166
|
-
var
|
|
167
|
-
if (!this._events[
|
|
168
|
-
var p = this._events[
|
|
165
|
+
}, n.prototype.emit = function(h, u, a, f, m, g) {
|
|
166
|
+
var v = t ? t + h : h;
|
|
167
|
+
if (!this._events[v]) return !1;
|
|
168
|
+
var p = this._events[v], S = arguments.length, L, R;
|
|
169
169
|
if (p.fn) {
|
|
170
|
-
switch (p.once && this.removeListener(
|
|
170
|
+
switch (p.once && this.removeListener(h, p.fn, void 0, !0), S) {
|
|
171
171
|
case 1:
|
|
172
172
|
return p.fn.call(p.context), !0;
|
|
173
173
|
case 2:
|
|
174
|
-
return p.fn.call(p.context,
|
|
174
|
+
return p.fn.call(p.context, u), !0;
|
|
175
175
|
case 3:
|
|
176
|
-
return p.fn.call(p.context,
|
|
176
|
+
return p.fn.call(p.context, u, a), !0;
|
|
177
177
|
case 4:
|
|
178
|
-
return p.fn.call(p.context,
|
|
178
|
+
return p.fn.call(p.context, u, a, f), !0;
|
|
179
179
|
case 5:
|
|
180
|
-
return p.fn.call(p.context,
|
|
180
|
+
return p.fn.call(p.context, u, a, f, m), !0;
|
|
181
181
|
case 6:
|
|
182
|
-
return p.fn.call(p.context,
|
|
182
|
+
return p.fn.call(p.context, u, a, f, m, g), !0;
|
|
183
183
|
}
|
|
184
|
-
for (
|
|
185
|
-
L[
|
|
184
|
+
for (R = 1, L = new Array(S - 1); R < S; R++)
|
|
185
|
+
L[R - 1] = arguments[R];
|
|
186
186
|
p.fn.apply(p.context, L);
|
|
187
187
|
} else {
|
|
188
|
-
var
|
|
189
|
-
for (
|
|
190
|
-
switch (p[
|
|
188
|
+
var k = p.length, G;
|
|
189
|
+
for (R = 0; R < k; R++)
|
|
190
|
+
switch (p[R].once && this.removeListener(h, p[R].fn, void 0, !0), S) {
|
|
191
191
|
case 1:
|
|
192
|
-
p[
|
|
192
|
+
p[R].fn.call(p[R].context);
|
|
193
193
|
break;
|
|
194
194
|
case 2:
|
|
195
|
-
p[
|
|
195
|
+
p[R].fn.call(p[R].context, u);
|
|
196
196
|
break;
|
|
197
197
|
case 3:
|
|
198
|
-
p[
|
|
198
|
+
p[R].fn.call(p[R].context, u, a);
|
|
199
199
|
break;
|
|
200
200
|
case 4:
|
|
201
|
-
p[
|
|
201
|
+
p[R].fn.call(p[R].context, u, a, f);
|
|
202
202
|
break;
|
|
203
203
|
default:
|
|
204
|
-
if (!L) for (
|
|
205
|
-
L[
|
|
206
|
-
p[
|
|
204
|
+
if (!L) for (G = 1, L = new Array(S - 1); G < S; G++)
|
|
205
|
+
L[G - 1] = arguments[G];
|
|
206
|
+
p[R].fn.apply(p[R].context, L);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
return !0;
|
|
210
|
-
}, n.prototype.on = function(
|
|
211
|
-
return r(this,
|
|
212
|
-
}, n.prototype.once = function(
|
|
213
|
-
return r(this,
|
|
214
|
-
}, n.prototype.removeListener = function(
|
|
215
|
-
var m = t ? t +
|
|
210
|
+
}, n.prototype.on = function(h, u, a) {
|
|
211
|
+
return r(this, h, u, a, !1);
|
|
212
|
+
}, n.prototype.once = function(h, u, a) {
|
|
213
|
+
return r(this, h, u, a, !0);
|
|
214
|
+
}, n.prototype.removeListener = function(h, u, a, f) {
|
|
215
|
+
var m = t ? t + h : h;
|
|
216
216
|
if (!this._events[m]) return this;
|
|
217
|
-
if (!
|
|
217
|
+
if (!u)
|
|
218
218
|
return o(this, m), this;
|
|
219
219
|
var g = this._events[m];
|
|
220
220
|
if (g.fn)
|
|
221
|
-
g.fn ===
|
|
221
|
+
g.fn === u && (!f || g.once) && (!a || g.context === a) && o(this, m);
|
|
222
222
|
else {
|
|
223
|
-
for (var
|
|
224
|
-
(g[
|
|
223
|
+
for (var v = 0, p = [], S = g.length; v < S; v++)
|
|
224
|
+
(g[v].fn !== u || f && !g[v].once || a && g[v].context !== a) && p.push(g[v]);
|
|
225
225
|
p.length ? this._events[m] = p.length === 1 ? p[0] : p : o(this, m);
|
|
226
226
|
}
|
|
227
227
|
return this;
|
|
228
|
-
}, n.prototype.removeAllListeners = function(
|
|
229
|
-
var
|
|
230
|
-
return
|
|
231
|
-
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n,
|
|
232
|
-
})(
|
|
233
|
-
var
|
|
234
|
-
const
|
|
235
|
-
class
|
|
228
|
+
}, n.prototype.removeAllListeners = function(h) {
|
|
229
|
+
var u;
|
|
230
|
+
return h ? (u = t ? t + h : h, this._events[u] && o(this, u)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
231
|
+
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n, d.exports = n;
|
|
232
|
+
})(Kt);
|
|
233
|
+
var ji = Kt.exports;
|
|
234
|
+
const Xi = /* @__PURE__ */ Yi(ji);
|
|
235
|
+
class Vt extends Error {
|
|
236
236
|
constructor(e) {
|
|
237
237
|
super(e), this.name = "TimeoutError";
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
class
|
|
240
|
+
class Zi extends Error {
|
|
241
241
|
constructor(e) {
|
|
242
242
|
super(), this.name = "AbortError", this.message = e;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
const
|
|
246
|
-
const e =
|
|
247
|
-
return e instanceof Error ? e :
|
|
245
|
+
const kt = (d) => globalThis.DOMException === void 0 ? new Zi(d) : new DOMException(d), Tt = (d) => {
|
|
246
|
+
const e = d.reason === void 0 ? kt("This operation was aborted.") : d.reason;
|
|
247
|
+
return e instanceof Error ? e : kt(e);
|
|
248
248
|
};
|
|
249
|
-
function
|
|
249
|
+
function Ji(d, e) {
|
|
250
250
|
const {
|
|
251
251
|
milliseconds: t,
|
|
252
252
|
fallback: i,
|
|
@@ -254,57 +254,57 @@ function ji(u, e) {
|
|
|
254
254
|
customTimers: r = { setTimeout, clearTimeout }
|
|
255
255
|
} = e;
|
|
256
256
|
let o, n;
|
|
257
|
-
const
|
|
257
|
+
const h = new Promise((u, a) => {
|
|
258
258
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
259
259
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
260
260
|
if (e.signal) {
|
|
261
261
|
const { signal: m } = e;
|
|
262
|
-
m.aborted && a(
|
|
263
|
-
a(
|
|
262
|
+
m.aborted && a(Tt(m)), n = () => {
|
|
263
|
+
a(Tt(m));
|
|
264
264
|
}, m.addEventListener("abort", n, { once: !0 });
|
|
265
265
|
}
|
|
266
266
|
if (t === Number.POSITIVE_INFINITY) {
|
|
267
|
-
|
|
267
|
+
d.then(u, a);
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
const f = new
|
|
270
|
+
const f = new Vt();
|
|
271
271
|
o = r.setTimeout.call(void 0, () => {
|
|
272
272
|
if (i) {
|
|
273
273
|
try {
|
|
274
|
-
|
|
274
|
+
u(i());
|
|
275
275
|
} catch (m) {
|
|
276
276
|
a(m);
|
|
277
277
|
}
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
typeof
|
|
280
|
+
typeof d.cancel == "function" && d.cancel(), s === !1 ? u() : s instanceof Error ? a(s) : (f.message = s ?? `Promise timed out after ${t} milliseconds`, a(f));
|
|
281
281
|
}, t), (async () => {
|
|
282
282
|
try {
|
|
283
|
-
|
|
283
|
+
u(await d);
|
|
284
284
|
} catch (m) {
|
|
285
285
|
a(m);
|
|
286
286
|
}
|
|
287
287
|
})();
|
|
288
288
|
}).finally(() => {
|
|
289
|
-
|
|
289
|
+
h.clear(), n && e.signal && e.signal.removeEventListener("abort", n);
|
|
290
290
|
});
|
|
291
|
-
return
|
|
291
|
+
return h.clear = () => {
|
|
292
292
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
293
|
-
},
|
|
293
|
+
}, h;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
let i = 0, s =
|
|
295
|
+
function es(d, e, t) {
|
|
296
|
+
let i = 0, s = d.length;
|
|
297
297
|
for (; s > 0; ) {
|
|
298
298
|
const r = Math.trunc(s / 2);
|
|
299
299
|
let o = i + r;
|
|
300
|
-
t(
|
|
300
|
+
t(d[o], e) <= 0 ? (i = ++o, s -= r + 1) : s = r;
|
|
301
301
|
}
|
|
302
302
|
return i;
|
|
303
303
|
}
|
|
304
|
-
var
|
|
305
|
-
class
|
|
304
|
+
var ie;
|
|
305
|
+
class ts {
|
|
306
306
|
constructor() {
|
|
307
|
-
|
|
307
|
+
B(this, ie, []);
|
|
308
308
|
}
|
|
309
309
|
enqueue(e, t) {
|
|
310
310
|
t = {
|
|
@@ -316,83 +316,83 @@ class Zi {
|
|
|
316
316
|
id: t.id,
|
|
317
317
|
run: e
|
|
318
318
|
};
|
|
319
|
-
if (this.size === 0 || _(this,
|
|
320
|
-
_(this,
|
|
319
|
+
if (this.size === 0 || _(this, ie)[this.size - 1].priority >= t.priority) {
|
|
320
|
+
_(this, ie).push(i);
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
|
-
const s =
|
|
324
|
-
_(this,
|
|
323
|
+
const s = es(_(this, ie), i, (r, o) => o.priority - r.priority);
|
|
324
|
+
_(this, ie).splice(s, 0, i);
|
|
325
325
|
}
|
|
326
326
|
setPriority(e, t) {
|
|
327
|
-
const i = _(this,
|
|
327
|
+
const i = _(this, ie).findIndex((r) => r.id === e);
|
|
328
328
|
if (i === -1)
|
|
329
329
|
throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
330
|
-
const [s] = _(this,
|
|
330
|
+
const [s] = _(this, ie).splice(i, 1);
|
|
331
331
|
this.enqueue(s.run, { priority: t, id: e });
|
|
332
332
|
}
|
|
333
333
|
dequeue() {
|
|
334
|
-
const e = _(this,
|
|
334
|
+
const e = _(this, ie).shift();
|
|
335
335
|
return e == null ? void 0 : e.run;
|
|
336
336
|
}
|
|
337
337
|
filter(e) {
|
|
338
|
-
return _(this,
|
|
338
|
+
return _(this, ie).filter((t) => t.priority === e.priority).map((t) => t.run);
|
|
339
339
|
}
|
|
340
340
|
get size() {
|
|
341
|
-
return _(this,
|
|
341
|
+
return _(this, ie).length;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
|
|
345
|
-
var
|
|
346
|
-
class
|
|
344
|
+
ie = new WeakMap();
|
|
345
|
+
var we, Ee, ge, Ae, xe, He, se, Ce, V, Oe, re, Re, de, Me, Ve, D, Qt, Yt, jt, Xt, Zt, Pe, nt, ot, $e, Jt, Fe;
|
|
346
|
+
class is extends Xi {
|
|
347
347
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
348
348
|
constructor(t) {
|
|
349
349
|
var i, s;
|
|
350
350
|
super();
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
351
|
+
B(this, D);
|
|
352
|
+
B(this, we);
|
|
353
|
+
B(this, Ee);
|
|
354
|
+
B(this, ge, 0);
|
|
355
|
+
B(this, Ae);
|
|
356
|
+
B(this, xe);
|
|
357
|
+
B(this, He, 0);
|
|
358
|
+
B(this, se);
|
|
359
|
+
B(this, Ce);
|
|
360
|
+
B(this, V);
|
|
361
|
+
B(this, Oe);
|
|
362
|
+
B(this, re, 0);
|
|
363
363
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
B(this, Re);
|
|
365
|
+
B(this, de);
|
|
366
|
+
B(this, Me);
|
|
367
367
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
368
|
-
|
|
368
|
+
B(this, Ve, 1n);
|
|
369
369
|
/**
|
|
370
370
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
371
371
|
|
|
372
372
|
Applies to each future operation.
|
|
373
373
|
*/
|
|
374
|
-
|
|
374
|
+
bt(this, "timeout");
|
|
375
375
|
if (t = {
|
|
376
376
|
carryoverConcurrencyCount: !1,
|
|
377
377
|
intervalCap: Number.POSITIVE_INFINITY,
|
|
378
378
|
interval: 0,
|
|
379
379
|
concurrency: Number.POSITIVE_INFINITY,
|
|
380
380
|
autoStart: !0,
|
|
381
|
-
queueClass:
|
|
381
|
+
queueClass: ts,
|
|
382
382
|
...t
|
|
383
383
|
}, !(typeof t.intervalCap == "number" && t.intervalCap >= 1))
|
|
384
384
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i = t.intervalCap) == null ? void 0 : i.toString()) ?? ""}\` (${typeof t.intervalCap})`);
|
|
385
385
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
386
386
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
387
|
-
I(this,
|
|
387
|
+
I(this, we, t.carryoverConcurrencyCount), I(this, Ee, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), I(this, Ae, t.intervalCap), I(this, xe, t.interval), I(this, V, new t.queueClass()), I(this, Oe, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, I(this, Me, t.throwOnTimeout === !0), I(this, de, t.autoStart === !1);
|
|
388
388
|
}
|
|
389
389
|
get concurrency() {
|
|
390
|
-
return _(this,
|
|
390
|
+
return _(this, Re);
|
|
391
391
|
}
|
|
392
392
|
set concurrency(t) {
|
|
393
393
|
if (!(typeof t == "number" && t >= 1))
|
|
394
394
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
395
|
-
I(this,
|
|
395
|
+
I(this, Re, t), U(this, D, $e).call(this);
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
398
398
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -431,33 +431,33 @@ class Ji extends Yi {
|
|
|
431
431
|
Here, the promise function with `id: '🦀'` executes last.
|
|
432
432
|
*/
|
|
433
433
|
setPriority(t, i) {
|
|
434
|
-
_(this,
|
|
434
|
+
_(this, V).setPriority(t, i);
|
|
435
435
|
}
|
|
436
436
|
async add(t, i = {}) {
|
|
437
|
-
return i.id ?? (i.id = (
|
|
437
|
+
return i.id ?? (i.id = (ze(this, Ve)._++).toString()), i = {
|
|
438
438
|
timeout: this.timeout,
|
|
439
|
-
throwOnTimeout: _(this,
|
|
439
|
+
throwOnTimeout: _(this, Me),
|
|
440
440
|
...i
|
|
441
441
|
}, new Promise((s, r) => {
|
|
442
|
-
_(this,
|
|
442
|
+
_(this, V).enqueue(async () => {
|
|
443
443
|
var o;
|
|
444
|
-
|
|
444
|
+
ze(this, re)._++, ze(this, ge)._++;
|
|
445
445
|
try {
|
|
446
446
|
(o = i.signal) == null || o.throwIfAborted();
|
|
447
447
|
let n = t({ signal: i.signal });
|
|
448
|
-
i.timeout && (n =
|
|
449
|
-
const
|
|
450
|
-
s(
|
|
448
|
+
i.timeout && (n = Ji(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, U(this, D, Jt).call(this, i.signal)]));
|
|
449
|
+
const l = await n;
|
|
450
|
+
s(l), this.emit("completed", l);
|
|
451
451
|
} catch (n) {
|
|
452
|
-
if (n instanceof
|
|
452
|
+
if (n instanceof Vt && !i.throwOnTimeout) {
|
|
453
453
|
s();
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
456
456
|
r(n), this.emit("error", n);
|
|
457
457
|
} finally {
|
|
458
|
-
|
|
458
|
+
U(this, D, jt).call(this);
|
|
459
459
|
}
|
|
460
|
-
}, i), this.emit("add"),
|
|
460
|
+
}, i), this.emit("add"), U(this, D, Pe).call(this);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
async addAll(t, i) {
|
|
@@ -467,19 +467,19 @@ class Ji extends Yi {
|
|
|
467
467
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
468
468
|
*/
|
|
469
469
|
start() {
|
|
470
|
-
return _(this,
|
|
470
|
+
return _(this, de) ? (I(this, de, !1), U(this, D, $e).call(this), this) : this;
|
|
471
471
|
}
|
|
472
472
|
/**
|
|
473
473
|
Put queue execution on hold.
|
|
474
474
|
*/
|
|
475
475
|
pause() {
|
|
476
|
-
I(this,
|
|
476
|
+
I(this, de, !0);
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
479
|
Clear the queue.
|
|
480
480
|
*/
|
|
481
481
|
clear() {
|
|
482
|
-
I(this,
|
|
482
|
+
I(this, V, new (_(this, Oe))());
|
|
483
483
|
}
|
|
484
484
|
/**
|
|
485
485
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -487,7 +487,7 @@ class Ji extends Yi {
|
|
|
487
487
|
@returns A promise that settles when the queue becomes empty.
|
|
488
488
|
*/
|
|
489
489
|
async onEmpty() {
|
|
490
|
-
_(this,
|
|
490
|
+
_(this, V).size !== 0 && await U(this, D, Fe).call(this, "empty");
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
493
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -497,7 +497,7 @@ class Ji extends Yi {
|
|
|
497
497
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
498
498
|
*/
|
|
499
499
|
async onSizeLessThan(t) {
|
|
500
|
-
_(this,
|
|
500
|
+
_(this, V).size < t || await U(this, D, Fe).call(this, "next", () => _(this, V).size < t);
|
|
501
501
|
}
|
|
502
502
|
/**
|
|
503
503
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -505,13 +505,13 @@ class Ji extends Yi {
|
|
|
505
505
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
506
506
|
*/
|
|
507
507
|
async onIdle() {
|
|
508
|
-
_(this,
|
|
508
|
+
_(this, re) === 0 && _(this, V).size === 0 || await U(this, D, Fe).call(this, "idle");
|
|
509
509
|
}
|
|
510
510
|
/**
|
|
511
511
|
Size of the queue, the number of queued items waiting to run.
|
|
512
512
|
*/
|
|
513
513
|
get size() {
|
|
514
|
-
return _(this,
|
|
514
|
+
return _(this, V).size;
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
517
|
Size of the queue, filtered by the given options.
|
|
@@ -519,71 +519,71 @@ class Ji extends Yi {
|
|
|
519
519
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
520
520
|
*/
|
|
521
521
|
sizeBy(t) {
|
|
522
|
-
return _(this,
|
|
522
|
+
return _(this, V).filter(t).length;
|
|
523
523
|
}
|
|
524
524
|
/**
|
|
525
525
|
Number of running items (no longer in the queue).
|
|
526
526
|
*/
|
|
527
527
|
get pending() {
|
|
528
|
-
return _(this,
|
|
528
|
+
return _(this, re);
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
531
531
|
Whether the queue is currently paused.
|
|
532
532
|
*/
|
|
533
533
|
get isPaused() {
|
|
534
|
-
return _(this,
|
|
534
|
+
return _(this, de);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
|
|
538
|
-
return _(this,
|
|
537
|
+
we = new WeakMap(), Ee = new WeakMap(), ge = new WeakMap(), Ae = new WeakMap(), xe = new WeakMap(), He = new WeakMap(), se = new WeakMap(), Ce = new WeakMap(), V = new WeakMap(), Oe = new WeakMap(), re = new WeakMap(), Re = new WeakMap(), de = new WeakMap(), Me = new WeakMap(), Ve = new WeakMap(), D = new WeakSet(), Qt = function() {
|
|
538
|
+
return _(this, Ee) || _(this, ge) < _(this, Ae);
|
|
539
|
+
}, Yt = function() {
|
|
540
|
+
return _(this, re) < _(this, Re);
|
|
539
541
|
}, jt = function() {
|
|
540
|
-
|
|
542
|
+
ze(this, re)._--, U(this, D, Pe).call(this), this.emit("next");
|
|
541
543
|
}, Xt = function() {
|
|
542
|
-
|
|
544
|
+
U(this, D, ot).call(this), U(this, D, nt).call(this), I(this, Ce, void 0);
|
|
543
545
|
}, Zt = function() {
|
|
544
|
-
W(this, S, ot).call(this), W(this, S, nt).call(this), I(this, xe, void 0);
|
|
545
|
-
}, Jt = function() {
|
|
546
546
|
const t = Date.now();
|
|
547
|
-
if (_(this,
|
|
548
|
-
const i = _(this,
|
|
547
|
+
if (_(this, se) === void 0) {
|
|
548
|
+
const i = _(this, He) - t;
|
|
549
549
|
if (i < 0)
|
|
550
|
-
I(this,
|
|
550
|
+
I(this, ge, _(this, we) ? _(this, re) : 0);
|
|
551
551
|
else
|
|
552
|
-
return _(this,
|
|
553
|
-
|
|
552
|
+
return _(this, Ce) === void 0 && I(this, Ce, setTimeout(() => {
|
|
553
|
+
U(this, D, Xt).call(this);
|
|
554
554
|
}, i)), !0;
|
|
555
555
|
}
|
|
556
556
|
return !1;
|
|
557
|
-
},
|
|
558
|
-
if (_(this,
|
|
559
|
-
return _(this,
|
|
560
|
-
if (!_(this,
|
|
561
|
-
const t = !_(this,
|
|
562
|
-
if (_(this,
|
|
563
|
-
const i = _(this,
|
|
564
|
-
return i ? (this.emit("active"), i(), t &&
|
|
557
|
+
}, Pe = function() {
|
|
558
|
+
if (_(this, V).size === 0)
|
|
559
|
+
return _(this, se) && clearInterval(_(this, se)), I(this, se, void 0), this.emit("empty"), _(this, re) === 0 && this.emit("idle"), !1;
|
|
560
|
+
if (!_(this, de)) {
|
|
561
|
+
const t = !_(this, D, Zt);
|
|
562
|
+
if (_(this, D, Qt) && _(this, D, Yt)) {
|
|
563
|
+
const i = _(this, V).dequeue();
|
|
564
|
+
return i ? (this.emit("active"), i(), t && U(this, D, nt).call(this), !0) : !1;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
return !1;
|
|
568
568
|
}, nt = function() {
|
|
569
|
-
_(this,
|
|
570
|
-
|
|
571
|
-
}, _(this,
|
|
569
|
+
_(this, Ee) || _(this, se) !== void 0 || (I(this, se, setInterval(() => {
|
|
570
|
+
U(this, D, ot).call(this);
|
|
571
|
+
}, _(this, xe))), I(this, He, Date.now() + _(this, xe)));
|
|
572
572
|
}, ot = function() {
|
|
573
|
-
_(this,
|
|
573
|
+
_(this, ge) === 0 && _(this, re) === 0 && _(this, se) && (clearInterval(_(this, se)), I(this, se, void 0)), I(this, ge, _(this, we) ? _(this, re) : 0), U(this, D, $e).call(this);
|
|
574
574
|
}, /**
|
|
575
575
|
Executes all queued functions until it reaches the limit.
|
|
576
576
|
*/
|
|
577
|
-
|
|
578
|
-
for (;
|
|
577
|
+
$e = function() {
|
|
578
|
+
for (; U(this, D, Pe).call(this); )
|
|
579
579
|
;
|
|
580
|
-
},
|
|
580
|
+
}, Jt = async function(t) {
|
|
581
581
|
return new Promise((i, s) => {
|
|
582
582
|
t.addEventListener("abort", () => {
|
|
583
583
|
s(t.reason);
|
|
584
584
|
}, { once: !0 });
|
|
585
585
|
});
|
|
586
|
-
},
|
|
586
|
+
}, Fe = async function(t, i) {
|
|
587
587
|
return new Promise((s) => {
|
|
588
588
|
const r = () => {
|
|
589
589
|
i && !i() || (this.off(t, r), s());
|
|
@@ -591,108 +591,145 @@ Fe = function() {
|
|
|
591
591
|
this.on(t, r);
|
|
592
592
|
});
|
|
593
593
|
};
|
|
594
|
-
const
|
|
595
|
-
const
|
|
594
|
+
const ss = () => {
|
|
595
|
+
const d = dt(), e = ye(pe);
|
|
596
596
|
if (!e)
|
|
597
597
|
return;
|
|
598
598
|
if (e.queryFnOverride) {
|
|
599
599
|
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.");
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
|
-
const t = new
|
|
602
|
+
const t = new is({
|
|
603
603
|
carryoverConcurrencyCount: !0,
|
|
604
|
-
concurrency:
|
|
605
|
-
interval:
|
|
606
|
-
intervalCap:
|
|
604
|
+
concurrency: d.maxParallelRequests,
|
|
605
|
+
interval: d.requestInterval,
|
|
606
|
+
intervalCap: d.requestIntervalCap
|
|
607
607
|
}), i = {
|
|
608
608
|
...e,
|
|
609
609
|
queryFnOverride: !0,
|
|
610
610
|
queryFn: (s, r) => t.add(() => e.queryFn(s, r), { throwOnTimeout: !0 })
|
|
611
611
|
};
|
|
612
|
-
|
|
612
|
+
hi(pe, i);
|
|
613
613
|
};
|
|
614
|
-
function
|
|
615
|
-
queryBridge:
|
|
614
|
+
function rs({
|
|
615
|
+
queryBridge: d,
|
|
616
616
|
context: e,
|
|
617
617
|
definition: t,
|
|
618
618
|
chartData: i
|
|
619
619
|
}) {
|
|
620
|
-
const { evaluateFeatureFlag: s } =
|
|
620
|
+
const { evaluateFeatureFlag: s } = ue.useEvaluateFeatureFlag(), r = A(""), o = A(""), n = A(void 0), l = A(void 0), h = s("analytics-chart-zoom-actions", !0), u = dt();
|
|
621
621
|
at(async () => {
|
|
622
|
-
var
|
|
623
|
-
r.value = await ((
|
|
622
|
+
var T, H;
|
|
623
|
+
r.value = await ((T = d == null ? void 0 : d.exploreBaseUrl) == null ? void 0 : T.call(d)) ?? "", o.value = await ((H = d == null ? void 0 : d.requestsBaseUrl) == null ? void 0 : H.call(d)) ?? "";
|
|
624
624
|
});
|
|
625
|
-
const a =
|
|
626
|
-
var
|
|
627
|
-
const
|
|
628
|
-
return
|
|
629
|
-
}),
|
|
625
|
+
const a = z(() => u.analytics && u.percentiles), f = z(() => !["golden_signals", "top_n", "gauge"].includes(t.value.chart.type)), m = z(() => h && o.value && t.value.query && t.value.query.datasource !== "llm_usage" && a.value), g = z(() => r.value && t.value.query && ["basic", "api_usage", "llm_usage", void 0].includes(t.value.query.datasource) && a.value), v = z(() => i.value ? rt(i.value.meta.granularity_ms) : void 0), p = z(() => {
|
|
626
|
+
var j;
|
|
627
|
+
const T = [...e.value.filters, ...t.value.query.filters ?? []], H = ((j = t.value.query) == null ? void 0 : j.datasource) ?? "api_usage";
|
|
628
|
+
return T.filter((W) => Gt(W.field).some((E) => H === E));
|
|
629
|
+
}), S = z(() => {
|
|
630
630
|
if (!g.value || !f.value)
|
|
631
631
|
return "";
|
|
632
|
-
const
|
|
633
|
-
return
|
|
634
|
-
}), L =
|
|
632
|
+
const T = p.value, H = t.value.query.time_range || e.value.timeSpec, j = _e(H, T);
|
|
633
|
+
return be(j);
|
|
634
|
+
}), L = z(() => {
|
|
635
635
|
if (!m.value || !f.value)
|
|
636
636
|
return "";
|
|
637
|
-
const
|
|
637
|
+
const T = p.value, H = k(
|
|
638
638
|
t.value.query.time_range || e.value.timeSpec,
|
|
639
|
-
|
|
639
|
+
T
|
|
640
640
|
);
|
|
641
|
-
return
|
|
642
|
-
}),
|
|
643
|
-
var
|
|
641
|
+
return R(H);
|
|
642
|
+
}), R = (T) => m.value ? `${o.value}?q=${JSON.stringify(T)}` : "", k = (T, H) => {
|
|
643
|
+
var j, W;
|
|
644
644
|
return {
|
|
645
|
-
filter:
|
|
645
|
+
filter: H,
|
|
646
646
|
timeframe: {
|
|
647
|
-
timePeriodsKey:
|
|
648
|
-
start:
|
|
649
|
-
end:
|
|
647
|
+
timePeriodsKey: T.type === "relative" ? T.time_range : "custom",
|
|
648
|
+
start: T.type === "absolute" ? (j = i.value) == null ? void 0 : j.meta.start_ms : void 0,
|
|
649
|
+
end: T.type === "absolute" ? (W = i.value) == null ? void 0 : W.meta.end_ms : void 0
|
|
650
650
|
}
|
|
651
651
|
};
|
|
652
|
-
},
|
|
653
|
-
filter:
|
|
652
|
+
}, G = (T, H) => ({
|
|
653
|
+
filter: H,
|
|
654
654
|
timeframe: {
|
|
655
|
-
timePeriodsKey:
|
|
656
|
-
start:
|
|
657
|
-
end:
|
|
655
|
+
timePeriodsKey: T.type === "relative" ? T.time_range : "custom",
|
|
656
|
+
start: T.type === "absolute" ? T.start : void 0,
|
|
657
|
+
end: T.type === "absolute" ? T.end : void 0
|
|
658
658
|
}
|
|
659
|
-
}),
|
|
660
|
-
const
|
|
659
|
+
}), _e = (T, H) => {
|
|
660
|
+
const j = t.value.query.dimensions ?? [];
|
|
661
661
|
return {
|
|
662
|
-
filters:
|
|
662
|
+
filters: H,
|
|
663
663
|
metrics: t.value.query.metrics ?? [],
|
|
664
|
-
dimensions:
|
|
665
|
-
time_range:
|
|
666
|
-
granularity: t.value.query.granularity ||
|
|
664
|
+
dimensions: j,
|
|
665
|
+
time_range: T,
|
|
666
|
+
granularity: t.value.query.granularity || v.value
|
|
667
667
|
};
|
|
668
|
-
},
|
|
668
|
+
}, be = (T) => {
|
|
669
669
|
if (!g.value)
|
|
670
670
|
return "";
|
|
671
|
-
const
|
|
672
|
-
return `${r.value}?q=${JSON.stringify(
|
|
671
|
+
const H = ["api_usage", "llm_usage"].includes(t.value.query.datasource) ? t.value.query.datasource : "api_usage";
|
|
672
|
+
return `${r.value}?q=${JSON.stringify(T)}&d=${H}&c=${t.value.chart.type}`;
|
|
673
673
|
};
|
|
674
|
-
return Qe([m, g], ([
|
|
675
|
-
|
|
674
|
+
return Qe([m, g], ([T, H]) => {
|
|
675
|
+
T && (n.value = { href: "" }), H && (l.value = { href: "" });
|
|
676
676
|
}), {
|
|
677
|
-
exploreLinkKebabMenu:
|
|
677
|
+
exploreLinkKebabMenu: S,
|
|
678
678
|
requestsLinkKebabMenu: L,
|
|
679
679
|
canShowKebabMenu: f,
|
|
680
680
|
canGenerateRequestsLink: m,
|
|
681
681
|
canGenerateExploreLink: g,
|
|
682
682
|
requestsLinkZoomActions: n,
|
|
683
|
-
exploreLinkZoomActions:
|
|
684
|
-
buildExploreQuery:
|
|
685
|
-
buildRequestsQueryZoomActions:
|
|
686
|
-
buildExploreLink:
|
|
687
|
-
buildRequestLink:
|
|
683
|
+
exploreLinkZoomActions: l,
|
|
684
|
+
buildExploreQuery: _e,
|
|
685
|
+
buildRequestsQueryZoomActions: G,
|
|
686
|
+
buildExploreLink: be,
|
|
687
|
+
buildRequestLink: R
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
690
|
+
const ns = (d, e, t) => {
|
|
691
|
+
const i = [];
|
|
692
|
+
return e && i.push(...e), i.push(...mi(d, t)), i;
|
|
693
|
+
};
|
|
694
|
+
function os() {
|
|
695
|
+
const d = ye(pe), e = new AbortController();
|
|
696
|
+
return lt(() => {
|
|
697
|
+
e.abort();
|
|
698
|
+
}), { issueQuery: async (i, s, r) => {
|
|
699
|
+
if (!d)
|
|
700
|
+
throw new Error("Query bridge is not defined");
|
|
701
|
+
const {
|
|
702
|
+
datasource: o,
|
|
703
|
+
limit: n,
|
|
704
|
+
...l
|
|
705
|
+
} = i, h = o || "basic", u = ns(h, i.filters, s.filters);
|
|
706
|
+
let a = i.time_range;
|
|
707
|
+
a ? a.tz || (a = {
|
|
708
|
+
...a,
|
|
709
|
+
tz: s.tz
|
|
710
|
+
}) : a = {
|
|
711
|
+
...s.timeSpec,
|
|
712
|
+
tz: s.tz
|
|
713
|
+
};
|
|
714
|
+
const f = {
|
|
715
|
+
datasource: h,
|
|
716
|
+
query: {
|
|
717
|
+
...l,
|
|
718
|
+
time_range: a,
|
|
719
|
+
filters: u,
|
|
720
|
+
limit: r ?? n
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
return d.queryFn(f, e);
|
|
724
|
+
} };
|
|
725
|
+
}
|
|
726
|
+
const ue = {
|
|
727
|
+
useContextLinks: rs,
|
|
728
|
+
useEvaluateFeatureFlag: Qi,
|
|
729
|
+
useI18n: Gi,
|
|
730
|
+
useIssueQuery: os,
|
|
731
|
+
useRequestQueue: ss
|
|
732
|
+
}, ct = /* @__PURE__ */ ee({
|
|
696
733
|
__name: "QueryDataProvider",
|
|
697
734
|
props: {
|
|
698
735
|
context: {},
|
|
@@ -701,54 +738,26 @@ const ye = {
|
|
|
701
738
|
refreshCounter: {}
|
|
702
739
|
},
|
|
703
740
|
emits: ["chart-data", "queryComplete"],
|
|
704
|
-
setup(
|
|
705
|
-
const t =
|
|
706
|
-
|
|
707
|
-
n.abort();
|
|
708
|
-
});
|
|
709
|
-
const h = (z, L, k) => {
|
|
710
|
-
const O = [];
|
|
711
|
-
return L && O.push(...L), O.push(...fi(z, k)), O;
|
|
712
|
-
}, { data: l, error: d, isValidating: a } = bi(o, async () => {
|
|
713
|
-
var z, L, k, O;
|
|
741
|
+
setup(d, { emit: e }) {
|
|
742
|
+
const t = d, i = e, { i18n: s } = ue.useI18n(), { issueQuery: r } = ue.useIssueQuery(), o = ye(pe), n = () => t.queryReady && o ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, { data: l, error: h, isValidating: u } = xi(n, async () => {
|
|
743
|
+
var p, S, L, R;
|
|
714
744
|
try {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
E || (E = "basic");
|
|
720
|
-
const fe = h(E, t.query.filters, t.context.filters);
|
|
721
|
-
let C = t.query.time_range;
|
|
722
|
-
C ? C.tz || (C = {
|
|
723
|
-
...C,
|
|
724
|
-
tz: t.context.tz
|
|
725
|
-
}) : C = {
|
|
726
|
-
...t.context.timeSpec,
|
|
727
|
-
tz: t.context.tz
|
|
728
|
-
};
|
|
729
|
-
const A = {
|
|
730
|
-
datasource: E,
|
|
731
|
-
query: {
|
|
732
|
-
...re,
|
|
733
|
-
time_range: C,
|
|
734
|
-
filters: fe
|
|
735
|
-
}
|
|
736
|
-
}, K = await (r == null ? void 0 : r.queryFn(A, n));
|
|
737
|
-
return g.value = null, K;
|
|
738
|
-
} catch (E) {
|
|
739
|
-
throw (E == null ? void 0 : E.status) === 403 ? g.value = {
|
|
745
|
+
const k = await r(t.query, t.context);
|
|
746
|
+
return m.value = null, k;
|
|
747
|
+
} catch (k) {
|
|
748
|
+
throw (k == null ? void 0 : k.status) === 403 ? m.value = {
|
|
740
749
|
message: s.t("queryDataProvider.forbidden"),
|
|
741
750
|
type: "forbidden"
|
|
742
|
-
} : (
|
|
751
|
+
} : (k == null ? void 0 : k.status) === 408 ? m.value = {
|
|
743
752
|
message: s.t("queryDataProvider.timeout"),
|
|
744
753
|
type: "timeout"
|
|
745
|
-
} : ((
|
|
754
|
+
} : ((S = (p = k == null ? void 0 : k.response) == null ? void 0 : p.data) == null ? void 0 : S.message) === "Range not allowed for this tier" ? m.value = {
|
|
746
755
|
message: s.t("queryDataProvider.timeRangeExceeded"),
|
|
747
756
|
type: "range_exceeded"
|
|
748
|
-
} :
|
|
749
|
-
message: ((
|
|
757
|
+
} : m.value = {
|
|
758
|
+
message: ((R = (L = k == null ? void 0 : k.response) == null ? void 0 : L.data) == null ? void 0 : R.message) || (k == null ? void 0 : k.message),
|
|
750
759
|
type: "other"
|
|
751
|
-
},
|
|
760
|
+
}, k;
|
|
752
761
|
} finally {
|
|
753
762
|
i("queryComplete");
|
|
754
763
|
}
|
|
@@ -756,48 +765,48 @@ const ye = {
|
|
|
756
765
|
refreshInterval: t.context.refreshInterval,
|
|
757
766
|
revalidateOnFocus: !1,
|
|
758
767
|
shouldRetryOnError: !1
|
|
759
|
-
}), { state:
|
|
760
|
-
return Qe(l, (
|
|
761
|
-
|
|
762
|
-
}), (
|
|
763
|
-
var
|
|
764
|
-
const
|
|
765
|
-
return
|
|
768
|
+
}), { state: a, swrvState: f } = Ai(l, h, u), m = A(null), g = z(() => a.value === f.ERROR || !!m.value), v = z(() => !t.queryReady || a.value === f.PENDING);
|
|
769
|
+
return Qe(l, (p) => {
|
|
770
|
+
p && i("chart-data", p);
|
|
771
|
+
}), (p, S) => {
|
|
772
|
+
var k;
|
|
773
|
+
const L = me("KSkeleton"), R = me("KEmptyState");
|
|
774
|
+
return v.value || !x(l) && !g.value ? (C(), q(L, {
|
|
766
775
|
key: 0,
|
|
767
776
|
class: "chart-skeleton",
|
|
768
777
|
type: "table"
|
|
769
|
-
})) :
|
|
778
|
+
})) : g.value && ((k = m.value) == null ? void 0 : k.type) === "forbidden" ? (C(), q(R, {
|
|
770
779
|
key: 1,
|
|
771
780
|
"action-button-visible": !1,
|
|
772
781
|
"data-testid": "chart-forbidden-state"
|
|
773
782
|
}, {
|
|
774
783
|
default: F(() => [
|
|
775
|
-
|
|
784
|
+
Se(ne(m.value.message), 1)
|
|
776
785
|
]),
|
|
777
786
|
icon: F(() => [
|
|
778
|
-
|
|
787
|
+
ae(x(ki))
|
|
779
788
|
]),
|
|
780
789
|
_: 1
|
|
781
|
-
})) :
|
|
790
|
+
})) : g.value ? (C(), q(R, {
|
|
782
791
|
key: 2,
|
|
783
792
|
"action-button-visible": !1,
|
|
784
793
|
"data-testid": "chart-empty-state",
|
|
785
794
|
"icon-variant": "error"
|
|
786
795
|
}, {
|
|
787
796
|
default: F(() => {
|
|
788
|
-
var
|
|
797
|
+
var G;
|
|
789
798
|
return [
|
|
790
|
-
|
|
799
|
+
Se(ne((G = m.value) == null ? void 0 : G.message), 1)
|
|
791
800
|
];
|
|
792
801
|
}),
|
|
793
802
|
_: 1
|
|
794
|
-
})) :
|
|
803
|
+
})) : x(l) ? De(p.$slots, "default", {
|
|
795
804
|
key: 3,
|
|
796
|
-
data:
|
|
797
|
-
}) :
|
|
805
|
+
data: x(l)
|
|
806
|
+
}) : Y("", !0);
|
|
798
807
|
};
|
|
799
808
|
}
|
|
800
|
-
}),
|
|
809
|
+
}), as = /* @__PURE__ */ ee({
|
|
801
810
|
__name: "SimpleChartRenderer",
|
|
802
811
|
props: {
|
|
803
812
|
query: {},
|
|
@@ -809,12 +818,12 @@ const ye = {
|
|
|
809
818
|
requestsLink: {},
|
|
810
819
|
exploreLink: {}
|
|
811
820
|
},
|
|
812
|
-
setup(
|
|
813
|
-
|
|
821
|
+
setup(d) {
|
|
822
|
+
Ye((i) => ({
|
|
814
823
|
"088169ae": `${i.height}px`
|
|
815
824
|
}));
|
|
816
|
-
const e =
|
|
817
|
-
return (i, s) => (
|
|
825
|
+
const e = d, t = z(() => e.chartOptions.type === "single_value");
|
|
826
|
+
return (i, s) => (C(), q(ct, {
|
|
818
827
|
context: i.context,
|
|
819
828
|
query: i.query,
|
|
820
829
|
"query-ready": i.queryReady,
|
|
@@ -822,9 +831,9 @@ const ye = {
|
|
|
822
831
|
}, {
|
|
823
832
|
default: F(({ data: r }) => [
|
|
824
833
|
ce("div", {
|
|
825
|
-
class:
|
|
834
|
+
class: je(["analytics-chart", { "single-value": t.value }])
|
|
826
835
|
}, [
|
|
827
|
-
|
|
836
|
+
ae(x(_i), {
|
|
828
837
|
"chart-data": r,
|
|
829
838
|
"chart-options": i.chartOptions,
|
|
830
839
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.synthetics_data_key
|
|
@@ -834,12 +843,12 @@ const ye = {
|
|
|
834
843
|
_: 1
|
|
835
844
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
836
845
|
}
|
|
837
|
-
}),
|
|
838
|
-
const t =
|
|
846
|
+
}), ve = (d, e) => {
|
|
847
|
+
const t = d.__vccOpts || d;
|
|
839
848
|
for (const [i, s] of e)
|
|
840
849
|
t[i] = s;
|
|
841
850
|
return t;
|
|
842
|
-
},
|
|
851
|
+
}, zt = /* @__PURE__ */ ve(as, [["__scopeId", "data-v-1e9ff912"]]), ls = { class: "analytics-chart" }, hs = /* @__PURE__ */ ee({
|
|
843
852
|
__name: "BaseAnalyticsChartRenderer",
|
|
844
853
|
props: {
|
|
845
854
|
query: {},
|
|
@@ -853,47 +862,47 @@ const ye = {
|
|
|
853
862
|
extraProps: {}
|
|
854
863
|
},
|
|
855
864
|
emits: ["edit-tile", "chart-data", "zoom-time-range", "view-requests", "select-chart-range"],
|
|
856
|
-
setup(
|
|
857
|
-
const t =
|
|
865
|
+
setup(d, { emit: e }) {
|
|
866
|
+
const t = d, i = e, { i18n: s } = ue.useI18n(), { evaluateFeatureFlag: r } = ue.useEvaluateFeatureFlag(), o = r("ma-4135-allow-zooming-all-dashboard-tiles", !1), n = z(() => ({
|
|
858
867
|
type: t.chartOptions.type,
|
|
859
868
|
stacked: t.chartOptions.stacked ?? !1,
|
|
860
869
|
chartDatasetColors: t.chartOptions.chart_dataset_colors,
|
|
861
870
|
threshold: t.chartOptions.threshold
|
|
862
|
-
})),
|
|
871
|
+
})), l = z(() => o ? t.context.zoomable : t.context.zoomable && !t.query.time_range), h = () => {
|
|
863
872
|
i("edit-tile");
|
|
864
|
-
},
|
|
873
|
+
}, u = (a) => {
|
|
865
874
|
i("chart-data", a);
|
|
866
875
|
};
|
|
867
876
|
return (a, f) => {
|
|
868
|
-
const m =
|
|
869
|
-
return
|
|
877
|
+
const m = me("KDropdownItem");
|
|
878
|
+
return C(), q(ct, {
|
|
870
879
|
context: a.context,
|
|
871
880
|
query: a.query,
|
|
872
881
|
"query-ready": a.queryReady,
|
|
873
882
|
"refresh-counter": a.refreshCounter,
|
|
874
|
-
onChartData:
|
|
883
|
+
onChartData: u
|
|
875
884
|
}, {
|
|
876
885
|
default: F(({ data: g }) => [
|
|
877
|
-
ce("div",
|
|
878
|
-
|
|
886
|
+
ce("div", ls, [
|
|
887
|
+
ae(x(bi), It({
|
|
879
888
|
"chart-data": g,
|
|
880
889
|
"chart-options": n.value,
|
|
881
890
|
"explore-link": a.exploreLink,
|
|
882
891
|
"legend-position": "bottom",
|
|
883
892
|
"requests-link": a.requestsLink,
|
|
884
893
|
"synthetics-data-key": a.chartOptions.synthetics_data_key,
|
|
885
|
-
"timeseries-zoom":
|
|
894
|
+
"timeseries-zoom": l.value,
|
|
886
895
|
"tooltip-title": ""
|
|
887
896
|
}, a.extraProps, {
|
|
888
|
-
onSelectChartRange: f[0] || (f[0] = (
|
|
889
|
-
onZoomTimeRange: f[1] || (f[1] = (
|
|
897
|
+
onSelectChartRange: f[0] || (f[0] = (v) => i("select-chart-range", v)),
|
|
898
|
+
onZoomTimeRange: f[1] || (f[1] = (v) => i("zoom-time-range", v))
|
|
890
899
|
}), ht({ _: 2 }, [
|
|
891
900
|
a.context.editable ? {
|
|
892
901
|
name: "menu-items",
|
|
893
902
|
fn: F(() => [
|
|
894
|
-
|
|
903
|
+
ae(m, { onClick: h }, {
|
|
895
904
|
default: F(() => [
|
|
896
|
-
|
|
905
|
+
Se(ne(x(s).t("renderer.edit")), 1)
|
|
897
906
|
]),
|
|
898
907
|
_: 1
|
|
899
908
|
})
|
|
@@ -907,7 +916,7 @@ const ye = {
|
|
|
907
916
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
908
917
|
};
|
|
909
918
|
}
|
|
910
|
-
}), ft = /* @__PURE__ */
|
|
919
|
+
}), ft = /* @__PURE__ */ ve(hs, [["__scopeId", "data-v-965790dd"]]), Dt = /* @__PURE__ */ ee({
|
|
911
920
|
__name: "BarChartRenderer",
|
|
912
921
|
props: {
|
|
913
922
|
query: {},
|
|
@@ -919,8 +928,8 @@ const ye = {
|
|
|
919
928
|
requestsLink: {},
|
|
920
929
|
exploreLink: {}
|
|
921
930
|
},
|
|
922
|
-
setup(
|
|
923
|
-
return (e, t) => (
|
|
931
|
+
setup(d) {
|
|
932
|
+
return (e, t) => (C(), q(ft, {
|
|
924
933
|
"chart-options": e.chartOptions,
|
|
925
934
|
context: e.context,
|
|
926
935
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -930,7 +939,7 @@ const ye = {
|
|
|
930
939
|
"refresh-counter": e.refreshCounter
|
|
931
940
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
932
941
|
}
|
|
933
|
-
}),
|
|
942
|
+
}), St = /* @__PURE__ */ ee({
|
|
934
943
|
__name: "TimeseriesChartRenderer",
|
|
935
944
|
props: {
|
|
936
945
|
query: {},
|
|
@@ -943,9 +952,9 @@ const ye = {
|
|
|
943
952
|
exploreLink: {}
|
|
944
953
|
},
|
|
945
954
|
emits: ["zoom-time-range", "select-chart-range"],
|
|
946
|
-
setup(
|
|
955
|
+
setup(d, { emit: e }) {
|
|
947
956
|
const t = e;
|
|
948
|
-
return (i, s) => (
|
|
957
|
+
return (i, s) => (C(), q(ft, {
|
|
949
958
|
"chart-options": i.chartOptions,
|
|
950
959
|
context: i.context,
|
|
951
960
|
"explore-link": i.exploreLink,
|
|
@@ -958,7 +967,7 @@ const ye = {
|
|
|
958
967
|
onZoomTimeRange: s[1] || (s[1] = (r) => t("zoom-time-range", r))
|
|
959
968
|
}, null, 8, ["chart-options", "context", "explore-link", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
960
969
|
}
|
|
961
|
-
}),
|
|
970
|
+
}), us = { class: "metric-card-tile-wrapper" }, ds = /* @__PURE__ */ ee({
|
|
962
971
|
__name: "GoldenSignalsRenderer",
|
|
963
972
|
props: {
|
|
964
973
|
query: {},
|
|
@@ -970,11 +979,11 @@ const ye = {
|
|
|
970
979
|
requestsLink: {},
|
|
971
980
|
exploreLink: {}
|
|
972
981
|
},
|
|
973
|
-
setup(
|
|
974
|
-
const e =
|
|
982
|
+
setup(d) {
|
|
983
|
+
const e = d, t = z(() => {
|
|
975
984
|
const s = e.context.timeSpec;
|
|
976
985
|
if (s.type === "absolute")
|
|
977
|
-
return new
|
|
986
|
+
return new pi({
|
|
978
987
|
key: "custom",
|
|
979
988
|
timeframeText: "custom",
|
|
980
989
|
display: "custom",
|
|
@@ -990,7 +999,7 @@ const ye = {
|
|
|
990
999
|
if (!r)
|
|
991
1000
|
throw new Error("Unknown time range");
|
|
992
1001
|
return r;
|
|
993
|
-
}), i =
|
|
1002
|
+
}), i = z(() => {
|
|
994
1003
|
var r, o;
|
|
995
1004
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
996
1005
|
if (s && s !== "api_usage" && s !== "basic")
|
|
@@ -1008,27 +1017,27 @@ const ye = {
|
|
|
1008
1017
|
refreshCounter: e.refreshCounter
|
|
1009
1018
|
};
|
|
1010
1019
|
});
|
|
1011
|
-
return (s, r) => (
|
|
1012
|
-
|
|
1020
|
+
return (s, r) => (C(), Q("div", us, [
|
|
1021
|
+
ae(x(Si), ui(di(i.value)), {
|
|
1013
1022
|
default: F(() => [
|
|
1014
|
-
|
|
1023
|
+
ae(x(Ni))
|
|
1015
1024
|
]),
|
|
1016
1025
|
_: 1
|
|
1017
1026
|
}, 16)
|
|
1018
1027
|
]));
|
|
1019
1028
|
}
|
|
1020
|
-
}),
|
|
1029
|
+
}), cs = /* @__PURE__ */ ve(ds, [["__scopeId", "data-v-7e1b1cc1"]]), Nt = "#6c7489", fs = "12px", Lt = "20px", ei = "20px", gs = {
|
|
1021
1030
|
class: "fallback-entity-link",
|
|
1022
1031
|
"data-testid": "entity-link-parent"
|
|
1023
|
-
},
|
|
1032
|
+
}, At = /* @__PURE__ */ ee({
|
|
1024
1033
|
__name: "FallbackEntityLink",
|
|
1025
1034
|
props: {
|
|
1026
1035
|
entityLinkData: {}
|
|
1027
1036
|
},
|
|
1028
|
-
setup(
|
|
1029
|
-
return (e, t) => (
|
|
1037
|
+
setup(d) {
|
|
1038
|
+
return (e, t) => (C(), Q("div", gs, ne(e.entityLinkData.label), 1));
|
|
1030
1039
|
}
|
|
1031
|
-
}),
|
|
1040
|
+
}), ms = /* @__PURE__ */ ee({
|
|
1032
1041
|
__name: "TopNTableRenderer",
|
|
1033
1042
|
props: {
|
|
1034
1043
|
query: {},
|
|
@@ -1040,46 +1049,46 @@ const ye = {
|
|
|
1040
1049
|
requestsLink: {},
|
|
1041
1050
|
exploreLink: {}
|
|
1042
1051
|
},
|
|
1043
|
-
setup(
|
|
1044
|
-
const e =
|
|
1052
|
+
setup(d) {
|
|
1053
|
+
const e = d, t = ye(pe), i = qt(async () => {
|
|
1045
1054
|
if (t != null && t.fetchComponent)
|
|
1046
1055
|
try {
|
|
1047
1056
|
return await t.fetchComponent("EntityLink");
|
|
1048
1057
|
} catch {
|
|
1049
|
-
return
|
|
1058
|
+
return At;
|
|
1050
1059
|
}
|
|
1051
|
-
return
|
|
1060
|
+
return At;
|
|
1052
1061
|
}), s = (r) => {
|
|
1053
1062
|
var o;
|
|
1054
1063
|
if ((o = e.chartOptions) != null && o.entity_link)
|
|
1055
1064
|
if (r.id.includes(":")) {
|
|
1056
|
-
const [n,
|
|
1057
|
-
return e.chartOptions.entity_link.replace(
|
|
1065
|
+
const [n, l] = r.id.split(":");
|
|
1066
|
+
return e.chartOptions.entity_link.replace(Bi, n).replace(Rt, l);
|
|
1058
1067
|
} else
|
|
1059
|
-
return e.chartOptions.entity_link.replace(
|
|
1068
|
+
return e.chartOptions.entity_link.replace(Rt, r.id);
|
|
1060
1069
|
return "";
|
|
1061
1070
|
};
|
|
1062
|
-
return (r, o) => (
|
|
1071
|
+
return (r, o) => (C(), q(ct, {
|
|
1063
1072
|
context: r.context,
|
|
1064
1073
|
query: r.query,
|
|
1065
1074
|
"query-ready": r.queryReady,
|
|
1066
1075
|
"refresh-counter": r.refreshCounter
|
|
1067
1076
|
}, {
|
|
1068
1077
|
default: F(({ data: n }) => [
|
|
1069
|
-
|
|
1078
|
+
ae(x(wi), {
|
|
1070
1079
|
data: n,
|
|
1071
1080
|
"synthetics-data-key": r.chartOptions.synthetics_data_key
|
|
1072
1081
|
}, ht({ _: 2 }, [
|
|
1073
1082
|
e.chartOptions.entity_link ? {
|
|
1074
1083
|
name: "name",
|
|
1075
|
-
fn: F(({ record:
|
|
1076
|
-
|
|
1084
|
+
fn: F(({ record: l }) => [
|
|
1085
|
+
ae(x(i), {
|
|
1077
1086
|
"entity-link-data": {
|
|
1078
|
-
id:
|
|
1079
|
-
label:
|
|
1080
|
-
deleted:
|
|
1087
|
+
id: l.id,
|
|
1088
|
+
label: l.name,
|
|
1089
|
+
deleted: l.deleted
|
|
1081
1090
|
},
|
|
1082
|
-
"external-link": s(
|
|
1091
|
+
"external-link": s(l)
|
|
1083
1092
|
}, null, 8, ["entity-link-data", "external-link"])
|
|
1084
1093
|
]),
|
|
1085
1094
|
key: "0"
|
|
@@ -1089,7 +1098,7 @@ const ye = {
|
|
|
1089
1098
|
_: 1
|
|
1090
1099
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
1091
1100
|
}
|
|
1092
|
-
}),
|
|
1101
|
+
}), ps = /* @__PURE__ */ ee({
|
|
1093
1102
|
__name: "DonutChartRenderer",
|
|
1094
1103
|
props: {
|
|
1095
1104
|
query: {},
|
|
@@ -1101,8 +1110,8 @@ const ye = {
|
|
|
1101
1110
|
requestsLink: {},
|
|
1102
1111
|
exploreLink: {}
|
|
1103
1112
|
},
|
|
1104
|
-
setup(
|
|
1105
|
-
return (e, t) => (
|
|
1113
|
+
setup(d) {
|
|
1114
|
+
return (e, t) => (C(), q(ft, {
|
|
1106
1115
|
"chart-options": e.chartOptions,
|
|
1107
1116
|
context: e.context,
|
|
1108
1117
|
height: e.height,
|
|
@@ -1111,69 +1120,69 @@ const ye = {
|
|
|
1111
1120
|
"refresh-counter": e.refreshCounter
|
|
1112
1121
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
1113
1122
|
}
|
|
1114
|
-
}),
|
|
1123
|
+
}), ys = ["data-testid"], vs = {
|
|
1115
1124
|
key: 0,
|
|
1116
1125
|
class: "tile-header"
|
|
1117
|
-
},
|
|
1126
|
+
}, _s = ["data-testid"], bs = { class: "badge-text" }, ws = ["data-testid"], Es = { class: "delete-option" }, xs = ["data-testid"], Cs = ["data-testid"], Rs = /* @__PURE__ */ ee({
|
|
1118
1127
|
__name: "DashboardTile",
|
|
1119
1128
|
props: {
|
|
1120
1129
|
definition: {},
|
|
1121
1130
|
context: {},
|
|
1122
|
-
height: { default:
|
|
1131
|
+
height: { default: Xe },
|
|
1123
1132
|
isFullscreen: { type: Boolean },
|
|
1124
1133
|
queryReady: { type: Boolean },
|
|
1125
1134
|
refreshCounter: {},
|
|
1126
1135
|
tileId: {}
|
|
1127
1136
|
},
|
|
1128
1137
|
emits: ["edit-tile", "duplicate-tile", "remove-tile", "tile-time-range-zoom"],
|
|
1129
|
-
setup(
|
|
1130
|
-
|
|
1131
|
-
|
|
1138
|
+
setup(d, { emit: e }) {
|
|
1139
|
+
Ye((y) => ({
|
|
1140
|
+
"0b59d877": `${y.height}px`
|
|
1132
1141
|
}));
|
|
1133
|
-
const t = parseInt(
|
|
1134
|
-
exploreLinkKebabMenu:
|
|
1135
|
-
requestsLinkKebabMenu:
|
|
1136
|
-
canShowKebabMenu:
|
|
1137
|
-
canGenerateRequestsLink:
|
|
1138
|
-
canGenerateExploreLink:
|
|
1142
|
+
const t = parseInt(ei, 10), i = d, s = e, r = qt(() => import("./GeoMapRenderer-NvV03kSZ.js")), o = ye(pe), n = o == null ? void 0 : o.evaluateFeatureFlagFn("analytics-chart-zoom-actions", !1), { i18n: l } = ue.useI18n(), h = A(), u = A({ status: "loading" }), a = A(!1), f = A(), m = A(!1), g = A(!0), {
|
|
1143
|
+
exploreLinkKebabMenu: v,
|
|
1144
|
+
requestsLinkKebabMenu: p,
|
|
1145
|
+
canShowKebabMenu: S,
|
|
1146
|
+
canGenerateRequestsLink: L,
|
|
1147
|
+
canGenerateExploreLink: R,
|
|
1139
1148
|
requestsLinkZoomActions: k,
|
|
1140
|
-
exploreLinkZoomActions:
|
|
1141
|
-
buildExploreQuery:
|
|
1142
|
-
buildExploreLink:
|
|
1143
|
-
buildRequestLink:
|
|
1144
|
-
buildRequestsQueryZoomActions:
|
|
1145
|
-
} =
|
|
1149
|
+
exploreLinkZoomActions: G,
|
|
1150
|
+
buildExploreQuery: _e,
|
|
1151
|
+
buildExploreLink: be,
|
|
1152
|
+
buildRequestLink: T,
|
|
1153
|
+
buildRequestsQueryZoomActions: H
|
|
1154
|
+
} = ue.useContextLinks({
|
|
1146
1155
|
queryBridge: o,
|
|
1147
|
-
chartData: st(
|
|
1148
|
-
definition: st(
|
|
1149
|
-
context: st(
|
|
1150
|
-
});
|
|
1156
|
+
chartData: st(h),
|
|
1157
|
+
definition: st(wt(i, "definition")),
|
|
1158
|
+
context: st(wt(i, "context"))
|
|
1159
|
+
}), { issueQuery: j } = ue.useIssueQuery();
|
|
1151
1160
|
Qe(() => i.definition, async () => {
|
|
1152
|
-
await
|
|
1161
|
+
await ut(), f.value && (m.value = f.value.scrollWidth > f.value.clientWidth), g.value = !0;
|
|
1153
1162
|
}, { immediate: !0, deep: !0 });
|
|
1154
|
-
const
|
|
1155
|
-
timeseries_line:
|
|
1156
|
-
timeseries_bar:
|
|
1157
|
-
horizontal_bar:
|
|
1158
|
-
vertical_bar:
|
|
1159
|
-
gauge:
|
|
1160
|
-
donut:
|
|
1161
|
-
golden_signals:
|
|
1162
|
-
top_n:
|
|
1163
|
+
const W = z(() => l.t("csvExport.defaultFilename")), Ie = z(() => S.value && (E.value || i.context.editable) || !!X.value), E = z(() => !!v.value || ("allow_csv_export" in i.definition.chart ? i.definition.chart.allow_csv_export : !0) || i.context.editable), N = {
|
|
1164
|
+
timeseries_line: St,
|
|
1165
|
+
timeseries_bar: St,
|
|
1166
|
+
horizontal_bar: Dt,
|
|
1167
|
+
vertical_bar: Dt,
|
|
1168
|
+
gauge: zt,
|
|
1169
|
+
donut: ps,
|
|
1170
|
+
golden_signals: cs,
|
|
1171
|
+
top_n: ms,
|
|
1163
1172
|
slottable: void 0,
|
|
1164
|
-
single_value:
|
|
1173
|
+
single_value: zt,
|
|
1165
1174
|
choropleth_map: r
|
|
1166
|
-
},
|
|
1167
|
-
var
|
|
1175
|
+
}, O = z(() => {
|
|
1176
|
+
var y, P;
|
|
1168
1177
|
return {
|
|
1169
|
-
...(
|
|
1170
|
-
...(
|
|
1178
|
+
...(y = M.value) != null && y.rendererEvents.supportsRequests ? { "select-chart-range": ni } : {},
|
|
1179
|
+
...(P = M.value) != null && P.rendererEvents.supportsZoom ? { "zoom-time-range": ri } : {}
|
|
1171
1180
|
};
|
|
1172
|
-
}),
|
|
1173
|
-
var
|
|
1174
|
-
const
|
|
1175
|
-
return
|
|
1176
|
-
component:
|
|
1181
|
+
}), M = z(() => {
|
|
1182
|
+
var te, Z;
|
|
1183
|
+
const y = N[i.definition.chart.type], P = !!((te = y == null ? void 0 : y.emits) != null && te.includes("select-chart-range")), $ = !!((Z = y == null ? void 0 : y.emits) != null && Z.includes("zoom-time-range"));
|
|
1184
|
+
return y && {
|
|
1185
|
+
component: y,
|
|
1177
1186
|
rendererProps: {
|
|
1178
1187
|
query: i.definition.query,
|
|
1179
1188
|
context: i.context,
|
|
@@ -1182,231 +1191,235 @@ const ye = {
|
|
|
1182
1191
|
height: i.height - t * 2,
|
|
1183
1192
|
refreshCounter: i.refreshCounter,
|
|
1184
1193
|
requestsLink: k.value,
|
|
1185
|
-
exploreLink:
|
|
1194
|
+
exploreLink: G.value
|
|
1186
1195
|
},
|
|
1187
1196
|
rendererEvents: {
|
|
1188
|
-
supportsRequests:
|
|
1197
|
+
supportsRequests: P,
|
|
1189
1198
|
supportsZoom: $
|
|
1190
1199
|
}
|
|
1191
1200
|
};
|
|
1192
|
-
}),
|
|
1193
|
-
var
|
|
1194
|
-
const
|
|
1195
|
-
if ((
|
|
1196
|
-
const $ = Bt.get(
|
|
1197
|
-
return $ ? $.display : (console.warn("Did not recognize the given relative time range:",
|
|
1198
|
-
} else if ((
|
|
1199
|
-
const $ =
|
|
1200
|
-
return `${
|
|
1201
|
+
}), X = z(() => {
|
|
1202
|
+
var P;
|
|
1203
|
+
const y = (P = i.definition.query) == null ? void 0 : P.time_range;
|
|
1204
|
+
if ((y == null ? void 0 : y.type) === "relative") {
|
|
1205
|
+
const $ = Bt.get(yi[y.time_range]);
|
|
1206
|
+
return $ ? $.display : (console.warn("Did not recognize the given relative time range:", y.time_range), y.time_range);
|
|
1207
|
+
} else if ((y == null ? void 0 : y.type) === "absolute") {
|
|
1208
|
+
const $ = y.tz || "Etc/UTC";
|
|
1209
|
+
return `${Ct(y.start, { short: !0, tz: $ })} - ${Ct(y.end, { short: !0, tz: $ })}`;
|
|
1201
1210
|
}
|
|
1202
1211
|
return null;
|
|
1203
|
-
}),
|
|
1204
|
-
var
|
|
1205
|
-
if (!
|
|
1212
|
+
}), fe = z(() => h.value ? rt(h.value.meta.granularity_ms) : void 0), qe = z(() => ["timeseries_line", "timeseries_bar"].includes(i.definition.chart.type)), ke = z(() => {
|
|
1213
|
+
var P, $;
|
|
1214
|
+
if (!qe.value || !i.queryReady || g.value)
|
|
1206
1215
|
return !1;
|
|
1207
|
-
const
|
|
1208
|
-
return !
|
|
1209
|
-
}),
|
|
1210
|
-
var $,
|
|
1211
|
-
const
|
|
1212
|
-
return
|
|
1213
|
-
currentGranularity:
|
|
1214
|
-
savedGranularity:
|
|
1216
|
+
const y = ($ = (P = i.definition) == null ? void 0 : P.query) == null ? void 0 : $.granularity;
|
|
1217
|
+
return !y || !fe.value ? !1 : y !== fe.value;
|
|
1218
|
+
}), Te = z(() => {
|
|
1219
|
+
var $, te, Z;
|
|
1220
|
+
const y = rt((($ = h.value) == null ? void 0 : $.meta.granularity_ms) ?? 0) ?? "unknown", P = ((Z = (te = i.definition) == null ? void 0 : te.query) == null ? void 0 : Z.granularity) ?? "unknown";
|
|
1221
|
+
return l.t("query_aged_out_warning", {
|
|
1222
|
+
currentGranularity: l.t(`granularities.${y}`),
|
|
1223
|
+
savedGranularity: l.t(`granularities.${P}`)
|
|
1215
1224
|
});
|
|
1216
|
-
}),
|
|
1217
|
-
var $,
|
|
1218
|
-
const
|
|
1219
|
-
return
|
|
1220
|
-
}),
|
|
1225
|
+
}), Je = z(() => {
|
|
1226
|
+
var $, te;
|
|
1227
|
+
const y = [...i.context.filters, ...i.definition.query.filters ?? []], P = ((te = ($ = i.definition) == null ? void 0 : $.query) == null ? void 0 : te.datasource) ?? "api_usage";
|
|
1228
|
+
return y.filter((Z) => Gt(Z.field).some((oi) => P === oi));
|
|
1229
|
+
}), pt = () => {
|
|
1221
1230
|
s("edit-tile", i.definition);
|
|
1222
1231
|
}, et = () => {
|
|
1223
1232
|
s("duplicate-tile", i.definition);
|
|
1224
|
-
},
|
|
1233
|
+
}, tt = () => {
|
|
1225
1234
|
s("remove-tile", i.definition);
|
|
1226
|
-
},
|
|
1227
|
-
|
|
1228
|
-
},
|
|
1229
|
-
|
|
1230
|
-
},
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1235
|
+
}, yt = (y) => {
|
|
1236
|
+
h.value = y, g.value = !1;
|
|
1237
|
+
}, ii = () => {
|
|
1238
|
+
a.value = !1;
|
|
1239
|
+
}, si = async () => {
|
|
1240
|
+
a.value = !0, u.value = { status: "loading" }, j(i.definition.query, i.context, vi).then((y) => {
|
|
1241
|
+
u.value = { status: "success", chartData: y };
|
|
1242
|
+
}).catch((y) => {
|
|
1243
|
+
u.value = { status: "error", error: y };
|
|
1244
|
+
});
|
|
1245
|
+
}, ri = (y) => {
|
|
1246
|
+
const P = {
|
|
1234
1247
|
tileId: i.tileId.toString(),
|
|
1235
|
-
timeRange:
|
|
1248
|
+
timeRange: y
|
|
1236
1249
|
};
|
|
1237
|
-
s("tile-time-range-zoom",
|
|
1238
|
-
},
|
|
1239
|
-
const
|
|
1240
|
-
k.value =
|
|
1250
|
+
s("tile-time-range-zoom", P);
|
|
1251
|
+
}, ni = (y) => {
|
|
1252
|
+
const P = Je.value, $ = H(y, P), te = _e(y, P);
|
|
1253
|
+
k.value = L.value ? { href: T($) } : void 0, G.value = R.value ? { href: be(te) } : void 0;
|
|
1241
1254
|
};
|
|
1242
|
-
return (
|
|
1243
|
-
const $ =
|
|
1244
|
-
return
|
|
1245
|
-
class:
|
|
1246
|
-
"data-testid": `tile-${
|
|
1255
|
+
return (y, P) => {
|
|
1256
|
+
const $ = me("KTooltip"), te = me("KBadge"), Z = me("KDropdownItem"), vt = me("KDropdown");
|
|
1257
|
+
return C(), Q("div", {
|
|
1258
|
+
class: je(["tile-boundary", { editable: y.context.editable }]),
|
|
1259
|
+
"data-testid": `tile-${y.tileId}`
|
|
1247
1260
|
}, [
|
|
1248
|
-
|
|
1249
|
-
|
|
1261
|
+
y.definition.chart.type !== "slottable" ? (C(), Q("div", vs, [
|
|
1262
|
+
ae($, {
|
|
1250
1263
|
class: "title-tooltip",
|
|
1251
|
-
disabled: !
|
|
1264
|
+
disabled: !m.value,
|
|
1252
1265
|
"max-width": "500",
|
|
1253
|
-
text:
|
|
1266
|
+
text: y.definition.chart.chart_title
|
|
1254
1267
|
}, {
|
|
1255
1268
|
default: F(() => [
|
|
1256
1269
|
ce("div", {
|
|
1257
1270
|
ref_key: "titleRef",
|
|
1258
|
-
ref:
|
|
1271
|
+
ref: f,
|
|
1259
1272
|
class: "title"
|
|
1260
|
-
},
|
|
1273
|
+
}, ne(y.definition.chart.chart_title), 513)
|
|
1261
1274
|
]),
|
|
1262
1275
|
_: 1
|
|
1263
1276
|
}, 8, ["disabled", "text"]),
|
|
1264
|
-
|
|
1277
|
+
Ie.value ? (C(), Q("div", {
|
|
1265
1278
|
key: 0,
|
|
1266
1279
|
class: "tile-actions",
|
|
1267
|
-
"data-testid": `tile-actions-${
|
|
1280
|
+
"data-testid": `tile-actions-${y.tileId}`
|
|
1268
1281
|
}, [
|
|
1269
|
-
|
|
1282
|
+
X.value ? (C(), q(te, {
|
|
1270
1283
|
key: 0,
|
|
1271
1284
|
"data-testid": "time-range-badge",
|
|
1272
|
-
tooltip:
|
|
1285
|
+
tooltip: ke.value ? Te.value : void 0,
|
|
1273
1286
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1274
1287
|
}, ht({
|
|
1275
1288
|
default: F(() => [
|
|
1276
|
-
ce("span",
|
|
1289
|
+
ce("span", bs, ne(X.value), 1)
|
|
1277
1290
|
]),
|
|
1278
1291
|
_: 2
|
|
1279
1292
|
}, [
|
|
1280
|
-
|
|
1293
|
+
ke.value ? {
|
|
1281
1294
|
name: "icon",
|
|
1282
1295
|
fn: F(() => [
|
|
1283
|
-
|
|
1296
|
+
ae(x(Ti), { size: x(fs) }, null, 8, ["size"])
|
|
1284
1297
|
]),
|
|
1285
1298
|
key: "0"
|
|
1286
1299
|
} : void 0
|
|
1287
|
-
]), 1032, ["tooltip"])) :
|
|
1288
|
-
|
|
1300
|
+
]), 1032, ["tooltip"])) : Y("", !0),
|
|
1301
|
+
x(S) && y.context.editable && !y.isFullscreen ? (C(), q(x(zi), {
|
|
1289
1302
|
key: 1,
|
|
1290
1303
|
class: "edit-icon",
|
|
1291
|
-
color:
|
|
1292
|
-
"data-testid": `edit-tile-${
|
|
1293
|
-
size:
|
|
1294
|
-
onClick:
|
|
1295
|
-
}, null, 8, ["color", "data-testid", "size"])) :
|
|
1296
|
-
|
|
1304
|
+
color: x(Nt),
|
|
1305
|
+
"data-testid": `edit-tile-${y.tileId}`,
|
|
1306
|
+
size: x(Lt),
|
|
1307
|
+
onClick: pt
|
|
1308
|
+
}, null, 8, ["color", "data-testid", "size"])) : Y("", !0),
|
|
1309
|
+
x(S) && E.value && !y.isFullscreen ? (C(), q(vt, {
|
|
1297
1310
|
key: 2,
|
|
1298
1311
|
class: "dropdown",
|
|
1299
|
-
"data-testid": `chart-action-menu-${
|
|
1312
|
+
"data-testid": `chart-action-menu-${y.tileId}`,
|
|
1300
1313
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1301
1314
|
}, {
|
|
1302
1315
|
items: F(() => [
|
|
1303
|
-
|
|
1316
|
+
x(v) ? (C(), q(Z, {
|
|
1304
1317
|
key: 0,
|
|
1305
|
-
"data-testid": `chart-jump-to-explore-${
|
|
1306
|
-
item: { label:
|
|
1307
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1308
|
-
|
|
1318
|
+
"data-testid": `chart-jump-to-explore-${y.tileId}`,
|
|
1319
|
+
item: { label: x(l).t("jumpToExplore"), to: x(v) }
|
|
1320
|
+
}, null, 8, ["data-testid", "item"])) : Y("", !0),
|
|
1321
|
+
x(n) && x(p) ? (C(), q(Z, {
|
|
1309
1322
|
key: 1,
|
|
1310
|
-
"data-testid": `chart-jump-to-requests-${
|
|
1311
|
-
item: { label:
|
|
1312
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1313
|
-
!("allow_csv_export" in
|
|
1323
|
+
"data-testid": `chart-jump-to-requests-${y.tileId}`,
|
|
1324
|
+
item: { label: x(l).t("jumpToRequests"), to: x(p) }
|
|
1325
|
+
}, null, 8, ["data-testid", "item"])) : Y("", !0),
|
|
1326
|
+
!("allow_csv_export" in y.definition.chart) || y.definition.chart.allow_csv_export ? (C(), q(Z, {
|
|
1314
1327
|
key: 2,
|
|
1315
1328
|
class: "chart-export-button",
|
|
1316
|
-
"data-testid": `chart-csv-export-${
|
|
1317
|
-
onClick:
|
|
1329
|
+
"data-testid": `chart-csv-export-${y.tileId}`,
|
|
1330
|
+
onClick: si
|
|
1318
1331
|
}, {
|
|
1319
1332
|
default: F(() => [
|
|
1320
1333
|
ce("span", {
|
|
1321
1334
|
class: "chart-export-trigger",
|
|
1322
|
-
"data-testid": `csv-export-button-${
|
|
1323
|
-
},
|
|
1335
|
+
"data-testid": `csv-export-button-${y.tileId}`
|
|
1336
|
+
}, ne(x(l).t("csvExport.exportAsCsv")), 9, ws)
|
|
1324
1337
|
]),
|
|
1325
1338
|
_: 1
|
|
1326
|
-
}, 8, ["data-testid"])) :
|
|
1327
|
-
|
|
1339
|
+
}, 8, ["data-testid"])) : Y("", !0),
|
|
1340
|
+
y.context.editable ? (C(), q(Z, {
|
|
1328
1341
|
key: 3,
|
|
1329
|
-
"data-testid": `duplicate-tile-${
|
|
1342
|
+
"data-testid": `duplicate-tile-${y.tileId}`,
|
|
1330
1343
|
onClick: et
|
|
1331
1344
|
}, {
|
|
1332
1345
|
default: F(() => [
|
|
1333
|
-
|
|
1346
|
+
Se(ne(x(l).t("renderer.duplicateTile")), 1)
|
|
1334
1347
|
]),
|
|
1335
1348
|
_: 1
|
|
1336
|
-
}, 8, ["data-testid"])) :
|
|
1337
|
-
|
|
1349
|
+
}, 8, ["data-testid"])) : Y("", !0),
|
|
1350
|
+
y.context.editable ? (C(), q(Z, {
|
|
1338
1351
|
key: 4,
|
|
1339
|
-
"data-testid": `remove-tile-${
|
|
1340
|
-
onClick:
|
|
1352
|
+
"data-testid": `remove-tile-${y.tileId}`,
|
|
1353
|
+
onClick: tt
|
|
1341
1354
|
}, {
|
|
1342
1355
|
default: F(() => [
|
|
1343
|
-
ce("span",
|
|
1356
|
+
ce("span", Es, ne(x(l).t("renderer.delete")), 1)
|
|
1344
1357
|
]),
|
|
1345
1358
|
_: 1
|
|
1346
|
-
}, 8, ["data-testid"])) :
|
|
1359
|
+
}, 8, ["data-testid"])) : Y("", !0)
|
|
1347
1360
|
]),
|
|
1348
1361
|
default: F(() => [
|
|
1349
|
-
|
|
1362
|
+
ae(x(Di), {
|
|
1350
1363
|
class: "kebab-action-menu",
|
|
1351
|
-
color:
|
|
1352
|
-
"data-testid": `kebab-action-menu-${
|
|
1353
|
-
size:
|
|
1364
|
+
color: x(Nt),
|
|
1365
|
+
"data-testid": `kebab-action-menu-${y.tileId}`,
|
|
1366
|
+
size: x(Lt)
|
|
1354
1367
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1355
1368
|
]),
|
|
1356
1369
|
_: 1
|
|
1357
|
-
}, 8, ["data-testid"])) :
|
|
1358
|
-
], 8,
|
|
1370
|
+
}, 8, ["data-testid"])) : Y("", !0)
|
|
1371
|
+
], 8, _s)) : "description" in y.definition.chart ? (C(), Q("div", {
|
|
1359
1372
|
key: 1,
|
|
1360
1373
|
class: "header-description",
|
|
1361
|
-
"data-testid": `tile-description-${
|
|
1362
|
-
},
|
|
1363
|
-
|
|
1374
|
+
"data-testid": `tile-description-${y.tileId}`
|
|
1375
|
+
}, ne(y.definition.chart.description), 9, xs)) : Y("", !0),
|
|
1376
|
+
a.value ? (C(), q(x(Ei), {
|
|
1364
1377
|
key: 2,
|
|
1365
|
-
"
|
|
1366
|
-
"
|
|
1367
|
-
filename:
|
|
1368
|
-
|
|
1369
|
-
}, null, 8, ["
|
|
1370
|
-
])) :
|
|
1378
|
+
"data-testid": `csv-export-modal-${y.tileId}`,
|
|
1379
|
+
"export-state": u.value,
|
|
1380
|
+
filename: W.value,
|
|
1381
|
+
onCloseModal: ii
|
|
1382
|
+
}, null, 8, ["data-testid", "export-state", "filename"])) : Y("", !0)
|
|
1383
|
+
])) : Y("", !0),
|
|
1371
1384
|
ce("div", {
|
|
1372
1385
|
class: "tile-content",
|
|
1373
|
-
"data-testid": `tile-content-${
|
|
1386
|
+
"data-testid": `tile-content-${y.tileId}`
|
|
1374
1387
|
}, [
|
|
1375
|
-
|
|
1376
|
-
], 8,
|
|
1377
|
-
], 10,
|
|
1388
|
+
M.value ? (C(), q(Pt(M.value.component), It({ key: 0 }, M.value.rendererProps, ci(O.value), { onChartData: yt }), null, 16)) : Y("", !0)
|
|
1389
|
+
], 8, Cs)
|
|
1390
|
+
], 10, ys);
|
|
1378
1391
|
};
|
|
1379
1392
|
}
|
|
1380
|
-
}),
|
|
1393
|
+
}), ks = /* @__PURE__ */ ve(Rs, [["__scopeId", "data-v-3751379a"]]), Ts = (d, e) => {
|
|
1381
1394
|
let t = 0;
|
|
1382
1395
|
const i = /* @__PURE__ */ new Map();
|
|
1383
1396
|
e.forEach((r) => {
|
|
1384
|
-
const o = r.layout.position.row, n = i.get(o),
|
|
1385
|
-
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o,
|
|
1397
|
+
const o = r.layout.position.row, n = i.get(o), l = r.layout.size.rows === 1 && !!r.layout.size.fit_to_content;
|
|
1398
|
+
t = Math.max(t, o + r.layout.size.rows), n === void 0 ? i.set(o, l) : i.set(o, n && l);
|
|
1386
1399
|
});
|
|
1387
1400
|
const s = [];
|
|
1388
1401
|
for (let r = 0; r < t; r++)
|
|
1389
|
-
i.get(r) ? s.push("auto") : s.push(`${
|
|
1402
|
+
i.get(r) ? s.push("auto") : s.push(`${d}px`);
|
|
1390
1403
|
return s;
|
|
1391
|
-
},
|
|
1404
|
+
}, zs = /* @__PURE__ */ ee({
|
|
1392
1405
|
__name: "GridLayout",
|
|
1393
1406
|
props: {
|
|
1394
1407
|
tileHeight: {
|
|
1395
1408
|
type: Number,
|
|
1396
1409
|
required: !1,
|
|
1397
|
-
default: () =>
|
|
1410
|
+
default: () => Xe
|
|
1398
1411
|
},
|
|
1399
1412
|
tiles: {
|
|
1400
1413
|
type: Array,
|
|
1401
1414
|
required: !0
|
|
1402
1415
|
}
|
|
1403
1416
|
},
|
|
1404
|
-
setup(
|
|
1405
|
-
|
|
1406
|
-
"2a38e79e":
|
|
1417
|
+
setup(d) {
|
|
1418
|
+
Ye((n) => ({
|
|
1419
|
+
"2a38e79e": x(Wt),
|
|
1407
1420
|
"4cc71de6": r.value
|
|
1408
1421
|
}));
|
|
1409
|
-
const e =
|
|
1422
|
+
const e = d, t = A(null), i = A(0), s = new ResizeObserver((n) => {
|
|
1410
1423
|
window.requestAnimationFrame(() => {
|
|
1411
1424
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1412
1425
|
});
|
|
@@ -1416,8 +1429,8 @@ const ye = {
|
|
|
1416
1429
|
}), lt(() => {
|
|
1417
1430
|
t.value && s.unobserve(t.value);
|
|
1418
1431
|
});
|
|
1419
|
-
const r =
|
|
1420
|
-
key: `tile-${
|
|
1432
|
+
const r = z(() => Ts(e.tileHeight, e.tiles).join(" ")), o = z(() => e.tiles.map((n, l) => ({
|
|
1433
|
+
key: `tile-${l}`,
|
|
1421
1434
|
tile: n,
|
|
1422
1435
|
style: {
|
|
1423
1436
|
"grid-column-start": n.layout.position.col + 1,
|
|
@@ -1426,28 +1439,28 @@ const ye = {
|
|
|
1426
1439
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1427
1440
|
}
|
|
1428
1441
|
})));
|
|
1429
|
-
return (n,
|
|
1442
|
+
return (n, l) => (C(), Q("div", {
|
|
1430
1443
|
ref_key: "gridContainer",
|
|
1431
1444
|
ref: t,
|
|
1432
1445
|
class: "kong-ui-public-grid-layout"
|
|
1433
1446
|
}, [
|
|
1434
|
-
(
|
|
1435
|
-
key:
|
|
1436
|
-
class:
|
|
1437
|
-
"empty-cell": !
|
|
1447
|
+
(C(!0), Q($t, null, Ft(o.value, (h) => (C(), Q("div", {
|
|
1448
|
+
key: h.key,
|
|
1449
|
+
class: je(["grid-cell", {
|
|
1450
|
+
"empty-cell": !h.tile
|
|
1438
1451
|
}]),
|
|
1439
|
-
style:
|
|
1452
|
+
style: Et(h.style)
|
|
1440
1453
|
}, [
|
|
1441
|
-
|
|
1442
|
-
style:
|
|
1443
|
-
tile:
|
|
1454
|
+
De(n.$slots, "tile", {
|
|
1455
|
+
style: Et(h.style),
|
|
1456
|
+
tile: h.tile
|
|
1444
1457
|
}, void 0, !0)
|
|
1445
1458
|
], 6))), 128))
|
|
1446
1459
|
], 512));
|
|
1447
1460
|
}
|
|
1448
|
-
}),
|
|
1449
|
-
function
|
|
1450
|
-
const r = (...o) => (console.warn("gridstack.js: Function `" + t + "` is deprecated in " + s + " and has been replaced with `" + i + "`. It will be **removed** in a future release"), e.apply(
|
|
1461
|
+
}), Ds = /* @__PURE__ */ ve(zs, [["__scopeId", "data-v-354b7177"]]);
|
|
1462
|
+
function Ss(d, e, t, i, s) {
|
|
1463
|
+
const r = (...o) => (console.warn("gridstack.js: Function `" + t + "` is deprecated in " + s + " and has been replaced with `" + i + "`. It will be **removed** in a future release"), e.apply(d, o));
|
|
1451
1464
|
return r.prototype = e.prototype, r;
|
|
1452
1465
|
}
|
|
1453
1466
|
class c {
|
|
@@ -1653,10 +1666,10 @@ class c {
|
|
|
1653
1666
|
static updateScrollPosition(e, t, i) {
|
|
1654
1667
|
const s = e.getBoundingClientRect(), r = window.innerHeight || document.documentElement.clientHeight;
|
|
1655
1668
|
if (s.top < 0 || s.bottom > r) {
|
|
1656
|
-
const o = s.bottom - r, n = s.top,
|
|
1657
|
-
if (
|
|
1658
|
-
const
|
|
1659
|
-
s.top < 0 && i < 0 ? e.offsetHeight > r ?
|
|
1669
|
+
const o = s.bottom - r, n = s.top, l = this.getScrollElement(e);
|
|
1670
|
+
if (l !== null) {
|
|
1671
|
+
const h = l.scrollTop;
|
|
1672
|
+
s.top < 0 && i < 0 ? e.offsetHeight > r ? l.scrollTop += i : l.scrollTop += Math.abs(n) > Math.abs(i) ? i : n : i > 0 && (e.offsetHeight > r ? l.scrollTop += i : l.scrollTop += o > i ? i : o), t.top += l.scrollTop - h;
|
|
1660
1673
|
}
|
|
1661
1674
|
}
|
|
1662
1675
|
}
|
|
@@ -1668,8 +1681,8 @@ class c {
|
|
|
1668
1681
|
* @param distance Distance from the V edges to start scrolling
|
|
1669
1682
|
*/
|
|
1670
1683
|
static updateScrollResize(e, t, i) {
|
|
1671
|
-
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o,
|
|
1672
|
-
|
|
1684
|
+
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o, l = n < i, h = n > r - i;
|
|
1685
|
+
l ? s.scrollBy({ behavior: "smooth", top: n - i }) : h && s.scrollBy({ behavior: "smooth", top: i - (r - n) });
|
|
1673
1686
|
}
|
|
1674
1687
|
/** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
|
|
1675
1688
|
static clone(e) {
|
|
@@ -1786,7 +1799,7 @@ class c {
|
|
|
1786
1799
|
return !(!e || e.w === e.h || e.locked || e.noResize || (t = e.grid) != null && t.opts.disableResize || e.minW && e.minW === e.maxW || e.minH && e.minH === e.maxH);
|
|
1787
1800
|
}
|
|
1788
1801
|
}
|
|
1789
|
-
class
|
|
1802
|
+
class le {
|
|
1790
1803
|
constructor(e = {}) {
|
|
1791
1804
|
this.addedNodes = [], this.removedNodes = [], this.defaultColumn = 12, this.column = e.column || this.defaultColumn, this.column > this.defaultColumn && (this.defaultColumn = this.column), this.maxRow = e.maxRow, this._float = e.float, this.nodes = e.nodes || [], this.onChange = e.onChange;
|
|
1792
1805
|
}
|
|
@@ -1808,19 +1821,19 @@ class he {
|
|
|
1808
1821
|
!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));
|
|
1809
1822
|
let o = !1;
|
|
1810
1823
|
const n = { nested: !0, pack: !1 };
|
|
1811
|
-
let
|
|
1824
|
+
let l = 0;
|
|
1812
1825
|
for (; i = i || this.collide(e, r, s.skip); ) {
|
|
1813
|
-
if (
|
|
1826
|
+
if (l++ > this.nodes.length * 2)
|
|
1814
1827
|
throw new Error("Infinite collide check");
|
|
1815
|
-
let
|
|
1828
|
+
let h;
|
|
1816
1829
|
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
|
|
1817
1830
|
(!this.collide(i, { ...i, y: e.y }, e) || !this.collide(i, { ...i, y: t.y - i.h }, e))) {
|
|
1818
1831
|
e._skipDown = e._skipDown || t.y > e.y;
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1832
|
+
const u = { ...t, y: i.y + i.h, ...n };
|
|
1833
|
+
h = this._loading && c.samePos(e, u) ? !0 : this.moveNode(e, u), (i.locked || this._loading) && h ? c.copyPos(t, e) : !i.locked && h && s.pack && (this._packNodes(), t.y = i.y + i.h, c.copyPos(e, t)), o = o || h;
|
|
1821
1834
|
} else
|
|
1822
|
-
|
|
1823
|
-
if (!
|
|
1835
|
+
h = this.moveNode(i, { ...i, y: t.y + t.h, skip: e, ...n });
|
|
1836
|
+
if (!h)
|
|
1824
1837
|
return o;
|
|
1825
1838
|
i = void 0;
|
|
1826
1839
|
}
|
|
@@ -1842,14 +1855,14 @@ class he {
|
|
|
1842
1855
|
const s = e._rect, r = { ...t.rect };
|
|
1843
1856
|
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;
|
|
1844
1857
|
let o, n = 0.5;
|
|
1845
|
-
for (let
|
|
1846
|
-
if (
|
|
1858
|
+
for (let l of i) {
|
|
1859
|
+
if (l.locked || !l._rect)
|
|
1847
1860
|
break;
|
|
1848
|
-
const
|
|
1849
|
-
let
|
|
1850
|
-
s.y <
|
|
1851
|
-
const f = Math.min(a,
|
|
1852
|
-
f > n && (n = f, o =
|
|
1861
|
+
const h = l._rect;
|
|
1862
|
+
let u = Number.MAX_VALUE, a = Number.MAX_VALUE;
|
|
1863
|
+
s.y < h.y ? u = (r.y + r.h - h.y) / h.h : s.y + s.h > h.y + h.h && (u = (h.y + h.h - r.y) / h.h), s.x < h.x ? a = (r.x + r.w - h.x) / h.w : s.x + s.w > h.x + h.w && (a = (h.x + h.w - r.x) / h.w);
|
|
1864
|
+
const f = Math.min(a, u);
|
|
1865
|
+
f > n && (n = f, o = l);
|
|
1853
1866
|
}
|
|
1854
1867
|
return t.collide = o, o;
|
|
1855
1868
|
}
|
|
@@ -1923,9 +1936,9 @@ class he {
|
|
|
1923
1936
|
const s = this._inColumnResize;
|
|
1924
1937
|
s || (this._inColumnResize = !0);
|
|
1925
1938
|
const r = this.nodes;
|
|
1926
|
-
return this.nodes = [], r.forEach((o, n,
|
|
1927
|
-
let
|
|
1928
|
-
o.locked || (o.autoPosition = !0, e === "list" && n && (
|
|
1939
|
+
return this.nodes = [], r.forEach((o, n, l) => {
|
|
1940
|
+
let h;
|
|
1941
|
+
o.locked || (o.autoPosition = !0, e === "list" && n && (h = l[n - 1])), this.addNode(o, !1, h);
|
|
1929
1942
|
}), s || delete this._inColumnResize, i || this.batchUpdate(!1), this;
|
|
1930
1943
|
}
|
|
1931
1944
|
/** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */
|
|
@@ -1964,7 +1977,7 @@ class he {
|
|
|
1964
1977
|
* @param resizing if out of bound, resize down or move into the grid to fit ?
|
|
1965
1978
|
*/
|
|
1966
1979
|
prepareNode(e, t) {
|
|
1967
|
-
e._id = e._id ??
|
|
1980
|
+
e._id = e._id ?? le._idSeq++;
|
|
1968
1981
|
const i = e.id;
|
|
1969
1982
|
if (i) {
|
|
1970
1983
|
let r = 1;
|
|
@@ -2023,11 +2036,11 @@ class he {
|
|
|
2023
2036
|
const r = s ? s.y * i + (s.x + s.w) : 0;
|
|
2024
2037
|
let o = !1;
|
|
2025
2038
|
for (let n = r; !o; ++n) {
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2039
|
+
const l = n % i, h = Math.floor(n / i);
|
|
2040
|
+
if (l + e.w > i)
|
|
2028
2041
|
continue;
|
|
2029
|
-
const
|
|
2030
|
-
t.find((a) => c.isIntercepted(
|
|
2042
|
+
const u = { x: l, y: h, w: e.w, h: e.h };
|
|
2043
|
+
t.find((a) => c.isIntercepted(u, a)) || ((e.x !== l || e.y !== h) && (e._dirty = !0), e.x = l, e.y = h, delete e.autoPosition, o = !0);
|
|
2031
2044
|
}
|
|
2032
2045
|
return o;
|
|
2033
2046
|
}
|
|
@@ -2059,7 +2072,7 @@ class he {
|
|
|
2059
2072
|
if (t.pack = !0, !this.maxRow)
|
|
2060
2073
|
return this.moveNode(e, t);
|
|
2061
2074
|
let i;
|
|
2062
|
-
const s = new
|
|
2075
|
+
const s = new le({
|
|
2063
2076
|
column: this.column,
|
|
2064
2077
|
float: this.float,
|
|
2065
2078
|
nodes: this.nodes.map((o) => o._id === e._id ? (i = { ...o }, i) : { ...o })
|
|
@@ -2073,7 +2086,7 @@ class he {
|
|
|
2073
2086
|
return this._notify(), !0;
|
|
2074
2087
|
}
|
|
2075
2088
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
2076
|
-
const n = this.nodes.find((
|
|
2089
|
+
const n = this.nodes.find((l) => l._id === o._id);
|
|
2077
2090
|
n && (c.copyPos(n, o), n._dirty = !0);
|
|
2078
2091
|
}), this._notify(), !0) : !1;
|
|
2079
2092
|
}
|
|
@@ -2081,7 +2094,7 @@ class he {
|
|
|
2081
2094
|
willItFit(e) {
|
|
2082
2095
|
if (delete e._willFitPos, !this.maxRow)
|
|
2083
2096
|
return !0;
|
|
2084
|
-
const t = new
|
|
2097
|
+
const t = new le({
|
|
2085
2098
|
column: this.column,
|
|
2086
2099
|
float: this.float,
|
|
2087
2100
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
@@ -2094,7 +2107,7 @@ class he {
|
|
|
2094
2107
|
}
|
|
2095
2108
|
/** return true if the passed in node was actually moved (checks for no-op and locked) */
|
|
2096
2109
|
moveNode(e, t) {
|
|
2097
|
-
var
|
|
2110
|
+
var h, u;
|
|
2098
2111
|
if (!e || /*node.locked ||*/
|
|
2099
2112
|
!t)
|
|
2100
2113
|
return !1;
|
|
@@ -2104,17 +2117,17 @@ class he {
|
|
|
2104
2117
|
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
2105
2118
|
return !1;
|
|
2106
2119
|
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
2107
|
-
let
|
|
2120
|
+
let l = !0;
|
|
2108
2121
|
if (n.length) {
|
|
2109
2122
|
const a = e._moving && !t.nested;
|
|
2110
2123
|
let f = a ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
2111
|
-
if (a && f && ((
|
|
2112
|
-
const m = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect),
|
|
2113
|
-
m / (g <
|
|
2124
|
+
if (a && f && ((u = (h = e.grid) == null ? void 0 : h.opts) != null && u.subGridDynamic) && !e.grid._isTemp) {
|
|
2125
|
+
const m = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect), v = c.area(f._rect);
|
|
2126
|
+
m / (g < v ? g : v) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
2114
2127
|
}
|
|
2115
|
-
f ?
|
|
2128
|
+
f ? l = !this._fixCollisions(e, r, f, t) : (l = !1, i && delete t.pack);
|
|
2116
2129
|
}
|
|
2117
|
-
return
|
|
2130
|
+
return l && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
2118
2131
|
}
|
|
2119
2132
|
getRow() {
|
|
2120
2133
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -2132,8 +2145,8 @@ class he {
|
|
|
2132
2145
|
var o;
|
|
2133
2146
|
const i = (o = this._layouts) == null ? void 0 : o.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
2134
2147
|
return this.sortNodes(), this.nodes.forEach((n) => {
|
|
2135
|
-
const
|
|
2136
|
-
c.removeInternalForSave(
|
|
2148
|
+
const l = s == null ? void 0 : s.find((u) => u._id === n._id), h = { ...n, ...l || {} };
|
|
2149
|
+
c.removeInternalForSave(h, !e), t && t(n, h), r.push(h);
|
|
2137
2150
|
}), r;
|
|
2138
2151
|
}
|
|
2139
2152
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -2172,19 +2185,19 @@ class he {
|
|
|
2172
2185
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
2173
2186
|
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
2174
2187
|
if (t > e && this._layouts) {
|
|
2175
|
-
const
|
|
2176
|
-
!
|
|
2177
|
-
const a = o.find((f) => f._id ===
|
|
2178
|
-
a && (!s && !
|
|
2179
|
-
})),
|
|
2180
|
-
const a = o.findIndex((f) => f._id ===
|
|
2188
|
+
const l = this._layouts[t] || [], h = this._layouts.length - 1;
|
|
2189
|
+
!l.length && e !== h && ((n = this._layouts[h]) != null && n.length) && (e = h, this._layouts[h].forEach((u) => {
|
|
2190
|
+
const a = o.find((f) => f._id === u._id);
|
|
2191
|
+
a && (!s && !u.autoPosition && (a.x = u.x ?? a.x, a.y = u.y ?? a.y), a.w = u.w ?? a.w, (u.x == null || u.y === void 0) && (a.autoPosition = !0));
|
|
2192
|
+
})), l.forEach((u) => {
|
|
2193
|
+
const a = o.findIndex((f) => f._id === u._id);
|
|
2181
2194
|
if (a !== -1) {
|
|
2182
2195
|
const f = o[a];
|
|
2183
2196
|
if (s) {
|
|
2184
|
-
f.w =
|
|
2197
|
+
f.w = u.w;
|
|
2185
2198
|
return;
|
|
2186
2199
|
}
|
|
2187
|
-
(
|
|
2200
|
+
(u.autoPosition || isNaN(u.x) || isNaN(u.y)) && this.findEmptyPosition(u, r), u.autoPosition || (f.x = u.x ?? f.x, f.y = u.y ?? f.y, f.w = u.w ?? f.w, r.push(f)), o.splice(a, 1);
|
|
2188
2201
|
}
|
|
2189
2202
|
});
|
|
2190
2203
|
}
|
|
@@ -2195,16 +2208,16 @@ class he {
|
|
|
2195
2208
|
if (typeof i == "function")
|
|
2196
2209
|
i(t, e, r, o);
|
|
2197
2210
|
else {
|
|
2198
|
-
const
|
|
2211
|
+
const l = s || i === "none" ? 1 : t / e, h = i === "move" || i === "moveScale", u = i === "scale" || i === "moveScale";
|
|
2199
2212
|
o.forEach((a) => {
|
|
2200
|
-
a.x = t === 1 ? 0 :
|
|
2213
|
+
a.x = t === 1 ? 0 : h ? Math.round(a.x * l) : Math.min(a.x, t - 1), a.w = t === 1 || e === 1 ? 1 : u ? Math.round(a.w * l) || 1 : Math.min(a.w, t), r.push(a);
|
|
2201
2214
|
}), o = [];
|
|
2202
2215
|
}
|
|
2203
|
-
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((
|
|
2204
|
-
this.addNode(
|
|
2216
|
+
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((l) => {
|
|
2217
|
+
this.addNode(l, !1), delete l._orig;
|
|
2205
2218
|
});
|
|
2206
2219
|
}
|
|
2207
|
-
return this.nodes.forEach((
|
|
2220
|
+
return this.nodes.forEach((l) => delete l._orig), this.batchUpdate(!1, !s), delete this._inColumnResize, this;
|
|
2208
2221
|
}
|
|
2209
2222
|
/**
|
|
2210
2223
|
* call to cache the given layout internally to the given location so we can restore back when column changes size
|
|
@@ -2216,8 +2229,8 @@ class he {
|
|
|
2216
2229
|
const s = [];
|
|
2217
2230
|
return e.forEach((r, o) => {
|
|
2218
2231
|
if (r._id === void 0) {
|
|
2219
|
-
const n = r.id ? this.nodes.find((
|
|
2220
|
-
r._id = (n == null ? void 0 : n._id) ??
|
|
2232
|
+
const n = r.id ? this.nodes.find((l) => l.id === r.id) : void 0;
|
|
2233
|
+
r._id = (n == null ? void 0 : n._id) ?? le._idSeq++;
|
|
2221
2234
|
}
|
|
2222
2235
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
2223
2236
|
}), this._layouts = i ? [] : this._layouts || [], this._layouts[t] = s, this;
|
|
@@ -2228,7 +2241,7 @@ class he {
|
|
|
2228
2241
|
* @param column corresponding column index to save it under
|
|
2229
2242
|
*/
|
|
2230
2243
|
cacheOneLayout(e, t) {
|
|
2231
|
-
e._id = e._id ??
|
|
2244
|
+
e._id = e._id ?? le._idSeq++;
|
|
2232
2245
|
const i = { x: e.x, y: e.y, w: e.w, _id: e._id };
|
|
2233
2246
|
(e.autoPosition || e.x === void 0) && (delete i.x, delete i.y, e.autoPosition && (i.autoPosition = !0)), this._layouts = this._layouts || [], this._layouts[t] = this._layouts[t] || [];
|
|
2234
2247
|
const s = this.findCacheLayout(e, t);
|
|
@@ -2252,8 +2265,8 @@ class he {
|
|
|
2252
2265
|
return this;
|
|
2253
2266
|
}
|
|
2254
2267
|
}
|
|
2255
|
-
|
|
2256
|
-
const
|
|
2268
|
+
le._idSeq = 0;
|
|
2269
|
+
const J = {
|
|
2257
2270
|
alwaysShowResizeHandle: "mobile",
|
|
2258
2271
|
animate: !0,
|
|
2259
2272
|
auto: !0,
|
|
@@ -2285,55 +2298,55 @@ const Z = {
|
|
|
2285
2298
|
};
|
|
2286
2299
|
class w {
|
|
2287
2300
|
}
|
|
2288
|
-
const
|
|
2289
|
-
class
|
|
2301
|
+
const oe = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2302
|
+
class he {
|
|
2290
2303
|
}
|
|
2291
|
-
function
|
|
2292
|
-
|
|
2304
|
+
function Ge(d, e) {
|
|
2305
|
+
d.touches.length > 1 || (d.cancelable && d.preventDefault(), c.simulateMouseEvent(d.changedTouches[0], e));
|
|
2293
2306
|
}
|
|
2294
|
-
function
|
|
2295
|
-
|
|
2307
|
+
function ti(d, e) {
|
|
2308
|
+
d.cancelable && d.preventDefault(), c.simulateMouseEvent(d, e);
|
|
2296
2309
|
}
|
|
2297
|
-
function Be(
|
|
2298
|
-
|
|
2310
|
+
function Be(d) {
|
|
2311
|
+
he.touchHandled || (he.touchHandled = !0, Ge(d, "mousedown"));
|
|
2299
2312
|
}
|
|
2300
|
-
function
|
|
2301
|
-
|
|
2313
|
+
function Ue(d) {
|
|
2314
|
+
he.touchHandled && Ge(d, "mousemove");
|
|
2302
2315
|
}
|
|
2303
|
-
function
|
|
2304
|
-
if (!
|
|
2316
|
+
function We(d) {
|
|
2317
|
+
if (!he.touchHandled)
|
|
2305
2318
|
return;
|
|
2306
|
-
|
|
2319
|
+
he.pointerLeaveTimeout && (window.clearTimeout(he.pointerLeaveTimeout), delete he.pointerLeaveTimeout);
|
|
2307
2320
|
const e = !!w.dragElement;
|
|
2308
|
-
|
|
2321
|
+
Ge(d, "mouseup"), e || Ge(d, "click"), he.touchHandled = !1;
|
|
2309
2322
|
}
|
|
2310
|
-
function
|
|
2311
|
-
|
|
2323
|
+
function Ke(d) {
|
|
2324
|
+
d.pointerType !== "mouse" && d.target.releasePointerCapture(d.pointerId);
|
|
2312
2325
|
}
|
|
2313
|
-
function
|
|
2314
|
-
w.dragElement &&
|
|
2326
|
+
function Ht(d) {
|
|
2327
|
+
w.dragElement && d.pointerType !== "mouse" && ti(d, "mouseenter");
|
|
2315
2328
|
}
|
|
2316
|
-
function
|
|
2317
|
-
w.dragElement &&
|
|
2318
|
-
delete
|
|
2329
|
+
function Ot(d) {
|
|
2330
|
+
w.dragElement && d.pointerType !== "mouse" && (he.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2331
|
+
delete he.pointerLeaveTimeout, ti(d, "mouseleave");
|
|
2319
2332
|
}, 10));
|
|
2320
2333
|
}
|
|
2321
|
-
class
|
|
2334
|
+
class Ze {
|
|
2322
2335
|
constructor(e, t, i) {
|
|
2323
2336
|
this.host = e, this.dir = t, this.option = i, this.moving = !1, this._mouseDown = this._mouseDown.bind(this), this._mouseMove = this._mouseMove.bind(this), this._mouseUp = this._mouseUp.bind(this), this._keyEvent = this._keyEvent.bind(this), this._init();
|
|
2324
2337
|
}
|
|
2325
2338
|
/** @internal */
|
|
2326
2339
|
_init() {
|
|
2327
2340
|
const e = this.el = document.createElement("div");
|
|
2328
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${
|
|
2341
|
+
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), oe && (this.el.addEventListener("touchstart", Be), this.el.addEventListener("pointerdown", Ke)), this;
|
|
2329
2342
|
}
|
|
2330
2343
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2331
2344
|
destroy() {
|
|
2332
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown),
|
|
2345
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), oe && (this.el.removeEventListener("touchstart", Be), this.el.removeEventListener("pointerdown", Ke)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2333
2346
|
}
|
|
2334
2347
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2335
2348
|
_mouseDown(e) {
|
|
2336
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0),
|
|
2349
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), oe && (this.el.addEventListener("touchmove", Ue), this.el.addEventListener("touchend", We)), e.stopPropagation(), e.preventDefault();
|
|
2337
2350
|
}
|
|
2338
2351
|
/** @internal */
|
|
2339
2352
|
_mouseMove(e) {
|
|
@@ -2342,7 +2355,7 @@ class Je {
|
|
|
2342
2355
|
}
|
|
2343
2356
|
/** @internal */
|
|
2344
2357
|
_mouseUp(e) {
|
|
2345
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2358
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), oe && (this.el.removeEventListener("touchmove", Ue), this.el.removeEventListener("touchend", We)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2346
2359
|
}
|
|
2347
2360
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2348
2361
|
_keyEvent(e) {
|
|
@@ -2354,7 +2367,7 @@ class Je {
|
|
|
2354
2367
|
return this.option[e] && this.option[e](t), this;
|
|
2355
2368
|
}
|
|
2356
2369
|
}
|
|
2357
|
-
|
|
2370
|
+
Ze.prefix = "ui-resizable-";
|
|
2358
2371
|
class gt {
|
|
2359
2372
|
constructor() {
|
|
2360
2373
|
this._eventRegister = {};
|
|
@@ -2383,7 +2396,7 @@ class gt {
|
|
|
2383
2396
|
return this._eventRegister[e](t);
|
|
2384
2397
|
}
|
|
2385
2398
|
}
|
|
2386
|
-
class
|
|
2399
|
+
class Ne extends gt {
|
|
2387
2400
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2388
2401
|
constructor(e, t = {}) {
|
|
2389
2402
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2453,7 +2466,7 @@ class Se extends gt {
|
|
|
2453
2466
|
}
|
|
2454
2467
|
/** @internal */
|
|
2455
2468
|
_setupHandlers() {
|
|
2456
|
-
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new
|
|
2469
|
+
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new Ze(this.el, e, {
|
|
2457
2470
|
start: (t) => {
|
|
2458
2471
|
this._resizeStart(t);
|
|
2459
2472
|
},
|
|
@@ -2484,7 +2497,7 @@ class Se extends gt {
|
|
|
2484
2497
|
}
|
|
2485
2498
|
/** @internal */
|
|
2486
2499
|
_setupHelper() {
|
|
2487
|
-
this.elOriginStyleVal =
|
|
2500
|
+
this.elOriginStyleVal = Ne._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2488
2501
|
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2489
2502
|
return this.rectScale = {
|
|
2490
2503
|
x: t.xScale,
|
|
@@ -2493,7 +2506,7 @@ class Se extends gt {
|
|
|
2493
2506
|
}
|
|
2494
2507
|
/** @internal */
|
|
2495
2508
|
_cleanHelper() {
|
|
2496
|
-
return
|
|
2509
|
+
return Ne._originStyleProp.forEach((e, t) => {
|
|
2497
2510
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
2498
2511
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
2499
2512
|
}
|
|
@@ -2505,15 +2518,15 @@ class Se extends gt {
|
|
|
2505
2518
|
left: this.originalRect.left,
|
|
2506
2519
|
top: this.originalRect.top - this.scrolled
|
|
2507
2520
|
}, r = e.clientX - i.clientX, o = this.sizeToContent ? 0 : e.clientY - i.clientY;
|
|
2508
|
-
let n,
|
|
2509
|
-
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,
|
|
2510
|
-
const
|
|
2511
|
-
return Math.round(s.width) !== Math.round(
|
|
2521
|
+
let n, l;
|
|
2522
|
+
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, l = !0);
|
|
2523
|
+
const h = this._constrainSize(s.width, s.height, n, l);
|
|
2524
|
+
return Math.round(s.width) !== Math.round(h.width) && (t.indexOf("w") > -1 && (s.left += s.width - h.width), s.width = h.width), Math.round(s.height) !== Math.round(h.height) && (t.indexOf("n") > -1 && (s.top += s.height - h.height), s.height = h.height), s;
|
|
2512
2525
|
}
|
|
2513
2526
|
/** @internal constrain the size to the set min/max values */
|
|
2514
2527
|
_constrainSize(e, t, i, s) {
|
|
2515
|
-
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e,
|
|
2516
|
-
return { width:
|
|
2528
|
+
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e, l = (s ? r.maxHeightMoveUp : r.maxHeight) || Number.MAX_SAFE_INTEGER, h = r.minHeight / this.rectScale.y || t, u = Math.min(o, Math.max(n, e)), a = Math.min(l, Math.max(h, t));
|
|
2529
|
+
return { width: u, height: a };
|
|
2517
2530
|
}
|
|
2518
2531
|
/** @internal */
|
|
2519
2532
|
_applyChange() {
|
|
@@ -2532,9 +2545,9 @@ class Se extends gt {
|
|
|
2532
2545
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
2533
2546
|
}
|
|
2534
2547
|
}
|
|
2535
|
-
|
|
2536
|
-
const
|
|
2537
|
-
class
|
|
2548
|
+
Ne._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2549
|
+
const Ns = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2550
|
+
class Le extends gt {
|
|
2538
2551
|
constructor(e, t = {}) {
|
|
2539
2552
|
var r;
|
|
2540
2553
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2554,12 +2567,12 @@ class Ne extends gt {
|
|
|
2554
2567
|
}
|
|
2555
2568
|
enable() {
|
|
2556
2569
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2557
|
-
e.addEventListener("mousedown", this._mouseDown),
|
|
2570
|
+
e.addEventListener("mousedown", this._mouseDown), oe && (e.addEventListener("touchstart", Be), e.addEventListener("pointerdown", Ke));
|
|
2558
2571
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2559
2572
|
}
|
|
2560
2573
|
disable(e = !1) {
|
|
2561
2574
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2562
|
-
t.removeEventListener("mousedown", this._mouseDown),
|
|
2575
|
+
t.removeEventListener("mousedown", this._mouseDown), oe && (t.removeEventListener("touchstart", Be), t.removeEventListener("pointerdown", Ke));
|
|
2563
2576
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2564
2577
|
}
|
|
2565
2578
|
destroy() {
|
|
@@ -2571,7 +2584,7 @@ class Ne extends gt {
|
|
|
2571
2584
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2572
2585
|
_mouseDown(e) {
|
|
2573
2586
|
if (!w.mouseHandled)
|
|
2574
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
2587
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Ns) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete w.dragElement, delete w.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), oe && (e.currentTarget.addEventListener("touchmove", Ue), e.currentTarget.addEventListener("touchend", We)), e.preventDefault(), document.activeElement && document.activeElement.blur(), w.mouseHandled = !0), !0;
|
|
2575
2588
|
}
|
|
2576
2589
|
/** @internal method to call actual drag event */
|
|
2577
2590
|
_callDrag(e) {
|
|
@@ -2602,7 +2615,7 @@ class Ne extends gt {
|
|
|
2602
2615
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2603
2616
|
_mouseUp(e) {
|
|
2604
2617
|
var t, i;
|
|
2605
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2618
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), oe && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", Ue, !0), e.currentTarget.removeEventListener("touchend", We, !0)), this.dragging) {
|
|
2606
2619
|
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i = w.dropElement) == null ? void 0 : i.el) === this.el.parentElement && delete w.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
2607
2620
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2608
2621
|
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), w.dropElement && w.dropElement.drop(e);
|
|
@@ -2624,7 +2637,7 @@ class Ne extends gt {
|
|
|
2624
2637
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
2625
2638
|
_createHelper() {
|
|
2626
2639
|
let e = this.el;
|
|
2627
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle =
|
|
2640
|
+
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = c.cloneNode(this.el)), e.parentElement || c.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle = Le.originStyleProp.map((t) => this.el.style[t]), e;
|
|
2628
2641
|
}
|
|
2629
2642
|
/** @internal set the fix position of the dragged item */
|
|
2630
2643
|
_setupHelperStyle(e) {
|
|
@@ -2641,7 +2654,7 @@ class Ne extends gt {
|
|
|
2641
2654
|
const e = (t = this.helper) == null ? void 0 : t.gridstackNode;
|
|
2642
2655
|
if (!(e != null && e._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
2643
2656
|
const i = this.helper, s = this.dragElementOriginStyle.transition || null;
|
|
2644
|
-
i.style.transition = this.dragElementOriginStyle.transition = "none",
|
|
2657
|
+
i.style.transition = this.dragElementOriginStyle.transition = "none", Le.originStyleProp.forEach((r) => i.style[r] = this.dragElementOriginStyle[r] || null), setTimeout(() => i.style.transition = s, 50);
|
|
2645
2658
|
}
|
|
2646
2659
|
return delete this.dragElementOriginStyle, this;
|
|
2647
2660
|
}
|
|
@@ -2683,8 +2696,8 @@ class Ne extends gt {
|
|
|
2683
2696
|
};
|
|
2684
2697
|
}
|
|
2685
2698
|
}
|
|
2686
|
-
|
|
2687
|
-
class
|
|
2699
|
+
Le.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2700
|
+
class Ls extends gt {
|
|
2688
2701
|
constructor(e, t = {}) {
|
|
2689
2702
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2690
2703
|
}
|
|
@@ -2695,10 +2708,10 @@ class Ts extends gt {
|
|
|
2695
2708
|
super.off(e);
|
|
2696
2709
|
}
|
|
2697
2710
|
enable() {
|
|
2698
|
-
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave),
|
|
2711
|
+
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave), oe && (this.el.addEventListener("pointerenter", Ht), this.el.addEventListener("pointerleave", Ot)));
|
|
2699
2712
|
}
|
|
2700
2713
|
disable(e = !1) {
|
|
2701
|
-
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave),
|
|
2714
|
+
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave), oe && (this.el.removeEventListener("pointerenter", Ht), this.el.removeEventListener("pointerleave", Ot)));
|
|
2702
2715
|
}
|
|
2703
2716
|
destroy() {
|
|
2704
2717
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2764,25 +2777,25 @@ class mt {
|
|
|
2764
2777
|
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;
|
|
2765
2778
|
}
|
|
2766
2779
|
setupDraggable(e) {
|
|
2767
|
-
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new
|
|
2780
|
+
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new Le(this.el, e), this;
|
|
2768
2781
|
}
|
|
2769
2782
|
cleanDraggable() {
|
|
2770
2783
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2771
2784
|
}
|
|
2772
2785
|
setupResizable(e) {
|
|
2773
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2786
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new Ne(this.el, e), this;
|
|
2774
2787
|
}
|
|
2775
2788
|
cleanResizable() {
|
|
2776
2789
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2777
2790
|
}
|
|
2778
2791
|
setupDroppable(e) {
|
|
2779
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2792
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Ls(this.el, e), this;
|
|
2780
2793
|
}
|
|
2781
2794
|
cleanDroppable() {
|
|
2782
2795
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2783
2796
|
}
|
|
2784
2797
|
}
|
|
2785
|
-
class
|
|
2798
|
+
class As {
|
|
2786
2799
|
resizable(e, t, i, s) {
|
|
2787
2800
|
return this._getDDElements(e, t).forEach((r) => {
|
|
2788
2801
|
if (t === "disable" || t === "enable")
|
|
@@ -2793,13 +2806,13 @@ class zs {
|
|
|
2793
2806
|
r.setupResizable({ [i]: s });
|
|
2794
2807
|
else {
|
|
2795
2808
|
const n = r.el.gridstackNode.grid;
|
|
2796
|
-
let
|
|
2797
|
-
|
|
2798
|
-
const
|
|
2809
|
+
let l = r.el.getAttribute("gs-resize-handles") || n.opts.resizable.handles || "e,s,se";
|
|
2810
|
+
l === "all" && (l = "n,e,s,w,se,sw,ne,nw");
|
|
2811
|
+
const h = !n.opts.alwaysShowResizeHandle;
|
|
2799
2812
|
r.setupResizable({
|
|
2800
2813
|
...n.opts.resizable,
|
|
2801
|
-
handles:
|
|
2802
|
-
autoHide:
|
|
2814
|
+
handles: l,
|
|
2815
|
+
autoHide: h,
|
|
2803
2816
|
start: t.start,
|
|
2804
2817
|
stop: t.stop,
|
|
2805
2818
|
resize: t.resize
|
|
@@ -2871,7 +2884,7 @@ class zs {
|
|
|
2871
2884
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2872
2885
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2873
2886
|
*/
|
|
2874
|
-
const
|
|
2887
|
+
const K = new As();
|
|
2875
2888
|
class b {
|
|
2876
2889
|
/**
|
|
2877
2890
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2936,7 +2949,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2936
2949
|
/** @internal create placeholder DIV as needed */
|
|
2937
2950
|
get placeholder() {
|
|
2938
2951
|
if (!this._placeholder) {
|
|
2939
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2952
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, J.itemClass, this.opts.itemClass]);
|
|
2940
2953
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2941
2954
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2942
2955
|
}
|
|
@@ -2957,42 +2970,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2957
2970
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2958
2971
|
const g = r.oneColumnSize || 768;
|
|
2959
2972
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2960
|
-
let
|
|
2961
|
-
|
|
2973
|
+
let v = s.find((p) => p.c === 1);
|
|
2974
|
+
v ? v.w = g : (v = { c: 1, w: g }, s.push(v, { c: 12, w: g + 1 }));
|
|
2962
2975
|
}
|
|
2963
2976
|
const o = t.columnOpts;
|
|
2964
|
-
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g,
|
|
2977
|
+
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g, v) => (v.w || 0) - (g.w || 0));
|
|
2965
2978
|
const n = {
|
|
2966
|
-
...c.cloneDeep(
|
|
2967
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2968
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2969
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2970
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2979
|
+
...c.cloneDeep(J),
|
|
2980
|
+
column: c.toNumber(e.getAttribute("gs-column")) || J.column,
|
|
2981
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || J.minRow,
|
|
2982
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || J.maxRow,
|
|
2983
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || J.staticGrid,
|
|
2971
2984
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2972
2985
|
draggable: {
|
|
2973
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2986
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || J.draggable.handle
|
|
2974
2987
|
},
|
|
2975
2988
|
removableOptions: {
|
|
2976
|
-
accept: t.itemClass ||
|
|
2977
|
-
decline:
|
|
2989
|
+
accept: t.itemClass || J.removableOptions.accept,
|
|
2990
|
+
decline: J.removableOptions.decline
|
|
2978
2991
|
}
|
|
2979
2992
|
};
|
|
2980
2993
|
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");
|
|
2981
|
-
const
|
|
2982
|
-
|
|
2983
|
-
const
|
|
2984
|
-
if (this.engine = new
|
|
2994
|
+
const l = this.el.closest("." + J.itemClass), h = l == null ? void 0 : l.gridstackNode;
|
|
2995
|
+
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== J.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = oe), this._styleSheetClass = "gs-id-" + le._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2996
|
+
const u = t.engineClass || b.engineClass || le;
|
|
2997
|
+
if (this.engine = new u({
|
|
2985
2998
|
column: this.getColumn(),
|
|
2986
2999
|
float: t.float,
|
|
2987
3000
|
maxRow: t.maxRow,
|
|
2988
3001
|
onChange: (g) => {
|
|
2989
|
-
let
|
|
3002
|
+
let v = 0;
|
|
2990
3003
|
this.engine.nodes.forEach((p) => {
|
|
2991
|
-
|
|
3004
|
+
v = Math.max(v, p.y + p.h);
|
|
2992
3005
|
}), g.forEach((p) => {
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2995
|
-
}), this._updateStyles(!1,
|
|
3006
|
+
const S = p.el;
|
|
3007
|
+
S && (p._removeDOM ? (S && S.remove(), delete p._removeDOM) : this._writePosAttr(S, p));
|
|
3008
|
+
}), this._updateStyles(!1, v);
|
|
2996
3009
|
}
|
|
2997
3010
|
}), 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) {
|
|
2998
3011
|
const g = t.children;
|
|
@@ -3049,13 +3062,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3049
3062
|
* @returns newly created grid
|
|
3050
3063
|
*/
|
|
3051
3064
|
makeSubGrid(e, t, i, s = !0) {
|
|
3052
|
-
var m, g,
|
|
3065
|
+
var m, g, v;
|
|
3053
3066
|
let r = e.gridstackNode;
|
|
3054
3067
|
if (r || (r = this.makeWidget(e).gridstackNode), (m = r.subGrid) != null && m.el)
|
|
3055
3068
|
return r.subGrid;
|
|
3056
3069
|
let o, n = this;
|
|
3057
3070
|
for (; n && !o; )
|
|
3058
|
-
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (
|
|
3071
|
+
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (v = n.parentGridNode) == null ? void 0 : v.grid;
|
|
3059
3072
|
t = c.cloneDeep({
|
|
3060
3073
|
// by default sub-grid inherit from us | parent, other than id, children, etc...
|
|
3061
3074
|
...this.opts,
|
|
@@ -3068,15 +3081,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3068
3081
|
...o || {},
|
|
3069
3082
|
...t || r.subGridOpts || {}
|
|
3070
3083
|
}), r.subGridOpts = t;
|
|
3071
|
-
let
|
|
3072
|
-
t.column === "auto" && (
|
|
3073
|
-
let
|
|
3074
|
-
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 }, c.removeInternalForSave(a), delete a.subGridOpts, r.content && (a.content = r.content, delete r.content), b.addRemoveCB ?
|
|
3075
|
-
const p =
|
|
3076
|
-
L.transition = "none", this.update(r.el, { w: p, h:
|
|
3084
|
+
let l;
|
|
3085
|
+
t.column === "auto" && (l = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
3086
|
+
let h = r.el.querySelector(".grid-stack-item-content"), u, a;
|
|
3087
|
+
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 }, c.removeInternalForSave(a), delete a.subGridOpts, r.content && (a.content = r.content, delete r.content), b.addRemoveCB ? u = b.addRemoveCB(this.el, a, !0, !1) : (u = c.createDiv(["grid-stack-item"]), u.appendChild(h), h = c.createDiv(["grid-stack-item-content"], r.el)), this.prepareDragDrop(r.el)), i) {
|
|
3088
|
+
const p = l ? t.column : r.w, S = r.h + i.h, L = r.el.style;
|
|
3089
|
+
L.transition = "none", this.update(r.el, { w: p, h: S }), setTimeout(() => L.transition = null);
|
|
3077
3090
|
}
|
|
3078
|
-
const f = r.subGrid = b.addGrid(
|
|
3079
|
-
return i != null && i._moving && (f._isTemp = !0),
|
|
3091
|
+
const f = r.subGrid = b.addGrid(h, t);
|
|
3092
|
+
return i != null && i._moving && (f._isTemp = !0), l && (f._autoColumn = !0), s && f.makeWidget(u, a), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
3080
3093
|
}
|
|
3081
3094
|
/**
|
|
3082
3095
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -3114,7 +3127,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3114
3127
|
const r = c.cloneDeep(this.opts);
|
|
3115
3128
|
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");
|
|
3116
3129
|
const o = r._alwaysShowResizeHandle;
|
|
3117
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
3130
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, J), r.children = s, r;
|
|
3118
3131
|
}
|
|
3119
3132
|
return s;
|
|
3120
3133
|
}
|
|
@@ -3129,15 +3142,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3129
3142
|
* see http://gridstackjs.com/demo/serialization.html
|
|
3130
3143
|
*/
|
|
3131
3144
|
load(e, t = b.addRemoveCB || !0) {
|
|
3132
|
-
var
|
|
3145
|
+
var h;
|
|
3133
3146
|
e = c.cloneDeep(e);
|
|
3134
3147
|
const i = this.getColumn();
|
|
3135
|
-
e.forEach((
|
|
3136
|
-
|
|
3148
|
+
e.forEach((u) => {
|
|
3149
|
+
u.w = u.w || 1, u.h = u.h || 1;
|
|
3137
3150
|
}), e = c.sort(e), this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = !0;
|
|
3138
3151
|
let s = 0;
|
|
3139
|
-
e.forEach((
|
|
3140
|
-
s = Math.max(s, (
|
|
3152
|
+
e.forEach((u) => {
|
|
3153
|
+
s = Math.max(s, (u.x || 0) + u.w);
|
|
3141
3154
|
}), s > this.engine.defaultColumn && (this.engine.defaultColumn = s), s > i && this.engine.cacheLayout(e, s, !0);
|
|
3142
3155
|
const r = b.addRemoveCB;
|
|
3143
3156
|
typeof t == "function" && (b.addRemoveCB = t);
|
|
@@ -3149,17 +3162,17 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3149
3162
|
return;
|
|
3150
3163
|
c.find(e, a.id) || (b.addRemoveCB && b.addRemoveCB(this.el, a, !1, !1), o.push(a), this.removeWidget(a.el, !0, !1));
|
|
3151
3164
|
}), this.engine._loading = !0;
|
|
3152
|
-
const
|
|
3153
|
-
return this.engine.nodes = this.engine.nodes.filter((
|
|
3165
|
+
const l = [];
|
|
3166
|
+
return this.engine.nodes = this.engine.nodes.filter((u) => c.find(e, u.id) ? (l.push(u), !1) : !0), e.forEach((u) => {
|
|
3154
3167
|
var f;
|
|
3155
|
-
const a = c.find(
|
|
3168
|
+
const a = c.find(l, u.id);
|
|
3156
3169
|
if (a) {
|
|
3157
|
-
if (c.shouldSizeToContent(a) && (
|
|
3170
|
+
if (c.shouldSizeToContent(a) && (u.h = a.h), this.engine.nodeBoundFix(u), (u.autoPosition || u.x === void 0 || u.y === void 0) && (u.w = u.w || a.w, u.h = u.h || a.h, this.engine.findEmptyPosition(u)), this.engine.nodes.push(a), c.samePos(a, u) && this.engine.nodes.length > 1 && (this.moveNode(a, { ...u, forceCollide: !0 }), c.copyPos(u, a)), this.update(a.el, u), (f = u.subGridOpts) != null && f.children) {
|
|
3158
3171
|
const m = a.el.querySelector(".grid-stack");
|
|
3159
|
-
m && m.gridstack && m.gridstack.load(
|
|
3172
|
+
m && m.gridstack && m.gridstack.load(u.subGridOpts.children);
|
|
3160
3173
|
}
|
|
3161
|
-
} else t && this.addWidget(
|
|
3162
|
-
}), 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 && ((
|
|
3174
|
+
} else t && this.addWidget(u);
|
|
3175
|
+
}), 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 && ((h = this.opts) != null && h.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
3163
3176
|
}
|
|
3164
3177
|
/**
|
|
3165
3178
|
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
@@ -3239,7 +3252,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3239
3252
|
i = e.breakpoints[n++].c || t;
|
|
3240
3253
|
}
|
|
3241
3254
|
if (i !== t) {
|
|
3242
|
-
const n = (o = e.breakpoints) == null ? void 0 : o.find((
|
|
3255
|
+
const n = (o = e.breakpoints) == null ? void 0 : o.find((l) => l.c === i);
|
|
3243
3256
|
return this.column(i, (n == null ? void 0 : n.layout) || e.layout), !0;
|
|
3244
3257
|
}
|
|
3245
3258
|
return !1;
|
|
@@ -3317,8 +3330,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3317
3330
|
const i = this.el.getBoundingClientRect();
|
|
3318
3331
|
let s;
|
|
3319
3332
|
t ? s = { top: i.top + document.documentElement.scrollTop, left: i.left } : s = { top: this.el.offsetTop, left: this.el.offsetLeft };
|
|
3320
|
-
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(),
|
|
3321
|
-
return { x: Math.floor(r / n), y: Math.floor(o /
|
|
3333
|
+
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(), l = i.height / parseInt(this.el.getAttribute("gs-current-row"));
|
|
3334
|
+
return { x: Math.floor(r / n), y: Math.floor(o / l) };
|
|
3322
3335
|
}
|
|
3323
3336
|
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
3324
3337
|
getRow() {
|
|
@@ -3440,7 +3453,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3440
3453
|
*/
|
|
3441
3454
|
update(e, t) {
|
|
3442
3455
|
return b.getElements(e).forEach((i) => {
|
|
3443
|
-
var
|
|
3456
|
+
var u;
|
|
3444
3457
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3445
3458
|
if (!s)
|
|
3446
3459
|
return;
|
|
@@ -3452,16 +3465,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3452
3465
|
n[a] = r[a] !== void 0 ? r[a] : s[a], delete r[a];
|
|
3453
3466
|
})), !n && (r.minW || r.minH || r.maxW || r.maxH) && (n = {}), r.content !== void 0) {
|
|
3454
3467
|
const a = i.querySelector(".grid-stack-item-content");
|
|
3455
|
-
a && a.textContent !== r.content && (s.content = r.content, b.renderCB(a, r), (
|
|
3468
|
+
a && a.textContent !== r.content && (s.content = r.content, b.renderCB(a, r), (u = s.subGrid) != null && u.el && (a.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3456
3469
|
}
|
|
3457
|
-
let
|
|
3470
|
+
let l = !1, h = !1;
|
|
3458
3471
|
for (const a in r)
|
|
3459
|
-
a[0] !== "_" && s[a] !== r[a] && (s[a] = r[a],
|
|
3472
|
+
a[0] !== "_" && s[a] !== r[a] && (s[a] = r[a], l = !0, h = h || !this.opts.staticGrid && (a === "noResize" || a === "noMove" || a === "locked"));
|
|
3460
3473
|
if (c.sanitizeMinMax(s), n) {
|
|
3461
3474
|
const a = n.w !== void 0 && n.w !== s.w;
|
|
3462
3475
|
this.moveNode(s, n), a && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(a, s), delete s._orig;
|
|
3463
3476
|
}
|
|
3464
|
-
(n ||
|
|
3477
|
+
(n || l) && this._writeAttr(i, s), h && this.prepareDragDrop(s.el);
|
|
3465
3478
|
}), this;
|
|
3466
3479
|
}
|
|
3467
3480
|
moveNode(e, t) {
|
|
@@ -3490,12 +3503,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3490
3503
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3491
3504
|
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(b.resizeToContentParent)), !o)
|
|
3492
3505
|
return;
|
|
3493
|
-
const n = e.clientHeight - o.clientHeight,
|
|
3494
|
-
let
|
|
3506
|
+
const n = e.clientHeight - o.clientHeight, l = t.h ? t.h * s - n : o.clientHeight;
|
|
3507
|
+
let h;
|
|
3495
3508
|
if (t.subGrid) {
|
|
3496
|
-
|
|
3497
|
-
const g = t.subGrid.el.getBoundingClientRect(),
|
|
3498
|
-
|
|
3509
|
+
h = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3510
|
+
const g = t.subGrid.el.getBoundingClientRect(), v = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3511
|
+
h += g.top - v.top;
|
|
3499
3512
|
} else {
|
|
3500
3513
|
if ((m = (f = t.subGridOpts) == null ? void 0 : f.children) != null && m.length)
|
|
3501
3514
|
return;
|
|
@@ -3505,15 +3518,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3505
3518
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3506
3519
|
return;
|
|
3507
3520
|
}
|
|
3508
|
-
|
|
3521
|
+
h = g.getBoundingClientRect().height || l;
|
|
3509
3522
|
}
|
|
3510
3523
|
}
|
|
3511
|
-
if (
|
|
3524
|
+
if (l === h)
|
|
3512
3525
|
return;
|
|
3513
|
-
r +=
|
|
3514
|
-
let
|
|
3526
|
+
r += h - l;
|
|
3527
|
+
let u = Math.ceil(r / s);
|
|
3515
3528
|
const a = Number.isInteger(t.sizeToContent) ? t.sizeToContent : 0;
|
|
3516
|
-
a &&
|
|
3529
|
+
a && u > a && (u = a, e.classList.add("size-to-content-max")), t.minH && u < t.minH ? u = t.minH : t.maxH && u > t.maxH && (u = t.maxH), u !== t.h && (i._ignoreLayoutsNodeChange = !0, i.moveNode(t, { h: u }), delete i._ignoreLayoutsNodeChange);
|
|
3517
3530
|
}
|
|
3518
3531
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3519
3532
|
resizeToContentCBCheck(e) {
|
|
@@ -3530,8 +3543,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3530
3543
|
return;
|
|
3531
3544
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3532
3545
|
if (t) {
|
|
3533
|
-
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0,
|
|
3534
|
-
r.x = s.x + n - (s.h - (
|
|
3546
|
+
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0, l = t.top > 0 ? Math.floor(t.top / this.opts.cellHeight) : 0;
|
|
3547
|
+
r.x = s.x + n - (s.h - (l + 1)), r.y = s.y + l - n;
|
|
3535
3548
|
}
|
|
3536
3549
|
Object.keys(r).forEach((n) => {
|
|
3537
3550
|
r[n] === void 0 && delete r[n];
|
|
@@ -3634,8 +3647,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3634
3647
|
}), !this._styles)
|
|
3635
3648
|
return this;
|
|
3636
3649
|
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
3637
|
-
const n = this.opts.marginTop + this.opts.marginUnit,
|
|
3638
|
-
c.addCSSRule(this._styles, a, `top: ${n}; right: ${
|
|
3650
|
+
const n = this.opts.marginTop + this.opts.marginUnit, l = this.opts.marginBottom + this.opts.marginUnit, h = this.opts.marginRight + this.opts.marginUnit, u = this.opts.marginLeft + this.opts.marginUnit, a = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
3651
|
+
c.addCSSRule(this._styles, a, `top: ${n}; right: ${h}; bottom: ${l}; left: ${u};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${h}; bottom: ${l}; left: ${u};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${h}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${h}; bottom: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${u}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${u}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${u}; bottom: ${l}`);
|
|
3639
3652
|
}
|
|
3640
3653
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
3641
3654
|
const o = (n) => i * n + s;
|
|
@@ -3665,7 +3678,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3665
3678
|
}
|
|
3666
3679
|
/** @internal */
|
|
3667
3680
|
_prepareElement(e, t = !1, i) {
|
|
3668
|
-
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(
|
|
3681
|
+
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(J.itemClass, this.opts.itemClass);
|
|
3669
3682
|
const s = c.shouldSizeToContent(i);
|
|
3670
3683
|
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;
|
|
3671
3684
|
}
|
|
@@ -3771,7 +3784,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3771
3784
|
*/
|
|
3772
3785
|
/** get the global (but static to this code) DD implementation */
|
|
3773
3786
|
static getDD() {
|
|
3774
|
-
return
|
|
3787
|
+
return K;
|
|
3775
3788
|
}
|
|
3776
3789
|
/**
|
|
3777
3790
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3784,7 +3797,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3784
3797
|
*/
|
|
3785
3798
|
static setupDragIn(e, t, i, s = document) {
|
|
3786
3799
|
(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) => {
|
|
3787
|
-
|
|
3800
|
+
K.isDraggable(o) || K.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3788
3801
|
});
|
|
3789
3802
|
}
|
|
3790
3803
|
/**
|
|
@@ -3863,12 +3876,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3863
3876
|
}
|
|
3864
3877
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3865
3878
|
_removeDD(e) {
|
|
3866
|
-
return
|
|
3879
|
+
return K.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3867
3880
|
}
|
|
3868
3881
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3869
3882
|
_setupAcceptWidget() {
|
|
3870
3883
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3871
|
-
return
|
|
3884
|
+
return K.droppable(this.el, "destroy"), this;
|
|
3872
3885
|
let e, t;
|
|
3873
3886
|
const i = (s, r, o) => {
|
|
3874
3887
|
var f;
|
|
@@ -3881,19 +3894,19 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3881
3894
|
const m = o.getBoundingClientRect();
|
|
3882
3895
|
o.style.left = m.x + (this.dragTransform.xScale - 1) * (s.clientX - m.x) / this.dragTransform.xScale + "px", o.style.top = m.y + (this.dragTransform.yScale - 1) * (s.clientY - m.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
3883
3896
|
}
|
|
3884
|
-
let { top:
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3897
|
+
let { top: l, left: h } = o.getBoundingClientRect();
|
|
3898
|
+
const u = this.el.getBoundingClientRect();
|
|
3899
|
+
h -= u.left, l -= u.top;
|
|
3887
3900
|
const a = {
|
|
3888
3901
|
position: {
|
|
3889
|
-
top:
|
|
3890
|
-
left:
|
|
3902
|
+
top: l * this.dragTransform.xScale,
|
|
3903
|
+
left: h * this.dragTransform.yScale
|
|
3891
3904
|
}
|
|
3892
3905
|
};
|
|
3893
3906
|
if (n._temporaryRemoved) {
|
|
3894
|
-
if (n.x = Math.max(0, Math.round(
|
|
3907
|
+
if (n.x = Math.max(0, Math.round(h / t)), n.y = Math.max(0, Math.round(l / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3895
3908
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3896
|
-
|
|
3909
|
+
K.off(r, "drag");
|
|
3897
3910
|
return;
|
|
3898
3911
|
}
|
|
3899
3912
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
@@ -3902,7 +3915,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3902
3915
|
} else
|
|
3903
3916
|
this._dragOrResize(o, s, a, n, t, e);
|
|
3904
3917
|
};
|
|
3905
|
-
return
|
|
3918
|
+
return K.droppable(this.el, {
|
|
3906
3919
|
accept: (s) => {
|
|
3907
3920
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3908
3921
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3927,42 +3940,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3927
3940
|
if ((n == null ? void 0 : n.grid) === this && !n._temporaryRemoved)
|
|
3928
3941
|
return !1;
|
|
3929
3942
|
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) {
|
|
3930
|
-
const
|
|
3931
|
-
if (
|
|
3943
|
+
const u = o.getAttribute("data-gs-widget") || o.getAttribute("gridstacknode");
|
|
3944
|
+
if (u) {
|
|
3932
3945
|
try {
|
|
3933
|
-
n = JSON.parse(
|
|
3946
|
+
n = JSON.parse(u);
|
|
3934
3947
|
} catch {
|
|
3935
|
-
console.error("Gridstack dropover: Bad JSON format: ",
|
|
3948
|
+
console.error("Gridstack dropover: Bad JSON format: ", u);
|
|
3936
3949
|
}
|
|
3937
3950
|
o.removeAttribute("data-gs-widget"), o.removeAttribute("gridstacknode");
|
|
3938
3951
|
}
|
|
3939
3952
|
n || (n = this._readAttr(o)), n._sidebarOrig = { w: n.w, h: n.h };
|
|
3940
3953
|
}
|
|
3941
3954
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3942
|
-
const
|
|
3943
|
-
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w:
|
|
3944
|
-
n._temporaryRemoved = !0) : (n.w =
|
|
3955
|
+
const l = n.w || Math.round(o.offsetWidth / t) || 1, h = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3956
|
+
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: l, h, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3957
|
+
n._temporaryRemoved = !0) : (n.w = l, n.h = h, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1), K.on(r, "drag", i), i(s, r, o), !1;
|
|
3945
3958
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3946
3959
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3947
3960
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3948
3961
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3949
|
-
var m, g,
|
|
3962
|
+
var m, g, v;
|
|
3950
3963
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3951
3964
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3952
3965
|
return !1;
|
|
3953
|
-
const
|
|
3966
|
+
const l = !!this.placeholder.parentElement, h = r !== o;
|
|
3954
3967
|
this.placeholder.remove(), delete this.placeholder.gridstackNode;
|
|
3955
|
-
const
|
|
3956
|
-
|
|
3968
|
+
const u = l && this.opts.animate;
|
|
3969
|
+
u && this.setAnimation(!1);
|
|
3957
3970
|
const a = r._gridstackNodeOrig;
|
|
3958
|
-
if (delete r._gridstackNodeOrig,
|
|
3971
|
+
if (delete r._gridstackNodeOrig, l && (a != null && a.grid) && a.grid !== this) {
|
|
3959
3972
|
const p = a.grid;
|
|
3960
3973
|
p.engine.removeNodeFromLayoutCache(a), p.engine.removedNodes.push(a), p._triggerRemoveEvent()._triggerChangeEvent(), p.parentGridNode && !p.engine.nodes.length && p.opts.subGridDynamic && p.removeAsSubGrid();
|
|
3961
3974
|
}
|
|
3962
|
-
if (!n || (
|
|
3975
|
+
if (!n || (l && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp, K.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !l))
|
|
3963
3976
|
return !1;
|
|
3964
|
-
const f = (
|
|
3965
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r),
|
|
3977
|
+
const f = (v = (g = n.subGrid) == null ? void 0 : g.el) == null ? void 0 : v.gridstack;
|
|
3978
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts || b.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, a && a.grid ? a : void 0, n), u && this.setAnimation(this.opts.animate, !0), !1;
|
|
3966
3979
|
}), this;
|
|
3967
3980
|
}
|
|
3968
3981
|
/** @internal mark item for removal */
|
|
@@ -3977,7 +3990,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3977
3990
|
if (typeof this.opts.removable != "string")
|
|
3978
3991
|
return this;
|
|
3979
3992
|
const e = document.querySelector(this.opts.removable);
|
|
3980
|
-
return e ? (!this.opts.staticGrid && !
|
|
3993
|
+
return e ? (!this.opts.staticGrid && !K.isDroppable(e) && K.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;
|
|
3981
3994
|
}
|
|
3982
3995
|
/**
|
|
3983
3996
|
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
@@ -3992,34 +4005,34 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3992
4005
|
if ((t || o) && (i._initDD && (this._removeDD(e), delete i._initDD), o && e.classList.add("ui-draggable-disabled", "ui-resizable-disabled"), !t))
|
|
3993
4006
|
return this;
|
|
3994
4007
|
if (!i._initDD) {
|
|
3995
|
-
let n,
|
|
3996
|
-
const
|
|
3997
|
-
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(),
|
|
3998
|
-
},
|
|
3999
|
-
this._dragOrResize(e, f, m, i, n,
|
|
4008
|
+
let n, l;
|
|
4009
|
+
const h = (f, m) => {
|
|
4010
|
+
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(), l = this.getCellHeight(!0), this._onStartMoving(e, f, m, i, n, l);
|
|
4011
|
+
}, u = (f, m) => {
|
|
4012
|
+
this._dragOrResize(e, f, m, i, n, l);
|
|
4000
4013
|
}, a = (f) => {
|
|
4001
4014
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete i._moving, delete i._event, delete i._lastTried;
|
|
4002
4015
|
const m = i.w !== i._orig.w, g = f.target;
|
|
4003
4016
|
if (!(!g.gridstackNode || g.gridstackNode.grid !== this)) {
|
|
4004
4017
|
if (i.el = g, i._isAboutToRemove) {
|
|
4005
|
-
const
|
|
4006
|
-
|
|
4018
|
+
const v = e.gridstackNode.grid;
|
|
4019
|
+
v._gsEventHandler[f.type] && v._gsEventHandler[f.type](f, g), v.engine.nodes.push(i), v.removeWidget(e, !0, !0);
|
|
4007
4020
|
} else
|
|
4008
4021
|
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);
|
|
4009
4022
|
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(m, i));
|
|
4010
4023
|
}
|
|
4011
4024
|
};
|
|
4012
|
-
|
|
4013
|
-
start:
|
|
4025
|
+
K.draggable(e, {
|
|
4026
|
+
start: h,
|
|
4014
4027
|
stop: a,
|
|
4015
|
-
drag:
|
|
4028
|
+
drag: u
|
|
4016
4029
|
}).resizable(e, {
|
|
4017
|
-
start:
|
|
4030
|
+
start: h,
|
|
4018
4031
|
stop: a,
|
|
4019
|
-
resize:
|
|
4032
|
+
resize: u
|
|
4020
4033
|
}), i._initDD = !0;
|
|
4021
4034
|
}
|
|
4022
|
-
return
|
|
4035
|
+
return K.draggable(e, s ? "disable" : "enable").resizable(e, r ? "disable" : "enable"), this;
|
|
4023
4036
|
}
|
|
4024
4037
|
/** @internal handles actual drag/resize start */
|
|
4025
4038
|
_onStartMoving(e, t, i, s, r, o) {
|
|
@@ -4027,8 +4040,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4027
4040
|
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)
|
|
4028
4041
|
this.dragTransform = c.getValuesFromTransformedElement(e);
|
|
4029
4042
|
else if (this.placeholder && this.placeholder.closest(".grid-stack")) {
|
|
4030
|
-
const
|
|
4031
|
-
this.dragTransform = c.getValuesFromTransformedElement(
|
|
4043
|
+
const l = this.placeholder.closest(".grid-stack");
|
|
4044
|
+
this.dragTransform = c.getValuesFromTransformedElement(l);
|
|
4032
4045
|
} else
|
|
4033
4046
|
this.dragTransform = {
|
|
4034
4047
|
xScale: 1,
|
|
@@ -4037,46 +4050,46 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4037
4050
|
yOffset: 0
|
|
4038
4051
|
};
|
|
4039
4052
|
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") {
|
|
4040
|
-
const
|
|
4041
|
-
|
|
4053
|
+
const l = this.getColumn() - s.x, h = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
4054
|
+
K.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, l)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, h)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, l)).resizable(e, "option", "maxWidthMoveLeft", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, s.x + s.w)).resizable(e, "option", "maxHeight", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, h)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
4042
4055
|
}
|
|
4043
4056
|
}
|
|
4044
4057
|
/** @internal handles actual drag/resize */
|
|
4045
4058
|
_dragOrResize(e, t, i, s, r, o) {
|
|
4046
4059
|
const n = { ...s._orig };
|
|
4047
|
-
let
|
|
4060
|
+
let l, h = this.opts.marginLeft, u = this.opts.marginRight, a = this.opts.marginTop, f = this.opts.marginBottom;
|
|
4048
4061
|
const m = Math.round(o * 0.1), g = Math.round(r * 0.1);
|
|
4049
|
-
if (
|
|
4062
|
+
if (h = Math.min(h, g), u = Math.min(u, g), a = Math.min(a, m), f = Math.min(f, m), t.type === "drag") {
|
|
4050
4063
|
if (s._temporaryRemoved)
|
|
4051
4064
|
return;
|
|
4052
4065
|
const p = i.position.top - s._prevYPix;
|
|
4053
4066
|
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, p);
|
|
4054
|
-
const
|
|
4055
|
-
n.x = Math.round(
|
|
4056
|
-
const
|
|
4067
|
+
const S = i.position.left + (i.position.left > s._lastUiPosition.left ? -u : h), L = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : a);
|
|
4068
|
+
n.x = Math.round(S / r), n.y = Math.round(L / o);
|
|
4069
|
+
const R = this._extraDragRow;
|
|
4057
4070
|
if (this.engine.collide(s, n)) {
|
|
4058
|
-
const
|
|
4059
|
-
let
|
|
4060
|
-
this.opts.maxRow &&
|
|
4071
|
+
const k = this.getRow();
|
|
4072
|
+
let G = Math.max(0, n.y + s.h - k);
|
|
4073
|
+
this.opts.maxRow && k + G > this.opts.maxRow && (G = Math.max(0, this.opts.maxRow - k)), this._extraDragRow = G;
|
|
4061
4074
|
} else
|
|
4062
4075
|
this._extraDragRow = 0;
|
|
4063
|
-
if (this._extraDragRow !==
|
|
4076
|
+
if (this._extraDragRow !== R && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
4064
4077
|
return;
|
|
4065
4078
|
} else if (t.type === "resize") {
|
|
4066
|
-
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width -
|
|
4079
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - h) / r), n.h = Math.round((i.size.height - a) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
4067
4080
|
return;
|
|
4068
|
-
const p = i.position.left +
|
|
4069
|
-
n.x = Math.round(p / r), n.y = Math.round(
|
|
4081
|
+
const p = i.position.left + h, S = i.position.top + a;
|
|
4082
|
+
n.x = Math.round(p / r), n.y = Math.round(S / o), l = !0;
|
|
4070
4083
|
}
|
|
4071
4084
|
s._event = t, s._lastTried = n;
|
|
4072
|
-
const
|
|
4073
|
-
x: i.position.left +
|
|
4085
|
+
const v = {
|
|
4086
|
+
x: i.position.left + h,
|
|
4074
4087
|
y: i.position.top + a,
|
|
4075
|
-
w: (i.size ? i.size.width : s.w * r) -
|
|
4088
|
+
w: (i.size ? i.size.width : s.w * r) - h - u,
|
|
4076
4089
|
h: (i.size ? i.size.height : s.h * o) - a - f
|
|
4077
4090
|
};
|
|
4078
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect:
|
|
4079
|
-
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a,
|
|
4091
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: v, resizing: l })) {
|
|
4092
|
+
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a, u, f, h), delete s._skipDown, l && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
4080
4093
|
const p = t.target;
|
|
4081
4094
|
s._sidebarOrig || this._writePosAttr(p, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, p);
|
|
4082
4095
|
}
|
|
@@ -4088,7 +4101,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4088
4101
|
_leave(e, t) {
|
|
4089
4102
|
t = t || e;
|
|
4090
4103
|
const i = t.gridstackNode;
|
|
4091
|
-
if (!i || (t.style.transform = t.style.transformOrigin = null,
|
|
4104
|
+
if (!i || (t.style.transform = t.style.transformOrigin = null, K.off(e, "drag"), i._temporaryRemoved))
|
|
4092
4105
|
return;
|
|
4093
4106
|
i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e;
|
|
4094
4107
|
const s = i._sidebarOrig;
|
|
@@ -4096,190 +4109,190 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4096
4109
|
}
|
|
4097
4110
|
// legacy method removed
|
|
4098
4111
|
commit() {
|
|
4099
|
-
return
|
|
4112
|
+
return Ss(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
4100
4113
|
}
|
|
4101
4114
|
}
|
|
4102
|
-
b.renderCB = (
|
|
4103
|
-
|
|
4115
|
+
b.renderCB = (d, e) => {
|
|
4116
|
+
d && (e != null && e.content) && (d.textContent = e.content);
|
|
4104
4117
|
};
|
|
4105
4118
|
b.resizeToContentParent = ".grid-stack-item-content";
|
|
4106
4119
|
b.Utils = c;
|
|
4107
|
-
b.Engine =
|
|
4120
|
+
b.Engine = le;
|
|
4108
4121
|
b.GDRev = "11.5.1";
|
|
4109
|
-
const
|
|
4122
|
+
const Hs = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Os = { class: "grid-stack-item-content" }, Ms = /* @__PURE__ */ ee({
|
|
4110
4123
|
__name: "DraggableGridLayout",
|
|
4111
4124
|
props: {
|
|
4112
4125
|
tiles: {},
|
|
4113
|
-
tileHeight: { default:
|
|
4126
|
+
tileHeight: { default: Xe }
|
|
4114
4127
|
},
|
|
4115
4128
|
emits: ["update-tiles"],
|
|
4116
|
-
setup(
|
|
4117
|
-
const i =
|
|
4129
|
+
setup(d, { expose: e, emit: t }) {
|
|
4130
|
+
const i = d, s = t, r = A(null), o = A(new Map(i.tiles.map((m) => [`${m.id}`, m])));
|
|
4118
4131
|
let n = null;
|
|
4119
|
-
const
|
|
4132
|
+
const l = (m) => `[data-id="${m}"]`, h = (m) => m.map((g) => {
|
|
4120
4133
|
var p;
|
|
4121
|
-
const
|
|
4122
|
-
if (
|
|
4134
|
+
const v = o.value.get(`${(p = g.el) == null ? void 0 : p.getAttribute("data-id")}`);
|
|
4135
|
+
if (v)
|
|
4123
4136
|
return {
|
|
4124
|
-
...
|
|
4137
|
+
...v,
|
|
4125
4138
|
layout: {
|
|
4126
4139
|
position: { col: Number(g.x), row: Number(g.y) },
|
|
4127
4140
|
size: { cols: Number(g.w), rows: Number(g.h) }
|
|
4128
4141
|
}
|
|
4129
4142
|
};
|
|
4130
|
-
}).filter((g) => g !== void 0),
|
|
4131
|
-
n && (
|
|
4143
|
+
}).filter((g) => g !== void 0), u = (m, g) => {
|
|
4144
|
+
n && (h(g).forEach((p) => {
|
|
4132
4145
|
o.value.set(`${p.id}`, p);
|
|
4133
4146
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4134
4147
|
}, a = (m, g) => {
|
|
4135
|
-
g.forEach((
|
|
4148
|
+
g.forEach((v) => {
|
|
4136
4149
|
var p;
|
|
4137
|
-
o.value.delete(`${(p =
|
|
4150
|
+
o.value.delete(`${(p = v.el) == null ? void 0 : p.getAttribute("data-id")}`);
|
|
4138
4151
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
4139
4152
|
};
|
|
4140
4153
|
at(() => {
|
|
4141
4154
|
r.value && (n = b.init({
|
|
4142
4155
|
margin: 10,
|
|
4143
|
-
column:
|
|
4156
|
+
column: Wt,
|
|
4144
4157
|
cellHeight: i.tileHeight,
|
|
4145
4158
|
resizable: { handles: "se, sw" },
|
|
4146
4159
|
handle: ".tile-header"
|
|
4147
|
-
}, r.value), n.on("change",
|
|
4160
|
+
}, r.value), n.on("change", u), n.on("added", u), n.on("removed", a));
|
|
4148
4161
|
}), lt(() => {
|
|
4149
4162
|
n && n.destroy(!1);
|
|
4150
4163
|
});
|
|
4151
4164
|
const f = (m) => {
|
|
4152
4165
|
if (n && r.value) {
|
|
4153
|
-
const g = r.value.querySelector(
|
|
4166
|
+
const g = r.value.querySelector(l(m));
|
|
4154
4167
|
g && n.removeWidget(g);
|
|
4155
4168
|
}
|
|
4156
4169
|
};
|
|
4157
4170
|
return Qe(() => i.tiles.length, async (m, g) => {
|
|
4158
4171
|
if (m > g && n) {
|
|
4159
|
-
const
|
|
4160
|
-
for (const p of
|
|
4161
|
-
o.value.set(`${p.id}`, p), await
|
|
4172
|
+
const v = i.tiles.slice(g);
|
|
4173
|
+
for (const p of v)
|
|
4174
|
+
o.value.set(`${p.id}`, p), await ut(), n.makeWidget(l(p.id), {
|
|
4162
4175
|
autoPosition: !0,
|
|
4163
4176
|
w: p.layout.size.cols,
|
|
4164
4177
|
h: p.layout.size.rows
|
|
4165
4178
|
});
|
|
4166
4179
|
}
|
|
4167
|
-
}),
|
|
4180
|
+
}), Mt(() => {
|
|
4168
4181
|
i.tiles.forEach((m) => {
|
|
4169
4182
|
o.value.set(`${m.id}`, m);
|
|
4170
4183
|
});
|
|
4171
|
-
}), e({ removeWidget: f }), (m, g) => (
|
|
4184
|
+
}), e({ removeWidget: f }), (m, g) => (C(), Q("div", {
|
|
4172
4185
|
ref_key: "gridContainer",
|
|
4173
4186
|
ref: r,
|
|
4174
4187
|
class: "grid-stack"
|
|
4175
4188
|
}, [
|
|
4176
|
-
(
|
|
4177
|
-
key:
|
|
4189
|
+
(C(!0), Q($t, null, Ft(i.tiles, (v) => (C(), Q("div", {
|
|
4190
|
+
key: v.id,
|
|
4178
4191
|
class: "grid-stack-item",
|
|
4179
|
-
"data-id": `${
|
|
4180
|
-
"data-testid": `grid-stack-item-${
|
|
4181
|
-
"gs-h":
|
|
4192
|
+
"data-id": `${v.id}`,
|
|
4193
|
+
"data-testid": `grid-stack-item-${v.id}`,
|
|
4194
|
+
"gs-h": v.layout.size.rows,
|
|
4182
4195
|
"gs-lazy-load": !0,
|
|
4183
|
-
"gs-w":
|
|
4184
|
-
"gs-x":
|
|
4185
|
-
"gs-y":
|
|
4196
|
+
"gs-w": v.layout.size.cols,
|
|
4197
|
+
"gs-x": v.layout.position.col,
|
|
4198
|
+
"gs-y": v.layout.position.row
|
|
4186
4199
|
}, [
|
|
4187
|
-
ce("div",
|
|
4188
|
-
|
|
4200
|
+
ce("div", Os, [
|
|
4201
|
+
De(m.$slots, "tile", { tile: v }, void 0, !0)
|
|
4189
4202
|
])
|
|
4190
|
-
], 8,
|
|
4203
|
+
], 8, Hs))), 128))
|
|
4191
4204
|
], 512));
|
|
4192
4205
|
}
|
|
4193
|
-
}),
|
|
4206
|
+
}), Is = /* @__PURE__ */ ve(Ms, [["__scopeId", "data-v-a68d6821"]]), qs = {
|
|
4194
4207
|
key: 0,
|
|
4195
4208
|
class: "fullscreen-header"
|
|
4196
|
-
},
|
|
4209
|
+
}, Ps = {
|
|
4197
4210
|
key: 0,
|
|
4198
4211
|
class: "tile-container slottable-tile"
|
|
4199
|
-
},
|
|
4212
|
+
}, $s = /* @__PURE__ */ ee({
|
|
4200
4213
|
__name: "DashboardRenderer",
|
|
4201
|
-
props: /* @__PURE__ */
|
|
4214
|
+
props: /* @__PURE__ */ xt({
|
|
4202
4215
|
context: {}
|
|
4203
4216
|
}, {
|
|
4204
4217
|
modelValue: { required: !0 },
|
|
4205
4218
|
modelModifiers: {}
|
|
4206
4219
|
}),
|
|
4207
|
-
emits: /* @__PURE__ */
|
|
4208
|
-
setup(
|
|
4209
|
-
|
|
4220
|
+
emits: /* @__PURE__ */ xt(["edit-tile", "tile-time-range-zoom"], ["update:modelValue"]),
|
|
4221
|
+
setup(d, { expose: e, emit: t }) {
|
|
4222
|
+
Ye((E) => ({
|
|
4210
4223
|
"82baf22a": a.value
|
|
4211
4224
|
}));
|
|
4212
|
-
const i =
|
|
4213
|
-
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),
|
|
4214
|
-
const m =
|
|
4225
|
+
const i = d, s = t, r = fi(d, "modelValue"), { i18n: o } = ue.useI18n(), n = A(0), l = A(null), h = A(), u = A(), a = A("scale(1)"), f = ye(pe);
|
|
4226
|
+
f || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ue.useRequestQueue();
|
|
4227
|
+
const m = dt(), g = z(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4215
4228
|
type: "relative",
|
|
4216
4229
|
time_range: m.defaultQueryTimeForOrg
|
|
4217
|
-
}),
|
|
4218
|
-
const
|
|
4219
|
-
return
|
|
4220
|
-
},
|
|
4221
|
-
var
|
|
4222
|
-
let N =
|
|
4230
|
+
}), v = z(() => !!i.context.timeSpec || !m.loading), p = (E, N) => {
|
|
4231
|
+
const O = E.layout.position.row - N.layout.position.row;
|
|
4232
|
+
return O !== 0 ? O : E.layout.position.col - N.layout.position.col;
|
|
4233
|
+
}, S = z(() => r.value.tiles.map((E) => {
|
|
4234
|
+
var O;
|
|
4235
|
+
let N = E.definition;
|
|
4223
4236
|
if ("description" in N.chart) {
|
|
4224
|
-
const
|
|
4225
|
-
const
|
|
4226
|
-
return o.te(
|
|
4237
|
+
const M = (O = N.chart.description) == null ? void 0 : O.replace(Ui, () => {
|
|
4238
|
+
const fe = `renderer.trendRange.${g.value.type === "absolute" ? "custom" : g.value.time_range}`;
|
|
4239
|
+
return o.te(fe) ? o.t(fe) : "";
|
|
4227
4240
|
});
|
|
4228
4241
|
N = {
|
|
4229
4242
|
...N,
|
|
4230
4243
|
chart: {
|
|
4231
4244
|
...N.chart,
|
|
4232
|
-
description:
|
|
4245
|
+
description: M
|
|
4233
4246
|
}
|
|
4234
4247
|
};
|
|
4235
4248
|
}
|
|
4236
|
-
return i.context.editable && !
|
|
4249
|
+
return i.context.editable && !E.id && console.warn(
|
|
4237
4250
|
"No id provided for tile. One will be generated automatically,",
|
|
4238
4251
|
"however tracking changes to this tile may not work as expected.",
|
|
4239
|
-
|
|
4252
|
+
E
|
|
4240
4253
|
), {
|
|
4241
|
-
layout:
|
|
4254
|
+
layout: E.layout,
|
|
4242
4255
|
meta: N,
|
|
4243
|
-
type:
|
|
4256
|
+
type: E.type,
|
|
4244
4257
|
// Add a unique key to each tile internally.
|
|
4245
|
-
id:
|
|
4258
|
+
id: E.id ?? crypto.randomUUID()
|
|
4246
4259
|
};
|
|
4247
|
-
})), L =
|
|
4248
|
-
var
|
|
4249
|
-
let { tz:
|
|
4250
|
-
const
|
|
4251
|
-
if (
|
|
4252
|
-
let
|
|
4260
|
+
})), L = z(() => {
|
|
4261
|
+
var fe, qe, ke;
|
|
4262
|
+
let { tz: E, refreshInterval: N, editable: O } = i.context;
|
|
4263
|
+
const M = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
4264
|
+
if (E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), N === void 0 && (N = Wi), W.value) {
|
|
4265
|
+
let Te = !1;
|
|
4253
4266
|
if (g.value.type === "relative")
|
|
4254
|
-
|
|
4267
|
+
Te = ["15m", "1h", "6h", "12h", "24h"].includes(g.value.time_range);
|
|
4255
4268
|
else {
|
|
4256
|
-
const
|
|
4257
|
-
|
|
4269
|
+
const et = g.value.start.getTime(), tt = g.value.end.getTime();
|
|
4270
|
+
Te = Math.abs(tt - et) <= 864e5;
|
|
4258
4271
|
}
|
|
4259
|
-
const
|
|
4260
|
-
g.value.type === "absolute" && g.value.end.getTime() <
|
|
4272
|
+
const Je = (/* @__PURE__ */ new Date()).getTime();
|
|
4273
|
+
g.value.type === "absolute" && g.value.end.getTime() < Je ? N = 0 : Te ? N = Ki : N = Vi;
|
|
4261
4274
|
}
|
|
4262
|
-
|
|
4263
|
-
const
|
|
4275
|
+
O === void 0 && (O = !1);
|
|
4276
|
+
const X = !!((ke = (qe = (fe = gi()) == null ? void 0 : fe.vnode) == null ? void 0 : qe.props) != null && ke.onTileTimeRangeZoom);
|
|
4264
4277
|
return {
|
|
4265
|
-
filters:
|
|
4266
|
-
tz:
|
|
4278
|
+
filters: M,
|
|
4279
|
+
tz: E,
|
|
4267
4280
|
timeSpec: g.value,
|
|
4268
4281
|
refreshInterval: N,
|
|
4269
|
-
editable:
|
|
4270
|
-
zoomable:
|
|
4282
|
+
editable: O,
|
|
4283
|
+
zoomable: X
|
|
4271
4284
|
};
|
|
4272
|
-
}),
|
|
4273
|
-
s("edit-tile",
|
|
4274
|
-
},
|
|
4275
|
-
const N =
|
|
4276
|
-
...
|
|
4277
|
-
chart_title:
|
|
4278
|
-
},
|
|
4285
|
+
}), R = (E) => {
|
|
4286
|
+
s("edit-tile", E);
|
|
4287
|
+
}, k = (E) => E.type === "slottable", G = (E) => {
|
|
4288
|
+
const N = k(E.meta.chart) ? { ...E.meta.chart } : {
|
|
4289
|
+
...E.meta.chart,
|
|
4290
|
+
chart_title: E.meta.chart.chart_title ? `Copy of ${E.meta.chart.chart_title}` : ""
|
|
4291
|
+
}, O = {
|
|
4279
4292
|
id: crypto.randomUUID(),
|
|
4280
4293
|
type: "chart",
|
|
4281
4294
|
definition: {
|
|
4282
|
-
...
|
|
4295
|
+
...E.meta,
|
|
4283
4296
|
chart: N
|
|
4284
4297
|
},
|
|
4285
4298
|
layout: {
|
|
@@ -4287,85 +4300,85 @@ const Ds = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ss = { cl
|
|
|
4287
4300
|
col: 0,
|
|
4288
4301
|
row: 0
|
|
4289
4302
|
},
|
|
4290
|
-
size:
|
|
4303
|
+
size: E.layout.size
|
|
4291
4304
|
}
|
|
4292
4305
|
};
|
|
4293
|
-
r.value.tiles.push(
|
|
4294
|
-
},
|
|
4295
|
-
|
|
4296
|
-
},
|
|
4306
|
+
r.value.tiles.push(O);
|
|
4307
|
+
}, _e = (E) => {
|
|
4308
|
+
l.value && l.value.removeWidget(E.id);
|
|
4309
|
+
}, be = () => {
|
|
4297
4310
|
n.value++;
|
|
4298
|
-
},
|
|
4299
|
-
const N =
|
|
4300
|
-
id:
|
|
4301
|
-
type:
|
|
4302
|
-
layout:
|
|
4303
|
-
definition:
|
|
4311
|
+
}, T = (E) => {
|
|
4312
|
+
const N = E.map((O) => ({
|
|
4313
|
+
id: O.id,
|
|
4314
|
+
type: O.type,
|
|
4315
|
+
layout: O.layout,
|
|
4316
|
+
definition: O.meta
|
|
4304
4317
|
}));
|
|
4305
4318
|
r.value.tiles = N.sort(p);
|
|
4306
|
-
},
|
|
4307
|
-
if (a.value = "scale(1)", await
|
|
4308
|
-
const { availWidth:
|
|
4309
|
-
a.value = `scale(${
|
|
4319
|
+
}, H = async () => {
|
|
4320
|
+
if (a.value = "scale(1)", await ut(), u.value) {
|
|
4321
|
+
const { availWidth: E, availHeight: N } = window.screen, { width: O, height: M } = u.value.getBoundingClientRect(), X = Math.min(N / M, E / O);
|
|
4322
|
+
a.value = `scale(${X})`;
|
|
4310
4323
|
}
|
|
4311
|
-
},
|
|
4312
|
-
|
|
4313
|
-
},
|
|
4314
|
-
|
|
4324
|
+
}, j = () => {
|
|
4325
|
+
h.value && (document.fullscreenElement ? document.exitFullscreen() : h.value.requestFullscreen());
|
|
4326
|
+
}, W = A(!1), Ie = () => {
|
|
4327
|
+
W.value = document.fullscreenElement !== null, W.value && H();
|
|
4315
4328
|
};
|
|
4316
4329
|
return e({
|
|
4317
|
-
refresh:
|
|
4318
|
-
toggleFullscreen:
|
|
4319
|
-
}), (
|
|
4320
|
-
const
|
|
4321
|
-
return
|
|
4330
|
+
refresh: be,
|
|
4331
|
+
toggleFullscreen: j
|
|
4332
|
+
}), (E, N) => {
|
|
4333
|
+
const O = me("KAlert");
|
|
4334
|
+
return C(), Q("div", {
|
|
4322
4335
|
ref_key: "dashboardContainer",
|
|
4323
|
-
ref:
|
|
4324
|
-
class:
|
|
4325
|
-
onFullscreenchange:
|
|
4336
|
+
ref: h,
|
|
4337
|
+
class: je(["kong-ui-public-dashboard-renderer", { "is-fullscreen": W.value }]),
|
|
4338
|
+
onFullscreenchange: Ie
|
|
4326
4339
|
}, [
|
|
4327
4340
|
ce("div", {
|
|
4328
4341
|
ref_key: "layoutContainer",
|
|
4329
|
-
ref:
|
|
4342
|
+
ref: u,
|
|
4330
4343
|
class: "layout"
|
|
4331
4344
|
}, [
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
])) :
|
|
4335
|
-
|
|
4345
|
+
x(f) && W.value ? (C(), Q("div", qs, [
|
|
4346
|
+
De(E.$slots, "fullscreenHeader", {}, void 0, !0)
|
|
4347
|
+
])) : Y("", !0),
|
|
4348
|
+
x(f) ? (C(), q(Pt(E.context.editable && !W.value ? Is : Ds), {
|
|
4336
4349
|
key: 2,
|
|
4337
4350
|
ref_key: "gridLayoutRef",
|
|
4338
|
-
ref:
|
|
4351
|
+
ref: l,
|
|
4339
4352
|
"tile-height": r.value.tile_height,
|
|
4340
|
-
tiles:
|
|
4341
|
-
onUpdateTiles:
|
|
4353
|
+
tiles: S.value,
|
|
4354
|
+
onUpdateTiles: T
|
|
4342
4355
|
}, {
|
|
4343
|
-
tile: F(({ tile:
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
])) : (
|
|
4347
|
-
key:
|
|
4356
|
+
tile: F(({ tile: M }) => [
|
|
4357
|
+
M.meta.chart.type === "slottable" ? (C(), Q("div", Ps, [
|
|
4358
|
+
De(E.$slots, M.meta.chart.id, {}, void 0, !0)
|
|
4359
|
+
])) : (C(), q(ks, {
|
|
4360
|
+
key: W.value ? `${M.id}-tile` : `${M.id}-tile-fullscreen`,
|
|
4348
4361
|
class: "tile-container",
|
|
4349
4362
|
context: L.value,
|
|
4350
|
-
definition:
|
|
4351
|
-
height:
|
|
4352
|
-
"is-fullscreen":
|
|
4353
|
-
"query-ready":
|
|
4363
|
+
definition: M.meta,
|
|
4364
|
+
height: M.layout.size.rows * (r.value.tile_height || x(Xe)) + parseInt(x(ei), 10),
|
|
4365
|
+
"is-fullscreen": W.value,
|
|
4366
|
+
"query-ready": v.value,
|
|
4354
4367
|
"refresh-counter": n.value,
|
|
4355
|
-
"tile-id":
|
|
4356
|
-
onDuplicateTile: (
|
|
4357
|
-
onEditTile: (
|
|
4358
|
-
onRemoveTile: (
|
|
4359
|
-
onTileTimeRangeZoom: N[0] || (N[0] = (
|
|
4368
|
+
"tile-id": M.id,
|
|
4369
|
+
onDuplicateTile: (X) => G(M),
|
|
4370
|
+
onEditTile: (X) => R(M),
|
|
4371
|
+
onRemoveTile: (X) => _e(M),
|
|
4372
|
+
onTileTimeRangeZoom: N[0] || (N[0] = (X) => s("tile-time-range-zoom", X))
|
|
4360
4373
|
}, null, 8, ["context", "definition", "height", "is-fullscreen", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4361
4374
|
]),
|
|
4362
4375
|
_: 3
|
|
4363
|
-
}, 40, ["tile-height", "tiles"])) : (
|
|
4376
|
+
}, 40, ["tile-height", "tiles"])) : (C(), q(O, {
|
|
4364
4377
|
key: 1,
|
|
4365
4378
|
appearance: "danger"
|
|
4366
4379
|
}, {
|
|
4367
4380
|
default: F(() => [
|
|
4368
|
-
|
|
4381
|
+
Se(ne(x(o).t("renderer.noQueryBridge")), 1)
|
|
4369
4382
|
]),
|
|
4370
4383
|
_: 1
|
|
4371
4384
|
}))
|
|
@@ -4373,18 +4386,18 @@ const Ds = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ss = { cl
|
|
|
4373
4386
|
], 34);
|
|
4374
4387
|
};
|
|
4375
4388
|
}
|
|
4376
|
-
}),
|
|
4389
|
+
}), Xs = /* @__PURE__ */ ve($s, [["__scopeId", "data-v-8d8a6181"]]);
|
|
4377
4390
|
export {
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4391
|
+
Bi as C,
|
|
4392
|
+
Xs as D,
|
|
4393
|
+
Rt as E,
|
|
4394
|
+
Ki as F,
|
|
4395
|
+
Ds as G,
|
|
4396
|
+
pe as I,
|
|
4397
|
+
Ui as T,
|
|
4385
4398
|
ct as _,
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4399
|
+
Xe as a,
|
|
4400
|
+
Wt as b,
|
|
4401
|
+
Wi as c,
|
|
4402
|
+
Vi as d
|
|
4390
4403
|
};
|