@kong-ui-public/dashboard-renderer 5.0.0 → 5.1.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/README.md +9 -0
- package/dist/dashboard-renderer.es.js +718 -708
- package/dist/dashboard-renderer.umd.js +3 -3
- package/dist/style.css +1 -1
- package/dist/types/components/BaseAnalyticsChartRenderer.vue.d.ts +3 -1
- package/dist/types/components/BaseAnalyticsChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardRenderer.vue.d.ts +3 -1
- package/dist/types/components/DashboardRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts +3 -0
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/components/TimeseriesChartRenderer.vue.d.ts +7 -2
- package/dist/types/components/TimeseriesChartRenderer.vue.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ot = Object.defineProperty;
|
|
2
|
+
var Ze = (u) => {
|
|
3
3
|
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var Je = (u, e, 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) ?
|
|
8
|
-
var
|
|
5
|
+
var Lt = (u, e, t) => e in u ? Ot(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
6
|
+
var Je = (u, e, t) => Lt(u, typeof e != "symbol" ? e + "" : e, t), Pe = (u, e, t) => e.has(u) || Ze("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) ? Ze("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 ye = (u, e, t, i) => ({
|
|
9
9
|
set _(s) {
|
|
10
10
|
N(u, e, s, t);
|
|
11
11
|
},
|
|
@@ -13,27 +13,27 @@ var me = (u, e, t, i) => ({
|
|
|
13
13
|
return v(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as
|
|
17
|
-
import { stripUnknownFilters as
|
|
18
|
-
import { SimpleChart as
|
|
19
|
-
import
|
|
16
|
+
import { ref as $, watchEffect as gt, inject as me, provide as Mt, defineComponent as G, onUnmounted as $e, computed as A, watch as Fe, resolveComponent as ne, unref as k, openBlock as z, createBlock as H, withCtx as M, createTextVNode as ve, toDisplayString as te, renderSlot as Le, createCommentVNode as X, useCssVars as Ue, createElementVNode as le, normalizeClass as Ge, createVNode as ie, mergeProps as mt, createSlots as pt, createElementBlock as F, normalizeProps as It, guardReactiveProps as Pt, defineAsyncComponent as qt, onMounted as We, nextTick as yt, resolveDynamicComponent as vt, Fragment as _t, renderList as wt, normalizeStyle as et, mergeModels as tt, useModel as Bt } from "vue";
|
|
17
|
+
import { stripUnknownFilters as $t, Timeframe as Ft, TimePeriods as bt, TIMEFRAME_LOOKUP as Ut, formatTime as it, msToGranularity as Gt } from "@kong-ui-public/analytics-utilities";
|
|
18
|
+
import { SimpleChart as Wt, AnalyticsChart as Vt, TopNTable as Kt, CsvExportModal as Yt } from "@kong-ui-public/analytics-chart";
|
|
19
|
+
import Xt 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 jt, i18nTComponent as Qt } from "@kong-ui-public/i18n";
|
|
22
|
+
import { useAnalyticsConfigStore as Et } from "@kong-ui-public/analytics-config-store";
|
|
23
|
+
import { MetricsProvider as Zt, MetricsConsumer as Jt } from "@kong-ui-public/analytics-metric-provider";
|
|
24
|
+
import { EditIcon as ei, MoreIcon as ti } from "@kong/icons";
|
|
25
|
+
var xt = /* @__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))(xt || {});
|
|
26
|
+
const ii = (u) => {
|
|
27
27
|
var e, t, i, s, r;
|
|
28
28
|
return u ? !!// TODO: revisit: currently only the first check ever matters?
|
|
29
29
|
((e = Object.keys(u)) != null && e.length || (t = u.data) != null && t.length || (s = (i = u.data) == null ? void 0 : i.data) != null && s.length || !((r = u.data) != null && r.data) && typeof u.data == "object" && Object.keys(u == null ? void 0 : u.data).length) : !1;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
const s =
|
|
31
|
+
function si(u = $({}), e, t, i = ii) {
|
|
32
|
+
const s = $(
|
|
33
33
|
"PENDING"
|
|
34
34
|
/* PENDING */
|
|
35
35
|
);
|
|
36
|
-
return
|
|
36
|
+
return gt(() => {
|
|
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 ii(u = B({}), e, t, i = ti) {
|
|
|
62
62
|
u.value === void 0 && e && (s.value = "ERROR");
|
|
63
63
|
}), {
|
|
64
64
|
state: s,
|
|
65
|
-
swrvState:
|
|
65
|
+
swrvState: xt
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const ri = {
|
|
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 si = {
|
|
|
74
74
|
},
|
|
75
75
|
edit: "Edit",
|
|
76
76
|
remove: "Remove"
|
|
77
|
-
}, ri = {
|
|
78
|
-
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
79
77
|
}, ni = {
|
|
78
|
+
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
79
|
+
}, oi = {
|
|
80
80
|
defaultFilename: "Chart Export",
|
|
81
81
|
exportAsCsv: "Export as CSV"
|
|
82
|
-
},
|
|
83
|
-
renderer:
|
|
84
|
-
queryDataProvider:
|
|
85
|
-
csvExport:
|
|
86
|
-
jumpToExplore:
|
|
82
|
+
}, ai = "Explore", li = {
|
|
83
|
+
renderer: ri,
|
|
84
|
+
queryDataProvider: ni,
|
|
85
|
+
csvExport: oi,
|
|
86
|
+
jumpToExplore: ai
|
|
87
87
|
};
|
|
88
|
-
function
|
|
89
|
-
const u =
|
|
88
|
+
function hi() {
|
|
89
|
+
const u = jt("en-us", li);
|
|
90
90
|
return {
|
|
91
91
|
i18n: u,
|
|
92
|
-
i18nT:
|
|
92
|
+
i18nT: Qt(u)
|
|
93
93
|
// Translation component <i18n-t>
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
const Ve = 170, oe = "analytics-query-provider",
|
|
97
|
-
function
|
|
98
|
-
const u =
|
|
96
|
+
const Ve = 170, oe = "analytics-query-provider", st = "{entity-id}", di = "{cp-id}", ui = "{timeframe}", ci = 30 * 1e3;
|
|
97
|
+
function fi() {
|
|
98
|
+
const u = me(oe);
|
|
99
99
|
return {
|
|
100
100
|
evaluateFeatureFlag: (t, i) => u ? u.evaluateFeatureFlagFn(t, i) : i
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function gi(u) {
|
|
104
104
|
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
105
105
|
}
|
|
106
|
-
var
|
|
106
|
+
var Ct = { 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(
|
|
113
|
-
this.fn =
|
|
112
|
+
function s(d, h, a) {
|
|
113
|
+
this.fn = d, this.context = h, this.once = a || !1;
|
|
114
114
|
}
|
|
115
|
-
function r(
|
|
116
|
-
if (typeof
|
|
115
|
+
function r(d, h, a, l, f) {
|
|
116
|
+
if (typeof a != "function")
|
|
117
117
|
throw new TypeError("The listener must be a function");
|
|
118
|
-
var
|
|
119
|
-
return
|
|
118
|
+
var m = new s(a, l || d, f), p = t ? t + h : h;
|
|
119
|
+
return d._events[p] ? d._events[p].fn ? d._events[p] = [d._events[p], m] : d._events[p].push(m) : (d._events[p] = m, d._eventsCount++), d;
|
|
120
120
|
}
|
|
121
|
-
function o(
|
|
122
|
-
--
|
|
121
|
+
function o(d, h) {
|
|
122
|
+
--d._eventsCount === 0 ? d._events = new i() : delete d._events[h];
|
|
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 (
|
|
131
|
-
e.call(
|
|
132
|
-
return Object.getOwnPropertySymbols ?
|
|
133
|
-
}, n.prototype.listeners = function(
|
|
134
|
-
var
|
|
135
|
-
if (!
|
|
136
|
-
if (
|
|
137
|
-
for (var f = 0,
|
|
138
|
-
|
|
139
|
-
return
|
|
140
|
-
}, n.prototype.listenerCount = function(
|
|
141
|
-
var
|
|
142
|
-
return
|
|
143
|
-
}, n.prototype.emit = function(
|
|
144
|
-
var y = t ? t +
|
|
128
|
+
var h = [], a, l;
|
|
129
|
+
if (this._eventsCount === 0) return h;
|
|
130
|
+
for (l in a = this._events)
|
|
131
|
+
e.call(a, l) && h.push(t ? l.slice(1) : l);
|
|
132
|
+
return Object.getOwnPropertySymbols ? h.concat(Object.getOwnPropertySymbols(a)) : h;
|
|
133
|
+
}, n.prototype.listeners = function(h) {
|
|
134
|
+
var a = t ? t + h : h, l = this._events[a];
|
|
135
|
+
if (!l) return [];
|
|
136
|
+
if (l.fn) return [l.fn];
|
|
137
|
+
for (var f = 0, m = l.length, p = new Array(m); f < m; f++)
|
|
138
|
+
p[f] = l[f].fn;
|
|
139
|
+
return p;
|
|
140
|
+
}, n.prototype.listenerCount = function(h) {
|
|
141
|
+
var a = t ? t + h : h, l = this._events[a];
|
|
142
|
+
return l ? l.fn ? 1 : l.length : 0;
|
|
143
|
+
}, n.prototype.emit = function(h, a, l, f, m, p) {
|
|
144
|
+
var y = t ? t + h : h;
|
|
145
145
|
if (!this._events[y]) return !1;
|
|
146
146
|
var g = this._events[y], R = arguments.length, S, C;
|
|
147
147
|
if (g.fn) {
|
|
148
|
-
switch (g.once && this.removeListener(
|
|
148
|
+
switch (g.once && this.removeListener(h, g.fn, void 0, !0), R) {
|
|
149
149
|
case 1:
|
|
150
150
|
return g.fn.call(g.context), !0;
|
|
151
151
|
case 2:
|
|
152
|
-
return g.fn.call(g.context,
|
|
152
|
+
return g.fn.call(g.context, a), !0;
|
|
153
153
|
case 3:
|
|
154
|
-
return g.fn.call(g.context,
|
|
154
|
+
return g.fn.call(g.context, a, l), !0;
|
|
155
155
|
case 4:
|
|
156
|
-
return g.fn.call(g.context,
|
|
156
|
+
return g.fn.call(g.context, a, l, f), !0;
|
|
157
157
|
case 5:
|
|
158
|
-
return g.fn.call(g.context,
|
|
158
|
+
return g.fn.call(g.context, a, l, f, m), !0;
|
|
159
159
|
case 6:
|
|
160
|
-
return g.fn.call(g.context,
|
|
160
|
+
return g.fn.call(g.context, a, l, f, m, p), !0;
|
|
161
161
|
}
|
|
162
162
|
for (C = 1, S = new Array(R - 1); C < R; C++)
|
|
163
163
|
S[C - 1] = arguments[C];
|
|
164
164
|
g.fn.apply(g.context, S);
|
|
165
165
|
} else {
|
|
166
|
-
var
|
|
167
|
-
for (C = 0; C <
|
|
168
|
-
switch (g[C].once && this.removeListener(
|
|
166
|
+
var x = g.length, E;
|
|
167
|
+
for (C = 0; C < x; C++)
|
|
168
|
+
switch (g[C].once && this.removeListener(h, 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
|
-
g[C].fn.call(g[C].context,
|
|
173
|
+
g[C].fn.call(g[C].context, a);
|
|
174
174
|
break;
|
|
175
175
|
case 3:
|
|
176
|
-
g[C].fn.call(g[C].context,
|
|
176
|
+
g[C].fn.call(g[C].context, a, l);
|
|
177
177
|
break;
|
|
178
178
|
case 4:
|
|
179
|
-
g[C].fn.call(g[C].context,
|
|
179
|
+
g[C].fn.call(g[C].context, a, l, f);
|
|
180
180
|
break;
|
|
181
181
|
default:
|
|
182
|
-
if (!S) for (
|
|
183
|
-
S[
|
|
182
|
+
if (!S) for (E = 1, S = new Array(R - 1); E < R; E++)
|
|
183
|
+
S[E - 1] = arguments[E];
|
|
184
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
|
|
198
|
-
if (
|
|
199
|
-
|
|
188
|
+
}, n.prototype.on = function(h, a, l) {
|
|
189
|
+
return r(this, h, a, l, !1);
|
|
190
|
+
}, n.prototype.once = function(h, a, l) {
|
|
191
|
+
return r(this, h, a, l, !0);
|
|
192
|
+
}, n.prototype.removeListener = function(h, a, l, f) {
|
|
193
|
+
var m = t ? t + h : h;
|
|
194
|
+
if (!this._events[m]) return this;
|
|
195
|
+
if (!a)
|
|
196
|
+
return o(this, m), this;
|
|
197
|
+
var p = this._events[m];
|
|
198
|
+
if (p.fn)
|
|
199
|
+
p.fn === a && (!f || p.once) && (!l || p.context === l) && o(this, m);
|
|
200
200
|
else {
|
|
201
|
-
for (var y = 0, g = [], R =
|
|
202
|
-
(
|
|
203
|
-
g.length ? this._events[
|
|
201
|
+
for (var y = 0, g = [], R = p.length; y < R; y++)
|
|
202
|
+
(p[y].fn !== a || f && !p[y].once || l && p[y].context !== l) && g.push(p[y]);
|
|
203
|
+
g.length ? this._events[m] = g.length === 1 ? g[0] : g : o(this, m);
|
|
204
204
|
}
|
|
205
205
|
return this;
|
|
206
|
-
}, n.prototype.removeAllListeners = function(
|
|
207
|
-
var
|
|
208
|
-
return
|
|
206
|
+
}, n.prototype.removeAllListeners = function(h) {
|
|
207
|
+
var a;
|
|
208
|
+
return h ? (a = t ? t + h : h, this._events[a] && o(this, a)) : (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 pi = /* @__PURE__ */
|
|
213
|
-
class
|
|
210
|
+
})(Ct);
|
|
211
|
+
var mi = Ct.exports;
|
|
212
|
+
const pi = /* @__PURE__ */ gi(mi);
|
|
213
|
+
class Rt extends Error {
|
|
214
214
|
constructor(e) {
|
|
215
215
|
super(e), this.name = "TimeoutError";
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
class
|
|
218
|
+
class yi 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 rt = (u) => globalThis.DOMException === void 0 ? new yi(u) : new DOMException(u), nt = (u) => {
|
|
224
|
+
const e = u.reason === void 0 ? rt("This operation was aborted.") : u.reason;
|
|
225
|
+
return e instanceof Error ? e : rt(e);
|
|
226
226
|
};
|
|
227
|
-
function
|
|
227
|
+
function vi(u, e) {
|
|
228
228
|
const {
|
|
229
229
|
milliseconds: t,
|
|
230
230
|
fallback: i,
|
|
@@ -232,45 +232,45 @@ function yi(u, e) {
|
|
|
232
232
|
customTimers: r = { setTimeout, clearTimeout }
|
|
233
233
|
} = e;
|
|
234
234
|
let o, n;
|
|
235
|
-
const
|
|
235
|
+
const h = new Promise((a, l) => {
|
|
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
|
-
|
|
242
|
-
},
|
|
239
|
+
const { signal: m } = e;
|
|
240
|
+
m.aborted && l(nt(m)), n = () => {
|
|
241
|
+
l(nt(m));
|
|
242
|
+
}, m.addEventListener("abort", n, { once: !0 });
|
|
243
243
|
}
|
|
244
244
|
if (t === Number.POSITIVE_INFINITY) {
|
|
245
|
-
u.then(
|
|
245
|
+
u.then(a, l);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
const f = new
|
|
248
|
+
const f = new Rt();
|
|
249
249
|
o = r.setTimeout.call(void 0, () => {
|
|
250
250
|
if (i) {
|
|
251
251
|
try {
|
|
252
|
-
|
|
253
|
-
} catch (
|
|
254
|
-
|
|
252
|
+
a(i());
|
|
253
|
+
} catch (m) {
|
|
254
|
+
l(m);
|
|
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 ? a() : s instanceof Error ? l(s) : (f.message = s ?? `Promise timed out after ${t} milliseconds`, l(f));
|
|
259
259
|
}, t), (async () => {
|
|
260
260
|
try {
|
|
261
|
-
|
|
262
|
-
} catch (
|
|
263
|
-
|
|
261
|
+
a(await u);
|
|
262
|
+
} catch (m) {
|
|
263
|
+
l(m);
|
|
264
264
|
}
|
|
265
265
|
})();
|
|
266
266
|
}).finally(() => {
|
|
267
|
-
|
|
267
|
+
h.clear(), n && e.signal && e.signal.removeEventListener("abort", n);
|
|
268
268
|
});
|
|
269
|
-
return
|
|
269
|
+
return h.clear = () => {
|
|
270
270
|
r.clearTimeout.call(void 0, o), o = void 0;
|
|
271
|
-
},
|
|
271
|
+
}, h;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function _i(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 vi(u, e, t) {
|
|
|
280
280
|
return i;
|
|
281
281
|
}
|
|
282
282
|
var W;
|
|
283
|
-
class
|
|
283
|
+
class wi {
|
|
284
284
|
constructor() {
|
|
285
285
|
O(this, W, []);
|
|
286
286
|
}
|
|
@@ -298,7 +298,7 @@ class _i {
|
|
|
298
298
|
v(this, W).push(i);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
const s =
|
|
301
|
+
const s = _i(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,13 +320,13 @@ class _i {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
W = new WeakMap();
|
|
323
|
-
var he, de, re, be, ue, Ee, V, ce,
|
|
324
|
-
class
|
|
323
|
+
var he, de, re, be, ue, Ee, V, ce, q, xe, K, fe, ee, Ce, Oe, T, zt, Tt, Dt, St, kt, ze, qe, Be, Te, Nt, De;
|
|
324
|
+
class bi 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
|
-
O(this,
|
|
329
|
+
O(this, T);
|
|
330
330
|
O(this, he);
|
|
331
331
|
O(this, de);
|
|
332
332
|
O(this, re, 0);
|
|
@@ -335,12 +335,12 @@ class wi extends pi {
|
|
|
335
335
|
O(this, Ee, 0);
|
|
336
336
|
O(this, V);
|
|
337
337
|
O(this, ce);
|
|
338
|
-
O(this,
|
|
338
|
+
O(this, q);
|
|
339
339
|
O(this, xe);
|
|
340
340
|
O(this, K, 0);
|
|
341
341
|
// The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
|
|
342
342
|
O(this, fe);
|
|
343
|
-
O(this,
|
|
343
|
+
O(this, ee);
|
|
344
344
|
O(this, Ce);
|
|
345
345
|
// Use to assign a unique identifier to a promise function, if not explicitly specified
|
|
346
346
|
O(this, Oe, 1n);
|
|
@@ -356,13 +356,13 @@ class wi extends pi {
|
|
|
356
356
|
interval: 0,
|
|
357
357
|
concurrency: Number.POSITIVE_INFINITY,
|
|
358
358
|
autoStart: !0,
|
|
359
|
-
queueClass:
|
|
359
|
+
queueClass: wi,
|
|
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, 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,
|
|
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, q, new t.queueClass()), N(this, xe, t.queueClass), this.concurrency = t.concurrency, this.timeout = t.timeout, N(this, Ce, t.throwOnTimeout === !0), N(this, ee, t.autoStart === !1);
|
|
366
366
|
}
|
|
367
367
|
get concurrency() {
|
|
368
368
|
return v(this, fe);
|
|
@@ -370,7 +370,7 @@ class wi extends pi {
|
|
|
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, fe, t), L(this,
|
|
373
|
+
N(this, fe, t), L(this, T, Te).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.
|
|
@@ -409,33 +409,33 @@ class wi extends pi {
|
|
|
409
409
|
Here, the promise function with `id: '🦀'` executes last.
|
|
410
410
|
*/
|
|
411
411
|
setPriority(t, i) {
|
|
412
|
-
v(this,
|
|
412
|
+
v(this, q).setPriority(t, i);
|
|
413
413
|
}
|
|
414
414
|
async add(t, i = {}) {
|
|
415
|
-
return i.id ?? (i.id = (
|
|
415
|
+
return i.id ?? (i.id = (ye(this, Oe)._++).toString()), i = {
|
|
416
416
|
timeout: this.timeout,
|
|
417
417
|
throwOnTimeout: v(this, Ce),
|
|
418
418
|
...i
|
|
419
419
|
}, new Promise((s, r) => {
|
|
420
|
-
v(this,
|
|
420
|
+
v(this, q).enqueue(async () => {
|
|
421
421
|
var o;
|
|
422
|
-
|
|
422
|
+
ye(this, K)._++, ye(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 = vi(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, L(this, T, Nt).call(this, i.signal)]));
|
|
427
|
+
const d = await n;
|
|
428
|
+
s(d), this.emit("completed", d);
|
|
429
429
|
} catch (n) {
|
|
430
|
-
if (n instanceof
|
|
430
|
+
if (n instanceof Rt && !i.throwOnTimeout) {
|
|
431
431
|
s();
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
434
|
r(n), this.emit("error", n);
|
|
435
435
|
} finally {
|
|
436
|
-
L(this,
|
|
436
|
+
L(this, T, Dt).call(this);
|
|
437
437
|
}
|
|
438
|
-
}, i), this.emit("add"), L(this,
|
|
438
|
+
}, i), this.emit("add"), L(this, T, ze).call(this);
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
async addAll(t, i) {
|
|
@@ -445,19 +445,19 @@ class wi extends pi {
|
|
|
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,
|
|
448
|
+
return v(this, ee) ? (N(this, ee, !1), L(this, T, Te).call(this), this) : this;
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
451
451
|
Put queue execution on hold.
|
|
452
452
|
*/
|
|
453
453
|
pause() {
|
|
454
|
-
N(this,
|
|
454
|
+
N(this, ee, !0);
|
|
455
455
|
}
|
|
456
456
|
/**
|
|
457
457
|
Clear the queue.
|
|
458
458
|
*/
|
|
459
459
|
clear() {
|
|
460
|
-
N(this,
|
|
460
|
+
N(this, q, 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 wi extends pi {
|
|
|
465
465
|
@returns A promise that settles when the queue becomes empty.
|
|
466
466
|
*/
|
|
467
467
|
async onEmpty() {
|
|
468
|
-
v(this,
|
|
468
|
+
v(this, q).size !== 0 && await L(this, T, De).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 wi extends pi {
|
|
|
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,
|
|
478
|
+
v(this, q).size < t || await L(this, T, De).call(this, "next", () => v(this, q).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,13 +483,13 @@ class wi extends pi {
|
|
|
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, K) === 0 && v(this,
|
|
486
|
+
v(this, K) === 0 && v(this, q).size === 0 || await L(this, T, De).call(this, "idle");
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
489
489
|
Size of the queue, the number of queued items waiting to run.
|
|
490
490
|
*/
|
|
491
491
|
get size() {
|
|
492
|
-
return v(this,
|
|
492
|
+
return v(this, q).size;
|
|
493
493
|
}
|
|
494
494
|
/**
|
|
495
495
|
Size of the queue, filtered by the given options.
|
|
@@ -497,7 +497,7 @@ class wi extends pi {
|
|
|
497
497
|
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
498
498
|
*/
|
|
499
499
|
sizeBy(t) {
|
|
500
|
-
return v(this,
|
|
500
|
+
return v(this, q).filter(t).length;
|
|
501
501
|
}
|
|
502
502
|
/**
|
|
503
503
|
Number of running items (no longer in the queue).
|
|
@@ -509,18 +509,18 @@ class wi extends pi {
|
|
|
509
509
|
Whether the queue is currently paused.
|
|
510
510
|
*/
|
|
511
511
|
get isPaused() {
|
|
512
|
-
return v(this,
|
|
512
|
+
return v(this, ee);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
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(),
|
|
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(), q = new WeakMap(), xe = new WeakMap(), K = new WeakMap(), fe = new WeakMap(), ee = new WeakMap(), Ce = new WeakMap(), Oe = new WeakMap(), T = new WeakSet(), zt = function() {
|
|
516
516
|
return v(this, de) || v(this, re) < v(this, be);
|
|
517
517
|
}, Tt = function() {
|
|
518
518
|
return v(this, K) < v(this, fe);
|
|
519
519
|
}, Dt = function() {
|
|
520
|
-
|
|
521
|
-
}, zt = function() {
|
|
522
|
-
L(this, D, Be).call(this), L(this, D, qe).call(this), N(this, ce, void 0);
|
|
520
|
+
ye(this, K)._--, L(this, T, ze).call(this), this.emit("next");
|
|
523
521
|
}, St = function() {
|
|
522
|
+
L(this, T, Be).call(this), L(this, T, qe).call(this), N(this, ce, void 0);
|
|
523
|
+
}, kt = function() {
|
|
524
524
|
const t = Date.now();
|
|
525
525
|
if (v(this, V) === void 0) {
|
|
526
526
|
const i = v(this, Ee) - t;
|
|
@@ -528,40 +528,40 @@ he = new WeakMap(), de = new WeakMap(), re = new WeakMap(), be = new WeakMap(),
|
|
|
528
528
|
N(this, re, v(this, he) ? v(this, K) : 0);
|
|
529
529
|
else
|
|
530
530
|
return v(this, ce) === void 0 && N(this, ce, setTimeout(() => {
|
|
531
|
-
L(this,
|
|
531
|
+
L(this, T, St).call(this);
|
|
532
532
|
}, i)), !0;
|
|
533
533
|
}
|
|
534
534
|
return !1;
|
|
535
|
-
},
|
|
536
|
-
if (v(this,
|
|
535
|
+
}, ze = function() {
|
|
536
|
+
if (v(this, q).size === 0)
|
|
537
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
|
-
if (!v(this,
|
|
539
|
-
const t = !v(this,
|
|
540
|
-
if (v(this,
|
|
541
|
-
const i = v(this,
|
|
542
|
-
return i ? (this.emit("active"), i(), t && L(this,
|
|
538
|
+
if (!v(this, ee)) {
|
|
539
|
+
const t = !v(this, T, kt);
|
|
540
|
+
if (v(this, T, zt) && v(this, T, Tt)) {
|
|
541
|
+
const i = v(this, q).dequeue();
|
|
542
|
+
return i ? (this.emit("active"), i(), t && L(this, T, qe).call(this), !0) : !1;
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
return !1;
|
|
546
546
|
}, qe = function() {
|
|
547
547
|
v(this, de) || v(this, V) !== void 0 || (N(this, V, setInterval(() => {
|
|
548
|
-
L(this,
|
|
548
|
+
L(this, T, Be).call(this);
|
|
549
549
|
}, v(this, ue))), N(this, Ee, Date.now() + v(this, ue)));
|
|
550
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,
|
|
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, T, Te).call(this);
|
|
552
552
|
}, /**
|
|
553
553
|
Executes all queued functions until it reaches the limit.
|
|
554
554
|
*/
|
|
555
|
-
|
|
556
|
-
for (; L(this,
|
|
555
|
+
Te = function() {
|
|
556
|
+
for (; L(this, T, ze).call(this); )
|
|
557
557
|
;
|
|
558
|
-
},
|
|
558
|
+
}, Nt = 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
|
+
}, De = 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 @@ De = function() {
|
|
|
569
569
|
this.on(t, r);
|
|
570
570
|
});
|
|
571
571
|
};
|
|
572
|
-
const
|
|
573
|
-
const u =
|
|
572
|
+
const Ei = () => {
|
|
573
|
+
const u = Et(), e = me(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 bi({
|
|
581
581
|
carryoverConcurrencyCount: !0,
|
|
582
582
|
concurrency: u.maxParallelRequests,
|
|
583
583
|
interval: u.requestInterval,
|
|
@@ -587,12 +587,12 @@ const bi = () => {
|
|
|
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
|
-
}, Ke = /* @__PURE__ */
|
|
590
|
+
Mt(oe, i);
|
|
591
|
+
}, ge = {
|
|
592
|
+
useI18n: hi,
|
|
593
|
+
useEvaluateFeatureFlag: fi,
|
|
594
|
+
useRequestQueue: Ei
|
|
595
|
+
}, Ke = /* @__PURE__ */ G({
|
|
596
596
|
__name: "QueryDataProvider",
|
|
597
597
|
props: {
|
|
598
598
|
context: {},
|
|
@@ -602,73 +602,73 @@ const bi = () => {
|
|
|
602
602
|
},
|
|
603
603
|
emits: ["chart-data", "queryComplete"],
|
|
604
604
|
setup(u, { emit: e }) {
|
|
605
|
-
const t = u, i = e, { i18n: s } =
|
|
605
|
+
const t = u, i = e, { i18n: s } = ge.useI18n(), r = me(oe), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, n = new AbortController();
|
|
606
606
|
$e(() => {
|
|
607
607
|
n.abort();
|
|
608
608
|
});
|
|
609
|
-
const
|
|
610
|
-
const
|
|
611
|
-
return S &&
|
|
612
|
-
}, { data:
|
|
613
|
-
var R, S, C,
|
|
609
|
+
const d = (R, S, C) => {
|
|
610
|
+
const x = [];
|
|
611
|
+
return S && x.push(...S), x.push(...$t(R, C)), x;
|
|
612
|
+
}, { data: h, error: a, isValidating: l } = Xt(o, async () => {
|
|
613
|
+
var R, S, C, x;
|
|
614
614
|
try {
|
|
615
615
|
let {
|
|
616
|
-
datasource:
|
|
617
|
-
...
|
|
616
|
+
datasource: E,
|
|
617
|
+
...D
|
|
618
618
|
} = t.query;
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
let
|
|
622
|
-
|
|
623
|
-
...
|
|
619
|
+
E || (E = "basic");
|
|
620
|
+
const B = d(E, t.query.filters, t.context.filters);
|
|
621
|
+
let I = t.query.time_range;
|
|
622
|
+
I ? I.tz || (I = {
|
|
623
|
+
...I,
|
|
624
624
|
tz: t.context.tz
|
|
625
|
-
}) :
|
|
625
|
+
}) : I = {
|
|
626
626
|
...t.context.timeSpec,
|
|
627
627
|
tz: t.context.tz
|
|
628
628
|
};
|
|
629
629
|
const Re = {
|
|
630
|
-
datasource:
|
|
630
|
+
datasource: E,
|
|
631
631
|
query: {
|
|
632
|
-
...
|
|
633
|
-
time_range:
|
|
634
|
-
filters:
|
|
632
|
+
...D,
|
|
633
|
+
time_range: I,
|
|
634
|
+
filters: B
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
637
|
return r == null ? void 0 : r.queryFn(Re, n);
|
|
638
|
-
} catch (
|
|
639
|
-
|
|
638
|
+
} catch (E) {
|
|
639
|
+
p.value = ((S = (R = E == null ? void 0 : E.response) == null ? void 0 : R.data) == null ? void 0 : S.message) === "Range not allowed for this tier" ? s.t("queryDataProvider.timeRangeExceeded") : ((x = (C = E == null ? void 0 : E.response) == null ? void 0 : C.data) == null ? void 0 : x.message) || (E == null ? void 0 : E.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
|
|
646
|
+
}), { state: f, swrvState: m } = si(h, a, l), p = $(null), y = A(() => f.value === m.ERROR || !!p.value), g = A(() => !t.queryReady || f.value === m.PENDING);
|
|
647
|
+
return Fe(h, (R) => {
|
|
648
648
|
R && i("chart-data", R);
|
|
649
649
|
}), (R, S) => {
|
|
650
|
-
const C = ne("KSkeleton"),
|
|
651
|
-
return g.value || !k(
|
|
650
|
+
const C = ne("KSkeleton"), x = ne("KEmptyState");
|
|
651
|
+
return g.value || !k(h) && !y.value ? (z(), H(C, {
|
|
652
652
|
key: 0,
|
|
653
653
|
class: "chart-skeleton",
|
|
654
654
|
type: "table"
|
|
655
|
-
})) : y.value ? (
|
|
655
|
+
})) : y.value ? (z(), H(x, {
|
|
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
|
+
ve(te(p.value), 1)
|
|
663
663
|
]),
|
|
664
664
|
_: 1
|
|
665
|
-
})) : k(
|
|
665
|
+
})) : k(h) ? Le(R.$slots, "default", {
|
|
666
666
|
key: 2,
|
|
667
|
-
data: k(
|
|
667
|
+
data: k(h)
|
|
668
668
|
}) : X("", !0);
|
|
669
669
|
};
|
|
670
670
|
}
|
|
671
|
-
}),
|
|
671
|
+
}), xi = /* @__PURE__ */ G({
|
|
672
672
|
__name: "SimpleChartRenderer",
|
|
673
673
|
props: {
|
|
674
674
|
query: {},
|
|
@@ -679,11 +679,11 @@ const bi = () => {
|
|
|
679
679
|
refreshCounter: {}
|
|
680
680
|
},
|
|
681
681
|
setup(u) {
|
|
682
|
-
|
|
682
|
+
Ue((i) => ({
|
|
683
683
|
"35a26ebf": `${i.height}px`
|
|
684
684
|
}));
|
|
685
|
-
const e = u, t =
|
|
686
|
-
return (i, s) => (
|
|
685
|
+
const e = u, t = A(() => e.chartOptions.type === "single_value");
|
|
686
|
+
return (i, s) => (z(), H(Ke, {
|
|
687
687
|
context: i.context,
|
|
688
688
|
query: i.query,
|
|
689
689
|
"query-ready": i.queryReady,
|
|
@@ -691,9 +691,9 @@ const bi = () => {
|
|
|
691
691
|
}, {
|
|
692
692
|
default: M(({ data: r }) => [
|
|
693
693
|
le("div", {
|
|
694
|
-
class:
|
|
694
|
+
class: Ge(["analytics-chart", { "single-value": t.value }])
|
|
695
695
|
}, [
|
|
696
|
-
|
|
696
|
+
ie(k(Wt), {
|
|
697
697
|
"chart-data": r,
|
|
698
698
|
"chart-options": i.chartOptions,
|
|
699
699
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.syntheticsDataKey
|
|
@@ -708,7 +708,7 @@ const bi = () => {
|
|
|
708
708
|
for (const [i, s] of e)
|
|
709
709
|
t[i] = s;
|
|
710
710
|
return t;
|
|
711
|
-
},
|
|
711
|
+
}, ot = /* @__PURE__ */ ae(xi, [["__scopeId", "data-v-65cc8607"]]), Ci = { class: "analytics-chart" }, Ri = /* @__PURE__ */ G({
|
|
712
712
|
__name: "BaseAnalyticsChartRenderer",
|
|
713
713
|
props: {
|
|
714
714
|
query: {},
|
|
@@ -719,58 +719,61 @@ const bi = () => {
|
|
|
719
719
|
refreshCounter: {},
|
|
720
720
|
extraProps: {}
|
|
721
721
|
},
|
|
722
|
-
emits: ["edit-tile", "chart-data"],
|
|
722
|
+
emits: ["edit-tile", "chart-data", "zoom-time-range"],
|
|
723
723
|
setup(u, { emit: e }) {
|
|
724
|
-
const t = u, i = e, { i18n: s } =
|
|
724
|
+
const t = u, i = e, { i18n: s } = ge.useI18n(), { evaluateFeatureFlag: r } = ge.useEvaluateFeatureFlag(), o = r("explore-v4-fine-granularity", !1), n = A(() => ({
|
|
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
|
+
})), d = () => {
|
|
730
730
|
i("edit-tile");
|
|
731
|
-
},
|
|
731
|
+
}, h = (a) => {
|
|
732
732
|
i("chart-data", a);
|
|
733
733
|
};
|
|
734
|
-
return (a,
|
|
735
|
-
const
|
|
736
|
-
return
|
|
734
|
+
return (a, l) => {
|
|
735
|
+
const f = ne("KDropdownItem");
|
|
736
|
+
return z(), H(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: h
|
|
742
742
|
}, {
|
|
743
|
-
default: M(({ data:
|
|
744
|
-
le("div",
|
|
745
|
-
|
|
743
|
+
default: M(({ data: m }) => [
|
|
744
|
+
le("div", Ci, [
|
|
745
|
+
ie(k(Vt), mt({
|
|
746
746
|
"allow-csv-export": a.chartOptions.allowCsvExport,
|
|
747
|
-
"chart-data":
|
|
748
|
-
"chart-options":
|
|
747
|
+
"chart-data": m,
|
|
748
|
+
"chart-options": n.value,
|
|
749
749
|
"legend-position": "bottom",
|
|
750
750
|
"show-menu": a.context.editable,
|
|
751
751
|
"synthetics-data-key": a.chartOptions.syntheticsDataKey,
|
|
752
|
+
"timeseries-zoom": k(o) && !a.query.time_range,
|
|
752
753
|
"tooltip-title": ""
|
|
753
|
-
}, a.extraProps
|
|
754
|
+
}, a.extraProps, {
|
|
755
|
+
onZoomTimeRange: l[0] || (l[0] = (p) => i("zoom-time-range", p))
|
|
756
|
+
}), pt({ _: 2 }, [
|
|
754
757
|
a.context.editable ? {
|
|
755
758
|
name: "menu-items",
|
|
756
759
|
fn: M(() => [
|
|
757
|
-
|
|
760
|
+
ie(f, { onClick: d }, {
|
|
758
761
|
default: M(() => [
|
|
759
|
-
|
|
762
|
+
ve(te(k(s).t("renderer.edit")), 1)
|
|
760
763
|
]),
|
|
761
764
|
_: 1
|
|
762
765
|
})
|
|
763
766
|
]),
|
|
764
767
|
key: "0"
|
|
765
768
|
} : void 0
|
|
766
|
-
]), 1040, ["allow-csv-export", "chart-data", "chart-options", "show-menu", "synthetics-data-key"])
|
|
769
|
+
]), 1040, ["allow-csv-export", "chart-data", "chart-options", "show-menu", "synthetics-data-key", "timeseries-zoom"])
|
|
767
770
|
])
|
|
768
771
|
]),
|
|
769
772
|
_: 1
|
|
770
773
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
771
774
|
};
|
|
772
775
|
}
|
|
773
|
-
}), Ye = /* @__PURE__ */ ae(
|
|
776
|
+
}), Ye = /* @__PURE__ */ ae(Ri, [["__scopeId", "data-v-a9ee3db9"]]), at = /* @__PURE__ */ G({
|
|
774
777
|
__name: "BarChartRenderer",
|
|
775
778
|
props: {
|
|
776
779
|
query: {},
|
|
@@ -781,7 +784,7 @@ const bi = () => {
|
|
|
781
784
|
refreshCounter: {}
|
|
782
785
|
},
|
|
783
786
|
setup(u) {
|
|
784
|
-
return (e, t) => (
|
|
787
|
+
return (e, t) => (z(), H(Ye, {
|
|
785
788
|
"chart-options": e.chartOptions,
|
|
786
789
|
context: e.context,
|
|
787
790
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -791,7 +794,7 @@ const bi = () => {
|
|
|
791
794
|
"refresh-counter": e.refreshCounter
|
|
792
795
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
793
796
|
}
|
|
794
|
-
}),
|
|
797
|
+
}), lt = /* @__PURE__ */ G({
|
|
795
798
|
__name: "TimeseriesChartRenderer",
|
|
796
799
|
props: {
|
|
797
800
|
query: {},
|
|
@@ -801,17 +804,20 @@ const bi = () => {
|
|
|
801
804
|
height: {},
|
|
802
805
|
refreshCounter: {}
|
|
803
806
|
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
807
|
+
emits: ["zoom-time-range"],
|
|
808
|
+
setup(u, { emit: e }) {
|
|
809
|
+
const t = e;
|
|
810
|
+
return (i, s) => (z(), H(Ye, {
|
|
811
|
+
"chart-options": i.chartOptions,
|
|
812
|
+
context: i.context,
|
|
813
|
+
height: i.height,
|
|
814
|
+
query: i.query,
|
|
815
|
+
"query-ready": i.queryReady,
|
|
816
|
+
"refresh-counter": i.refreshCounter,
|
|
817
|
+
onZoomTimeRange: s[0] || (s[0] = (r) => t("zoom-time-range", r))
|
|
812
818
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
813
819
|
}
|
|
814
|
-
}),
|
|
820
|
+
}), zi = { class: "metric-card-tile-wrapper" }, Ti = /* @__PURE__ */ G({
|
|
815
821
|
__name: "GoldenSignalsRenderer",
|
|
816
822
|
props: {
|
|
817
823
|
query: {},
|
|
@@ -822,10 +828,10 @@ const bi = () => {
|
|
|
822
828
|
refreshCounter: {}
|
|
823
829
|
},
|
|
824
830
|
setup(u) {
|
|
825
|
-
const e = u, t =
|
|
831
|
+
const e = u, t = A(() => {
|
|
826
832
|
const s = e.context.timeSpec;
|
|
827
833
|
if (s.type === "absolute")
|
|
828
|
-
return new
|
|
834
|
+
return new Ft({
|
|
829
835
|
key: "custom",
|
|
830
836
|
timeframeText: "custom",
|
|
831
837
|
display: "custom",
|
|
@@ -837,11 +843,11 @@ const bi = () => {
|
|
|
837
843
|
isRelative: !1,
|
|
838
844
|
allowedTiers: ["free", "plus", "enterprise"]
|
|
839
845
|
});
|
|
840
|
-
const r =
|
|
846
|
+
const r = bt.get(s.time_range);
|
|
841
847
|
if (!r)
|
|
842
848
|
throw new Error("Unknown time range");
|
|
843
849
|
return r;
|
|
844
|
-
}), i =
|
|
850
|
+
}), i = A(() => {
|
|
845
851
|
var r, o;
|
|
846
852
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
847
853
|
if (s && s !== "advanced" && s !== "basic")
|
|
@@ -859,27 +865,27 @@ const bi = () => {
|
|
|
859
865
|
refreshCounter: e.refreshCounter
|
|
860
866
|
};
|
|
861
867
|
});
|
|
862
|
-
return (s, r) => (
|
|
863
|
-
|
|
868
|
+
return (s, r) => (z(), F("div", zi, [
|
|
869
|
+
ie(k(Zt), It(Pt(i.value)), {
|
|
864
870
|
default: M(() => [
|
|
865
|
-
|
|
871
|
+
ie(k(Jt))
|
|
866
872
|
]),
|
|
867
873
|
_: 1
|
|
868
874
|
}, 16)
|
|
869
875
|
]));
|
|
870
876
|
}
|
|
871
|
-
}), Di = /* @__PURE__ */ ae(Ti, [["__scopeId", "data-v-bd5889d1"]]),
|
|
877
|
+
}), Di = /* @__PURE__ */ ae(Ti, [["__scopeId", "data-v-bd5889d1"]]), ht = "#6c7489", dt = "20px", At = "20px", Si = {
|
|
872
878
|
class: "fallback-entity-link",
|
|
873
879
|
"data-testid": "entity-link-parent"
|
|
874
|
-
},
|
|
880
|
+
}, ut = /* @__PURE__ */ G({
|
|
875
881
|
__name: "FallbackEntityLink",
|
|
876
882
|
props: {
|
|
877
883
|
entityLinkData: {}
|
|
878
884
|
},
|
|
879
885
|
setup(u) {
|
|
880
|
-
return (e, t) => (
|
|
886
|
+
return (e, t) => (z(), F("div", Si, te(e.entityLinkData.label), 1));
|
|
881
887
|
}
|
|
882
|
-
}),
|
|
888
|
+
}), ki = /* @__PURE__ */ G({
|
|
883
889
|
__name: "TopNTableRenderer",
|
|
884
890
|
props: {
|
|
885
891
|
query: {},
|
|
@@ -890,45 +896,45 @@ const bi = () => {
|
|
|
890
896
|
refreshCounter: {}
|
|
891
897
|
},
|
|
892
898
|
setup(u) {
|
|
893
|
-
const e = u, t =
|
|
899
|
+
const e = u, t = me(oe), i = qt(async () => {
|
|
894
900
|
if (t != null && t.fetchComponent)
|
|
895
901
|
try {
|
|
896
902
|
return await t.fetchComponent("EntityLink");
|
|
897
903
|
} catch {
|
|
898
|
-
return
|
|
904
|
+
return ut;
|
|
899
905
|
}
|
|
900
|
-
return
|
|
906
|
+
return ut;
|
|
901
907
|
}), s = (r) => {
|
|
902
908
|
var o;
|
|
903
909
|
if ((o = e.chartOptions) != null && o.entityLink)
|
|
904
910
|
if (r.id.includes(":")) {
|
|
905
|
-
const [n,
|
|
906
|
-
return e.chartOptions.entityLink.replace(
|
|
911
|
+
const [n, d] = r.id.split(":");
|
|
912
|
+
return e.chartOptions.entityLink.replace(di, n).replace(st, d);
|
|
907
913
|
} else
|
|
908
|
-
return e.chartOptions.entityLink.replace(
|
|
914
|
+
return e.chartOptions.entityLink.replace(st, r.id);
|
|
909
915
|
return "";
|
|
910
916
|
};
|
|
911
|
-
return (r, o) => (
|
|
917
|
+
return (r, o) => (z(), H(Ke, {
|
|
912
918
|
context: r.context,
|
|
913
919
|
query: r.query,
|
|
914
920
|
"query-ready": r.queryReady,
|
|
915
921
|
"refresh-counter": r.refreshCounter
|
|
916
922
|
}, {
|
|
917
923
|
default: M(({ data: n }) => [
|
|
918
|
-
|
|
924
|
+
ie(k(Kt), {
|
|
919
925
|
data: n,
|
|
920
926
|
"synthetics-data-key": r.chartOptions.syntheticsDataKey
|
|
921
927
|
}, pt({ _: 2 }, [
|
|
922
928
|
e.chartOptions.entityLink ? {
|
|
923
929
|
name: "name",
|
|
924
|
-
fn: M(({ record:
|
|
925
|
-
|
|
930
|
+
fn: M(({ record: d }) => [
|
|
931
|
+
ie(k(i), {
|
|
926
932
|
"entity-link-data": {
|
|
927
|
-
id:
|
|
928
|
-
label:
|
|
929
|
-
deleted:
|
|
933
|
+
id: d.id,
|
|
934
|
+
label: d.name,
|
|
935
|
+
deleted: d.deleted
|
|
930
936
|
},
|
|
931
|
-
"external-link": s(
|
|
937
|
+
"external-link": s(d)
|
|
932
938
|
}, null, 8, ["entity-link-data", "external-link"])
|
|
933
939
|
]),
|
|
934
940
|
key: "0"
|
|
@@ -938,7 +944,7 @@ const bi = () => {
|
|
|
938
944
|
_: 1
|
|
939
945
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
940
946
|
}
|
|
941
|
-
}),
|
|
947
|
+
}), Ni = /* @__PURE__ */ G({
|
|
942
948
|
__name: "DonutChartRenderer",
|
|
943
949
|
props: {
|
|
944
950
|
query: {},
|
|
@@ -949,7 +955,7 @@ const bi = () => {
|
|
|
949
955
|
refreshCounter: {}
|
|
950
956
|
},
|
|
951
957
|
setup(u) {
|
|
952
|
-
return (e, t) => (
|
|
958
|
+
return (e, t) => (z(), H(Ye, {
|
|
953
959
|
"chart-options": e.chartOptions,
|
|
954
960
|
context: e.context,
|
|
955
961
|
height: e.height,
|
|
@@ -958,10 +964,10 @@ const bi = () => {
|
|
|
958
964
|
"refresh-counter": e.refreshCounter
|
|
959
965
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
960
966
|
}
|
|
961
|
-
}),
|
|
967
|
+
}), Ai = ["data-testid"], Hi = {
|
|
962
968
|
key: 0,
|
|
963
969
|
class: "tile-header"
|
|
964
|
-
},
|
|
970
|
+
}, Oi = ["data-testid"], Li = ["data-testid"], Mi = ["data-testid"], Ii = ["data-testid"], Pi = /* @__PURE__ */ G({
|
|
965
971
|
__name: "DashboardTile",
|
|
966
972
|
props: {
|
|
967
973
|
definition: {},
|
|
@@ -971,44 +977,44 @@ const bi = () => {
|
|
|
971
977
|
refreshCounter: {},
|
|
972
978
|
tileId: {}
|
|
973
979
|
},
|
|
974
|
-
emits: ["edit-tile", "remove-tile"],
|
|
980
|
+
emits: ["edit-tile", "remove-tile", "zoom-time-range"],
|
|
975
981
|
setup(u, { emit: e }) {
|
|
976
|
-
|
|
977
|
-
"
|
|
982
|
+
Ue((w) => ({
|
|
983
|
+
"050eccb7": `${w.height}px`
|
|
978
984
|
}));
|
|
979
|
-
const t = parseInt(
|
|
985
|
+
const t = parseInt(At, 10), i = u, s = e, r = me(oe), { i18n: o } = ge.useI18n(), n = $(), d = $(!1), h = $(), a = $(!1), l = $("");
|
|
980
986
|
We(async () => {
|
|
981
987
|
var w;
|
|
982
|
-
|
|
983
|
-
}),
|
|
984
|
-
await
|
|
988
|
+
l.value = await ((w = r == null ? void 0 : r.exploreBaseUrl) == null ? void 0 : w.call(r)) ?? "";
|
|
989
|
+
}), Fe(() => i.definition, async () => {
|
|
990
|
+
await yt(), h.value && (a.value = h.value.scrollWidth > h.value.clientWidth);
|
|
985
991
|
}, { immediate: !0, deep: !0 });
|
|
986
|
-
const f =
|
|
987
|
-
if (!
|
|
992
|
+
const f = A(() => {
|
|
993
|
+
if (!l.value || !i.definition.query || !y.value)
|
|
988
994
|
return "";
|
|
989
|
-
const w = [...i.context.filters, ...i.definition.query.filters ?? []],
|
|
990
|
-
if (w.some((se) => "dimension" in se && Y.has(se.dimension) || "field" in se && Y.has(se.field)) ||
|
|
995
|
+
const w = [...i.context.filters, ...i.definition.query.filters ?? []], Q = i.definition.query.dimensions ?? [], Y = /* @__PURE__ */ new Set(["portal", "api"]);
|
|
996
|
+
if (w.some((se) => "dimension" in se && Y.has(se.dimension) || "field" in se && Y.has(se.field)) || Q.some((se) => Y.has(se)))
|
|
991
997
|
return "";
|
|
992
998
|
const Ie = {
|
|
993
999
|
filters: w,
|
|
994
1000
|
metrics: i.definition.query.metrics ?? [],
|
|
995
|
-
dimensions:
|
|
1001
|
+
dimensions: Q,
|
|
996
1002
|
time_range: i.definition.query.time_range || i.context.timeSpec,
|
|
997
|
-
granularity: i.definition.query.granularity ||
|
|
1003
|
+
granularity: i.definition.query.granularity || x.value
|
|
998
1004
|
}, pe = ["advanced", "ai"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "advanced";
|
|
999
|
-
return `${
|
|
1000
|
-
}),
|
|
1001
|
-
timeseries_line:
|
|
1002
|
-
timeseries_bar:
|
|
1003
|
-
horizontal_bar:
|
|
1004
|
-
vertical_bar:
|
|
1005
|
-
gauge:
|
|
1006
|
-
donut:
|
|
1005
|
+
return `${l.value}?q=${JSON.stringify(Ie)}&d=${pe}&c=${i.definition.chart.type}`;
|
|
1006
|
+
}), m = A(() => o.t("csvExport.defaultFilename")), p = A(() => y.value && (g.value || i.context.editable) || !!C.value), y = A(() => !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), g = A(() => !!f.value || "allowCsvExport" in i.definition.chart && i.definition.chart.allowCsvExport || i.context.editable), R = {
|
|
1007
|
+
timeseries_line: lt,
|
|
1008
|
+
timeseries_bar: lt,
|
|
1009
|
+
horizontal_bar: at,
|
|
1010
|
+
vertical_bar: at,
|
|
1011
|
+
gauge: ot,
|
|
1012
|
+
donut: Ni,
|
|
1007
1013
|
golden_signals: Di,
|
|
1008
|
-
top_n:
|
|
1014
|
+
top_n: ki,
|
|
1009
1015
|
slottable: void 0,
|
|
1010
|
-
single_value:
|
|
1011
|
-
}, S =
|
|
1016
|
+
single_value: ot
|
|
1017
|
+
}, S = A(() => {
|
|
1012
1018
|
const w = R[i.definition.chart.type];
|
|
1013
1019
|
return w && {
|
|
1014
1020
|
component: w,
|
|
@@ -1021,149 +1027,152 @@ const bi = () => {
|
|
|
1021
1027
|
refreshCounter: i.refreshCounter
|
|
1022
1028
|
}
|
|
1023
1029
|
};
|
|
1024
|
-
}), C =
|
|
1025
|
-
var
|
|
1026
|
-
const w = (
|
|
1030
|
+
}), C = A(() => {
|
|
1031
|
+
var Q;
|
|
1032
|
+
const w = (Q = i.definition.query) == null ? void 0 : Q.time_range;
|
|
1027
1033
|
if ((w == null ? void 0 : w.type) === "relative") {
|
|
1028
|
-
const Y =
|
|
1034
|
+
const Y = bt.get(Ut[w.time_range]);
|
|
1029
1035
|
return Y ? Y.display : (console.warn("Did not recognize the given relative time range:", w.time_range), w.time_range);
|
|
1030
1036
|
} else if ((w == null ? void 0 : w.type) === "absolute") {
|
|
1031
1037
|
const Y = w.tz || "Etc/UTC";
|
|
1032
|
-
return `${
|
|
1038
|
+
return `${it(w.start, { short: !0, tz: Y })} - ${it(w.end, { short: !0, tz: Y })}`;
|
|
1033
1039
|
}
|
|
1034
1040
|
return null;
|
|
1035
|
-
}),
|
|
1041
|
+
}), x = A(() => n.value ? Gt(n.value.meta.granularity_ms) : void 0), E = () => {
|
|
1036
1042
|
s("edit-tile", i.definition);
|
|
1037
|
-
},
|
|
1043
|
+
}, D = () => {
|
|
1038
1044
|
s("remove-tile", i.definition);
|
|
1039
|
-
},
|
|
1045
|
+
}, B = (w) => {
|
|
1040
1046
|
n.value = w;
|
|
1041
|
-
},
|
|
1042
|
-
|
|
1047
|
+
}, I = (w) => {
|
|
1048
|
+
d.value = w;
|
|
1043
1049
|
}, Re = () => {
|
|
1044
|
-
|
|
1050
|
+
I(!0);
|
|
1045
1051
|
};
|
|
1046
|
-
return (w,
|
|
1052
|
+
return (w, Q) => {
|
|
1047
1053
|
const Y = ne("KTooltip"), Ie = ne("KBadge"), pe = ne("KDropdownItem"), se = ne("KDropdown");
|
|
1048
|
-
return
|
|
1049
|
-
class:
|
|
1054
|
+
return z(), F("div", {
|
|
1055
|
+
class: Ge(["tile-boundary", { editable: w.context.editable }]),
|
|
1050
1056
|
"data-testid": `tile-${w.tileId}`
|
|
1051
1057
|
}, [
|
|
1052
|
-
w.definition.chart.type !== "slottable" ? (
|
|
1053
|
-
|
|
1058
|
+
w.definition.chart.type !== "slottable" ? (z(), F("div", Hi, [
|
|
1059
|
+
ie(Y, {
|
|
1054
1060
|
class: "title-tooltip",
|
|
1055
|
-
disabled: !
|
|
1061
|
+
disabled: !a.value,
|
|
1056
1062
|
"max-width": "500",
|
|
1057
1063
|
text: w.definition.chart.chartTitle
|
|
1058
1064
|
}, {
|
|
1059
1065
|
default: M(() => [
|
|
1060
1066
|
le("div", {
|
|
1061
1067
|
ref_key: "titleRef",
|
|
1062
|
-
ref:
|
|
1068
|
+
ref: h,
|
|
1063
1069
|
class: "title"
|
|
1064
|
-
},
|
|
1070
|
+
}, te(w.definition.chart.chartTitle), 513)
|
|
1065
1071
|
]),
|
|
1066
1072
|
_: 1
|
|
1067
1073
|
}, 8, ["disabled", "text"]),
|
|
1068
|
-
|
|
1074
|
+
p.value ? (z(), F("div", {
|
|
1069
1075
|
key: 0,
|
|
1070
1076
|
class: "tile-actions",
|
|
1071
1077
|
"data-testid": `tile-actions-${w.tileId}`
|
|
1072
1078
|
}, [
|
|
1073
|
-
C.value ? (
|
|
1079
|
+
C.value ? (z(), H(Ie, { key: 0 }, {
|
|
1074
1080
|
default: M(() => [
|
|
1075
|
-
|
|
1081
|
+
ve(te(C.value), 1)
|
|
1076
1082
|
]),
|
|
1077
1083
|
_: 1
|
|
1078
1084
|
})) : X("", !0),
|
|
1079
|
-
y.value && w.context.editable ? (
|
|
1085
|
+
y.value && w.context.editable ? (z(), H(k(ei), {
|
|
1080
1086
|
key: 1,
|
|
1081
1087
|
class: "edit-icon",
|
|
1082
|
-
color: k(
|
|
1088
|
+
color: k(ht),
|
|
1083
1089
|
"data-testid": `edit-tile-${w.tileId}`,
|
|
1084
|
-
size: k(
|
|
1085
|
-
onClick:
|
|
1090
|
+
size: k(dt),
|
|
1091
|
+
onClick: E
|
|
1086
1092
|
}, null, 8, ["color", "data-testid", "size"])) : X("", !0),
|
|
1087
|
-
y.value && g.value ? (
|
|
1093
|
+
y.value && g.value ? (z(), H(se, {
|
|
1088
1094
|
key: 2,
|
|
1089
1095
|
class: "dropdown",
|
|
1090
1096
|
"data-testid": `chart-action-menu-${w.tileId}`,
|
|
1091
1097
|
"kpop-attributes": { placement: "bottom-end" }
|
|
1092
1098
|
}, {
|
|
1093
1099
|
items: M(() => [
|
|
1094
|
-
f.value ? (
|
|
1100
|
+
f.value ? (z(), H(pe, {
|
|
1095
1101
|
key: 0,
|
|
1096
1102
|
"data-testid": `chart-jump-to-explore-${w.tileId}`,
|
|
1097
1103
|
item: { label: k(o).t("jumpToExplore"), to: f.value }
|
|
1098
1104
|
}, null, 8, ["data-testid", "item"])) : X("", !0),
|
|
1099
|
-
!("allowCsvExport" in w.definition.chart) || w.definition.chart.allowCsvExport ? (
|
|
1105
|
+
!("allowCsvExport" in w.definition.chart) || w.definition.chart.allowCsvExport ? (z(), H(pe, {
|
|
1100
1106
|
key: 1,
|
|
1101
1107
|
class: "chart-export-button",
|
|
1102
1108
|
"data-testid": `chart-csv-export-${w.tileId}`,
|
|
1103
|
-
onClick:
|
|
1109
|
+
onClick: Q[0] || (Q[0] = (Qe) => Re())
|
|
1104
1110
|
}, {
|
|
1105
1111
|
default: M(() => [
|
|
1106
1112
|
le("span", {
|
|
1107
1113
|
class: "chart-export-trigger",
|
|
1108
1114
|
"data-testid": `csv-export-button-${w.tileId}`
|
|
1109
|
-
},
|
|
1115
|
+
}, te(k(o).t("csvExport.exportAsCsv")), 9, Li)
|
|
1110
1116
|
]),
|
|
1111
1117
|
_: 1
|
|
1112
1118
|
}, 8, ["data-testid"])) : X("", !0),
|
|
1113
|
-
w.context.editable ? (
|
|
1119
|
+
w.context.editable ? (z(), H(pe, {
|
|
1114
1120
|
key: 2,
|
|
1115
1121
|
"data-testid": `remove-tile-${w.tileId}`,
|
|
1116
|
-
onClick:
|
|
1122
|
+
onClick: D
|
|
1117
1123
|
}, {
|
|
1118
1124
|
default: M(() => [
|
|
1119
|
-
|
|
1125
|
+
ve(te(k(o).t("renderer.remove")), 1)
|
|
1120
1126
|
]),
|
|
1121
1127
|
_: 1
|
|
1122
1128
|
}, 8, ["data-testid"])) : X("", !0)
|
|
1123
1129
|
]),
|
|
1124
1130
|
default: M(() => [
|
|
1125
|
-
|
|
1131
|
+
ie(k(ti), {
|
|
1126
1132
|
class: "kebab-action-menu",
|
|
1127
|
-
color: k(
|
|
1133
|
+
color: k(ht),
|
|
1128
1134
|
"data-testid": `kebab-action-menu-${w.tileId}`,
|
|
1129
|
-
size: k(
|
|
1135
|
+
size: k(dt)
|
|
1130
1136
|
}, null, 8, ["color", "data-testid", "size"])
|
|
1131
1137
|
]),
|
|
1132
1138
|
_: 1
|
|
1133
1139
|
}, 8, ["data-testid"])) : X("", !0)
|
|
1134
|
-
], 8,
|
|
1140
|
+
], 8, Oi)) : "description" in w.definition.chart ? (z(), F("div", {
|
|
1135
1141
|
key: 1,
|
|
1136
1142
|
class: "header-description",
|
|
1137
1143
|
"data-testid": `tile-description-${w.tileId}`
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1144
|
+
}, te(w.definition.chart.description), 9, Mi)) : X("", !0),
|
|
1145
|
+
d.value ? (z(), H(k(Yt), {
|
|
1140
1146
|
key: 2,
|
|
1141
1147
|
"chart-data": n.value,
|
|
1142
1148
|
"data-testid": `csv-export-modal-${w.tileId}`,
|
|
1143
|
-
filename:
|
|
1144
|
-
onToggleModal:
|
|
1149
|
+
filename: m.value,
|
|
1150
|
+
onToggleModal: I
|
|
1145
1151
|
}, null, 8, ["chart-data", "data-testid", "filename"])) : X("", !0)
|
|
1146
1152
|
])) : X("", !0),
|
|
1147
1153
|
le("div", {
|
|
1148
1154
|
class: "tile-content",
|
|
1149
1155
|
"data-testid": `tile-content-${w.tileId}`
|
|
1150
1156
|
}, [
|
|
1151
|
-
S.value ? (
|
|
1152
|
-
|
|
1153
|
-
|
|
1157
|
+
S.value ? (z(), H(vt(S.value.component), mt({ key: 0 }, S.value.rendererProps, {
|
|
1158
|
+
onChartData: B,
|
|
1159
|
+
onZoomTimeRange: Q[1] || (Q[1] = (Qe) => s("zoom-time-range", Qe))
|
|
1160
|
+
}), null, 16)) : X("", !0)
|
|
1161
|
+
], 8, Ii)
|
|
1162
|
+
], 10, Ai);
|
|
1154
1163
|
};
|
|
1155
1164
|
}
|
|
1156
|
-
}),
|
|
1165
|
+
}), qi = /* @__PURE__ */ ae(Pi, [["__scopeId", "data-v-caafa72e"]]), Bi = (u, e, t) => {
|
|
1157
1166
|
const i = /* @__PURE__ */ new Map();
|
|
1158
1167
|
t.forEach((r) => {
|
|
1159
|
-
const o = r.layout.position.row, n = i.get(o),
|
|
1160
|
-
n === void 0 ? i.set(o,
|
|
1168
|
+
const o = r.layout.position.row, n = i.get(o), d = r.layout.size.rows === 1 && !!r.layout.size.fitToContent;
|
|
1169
|
+
n === void 0 ? i.set(o, d) : i.set(o, n && d);
|
|
1161
1170
|
});
|
|
1162
1171
|
const s = [];
|
|
1163
1172
|
for (let r = 0; r < u; r++)
|
|
1164
1173
|
i.get(r) ? s.push("auto") : s.push(`${e}px`);
|
|
1165
1174
|
return s;
|
|
1166
|
-
},
|
|
1175
|
+
}, $i = /* @__PURE__ */ G({
|
|
1167
1176
|
__name: "GridLayout",
|
|
1168
1177
|
props: {
|
|
1169
1178
|
gridSize: {
|
|
@@ -1181,11 +1190,11 @@ const bi = () => {
|
|
|
1181
1190
|
}
|
|
1182
1191
|
},
|
|
1183
1192
|
setup(u) {
|
|
1184
|
-
|
|
1193
|
+
Ue((n) => ({
|
|
1185
1194
|
"3bc5e939": u.gridSize.cols,
|
|
1186
1195
|
"77aa3028": r.value
|
|
1187
1196
|
}));
|
|
1188
|
-
const e = u, t =
|
|
1197
|
+
const e = u, t = $(null), i = $(0), s = new ResizeObserver((n) => {
|
|
1189
1198
|
window.requestAnimationFrame(() => {
|
|
1190
1199
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
1191
1200
|
});
|
|
@@ -1195,11 +1204,11 @@ const bi = () => {
|
|
|
1195
1204
|
}), $e(() => {
|
|
1196
1205
|
t.value && s.unobserve(t.value);
|
|
1197
1206
|
});
|
|
1198
|
-
const r =
|
|
1199
|
-
var
|
|
1200
|
-
return
|
|
1201
|
-
}), o =
|
|
1202
|
-
key: `tile-${
|
|
1207
|
+
const r = A(() => {
|
|
1208
|
+
var d;
|
|
1209
|
+
return Bi((d = e.gridSize) == null ? void 0 : d.rows, e.tileHeight, e.tiles).join(" ");
|
|
1210
|
+
}), o = A(() => e.tiles.map((n, d) => ({
|
|
1211
|
+
key: `tile-${d}`,
|
|
1203
1212
|
tile: n,
|
|
1204
1213
|
style: {
|
|
1205
1214
|
"grid-column-start": n.layout.position.col + 1,
|
|
@@ -1208,26 +1217,26 @@ const bi = () => {
|
|
|
1208
1217
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
1209
1218
|
}
|
|
1210
1219
|
})));
|
|
1211
|
-
return (n,
|
|
1220
|
+
return (n, d) => (z(), F("div", {
|
|
1212
1221
|
ref_key: "gridContainer",
|
|
1213
1222
|
ref: t,
|
|
1214
1223
|
class: "kong-ui-public-grid-layout"
|
|
1215
1224
|
}, [
|
|
1216
|
-
(
|
|
1217
|
-
key:
|
|
1218
|
-
class:
|
|
1219
|
-
"empty-cell": !
|
|
1225
|
+
(z(!0), F(_t, null, wt(o.value, (h) => (z(), F("div", {
|
|
1226
|
+
key: h.key,
|
|
1227
|
+
class: Ge(["grid-cell", {
|
|
1228
|
+
"empty-cell": !h.tile
|
|
1220
1229
|
}]),
|
|
1221
|
-
style:
|
|
1230
|
+
style: et(h.style)
|
|
1222
1231
|
}, [
|
|
1223
1232
|
Le(n.$slots, "tile", {
|
|
1224
|
-
style:
|
|
1225
|
-
tile:
|
|
1233
|
+
style: et(h.style),
|
|
1234
|
+
tile: h.tile
|
|
1226
1235
|
}, void 0, !0)
|
|
1227
1236
|
], 6))), 128))
|
|
1228
1237
|
], 512));
|
|
1229
1238
|
}
|
|
1230
|
-
}),
|
|
1239
|
+
}), Fi = /* @__PURE__ */ ae($i, [["__scopeId", "data-v-f43eb7b8"]]);
|
|
1231
1240
|
function Ui(u, e, t, i, s) {
|
|
1232
1241
|
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));
|
|
1233
1242
|
return r.prototype = e.prototype, r;
|
|
@@ -1267,12 +1276,12 @@ class c {
|
|
|
1267
1276
|
static createWidgetDivs(e, t) {
|
|
1268
1277
|
var o, n;
|
|
1269
1278
|
const i = c.createDiv(["grid-stack-item", e]), s = c.createDiv(["grid-stack-item-content"], i);
|
|
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(([
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1279
|
+
return t.lazyLoad || ((n = (o = t.grid) == null ? void 0 : o.opts) == null ? void 0 : n.lazyLoad) && t.lazyLoad !== !1 ? t.visibleObservable || (t.visibleObservable = new IntersectionObserver(([d]) => {
|
|
1280
|
+
var h;
|
|
1281
|
+
d.isIntersecting && ((h = t.visibleObservable) == null || h.disconnect(), delete t.visibleObservable, _.renderCB(s, t));
|
|
1273
1282
|
}), window.setTimeout(() => {
|
|
1274
|
-
var
|
|
1275
|
-
return (
|
|
1283
|
+
var d;
|
|
1284
|
+
return (d = t.visibleObservable) == null ? void 0 : d.observe(i);
|
|
1276
1285
|
})) : _.renderCB(s, t), i;
|
|
1277
1286
|
}
|
|
1278
1287
|
/** create a div with the given classes */
|
|
@@ -1442,10 +1451,10 @@ class c {
|
|
|
1442
1451
|
static updateScrollPosition(e, t, i) {
|
|
1443
1452
|
const s = e.getBoundingClientRect(), r = window.innerHeight || document.documentElement.clientHeight;
|
|
1444
1453
|
if (s.top < 0 || s.bottom > r) {
|
|
1445
|
-
const o = s.bottom - r, n = s.top,
|
|
1446
|
-
if (
|
|
1447
|
-
const
|
|
1448
|
-
s.top < 0 && i < 0 ? e.offsetHeight > r ?
|
|
1454
|
+
const o = s.bottom - r, n = s.top, d = this.getScrollElement(e);
|
|
1455
|
+
if (d !== null) {
|
|
1456
|
+
const h = d.scrollTop;
|
|
1457
|
+
s.top < 0 && i < 0 ? e.offsetHeight > r ? d.scrollTop += i : d.scrollTop += Math.abs(n) > Math.abs(i) ? i : n : i > 0 && (e.offsetHeight > r ? d.scrollTop += i : d.scrollTop += o > i ? i : o), t.top += d.scrollTop - h;
|
|
1449
1458
|
}
|
|
1450
1459
|
}
|
|
1451
1460
|
}
|
|
@@ -1457,8 +1466,8 @@ class c {
|
|
|
1457
1466
|
* @param distance Distance from the V edges to start scrolling
|
|
1458
1467
|
*/
|
|
1459
1468
|
static updateScrollResize(e, t, i) {
|
|
1460
|
-
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o,
|
|
1461
|
-
|
|
1469
|
+
const s = this.getScrollElement(t), r = s.clientHeight, o = s === this.getScrollElement() ? 0 : s.getBoundingClientRect().top, n = e.clientY - o, d = n < i, h = n > r - i;
|
|
1470
|
+
d ? s.scrollBy({ behavior: "smooth", top: n - i }) : h && s.scrollBy({ behavior: "smooth", top: i - (r - n) });
|
|
1462
1471
|
}
|
|
1463
1472
|
/** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
|
|
1464
1473
|
static clone(e) {
|
|
@@ -1590,7 +1599,7 @@ class c {
|
|
|
1590
1599
|
return !(!e || e.w === e.h || e.locked || e.noResize || (t = e.grid) != null && t.opts.disableResize || e.minW && e.minW === e.maxW || e.minH && e.minH === e.maxH);
|
|
1591
1600
|
}
|
|
1592
1601
|
}
|
|
1593
|
-
class
|
|
1602
|
+
class Z {
|
|
1594
1603
|
constructor(e = {}) {
|
|
1595
1604
|
this.addedNodes = [], this.removedNodes = [], this.defaultColumn = 12, this.column = e.column || this.defaultColumn, this.column > this.defaultColumn && (this.defaultColumn = this.column), this.maxRow = e.maxRow, this._float = e.float, this.nodes = e.nodes || [], this.onChange = e.onChange;
|
|
1596
1605
|
}
|
|
@@ -1612,19 +1621,19 @@ class Q {
|
|
|
1612
1621
|
!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));
|
|
1613
1622
|
let o = !1;
|
|
1614
1623
|
const n = { nested: !0, pack: !1 };
|
|
1615
|
-
let
|
|
1624
|
+
let d = 0;
|
|
1616
1625
|
for (; i = i || this.collide(e, r, s.skip); ) {
|
|
1617
|
-
if (
|
|
1626
|
+
if (d++ > this.nodes.length * 2)
|
|
1618
1627
|
throw new Error("Infinite collide check");
|
|
1619
|
-
let
|
|
1628
|
+
let h;
|
|
1620
1629
|
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
|
|
1621
1630
|
(!this.collide(i, { ...i, y: e.y }, e) || !this.collide(i, { ...i, y: t.y - i.h }, e))) {
|
|
1622
1631
|
e._skipDown = e._skipDown || t.y > e.y;
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1632
|
+
const a = { ...t, y: i.y + i.h, ...n };
|
|
1633
|
+
h = this._loading && c.samePos(e, a) ? !0 : this.moveNode(e, a), (i.locked || this._loading) && h ? c.copyPos(t, e) : !i.locked && h && s.pack && (this._packNodes(), t.y = i.y + i.h, c.copyPos(e, t)), o = o || h;
|
|
1625
1634
|
} else
|
|
1626
|
-
|
|
1627
|
-
if (!
|
|
1635
|
+
h = this.moveNode(i, { ...i, y: t.y + t.h, skip: e, ...n });
|
|
1636
|
+
if (!h)
|
|
1628
1637
|
return o;
|
|
1629
1638
|
i = void 0;
|
|
1630
1639
|
}
|
|
@@ -1646,14 +1655,14 @@ class Q {
|
|
|
1646
1655
|
const s = e._rect, r = { ...t.rect };
|
|
1647
1656
|
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;
|
|
1648
1657
|
let o, n = 0.5;
|
|
1649
|
-
for (let
|
|
1650
|
-
if (
|
|
1658
|
+
for (let d of i) {
|
|
1659
|
+
if (d.locked || !d._rect)
|
|
1651
1660
|
break;
|
|
1652
|
-
const
|
|
1653
|
-
let
|
|
1654
|
-
s.y <
|
|
1655
|
-
const f = Math.min(
|
|
1656
|
-
f > n && (n = f, o =
|
|
1661
|
+
const h = d._rect;
|
|
1662
|
+
let a = Number.MAX_VALUE, l = Number.MAX_VALUE;
|
|
1663
|
+
s.y < h.y ? a = (r.y + r.h - h.y) / h.h : s.y + s.h > h.y + h.h && (a = (h.y + h.h - r.y) / h.h), s.x < h.x ? l = (r.x + r.w - h.x) / h.w : s.x + s.w > h.x + h.w && (l = (h.x + h.w - r.x) / h.w);
|
|
1664
|
+
const f = Math.min(l, a);
|
|
1665
|
+
f > n && (n = f, o = d);
|
|
1657
1666
|
}
|
|
1658
1667
|
return t.collide = o, o;
|
|
1659
1668
|
}
|
|
@@ -1727,9 +1736,9 @@ class Q {
|
|
|
1727
1736
|
const s = this._inColumnResize;
|
|
1728
1737
|
s || (this._inColumnResize = !0);
|
|
1729
1738
|
const r = this.nodes;
|
|
1730
|
-
return this.nodes = [], r.forEach((o, n,
|
|
1731
|
-
let
|
|
1732
|
-
o.locked || (o.autoPosition = !0, e === "list" && n && (
|
|
1739
|
+
return this.nodes = [], r.forEach((o, n, d) => {
|
|
1740
|
+
let h;
|
|
1741
|
+
o.locked || (o.autoPosition = !0, e === "list" && n && (h = d[n - 1])), this.addNode(o, !1, h);
|
|
1733
1742
|
}), s || delete this._inColumnResize, i || this.batchUpdate(!1), this;
|
|
1734
1743
|
}
|
|
1735
1744
|
/** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */
|
|
@@ -1768,7 +1777,7 @@ class Q {
|
|
|
1768
1777
|
* @param resizing if out of bound, resize down or move into the grid to fit ?
|
|
1769
1778
|
*/
|
|
1770
1779
|
prepareNode(e, t) {
|
|
1771
|
-
e._id = e._id ??
|
|
1780
|
+
e._id = e._id ?? Z._idSeq++;
|
|
1772
1781
|
const i = e.id;
|
|
1773
1782
|
if (i) {
|
|
1774
1783
|
let r = 1;
|
|
@@ -1827,11 +1836,11 @@ class Q {
|
|
|
1827
1836
|
const r = s ? s.y * i + (s.x + s.w) : 0;
|
|
1828
1837
|
let o = !1;
|
|
1829
1838
|
for (let n = r; !o; ++n) {
|
|
1830
|
-
const
|
|
1831
|
-
if (
|
|
1839
|
+
const d = n % i, h = Math.floor(n / i);
|
|
1840
|
+
if (d + e.w > i)
|
|
1832
1841
|
continue;
|
|
1833
|
-
const
|
|
1834
|
-
t.find((
|
|
1842
|
+
const a = { x: d, y: h, w: e.w, h: e.h };
|
|
1843
|
+
t.find((l) => c.isIntercepted(a, l)) || ((e.x !== d || e.y !== h) && (e._dirty = !0), e.x = d, e.y = h, delete e.autoPosition, o = !0);
|
|
1835
1844
|
}
|
|
1836
1845
|
return o;
|
|
1837
1846
|
}
|
|
@@ -1863,7 +1872,7 @@ class Q {
|
|
|
1863
1872
|
if (t.pack = !0, !this.maxRow)
|
|
1864
1873
|
return this.moveNode(e, t);
|
|
1865
1874
|
let i;
|
|
1866
|
-
const s = new
|
|
1875
|
+
const s = new Z({
|
|
1867
1876
|
column: this.column,
|
|
1868
1877
|
float: this.float,
|
|
1869
1878
|
nodes: this.nodes.map((o) => o._id === e._id ? (i = { ...o }, i) : { ...o })
|
|
@@ -1877,7 +1886,7 @@ class Q {
|
|
|
1877
1886
|
return this._notify(), !0;
|
|
1878
1887
|
}
|
|
1879
1888
|
return r ? (s.nodes.filter((o) => o._dirty).forEach((o) => {
|
|
1880
|
-
const n = this.nodes.find((
|
|
1889
|
+
const n = this.nodes.find((d) => d._id === o._id);
|
|
1881
1890
|
n && (c.copyPos(n, o), n._dirty = !0);
|
|
1882
1891
|
}), this._notify(), !0) : !1;
|
|
1883
1892
|
}
|
|
@@ -1885,7 +1894,7 @@ class Q {
|
|
|
1885
1894
|
willItFit(e) {
|
|
1886
1895
|
if (delete e._willFitPos, !this.maxRow)
|
|
1887
1896
|
return !0;
|
|
1888
|
-
const t = new
|
|
1897
|
+
const t = new Z({
|
|
1889
1898
|
column: this.column,
|
|
1890
1899
|
float: this.float,
|
|
1891
1900
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
@@ -1898,7 +1907,7 @@ class Q {
|
|
|
1898
1907
|
}
|
|
1899
1908
|
/** return true if the passed in node was actually moved (checks for no-op and locked) */
|
|
1900
1909
|
moveNode(e, t) {
|
|
1901
|
-
var
|
|
1910
|
+
var h, a;
|
|
1902
1911
|
if (!e || /*node.locked ||*/
|
|
1903
1912
|
!t)
|
|
1904
1913
|
return !1;
|
|
@@ -1908,17 +1917,17 @@ class Q {
|
|
|
1908
1917
|
if (c.copyPos(r, t), this.nodeBoundFix(r, s), c.copyPos(t, r), !t.forceCollide && c.samePos(e, t))
|
|
1909
1918
|
return !1;
|
|
1910
1919
|
const o = c.copyPos({}, e), n = this.collideAll(e, r, t.skip);
|
|
1911
|
-
let
|
|
1920
|
+
let d = !0;
|
|
1912
1921
|
if (n.length) {
|
|
1913
|
-
const
|
|
1914
|
-
let f =
|
|
1915
|
-
if (
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1922
|
+
const l = e._moving && !t.nested;
|
|
1923
|
+
let f = l ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
1924
|
+
if (l && f && ((a = (h = e.grid) == null ? void 0 : h.opts) != null && a.subGridDynamic) && !e.grid._isTemp) {
|
|
1925
|
+
const m = c.areaIntercept(t.rect, f._rect), p = c.area(t.rect), y = c.area(f._rect);
|
|
1926
|
+
m / (p < y ? p : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
1918
1927
|
}
|
|
1919
|
-
f ?
|
|
1928
|
+
f ? d = !this._fixCollisions(e, r, f, t) : (d = !1, i && delete t.pack);
|
|
1920
1929
|
}
|
|
1921
|
-
return
|
|
1930
|
+
return d && !c.samePos(e, r) && (e._dirty = !0, c.copyPos(e, r)), t.pack && this._packNodes()._notify(), !c.samePos(e, o);
|
|
1922
1931
|
}
|
|
1923
1932
|
getRow() {
|
|
1924
1933
|
return this.nodes.reduce((e, t) => Math.max(e, t.y + t.h), 0);
|
|
@@ -1936,8 +1945,8 @@ class Q {
|
|
|
1936
1945
|
var o;
|
|
1937
1946
|
const i = (o = this._layouts) == null ? void 0 : o.length, s = i && this.column !== i - 1 ? this._layouts[i - 1] : null, r = [];
|
|
1938
1947
|
return this.sortNodes(), this.nodes.forEach((n) => {
|
|
1939
|
-
const
|
|
1940
|
-
c.removeInternalForSave(
|
|
1948
|
+
const d = s == null ? void 0 : s.find((a) => a._id === n._id), h = { ...n, ...d || {} };
|
|
1949
|
+
c.removeInternalForSave(h, !e), t && t(n, h), r.push(h);
|
|
1941
1950
|
}), r;
|
|
1942
1951
|
}
|
|
1943
1952
|
/** @internal called whenever a node is added or moved - updates the cached layouts */
|
|
@@ -1976,19 +1985,19 @@ class Q {
|
|
|
1976
1985
|
s && this.sortNodes(1), t < e && this.cacheLayout(this.nodes, e), this.batchUpdate();
|
|
1977
1986
|
let r = [], o = s ? this.nodes : c.sort(this.nodes, -1);
|
|
1978
1987
|
if (t > e && this._layouts) {
|
|
1979
|
-
const
|
|
1980
|
-
!
|
|
1981
|
-
const
|
|
1982
|
-
|
|
1983
|
-
})),
|
|
1984
|
-
const
|
|
1985
|
-
if (
|
|
1986
|
-
const f = o[
|
|
1988
|
+
const d = this._layouts[t] || [], h = this._layouts.length - 1;
|
|
1989
|
+
!d.length && e !== h && ((n = this._layouts[h]) != null && n.length) && (e = h, this._layouts[h].forEach((a) => {
|
|
1990
|
+
const l = o.find((f) => f._id === a._id);
|
|
1991
|
+
l && (!s && !a.autoPosition && (l.x = a.x ?? l.x, l.y = a.y ?? l.y), l.w = a.w ?? l.w, (a.x == null || a.y === void 0) && (l.autoPosition = !0));
|
|
1992
|
+
})), d.forEach((a) => {
|
|
1993
|
+
const l = o.findIndex((f) => f._id === a._id);
|
|
1994
|
+
if (l !== -1) {
|
|
1995
|
+
const f = o[l];
|
|
1987
1996
|
if (s) {
|
|
1988
|
-
f.w =
|
|
1997
|
+
f.w = a.w;
|
|
1989
1998
|
return;
|
|
1990
1999
|
}
|
|
1991
|
-
(
|
|
2000
|
+
(a.autoPosition || isNaN(a.x) || isNaN(a.y)) && this.findEmptyPosition(a, r), a.autoPosition || (f.x = a.x ?? f.x, f.y = a.y ?? f.y, f.w = a.w ?? f.w, r.push(f)), o.splice(l, 1);
|
|
1992
2001
|
}
|
|
1993
2002
|
});
|
|
1994
2003
|
}
|
|
@@ -1999,16 +2008,16 @@ class Q {
|
|
|
1999
2008
|
if (typeof i == "function")
|
|
2000
2009
|
i(t, e, r, o);
|
|
2001
2010
|
else {
|
|
2002
|
-
const
|
|
2003
|
-
o.forEach((
|
|
2004
|
-
|
|
2011
|
+
const d = s || i === "none" ? 1 : t / e, h = i === "move" || i === "moveScale", a = i === "scale" || i === "moveScale";
|
|
2012
|
+
o.forEach((l) => {
|
|
2013
|
+
l.x = t === 1 ? 0 : h ? Math.round(l.x * d) : Math.min(l.x, t - 1), l.w = t === 1 || e === 1 ? 1 : a ? Math.round(l.w * d) || 1 : Math.min(l.w, t), r.push(l);
|
|
2005
2014
|
}), o = [];
|
|
2006
2015
|
}
|
|
2007
|
-
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((
|
|
2008
|
-
this.addNode(
|
|
2016
|
+
r = c.sort(r, -1), this._inColumnResize = !0, this.nodes = [], r.forEach((d) => {
|
|
2017
|
+
this.addNode(d, !1), delete d._orig;
|
|
2009
2018
|
});
|
|
2010
2019
|
}
|
|
2011
|
-
return this.nodes.forEach((
|
|
2020
|
+
return this.nodes.forEach((d) => delete d._orig), this.batchUpdate(!1, !s), delete this._inColumnResize, this;
|
|
2012
2021
|
}
|
|
2013
2022
|
/**
|
|
2014
2023
|
* call to cache the given layout internally to the given location so we can restore back when column changes size
|
|
@@ -2020,8 +2029,8 @@ class Q {
|
|
|
2020
2029
|
const s = [];
|
|
2021
2030
|
return e.forEach((r, o) => {
|
|
2022
2031
|
if (r._id === void 0) {
|
|
2023
|
-
const n = r.id ? this.nodes.find((
|
|
2024
|
-
r._id = (n == null ? void 0 : n._id) ??
|
|
2032
|
+
const n = r.id ? this.nodes.find((d) => d.id === r.id) : void 0;
|
|
2033
|
+
r._id = (n == null ? void 0 : n._id) ?? Z._idSeq++;
|
|
2025
2034
|
}
|
|
2026
2035
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
2027
2036
|
}), this._layouts = i ? [] : this._layouts || [], this._layouts[t] = s, this;
|
|
@@ -2032,7 +2041,7 @@ class Q {
|
|
|
2032
2041
|
* @param column corresponding column index to save it under
|
|
2033
2042
|
*/
|
|
2034
2043
|
cacheOneLayout(e, t) {
|
|
2035
|
-
e._id = e._id ??
|
|
2044
|
+
e._id = e._id ?? Z._idSeq++;
|
|
2036
2045
|
const i = { x: e.x, y: e.y, w: e.w, _id: e._id };
|
|
2037
2046
|
(e.autoPosition || e.x === void 0) && (delete i.x, delete i.y, e.autoPosition && (i.autoPosition = !0)), this._layouts = this._layouts || [], this._layouts[t] = this._layouts[t] || [];
|
|
2038
2047
|
const s = this.findCacheLayout(e, t);
|
|
@@ -2056,8 +2065,8 @@ class Q {
|
|
|
2056
2065
|
return this;
|
|
2057
2066
|
}
|
|
2058
2067
|
}
|
|
2059
|
-
|
|
2060
|
-
const
|
|
2068
|
+
Z._idSeq = 0;
|
|
2069
|
+
const U = {
|
|
2061
2070
|
alwaysShowResizeHandle: "mobile",
|
|
2062
2071
|
animate: !0,
|
|
2063
2072
|
auto: !0,
|
|
@@ -2172,20 +2181,20 @@ function ke(u) {
|
|
|
2172
2181
|
function Ne(u) {
|
|
2173
2182
|
J.touchHandled && Se(u, "mousemove");
|
|
2174
2183
|
}
|
|
2175
|
-
function
|
|
2184
|
+
function Ae(u) {
|
|
2176
2185
|
if (!J.touchHandled)
|
|
2177
2186
|
return;
|
|
2178
2187
|
J.pointerLeaveTimeout && (window.clearTimeout(J.pointerLeaveTimeout), delete J.pointerLeaveTimeout);
|
|
2179
2188
|
const e = !!b.dragElement;
|
|
2180
2189
|
Se(u, "mouseup"), e || Se(u, "click"), J.touchHandled = !1;
|
|
2181
2190
|
}
|
|
2182
|
-
function
|
|
2191
|
+
function He(u) {
|
|
2183
2192
|
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
2184
2193
|
}
|
|
2185
|
-
function
|
|
2194
|
+
function ct(u) {
|
|
2186
2195
|
b.dragElement && u.pointerType !== "mouse" && Ht(u, "mouseenter");
|
|
2187
2196
|
}
|
|
2188
|
-
function
|
|
2197
|
+
function ft(u) {
|
|
2189
2198
|
b.dragElement && u.pointerType !== "mouse" && (J.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2190
2199
|
delete J.pointerLeaveTimeout, Ht(u, "mouseleave");
|
|
2191
2200
|
}, 10));
|
|
@@ -2197,15 +2206,15 @@ class Me {
|
|
|
2197
2206
|
/** @internal */
|
|
2198
2207
|
_init() {
|
|
2199
2208
|
const e = this.el = document.createElement("div");
|
|
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",
|
|
2209
|
+
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", He)), this;
|
|
2201
2210
|
}
|
|
2202
2211
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2203
2212
|
destroy() {
|
|
2204
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), j && (this.el.removeEventListener("touchstart", ke), this.el.removeEventListener("pointerdown",
|
|
2213
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), j && (this.el.removeEventListener("touchstart", ke), this.el.removeEventListener("pointerdown", He)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2205
2214
|
}
|
|
2206
2215
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2207
2216
|
_mouseDown(e) {
|
|
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",
|
|
2217
|
+
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", Ae)), e.stopPropagation(), e.preventDefault();
|
|
2209
2218
|
}
|
|
2210
2219
|
/** @internal */
|
|
2211
2220
|
_mouseMove(e) {
|
|
@@ -2214,7 +2223,7 @@ class Me {
|
|
|
2214
2223
|
}
|
|
2215
2224
|
/** @internal */
|
|
2216
2225
|
_mouseUp(e) {
|
|
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",
|
|
2226
|
+
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", Ae)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2218
2227
|
}
|
|
2219
2228
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2220
2229
|
_keyEvent(e) {
|
|
@@ -2377,15 +2386,15 @@ class _e extends Xe {
|
|
|
2377
2386
|
left: this.originalRect.left,
|
|
2378
2387
|
top: this.originalRect.top - this.scrolled
|
|
2379
2388
|
}, r = e.clientX - i.clientX, o = this.sizeToContent ? 0 : e.clientY - i.clientY;
|
|
2380
|
-
let n,
|
|
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,
|
|
2382
|
-
const
|
|
2383
|
-
return Math.round(s.width) !== Math.round(
|
|
2389
|
+
let n, d;
|
|
2390
|
+
t.indexOf("e") > -1 ? s.width += r : t.indexOf("w") > -1 && (s.width -= r, s.left += r, n = !0), t.indexOf("s") > -1 ? s.height += o : t.indexOf("n") > -1 && (s.height -= o, s.top += o, d = !0);
|
|
2391
|
+
const h = this._constrainSize(s.width, s.height, n, d);
|
|
2392
|
+
return Math.round(s.width) !== Math.round(h.width) && (t.indexOf("w") > -1 && (s.left += s.width - h.width), s.width = h.width), Math.round(s.height) !== Math.round(h.height) && (t.indexOf("n") > -1 && (s.top += s.height - h.height), s.height = h.height), s;
|
|
2384
2393
|
}
|
|
2385
2394
|
/** @internal constrain the size to the set min/max values */
|
|
2386
2395
|
_constrainSize(e, t, i, s) {
|
|
2387
|
-
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e,
|
|
2388
|
-
return { width:
|
|
2396
|
+
const r = this.option, o = (i ? r.maxWidthMoveLeft : r.maxWidth) || Number.MAX_SAFE_INTEGER, n = r.minWidth / this.rectScale.x || e, d = (s ? r.maxHeightMoveUp : r.maxHeight) || Number.MAX_SAFE_INTEGER, h = r.minHeight / this.rectScale.y || t, a = Math.min(o, Math.max(n, e)), l = Math.min(d, Math.max(h, t));
|
|
2397
|
+
return { width: a, height: l };
|
|
2389
2398
|
}
|
|
2390
2399
|
/** @internal */
|
|
2391
2400
|
_applyChange() {
|
|
@@ -2426,12 +2435,12 @@ class we extends Xe {
|
|
|
2426
2435
|
}
|
|
2427
2436
|
enable() {
|
|
2428
2437
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2429
|
-
e.addEventListener("mousedown", this._mouseDown), j && (e.addEventListener("touchstart", ke), e.addEventListener("pointerdown",
|
|
2438
|
+
e.addEventListener("mousedown", this._mouseDown), j && (e.addEventListener("touchstart", ke), e.addEventListener("pointerdown", He));
|
|
2430
2439
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2431
2440
|
}
|
|
2432
2441
|
disable(e = !1) {
|
|
2433
2442
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2434
|
-
t.removeEventListener("mousedown", this._mouseDown), j && (t.removeEventListener("touchstart", ke), t.removeEventListener("pointerdown",
|
|
2443
|
+
t.removeEventListener("mousedown", this._mouseDown), j && (t.removeEventListener("touchstart", ke), t.removeEventListener("pointerdown", He));
|
|
2435
2444
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2436
2445
|
}
|
|
2437
2446
|
destroy() {
|
|
@@ -2443,7 +2452,7 @@ class we extends Xe {
|
|
|
2443
2452
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2444
2453
|
_mouseDown(e) {
|
|
2445
2454
|
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",
|
|
2455
|
+
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", Ae)), e.preventDefault(), document.activeElement && document.activeElement.blur(), b.mouseHandled = !0), !0;
|
|
2447
2456
|
}
|
|
2448
2457
|
/** @internal method to call actual drag event */
|
|
2449
2458
|
_callDrag(e) {
|
|
@@ -2474,7 +2483,7 @@ class we extends Xe {
|
|
|
2474
2483
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2475
2484
|
_mouseUp(e) {
|
|
2476
2485
|
var t, 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",
|
|
2486
|
+
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", Ae, !0)), this.dragging) {
|
|
2478
2487
|
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();
|
|
2479
2488
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2480
2489
|
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), b.dropElement && b.dropElement.drop(e);
|
|
@@ -2556,7 +2565,7 @@ class we extends Xe {
|
|
|
2556
2565
|
}
|
|
2557
2566
|
}
|
|
2558
2567
|
we.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2559
|
-
class
|
|
2568
|
+
class Wi extends Xe {
|
|
2560
2569
|
constructor(e, t = {}) {
|
|
2561
2570
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2562
2571
|
}
|
|
@@ -2567,10 +2576,10 @@ class Fi extends Xe {
|
|
|
2567
2576
|
super.off(e);
|
|
2568
2577
|
}
|
|
2569
2578
|
enable() {
|
|
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",
|
|
2579
|
+
this.disabled !== !1 && (super.enable(), this.el.classList.add("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), this.el.addEventListener("mouseenter", this._mouseEnter), this.el.addEventListener("mouseleave", this._mouseLeave), j && (this.el.addEventListener("pointerenter", ct), this.el.addEventListener("pointerleave", ft)));
|
|
2571
2580
|
}
|
|
2572
2581
|
disable(e = !1) {
|
|
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",
|
|
2582
|
+
this.disabled !== !0 && (super.disable(), this.el.classList.remove("ui-droppable"), e || this.el.classList.add("ui-droppable-disabled"), this.el.removeEventListener("mouseenter", this._mouseEnter), this.el.removeEventListener("mouseleave", this._mouseLeave), j && (this.el.removeEventListener("pointerenter", ct), this.el.removeEventListener("pointerleave", ft)));
|
|
2574
2583
|
}
|
|
2575
2584
|
destroy() {
|
|
2576
2585
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2648,13 +2657,13 @@ class je {
|
|
|
2648
2657
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2649
2658
|
}
|
|
2650
2659
|
setupDroppable(e) {
|
|
2651
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2660
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new Wi(this.el, e), this;
|
|
2652
2661
|
}
|
|
2653
2662
|
cleanDroppable() {
|
|
2654
2663
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2655
2664
|
}
|
|
2656
2665
|
}
|
|
2657
|
-
class
|
|
2666
|
+
class Vi {
|
|
2658
2667
|
resizable(e, t, i, s) {
|
|
2659
2668
|
return this._getDDElements(e).forEach((r) => {
|
|
2660
2669
|
if (t === "disable" || t === "enable")
|
|
@@ -2665,13 +2674,13 @@ class Wi {
|
|
|
2665
2674
|
r.setupResizable({ [i]: s });
|
|
2666
2675
|
else {
|
|
2667
2676
|
const n = r.el.gridstackNode.grid;
|
|
2668
|
-
let
|
|
2669
|
-
|
|
2670
|
-
const
|
|
2677
|
+
let d = r.el.getAttribute("gs-resize-handles") || n.opts.resizable.handles || "e,s,se";
|
|
2678
|
+
d === "all" && (d = "n,e,s,w,se,sw,ne,nw");
|
|
2679
|
+
const h = !n.opts.alwaysShowResizeHandle;
|
|
2671
2680
|
r.setupResizable({
|
|
2672
2681
|
...n.opts.resizable,
|
|
2673
|
-
handles:
|
|
2674
|
-
autoHide:
|
|
2682
|
+
handles: d,
|
|
2683
|
+
autoHide: h,
|
|
2675
2684
|
start: t.start,
|
|
2676
2685
|
stop: t.stop,
|
|
2677
2686
|
resize: t.resize
|
|
@@ -2746,7 +2755,7 @@ class Wi {
|
|
|
2746
2755
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2747
2756
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2748
2757
|
*/
|
|
2749
|
-
const
|
|
2758
|
+
const P = new Vi();
|
|
2750
2759
|
class _ {
|
|
2751
2760
|
/**
|
|
2752
2761
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2811,7 +2820,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2811
2820
|
/** @internal create placeholder DIV as needed */
|
|
2812
2821
|
get placeholder() {
|
|
2813
2822
|
if (!this._placeholder) {
|
|
2814
|
-
this._placeholder = c.createDiv([this.opts.placeholderClass,
|
|
2823
|
+
this._placeholder = c.createDiv([this.opts.placeholderClass, U.itemClass, this.opts.itemClass]);
|
|
2815
2824
|
const e = c.createDiv(["placeholder-content"], this._placeholder);
|
|
2816
2825
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2817
2826
|
}
|
|
@@ -2823,57 +2832,57 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2823
2832
|
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
2824
2833
|
*/
|
|
2825
2834
|
constructor(e, t = {}) {
|
|
2826
|
-
var
|
|
2835
|
+
var l, f, m;
|
|
2827
2836
|
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);
|
|
2828
2837
|
const i = c.toNumber(e.getAttribute("gs-row"));
|
|
2829
2838
|
t.column === "auto" && delete t.column, t.alwaysShowResizeHandle !== void 0 && (t._alwaysShowResizeHandle = t.alwaysShowResizeHandle);
|
|
2830
|
-
let s = (
|
|
2839
|
+
let s = (l = t.columnOpts) == null ? void 0 : l.breakpoints;
|
|
2831
2840
|
const r = t;
|
|
2832
2841
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2833
|
-
const
|
|
2842
|
+
const p = r.oneColumnSize || 768;
|
|
2834
2843
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2835
2844
|
let y = s.find((g) => g.c === 1);
|
|
2836
|
-
y ? y.w =
|
|
2845
|
+
y ? y.w = p : (y = { c: 1, w: p }, s.push(y, { c: 12, w: p + 1 }));
|
|
2837
2846
|
}
|
|
2838
2847
|
const o = t.columnOpts;
|
|
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((
|
|
2848
|
+
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((p, y) => (y.w || 0) - (p.w || 0));
|
|
2840
2849
|
const n = {
|
|
2841
|
-
...c.cloneDeep(
|
|
2842
|
-
column: c.toNumber(e.getAttribute("gs-column")) ||
|
|
2843
|
-
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2844
|
-
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2845
|
-
staticGrid: c.toBool(e.getAttribute("gs-static")) ||
|
|
2850
|
+
...c.cloneDeep(U),
|
|
2851
|
+
column: c.toNumber(e.getAttribute("gs-column")) || U.column,
|
|
2852
|
+
minRow: i || c.toNumber(e.getAttribute("gs-min-row")) || U.minRow,
|
|
2853
|
+
maxRow: i || c.toNumber(e.getAttribute("gs-max-row")) || U.maxRow,
|
|
2854
|
+
staticGrid: c.toBool(e.getAttribute("gs-static")) || U.staticGrid,
|
|
2846
2855
|
sizeToContent: c.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2847
2856
|
draggable: {
|
|
2848
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2857
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || U.draggable.handle
|
|
2849
2858
|
},
|
|
2850
2859
|
removableOptions: {
|
|
2851
|
-
accept: t.itemClass ||
|
|
2852
|
-
decline:
|
|
2860
|
+
accept: t.itemClass || U.removableOptions.accept,
|
|
2861
|
+
decline: U.removableOptions.decline
|
|
2853
2862
|
}
|
|
2854
2863
|
};
|
|
2855
2864
|
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");
|
|
2856
|
-
const
|
|
2857
|
-
|
|
2858
|
-
const
|
|
2859
|
-
if (this.engine = new
|
|
2865
|
+
const d = this.el.closest("." + U.itemClass), h = d == null ? void 0 : d.gridstackNode;
|
|
2866
|
+
h && (h.subGrid = this, this.parentGridNode = h, this.el.classList.add("grid-stack-nested"), h.el.classList.add("grid-stack-sub-grid")), this._isAutoCellHeight = t.cellHeight === "auto", this._isAutoCellHeight || t.cellHeight === "initial" ? this.cellHeight(void 0, !1) : (typeof t.cellHeight == "number" && t.cellHeightUnit && t.cellHeightUnit !== U.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-" + Z._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2867
|
+
const a = t.engineClass || _.engineClass || Z;
|
|
2868
|
+
if (this.engine = new a({
|
|
2860
2869
|
column: this.getColumn(),
|
|
2861
2870
|
float: t.float,
|
|
2862
2871
|
maxRow: t.maxRow,
|
|
2863
|
-
onChange: (
|
|
2872
|
+
onChange: (p) => {
|
|
2864
2873
|
let y = 0;
|
|
2865
2874
|
this.engine.nodes.forEach((g) => {
|
|
2866
2875
|
y = Math.max(y, g.y + g.h);
|
|
2867
|
-
}),
|
|
2876
|
+
}), p.forEach((g) => {
|
|
2868
2877
|
const R = g.el;
|
|
2869
2878
|
R && (g._removeDOM ? (R && R.remove(), delete g._removeDOM) : this._writePosAttr(R, g));
|
|
2870
2879
|
}), this._updateStyles(!1, y);
|
|
2871
2880
|
}
|
|
2872
|
-
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((
|
|
2873
|
-
const
|
|
2874
|
-
delete t.children,
|
|
2881
|
+
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((p) => this._prepareElement(p)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
2882
|
+
const p = t.children;
|
|
2883
|
+
delete t.children, p.length && this.load(p);
|
|
2875
2884
|
}
|
|
2876
|
-
this.setAnimation(), t.subGridDynamic && !b.pauseDrag && (b.pauseDrag = !0), ((
|
|
2885
|
+
this.setAnimation(), t.subGridDynamic && !b.pauseDrag && (b.pauseDrag = !0), ((m = t.draggable) == null ? void 0 : m.pause) !== void 0 && (b.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
2877
2886
|
}
|
|
2878
2887
|
/**
|
|
2879
2888
|
* add a new widget and returns it.
|
|
@@ -2913,13 +2922,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2913
2922
|
* @returns newly created grid
|
|
2914
2923
|
*/
|
|
2915
2924
|
makeSubGrid(e, t, i, s = !0) {
|
|
2916
|
-
var
|
|
2925
|
+
var m, p, y;
|
|
2917
2926
|
let r = e.gridstackNode;
|
|
2918
|
-
if (r || (r = this.makeWidget(e).gridstackNode), (
|
|
2927
|
+
if (r || (r = this.makeWidget(e).gridstackNode), (m = r.subGrid) != null && m.el)
|
|
2919
2928
|
return r.subGrid;
|
|
2920
2929
|
let o, n = this;
|
|
2921
2930
|
for (; n && !o; )
|
|
2922
|
-
o = (
|
|
2931
|
+
o = (p = n.opts) == null ? void 0 : p.subGridOpts, n = (y = n.parentGridNode) == null ? void 0 : y.grid;
|
|
2923
2932
|
t = c.cloneDeep({
|
|
2924
2933
|
// by default sub-grid inherit from us | parent, other than id, children, etc...
|
|
2925
2934
|
...this.opts,
|
|
@@ -2932,15 +2941,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2932
2941
|
...o || {},
|
|
2933
2942
|
...t || r.subGridOpts || {}
|
|
2934
2943
|
}), r.subGridOpts = t;
|
|
2935
|
-
let
|
|
2936
|
-
t.column === "auto" && (
|
|
2937
|
-
let
|
|
2938
|
-
if (s && (this._removeDD(r.el),
|
|
2939
|
-
const g =
|
|
2944
|
+
let d;
|
|
2945
|
+
t.column === "auto" && (d = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
2946
|
+
let h = r.el.querySelector(".grid-stack-item-content"), a, l;
|
|
2947
|
+
if (s && (this._removeDD(r.el), l = { ...r, x: 0, y: 0 }, c.removeInternalForSave(l), delete l.subGridOpts, r.content && (l.content = r.content, delete r.content), _.addRemoveCB ? a = _.addRemoveCB(this.el, l, !0, !1) : (a = c.createDiv(["grid-stack-item"]), a.appendChild(h), h = c.createDiv(["grid-stack-item-content"], r.el)), this._prepareDragDropByNode(r)), i) {
|
|
2948
|
+
const g = d ? t.column : r.w, R = r.h + i.h, S = r.el.style;
|
|
2940
2949
|
S.transition = "none", this.update(r.el, { w: g, h: R }), setTimeout(() => S.transition = null);
|
|
2941
2950
|
}
|
|
2942
|
-
const f = r.subGrid = _.addGrid(
|
|
2943
|
-
return i != null && i._moving && (f._isTemp = !0),
|
|
2951
|
+
const f = r.subGrid = _.addGrid(h, t);
|
|
2952
|
+
return i != null && i._moving && (f._isTemp = !0), d && (f._autoColumn = !0), s && f.makeWidget(a, l), i && (i._moving ? window.setTimeout(() => c.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
2944
2953
|
}
|
|
2945
2954
|
/**
|
|
2946
2955
|
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
@@ -2978,7 +2987,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2978
2987
|
const r = c.cloneDeep(this.opts);
|
|
2979
2988
|
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");
|
|
2980
2989
|
const o = r._alwaysShowResizeHandle;
|
|
2981
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r,
|
|
2990
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, c.removeInternalAndSame(r, U), r.children = s, r;
|
|
2982
2991
|
}
|
|
2983
2992
|
return s;
|
|
2984
2993
|
}
|
|
@@ -2993,37 +3002,37 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2993
3002
|
* see http://gridstackjs.com/demo/serialization.html
|
|
2994
3003
|
*/
|
|
2995
3004
|
load(e, t = _.addRemoveCB || !0) {
|
|
2996
|
-
var
|
|
3005
|
+
var h;
|
|
2997
3006
|
e = c.cloneDeep(e);
|
|
2998
3007
|
const i = this.getColumn();
|
|
2999
|
-
e.forEach((
|
|
3000
|
-
|
|
3008
|
+
e.forEach((a) => {
|
|
3009
|
+
a.w = a.w || 1, a.h = a.h || 1;
|
|
3001
3010
|
}), e = c.sort(e), this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = !0;
|
|
3002
3011
|
let s = 0;
|
|
3003
|
-
e.forEach((
|
|
3004
|
-
s = Math.max(s, (
|
|
3012
|
+
e.forEach((a) => {
|
|
3013
|
+
s = Math.max(s, (a.x || 0) + a.w);
|
|
3005
3014
|
}), s > this.engine.defaultColumn && (this.engine.defaultColumn = s), s > i && this.engine.cacheLayout(e, s, !0);
|
|
3006
3015
|
const r = _.addRemoveCB;
|
|
3007
3016
|
typeof t == "function" && (_.addRemoveCB = t);
|
|
3008
3017
|
const o = [];
|
|
3009
3018
|
this.batchUpdate();
|
|
3010
3019
|
const n = !this.engine.nodes.length;
|
|
3011
|
-
n && this.setAnimation(!1), !n && t && [...this.engine.nodes].forEach((
|
|
3012
|
-
if (!
|
|
3020
|
+
n && this.setAnimation(!1), !n && t && [...this.engine.nodes].forEach((l) => {
|
|
3021
|
+
if (!l.id)
|
|
3013
3022
|
return;
|
|
3014
|
-
c.find(e,
|
|
3023
|
+
c.find(e, l.id) || (_.addRemoveCB && _.addRemoveCB(this.el, l, !1, !1), o.push(l), this.removeWidget(l.el, !0, !1));
|
|
3015
3024
|
}), this.engine._loading = !0;
|
|
3016
|
-
const
|
|
3017
|
-
return this.engine.nodes = this.engine.nodes.filter((
|
|
3025
|
+
const d = [];
|
|
3026
|
+
return this.engine.nodes = this.engine.nodes.filter((a) => c.find(e, a.id) ? (d.push(a), !1) : !0), e.forEach((a) => {
|
|
3018
3027
|
var f;
|
|
3019
|
-
const
|
|
3020
|
-
if (
|
|
3021
|
-
if (c.shouldSizeToContent(
|
|
3022
|
-
const
|
|
3023
|
-
|
|
3028
|
+
const l = c.find(d, a.id);
|
|
3029
|
+
if (l) {
|
|
3030
|
+
if (c.shouldSizeToContent(l) && (a.h = l.h), this.engine.nodeBoundFix(a), (a.autoPosition || a.x === void 0 || a.y === void 0) && (a.w = a.w || l.w, a.h = a.h || l.h, this.engine.findEmptyPosition(a)), this.engine.nodes.push(l), c.samePos(l, a) && this.engine.nodes.length > 1 && (this.moveNode(l, { ...a, forceCollide: !0 }), c.copyPos(a, l)), this.update(l.el, a), (f = a.subGridOpts) != null && f.children) {
|
|
3031
|
+
const m = l.el.querySelector(".grid-stack");
|
|
3032
|
+
m && m.gridstack && m.gridstack.load(a.subGridOpts.children);
|
|
3024
3033
|
}
|
|
3025
|
-
} else t && this.addWidget(
|
|
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 && ((
|
|
3034
|
+
} else t && this.addWidget(a);
|
|
3035
|
+
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? _.addRemoveCB = r : delete _.addRemoveCB, n && ((h = this.opts) != null && h.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
3027
3036
|
}
|
|
3028
3037
|
/**
|
|
3029
3038
|
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
@@ -3103,7 +3112,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3103
3112
|
i = e.breakpoints[n++].c || t;
|
|
3104
3113
|
}
|
|
3105
3114
|
if (i !== t) {
|
|
3106
|
-
const n = (o = e.breakpoints) == null ? void 0 : o.find((
|
|
3115
|
+
const n = (o = e.breakpoints) == null ? void 0 : o.find((d) => d.c === i);
|
|
3107
3116
|
return this.column(i, (n == null ? void 0 : n.layout) || e.layout), !0;
|
|
3108
3117
|
}
|
|
3109
3118
|
return !1;
|
|
@@ -3181,8 +3190,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3181
3190
|
const i = this.el.getBoundingClientRect();
|
|
3182
3191
|
let s;
|
|
3183
3192
|
t ? s = { top: i.top + document.documentElement.scrollTop, left: i.left } : s = { top: this.el.offsetTop, left: this.el.offsetLeft };
|
|
3184
|
-
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(),
|
|
3185
|
-
return { x: Math.floor(r / n), y: Math.floor(o /
|
|
3193
|
+
const r = e.left - s.left, o = e.top - s.top, n = i.width / this.getColumn(), d = i.height / parseInt(this.el.getAttribute("gs-current-row"));
|
|
3194
|
+
return { x: Math.floor(r / n), y: Math.floor(o / d) };
|
|
3186
3195
|
}
|
|
3187
3196
|
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
3188
3197
|
getRow() {
|
|
@@ -3300,7 +3309,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3300
3309
|
return t = { x: i[s++], y: i[s++], w: i[s++], h: i[s++] }, this.update(e, t);
|
|
3301
3310
|
}
|
|
3302
3311
|
return _.getElements(e).forEach((i) => {
|
|
3303
|
-
var
|
|
3312
|
+
var a;
|
|
3304
3313
|
const s = i == null ? void 0 : i.gridstackNode;
|
|
3305
3314
|
if (!s)
|
|
3306
3315
|
return;
|
|
@@ -3308,20 +3317,20 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3308
3317
|
this.engine.nodeBoundFix(r), delete r.autoPosition;
|
|
3309
3318
|
const o = ["x", "y", "w", "h"];
|
|
3310
3319
|
let n;
|
|
3311
|
-
if (o.some((
|
|
3312
|
-
n[
|
|
3320
|
+
if (o.some((l) => r[l] !== void 0 && r[l] !== s[l]) && (n = {}, o.forEach((l) => {
|
|
3321
|
+
n[l] = r[l] !== void 0 ? r[l] : s[l], delete r[l];
|
|
3313
3322
|
})), !n && (r.minW || r.minH || r.maxW || r.maxH) && (n = {}), r.content !== void 0) {
|
|
3314
|
-
const
|
|
3315
|
-
|
|
3323
|
+
const l = i.querySelector(".grid-stack-item-content");
|
|
3324
|
+
l && l.textContent !== r.content && (s.content = r.content, _.renderCB(l, r), (a = s.subGrid) != null && a.el && (l.appendChild(s.subGrid.el), s.subGrid.opts.styleInHead || s.subGrid._updateStyles(!0))), delete r.content;
|
|
3316
3325
|
}
|
|
3317
|
-
let
|
|
3318
|
-
for (const
|
|
3319
|
-
|
|
3326
|
+
let d = !1, h = !1;
|
|
3327
|
+
for (const l in r)
|
|
3328
|
+
l[0] !== "_" && s[l] !== r[l] && (s[l] = r[l], d = !0, h = h || !this.opts.staticGrid && (l === "noResize" || l === "noMove" || l === "locked"));
|
|
3320
3329
|
if (c.sanitizeMinMax(s), n) {
|
|
3321
|
-
const
|
|
3322
|
-
this.moveNode(s, n),
|
|
3330
|
+
const l = n.w !== void 0 && n.w !== s.w;
|
|
3331
|
+
this.moveNode(s, n), l && s.subGrid ? s.subGrid.onResize(this.hasAnimationCSS() ? s.w : void 0) : this.resizeToContentCheck(l, s), delete s._orig;
|
|
3323
3332
|
}
|
|
3324
|
-
(n ||
|
|
3333
|
+
(n || d) && this._writeAttr(i, s), h && this._prepareDragDropByNode(s);
|
|
3325
3334
|
}), this;
|
|
3326
3335
|
}
|
|
3327
3336
|
moveNode(e, t) {
|
|
@@ -3335,7 +3344,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3335
3344
|
* @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
|
|
3336
3345
|
*/
|
|
3337
3346
|
resizeToContent(e) {
|
|
3338
|
-
var f,
|
|
3347
|
+
var f, m;
|
|
3339
3348
|
if (!e || (e.classList.remove("size-to-content-max"), !e.clientHeight))
|
|
3340
3349
|
return;
|
|
3341
3350
|
const t = e.gridstackNode;
|
|
@@ -3350,30 +3359,30 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3350
3359
|
let r = t.h ? t.h * s : e.clientHeight, o;
|
|
3351
3360
|
if (t.resizeToContentParent && (o = e.querySelector(t.resizeToContentParent)), o || (o = e.querySelector(_.resizeToContentParent)), !o)
|
|
3352
3361
|
return;
|
|
3353
|
-
const n = e.clientHeight - o.clientHeight,
|
|
3354
|
-
let
|
|
3362
|
+
const n = e.clientHeight - o.clientHeight, d = t.h ? t.h * s - n : o.clientHeight;
|
|
3363
|
+
let h;
|
|
3355
3364
|
if (t.subGrid) {
|
|
3356
|
-
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3365
|
+
h = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3366
|
+
const p = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3367
|
+
h += p.top - y.top;
|
|
3359
3368
|
} else {
|
|
3360
|
-
if ((
|
|
3369
|
+
if ((m = (f = t.subGridOpts) == null ? void 0 : f.children) != null && m.length)
|
|
3361
3370
|
return;
|
|
3362
3371
|
{
|
|
3363
|
-
const
|
|
3364
|
-
if (!
|
|
3372
|
+
const p = o.firstElementChild;
|
|
3373
|
+
if (!p) {
|
|
3365
3374
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3366
3375
|
return;
|
|
3367
3376
|
}
|
|
3368
|
-
|
|
3377
|
+
h = p.getBoundingClientRect().height || d;
|
|
3369
3378
|
}
|
|
3370
3379
|
}
|
|
3371
|
-
if (
|
|
3380
|
+
if (d === h)
|
|
3372
3381
|
return;
|
|
3373
|
-
r +=
|
|
3374
|
-
let
|
|
3375
|
-
const
|
|
3376
|
-
|
|
3382
|
+
r += h - d;
|
|
3383
|
+
let a = Math.ceil(r / s);
|
|
3384
|
+
const l = Number.isInteger(t.sizeToContent) ? t.sizeToContent : 0;
|
|
3385
|
+
l && a > l && (a = l, e.classList.add("size-to-content-max")), t.minH && a < t.minH ? a = t.minH : t.maxH && a > t.maxH && (a = t.maxH), a !== t.h && (i._ignoreLayoutsNodeChange = !0, i.moveNode(t, { h: a }), delete i._ignoreLayoutsNodeChange);
|
|
3377
3386
|
}
|
|
3378
3387
|
/** call the user resize (so they can do extra work) else our build in version */
|
|
3379
3388
|
resizeToContentCBCheck(e) {
|
|
@@ -3390,8 +3399,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3390
3399
|
return;
|
|
3391
3400
|
const r = { w: s.h, h: s.w, minH: s.minW, minW: s.minH, maxH: s.maxW, maxW: s.maxH };
|
|
3392
3401
|
if (t) {
|
|
3393
|
-
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0,
|
|
3394
|
-
r.x = s.x + n - (s.h - (
|
|
3402
|
+
const n = t.left > 0 ? Math.floor(t.left / this.cellWidth()) : 0, d = t.top > 0 ? Math.floor(t.top / this.opts.cellHeight) : 0;
|
|
3403
|
+
r.x = s.x + n - (s.h - (d + 1)), r.y = s.y + d - n;
|
|
3395
3404
|
}
|
|
3396
3405
|
Object.keys(r).forEach((n) => {
|
|
3397
3406
|
r[n] === void 0 && delete r[n];
|
|
@@ -3494,8 +3503,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3494
3503
|
}), !this._styles)
|
|
3495
3504
|
return this;
|
|
3496
3505
|
this._styles._max = 0, c.addCSSRule(this._styles, r, `height: ${i}${s}`);
|
|
3497
|
-
const n = this.opts.marginTop + this.opts.marginUnit,
|
|
3498
|
-
c.addCSSRule(this._styles,
|
|
3506
|
+
const n = this.opts.marginTop + this.opts.marginUnit, d = this.opts.marginBottom + this.opts.marginUnit, h = this.opts.marginRight + this.opts.marginUnit, a = this.opts.marginLeft + this.opts.marginUnit, l = `${r} > .grid-stack-item-content`, f = `.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;
|
|
3507
|
+
c.addCSSRule(this._styles, l, `top: ${n}; right: ${h}; bottom: ${d}; left: ${a};`), c.addCSSRule(this._styles, f, `top: ${n}; right: ${h}; bottom: ${d}; left: ${a};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-n`, `top: ${n};`), c.addCSSRule(this._styles, `${r} > .ui-resizable-s`, `bottom: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-ne`, `right: ${h}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-e`, `right: ${h}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-se`, `right: ${h}; bottom: ${d}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-nw`, `left: ${a}; top: ${n}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-w`, `left: ${a}`), c.addCSSRule(this._styles, `${r} > .ui-resizable-sw`, `left: ${a}; bottom: ${d}`);
|
|
3499
3508
|
}
|
|
3500
3509
|
if (t = t || this._styles._max, t > this._styles._max) {
|
|
3501
3510
|
const o = (n) => i * n + s;
|
|
@@ -3525,7 +3534,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3525
3534
|
}
|
|
3526
3535
|
/** @internal */
|
|
3527
3536
|
_prepareElement(e, t = !1, i) {
|
|
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(
|
|
3537
|
+
i = i || this._readAttr(e), e.gridstackNode = i, i.el = e, i.grid = this, i = this.engine.addNode(i, t), this._writeAttr(e, i), e.classList.add(U.itemClass, this.opts.itemClass);
|
|
3529
3538
|
const s = c.shouldSizeToContent(i);
|
|
3530
3539
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), this._prepareDragDropByNode(i), this;
|
|
3531
3540
|
}
|
|
@@ -3629,7 +3638,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3629
3638
|
*/
|
|
3630
3639
|
/** get the global (but static to this code) DD implementation */
|
|
3631
3640
|
static getDD() {
|
|
3632
|
-
return
|
|
3641
|
+
return P;
|
|
3633
3642
|
}
|
|
3634
3643
|
/**
|
|
3635
3644
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
@@ -3642,7 +3651,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3642
3651
|
*/
|
|
3643
3652
|
static setupDragIn(e, t, i, s = document) {
|
|
3644
3653
|
(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) => {
|
|
3645
|
-
|
|
3654
|
+
P.isDraggable(o) || P.dragIn(o, t), i != null && i[n] && (o.gridstackNode = i[n]);
|
|
3646
3655
|
});
|
|
3647
3656
|
}
|
|
3648
3657
|
/**
|
|
@@ -3721,12 +3730,12 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3721
3730
|
}
|
|
3722
3731
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
3723
3732
|
_removeDD(e) {
|
|
3724
|
-
return
|
|
3733
|
+
return P.draggable(e, "destroy").resizable(e, "destroy"), e.gridstackNode && delete e.gridstackNode._initDD, delete e.ddElement, this;
|
|
3725
3734
|
}
|
|
3726
3735
|
/** @internal called to add drag over to support widgets being added externally */
|
|
3727
3736
|
_setupAcceptWidget() {
|
|
3728
3737
|
if (this.opts.staticGrid || !this.opts.acceptWidgets && !this.opts.removable)
|
|
3729
|
-
return
|
|
3738
|
+
return P.droppable(this.el, "destroy"), this;
|
|
3730
3739
|
let e, t;
|
|
3731
3740
|
const i = (s, r, o) => {
|
|
3732
3741
|
var f;
|
|
@@ -3736,31 +3745,31 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3736
3745
|
return;
|
|
3737
3746
|
if (!((f = n.grid) != null && f.el)) {
|
|
3738
3747
|
o.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;
|
|
3739
|
-
const
|
|
3740
|
-
o.style.left =
|
|
3748
|
+
const m = o.getBoundingClientRect();
|
|
3749
|
+
o.style.left = m.x + (this.dragTransform.xScale - 1) * (s.clientX - m.x) / this.dragTransform.xScale + "px", o.style.top = m.y + (this.dragTransform.yScale - 1) * (s.clientY - m.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
3741
3750
|
}
|
|
3742
|
-
let { top:
|
|
3743
|
-
const
|
|
3744
|
-
|
|
3745
|
-
const
|
|
3751
|
+
let { top: d, left: h } = o.getBoundingClientRect();
|
|
3752
|
+
const a = this.el.getBoundingClientRect();
|
|
3753
|
+
h -= a.left, d -= a.top;
|
|
3754
|
+
const l = {
|
|
3746
3755
|
position: {
|
|
3747
|
-
top:
|
|
3748
|
-
left:
|
|
3756
|
+
top: d * this.dragTransform.xScale,
|
|
3757
|
+
left: h * this.dragTransform.yScale
|
|
3749
3758
|
}
|
|
3750
3759
|
};
|
|
3751
3760
|
if (n._temporaryRemoved) {
|
|
3752
|
-
if (n.x = Math.max(0, Math.round(
|
|
3761
|
+
if (n.x = Math.max(0, Math.round(h / t)), n.y = Math.max(0, Math.round(d / e)), delete n.autoPosition, this.engine.nodeBoundFix(n), !this.engine.willItFit(n)) {
|
|
3753
3762
|
if (n.autoPosition = !0, !this.engine.willItFit(n)) {
|
|
3754
|
-
|
|
3763
|
+
P.off(r, "drag");
|
|
3755
3764
|
return;
|
|
3756
3765
|
}
|
|
3757
3766
|
n._willFitPos && (c.copyPos(n, n._willFitPos), delete n._willFitPos);
|
|
3758
3767
|
}
|
|
3759
|
-
this._onStartMoving(o, s,
|
|
3768
|
+
this._onStartMoving(o, s, l, n, t, e);
|
|
3760
3769
|
} else
|
|
3761
|
-
this._dragOrResize(o, s,
|
|
3770
|
+
this._dragOrResize(o, s, l, n, t, e);
|
|
3762
3771
|
};
|
|
3763
|
-
return
|
|
3772
|
+
return P.droppable(this.el, {
|
|
3764
3773
|
accept: (s) => {
|
|
3765
3774
|
const r = s.gridstackNode || this._readAttr(s, !1);
|
|
3766
3775
|
if ((r == null ? void 0 : r.grid) === this)
|
|
@@ -3785,42 +3794,42 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3785
3794
|
if ((n == null ? void 0 : n.grid) === this && !n._temporaryRemoved)
|
|
3786
3795
|
return !1;
|
|
3787
3796
|
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) {
|
|
3788
|
-
const
|
|
3789
|
-
if (
|
|
3797
|
+
const a = o.getAttribute("data-gs-widget") || o.getAttribute("gridstacknode");
|
|
3798
|
+
if (a) {
|
|
3790
3799
|
try {
|
|
3791
|
-
n = JSON.parse(
|
|
3800
|
+
n = JSON.parse(a);
|
|
3792
3801
|
} catch {
|
|
3793
|
-
console.error("Gridstack dropover: Bad JSON format: ",
|
|
3802
|
+
console.error("Gridstack dropover: Bad JSON format: ", a);
|
|
3794
3803
|
}
|
|
3795
3804
|
o.removeAttribute("data-gs-widget"), o.removeAttribute("gridstacknode");
|
|
3796
3805
|
}
|
|
3797
3806
|
n || (n = this._readAttr(o));
|
|
3798
3807
|
}
|
|
3799
3808
|
n.grid || (n.el || (n = { ...n }), n._isExternal = !0, o.gridstackNode = n);
|
|
3800
|
-
const
|
|
3801
|
-
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w:
|
|
3802
|
-
n._temporaryRemoved = !0) : (n.w =
|
|
3809
|
+
const d = n.w || Math.round(o.offsetWidth / t) || 1, h = n.h || Math.round(o.offsetHeight / e) || 1;
|
|
3810
|
+
return n.grid && n.grid !== this ? (r._gridstackNodeOrig || (r._gridstackNodeOrig = n), r.gridstackNode = n = { ...n, w: d, h, grid: this }, delete n.x, delete n.y, this.engine.cleanupNode(n).nodeBoundFix(n), n._initDD = n._isExternal = // DOM needs to be re-parented on a drop
|
|
3811
|
+
n._temporaryRemoved = !0) : (n.w = d, n.h = h, n._temporaryRemoved = !0), _._itemRemoving(n.el, !1), P.on(r, "drag", i), i(s, r, o), !1;
|
|
3803
3812
|
}).on(this.el, "dropout", (s, r, o) => {
|
|
3804
3813
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3805
3814
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3806
3815
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3807
|
-
var
|
|
3816
|
+
var m, p, y;
|
|
3808
3817
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3809
3818
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3810
3819
|
return !1;
|
|
3811
|
-
const
|
|
3820
|
+
const d = !!this.placeholder.parentElement, h = r !== o;
|
|
3812
3821
|
this.placeholder.remove(), delete this.placeholder.gridstackNode;
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3815
|
-
const
|
|
3816
|
-
if (delete r._gridstackNodeOrig,
|
|
3817
|
-
const g =
|
|
3818
|
-
g.engine.removeNodeFromLayoutCache(
|
|
3822
|
+
const a = d && this.opts.animate;
|
|
3823
|
+
a && this.setAnimation(!1);
|
|
3824
|
+
const l = r._gridstackNodeOrig;
|
|
3825
|
+
if (delete r._gridstackNodeOrig, d && (l != null && l.grid) && l.grid !== this) {
|
|
3826
|
+
const g = l.grid;
|
|
3827
|
+
g.engine.removeNodeFromLayoutCache(l), g.engine.removedNodes.push(l), g._triggerRemoveEvent()._triggerChangeEvent(), g.parentGridNode && !g.engine.nodes.length && g.opts.subGridDynamic && g.removeAsSubGrid();
|
|
3819
3828
|
}
|
|
3820
|
-
if (!n || (
|
|
3829
|
+
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (m = n.grid) == null || delete m._isTemp, P.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !d))
|
|
3821
3830
|
return !1;
|
|
3822
|
-
const f = (y = (
|
|
3823
|
-
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r),
|
|
3831
|
+
const f = (y = (p = n.subGrid) == null ? void 0 : p.el) == null ? void 0 : y.gridstack;
|
|
3832
|
+
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts || _.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, l && l.grid ? l : void 0, n), a && this.setAnimation(this.opts.animate, !0), !1;
|
|
3824
3833
|
}), this;
|
|
3825
3834
|
}
|
|
3826
3835
|
/** @internal mark item for removal */
|
|
@@ -3835,7 +3844,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3835
3844
|
if (typeof this.opts.removable != "string")
|
|
3836
3845
|
return this;
|
|
3837
3846
|
const e = document.querySelector(this.opts.removable);
|
|
3838
|
-
return e ? (!this.opts.staticGrid && !
|
|
3847
|
+
return e ? (!this.opts.staticGrid && !P.isDroppable(e) && P.droppable(e, this.opts.removableOptions).on(e, "dropover", (t, i) => _._itemRemoving(i, !0)).on(e, "dropout", (t, i) => _._itemRemoving(i, !1)), this) : this;
|
|
3839
3848
|
}
|
|
3840
3849
|
/** @internal prepares the element for drag&drop */
|
|
3841
3850
|
_prepareDragDropByNode(e) {
|
|
@@ -3844,33 +3853,33 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3844
3853
|
return e._initDD && (this._removeDD(t), delete e._initDD), t.classList.add("ui-draggable-disabled", "ui-resizable-disabled"), this;
|
|
3845
3854
|
if (!e._initDD) {
|
|
3846
3855
|
let r, o;
|
|
3847
|
-
const n = (
|
|
3848
|
-
this._gsEventHandler[
|
|
3849
|
-
},
|
|
3850
|
-
this._dragOrResize(t,
|
|
3851
|
-
},
|
|
3856
|
+
const n = (a, l) => {
|
|
3857
|
+
this._gsEventHandler[a.type] && this._gsEventHandler[a.type](a, a.target), r = this.cellWidth(), o = this.getCellHeight(!0), this._onStartMoving(t, a, l, e, r, o);
|
|
3858
|
+
}, d = (a, l) => {
|
|
3859
|
+
this._dragOrResize(t, a, l, e, r, o);
|
|
3860
|
+
}, h = (a) => {
|
|
3852
3861
|
this.placeholder.remove(), delete this.placeholder.gridstackNode, delete e._moving, delete e._event, delete e._lastTried;
|
|
3853
|
-
const
|
|
3862
|
+
const l = e.w !== e._orig.w, f = a.target;
|
|
3854
3863
|
if (!(!f.gridstackNode || f.gridstackNode.grid !== this)) {
|
|
3855
3864
|
if (e.el = f, e._isAboutToRemove) {
|
|
3856
|
-
const
|
|
3857
|
-
|
|
3865
|
+
const m = t.gridstackNode.grid;
|
|
3866
|
+
m._gsEventHandler[a.type] && m._gsEventHandler[a.type](a, f), m.engine.nodes.push(e), m.removeWidget(t, !0, !0);
|
|
3858
3867
|
} else
|
|
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[
|
|
3860
|
-
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(),
|
|
3868
|
+
c.removePositioningStyles(f), e._temporaryRemoved ? (c.copyPos(e, e._orig), this._writePosAttr(f, e), this.engine.addNode(e)) : this._writePosAttr(f, e), this._gsEventHandler[a.type] && this._gsEventHandler[a.type](a, f);
|
|
3869
|
+
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), a.type === "resizestop" && (Number.isInteger(e.sizeToContent) && (e.sizeToContent = e.h), this.resizeToContentCheck(l, e));
|
|
3861
3870
|
}
|
|
3862
3871
|
};
|
|
3863
|
-
|
|
3872
|
+
P.draggable(t, {
|
|
3864
3873
|
start: n,
|
|
3865
|
-
stop:
|
|
3866
|
-
drag:
|
|
3874
|
+
stop: h,
|
|
3875
|
+
drag: d
|
|
3867
3876
|
}).resizable(t, {
|
|
3868
3877
|
start: n,
|
|
3869
|
-
stop:
|
|
3870
|
-
resize:
|
|
3878
|
+
stop: h,
|
|
3879
|
+
resize: d
|
|
3871
3880
|
}), e._initDD = !0;
|
|
3872
3881
|
}
|
|
3873
|
-
return
|
|
3882
|
+
return P.draggable(t, i ? "disable" : "enable").resizable(t, s ? "disable" : "enable"), this;
|
|
3874
3883
|
}
|
|
3875
3884
|
/** @internal handles actual drag/resize start */
|
|
3876
3885
|
_onStartMoving(e, t, i, s, r, o) {
|
|
@@ -3878,8 +3887,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3878
3887
|
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)
|
|
3879
3888
|
this.dragTransform = c.getValuesFromTransformedElement(e);
|
|
3880
3889
|
else if (this.placeholder && this.placeholder.closest(".grid-stack")) {
|
|
3881
|
-
const
|
|
3882
|
-
this.dragTransform = c.getValuesFromTransformedElement(
|
|
3890
|
+
const d = this.placeholder.closest(".grid-stack");
|
|
3891
|
+
this.dragTransform = c.getValuesFromTransformedElement(d);
|
|
3883
3892
|
} else
|
|
3884
3893
|
this.dragTransform = {
|
|
3885
3894
|
xScale: 1,
|
|
@@ -3888,46 +3897,46 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3888
3897
|
yOffset: 0
|
|
3889
3898
|
};
|
|
3890
3899
|
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") {
|
|
3891
|
-
const
|
|
3892
|
-
|
|
3900
|
+
const d = this.getColumn() - s.x, h = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - s.y;
|
|
3901
|
+
P.resizable(e, "option", "minWidth", r * Math.min(s.minW || 1, d)).resizable(e, "option", "minHeight", o * Math.min(s.minH || 1, h)).resizable(e, "option", "maxWidth", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, d)).resizable(e, "option", "maxWidthMoveLeft", r * Math.min(s.maxW || Number.MAX_SAFE_INTEGER, s.x + s.w)).resizable(e, "option", "maxHeight", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, h)).resizable(e, "option", "maxHeightMoveUp", o * Math.min(s.maxH || Number.MAX_SAFE_INTEGER, s.y + s.h));
|
|
3893
3902
|
}
|
|
3894
3903
|
}
|
|
3895
3904
|
/** @internal handles actual drag/resize */
|
|
3896
3905
|
_dragOrResize(e, t, i, s, r, o) {
|
|
3897
3906
|
const n = { ...s._orig };
|
|
3898
|
-
let
|
|
3899
|
-
const
|
|
3900
|
-
if (
|
|
3907
|
+
let d, h = this.opts.marginLeft, a = this.opts.marginRight, l = this.opts.marginTop, f = this.opts.marginBottom;
|
|
3908
|
+
const m = Math.round(o * 0.1), p = Math.round(r * 0.1);
|
|
3909
|
+
if (h = Math.min(h, p), a = Math.min(a, p), l = Math.min(l, m), f = Math.min(f, m), t.type === "drag") {
|
|
3901
3910
|
if (s._temporaryRemoved)
|
|
3902
3911
|
return;
|
|
3903
3912
|
const g = i.position.top - s._prevYPix;
|
|
3904
3913
|
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 ? -
|
|
3914
|
+
const R = i.position.left + (i.position.left > s._lastUiPosition.left ? -a : h), S = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : l);
|
|
3906
3915
|
n.x = Math.round(R / r), n.y = Math.round(S / o);
|
|
3907
3916
|
const C = this._extraDragRow;
|
|
3908
3917
|
if (this.engine.collide(s, n)) {
|
|
3909
|
-
const
|
|
3910
|
-
let
|
|
3911
|
-
this.opts.maxRow &&
|
|
3918
|
+
const x = this.getRow();
|
|
3919
|
+
let E = Math.max(0, n.y + s.h - x);
|
|
3920
|
+
this.opts.maxRow && x + E > this.opts.maxRow && (E = Math.max(0, this.opts.maxRow - x)), this._extraDragRow = E;
|
|
3912
3921
|
} else
|
|
3913
3922
|
this._extraDragRow = 0;
|
|
3914
3923
|
if (this._extraDragRow !== C && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
3915
3924
|
return;
|
|
3916
3925
|
} else if (t.type === "resize") {
|
|
3917
|
-
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width -
|
|
3926
|
+
if (n.x < 0 || (c.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - h) / r), n.h = Math.round((i.size.height - l) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
3918
3927
|
return;
|
|
3919
|
-
const g = i.position.left +
|
|
3920
|
-
n.x = Math.round(g / r), n.y = Math.round(R / o),
|
|
3928
|
+
const g = i.position.left + h, R = i.position.top + l;
|
|
3929
|
+
n.x = Math.round(g / r), n.y = Math.round(R / o), d = !0;
|
|
3921
3930
|
}
|
|
3922
3931
|
s._event = t, s._lastTried = n;
|
|
3923
3932
|
const y = {
|
|
3924
|
-
x: i.position.left +
|
|
3925
|
-
y: i.position.top +
|
|
3926
|
-
w: (i.size ? i.size.width : s.w * r) -
|
|
3927
|
-
h: (i.size ? i.size.height : s.h * o) -
|
|
3933
|
+
x: i.position.left + h,
|
|
3934
|
+
y: i.position.top + l,
|
|
3935
|
+
w: (i.size ? i.size.width : s.w * r) - h - a,
|
|
3936
|
+
h: (i.size ? i.size.height : s.h * o) - l - f
|
|
3928
3937
|
};
|
|
3929
|
-
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing:
|
|
3930
|
-
s._lastUiPosition = i.position, this.engine.cacheRects(r, o,
|
|
3938
|
+
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: y, resizing: d })) {
|
|
3939
|
+
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, l, a, f, h), delete s._skipDown, d && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
3931
3940
|
const g = t.target;
|
|
3932
3941
|
this._writePosAttr(g, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, g);
|
|
3933
3942
|
}
|
|
@@ -3939,7 +3948,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3939
3948
|
_leave(e, t) {
|
|
3940
3949
|
t = t || e;
|
|
3941
3950
|
const i = t.gridstackNode;
|
|
3942
|
-
i && (t.style.transform = t.style.transformOrigin = null,
|
|
3951
|
+
i && (t.style.transform = t.style.transformOrigin = null, P.off(e, "drag"), !i._temporaryRemoved && (i._temporaryRemoved = !0, this.engine.removeNode(i), i.el = i._isExternal && t ? t : e, i._isExternal && this.engine.cleanupNode(i), this.opts.removable === !0 && _._itemRemoving(e, !0), e._gridstackNodeOrig ? (e.gridstackNode = e._gridstackNodeOrig, delete e._gridstackNodeOrig) : i._isExternal && this.engine.restoreInitial()));
|
|
3943
3952
|
}
|
|
3944
3953
|
// legacy method removed
|
|
3945
3954
|
commit() {
|
|
@@ -3951,9 +3960,9 @@ _.renderCB = (u, e) => {
|
|
|
3951
3960
|
};
|
|
3952
3961
|
_.resizeToContentParent = ".grid-stack-item-content";
|
|
3953
3962
|
_.Utils = c;
|
|
3954
|
-
_.Engine =
|
|
3963
|
+
_.Engine = Z;
|
|
3955
3964
|
_.GDRev = "11.3.0";
|
|
3956
|
-
const
|
|
3965
|
+
const Ki = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Yi = { class: "grid-stack-item-content" }, Xi = /* @__PURE__ */ G({
|
|
3957
3966
|
__name: "DraggableGridLayout",
|
|
3958
3967
|
props: {
|
|
3959
3968
|
tiles: {},
|
|
@@ -3962,25 +3971,25 @@ const Vi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ki = { cl
|
|
|
3962
3971
|
},
|
|
3963
3972
|
emits: ["update-tiles"],
|
|
3964
3973
|
setup(u, { expose: e, emit: t }) {
|
|
3965
|
-
const i = u, s = t, r =
|
|
3974
|
+
const i = u, s = t, r = $(null), o = $(new Map(i.tiles.map((m) => [`${m.id}`, m])));
|
|
3966
3975
|
let n = null;
|
|
3967
|
-
const
|
|
3976
|
+
const d = (m) => `[data-id="${m}"]`, h = (m) => m.map((p) => {
|
|
3968
3977
|
var g;
|
|
3969
|
-
const y = o.value.get(`${(g =
|
|
3978
|
+
const y = o.value.get(`${(g = p.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
3970
3979
|
if (y)
|
|
3971
3980
|
return {
|
|
3972
3981
|
...y,
|
|
3973
3982
|
layout: {
|
|
3974
|
-
position: { col: Number(
|
|
3975
|
-
size: { cols: Number(
|
|
3983
|
+
position: { col: Number(p.x), row: Number(p.y) },
|
|
3984
|
+
size: { cols: Number(p.w), rows: Number(p.h) }
|
|
3976
3985
|
}
|
|
3977
3986
|
};
|
|
3978
|
-
}).filter((
|
|
3979
|
-
n && (
|
|
3987
|
+
}).filter((p) => p !== void 0), a = (m, p) => {
|
|
3988
|
+
n && (h(p).forEach((g) => {
|
|
3980
3989
|
o.value.set(`${g.id}`, g);
|
|
3981
3990
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
3982
|
-
},
|
|
3983
|
-
|
|
3991
|
+
}, l = (m, p) => {
|
|
3992
|
+
p.forEach((y) => {
|
|
3984
3993
|
var g;
|
|
3985
3994
|
o.value.delete(`${(g = y.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
3986
3995
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
@@ -3991,36 +4000,36 @@ const Vi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ki = { cl
|
|
|
3991
4000
|
cellHeight: i.tileHeight,
|
|
3992
4001
|
resizable: { handles: "se, sw" },
|
|
3993
4002
|
handle: ".tile-header"
|
|
3994
|
-
}, r.value), n.on("change",
|
|
4003
|
+
}, r.value), n.on("change", a), n.on("added", a), n.on("removed", l));
|
|
3995
4004
|
}), $e(() => {
|
|
3996
4005
|
n && n.destroy(!1);
|
|
3997
4006
|
});
|
|
3998
|
-
const f = (
|
|
4007
|
+
const f = (m) => {
|
|
3999
4008
|
if (n && r.value) {
|
|
4000
|
-
const
|
|
4001
|
-
|
|
4009
|
+
const p = r.value.querySelector(d(m));
|
|
4010
|
+
p && n.removeWidget(p);
|
|
4002
4011
|
}
|
|
4003
4012
|
};
|
|
4004
|
-
return
|
|
4005
|
-
if (
|
|
4006
|
-
const y = i.tiles.slice(
|
|
4013
|
+
return Fe(() => i.tiles.length, async (m, p) => {
|
|
4014
|
+
if (m > p && n) {
|
|
4015
|
+
const y = i.tiles.slice(p);
|
|
4007
4016
|
for (const g of y)
|
|
4008
|
-
o.value.set(`${g.id}`, g), await
|
|
4017
|
+
o.value.set(`${g.id}`, g), await yt(), n.makeWidget(d(g.id), {
|
|
4009
4018
|
autoPosition: !0,
|
|
4010
4019
|
w: g.layout.size.cols,
|
|
4011
4020
|
h: g.layout.size.rows
|
|
4012
4021
|
});
|
|
4013
4022
|
}
|
|
4014
|
-
}),
|
|
4015
|
-
i.tiles.forEach((
|
|
4016
|
-
o.value.set(`${
|
|
4023
|
+
}), gt(() => {
|
|
4024
|
+
i.tiles.forEach((m) => {
|
|
4025
|
+
o.value.set(`${m.id}`, m);
|
|
4017
4026
|
});
|
|
4018
|
-
}), e({ removeWidget: f }), (
|
|
4027
|
+
}), e({ removeWidget: f }), (m, p) => (z(), F("div", {
|
|
4019
4028
|
ref_key: "gridContainer",
|
|
4020
4029
|
ref: r,
|
|
4021
4030
|
class: "grid-stack"
|
|
4022
4031
|
}, [
|
|
4023
|
-
(
|
|
4032
|
+
(z(!0), F(_t, null, wt(i.tiles, (y) => (z(), F("div", {
|
|
4024
4033
|
key: y.id,
|
|
4025
4034
|
class: "grid-stack-item",
|
|
4026
4035
|
"data-id": `${y.id}`,
|
|
@@ -4031,131 +4040,132 @@ const Vi = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], Ki = { cl
|
|
|
4031
4040
|
"gs-x": y.layout.position.col,
|
|
4032
4041
|
"gs-y": y.layout.position.row
|
|
4033
4042
|
}, [
|
|
4034
|
-
le("div",
|
|
4035
|
-
Le(
|
|
4043
|
+
le("div", Yi, [
|
|
4044
|
+
Le(m.$slots, "tile", { tile: y }, void 0, !0)
|
|
4036
4045
|
])
|
|
4037
|
-
], 8,
|
|
4046
|
+
], 8, Ki))), 128))
|
|
4038
4047
|
], 512));
|
|
4039
4048
|
}
|
|
4040
|
-
}),
|
|
4049
|
+
}), ji = /* @__PURE__ */ ae(Xi, [["__scopeId", "data-v-f4f87f74"]]), Qi = { class: "kong-ui-public-dashboard-renderer" }, Zi = {
|
|
4041
4050
|
key: 0,
|
|
4042
4051
|
class: "tile-container slottable-tile"
|
|
4043
|
-
}, Ji = /* @__PURE__ */
|
|
4052
|
+
}, Ji = /* @__PURE__ */ G({
|
|
4044
4053
|
__name: "DashboardRenderer",
|
|
4045
|
-
props: /* @__PURE__ */
|
|
4054
|
+
props: /* @__PURE__ */ tt({
|
|
4046
4055
|
context: {}
|
|
4047
4056
|
}, {
|
|
4048
4057
|
modelValue: { required: !0 },
|
|
4049
4058
|
modelModifiers: {}
|
|
4050
4059
|
}),
|
|
4051
|
-
emits: /* @__PURE__ */
|
|
4060
|
+
emits: /* @__PURE__ */ tt(["edit-tile", "zoom-time-range"], ["update:modelValue"]),
|
|
4052
4061
|
setup(u, { expose: e, emit: t }) {
|
|
4053
|
-
const i = u, s = t, r =
|
|
4054
|
-
|
|
4055
|
-
const
|
|
4062
|
+
const i = u, s = t, r = Bt(u, "modelValue"), { i18n: o } = ge.useI18n(), n = $(0), d = $(null), h = me(oe);
|
|
4063
|
+
h || (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")), ge.useRequestQueue();
|
|
4064
|
+
const a = Et(), l = A(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4056
4065
|
type: "relative",
|
|
4057
|
-
time_range:
|
|
4058
|
-
}), f =
|
|
4059
|
-
const
|
|
4060
|
-
return
|
|
4061
|
-
},
|
|
4062
|
-
var
|
|
4063
|
-
let
|
|
4064
|
-
if ("description" in
|
|
4065
|
-
const
|
|
4066
|
-
const w = `renderer.trendRange.${
|
|
4066
|
+
time_range: a.defaultQueryTimeForOrg
|
|
4067
|
+
}), f = A(() => !!i.context.timeSpec || !a.loading), m = (x, E) => {
|
|
4068
|
+
const D = x.layout.position.row - E.layout.position.row;
|
|
4069
|
+
return D !== 0 ? D : x.layout.position.col - E.layout.position.col;
|
|
4070
|
+
}, p = A(() => r.value.tiles.map((x, E) => {
|
|
4071
|
+
var B;
|
|
4072
|
+
let D = x.definition;
|
|
4073
|
+
if ("description" in D.chart) {
|
|
4074
|
+
const I = (B = D.chart.description) == null ? void 0 : B.replace(ui, () => {
|
|
4075
|
+
const w = `renderer.trendRange.${l.value.type === "absolute" ? "custom" : l.value.time_range}`;
|
|
4067
4076
|
return o.te(w) ? o.t(w) : "";
|
|
4068
4077
|
});
|
|
4069
|
-
|
|
4070
|
-
...
|
|
4078
|
+
D = {
|
|
4079
|
+
...D,
|
|
4071
4080
|
chart: {
|
|
4072
|
-
...
|
|
4073
|
-
description:
|
|
4081
|
+
...D.chart,
|
|
4082
|
+
description: I
|
|
4074
4083
|
}
|
|
4075
4084
|
};
|
|
4076
4085
|
}
|
|
4077
|
-
return i.context.editable && !
|
|
4086
|
+
return i.context.editable && !x.id && console.warn(
|
|
4078
4087
|
"No id provided for tile. One will be generated automatically,",
|
|
4079
4088
|
"however tracking changes to this tile may not work as expected.",
|
|
4080
|
-
|
|
4089
|
+
x
|
|
4081
4090
|
), {
|
|
4082
|
-
layout:
|
|
4083
|
-
meta:
|
|
4091
|
+
layout: x.layout,
|
|
4092
|
+
meta: D,
|
|
4084
4093
|
// Add a unique key to each tile internally.
|
|
4085
|
-
id:
|
|
4094
|
+
id: x.id ?? crypto.randomUUID()
|
|
4086
4095
|
};
|
|
4087
|
-
})), y =
|
|
4088
|
-
let { tz:
|
|
4089
|
-
return
|
|
4096
|
+
})), y = A(() => {
|
|
4097
|
+
let { tz: x, refreshInterval: E, editable: D } = i.context;
|
|
4098
|
+
return x || (x = new Intl.DateTimeFormat().resolvedOptions().timeZone), E === void 0 && (E = ci), D === void 0 && (D = !1), {
|
|
4090
4099
|
...i.context,
|
|
4091
|
-
tz:
|
|
4092
|
-
timeSpec:
|
|
4093
|
-
refreshInterval:
|
|
4094
|
-
editable:
|
|
4100
|
+
tz: x,
|
|
4101
|
+
timeSpec: l.value,
|
|
4102
|
+
refreshInterval: E,
|
|
4103
|
+
editable: D
|
|
4095
4104
|
};
|
|
4096
|
-
}), g = (
|
|
4097
|
-
s("edit-tile",
|
|
4098
|
-
}, R = (
|
|
4099
|
-
|
|
4105
|
+
}), g = (x) => {
|
|
4106
|
+
s("edit-tile", x);
|
|
4107
|
+
}, R = (x) => {
|
|
4108
|
+
d.value && d.value.removeWidget(x.id);
|
|
4100
4109
|
}, S = () => {
|
|
4101
4110
|
n.value++;
|
|
4102
|
-
}, C = (
|
|
4103
|
-
const
|
|
4104
|
-
id:
|
|
4105
|
-
layout:
|
|
4106
|
-
definition:
|
|
4111
|
+
}, C = (x) => {
|
|
4112
|
+
const E = x.map((D) => ({
|
|
4113
|
+
id: D.id,
|
|
4114
|
+
layout: D.layout,
|
|
4115
|
+
definition: D.meta
|
|
4107
4116
|
}));
|
|
4108
|
-
r.value.gridSize.rows = Math.max(1, ...
|
|
4117
|
+
r.value.gridSize.rows = Math.max(1, ...E.map((D) => D.layout.position.row + D.layout.size.rows)), r.value.tiles = E.sort(m);
|
|
4109
4118
|
};
|
|
4110
|
-
return e({ refresh: S }), (
|
|
4111
|
-
const
|
|
4112
|
-
return
|
|
4113
|
-
k(
|
|
4119
|
+
return e({ refresh: S }), (x, E) => {
|
|
4120
|
+
const D = ne("KAlert");
|
|
4121
|
+
return z(), F("div", Qi, [
|
|
4122
|
+
k(h) ? (z(), H(vt(x.context.editable ? ji : Fi), {
|
|
4114
4123
|
key: 1,
|
|
4115
4124
|
ref_key: "gridLayoutRef",
|
|
4116
|
-
ref:
|
|
4125
|
+
ref: d,
|
|
4117
4126
|
"grid-size": r.value.gridSize,
|
|
4118
4127
|
"tile-height": r.value.tileHeight,
|
|
4119
|
-
tiles:
|
|
4128
|
+
tiles: p.value,
|
|
4120
4129
|
onUpdateTiles: C
|
|
4121
4130
|
}, {
|
|
4122
|
-
tile: M(({ tile:
|
|
4123
|
-
|
|
4124
|
-
Le(
|
|
4125
|
-
])) : (
|
|
4131
|
+
tile: M(({ tile: B }) => [
|
|
4132
|
+
B.meta.chart.type === "slottable" ? (z(), F("div", Zi, [
|
|
4133
|
+
Le(x.$slots, B.meta.chart.id, {}, void 0, !0)
|
|
4134
|
+
])) : (z(), H(qi, {
|
|
4126
4135
|
key: 1,
|
|
4127
4136
|
class: "tile-container",
|
|
4128
4137
|
context: y.value,
|
|
4129
|
-
definition:
|
|
4130
|
-
height:
|
|
4138
|
+
definition: B.meta,
|
|
4139
|
+
height: B.layout.size.rows * (r.value.tileHeight || k(Ve)) + parseInt(k(At), 10),
|
|
4131
4140
|
"query-ready": f.value,
|
|
4132
4141
|
"refresh-counter": n.value,
|
|
4133
|
-
"tile-id":
|
|
4134
|
-
onEditTile: (
|
|
4135
|
-
onRemoveTile: (
|
|
4142
|
+
"tile-id": B.id,
|
|
4143
|
+
onEditTile: (I) => g(B),
|
|
4144
|
+
onRemoveTile: (I) => R(B),
|
|
4145
|
+
onZoomTimeRange: E[0] || (E[0] = (I) => s("zoom-time-range", I))
|
|
4136
4146
|
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onEditTile", "onRemoveTile"]))
|
|
4137
4147
|
]),
|
|
4138
4148
|
_: 3
|
|
4139
|
-
}, 40, ["grid-size", "tile-height", "tiles"])) : (
|
|
4149
|
+
}, 40, ["grid-size", "tile-height", "tiles"])) : (z(), H(D, {
|
|
4140
4150
|
key: 0,
|
|
4141
4151
|
appearance: "danger"
|
|
4142
4152
|
}, {
|
|
4143
4153
|
default: M(() => [
|
|
4144
|
-
|
|
4154
|
+
ve(te(k(o).t("renderer.noQueryBridge")), 1)
|
|
4145
4155
|
]),
|
|
4146
4156
|
_: 1
|
|
4147
4157
|
}))
|
|
4148
4158
|
]);
|
|
4149
4159
|
};
|
|
4150
4160
|
}
|
|
4151
|
-
}), ds = /* @__PURE__ */ ae(Ji, [["__scopeId", "data-v-
|
|
4161
|
+
}), ds = /* @__PURE__ */ ae(Ji, [["__scopeId", "data-v-d96885ca"]]);
|
|
4152
4162
|
export {
|
|
4153
|
-
|
|
4163
|
+
di as CP_ID_TOKEN,
|
|
4154
4164
|
Ve as DEFAULT_TILE_HEIGHT,
|
|
4155
|
-
|
|
4165
|
+
ci as DEFAULT_TILE_REFRESH_INTERVAL_MS,
|
|
4156
4166
|
ds as DashboardRenderer,
|
|
4157
|
-
|
|
4158
|
-
|
|
4167
|
+
st as ENTITY_ID_TOKEN,
|
|
4168
|
+
Fi as GridLayout,
|
|
4159
4169
|
oe as INJECT_QUERY_PROVIDER,
|
|
4160
|
-
|
|
4170
|
+
ui as TIMEFRAME_TOKEN
|
|
4161
4171
|
};
|