@kong-ui-public/dashboard-renderer 7.1.3 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GeoMapRenderer-DqEby8vN.js → GeoMapRenderer-ZojWjKPk.js} +5 -4
- package/dist/dashboard-renderer.es.js +1 -1
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/{index-D8hJwMTc.js → index-DGR4QksL.js} +962 -908
- package/dist/style.css +1 -1
- package/dist/types/components/BaseAnalyticsChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardRenderer.vue.d.ts +28 -28
- package/dist/types/components/DashboardTile.vue.d.ts +42 -42
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/components/TimeseriesChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/composables/index.d.ts +2 -0
- package/dist/types/composables/index.d.ts.map +1 -1
- package/dist/types/composables/useContextLinks.d.ts +56 -0
- package/dist/types/composables/useContextLinks.d.ts.map +1 -0
- package/dist/types/types/renderer-types.d.ts +1 -0
- package/dist/types/types/renderer-types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var ni = Object.defineProperty;
|
|
2
|
+
var dt = (u) => {
|
|
3
|
+
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _ = (
|
|
8
|
-
var we = (
|
|
5
|
+
var oi = (u, e, t) => e in u ? ni(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
6
|
+
var ut = (u, e, t) => oi(u, typeof e != "symbol" ? e + "" : e, t), Be = (u, e, t) => e.has(u) || dt("Cannot " + t);
|
|
7
|
+
var _ = (u, e, t) => (Be(u, e, "read from private field"), t ? t.call(u) : e.get(u)), P = (u, e, t) => e.has(u) ? dt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(u) : e.set(u, t), H = (u, e, t, i) => (Be(u, e, "write to private field"), i ? i.call(u, t) : e.set(u, t), t), G = (u, e, t) => (Be(u, e, "access private method"), t);
|
|
8
|
+
var we = (u, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
|
-
|
|
10
|
+
H(u, e, s, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return _(
|
|
13
|
+
return _(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as
|
|
17
|
-
import {
|
|
18
|
-
import { SimpleChart as
|
|
19
|
-
import
|
|
16
|
+
import { ref as $, watchEffect as Tt, inject as _e, provide as ai, onMounted as Qe, computed as N, defineComponent as Q, onUnmounted as je, watch as Xe, resolveComponent as de, createBlock as M, renderSlot as $e, createCommentVNode as Y, unref as T, openBlock as z, withCtx as q, createVNode as se, createTextVNode as Ee, toDisplayString as te, useCssVars as Ze, createElementVNode as le, normalizeClass as Je, mergeProps as zt, createSlots as et, createElementBlock as W, normalizeProps as li, guardReactiveProps as hi, defineAsyncComponent as Dt, readonly as We, toRef as ct, nextTick as St, resolveDynamicComponent as Nt, toHandlers as di, Fragment as Lt, renderList as At, normalizeStyle as ft, mergeModels as gt, useModel as ui, getCurrentInstance as ci } from "vue";
|
|
17
|
+
import { msToGranularity as Ke, getFieldDataSources as Ot, stripUnknownFilters as fi, Timeframe as gi, TimePeriods as Ht, TIMEFRAME_LOOKUP as mi, formatTime as mt } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { SimpleChart as pi, AnalyticsChart as yi, TopNTable as vi, CsvExportModal as _i } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import bi 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 wi, i18nTComponent as Ei } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as Mt } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { VisibilityOffIcon as xi, WarningIcon as Ci, EditIcon as Ri, MoreIcon as ki } from "@kong/icons";
|
|
24
|
+
import { MetricsProvider as Ti, MetricsConsumer as zi } from "@kong-ui-public/analytics-metric-provider";
|
|
25
|
+
var It = /* @__PURE__ */ ((u) => (u.VALIDATING = "VALIDATING", u.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", u.PENDING = "PENDING", u.SUCCESS = "SUCCESS", u.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", u.ERROR = "ERROR", u.STALE_IF_ERROR = "STALE_IF_ERROR", u))(It || {});
|
|
26
|
+
const Di = (u) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
|
-
return
|
|
29
|
-
((e = Object.keys(
|
|
28
|
+
return u ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
|
+
((e = Object.keys(u)) != null && e.length || (t = u.data) != null && t.length || (s = (i = u.data) == null ? void 0 : i.data) != null && s.length || !((r = u.data) != null && r.data) && typeof u.data == "object" && Object.keys(u == null ? void 0 : u.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
const s =
|
|
31
|
+
function Si(u = $({}), e, t, i = Di) {
|
|
32
|
+
const s = $(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
const r = i(
|
|
38
|
-
if (
|
|
36
|
+
return Tt(() => {
|
|
37
|
+
const r = i(u.value);
|
|
38
|
+
if (u.value && r && t.value) {
|
|
39
39
|
s.value = "VALIDATING_HAS_DATA";
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (u.value && t.value) {
|
|
43
43
|
s.value = "VALIDATING";
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (u.value && e.value) {
|
|
47
47
|
s.value = "STALE_IF_ERROR";
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
50
|
+
if (u.value === void 0 && !e.value) {
|
|
51
51
|
s.value = "PENDING";
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (u.value && !e.value && r) {
|
|
55
55
|
s.value = "SUCCESS_HAS_DATA";
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (u.value && !e.value) {
|
|
59
59
|
s.value = "SUCCESS";
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
u.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
|
-
swrvState:
|
|
65
|
+
swrvState: It
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const Ni = {
|
|
69
69
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
70
70
|
trendRange: {
|
|
71
71
|
"24h": "Last 24-hour summary",
|
|
@@ -76,14 +76,14 @@ const zi = {
|
|
|
76
76
|
duplicateTile: "Duplicate",
|
|
77
77
|
remove: "Remove",
|
|
78
78
|
delete: "Delete"
|
|
79
|
-
},
|
|
79
|
+
}, Li = {
|
|
80
80
|
forbidden: "To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator.",
|
|
81
81
|
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period",
|
|
82
82
|
timeout: "Query timed out. Consider querying a shorter time range."
|
|
83
|
-
},
|
|
83
|
+
}, Ai = {
|
|
84
84
|
defaultFilename: "Chart export",
|
|
85
85
|
exportAsCsv: "Export as CSV"
|
|
86
|
-
},
|
|
86
|
+
}, Oi = "Explore", Hi = "View requests", Mi = "This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.", Ii = {
|
|
87
87
|
daily: "1 day",
|
|
88
88
|
fiveMinutely: "5 minutes",
|
|
89
89
|
hourly: "1 hour",
|
|
@@ -96,35 +96,35 @@ const zi = {
|
|
|
96
96
|
twoHourly: "2 hours",
|
|
97
97
|
weekly: "1 week",
|
|
98
98
|
unknown: "Unknown"
|
|
99
|
-
},
|
|
100
|
-
renderer:
|
|
101
|
-
queryDataProvider:
|
|
102
|
-
csvExport:
|
|
103
|
-
jumpToExplore:
|
|
104
|
-
jumpToRequests:
|
|
105
|
-
query_aged_out_warning:
|
|
106
|
-
granularities:
|
|
99
|
+
}, qi = {
|
|
100
|
+
renderer: Ni,
|
|
101
|
+
queryDataProvider: Li,
|
|
102
|
+
csvExport: Ai,
|
|
103
|
+
jumpToExplore: Oi,
|
|
104
|
+
jumpToRequests: Hi,
|
|
105
|
+
query_aged_out_warning: Mi,
|
|
106
|
+
granularities: Ii
|
|
107
107
|
};
|
|
108
|
-
function
|
|
109
|
-
const
|
|
108
|
+
function Pi() {
|
|
109
|
+
const u = wi("en-us", qi);
|
|
110
110
|
return {
|
|
111
|
-
i18n:
|
|
112
|
-
i18nT:
|
|
111
|
+
i18n: u,
|
|
112
|
+
i18nT: Ei(u)
|
|
113
113
|
// Translation component <i18n-t>
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
const
|
|
117
|
-
function
|
|
118
|
-
const
|
|
116
|
+
const Ge = 170, qt = 6, ue = "analytics-query-provider", pt = "{entity-id}", $i = "{cp-id}", Gi = "{timeframe}", Ui = 30 * 1e3;
|
|
117
|
+
function Fi() {
|
|
118
|
+
const u = _e(ue);
|
|
119
119
|
return {
|
|
120
|
-
evaluateFeatureFlag: (t, i) =>
|
|
120
|
+
evaluateFeatureFlag: (t, i) => u ? u.evaluateFeatureFlagFn(t, i) : i
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
123
|
+
function Bi(u) {
|
|
124
|
+
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
125
125
|
}
|
|
126
|
-
var
|
|
127
|
-
(function(
|
|
126
|
+
var Pt = { exports: {} };
|
|
127
|
+
(function(u) {
|
|
128
128
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
129
129
|
function i() {
|
|
130
130
|
}
|
|
@@ -135,8 +135,8 @@ var Ot = { exports: {} };
|
|
|
135
135
|
function r(h, l, d, a, f) {
|
|
136
136
|
if (typeof d != "function")
|
|
137
137
|
throw new TypeError("The listener must be a function");
|
|
138
|
-
var
|
|
139
|
-
return h._events[g] ? h._events[g].fn ? h._events[g] = [h._events[g],
|
|
138
|
+
var p = new s(d, a || h, f), g = t ? t + l : l;
|
|
139
|
+
return h._events[g] ? h._events[g].fn ? h._events[g] = [h._events[g], p] : h._events[g].push(p) : (h._events[g] = p, h._eventsCount++), h;
|
|
140
140
|
}
|
|
141
141
|
function o(h, l) {
|
|
142
142
|
--h._eventsCount === 0 ? h._events = new i() : delete h._events[l];
|
|
@@ -154,54 +154,54 @@ var Ot = { exports: {} };
|
|
|
154
154
|
var d = t ? t + l : l, a = this._events[d];
|
|
155
155
|
if (!a) return [];
|
|
156
156
|
if (a.fn) return [a.fn];
|
|
157
|
-
for (var f = 0,
|
|
157
|
+
for (var f = 0, p = a.length, g = new Array(p); f < p; f++)
|
|
158
158
|
g[f] = a[f].fn;
|
|
159
159
|
return g;
|
|
160
160
|
}, n.prototype.listenerCount = function(l) {
|
|
161
161
|
var d = t ? t + l : l, a = this._events[d];
|
|
162
162
|
return a ? a.fn ? 1 : a.length : 0;
|
|
163
|
-
}, n.prototype.emit = function(l, d, a, f,
|
|
164
|
-
var
|
|
165
|
-
if (!this._events[
|
|
166
|
-
var
|
|
167
|
-
if (
|
|
168
|
-
switch (
|
|
163
|
+
}, n.prototype.emit = function(l, d, a, f, p, g) {
|
|
164
|
+
var y = t ? t + l : l;
|
|
165
|
+
if (!this._events[y]) return !1;
|
|
166
|
+
var m = this._events[y], k = arguments.length, w, E;
|
|
167
|
+
if (m.fn) {
|
|
168
|
+
switch (m.once && this.removeListener(l, m.fn, void 0, !0), k) {
|
|
169
169
|
case 1:
|
|
170
|
-
return
|
|
170
|
+
return m.fn.call(m.context), !0;
|
|
171
171
|
case 2:
|
|
172
|
-
return
|
|
172
|
+
return m.fn.call(m.context, d), !0;
|
|
173
173
|
case 3:
|
|
174
|
-
return
|
|
174
|
+
return m.fn.call(m.context, d, a), !0;
|
|
175
175
|
case 4:
|
|
176
|
-
return
|
|
176
|
+
return m.fn.call(m.context, d, a, f), !0;
|
|
177
177
|
case 5:
|
|
178
|
-
return
|
|
178
|
+
return m.fn.call(m.context, d, a, f, p), !0;
|
|
179
179
|
case 6:
|
|
180
|
-
return
|
|
180
|
+
return m.fn.call(m.context, d, a, f, p, g), !0;
|
|
181
181
|
}
|
|
182
|
-
for (
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
for (E = 1, w = new Array(k - 1); E < k; E++)
|
|
183
|
+
w[E - 1] = arguments[E];
|
|
184
|
+
m.fn.apply(m.context, w);
|
|
185
185
|
} else {
|
|
186
|
-
var
|
|
187
|
-
for (
|
|
188
|
-
switch (
|
|
186
|
+
var D = m.length, C;
|
|
187
|
+
for (E = 0; E < D; E++)
|
|
188
|
+
switch (m[E].once && this.removeListener(l, m[E].fn, void 0, !0), k) {
|
|
189
189
|
case 1:
|
|
190
|
-
|
|
190
|
+
m[E].fn.call(m[E].context);
|
|
191
191
|
break;
|
|
192
192
|
case 2:
|
|
193
|
-
|
|
193
|
+
m[E].fn.call(m[E].context, d);
|
|
194
194
|
break;
|
|
195
195
|
case 3:
|
|
196
|
-
|
|
196
|
+
m[E].fn.call(m[E].context, d, a);
|
|
197
197
|
break;
|
|
198
198
|
case 4:
|
|
199
|
-
|
|
199
|
+
m[E].fn.call(m[E].context, d, a, f);
|
|
200
200
|
break;
|
|
201
201
|
default:
|
|
202
|
-
if (!
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
if (!w) for (C = 1, w = new Array(k - 1); C < k; C++)
|
|
203
|
+
w[C - 1] = arguments[C];
|
|
204
|
+
m[E].fn.apply(m[E].context, w);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
return !0;
|
|
@@ -210,41 +210,41 @@ var Ot = { exports: {} };
|
|
|
210
210
|
}, n.prototype.once = function(l, d, a) {
|
|
211
211
|
return r(this, l, d, a, !0);
|
|
212
212
|
}, n.prototype.removeListener = function(l, d, a, f) {
|
|
213
|
-
var
|
|
214
|
-
if (!this._events[
|
|
213
|
+
var p = t ? t + l : l;
|
|
214
|
+
if (!this._events[p]) return this;
|
|
215
215
|
if (!d)
|
|
216
|
-
return o(this,
|
|
217
|
-
var g = this._events[
|
|
216
|
+
return o(this, p), this;
|
|
217
|
+
var g = this._events[p];
|
|
218
218
|
if (g.fn)
|
|
219
|
-
g.fn === d && (!f || g.once) && (!a || g.context === a) && o(this,
|
|
219
|
+
g.fn === d && (!f || g.once) && (!a || g.context === a) && o(this, p);
|
|
220
220
|
else {
|
|
221
|
-
for (var
|
|
222
|
-
(g[
|
|
223
|
-
|
|
221
|
+
for (var y = 0, m = [], k = g.length; y < k; y++)
|
|
222
|
+
(g[y].fn !== d || f && !g[y].once || a && g[y].context !== a) && m.push(g[y]);
|
|
223
|
+
m.length ? this._events[p] = m.length === 1 ? m[0] : m : o(this, p);
|
|
224
224
|
}
|
|
225
225
|
return this;
|
|
226
226
|
}, n.prototype.removeAllListeners = function(l) {
|
|
227
227
|
var d;
|
|
228
228
|
return l ? (d = t ? t + l : l, this._events[d] && o(this, d)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
229
|
-
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n,
|
|
230
|
-
})(
|
|
231
|
-
var
|
|
232
|
-
const
|
|
233
|
-
class
|
|
229
|
+
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n, u.exports = n;
|
|
230
|
+
})(Pt);
|
|
231
|
+
var Wi = Pt.exports;
|
|
232
|
+
const Ki = /* @__PURE__ */ Bi(Wi);
|
|
233
|
+
class $t extends Error {
|
|
234
234
|
constructor(e) {
|
|
235
235
|
super(e), this.name = "TimeoutError";
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
class
|
|
238
|
+
class Vi extends Error {
|
|
239
239
|
constructor(e) {
|
|
240
240
|
super(), this.name = "AbortError", this.message = e;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
const e =
|
|
245
|
-
return e instanceof Error ? e :
|
|
243
|
+
const yt = (u) => globalThis.DOMException === void 0 ? new Vi(u) : new DOMException(u), vt = (u) => {
|
|
244
|
+
const e = u.reason === void 0 ? yt("This operation was aborted.") : u.reason;
|
|
245
|
+
return e instanceof Error ? e : yt(e);
|
|
246
246
|
};
|
|
247
|
-
function
|
|
247
|
+
function Yi(u, e) {
|
|
248
248
|
const {
|
|
249
249
|
milliseconds: t,
|
|
250
250
|
fallback: i,
|
|
@@ -256,31 +256,31 @@ function Fi(c, e) {
|
|
|
256
256
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
257
257
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
258
258
|
if (e.signal) {
|
|
259
|
-
const { signal:
|
|
260
|
-
|
|
261
|
-
a(
|
|
262
|
-
},
|
|
259
|
+
const { signal: p } = e;
|
|
260
|
+
p.aborted && a(vt(p)), n = () => {
|
|
261
|
+
a(vt(p));
|
|
262
|
+
}, p.addEventListener("abort", n, { once: !0 });
|
|
263
263
|
}
|
|
264
264
|
if (t === Number.POSITIVE_INFINITY) {
|
|
265
|
-
|
|
265
|
+
u.then(d, a);
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
const f = new
|
|
268
|
+
const f = new $t();
|
|
269
269
|
o = r.setTimeout.call(void 0, () => {
|
|
270
270
|
if (i) {
|
|
271
271
|
try {
|
|
272
272
|
d(i());
|
|
273
|
-
} catch (
|
|
274
|
-
a(
|
|
273
|
+
} catch (p) {
|
|
274
|
+
a(p);
|
|
275
275
|
}
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
typeof
|
|
278
|
+
typeof u.cancel == "function" && u.cancel(), s === !1 ? d() : s instanceof Error ? a(s) : (f.message = s ?? `Promise timed out after ${t} milliseconds`, a(f));
|
|
279
279
|
}, t), (async () => {
|
|
280
280
|
try {
|
|
281
|
-
d(await
|
|
282
|
-
} catch (
|
|
283
|
-
a(
|
|
281
|
+
d(await u);
|
|
282
|
+
} catch (p) {
|
|
283
|
+
a(p);
|
|
284
284
|
}
|
|
285
285
|
})();
|
|
286
286
|
}).finally(() => {
|
|
@@ -290,19 +290,19 @@ function Fi(c, e) {
|
|
|
290
290
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
291
291
|
}, l;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
let i = 0, s =
|
|
293
|
+
function Qi(u, e, t) {
|
|
294
|
+
let i = 0, s = u.length;
|
|
295
295
|
for (; s > 0; ) {
|
|
296
296
|
const r = Math.trunc(s / 2);
|
|
297
297
|
let o = i + r;
|
|
298
|
-
t(
|
|
298
|
+
t(u[o], e) <= 0 ? (i = ++o, s -= r + 1) : s = r;
|
|
299
299
|
}
|
|
300
300
|
return i;
|
|
301
301
|
}
|
|
302
|
-
var
|
|
303
|
-
class
|
|
302
|
+
var X;
|
|
303
|
+
class ji {
|
|
304
304
|
constructor() {
|
|
305
|
-
P(this,
|
|
305
|
+
P(this, X, []);
|
|
306
306
|
}
|
|
307
307
|
enqueue(e, t) {
|
|
308
308
|
t = {
|
|
@@ -314,75 +314,75 @@ class Ki {
|
|
|
314
314
|
id: t.id,
|
|
315
315
|
run: e
|
|
316
316
|
};
|
|
317
|
-
if (this.size === 0 || _(this,
|
|
318
|
-
_(this,
|
|
317
|
+
if (this.size === 0 || _(this, X)[this.size - 1].priority >= t.priority) {
|
|
318
|
+
_(this, X).push(i);
|
|
319
319
|
return;
|
|
320
320
|
}
|
|
321
|
-
const s =
|
|
322
|
-
_(this,
|
|
321
|
+
const s = Qi(_(this, X), i, (r, o) => o.priority - r.priority);
|
|
322
|
+
_(this, X).splice(s, 0, i);
|
|
323
323
|
}
|
|
324
324
|
setPriority(e, t) {
|
|
325
|
-
const i = _(this,
|
|
325
|
+
const i = _(this, X).findIndex((r) => r.id === e);
|
|
326
326
|
if (i === -1)
|
|
327
327
|
throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
328
|
-
const [s] = _(this,
|
|
328
|
+
const [s] = _(this, X).splice(i, 1);
|
|
329
329
|
this.enqueue(s.run, { priority: t, id: e });
|
|
330
330
|
}
|
|
331
331
|
dequeue() {
|
|
332
|
-
const e = _(this,
|
|
332
|
+
const e = _(this, X).shift();
|
|
333
333
|
return e == null ? void 0 : e.run;
|
|
334
334
|
}
|
|
335
335
|
filter(e) {
|
|
336
|
-
return _(this,
|
|
336
|
+
return _(this, X).filter((t) => t.priority === e.priority).map((t) => t.run);
|
|
337
337
|
}
|
|
338
338
|
get size() {
|
|
339
|
-
return _(this,
|
|
339
|
+
return _(this, X).length;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
|
|
343
|
-
var ge, me, he, Re, pe,
|
|
344
|
-
class
|
|
342
|
+
X = new WeakMap();
|
|
343
|
+
var ge, me, he, Re, pe, ke, Z, ye, B, Te, J, ve, oe, ze, Pe, S, Gt, Ut, Ft, Bt, Wt, Ne, Ve, Ye, Le, Kt, Ae;
|
|
344
|
+
class Xi extends Ki {
|
|
345
345
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
346
346
|
constructor(t) {
|
|
347
347
|
var i, s;
|
|
348
348
|
super();
|
|
349
|
-
P(this,
|
|
349
|
+
P(this, S);
|
|
350
350
|
P(this, ge);
|
|
351
351
|
P(this, me);
|
|
352
352
|
P(this, he, 0);
|
|
353
353
|
P(this, Re);
|
|
354
354
|
P(this, pe);
|
|
355
|
-
P(this,
|
|
356
|
-
P(this,
|
|
355
|
+
P(this, ke, 0);
|
|
356
|
+
P(this, Z);
|
|
357
357
|
P(this, ye);
|
|
358
|
-
P(this,
|
|
359
|
-
P(this,
|
|
360
|
-
P(this,
|
|
358
|
+
P(this, B);
|
|
359
|
+
P(this, Te);
|
|
360
|
+
P(this, J, 0);
|
|
361
361
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
362
362
|
P(this, ve);
|
|
363
|
-
P(this,
|
|
364
|
-
P(this,
|
|
363
|
+
P(this, oe);
|
|
364
|
+
P(this, ze);
|
|
365
365
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
366
|
-
P(this,
|
|
366
|
+
P(this, Pe, 1n);
|
|
367
367
|
/**
|
|
368
368
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
369
369
|
|
|
370
370
|
Applies to each future operation.
|
|
371
371
|
*/
|
|
372
|
-
|
|
372
|
+
ut(this, "timeout");
|
|
373
373
|
if (t = {
|
|
374
374
|
carryoverConcurrencyCount: !1,
|
|
375
375
|
intervalCap: Number.POSITIVE_INFINITY,
|
|
376
376
|
interval: 0,
|
|
377
377
|
concurrency: Number.POSITIVE_INFINITY,
|
|
378
378
|
autoStart: !0,
|
|
379
|
-
queueClass:
|
|
379
|
+
queueClass: ji,
|
|
380
380
|
...t
|
|
381
381
|
}, !(typeof t.intervalCap == "number" && t.intervalCap >= 1))
|
|
382
382
|
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})`);
|
|
383
383
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
384
384
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
385
|
-
|
|
385
|
+
H(this, ge, t.carryoverConcurrencyCount), H(this, me, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), H(this, Re, t.intervalCap), H(this, pe, t.interval), H(this, B, new t.queueClass()), H(this, Te, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, H(this, ze, t.throwOnTimeout === !0), H(this, oe, t.autoStart === !1);
|
|
386
386
|
}
|
|
387
387
|
get concurrency() {
|
|
388
388
|
return _(this, ve);
|
|
@@ -390,7 +390,7 @@ class Vi extends Gi {
|
|
|
390
390
|
set concurrency(t) {
|
|
391
391
|
if (!(typeof t == "number" && t >= 1))
|
|
392
392
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
393
|
-
|
|
393
|
+
H(this, ve, t), G(this, S, Le).call(this);
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
396
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -429,33 +429,33 @@ class Vi extends Gi {
|
|
|
429
429
|
Here, the promise function with `id: '🦀'` executes last.
|
|
430
430
|
*/
|
|
431
431
|
setPriority(t, i) {
|
|
432
|
-
_(this,
|
|
432
|
+
_(this, B).setPriority(t, i);
|
|
433
433
|
}
|
|
434
434
|
async add(t, i = {}) {
|
|
435
|
-
return i.id ?? (i.id = (we(this,
|
|
435
|
+
return i.id ?? (i.id = (we(this, Pe)._++).toString()), i = {
|
|
436
436
|
timeout: this.timeout,
|
|
437
|
-
throwOnTimeout: _(this,
|
|
437
|
+
throwOnTimeout: _(this, ze),
|
|
438
438
|
...i
|
|
439
439
|
}, new Promise((s, r) => {
|
|
440
|
-
_(this,
|
|
440
|
+
_(this, B).enqueue(async () => {
|
|
441
441
|
var o;
|
|
442
|
-
we(this,
|
|
442
|
+
we(this, J)._++, we(this, he)._++;
|
|
443
443
|
try {
|
|
444
444
|
(o = i.signal) == null || o.throwIfAborted();
|
|
445
445
|
let n = t({ signal: i.signal });
|
|
446
|
-
i.timeout && (n =
|
|
446
|
+
i.timeout && (n = Yi(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, G(this, S, Kt).call(this, i.signal)]));
|
|
447
447
|
const h = await n;
|
|
448
448
|
s(h), this.emit("completed", h);
|
|
449
449
|
} catch (n) {
|
|
450
|
-
if (n instanceof
|
|
450
|
+
if (n instanceof $t && !i.throwOnTimeout) {
|
|
451
451
|
s();
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
454
|
r(n), this.emit("error", n);
|
|
455
455
|
} finally {
|
|
456
|
-
|
|
456
|
+
G(this, S, Ft).call(this);
|
|
457
457
|
}
|
|
458
|
-
}, i), this.emit("add"),
|
|
458
|
+
}, i), this.emit("add"), G(this, S, Ne).call(this);
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
async addAll(t, i) {
|
|
@@ -465,19 +465,19 @@ class Vi extends Gi {
|
|
|
465
465
|
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.)
|
|
466
466
|
*/
|
|
467
467
|
start() {
|
|
468
|
-
return _(this,
|
|
468
|
+
return _(this, oe) ? (H(this, oe, !1), G(this, S, Le).call(this), this) : this;
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
Put queue execution on hold.
|
|
472
472
|
*/
|
|
473
473
|
pause() {
|
|
474
|
-
|
|
474
|
+
H(this, oe, !0);
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
477
|
Clear the queue.
|
|
478
478
|
*/
|
|
479
479
|
clear() {
|
|
480
|
-
|
|
480
|
+
H(this, B, new (_(this, Te))());
|
|
481
481
|
}
|
|
482
482
|
/**
|
|
483
483
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -485,7 +485,7 @@ class Vi extends Gi {
|
|
|
485
485
|
@returns A promise that settles when the queue becomes empty.
|
|
486
486
|
*/
|
|
487
487
|
async onEmpty() {
|
|
488
|
-
_(this,
|
|
488
|
+
_(this, B).size !== 0 && await G(this, S, Ae).call(this, "empty");
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
491
491
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -495,7 +495,7 @@ class Vi extends Gi {
|
|
|
495
495
|
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.
|
|
496
496
|
*/
|
|
497
497
|
async onSizeLessThan(t) {
|
|
498
|
-
_(this,
|
|
498
|
+
_(this, B).size < t || await G(this, S, Ae).call(this, "next", () => _(this, B).size < t);
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
501
501
|
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.
|
|
@@ -503,13 +503,13 @@ class Vi extends Gi {
|
|
|
503
503
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
504
504
|
*/
|
|
505
505
|
async onIdle() {
|
|
506
|
-
_(this,
|
|
506
|
+
_(this, J) === 0 && _(this, B).size === 0 || await G(this, S, Ae).call(this, "idle");
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
509
509
|
Size of the queue, the number of queued items waiting to run.
|
|
510
510
|
*/
|
|
511
511
|
get size() {
|
|
512
|
-
return _(this,
|
|
512
|
+
return _(this, B).size;
|
|
513
513
|
}
|
|
514
514
|
/**
|
|
515
515
|
Size of the queue, filtered by the given options.
|
|
@@ -517,65 +517,65 @@ class Vi extends Gi {
|
|
|
517
517
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
518
518
|
*/
|
|
519
519
|
sizeBy(t) {
|
|
520
|
-
return _(this,
|
|
520
|
+
return _(this, B).filter(t).length;
|
|
521
521
|
}
|
|
522
522
|
/**
|
|
523
523
|
Number of running items (no longer in the queue).
|
|
524
524
|
*/
|
|
525
525
|
get pending() {
|
|
526
|
-
return _(this,
|
|
526
|
+
return _(this, J);
|
|
527
527
|
}
|
|
528
528
|
/**
|
|
529
529
|
Whether the queue is currently paused.
|
|
530
530
|
*/
|
|
531
531
|
get isPaused() {
|
|
532
|
-
return _(this,
|
|
532
|
+
return _(this, oe);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(), pe = new WeakMap(),
|
|
535
|
+
ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(), pe = new WeakMap(), ke = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), B = new WeakMap(), Te = new WeakMap(), J = new WeakMap(), ve = new WeakMap(), oe = new WeakMap(), ze = new WeakMap(), Pe = new WeakMap(), S = new WeakSet(), Gt = function() {
|
|
536
536
|
return _(this, me) || _(this, he) < _(this, Re);
|
|
537
|
-
},
|
|
538
|
-
return _(this,
|
|
539
|
-
},
|
|
540
|
-
we(this,
|
|
541
|
-
},
|
|
542
|
-
|
|
543
|
-
},
|
|
537
|
+
}, Ut = function() {
|
|
538
|
+
return _(this, J) < _(this, ve);
|
|
539
|
+
}, Ft = function() {
|
|
540
|
+
we(this, J)._--, G(this, S, Ne).call(this), this.emit("next");
|
|
541
|
+
}, Bt = function() {
|
|
542
|
+
G(this, S, Ye).call(this), G(this, S, Ve).call(this), H(this, ye, void 0);
|
|
543
|
+
}, Wt = function() {
|
|
544
544
|
const t = Date.now();
|
|
545
|
-
if (_(this,
|
|
546
|
-
const i = _(this,
|
|
545
|
+
if (_(this, Z) === void 0) {
|
|
546
|
+
const i = _(this, ke) - t;
|
|
547
547
|
if (i < 0)
|
|
548
|
-
|
|
548
|
+
H(this, he, _(this, ge) ? _(this, J) : 0);
|
|
549
549
|
else
|
|
550
|
-
return _(this, ye) === void 0 &&
|
|
551
|
-
|
|
550
|
+
return _(this, ye) === void 0 && H(this, ye, setTimeout(() => {
|
|
551
|
+
G(this, S, Bt).call(this);
|
|
552
552
|
}, i)), !0;
|
|
553
553
|
}
|
|
554
554
|
return !1;
|
|
555
|
-
},
|
|
556
|
-
if (_(this,
|
|
557
|
-
return _(this,
|
|
558
|
-
if (!_(this,
|
|
559
|
-
const t = !_(this,
|
|
560
|
-
if (_(this,
|
|
561
|
-
const i = _(this,
|
|
562
|
-
return i ? (this.emit("active"), i(), t &&
|
|
555
|
+
}, Ne = function() {
|
|
556
|
+
if (_(this, B).size === 0)
|
|
557
|
+
return _(this, Z) && clearInterval(_(this, Z)), H(this, Z, void 0), this.emit("empty"), _(this, J) === 0 && this.emit("idle"), !1;
|
|
558
|
+
if (!_(this, oe)) {
|
|
559
|
+
const t = !_(this, S, Wt);
|
|
560
|
+
if (_(this, S, Gt) && _(this, S, Ut)) {
|
|
561
|
+
const i = _(this, B).dequeue();
|
|
562
|
+
return i ? (this.emit("active"), i(), t && G(this, S, Ve).call(this), !0) : !1;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
return !1;
|
|
566
|
-
},
|
|
567
|
-
_(this, me) || _(this,
|
|
568
|
-
|
|
569
|
-
}, _(this, pe))),
|
|
570
|
-
},
|
|
571
|
-
_(this, he) === 0 && _(this,
|
|
566
|
+
}, Ve = function() {
|
|
567
|
+
_(this, me) || _(this, Z) !== void 0 || (H(this, Z, setInterval(() => {
|
|
568
|
+
G(this, S, Ye).call(this);
|
|
569
|
+
}, _(this, pe))), H(this, ke, Date.now() + _(this, pe)));
|
|
570
|
+
}, Ye = function() {
|
|
571
|
+
_(this, he) === 0 && _(this, J) === 0 && _(this, Z) && (clearInterval(_(this, Z)), H(this, Z, void 0)), H(this, he, _(this, ge) ? _(this, J) : 0), G(this, S, Le).call(this);
|
|
572
572
|
}, /**
|
|
573
573
|
Executes all queued functions until it reaches the limit.
|
|
574
574
|
*/
|
|
575
|
-
|
|
576
|
-
for (;
|
|
575
|
+
Le = function() {
|
|
576
|
+
for (; G(this, S, Ne).call(this); )
|
|
577
577
|
;
|
|
578
|
-
},
|
|
578
|
+
}, Kt = async function(t) {
|
|
579
579
|
return new Promise((i, s) => {
|
|
580
580
|
t.addEventListener("abort", () => {
|
|
581
581
|
s(t.reason);
|
|
@@ -589,30 +589,105 @@ Ne = function() {
|
|
|
589
589
|
this.on(t, r);
|
|
590
590
|
});
|
|
591
591
|
};
|
|
592
|
-
const
|
|
593
|
-
const
|
|
592
|
+
const Zi = () => {
|
|
593
|
+
const u = Mt(), e = _e(ue);
|
|
594
594
|
if (!e)
|
|
595
595
|
return;
|
|
596
596
|
if (e.queryFnOverride) {
|
|
597
597
|
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.");
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
|
-
const t = new
|
|
600
|
+
const t = new Xi({
|
|
601
601
|
carryoverConcurrencyCount: !0,
|
|
602
|
-
concurrency:
|
|
603
|
-
interval:
|
|
604
|
-
intervalCap:
|
|
602
|
+
concurrency: u.maxParallelRequests,
|
|
603
|
+
interval: u.requestInterval,
|
|
604
|
+
intervalCap: u.requestIntervalCap
|
|
605
605
|
}), i = {
|
|
606
606
|
...e,
|
|
607
607
|
queryFnOverride: !0,
|
|
608
608
|
queryFn: (s, r) => t.add(() => e.queryFn(s, r), { throwOnTimeout: !0 })
|
|
609
609
|
};
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
610
|
+
ai(ue, i);
|
|
611
|
+
};
|
|
612
|
+
function Ji({
|
|
613
|
+
queryBridge: u,
|
|
614
|
+
context: e,
|
|
615
|
+
definition: t,
|
|
616
|
+
chartData: i
|
|
617
|
+
}) {
|
|
618
|
+
const s = $(""), r = $("");
|
|
619
|
+
Qe(async () => {
|
|
620
|
+
var w, E;
|
|
621
|
+
s.value = await ((w = u == null ? void 0 : u.exploreBaseUrl) == null ? void 0 : w.call(u)) ?? "", r.value = await ((E = u == null ? void 0 : u.requestsBaseUrl) == null ? void 0 : E.call(u)) ?? "";
|
|
622
|
+
});
|
|
623
|
+
const o = N(() => !["golden_signals", "top_n", "gauge"].includes(t.value.chart.type)), n = N(() => r.value && t.value.query && t.value.query.datasource !== "llm_usage"), h = N(() => s.value && t.value.query && ["api_usage", "llm_usage", "basic"].includes(t.value.query.datasource)), l = N(() => i.value ? Ke(i.value.meta.granularity_ms) : void 0), d = N(() => {
|
|
624
|
+
var D;
|
|
625
|
+
const w = [...e.value.filters, ...t.value.query.filters ?? []], E = ((D = t.value.query) == null ? void 0 : D.datasource) ?? "api_usage";
|
|
626
|
+
return w.filter((C) => Ot(C.field).some((A) => E === A));
|
|
627
|
+
}), a = N(() => {
|
|
628
|
+
if (!h.value || !o.value)
|
|
629
|
+
return "";
|
|
630
|
+
const w = d.value, E = t.value.query.time_range || e.value.timeSpec, D = m(E, w);
|
|
631
|
+
return k(D);
|
|
632
|
+
}), f = N(() => {
|
|
633
|
+
if (!n.value || !o.value)
|
|
634
|
+
return "";
|
|
635
|
+
const w = [...e.value.filters, ...t.value.query.filters ?? []], E = g(
|
|
636
|
+
t.value.query.time_range || e.value.timeSpec,
|
|
637
|
+
w
|
|
638
|
+
);
|
|
639
|
+
return p(E);
|
|
640
|
+
}), p = (w) => n.value ? `${r.value}?q=${JSON.stringify(w)}` : "", g = (w, E) => {
|
|
641
|
+
var D, C;
|
|
642
|
+
return {
|
|
643
|
+
filter: E,
|
|
644
|
+
timeframe: {
|
|
645
|
+
timePeriodsKey: w.type === "relative" ? w.time_range : "custom",
|
|
646
|
+
start: w.type === "absolute" ? (D = i.value) == null ? void 0 : D.meta.start_ms : void 0,
|
|
647
|
+
end: w.type === "absolute" ? (C = i.value) == null ? void 0 : C.meta.end_ms : void 0
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
}, y = (w, E) => ({
|
|
651
|
+
filter: E,
|
|
652
|
+
timeframe: {
|
|
653
|
+
timePeriodsKey: w.type === "relative" ? w.time_range : "custom",
|
|
654
|
+
start: w.type === "absolute" ? w.start : void 0,
|
|
655
|
+
end: w.type === "absolute" ? w.end : void 0
|
|
656
|
+
}
|
|
657
|
+
}), m = (w, E) => {
|
|
658
|
+
const D = t.value.query.dimensions ?? [];
|
|
659
|
+
return {
|
|
660
|
+
filters: E,
|
|
661
|
+
metrics: t.value.query.metrics ?? [],
|
|
662
|
+
dimensions: D,
|
|
663
|
+
time_range: w,
|
|
664
|
+
granularity: t.value.query.granularity || l.value
|
|
665
|
+
};
|
|
666
|
+
}, k = (w) => {
|
|
667
|
+
var D, C;
|
|
668
|
+
if (!h.value)
|
|
669
|
+
return "";
|
|
670
|
+
const E = ((D = t.value.query) == null ? void 0 : D.datasource) === "basic" ? "api_usage" : (C = t.value.query) == null ? void 0 : C.datasource;
|
|
671
|
+
return `${s.value}?q=${JSON.stringify(w)}&d=${E}&c=${t.value.chart.type}`;
|
|
672
|
+
};
|
|
673
|
+
return {
|
|
674
|
+
exploreLinkKebabMenu: a,
|
|
675
|
+
requestsLinkKebabMenu: f,
|
|
676
|
+
canShowKebabMenu: o,
|
|
677
|
+
canGenerateRequestsLink: n,
|
|
678
|
+
canGenerateExploreLink: h,
|
|
679
|
+
buildExploreQuery: m,
|
|
680
|
+
buildRequestsQueryZoomActions: y,
|
|
681
|
+
buildExploreLink: k,
|
|
682
|
+
buildRequestLink: p
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
const ce = {
|
|
686
|
+
useI18n: Pi,
|
|
687
|
+
useEvaluateFeatureFlag: Fi,
|
|
688
|
+
useRequestQueue: Zi,
|
|
689
|
+
useContextLinks: Ji
|
|
690
|
+
}, tt = /* @__PURE__ */ Q({
|
|
616
691
|
__name: "QueryDataProvider",
|
|
617
692
|
props: {
|
|
618
693
|
context: {},
|
|
@@ -621,54 +696,54 @@ const Yi = () => {
|
|
|
621
696
|
refreshCounter: {}
|
|
622
697
|
},
|
|
623
698
|
emits: ["chart-data", "queryComplete"],
|
|
624
|
-
setup(
|
|
625
|
-
const t =
|
|
626
|
-
|
|
699
|
+
setup(u, { emit: e }) {
|
|
700
|
+
const t = u, i = e, { i18n: s } = ce.useI18n(), r = _e(ue), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, n = new AbortController();
|
|
701
|
+
je(() => {
|
|
627
702
|
n.abort();
|
|
628
703
|
});
|
|
629
|
-
const h = (
|
|
630
|
-
const
|
|
631
|
-
return
|
|
632
|
-
}, { data: l, error: d, isValidating: a } =
|
|
633
|
-
var
|
|
704
|
+
const h = (k, w, E) => {
|
|
705
|
+
const D = [];
|
|
706
|
+
return w && D.push(...w), D.push(...fi(k, E)), D;
|
|
707
|
+
}, { data: l, error: d, isValidating: a } = bi(o, async () => {
|
|
708
|
+
var k, w, E, D;
|
|
634
709
|
try {
|
|
635
710
|
let {
|
|
636
|
-
datasource:
|
|
637
|
-
...
|
|
711
|
+
datasource: C,
|
|
712
|
+
...R
|
|
638
713
|
} = t.query;
|
|
639
|
-
|
|
640
|
-
const A = h(
|
|
641
|
-
let
|
|
642
|
-
|
|
643
|
-
...
|
|
714
|
+
C || (C = "basic");
|
|
715
|
+
const A = h(C, t.query.filters, t.context.filters);
|
|
716
|
+
let L = t.query.time_range;
|
|
717
|
+
L ? L.tz || (L = {
|
|
718
|
+
...L,
|
|
644
719
|
tz: t.context.tz
|
|
645
|
-
}) :
|
|
720
|
+
}) : L = {
|
|
646
721
|
...t.context.timeSpec,
|
|
647
722
|
tz: t.context.tz
|
|
648
723
|
};
|
|
649
|
-
const
|
|
650
|
-
datasource:
|
|
724
|
+
const U = {
|
|
725
|
+
datasource: C,
|
|
651
726
|
query: {
|
|
652
|
-
...
|
|
653
|
-
time_range:
|
|
727
|
+
...R,
|
|
728
|
+
time_range: L,
|
|
654
729
|
filters: A
|
|
655
730
|
}
|
|
656
|
-
},
|
|
657
|
-
return g.value = null,
|
|
658
|
-
} catch (
|
|
659
|
-
throw (
|
|
731
|
+
}, ee = await (r == null ? void 0 : r.queryFn(U, n));
|
|
732
|
+
return g.value = null, ee;
|
|
733
|
+
} catch (C) {
|
|
734
|
+
throw (C == null ? void 0 : C.status) === 403 ? g.value = {
|
|
660
735
|
message: s.t("queryDataProvider.forbidden"),
|
|
661
736
|
type: "forbidden"
|
|
662
|
-
} : (
|
|
737
|
+
} : (C == null ? void 0 : C.status) === 408 ? g.value = {
|
|
663
738
|
message: s.t("queryDataProvider.timeout"),
|
|
664
739
|
type: "timeout"
|
|
665
|
-
} : ((
|
|
740
|
+
} : ((w = (k = C == null ? void 0 : C.response) == null ? void 0 : k.data) == null ? void 0 : w.message) === "Range not allowed for this tier" ? g.value = {
|
|
666
741
|
message: s.t("queryDataProvider.timeRangeExceeded"),
|
|
667
742
|
type: "range_exceeded"
|
|
668
743
|
} : g.value = {
|
|
669
|
-
message: ((
|
|
744
|
+
message: ((D = (E = C == null ? void 0 : C.response) == null ? void 0 : E.data) == null ? void 0 : D.message) || (C == null ? void 0 : C.message),
|
|
670
745
|
type: "other"
|
|
671
|
-
},
|
|
746
|
+
}, C;
|
|
672
747
|
} finally {
|
|
673
748
|
i("queryComplete");
|
|
674
749
|
}
|
|
@@ -676,48 +751,48 @@ const Yi = () => {
|
|
|
676
751
|
refreshInterval: t.context.refreshInterval,
|
|
677
752
|
revalidateOnFocus: !1,
|
|
678
753
|
shouldRetryOnError: !1
|
|
679
|
-
}), { state: f, swrvState:
|
|
680
|
-
return
|
|
681
|
-
|
|
682
|
-
}), (
|
|
683
|
-
var
|
|
684
|
-
const
|
|
685
|
-
return
|
|
754
|
+
}), { state: f, swrvState: p } = Si(l, d, a), g = $(null), y = N(() => f.value === p.ERROR || !!g.value), m = N(() => !t.queryReady || f.value === p.PENDING);
|
|
755
|
+
return Xe(l, (k) => {
|
|
756
|
+
k && i("chart-data", k);
|
|
757
|
+
}), (k, w) => {
|
|
758
|
+
var C;
|
|
759
|
+
const E = de("KSkeleton"), D = de("KEmptyState");
|
|
760
|
+
return m.value || !T(l) && !y.value ? (z(), M(E, {
|
|
686
761
|
key: 0,
|
|
687
762
|
class: "chart-skeleton",
|
|
688
763
|
type: "table"
|
|
689
|
-
})) :
|
|
764
|
+
})) : y.value && ((C = g.value) == null ? void 0 : C.type) === "forbidden" ? (z(), M(D, {
|
|
690
765
|
key: 1,
|
|
691
766
|
"action-button-visible": !1,
|
|
692
767
|
"data-testid": "chart-forbidden-state"
|
|
693
768
|
}, {
|
|
694
|
-
default:
|
|
769
|
+
default: q(() => [
|
|
695
770
|
Ee(te(g.value.message), 1)
|
|
696
771
|
]),
|
|
697
|
-
icon:
|
|
698
|
-
se(
|
|
772
|
+
icon: q(() => [
|
|
773
|
+
se(T(xi))
|
|
699
774
|
]),
|
|
700
775
|
_: 1
|
|
701
|
-
})) :
|
|
776
|
+
})) : y.value ? (z(), M(D, {
|
|
702
777
|
key: 2,
|
|
703
778
|
"action-button-visible": !1,
|
|
704
779
|
"data-testid": "chart-empty-state",
|
|
705
780
|
"icon-variant": "error"
|
|
706
781
|
}, {
|
|
707
|
-
default:
|
|
708
|
-
var
|
|
782
|
+
default: q(() => {
|
|
783
|
+
var R;
|
|
709
784
|
return [
|
|
710
|
-
Ee(te((
|
|
785
|
+
Ee(te((R = g.value) == null ? void 0 : R.message), 1)
|
|
711
786
|
];
|
|
712
787
|
}),
|
|
713
788
|
_: 1
|
|
714
|
-
})) :
|
|
789
|
+
})) : T(l) ? $e(k.$slots, "default", {
|
|
715
790
|
key: 3,
|
|
716
|
-
data:
|
|
717
|
-
}) :
|
|
791
|
+
data: T(l)
|
|
792
|
+
}) : Y("", !0);
|
|
718
793
|
};
|
|
719
794
|
}
|
|
720
|
-
}),
|
|
795
|
+
}), es = /* @__PURE__ */ Q({
|
|
721
796
|
__name: "SimpleChartRenderer",
|
|
722
797
|
props: {
|
|
723
798
|
query: {},
|
|
@@ -726,24 +801,25 @@ const Yi = () => {
|
|
|
726
801
|
chartOptions: {},
|
|
727
802
|
height: {},
|
|
728
803
|
refreshCounter: {},
|
|
729
|
-
requestsLink: {}
|
|
804
|
+
requestsLink: {},
|
|
805
|
+
exploreLink: {}
|
|
730
806
|
},
|
|
731
|
-
setup(
|
|
732
|
-
|
|
807
|
+
setup(u) {
|
|
808
|
+
Ze((i) => ({
|
|
733
809
|
"088169ae": `${i.height}px`
|
|
734
810
|
}));
|
|
735
|
-
const e =
|
|
736
|
-
return (i, s) => (
|
|
811
|
+
const e = u, t = N(() => e.chartOptions.type === "single_value");
|
|
812
|
+
return (i, s) => (z(), M(tt, {
|
|
737
813
|
context: i.context,
|
|
738
814
|
query: i.query,
|
|
739
815
|
"query-ready": i.queryReady,
|
|
740
816
|
"refresh-counter": i.refreshCounter
|
|
741
817
|
}, {
|
|
742
|
-
default:
|
|
818
|
+
default: q(({ data: r }) => [
|
|
743
819
|
le("div", {
|
|
744
|
-
class:
|
|
820
|
+
class: Je(["analytics-chart", { "single-value": t.value }])
|
|
745
821
|
}, [
|
|
746
|
-
se(
|
|
822
|
+
se(T(pi), {
|
|
747
823
|
"chart-data": r,
|
|
748
824
|
"chart-options": i.chartOptions,
|
|
749
825
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.synthetics_data_key
|
|
@@ -753,12 +829,12 @@ const Yi = () => {
|
|
|
753
829
|
_: 1
|
|
754
830
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
755
831
|
}
|
|
756
|
-
}),
|
|
757
|
-
const t =
|
|
832
|
+
}), fe = (u, e) => {
|
|
833
|
+
const t = u.__vccOpts || u;
|
|
758
834
|
for (const [i, s] of e)
|
|
759
835
|
t[i] = s;
|
|
760
836
|
return t;
|
|
761
|
-
},
|
|
837
|
+
}, _t = /* @__PURE__ */ fe(es, [["__scopeId", "data-v-1e9ff912"]]), ts = { class: "analytics-chart" }, is = /* @__PURE__ */ Q({
|
|
762
838
|
__name: "BaseAnalyticsChartRenderer",
|
|
763
839
|
props: {
|
|
764
840
|
query: {},
|
|
@@ -768,63 +844,65 @@ const Yi = () => {
|
|
|
768
844
|
height: {},
|
|
769
845
|
refreshCounter: {},
|
|
770
846
|
requestsLink: {},
|
|
847
|
+
exploreLink: {},
|
|
771
848
|
extraProps: {}
|
|
772
849
|
},
|
|
773
850
|
emits: ["edit-tile", "chart-data", "zoom-time-range", "view-requests", "select-chart-range"],
|
|
774
|
-
setup(
|
|
775
|
-
const t =
|
|
851
|
+
setup(u, { emit: e }) {
|
|
852
|
+
const t = u, i = e, { i18n: s } = ce.useI18n(), { evaluateFeatureFlag: r } = ce.useEvaluateFeatureFlag(), o = r("ma-4135-allow-zooming-all-dashboard-tiles", !1), n = N(() => ({
|
|
776
853
|
type: t.chartOptions.type,
|
|
777
854
|
stacked: t.chartOptions.stacked ?? !1,
|
|
778
855
|
chartDatasetColors: t.chartOptions.chart_dataset_colors,
|
|
779
856
|
threshold: t.chartOptions.threshold
|
|
780
|
-
})), h =
|
|
857
|
+
})), h = N(() => o ? t.context.zoomable : t.context.zoomable && !t.query.time_range), l = () => {
|
|
781
858
|
i("edit-tile");
|
|
782
859
|
}, d = (a) => {
|
|
783
860
|
i("chart-data", a);
|
|
784
861
|
};
|
|
785
862
|
return (a, f) => {
|
|
786
|
-
const
|
|
787
|
-
return
|
|
863
|
+
const p = de("KDropdownItem");
|
|
864
|
+
return z(), M(tt, {
|
|
788
865
|
context: a.context,
|
|
789
866
|
query: a.query,
|
|
790
867
|
"query-ready": a.queryReady,
|
|
791
868
|
"refresh-counter": a.refreshCounter,
|
|
792
869
|
onChartData: d
|
|
793
870
|
}, {
|
|
794
|
-
default:
|
|
795
|
-
le("div",
|
|
796
|
-
se(
|
|
871
|
+
default: q(({ data: g }) => [
|
|
872
|
+
le("div", ts, [
|
|
873
|
+
se(T(yi), zt({
|
|
797
874
|
"chart-data": g,
|
|
798
875
|
"chart-options": n.value,
|
|
876
|
+
"explore-link": a.exploreLink,
|
|
799
877
|
"legend-position": "bottom",
|
|
800
878
|
"requests-link": a.requestsLink,
|
|
801
879
|
"synthetics-data-key": a.chartOptions.synthetics_data_key,
|
|
802
880
|
"timeseries-zoom": h.value,
|
|
803
881
|
"tooltip-title": ""
|
|
804
882
|
}, a.extraProps, {
|
|
805
|
-
onSelectChartRange: f[0] || (f[0] = (
|
|
806
|
-
onZoomTimeRange: f[1] || (f[1] = (
|
|
807
|
-
}),
|
|
883
|
+
onSelectChartRange: f[0] || (f[0] = (y) => i("select-chart-range", y)),
|
|
884
|
+
onZoomTimeRange: f[1] || (f[1] = (y) => i("zoom-time-range", y))
|
|
885
|
+
}), et({ _: 2 }, [
|
|
808
886
|
a.context.editable ? {
|
|
809
887
|
name: "menu-items",
|
|
810
|
-
fn:
|
|
811
|
-
se(
|
|
812
|
-
default:
|
|
813
|
-
Ee(te(
|
|
888
|
+
fn: q(() => [
|
|
889
|
+
se(p, { onClick: l }, {
|
|
890
|
+
default: q(() => [
|
|
891
|
+
Ee(te(T(s).t("renderer.edit")), 1)
|
|
814
892
|
]),
|
|
815
893
|
_: 1
|
|
816
894
|
})
|
|
817
895
|
]),
|
|
818
896
|
key: "0"
|
|
819
897
|
} : void 0
|
|
820
|
-
]), 1040, ["chart-data", "chart-options", "requests-link", "synthetics-data-key", "timeseries-zoom"])
|
|
898
|
+
]), 1040, ["chart-data", "chart-options", "explore-link", "requests-link", "synthetics-data-key", "timeseries-zoom"])
|
|
821
899
|
])
|
|
822
900
|
]),
|
|
823
901
|
_: 1
|
|
824
902
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
825
903
|
};
|
|
826
904
|
}
|
|
827
|
-
}),
|
|
905
|
+
}), it = /* @__PURE__ */ fe(is, [["__scopeId", "data-v-965790dd"]]), bt = /* @__PURE__ */ Q({
|
|
828
906
|
__name: "BarChartRenderer",
|
|
829
907
|
props: {
|
|
830
908
|
query: {},
|
|
@@ -833,10 +911,11 @@ const Yi = () => {
|
|
|
833
911
|
chartOptions: {},
|
|
834
912
|
height: {},
|
|
835
913
|
refreshCounter: {},
|
|
836
|
-
requestsLink: {}
|
|
914
|
+
requestsLink: {},
|
|
915
|
+
exploreLink: {}
|
|
837
916
|
},
|
|
838
|
-
setup(
|
|
839
|
-
return (e, t) => (
|
|
917
|
+
setup(u) {
|
|
918
|
+
return (e, t) => (z(), M(it, {
|
|
840
919
|
"chart-options": e.chartOptions,
|
|
841
920
|
context: e.context,
|
|
842
921
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -846,7 +925,7 @@ const Yi = () => {
|
|
|
846
925
|
"refresh-counter": e.refreshCounter
|
|
847
926
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
848
927
|
}
|
|
849
|
-
}),
|
|
928
|
+
}), wt = /* @__PURE__ */ Q({
|
|
850
929
|
__name: "TimeseriesChartRenderer",
|
|
851
930
|
props: {
|
|
852
931
|
query: {},
|
|
@@ -855,14 +934,16 @@ const Yi = () => {
|
|
|
855
934
|
chartOptions: {},
|
|
856
935
|
height: {},
|
|
857
936
|
refreshCounter: {},
|
|
858
|
-
requestsLink: {}
|
|
937
|
+
requestsLink: {},
|
|
938
|
+
exploreLink: {}
|
|
859
939
|
},
|
|
860
940
|
emits: ["zoom-time-range", "select-chart-range"],
|
|
861
|
-
setup(
|
|
941
|
+
setup(u, { emit: e }) {
|
|
862
942
|
const t = e;
|
|
863
|
-
return (i, s) => (
|
|
943
|
+
return (i, s) => (z(), M(it, {
|
|
864
944
|
"chart-options": i.chartOptions,
|
|
865
945
|
context: i.context,
|
|
946
|
+
"explore-link": i.exploreLink,
|
|
866
947
|
height: i.height,
|
|
867
948
|
query: i.query,
|
|
868
949
|
"query-ready": i.queryReady,
|
|
@@ -870,9 +951,9 @@ const Yi = () => {
|
|
|
870
951
|
"requests-link": i.requestsLink,
|
|
871
952
|
onSelectChartRange: s[0] || (s[0] = (r) => t("select-chart-range", r)),
|
|
872
953
|
onZoomTimeRange: s[1] || (s[1] = (r) => t("zoom-time-range", r))
|
|
873
|
-
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
954
|
+
}, null, 8, ["chart-options", "context", "explore-link", "height", "query", "query-ready", "refresh-counter", "requests-link"]));
|
|
874
955
|
}
|
|
875
|
-
}),
|
|
956
|
+
}), ss = { class: "metric-card-tile-wrapper" }, rs = /* @__PURE__ */ Q({
|
|
876
957
|
__name: "GoldenSignalsRenderer",
|
|
877
958
|
props: {
|
|
878
959
|
query: {},
|
|
@@ -881,13 +962,14 @@ const Yi = () => {
|
|
|
881
962
|
chartOptions: {},
|
|
882
963
|
height: {},
|
|
883
964
|
refreshCounter: {},
|
|
884
|
-
requestsLink: {}
|
|
965
|
+
requestsLink: {},
|
|
966
|
+
exploreLink: {}
|
|
885
967
|
},
|
|
886
|
-
setup(
|
|
887
|
-
const e =
|
|
968
|
+
setup(u) {
|
|
969
|
+
const e = u, t = N(() => {
|
|
888
970
|
const s = e.context.timeSpec;
|
|
889
971
|
if (s.type === "absolute")
|
|
890
|
-
return new
|
|
972
|
+
return new gi({
|
|
891
973
|
key: "custom",
|
|
892
974
|
timeframeText: "custom",
|
|
893
975
|
display: "custom",
|
|
@@ -899,11 +981,11 @@ const Yi = () => {
|
|
|
899
981
|
isRelative: !1,
|
|
900
982
|
allowedTiers: ["free", "plus", "enterprise"]
|
|
901
983
|
});
|
|
902
|
-
const r =
|
|
984
|
+
const r = Ht.get(s.time_range);
|
|
903
985
|
if (!r)
|
|
904
986
|
throw new Error("Unknown time range");
|
|
905
987
|
return r;
|
|
906
|
-
}), i =
|
|
988
|
+
}), i = N(() => {
|
|
907
989
|
var r, o;
|
|
908
990
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
909
991
|
if (s && s !== "api_usage" && s !== "basic")
|
|
@@ -921,27 +1003,27 @@ const Yi = () => {
|
|
|
921
1003
|
refreshCounter: e.refreshCounter
|
|
922
1004
|
};
|
|
923
1005
|
});
|
|
924
|
-
return (s, r) => (
|
|
925
|
-
se(
|
|
926
|
-
default:
|
|
927
|
-
se(
|
|
1006
|
+
return (s, r) => (z(), W("div", ss, [
|
|
1007
|
+
se(T(Ti), li(hi(i.value)), {
|
|
1008
|
+
default: q(() => [
|
|
1009
|
+
se(T(zi))
|
|
928
1010
|
]),
|
|
929
1011
|
_: 1
|
|
930
1012
|
}, 16)
|
|
931
1013
|
]));
|
|
932
1014
|
}
|
|
933
|
-
}),
|
|
1015
|
+
}), ns = /* @__PURE__ */ fe(rs, [["__scopeId", "data-v-7e1b1cc1"]]), Et = "#6c7489", os = "12px", xt = "20px", Vt = "20px", as = {
|
|
934
1016
|
class: "fallback-entity-link",
|
|
935
1017
|
"data-testid": "entity-link-parent"
|
|
936
|
-
},
|
|
1018
|
+
}, Ct = /* @__PURE__ */ Q({
|
|
937
1019
|
__name: "FallbackEntityLink",
|
|
938
1020
|
props: {
|
|
939
1021
|
entityLinkData: {}
|
|
940
1022
|
},
|
|
941
|
-
setup(
|
|
942
|
-
return (e, t) => (
|
|
1023
|
+
setup(u) {
|
|
1024
|
+
return (e, t) => (z(), W("div", as, te(e.entityLinkData.label), 1));
|
|
943
1025
|
}
|
|
944
|
-
}),
|
|
1026
|
+
}), ls = /* @__PURE__ */ Q({
|
|
945
1027
|
__name: "TopNTableRenderer",
|
|
946
1028
|
props: {
|
|
947
1029
|
query: {},
|
|
@@ -950,42 +1032,43 @@ const Yi = () => {
|
|
|
950
1032
|
chartOptions: {},
|
|
951
1033
|
height: {},
|
|
952
1034
|
refreshCounter: {},
|
|
953
|
-
requestsLink: {}
|
|
1035
|
+
requestsLink: {},
|
|
1036
|
+
exploreLink: {}
|
|
954
1037
|
},
|
|
955
|
-
setup(
|
|
956
|
-
const e =
|
|
1038
|
+
setup(u) {
|
|
1039
|
+
const e = u, t = _e(ue), i = Dt(async () => {
|
|
957
1040
|
if (t != null && t.fetchComponent)
|
|
958
1041
|
try {
|
|
959
1042
|
return await t.fetchComponent("EntityLink");
|
|
960
1043
|
} catch {
|
|
961
|
-
return
|
|
1044
|
+
return Ct;
|
|
962
1045
|
}
|
|
963
|
-
return
|
|
1046
|
+
return Ct;
|
|
964
1047
|
}), s = (r) => {
|
|
965
1048
|
var o;
|
|
966
1049
|
if ((o = e.chartOptions) != null && o.entity_link)
|
|
967
1050
|
if (r.id.includes(":")) {
|
|
968
1051
|
const [n, h] = r.id.split(":");
|
|
969
|
-
return e.chartOptions.entity_link.replace(
|
|
1052
|
+
return e.chartOptions.entity_link.replace($i, n).replace(pt, h);
|
|
970
1053
|
} else
|
|
971
|
-
return e.chartOptions.entity_link.replace(
|
|
1054
|
+
return e.chartOptions.entity_link.replace(pt, r.id);
|
|
972
1055
|
return "";
|
|
973
1056
|
};
|
|
974
|
-
return (r, o) => (
|
|
1057
|
+
return (r, o) => (z(), M(tt, {
|
|
975
1058
|
context: r.context,
|
|
976
1059
|
query: r.query,
|
|
977
1060
|
"query-ready": r.queryReady,
|
|
978
1061
|
"refresh-counter": r.refreshCounter
|
|
979
1062
|
}, {
|
|
980
|
-
default:
|
|
981
|
-
se(
|
|
1063
|
+
default: q(({ data: n }) => [
|
|
1064
|
+
se(T(vi), {
|
|
982
1065
|
data: n,
|
|
983
1066
|
"synthetics-data-key": r.chartOptions.synthetics_data_key
|
|
984
|
-
},
|
|
1067
|
+
}, et({ _: 2 }, [
|
|
985
1068
|
e.chartOptions.entity_link ? {
|
|
986
1069
|
name: "name",
|
|
987
|
-
fn:
|
|
988
|
-
se(
|
|
1070
|
+
fn: q(({ record: h }) => [
|
|
1071
|
+
se(T(i), {
|
|
989
1072
|
"entity-link-data": {
|
|
990
1073
|
id: h.id,
|
|
991
1074
|
label: h.name,
|
|
@@ -1001,7 +1084,7 @@ const Yi = () => {
|
|
|
1001
1084
|
_: 1
|
|
1002
1085
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
1003
1086
|
}
|
|
1004
|
-
}),
|
|
1087
|
+
}), hs = /* @__PURE__ */ Q({
|
|
1005
1088
|
__name: "DonutChartRenderer",
|
|
1006
1089
|
props: {
|
|
1007
1090
|
query: {},
|
|
@@ -1010,10 +1093,11 @@ const Yi = () => {
|
|
|
1010
1093
|
chartOptions: {},
|
|
1011
1094
|
height: {},
|
|
1012
1095
|
refreshCounter: {},
|
|
1013
|
-
requestsLink: {}
|
|
1096
|
+
requestsLink: {},
|
|
1097
|
+
exploreLink: {}
|
|
1014
1098
|
},
|
|
1015
|
-
setup(
|
|
1016
|
-
return (e, t) => (
|
|
1099
|
+
setup(u) {
|
|
1100
|
+
return (e, t) => (z(), M(it, {
|
|
1017
1101
|
"chart-options": e.chartOptions,
|
|
1018
1102
|
context: e.context,
|
|
1019
1103
|
height: e.height,
|
|
@@ -1022,76 +1106,66 @@ const Yi = () => {
|
|
|
1022
1106
|
"refresh-counter": e.refreshCounter
|
|
1023
1107
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
1024
1108
|
}
|
|
1025
|
-
}),
|
|
1109
|
+
}), ds = ["data-testid"], us = {
|
|
1026
1110
|
key: 0,
|
|
1027
1111
|
class: "tile-header"
|
|
1028
|
-
},
|
|
1112
|
+
}, cs = ["data-testid"], fs = { class: "badge-text" }, gs = ["data-testid"], ms = { class: "delete-option" }, ps = ["data-testid"], ys = ["data-testid"], vs = /* @__PURE__ */ Q({
|
|
1029
1113
|
__name: "DashboardTile",
|
|
1030
1114
|
props: {
|
|
1031
1115
|
definition: {},
|
|
1032
1116
|
context: {},
|
|
1033
|
-
height: { default:
|
|
1117
|
+
height: { default: Ge },
|
|
1034
1118
|
queryReady: { type: Boolean },
|
|
1035
1119
|
refreshCounter: {},
|
|
1036
1120
|
tileId: {}
|
|
1037
1121
|
},
|
|
1038
1122
|
emits: ["edit-tile", "duplicate-tile", "remove-tile", "tile-time-range-zoom"],
|
|
1039
|
-
setup(
|
|
1040
|
-
|
|
1041
|
-
"
|
|
1123
|
+
setup(u, { emit: e }) {
|
|
1124
|
+
Ze((v) => ({
|
|
1125
|
+
"3d5e4dab": `${v.height}px`
|
|
1042
1126
|
}));
|
|
1043
|
-
const t = parseInt(
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1127
|
+
const t = parseInt(Vt, 10), i = u, s = e, r = Dt(() => import("./GeoMapRenderer-ZojWjKPk.js")), o = _e(ue), n = o == null ? void 0 : o.evaluateFeatureFlagFn("analytics-chart-zoom-actions", !1), { i18n: h } = ce.useI18n(), l = $(), d = $(!1), a = $(), f = $(!1), p = $(void 0), g = $(void 0), y = $(!0), {
|
|
1128
|
+
exploreLinkKebabMenu: m,
|
|
1129
|
+
requestsLinkKebabMenu: k,
|
|
1130
|
+
canShowKebabMenu: w,
|
|
1131
|
+
canGenerateRequestsLink: E,
|
|
1132
|
+
canGenerateExploreLink: D,
|
|
1133
|
+
buildExploreQuery: C,
|
|
1134
|
+
buildExploreLink: R,
|
|
1135
|
+
buildRequestLink: A,
|
|
1136
|
+
buildRequestsQueryZoomActions: L
|
|
1137
|
+
} = ce.useContextLinks({
|
|
1138
|
+
queryBridge: o,
|
|
1139
|
+
chartData: We(l),
|
|
1140
|
+
definition: We(ct(i, "definition")),
|
|
1141
|
+
context: We(ct(i, "context"))
|
|
1142
|
+
});
|
|
1143
|
+
Xe(() => i.definition, async () => {
|
|
1144
|
+
await St(), a.value && (f.value = a.value.scrollWidth > a.value.clientWidth), y.value = !0;
|
|
1049
1145
|
}, { immediate: !0, deep: !0 });
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
}, F = ["api_usage", "llm_usage"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "api_usage";
|
|
1060
|
-
return `${y.value}?q=${JSON.stringify(O)}&d=${F}&c=${i.definition.chart.type}`;
|
|
1061
|
-
}), H = S(() => {
|
|
1062
|
-
var m;
|
|
1063
|
-
return g.value && i.definition.query && ((m = i.definition.query) == null ? void 0 : m.datasource) !== "llm_usage";
|
|
1064
|
-
}), T = S(() => {
|
|
1065
|
-
if (!H.value || !E.value)
|
|
1066
|
-
return "";
|
|
1067
|
-
const m = [...i.context.filters, ...i.definition.query.filters ?? []], z = Qt(
|
|
1068
|
-
i.definition.query.time_range || i.context.timeSpec,
|
|
1069
|
-
m
|
|
1070
|
-
);
|
|
1071
|
-
return `${g.value}?q=${JSON.stringify(z)}`;
|
|
1072
|
-
}), q = S(() => h.t("csvExport.defaultFilename")), x = S(() => E.value && (A.value || i.context.editable) || !!oe.value), E = S(() => !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), A = S(() => !!R.value || "allow_csv_export" in i.definition.chart && i.definition.chart.allow_csv_export || i.context.editable), N = {
|
|
1073
|
-
timeseries_line: pt,
|
|
1074
|
-
timeseries_bar: pt,
|
|
1075
|
-
horizontal_bar: mt,
|
|
1076
|
-
vertical_bar: mt,
|
|
1077
|
-
gauge: gt,
|
|
1078
|
-
donut: rs,
|
|
1079
|
-
golden_signals: es,
|
|
1080
|
-
top_n: ss,
|
|
1146
|
+
const U = N(() => h.t("csvExport.defaultFilename")), ee = N(() => w.value && (ae.value || i.context.editable) || !!Fe.value), ae = N(() => !!m.value || "allow_csv_export" in i.definition.chart && i.definition.chart.allow_csv_export || i.context.editable), De = {
|
|
1147
|
+
timeseries_line: wt,
|
|
1148
|
+
timeseries_bar: wt,
|
|
1149
|
+
horizontal_bar: bt,
|
|
1150
|
+
vertical_bar: bt,
|
|
1151
|
+
gauge: _t,
|
|
1152
|
+
donut: hs,
|
|
1153
|
+
golden_signals: ns,
|
|
1154
|
+
top_n: ls,
|
|
1081
1155
|
slottable: void 0,
|
|
1082
|
-
single_value:
|
|
1156
|
+
single_value: _t,
|
|
1083
1157
|
choropleth_map: r
|
|
1084
|
-
},
|
|
1085
|
-
var
|
|
1158
|
+
}, Se = N(() => {
|
|
1159
|
+
var v, O;
|
|
1086
1160
|
return {
|
|
1087
|
-
...(
|
|
1088
|
-
...(
|
|
1161
|
+
...(v = be.value) != null && v.rendererEvents.supportsRequests ? { "select-chart-range": ri } : {},
|
|
1162
|
+
...(O = be.value) != null && O.rendererEvents.supportsZoom ? { "zoom-time-range": si } : {}
|
|
1089
1163
|
};
|
|
1090
|
-
}),
|
|
1091
|
-
var
|
|
1092
|
-
const
|
|
1093
|
-
return
|
|
1094
|
-
component:
|
|
1164
|
+
}), be = N(() => {
|
|
1165
|
+
var j, K;
|
|
1166
|
+
const v = De[i.definition.chart.type], O = !!((j = v == null ? void 0 : v.emits) != null && j.includes("select-chart-range")), I = !!((K = v == null ? void 0 : v.emits) != null && K.includes("zoom-time-range"));
|
|
1167
|
+
return v && {
|
|
1168
|
+
component: v,
|
|
1095
1169
|
rendererProps: {
|
|
1096
1170
|
query: i.definition.query,
|
|
1097
1171
|
context: i.context,
|
|
@@ -1099,223 +1173,203 @@ const Yi = () => {
|
|
|
1099
1173
|
chartOptions: i.definition.chart,
|
|
1100
1174
|
height: i.height - t * 2,
|
|
1101
1175
|
refreshCounter: i.refreshCounter,
|
|
1102
|
-
requestsLink:
|
|
1176
|
+
requestsLink: p.value,
|
|
1177
|
+
exploreLink: g.value
|
|
1103
1178
|
},
|
|
1104
1179
|
rendererEvents: {
|
|
1105
|
-
supportsRequests:
|
|
1106
|
-
supportsZoom:
|
|
1180
|
+
supportsRequests: O,
|
|
1181
|
+
supportsZoom: I
|
|
1107
1182
|
}
|
|
1108
1183
|
};
|
|
1109
|
-
}),
|
|
1110
|
-
var
|
|
1111
|
-
const
|
|
1112
|
-
if ((
|
|
1113
|
-
const
|
|
1114
|
-
return
|
|
1115
|
-
} else if ((
|
|
1116
|
-
const
|
|
1117
|
-
return `${
|
|
1184
|
+
}), Fe = N(() => {
|
|
1185
|
+
var O;
|
|
1186
|
+
const v = (O = i.definition.query) == null ? void 0 : O.time_range;
|
|
1187
|
+
if ((v == null ? void 0 : v.type) === "relative") {
|
|
1188
|
+
const I = Ht.get(mi[v.time_range]);
|
|
1189
|
+
return I ? I.display : (console.warn("Did not recognize the given relative time range:", v.time_range), v.time_range);
|
|
1190
|
+
} else if ((v == null ? void 0 : v.type) === "absolute") {
|
|
1191
|
+
const I = v.tz || "Etc/UTC";
|
|
1192
|
+
return `${mt(v.start, { short: !0, tz: I })} - ${mt(v.end, { short: !0, tz: I })}`;
|
|
1118
1193
|
}
|
|
1119
1194
|
return null;
|
|
1120
|
-
}),
|
|
1121
|
-
var
|
|
1122
|
-
if (!
|
|
1195
|
+
}), nt = N(() => l.value ? Ke(l.value.meta.granularity_ms) : void 0), Qt = N(() => ["timeseries_line", "timeseries_bar"].includes(i.definition.chart.type)), ot = N(() => {
|
|
1196
|
+
var O, I;
|
|
1197
|
+
if (!Qt.value || !i.queryReady || y.value)
|
|
1123
1198
|
return !1;
|
|
1124
|
-
const
|
|
1125
|
-
return !
|
|
1126
|
-
}),
|
|
1127
|
-
var
|
|
1128
|
-
const
|
|
1199
|
+
const v = (I = (O = i.definition) == null ? void 0 : O.query) == null ? void 0 : I.granularity;
|
|
1200
|
+
return !v || !nt.value ? !1 : v !== nt.value;
|
|
1201
|
+
}), jt = N(() => {
|
|
1202
|
+
var I, j, K;
|
|
1203
|
+
const v = Ke(((I = l.value) == null ? void 0 : I.meta.granularity_ms) ?? 0) ?? "unknown", O = ((K = (j = i.definition) == null ? void 0 : j.query) == null ? void 0 : K.granularity) ?? "unknown";
|
|
1129
1204
|
return h.t("query_aged_out_warning", {
|
|
1130
|
-
currentGranularity: h.t(`granularities.${
|
|
1131
|
-
savedGranularity: h.t(`granularities.${
|
|
1205
|
+
currentGranularity: h.t(`granularities.${v}`),
|
|
1206
|
+
savedGranularity: h.t(`granularities.${O}`)
|
|
1132
1207
|
});
|
|
1133
|
-
}),
|
|
1134
|
-
var
|
|
1135
|
-
const
|
|
1136
|
-
return
|
|
1137
|
-
}),
|
|
1208
|
+
}), Xt = N(() => {
|
|
1209
|
+
var I, j;
|
|
1210
|
+
const v = [...i.context.filters, ...i.definition.query.filters ?? []], O = ((j = (I = i.definition) == null ? void 0 : I.query) == null ? void 0 : j.datasource) ?? "api_usage";
|
|
1211
|
+
return v.filter((K) => Ot(K.field).some((ht) => O === ht));
|
|
1212
|
+
}), Zt = () => {
|
|
1138
1213
|
s("edit-tile", i.definition);
|
|
1139
|
-
},
|
|
1214
|
+
}, Jt = () => {
|
|
1140
1215
|
s("duplicate-tile", i.definition);
|
|
1141
|
-
},
|
|
1216
|
+
}, ei = () => {
|
|
1142
1217
|
s("remove-tile", i.definition);
|
|
1143
|
-
},
|
|
1144
|
-
l.value =
|
|
1145
|
-
},
|
|
1146
|
-
d.value =
|
|
1147
|
-
},
|
|
1148
|
-
|
|
1149
|
-
},
|
|
1150
|
-
const
|
|
1218
|
+
}, ti = (v) => {
|
|
1219
|
+
l.value = v, y.value = !1;
|
|
1220
|
+
}, at = (v) => {
|
|
1221
|
+
d.value = v;
|
|
1222
|
+
}, ii = () => {
|
|
1223
|
+
at(!0);
|
|
1224
|
+
}, si = (v) => {
|
|
1225
|
+
const O = {
|
|
1151
1226
|
tileId: i.tileId.toString(),
|
|
1152
|
-
timeRange:
|
|
1227
|
+
timeRange: v
|
|
1153
1228
|
};
|
|
1154
|
-
s("tile-time-range-zoom",
|
|
1155
|
-
},
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
filter: z,
|
|
1159
|
-
timeframe: {
|
|
1160
|
-
timePeriodsKey: m.type === "relative" ? m.time_range : "custom",
|
|
1161
|
-
start: m.type === "absolute" ? (O = l.value) == null ? void 0 : O.meta.start_ms : void 0,
|
|
1162
|
-
end: m.type === "absolute" ? (F = l.value) == null ? void 0 : F.meta.end_ms : void 0
|
|
1163
|
-
}
|
|
1164
|
-
};
|
|
1165
|
-
}, Zt = (m, z) => ({
|
|
1166
|
-
filter: z,
|
|
1167
|
-
timeframe: {
|
|
1168
|
-
timePeriodsKey: m.type === "relative" ? m.time_range : "custom",
|
|
1169
|
-
start: m.type === "absolute" ? m.start : void 0,
|
|
1170
|
-
end: m.type === "absolute" ? m.end : void 0
|
|
1171
|
-
}
|
|
1172
|
-
}), Jt = (m) => {
|
|
1173
|
-
if (!H.value) {
|
|
1174
|
-
v.value = void 0;
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
const z = [...i.context.filters, ...i.definition.query.filters ?? []], O = Zt(m, z);
|
|
1178
|
-
v.value = { href: `${g.value}?q=${JSON.stringify(O)}` };
|
|
1229
|
+
s("tile-time-range-zoom", O);
|
|
1230
|
+
}, ri = (v) => {
|
|
1231
|
+
const O = Xt.value, I = L(v, O), j = C(v, O);
|
|
1232
|
+
p.value = E.value ? { href: A(I) } : void 0, g.value = D.value ? { href: R(j) } : void 0;
|
|
1179
1233
|
};
|
|
1180
|
-
return (
|
|
1181
|
-
const
|
|
1182
|
-
return
|
|
1183
|
-
class:
|
|
1184
|
-
"data-testid": `tile-${
|
|
1234
|
+
return (v, O) => {
|
|
1235
|
+
const I = de("KTooltip"), j = de("KBadge"), K = de("KDropdownItem"), lt = de("KDropdown");
|
|
1236
|
+
return z(), W("div", {
|
|
1237
|
+
class: Je(["tile-boundary", { editable: v.context.editable }]),
|
|
1238
|
+
"data-testid": `tile-${v.tileId}`
|
|
1185
1239
|
}, [
|
|
1186
|
-
|
|
1187
|
-
se(
|
|
1240
|
+
v.definition.chart.type !== "slottable" ? (z(), W("div", us, [
|
|
1241
|
+
se(I, {
|
|
1188
1242
|
class: "title-tooltip",
|
|
1189
1243
|
disabled: !f.value,
|
|
1190
1244
|
"max-width": "500",
|
|
1191
|
-
text:
|
|
1245
|
+
text: v.definition.chart.chart_title
|
|
1192
1246
|
}, {
|
|
1193
|
-
default:
|
|
1247
|
+
default: q(() => [
|
|
1194
1248
|
le("div", {
|
|
1195
1249
|
ref_key: "titleRef",
|
|
1196
1250
|
ref: a,
|
|
1197
1251
|
class: "title"
|
|
1198
|
-
}, te(
|
|
1252
|
+
}, te(v.definition.chart.chart_title), 513)
|
|
1199
1253
|
]),
|
|
1200
1254
|
_: 1
|
|
1201
1255
|
}, 8, ["disabled", "text"]),
|
|
1202
|
-
|
|
1256
|
+
ee.value ? (z(), W("div", {
|
|
1203
1257
|
key: 0,
|
|
1204
1258
|
class: "tile-actions",
|
|
1205
|
-
"data-testid": `tile-actions-${
|
|
1259
|
+
"data-testid": `tile-actions-${v.tileId}`
|
|
1206
1260
|
}, [
|
|
1207
|
-
|
|
1261
|
+
Fe.value ? (z(), M(j, {
|
|
1208
1262
|
key: 0,
|
|
1209
1263
|
"data-testid": "time-range-badge",
|
|
1210
|
-
tooltip:
|
|
1264
|
+
tooltip: ot.value ? jt.value : void 0,
|
|
1211
1265
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1212
|
-
},
|
|
1213
|
-
default:
|
|
1214
|
-
le("span",
|
|
1266
|
+
}, et({
|
|
1267
|
+
default: q(() => [
|
|
1268
|
+
le("span", fs, te(Fe.value), 1)
|
|
1215
1269
|
]),
|
|
1216
1270
|
_: 2
|
|
1217
1271
|
}, [
|
|
1218
|
-
|
|
1272
|
+
ot.value ? {
|
|
1219
1273
|
name: "icon",
|
|
1220
|
-
fn:
|
|
1221
|
-
se(
|
|
1274
|
+
fn: q(() => [
|
|
1275
|
+
se(T(Ci), { size: T(os) }, null, 8, ["size"])
|
|
1222
1276
|
]),
|
|
1223
1277
|
key: "0"
|
|
1224
1278
|
} : void 0
|
|
1225
|
-
]), 1032, ["tooltip"])) :
|
|
1226
|
-
|
|
1279
|
+
]), 1032, ["tooltip"])) : Y("", !0),
|
|
1280
|
+
T(w) && v.context.editable ? (z(), M(T(Ri), {
|
|
1227
1281
|
key: 1,
|
|
1228
1282
|
class: "edit-icon",
|
|
1229
|
-
color:
|
|
1230
|
-
"data-testid": `edit-tile-${
|
|
1231
|
-
size:
|
|
1232
|
-
onClick:
|
|
1233
|
-
}, null, 8, ["color", "data-testid", "size"])) :
|
|
1234
|
-
|
|
1283
|
+
color: T(Et),
|
|
1284
|
+
"data-testid": `edit-tile-${v.tileId}`,
|
|
1285
|
+
size: T(xt),
|
|
1286
|
+
onClick: Zt
|
|
1287
|
+
}, null, 8, ["color", "data-testid", "size"])) : Y("", !0),
|
|
1288
|
+
T(w) && ae.value ? (z(), M(lt, {
|
|
1235
1289
|
key: 2,
|
|
1236
1290
|
class: "dropdown",
|
|
1237
|
-
"data-testid": `chart-action-menu-${
|
|
1291
|
+
"data-testid": `chart-action-menu-${v.tileId}`,
|
|
1238
1292
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1239
1293
|
}, {
|
|
1240
|
-
items:
|
|
1241
|
-
|
|
1294
|
+
items: q(() => [
|
|
1295
|
+
T(m) ? (z(), M(K, {
|
|
1242
1296
|
key: 0,
|
|
1243
|
-
"data-testid": `chart-jump-to-explore-${
|
|
1244
|
-
item: { label:
|
|
1245
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1246
|
-
|
|
1297
|
+
"data-testid": `chart-jump-to-explore-${v.tileId}`,
|
|
1298
|
+
item: { label: T(h).t("jumpToExplore"), to: T(m) }
|
|
1299
|
+
}, null, 8, ["data-testid", "item"])) : Y("", !0),
|
|
1300
|
+
T(n) && T(k) ? (z(), M(K, {
|
|
1247
1301
|
key: 1,
|
|
1248
|
-
"data-testid": `chart-jump-to-requests-${
|
|
1249
|
-
item: { label:
|
|
1250
|
-
}, null, 8, ["data-testid", "item"])) :
|
|
1251
|
-
!("allow_csv_export" in
|
|
1302
|
+
"data-testid": `chart-jump-to-requests-${v.tileId}`,
|
|
1303
|
+
item: { label: T(h).t("jumpToRequests"), to: T(k) }
|
|
1304
|
+
}, null, 8, ["data-testid", "item"])) : Y("", !0),
|
|
1305
|
+
!("allow_csv_export" in v.definition.chart) || v.definition.chart.allow_csv_export ? (z(), M(K, {
|
|
1252
1306
|
key: 2,
|
|
1253
1307
|
class: "chart-export-button",
|
|
1254
|
-
"data-testid": `chart-csv-export-${
|
|
1255
|
-
onClick:
|
|
1308
|
+
"data-testid": `chart-csv-export-${v.tileId}`,
|
|
1309
|
+
onClick: O[0] || (O[0] = (ht) => ii())
|
|
1256
1310
|
}, {
|
|
1257
|
-
default:
|
|
1311
|
+
default: q(() => [
|
|
1258
1312
|
le("span", {
|
|
1259
1313
|
class: "chart-export-trigger",
|
|
1260
|
-
"data-testid": `csv-export-button-${
|
|
1261
|
-
}, te(
|
|
1314
|
+
"data-testid": `csv-export-button-${v.tileId}`
|
|
1315
|
+
}, te(T(h).t("csvExport.exportAsCsv")), 9, gs)
|
|
1262
1316
|
]),
|
|
1263
1317
|
_: 1
|
|
1264
|
-
}, 8, ["data-testid"])) :
|
|
1265
|
-
|
|
1318
|
+
}, 8, ["data-testid"])) : Y("", !0),
|
|
1319
|
+
v.context.editable ? (z(), M(K, {
|
|
1266
1320
|
key: 3,
|
|
1267
|
-
"data-testid": `duplicate-tile-${
|
|
1268
|
-
onClick:
|
|
1321
|
+
"data-testid": `duplicate-tile-${v.tileId}`,
|
|
1322
|
+
onClick: Jt
|
|
1269
1323
|
}, {
|
|
1270
|
-
default:
|
|
1271
|
-
Ee(te(
|
|
1324
|
+
default: q(() => [
|
|
1325
|
+
Ee(te(T(h).t("renderer.duplicateTile")), 1)
|
|
1272
1326
|
]),
|
|
1273
1327
|
_: 1
|
|
1274
|
-
}, 8, ["data-testid"])) :
|
|
1275
|
-
|
|
1328
|
+
}, 8, ["data-testid"])) : Y("", !0),
|
|
1329
|
+
v.context.editable ? (z(), M(K, {
|
|
1276
1330
|
key: 4,
|
|
1277
|
-
"data-testid": `remove-tile-${
|
|
1278
|
-
onClick:
|
|
1331
|
+
"data-testid": `remove-tile-${v.tileId}`,
|
|
1332
|
+
onClick: ei
|
|
1279
1333
|
}, {
|
|
1280
|
-
default:
|
|
1281
|
-
le("span",
|
|
1334
|
+
default: q(() => [
|
|
1335
|
+
le("span", ms, te(T(h).t("renderer.delete")), 1)
|
|
1282
1336
|
]),
|
|
1283
1337
|
_: 1
|
|
1284
|
-
}, 8, ["data-testid"])) :
|
|
1338
|
+
}, 8, ["data-testid"])) : Y("", !0)
|
|
1285
1339
|
]),
|
|
1286
|
-
default:
|
|
1287
|
-
se(
|
|
1340
|
+
default: q(() => [
|
|
1341
|
+
se(T(ki), {
|
|
1288
1342
|
class: "kebab-action-menu",
|
|
1289
|
-
color:
|
|
1290
|
-
"data-testid": `kebab-action-menu-${
|
|
1291
|
-
size:
|
|
1343
|
+
color: T(Et),
|
|
1344
|
+
"data-testid": `kebab-action-menu-${v.tileId}`,
|
|
1345
|
+
size: T(xt)
|
|
1292
1346
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1293
1347
|
]),
|
|
1294
1348
|
_: 1
|
|
1295
|
-
}, 8, ["data-testid"])) :
|
|
1296
|
-
], 8,
|
|
1349
|
+
}, 8, ["data-testid"])) : Y("", !0)
|
|
1350
|
+
], 8, cs)) : "description" in v.definition.chart ? (z(), W("div", {
|
|
1297
1351
|
key: 1,
|
|
1298
1352
|
class: "header-description",
|
|
1299
|
-
"data-testid": `tile-description-${
|
|
1300
|
-
}, te(
|
|
1301
|
-
d.value ? (
|
|
1353
|
+
"data-testid": `tile-description-${v.tileId}`
|
|
1354
|
+
}, te(v.definition.chart.description), 9, ps)) : Y("", !0),
|
|
1355
|
+
d.value ? (z(), M(T(_i), {
|
|
1302
1356
|
key: 2,
|
|
1303
1357
|
"chart-data": l.value,
|
|
1304
|
-
"data-testid": `csv-export-modal-${
|
|
1305
|
-
filename:
|
|
1306
|
-
onToggleModal:
|
|
1307
|
-
}, null, 8, ["chart-data", "data-testid", "filename"])) :
|
|
1308
|
-
])) :
|
|
1358
|
+
"data-testid": `csv-export-modal-${v.tileId}`,
|
|
1359
|
+
filename: U.value,
|
|
1360
|
+
onToggleModal: at
|
|
1361
|
+
}, null, 8, ["chart-data", "data-testid", "filename"])) : Y("", !0)
|
|
1362
|
+
])) : Y("", !0),
|
|
1309
1363
|
le("div", {
|
|
1310
1364
|
class: "tile-content",
|
|
1311
|
-
"data-testid": `tile-content-${
|
|
1365
|
+
"data-testid": `tile-content-${v.tileId}`
|
|
1312
1366
|
}, [
|
|
1313
|
-
|
|
1314
|
-
], 8,
|
|
1315
|
-
], 10,
|
|
1367
|
+
be.value ? (z(), M(Nt(be.value.component), zt({ key: 0 }, be.value.rendererProps, di(Se.value), { onChartData: ti }), null, 16)) : Y("", !0)
|
|
1368
|
+
], 8, ys)
|
|
1369
|
+
], 10, ds);
|
|
1316
1370
|
};
|
|
1317
1371
|
}
|
|
1318
|
-
}),
|
|
1372
|
+
}), _s = /* @__PURE__ */ fe(vs, [["__scopeId", "data-v-7a51e777"]]), bs = (u, e) => {
|
|
1319
1373
|
let t = 0;
|
|
1320
1374
|
const i = /* @__PURE__ */ new Map();
|
|
1321
1375
|
e.forEach((r) => {
|
|
@@ -1324,37 +1378,37 @@ const Yi = () => {
|
|
|
1324
1378
|
});
|
|
1325
1379
|
const s = [];
|
|
1326
1380
|
for (let r = 0; r < t; r++)
|
|
1327
|
-
i.get(r) ? s.push("auto") : s.push(`${
|
|
1381
|
+
i.get(r) ? s.push("auto") : s.push(`${u}px`);
|
|
1328
1382
|
return s;
|
|
1329
|
-
},
|
|
1383
|
+
}, ws = /* @__PURE__ */ Q({
|
|
1330
1384
|
__name: "GridLayout",
|
|
1331
1385
|
props: {
|
|
1332
1386
|
tileHeight: {
|
|
1333
1387
|
type: Number,
|
|
1334
1388
|
required: !1,
|
|
1335
|
-
default: () =>
|
|
1389
|
+
default: () => Ge
|
|
1336
1390
|
},
|
|
1337
1391
|
tiles: {
|
|
1338
1392
|
type: Array,
|
|
1339
1393
|
required: !0
|
|
1340
1394
|
}
|
|
1341
1395
|
},
|
|
1342
|
-
setup(
|
|
1343
|
-
|
|
1344
|
-
"2a38e79e":
|
|
1396
|
+
setup(u) {
|
|
1397
|
+
Ze((n) => ({
|
|
1398
|
+
"2a38e79e": T(qt),
|
|
1345
1399
|
"4cc71de6": r.value
|
|
1346
1400
|
}));
|
|
1347
|
-
const e =
|
|
1401
|
+
const e = u, t = $(null), i = $(0), s = new ResizeObserver((n) => {
|
|
1348
1402
|
window.requestAnimationFrame(() => {
|
|
1349
1403
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1350
1404
|
});
|
|
1351
1405
|
});
|
|
1352
|
-
|
|
1406
|
+
Qe(() => {
|
|
1353
1407
|
t.value && s.observe(t.value);
|
|
1354
|
-
}),
|
|
1408
|
+
}), je(() => {
|
|
1355
1409
|
t.value && s.unobserve(t.value);
|
|
1356
1410
|
});
|
|
1357
|
-
const r =
|
|
1411
|
+
const r = N(() => bs(e.tileHeight, e.tiles).join(" ")), o = N(() => e.tiles.map((n, h) => ({
|
|
1358
1412
|
key: `tile-${h}`,
|
|
1359
1413
|
tile: n,
|
|
1360
1414
|
style: {
|
|
@@ -1364,31 +1418,31 @@ const Yi = () => {
|
|
|
1364
1418
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1365
1419
|
}
|
|
1366
1420
|
})));
|
|
1367
|
-
return (n, h) => (
|
|
1421
|
+
return (n, h) => (z(), W("div", {
|
|
1368
1422
|
ref_key: "gridContainer",
|
|
1369
1423
|
ref: t,
|
|
1370
1424
|
class: "kong-ui-public-grid-layout"
|
|
1371
1425
|
}, [
|
|
1372
|
-
(
|
|
1426
|
+
(z(!0), W(Lt, null, At(o.value, (l) => (z(), W("div", {
|
|
1373
1427
|
key: l.key,
|
|
1374
|
-
class:
|
|
1428
|
+
class: Je(["grid-cell", {
|
|
1375
1429
|
"empty-cell": !l.tile
|
|
1376
1430
|
}]),
|
|
1377
|
-
style:
|
|
1431
|
+
style: ft(l.style)
|
|
1378
1432
|
}, [
|
|
1379
|
-
|
|
1380
|
-
style:
|
|
1433
|
+
$e(n.$slots, "tile", {
|
|
1434
|
+
style: ft(l.style),
|
|
1381
1435
|
tile: l.tile
|
|
1382
1436
|
}, void 0, !0)
|
|
1383
1437
|
], 6))), 128))
|
|
1384
1438
|
], 512));
|
|
1385
1439
|
}
|
|
1386
|
-
}),
|
|
1387
|
-
function
|
|
1388
|
-
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(
|
|
1440
|
+
}), Es = /* @__PURE__ */ fe(ws, [["__scopeId", "data-v-354b7177"]]);
|
|
1441
|
+
function xs(u, e, t, i, s) {
|
|
1442
|
+
const r = (...o) => (console.warn("gridstack.js: Function `" + t + "` is deprecated in " + s + " and has been replaced with `" + i + "`. It will be **removed** in a future release"), e.apply(u, o));
|
|
1389
1443
|
return r.prototype = e.prototype, r;
|
|
1390
1444
|
}
|
|
1391
|
-
class
|
|
1445
|
+
class c {
|
|
1392
1446
|
/** convert a potential selector into actual list of html elements. optional root which defaults to document (for shadow dom) */
|
|
1393
1447
|
static getElements(e, t = document) {
|
|
1394
1448
|
if (typeof e == "string") {
|
|
@@ -1441,7 +1495,7 @@ class u {
|
|
|
1441
1495
|
}
|
|
1442
1496
|
/** returns true if a and b touch edges or corners */
|
|
1443
1497
|
static isTouching(e, t) {
|
|
1444
|
-
return
|
|
1498
|
+
return c.isIntercepted(e, { x: t.x - 0.5, y: t.y - 0.5, w: t.w + 1, h: t.h + 1 });
|
|
1445
1499
|
}
|
|
1446
1500
|
/** returns the area a and b overlap */
|
|
1447
1501
|
static areaIntercept(e, t) {
|
|
@@ -1550,7 +1604,7 @@ class u {
|
|
|
1550
1604
|
if (!(typeof e != "object" || typeof t != "object"))
|
|
1551
1605
|
for (let i in e) {
|
|
1552
1606
|
const s = e[i], r = t[i];
|
|
1553
|
-
i[0] === "_" || s === r ? delete e[i] : s && typeof s == "object" && r !== void 0 && (
|
|
1607
|
+
i[0] === "_" || s === r ? delete e[i] : s && typeof s == "object" && r !== void 0 && (c.removeInternalAndSame(s, r), Object.keys(s).length || delete e[i]);
|
|
1554
1608
|
}
|
|
1555
1609
|
}
|
|
1556
1610
|
/** removes internal fields '_' and default values for saving */
|
|
@@ -1618,9 +1672,9 @@ class u {
|
|
|
1618
1672
|
* Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
|
|
1619
1673
|
*/
|
|
1620
1674
|
static cloneDeep(e) {
|
|
1621
|
-
const t = ["parentGrid", "el", "grid", "subGrid", "engine"], i =
|
|
1675
|
+
const t = ["parentGrid", "el", "grid", "subGrid", "engine"], i = c.clone(e);
|
|
1622
1676
|
for (const s in i)
|
|
1623
|
-
i.hasOwnProperty(s) && typeof i[s] == "object" && s.substring(0, 2) !== "__" && !t.find((r) => r === s) && (i[s] =
|
|
1677
|
+
i.hasOwnProperty(s) && typeof i[s] == "object" && s.substring(0, 2) !== "__" && !t.find((r) => r === s) && (i[s] = c.cloneDeep(e[s]));
|
|
1624
1678
|
return i;
|
|
1625
1679
|
}
|
|
1626
1680
|
/** deep clone the given HTML node, removing teh unique id field */
|
|
@@ -1630,7 +1684,7 @@ class u {
|
|
|
1630
1684
|
}
|
|
1631
1685
|
static appendTo(e, t) {
|
|
1632
1686
|
let i;
|
|
1633
|
-
typeof t == "string" ? i =
|
|
1687
|
+
typeof t == "string" ? i = c.getElement(t) : i = t, i && i.appendChild(e);
|
|
1634
1688
|
}
|
|
1635
1689
|
// public static setPositionRelative(el: HTMLElement): void {
|
|
1636
1690
|
// if (!(/^(?:r|a|f)/).test(getComputedStyle(el).position)) {
|
|
@@ -1682,7 +1736,7 @@ class u {
|
|
|
1682
1736
|
*/
|
|
1683
1737
|
static getValuesFromTransformedElement(e) {
|
|
1684
1738
|
const t = document.createElement("div");
|
|
1685
|
-
|
|
1739
|
+
c.addElStyles(t, {
|
|
1686
1740
|
opacity: "0",
|
|
1687
1741
|
position: "fixed",
|
|
1688
1742
|
top: "0px",
|
|
@@ -1755,7 +1809,7 @@ class re {
|
|
|
1755
1809
|
(!this.collide(i, { ...i, y: e.y }, e) || !this.collide(i, { ...i, y: t.y - i.h }, e))) {
|
|
1756
1810
|
e._skipDown = e._skipDown || t.y > e.y;
|
|
1757
1811
|
const d = { ...t, y: i.y + i.h, ...n };
|
|
1758
|
-
l = this._loading &&
|
|
1812
|
+
l = this._loading && c.samePos(e, d) ? !0 : this.moveNode(e, d), (i.locked || this._loading) && l ? c.copyPos(t, e) : !i.locked && l && s.pack && (this._packNodes(), t.y = i.y + i.h, c.copyPos(e, t)), o = o || l;
|
|
1759
1813
|
} else
|
|
1760
1814
|
l = this.moveNode(i, { ...i, y: t.y + t.h, skip: e, ...n });
|
|
1761
1815
|
if (!l)
|
|
@@ -1767,11 +1821,11 @@ class re {
|
|
|
1767
1821
|
/** return the nodes that intercept the given node. Optionally a different area can be used, as well as a second node to skip */
|
|
1768
1822
|
collide(e, t = e, i) {
|
|
1769
1823
|
const s = e._id, r = i == null ? void 0 : i._id;
|
|
1770
|
-
return this.nodes.find((o) => o._id !== s && o._id !== r &&
|
|
1824
|
+
return this.nodes.find((o) => o._id !== s && o._id !== r && c.isIntercepted(o, t));
|
|
1771
1825
|
}
|
|
1772
1826
|
collideAll(e, t = e, i) {
|
|
1773
1827
|
const s = e._id, r = i == null ? void 0 : i._id;
|
|
1774
|
-
return this.nodes.filter((o) => o._id !== s && o._id !== r &&
|
|
1828
|
+
return this.nodes.filter((o) => o._id !== s && o._id !== r && c.isIntercepted(o, t));
|
|
1775
1829
|
}
|
|
1776
1830
|
/** does a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line */
|
|
1777
1831
|
directionCollideCoverage(e, t, i) {
|
|
@@ -1825,10 +1879,10 @@ class re {
|
|
|
1825
1879
|
return t.x = e.x, t.y = e.y, e.h != t.h ? (e.x = r, e.y = t.y + t.h) : e.w != t.w ? (e.x = t.x + t.w, e.y = o) : (e.x = r, e.y = o), e._dirty = t._dirty = !0, !0;
|
|
1826
1880
|
}
|
|
1827
1881
|
let s;
|
|
1828
|
-
if (e.w === t.w && e.h === t.h && (e.x === t.x || e.y === t.y) && (s =
|
|
1882
|
+
if (e.w === t.w && e.h === t.h && (e.x === t.x || e.y === t.y) && (s = c.isTouching(e, t)))
|
|
1829
1883
|
return i();
|
|
1830
1884
|
if (s !== !1) {
|
|
1831
|
-
if (e.w === t.w && e.x === t.x && (s || (s =
|
|
1885
|
+
if (e.w === t.w && e.x === t.x && (s || (s = c.isTouching(e, t)))) {
|
|
1832
1886
|
if (t.y < e.y) {
|
|
1833
1887
|
const r = e;
|
|
1834
1888
|
e = t, t = r;
|
|
@@ -1836,7 +1890,7 @@ class re {
|
|
|
1836
1890
|
return i();
|
|
1837
1891
|
}
|
|
1838
1892
|
if (s !== !1) {
|
|
1839
|
-
if (e.h === t.h && e.y === t.y && (s || (s =
|
|
1893
|
+
if (e.h === t.h && e.y === t.y && (s || (s = c.isTouching(e, t)))) {
|
|
1840
1894
|
if (t.x < e.x) {
|
|
1841
1895
|
const r = e;
|
|
1842
1896
|
e = t, t = r;
|
|
@@ -1876,7 +1930,7 @@ class re {
|
|
|
1876
1930
|
}
|
|
1877
1931
|
/** sort the nodes array from first to last, or reverse. Called during collision/placement to force an order */
|
|
1878
1932
|
sortNodes(e = 1) {
|
|
1879
|
-
return this.nodes =
|
|
1933
|
+
return this.nodes = c.sort(this.nodes, e), this;
|
|
1880
1934
|
}
|
|
1881
1935
|
/** @internal called to top gravity pack the items back OR revert back to original Y positions when floating */
|
|
1882
1936
|
_packNodes() {
|
|
@@ -1911,20 +1965,20 @@ class re {
|
|
|
1911
1965
|
}
|
|
1912
1966
|
(e.x === void 0 || e.y === void 0 || e.x === null || e.y === null) && (e.autoPosition = !0);
|
|
1913
1967
|
const s = { x: 0, y: 0, w: 1, h: 1 };
|
|
1914
|
-
return
|
|
1968
|
+
return c.defaults(e, s), e.autoPosition || delete e.autoPosition, e.noResize || delete e.noResize, e.noMove || delete e.noMove, c.sanitizeMinMax(e), typeof e.x == "string" && (e.x = Number(e.x)), typeof e.y == "string" && (e.y = Number(e.y)), typeof e.w == "string" && (e.w = Number(e.w)), typeof e.h == "string" && (e.h = Number(e.h)), isNaN(e.x) && (e.x = s.x, e.autoPosition = !0), isNaN(e.y) && (e.y = s.y, e.autoPosition = !0), isNaN(e.w) && (e.w = s.w), isNaN(e.h) && (e.h = s.h), this.nodeBoundFix(e, t), e;
|
|
1915
1969
|
}
|
|
1916
1970
|
/** part2 of preparing a node to fit inside our grid - checks for x,y,w from grid dimensions */
|
|
1917
1971
|
nodeBoundFix(e, t) {
|
|
1918
|
-
const i = e._orig ||
|
|
1972
|
+
const i = e._orig || c.copyPos({}, e);
|
|
1919
1973
|
if (e.maxW && (e.w = Math.min(e.w || 1, e.maxW)), e.maxH && (e.h = Math.min(e.h || 1, e.maxH)), e.minW && (e.w = Math.max(e.w || 1, e.minW)), e.minH && (e.h = Math.max(e.h || 1, e.minH)), (e.x || 0) + (e.w || 1) > this.column && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && e._id && this.findCacheLayout(e, this.defaultColumn) === -1) {
|
|
1920
1974
|
const r = { ...e };
|
|
1921
1975
|
r.autoPosition || r.x === void 0 ? (delete r.x, delete r.y) : r.x = Math.min(this.defaultColumn - 1, r.x), r.w = Math.min(this.defaultColumn, r.w || 1), this.cacheOneLayout(r, this.defaultColumn);
|
|
1922
1976
|
}
|
|
1923
|
-
return e.w > this.column ? e.w = this.column : e.w < 1 && (e.w = 1), this.maxRow && e.h > this.maxRow ? e.h = this.maxRow : e.h < 1 && (e.h = 1), e.x < 0 && (e.x = 0), e.y < 0 && (e.y = 0), e.x + e.w > this.column && (t ? e.w = this.column - e.x : e.x = this.column - e.w), this.maxRow && e.y + e.h > this.maxRow && (t ? e.h = this.maxRow - e.y : e.y = this.maxRow - e.h),
|
|
1977
|
+
return e.w > this.column ? e.w = this.column : e.w < 1 && (e.w = 1), this.maxRow && e.h > this.maxRow ? e.h = this.maxRow : e.h < 1 && (e.h = 1), e.x < 0 && (e.x = 0), e.y < 0 && (e.y = 0), e.x + e.w > this.column && (t ? e.w = this.column - e.x : e.x = this.column - e.w), this.maxRow && e.y + e.h > this.maxRow && (t ? e.h = this.maxRow - e.y : e.y = this.maxRow - e.h), c.samePos(e, i) || (e._dirty = !0), this;
|
|
1924
1978
|
}
|
|
1925
1979
|
/** returns a list of modified nodes from their original values */
|
|
1926
1980
|
getDirtyNodes(e) {
|
|
1927
|
-
return e ? this.nodes.filter((t) => t._dirty && !
|
|
1981
|
+
return e ? this.nodes.filter((t) => t._dirty && !c.samePos(t, t._orig)) : this.nodes.filter((t) => t._dirty);
|
|
1928
1982
|
}
|
|
1929
1983
|
/** @internal call this to call onChange callback with dirty nodes so DOM can be updated */
|
|
1930
1984
|
_notify(e) {
|
|
@@ -1944,13 +1998,13 @@ class re {
|
|
|
1944
1998
|
* as well as right before we start move/resize/enter (so we can restore items to prev values) */
|
|
1945
1999
|
saveInitial() {
|
|
1946
2000
|
return this.nodes.forEach((e) => {
|
|
1947
|
-
e._orig =
|
|
2001
|
+
e._orig = c.copyPos({}, e), delete e._dirty;
|
|
1948
2002
|
}), this._hasLocked = this.nodes.some((e) => e.locked), this;
|
|
1949
2003
|
}
|
|
1950
2004
|
/** @internal restore all the nodes back to initial values (called when we leave) */
|
|
1951
2005
|
restoreInitial() {
|
|
1952
2006
|
return this.nodes.forEach((e) => {
|
|
1953
|
-
!e._orig ||
|
|
2007
|
+
!e._orig || c.samePos(e, e._orig) || (c.copyPos(e, e._orig), e._dirty = !0);
|
|
1954
2008
|
}), this._notify(), this;
|
|
1955
2009
|
}
|
|
1956
2010
|
/** find the first available empty spot for the given node width/height, updating the x,y attributes. return true if found.
|
|
@@ -1965,7 +2019,7 @@ class re {
|
|
|
1965
2019
|
if (h + e.w > i)
|
|
1966
2020
|
continue;
|
|
1967
2021
|
const d = { x: h, y: l, w: e.w, h: e.h };
|
|
1968
|
-
t.find((a) =>
|
|
2022
|
+
t.find((a) => c.isIntercepted(d, a)) || ((e.x !== h || e.y !== l) && (e._dirty = !0), e.x = h, e.y = l, delete e.autoPosition, o = !0);
|
|
1969
2023
|
}
|
|
1970
2024
|
return o;
|
|
1971
2025
|
}
|
|
@@ -2012,7 +2066,7 @@ class re {
|
|
|
2012
2066
|
}
|
|
2013
2067
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
2014
2068
|
const n = this.nodes.find((h) => h._id === o._id);
|
|
2015
|
-
n && (
|
|
2069
|
+
n && (c.copyPos(n, o), n._dirty = !0);
|
|
2016
2070
|
}), this._notify(), !0) : !1;
|
|
2017
2071
|
}
|
|
2018
2072
|
/** return true if can fit in grid height constrain only (always true if no maxRow) */
|
|
@@ -2024,7 +2078,7 @@ class re {
|
|
|
2024
2078
|
float: this.float,
|
|
2025
2079
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
2026
2080
|
}), i = { ...e };
|
|
2027
|
-
return this.cleanupNode(i), delete i.el, delete i._id, delete i.content, delete i.grid, t.addNode(i), t.getRow() <= this.maxRow ? (e._willFitPos =
|
|
2081
|
+
return this.cleanupNode(i), delete i.el, delete i._id, delete i.content, delete i.grid, t.addNode(i), t.getRow() <= this.maxRow ? (e._willFitPos = c.copyPos({}, i), !0) : !1;
|
|
2028
2082
|
}
|
|
2029
2083
|
/** true if x,y or w,h are different after clamping to min/max */
|
|
2030
2084
|
changedPosConstrain(e, t) {
|
|
@@ -2038,21 +2092,21 @@ class re {
|
|
|
2038
2092
|
return !1;
|
|
2039
2093
|
let i;
|
|
2040
2094
|
t.pack === void 0 && !this.batchMode && (i = t.pack = !0), typeof t.x != "number" && (t.x = e.x), typeof t.y != "number" && (t.y = e.y), typeof t.w != "number" && (t.w = e.w), typeof t.h != "number" && (t.h = e.h);
|
|
2041
|
-
const s = e.w !== t.w || e.h !== t.h, r =
|
|
2042
|
-
if (
|
|
2095
|
+
const s = e.w !== t.w || e.h !== t.h, r = c.copyPos({}, e, !0);
|
|
2096
|
+
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
2043
2097
|
return !1;
|
|
2044
|
-
const o =
|
|
2098
|
+
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
2045
2099
|
let h = !0;
|
|
2046
2100
|
if (n.length) {
|
|
2047
2101
|
const a = e._moving && !t.nested;
|
|
2048
2102
|
let f = a ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
2049
2103
|
if (a && f && ((d = (l = e.grid) == null ? void 0 : l.opts) != null && d.subGridDynamic) && !e.grid._isTemp) {
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2104
|
+
const p = c.areaIntercept(t.rect, f._rect), g = c.area(t.rect), y = c.area(f._rect);
|
|
2105
|
+
p / (g < y ? g : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
2052
2106
|
}
|
|
2053
2107
|
f ? h = !this._fixCollisions(e, r, f, t) : (h = !1, i && delete t.pack);
|
|
2054
2108
|
}
|
|
2055
|
-
return h && !
|
|
2109
|
+
return h && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
2056
2110
|
}
|
|
2057
2111
|
getRow() {
|
|
2058
2112
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -2071,7 +2125,7 @@ class re {
|
|
|
2071
2125
|
const i = (o = this._layouts) == null ? void 0 : o.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
2072
2126
|
return this.sortNodes(), this.nodes.forEach((n) => {
|
|
2073
2127
|
const h = s == null ? void 0 : s.find((d) => d._id === n._id), l = { ...n, ...h || {} };
|
|
2074
|
-
|
|
2128
|
+
c.removeInternalForSave(l, !e), t && t(n, l), r.push(l);
|
|
2075
2129
|
}), r;
|
|
2076
2130
|
}
|
|
2077
2131
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -2108,7 +2162,7 @@ class re {
|
|
|
2108
2162
|
return this;
|
|
2109
2163
|
const s = i === "compact" || i === "list";
|
|
2110
2164
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
2111
|
-
let r = [], o = s ? this.nodes :
|
|
2165
|
+
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
2112
2166
|
if (t > e && this._layouts) {
|
|
2113
2167
|
const h = this._layouts[t] || [], l = this._layouts.length - 1;
|
|
2114
2168
|
!h.length && e !== l && ((n = this._layouts[l]) != null && n.length) && (e = l, this._layouts[l].forEach((d) => {
|
|
@@ -2138,7 +2192,7 @@ class re {
|
|
|
2138
2192
|
a.x = t === 1 ? 0 : l ? Math.round(a.x * h) : Math.min(a.x, t - 1), a.w = t === 1 || e === 1 ? 1 : d ? Math.round(a.w * h) || 1 : Math.min(a.w, t), r.push(a);
|
|
2139
2193
|
}), o = [];
|
|
2140
2194
|
}
|
|
2141
|
-
r =
|
|
2195
|
+
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((h) => {
|
|
2142
2196
|
this.addNode(h, !1), delete h._orig;
|
|
2143
2197
|
});
|
|
2144
2198
|
}
|
|
@@ -2191,7 +2245,7 @@ class re {
|
|
|
2191
2245
|
}
|
|
2192
2246
|
}
|
|
2193
2247
|
re._idSeq = 0;
|
|
2194
|
-
const
|
|
2248
|
+
const V = {
|
|
2195
2249
|
alwaysShowResizeHandle: "mobile",
|
|
2196
2250
|
animate: !0,
|
|
2197
2251
|
auto: !0,
|
|
@@ -2221,57 +2275,57 @@ const j = {
|
|
|
2221
2275
|
// styleInHead: false,
|
|
2222
2276
|
//removable
|
|
2223
2277
|
};
|
|
2224
|
-
class
|
|
2278
|
+
class x {
|
|
2225
2279
|
}
|
|
2226
2280
|
const ie = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2227
2281
|
class ne {
|
|
2228
2282
|
}
|
|
2229
|
-
function Oe(
|
|
2230
|
-
|
|
2283
|
+
function Oe(u, e) {
|
|
2284
|
+
u.touches.length > 1 || (u.cancelable && u.preventDefault(), c.simulateMouseEvent(u.changedTouches[0], e));
|
|
2231
2285
|
}
|
|
2232
|
-
function
|
|
2233
|
-
|
|
2286
|
+
function Yt(u, e) {
|
|
2287
|
+
u.cancelable && u.preventDefault(), c.simulateMouseEvent(u, e);
|
|
2234
2288
|
}
|
|
2235
|
-
function He(
|
|
2236
|
-
ne.touchHandled || (ne.touchHandled = !0, Oe(
|
|
2289
|
+
function He(u) {
|
|
2290
|
+
ne.touchHandled || (ne.touchHandled = !0, Oe(u, "mousedown"));
|
|
2237
2291
|
}
|
|
2238
|
-
function
|
|
2239
|
-
ne.touchHandled && Oe(
|
|
2292
|
+
function Me(u) {
|
|
2293
|
+
ne.touchHandled && Oe(u, "mousemove");
|
|
2240
2294
|
}
|
|
2241
|
-
function
|
|
2295
|
+
function Ie(u) {
|
|
2242
2296
|
if (!ne.touchHandled)
|
|
2243
2297
|
return;
|
|
2244
2298
|
ne.pointerLeaveTimeout && (window.clearTimeout(ne.pointerLeaveTimeout), delete ne.pointerLeaveTimeout);
|
|
2245
|
-
const e = !!
|
|
2246
|
-
Oe(
|
|
2299
|
+
const e = !!x.dragElement;
|
|
2300
|
+
Oe(u, "mouseup"), e || Oe(u, "click"), ne.touchHandled = !1;
|
|
2247
2301
|
}
|
|
2248
|
-
function
|
|
2249
|
-
|
|
2302
|
+
function qe(u) {
|
|
2303
|
+
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
2250
2304
|
}
|
|
2251
|
-
function
|
|
2252
|
-
|
|
2305
|
+
function Rt(u) {
|
|
2306
|
+
x.dragElement && u.pointerType !== "mouse" && Yt(u, "mouseenter");
|
|
2253
2307
|
}
|
|
2254
|
-
function
|
|
2255
|
-
|
|
2256
|
-
delete ne.pointerLeaveTimeout,
|
|
2308
|
+
function kt(u) {
|
|
2309
|
+
x.dragElement && u.pointerType !== "mouse" && (ne.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2310
|
+
delete ne.pointerLeaveTimeout, Yt(u, "mouseleave");
|
|
2257
2311
|
}, 10));
|
|
2258
2312
|
}
|
|
2259
|
-
class
|
|
2313
|
+
class Ue {
|
|
2260
2314
|
constructor(e, t, i) {
|
|
2261
2315
|
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();
|
|
2262
2316
|
}
|
|
2263
2317
|
/** @internal */
|
|
2264
2318
|
_init() {
|
|
2265
2319
|
const e = this.el = document.createElement("div");
|
|
2266
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${
|
|
2320
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Ue.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), ie && (this.el.addEventListener("touchstart", He), this.el.addEventListener("pointerdown", qe)), this;
|
|
2267
2321
|
}
|
|
2268
2322
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2269
2323
|
destroy() {
|
|
2270
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), ie && (this.el.removeEventListener("touchstart", He), this.el.removeEventListener("pointerdown",
|
|
2324
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), ie && (this.el.removeEventListener("touchstart", He), this.el.removeEventListener("pointerdown", qe)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2271
2325
|
}
|
|
2272
2326
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2273
2327
|
_mouseDown(e) {
|
|
2274
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (this.el.addEventListener("touchmove",
|
|
2328
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (this.el.addEventListener("touchmove", Me), this.el.addEventListener("touchend", Ie)), e.stopPropagation(), e.preventDefault();
|
|
2275
2329
|
}
|
|
2276
2330
|
/** @internal */
|
|
2277
2331
|
_mouseMove(e) {
|
|
@@ -2280,7 +2334,7 @@ class Be {
|
|
|
2280
2334
|
}
|
|
2281
2335
|
/** @internal */
|
|
2282
2336
|
_mouseUp(e) {
|
|
2283
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && (this.el.removeEventListener("touchmove",
|
|
2337
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && (this.el.removeEventListener("touchmove", Me), this.el.removeEventListener("touchend", Ie)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2284
2338
|
}
|
|
2285
2339
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2286
2340
|
_keyEvent(e) {
|
|
@@ -2292,8 +2346,8 @@ class Be {
|
|
|
2292
2346
|
return this.option[e] && this.option[e](t), this;
|
|
2293
2347
|
}
|
|
2294
2348
|
}
|
|
2295
|
-
|
|
2296
|
-
class
|
|
2349
|
+
Ue.prefix = "ui-resizable-";
|
|
2350
|
+
class st {
|
|
2297
2351
|
constructor() {
|
|
2298
2352
|
this._eventRegister = {};
|
|
2299
2353
|
}
|
|
@@ -2321,7 +2375,7 @@ class Je {
|
|
|
2321
2375
|
return this._eventRegister[e](t);
|
|
2322
2376
|
}
|
|
2323
2377
|
}
|
|
2324
|
-
class xe extends
|
|
2378
|
+
class xe extends st {
|
|
2325
2379
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2326
2380
|
constructor(e, t = {}) {
|
|
2327
2381
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2377,21 +2431,21 @@ class xe extends Je {
|
|
|
2377
2431
|
}
|
|
2378
2432
|
/** @internal turns auto hide on/off */
|
|
2379
2433
|
_setupAutoHide(e) {
|
|
2380
|
-
return e ? (this.el.classList.add("ui-resizable-autohide"), this.el.addEventListener("mouseover", this._mouseOver), this.el.addEventListener("mouseout", this._mouseOut)) : (this.el.classList.remove("ui-resizable-autohide"), this.el.removeEventListener("mouseover", this._mouseOver), this.el.removeEventListener("mouseout", this._mouseOut),
|
|
2434
|
+
return e ? (this.el.classList.add("ui-resizable-autohide"), this.el.addEventListener("mouseover", this._mouseOver), this.el.addEventListener("mouseout", this._mouseOut)) : (this.el.classList.remove("ui-resizable-autohide"), this.el.removeEventListener("mouseover", this._mouseOver), this.el.removeEventListener("mouseout", this._mouseOut), x.overResizeElement === this && delete x.overResizeElement), this;
|
|
2381
2435
|
}
|
|
2382
2436
|
/** @internal */
|
|
2383
2437
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2384
2438
|
_mouseOver(e) {
|
|
2385
|
-
|
|
2439
|
+
x.overResizeElement || x.dragElement || (x.overResizeElement = this, this.el.classList.remove("ui-resizable-autohide"));
|
|
2386
2440
|
}
|
|
2387
2441
|
/** @internal */
|
|
2388
2442
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2389
2443
|
_mouseOut(e) {
|
|
2390
|
-
|
|
2444
|
+
x.overResizeElement === this && (delete x.overResizeElement, this.el.classList.add("ui-resizable-autohide"));
|
|
2391
2445
|
}
|
|
2392
2446
|
/** @internal */
|
|
2393
2447
|
_setupHandlers() {
|
|
2394
|
-
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new
|
|
2448
|
+
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new Ue(this.el, e, {
|
|
2395
2449
|
start: (t) => {
|
|
2396
2450
|
this._resizeStart(t);
|
|
2397
2451
|
},
|
|
@@ -2405,25 +2459,25 @@ class xe extends Je {
|
|
|
2405
2459
|
}
|
|
2406
2460
|
/** @internal */
|
|
2407
2461
|
_resizeStart(e) {
|
|
2408
|
-
this.sizeToContent =
|
|
2409
|
-
const t =
|
|
2462
|
+
this.sizeToContent = c.shouldSizeToContent(this.el.gridstackNode, !0), this.originalRect = this.el.getBoundingClientRect(), this.scrollEl = c.getScrollElement(this.el), this.scrollY = this.scrollEl.scrollTop, this.scrolled = 0, this.startEvent = e, this._setupHelper(), this._applyChange();
|
|
2463
|
+
const t = c.initEvent(e, { type: "resizestart", target: this.el });
|
|
2410
2464
|
return this.option.start && this.option.start(t, this._ui()), this.el.classList.add("ui-resizable-resizing"), this.triggerEvent("resizestart", t), this;
|
|
2411
2465
|
}
|
|
2412
2466
|
/** @internal */
|
|
2413
2467
|
_resizing(e, t) {
|
|
2414
2468
|
this.scrolled = this.scrollEl.scrollTop - this.scrollY, this.temporalRect = this._getChange(e, t), this._applyChange();
|
|
2415
|
-
const i =
|
|
2469
|
+
const i = c.initEvent(e, { type: "resize", target: this.el });
|
|
2416
2470
|
return this.option.resize && this.option.resize(i, this._ui()), this.triggerEvent("resize", i), this;
|
|
2417
2471
|
}
|
|
2418
2472
|
/** @internal */
|
|
2419
2473
|
_resizeStop(e) {
|
|
2420
|
-
const t =
|
|
2474
|
+
const t = c.initEvent(e, { type: "resizestop", target: this.el });
|
|
2421
2475
|
return this.option.stop && this.option.stop(t), this.el.classList.remove("ui-resizable-resizing"), this.triggerEvent("resizestop", t), this._cleanHelper(), delete this.startEvent, delete this.originalRect, delete this.temporalRect, delete this.scrollY, delete this.scrolled, this;
|
|
2422
2476
|
}
|
|
2423
2477
|
/** @internal */
|
|
2424
2478
|
_setupHelper() {
|
|
2425
2479
|
this.elOriginStyleVal = xe._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2426
|
-
const e = this.el.parentElement, t =
|
|
2480
|
+
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2427
2481
|
return this.rectScale = {
|
|
2428
2482
|
x: t.xScale,
|
|
2429
2483
|
y: t.yScale
|
|
@@ -2471,8 +2525,8 @@ class xe extends Je {
|
|
|
2471
2525
|
}
|
|
2472
2526
|
}
|
|
2473
2527
|
xe._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2474
|
-
const
|
|
2475
|
-
class Ce extends
|
|
2528
|
+
const Cs = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2529
|
+
class Ce extends st {
|
|
2476
2530
|
constructor(e, t = {}) {
|
|
2477
2531
|
var r;
|
|
2478
2532
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2492,12 +2546,12 @@ class Ce extends Je {
|
|
|
2492
2546
|
}
|
|
2493
2547
|
enable() {
|
|
2494
2548
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2495
|
-
e.addEventListener("mousedown", this._mouseDown), ie && (e.addEventListener("touchstart", He), e.addEventListener("pointerdown",
|
|
2549
|
+
e.addEventListener("mousedown", this._mouseDown), ie && (e.addEventListener("touchstart", He), e.addEventListener("pointerdown", qe));
|
|
2496
2550
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2497
2551
|
}
|
|
2498
2552
|
disable(e = !1) {
|
|
2499
2553
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2500
|
-
t.removeEventListener("mousedown", this._mouseDown), ie && (t.removeEventListener("touchstart", He), t.removeEventListener("pointerdown",
|
|
2554
|
+
t.removeEventListener("mousedown", this._mouseDown), ie && (t.removeEventListener("touchstart", He), t.removeEventListener("pointerdown", qe));
|
|
2501
2555
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2502
2556
|
}
|
|
2503
2557
|
destroy() {
|
|
@@ -2508,14 +2562,14 @@ class Ce extends Je {
|
|
|
2508
2562
|
}
|
|
2509
2563
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2510
2564
|
_mouseDown(e) {
|
|
2511
|
-
if (!
|
|
2512
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
2565
|
+
if (!x.mouseHandled)
|
|
2566
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Cs) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete x.dragElement, delete x.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), ie && (e.currentTarget.addEventListener("touchmove", Me), e.currentTarget.addEventListener("touchend", Ie)), e.preventDefault(), document.activeElement && document.activeElement.blur(), x.mouseHandled = !0), !0;
|
|
2513
2567
|
}
|
|
2514
2568
|
/** @internal method to call actual drag event */
|
|
2515
2569
|
_callDrag(e) {
|
|
2516
2570
|
if (!this.dragging)
|
|
2517
2571
|
return;
|
|
2518
|
-
const t =
|
|
2572
|
+
const t = c.initEvent(e, { target: this.el, type: "drag" });
|
|
2519
2573
|
this.option.drag && this.option.drag(t, this.ui()), this.triggerEvent("drag", t);
|
|
2520
2574
|
}
|
|
2521
2575
|
/** @internal called when the main page (after successful mousedown) receives a move event to drag the item around the screen */
|
|
@@ -2523,16 +2577,16 @@ class Ce extends Je {
|
|
|
2523
2577
|
var i;
|
|
2524
2578
|
const t = this.mouseDownEvent;
|
|
2525
2579
|
if (this.lastDrag = e, this.dragging)
|
|
2526
|
-
if (this._dragFollow(e),
|
|
2527
|
-
const s = Number.isInteger(
|
|
2580
|
+
if (this._dragFollow(e), x.pauseDrag) {
|
|
2581
|
+
const s = Number.isInteger(x.pauseDrag) ? x.pauseDrag : 100;
|
|
2528
2582
|
this.dragTimeout && window.clearTimeout(this.dragTimeout), this.dragTimeout = window.setTimeout(() => this._callDrag(e), s);
|
|
2529
2583
|
} else
|
|
2530
2584
|
this._callDrag(e);
|
|
2531
2585
|
else if (Math.abs(e.x - t.x) + Math.abs(e.y - t.y) > 3) {
|
|
2532
|
-
this.dragging = !0,
|
|
2586
|
+
this.dragging = !0, x.dragElement = this;
|
|
2533
2587
|
const s = (i = this.el.gridstackNode) == null ? void 0 : i.grid;
|
|
2534
|
-
s ?
|
|
2535
|
-
const r =
|
|
2588
|
+
s ? x.dropElement = s.el.ddElement.ddDroppable : delete x.dropElement, this.helper = this._createHelper(), this._setupHelperContainmentStyle(), this.dragTransform = c.getValuesFromTransformedElement(this.helperContainment), this.dragOffset = this._getDragOffset(e, this.el, this.helperContainment), this._setupHelperStyle(e);
|
|
2589
|
+
const r = c.initEvent(e, { target: this.el, type: "dragstart" });
|
|
2536
2590
|
this.option.start && this.option.start(r, this.ui()), this.triggerEvent("dragstart", r), document.addEventListener("keydown", this._keyEvent);
|
|
2537
2591
|
}
|
|
2538
2592
|
return !0;
|
|
@@ -2540,29 +2594,29 @@ class Ce extends Je {
|
|
|
2540
2594
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2541
2595
|
_mouseUp(e) {
|
|
2542
2596
|
var t, i;
|
|
2543
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && e.currentTarget && (e.currentTarget.removeEventListener("touchmove",
|
|
2544
|
-
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i =
|
|
2545
|
-
const s =
|
|
2546
|
-
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s),
|
|
2597
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), ie && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", Me, !0), e.currentTarget.removeEventListener("touchend", Ie, !0)), this.dragging) {
|
|
2598
|
+
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i = x.dropElement) == null ? void 0 : i.el) === this.el.parentElement && delete x.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
2599
|
+
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2600
|
+
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), x.dropElement && x.dropElement.drop(e);
|
|
2547
2601
|
}
|
|
2548
|
-
delete this.helper, delete this.mouseDownEvent, delete
|
|
2602
|
+
delete this.helper, delete this.mouseDownEvent, delete x.dragElement, delete x.dropElement, delete x.mouseHandled, e.preventDefault();
|
|
2549
2603
|
}
|
|
2550
2604
|
/** @internal call when keys are being pressed - use Esc to cancel, R to rotate */
|
|
2551
2605
|
_keyEvent(e) {
|
|
2552
2606
|
var s, r;
|
|
2553
|
-
const t = this.el.gridstackNode, i = (t == null ? void 0 : t.grid) || ((r = (s =
|
|
2607
|
+
const t = this.el.gridstackNode, i = (t == null ? void 0 : t.grid) || ((r = (s = x.dropElement) == null ? void 0 : s.el) == null ? void 0 : r.gridstack);
|
|
2554
2608
|
if (e.key === "Escape")
|
|
2555
2609
|
t && t._origRotate && (t._orig = t._origRotate, delete t._origRotate), i == null || i.cancelDrag(), this._mouseUp(this.mouseDownEvent);
|
|
2556
2610
|
else if (t && i && (e.key === "r" || e.key === "R")) {
|
|
2557
|
-
if (!
|
|
2611
|
+
if (!c.canBeRotated(t))
|
|
2558
2612
|
return;
|
|
2559
|
-
t._origRotate = t._origRotate || { ...t._orig }, delete t._moving, i.setAnimation(!1).rotate(t.el, { top: -this.dragOffset.offsetTop, left: -this.dragOffset.offsetLeft }).setAnimation(), t._moving = !0, this.dragOffset = this._getDragOffset(this.lastDrag, t.el, this.helperContainment), this.helper.style.width = this.dragOffset.width + "px", this.helper.style.height = this.dragOffset.height + "px",
|
|
2613
|
+
t._origRotate = t._origRotate || { ...t._orig }, delete t._moving, i.setAnimation(!1).rotate(t.el, { top: -this.dragOffset.offsetTop, left: -this.dragOffset.offsetLeft }).setAnimation(), t._moving = !0, this.dragOffset = this._getDragOffset(this.lastDrag, t.el, this.helperContainment), this.helper.style.width = this.dragOffset.width + "px", this.helper.style.height = this.dragOffset.height + "px", c.swap(t._orig, "w", "h"), delete t._rect, this._mouseMove(this.lastDrag);
|
|
2560
2614
|
}
|
|
2561
2615
|
}
|
|
2562
2616
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
2563
2617
|
_createHelper() {
|
|
2564
2618
|
let e = this.el;
|
|
2565
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e =
|
|
2619
|
+
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 = Ce.originStyleProp.map((t) => this.el.style[t]), e;
|
|
2566
2620
|
}
|
|
2567
2621
|
/** @internal set the fix position of the dragged item */
|
|
2568
2622
|
_setupHelperStyle(e) {
|
|
@@ -2622,7 +2676,7 @@ class Ce extends Je {
|
|
|
2622
2676
|
}
|
|
2623
2677
|
}
|
|
2624
2678
|
Ce.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2625
|
-
class
|
|
2679
|
+
class Rs extends st {
|
|
2626
2680
|
constructor(e, t = {}) {
|
|
2627
2681
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2628
2682
|
}
|
|
@@ -2633,10 +2687,10 @@ class bs extends Je {
|
|
|
2633
2687
|
super.off(e);
|
|
2634
2688
|
}
|
|
2635
2689
|
enable() {
|
|
2636
|
-
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave), ie && (this.el.addEventListener("pointerenter",
|
|
2690
|
+
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave), ie && (this.el.addEventListener("pointerenter", Rt), this.el.addEventListener("pointerleave", kt)));
|
|
2637
2691
|
}
|
|
2638
2692
|
disable(e = !1) {
|
|
2639
|
-
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave), ie && (this.el.removeEventListener("pointerenter",
|
|
2693
|
+
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave), ie && (this.el.removeEventListener("pointerenter", Rt), this.el.removeEventListener("pointerleave", kt)));
|
|
2640
2694
|
}
|
|
2641
2695
|
destroy() {
|
|
2642
2696
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2646,20 +2700,20 @@ class bs extends Je {
|
|
|
2646
2700
|
}
|
|
2647
2701
|
/** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */
|
|
2648
2702
|
_mouseEnter(e) {
|
|
2649
|
-
if (!
|
|
2703
|
+
if (!x.dragElement || !this._canDrop(x.dragElement.el))
|
|
2650
2704
|
return;
|
|
2651
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2652
|
-
const t =
|
|
2653
|
-
this.option.over && this.option.over(t, this._ui(
|
|
2705
|
+
e.preventDefault(), e.stopPropagation(), x.dropElement && x.dropElement !== this && x.dropElement._mouseLeave(e, !0), x.dropElement = this;
|
|
2706
|
+
const t = c.initEvent(e, { target: this.el, type: "dropover" });
|
|
2707
|
+
this.option.over && this.option.over(t, this._ui(x.dragElement)), this.triggerEvent("dropover", t), this.el.classList.add("ui-droppable-over");
|
|
2654
2708
|
}
|
|
2655
2709
|
/** @internal called when the item is leaving our area, stop tracking if we had moving item */
|
|
2656
2710
|
_mouseLeave(e, t = !1) {
|
|
2657
2711
|
var s;
|
|
2658
|
-
if (!
|
|
2712
|
+
if (!x.dragElement || x.dropElement !== this)
|
|
2659
2713
|
return;
|
|
2660
2714
|
e.preventDefault(), e.stopPropagation();
|
|
2661
|
-
const i =
|
|
2662
|
-
if (this.option.out && this.option.out(i, this._ui(
|
|
2715
|
+
const i = c.initEvent(e, { target: this.el, type: "dropout" });
|
|
2716
|
+
if (this.option.out && this.option.out(i, this._ui(x.dragElement)), this.triggerEvent("dropout", i), x.dropElement === this && (delete x.dropElement, !t)) {
|
|
2663
2717
|
let r, o = this.el.parentElement;
|
|
2664
2718
|
for (; !r && o; )
|
|
2665
2719
|
r = (s = o.ddElement) == null ? void 0 : s.ddDroppable, o = o.parentElement;
|
|
@@ -2669,8 +2723,8 @@ class bs extends Je {
|
|
|
2669
2723
|
/** item is being dropped on us - called by the drag mouseup handler - this calls the client drop event */
|
|
2670
2724
|
drop(e) {
|
|
2671
2725
|
e.preventDefault();
|
|
2672
|
-
const t =
|
|
2673
|
-
this.option.drop && this.option.drop(t, this._ui(
|
|
2726
|
+
const t = c.initEvent(e, { target: this.el, type: "drop" });
|
|
2727
|
+
this.option.drop && this.option.drop(t, this._ui(x.dragElement)), this.triggerEvent("drop", t);
|
|
2674
2728
|
}
|
|
2675
2729
|
/** @internal true if element matches the string/method accept option */
|
|
2676
2730
|
_canDrop(e) {
|
|
@@ -2688,9 +2742,9 @@ class bs extends Je {
|
|
|
2688
2742
|
};
|
|
2689
2743
|
}
|
|
2690
2744
|
}
|
|
2691
|
-
class
|
|
2745
|
+
class rt {
|
|
2692
2746
|
static init(e) {
|
|
2693
|
-
return e.ddElement || (e.ddElement = new
|
|
2747
|
+
return e.ddElement || (e.ddElement = new rt(e)), e.ddElement;
|
|
2694
2748
|
}
|
|
2695
2749
|
constructor(e) {
|
|
2696
2750
|
this.el = e;
|
|
@@ -2714,13 +2768,13 @@ class et {
|
|
|
2714
2768
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2715
2769
|
}
|
|
2716
2770
|
setupDroppable(e) {
|
|
2717
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2771
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Rs(this.el, e), this;
|
|
2718
2772
|
}
|
|
2719
2773
|
cleanDroppable() {
|
|
2720
2774
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2721
2775
|
}
|
|
2722
2776
|
}
|
|
2723
|
-
class
|
|
2777
|
+
class ks {
|
|
2724
2778
|
resizable(e, t, i, s) {
|
|
2725
2779
|
return this._getDDElements(e, t).forEach((r) => {
|
|
2726
2780
|
if (t === "disable" || t === "enable")
|
|
@@ -2790,7 +2844,7 @@ class ws {
|
|
|
2790
2844
|
}
|
|
2791
2845
|
on(e, t, i) {
|
|
2792
2846
|
return this._getDDElements(e).forEach((s) => s.on(t, (r) => {
|
|
2793
|
-
i(r,
|
|
2847
|
+
i(r, x.dragElement ? x.dragElement.el : r.target, x.dragElement ? x.dragElement.helper : null);
|
|
2794
2848
|
})), this;
|
|
2795
2849
|
}
|
|
2796
2850
|
off(e, t) {
|
|
@@ -2798,8 +2852,8 @@ class ws {
|
|
|
2798
2852
|
}
|
|
2799
2853
|
/** @internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable */
|
|
2800
2854
|
_getDDElements(e, t) {
|
|
2801
|
-
const i = e.gridstack || t !== "destroy" && t !== "disable", s =
|
|
2802
|
-
return s.length ? s.map((o) => o.ddElement || (i ?
|
|
2855
|
+
const i = e.gridstack || t !== "destroy" && t !== "disable", s = c.getElements(e);
|
|
2856
|
+
return s.length ? s.map((o) => o.ddElement || (i ? rt.init(o) : null)).filter((o) => o) : [];
|
|
2803
2857
|
}
|
|
2804
2858
|
}
|
|
2805
2859
|
/*!
|
|
@@ -2809,7 +2863,7 @@ class ws {
|
|
|
2809
2863
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2810
2864
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2811
2865
|
*/
|
|
2812
|
-
const
|
|
2866
|
+
const F = new ks();
|
|
2813
2867
|
class b {
|
|
2814
2868
|
/**
|
|
2815
2869
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2828,7 +2882,7 @@ class b {
|
|
|
2828
2882
|
if (typeof document > "u")
|
|
2829
2883
|
return null;
|
|
2830
2884
|
const i = b.getGridElement(t);
|
|
2831
|
-
return i ? (i.gridstack || (i.gridstack = new b(i,
|
|
2885
|
+
return i ? (i.gridstack || (i.gridstack = new b(i, c.cloneDeep(e))), i.gridstack) : (console.error(typeof t == "string" ? 'GridStack.initAll() no grid was found with selector "' + t + `" - element missing or wrong selector ?
|
|
2832
2886
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.` : "GridStack.init() no grid element was passed."), null);
|
|
2833
2887
|
}
|
|
2834
2888
|
/**
|
|
@@ -2843,7 +2897,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2843
2897
|
static initAll(e = {}, t = ".grid-stack") {
|
|
2844
2898
|
const i = [];
|
|
2845
2899
|
return typeof document > "u" || (b.getGridElements(t).forEach((s) => {
|
|
2846
|
-
s.gridstack || (s.gridstack = new b(s,
|
|
2900
|
+
s.gridstack || (s.gridstack = new b(s, c.cloneDeep(e))), i.push(s.gridstack);
|
|
2847
2901
|
}), i.length === 0 && console.error('GridStack.initAll() no grid was found with selector "' + t + `" - element missing or wrong selector ?
|
|
2848
2902
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)), i;
|
|
2849
2903
|
}
|
|
@@ -2862,7 +2916,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2862
2916
|
const o = i.gridstack;
|
|
2863
2917
|
return t && (o.opts = { ...o.opts, ...t }), t.children !== void 0 && o.load(t.children), o;
|
|
2864
2918
|
}
|
|
2865
|
-
return (!e.classList.contains("grid-stack") || b.addRemoveCB) && (b.addRemoveCB ? i = b.addRemoveCB(e, t, !0, !0) : i =
|
|
2919
|
+
return (!e.classList.contains("grid-stack") || b.addRemoveCB) && (b.addRemoveCB ? i = b.addRemoveCB(e, t, !0, !0) : i = c.createDiv(["grid-stack", t.class], e)), b.init(t, i);
|
|
2866
2920
|
}
|
|
2867
2921
|
/** call this method to register your engine instead of the default one.
|
|
2868
2922
|
* See instead `GridStackOptions.engineClass` if you only need to
|
|
@@ -2874,8 +2928,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2874
2928
|
/** @internal create placeholder DIV as needed */
|
|
2875
2929
|
get placeholder() {
|
|
2876
2930
|
if (!this._placeholder) {
|
|
2877
|
-
this._placeholder =
|
|
2878
|
-
const e =
|
|
2931
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, V.itemClass, this.opts.itemClass]);
|
|
2932
|
+
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2879
2933
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2880
2934
|
}
|
|
2881
2935
|
return this._placeholder;
|
|
@@ -2886,57 +2940,57 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2886
2940
|
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
2887
2941
|
*/
|
|
2888
2942
|
constructor(e, t = {}) {
|
|
2889
|
-
var a, f,
|
|
2943
|
+
var a, f, p;
|
|
2890
2944
|
this.el = e, this.opts = t, this.animationDelay = 310, this._gsEventHandler = {}, this._extraDragRow = 0, this.dragTransform = { xScale: 1, yScale: 1, xOffset: 0, yOffset: 0 }, e.gridstack = this, this.opts = t = t || {}, e.classList.contains("grid-stack") || this.el.classList.add("grid-stack"), t.row && (t.minRow = t.maxRow = t.row, delete t.row);
|
|
2891
|
-
const i =
|
|
2945
|
+
const i = c.toNumber(e.getAttribute("gs-row"));
|
|
2892
2946
|
t.column === "auto" && delete t.column, t.alwaysShowResizeHandle !== void 0 && (t._alwaysShowResizeHandle = t.alwaysShowResizeHandle);
|
|
2893
2947
|
let s = (a = t.columnOpts) == null ? void 0 : a.breakpoints;
|
|
2894
2948
|
const r = t;
|
|
2895
2949
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2896
2950
|
const g = r.oneColumnSize || 768;
|
|
2897
2951
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2898
|
-
let
|
|
2899
|
-
|
|
2952
|
+
let y = s.find((m) => m.c === 1);
|
|
2953
|
+
y ? y.w = g : (y = { c: 1, w: g }, s.push(y, { c: 12, w: g + 1 }));
|
|
2900
2954
|
}
|
|
2901
2955
|
const o = t.columnOpts;
|
|
2902
|
-
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,
|
|
2956
|
+
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((g, y) => (y.w || 0) - (g.w || 0));
|
|
2903
2957
|
const n = {
|
|
2904
|
-
...
|
|
2905
|
-
column:
|
|
2906
|
-
minRow: i ||
|
|
2907
|
-
maxRow: i ||
|
|
2908
|
-
staticGrid:
|
|
2909
|
-
sizeToContent:
|
|
2958
|
+
...c.cloneDeep(V),
|
|
2959
|
+
column: c.toNumber(e.getAttribute("gs-column")) || V.column,
|
|
2960
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || V.minRow,
|
|
2961
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || V.maxRow,
|
|
2962
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || V.staticGrid,
|
|
2963
|
+
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2910
2964
|
draggable: {
|
|
2911
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2965
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || V.draggable.handle
|
|
2912
2966
|
},
|
|
2913
2967
|
removableOptions: {
|
|
2914
|
-
accept: t.itemClass ||
|
|
2915
|
-
decline:
|
|
2968
|
+
accept: t.itemClass || V.removableOptions.accept,
|
|
2969
|
+
decline: V.removableOptions.decline
|
|
2916
2970
|
}
|
|
2917
2971
|
};
|
|
2918
|
-
e.getAttribute("gs-animate") && (n.animate =
|
|
2919
|
-
const h = this.el.closest("." +
|
|
2920
|
-
l && (l.subGrid = this, this.parentGridNode = l, this.el.classList.add("grid-stack-nested"), l.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !==
|
|
2972
|
+
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");
|
|
2973
|
+
const h = this.el.closest("." + V.itemClass), l = h == null ? void 0 : h.gridstackNode;
|
|
2974
|
+
l && (l.subGrid = this, this.parentGridNode = l, this.el.classList.add("grid-stack-nested"), l.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== V.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = ie), this._styleSheetClass = "gs-id-" + re._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2921
2975
|
const d = t.engineClass || b.engineClass || re;
|
|
2922
2976
|
if (this.engine = new d({
|
|
2923
2977
|
column: this.getColumn(),
|
|
2924
2978
|
float: t.float,
|
|
2925
2979
|
maxRow: t.maxRow,
|
|
2926
2980
|
onChange: (g) => {
|
|
2927
|
-
let
|
|
2928
|
-
this.engine.nodes.forEach((
|
|
2929
|
-
|
|
2930
|
-
}), g.forEach((
|
|
2931
|
-
const
|
|
2932
|
-
|
|
2933
|
-
}), this._updateStyles(!1,
|
|
2981
|
+
let y = 0;
|
|
2982
|
+
this.engine.nodes.forEach((m) => {
|
|
2983
|
+
y = Math.max(y, m.y + m.h);
|
|
2984
|
+
}), g.forEach((m) => {
|
|
2985
|
+
const k = m.el;
|
|
2986
|
+
k && (m._removeDOM ? (k && k.remove(), delete m._removeDOM) : this._writePosAttr(k, m));
|
|
2987
|
+
}), this._updateStyles(!1, y);
|
|
2934
2988
|
}
|
|
2935
2989
|
}), 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) {
|
|
2936
2990
|
const g = t.children;
|
|
2937
2991
|
delete t.children, g.length && this.load(g);
|
|
2938
2992
|
}
|
|
2939
|
-
this.setAnimation(), t.subGridDynamic && !
|
|
2993
|
+
this.setAnimation(), t.subGridDynamic && !x.pauseDrag && (x.pauseDrag = !0), ((p = t.draggable) == null ? void 0 : p.pause) !== void 0 && (x.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
2940
2994
|
}
|
|
2941
2995
|
/**
|
|
2942
2996
|
* add a new widget and returns it.
|
|
@@ -2964,12 +3018,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2964
3018
|
if (i = t.gridstackNode, i && t.parentElement === this.el && this.engine.nodes.find((r) => r._id === i._id))
|
|
2965
3019
|
return t;
|
|
2966
3020
|
const s = this._readAttr(t);
|
|
2967
|
-
return
|
|
3021
|
+
return c.defaults(e, s), this.engine.prepareNode(e), this.el.appendChild(t), this.makeWidget(t, e), t;
|
|
2968
3022
|
}
|
|
2969
3023
|
/** create the default grid item divs, and content (possibly lazy loaded) by using GridStack.renderCB() */
|
|
2970
3024
|
createWidgetDivs(e) {
|
|
2971
|
-
const t =
|
|
2972
|
-
return
|
|
3025
|
+
const t = c.createDiv(["grid-stack-item", this.opts.itemClass]), i = c.createDiv(["grid-stack-item-content"], t);
|
|
3026
|
+
return c.lazyLoad(e) ? e.visibleObservable || (e.visibleObservable = new IntersectionObserver(([s]) => {
|
|
2973
3027
|
var r, o;
|
|
2974
3028
|
s.isIntersecting && ((r = e.visibleObservable) == null || r.disconnect(), delete e.visibleObservable, b.renderCB(i, e), (o = e.grid) == null || o.prepareDragDrop(e.el));
|
|
2975
3029
|
}), window.setTimeout(() => {
|
|
@@ -2987,14 +3041,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2987
3041
|
* @returns newly created grid
|
|
2988
3042
|
*/
|
|
2989
3043
|
makeSubGrid(e, t, i, s = !0) {
|
|
2990
|
-
var
|
|
3044
|
+
var p, g, y;
|
|
2991
3045
|
let r = e.gridstackNode;
|
|
2992
|
-
if (r || (r = this.makeWidget(e).gridstackNode), (
|
|
3046
|
+
if (r || (r = this.makeWidget(e).gridstackNode), (p = r.subGrid) != null && p.el)
|
|
2993
3047
|
return r.subGrid;
|
|
2994
3048
|
let o, n = this;
|
|
2995
3049
|
for (; n && !o; )
|
|
2996
|
-
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (
|
|
2997
|
-
t =
|
|
3050
|
+
o = (g = n.opts) == null ? void 0 : g.subGridOpts, n = (y = n.parentGridNode) == null ? void 0 : y.grid;
|
|
3051
|
+
t = c.cloneDeep({
|
|
2998
3052
|
// by default sub-grid inherit from us | parent, other than id, children, etc...
|
|
2999
3053
|
...this.opts,
|
|
3000
3054
|
id: void 0,
|
|
@@ -3009,12 +3063,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3009
3063
|
let h;
|
|
3010
3064
|
t.column === "auto" && (h = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
3011
3065
|
let l = r.el.querySelector(".grid-stack-item-content"), d, a;
|
|
3012
|
-
if (s && (this._removeDD(r.el), a = { ...r, x: 0, y: 0 },
|
|
3013
|
-
const
|
|
3014
|
-
|
|
3066
|
+
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 ? d = b.addRemoveCB(this.el, a, !0, !1) : (d = c.createDiv(["grid-stack-item"]), d.appendChild(l), l = c.createDiv(["grid-stack-item-content"], r.el)), this.prepareDragDrop(r.el)), i) {
|
|
3067
|
+
const m = h ? t.column : r.w, k = r.h + i.h, w = r.el.style;
|
|
3068
|
+
w.transition = "none", this.update(r.el, { w: m, h: k }), setTimeout(() => w.transition = null);
|
|
3015
3069
|
}
|
|
3016
3070
|
const f = r.subGrid = b.addGrid(l, t);
|
|
3017
|
-
return i != null && i._moving && (f._isTemp = !0), h && (f._autoColumn = !0), s && f.makeWidget(d, a), i && (i._moving ? window.setTimeout(() =>
|
|
3071
|
+
return i != null && i._moving && (f._isTemp = !0), h && (f._autoColumn = !0), s && f.makeWidget(d, a), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
3018
3072
|
}
|
|
3019
3073
|
/**
|
|
3020
3074
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -3025,7 +3079,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3025
3079
|
const t = (i = this.parentGridNode) == null ? void 0 : i.grid;
|
|
3026
3080
|
t && (t.batchUpdate(), t.removeWidget(this.parentGridNode.el, !0, !0), this.engine.nodes.forEach((s) => {
|
|
3027
3081
|
s.x += this.parentGridNode.x, s.y += this.parentGridNode.y, t.makeWidget(s.el, s);
|
|
3028
|
-
}), t.batchUpdate(!1), this.parentGridNode && delete this.parentGridNode.subGrid, delete this.parentGridNode, e && window.setTimeout(() =>
|
|
3082
|
+
}), t.batchUpdate(!1), this.parentGridNode && delete this.parentGridNode.subGrid, delete this.parentGridNode, e && window.setTimeout(() => c.simulateMouseEvent(e._event, "mouseenter", t.el), 0));
|
|
3029
3083
|
}
|
|
3030
3084
|
/**
|
|
3031
3085
|
* saves the current layout returning a list of widgets for serialization which might include any nested grids.
|
|
@@ -3049,10 +3103,10 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3049
3103
|
}
|
|
3050
3104
|
delete r.el;
|
|
3051
3105
|
}), t) {
|
|
3052
|
-
const r =
|
|
3106
|
+
const r = c.cloneDeep(this.opts);
|
|
3053
3107
|
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");
|
|
3054
3108
|
const o = r._alwaysShowResizeHandle;
|
|
3055
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle,
|
|
3109
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, V), r.children = s, r;
|
|
3056
3110
|
}
|
|
3057
3111
|
return s;
|
|
3058
3112
|
}
|
|
@@ -3068,11 +3122,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3068
3122
|
*/
|
|
3069
3123
|
load(e, t = b.addRemoveCB || !0) {
|
|
3070
3124
|
var l;
|
|
3071
|
-
e =
|
|
3125
|
+
e = c.cloneDeep(e);
|
|
3072
3126
|
const i = this.getColumn();
|
|
3073
3127
|
e.forEach((d) => {
|
|
3074
3128
|
d.w = d.w || 1, d.h = d.h || 1;
|
|
3075
|
-
}), e =
|
|
3129
|
+
}), e = c.sort(e), this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = !0;
|
|
3076
3130
|
let s = 0;
|
|
3077
3131
|
e.forEach((d) => {
|
|
3078
3132
|
s = Math.max(s, (d.x || 0) + d.w);
|
|
@@ -3085,16 +3139,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3085
3139
|
n && this.setAnimation(!1), !n && t && [...this.engine.nodes].forEach((a) => {
|
|
3086
3140
|
if (!a.id)
|
|
3087
3141
|
return;
|
|
3088
|
-
|
|
3142
|
+
c.find(e, a.id) || (b.addRemoveCB && b.addRemoveCB(this.el, a, !1, !1), o.push(a), this.removeWidget(a.el, !0, !1));
|
|
3089
3143
|
}), this.engine._loading = !0;
|
|
3090
3144
|
const h = [];
|
|
3091
|
-
return this.engine.nodes = this.engine.nodes.filter((d) =>
|
|
3145
|
+
return this.engine.nodes = this.engine.nodes.filter((d) => c.find(e, d.id) ? (h.push(d), !1) : !0), e.forEach((d) => {
|
|
3092
3146
|
var f;
|
|
3093
|
-
const a =
|
|
3147
|
+
const a = c.find(h, d.id);
|
|
3094
3148
|
if (a) {
|
|
3095
|
-
if (
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3149
|
+
if (c.shouldSizeToContent(a) && (d.h = a.h), this.engine.nodeBoundFix(d), (d.autoPosition || d.x === void 0 || d.y === void 0) && (d.w = d.w || a.w, d.h = d.h || a.h, this.engine.findEmptyPosition(d)), this.engine.nodes.push(a), c.samePos(a, d) && this.engine.nodes.length > 1 && (this.moveNode(a, { ...d, forceCollide: !0 }), c.copyPos(d, a)), this.update(a.el, d), (f = d.subGridOpts) != null && f.children) {
|
|
3150
|
+
const p = a.el.querySelector(".grid-stack");
|
|
3151
|
+
p && p.gridstack && p.gridstack.load(d.subGridOpts.children);
|
|
3098
3152
|
}
|
|
3099
3153
|
} else t && this.addWidget(d);
|
|
3100
3154
|
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? b.addRemoveCB = r : delete b.addRemoveCB, n && ((l = this.opts) != null && l.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
@@ -3122,7 +3176,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3122
3176
|
return this.opts.cellHeight * (96 / 2.54) / 10;
|
|
3123
3177
|
const t = this.el.querySelector("." + this.opts.itemClass);
|
|
3124
3178
|
if (t) {
|
|
3125
|
-
const s =
|
|
3179
|
+
const s = c.toNumber(t.getAttribute("gs-h")) || 1;
|
|
3126
3180
|
return Math.round(t.offsetHeight / s);
|
|
3127
3181
|
}
|
|
3128
3182
|
const i = parseInt(this.el.getAttribute("gs-current-row"));
|
|
@@ -3147,7 +3201,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3147
3201
|
const s = -this.opts.marginRight - this.opts.marginLeft + this.opts.marginTop + this.opts.marginBottom;
|
|
3148
3202
|
e = this.cellWidth() + s;
|
|
3149
3203
|
}
|
|
3150
|
-
const i =
|
|
3204
|
+
const i = c.parseHeight(e);
|
|
3151
3205
|
return this.opts.cellHeightUnit === i.unit && this.opts.cellHeight === i.h ? this : (this.opts.cellHeightUnit = i.unit, this.opts.cellHeight = i.h, this.resizeToContentCheck(), t && this._updateStyles(!0), this);
|
|
3152
3206
|
}
|
|
3153
3207
|
/** Gets current cell width. */
|
|
@@ -3382,7 +3436,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3382
3436
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3383
3437
|
if (!s)
|
|
3384
3438
|
return;
|
|
3385
|
-
const r = { ...
|
|
3439
|
+
const r = { ...c.copyPos({}, s), ...c.cloneDeep(t) };
|
|
3386
3440
|
this.engine.nodeBoundFix(r), delete r.autoPosition;
|
|
3387
3441
|
const o = ["x", "y", "w", "h"];
|
|
3388
3442
|
let n;
|
|
@@ -3395,7 +3449,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3395
3449
|
let h = !1, l = !1;
|
|
3396
3450
|
for (const a in r)
|
|
3397
3451
|
a[0] !== "_" && s[a] !== r[a] && (s[a] = r[a], h = !0, l = l || !this.opts.staticGrid && (a === "noResize" || a === "noMove" || a === "locked"));
|
|
3398
|
-
if (
|
|
3452
|
+
if (c.sanitizeMinMax(s), n) {
|
|
3399
3453
|
const a = n.w !== void 0 && n.w !== s.w;
|
|
3400
3454
|
this.moveNode(s, n), a && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(a, s), delete s._orig;
|
|
3401
3455
|
}
|
|
@@ -3413,7 +3467,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3413
3467
|
* @param useNodeH set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
|
|
3414
3468
|
*/
|
|
3415
3469
|
resizeToContent(e) {
|
|
3416
|
-
var f,
|
|
3470
|
+
var f, p;
|
|
3417
3471
|
if (!e || (e.classList.remove("size-to-content-max"), !e.clientHeight))
|
|
3418
3472
|
return;
|
|
3419
3473
|
const t = e.gridstackNode;
|
|
@@ -3432,10 +3486,10 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3432
3486
|
let l;
|
|
3433
3487
|
if (t.subGrid) {
|
|
3434
3488
|
l = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3435
|
-
const g = t.subGrid.el.getBoundingClientRect(),
|
|
3436
|
-
l += g.top -
|
|
3489
|
+
const g = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3490
|
+
l += g.top - y.top;
|
|
3437
3491
|
} else {
|
|
3438
|
-
if ((
|
|
3492
|
+
if ((p = (f = t.subGridOpts) == null ? void 0 : f.children) != null && p.length)
|
|
3439
3493
|
return;
|
|
3440
3494
|
{
|
|
3441
3495
|
const g = o.firstElementChild;
|
|
@@ -3464,7 +3518,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3464
3518
|
rotate(e, t) {
|
|
3465
3519
|
return b.getElements(e).forEach((i) => {
|
|
3466
3520
|
const s = i.gridstackNode;
|
|
3467
|
-
if (!
|
|
3521
|
+
if (!c.canBeRotated(s))
|
|
3468
3522
|
return;
|
|
3469
3523
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3470
3524
|
if (t) {
|
|
@@ -3484,7 +3538,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3484
3538
|
*/
|
|
3485
3539
|
margin(e) {
|
|
3486
3540
|
if (!(typeof e == "string" && e.split(" ").length > 1)) {
|
|
3487
|
-
const i =
|
|
3541
|
+
const i = c.parseHeight(e);
|
|
3488
3542
|
if (this.opts.marginUnit === i.unit && this.opts.margin === i.h)
|
|
3489
3543
|
return;
|
|
3490
3544
|
}
|
|
@@ -3556,7 +3610,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3556
3610
|
_removeStylesheet() {
|
|
3557
3611
|
if (this._styles) {
|
|
3558
3612
|
const e = this.opts.styleInHead ? void 0 : this.el.parentNode;
|
|
3559
|
-
|
|
3613
|
+
c.removeStylesheet(this._styleSheetClass, e), delete this._styles;
|
|
3560
3614
|
}
|
|
3561
3615
|
return this;
|
|
3562
3616
|
}
|
|
@@ -3567,18 +3621,18 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3567
3621
|
const i = this.opts.cellHeight, s = this.opts.cellHeightUnit, r = `.${this._styleSheetClass} > .${this.opts.itemClass}`;
|
|
3568
3622
|
if (!this._styles) {
|
|
3569
3623
|
const o = this.opts.styleInHead ? void 0 : this.el.parentNode;
|
|
3570
|
-
if (this._styles =
|
|
3624
|
+
if (this._styles = c.createStylesheet(this._styleSheetClass, o, {
|
|
3571
3625
|
nonce: this.opts.nonce
|
|
3572
3626
|
}), !this._styles)
|
|
3573
3627
|
return this;
|
|
3574
|
-
this._styles._max = 0,
|
|
3628
|
+
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
3575
3629
|
const n = this.opts.marginTop + this.opts.marginUnit, h = this.opts.marginBottom + this.opts.marginUnit, l = this.opts.marginRight + this.opts.marginUnit, d = this.opts.marginLeft + this.opts.marginUnit, a = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
3576
|
-
|
|
3630
|
+
c.addCSSRule(this._styles, a, `top: ${n}; right: ${l}; bottom: ${h}; left: ${d};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${l}; bottom: ${h}; left: ${d};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${l}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${l}; bottom: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${d}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${d}; bottom: ${h}`);
|
|
3577
3631
|
}
|
|
3578
3632
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
3579
3633
|
const o = (n) => i * n + s;
|
|
3580
3634
|
for (let n = this._styles._max + 1; n <= t; n++)
|
|
3581
|
-
|
|
3635
|
+
c.addCSSRule(this._styles, `${r}[gs-y="${n}"]`, `top: ${o(n)}`), c.addCSSRule(this._styles, `${r}[gs-h="${n + 1}"]`, `height: ${o(n + 1)}`);
|
|
3582
3636
|
this._styles._max = t;
|
|
3583
3637
|
}
|
|
3584
3638
|
return this;
|
|
@@ -3593,19 +3647,19 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3593
3647
|
if (!i)
|
|
3594
3648
|
return this;
|
|
3595
3649
|
if (!e) {
|
|
3596
|
-
const r =
|
|
3650
|
+
const r = c.parseHeight(getComputedStyle(this.el).minHeight);
|
|
3597
3651
|
if (r.h > 0 && r.unit === s) {
|
|
3598
3652
|
const o = Math.floor(r.h / i);
|
|
3599
3653
|
t < o && (t = o);
|
|
3600
3654
|
}
|
|
3601
3655
|
}
|
|
3602
|
-
return this.el.setAttribute("gs-current-row", String(t)), this.el.style.removeProperty("min-height"), this.el.style.removeProperty("height"), t && (this.el.style[e ? "minHeight" : "height"] = t * i + s), e && !e.grid.engine.batchMode &&
|
|
3656
|
+
return this.el.setAttribute("gs-current-row", String(t)), this.el.style.removeProperty("min-height"), this.el.style.removeProperty("height"), t && (this.el.style[e ? "minHeight" : "height"] = t * i + s), e && !e.grid.engine.batchMode && c.shouldSizeToContent(e) && e.grid.resizeToContentCBCheck(e.el), this;
|
|
3603
3657
|
}
|
|
3604
3658
|
/** @internal */
|
|
3605
3659
|
_prepareElement(e, t = !1, i) {
|
|
3606
|
-
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(
|
|
3607
|
-
const s =
|
|
3608
|
-
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i),
|
|
3660
|
+
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(V.itemClass, this.opts.itemClass);
|
|
3661
|
+
const s = c.shouldSizeToContent(i);
|
|
3662
|
+
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;
|
|
3609
3663
|
}
|
|
3610
3664
|
/** @internal call to write position x,y,w,h attributes back to element */
|
|
3611
3665
|
_writePosAttr(e, t) {
|
|
@@ -3631,9 +3685,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3631
3685
|
/** @internal call to read any default attributes from element */
|
|
3632
3686
|
_readAttr(e, t = !0) {
|
|
3633
3687
|
const i = {};
|
|
3634
|
-
i.x =
|
|
3688
|
+
i.x = c.toNumber(e.getAttribute("gs-x")), i.y = c.toNumber(e.getAttribute("gs-y")), i.w = c.toNumber(e.getAttribute("gs-w")), i.h = c.toNumber(e.getAttribute("gs-h")), i.autoPosition = c.toBool(e.getAttribute("gs-auto-position")), i.noResize = c.toBool(e.getAttribute("gs-no-resize")), i.noMove = c.toBool(e.getAttribute("gs-no-move")), i.locked = c.toBool(e.getAttribute("gs-locked"));
|
|
3635
3689
|
const s = e.getAttribute("gs-size-to-content");
|
|
3636
|
-
s && (s === "true" || s === "false" ? i.sizeToContent =
|
|
3690
|
+
s && (s === "true" || s === "false" ? i.sizeToContent = c.toBool(s) : i.sizeToContent = parseInt(s, 10)), i.id = e.getAttribute("gs-id"), i.maxW = c.toNumber(e.getAttribute("gs-max-w")), i.minW = c.toNumber(e.getAttribute("gs-min-w")), i.maxH = c.toNumber(e.getAttribute("gs-max-h")), i.minH = c.toNumber(e.getAttribute("gs-min-h")), t && (i.w === 1 && e.removeAttribute("gs-w"), i.h === 1 && e.removeAttribute("gs-h"), i.maxW && e.removeAttribute("gs-max-w"), i.minW && e.removeAttribute("gs-min-w"), i.maxH && e.removeAttribute("gs-max-h"), i.minH && e.removeAttribute("gs-min-h"));
|
|
3637
3691
|
for (const r in i) {
|
|
3638
3692
|
if (!i.hasOwnProperty(r))
|
|
3639
3693
|
return;
|
|
@@ -3666,11 +3720,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3666
3720
|
if (e && this.hasAnimationCSS())
|
|
3667
3721
|
return setTimeout(() => this.resizeToContentCheck(!1, t), this.animationDelay);
|
|
3668
3722
|
if (t)
|
|
3669
|
-
|
|
3670
|
-
else if (this.engine.nodes.some((i) =>
|
|
3723
|
+
c.shouldSizeToContent(t) && this.resizeToContentCBCheck(t.el);
|
|
3724
|
+
else if (this.engine.nodes.some((i) => c.shouldSizeToContent(i))) {
|
|
3671
3725
|
const i = [...this.engine.nodes];
|
|
3672
3726
|
this.batchUpdate(), i.forEach((s) => {
|
|
3673
|
-
|
|
3727
|
+
c.shouldSizeToContent(s) && this.resizeToContentCBCheck(s.el);
|
|
3674
3728
|
}), this.batchUpdate(!1);
|
|
3675
3729
|
}
|
|
3676
3730
|
this._gsEventHandler.resizecontent && this._gsEventHandler.resizecontent(null, t ? [t] : this.engine.nodes);
|
|
@@ -3679,15 +3733,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3679
3733
|
/** add or remove the grid element size event handler */
|
|
3680
3734
|
_updateResizeEvent(e = !1) {
|
|
3681
3735
|
const t = !this.parentGridNode && (this._isAutoCellHeight || this.opts.sizeToContent || this.opts.columnOpts || this.engine.nodes.find((i) => i.sizeToContent));
|
|
3682
|
-
return !e && t && !this.resizeObserver ? (this._sizeThrottle =
|
|
3736
|
+
return !e && t && !this.resizeObserver ? (this._sizeThrottle = c.throttle(() => this.onResize(), this.opts.cellHeightThrottle), this.resizeObserver = new ResizeObserver(() => this._sizeThrottle()), this.resizeObserver.observe(this.el), this._skipInitialResize = !0) : (e || !t) && this.resizeObserver && (this.resizeObserver.disconnect(), delete this.resizeObserver, delete this._sizeThrottle), this;
|
|
3683
3737
|
}
|
|
3684
3738
|
/** @internal convert a potential selector into actual element */
|
|
3685
3739
|
static getElement(e = ".grid-stack-item") {
|
|
3686
|
-
return
|
|
3740
|
+
return c.getElement(e);
|
|
3687
3741
|
}
|
|
3688
3742
|
/** @internal */
|
|
3689
3743
|
static getElements(e = ".grid-stack-item") {
|
|
3690
|
-
return
|
|
3744
|
+
return c.getElements(e);
|
|
3691
3745
|
}
|
|
3692
3746
|
/** @internal */
|
|
3693
3747
|
static getGridElement(e) {
|
|
@@ -3695,12 +3749,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3695
3749
|
}
|
|
3696
3750
|
/** @internal */
|
|
3697
3751
|
static getGridElements(e) {
|
|
3698
|
-
return
|
|
3752
|
+
return c.getElements(e);
|
|
3699
3753
|
}
|
|
3700
3754
|
/** @internal initialize margin top/bottom/left/right and units */
|
|
3701
3755
|
_initMargin() {
|
|
3702
3756
|
let e, t = 0, i = [];
|
|
3703
|
-
return typeof this.opts.margin == "string" && (i = this.opts.margin.split(" ")), i.length === 2 ? (this.opts.marginTop = this.opts.marginBottom = i[0], this.opts.marginLeft = this.opts.marginRight = i[1]) : i.length === 4 ? (this.opts.marginTop = i[0], this.opts.marginRight = i[1], this.opts.marginBottom = i[2], this.opts.marginLeft = i[3]) : (e =
|
|
3757
|
+
return typeof this.opts.margin == "string" && (i = this.opts.margin.split(" ")), i.length === 2 ? (this.opts.marginTop = this.opts.marginBottom = i[0], this.opts.marginLeft = this.opts.marginRight = i[1]) : i.length === 4 ? (this.opts.marginTop = i[0], this.opts.marginRight = i[1], this.opts.marginBottom = i[2], this.opts.marginLeft = i[3]) : (e = c.parseHeight(this.opts.margin), this.opts.marginUnit = e.unit, t = this.opts.margin = e.h), this.opts.marginTop === void 0 ? this.opts.marginTop = t : (e = c.parseHeight(this.opts.marginTop), this.opts.marginTop = e.h, delete this.opts.margin), this.opts.marginBottom === void 0 ? this.opts.marginBottom = t : (e = c.parseHeight(this.opts.marginBottom), this.opts.marginBottom = e.h, delete this.opts.margin), this.opts.marginRight === void 0 ? this.opts.marginRight = t : (e = c.parseHeight(this.opts.marginRight), this.opts.marginRight = e.h, delete this.opts.margin), this.opts.marginLeft === void 0 ? this.opts.marginLeft = t : (e = c.parseHeight(this.opts.marginLeft), this.opts.marginLeft = e.h, delete this.opts.margin), this.opts.marginUnit = e.unit, this.opts.marginTop === this.opts.marginBottom && this.opts.marginLeft === this.opts.marginRight && this.opts.marginTop === this.opts.marginRight && (this.opts.margin = this.opts.marginTop), this;
|
|
3704
3758
|
}
|
|
3705
3759
|
/* ===========================================================================================
|
|
3706
3760
|
* drag&drop methods that used to be stubbed out and implemented in dd-gridstack.ts
|
|
@@ -3709,7 +3763,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3709
3763
|
*/
|
|
3710
3764
|
/** get the global (but static to this code) DD implementation */
|
|
3711
3765
|
static getDD() {
|
|
3712
|
-
return
|
|
3766
|
+
return F;
|
|
3713
3767
|
}
|
|
3714
3768
|
/**
|
|
3715
3769
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3721,8 +3775,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3721
3775
|
* @param root optional root which defaults to document (for shadow dom pass the parent HTMLDocument)
|
|
3722
3776
|
*/
|
|
3723
3777
|
static setupDragIn(e, t, i, s = document) {
|
|
3724
|
-
(t == null ? void 0 : t.pause) !== void 0 && (
|
|
3725
|
-
|
|
3778
|
+
(t == null ? void 0 : t.pause) !== void 0 && (x.pauseDrag = t.pause), t = { appendTo: "body", helper: "clone", ...t || {} }, (typeof e == "string" ? c.getElements(e, s) : e).forEach((o, n) => {
|
|
3779
|
+
F.isDraggable(o) || F.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3726
3780
|
});
|
|
3727
3781
|
}
|
|
3728
3782
|
/**
|
|
@@ -3801,12 +3855,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3801
3855
|
}
|
|
3802
3856
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3803
3857
|
_removeDD(e) {
|
|
3804
|
-
return
|
|
3858
|
+
return F.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3805
3859
|
}
|
|
3806
3860
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3807
3861
|
_setupAcceptWidget() {
|
|
3808
3862
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3809
|
-
return
|
|
3863
|
+
return F.droppable(this.el, "destroy"), this;
|
|
3810
3864
|
let e, t;
|
|
3811
3865
|
const i = (s, r, o) => {
|
|
3812
3866
|
var f;
|
|
@@ -3816,8 +3870,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3816
3870
|
return;
|
|
3817
3871
|
if (!((f = n.grid) != null && f.el)) {
|
|
3818
3872
|
o.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;
|
|
3819
|
-
const
|
|
3820
|
-
o.style.left =
|
|
3873
|
+
const p = o.getBoundingClientRect();
|
|
3874
|
+
o.style.left = p.x + (this.dragTransform.xScale - 1) * (s.clientX - p.x) / this.dragTransform.xScale + "px", o.style.top = p.y + (this.dragTransform.yScale - 1) * (s.clientY - p.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
3821
3875
|
}
|
|
3822
3876
|
let { top: h, left: l } = o.getBoundingClientRect();
|
|
3823
3877
|
const d = this.el.getBoundingClientRect();
|
|
@@ -3831,16 +3885,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3831
3885
|
if (n._temporaryRemoved) {
|
|
3832
3886
|
if (n.x = Math.max(0, Math.round(l / t)), n.y = Math.max(0, Math.round(h / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3833
3887
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3834
|
-
|
|
3888
|
+
F.off(r, "drag");
|
|
3835
3889
|
return;
|
|
3836
3890
|
}
|
|
3837
|
-
n._willFitPos && (
|
|
3891
|
+
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
3838
3892
|
}
|
|
3839
3893
|
this._onStartMoving(o, s, a, n, t, e);
|
|
3840
3894
|
} else
|
|
3841
3895
|
this._dragOrResize(o, s, a, n, t, e);
|
|
3842
3896
|
};
|
|
3843
|
-
return
|
|
3897
|
+
return F.droppable(this.el, {
|
|
3844
3898
|
accept: (s) => {
|
|
3845
3899
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3846
3900
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3879,12 +3933,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3879
3933
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3880
3934
|
const h = n.w || Math.round(o.offsetWidth / t) || 1, l = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3881
3935
|
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: h, h: l, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3882
|
-
n._temporaryRemoved = !0) : (n.w = h, n.h = l, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1),
|
|
3936
|
+
n._temporaryRemoved = !0) : (n.w = h, n.h = l, n._temporaryRemoved = !0), b._itemRemoving(n.el, !1), F.on(r, "drag", i), i(s, r, o), !1;
|
|
3883
3937
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3884
3938
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3885
3939
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3886
3940
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3887
|
-
var
|
|
3941
|
+
var p, g, y;
|
|
3888
3942
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3889
3943
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3890
3944
|
return !1;
|
|
@@ -3894,13 +3948,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3894
3948
|
d && this.setAnimation(!1);
|
|
3895
3949
|
const a = r._gridstackNodeOrig;
|
|
3896
3950
|
if (delete r._gridstackNodeOrig, h && (a != null && a.grid) && a.grid !== this) {
|
|
3897
|
-
const
|
|
3898
|
-
|
|
3951
|
+
const m = a.grid;
|
|
3952
|
+
m.engine.removeNodeFromLayoutCache(a), m.engine.removedNodes.push(a), m._triggerRemoveEvent()._triggerChangeEvent(), m.parentGridNode && !m.engine.nodes.length && m.opts.subGridDynamic && m.removeAsSubGrid();
|
|
3899
3953
|
}
|
|
3900
|
-
if (!n || (h && (this.engine.cleanupNode(n), n.grid = this), (
|
|
3954
|
+
if (!n || (h && (this.engine.cleanupNode(n), n.grid = this), (p = n.grid) == null || delete p._isTemp, F.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !h))
|
|
3901
3955
|
return !1;
|
|
3902
|
-
const f = (
|
|
3903
|
-
return
|
|
3956
|
+
const f = (y = (g = n.subGrid) == null ? void 0 : g.el) == null ? void 0 : y.gridstack;
|
|
3957
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), l && (n.content || n.subGridOpts || b.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, a && a.grid ? a : void 0, n), d && this.setAnimation(this.opts.animate, !0), !1;
|
|
3904
3958
|
}), this;
|
|
3905
3959
|
}
|
|
3906
3960
|
/** @internal mark item for removal */
|
|
@@ -3915,7 +3969,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3915
3969
|
if (typeof this.opts.removable != "string")
|
|
3916
3970
|
return this;
|
|
3917
3971
|
const e = document.querySelector(this.opts.removable);
|
|
3918
|
-
return e ? (!this.opts.staticGrid && !
|
|
3972
|
+
return e ? (!this.opts.staticGrid && !F.isDroppable(e) && F.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;
|
|
3919
3973
|
}
|
|
3920
3974
|
/**
|
|
3921
3975
|
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
@@ -3931,23 +3985,23 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3931
3985
|
return this;
|
|
3932
3986
|
if (!i._initDD) {
|
|
3933
3987
|
let n, h;
|
|
3934
|
-
const l = (f,
|
|
3935
|
-
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(), h = this.getCellHeight(!0), this._onStartMoving(e, f,
|
|
3936
|
-
}, d = (f,
|
|
3937
|
-
this._dragOrResize(e, f,
|
|
3988
|
+
const l = (f, p) => {
|
|
3989
|
+
this._gsEventHandler[f.type] && this._gsEventHandler[f.type](f, f.target), n = this.cellWidth(), h = this.getCellHeight(!0), this._onStartMoving(e, f, p, i, n, h);
|
|
3990
|
+
}, d = (f, p) => {
|
|
3991
|
+
this._dragOrResize(e, f, p, i, n, h);
|
|
3938
3992
|
}, a = (f) => {
|
|
3939
3993
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete i._moving, delete i._event, delete i._lastTried;
|
|
3940
|
-
const
|
|
3994
|
+
const p = i.w !== i._orig.w, g = f.target;
|
|
3941
3995
|
if (!(!g.gridstackNode || g.gridstackNode.grid !== this)) {
|
|
3942
3996
|
if (i.el = g, i._isAboutToRemove) {
|
|
3943
|
-
const
|
|
3944
|
-
|
|
3997
|
+
const y = e.gridstackNode.grid;
|
|
3998
|
+
y._gsEventHandler[f.type] && y._gsEventHandler[f.type](f, g), y.engine.nodes.push(i), y.removeWidget(e, !0, !0);
|
|
3945
3999
|
} else
|
|
3946
|
-
|
|
3947
|
-
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(
|
|
4000
|
+
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);
|
|
4001
|
+
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), f.type === "resizestop" && (Number.isInteger(i.sizeToContent) && (i.sizeToContent = i.h), this.resizeToContentCheck(p, i));
|
|
3948
4002
|
}
|
|
3949
4003
|
};
|
|
3950
|
-
|
|
4004
|
+
F.draggable(e, {
|
|
3951
4005
|
start: l,
|
|
3952
4006
|
stop: a,
|
|
3953
4007
|
drag: d
|
|
@@ -3957,16 +4011,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3957
4011
|
resize: d
|
|
3958
4012
|
}), i._initDD = !0;
|
|
3959
4013
|
}
|
|
3960
|
-
return
|
|
4014
|
+
return F.draggable(e, s ? "disable" : "enable").resizable(e, r ? "disable" : "enable"), this;
|
|
3961
4015
|
}
|
|
3962
4016
|
/** @internal handles actual drag/resize start */
|
|
3963
4017
|
_onStartMoving(e, t, i, s, r, o) {
|
|
3964
4018
|
var n;
|
|
3965
4019
|
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)
|
|
3966
|
-
this.dragTransform =
|
|
4020
|
+
this.dragTransform = c.getValuesFromTransformedElement(e);
|
|
3967
4021
|
else if (this.placeholder && this.placeholder.closest(".grid-stack")) {
|
|
3968
4022
|
const h = this.placeholder.closest(".grid-stack");
|
|
3969
|
-
this.dragTransform =
|
|
4023
|
+
this.dragTransform = c.getValuesFromTransformedElement(h);
|
|
3970
4024
|
} else
|
|
3971
4025
|
this.dragTransform = {
|
|
3972
4026
|
xScale: 1,
|
|
@@ -3976,47 +4030,47 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3976
4030
|
};
|
|
3977
4031
|
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") {
|
|
3978
4032
|
const h = this.getColumn() - s.x, l = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
3979
|
-
|
|
4033
|
+
F.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, h)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, l)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, h)).resizable(e, "option", "maxWidthMoveLeft", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, s.x + s.w)).resizable(e, "option", "maxHeight", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, l)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
3980
4034
|
}
|
|
3981
4035
|
}
|
|
3982
4036
|
/** @internal handles actual drag/resize */
|
|
3983
4037
|
_dragOrResize(e, t, i, s, r, o) {
|
|
3984
4038
|
const n = { ...s._orig };
|
|
3985
4039
|
let h, l = this.opts.marginLeft, d = this.opts.marginRight, a = this.opts.marginTop, f = this.opts.marginBottom;
|
|
3986
|
-
const
|
|
3987
|
-
if (l = Math.min(l, g), d = Math.min(d, g), a = Math.min(a,
|
|
4040
|
+
const p = Math.round(o * 0.1), g = Math.round(r * 0.1);
|
|
4041
|
+
if (l = Math.min(l, g), d = Math.min(d, g), a = Math.min(a, p), f = Math.min(f, p), t.type === "drag") {
|
|
3988
4042
|
if (s._temporaryRemoved)
|
|
3989
4043
|
return;
|
|
3990
|
-
const
|
|
3991
|
-
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 &&
|
|
3992
|
-
const
|
|
3993
|
-
n.x = Math.round(
|
|
3994
|
-
const
|
|
4044
|
+
const m = i.position.top - s._prevYPix;
|
|
4045
|
+
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, m);
|
|
4046
|
+
const k = i.position.left + (i.position.left > s._lastUiPosition.left ? -d : l), w = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : a);
|
|
4047
|
+
n.x = Math.round(k / r), n.y = Math.round(w / o);
|
|
4048
|
+
const E = this._extraDragRow;
|
|
3995
4049
|
if (this.engine.collide(s, n)) {
|
|
3996
|
-
const
|
|
3997
|
-
let
|
|
3998
|
-
this.opts.maxRow &&
|
|
4050
|
+
const D = this.getRow();
|
|
4051
|
+
let C = Math.max(0, n.y + s.h - D);
|
|
4052
|
+
this.opts.maxRow && D + C > this.opts.maxRow && (C = Math.max(0, this.opts.maxRow - D)), this._extraDragRow = C;
|
|
3999
4053
|
} else
|
|
4000
4054
|
this._extraDragRow = 0;
|
|
4001
|
-
if (this._extraDragRow !==
|
|
4055
|
+
if (this._extraDragRow !== E && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
4002
4056
|
return;
|
|
4003
4057
|
} else if (t.type === "resize") {
|
|
4004
|
-
if (n.x < 0 || (
|
|
4058
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - l) / r), n.h = Math.round((i.size.height - a) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
4005
4059
|
return;
|
|
4006
|
-
const
|
|
4007
|
-
n.x = Math.round(
|
|
4060
|
+
const m = i.position.left + l, k = i.position.top + a;
|
|
4061
|
+
n.x = Math.round(m / r), n.y = Math.round(k / o), h = !0;
|
|
4008
4062
|
}
|
|
4009
4063
|
s._event = t, s._lastTried = n;
|
|
4010
|
-
const
|
|
4064
|
+
const y = {
|
|
4011
4065
|
x: i.position.left + l,
|
|
4012
4066
|
y: i.position.top + a,
|
|
4013
4067
|
w: (i.size ? i.size.width : s.w * r) - l - d,
|
|
4014
4068
|
h: (i.size ? i.size.height : s.h * o) - a - f
|
|
4015
4069
|
};
|
|
4016
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect:
|
|
4070
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing: h })) {
|
|
4017
4071
|
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, a, d, f, l), delete s._skipDown, h && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
4018
|
-
const
|
|
4019
|
-
s._sidebarOrig || this._writePosAttr(
|
|
4072
|
+
const m = t.target;
|
|
4073
|
+
s._sidebarOrig || this._writePosAttr(m, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, m);
|
|
4020
4074
|
}
|
|
4021
4075
|
}
|
|
4022
4076
|
/** @internal called when item leaving our area by either cursor dropout event
|
|
@@ -4026,7 +4080,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4026
4080
|
_leave(e, t) {
|
|
4027
4081
|
t = t || e;
|
|
4028
4082
|
const i = t.gridstackNode;
|
|
4029
|
-
if (!i || (t.style.transform = t.style.transformOrigin = null,
|
|
4083
|
+
if (!i || (t.style.transform = t.style.transformOrigin = null, F.off(e, "drag"), i._temporaryRemoved))
|
|
4030
4084
|
return;
|
|
4031
4085
|
i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e;
|
|
4032
4086
|
const s = i._sidebarOrig;
|
|
@@ -4034,173 +4088,173 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4034
4088
|
}
|
|
4035
4089
|
// legacy method removed
|
|
4036
4090
|
commit() {
|
|
4037
|
-
return
|
|
4091
|
+
return xs(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
4038
4092
|
}
|
|
4039
4093
|
}
|
|
4040
|
-
b.renderCB = (
|
|
4041
|
-
|
|
4094
|
+
b.renderCB = (u, e) => {
|
|
4095
|
+
u && (e != null && e.content) && (u.textContent = e.content);
|
|
4042
4096
|
};
|
|
4043
4097
|
b.resizeToContentParent = ".grid-stack-item-content";
|
|
4044
|
-
b.Utils =
|
|
4098
|
+
b.Utils = c;
|
|
4045
4099
|
b.Engine = re;
|
|
4046
4100
|
b.GDRev = "11.5.1";
|
|
4047
|
-
const
|
|
4101
|
+
const Ts = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], zs = { class: "grid-stack-item-content" }, Ds = /* @__PURE__ */ Q({
|
|
4048
4102
|
__name: "DraggableGridLayout",
|
|
4049
4103
|
props: {
|
|
4050
4104
|
tiles: {},
|
|
4051
|
-
tileHeight: { default:
|
|
4105
|
+
tileHeight: { default: Ge }
|
|
4052
4106
|
},
|
|
4053
4107
|
emits: ["update-tiles"],
|
|
4054
|
-
setup(
|
|
4055
|
-
const i =
|
|
4108
|
+
setup(u, { expose: e, emit: t }) {
|
|
4109
|
+
const i = u, s = t, r = $(null), o = $(new Map(i.tiles.map((p) => [`${p.id}`, p])));
|
|
4056
4110
|
let n = null;
|
|
4057
|
-
const h = (
|
|
4058
|
-
var
|
|
4059
|
-
const
|
|
4060
|
-
if (
|
|
4111
|
+
const h = (p) => `[data-id="${p}"]`, l = (p) => p.map((g) => {
|
|
4112
|
+
var m;
|
|
4113
|
+
const y = o.value.get(`${(m = g.el) == null ? void 0 : m.getAttribute("data-id")}`);
|
|
4114
|
+
if (y)
|
|
4061
4115
|
return {
|
|
4062
|
-
...
|
|
4116
|
+
...y,
|
|
4063
4117
|
layout: {
|
|
4064
4118
|
position: { col: Number(g.x), row: Number(g.y) },
|
|
4065
4119
|
size: { cols: Number(g.w), rows: Number(g.h) }
|
|
4066
4120
|
}
|
|
4067
4121
|
};
|
|
4068
|
-
}).filter((g) => g !== void 0), d = (
|
|
4069
|
-
n && (l(g).forEach((
|
|
4070
|
-
o.value.set(`${
|
|
4122
|
+
}).filter((g) => g !== void 0), d = (p, g) => {
|
|
4123
|
+
n && (l(g).forEach((m) => {
|
|
4124
|
+
o.value.set(`${m.id}`, m);
|
|
4071
4125
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4072
|
-
}, a = (
|
|
4073
|
-
g.forEach((
|
|
4074
|
-
var
|
|
4075
|
-
o.value.delete(`${(
|
|
4126
|
+
}, a = (p, g) => {
|
|
4127
|
+
g.forEach((y) => {
|
|
4128
|
+
var m;
|
|
4129
|
+
o.value.delete(`${(m = y.el) == null ? void 0 : m.getAttribute("data-id")}`);
|
|
4076
4130
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
4077
4131
|
};
|
|
4078
|
-
|
|
4132
|
+
Qe(() => {
|
|
4079
4133
|
r.value && (n = b.init({
|
|
4080
4134
|
margin: 10,
|
|
4081
|
-
column:
|
|
4135
|
+
column: qt,
|
|
4082
4136
|
cellHeight: i.tileHeight,
|
|
4083
4137
|
resizable: { handles: "se, sw" },
|
|
4084
4138
|
handle: ".tile-header"
|
|
4085
4139
|
}, r.value), n.on("change", d), n.on("added", d), n.on("removed", a));
|
|
4086
|
-
}),
|
|
4140
|
+
}), je(() => {
|
|
4087
4141
|
n && n.destroy(!1);
|
|
4088
4142
|
});
|
|
4089
|
-
const f = (
|
|
4143
|
+
const f = (p) => {
|
|
4090
4144
|
if (n && r.value) {
|
|
4091
|
-
const g = r.value.querySelector(h(
|
|
4145
|
+
const g = r.value.querySelector(h(p));
|
|
4092
4146
|
g && n.removeWidget(g);
|
|
4093
4147
|
}
|
|
4094
4148
|
};
|
|
4095
|
-
return
|
|
4096
|
-
if (
|
|
4097
|
-
const
|
|
4098
|
-
for (const
|
|
4099
|
-
o.value.set(`${
|
|
4149
|
+
return Xe(() => i.tiles.length, async (p, g) => {
|
|
4150
|
+
if (p > g && n) {
|
|
4151
|
+
const y = i.tiles.slice(g);
|
|
4152
|
+
for (const m of y)
|
|
4153
|
+
o.value.set(`${m.id}`, m), await St(), n.makeWidget(h(m.id), {
|
|
4100
4154
|
autoPosition: !0,
|
|
4101
|
-
w:
|
|
4102
|
-
h:
|
|
4155
|
+
w: m.layout.size.cols,
|
|
4156
|
+
h: m.layout.size.rows
|
|
4103
4157
|
});
|
|
4104
4158
|
}
|
|
4105
|
-
}),
|
|
4106
|
-
i.tiles.forEach((
|
|
4107
|
-
o.value.set(`${
|
|
4159
|
+
}), Tt(() => {
|
|
4160
|
+
i.tiles.forEach((p) => {
|
|
4161
|
+
o.value.set(`${p.id}`, p);
|
|
4108
4162
|
});
|
|
4109
|
-
}), e({ removeWidget: f }), (
|
|
4163
|
+
}), e({ removeWidget: f }), (p, g) => (z(), W("div", {
|
|
4110
4164
|
ref_key: "gridContainer",
|
|
4111
4165
|
ref: r,
|
|
4112
4166
|
class: "grid-stack"
|
|
4113
4167
|
}, [
|
|
4114
|
-
(
|
|
4115
|
-
key:
|
|
4168
|
+
(z(!0), W(Lt, null, At(i.tiles, (y) => (z(), W("div", {
|
|
4169
|
+
key: y.id,
|
|
4116
4170
|
class: "grid-stack-item",
|
|
4117
|
-
"data-id": `${
|
|
4118
|
-
"data-testid": `grid-stack-item-${
|
|
4119
|
-
"gs-h":
|
|
4171
|
+
"data-id": `${y.id}`,
|
|
4172
|
+
"data-testid": `grid-stack-item-${y.id}`,
|
|
4173
|
+
"gs-h": y.layout.size.rows,
|
|
4120
4174
|
"gs-lazy-load": !0,
|
|
4121
|
-
"gs-w":
|
|
4122
|
-
"gs-x":
|
|
4123
|
-
"gs-y":
|
|
4175
|
+
"gs-w": y.layout.size.cols,
|
|
4176
|
+
"gs-x": y.layout.position.col,
|
|
4177
|
+
"gs-y": y.layout.position.row
|
|
4124
4178
|
}, [
|
|
4125
|
-
le("div",
|
|
4126
|
-
|
|
4179
|
+
le("div", zs, [
|
|
4180
|
+
$e(p.$slots, "tile", { tile: y }, void 0, !0)
|
|
4127
4181
|
])
|
|
4128
|
-
], 8,
|
|
4182
|
+
], 8, Ts))), 128))
|
|
4129
4183
|
], 512));
|
|
4130
4184
|
}
|
|
4131
|
-
}),
|
|
4185
|
+
}), Ss = /* @__PURE__ */ fe(Ds, [["__scopeId", "data-v-a68d6821"]]), Ns = { class: "kong-ui-public-dashboard-renderer" }, Ls = {
|
|
4132
4186
|
key: 0,
|
|
4133
4187
|
class: "tile-container slottable-tile"
|
|
4134
|
-
},
|
|
4188
|
+
}, As = /* @__PURE__ */ Q({
|
|
4135
4189
|
__name: "DashboardRenderer",
|
|
4136
|
-
props: /* @__PURE__ */
|
|
4190
|
+
props: /* @__PURE__ */ gt({
|
|
4137
4191
|
context: {}
|
|
4138
4192
|
}, {
|
|
4139
4193
|
modelValue: { required: !0 },
|
|
4140
4194
|
modelModifiers: {}
|
|
4141
4195
|
}),
|
|
4142
|
-
emits: /* @__PURE__ */
|
|
4143
|
-
setup(
|
|
4144
|
-
const i =
|
|
4145
|
-
l || (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")),
|
|
4146
|
-
const d =
|
|
4196
|
+
emits: /* @__PURE__ */ gt(["edit-tile", "tile-time-range-zoom"], ["update:modelValue"]),
|
|
4197
|
+
setup(u, { expose: e, emit: t }) {
|
|
4198
|
+
const i = u, s = t, r = ui(u, "modelValue"), { i18n: o } = ce.useI18n(), n = $(0), h = $(null), l = _e(ue);
|
|
4199
|
+
l || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ce.useRequestQueue();
|
|
4200
|
+
const d = Mt(), a = N(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4147
4201
|
type: "relative",
|
|
4148
4202
|
time_range: d.defaultQueryTimeForOrg
|
|
4149
|
-
}), f =
|
|
4150
|
-
const
|
|
4151
|
-
return
|
|
4152
|
-
}, g =
|
|
4153
|
-
var
|
|
4154
|
-
let A =
|
|
4203
|
+
}), f = N(() => !!i.context.timeSpec || !d.loading), p = (R, A) => {
|
|
4204
|
+
const L = R.layout.position.row - A.layout.position.row;
|
|
4205
|
+
return L !== 0 ? L : R.layout.position.col - A.layout.position.col;
|
|
4206
|
+
}, g = N(() => r.value.tiles.map((R) => {
|
|
4207
|
+
var L;
|
|
4208
|
+
let A = R.definition;
|
|
4155
4209
|
if ("description" in A.chart) {
|
|
4156
|
-
const
|
|
4157
|
-
const
|
|
4158
|
-
return o.te(
|
|
4210
|
+
const U = (L = A.chart.description) == null ? void 0 : L.replace(Gi, () => {
|
|
4211
|
+
const ae = `renderer.trendRange.${a.value.type === "absolute" ? "custom" : a.value.time_range}`;
|
|
4212
|
+
return o.te(ae) ? o.t(ae) : "";
|
|
4159
4213
|
});
|
|
4160
4214
|
A = {
|
|
4161
4215
|
...A,
|
|
4162
4216
|
chart: {
|
|
4163
4217
|
...A.chart,
|
|
4164
|
-
description:
|
|
4218
|
+
description: U
|
|
4165
4219
|
}
|
|
4166
4220
|
};
|
|
4167
4221
|
}
|
|
4168
|
-
return i.context.editable && !
|
|
4222
|
+
return i.context.editable && !R.id && console.warn(
|
|
4169
4223
|
"No id provided for tile. One will be generated automatically,",
|
|
4170
4224
|
"however tracking changes to this tile may not work as expected.",
|
|
4171
|
-
|
|
4225
|
+
R
|
|
4172
4226
|
), {
|
|
4173
|
-
layout:
|
|
4227
|
+
layout: R.layout,
|
|
4174
4228
|
meta: A,
|
|
4175
|
-
type:
|
|
4229
|
+
type: R.type,
|
|
4176
4230
|
// Add a unique key to each tile internally.
|
|
4177
|
-
id:
|
|
4231
|
+
id: R.id ?? crypto.randomUUID()
|
|
4178
4232
|
};
|
|
4179
|
-
})),
|
|
4180
|
-
var
|
|
4181
|
-
let { tz:
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
const
|
|
4233
|
+
})), y = N(() => {
|
|
4234
|
+
var ae, De, Se;
|
|
4235
|
+
let { tz: R, refreshInterval: A, editable: L } = i.context;
|
|
4236
|
+
const U = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
4237
|
+
R || (R = new Intl.DateTimeFormat().resolvedOptions().timeZone), A === void 0 && (A = Ui), L === void 0 && (L = !1);
|
|
4238
|
+
const ee = !!((Se = (De = (ae = ci()) == null ? void 0 : ae.vnode) == null ? void 0 : De.props) != null && Se.onTileTimeRangeZoom);
|
|
4185
4239
|
return {
|
|
4186
|
-
filters:
|
|
4187
|
-
tz:
|
|
4240
|
+
filters: U,
|
|
4241
|
+
tz: R,
|
|
4188
4242
|
timeSpec: a.value,
|
|
4189
4243
|
refreshInterval: A,
|
|
4190
|
-
editable:
|
|
4191
|
-
zoomable:
|
|
4244
|
+
editable: L,
|
|
4245
|
+
zoomable: ee
|
|
4192
4246
|
};
|
|
4193
|
-
}),
|
|
4194
|
-
s("edit-tile",
|
|
4195
|
-
},
|
|
4196
|
-
const A = R
|
|
4197
|
-
...
|
|
4198
|
-
chart_title:
|
|
4199
|
-
},
|
|
4247
|
+
}), m = (R) => {
|
|
4248
|
+
s("edit-tile", R);
|
|
4249
|
+
}, k = (R) => R.type === "slottable", w = (R) => {
|
|
4250
|
+
const A = k(R.meta.chart) ? { ...R.meta.chart } : {
|
|
4251
|
+
...R.meta.chart,
|
|
4252
|
+
chart_title: R.meta.chart.chart_title ? `Copy of ${R.meta.chart.chart_title}` : ""
|
|
4253
|
+
}, L = {
|
|
4200
4254
|
id: crypto.randomUUID(),
|
|
4201
4255
|
type: "chart",
|
|
4202
4256
|
definition: {
|
|
4203
|
-
...
|
|
4257
|
+
...R.meta,
|
|
4204
4258
|
chart: A
|
|
4205
4259
|
},
|
|
4206
4260
|
layout: {
|
|
@@ -4208,75 +4262,75 @@ const Es = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], xs = { cl
|
|
|
4208
4262
|
col: 0,
|
|
4209
4263
|
row: 0
|
|
4210
4264
|
},
|
|
4211
|
-
size:
|
|
4265
|
+
size: R.layout.size
|
|
4212
4266
|
}
|
|
4213
4267
|
};
|
|
4214
|
-
r.value.tiles.push(
|
|
4215
|
-
},
|
|
4216
|
-
h.value && h.value.removeWidget(
|
|
4217
|
-
},
|
|
4268
|
+
r.value.tiles.push(L);
|
|
4269
|
+
}, E = (R) => {
|
|
4270
|
+
h.value && h.value.removeWidget(R.id);
|
|
4271
|
+
}, D = () => {
|
|
4218
4272
|
n.value++;
|
|
4219
|
-
},
|
|
4220
|
-
const A =
|
|
4221
|
-
id:
|
|
4222
|
-
type:
|
|
4223
|
-
layout:
|
|
4224
|
-
definition:
|
|
4273
|
+
}, C = (R) => {
|
|
4274
|
+
const A = R.map((L) => ({
|
|
4275
|
+
id: L.id,
|
|
4276
|
+
type: L.type,
|
|
4277
|
+
layout: L.layout,
|
|
4278
|
+
definition: L.meta
|
|
4225
4279
|
}));
|
|
4226
|
-
r.value.tiles = A.sort(
|
|
4280
|
+
r.value.tiles = A.sort(p);
|
|
4227
4281
|
};
|
|
4228
|
-
return e({ refresh:
|
|
4229
|
-
const
|
|
4230
|
-
return
|
|
4231
|
-
|
|
4282
|
+
return e({ refresh: D }), (R, A) => {
|
|
4283
|
+
const L = de("KAlert");
|
|
4284
|
+
return z(), W("div", Ns, [
|
|
4285
|
+
T(l) ? (z(), M(Nt(R.context.editable ? Ss : Es), {
|
|
4232
4286
|
key: 1,
|
|
4233
4287
|
ref_key: "gridLayoutRef",
|
|
4234
4288
|
ref: h,
|
|
4235
4289
|
"tile-height": r.value.tile_height,
|
|
4236
4290
|
tiles: g.value,
|
|
4237
|
-
onUpdateTiles:
|
|
4291
|
+
onUpdateTiles: C
|
|
4238
4292
|
}, {
|
|
4239
|
-
tile:
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
])) : (
|
|
4293
|
+
tile: q(({ tile: U }) => [
|
|
4294
|
+
U.meta.chart.type === "slottable" ? (z(), W("div", Ls, [
|
|
4295
|
+
$e(R.$slots, U.meta.chart.id, {}, void 0, !0)
|
|
4296
|
+
])) : (z(), M(_s, {
|
|
4243
4297
|
key: 1,
|
|
4244
4298
|
class: "tile-container",
|
|
4245
|
-
context:
|
|
4246
|
-
definition:
|
|
4247
|
-
height:
|
|
4299
|
+
context: y.value,
|
|
4300
|
+
definition: U.meta,
|
|
4301
|
+
height: U.layout.size.rows * (r.value.tile_height || T(Ge)) + parseInt(T(Vt), 10),
|
|
4248
4302
|
"query-ready": f.value,
|
|
4249
4303
|
"refresh-counter": n.value,
|
|
4250
|
-
"tile-id":
|
|
4251
|
-
onDuplicateTile: (
|
|
4252
|
-
onEditTile: (
|
|
4253
|
-
onRemoveTile: (
|
|
4254
|
-
onTileTimeRangeZoom: A[0] || (A[0] = (
|
|
4304
|
+
"tile-id": U.id,
|
|
4305
|
+
onDuplicateTile: (ee) => w(U),
|
|
4306
|
+
onEditTile: (ee) => m(U),
|
|
4307
|
+
onRemoveTile: (ee) => E(U),
|
|
4308
|
+
onTileTimeRangeZoom: A[0] || (A[0] = (ee) => s("tile-time-range-zoom", ee))
|
|
4255
4309
|
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4256
4310
|
]),
|
|
4257
4311
|
_: 3
|
|
4258
|
-
}, 40, ["tile-height", "tiles"])) : (
|
|
4312
|
+
}, 40, ["tile-height", "tiles"])) : (z(), M(L, {
|
|
4259
4313
|
key: 0,
|
|
4260
4314
|
appearance: "danger"
|
|
4261
4315
|
}, {
|
|
4262
|
-
default:
|
|
4263
|
-
Ee(te(
|
|
4316
|
+
default: q(() => [
|
|
4317
|
+
Ee(te(T(o).t("renderer.noQueryBridge")), 1)
|
|
4264
4318
|
]),
|
|
4265
4319
|
_: 1
|
|
4266
4320
|
}))
|
|
4267
4321
|
]);
|
|
4268
4322
|
};
|
|
4269
4323
|
}
|
|
4270
|
-
}),
|
|
4324
|
+
}), Bs = /* @__PURE__ */ fe(As, [["__scopeId", "data-v-c16badc2"]]);
|
|
4271
4325
|
export {
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4326
|
+
$i as C,
|
|
4327
|
+
Bs as D,
|
|
4328
|
+
pt as E,
|
|
4329
|
+
Es as G,
|
|
4276
4330
|
ue as I,
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4331
|
+
Gi as T,
|
|
4332
|
+
tt as _,
|
|
4333
|
+
Ge as a,
|
|
4334
|
+
qt as b,
|
|
4335
|
+
Ui as c
|
|
4282
4336
|
};
|