@kong-ui-public/dashboard-renderer 6.3.3 → 6.3.4
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.
|
@@ -13,7 +13,7 @@ var _e = (u, e, t, i) => ({
|
|
|
13
13
|
return _(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as U, watchEffect as _t, inject as ye, provide as Gt, defineComponent as K, onUnmounted as Ve, computed as A, watch as Ke, resolveComponent as ae, createBlock as O, renderSlot as Ie, createCommentVNode as Y, unref as D, openBlock as R, withCtx as I, createTextVNode as Pe, toDisplayString as
|
|
16
|
+
import { ref as U, watchEffect as _t, inject as ye, provide as Gt, defineComponent as K, onUnmounted as Ve, computed as A, watch as Ke, resolveComponent as ae, createBlock as O, renderSlot as Ie, createCommentVNode as Y, unref as D, openBlock as R, withCtx as I, createTextVNode as Pe, toDisplayString as ee, useCssVars as Ye, createElementVNode as ne, normalizeClass as Xe, createVNode as se, mergeProps as wt, createSlots as je, createElementBlock as F, normalizeProps as Ut, guardReactiveProps as Ft, defineAsyncComponent as Wt, onMounted as Qe, nextTick as bt, resolveDynamicComponent as Et, Fragment as xt, renderList as Ct, normalizeStyle as nt, mergeModels as ot, useModel as Vt, getCurrentInstance as Kt } from "vue";
|
|
17
17
|
import { stripUnknownFilters as Yt, Timeframe as Xt, TimePeriods as Rt, TIMEFRAME_LOOKUP as jt, formatTime as at, msToGranularity as Ue } from "@kong-ui-public/analytics-utilities";
|
|
18
18
|
import { SimpleChart as Qt, AnalyticsChart as Zt, TopNTable as Jt, CsvExportModal as ei } from "@kong-ui-public/analytics-chart";
|
|
19
19
|
import ti from "swrv";
|
|
@@ -133,8 +133,8 @@ var St = { exports: {} };
|
|
|
133
133
|
function r(d, h, l, a, f) {
|
|
134
134
|
if (typeof l != "function")
|
|
135
135
|
throw new TypeError("The listener must be a function");
|
|
136
|
-
var
|
|
137
|
-
return d._events[
|
|
136
|
+
var p = new s(l, a || d, f), m = t ? t + h : h;
|
|
137
|
+
return d._events[m] ? d._events[m].fn ? d._events[m] = [d._events[m], p] : d._events[m].push(p) : (d._events[m] = p, d._eventsCount++), d;
|
|
138
138
|
}
|
|
139
139
|
function o(d, h) {
|
|
140
140
|
--d._eventsCount === 0 ? d._events = new i() : delete d._events[h];
|
|
@@ -152,13 +152,13 @@ var St = { exports: {} };
|
|
|
152
152
|
var l = t ? t + h : h, a = this._events[l];
|
|
153
153
|
if (!a) return [];
|
|
154
154
|
if (a.fn) return [a.fn];
|
|
155
|
-
for (var f = 0,
|
|
156
|
-
|
|
157
|
-
return
|
|
155
|
+
for (var f = 0, p = a.length, m = new Array(p); f < p; f++)
|
|
156
|
+
m[f] = a[f].fn;
|
|
157
|
+
return m;
|
|
158
158
|
}, n.prototype.listenerCount = function(h) {
|
|
159
159
|
var l = t ? t + h : h, a = this._events[l];
|
|
160
160
|
return a ? a.fn ? 1 : a.length : 0;
|
|
161
|
-
}, n.prototype.emit = function(h, l, a, f,
|
|
161
|
+
}, n.prototype.emit = function(h, l, a, f, p, m) {
|
|
162
162
|
var y = t ? t + h : h;
|
|
163
163
|
if (!this._events[y]) return !1;
|
|
164
164
|
var g = this._events[y], T = arguments.length, k, x;
|
|
@@ -173,9 +173,9 @@ var St = { exports: {} };
|
|
|
173
173
|
case 4:
|
|
174
174
|
return g.fn.call(g.context, l, a, f), !0;
|
|
175
175
|
case 5:
|
|
176
|
-
return g.fn.call(g.context, l, a, f,
|
|
176
|
+
return g.fn.call(g.context, l, a, f, p), !0;
|
|
177
177
|
case 6:
|
|
178
|
-
return g.fn.call(g.context, l, a, f,
|
|
178
|
+
return g.fn.call(g.context, l, a, f, p, m), !0;
|
|
179
179
|
}
|
|
180
180
|
for (x = 1, k = new Array(T - 1); x < T; x++)
|
|
181
181
|
k[x - 1] = arguments[x];
|
|
@@ -208,17 +208,17 @@ var St = { exports: {} };
|
|
|
208
208
|
}, n.prototype.once = function(h, l, a) {
|
|
209
209
|
return r(this, h, l, a, !0);
|
|
210
210
|
}, n.prototype.removeListener = function(h, l, a, f) {
|
|
211
|
-
var
|
|
212
|
-
if (!this._events[
|
|
211
|
+
var p = t ? t + h : h;
|
|
212
|
+
if (!this._events[p]) return this;
|
|
213
213
|
if (!l)
|
|
214
|
-
return o(this,
|
|
215
|
-
var
|
|
216
|
-
if (
|
|
217
|
-
|
|
214
|
+
return o(this, p), this;
|
|
215
|
+
var m = this._events[p];
|
|
216
|
+
if (m.fn)
|
|
217
|
+
m.fn === l && (!f || m.once) && (!a || m.context === a) && o(this, p);
|
|
218
218
|
else {
|
|
219
|
-
for (var y = 0, g = [], T =
|
|
220
|
-
(
|
|
221
|
-
g.length ? this._events[
|
|
219
|
+
for (var y = 0, g = [], T = m.length; y < T; y++)
|
|
220
|
+
(m[y].fn !== l || f && !m[y].once || a && m[y].context !== a) && g.push(m[y]);
|
|
221
|
+
g.length ? this._events[p] = g.length === 1 ? g[0] : g : o(this, p);
|
|
222
222
|
}
|
|
223
223
|
return this;
|
|
224
224
|
}, n.prototype.removeAllListeners = function(h) {
|
|
@@ -254,10 +254,10 @@ function zi(u, e) {
|
|
|
254
254
|
if (typeof t != "number" || Math.sign(t) !== 1)
|
|
255
255
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);
|
|
256
256
|
if (e.signal) {
|
|
257
|
-
const { signal:
|
|
258
|
-
|
|
259
|
-
a(dt(
|
|
260
|
-
},
|
|
257
|
+
const { signal: p } = e;
|
|
258
|
+
p.aborted && a(dt(p)), n = () => {
|
|
259
|
+
a(dt(p));
|
|
260
|
+
}, p.addEventListener("abort", n, { once: !0 });
|
|
261
261
|
}
|
|
262
262
|
if (t === Number.POSITIVE_INFINITY) {
|
|
263
263
|
u.then(l, a);
|
|
@@ -268,8 +268,8 @@ function zi(u, e) {
|
|
|
268
268
|
if (i) {
|
|
269
269
|
try {
|
|
270
270
|
l(i());
|
|
271
|
-
} catch (
|
|
272
|
-
a(
|
|
271
|
+
} catch (p) {
|
|
272
|
+
a(p);
|
|
273
273
|
}
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
@@ -277,8 +277,8 @@ function zi(u, e) {
|
|
|
277
277
|
}, t), (async () => {
|
|
278
278
|
try {
|
|
279
279
|
l(await u);
|
|
280
|
-
} catch (
|
|
281
|
-
a(
|
|
280
|
+
} catch (p) {
|
|
281
|
+
a(p);
|
|
282
282
|
}
|
|
283
283
|
})();
|
|
284
284
|
}).finally(() => {
|
|
@@ -651,17 +651,17 @@ const Ni = () => {
|
|
|
651
651
|
time_range: S,
|
|
652
652
|
filters: N
|
|
653
653
|
}
|
|
654
|
-
};
|
|
655
|
-
return
|
|
654
|
+
}, Z = await (r == null ? void 0 : r.queryFn(q, n));
|
|
655
|
+
return m.value = null, Z;
|
|
656
656
|
} catch (C) {
|
|
657
|
-
throw (C == null ? void 0 : C.status) === 403 ?
|
|
657
|
+
throw (C == null ? void 0 : C.status) === 403 ? m.value = s.t("queryDataProvider.forbidden") : (C == null ? void 0 : C.status) === 408 ? m.value = s.t("queryDataProvider.timeout") : ((k = (T = C == null ? void 0 : C.response) == null ? void 0 : T.data) == null ? void 0 : k.message) === "Range not allowed for this tier" ? m.value = s.t("queryDataProvider.timeRangeExceeded") : m.value = ((L = (x = C == null ? void 0 : C.response) == null ? void 0 : x.data) == null ? void 0 : L.message) || (C == null ? void 0 : C.message), C;
|
|
658
658
|
} finally {
|
|
659
659
|
i("queryComplete");
|
|
660
660
|
}
|
|
661
661
|
}, {
|
|
662
662
|
refreshInterval: t.context.refreshInterval,
|
|
663
663
|
revalidateOnFocus: !1
|
|
664
|
-
}), { state: f, swrvState:
|
|
664
|
+
}), { state: f, swrvState: p } = di(h, l, a), m = U(null), y = A(() => f.value === p.ERROR || !!m.value), g = A(() => !t.queryReady || f.value === p.PENDING);
|
|
665
665
|
return Ke(h, (T) => {
|
|
666
666
|
T && i("chart-data", T);
|
|
667
667
|
}), (T, k) => {
|
|
@@ -677,7 +677,7 @@ const Ni = () => {
|
|
|
677
677
|
"icon-variant": "error"
|
|
678
678
|
}, {
|
|
679
679
|
default: I(() => [
|
|
680
|
-
Pe(
|
|
680
|
+
Pe(ee(m.value), 1)
|
|
681
681
|
]),
|
|
682
682
|
_: 1
|
|
683
683
|
})) : D(h) ? Ie(T.$slots, "default", {
|
|
@@ -711,7 +711,7 @@ const Ni = () => {
|
|
|
711
711
|
ne("div", {
|
|
712
712
|
class: Xe(["analytics-chart", { "single-value": t.value }])
|
|
713
713
|
}, [
|
|
714
|
-
|
|
714
|
+
se(D(Qt), {
|
|
715
715
|
"chart-data": r,
|
|
716
716
|
"chart-options": i.chartOptions,
|
|
717
717
|
"synthetics-data-key": t.value ? void 0 : i.chartOptions.synthetics_data_key
|
|
@@ -750,7 +750,7 @@ const Ni = () => {
|
|
|
750
750
|
i("chart-data", a);
|
|
751
751
|
};
|
|
752
752
|
return (a, f) => {
|
|
753
|
-
const
|
|
753
|
+
const p = ae("KDropdownItem");
|
|
754
754
|
return R(), O(Ze, {
|
|
755
755
|
context: a.context,
|
|
756
756
|
query: a.query,
|
|
@@ -758,11 +758,11 @@ const Ni = () => {
|
|
|
758
758
|
"refresh-counter": a.refreshCounter,
|
|
759
759
|
onChartData: l
|
|
760
760
|
}, {
|
|
761
|
-
default: I(({ data:
|
|
761
|
+
default: I(({ data: m }) => [
|
|
762
762
|
ne("div", Hi, [
|
|
763
|
-
|
|
763
|
+
se(D(Zt), wt({
|
|
764
764
|
"allow-csv-export": a.chartOptions.allow_csv_export,
|
|
765
|
-
"chart-data":
|
|
765
|
+
"chart-data": m,
|
|
766
766
|
"chart-options": n.value,
|
|
767
767
|
"legend-position": "bottom",
|
|
768
768
|
"show-menu": a.context.editable,
|
|
@@ -775,9 +775,9 @@ const Ni = () => {
|
|
|
775
775
|
a.context.editable ? {
|
|
776
776
|
name: "menu-items",
|
|
777
777
|
fn: I(() => [
|
|
778
|
-
|
|
778
|
+
se(p, { onClick: h }, {
|
|
779
779
|
default: I(() => [
|
|
780
|
-
Pe(
|
|
780
|
+
Pe(ee(D(s).t("renderer.edit")), 1)
|
|
781
781
|
]),
|
|
782
782
|
_: 1
|
|
783
783
|
})
|
|
@@ -884,9 +884,9 @@ const Ni = () => {
|
|
|
884
884
|
};
|
|
885
885
|
});
|
|
886
886
|
return (s, r) => (R(), F("div", Li, [
|
|
887
|
-
|
|
887
|
+
se(D(ri), Ut(Ft(i.value)), {
|
|
888
888
|
default: I(() => [
|
|
889
|
-
|
|
889
|
+
se(D(ni))
|
|
890
890
|
]),
|
|
891
891
|
_: 1
|
|
892
892
|
}, 16)
|
|
@@ -901,7 +901,7 @@ const Ni = () => {
|
|
|
901
901
|
entityLinkData: {}
|
|
902
902
|
},
|
|
903
903
|
setup(u) {
|
|
904
|
-
return (e, t) => (R(), F("div", qi,
|
|
904
|
+
return (e, t) => (R(), F("div", qi, ee(e.entityLinkData.label), 1));
|
|
905
905
|
}
|
|
906
906
|
}), Bi = /* @__PURE__ */ K({
|
|
907
907
|
__name: "TopNTableRenderer",
|
|
@@ -939,14 +939,14 @@ const Ni = () => {
|
|
|
939
939
|
"refresh-counter": r.refreshCounter
|
|
940
940
|
}, {
|
|
941
941
|
default: I(({ data: n }) => [
|
|
942
|
-
|
|
942
|
+
se(D(Jt), {
|
|
943
943
|
data: n,
|
|
944
944
|
"synthetics-data-key": r.chartOptions.synthetics_data_key
|
|
945
945
|
}, je({ _: 2 }, [
|
|
946
946
|
e.chartOptions.entity_link ? {
|
|
947
947
|
name: "name",
|
|
948
948
|
fn: I(({ record: d }) => [
|
|
949
|
-
|
|
949
|
+
se(D(i), {
|
|
950
950
|
"entity-link-data": {
|
|
951
951
|
id: d.id,
|
|
952
952
|
label: d.name,
|
|
@@ -1018,7 +1018,7 @@ const Ni = () => {
|
|
|
1018
1018
|
granularity: i.definition.query.granularity || L.value
|
|
1019
1019
|
}, $e = ["api_usage", "llm_usage"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "api_usage";
|
|
1020
1020
|
return `${a.value}?q=${JSON.stringify(B)}&d=${$e}&c=${i.definition.chart.type}`;
|
|
1021
|
-
}),
|
|
1021
|
+
}), p = A(() => o.t("csvExport.defaultFilename")), m = A(() => y.value && (g.value || i.context.editable) || !!x.value), y = A(() => !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), g = A(() => !!f.value || "allow_csv_export" in i.definition.chart && i.definition.chart.allow_csv_export || i.context.editable), T = {
|
|
1022
1022
|
timeseries_line: ft,
|
|
1023
1023
|
timeseries_bar: ft,
|
|
1024
1024
|
horizontal_bar: ct,
|
|
@@ -1068,7 +1068,7 @@ const Ni = () => {
|
|
|
1068
1068
|
s("edit-tile", i.definition);
|
|
1069
1069
|
}, q = () => {
|
|
1070
1070
|
s("duplicate-tile", i.definition);
|
|
1071
|
-
},
|
|
1071
|
+
}, Z = () => {
|
|
1072
1072
|
s("remove-tile", i.definition);
|
|
1073
1073
|
}, le = (v) => {
|
|
1074
1074
|
n.value = v;
|
|
@@ -1084,7 +1084,7 @@ const Ni = () => {
|
|
|
1084
1084
|
"data-testid": `tile-${v.tileId}`
|
|
1085
1085
|
}, [
|
|
1086
1086
|
v.definition.chart.type !== "slottable" ? (R(), F("div", Ui, [
|
|
1087
|
-
|
|
1087
|
+
se(B, {
|
|
1088
1088
|
class: "title-tooltip",
|
|
1089
1089
|
disabled: !l.value,
|
|
1090
1090
|
"max-width": "500",
|
|
@@ -1095,11 +1095,11 @@ const Ni = () => {
|
|
|
1095
1095
|
ref_key: "titleRef",
|
|
1096
1096
|
ref: h,
|
|
1097
1097
|
class: "title"
|
|
1098
|
-
},
|
|
1098
|
+
}, ee(v.definition.chart.chart_title), 513)
|
|
1099
1099
|
]),
|
|
1100
1100
|
_: 1
|
|
1101
1101
|
}, 8, ["disabled", "text"]),
|
|
1102
|
-
|
|
1102
|
+
m.value ? (R(), F("div", {
|
|
1103
1103
|
key: 0,
|
|
1104
1104
|
class: "tile-actions",
|
|
1105
1105
|
"data-testid": `tile-actions-${v.tileId}`
|
|
@@ -1111,14 +1111,14 @@ const Ni = () => {
|
|
|
1111
1111
|
"tooltip-attributes": { maxWidth: "320px" }
|
|
1112
1112
|
}, je({
|
|
1113
1113
|
default: I(() => [
|
|
1114
|
-
ne("span", Wi,
|
|
1114
|
+
ne("span", Wi, ee(x.value), 1)
|
|
1115
1115
|
]),
|
|
1116
1116
|
_: 2
|
|
1117
1117
|
}, [
|
|
1118
1118
|
E.value ? {
|
|
1119
1119
|
name: "icon",
|
|
1120
1120
|
fn: I(() => [
|
|
1121
|
-
|
|
1121
|
+
se(D(oi), { size: D(Pi) }, null, 8, ["size"])
|
|
1122
1122
|
]),
|
|
1123
1123
|
key: "0"
|
|
1124
1124
|
} : void 0
|
|
@@ -1153,7 +1153,7 @@ const Ni = () => {
|
|
|
1153
1153
|
ne("span", {
|
|
1154
1154
|
class: "chart-export-trigger",
|
|
1155
1155
|
"data-testid": `csv-export-button-${v.tileId}`
|
|
1156
|
-
},
|
|
1156
|
+
}, ee(D(o).t("csvExport.exportAsCsv")), 9, Vi)
|
|
1157
1157
|
]),
|
|
1158
1158
|
_: 1
|
|
1159
1159
|
}, 8, ["data-testid"])) : Y("", !0),
|
|
@@ -1163,23 +1163,23 @@ const Ni = () => {
|
|
|
1163
1163
|
onClick: q
|
|
1164
1164
|
}, {
|
|
1165
1165
|
default: I(() => [
|
|
1166
|
-
Pe(
|
|
1166
|
+
Pe(ee(D(o).t("renderer.duplicateTile")), 1)
|
|
1167
1167
|
]),
|
|
1168
1168
|
_: 1
|
|
1169
1169
|
}, 8, ["data-testid"])) : Y("", !0),
|
|
1170
1170
|
v.context.editable ? (R(), O(ze, {
|
|
1171
1171
|
key: 3,
|
|
1172
1172
|
"data-testid": `remove-tile-${v.tileId}`,
|
|
1173
|
-
onClick:
|
|
1173
|
+
onClick: Z
|
|
1174
1174
|
}, {
|
|
1175
1175
|
default: I(() => [
|
|
1176
|
-
ne("span", Ki,
|
|
1176
|
+
ne("span", Ki, ee(D(o).t("renderer.delete")), 1)
|
|
1177
1177
|
]),
|
|
1178
1178
|
_: 1
|
|
1179
1179
|
}, 8, ["data-testid"])) : Y("", !0)
|
|
1180
1180
|
]),
|
|
1181
1181
|
default: I(() => [
|
|
1182
|
-
|
|
1182
|
+
se(D(li), {
|
|
1183
1183
|
class: "kebab-action-menu",
|
|
1184
1184
|
color: D(gt),
|
|
1185
1185
|
"data-testid": `kebab-action-menu-${v.tileId}`,
|
|
@@ -1192,12 +1192,12 @@ const Ni = () => {
|
|
|
1192
1192
|
key: 1,
|
|
1193
1193
|
class: "header-description",
|
|
1194
1194
|
"data-testid": `tile-description-${v.tileId}`
|
|
1195
|
-
},
|
|
1195
|
+
}, ee(v.definition.chart.description), 9, Yi)) : Y("", !0),
|
|
1196
1196
|
d.value ? (R(), O(D(ei), {
|
|
1197
1197
|
key: 2,
|
|
1198
1198
|
"chart-data": n.value,
|
|
1199
1199
|
"data-testid": `csv-export-modal-${v.tileId}`,
|
|
1200
|
-
filename:
|
|
1200
|
+
filename: p.value,
|
|
1201
1201
|
onToggleModal: ve
|
|
1202
1202
|
}, null, 8, ["chart-data", "data-testid", "filename"])) : Y("", !0)
|
|
1203
1203
|
])) : Y("", !0),
|
|
@@ -1644,7 +1644,7 @@ class c {
|
|
|
1644
1644
|
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);
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
|
-
class
|
|
1647
|
+
class te {
|
|
1648
1648
|
constructor(e = {}) {
|
|
1649
1649
|
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;
|
|
1650
1650
|
}
|
|
@@ -1822,7 +1822,7 @@ class ee {
|
|
|
1822
1822
|
* @param resizing if out of bound, resize down or move into the grid to fit ?
|
|
1823
1823
|
*/
|
|
1824
1824
|
prepareNode(e, t) {
|
|
1825
|
-
e._id = e._id ??
|
|
1825
|
+
e._id = e._id ?? te._idSeq++;
|
|
1826
1826
|
const i = e.id;
|
|
1827
1827
|
if (i) {
|
|
1828
1828
|
let r = 1;
|
|
@@ -1917,7 +1917,7 @@ class ee {
|
|
|
1917
1917
|
if (t.pack = !0, !this.maxRow)
|
|
1918
1918
|
return this.moveNode(e, t);
|
|
1919
1919
|
let i;
|
|
1920
|
-
const s = new
|
|
1920
|
+
const s = new te({
|
|
1921
1921
|
column: this.column,
|
|
1922
1922
|
float: this.float,
|
|
1923
1923
|
nodes: this.nodes.map((o) => o._id === e._id ? (i = { ...o }, i) : { ...o })
|
|
@@ -1939,7 +1939,7 @@ class ee {
|
|
|
1939
1939
|
willItFit(e) {
|
|
1940
1940
|
if (delete e._willFitPos, !this.maxRow)
|
|
1941
1941
|
return !0;
|
|
1942
|
-
const t = new
|
|
1942
|
+
const t = new te({
|
|
1943
1943
|
column: this.column,
|
|
1944
1944
|
float: this.float,
|
|
1945
1945
|
nodes: this.nodes.map((s) => ({ ...s }))
|
|
@@ -1967,8 +1967,8 @@ class ee {
|
|
|
1967
1967
|
const a = e._moving && !t.nested;
|
|
1968
1968
|
let f = a ? this.directionCollideCoverage(e, t, n) : n[0];
|
|
1969
1969
|
if (a && f && ((l = (h = e.grid) == null ? void 0 : h.opts) != null && l.subGridDynamic) && !e.grid._isTemp) {
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1970
|
+
const p = c.areaIntercept(t.rect, f._rect), m = c.area(t.rect), y = c.area(f._rect);
|
|
1971
|
+
p / (m < y ? m : y) > 0.8 && (f.grid.makeSubGrid(f.el, void 0, e), f = void 0);
|
|
1972
1972
|
}
|
|
1973
1973
|
f ? d = !this._fixCollisions(e, r, f, t) : (d = !1, i && delete t.pack);
|
|
1974
1974
|
}
|
|
@@ -2075,7 +2075,7 @@ class ee {
|
|
|
2075
2075
|
return e.forEach((r, o) => {
|
|
2076
2076
|
if (r._id === void 0) {
|
|
2077
2077
|
const n = r.id ? this.nodes.find((d) => d.id === r.id) : void 0;
|
|
2078
|
-
r._id = (n == null ? void 0 : n._id) ??
|
|
2078
|
+
r._id = (n == null ? void 0 : n._id) ?? te._idSeq++;
|
|
2079
2079
|
}
|
|
2080
2080
|
s[o] = { x: r.x, y: r.y, w: r.w, _id: r._id };
|
|
2081
2081
|
}), this._layouts = i ? [] : this._layouts || [], this._layouts[t] = s, this;
|
|
@@ -2086,7 +2086,7 @@ class ee {
|
|
|
2086
2086
|
* @param column corresponding column index to save it under
|
|
2087
2087
|
*/
|
|
2088
2088
|
cacheOneLayout(e, t) {
|
|
2089
|
-
e._id = e._id ??
|
|
2089
|
+
e._id = e._id ?? te._idSeq++;
|
|
2090
2090
|
const i = { x: e.x, y: e.y, w: e.w, _id: e._id };
|
|
2091
2091
|
(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] || [];
|
|
2092
2092
|
const s = this.findCacheLayout(e, t);
|
|
@@ -2110,7 +2110,7 @@ class ee {
|
|
|
2110
2110
|
return this;
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
|
-
|
|
2113
|
+
te._idSeq = 0;
|
|
2114
2114
|
const V = {
|
|
2115
2115
|
alwaysShowResizeHandle: "mobile",
|
|
2116
2116
|
animate: !0,
|
|
@@ -2143,8 +2143,8 @@ const V = {
|
|
|
2143
2143
|
};
|
|
2144
2144
|
class b {
|
|
2145
2145
|
}
|
|
2146
|
-
const
|
|
2147
|
-
class
|
|
2146
|
+
const J = typeof window < "u" && typeof document < "u" && ("ontouchstart" in document || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
|
|
2147
|
+
class ie {
|
|
2148
2148
|
}
|
|
2149
2149
|
function Ne(u, e) {
|
|
2150
2150
|
if (u.touches.length > 1)
|
|
@@ -2221,17 +2221,17 @@ function Pt(u, e) {
|
|
|
2221
2221
|
), u.target.dispatchEvent(t);
|
|
2222
2222
|
}
|
|
2223
2223
|
function Ae(u) {
|
|
2224
|
-
|
|
2224
|
+
ie.touchHandled || (ie.touchHandled = !0, Ne(u, "mousedown"));
|
|
2225
2225
|
}
|
|
2226
2226
|
function He(u) {
|
|
2227
|
-
|
|
2227
|
+
ie.touchHandled && Ne(u, "mousemove");
|
|
2228
2228
|
}
|
|
2229
2229
|
function Oe(u) {
|
|
2230
|
-
if (!
|
|
2230
|
+
if (!ie.touchHandled)
|
|
2231
2231
|
return;
|
|
2232
|
-
|
|
2232
|
+
ie.pointerLeaveTimeout && (window.clearTimeout(ie.pointerLeaveTimeout), delete ie.pointerLeaveTimeout);
|
|
2233
2233
|
const e = !!b.dragElement;
|
|
2234
|
-
Ne(u, "mouseup"), e || Ne(u, "click"),
|
|
2234
|
+
Ne(u, "mouseup"), e || Ne(u, "click"), ie.touchHandled = !1;
|
|
2235
2235
|
}
|
|
2236
2236
|
function Le(u) {
|
|
2237
2237
|
u.pointerType !== "mouse" && u.target.releasePointerCapture(u.pointerId);
|
|
@@ -2240,8 +2240,8 @@ function yt(u) {
|
|
|
2240
2240
|
b.dragElement && u.pointerType !== "mouse" && Pt(u, "mouseenter");
|
|
2241
2241
|
}
|
|
2242
2242
|
function vt(u) {
|
|
2243
|
-
b.dragElement && u.pointerType !== "mouse" && (
|
|
2244
|
-
delete
|
|
2243
|
+
b.dragElement && u.pointerType !== "mouse" && (ie.pointerLeaveTimeout = window.setTimeout(() => {
|
|
2244
|
+
delete ie.pointerLeaveTimeout, Pt(u, "mouseleave");
|
|
2245
2245
|
}, 10));
|
|
2246
2246
|
}
|
|
2247
2247
|
class Be {
|
|
@@ -2251,15 +2251,15 @@ class Be {
|
|
|
2251
2251
|
/** @internal */
|
|
2252
2252
|
_init() {
|
|
2253
2253
|
const e = this.el = document.createElement("div");
|
|
2254
|
-
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Be.prefix}${this.dir}`), e.style.zIndex = "100", e.style.userSelect = "none", this.host.appendChild(this.el), this.el.addEventListener("mousedown", this._mouseDown),
|
|
2254
|
+
return e.classList.add("ui-resizable-handle"), e.classList.add(`${Be.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", Ae), this.el.addEventListener("pointerdown", Le)), this;
|
|
2255
2255
|
}
|
|
2256
2256
|
/** call this when resize handle needs to be removed and cleaned up */
|
|
2257
2257
|
destroy() {
|
|
2258
|
-
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown),
|
|
2258
|
+
return this.moving && this._mouseUp(this.mouseDownEvent), this.el.removeEventListener("mousedown", this._mouseDown), J && (this.el.removeEventListener("touchstart", Ae), this.el.removeEventListener("pointerdown", Le)), this.host.removeChild(this.el), delete this.el, delete this.host, this;
|
|
2259
2259
|
}
|
|
2260
2260
|
/** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
|
|
2261
2261
|
_mouseDown(e) {
|
|
2262
|
-
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0),
|
|
2262
|
+
this.mouseDownEvent = e, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), J && (this.el.addEventListener("touchmove", He), this.el.addEventListener("touchend", Oe)), e.stopPropagation(), e.preventDefault();
|
|
2263
2263
|
}
|
|
2264
2264
|
/** @internal */
|
|
2265
2265
|
_mouseMove(e) {
|
|
@@ -2268,7 +2268,7 @@ class Be {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
/** @internal */
|
|
2270
2270
|
_mouseUp(e) {
|
|
2271
|
-
this.moving && (this._triggerEvent("stop", e), document.removeEventListener("keydown", this._keyEvent)), document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2271
|
+
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", He), this.el.removeEventListener("touchend", Oe)), delete this.moving, delete this.mouseDownEvent, e.stopPropagation(), e.preventDefault();
|
|
2272
2272
|
}
|
|
2273
2273
|
/** @internal call when keys are being pressed - use Esc to cancel */
|
|
2274
2274
|
_keyEvent(e) {
|
|
@@ -2480,12 +2480,12 @@ class be extends et {
|
|
|
2480
2480
|
}
|
|
2481
2481
|
enable() {
|
|
2482
2482
|
this.disabled !== !1 && (super.enable(), this.dragEls.forEach((e) => {
|
|
2483
|
-
e.addEventListener("mousedown", this._mouseDown),
|
|
2483
|
+
e.addEventListener("mousedown", this._mouseDown), J && (e.addEventListener("touchstart", Ae), e.addEventListener("pointerdown", Le));
|
|
2484
2484
|
}), this.el.classList.remove("ui-draggable-disabled"));
|
|
2485
2485
|
}
|
|
2486
2486
|
disable(e = !1) {
|
|
2487
2487
|
this.disabled !== !0 && (super.disable(), this.dragEls.forEach((t) => {
|
|
2488
|
-
t.removeEventListener("mousedown", this._mouseDown),
|
|
2488
|
+
t.removeEventListener("mousedown", this._mouseDown), J && (t.removeEventListener("touchstart", Ae), t.removeEventListener("pointerdown", Le));
|
|
2489
2489
|
}), e || this.el.classList.add("ui-draggable-disabled"));
|
|
2490
2490
|
}
|
|
2491
2491
|
destroy() {
|
|
@@ -2497,7 +2497,7 @@ class be extends et {
|
|
|
2497
2497
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
2498
2498
|
_mouseDown(e) {
|
|
2499
2499
|
if (!b.mouseHandled)
|
|
2500
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(is) || 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),
|
|
2500
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(is) || 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", He), e.currentTarget.addEventListener("touchend", Oe)), e.preventDefault(), document.activeElement && document.activeElement.blur(), b.mouseHandled = !0), !0;
|
|
2501
2501
|
}
|
|
2502
2502
|
/** @internal method to call actual drag event */
|
|
2503
2503
|
_callDrag(e) {
|
|
@@ -2528,7 +2528,7 @@ class be extends et {
|
|
|
2528
2528
|
/** @internal call when the mouse gets released to drop the item at current location */
|
|
2529
2529
|
_mouseUp(e) {
|
|
2530
2530
|
var t, i;
|
|
2531
|
-
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0),
|
|
2531
|
+
if (document.removeEventListener("mousemove", this._mouseMove, !0), document.removeEventListener("mouseup", this._mouseUp, !0), J && e.currentTarget && (e.currentTarget.removeEventListener("touchmove", He, !0), e.currentTarget.removeEventListener("touchend", Oe, !0)), this.dragging) {
|
|
2532
2532
|
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();
|
|
2533
2533
|
const s = c.initEvent(e, { target: this.el, type: "dragstop" });
|
|
2534
2534
|
this.option.stop && this.option.stop(s), this.triggerEvent("dragstop", s), b.dropElement && b.dropElement.drop(e);
|
|
@@ -2621,10 +2621,10 @@ class ss extends et {
|
|
|
2621
2621
|
super.off(e);
|
|
2622
2622
|
}
|
|
2623
2623
|
enable() {
|
|
2624
|
-
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),
|
|
2624
|
+
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", yt), this.el.addEventListener("pointerleave", vt)));
|
|
2625
2625
|
}
|
|
2626
2626
|
disable(e = !1) {
|
|
2627
|
-
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),
|
|
2627
|
+
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", yt), this.el.removeEventListener("pointerleave", vt)));
|
|
2628
2628
|
}
|
|
2629
2629
|
destroy() {
|
|
2630
2630
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2877,20 +2877,20 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2877
2877
|
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
2878
2878
|
*/
|
|
2879
2879
|
constructor(e, t = {}) {
|
|
2880
|
-
var a, f,
|
|
2880
|
+
var a, f, p;
|
|
2881
2881
|
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);
|
|
2882
2882
|
const i = c.toNumber(e.getAttribute("gs-row"));
|
|
2883
2883
|
t.column === "auto" && delete t.column, t.alwaysShowResizeHandle !== void 0 && (t._alwaysShowResizeHandle = t.alwaysShowResizeHandle);
|
|
2884
2884
|
let s = (a = t.columnOpts) == null ? void 0 : a.breakpoints;
|
|
2885
2885
|
const r = t;
|
|
2886
2886
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2887
|
-
const
|
|
2887
|
+
const m = r.oneColumnSize || 768;
|
|
2888
2888
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2889
2889
|
let y = s.find((g) => g.c === 1);
|
|
2890
|
-
y ? y.w =
|
|
2890
|
+
y ? y.w = m : (y = { c: 1, w: m }, s.push(y, { c: 12, w: m + 1 }));
|
|
2891
2891
|
}
|
|
2892
2892
|
const o = t.columnOpts;
|
|
2893
|
-
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((
|
|
2893
|
+
o && (!o.columnWidth && !((f = o.breakpoints) != null && f.length) ? (delete t.columnOpts, s = void 0) : o.columnMax = o.columnMax || 12), (s == null ? void 0 : s.length) > 1 && s.sort((m, y) => (y.w || 0) - (m.w || 0));
|
|
2894
2894
|
const n = {
|
|
2895
2895
|
...c.cloneDeep(V),
|
|
2896
2896
|
column: c.toNumber(e.getAttribute("gs-column")) || V.column,
|
|
@@ -2908,26 +2908,26 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2908
2908
|
};
|
|
2909
2909
|
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");
|
|
2910
2910
|
const d = this.el.closest("." + V.itemClass), h = d == null ? void 0 : d.gridstackNode;
|
|
2911
|
-
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 !== V.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle =
|
|
2912
|
-
const l = t.engineClass || w.engineClass ||
|
|
2911
|
+
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 !== V.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-" + te._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2912
|
+
const l = t.engineClass || w.engineClass || te;
|
|
2913
2913
|
if (this.engine = new l({
|
|
2914
2914
|
column: this.getColumn(),
|
|
2915
2915
|
float: t.float,
|
|
2916
2916
|
maxRow: t.maxRow,
|
|
2917
|
-
onChange: (
|
|
2917
|
+
onChange: (m) => {
|
|
2918
2918
|
let y = 0;
|
|
2919
2919
|
this.engine.nodes.forEach((g) => {
|
|
2920
2920
|
y = Math.max(y, g.y + g.h);
|
|
2921
|
-
}),
|
|
2921
|
+
}), m.forEach((g) => {
|
|
2922
2922
|
const T = g.el;
|
|
2923
2923
|
T && (g._removeDOM ? (T && T.remove(), delete g._removeDOM) : this._writePosAttr(T, g));
|
|
2924
2924
|
}), this._updateStyles(!1, y);
|
|
2925
2925
|
}
|
|
2926
|
-
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((
|
|
2927
|
-
const
|
|
2928
|
-
delete t.children,
|
|
2926
|
+
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((m) => this._prepareElement(m)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
2927
|
+
const m = t.children;
|
|
2928
|
+
delete t.children, m.length && this.load(m);
|
|
2929
2929
|
}
|
|
2930
|
-
this.setAnimation(), t.subGridDynamic && !b.pauseDrag && (b.pauseDrag = !0), ((
|
|
2930
|
+
this.setAnimation(), t.subGridDynamic && !b.pauseDrag && (b.pauseDrag = !0), ((p = t.draggable) == null ? void 0 : p.pause) !== void 0 && (b.pauseDrag = t.draggable.pause), this._setupRemoveDrop(), this._setupAcceptWidget(), this._updateResizeEvent();
|
|
2931
2931
|
}
|
|
2932
2932
|
/**
|
|
2933
2933
|
* add a new widget and returns it.
|
|
@@ -2967,13 +2967,13 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2967
2967
|
* @returns newly created grid
|
|
2968
2968
|
*/
|
|
2969
2969
|
makeSubGrid(e, t, i, s = !0) {
|
|
2970
|
-
var
|
|
2970
|
+
var p, m, y;
|
|
2971
2971
|
let r = e.gridstackNode;
|
|
2972
|
-
if (r || (r = this.makeWidget(e).gridstackNode), (
|
|
2972
|
+
if (r || (r = this.makeWidget(e).gridstackNode), (p = r.subGrid) != null && p.el)
|
|
2973
2973
|
return r.subGrid;
|
|
2974
2974
|
let o, n = this;
|
|
2975
2975
|
for (; n && !o; )
|
|
2976
|
-
o = (
|
|
2976
|
+
o = (m = n.opts) == null ? void 0 : m.subGridOpts, n = (y = n.parentGridNode) == null ? void 0 : y.grid;
|
|
2977
2977
|
t = c.cloneDeep({
|
|
2978
2978
|
// by default sub-grid inherit from us | parent, other than id, children, etc...
|
|
2979
2979
|
...this.opts,
|
|
@@ -3073,8 +3073,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3073
3073
|
const a = c.find(d, l.id);
|
|
3074
3074
|
if (a) {
|
|
3075
3075
|
if (c.shouldSizeToContent(a) && (l.h = a.h), this.engine.nodeBoundFix(l), (l.autoPosition || l.x === void 0 || l.y === void 0) && (l.w = l.w || a.w, l.h = l.h || a.h, this.engine.findEmptyPosition(l)), this.engine.nodes.push(a), c.samePos(a, l) && this.engine.nodes.length > 1 && (this.moveNode(a, { ...l, forceCollide: !0 }), c.copyPos(l, a)), this.update(a.el, l), (f = l.subGridOpts) != null && f.children) {
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3076
|
+
const p = a.el.querySelector(".grid-stack");
|
|
3077
|
+
p && p.gridstack && p.gridstack.load(l.subGridOpts.children);
|
|
3078
3078
|
}
|
|
3079
3079
|
} else t && this.addWidget(l);
|
|
3080
3080
|
}), delete this.engine._loading, this.engine.removedNodes = o, this.batchUpdate(!1), delete this._ignoreLayoutsNodeChange, delete this.engine.skipCacheUpdate, r ? w.addRemoveCB = r : delete w.addRemoveCB, n && ((h = this.opts) != null && h.animate) && this.setAnimation(this.opts.animate, !0), this;
|
|
@@ -3389,7 +3389,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3389
3389
|
* @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
|
|
3390
3390
|
*/
|
|
3391
3391
|
resizeToContent(e) {
|
|
3392
|
-
var f,
|
|
3392
|
+
var f, p;
|
|
3393
3393
|
if (!e || (e.classList.remove("size-to-content-max"), !e.clientHeight))
|
|
3394
3394
|
return;
|
|
3395
3395
|
const t = e.gridstackNode;
|
|
@@ -3408,18 +3408,18 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3408
3408
|
let h;
|
|
3409
3409
|
if (t.subGrid) {
|
|
3410
3410
|
h = t.subGrid.getRow() * t.subGrid.getCellHeight(!0);
|
|
3411
|
-
const
|
|
3412
|
-
h +=
|
|
3411
|
+
const m = t.subGrid.el.getBoundingClientRect(), y = t.subGrid.el.parentElement.getBoundingClientRect();
|
|
3412
|
+
h += m.top - y.top;
|
|
3413
3413
|
} else {
|
|
3414
|
-
if ((
|
|
3414
|
+
if ((p = (f = t.subGridOpts) == null ? void 0 : f.children) != null && p.length)
|
|
3415
3415
|
return;
|
|
3416
3416
|
{
|
|
3417
|
-
const
|
|
3418
|
-
if (!
|
|
3417
|
+
const m = o.firstElementChild;
|
|
3418
|
+
if (!m) {
|
|
3419
3419
|
console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${w.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
3420
3420
|
return;
|
|
3421
3421
|
}
|
|
3422
|
-
h =
|
|
3422
|
+
h = m.getBoundingClientRect().height || d;
|
|
3423
3423
|
}
|
|
3424
3424
|
}
|
|
3425
3425
|
if (d === h)
|
|
@@ -3790,8 +3790,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3790
3790
|
return;
|
|
3791
3791
|
if (!((f = n.grid) != null && f.el)) {
|
|
3792
3792
|
o.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;
|
|
3793
|
-
const
|
|
3794
|
-
o.style.left =
|
|
3793
|
+
const p = o.getBoundingClientRect();
|
|
3794
|
+
o.style.left = p.x + (this.dragTransform.xScale - 1) * (s.clientX - p.x) / this.dragTransform.xScale + "px", o.style.top = p.y + (this.dragTransform.yScale - 1) * (s.clientY - p.y) / this.dragTransform.yScale + "px", o.style.transformOrigin = "0px 0px";
|
|
3795
3795
|
}
|
|
3796
3796
|
let { top: d, left: h } = o.getBoundingClientRect();
|
|
3797
3797
|
const l = this.el.getBoundingClientRect();
|
|
@@ -3858,7 +3858,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3858
3858
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3859
3859
|
return n && (!n.grid || n.grid === this) && (this._leave(r, o), this._isTemp && this.removeAsSubGrid(n)), !1;
|
|
3860
3860
|
}).on(this.el, "drop", (s, r, o) => {
|
|
3861
|
-
var
|
|
3861
|
+
var p, m, y;
|
|
3862
3862
|
const n = (o == null ? void 0 : o.gridstackNode) || r.gridstackNode;
|
|
3863
3863
|
if ((n == null ? void 0 : n.grid) === this && !n._isExternal)
|
|
3864
3864
|
return !1;
|
|
@@ -3871,9 +3871,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3871
3871
|
const g = a.grid;
|
|
3872
3872
|
g.engine.removeNodeFromLayoutCache(a), g.engine.removedNodes.push(a), g._triggerRemoveEvent()._triggerChangeEvent(), g.parentGridNode && !g.engine.nodes.length && g.opts.subGridDynamic && g.removeAsSubGrid();
|
|
3873
3873
|
}
|
|
3874
|
-
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (
|
|
3874
|
+
if (!n || (d && (this.engine.cleanupNode(n), n.grid = this), (p = n.grid) == null || delete p._isTemp, $.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !d))
|
|
3875
3875
|
return !1;
|
|
3876
|
-
const f = (y = (
|
|
3876
|
+
const f = (y = (m = n.subGrid) == null ? void 0 : m.el) == null ? void 0 : y.gridstack;
|
|
3877
3877
|
return c.copyPos(n, this._readAttr(this.placeholder)), c.removePositioningStyles(r), h && (n.content || n.subGridOpts || w.addRemoveCB) ? (delete n.el, r = this.addWidget(n)) : (this._prepareElement(r, !0, n), this.el.appendChild(r), this.resizeToContentCheck(!1, n), f && (f.parentGridNode = n, f.opts.styleInHead || f._updateStyles(!0)), this._updateContainerHeight()), this.engine.addedNodes.push(n), this._triggerAddEvent(), this._triggerChangeEvent(), this.engine.endUpdate(), this._gsEventHandler.dropped && this._gsEventHandler.dropped({ ...s, type: "dropped" }, a && a.grid ? a : void 0, n), l && this.setAnimation(this.opts.animate, !0), !1;
|
|
3878
3878
|
}), this;
|
|
3879
3879
|
}
|
|
@@ -3907,8 +3907,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3907
3907
|
const a = e.w !== e._orig.w, f = l.target;
|
|
3908
3908
|
if (!(!f.gridstackNode || f.gridstackNode.grid !== this)) {
|
|
3909
3909
|
if (e.el = f, e._isAboutToRemove) {
|
|
3910
|
-
const
|
|
3911
|
-
|
|
3910
|
+
const p = t.gridstackNode.grid;
|
|
3911
|
+
p._gsEventHandler[l.type] && p._gsEventHandler[l.type](l, f), p.engine.nodes.push(e), p.removeWidget(t, !0, !0);
|
|
3912
3912
|
} else
|
|
3913
3913
|
c.removePositioningStyles(f), e._temporaryRemoved ? (c.copyPos(e, e._orig), this._writePosAttr(f, e), this.engine.addNode(e)) : this._writePosAttr(f, e), this._gsEventHandler[l.type] && this._gsEventHandler[l.type](l, f);
|
|
3914
3914
|
this._extraDragRow = 0, this._updateContainerHeight(), this._triggerChangeEvent(), this.engine.endUpdate(), l.type === "resizestop" && (Number.isInteger(e.sizeToContent) && (e.sizeToContent = e.h), this.resizeToContentCheck(a, e));
|
|
@@ -3950,8 +3950,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3950
3950
|
_dragOrResize(e, t, i, s, r, o) {
|
|
3951
3951
|
const n = { ...s._orig };
|
|
3952
3952
|
let d, h = this.opts.marginLeft, l = this.opts.marginRight, a = this.opts.marginTop, f = this.opts.marginBottom;
|
|
3953
|
-
const
|
|
3954
|
-
if (h = Math.min(h,
|
|
3953
|
+
const p = Math.round(o * 0.1), m = Math.round(r * 0.1);
|
|
3954
|
+
if (h = Math.min(h, m), l = Math.min(l, m), a = Math.min(a, p), f = Math.min(f, p), t.type === "drag") {
|
|
3955
3955
|
if (s._temporaryRemoved)
|
|
3956
3956
|
return;
|
|
3957
3957
|
const g = i.position.top - s._prevYPix;
|
|
@@ -4005,7 +4005,7 @@ w.renderCB = (u, e) => {
|
|
|
4005
4005
|
};
|
|
4006
4006
|
w.resizeToContentParent = ".grid-stack-item-content";
|
|
4007
4007
|
w.Utils = c;
|
|
4008
|
-
w.Engine =
|
|
4008
|
+
w.Engine = te;
|
|
4009
4009
|
w.GDRev = "11.3.0";
|
|
4010
4010
|
const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { class: "grid-stack-item-content" }, as = /* @__PURE__ */ K({
|
|
4011
4011
|
__name: "DraggableGridLayout",
|
|
@@ -4015,25 +4015,25 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4015
4015
|
},
|
|
4016
4016
|
emits: ["update-tiles"],
|
|
4017
4017
|
setup(u, { expose: e, emit: t }) {
|
|
4018
|
-
const i = u, s = t, r = U(null), o = U(new Map(i.tiles.map((
|
|
4018
|
+
const i = u, s = t, r = U(null), o = U(new Map(i.tiles.map((p) => [`${p.id}`, p])));
|
|
4019
4019
|
let n = null;
|
|
4020
|
-
const d = (
|
|
4020
|
+
const d = (p) => `[data-id="${p}"]`, h = (p) => p.map((m) => {
|
|
4021
4021
|
var g;
|
|
4022
|
-
const y = o.value.get(`${(g =
|
|
4022
|
+
const y = o.value.get(`${(g = m.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
4023
4023
|
if (y)
|
|
4024
4024
|
return {
|
|
4025
4025
|
...y,
|
|
4026
4026
|
layout: {
|
|
4027
|
-
position: { col: Number(
|
|
4028
|
-
size: { cols: Number(
|
|
4027
|
+
position: { col: Number(m.x), row: Number(m.y) },
|
|
4028
|
+
size: { cols: Number(m.w), rows: Number(m.h) }
|
|
4029
4029
|
}
|
|
4030
4030
|
};
|
|
4031
|
-
}).filter((
|
|
4032
|
-
n && (h(
|
|
4031
|
+
}).filter((m) => m !== void 0), l = (p, m) => {
|
|
4032
|
+
n && (h(m).forEach((g) => {
|
|
4033
4033
|
o.value.set(`${g.id}`, g);
|
|
4034
4034
|
}), s("update-tiles", Array.from(o.value.values())));
|
|
4035
|
-
}, a = (
|
|
4036
|
-
|
|
4035
|
+
}, a = (p, m) => {
|
|
4036
|
+
m.forEach((y) => {
|
|
4037
4037
|
var g;
|
|
4038
4038
|
o.value.delete(`${(g = y.el) == null ? void 0 : g.getAttribute("data-id")}`);
|
|
4039
4039
|
}), s("update-tiles", Array.from(o.value.values()));
|
|
@@ -4049,15 +4049,15 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4049
4049
|
}), Ve(() => {
|
|
4050
4050
|
n && n.destroy(!1);
|
|
4051
4051
|
});
|
|
4052
|
-
const f = (
|
|
4052
|
+
const f = (p) => {
|
|
4053
4053
|
if (n && r.value) {
|
|
4054
|
-
const
|
|
4055
|
-
|
|
4054
|
+
const m = r.value.querySelector(d(p));
|
|
4055
|
+
m && n.removeWidget(m);
|
|
4056
4056
|
}
|
|
4057
4057
|
};
|
|
4058
|
-
return Ke(() => i.tiles.length, async (
|
|
4059
|
-
if (
|
|
4060
|
-
const y = i.tiles.slice(
|
|
4058
|
+
return Ke(() => i.tiles.length, async (p, m) => {
|
|
4059
|
+
if (p > m && n) {
|
|
4060
|
+
const y = i.tiles.slice(m);
|
|
4061
4061
|
for (const g of y)
|
|
4062
4062
|
o.value.set(`${g.id}`, g), await bt(), n.makeWidget(d(g.id), {
|
|
4063
4063
|
autoPosition: !0,
|
|
@@ -4066,10 +4066,10 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4066
4066
|
});
|
|
4067
4067
|
}
|
|
4068
4068
|
}), _t(() => {
|
|
4069
|
-
i.tiles.forEach((
|
|
4070
|
-
o.value.set(`${
|
|
4069
|
+
i.tiles.forEach((p) => {
|
|
4070
|
+
o.value.set(`${p.id}`, p);
|
|
4071
4071
|
});
|
|
4072
|
-
}), e({ removeWidget: f }), (
|
|
4072
|
+
}), e({ removeWidget: f }), (p, m) => (R(), F("div", {
|
|
4073
4073
|
ref_key: "gridContainer",
|
|
4074
4074
|
ref: r,
|
|
4075
4075
|
class: "grid-stack"
|
|
@@ -4086,7 +4086,7 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4086
4086
|
"gs-y": y.layout.position.row
|
|
4087
4087
|
}, [
|
|
4088
4088
|
ne("div", os, [
|
|
4089
|
-
Ie(
|
|
4089
|
+
Ie(p.$slots, "tile", { tile: y }, void 0, !0)
|
|
4090
4090
|
])
|
|
4091
4091
|
], 8, ns))), 128))
|
|
4092
4092
|
], 512));
|
|
@@ -4109,10 +4109,10 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4109
4109
|
const l = Tt(), a = A(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4110
4110
|
type: "relative",
|
|
4111
4111
|
time_range: l.defaultQueryTimeForOrg
|
|
4112
|
-
}), f = A(() => !!i.context.timeSpec || !l.loading),
|
|
4112
|
+
}), f = A(() => !!i.context.timeSpec || !l.loading), p = (E, N) => {
|
|
4113
4113
|
const S = E.layout.position.row - N.layout.position.row;
|
|
4114
4114
|
return S !== 0 ? S : E.layout.position.col - N.layout.position.col;
|
|
4115
|
-
},
|
|
4115
|
+
}, m = A(() => r.value.tiles.map((E) => {
|
|
4116
4116
|
var S;
|
|
4117
4117
|
let N = E.definition;
|
|
4118
4118
|
if ("description" in N.chart) {
|
|
@@ -4144,14 +4144,14 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4144
4144
|
let { tz: E, refreshInterval: N, editable: S } = i.context;
|
|
4145
4145
|
const q = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
4146
4146
|
E || (E = new Intl.DateTimeFormat().resolvedOptions().timeZone), N === void 0 && (N = bi), S === void 0 && (S = !1);
|
|
4147
|
-
const
|
|
4147
|
+
const Z = !!((Te = (ve = (le = Kt()) == null ? void 0 : le.vnode) == null ? void 0 : ve.props) != null && Te.onZoomTimeRange);
|
|
4148
4148
|
return {
|
|
4149
4149
|
filters: q,
|
|
4150
4150
|
tz: E,
|
|
4151
4151
|
timeSpec: a.value,
|
|
4152
4152
|
refreshInterval: N,
|
|
4153
4153
|
editable: S,
|
|
4154
|
-
zoomable:
|
|
4154
|
+
zoomable: Z
|
|
4155
4155
|
};
|
|
4156
4156
|
}), g = (E) => {
|
|
4157
4157
|
s("edit-tile", E);
|
|
@@ -4186,7 +4186,7 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4186
4186
|
layout: S.layout,
|
|
4187
4187
|
definition: S.meta
|
|
4188
4188
|
}));
|
|
4189
|
-
r.value.tiles = N.sort(
|
|
4189
|
+
r.value.tiles = N.sort(p);
|
|
4190
4190
|
};
|
|
4191
4191
|
return e({ refresh: L }), (E, N) => {
|
|
4192
4192
|
const S = ae("KAlert");
|
|
@@ -4196,7 +4196,7 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4196
4196
|
ref_key: "gridLayoutRef",
|
|
4197
4197
|
ref: d,
|
|
4198
4198
|
"tile-height": r.value.tile_height,
|
|
4199
|
-
tiles:
|
|
4199
|
+
tiles: m.value,
|
|
4200
4200
|
onUpdateTiles: C
|
|
4201
4201
|
}, {
|
|
4202
4202
|
tile: I(({ tile: q }) => [
|
|
@@ -4211,10 +4211,10 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4211
4211
|
"query-ready": f.value,
|
|
4212
4212
|
"refresh-counter": n.value,
|
|
4213
4213
|
"tile-id": q.id,
|
|
4214
|
-
onDuplicateTile: (
|
|
4215
|
-
onEditTile: (
|
|
4216
|
-
onRemoveTile: (
|
|
4217
|
-
onZoomTimeRange: N[0] || (N[0] = (
|
|
4214
|
+
onDuplicateTile: (Z) => k(q),
|
|
4215
|
+
onEditTile: (Z) => g(q),
|
|
4216
|
+
onRemoveTile: (Z) => x(q),
|
|
4217
|
+
onZoomTimeRange: N[0] || (N[0] = (Z) => s("zoom-time-range", Z))
|
|
4218
4218
|
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onDuplicateTile", "onEditTile", "onRemoveTile"]))
|
|
4219
4219
|
]),
|
|
4220
4220
|
_: 3
|
|
@@ -4223,7 +4223,7 @@ const ns = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], os = { cl
|
|
|
4223
4223
|
appearance: "danger"
|
|
4224
4224
|
}, {
|
|
4225
4225
|
default: I(() => [
|
|
4226
|
-
Pe(
|
|
4226
|
+
Pe(ee(D(o).t("renderer.noQueryBridge")), 1)
|
|
4227
4227
|
]),
|
|
4228
4228
|
_: 1
|
|
4229
4229
|
}))
|