@kong-ui-public/dashboard-renderer 4.1.15 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard-renderer.es.js +770 -780
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/style.css +1 -1
- package/dist/types/components/BaseAnalyticsChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/components/GoldenSignalsRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/TopNTableRenderer.vue.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var Qe = (u) => {
|
|
3
3
|
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var v = (u, e, t) => (
|
|
8
|
-
var
|
|
5
|
+
var Ot = (u, e, t) => e in u ? At(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
6
|
+
var Je = (u, e, t) => Ot(u, typeof e != "symbol" ? e + "" : e, t), Pe = (u, e, t) => e.has(u) || Qe("Cannot " + t);
|
|
7
|
+
var v = (u, e, t) => (Pe(u, e, "read from private field"), t ? t.call(u) : e.get(u)), O = (u, e, t) => e.has(u) ? Qe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(u) : e.set(u, t), N = (u, e, t, i) => (Pe(u, e, "write to private field"), i ? i.call(u, t) : e.set(u, t), t), L = (u, e, t) => (Pe(u, e, "access private method"), t);
|
|
8
|
+
var me = (u, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
10
|
N(u, e, s, t);
|
|
11
11
|
},
|
|
@@ -13,27 +13,27 @@ var ve = (u, e, t, i) => ({
|
|
|
13
13
|
return v(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as B, watchEffect as
|
|
17
|
-
import { stripUnknownFilters as
|
|
18
|
-
import { SimpleChart as
|
|
19
|
-
import
|
|
16
|
+
import { ref as B, watchEffect as ft, inject as ge, provide as Lt, defineComponent as F, onUnmounted as $e, computed as H, watch as Ue, resolveComponent as ne, unref as k, openBlock as T, createBlock as A, withCtx as M, createTextVNode as ye, toDisplayString as ee, renderSlot as Le, createCommentVNode as X, useCssVars as Ge, createElementVNode as le, normalizeClass as Fe, createVNode as te, mergeProps as gt, createSlots as pt, createElementBlock as $, normalizeProps as Mt, guardReactiveProps as It, defineAsyncComponent as Pt, onMounted as We, nextTick as mt, resolveDynamicComponent as yt, Fragment as vt, renderList as _t, normalizeStyle as Ze, mergeModels as et, useModel as qt } from "vue";
|
|
17
|
+
import { stripUnknownFilters as Bt, Timeframe as $t, TimePeriods as wt, TIMEFRAME_LOOKUP as Ut, formatTime as tt, msToGranularity as Gt } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { SimpleChart as Ft, AnalyticsChart as Wt, TopNTable as Vt, CsvExportModal as Kt } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import Yt from "swrv";
|
|
20
20
|
import "axios";
|
|
21
|
-
import { createI18n as
|
|
22
|
-
import { useAnalyticsConfigStore as
|
|
23
|
-
import { MetricsProvider as
|
|
24
|
-
import { EditIcon as
|
|
25
|
-
var
|
|
26
|
-
const
|
|
21
|
+
import { createI18n as Xt, i18nTComponent as jt } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as bt } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { MetricsProvider as Qt, MetricsConsumer as Jt } from "@kong-ui-public/analytics-metric-provider";
|
|
24
|
+
import { EditIcon as Zt, MoreIcon as ei } from "@kong/icons";
|
|
25
|
+
var Et = /* @__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))(Et || {});
|
|
26
|
+
const ti = (u) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
28
|
return u ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
29
|
((e = Object.keys(u)) != null && e.length || (t = u.data) != null && t.length || (s = (i = u.data) == null ? void 0 : i.data) != null && s.length || !((r = u.data) != null && r.data) && typeof u.data == "object" && Object.keys(u == null ? void 0 : u.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
31
|
+
function ii(u = B({}), e, t, i = ti) {
|
|
32
32
|
const s = B(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
|
-
return
|
|
36
|
+
return ft(() => {
|
|
37
37
|
const r = i(u.value);
|
|
38
38
|
if (u.value && r && t.value) {
|
|
39
39
|
s.value = "VALIDATING_HAS_DATA";
|
|
@@ -62,10 +62,10 @@ function ri(u = B({}), e, t, i = si) {
|
|
|
62
62
|
u.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
|
-
swrvState:
|
|
65
|
+
swrvState: Et
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const si = {
|
|
69
69
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
70
70
|
trendRange: {
|
|
71
71
|
"24h": "Last 24-Hour Summary",
|
|
@@ -74,157 +74,157 @@ const ni = {
|
|
|
74
74
|
},
|
|
75
75
|
edit: "Edit",
|
|
76
76
|
remove: "Remove"
|
|
77
|
-
},
|
|
77
|
+
}, ri = {
|
|
78
78
|
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
79
|
-
},
|
|
79
|
+
}, ni = {
|
|
80
80
|
defaultFilename: "Chart Export",
|
|
81
81
|
exportAsCsv: "Export as CSV"
|
|
82
|
-
},
|
|
83
|
-
renderer:
|
|
84
|
-
queryDataProvider:
|
|
85
|
-
csvExport:
|
|
86
|
-
jumpToExplore:
|
|
82
|
+
}, oi = "Explore", ai = {
|
|
83
|
+
renderer: si,
|
|
84
|
+
queryDataProvider: ri,
|
|
85
|
+
csvExport: ni,
|
|
86
|
+
jumpToExplore: oi
|
|
87
87
|
};
|
|
88
|
-
function
|
|
89
|
-
const u =
|
|
88
|
+
function li() {
|
|
89
|
+
const u = Xt("en-us", ai);
|
|
90
90
|
return {
|
|
91
91
|
i18n: u,
|
|
92
|
-
i18nT:
|
|
92
|
+
i18nT: jt(u)
|
|
93
93
|
// Translation component <i18n-t>
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
const Ve = 170,
|
|
97
|
-
function
|
|
98
|
-
const u =
|
|
96
|
+
const Ve = 170, oe = "analytics-query-provider", it = "{entity-id}", hi = "{cp-id}", di = "{timeframe}", ui = 30 * 1e3;
|
|
97
|
+
function ci() {
|
|
98
|
+
const u = ge(oe);
|
|
99
99
|
return {
|
|
100
100
|
evaluateFeatureFlag: (t, i) => u ? u.evaluateFeatureFlagFn(t, i) : i
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function fi(u) {
|
|
104
104
|
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
105
105
|
}
|
|
106
|
-
var
|
|
106
|
+
var xt = { exports: {} };
|
|
107
107
|
(function(u) {
|
|
108
108
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
109
109
|
function i() {
|
|
110
110
|
}
|
|
111
111
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
112
|
-
function s(d, l
|
|
113
|
-
this.fn =
|
|
112
|
+
function s(a, d, l) {
|
|
113
|
+
this.fn = a, this.context = d, this.once = l || !1;
|
|
114
114
|
}
|
|
115
|
-
function r(d, l,
|
|
116
|
-
if (typeof
|
|
115
|
+
function r(a, d, l, h, f) {
|
|
116
|
+
if (typeof l != "function")
|
|
117
117
|
throw new TypeError("The listener must be a function");
|
|
118
|
-
var
|
|
119
|
-
return
|
|
118
|
+
var p = new s(l, h || a, f), m = t ? t + d : d;
|
|
119
|
+
return a._events[m] ? a._events[m].fn ? a._events[m] = [a._events[m], p] : a._events[m].push(p) : (a._events[m] = p, a._eventsCount++), a;
|
|
120
120
|
}
|
|
121
|
-
function o(
|
|
122
|
-
--
|
|
121
|
+
function o(a, d) {
|
|
122
|
+
--a._eventsCount === 0 ? a._events = new i() : delete a._events[d];
|
|
123
123
|
}
|
|
124
124
|
function n() {
|
|
125
125
|
this._events = new i(), this._eventsCount = 0;
|
|
126
126
|
}
|
|
127
127
|
n.prototype.eventNames = function() {
|
|
128
|
-
var
|
|
129
|
-
if (this._eventsCount === 0) return
|
|
130
|
-
for (h in
|
|
131
|
-
e.call(
|
|
132
|
-
return Object.getOwnPropertySymbols ?
|
|
133
|
-
}, n.prototype.listeners = function(
|
|
134
|
-
var
|
|
128
|
+
var d = [], l, h;
|
|
129
|
+
if (this._eventsCount === 0) return d;
|
|
130
|
+
for (h in l = this._events)
|
|
131
|
+
e.call(l, h) && d.push(t ? h.slice(1) : h);
|
|
132
|
+
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(l)) : d;
|
|
133
|
+
}, n.prototype.listeners = function(d) {
|
|
134
|
+
var l = t ? t + d : d, h = this._events[l];
|
|
135
135
|
if (!h) return [];
|
|
136
136
|
if (h.fn) return [h.fn];
|
|
137
|
-
for (var f = 0,
|
|
137
|
+
for (var f = 0, p = h.length, m = new Array(p); f < p; f++)
|
|
138
138
|
m[f] = h[f].fn;
|
|
139
139
|
return m;
|
|
140
|
-
}, n.prototype.listenerCount = function(
|
|
141
|
-
var
|
|
140
|
+
}, n.prototype.listenerCount = function(d) {
|
|
141
|
+
var l = t ? t + d : d, h = this._events[l];
|
|
142
142
|
return h ? h.fn ? 1 : h.length : 0;
|
|
143
|
-
}, n.prototype.emit = function(
|
|
144
|
-
var y = t ? t +
|
|
143
|
+
}, n.prototype.emit = function(d, l, h, f, p, m) {
|
|
144
|
+
var y = t ? t + d : d;
|
|
145
145
|
if (!this._events[y]) return !1;
|
|
146
|
-
var
|
|
147
|
-
if (
|
|
148
|
-
switch (
|
|
146
|
+
var g = this._events[y], R = arguments.length, S, C;
|
|
147
|
+
if (g.fn) {
|
|
148
|
+
switch (g.once && this.removeListener(d, g.fn, void 0, !0), R) {
|
|
149
149
|
case 1:
|
|
150
|
-
return
|
|
150
|
+
return g.fn.call(g.context), !0;
|
|
151
151
|
case 2:
|
|
152
|
-
return
|
|
152
|
+
return g.fn.call(g.context, l), !0;
|
|
153
153
|
case 3:
|
|
154
|
-
return
|
|
154
|
+
return g.fn.call(g.context, l, h), !0;
|
|
155
155
|
case 4:
|
|
156
|
-
return
|
|
156
|
+
return g.fn.call(g.context, l, h, f), !0;
|
|
157
157
|
case 5:
|
|
158
|
-
return
|
|
158
|
+
return g.fn.call(g.context, l, h, f, p), !0;
|
|
159
159
|
case 6:
|
|
160
|
-
return
|
|
160
|
+
return g.fn.call(g.context, l, h, f, p, m), !0;
|
|
161
161
|
}
|
|
162
|
-
for (
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
for (C = 1, S = new Array(R - 1); C < R; C++)
|
|
163
|
+
S[C - 1] = arguments[C];
|
|
164
|
+
g.fn.apply(g.context, S);
|
|
165
165
|
} else {
|
|
166
|
-
var E =
|
|
167
|
-
for (
|
|
168
|
-
switch (
|
|
166
|
+
var E = g.length, x;
|
|
167
|
+
for (C = 0; C < E; C++)
|
|
168
|
+
switch (g[C].once && this.removeListener(d, g[C].fn, void 0, !0), R) {
|
|
169
169
|
case 1:
|
|
170
|
-
|
|
170
|
+
g[C].fn.call(g[C].context);
|
|
171
171
|
break;
|
|
172
172
|
case 2:
|
|
173
|
-
|
|
173
|
+
g[C].fn.call(g[C].context, l);
|
|
174
174
|
break;
|
|
175
175
|
case 3:
|
|
176
|
-
|
|
176
|
+
g[C].fn.call(g[C].context, l, h);
|
|
177
177
|
break;
|
|
178
178
|
case 4:
|
|
179
|
-
|
|
179
|
+
g[C].fn.call(g[C].context, l, h, f);
|
|
180
180
|
break;
|
|
181
181
|
default:
|
|
182
|
-
if (!
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
if (!S) for (x = 1, S = new Array(R - 1); x < R; x++)
|
|
183
|
+
S[x - 1] = arguments[x];
|
|
184
|
+
g[C].fn.apply(g[C].context, S);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
return !0;
|
|
188
|
-
}, n.prototype.on = function(
|
|
189
|
-
return r(this,
|
|
190
|
-
}, n.prototype.once = function(
|
|
191
|
-
return r(this,
|
|
192
|
-
}, n.prototype.removeListener = function(
|
|
193
|
-
var
|
|
194
|
-
if (!this._events[
|
|
195
|
-
if (!
|
|
196
|
-
return o(this,
|
|
197
|
-
var m = this._events[
|
|
188
|
+
}, n.prototype.on = function(d, l, h) {
|
|
189
|
+
return r(this, d, l, h, !1);
|
|
190
|
+
}, n.prototype.once = function(d, l, h) {
|
|
191
|
+
return r(this, d, l, h, !0);
|
|
192
|
+
}, n.prototype.removeListener = function(d, l, h, f) {
|
|
193
|
+
var p = t ? t + d : d;
|
|
194
|
+
if (!this._events[p]) return this;
|
|
195
|
+
if (!l)
|
|
196
|
+
return o(this, p), this;
|
|
197
|
+
var m = this._events[p];
|
|
198
198
|
if (m.fn)
|
|
199
|
-
m.fn ===
|
|
199
|
+
m.fn === l && (!f || m.once) && (!h || m.context === h) && o(this, p);
|
|
200
200
|
else {
|
|
201
|
-
for (var y = 0,
|
|
202
|
-
(m[y].fn !==
|
|
203
|
-
|
|
201
|
+
for (var y = 0, g = [], R = m.length; y < R; y++)
|
|
202
|
+
(m[y].fn !== l || f && !m[y].once || h && m[y].context !== h) && g.push(m[y]);
|
|
203
|
+
g.length ? this._events[p] = g.length === 1 ? g[0] : g : o(this, p);
|
|
204
204
|
}
|
|
205
205
|
return this;
|
|
206
|
-
}, n.prototype.removeAllListeners = function(
|
|
207
|
-
var
|
|
208
|
-
return
|
|
206
|
+
}, n.prototype.removeAllListeners = function(d) {
|
|
207
|
+
var l;
|
|
208
|
+
return d ? (l = t ? t + d : d, this._events[l] && o(this, l)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
209
209
|
}, n.prototype.off = n.prototype.removeListener, n.prototype.addListener = n.prototype.on, n.prefixed = t, n.EventEmitter = n, u.exports = n;
|
|
210
|
-
})(
|
|
211
|
-
var
|
|
212
|
-
const
|
|
213
|
-
class
|
|
210
|
+
})(xt);
|
|
211
|
+
var gi = xt.exports;
|
|
212
|
+
const pi = /* @__PURE__ */ fi(gi);
|
|
213
|
+
class Ct extends Error {
|
|
214
214
|
constructor(e) {
|
|
215
215
|
super(e), this.name = "TimeoutError";
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
class
|
|
218
|
+
class mi extends Error {
|
|
219
219
|
constructor(e) {
|
|
220
220
|
super(), this.name = "AbortError", this.message = e;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const
|
|
224
|
-
const e = u.reason === void 0 ?
|
|
225
|
-
return e instanceof Error ? e :
|
|
223
|
+
const st = (u) => globalThis.DOMException === void 0 ? new mi(u) : new DOMException(u), rt = (u) => {
|
|
224
|
+
const e = u.reason === void 0 ? st("This operation was aborted.") : u.reason;
|
|
225
|
+
return e instanceof Error ? e : st(e);
|
|
226
226
|
};
|
|
227
|
-
function
|
|
227
|
+
function yi(u, e) {
|
|
228
228
|
const {
|
|
229
229
|
milliseconds: t,
|
|
230
230
|
fallback: i,
|
|
@@ -232,45 +232,45 @@ function _i(u, e) {
|
|
|
232
232
|
customTimers: r = { setTimeout, clearTimeout }
|
|
233
233
|
} = e;
|
|
234
234
|
let o, n;
|
|
235
|
-
const
|
|
235
|
+
const d = new Promise((l, h) => {
|
|
236
236
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
237
237
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
238
238
|
if (e.signal) {
|
|
239
|
-
const { signal:
|
|
240
|
-
|
|
241
|
-
h(
|
|
242
|
-
},
|
|
239
|
+
const { signal: p } = e;
|
|
240
|
+
p.aborted && h(rt(p)), n = () => {
|
|
241
|
+
h(rt(p));
|
|
242
|
+
}, p.addEventListener("abort", n, { once: !0 });
|
|
243
243
|
}
|
|
244
244
|
if (t === Number.POSITIVE_INFINITY) {
|
|
245
|
-
u.then(
|
|
245
|
+
u.then(l, h);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
const f = new
|
|
248
|
+
const f = new Ct();
|
|
249
249
|
o = r.setTimeout.call(void 0, () => {
|
|
250
250
|
if (i) {
|
|
251
251
|
try {
|
|
252
|
-
|
|
253
|
-
} catch (
|
|
254
|
-
h(
|
|
252
|
+
l(i());
|
|
253
|
+
} catch (p) {
|
|
254
|
+
h(p);
|
|
255
255
|
}
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
typeof u.cancel == "function" && u.cancel(), s === !1 ?
|
|
258
|
+
typeof u.cancel == "function" && u.cancel(), s === !1 ? l() : s instanceof Error ? h(s) : (f.message = s ?? `Promise timed out after ${t} milliseconds`, h(f));
|
|
259
259
|
}, t), (async () => {
|
|
260
260
|
try {
|
|
261
|
-
|
|
262
|
-
} catch (
|
|
263
|
-
h(
|
|
261
|
+
l(await u);
|
|
262
|
+
} catch (p) {
|
|
263
|
+
h(p);
|
|
264
264
|
}
|
|
265
265
|
})();
|
|
266
266
|
}).finally(() => {
|
|
267
|
-
|
|
267
|
+
d.clear(), n && e.signal && e.signal.removeEventListener("abort", n);
|
|
268
268
|
});
|
|
269
|
-
return
|
|
269
|
+
return d.clear = () => {
|
|
270
270
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
271
|
-
},
|
|
271
|
+
}, d;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function vi(u, e, t) {
|
|
274
274
|
let i = 0, s = u.length;
|
|
275
275
|
for (; s > 0; ) {
|
|
276
276
|
const r = Math.trunc(s / 2);
|
|
@@ -280,7 +280,7 @@ function bi(u, e, t) {
|
|
|
280
280
|
return i;
|
|
281
281
|
}
|
|
282
282
|
var W;
|
|
283
|
-
class
|
|
283
|
+
class _i {
|
|
284
284
|
constructor() {
|
|
285
285
|
O(this, W, []);
|
|
286
286
|
}
|
|
@@ -298,7 +298,7 @@ class wi {
|
|
|
298
298
|
v(this, W).push(i);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
const s =
|
|
301
|
+
const s = vi(v(this, W), i, (r, o) => o.priority - r.priority);
|
|
302
302
|
v(this, W).splice(s, 0, i);
|
|
303
303
|
}
|
|
304
304
|
setPriority(e, t) {
|
|
@@ -320,57 +320,57 @@ class wi {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
W = new WeakMap();
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
var he, de, re, be, ue, Ee, V, ce, P, xe, K, fe, Z, Ce, Oe, D, Rt, Tt, Dt, zt, St, Te, qe, Be, De, kt, ze;
|
|
324
|
+
class wi extends pi {
|
|
325
325
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
326
326
|
constructor(t) {
|
|
327
327
|
var i, s;
|
|
328
328
|
super();
|
|
329
329
|
O(this, D);
|
|
330
|
+
O(this, he);
|
|
330
331
|
O(this, de);
|
|
332
|
+
O(this, re, 0);
|
|
333
|
+
O(this, be);
|
|
331
334
|
O(this, ue);
|
|
332
|
-
O(this,
|
|
333
|
-
O(this,
|
|
335
|
+
O(this, Ee, 0);
|
|
336
|
+
O(this, V);
|
|
334
337
|
O(this, ce);
|
|
335
|
-
O(this, xe, 0);
|
|
336
|
-
O(this, K);
|
|
337
|
-
O(this, fe);
|
|
338
338
|
O(this, P);
|
|
339
|
-
O(this,
|
|
340
|
-
O(this,
|
|
339
|
+
O(this, xe);
|
|
340
|
+
O(this, K, 0);
|
|
341
341
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
342
|
-
O(this,
|
|
342
|
+
O(this, fe);
|
|
343
343
|
O(this, Z);
|
|
344
|
-
O(this,
|
|
344
|
+
O(this, Ce);
|
|
345
345
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
346
|
-
O(this,
|
|
346
|
+
O(this, Oe, 1n);
|
|
347
347
|
/**
|
|
348
348
|
Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
|
|
349
349
|
|
|
350
350
|
Applies to each future operation.
|
|
351
351
|
*/
|
|
352
|
-
|
|
352
|
+
Je(this, "timeout");
|
|
353
353
|
if (t = {
|
|
354
354
|
carryoverConcurrencyCount: !1,
|
|
355
355
|
intervalCap: Number.POSITIVE_INFINITY,
|
|
356
356
|
interval: 0,
|
|
357
357
|
concurrency: Number.POSITIVE_INFINITY,
|
|
358
358
|
autoStart: !0,
|
|
359
|
-
queueClass:
|
|
359
|
+
queueClass: _i,
|
|
360
360
|
...t
|
|
361
361
|
}, !(typeof t.intervalCap == "number" && t.intervalCap >= 1))
|
|
362
362
|
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i = t.intervalCap) == null ? void 0 : i.toString()) ?? ""}\` (${typeof t.intervalCap})`);
|
|
363
363
|
if (t.interval === void 0 || !(Number.isFinite(t.interval) && t.interval >= 0))
|
|
364
364
|
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s = t.interval) == null ? void 0 : s.toString()) ?? ""}\` (${typeof t.interval})`);
|
|
365
|
-
N(this,
|
|
365
|
+
N(this, he, t.carryoverConcurrencyCount), N(this, de, t.intervalCap === Number.POSITIVE_INFINITY || t.interval === 0), N(this, be, t.intervalCap), N(this, ue, t.interval), N(this, P, new t.queueClass()), N(this, xe, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, N(this, Ce, t.throwOnTimeout === !0), N(this, Z, t.autoStart === !1);
|
|
366
366
|
}
|
|
367
367
|
get concurrency() {
|
|
368
|
-
return v(this,
|
|
368
|
+
return v(this, fe);
|
|
369
369
|
}
|
|
370
370
|
set concurrency(t) {
|
|
371
371
|
if (!(typeof t == "number" && t >= 1))
|
|
372
372
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
373
|
-
N(this,
|
|
373
|
+
N(this, fe, t), L(this, D, De).call(this);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -412,30 +412,30 @@ class Ei extends yi {
|
|
|
412
412
|
v(this, P).setPriority(t, i);
|
|
413
413
|
}
|
|
414
414
|
async add(t, i = {}) {
|
|
415
|
-
return i.id ?? (i.id = (
|
|
415
|
+
return i.id ?? (i.id = (me(this, Oe)._++).toString()), i = {
|
|
416
416
|
timeout: this.timeout,
|
|
417
|
-
throwOnTimeout: v(this,
|
|
417
|
+
throwOnTimeout: v(this, Ce),
|
|
418
418
|
...i
|
|
419
419
|
}, new Promise((s, r) => {
|
|
420
420
|
v(this, P).enqueue(async () => {
|
|
421
421
|
var o;
|
|
422
|
-
|
|
422
|
+
me(this, K)._++, me(this, re)._++;
|
|
423
423
|
try {
|
|
424
424
|
(o = i.signal) == null || o.throwIfAborted();
|
|
425
425
|
let n = t({ signal: i.signal });
|
|
426
|
-
i.timeout && (n =
|
|
427
|
-
const
|
|
428
|
-
s(
|
|
426
|
+
i.timeout && (n = yi(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, L(this, D, kt).call(this, i.signal)]));
|
|
427
|
+
const a = await n;
|
|
428
|
+
s(a), this.emit("completed", a);
|
|
429
429
|
} catch (n) {
|
|
430
|
-
if (n instanceof
|
|
430
|
+
if (n instanceof Ct && !i.throwOnTimeout) {
|
|
431
431
|
s();
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
434
|
r(n), this.emit("error", n);
|
|
435
435
|
} finally {
|
|
436
|
-
L(this, D,
|
|
436
|
+
L(this, D, Dt).call(this);
|
|
437
437
|
}
|
|
438
|
-
}, i), this.emit("add"), L(this, D,
|
|
438
|
+
}, i), this.emit("add"), L(this, D, Te).call(this);
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
async addAll(t, i) {
|
|
@@ -445,7 +445,7 @@ class Ei extends yi {
|
|
|
445
445
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
446
446
|
*/
|
|
447
447
|
start() {
|
|
448
|
-
return v(this, Z) ? (N(this, Z, !1), L(this, D,
|
|
448
|
+
return v(this, Z) ? (N(this, Z, !1), L(this, D, De).call(this), this) : this;
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
451
451
|
Put queue execution on hold.
|
|
@@ -457,7 +457,7 @@ class Ei extends yi {
|
|
|
457
457
|
Clear the queue.
|
|
458
458
|
*/
|
|
459
459
|
clear() {
|
|
460
|
-
N(this, P, new (v(this,
|
|
460
|
+
N(this, P, new (v(this, xe))());
|
|
461
461
|
}
|
|
462
462
|
/**
|
|
463
463
|
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
@@ -465,7 +465,7 @@ class Ei extends yi {
|
|
|
465
465
|
@returns A promise that settles when the queue becomes empty.
|
|
466
466
|
*/
|
|
467
467
|
async onEmpty() {
|
|
468
|
-
v(this, P).size !== 0 && await L(this, D,
|
|
468
|
+
v(this, P).size !== 0 && await L(this, D, ze).call(this, "empty");
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -475,7 +475,7 @@ class Ei extends yi {
|
|
|
475
475
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
476
476
|
*/
|
|
477
477
|
async onSizeLessThan(t) {
|
|
478
|
-
v(this, P).size < t || await L(this, D,
|
|
478
|
+
v(this, P).size < t || await L(this, D, ze).call(this, "next", () => v(this, P).size < t);
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
481
481
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -483,7 +483,7 @@ class Ei extends yi {
|
|
|
483
483
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
484
484
|
*/
|
|
485
485
|
async onIdle() {
|
|
486
|
-
v(this,
|
|
486
|
+
v(this, K) === 0 && v(this, P).size === 0 || await L(this, D, ze).call(this, "idle");
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
489
489
|
Size of the queue, the number of queued items waiting to run.
|
|
@@ -503,7 +503,7 @@ class Ei extends yi {
|
|
|
503
503
|
Number of running items (no longer in the queue).
|
|
504
504
|
*/
|
|
505
505
|
get pending() {
|
|
506
|
-
return v(this,
|
|
506
|
+
return v(this, K);
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
509
509
|
Whether the queue is currently paused.
|
|
@@ -512,56 +512,56 @@ class Ei extends yi {
|
|
|
512
512
|
return v(this, Z);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
|
|
516
|
-
return v(this,
|
|
515
|
+
he = new WeakMap(), de = new WeakMap(), re = new WeakMap(), be = new WeakMap(), ue = new WeakMap(), Ee = new WeakMap(), V = new WeakMap(), ce = new WeakMap(), P = new WeakMap(), xe = new WeakMap(), K = new WeakMap(), fe = new WeakMap(), Z = new WeakMap(), Ce = new WeakMap(), Oe = new WeakMap(), D = new WeakSet(), Rt = function() {
|
|
516
|
+
return v(this, de) || v(this, re) < v(this, be);
|
|
517
|
+
}, Tt = function() {
|
|
518
|
+
return v(this, K) < v(this, fe);
|
|
517
519
|
}, Dt = function() {
|
|
518
|
-
|
|
520
|
+
me(this, K)._--, L(this, D, Te).call(this), this.emit("next");
|
|
519
521
|
}, zt = function() {
|
|
520
|
-
|
|
522
|
+
L(this, D, Be).call(this), L(this, D, qe).call(this), N(this, ce, void 0);
|
|
521
523
|
}, St = function() {
|
|
522
|
-
L(this, D, Fe).call(this), L(this, D, $e).call(this), N(this, fe, void 0);
|
|
523
|
-
}, kt = function() {
|
|
524
524
|
const t = Date.now();
|
|
525
|
-
if (v(this,
|
|
526
|
-
const i = v(this,
|
|
525
|
+
if (v(this, V) === void 0) {
|
|
526
|
+
const i = v(this, Ee) - t;
|
|
527
527
|
if (i < 0)
|
|
528
|
-
N(this,
|
|
528
|
+
N(this, re, v(this, he) ? v(this, K) : 0);
|
|
529
529
|
else
|
|
530
|
-
return v(this,
|
|
531
|
-
L(this, D,
|
|
530
|
+
return v(this, ce) === void 0 && N(this, ce, setTimeout(() => {
|
|
531
|
+
L(this, D, zt).call(this);
|
|
532
532
|
}, i)), !0;
|
|
533
533
|
}
|
|
534
534
|
return !1;
|
|
535
|
-
},
|
|
535
|
+
}, Te = function() {
|
|
536
536
|
if (v(this, P).size === 0)
|
|
537
|
-
return v(this,
|
|
537
|
+
return v(this, V) && clearInterval(v(this, V)), N(this, V, void 0), this.emit("empty"), v(this, K) === 0 && this.emit("idle"), !1;
|
|
538
538
|
if (!v(this, Z)) {
|
|
539
|
-
const t = !v(this, D,
|
|
540
|
-
if (v(this, D,
|
|
539
|
+
const t = !v(this, D, St);
|
|
540
|
+
if (v(this, D, Rt) && v(this, D, Tt)) {
|
|
541
541
|
const i = v(this, P).dequeue();
|
|
542
|
-
return i ? (this.emit("active"), i(), t && L(this, D,
|
|
542
|
+
return i ? (this.emit("active"), i(), t && L(this, D, qe).call(this), !0) : !1;
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
return !1;
|
|
546
|
-
},
|
|
547
|
-
v(this,
|
|
548
|
-
L(this, D,
|
|
549
|
-
}, v(this,
|
|
550
|
-
},
|
|
551
|
-
v(this,
|
|
546
|
+
}, qe = function() {
|
|
547
|
+
v(this, de) || v(this, V) !== void 0 || (N(this, V, setInterval(() => {
|
|
548
|
+
L(this, D, Be).call(this);
|
|
549
|
+
}, v(this, ue))), N(this, Ee, Date.now() + v(this, ue)));
|
|
550
|
+
}, Be = function() {
|
|
551
|
+
v(this, re) === 0 && v(this, K) === 0 && v(this, V) && (clearInterval(v(this, V)), N(this, V, void 0)), N(this, re, v(this, he) ? v(this, K) : 0), L(this, D, De).call(this);
|
|
552
552
|
}, /**
|
|
553
553
|
Executes all queued functions until it reaches the limit.
|
|
554
554
|
*/
|
|
555
|
-
|
|
556
|
-
for (; L(this, D,
|
|
555
|
+
De = function() {
|
|
556
|
+
for (; L(this, D, Te).call(this); )
|
|
557
557
|
;
|
|
558
|
-
},
|
|
558
|
+
}, kt = async function(t) {
|
|
559
559
|
return new Promise((i, s) => {
|
|
560
560
|
t.addEventListener("abort", () => {
|
|
561
561
|
s(t.reason);
|
|
562
562
|
}, { once: !0 });
|
|
563
563
|
});
|
|
564
|
-
},
|
|
564
|
+
}, ze = async function(t, i) {
|
|
565
565
|
return new Promise((s) => {
|
|
566
566
|
const r = () => {
|
|
567
567
|
i && !i() || (this.off(t, r), s());
|
|
@@ -569,15 +569,15 @@ ze = function() {
|
|
|
569
569
|
this.on(t, r);
|
|
570
570
|
});
|
|
571
571
|
};
|
|
572
|
-
const
|
|
573
|
-
const u =
|
|
572
|
+
const bi = () => {
|
|
573
|
+
const u = bt(), e = ge(oe);
|
|
574
574
|
if (!e)
|
|
575
575
|
return;
|
|
576
576
|
if (e.queryFnOverride) {
|
|
577
577
|
console.warn("Detected incorrect use of useRequestQueue. This composable should not be used in nested components. Please discuss with team-data or report an issue if you feel you have a use case.");
|
|
578
578
|
return;
|
|
579
579
|
}
|
|
580
|
-
const t = new
|
|
580
|
+
const t = new wi({
|
|
581
581
|
carryoverConcurrencyCount: !0,
|
|
582
582
|
concurrency: u.maxParallelRequests,
|
|
583
583
|
interval: u.requestInterval,
|
|
@@ -587,12 +587,12 @@ const xi = () => {
|
|
|
587
587
|
queryFnOverride: !0,
|
|
588
588
|
queryFn: (s, r) => t.add(() => e.queryFn(s, r), { throwOnTimeout: !0 })
|
|
589
589
|
};
|
|
590
|
-
|
|
591
|
-
},
|
|
592
|
-
useI18n:
|
|
593
|
-
useEvaluateFeatureFlag:
|
|
594
|
-
useRequestQueue:
|
|
595
|
-
},
|
|
590
|
+
Lt(oe, i);
|
|
591
|
+
}, ve = {
|
|
592
|
+
useI18n: li,
|
|
593
|
+
useEvaluateFeatureFlag: ci,
|
|
594
|
+
useRequestQueue: bi
|
|
595
|
+
}, Ke = /* @__PURE__ */ F({
|
|
596
596
|
__name: "QueryDataProvider",
|
|
597
597
|
props: {
|
|
598
598
|
context: {},
|
|
@@ -602,73 +602,73 @@ const xi = () => {
|
|
|
602
602
|
},
|
|
603
603
|
emits: ["chart-data", "queryComplete"],
|
|
604
604
|
setup(u, { emit: e }) {
|
|
605
|
-
const t = u, i = e, { i18n: s } =
|
|
606
|
-
|
|
605
|
+
const t = u, i = e, { i18n: s } = ve.useI18n(), r = ge(oe), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, n = new AbortController();
|
|
606
|
+
$e(() => {
|
|
607
607
|
n.abort();
|
|
608
608
|
});
|
|
609
|
-
const
|
|
609
|
+
const a = (R, S, C) => {
|
|
610
610
|
const E = [];
|
|
611
|
-
return
|
|
612
|
-
}, { data:
|
|
613
|
-
var
|
|
611
|
+
return S && E.push(...S), E.push(...Bt(R, C)), E;
|
|
612
|
+
}, { data: d, error: l, isValidating: h } = Yt(o, async () => {
|
|
613
|
+
var R, S, C, E;
|
|
614
614
|
try {
|
|
615
615
|
let {
|
|
616
616
|
datasource: x,
|
|
617
|
-
...
|
|
617
|
+
...z
|
|
618
618
|
} = t.query;
|
|
619
619
|
x || (x = "basic");
|
|
620
|
-
const q =
|
|
621
|
-
let
|
|
622
|
-
|
|
623
|
-
...
|
|
620
|
+
const q = a(x, t.query.filters, t.context.filters);
|
|
621
|
+
let U = t.query.time_range;
|
|
622
|
+
U ? U.tz || (U = {
|
|
623
|
+
...U,
|
|
624
624
|
tz: t.context.tz
|
|
625
|
-
}) :
|
|
625
|
+
}) : U = {
|
|
626
626
|
...t.context.timeSpec,
|
|
627
627
|
tz: t.context.tz
|
|
628
628
|
};
|
|
629
|
-
const
|
|
629
|
+
const Re = {
|
|
630
630
|
datasource: x,
|
|
631
631
|
query: {
|
|
632
|
-
...
|
|
633
|
-
time_range:
|
|
632
|
+
...z,
|
|
633
|
+
time_range: U,
|
|
634
634
|
filters: q
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
|
-
return r == null ? void 0 : r.queryFn(
|
|
637
|
+
return r == null ? void 0 : r.queryFn(Re, n);
|
|
638
638
|
} catch (x) {
|
|
639
|
-
m.value = ((
|
|
639
|
+
m.value = ((S = (R = x == null ? void 0 : x.response) == null ? void 0 : R.data) == null ? void 0 : S.message) === "Range not allowed for this tier" ? s.t("queryDataProvider.timeRangeExceeded") : ((E = (C = x == null ? void 0 : x.response) == null ? void 0 : C.data) == null ? void 0 : E.message) || (x == null ? void 0 : x.message);
|
|
640
640
|
} finally {
|
|
641
641
|
i("queryComplete");
|
|
642
642
|
}
|
|
643
643
|
}, {
|
|
644
644
|
refreshInterval: t.context.refreshInterval,
|
|
645
645
|
revalidateOnFocus: !1
|
|
646
|
-
}), { state: f, swrvState:
|
|
647
|
-
return
|
|
648
|
-
|
|
649
|
-
}), (
|
|
650
|
-
const
|
|
651
|
-
return
|
|
646
|
+
}), { state: f, swrvState: p } = ii(d, l, h), m = B(null), y = H(() => f.value === p.ERROR || !!m.value), g = H(() => !t.queryReady || f.value === p.PENDING);
|
|
647
|
+
return Ue(d, (R) => {
|
|
648
|
+
R && i("chart-data", R);
|
|
649
|
+
}), (R, S) => {
|
|
650
|
+
const C = ne("KSkeleton"), E = ne("KEmptyState");
|
|
651
|
+
return g.value || !k(d) && !y.value ? (T(), A(C, {
|
|
652
652
|
key: 0,
|
|
653
653
|
class: "chart-skeleton",
|
|
654
654
|
type: "table"
|
|
655
|
-
})) : y.value ? (T(),
|
|
655
|
+
})) : y.value ? (T(), A(E, {
|
|
656
656
|
key: 1,
|
|
657
657
|
"action-button-visible": !1,
|
|
658
658
|
"data-testid": "chart-empty-state",
|
|
659
659
|
"icon-variant": "error"
|
|
660
660
|
}, {
|
|
661
661
|
default: M(() => [
|
|
662
|
-
|
|
662
|
+
ye(ee(m.value), 1)
|
|
663
663
|
]),
|
|
664
664
|
_: 1
|
|
665
|
-
})) :
|
|
665
|
+
})) : k(d) ? Le(R.$slots, "default", {
|
|
666
666
|
key: 2,
|
|
667
|
-
data:
|
|
667
|
+
data: k(d)
|
|
668
668
|
}) : X("", !0);
|
|
669
669
|
};
|
|
670
670
|
}
|
|
671
|
-
}),
|
|
671
|
+
}), Ei = /* @__PURE__ */ F({
|
|
672
672
|
__name: "SimpleChartRenderer",
|
|
673
673
|
props: {
|
|
674
674
|
query: {},
|
|
@@ -679,21 +679,21 @@ const xi = () => {
|
|
|
679
679
|
refreshCounter: {}
|
|
680
680
|
},
|
|
681
681
|
setup(u) {
|
|
682
|
-
|
|
682
|
+
Ge((i) => ({
|
|
683
683
|
"35a26ebf": `${i.height}px`
|
|
684
684
|
}));
|
|
685
|
-
const e = u, t =
|
|
686
|
-
return (i, s) => (T(),
|
|
685
|
+
const e = u, t = H(() => e.chartOptions.type === "single_value");
|
|
686
|
+
return (i, s) => (T(), A(Ke, {
|
|
687
687
|
context: i.context,
|
|
688
688
|
query: i.query,
|
|
689
689
|
"query-ready": i.queryReady,
|
|
690
690
|
"refresh-counter": i.refreshCounter
|
|
691
691
|
}, {
|
|
692
692
|
default: M(({ data: r }) => [
|
|
693
|
-
|
|
694
|
-
class:
|
|
693
|
+
le("div", {
|
|
694
|
+
class: Fe(["analytics-chart", { "single-value": t.value }])
|
|
695
695
|
}, [
|
|
696
|
-
te(
|
|
696
|
+
te(k(Ft), {
|
|
697
697
|
"chart-data": r,
|
|
698
698
|
"chart-options": i.chartOptions,
|
|
699
699
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.syntheticsDataKey
|
|
@@ -703,12 +703,12 @@ const xi = () => {
|
|
|
703
703
|
_: 1
|
|
704
704
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
705
705
|
}
|
|
706
|
-
}),
|
|
706
|
+
}), ae = (u, e) => {
|
|
707
707
|
const t = u.__vccOpts || u;
|
|
708
708
|
for (const [i, s] of e)
|
|
709
709
|
t[i] = s;
|
|
710
710
|
return t;
|
|
711
|
-
},
|
|
711
|
+
}, nt = /* @__PURE__ */ ae(Ei, [["__scopeId", "data-v-65cc8607"]]), xi = { class: "analytics-chart" }, Ci = /* @__PURE__ */ F({
|
|
712
712
|
__name: "BaseAnalyticsChartRenderer",
|
|
713
713
|
props: {
|
|
714
714
|
query: {},
|
|
@@ -721,57 +721,56 @@ const xi = () => {
|
|
|
721
721
|
},
|
|
722
722
|
emits: ["edit-tile", "chart-data"],
|
|
723
723
|
setup(u, { emit: e }) {
|
|
724
|
-
const t = u, i = e, { i18n: s } =
|
|
724
|
+
const t = u, i = e, { i18n: s } = ve.useI18n(), r = H(() => ({
|
|
725
725
|
type: t.chartOptions.type,
|
|
726
726
|
stacked: t.chartOptions.stacked ?? !1,
|
|
727
727
|
chartDatasetColors: t.chartOptions.chartDatasetColors,
|
|
728
728
|
threshold: t.chartOptions.threshold
|
|
729
|
-
})),
|
|
729
|
+
})), o = () => {
|
|
730
730
|
i("edit-tile");
|
|
731
|
-
},
|
|
731
|
+
}, n = (a) => {
|
|
732
732
|
i("chart-data", a);
|
|
733
733
|
};
|
|
734
|
-
return (a,
|
|
735
|
-
const
|
|
736
|
-
return T(),
|
|
734
|
+
return (a, d) => {
|
|
735
|
+
const l = ne("KDropdownItem");
|
|
736
|
+
return T(), A(Ke, {
|
|
737
737
|
context: a.context,
|
|
738
738
|
query: a.query,
|
|
739
739
|
"query-ready": a.queryReady,
|
|
740
740
|
"refresh-counter": a.refreshCounter,
|
|
741
|
-
onChartData:
|
|
741
|
+
onChartData: n
|
|
742
742
|
}, {
|
|
743
|
-
default: M(({ data:
|
|
744
|
-
|
|
745
|
-
te(
|
|
743
|
+
default: M(({ data: h }) => [
|
|
744
|
+
le("div", xi, [
|
|
745
|
+
te(k(Wt), gt({
|
|
746
746
|
"allow-csv-export": a.chartOptions.allowCsvExport,
|
|
747
|
-
"chart-data":
|
|
748
|
-
"chart-options":
|
|
749
|
-
"chart-title": !z(o) && a.chartOptions.chartTitle || "",
|
|
747
|
+
"chart-data": h,
|
|
748
|
+
"chart-options": r.value,
|
|
750
749
|
"legend-position": "bottom",
|
|
751
750
|
"show-menu": a.context.editable,
|
|
752
751
|
"synthetics-data-key": a.chartOptions.syntheticsDataKey,
|
|
753
752
|
"tooltip-title": ""
|
|
754
|
-
}, a.extraProps),
|
|
753
|
+
}, a.extraProps), pt({ _: 2 }, [
|
|
755
754
|
a.context.editable ? {
|
|
756
755
|
name: "menu-items",
|
|
757
756
|
fn: M(() => [
|
|
758
|
-
te(
|
|
757
|
+
te(l, { onClick: o }, {
|
|
759
758
|
default: M(() => [
|
|
760
|
-
|
|
759
|
+
ye(ee(k(s).t("renderer.edit")), 1)
|
|
761
760
|
]),
|
|
762
761
|
_: 1
|
|
763
762
|
})
|
|
764
763
|
]),
|
|
765
764
|
key: "0"
|
|
766
765
|
} : void 0
|
|
767
|
-
]), 1040, ["allow-csv-export", "chart-data", "chart-options", "
|
|
766
|
+
]), 1040, ["allow-csv-export", "chart-data", "chart-options", "show-menu", "synthetics-data-key"])
|
|
768
767
|
])
|
|
769
768
|
]),
|
|
770
769
|
_: 1
|
|
771
770
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
772
771
|
};
|
|
773
772
|
}
|
|
774
|
-
}),
|
|
773
|
+
}), Ye = /* @__PURE__ */ ae(Ci, [["__scopeId", "data-v-85aa2302"]]), ot = /* @__PURE__ */ F({
|
|
775
774
|
__name: "BarChartRenderer",
|
|
776
775
|
props: {
|
|
777
776
|
query: {},
|
|
@@ -782,7 +781,7 @@ const xi = () => {
|
|
|
782
781
|
refreshCounter: {}
|
|
783
782
|
},
|
|
784
783
|
setup(u) {
|
|
785
|
-
return (e, t) => (T(),
|
|
784
|
+
return (e, t) => (T(), A(Ye, {
|
|
786
785
|
"chart-options": e.chartOptions,
|
|
787
786
|
context: e.context,
|
|
788
787
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -792,7 +791,7 @@ const xi = () => {
|
|
|
792
791
|
"refresh-counter": e.refreshCounter
|
|
793
792
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
794
793
|
}
|
|
795
|
-
}),
|
|
794
|
+
}), at = /* @__PURE__ */ F({
|
|
796
795
|
__name: "TimeseriesChartRenderer",
|
|
797
796
|
props: {
|
|
798
797
|
query: {},
|
|
@@ -803,7 +802,7 @@ const xi = () => {
|
|
|
803
802
|
refreshCounter: {}
|
|
804
803
|
},
|
|
805
804
|
setup(u) {
|
|
806
|
-
return (e, t) => (T(),
|
|
805
|
+
return (e, t) => (T(), A(Ye, {
|
|
807
806
|
"chart-options": e.chartOptions,
|
|
808
807
|
context: e.context,
|
|
809
808
|
height: e.height,
|
|
@@ -812,7 +811,7 @@ const xi = () => {
|
|
|
812
811
|
"refresh-counter": e.refreshCounter
|
|
813
812
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
814
813
|
}
|
|
815
|
-
}),
|
|
814
|
+
}), Ri = { class: "metric-card-tile-wrapper" }, Ti = /* @__PURE__ */ F({
|
|
816
815
|
__name: "GoldenSignalsRenderer",
|
|
817
816
|
props: {
|
|
818
817
|
query: {},
|
|
@@ -823,71 +822,64 @@ const xi = () => {
|
|
|
823
822
|
refreshCounter: {}
|
|
824
823
|
},
|
|
825
824
|
setup(u) {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}));
|
|
831
|
-
const e = u, { evaluateFeatureFlag: t } = ie.useEvaluateFeatureFlag(), i = t("ma-3043-analytics-chart-kebab-menu", !1), s = A(() => {
|
|
832
|
-
const o = e.context.timeSpec;
|
|
833
|
-
if (o.type === "absolute")
|
|
834
|
-
return new Ut({
|
|
825
|
+
const e = u, t = H(() => {
|
|
826
|
+
const s = e.context.timeSpec;
|
|
827
|
+
if (s.type === "absolute")
|
|
828
|
+
return new $t({
|
|
835
829
|
key: "custom",
|
|
836
830
|
timeframeText: "custom",
|
|
837
831
|
display: "custom",
|
|
838
|
-
startCustom:
|
|
839
|
-
endCustom:
|
|
840
|
-
timeframeLength: () =>
|
|
832
|
+
startCustom: s.start,
|
|
833
|
+
endCustom: s.end,
|
|
834
|
+
timeframeLength: () => s.end.getTime() - s.start.getTime(),
|
|
841
835
|
defaultResponseGranularity: "daily",
|
|
842
836
|
dataGranularity: "daily",
|
|
843
837
|
isRelative: !1,
|
|
844
838
|
allowedTiers: ["free", "plus", "enterprise"]
|
|
845
839
|
});
|
|
846
|
-
const
|
|
847
|
-
if (!
|
|
840
|
+
const r = wt.get(s.time_range);
|
|
841
|
+
if (!r)
|
|
848
842
|
throw new Error("Unknown time range");
|
|
849
|
-
return
|
|
850
|
-
}),
|
|
851
|
-
var
|
|
852
|
-
const
|
|
853
|
-
if (
|
|
854
|
-
throw new Error(`Invalid datasource value: ${
|
|
843
|
+
return r;
|
|
844
|
+
}), i = H(() => {
|
|
845
|
+
var r, o;
|
|
846
|
+
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
847
|
+
if (s && s !== "advanced" && s !== "basic")
|
|
848
|
+
throw new Error(`Invalid datasource value: ${s}`);
|
|
855
849
|
return {
|
|
856
|
-
datasource: (
|
|
857
|
-
overrideTimeframe:
|
|
850
|
+
datasource: (o = e.query) == null ? void 0 : o.datasource,
|
|
851
|
+
overrideTimeframe: t.value,
|
|
858
852
|
tz: e.context.tz,
|
|
859
853
|
additionalFilter: e.context.filters,
|
|
860
854
|
// TODO: Decide how to handle metric card filters.
|
|
861
855
|
longCardTitles: e.chartOptions.longCardTitles,
|
|
862
|
-
...!i && { containerTitle: e.chartOptions.chartTitle },
|
|
863
|
-
...!i && { description: e.chartOptions.description },
|
|
864
856
|
percentileLatency: e.chartOptions.percentileLatency,
|
|
865
857
|
refreshInterval: e.context.refreshInterval,
|
|
866
858
|
queryReady: e.queryReady,
|
|
867
859
|
refreshCounter: e.refreshCounter
|
|
868
860
|
};
|
|
869
861
|
});
|
|
870
|
-
return (
|
|
871
|
-
te(
|
|
862
|
+
return (s, r) => (T(), $("div", Ri, [
|
|
863
|
+
te(k(Qt), Mt(It(i.value)), {
|
|
872
864
|
default: M(() => [
|
|
873
|
-
te(
|
|
865
|
+
te(k(Jt))
|
|
874
866
|
]),
|
|
875
867
|
_: 1
|
|
876
868
|
}, 16)
|
|
877
869
|
]));
|
|
878
870
|
}
|
|
879
|
-
}),
|
|
871
|
+
}), Di = /* @__PURE__ */ ae(Ti, [["__scopeId", "data-v-bd5889d1"]]), lt = "#6c7489", ht = "20px", Nt = "20px", zi = {
|
|
880
872
|
class: "fallback-entity-link",
|
|
881
873
|
"data-testid": "entity-link-parent"
|
|
882
|
-
},
|
|
874
|
+
}, dt = /* @__PURE__ */ F({
|
|
883
875
|
__name: "FallbackEntityLink",
|
|
884
876
|
props: {
|
|
885
877
|
entityLinkData: {}
|
|
886
878
|
},
|
|
887
879
|
setup(u) {
|
|
888
|
-
return (e, t) => (T(), $("div",
|
|
880
|
+
return (e, t) => (T(), $("div", zi, ee(e.entityLinkData.label), 1));
|
|
889
881
|
}
|
|
890
|
-
}),
|
|
882
|
+
}), Si = /* @__PURE__ */ F({
|
|
891
883
|
__name: "TopNTableRenderer",
|
|
892
884
|
props: {
|
|
893
885
|
query: {},
|
|
@@ -898,57 +890,55 @@ const xi = () => {
|
|
|
898
890
|
refreshCounter: {}
|
|
899
891
|
},
|
|
900
892
|
setup(u) {
|
|
901
|
-
const e = u,
|
|
902
|
-
if (
|
|
893
|
+
const e = u, t = ge(oe), i = Pt(async () => {
|
|
894
|
+
if (t != null && t.fetchComponent)
|
|
903
895
|
try {
|
|
904
|
-
return await
|
|
896
|
+
return await t.fetchComponent("EntityLink");
|
|
905
897
|
} catch {
|
|
906
|
-
return
|
|
898
|
+
return dt;
|
|
907
899
|
}
|
|
908
|
-
return
|
|
909
|
-
}),
|
|
910
|
-
var
|
|
911
|
-
if ((
|
|
912
|
-
if (
|
|
913
|
-
const [
|
|
914
|
-
return e.chartOptions.entityLink.replace(
|
|
900
|
+
return dt;
|
|
901
|
+
}), s = (r) => {
|
|
902
|
+
var o;
|
|
903
|
+
if ((o = e.chartOptions) != null && o.entityLink)
|
|
904
|
+
if (r.id.includes(":")) {
|
|
905
|
+
const [n, a] = r.id.split(":");
|
|
906
|
+
return e.chartOptions.entityLink.replace(hi, n).replace(it, a);
|
|
915
907
|
} else
|
|
916
|
-
return e.chartOptions.entityLink.replace(
|
|
908
|
+
return e.chartOptions.entityLink.replace(it, r.id);
|
|
917
909
|
return "";
|
|
918
910
|
};
|
|
919
|
-
return (
|
|
920
|
-
context:
|
|
921
|
-
query:
|
|
922
|
-
"query-ready":
|
|
923
|
-
"refresh-counter":
|
|
911
|
+
return (r, o) => (T(), A(Ke, {
|
|
912
|
+
context: r.context,
|
|
913
|
+
query: r.query,
|
|
914
|
+
"query-ready": r.queryReady,
|
|
915
|
+
"refresh-counter": r.refreshCounter
|
|
924
916
|
}, {
|
|
925
|
-
default: M(({ data:
|
|
926
|
-
te(
|
|
927
|
-
data:
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
title: !z(i) && n.chartOptions.chartTitle || ""
|
|
931
|
-
}, mt({ _: 2 }, [
|
|
917
|
+
default: M(({ data: n }) => [
|
|
918
|
+
te(k(Vt), {
|
|
919
|
+
data: n,
|
|
920
|
+
"synthetics-data-key": r.chartOptions.syntheticsDataKey
|
|
921
|
+
}, pt({ _: 2 }, [
|
|
932
922
|
e.chartOptions.entityLink ? {
|
|
933
923
|
name: "name",
|
|
934
924
|
fn: M(({ record: a }) => [
|
|
935
|
-
te(
|
|
925
|
+
te(k(i), {
|
|
936
926
|
"entity-link-data": {
|
|
937
927
|
id: a.id,
|
|
938
928
|
label: a.name,
|
|
939
929
|
deleted: a.deleted
|
|
940
930
|
},
|
|
941
|
-
"external-link":
|
|
931
|
+
"external-link": s(a)
|
|
942
932
|
}, null, 8, ["entity-link-data", "external-link"])
|
|
943
933
|
]),
|
|
944
934
|
key: "0"
|
|
945
935
|
} : void 0
|
|
946
|
-
]), 1032, ["data", "
|
|
936
|
+
]), 1032, ["data", "synthetics-data-key"])
|
|
947
937
|
]),
|
|
948
938
|
_: 1
|
|
949
939
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
950
940
|
}
|
|
951
|
-
}),
|
|
941
|
+
}), ki = /* @__PURE__ */ F({
|
|
952
942
|
__name: "DonutChartRenderer",
|
|
953
943
|
props: {
|
|
954
944
|
query: {},
|
|
@@ -959,7 +949,7 @@ const xi = () => {
|
|
|
959
949
|
refreshCounter: {}
|
|
960
950
|
},
|
|
961
951
|
setup(u) {
|
|
962
|
-
return (e, t) => (T(),
|
|
952
|
+
return (e, t) => (T(), A(Ye, {
|
|
963
953
|
"chart-options": e.chartOptions,
|
|
964
954
|
context: e.context,
|
|
965
955
|
height: e.height,
|
|
@@ -968,10 +958,10 @@ const xi = () => {
|
|
|
968
958
|
"refresh-counter": e.refreshCounter
|
|
969
959
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
970
960
|
}
|
|
971
|
-
}),
|
|
961
|
+
}), Ni = ["data-testid"], Hi = {
|
|
972
962
|
key: 0,
|
|
973
963
|
class: "tile-header"
|
|
974
|
-
},
|
|
964
|
+
}, Ai = ["data-testid"], Oi = ["data-testid"], Li = ["data-testid"], Mi = ["data-testid"], Ii = /* @__PURE__ */ F({
|
|
975
965
|
__name: "DashboardTile",
|
|
976
966
|
props: {
|
|
977
967
|
definition: {},
|
|
@@ -983,45 +973,45 @@ const xi = () => {
|
|
|
983
973
|
},
|
|
984
974
|
emits: ["edit-tile", "remove-tile"],
|
|
985
975
|
setup(u, { emit: e }) {
|
|
986
|
-
|
|
987
|
-
|
|
976
|
+
Ge((w) => ({
|
|
977
|
+
"7cb73d6a": `${w.height}px`
|
|
988
978
|
}));
|
|
989
|
-
const t = parseInt(
|
|
990
|
-
|
|
991
|
-
var
|
|
992
|
-
|
|
993
|
-
}),
|
|
994
|
-
await
|
|
979
|
+
const t = parseInt(Nt, 10), i = u, s = e, r = ge(oe), { i18n: o } = ve.useI18n(), n = B(), a = B(!1), d = B(), l = B(!1), h = B("");
|
|
980
|
+
We(async () => {
|
|
981
|
+
var w;
|
|
982
|
+
h.value = await ((w = r == null ? void 0 : r.exploreBaseUrl) == null ? void 0 : w.call(r)) ?? "";
|
|
983
|
+
}), Ue(() => i.definition, async () => {
|
|
984
|
+
await mt(), d.value && (l.value = d.value.scrollWidth > d.value.clientWidth);
|
|
995
985
|
}, { immediate: !0, deep: !0 });
|
|
996
|
-
const
|
|
997
|
-
if (!
|
|
986
|
+
const f = H(() => {
|
|
987
|
+
if (!h.value || !i.definition.query || !y.value)
|
|
998
988
|
return "";
|
|
999
|
-
const
|
|
1000
|
-
if (
|
|
989
|
+
const w = [...i.context.filters, ...i.definition.query.filters ?? []], ie = i.definition.query.dimensions ?? [], Y = /* @__PURE__ */ new Set(["portal", "api"]);
|
|
990
|
+
if (w.some((se) => "dimension" in se && Y.has(se.dimension) || "field" in se && Y.has(se.field)) || ie.some((se) => Y.has(se)))
|
|
1001
991
|
return "";
|
|
1002
|
-
const
|
|
1003
|
-
filters:
|
|
992
|
+
const Ie = {
|
|
993
|
+
filters: w,
|
|
1004
994
|
metrics: i.definition.query.metrics ?? [],
|
|
1005
|
-
dimensions:
|
|
995
|
+
dimensions: ie,
|
|
1006
996
|
time_range: i.definition.query.time_range || i.context.timeSpec,
|
|
1007
|
-
granularity: i.definition.query.granularity ||
|
|
1008
|
-
},
|
|
1009
|
-
return `${
|
|
1010
|
-
}),
|
|
1011
|
-
timeseries_line:
|
|
1012
|
-
timeseries_bar:
|
|
1013
|
-
horizontal_bar:
|
|
1014
|
-
vertical_bar:
|
|
1015
|
-
gauge:
|
|
1016
|
-
donut:
|
|
1017
|
-
golden_signals:
|
|
1018
|
-
top_n:
|
|
997
|
+
granularity: i.definition.query.granularity || E.value
|
|
998
|
+
}, pe = ["advanced", "ai"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "advanced";
|
|
999
|
+
return `${h.value}?q=${JSON.stringify(Ie)}&d=${pe}&c=${i.definition.chart.type}`;
|
|
1000
|
+
}), p = H(() => o.t("csvExport.defaultFilename")), m = H(() => y.value && (g.value || i.context.editable) || !!C.value), y = H(() => !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), g = H(() => !!f.value || "allowCsvExport" in i.definition.chart && i.definition.chart.allowCsvExport || i.context.editable), R = {
|
|
1001
|
+
timeseries_line: at,
|
|
1002
|
+
timeseries_bar: at,
|
|
1003
|
+
horizontal_bar: ot,
|
|
1004
|
+
vertical_bar: ot,
|
|
1005
|
+
gauge: nt,
|
|
1006
|
+
donut: ki,
|
|
1007
|
+
golden_signals: Di,
|
|
1008
|
+
top_n: Si,
|
|
1019
1009
|
slottable: void 0,
|
|
1020
|
-
single_value:
|
|
1021
|
-
},
|
|
1022
|
-
const
|
|
1023
|
-
return
|
|
1024
|
-
component:
|
|
1010
|
+
single_value: nt
|
|
1011
|
+
}, S = H(() => {
|
|
1012
|
+
const w = R[i.definition.chart.type];
|
|
1013
|
+
return w && {
|
|
1014
|
+
component: w,
|
|
1025
1015
|
rendererProps: {
|
|
1026
1016
|
query: i.definition.query,
|
|
1027
1017
|
context: i.context,
|
|
@@ -1031,149 +1021,149 @@ const xi = () => {
|
|
|
1031
1021
|
refreshCounter: i.refreshCounter
|
|
1032
1022
|
}
|
|
1033
1023
|
};
|
|
1034
|
-
}),
|
|
1035
|
-
var
|
|
1036
|
-
const
|
|
1037
|
-
if ((
|
|
1038
|
-
const Y = wt.get(
|
|
1039
|
-
return Y ? Y.display : (console.warn("Did not recognize the given relative time range:",
|
|
1040
|
-
} else if ((
|
|
1041
|
-
const Y =
|
|
1042
|
-
return `${
|
|
1024
|
+
}), C = H(() => {
|
|
1025
|
+
var ie;
|
|
1026
|
+
const w = (ie = i.definition.query) == null ? void 0 : ie.time_range;
|
|
1027
|
+
if ((w == null ? void 0 : w.type) === "relative") {
|
|
1028
|
+
const Y = wt.get(Ut[w.time_range]);
|
|
1029
|
+
return Y ? Y.display : (console.warn("Did not recognize the given relative time range:", w.time_range), w.time_range);
|
|
1030
|
+
} else if ((w == null ? void 0 : w.type) === "absolute") {
|
|
1031
|
+
const Y = w.tz || "Etc/UTC";
|
|
1032
|
+
return `${tt(w.start, { short: !0, tz: Y })} - ${tt(w.end, { short: !0, tz: Y })}`;
|
|
1043
1033
|
}
|
|
1044
1034
|
return null;
|
|
1045
|
-
}),
|
|
1035
|
+
}), E = H(() => n.value ? Gt(n.value.meta.granularity_ms) : void 0), x = () => {
|
|
1046
1036
|
s("edit-tile", i.definition);
|
|
1047
|
-
},
|
|
1037
|
+
}, z = () => {
|
|
1048
1038
|
s("remove-tile", i.definition);
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1051
|
-
},
|
|
1052
|
-
a.value =
|
|
1053
|
-
},
|
|
1054
|
-
|
|
1039
|
+
}, q = (w) => {
|
|
1040
|
+
n.value = w;
|
|
1041
|
+
}, U = (w) => {
|
|
1042
|
+
a.value = w;
|
|
1043
|
+
}, Re = () => {
|
|
1044
|
+
U(!0);
|
|
1055
1045
|
};
|
|
1056
|
-
return (
|
|
1057
|
-
const Y =
|
|
1046
|
+
return (w, ie) => {
|
|
1047
|
+
const Y = ne("KTooltip"), Ie = ne("KBadge"), pe = ne("KDropdownItem"), se = ne("KDropdown");
|
|
1058
1048
|
return T(), $("div", {
|
|
1059
|
-
class:
|
|
1060
|
-
"data-testid": `tile-${
|
|
1049
|
+
class: Fe(["tile-boundary", { editable: w.context.editable }]),
|
|
1050
|
+
"data-testid": `tile-${w.tileId}`
|
|
1061
1051
|
}, [
|
|
1062
|
-
|
|
1052
|
+
w.definition.chart.type !== "slottable" ? (T(), $("div", Hi, [
|
|
1063
1053
|
te(Y, {
|
|
1064
1054
|
class: "title-tooltip",
|
|
1065
|
-
disabled: !
|
|
1055
|
+
disabled: !l.value,
|
|
1066
1056
|
"max-width": "500",
|
|
1067
|
-
text:
|
|
1057
|
+
text: w.definition.chart.chartTitle
|
|
1068
1058
|
}, {
|
|
1069
1059
|
default: M(() => [
|
|
1070
|
-
|
|
1060
|
+
le("div", {
|
|
1071
1061
|
ref_key: "titleRef",
|
|
1072
|
-
ref:
|
|
1062
|
+
ref: d,
|
|
1073
1063
|
class: "title"
|
|
1074
|
-
}, ee(
|
|
1064
|
+
}, ee(w.definition.chart.chartTitle), 513)
|
|
1075
1065
|
]),
|
|
1076
1066
|
_: 1
|
|
1077
1067
|
}, 8, ["disabled", "text"]),
|
|
1078
|
-
|
|
1068
|
+
m.value ? (T(), $("div", {
|
|
1079
1069
|
key: 0,
|
|
1080
1070
|
class: "tile-actions",
|
|
1081
|
-
"data-testid": `tile-actions-${
|
|
1071
|
+
"data-testid": `tile-actions-${w.tileId}`
|
|
1082
1072
|
}, [
|
|
1083
|
-
|
|
1073
|
+
C.value ? (T(), A(Ie, { key: 0 }, {
|
|
1084
1074
|
default: M(() => [
|
|
1085
|
-
|
|
1075
|
+
ye(ee(C.value), 1)
|
|
1086
1076
|
]),
|
|
1087
1077
|
_: 1
|
|
1088
1078
|
})) : X("", !0),
|
|
1089
|
-
|
|
1079
|
+
y.value && w.context.editable ? (T(), A(k(Zt), {
|
|
1090
1080
|
key: 1,
|
|
1091
1081
|
class: "edit-icon",
|
|
1092
|
-
color:
|
|
1093
|
-
"data-testid": `edit-tile-${
|
|
1094
|
-
size:
|
|
1095
|
-
onClick:
|
|
1082
|
+
color: k(lt),
|
|
1083
|
+
"data-testid": `edit-tile-${w.tileId}`,
|
|
1084
|
+
size: k(ht),
|
|
1085
|
+
onClick: x
|
|
1096
1086
|
}, null, 8, ["color", "data-testid", "size"])) : X("", !0),
|
|
1097
|
-
|
|
1087
|
+
y.value && g.value ? (T(), A(se, {
|
|
1098
1088
|
key: 2,
|
|
1099
1089
|
class: "dropdown",
|
|
1100
|
-
"data-testid": `chart-action-menu-${
|
|
1090
|
+
"data-testid": `chart-action-menu-${w.tileId}`,
|
|
1101
1091
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1102
1092
|
}, {
|
|
1103
1093
|
items: M(() => [
|
|
1104
|
-
|
|
1094
|
+
f.value ? (T(), A(pe, {
|
|
1105
1095
|
key: 0,
|
|
1106
|
-
"data-testid": `chart-jump-to-explore-${
|
|
1107
|
-
item: { label:
|
|
1096
|
+
"data-testid": `chart-jump-to-explore-${w.tileId}`,
|
|
1097
|
+
item: { label: k(o).t("jumpToExplore"), to: f.value }
|
|
1108
1098
|
}, null, 8, ["data-testid", "item"])) : X("", !0),
|
|
1109
|
-
"allowCsvExport" in
|
|
1099
|
+
!("allowCsvExport" in w.definition.chart) || w.definition.chart.allowCsvExport ? (T(), A(pe, {
|
|
1110
1100
|
key: 1,
|
|
1111
1101
|
class: "chart-export-button",
|
|
1112
|
-
"data-testid": `chart-csv-export-${
|
|
1113
|
-
onClick:
|
|
1102
|
+
"data-testid": `chart-csv-export-${w.tileId}`,
|
|
1103
|
+
onClick: ie[0] || (ie[0] = (Zi) => Re())
|
|
1114
1104
|
}, {
|
|
1115
1105
|
default: M(() => [
|
|
1116
|
-
|
|
1106
|
+
le("span", {
|
|
1117
1107
|
class: "chart-export-trigger",
|
|
1118
|
-
"data-testid": `csv-export-button-${
|
|
1119
|
-
}, ee(
|
|
1108
|
+
"data-testid": `csv-export-button-${w.tileId}`
|
|
1109
|
+
}, ee(k(o).t("csvExport.exportAsCsv")), 9, Oi)
|
|
1120
1110
|
]),
|
|
1121
1111
|
_: 1
|
|
1122
1112
|
}, 8, ["data-testid"])) : X("", !0),
|
|
1123
|
-
|
|
1113
|
+
w.context.editable ? (T(), A(pe, {
|
|
1124
1114
|
key: 2,
|
|
1125
|
-
"data-testid": `remove-tile-${
|
|
1126
|
-
onClick:
|
|
1115
|
+
"data-testid": `remove-tile-${w.tileId}`,
|
|
1116
|
+
onClick: z
|
|
1127
1117
|
}, {
|
|
1128
1118
|
default: M(() => [
|
|
1129
|
-
|
|
1119
|
+
ye(ee(k(o).t("renderer.remove")), 1)
|
|
1130
1120
|
]),
|
|
1131
1121
|
_: 1
|
|
1132
1122
|
}, 8, ["data-testid"])) : X("", !0)
|
|
1133
1123
|
]),
|
|
1134
1124
|
default: M(() => [
|
|
1135
|
-
te(
|
|
1125
|
+
te(k(ei), {
|
|
1136
1126
|
class: "kebab-action-menu",
|
|
1137
|
-
color:
|
|
1138
|
-
"data-testid": `kebab-action-menu-${
|
|
1139
|
-
size:
|
|
1127
|
+
color: k(lt),
|
|
1128
|
+
"data-testid": `kebab-action-menu-${w.tileId}`,
|
|
1129
|
+
size: k(ht)
|
|
1140
1130
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1141
1131
|
]),
|
|
1142
1132
|
_: 1
|
|
1143
1133
|
}, 8, ["data-testid"])) : X("", !0)
|
|
1144
|
-
], 8,
|
|
1134
|
+
], 8, Ai)) : "description" in w.definition.chart ? (T(), $("div", {
|
|
1145
1135
|
key: 1,
|
|
1146
1136
|
class: "header-description",
|
|
1147
|
-
"data-testid": `tile-description-${
|
|
1148
|
-
}, ee(
|
|
1149
|
-
a.value ? (T(),
|
|
1137
|
+
"data-testid": `tile-description-${w.tileId}`
|
|
1138
|
+
}, ee(w.definition.chart.description), 9, Li)) : X("", !0),
|
|
1139
|
+
a.value ? (T(), A(k(Kt), {
|
|
1150
1140
|
key: 2,
|
|
1151
|
-
"chart-data":
|
|
1152
|
-
"data-testid": `csv-export-modal-${
|
|
1153
|
-
filename:
|
|
1154
|
-
onToggleModal:
|
|
1141
|
+
"chart-data": n.value,
|
|
1142
|
+
"data-testid": `csv-export-modal-${w.tileId}`,
|
|
1143
|
+
filename: p.value,
|
|
1144
|
+
onToggleModal: U
|
|
1155
1145
|
}, null, 8, ["chart-data", "data-testid", "filename"])) : X("", !0)
|
|
1156
1146
|
])) : X("", !0),
|
|
1157
|
-
|
|
1147
|
+
le("div", {
|
|
1158
1148
|
class: "tile-content",
|
|
1159
|
-
"data-testid": `tile-content-${
|
|
1149
|
+
"data-testid": `tile-content-${w.tileId}`
|
|
1160
1150
|
}, [
|
|
1161
|
-
|
|
1162
|
-
], 8,
|
|
1163
|
-
], 10,
|
|
1151
|
+
S.value ? (T(), A(yt(S.value.component), gt({ key: 0 }, S.value.rendererProps, { onChartData: q }), null, 16)) : X("", !0)
|
|
1152
|
+
], 8, Mi)
|
|
1153
|
+
], 10, Ni);
|
|
1164
1154
|
};
|
|
1165
1155
|
}
|
|
1166
|
-
}),
|
|
1156
|
+
}), Pi = /* @__PURE__ */ ae(Ii, [["__scopeId", "data-v-7be0ec05"]]), qi = (u, e, t) => {
|
|
1167
1157
|
const i = /* @__PURE__ */ new Map();
|
|
1168
1158
|
t.forEach((r) => {
|
|
1169
|
-
const o = r.layout.position.row, n = i.get(o),
|
|
1170
|
-
n === void 0 ? i.set(o,
|
|
1159
|
+
const o = r.layout.position.row, n = i.get(o), a = r.layout.size.rows === 1 && !!r.layout.size.fitToContent;
|
|
1160
|
+
n === void 0 ? i.set(o, a) : i.set(o, n && a);
|
|
1171
1161
|
});
|
|
1172
1162
|
const s = [];
|
|
1173
1163
|
for (let r = 0; r < u; r++)
|
|
1174
1164
|
i.get(r) ? s.push("auto") : s.push(`${e}px`);
|
|
1175
1165
|
return s;
|
|
1176
|
-
},
|
|
1166
|
+
}, Bi = /* @__PURE__ */ F({
|
|
1177
1167
|
__name: "GridLayout",
|
|
1178
1168
|
props: {
|
|
1179
1169
|
gridSize: {
|
|
@@ -1191,7 +1181,7 @@ const xi = () => {
|
|
|
1191
1181
|
}
|
|
1192
1182
|
},
|
|
1193
1183
|
setup(u) {
|
|
1194
|
-
|
|
1184
|
+
Ge((n) => ({
|
|
1195
1185
|
"3bc5e939": u.gridSize.cols,
|
|
1196
1186
|
"77aa3028": r.value
|
|
1197
1187
|
}));
|
|
@@ -1200,16 +1190,16 @@ const xi = () => {
|
|
|
1200
1190
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1201
1191
|
});
|
|
1202
1192
|
});
|
|
1203
|
-
|
|
1193
|
+
We(() => {
|
|
1204
1194
|
t.value && s.observe(t.value);
|
|
1205
|
-
}),
|
|
1195
|
+
}), $e(() => {
|
|
1206
1196
|
t.value && s.unobserve(t.value);
|
|
1207
1197
|
});
|
|
1208
|
-
const r =
|
|
1209
|
-
var
|
|
1210
|
-
return
|
|
1211
|
-
}), o =
|
|
1212
|
-
key: `tile-${
|
|
1198
|
+
const r = H(() => {
|
|
1199
|
+
var a;
|
|
1200
|
+
return qi((a = e.gridSize) == null ? void 0 : a.rows, e.tileHeight, e.tiles).join(" ");
|
|
1201
|
+
}), o = H(() => e.tiles.map((n, a) => ({
|
|
1202
|
+
key: `tile-${a}`,
|
|
1213
1203
|
tile: n,
|
|
1214
1204
|
style: {
|
|
1215
1205
|
"grid-column-start": n.layout.position.col + 1,
|
|
@@ -1218,27 +1208,27 @@ const xi = () => {
|
|
|
1218
1208
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1219
1209
|
}
|
|
1220
1210
|
})));
|
|
1221
|
-
return (n,
|
|
1211
|
+
return (n, a) => (T(), $("div", {
|
|
1222
1212
|
ref_key: "gridContainer",
|
|
1223
1213
|
ref: t,
|
|
1224
1214
|
class: "kong-ui-public-grid-layout"
|
|
1225
1215
|
}, [
|
|
1226
|
-
(T(!0), $(
|
|
1227
|
-
key:
|
|
1228
|
-
class:
|
|
1229
|
-
"empty-cell": !
|
|
1216
|
+
(T(!0), $(vt, null, _t(o.value, (d) => (T(), $("div", {
|
|
1217
|
+
key: d.key,
|
|
1218
|
+
class: Fe(["grid-cell", {
|
|
1219
|
+
"empty-cell": !d.tile
|
|
1230
1220
|
}]),
|
|
1231
|
-
style:
|
|
1221
|
+
style: Ze(d.style)
|
|
1232
1222
|
}, [
|
|
1233
|
-
|
|
1234
|
-
style:
|
|
1235
|
-
tile:
|
|
1223
|
+
Le(n.$slots, "tile", {
|
|
1224
|
+
style: Ze(d.style),
|
|
1225
|
+
tile: d.tile
|
|
1236
1226
|
}, void 0, !0)
|
|
1237
1227
|
], 6))), 128))
|
|
1238
1228
|
], 512));
|
|
1239
1229
|
}
|
|
1240
|
-
}),
|
|
1241
|
-
function
|
|
1230
|
+
}), $i = /* @__PURE__ */ ae(Bi, [["__scopeId", "data-v-f43eb7b8"]]);
|
|
1231
|
+
function Ui(u, e, t, i, s) {
|
|
1242
1232
|
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));
|
|
1243
1233
|
return r.prototype = e.prototype, r;
|
|
1244
1234
|
}
|
|
@@ -1277,12 +1267,12 @@ class c {
|
|
|
1277
1267
|
static createWidgetDivs(e, t) {
|
|
1278
1268
|
var o, n;
|
|
1279
1269
|
const i = c.createDiv(["grid-stack-item", e]), s = c.createDiv(["grid-stack-item-content"], i);
|
|
1280
|
-
return t.lazyLoad || ((n = (o = t.grid) == null ? void 0 : o.opts) == null ? void 0 : n.lazyLoad) && t.lazyLoad !== !1 ? t.visibleObservable || (t.visibleObservable = new IntersectionObserver(([
|
|
1281
|
-
var l;
|
|
1282
|
-
d.isIntersecting && ((l = t.visibleObservable) == null || l.disconnect(), delete t.visibleObservable, _.renderCB(s, t));
|
|
1283
|
-
}), window.setTimeout(() => {
|
|
1270
|
+
return t.lazyLoad || ((n = (o = t.grid) == null ? void 0 : o.opts) == null ? void 0 : n.lazyLoad) && t.lazyLoad !== !1 ? t.visibleObservable || (t.visibleObservable = new IntersectionObserver(([a]) => {
|
|
1284
1271
|
var d;
|
|
1285
|
-
|
|
1272
|
+
a.isIntersecting && ((d = t.visibleObservable) == null || d.disconnect(), delete t.visibleObservable, _.renderCB(s, t));
|
|
1273
|
+
}), window.setTimeout(() => {
|
|
1274
|
+
var a;
|
|
1275
|
+
return (a = t.visibleObservable) == null ? void 0 : a.observe(i);
|
|
1286
1276
|
})) : _.renderCB(s, t), i;
|
|
1287
1277
|
}
|
|
1288
1278
|
/** create a div with the given classes */
|
|
@@ -1452,10 +1442,10 @@ class c {
|
|
|
1452
1442
|
static updateScrollPosition(e, t, i) {
|
|
1453
1443
|
const s = e.getBoundingClientRect(), r = window.innerHeight || document.documentElement.clientHeight;
|
|
1454
1444
|
if (s.top < 0 || s.bottom > r) {
|
|
1455
|
-
const o = s.bottom - r, n = s.top,
|
|
1456
|
-
if (
|
|
1457
|
-
const
|
|
1458
|
-
s.top < 0 && i < 0 ? e.offsetHeight > r ?
|
|
1445
|
+
const o = s.bottom - r, n = s.top, a = this.getScrollElement(e);
|
|
1446
|
+
if (a !== null) {
|
|
1447
|
+
const d = a.scrollTop;
|
|
1448
|
+
s.top < 0 && i < 0 ? e.offsetHeight > r ? a.scrollTop += i : a.scrollTop += Math.abs(n) > Math.abs(i) ? i : n : i > 0 && (e.offsetHeight > r ? a.scrollTop += i : a.scrollTop += o > i ? i : o), t.top += a.scrollTop - d;
|
|
1459
1449
|
}
|
|
1460
1450
|
}
|
|
1461
1451
|
}
|
|
@@ -1467,8 +1457,8 @@ class c {
|
|
|
1467
1457
|
* @param distance Distance from the V edges to start scrolling
|
|
1468
1458
|
*/
|
|
1469
1459
|
static updateScrollResize(e, t, i) {
|
|
1470
|
-
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o,
|
|
1471
|
-
|
|
1460
|
+
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o, a = n < i, d = n > r - i;
|
|
1461
|
+
a ? s.scrollBy({ behavior: "smooth", top: n - i }) : d && s.scrollBy({ behavior: "smooth", top: i - (r - n) });
|
|
1472
1462
|
}
|
|
1473
1463
|
/** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
|
|
1474
1464
|
static clone(e) {
|
|
@@ -1622,19 +1612,19 @@ class Q {
|
|
|
1622
1612
|
!this._loading && this._useEntireRowArea(e, t) && (r = { x: 0, w: this.column, y: t.y, h: t.h }, i = this.collide(e, r, s.skip));
|
|
1623
1613
|
let o = !1;
|
|
1624
1614
|
const n = { nested: !0, pack: !1 };
|
|
1625
|
-
let
|
|
1615
|
+
let a = 0;
|
|
1626
1616
|
for (; i = i || this.collide(e, r, s.skip); ) {
|
|
1627
|
-
if (
|
|
1617
|
+
if (a++ > this.nodes.length * 2)
|
|
1628
1618
|
throw new Error("Infinite collide check");
|
|
1629
|
-
let
|
|
1619
|
+
let d;
|
|
1630
1620
|
if (i.locked || this._loading || e._moving && !e._skipDown && t.y > e.y && !this.float && // can take space we had, or before where we're going
|
|
1631
1621
|
(!this.collide(i, { ...i, y: e.y }, e) || !this.collide(i, { ...i, y: t.y - i.h }, e))) {
|
|
1632
1622
|
e._skipDown = e._skipDown || t.y > e.y;
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1623
|
+
const l = { ...t, y: i.y + i.h, ...n };
|
|
1624
|
+
d = this._loading && c.samePos(e, l) ? !0 : this.moveNode(e, l), (i.locked || this._loading) && d ? c.copyPos(t, e) : !i.locked && d && s.pack && (this._packNodes(), t.y = i.y + i.h, c.copyPos(e, t)), o = o || d;
|
|
1635
1625
|
} else
|
|
1636
|
-
|
|
1637
|
-
if (!
|
|
1626
|
+
d = this.moveNode(i, { ...i, y: t.y + t.h, skip: e, ...n });
|
|
1627
|
+
if (!d)
|
|
1638
1628
|
return o;
|
|
1639
1629
|
i = void 0;
|
|
1640
1630
|
}
|
|
@@ -1656,14 +1646,14 @@ class Q {
|
|
|
1656
1646
|
const s = e._rect, r = { ...t.rect };
|
|
1657
1647
|
r.y > s.y ? (r.h += r.y - s.y, r.y = s.y) : r.h += s.y - r.y, r.x > s.x ? (r.w += r.x - s.x, r.x = s.x) : r.w += s.x - r.x;
|
|
1658
1648
|
let o, n = 0.5;
|
|
1659
|
-
for (let
|
|
1660
|
-
if (
|
|
1649
|
+
for (let a of i) {
|
|
1650
|
+
if (a.locked || !a._rect)
|
|
1661
1651
|
break;
|
|
1662
|
-
const
|
|
1663
|
-
let
|
|
1664
|
-
s.y <
|
|
1665
|
-
const f = Math.min(h,
|
|
1666
|
-
f > n && (n = f, o =
|
|
1652
|
+
const d = a._rect;
|
|
1653
|
+
let l = Number.MAX_VALUE, h = Number.MAX_VALUE;
|
|
1654
|
+
s.y < d.y ? l = (r.y + r.h - d.y) / d.h : s.y + s.h > d.y + d.h && (l = (d.y + d.h - r.y) / d.h), s.x < d.x ? h = (r.x + r.w - d.x) / d.w : s.x + s.w > d.x + d.w && (h = (d.x + d.w - r.x) / d.w);
|
|
1655
|
+
const f = Math.min(h, l);
|
|
1656
|
+
f > n && (n = f, o = a);
|
|
1667
1657
|
}
|
|
1668
1658
|
return t.collide = o, o;
|
|
1669
1659
|
}
|
|
@@ -1737,9 +1727,9 @@ class Q {
|
|
|
1737
1727
|
const s = this._inColumnResize;
|
|
1738
1728
|
s || (this._inColumnResize = !0);
|
|
1739
1729
|
const r = this.nodes;
|
|
1740
|
-
return this.nodes = [], r.forEach((o, n,
|
|
1741
|
-
let
|
|
1742
|
-
o.locked || (o.autoPosition = !0, e === "list" && n && (
|
|
1730
|
+
return this.nodes = [], r.forEach((o, n, a) => {
|
|
1731
|
+
let d;
|
|
1732
|
+
o.locked || (o.autoPosition = !0, e === "list" && n && (d = a[n - 1])), this.addNode(o, !1, d);
|
|
1743
1733
|
}), s || delete this._inColumnResize, i || this.batchUpdate(!1), this;
|
|
1744
1734
|
}
|
|
1745
1735
|
/** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */
|
|
@@ -1837,11 +1827,11 @@ class Q {
|
|
|
1837
1827
|
const r = s ? s.y * i + (s.x + s.w) : 0;
|
|
1838
1828
|
let o = !1;
|
|
1839
1829
|
for (let n = r; !o; ++n) {
|
|
1840
|
-
const
|
|
1841
|
-
if (
|
|
1830
|
+
const a = n % i, d = Math.floor(n / i);
|
|
1831
|
+
if (a + e.w > i)
|
|
1842
1832
|
continue;
|
|
1843
|
-
const
|
|
1844
|
-
t.find((h) => c.isIntercepted(
|
|
1833
|
+
const l = { x: a, y: d, w: e.w, h: e.h };
|
|
1834
|
+
t.find((h) => c.isIntercepted(l, h)) || ((e.x !== a || e.y !== d) && (e._dirty = !0), e.x = a, e.y = d, delete e.autoPosition, o = !0);
|
|
1845
1835
|
}
|
|
1846
1836
|
return o;
|
|
1847
1837
|
}
|
|
@@ -1887,7 +1877,7 @@ class Q {
|
|
|
1887
1877
|
return this._notify(), !0;
|
|
1888
1878
|
}
|
|
1889
1879
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
1890
|
-
const n = this.nodes.find((
|
|
1880
|
+
const n = this.nodes.find((a) => a._id === o._id);
|
|
1891
1881
|
n && (c.copyPos(n, o), n._dirty = !0);
|
|
1892
1882
|
}), this._notify(), !0) : !1;
|
|
1893
1883
|
}
|
|
@@ -1908,7 +1898,7 @@ class Q {
|
|
|
1908
1898
|
}
|
|
1909
1899
|
/** return true if the passed in node was actually moved (checks for no-op and locked) */
|
|
1910
1900
|
moveNode(e, t) {
|
|
1911
|
-
var
|
|
1901
|
+
var d, l;
|
|
1912
1902
|
if (!e || /*node.locked ||*/
|
|
1913
1903
|
!t)
|
|
1914
1904
|
return !1;
|
|
@@ -1918,17 +1908,17 @@ class Q {
|
|
|
1918
1908
|
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
1919
1909
|
return !1;
|
|
1920
1910
|
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
1921
|
-
let
|
|
1911
|
+
let a = !0;
|
|
1922
1912
|
if (n.length) {
|
|
1923
1913
|
const h = e._moving && !t.nested;
|
|
1924
1914
|
let f = h ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
1925
|
-
if (h && f && ((
|
|
1926
|
-
const
|
|
1927
|
-
|
|
1915
|
+
if (h && f && ((l = (d = e.grid) == null ? void 0 : d.opts) != null && l.subGridDynamic) && !e.grid._isTemp) {
|
|
1916
|
+
const p = c.areaIntercept(t.rect, f._rect), m = c.area(t.rect), y = c.area(f._rect);
|
|
1917
|
+
p / (m < y ? m : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
1928
1918
|
}
|
|
1929
|
-
f ?
|
|
1919
|
+
f ? a = !this._fixCollisions(e, r, f, t) : (a = !1, i && delete t.pack);
|
|
1930
1920
|
}
|
|
1931
|
-
return
|
|
1921
|
+
return a && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
1932
1922
|
}
|
|
1933
1923
|
getRow() {
|
|
1934
1924
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -1946,8 +1936,8 @@ class Q {
|
|
|
1946
1936
|
var o;
|
|
1947
1937
|
const i = (o = this._layouts) == null ? void 0 : o.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
1948
1938
|
return this.sortNodes(), this.nodes.forEach((n) => {
|
|
1949
|
-
const
|
|
1950
|
-
c.removeInternalForSave(
|
|
1939
|
+
const a = s == null ? void 0 : s.find((l) => l._id === n._id), d = { ...n, ...a || {} };
|
|
1940
|
+
c.removeInternalForSave(d, !e), t && t(n, d), r.push(d);
|
|
1951
1941
|
}), r;
|
|
1952
1942
|
}
|
|
1953
1943
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -1986,19 +1976,19 @@ class Q {
|
|
|
1986
1976
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
1987
1977
|
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
1988
1978
|
if (t > e && this._layouts) {
|
|
1989
|
-
const
|
|
1990
|
-
!
|
|
1991
|
-
const h = o.find((f) => f._id ===
|
|
1992
|
-
h && (!s && !
|
|
1993
|
-
})),
|
|
1994
|
-
const h = o.findIndex((f) => f._id ===
|
|
1979
|
+
const a = this._layouts[t] || [], d = this._layouts.length - 1;
|
|
1980
|
+
!a.length && e !== d && ((n = this._layouts[d]) != null && n.length) && (e = d, this._layouts[d].forEach((l) => {
|
|
1981
|
+
const h = o.find((f) => f._id === l._id);
|
|
1982
|
+
h && (!s && !l.autoPosition && (h.x = l.x ?? h.x, h.y = l.y ?? h.y), h.w = l.w ?? h.w, (l.x == null || l.y === void 0) && (h.autoPosition = !0));
|
|
1983
|
+
})), a.forEach((l) => {
|
|
1984
|
+
const h = o.findIndex((f) => f._id === l._id);
|
|
1995
1985
|
if (h !== -1) {
|
|
1996
1986
|
const f = o[h];
|
|
1997
1987
|
if (s) {
|
|
1998
|
-
f.w =
|
|
1988
|
+
f.w = l.w;
|
|
1999
1989
|
return;
|
|
2000
1990
|
}
|
|
2001
|
-
(
|
|
1991
|
+
(l.autoPosition || isNaN(l.x) || isNaN(l.y)) && this.findEmptyPosition(l, r), l.autoPosition || (f.x = l.x ?? f.x, f.y = l.y ?? f.y, f.w = l.w ?? f.w, r.push(f)), o.splice(h, 1);
|
|
2002
1992
|
}
|
|
2003
1993
|
});
|
|
2004
1994
|
}
|
|
@@ -2009,16 +1999,16 @@ class Q {
|
|
|
2009
1999
|
if (typeof i == "function")
|
|
2010
2000
|
i(t, e, r, o);
|
|
2011
2001
|
else {
|
|
2012
|
-
const
|
|
2002
|
+
const a = s || i === "none" ? 1 : t / e, d = i === "move" || i === "moveScale", l = i === "scale" || i === "moveScale";
|
|
2013
2003
|
o.forEach((h) => {
|
|
2014
|
-
h.x = t === 1 ? 0 :
|
|
2004
|
+
h.x = t === 1 ? 0 : d ? Math.round(h.x * a) : Math.min(h.x, t - 1), h.w = t === 1 || e === 1 ? 1 : l ? Math.round(h.w * a) || 1 : Math.min(h.w, t), r.push(h);
|
|
2015
2005
|
}), o = [];
|
|
2016
2006
|
}
|
|
2017
|
-
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((
|
|
2018
|
-
this.addNode(
|
|
2007
|
+
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((a) => {
|
|
2008
|
+
this.addNode(a, !1), delete a._orig;
|
|
2019
2009
|
});
|
|
2020
2010
|
}
|
|
2021
|
-
return this.nodes.forEach((
|
|
2011
|
+
return this.nodes.forEach((a) => delete a._orig), this.batchUpdate(!1, !s), delete this._inColumnResize, this;
|
|
2022
2012
|
}
|
|
2023
2013
|
/**
|
|
2024
2014
|
* call to cache the given layout internally to the given location so we can restore back when column changes size
|
|
@@ -2030,7 +2020,7 @@ class Q {
|
|
|
2030
2020
|
const s = [];
|
|
2031
2021
|
return e.forEach((r, o) => {
|
|
2032
2022
|
if (r._id === void 0) {
|
|
2033
|
-
const n = r.id ? this.nodes.find((
|
|
2023
|
+
const n = r.id ? this.nodes.find((a) => a.id === r.id) : void 0;
|
|
2034
2024
|
r._id = (n == null ? void 0 : n._id) ?? Q._idSeq++;
|
|
2035
2025
|
}
|
|
2036
2026
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
@@ -2067,7 +2057,7 @@ class Q {
|
|
|
2067
2057
|
}
|
|
2068
2058
|
}
|
|
2069
2059
|
Q._idSeq = 0;
|
|
2070
|
-
const
|
|
2060
|
+
const G = {
|
|
2071
2061
|
alwaysShowResizeHandle: "mobile",
|
|
2072
2062
|
animate: !0,
|
|
2073
2063
|
auto: !0,
|
|
@@ -2097,12 +2087,12 @@ const F = {
|
|
|
2097
2087
|
// styleInHead: false,
|
|
2098
2088
|
//removable
|
|
2099
2089
|
};
|
|
2100
|
-
class
|
|
2090
|
+
class b {
|
|
2101
2091
|
}
|
|
2102
2092
|
const j = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2103
2093
|
class J {
|
|
2104
2094
|
}
|
|
2105
|
-
function
|
|
2095
|
+
function Se(u, e) {
|
|
2106
2096
|
if (u.touches.length > 1)
|
|
2107
2097
|
return;
|
|
2108
2098
|
u.cancelable && u.preventDefault();
|
|
@@ -2176,46 +2166,46 @@ function Ht(u, e) {
|
|
|
2176
2166
|
// relatedTarget
|
|
2177
2167
|
), u.target.dispatchEvent(t);
|
|
2178
2168
|
}
|
|
2179
|
-
function
|
|
2180
|
-
J.touchHandled || (J.touchHandled = !0,
|
|
2169
|
+
function ke(u) {
|
|
2170
|
+
J.touchHandled || (J.touchHandled = !0, Se(u, "mousedown"));
|
|
2181
2171
|
}
|
|
2182
|
-
function
|
|
2183
|
-
J.touchHandled &&
|
|
2172
|
+
function Ne(u) {
|
|
2173
|
+
J.touchHandled && Se(u, "mousemove");
|
|
2184
2174
|
}
|
|
2185
2175
|
function He(u) {
|
|
2186
2176
|
if (!J.touchHandled)
|
|
2187
2177
|
return;
|
|
2188
2178
|
J.pointerLeaveTimeout && (window.clearTimeout(J.pointerLeaveTimeout), delete J.pointerLeaveTimeout);
|
|
2189
|
-
const e = !!
|
|
2190
|
-
|
|
2179
|
+
const e = !!b.dragElement;
|
|
2180
|
+
Se(u, "mouseup"), e || Se(u, "click"), J.touchHandled = !1;
|
|
2191
2181
|
}
|
|
2192
|
-
function
|
|
2182
|
+
function Ae(u) {
|
|
2193
2183
|
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
2194
2184
|
}
|
|
2195
|
-
function
|
|
2196
|
-
|
|
2185
|
+
function ut(u) {
|
|
2186
|
+
b.dragElement && u.pointerType !== "mouse" && Ht(u, "mouseenter");
|
|
2197
2187
|
}
|
|
2198
|
-
function
|
|
2199
|
-
|
|
2188
|
+
function ct(u) {
|
|
2189
|
+
b.dragElement && u.pointerType !== "mouse" && (J.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2200
2190
|
delete J.pointerLeaveTimeout, Ht(u, "mouseleave");
|
|
2201
2191
|
}, 10));
|
|
2202
2192
|
}
|
|
2203
|
-
class
|
|
2193
|
+
class Me {
|
|
2204
2194
|
constructor(e, t, i) {
|
|
2205
2195
|
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();
|
|
2206
2196
|
}
|
|
2207
2197
|
/** @internal */
|
|
2208
2198
|
_init() {
|
|
2209
2199
|
const e = this.el = document.createElement("div");
|
|
2210
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${
|
|
2200
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Me.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown), j && (this.el.addEventListener("touchstart", ke), this.el.addEventListener("pointerdown", Ae)), this;
|
|
2211
2201
|
}
|
|
2212
2202
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2213
2203
|
destroy() {
|
|
2214
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), j && (this.el.removeEventListener("touchstart",
|
|
2204
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), j && (this.el.removeEventListener("touchstart", ke), this.el.removeEventListener("pointerdown", Ae)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2215
2205
|
}
|
|
2216
2206
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2217
2207
|
_mouseDown(e) {
|
|
2218
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), j && (this.el.addEventListener("touchmove",
|
|
2208
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), j && (this.el.addEventListener("touchmove", Ne), this.el.addEventListener("touchend", He)), e.stopPropagation(), e.preventDefault();
|
|
2219
2209
|
}
|
|
2220
2210
|
/** @internal */
|
|
2221
2211
|
_mouseMove(e) {
|
|
@@ -2224,7 +2214,7 @@ class Pe {
|
|
|
2224
2214
|
}
|
|
2225
2215
|
/** @internal */
|
|
2226
2216
|
_mouseUp(e) {
|
|
2227
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), j && (this.el.removeEventListener("touchmove",
|
|
2217
|
+
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), j && (this.el.removeEventListener("touchmove", Ne), this.el.removeEventListener("touchend", He)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2228
2218
|
}
|
|
2229
2219
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2230
2220
|
_keyEvent(e) {
|
|
@@ -2236,8 +2226,8 @@ class Pe {
|
|
|
2236
2226
|
return this.option[e] && this.option[e](t), this;
|
|
2237
2227
|
}
|
|
2238
2228
|
}
|
|
2239
|
-
|
|
2240
|
-
class
|
|
2229
|
+
Me.prefix = "ui-resizable-";
|
|
2230
|
+
class Xe {
|
|
2241
2231
|
constructor() {
|
|
2242
2232
|
this._eventRegister = {};
|
|
2243
2233
|
}
|
|
@@ -2265,7 +2255,7 @@ class je {
|
|
|
2265
2255
|
return this._eventRegister[e](t);
|
|
2266
2256
|
}
|
|
2267
2257
|
}
|
|
2268
|
-
class
|
|
2258
|
+
class _e extends Xe {
|
|
2269
2259
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
2270
2260
|
constructor(e, t = {}) {
|
|
2271
2261
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -2321,21 +2311,21 @@ class be extends je {
|
|
|
2321
2311
|
}
|
|
2322
2312
|
/** @internal turns auto hide on/off */
|
|
2323
2313
|
_setupAutoHide(e) {
|
|
2324
|
-
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),
|
|
2314
|
+
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), b.overResizeElement === this && delete b.overResizeElement), this;
|
|
2325
2315
|
}
|
|
2326
2316
|
/** @internal */
|
|
2327
2317
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2328
2318
|
_mouseOver(e) {
|
|
2329
|
-
|
|
2319
|
+
b.overResizeElement || b.dragElement || (b.overResizeElement = this, this.el.classList.remove("ui-resizable-autohide"));
|
|
2330
2320
|
}
|
|
2331
2321
|
/** @internal */
|
|
2332
2322
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2333
2323
|
_mouseOut(e) {
|
|
2334
|
-
|
|
2324
|
+
b.overResizeElement === this && (delete b.overResizeElement, this.el.classList.add("ui-resizable-autohide"));
|
|
2335
2325
|
}
|
|
2336
2326
|
/** @internal */
|
|
2337
2327
|
_setupHandlers() {
|
|
2338
|
-
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new
|
|
2328
|
+
return this.handlers = this.option.handles.split(",").map((e) => e.trim()).map((e) => new Me(this.el, e, {
|
|
2339
2329
|
start: (t) => {
|
|
2340
2330
|
this._resizeStart(t);
|
|
2341
2331
|
},
|
|
@@ -2366,7 +2356,7 @@ class be extends je {
|
|
|
2366
2356
|
}
|
|
2367
2357
|
/** @internal */
|
|
2368
2358
|
_setupHelper() {
|
|
2369
|
-
this.elOriginStyleVal =
|
|
2359
|
+
this.elOriginStyleVal = _e._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
2370
2360
|
const e = this.el.parentElement, t = c.getValuesFromTransformedElement(e);
|
|
2371
2361
|
return this.rectScale = {
|
|
2372
2362
|
x: t.xScale,
|
|
@@ -2375,7 +2365,7 @@ class be extends je {
|
|
|
2375
2365
|
}
|
|
2376
2366
|
/** @internal */
|
|
2377
2367
|
_cleanHelper() {
|
|
2378
|
-
return
|
|
2368
|
+
return _e._originStyleProp.forEach((e, t) => {
|
|
2379
2369
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
2380
2370
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
2381
2371
|
}
|
|
@@ -2387,15 +2377,15 @@ class be extends je {
|
|
|
2387
2377
|
left: this.originalRect.left,
|
|
2388
2378
|
top: this.originalRect.top - this.scrolled
|
|
2389
2379
|
}, r = e.clientX - i.clientX, o = this.sizeToContent ? 0 : e.clientY - i.clientY;
|
|
2390
|
-
let n,
|
|
2391
|
-
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o,
|
|
2392
|
-
const
|
|
2393
|
-
return Math.round(s.width) !== Math.round(
|
|
2380
|
+
let n, a;
|
|
2381
|
+
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o, a = !0);
|
|
2382
|
+
const d = this._constrainSize(s.width, s.height, n, a);
|
|
2383
|
+
return Math.round(s.width) !== Math.round(d.width) && (t.indexOf("w") > -1 && (s.left += s.width - d.width), s.width = d.width), Math.round(s.height) !== Math.round(d.height) && (t.indexOf("n") > -1 && (s.top += s.height - d.height), s.height = d.height), s;
|
|
2394
2384
|
}
|
|
2395
2385
|
/** @internal constrain the size to the set min/max values */
|
|
2396
2386
|
_constrainSize(e, t, i, s) {
|
|
2397
|
-
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e,
|
|
2398
|
-
return { width:
|
|
2387
|
+
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e, a = (s ? r.maxHeightMoveUp : r.maxHeight) || Number.MAX_SAFE_INTEGER, d = r.minHeight / this.rectScale.y || t, l = Math.min(o, Math.max(n, e)), h = Math.min(a, Math.max(d, t));
|
|
2388
|
+
return { width: l, height: h };
|
|
2399
2389
|
}
|
|
2400
2390
|
/** @internal */
|
|
2401
2391
|
_applyChange() {
|
|
@@ -2414,9 +2404,9 @@ class be extends je {
|
|
|
2414
2404
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
2415
2405
|
}
|
|
2416
2406
|
}
|
|
2417
|
-
|
|
2418
|
-
const
|
|
2419
|
-
class we extends
|
|
2407
|
+
_e._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
2408
|
+
const Gi = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
2409
|
+
class we extends Xe {
|
|
2420
2410
|
constructor(e, t = {}) {
|
|
2421
2411
|
var r;
|
|
2422
2412
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -2436,12 +2426,12 @@ class we extends je {
|
|
|
2436
2426
|
}
|
|
2437
2427
|
enable() {
|
|
2438
2428
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2439
|
-
e.addEventListener("mousedown", this._mouseDown), j && (e.addEventListener("touchstart",
|
|
2429
|
+
e.addEventListener("mousedown", this._mouseDown), j && (e.addEventListener("touchstart", ke), e.addEventListener("pointerdown", Ae));
|
|
2440
2430
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2441
2431
|
}
|
|
2442
2432
|
disable(e = !1) {
|
|
2443
2433
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2444
|
-
t.removeEventListener("mousedown", this._mouseDown), j && (t.removeEventListener("touchstart",
|
|
2434
|
+
t.removeEventListener("mousedown", this._mouseDown), j && (t.removeEventListener("touchstart", ke), t.removeEventListener("pointerdown", Ae));
|
|
2445
2435
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2446
2436
|
}
|
|
2447
2437
|
destroy() {
|
|
@@ -2452,8 +2442,8 @@ class we extends je {
|
|
|
2452
2442
|
}
|
|
2453
2443
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2454
2444
|
_mouseDown(e) {
|
|
2455
|
-
if (!
|
|
2456
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
2445
|
+
if (!b.mouseHandled)
|
|
2446
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Gi) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete b.dragElement, delete b.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), j && (e.currentTarget.addEventListener("touchmove", Ne), e.currentTarget.addEventListener("touchend", He)), e.preventDefault(), document.activeElement && document.activeElement.blur(), b.mouseHandled = !0), !0;
|
|
2457
2447
|
}
|
|
2458
2448
|
/** @internal method to call actual drag event */
|
|
2459
2449
|
_callDrag(e) {
|
|
@@ -2467,15 +2457,15 @@ class we extends je {
|
|
|
2467
2457
|
var i;
|
|
2468
2458
|
const t = this.mouseDownEvent;
|
|
2469
2459
|
if (this.lastDrag = e, this.dragging)
|
|
2470
|
-
if (this._dragFollow(e),
|
|
2471
|
-
const s = Number.isInteger(
|
|
2460
|
+
if (this._dragFollow(e), b.pauseDrag) {
|
|
2461
|
+
const s = Number.isInteger(b.pauseDrag) ? b.pauseDrag : 100;
|
|
2472
2462
|
this.dragTimeout && window.clearTimeout(this.dragTimeout), this.dragTimeout = window.setTimeout(() => this._callDrag(e), s);
|
|
2473
2463
|
} else
|
|
2474
2464
|
this._callDrag(e);
|
|
2475
2465
|
else if (Math.abs(e.x - t.x) + Math.abs(e.y - t.y) > 3) {
|
|
2476
|
-
this.dragging = !0,
|
|
2466
|
+
this.dragging = !0, b.dragElement = this;
|
|
2477
2467
|
const s = (i = this.el.gridstackNode) == null ? void 0 : i.grid;
|
|
2478
|
-
s ?
|
|
2468
|
+
s ? b.dropElement = s.el.ddElement.ddDroppable : delete b.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);
|
|
2479
2469
|
const r = c.initEvent(e, { target: this.el, type: "dragstart" });
|
|
2480
2470
|
this.option.start && this.option.start(r, this.ui()), this.triggerEvent("dragstart", r), document.addEventListener("keydown", this._keyEvent);
|
|
2481
2471
|
}
|
|
@@ -2484,17 +2474,17 @@ class we extends je {
|
|
|
2484
2474
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2485
2475
|
_mouseUp(e) {
|
|
2486
2476
|
var t, i;
|
|
2487
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), j && e.currentTarget && (e.currentTarget.removeEventListener("touchmove",
|
|
2488
|
-
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i =
|
|
2477
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), j && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", Ne, !0), e.currentTarget.removeEventListener("touchend", He, !0)), this.dragging) {
|
|
2478
|
+
delete this.dragging, (t = this.el.gridstackNode) == null || delete t._origRotate, document.removeEventListener("keydown", this._keyEvent), ((i = b.dropElement) == null ? void 0 : i.el) === this.el.parentElement && delete b.dropElement, this.helperContainment.style.position = this.parentOriginStylePosition || null, this.helper !== this.el && this.helper.remove(), this._removeHelperStyle();
|
|
2489
2479
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2490
|
-
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s),
|
|
2480
|
+
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), b.dropElement && b.dropElement.drop(e);
|
|
2491
2481
|
}
|
|
2492
|
-
delete this.helper, delete this.mouseDownEvent, delete
|
|
2482
|
+
delete this.helper, delete this.mouseDownEvent, delete b.dragElement, delete b.dropElement, delete b.mouseHandled, e.preventDefault();
|
|
2493
2483
|
}
|
|
2494
2484
|
/** @internal call when keys are being pressed - use Esc to cancel, R to rotate */
|
|
2495
2485
|
_keyEvent(e) {
|
|
2496
2486
|
var s, r;
|
|
2497
|
-
const t = this.el.gridstackNode, i = (t == null ? void 0 : t.grid) || ((r = (s =
|
|
2487
|
+
const t = this.el.gridstackNode, i = (t == null ? void 0 : t.grid) || ((r = (s = b.dropElement) == null ? void 0 : s.el) == null ? void 0 : r.gridstack);
|
|
2498
2488
|
if (e.key === "Escape")
|
|
2499
2489
|
t && t._origRotate && (t._orig = t._origRotate, delete t._origRotate), i == null || i.cancelDrag(), this._mouseUp(this.mouseDownEvent);
|
|
2500
2490
|
else if (t && i && (e.key === "r" || e.key === "R")) {
|
|
@@ -2566,7 +2556,7 @@ class we extends je {
|
|
|
2566
2556
|
}
|
|
2567
2557
|
}
|
|
2568
2558
|
we.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2569
|
-
class
|
|
2559
|
+
class Fi extends Xe {
|
|
2570
2560
|
constructor(e, t = {}) {
|
|
2571
2561
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2572
2562
|
}
|
|
@@ -2577,10 +2567,10 @@ class Ki extends je {
|
|
|
2577
2567
|
super.off(e);
|
|
2578
2568
|
}
|
|
2579
2569
|
enable() {
|
|
2580
|
-
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), j && (this.el.addEventListener("pointerenter",
|
|
2570
|
+
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), j && (this.el.addEventListener("pointerenter", ut), this.el.addEventListener("pointerleave", ct)));
|
|
2581
2571
|
}
|
|
2582
2572
|
disable(e = !1) {
|
|
2583
|
-
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), j && (this.el.removeEventListener("pointerenter",
|
|
2573
|
+
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), j && (this.el.removeEventListener("pointerenter", ut), this.el.removeEventListener("pointerleave", ct)));
|
|
2584
2574
|
}
|
|
2585
2575
|
destroy() {
|
|
2586
2576
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2590,20 +2580,20 @@ class Ki extends je {
|
|
|
2590
2580
|
}
|
|
2591
2581
|
/** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */
|
|
2592
2582
|
_mouseEnter(e) {
|
|
2593
|
-
if (!
|
|
2583
|
+
if (!b.dragElement || !this._canDrop(b.dragElement.el))
|
|
2594
2584
|
return;
|
|
2595
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2585
|
+
e.preventDefault(), e.stopPropagation(), b.dropElement && b.dropElement !== this && b.dropElement._mouseLeave(e, !0), b.dropElement = this;
|
|
2596
2586
|
const t = c.initEvent(e, { target: this.el, type: "dropover" });
|
|
2597
|
-
this.option.over && this.option.over(t, this._ui(
|
|
2587
|
+
this.option.over && this.option.over(t, this._ui(b.dragElement)), this.triggerEvent("dropover", t), this.el.classList.add("ui-droppable-over");
|
|
2598
2588
|
}
|
|
2599
2589
|
/** @internal called when the item is leaving our area, stop tracking if we had moving item */
|
|
2600
2590
|
_mouseLeave(e, t = !1) {
|
|
2601
2591
|
var s;
|
|
2602
|
-
if (!
|
|
2592
|
+
if (!b.dragElement || b.dropElement !== this)
|
|
2603
2593
|
return;
|
|
2604
2594
|
e.preventDefault(), e.stopPropagation();
|
|
2605
2595
|
const i = c.initEvent(e, { target: this.el, type: "dropout" });
|
|
2606
|
-
if (this.option.out && this.option.out(i, this._ui(
|
|
2596
|
+
if (this.option.out && this.option.out(i, this._ui(b.dragElement)), this.triggerEvent("dropout", i), b.dropElement === this && (delete b.dropElement, !t)) {
|
|
2607
2597
|
let r, o = this.el.parentElement;
|
|
2608
2598
|
for (; !r && o; )
|
|
2609
2599
|
r = (s = o.ddElement) == null ? void 0 : s.ddDroppable, o = o.parentElement;
|
|
@@ -2614,7 +2604,7 @@ class Ki extends je {
|
|
|
2614
2604
|
drop(e) {
|
|
2615
2605
|
e.preventDefault();
|
|
2616
2606
|
const t = c.initEvent(e, { target: this.el, type: "drop" });
|
|
2617
|
-
this.option.drop && this.option.drop(t, this._ui(
|
|
2607
|
+
this.option.drop && this.option.drop(t, this._ui(b.dragElement)), this.triggerEvent("drop", t);
|
|
2618
2608
|
}
|
|
2619
2609
|
/** @internal true if element matches the string/method accept option */
|
|
2620
2610
|
_canDrop(e) {
|
|
@@ -2632,9 +2622,9 @@ class Ki extends je {
|
|
|
2632
2622
|
};
|
|
2633
2623
|
}
|
|
2634
2624
|
}
|
|
2635
|
-
class
|
|
2625
|
+
class je {
|
|
2636
2626
|
static init(e) {
|
|
2637
|
-
return e.ddElement || (e.ddElement = new
|
|
2627
|
+
return e.ddElement || (e.ddElement = new je(e)), e.ddElement;
|
|
2638
2628
|
}
|
|
2639
2629
|
constructor(e) {
|
|
2640
2630
|
this.el = e;
|
|
@@ -2652,19 +2642,19 @@ class Qe {
|
|
|
2652
2642
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2653
2643
|
}
|
|
2654
2644
|
setupResizable(e) {
|
|
2655
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2645
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new _e(this.el, e), this;
|
|
2656
2646
|
}
|
|
2657
2647
|
cleanResizable() {
|
|
2658
2648
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2659
2649
|
}
|
|
2660
2650
|
setupDroppable(e) {
|
|
2661
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2651
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Fi(this.el, e), this;
|
|
2662
2652
|
}
|
|
2663
2653
|
cleanDroppable() {
|
|
2664
2654
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2665
2655
|
}
|
|
2666
2656
|
}
|
|
2667
|
-
class
|
|
2657
|
+
class Wi {
|
|
2668
2658
|
resizable(e, t, i, s) {
|
|
2669
2659
|
return this._getDDElements(e).forEach((r) => {
|
|
2670
2660
|
if (t === "disable" || t === "enable")
|
|
@@ -2675,13 +2665,13 @@ class Vi {
|
|
|
2675
2665
|
r.setupResizable({ [i]: s });
|
|
2676
2666
|
else {
|
|
2677
2667
|
const n = r.el.gridstackNode.grid;
|
|
2678
|
-
let
|
|
2679
|
-
|
|
2680
|
-
const
|
|
2668
|
+
let a = r.el.getAttribute("gs-resize-handles") || n.opts.resizable.handles || "e,s,se";
|
|
2669
|
+
a === "all" && (a = "n,e,s,w,se,sw,ne,nw");
|
|
2670
|
+
const d = !n.opts.alwaysShowResizeHandle;
|
|
2681
2671
|
r.setupResizable({
|
|
2682
2672
|
...n.opts.resizable,
|
|
2683
|
-
handles:
|
|
2684
|
-
autoHide:
|
|
2673
|
+
handles: a,
|
|
2674
|
+
autoHide: d,
|
|
2685
2675
|
start: t.start,
|
|
2686
2676
|
stop: t.stop,
|
|
2687
2677
|
resize: t.resize
|
|
@@ -2734,7 +2724,7 @@ class Vi {
|
|
|
2734
2724
|
}
|
|
2735
2725
|
on(e, t, i) {
|
|
2736
2726
|
return this._getDDElements(e).forEach((s) => s.on(t, (r) => {
|
|
2737
|
-
i(r,
|
|
2727
|
+
i(r, b.dragElement ? b.dragElement.el : r.target, b.dragElement ? b.dragElement.helper : null);
|
|
2738
2728
|
})), this;
|
|
2739
2729
|
}
|
|
2740
2730
|
off(e, t) {
|
|
@@ -2745,7 +2735,7 @@ class Vi {
|
|
|
2745
2735
|
const i = c.getElements(e);
|
|
2746
2736
|
if (!i.length)
|
|
2747
2737
|
return [];
|
|
2748
|
-
const s = i.map((r) => r.ddElement || (t ?
|
|
2738
|
+
const s = i.map((r) => r.ddElement || (t ? je.init(r) : null));
|
|
2749
2739
|
return t || s.filter((r) => r), s;
|
|
2750
2740
|
}
|
|
2751
2741
|
}
|
|
@@ -2756,7 +2746,7 @@ class Vi {
|
|
|
2756
2746
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2757
2747
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2758
2748
|
*/
|
|
2759
|
-
const I = new
|
|
2749
|
+
const I = new Wi();
|
|
2760
2750
|
class _ {
|
|
2761
2751
|
/**
|
|
2762
2752
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2821,7 +2811,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2821
2811
|
/** @internal create placeholder DIV as needed */
|
|
2822
2812
|
get placeholder() {
|
|
2823
2813
|
if (!this._placeholder) {
|
|
2824
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2814
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, G.itemClass, this.opts.itemClass]);
|
|
2825
2815
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2826
2816
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2827
2817
|
}
|
|
@@ -2833,7 +2823,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2833
2823
|
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
2834
2824
|
*/
|
|
2835
2825
|
constructor(e, t = {}) {
|
|
2836
|
-
var h, f,
|
|
2826
|
+
var h, f, p;
|
|
2837
2827
|
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);
|
|
2838
2828
|
const i = c.toNumber(e.getAttribute("gs-row"));
|
|
2839
2829
|
t.column === "auto" && delete t.column, t.alwaysShowResizeHandle !== void 0 && (t._alwaysShowResizeHandle = t.alwaysShowResizeHandle);
|
|
@@ -2842,48 +2832,48 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2842
2832
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2843
2833
|
const m = r.oneColumnSize || 768;
|
|
2844
2834
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2845
|
-
let y = s.find((
|
|
2835
|
+
let y = s.find((g) => g.c === 1);
|
|
2846
2836
|
y ? y.w = m : (y = { c: 1, w: m }, s.push(y, { c: 12, w: m + 1 }));
|
|
2847
2837
|
}
|
|
2848
2838
|
const o = t.columnOpts;
|
|
2849
2839
|
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((m, y) => (y.w || 0) - (m.w || 0));
|
|
2850
2840
|
const n = {
|
|
2851
|
-
...c.cloneDeep(
|
|
2852
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2853
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2854
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2855
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2841
|
+
...c.cloneDeep(G),
|
|
2842
|
+
column: c.toNumber(e.getAttribute("gs-column")) || G.column,
|
|
2843
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || G.minRow,
|
|
2844
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || G.maxRow,
|
|
2845
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || G.staticGrid,
|
|
2856
2846
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2857
2847
|
draggable: {
|
|
2858
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2848
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || G.draggable.handle
|
|
2859
2849
|
},
|
|
2860
2850
|
removableOptions: {
|
|
2861
|
-
accept: t.itemClass ||
|
|
2862
|
-
decline:
|
|
2851
|
+
accept: t.itemClass || G.removableOptions.accept,
|
|
2852
|
+
decline: G.removableOptions.decline
|
|
2863
2853
|
}
|
|
2864
2854
|
};
|
|
2865
2855
|
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");
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
const
|
|
2869
|
-
if (this.engine = new
|
|
2856
|
+
const a = this.el.closest("." + G.itemClass), d = a == null ? void 0 : a.gridstackNode;
|
|
2857
|
+
d && (d.subGrid = this, this.parentGridNode = d, this.el.classList.add("grid-stack-nested"), d.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== G.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = j), this._styleSheetClass = "gs-id-" + Q._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2858
|
+
const l = t.engineClass || _.engineClass || Q;
|
|
2859
|
+
if (this.engine = new l({
|
|
2870
2860
|
column: this.getColumn(),
|
|
2871
2861
|
float: t.float,
|
|
2872
2862
|
maxRow: t.maxRow,
|
|
2873
2863
|
onChange: (m) => {
|
|
2874
2864
|
let y = 0;
|
|
2875
|
-
this.engine.nodes.forEach((
|
|
2876
|
-
y = Math.max(y,
|
|
2877
|
-
}), m.forEach((
|
|
2878
|
-
const
|
|
2879
|
-
|
|
2865
|
+
this.engine.nodes.forEach((g) => {
|
|
2866
|
+
y = Math.max(y, g.y + g.h);
|
|
2867
|
+
}), m.forEach((g) => {
|
|
2868
|
+
const R = g.el;
|
|
2869
|
+
R && (g._removeDOM ? (R && R.remove(), delete g._removeDOM) : this._writePosAttr(R, g));
|
|
2880
2870
|
}), this._updateStyles(!1, y);
|
|
2881
2871
|
}
|
|
2882
2872
|
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((m) => this._prepareElement(m)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
2883
2873
|
const m = t.children;
|
|
2884
2874
|
delete t.children, m.length && this.load(m);
|
|
2885
2875
|
}
|
|
2886
|
-
this.setAnimation(), t.subGridDynamic && !
|
|
2876
|
+
this.setAnimation(), t.subGridDynamic && !b.pauseDrag && (b.pauseDrag = !0), ((p = t.draggable) == null ? void 0 : p.pause) !== void 0 && (b.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
2887
2877
|
}
|
|
2888
2878
|
/**
|
|
2889
2879
|
* add a new widget and returns it.
|
|
@@ -2923,9 +2913,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2923
2913
|
* @returns newly created grid
|
|
2924
2914
|
*/
|
|
2925
2915
|
makeSubGrid(e, t, i, s = !0) {
|
|
2926
|
-
var
|
|
2916
|
+
var p, m, y;
|
|
2927
2917
|
let r = e.gridstackNode;
|
|
2928
|
-
if (r || (r = this.makeWidget(e).gridstackNode), (
|
|
2918
|
+
if (r || (r = this.makeWidget(e).gridstackNode), (p = r.subGrid) != null && p.el)
|
|
2929
2919
|
return r.subGrid;
|
|
2930
2920
|
let o, n = this;
|
|
2931
2921
|
for (; n && !o; )
|
|
@@ -2942,15 +2932,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2942
2932
|
...o || {},
|
|
2943
2933
|
...t || r.subGridOpts || {}
|
|
2944
2934
|
}), r.subGridOpts = t;
|
|
2945
|
-
let
|
|
2946
|
-
t.column === "auto" && (
|
|
2947
|
-
let
|
|
2948
|
-
if (s && (this._removeDD(r.el), h = { ...r, x: 0, y: 0 }, c.removeInternalForSave(h), delete h.subGridOpts, r.content && (h.content = r.content, delete r.content), _.addRemoveCB ?
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2935
|
+
let a;
|
|
2936
|
+
t.column === "auto" && (a = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
2937
|
+
let d = r.el.querySelector(".grid-stack-item-content"), l, h;
|
|
2938
|
+
if (s && (this._removeDD(r.el), h = { ...r, x: 0, y: 0 }, c.removeInternalForSave(h), delete h.subGridOpts, r.content && (h.content = r.content, delete r.content), _.addRemoveCB ? l = _.addRemoveCB(this.el, h, !0, !1) : (l = c.createDiv(["grid-stack-item"]), l.appendChild(d), d = c.createDiv(["grid-stack-item-content"], r.el)), this._prepareDragDropByNode(r)), i) {
|
|
2939
|
+
const g = a ? t.column : r.w, R = r.h + i.h, S = r.el.style;
|
|
2940
|
+
S.transition = "none", this.update(r.el, { w: g, h: R }), setTimeout(() => S.transition = null);
|
|
2951
2941
|
}
|
|
2952
|
-
const f = r.subGrid = _.addGrid(
|
|
2953
|
-
return i != null && i._moving && (f._isTemp = !0),
|
|
2942
|
+
const f = r.subGrid = _.addGrid(d, t);
|
|
2943
|
+
return i != null && i._moving && (f._isTemp = !0), a && (f._autoColumn = !0), s && f.makeWidget(l, h), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
2954
2944
|
}
|
|
2955
2945
|
/**
|
|
2956
2946
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -2988,7 +2978,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2988
2978
|
const r = c.cloneDeep(this.opts);
|
|
2989
2979
|
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");
|
|
2990
2980
|
const o = r._alwaysShowResizeHandle;
|
|
2991
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
2981
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, G), r.children = s, r;
|
|
2992
2982
|
}
|
|
2993
2983
|
return s;
|
|
2994
2984
|
}
|
|
@@ -3003,15 +2993,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3003
2993
|
* see http://gridstackjs.com/demo/serialization.html
|
|
3004
2994
|
*/
|
|
3005
2995
|
load(e, t = _.addRemoveCB || !0) {
|
|
3006
|
-
var
|
|
2996
|
+
var d;
|
|
3007
2997
|
e = c.cloneDeep(e);
|
|
3008
2998
|
const i = this.getColumn();
|
|
3009
|
-
e.forEach((
|
|
3010
|
-
|
|
2999
|
+
e.forEach((l) => {
|
|
3000
|
+
l.w = l.w || 1, l.h = l.h || 1;
|
|
3011
3001
|
}), e = c.sort(e), this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = !0;
|
|
3012
3002
|
let s = 0;
|
|
3013
|
-
e.forEach((
|
|
3014
|
-
s = Math.max(s, (
|
|
3003
|
+
e.forEach((l) => {
|
|
3004
|
+
s = Math.max(s, (l.x || 0) + l.w);
|
|
3015
3005
|
}), s > this.engine.defaultColumn && (this.engine.defaultColumn = s), s > i && this.engine.cacheLayout(e, s, !0);
|
|
3016
3006
|
const r = _.addRemoveCB;
|
|
3017
3007
|
typeof t == "function" && (_.addRemoveCB = t);
|
|
@@ -3023,17 +3013,17 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3023
3013
|
return;
|
|
3024
3014
|
c.find(e, h.id) || (_.addRemoveCB && _.addRemoveCB(this.el, h, !1, !1), o.push(h), this.removeWidget(h.el, !0, !1));
|
|
3025
3015
|
}), this.engine._loading = !0;
|
|
3026
|
-
const
|
|
3027
|
-
return this.engine.nodes = this.engine.nodes.filter((
|
|
3016
|
+
const a = [];
|
|
3017
|
+
return this.engine.nodes = this.engine.nodes.filter((l) => c.find(e, l.id) ? (a.push(l), !1) : !0), e.forEach((l) => {
|
|
3028
3018
|
var f;
|
|
3029
|
-
const h = c.find(
|
|
3019
|
+
const h = c.find(a, l.id);
|
|
3030
3020
|
if (h) {
|
|
3031
|
-
if (c.shouldSizeToContent(h) && (
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3021
|
+
if (c.shouldSizeToContent(h) && (l.h = h.h), this.engine.nodeBoundFix(l), (l.autoPosition || l.x === void 0 || l.y === void 0) && (l.w = l.w || h.w, l.h = l.h || h.h, this.engine.findEmptyPosition(l)), this.engine.nodes.push(h), c.samePos(h, l) && this.engine.nodes.length > 1 && (this.moveNode(h, { ...l, forceCollide: !0 }), c.copyPos(l, h)), this.update(h.el, l), (f = l.subGridOpts) != null && f.children) {
|
|
3022
|
+
const p = h.el.querySelector(".grid-stack");
|
|
3023
|
+
p && p.gridstack && p.gridstack.load(l.subGridOpts.children);
|
|
3034
3024
|
}
|
|
3035
|
-
} else t && this.addWidget(
|
|
3036
|
-
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? _.addRemoveCB = r : delete _.addRemoveCB, n && ((
|
|
3025
|
+
} else t && this.addWidget(l);
|
|
3026
|
+
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? _.addRemoveCB = r : delete _.addRemoveCB, n && ((d = this.opts) != null && d.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
3037
3027
|
}
|
|
3038
3028
|
/**
|
|
3039
3029
|
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
@@ -3113,7 +3103,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3113
3103
|
i = e.breakpoints[n++].c || t;
|
|
3114
3104
|
}
|
|
3115
3105
|
if (i !== t) {
|
|
3116
|
-
const n = (o = e.breakpoints) == null ? void 0 : o.find((
|
|
3106
|
+
const n = (o = e.breakpoints) == null ? void 0 : o.find((a) => a.c === i);
|
|
3117
3107
|
return this.column(i, (n == null ? void 0 : n.layout) || e.layout), !0;
|
|
3118
3108
|
}
|
|
3119
3109
|
return !1;
|
|
@@ -3191,8 +3181,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3191
3181
|
const i = this.el.getBoundingClientRect();
|
|
3192
3182
|
let s;
|
|
3193
3183
|
t ? s = { top: i.top + document.documentElement.scrollTop, left: i.left } : s = { top: this.el.offsetTop, left: this.el.offsetLeft };
|
|
3194
|
-
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(),
|
|
3195
|
-
return { x: Math.floor(r / n), y: Math.floor(o /
|
|
3184
|
+
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(), a = i.height / parseInt(this.el.getAttribute("gs-current-row"));
|
|
3185
|
+
return { x: Math.floor(r / n), y: Math.floor(o / a) };
|
|
3196
3186
|
}
|
|
3197
3187
|
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
3198
3188
|
getRow() {
|
|
@@ -3310,7 +3300,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3310
3300
|
return t = { x: i[s++], y: i[s++], w: i[s++], h: i[s++] }, this.update(e, t);
|
|
3311
3301
|
}
|
|
3312
3302
|
return _.getElements(e).forEach((i) => {
|
|
3313
|
-
var
|
|
3303
|
+
var l;
|
|
3314
3304
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3315
3305
|
if (!s)
|
|
3316
3306
|
return;
|
|
@@ -3322,16 +3312,16 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3322
3312
|
n[h] = r[h] !== void 0 ? r[h] : s[h], delete r[h];
|
|
3323
3313
|
})), !n && (r.minW || r.minH || r.maxW || r.maxH) && (n = {}), r.content !== void 0) {
|
|
3324
3314
|
const h = i.querySelector(".grid-stack-item-content");
|
|
3325
|
-
h && h.textContent !== r.content && (s.content = r.content, _.renderCB(h, r), (
|
|
3315
|
+
h && h.textContent !== r.content && (s.content = r.content, _.renderCB(h, r), (l = s.subGrid) != null && l.el && (h.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3326
3316
|
}
|
|
3327
|
-
let
|
|
3317
|
+
let a = !1, d = !1;
|
|
3328
3318
|
for (const h in r)
|
|
3329
|
-
h[0] !== "_" && s[h] !== r[h] && (s[h] = r[h],
|
|
3319
|
+
h[0] !== "_" && s[h] !== r[h] && (s[h] = r[h], a = !0, d = d || !this.opts.staticGrid && (h === "noResize" || h === "noMove" || h === "locked"));
|
|
3330
3320
|
if (c.sanitizeMinMax(s), n) {
|
|
3331
3321
|
const h = n.w !== void 0 && n.w !== s.w;
|
|
3332
3322
|
this.moveNode(s, n), h && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(h, s), delete s._orig;
|
|
3333
3323
|
}
|
|
3334
|
-
(n ||
|
|
3324
|
+
(n || a) && this._writeAttr(i, s), d && this._prepareDragDropByNode(s);
|
|
3335
3325
|
}), this;
|
|
3336
3326
|
}
|
|
3337
3327
|
moveNode(e, t) {
|
|
@@ -3345,7 +3335,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3345
3335
|
* @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
|
|
3346
3336
|
*/
|
|
3347
3337
|
resizeToContent(e) {
|
|
3348
|
-
var f,
|
|
3338
|
+
var f, p;
|
|
3349
3339
|
if (!e || (e.classList.remove("size-to-content-max"), !e.clientHeight))
|
|
3350
3340
|
return;
|
|
3351
3341
|
const t = e.gridstackNode;
|
|
@@ -3360,14 +3350,14 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3360
3350
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3361
3351
|
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(_.resizeToContentParent)), !o)
|
|
3362
3352
|
return;
|
|
3363
|
-
const n = e.clientHeight - o.clientHeight,
|
|
3364
|
-
let
|
|
3353
|
+
const n = e.clientHeight - o.clientHeight, a = t.h ? t.h * s - n : o.clientHeight;
|
|
3354
|
+
let d;
|
|
3365
3355
|
if (t.subGrid) {
|
|
3366
|
-
|
|
3356
|
+
d = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3367
3357
|
const m = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3368
|
-
|
|
3358
|
+
d += m.top - y.top;
|
|
3369
3359
|
} else {
|
|
3370
|
-
if ((
|
|
3360
|
+
if ((p = (f = t.subGridOpts) == null ? void 0 : f.children) != null && p.length)
|
|
3371
3361
|
return;
|
|
3372
3362
|
{
|
|
3373
3363
|
const m = o.firstElementChild;
|
|
@@ -3375,15 +3365,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3375
3365
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3376
3366
|
return;
|
|
3377
3367
|
}
|
|
3378
|
-
|
|
3368
|
+
d = m.getBoundingClientRect().height || a;
|
|
3379
3369
|
}
|
|
3380
3370
|
}
|
|
3381
|
-
if (
|
|
3371
|
+
if (a === d)
|
|
3382
3372
|
return;
|
|
3383
|
-
r +=
|
|
3384
|
-
let
|
|
3373
|
+
r += d - a;
|
|
3374
|
+
let l = Math.ceil(r / s);
|
|
3385
3375
|
const h = Number.isInteger(t.sizeToContent) ? t.sizeToContent : 0;
|
|
3386
|
-
h &&
|
|
3376
|
+
h && l > h && (l = h, e.classList.add("size-to-content-max")), t.minH && l < t.minH ? l = t.minH : t.maxH && l > t.maxH && (l = t.maxH), l !== t.h && (i._ignoreLayoutsNodeChange = !0, i.moveNode(t, { h: l }), delete i._ignoreLayoutsNodeChange);
|
|
3387
3377
|
}
|
|
3388
3378
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3389
3379
|
resizeToContentCBCheck(e) {
|
|
@@ -3400,8 +3390,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3400
3390
|
return;
|
|
3401
3391
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3402
3392
|
if (t) {
|
|
3403
|
-
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0,
|
|
3404
|
-
r.x = s.x + n - (s.h - (
|
|
3393
|
+
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0, a = t.top > 0 ? Math.floor(t.top / this.opts.cellHeight) : 0;
|
|
3394
|
+
r.x = s.x + n - (s.h - (a + 1)), r.y = s.y + a - n;
|
|
3405
3395
|
}
|
|
3406
3396
|
Object.keys(r).forEach((n) => {
|
|
3407
3397
|
r[n] === void 0 && delete r[n];
|
|
@@ -3504,8 +3494,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3504
3494
|
}), !this._styles)
|
|
3505
3495
|
return this;
|
|
3506
3496
|
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
3507
|
-
const n = this.opts.marginTop + this.opts.marginUnit,
|
|
3508
|
-
c.addCSSRule(this._styles, h, `top: ${n}; right: ${
|
|
3497
|
+
const n = this.opts.marginTop + this.opts.marginUnit, a = this.opts.marginBottom + this.opts.marginUnit, d = this.opts.marginRight + this.opts.marginUnit, l = this.opts.marginLeft + this.opts.marginUnit, h = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
3498
|
+
c.addCSSRule(this._styles, h, `top: ${n}; right: ${d}; bottom: ${a}; left: ${l};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${d}; bottom: ${a}; left: ${l};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${a}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${d}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${d}; bottom: ${a}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${l}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${l}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${l}; bottom: ${a}`);
|
|
3509
3499
|
}
|
|
3510
3500
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
3511
3501
|
const o = (n) => i * n + s;
|
|
@@ -3535,7 +3525,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3535
3525
|
}
|
|
3536
3526
|
/** @internal */
|
|
3537
3527
|
_prepareElement(e, t = !1, i) {
|
|
3538
|
-
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(
|
|
3528
|
+
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(G.itemClass, this.opts.itemClass);
|
|
3539
3529
|
const s = c.shouldSizeToContent(i);
|
|
3540
3530
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), this._prepareDragDropByNode(i), this;
|
|
3541
3531
|
}
|
|
@@ -3651,7 +3641,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3651
3641
|
* @param root optional root which defaults to document (for shadow dom pass the parent HTMLDocument)
|
|
3652
3642
|
*/
|
|
3653
3643
|
static setupDragIn(e, t, i, s = document) {
|
|
3654
|
-
(t == null ? void 0 : t.pause) !== void 0 && (
|
|
3644
|
+
(t == null ? void 0 : t.pause) !== void 0 && (b.pauseDrag = t.pause), t = { appendTo: "body", helper: "clone", ...t || {} }, (typeof e == "string" ? c.getElements(e, s) : e).forEach((o, n) => {
|
|
3655
3645
|
I.isDraggable(o) || I.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3656
3646
|
});
|
|
3657
3647
|
}
|
|
@@ -3746,20 +3736,20 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3746
3736
|
return;
|
|
3747
3737
|
if (!((f = n.grid) != null && f.el)) {
|
|
3748
3738
|
o.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;
|
|
3749
|
-
const
|
|
3750
|
-
o.style.left =
|
|
3739
|
+
const p = o.getBoundingClientRect();
|
|
3740
|
+
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";
|
|
3751
3741
|
}
|
|
3752
|
-
let { top:
|
|
3753
|
-
const
|
|
3754
|
-
|
|
3742
|
+
let { top: a, left: d } = o.getBoundingClientRect();
|
|
3743
|
+
const l = this.el.getBoundingClientRect();
|
|
3744
|
+
d -= l.left, a -= l.top;
|
|
3755
3745
|
const h = {
|
|
3756
3746
|
position: {
|
|
3757
|
-
top:
|
|
3758
|
-
left:
|
|
3747
|
+
top: a * this.dragTransform.xScale,
|
|
3748
|
+
left: d * this.dragTransform.yScale
|
|
3759
3749
|
}
|
|
3760
3750
|
};
|
|
3761
3751
|
if (n._temporaryRemoved) {
|
|
3762
|
-
if (n.x = Math.max(0, Math.round(
|
|
3752
|
+
if (n.x = Math.max(0, Math.round(d / t)), n.y = Math.max(0, Math.round(a / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3763
3753
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3764
3754
|
I.off(r, "drag");
|
|
3765
3755
|
return;
|
|
@@ -3795,42 +3785,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3795
3785
|
if ((n == null ? void 0 : n.grid) === this && !n._temporaryRemoved)
|
|
3796
3786
|
return !1;
|
|
3797
3787
|
if (n != null && n.grid && n.grid !== this && !n._temporaryRemoved && n.grid._leave(r, o), o = o || r, t = this.cellWidth(), e = this.getCellHeight(!0), !n) {
|
|
3798
|
-
const
|
|
3799
|
-
if (
|
|
3788
|
+
const l = o.getAttribute("data-gs-widget") || o.getAttribute("gridstacknode");
|
|
3789
|
+
if (l) {
|
|
3800
3790
|
try {
|
|
3801
|
-
n = JSON.parse(
|
|
3791
|
+
n = JSON.parse(l);
|
|
3802
3792
|
} catch {
|
|
3803
|
-
console.error("Gridstack dropover: Bad JSON format: ",
|
|
3793
|
+
console.error("Gridstack dropover: Bad JSON format: ", l);
|
|
3804
3794
|
}
|
|
3805
3795
|
o.removeAttribute("data-gs-widget"), o.removeAttribute("gridstacknode");
|
|
3806
3796
|
}
|
|
3807
3797
|
n || (n = this._readAttr(o));
|
|
3808
3798
|
}
|
|
3809
3799
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3810
|
-
const
|
|
3811
|
-
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w:
|
|
3812
|
-
n._temporaryRemoved = !0) : (n.w =
|
|
3800
|
+
const a = n.w || Math.round(o.offsetWidth / t) || 1, d = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3801
|
+
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: a, h: d, 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
|
|
3802
|
+
n._temporaryRemoved = !0) : (n.w = a, n.h = d, n._temporaryRemoved = !0), _._itemRemoving(n.el, !1), I.on(r, "drag", i), i(s, r, o), !1;
|
|
3813
3803
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3814
3804
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3815
3805
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3816
3806
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3817
|
-
var
|
|
3807
|
+
var p, m, y;
|
|
3818
3808
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3819
3809
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3820
3810
|
return !1;
|
|
3821
|
-
const
|
|
3811
|
+
const a = !!this.placeholder.parentElement, d = r !== o;
|
|
3822
3812
|
this.placeholder.remove(), delete this.placeholder.gridstackNode;
|
|
3823
|
-
const
|
|
3824
|
-
|
|
3813
|
+
const l = a && this.opts.animate;
|
|
3814
|
+
l && this.setAnimation(!1);
|
|
3825
3815
|
const h = r._gridstackNodeOrig;
|
|
3826
|
-
if (delete r._gridstackNodeOrig,
|
|
3827
|
-
const
|
|
3828
|
-
|
|
3816
|
+
if (delete r._gridstackNodeOrig, a && (h != null && h.grid) && h.grid !== this) {
|
|
3817
|
+
const g = h.grid;
|
|
3818
|
+
g.engine.removeNodeFromLayoutCache(h), g.engine.removedNodes.push(h), g._triggerRemoveEvent()._triggerChangeEvent(), g.parentGridNode && !g.engine.nodes.length && g.opts.subGridDynamic && g.removeAsSubGrid();
|
|
3829
3819
|
}
|
|
3830
|
-
if (!n || (
|
|
3820
|
+
if (!n || (a && (this.engine.cleanupNode(n), n.grid = this), (p = n.grid) == null || delete p._isTemp, I.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !a))
|
|
3831
3821
|
return !1;
|
|
3832
3822
|
const f = (y = (m = n.subGrid) == null ? void 0 : m.el) == null ? void 0 : y.gridstack;
|
|
3833
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r),
|
|
3823
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), d && (n.content || n.subGridOpts || _.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, h && h.grid ? h : void 0, n), l && this.setAnimation(this.opts.animate, !0), !1;
|
|
3834
3824
|
}), this;
|
|
3835
3825
|
}
|
|
3836
3826
|
/** @internal mark item for removal */
|
|
@@ -3854,30 +3844,30 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3854
3844
|
return e._initDD && (this._removeDD(t), delete e._initDD), t.classList.add("ui-draggable-disabled", "ui-resizable-disabled"), this;
|
|
3855
3845
|
if (!e._initDD) {
|
|
3856
3846
|
let r, o;
|
|
3857
|
-
const n = (
|
|
3858
|
-
this._gsEventHandler[
|
|
3859
|
-
},
|
|
3860
|
-
this._dragOrResize(t,
|
|
3861
|
-
},
|
|
3847
|
+
const n = (l, h) => {
|
|
3848
|
+
this._gsEventHandler[l.type] && this._gsEventHandler[l.type](l, l.target), r = this.cellWidth(), o = this.getCellHeight(!0), this._onStartMoving(t, l, h, e, r, o);
|
|
3849
|
+
}, a = (l, h) => {
|
|
3850
|
+
this._dragOrResize(t, l, h, e, r, o);
|
|
3851
|
+
}, d = (l) => {
|
|
3862
3852
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete e._moving, delete e._event, delete e._lastTried;
|
|
3863
|
-
const h = e.w !== e._orig.w, f =
|
|
3853
|
+
const h = e.w !== e._orig.w, f = l.target;
|
|
3864
3854
|
if (!(!f.gridstackNode || f.gridstackNode.grid !== this)) {
|
|
3865
3855
|
if (e.el = f, e._isAboutToRemove) {
|
|
3866
|
-
const
|
|
3867
|
-
|
|
3856
|
+
const p = t.gridstackNode.grid;
|
|
3857
|
+
p._gsEventHandler[l.type] && p._gsEventHandler[l.type](l, f), p.engine.nodes.push(e), p.removeWidget(t, !0, !0);
|
|
3868
3858
|
} else
|
|
3869
|
-
c.removePositioningStyles(f), e._temporaryRemoved ? (c.copyPos(e, e._orig), this._writePosAttr(f, e), this.engine.addNode(e)) : this._writePosAttr(f, e), this._gsEventHandler[
|
|
3870
|
-
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(),
|
|
3859
|
+
c.removePositioningStyles(f), e._temporaryRemoved ? (c.copyPos(e, e._orig), this._writePosAttr(f, e), this.engine.addNode(e)) : this._writePosAttr(f, e), this._gsEventHandler[l.type] && this._gsEventHandler[l.type](l, f);
|
|
3860
|
+
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), l.type === "resizestop" && (Number.isInteger(e.sizeToContent) && (e.sizeToContent = e.h), this.resizeToContentCheck(h, e));
|
|
3871
3861
|
}
|
|
3872
3862
|
};
|
|
3873
3863
|
I.draggable(t, {
|
|
3874
3864
|
start: n,
|
|
3875
|
-
stop:
|
|
3876
|
-
drag:
|
|
3865
|
+
stop: d,
|
|
3866
|
+
drag: a
|
|
3877
3867
|
}).resizable(t, {
|
|
3878
3868
|
start: n,
|
|
3879
|
-
stop:
|
|
3880
|
-
resize:
|
|
3869
|
+
stop: d,
|
|
3870
|
+
resize: a
|
|
3881
3871
|
}), e._initDD = !0;
|
|
3882
3872
|
}
|
|
3883
3873
|
return I.draggable(t, i ? "disable" : "enable").resizable(t, s ? "disable" : "enable"), this;
|
|
@@ -3888,8 +3878,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3888
3878
|
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)
|
|
3889
3879
|
this.dragTransform = c.getValuesFromTransformedElement(e);
|
|
3890
3880
|
else if (this.placeholder && this.placeholder.closest(".grid-stack")) {
|
|
3891
|
-
const
|
|
3892
|
-
this.dragTransform = c.getValuesFromTransformedElement(
|
|
3881
|
+
const a = this.placeholder.closest(".grid-stack");
|
|
3882
|
+
this.dragTransform = c.getValuesFromTransformedElement(a);
|
|
3893
3883
|
} else
|
|
3894
3884
|
this.dragTransform = {
|
|
3895
3885
|
xScale: 1,
|
|
@@ -3898,48 +3888,48 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3898
3888
|
yOffset: 0
|
|
3899
3889
|
};
|
|
3900
3890
|
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") {
|
|
3901
|
-
const
|
|
3902
|
-
I.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1,
|
|
3891
|
+
const a = this.getColumn() - s.x, d = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
3892
|
+
I.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, a)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, d)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, a)).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, d)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
3903
3893
|
}
|
|
3904
3894
|
}
|
|
3905
3895
|
/** @internal handles actual drag/resize */
|
|
3906
3896
|
_dragOrResize(e, t, i, s, r, o) {
|
|
3907
3897
|
const n = { ...s._orig };
|
|
3908
|
-
let
|
|
3909
|
-
const
|
|
3910
|
-
if (
|
|
3898
|
+
let a, d = this.opts.marginLeft, l = this.opts.marginRight, h = this.opts.marginTop, f = this.opts.marginBottom;
|
|
3899
|
+
const p = Math.round(o * 0.1), m = Math.round(r * 0.1);
|
|
3900
|
+
if (d = Math.min(d, m), l = Math.min(l, m), h = Math.min(h, p), f = Math.min(f, p), t.type === "drag") {
|
|
3911
3901
|
if (s._temporaryRemoved)
|
|
3912
3902
|
return;
|
|
3913
|
-
const
|
|
3914
|
-
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position,
|
|
3915
|
-
const
|
|
3916
|
-
n.x = Math.round(
|
|
3917
|
-
const
|
|
3903
|
+
const g = i.position.top - s._prevYPix;
|
|
3904
|
+
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && c.updateScrollPosition(e, i.position, g);
|
|
3905
|
+
const R = i.position.left + (i.position.left > s._lastUiPosition.left ? -l : d), S = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : h);
|
|
3906
|
+
n.x = Math.round(R / r), n.y = Math.round(S / o);
|
|
3907
|
+
const C = this._extraDragRow;
|
|
3918
3908
|
if (this.engine.collide(s, n)) {
|
|
3919
3909
|
const E = this.getRow();
|
|
3920
3910
|
let x = Math.max(0, n.y + s.h - E);
|
|
3921
3911
|
this.opts.maxRow && E + x > this.opts.maxRow && (x = Math.max(0, this.opts.maxRow - E)), this._extraDragRow = x;
|
|
3922
3912
|
} else
|
|
3923
3913
|
this._extraDragRow = 0;
|
|
3924
|
-
if (this._extraDragRow !==
|
|
3914
|
+
if (this._extraDragRow !== C && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
3925
3915
|
return;
|
|
3926
3916
|
} else if (t.type === "resize") {
|
|
3927
|
-
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width -
|
|
3917
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - d) / r), n.h = Math.round((i.size.height - h) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
3928
3918
|
return;
|
|
3929
|
-
const
|
|
3930
|
-
n.x = Math.round(
|
|
3919
|
+
const g = i.position.left + d, R = i.position.top + h;
|
|
3920
|
+
n.x = Math.round(g / r), n.y = Math.round(R / o), a = !0;
|
|
3931
3921
|
}
|
|
3932
3922
|
s._event = t, s._lastTried = n;
|
|
3933
3923
|
const y = {
|
|
3934
|
-
x: i.position.left +
|
|
3924
|
+
x: i.position.left + d,
|
|
3935
3925
|
y: i.position.top + h,
|
|
3936
|
-
w: (i.size ? i.size.width : s.w * r) -
|
|
3926
|
+
w: (i.size ? i.size.width : s.w * r) - d - l,
|
|
3937
3927
|
h: (i.size ? i.size.height : s.h * o) - h - f
|
|
3938
3928
|
};
|
|
3939
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing:
|
|
3940
|
-
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, h,
|
|
3941
|
-
const
|
|
3942
|
-
this._writePosAttr(
|
|
3929
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing: a })) {
|
|
3930
|
+
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, h, l, f, d), delete s._skipDown, a && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
3931
|
+
const g = t.target;
|
|
3932
|
+
this._writePosAttr(g, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, g);
|
|
3943
3933
|
}
|
|
3944
3934
|
}
|
|
3945
3935
|
/** @internal called when item leaving our area by either cursor dropout event
|
|
@@ -3953,7 +3943,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3953
3943
|
}
|
|
3954
3944
|
// legacy method removed
|
|
3955
3945
|
commit() {
|
|
3956
|
-
return
|
|
3946
|
+
return Ui(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
3957
3947
|
}
|
|
3958
3948
|
}
|
|
3959
3949
|
_.renderCB = (u, e) => {
|
|
@@ -3963,7 +3953,7 @@ _.resizeToContentParent = ".grid-stack-item-content";
|
|
|
3963
3953
|
_.Utils = c;
|
|
3964
3954
|
_.Engine = Q;
|
|
3965
3955
|
_.GDRev = "11.3.0";
|
|
3966
|
-
const
|
|
3956
|
+
const Vi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ki = { class: "grid-stack-item-content" }, Yi = /* @__PURE__ */ F({
|
|
3967
3957
|
__name: "DraggableGridLayout",
|
|
3968
3958
|
props: {
|
|
3969
3959
|
tiles: {},
|
|
@@ -3972,11 +3962,11 @@ const Yi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Xi = { cl
|
|
|
3972
3962
|
},
|
|
3973
3963
|
emits: ["update-tiles"],
|
|
3974
3964
|
setup(u, { expose: e, emit: t }) {
|
|
3975
|
-
const i = u, s = t, r = B(null), o = B(new Map(i.tiles.map((
|
|
3965
|
+
const i = u, s = t, r = B(null), o = B(new Map(i.tiles.map((p) => [`${p.id}`, p])));
|
|
3976
3966
|
let n = null;
|
|
3977
|
-
const
|
|
3978
|
-
var
|
|
3979
|
-
const y = o.value.get(`${(
|
|
3967
|
+
const a = (p) => `[data-id="${p}"]`, d = (p) => p.map((m) => {
|
|
3968
|
+
var g;
|
|
3969
|
+
const y = o.value.get(`${(g = m.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
3980
3970
|
if (y)
|
|
3981
3971
|
return {
|
|
3982
3972
|
...y,
|
|
@@ -3985,52 +3975,52 @@ const Yi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Xi = { cl
|
|
|
3985
3975
|
size: { cols: Number(m.w), rows: Number(m.h) }
|
|
3986
3976
|
}
|
|
3987
3977
|
};
|
|
3988
|
-
}).filter((m) => m !== void 0),
|
|
3989
|
-
n && (
|
|
3990
|
-
o.value.set(`${
|
|
3978
|
+
}).filter((m) => m !== void 0), l = (p, m) => {
|
|
3979
|
+
n && (d(m).forEach((g) => {
|
|
3980
|
+
o.value.set(`${g.id}`, g);
|
|
3991
3981
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
3992
|
-
}, h = (
|
|
3982
|
+
}, h = (p, m) => {
|
|
3993
3983
|
m.forEach((y) => {
|
|
3994
|
-
var
|
|
3995
|
-
o.value.delete(`${(
|
|
3984
|
+
var g;
|
|
3985
|
+
o.value.delete(`${(g = y.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
3996
3986
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
3997
3987
|
};
|
|
3998
|
-
|
|
3988
|
+
We(() => {
|
|
3999
3989
|
r.value && (n = _.init({
|
|
4000
3990
|
column: i.gridSize.cols,
|
|
4001
3991
|
cellHeight: i.tileHeight,
|
|
4002
3992
|
resizable: { handles: "se, sw" },
|
|
4003
3993
|
handle: ".tile-header"
|
|
4004
|
-
}, r.value), n.on("change",
|
|
4005
|
-
}),
|
|
3994
|
+
}, r.value), n.on("change", l), n.on("added", l), n.on("removed", h));
|
|
3995
|
+
}), $e(() => {
|
|
4006
3996
|
n && n.destroy(!1);
|
|
4007
3997
|
});
|
|
4008
|
-
const f = (
|
|
3998
|
+
const f = (p) => {
|
|
4009
3999
|
if (n && r.value) {
|
|
4010
|
-
const m = r.value.querySelector(
|
|
4000
|
+
const m = r.value.querySelector(a(p));
|
|
4011
4001
|
m && n.removeWidget(m);
|
|
4012
4002
|
}
|
|
4013
4003
|
};
|
|
4014
|
-
return
|
|
4015
|
-
if (
|
|
4004
|
+
return Ue(() => i.tiles.length, async (p, m) => {
|
|
4005
|
+
if (p > m && n) {
|
|
4016
4006
|
const y = i.tiles.slice(m);
|
|
4017
|
-
for (const
|
|
4018
|
-
o.value.set(`${
|
|
4007
|
+
for (const g of y)
|
|
4008
|
+
o.value.set(`${g.id}`, g), await mt(), n.makeWidget(a(g.id), {
|
|
4019
4009
|
autoPosition: !0,
|
|
4020
|
-
w:
|
|
4021
|
-
h:
|
|
4010
|
+
w: g.layout.size.cols,
|
|
4011
|
+
h: g.layout.size.rows
|
|
4022
4012
|
});
|
|
4023
4013
|
}
|
|
4024
|
-
}),
|
|
4025
|
-
i.tiles.forEach((
|
|
4026
|
-
o.value.set(`${
|
|
4014
|
+
}), ft(() => {
|
|
4015
|
+
i.tiles.forEach((p) => {
|
|
4016
|
+
o.value.set(`${p.id}`, p);
|
|
4027
4017
|
});
|
|
4028
|
-
}), e({ removeWidget: f }), (
|
|
4018
|
+
}), e({ removeWidget: f }), (p, m) => (T(), $("div", {
|
|
4029
4019
|
ref_key: "gridContainer",
|
|
4030
4020
|
ref: r,
|
|
4031
4021
|
class: "grid-stack"
|
|
4032
4022
|
}, [
|
|
4033
|
-
(T(!0), $(
|
|
4023
|
+
(T(!0), $(vt, null, _t(i.tiles, (y) => (T(), $("div", {
|
|
4034
4024
|
key: y.id,
|
|
4035
4025
|
class: "grid-stack-item",
|
|
4036
4026
|
"data-id": `${y.id}`,
|
|
@@ -4041,46 +4031,46 @@ const Yi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Xi = { cl
|
|
|
4041
4031
|
"gs-x": y.layout.position.col,
|
|
4042
4032
|
"gs-y": y.layout.position.row
|
|
4043
4033
|
}, [
|
|
4044
|
-
|
|
4045
|
-
|
|
4034
|
+
le("div", Ki, [
|
|
4035
|
+
Le(p.$slots, "tile", { tile: y }, void 0, !0)
|
|
4046
4036
|
])
|
|
4047
|
-
], 8,
|
|
4037
|
+
], 8, Vi))), 128))
|
|
4048
4038
|
], 512));
|
|
4049
4039
|
}
|
|
4050
|
-
}),
|
|
4040
|
+
}), Xi = /* @__PURE__ */ ae(Yi, [["__scopeId", "data-v-f4f87f74"]]), ji = { class: "kong-ui-public-dashboard-renderer" }, Qi = {
|
|
4051
4041
|
key: 0,
|
|
4052
4042
|
class: "tile-container slottable-tile"
|
|
4053
|
-
},
|
|
4043
|
+
}, Ji = /* @__PURE__ */ F({
|
|
4054
4044
|
__name: "DashboardRenderer",
|
|
4055
|
-
props: /* @__PURE__ */
|
|
4045
|
+
props: /* @__PURE__ */ et({
|
|
4056
4046
|
context: {}
|
|
4057
4047
|
}, {
|
|
4058
4048
|
modelValue: { required: !0 },
|
|
4059
4049
|
modelModifiers: {}
|
|
4060
4050
|
}),
|
|
4061
|
-
emits: /* @__PURE__ */
|
|
4051
|
+
emits: /* @__PURE__ */ et(["edit-tile"], ["update:modelValue"]),
|
|
4062
4052
|
setup(u, { expose: e, emit: t }) {
|
|
4063
|
-
const i = u, s = t, r =
|
|
4064
|
-
|
|
4065
|
-
const
|
|
4053
|
+
const i = u, s = t, r = qt(u, "modelValue"), { i18n: o } = ve.useI18n(), n = B(0), a = B(null), d = ge(oe);
|
|
4054
|
+
d || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ve.useRequestQueue();
|
|
4055
|
+
const l = bt(), h = H(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4066
4056
|
type: "relative",
|
|
4067
|
-
time_range:
|
|
4068
|
-
}), f =
|
|
4069
|
-
const
|
|
4070
|
-
return
|
|
4071
|
-
}, m =
|
|
4057
|
+
time_range: l.defaultQueryTimeForOrg
|
|
4058
|
+
}), f = H(() => !!i.context.timeSpec || !l.loading), p = (E, x) => {
|
|
4059
|
+
const z = E.layout.position.row - x.layout.position.row;
|
|
4060
|
+
return z !== 0 ? z : E.layout.position.col - x.layout.position.col;
|
|
4061
|
+
}, m = H(() => r.value.tiles.map((E, x) => {
|
|
4072
4062
|
var q;
|
|
4073
|
-
let
|
|
4074
|
-
if ("description" in
|
|
4075
|
-
const
|
|
4076
|
-
const
|
|
4077
|
-
return o.te(
|
|
4063
|
+
let z = E.definition;
|
|
4064
|
+
if ("description" in z.chart) {
|
|
4065
|
+
const U = (q = z.chart.description) == null ? void 0 : q.replace(di, () => {
|
|
4066
|
+
const w = `renderer.trendRange.${h.value.type === "absolute" ? "custom" : h.value.time_range}`;
|
|
4067
|
+
return o.te(w) ? o.t(w) : "";
|
|
4078
4068
|
});
|
|
4079
|
-
|
|
4080
|
-
...
|
|
4069
|
+
z = {
|
|
4070
|
+
...z,
|
|
4081
4071
|
chart: {
|
|
4082
|
-
...
|
|
4083
|
-
description:
|
|
4072
|
+
...z.chart,
|
|
4073
|
+
description: U
|
|
4084
4074
|
}
|
|
4085
4075
|
};
|
|
4086
4076
|
}
|
|
@@ -4090,82 +4080,82 @@ const Yi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Xi = { cl
|
|
|
4090
4080
|
E
|
|
4091
4081
|
), {
|
|
4092
4082
|
layout: E.layout,
|
|
4093
|
-
meta:
|
|
4083
|
+
meta: z,
|
|
4094
4084
|
// Add a unique key to each tile internally.
|
|
4095
4085
|
id: E.id ?? crypto.randomUUID()
|
|
4096
4086
|
};
|
|
4097
|
-
})), y =
|
|
4098
|
-
let { tz: E, refreshInterval: x, editable:
|
|
4099
|
-
return E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), x === void 0 && (x =
|
|
4087
|
+
})), y = H(() => {
|
|
4088
|
+
let { tz: E, refreshInterval: x, editable: z } = i.context;
|
|
4089
|
+
return E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), x === void 0 && (x = ui), z === void 0 && (z = !1), {
|
|
4100
4090
|
...i.context,
|
|
4101
4091
|
tz: E,
|
|
4102
4092
|
timeSpec: h.value,
|
|
4103
4093
|
refreshInterval: x,
|
|
4104
|
-
editable:
|
|
4094
|
+
editable: z
|
|
4105
4095
|
};
|
|
4106
|
-
}),
|
|
4096
|
+
}), g = (E) => {
|
|
4107
4097
|
s("edit-tile", E);
|
|
4108
|
-
}, C = (E) => {
|
|
4109
|
-
d.value && d.value.removeWidget(E.id);
|
|
4110
|
-
}, k = () => {
|
|
4111
|
-
n.value++;
|
|
4112
4098
|
}, R = (E) => {
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4099
|
+
a.value && a.value.removeWidget(E.id);
|
|
4100
|
+
}, S = () => {
|
|
4101
|
+
n.value++;
|
|
4102
|
+
}, C = (E) => {
|
|
4103
|
+
const x = E.map((z) => ({
|
|
4104
|
+
id: z.id,
|
|
4105
|
+
layout: z.layout,
|
|
4106
|
+
definition: z.meta
|
|
4117
4107
|
}));
|
|
4118
|
-
r.value.gridSize.rows = Math.max(1, ...x.map((
|
|
4108
|
+
r.value.gridSize.rows = Math.max(1, ...x.map((z) => z.layout.position.row + z.layout.size.rows)), r.value.tiles = x.sort(p);
|
|
4119
4109
|
};
|
|
4120
|
-
return e({ refresh:
|
|
4121
|
-
const
|
|
4122
|
-
return T(), $("div",
|
|
4123
|
-
|
|
4110
|
+
return e({ refresh: S }), (E, x) => {
|
|
4111
|
+
const z = ne("KAlert");
|
|
4112
|
+
return T(), $("div", ji, [
|
|
4113
|
+
k(d) ? (T(), A(yt(E.context.editable ? Xi : $i), {
|
|
4124
4114
|
key: 1,
|
|
4125
4115
|
ref_key: "gridLayoutRef",
|
|
4126
|
-
ref:
|
|
4116
|
+
ref: a,
|
|
4127
4117
|
"grid-size": r.value.gridSize,
|
|
4128
4118
|
"tile-height": r.value.tileHeight,
|
|
4129
4119
|
tiles: m.value,
|
|
4130
|
-
onUpdateTiles:
|
|
4120
|
+
onUpdateTiles: C
|
|
4131
4121
|
}, {
|
|
4132
4122
|
tile: M(({ tile: q }) => [
|
|
4133
|
-
q.meta.chart.type === "slottable" ? (T(), $("div",
|
|
4134
|
-
|
|
4135
|
-
])) : (T(),
|
|
4123
|
+
q.meta.chart.type === "slottable" ? (T(), $("div", Qi, [
|
|
4124
|
+
Le(E.$slots, q.meta.chart.id, {}, void 0, !0)
|
|
4125
|
+
])) : (T(), A(Pi, {
|
|
4136
4126
|
key: 1,
|
|
4137
4127
|
class: "tile-container",
|
|
4138
4128
|
context: y.value,
|
|
4139
4129
|
definition: q.meta,
|
|
4140
|
-
height: q.layout.size.rows * (r.value.tileHeight ||
|
|
4130
|
+
height: q.layout.size.rows * (r.value.tileHeight || k(Ve)) + parseInt(k(Nt), 10),
|
|
4141
4131
|
"query-ready": f.value,
|
|
4142
4132
|
"refresh-counter": n.value,
|
|
4143
4133
|
"tile-id": q.id,
|
|
4144
|
-
onEditTile: (
|
|
4145
|
-
onRemoveTile: (
|
|
4134
|
+
onEditTile: (U) => g(q),
|
|
4135
|
+
onRemoveTile: (U) => R(q)
|
|
4146
4136
|
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onEditTile", "onRemoveTile"]))
|
|
4147
4137
|
]),
|
|
4148
4138
|
_: 3
|
|
4149
|
-
}, 40, ["grid-size", "tile-height", "tiles"])) : (T(),
|
|
4139
|
+
}, 40, ["grid-size", "tile-height", "tiles"])) : (T(), A(z, {
|
|
4150
4140
|
key: 0,
|
|
4151
4141
|
appearance: "danger"
|
|
4152
4142
|
}, {
|
|
4153
4143
|
default: M(() => [
|
|
4154
|
-
|
|
4144
|
+
ye(ee(k(o).t("renderer.noQueryBridge")), 1)
|
|
4155
4145
|
]),
|
|
4156
4146
|
_: 1
|
|
4157
4147
|
}))
|
|
4158
4148
|
]);
|
|
4159
4149
|
};
|
|
4160
4150
|
}
|
|
4161
|
-
}),
|
|
4151
|
+
}), ds = /* @__PURE__ */ ae(Ji, [["__scopeId", "data-v-18c7e16d"]]);
|
|
4162
4152
|
export {
|
|
4163
|
-
|
|
4153
|
+
hi as CP_ID_TOKEN,
|
|
4164
4154
|
Ve as DEFAULT_TILE_HEIGHT,
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4155
|
+
ui as DEFAULT_TILE_REFRESH_INTERVAL_MS,
|
|
4156
|
+
ds as DashboardRenderer,
|
|
4157
|
+
it as ENTITY_ID_TOKEN,
|
|
4158
|
+
$i as GridLayout,
|
|
4159
|
+
oe as INJECT_QUERY_PROVIDER,
|
|
4160
|
+
di as TIMEFRAME_TOKEN
|
|
4171
4161
|
};
|