@kong-ui-public/dashboard-renderer 0.35.0 → 0.35.2
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.
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { stripUnknownFilters as
|
|
3
|
-
import { SimpleChart as
|
|
4
|
-
import
|
|
1
|
+
import { ref as L, watchEffect as Pe, inject as Q, defineComponent as M, onUnmounted as he, computed as z, watch as de, resolveComponent as F, unref as C, openBlock as x, createBlock as T, withCtx as N, createTextVNode as re, toDisplayString as K, renderSlot as ne, createCommentVNode as I, useCssVars as oe, createElementVNode as Y, createVNode as U, mergeProps as Re, createSlots as De, createElementBlock as A, normalizeProps as Be, guardReactiveProps as qe, nextTick as Ue, resolveDynamicComponent as ze, onMounted as Se, Fragment as Te, renderList as ke, normalizeClass as Fe, normalizeStyle as me } from "vue";
|
|
2
|
+
import { stripUnknownFilters as $e, Timeframe as Ge, TimePeriods as Ne, TIMEFRAME_LOOKUP as We, formatTime as ye, msToGranularity as Ke } from "@kong-ui-public/analytics-utilities";
|
|
3
|
+
import { SimpleChart as Ve, AnalyticsChart as Ye, TopNTable as Xe, CsvExportModal as je } from "@kong-ui-public/analytics-chart";
|
|
4
|
+
import Qe from "swrv";
|
|
5
5
|
import "axios";
|
|
6
|
-
import { createI18n as
|
|
7
|
-
import { MetricsProvider as
|
|
8
|
-
import { EntityLink as
|
|
9
|
-
import { EditIcon as
|
|
10
|
-
import { useAnalyticsConfigStore as
|
|
11
|
-
var
|
|
12
|
-
const
|
|
6
|
+
import { createI18n as Je, i18nTComponent as Ze } from "@kong-ui-public/i18n";
|
|
7
|
+
import { MetricsProvider as et, MetricsConsumer as tt } from "@kong-ui-public/analytics-metric-provider";
|
|
8
|
+
import { EntityLink as it } from "@kong-ui-public/entities-shared";
|
|
9
|
+
import { EditIcon as st, MoreIcon as rt } from "@kong/icons";
|
|
10
|
+
import { useAnalyticsConfigStore as nt } from "@kong-ui-public/analytics-config-store";
|
|
11
|
+
var He = /* @__PURE__ */ ((c) => (c.VALIDATING = "VALIDATING", c.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", c.PENDING = "PENDING", c.SUCCESS = "SUCCESS", c.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", c.ERROR = "ERROR", c.STALE_IF_ERROR = "STALE_IF_ERROR", c))(He || {});
|
|
12
|
+
const ot = (c) => {
|
|
13
13
|
var e, t, i, s, r;
|
|
14
14
|
return c ? !!// TODO: revisit: currently only the first check ever matters?
|
|
15
15
|
((e = Object.keys(c)) != null && e.length || (t = c.data) != null && t.length || (s = (i = c.data) == null ? void 0 : i.data) != null && s.length || !((r = c.data) != null && r.data) && typeof c.data == "object" && Object.keys(c == null ? void 0 : c.data).length) : !1;
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const s =
|
|
17
|
+
function at(c = L({}), e, t, i = ot) {
|
|
18
|
+
const s = L(
|
|
19
19
|
"PENDING"
|
|
20
20
|
/* PENDING */
|
|
21
21
|
);
|
|
22
|
-
return
|
|
22
|
+
return Pe(() => {
|
|
23
23
|
const r = i(c.value);
|
|
24
24
|
if (c.value && r && t.value) {
|
|
25
25
|
s.value = "VALIDATING_HAS_DATA";
|
|
@@ -48,10 +48,10 @@ function st(c = U({}), e, t, i = it) {
|
|
|
48
48
|
c.value === void 0 && e && (s.value = "ERROR");
|
|
49
49
|
}), {
|
|
50
50
|
state: s,
|
|
51
|
-
swrvState:
|
|
51
|
+
swrvState: He
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const lt = {
|
|
55
55
|
noQueryBridge: "No query bridge provided. Unable to render dashboard.",
|
|
56
56
|
trendRange: {
|
|
57
57
|
"24h": "Last 24-Hour Summary",
|
|
@@ -59,36 +59,36 @@ const rt = {
|
|
|
59
59
|
"30d": "Last 30-Day Summary"
|
|
60
60
|
},
|
|
61
61
|
edit: "Edit"
|
|
62
|
-
},
|
|
62
|
+
}, ht = {
|
|
63
63
|
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
64
|
-
},
|
|
64
|
+
}, dt = {
|
|
65
65
|
defaultFilename: "Chart Export",
|
|
66
66
|
exportAsCsv: "Export as CSV"
|
|
67
|
-
},
|
|
68
|
-
renderer:
|
|
69
|
-
queryDataProvider:
|
|
70
|
-
csvExport:
|
|
71
|
-
jumpToExplore:
|
|
67
|
+
}, ut = "Explore", ct = {
|
|
68
|
+
renderer: lt,
|
|
69
|
+
queryDataProvider: ht,
|
|
70
|
+
csvExport: dt,
|
|
71
|
+
jumpToExplore: ut
|
|
72
72
|
};
|
|
73
|
-
function
|
|
74
|
-
const c =
|
|
73
|
+
function ft() {
|
|
74
|
+
const c = Je("en-us", ct);
|
|
75
75
|
return {
|
|
76
76
|
i18n: c,
|
|
77
|
-
i18nT:
|
|
77
|
+
i18nT: Ze(c)
|
|
78
78
|
// Translation component <i18n-t>
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const c =
|
|
81
|
+
const ue = 170, J = "analytics-query-provider", _e = "{entity-id}", gt = "{cp-id}", pt = "{timeframe}", mt = 30 * 1e3;
|
|
82
|
+
function yt() {
|
|
83
|
+
const c = Q(J);
|
|
84
84
|
return {
|
|
85
85
|
evaluateFeatureFlag: (t, i) => c ? c.evaluateFeatureFlagFn(t, i) : i
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
useI18n:
|
|
90
|
-
useEvaluateFeatureFlag:
|
|
91
|
-
},
|
|
88
|
+
const $ = {
|
|
89
|
+
useI18n: ft,
|
|
90
|
+
useEvaluateFeatureFlag: yt
|
|
91
|
+
}, ce = /* @__PURE__ */ M({
|
|
92
92
|
__name: "QueryDataProvider",
|
|
93
93
|
props: {
|
|
94
94
|
context: {},
|
|
@@ -98,73 +98,73 @@ const F = {
|
|
|
98
98
|
},
|
|
99
99
|
emits: ["chart-data", "queryComplete"],
|
|
100
100
|
setup(c, { emit: e }) {
|
|
101
|
-
const t = c, i = e, { i18n: s } =
|
|
102
|
-
|
|
101
|
+
const t = c, i = e, { i18n: s } = $.useI18n(), r = Q(J), o = () => t.queryReady && r ? JSON.stringify([t.query, t.context, t.refreshCounter]) : null, n = new AbortController();
|
|
102
|
+
he(() => {
|
|
103
103
|
n.abort();
|
|
104
104
|
});
|
|
105
|
-
const l = (w,
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
}, { data: h, error: d, isValidating: u } =
|
|
109
|
-
var w,
|
|
105
|
+
const l = (w, E, D) => {
|
|
106
|
+
const S = [];
|
|
107
|
+
return E && S.push(...E), S.push(...$e(w, D)), S;
|
|
108
|
+
}, { data: h, error: d, isValidating: u } = Qe(o, async () => {
|
|
109
|
+
var w, E, D, S;
|
|
110
110
|
try {
|
|
111
111
|
let {
|
|
112
112
|
datasource: R,
|
|
113
|
-
...
|
|
113
|
+
...G
|
|
114
114
|
} = t.query;
|
|
115
115
|
R || (R = "basic");
|
|
116
|
-
const
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
...
|
|
116
|
+
const le = l(R, t.query.filters, t.context.filters);
|
|
117
|
+
let p = t.query.time_range;
|
|
118
|
+
p ? p.tz || (p = {
|
|
119
|
+
...p,
|
|
120
120
|
tz: t.context.tz
|
|
121
|
-
}) :
|
|
121
|
+
}) : p = {
|
|
122
122
|
...t.context.timeSpec,
|
|
123
123
|
tz: t.context.tz
|
|
124
124
|
};
|
|
125
|
-
const
|
|
125
|
+
const q = {
|
|
126
126
|
datasource: R,
|
|
127
127
|
query: {
|
|
128
|
-
...
|
|
129
|
-
time_range:
|
|
130
|
-
filters:
|
|
128
|
+
...G,
|
|
129
|
+
time_range: p,
|
|
130
|
+
filters: le
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
return r == null ? void 0 : r.queryFn(
|
|
133
|
+
return r == null ? void 0 : r.queryFn(q, n);
|
|
134
134
|
} catch (R) {
|
|
135
|
-
v.value = ((
|
|
135
|
+
v.value = ((E = (w = R == null ? void 0 : R.response) == null ? void 0 : w.data) == null ? void 0 : E.message) === "Range not allowed for this tier" ? s.t("queryDataProvider.timeRangeExceeded") : ((S = (D = R == null ? void 0 : R.response) == null ? void 0 : D.data) == null ? void 0 : S.message) || (R == null ? void 0 : R.message);
|
|
136
136
|
} finally {
|
|
137
137
|
i("queryComplete");
|
|
138
138
|
}
|
|
139
139
|
}, {
|
|
140
140
|
refreshInterval: t.context.refreshInterval,
|
|
141
141
|
revalidateOnFocus: !1
|
|
142
|
-
}), { state: f, swrvState: _ } =
|
|
143
|
-
return
|
|
142
|
+
}), { state: f, swrvState: _ } = at(h, d, u), v = L(null), b = z(() => f.value === _.ERROR || !!v.value), y = z(() => !t.queryReady || f.value === _.PENDING);
|
|
143
|
+
return de(h, (w) => {
|
|
144
144
|
w && i("chart-data", w);
|
|
145
|
-
}), (w,
|
|
146
|
-
const D =
|
|
147
|
-
return
|
|
145
|
+
}), (w, E) => {
|
|
146
|
+
const D = F("KSkeleton"), S = F("KEmptyState");
|
|
147
|
+
return y.value || !C(h) && !b.value ? (x(), T(D, {
|
|
148
148
|
key: 0,
|
|
149
149
|
class: "chart-skeleton",
|
|
150
150
|
type: "table"
|
|
151
|
-
})) : b.value ? (
|
|
151
|
+
})) : b.value ? (x(), T(S, {
|
|
152
152
|
key: 1,
|
|
153
153
|
"action-button-visible": !1,
|
|
154
154
|
"data-testid": "chart-empty-state",
|
|
155
155
|
"icon-variant": "error"
|
|
156
156
|
}, {
|
|
157
|
-
default:
|
|
158
|
-
re(
|
|
157
|
+
default: N(() => [
|
|
158
|
+
re(K(v.value), 1)
|
|
159
159
|
]),
|
|
160
160
|
_: 1
|
|
161
|
-
})) :
|
|
161
|
+
})) : C(h) ? ne(w.$slots, "default", {
|
|
162
162
|
key: 2,
|
|
163
|
-
data:
|
|
163
|
+
data: C(h)
|
|
164
164
|
}) : I("", !0);
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
}),
|
|
167
|
+
}), _t = { class: "analytics-chart" }, vt = /* @__PURE__ */ M({
|
|
168
168
|
__name: "SimpleChartRenderer",
|
|
169
169
|
props: {
|
|
170
170
|
query: {},
|
|
@@ -179,15 +179,15 @@ const F = {
|
|
|
179
179
|
c40c0e86: `${t.height}px`
|
|
180
180
|
}));
|
|
181
181
|
const e = c;
|
|
182
|
-
return (t, i) => (
|
|
182
|
+
return (t, i) => (x(), T(ce, {
|
|
183
183
|
context: t.context,
|
|
184
184
|
query: t.query,
|
|
185
185
|
"query-ready": t.queryReady,
|
|
186
186
|
"refresh-counter": t.refreshCounter
|
|
187
187
|
}, {
|
|
188
|
-
default:
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
default: N(({ data: s }) => [
|
|
189
|
+
Y("div", _t, [
|
|
190
|
+
U(C(Ve), {
|
|
191
191
|
"chart-data": s,
|
|
192
192
|
"chart-options": e.chartOptions,
|
|
193
193
|
"synthetics-data-key": t.chartOptions.syntheticsDataKey
|
|
@@ -202,7 +202,7 @@ const F = {
|
|
|
202
202
|
for (const [i, s] of e)
|
|
203
203
|
t[i] = s;
|
|
204
204
|
return t;
|
|
205
|
-
},
|
|
205
|
+
}, bt = /* @__PURE__ */ V(vt, [["__scopeId", "data-v-694cf637"]]), wt = { class: "analytics-chart" }, Et = /* @__PURE__ */ M({
|
|
206
206
|
__name: "BaseAnalyticsChartRenderer",
|
|
207
207
|
props: {
|
|
208
208
|
query: {},
|
|
@@ -215,12 +215,12 @@ const F = {
|
|
|
215
215
|
},
|
|
216
216
|
emits: ["edit-tile", "chart-data"],
|
|
217
217
|
setup(c, { emit: e }) {
|
|
218
|
-
const t = c, i = e, s =
|
|
218
|
+
const t = c, i = e, s = Q(J), { i18n: r } = $.useI18n(), { evaluateFeatureFlag: o } = $.useEvaluateFeatureFlag(), n = o("ma-3043-analytics-chart-kebab-menu", !1), l = z(() => ({
|
|
219
219
|
type: t.chartOptions.type,
|
|
220
220
|
stacked: t.chartOptions.stacked ?? !1,
|
|
221
221
|
chartDatasetColors: t.chartOptions.chartDatasetColors,
|
|
222
222
|
threshold: t.chartOptions.threshold
|
|
223
|
-
})), h =
|
|
223
|
+
})), h = z(() => {
|
|
224
224
|
if (s && s.exploreBaseUrl) {
|
|
225
225
|
const f = {
|
|
226
226
|
filters: [...t.context.filters, ...t.query.filters ?? []],
|
|
@@ -237,33 +237,33 @@ const F = {
|
|
|
237
237
|
i("chart-data", f);
|
|
238
238
|
};
|
|
239
239
|
return (f, _) => {
|
|
240
|
-
const v =
|
|
241
|
-
return
|
|
240
|
+
const v = F("KDropdownItem");
|
|
241
|
+
return x(), T(ce, {
|
|
242
242
|
context: f.context,
|
|
243
243
|
query: f.query,
|
|
244
244
|
"query-ready": f.queryReady,
|
|
245
245
|
"refresh-counter": f.refreshCounter,
|
|
246
246
|
onChartData: u
|
|
247
247
|
}, {
|
|
248
|
-
default:
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
default: N(({ data: b }) => [
|
|
249
|
+
Y("div", wt, [
|
|
250
|
+
U(C(Ye), Re({
|
|
251
251
|
"allow-csv-export": f.chartOptions.allowCsvExport,
|
|
252
252
|
"chart-data": b,
|
|
253
253
|
"chart-options": l.value,
|
|
254
|
-
"chart-title": !
|
|
254
|
+
"chart-title": !C(n) && f.chartOptions.chartTitle || "",
|
|
255
255
|
"go-to-explore": h.value,
|
|
256
256
|
"legend-position": "bottom",
|
|
257
257
|
"show-menu": f.context.editable,
|
|
258
258
|
"synthetics-data-key": f.chartOptions.syntheticsDataKey,
|
|
259
259
|
"tooltip-title": ""
|
|
260
|
-
}, f.extraProps),
|
|
260
|
+
}, f.extraProps), De({ _: 2 }, [
|
|
261
261
|
f.context.editable ? {
|
|
262
262
|
name: "menu-items",
|
|
263
|
-
fn:
|
|
264
|
-
|
|
265
|
-
default:
|
|
266
|
-
re(
|
|
263
|
+
fn: N(() => [
|
|
264
|
+
U(v, { onClick: d }, {
|
|
265
|
+
default: N(() => [
|
|
266
|
+
re(K(C(r).t("renderer.edit")), 1)
|
|
267
267
|
]),
|
|
268
268
|
_: 1
|
|
269
269
|
})
|
|
@@ -277,7 +277,7 @@ const F = {
|
|
|
277
277
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]);
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
|
-
}),
|
|
280
|
+
}), Ae = /* @__PURE__ */ V(Et, [["__scopeId", "data-v-1bc587d3"]]), ve = /* @__PURE__ */ M({
|
|
281
281
|
__name: "BarChartRenderer",
|
|
282
282
|
props: {
|
|
283
283
|
query: {},
|
|
@@ -288,7 +288,7 @@ const F = {
|
|
|
288
288
|
refreshCounter: {}
|
|
289
289
|
},
|
|
290
290
|
setup(c) {
|
|
291
|
-
return (e, t) => (
|
|
291
|
+
return (e, t) => (x(), T(Ae, {
|
|
292
292
|
"chart-options": e.chartOptions,
|
|
293
293
|
context: e.context,
|
|
294
294
|
"extra-props": { showAnnotations: !1 },
|
|
@@ -298,7 +298,7 @@ const F = {
|
|
|
298
298
|
"refresh-counter": e.refreshCounter
|
|
299
299
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
300
300
|
}
|
|
301
|
-
}),
|
|
301
|
+
}), be = /* @__PURE__ */ M({
|
|
302
302
|
__name: "TimeseriesChartRenderer",
|
|
303
303
|
props: {
|
|
304
304
|
query: {},
|
|
@@ -309,7 +309,7 @@ const F = {
|
|
|
309
309
|
refreshCounter: {}
|
|
310
310
|
},
|
|
311
311
|
setup(c) {
|
|
312
|
-
return (e, t) => (
|
|
312
|
+
return (e, t) => (x(), T(Ae, {
|
|
313
313
|
"chart-options": e.chartOptions,
|
|
314
314
|
context: e.context,
|
|
315
315
|
height: e.height,
|
|
@@ -318,7 +318,7 @@ const F = {
|
|
|
318
318
|
"refresh-counter": e.refreshCounter
|
|
319
319
|
}, null, 8, ["chart-options", "context", "height", "query", "query-ready", "refresh-counter"]));
|
|
320
320
|
}
|
|
321
|
-
}),
|
|
321
|
+
}), xt = { class: "metric-card-tile-wrapper" }, Ct = /* @__PURE__ */ M({
|
|
322
322
|
__name: "GoldenSignalsRenderer",
|
|
323
323
|
props: {
|
|
324
324
|
query: {},
|
|
@@ -330,14 +330,14 @@ const F = {
|
|
|
330
330
|
},
|
|
331
331
|
setup(c) {
|
|
332
332
|
oe((o) => ({
|
|
333
|
-
"926e3b48":
|
|
334
|
-
"7be2893e":
|
|
335
|
-
"0d55c162":
|
|
333
|
+
"926e3b48": C(i) ? "90%" : "100%",
|
|
334
|
+
"7be2893e": C(i) ? "auto" : "100%",
|
|
335
|
+
"0d55c162": C(i) ? "100%" : "none"
|
|
336
336
|
}));
|
|
337
|
-
const e = c, { evaluateFeatureFlag: t } =
|
|
337
|
+
const e = c, { evaluateFeatureFlag: t } = $.useEvaluateFeatureFlag(), i = t("ma-3043-analytics-chart-kebab-menu", !1), s = z(() => {
|
|
338
338
|
const o = e.context.timeSpec;
|
|
339
339
|
if (o.type === "absolute")
|
|
340
|
-
return new
|
|
340
|
+
return new Ge({
|
|
341
341
|
key: "custom",
|
|
342
342
|
timeframeText: "custom",
|
|
343
343
|
display: "custom",
|
|
@@ -349,11 +349,11 @@ const F = {
|
|
|
349
349
|
isRelative: !1,
|
|
350
350
|
allowedTiers: ["free", "plus", "enterprise"]
|
|
351
351
|
});
|
|
352
|
-
const n =
|
|
352
|
+
const n = Ne.get(o.time_range);
|
|
353
353
|
if (!n)
|
|
354
354
|
throw new Error("Unknown time range");
|
|
355
355
|
return n;
|
|
356
|
-
}), r =
|
|
356
|
+
}), r = z(() => {
|
|
357
357
|
var n, l;
|
|
358
358
|
const o = (n = e.query) == null ? void 0 : n.datasource;
|
|
359
359
|
if (o && o !== "advanced" && o !== "basic")
|
|
@@ -373,16 +373,16 @@ const F = {
|
|
|
373
373
|
refreshCounter: e.refreshCounter
|
|
374
374
|
};
|
|
375
375
|
});
|
|
376
|
-
return (o, n) => (
|
|
377
|
-
|
|
378
|
-
default:
|
|
379
|
-
|
|
376
|
+
return (o, n) => (x(), A("div", xt, [
|
|
377
|
+
U(C(et), Be(qe(r.value)), {
|
|
378
|
+
default: N(() => [
|
|
379
|
+
U(C(tt))
|
|
380
380
|
]),
|
|
381
381
|
_: 1
|
|
382
382
|
}, 16)
|
|
383
383
|
]));
|
|
384
384
|
}
|
|
385
|
-
}),
|
|
385
|
+
}), Rt = /* @__PURE__ */ V(Ct, [["__scopeId", "data-v-0f571079"]]), we = "#6c7489", Ee = "20px", Le = "20px", Dt = /* @__PURE__ */ M({
|
|
386
386
|
__name: "TopNTableRenderer",
|
|
387
387
|
props: {
|
|
388
388
|
query: {},
|
|
@@ -393,33 +393,33 @@ const F = {
|
|
|
393
393
|
refreshCounter: {}
|
|
394
394
|
},
|
|
395
395
|
setup(c) {
|
|
396
|
-
const e = c, { evaluateFeatureFlag: t } =
|
|
396
|
+
const e = c, { evaluateFeatureFlag: t } = $.useEvaluateFeatureFlag(), i = t("ma-3043-analytics-chart-kebab-menu", !1), s = (r) => {
|
|
397
397
|
var o;
|
|
398
398
|
if ((o = e.chartOptions) != null && o.entityLink)
|
|
399
399
|
if (r.id.includes(":")) {
|
|
400
400
|
const [n, l] = r.id.split(":");
|
|
401
|
-
return e.chartOptions.entityLink.replace(
|
|
401
|
+
return e.chartOptions.entityLink.replace(gt, n).replace(_e, l);
|
|
402
402
|
} else
|
|
403
|
-
return e.chartOptions.entityLink.replace(
|
|
403
|
+
return e.chartOptions.entityLink.replace(_e, r.id);
|
|
404
404
|
return "";
|
|
405
405
|
};
|
|
406
|
-
return (r, o) => (
|
|
406
|
+
return (r, o) => (x(), T(ce, {
|
|
407
407
|
context: r.context,
|
|
408
408
|
query: r.query,
|
|
409
409
|
"query-ready": r.queryReady,
|
|
410
410
|
"refresh-counter": r.refreshCounter
|
|
411
411
|
}, {
|
|
412
|
-
default:
|
|
413
|
-
|
|
412
|
+
default: N(({ data: n }) => [
|
|
413
|
+
U(C(Xe), {
|
|
414
414
|
data: n,
|
|
415
|
-
description: !
|
|
415
|
+
description: !C(i) && r.chartOptions.description || "",
|
|
416
416
|
"synthetics-data-key": r.chartOptions.syntheticsDataKey,
|
|
417
|
-
title: !
|
|
418
|
-
},
|
|
417
|
+
title: !C(i) && r.chartOptions.chartTitle || ""
|
|
418
|
+
}, De({ _: 2 }, [
|
|
419
419
|
e.chartOptions.entityLink ? {
|
|
420
420
|
name: "name",
|
|
421
|
-
fn:
|
|
422
|
-
|
|
421
|
+
fn: N(({ record: l }) => [
|
|
422
|
+
U(C(it), {
|
|
423
423
|
"entity-link-data": {
|
|
424
424
|
id: l.id,
|
|
425
425
|
label: l.name,
|
|
@@ -435,49 +435,53 @@ const F = {
|
|
|
435
435
|
_: 1
|
|
436
436
|
}, 8, ["context", "query", "query-ready", "refresh-counter"]));
|
|
437
437
|
}
|
|
438
|
-
}),
|
|
438
|
+
}), zt = ["data-testid"], St = {
|
|
439
439
|
key: 0,
|
|
440
440
|
class: "tile-header"
|
|
441
|
-
},
|
|
441
|
+
}, Tt = ["data-testid"], kt = ["data-testid"], Nt = ["data-testid"], Ht = ["data-testid"], At = /* @__PURE__ */ M({
|
|
442
442
|
__name: "DashboardTile",
|
|
443
443
|
props: {
|
|
444
444
|
definition: {},
|
|
445
445
|
context: {},
|
|
446
|
-
height: { default:
|
|
446
|
+
height: { default: ue },
|
|
447
447
|
queryReady: { type: Boolean },
|
|
448
448
|
refreshCounter: {},
|
|
449
449
|
tileId: {}
|
|
450
450
|
},
|
|
451
451
|
emits: ["edit-tile"],
|
|
452
452
|
setup(c, { emit: e }) {
|
|
453
|
-
oe((
|
|
454
|
-
|
|
453
|
+
oe((p) => ({
|
|
454
|
+
"733568b4": `${p.height}px`
|
|
455
455
|
}));
|
|
456
|
-
const t = parseInt(
|
|
456
|
+
const t = parseInt(Le, 10), i = c, s = e, r = Q(J), { evaluateFeatureFlag: o } = $.useEvaluateFeatureFlag(), { i18n: n } = $.useI18n(), l = o("ma-3043-analytics-chart-kebab-menu", !1), h = L(), d = L(!1), u = L(), f = L(!1);
|
|
457
|
+
de(() => i.definition, async () => {
|
|
458
|
+
await Ue(), u.value && (f.value = u.value.scrollWidth > u.value.clientWidth);
|
|
459
|
+
}, { immediate: !0, deep: !0 });
|
|
460
|
+
const _ = z(() => {
|
|
457
461
|
if (r && r.exploreBaseUrl) {
|
|
458
|
-
const
|
|
462
|
+
const p = {
|
|
459
463
|
filters: [...i.context.filters, ...i.definition.query.filters ?? []],
|
|
460
464
|
metrics: i.definition.query.metrics ?? [],
|
|
461
465
|
dimensions: i.definition.query.dimensions ?? [],
|
|
462
466
|
time_range: i.definition.query.time_range || i.context.timeSpec,
|
|
463
|
-
granularity: i.definition.query.granularity ||
|
|
467
|
+
granularity: i.definition.query.granularity || D.value
|
|
464
468
|
}, q = ["advanced", "ai"].includes(i.definition.query.datasource) ? i.definition.query.datasource : "advanced";
|
|
465
|
-
return `${r.exploreBaseUrl()}?q=${JSON.stringify(
|
|
469
|
+
return `${r.exploreBaseUrl()}?q=${JSON.stringify(p)}&d=${q}&c=${i.definition.chart.type}`;
|
|
466
470
|
}
|
|
467
471
|
return "";
|
|
468
|
-
}),
|
|
469
|
-
timeseries_line:
|
|
470
|
-
timeseries_bar:
|
|
471
|
-
horizontal_bar:
|
|
472
|
-
vertical_bar:
|
|
473
|
-
gauge:
|
|
474
|
-
golden_signals:
|
|
475
|
-
top_n:
|
|
472
|
+
}), v = z(() => n.t("csvExport.defaultFilename")), b = z(() => l && !["golden_signals", "top_n", "gauge"].includes(i.definition.chart.type)), y = {
|
|
473
|
+
timeseries_line: be,
|
|
474
|
+
timeseries_bar: be,
|
|
475
|
+
horizontal_bar: ve,
|
|
476
|
+
vertical_bar: ve,
|
|
477
|
+
gauge: bt,
|
|
478
|
+
golden_signals: Rt,
|
|
479
|
+
top_n: Dt,
|
|
476
480
|
slottable: void 0
|
|
477
|
-
},
|
|
478
|
-
const
|
|
479
|
-
return
|
|
480
|
-
component:
|
|
481
|
+
}, w = z(() => {
|
|
482
|
+
const p = y[i.definition.chart.type];
|
|
483
|
+
return p && {
|
|
484
|
+
component: p,
|
|
481
485
|
rendererProps: {
|
|
482
486
|
query: i.definition.query,
|
|
483
487
|
context: i.context,
|
|
@@ -487,116 +491,127 @@ const F = {
|
|
|
487
491
|
refreshCounter: i.refreshCounter
|
|
488
492
|
}
|
|
489
493
|
};
|
|
490
|
-
}),
|
|
494
|
+
}), E = z(() => {
|
|
491
495
|
var q;
|
|
492
|
-
const
|
|
493
|
-
if ((
|
|
494
|
-
const
|
|
495
|
-
return
|
|
496
|
-
} else if ((
|
|
497
|
-
const
|
|
498
|
-
return `${
|
|
496
|
+
const p = (q = i.definition.query) == null ? void 0 : q.time_range;
|
|
497
|
+
if ((p == null ? void 0 : p.type) === "relative") {
|
|
498
|
+
const W = Ne.get(We[p.time_range]);
|
|
499
|
+
return W ? W.display : (console.warn("Did not recognize the given relative time range:", p.time_range), p.time_range);
|
|
500
|
+
} else if ((p == null ? void 0 : p.type) === "absolute") {
|
|
501
|
+
const W = p.tz || "Etc/UTC";
|
|
502
|
+
return `${ye(p.start, { short: !0, tz: W })} - ${ye(p.end, { short: !0, tz: W })}`;
|
|
499
503
|
}
|
|
500
504
|
return null;
|
|
501
|
-
}),
|
|
505
|
+
}), D = z(() => h.value ? Ke(h.value.meta.granularity_ms) : void 0), S = () => {
|
|
502
506
|
s("edit-tile", i.definition);
|
|
503
|
-
},
|
|
504
|
-
h.value =
|
|
505
|
-
},
|
|
506
|
-
d.value =
|
|
507
|
-
},
|
|
508
|
-
|
|
507
|
+
}, R = (p) => {
|
|
508
|
+
h.value = p;
|
|
509
|
+
}, G = (p) => {
|
|
510
|
+
d.value = p;
|
|
511
|
+
}, le = () => {
|
|
512
|
+
G(!0);
|
|
509
513
|
};
|
|
510
|
-
return (
|
|
511
|
-
const
|
|
512
|
-
return
|
|
514
|
+
return (p, q) => {
|
|
515
|
+
const W = F("KTooltip"), Me = F("KBadge"), pe = F("KDropdownItem"), Ie = F("KDropdown");
|
|
516
|
+
return x(), A("div", {
|
|
513
517
|
class: "tile-boundary",
|
|
514
|
-
"data-testid": `tile-${
|
|
518
|
+
"data-testid": `tile-${p.tileId}`
|
|
515
519
|
}, [
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
class: "title",
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
C(l) && p.definition.chart.type !== "slottable" ? (x(), A("div", St, [
|
|
521
|
+
U(W, {
|
|
522
|
+
class: "title-tooltip",
|
|
523
|
+
disabled: !f.value,
|
|
524
|
+
"max-width": "500",
|
|
525
|
+
text: p.definition.chart.chartTitle
|
|
526
|
+
}, {
|
|
527
|
+
default: N(() => [
|
|
528
|
+
Y("div", {
|
|
529
|
+
ref_key: "titleRef",
|
|
530
|
+
ref: u,
|
|
531
|
+
class: "title"
|
|
532
|
+
}, K(p.definition.chart.chartTitle), 513)
|
|
533
|
+
]),
|
|
534
|
+
_: 1
|
|
535
|
+
}, 8, ["disabled", "text"]),
|
|
536
|
+
b.value || E.value ? (x(), A("div", {
|
|
522
537
|
key: 0,
|
|
523
538
|
class: "tile-actions",
|
|
524
|
-
"data-testid": `tile-actions-${
|
|
539
|
+
"data-testid": `tile-actions-${p.tileId}`
|
|
525
540
|
}, [
|
|
526
|
-
|
|
527
|
-
default:
|
|
528
|
-
re(
|
|
541
|
+
E.value ? (x(), T(Me, { key: 0 }, {
|
|
542
|
+
default: N(() => [
|
|
543
|
+
re(K(E.value), 1)
|
|
529
544
|
]),
|
|
530
545
|
_: 1
|
|
531
546
|
})) : I("", !0),
|
|
532
|
-
|
|
547
|
+
b.value && p.context.editable ? (x(), T(C(st), {
|
|
533
548
|
key: 1,
|
|
534
549
|
class: "edit-icon",
|
|
535
|
-
color:
|
|
536
|
-
"data-testid": `edit-tile-${
|
|
537
|
-
size:
|
|
538
|
-
onClick:
|
|
550
|
+
color: C(we),
|
|
551
|
+
"data-testid": `edit-tile-${p.tileId}`,
|
|
552
|
+
size: C(Ee),
|
|
553
|
+
onClick: S
|
|
539
554
|
}, null, 8, ["color", "data-testid", "size"])) : I("", !0),
|
|
540
|
-
|
|
555
|
+
b.value ? (x(), T(Ie, {
|
|
541
556
|
key: 2,
|
|
542
557
|
class: "dropdown",
|
|
543
|
-
"data-testid": `chart-action-menu-${
|
|
558
|
+
"data-testid": `chart-action-menu-${p.tileId}`,
|
|
544
559
|
"kpop-attributes": { placement: "bottom-end" }
|
|
545
560
|
}, {
|
|
546
|
-
items:
|
|
547
|
-
|
|
561
|
+
items: N(() => [
|
|
562
|
+
_.value ? (x(), T(pe, {
|
|
548
563
|
key: 0,
|
|
549
|
-
"data-testid": `chart-jump-to-explore-${
|
|
550
|
-
item: { label:
|
|
564
|
+
"data-testid": `chart-jump-to-explore-${p.tileId}`,
|
|
565
|
+
item: { label: C(n).t("jumpToExplore"), to: _.value }
|
|
551
566
|
}, null, 8, ["data-testid", "item"])) : I("", !0),
|
|
552
|
-
"allowCsvExport" in
|
|
567
|
+
"allowCsvExport" in p.definition.chart && p.definition.chart.allowCsvExport ? (x(), T(pe, {
|
|
553
568
|
key: 1,
|
|
554
569
|
class: "chart-export-button",
|
|
555
|
-
"data-testid": `chart-csv-export-${
|
|
556
|
-
onClick: q[0] || (q[0] = (
|
|
570
|
+
"data-testid": `chart-csv-export-${p.tileId}`,
|
|
571
|
+
onClick: q[0] || (q[0] = (Xt) => le())
|
|
557
572
|
}, {
|
|
558
|
-
default:
|
|
559
|
-
|
|
573
|
+
default: N(() => [
|
|
574
|
+
Y("span", {
|
|
560
575
|
class: "chart-export-trigger",
|
|
561
|
-
"data-testid": `csv-export-button-${
|
|
562
|
-
},
|
|
576
|
+
"data-testid": `csv-export-button-${p.tileId}`
|
|
577
|
+
}, K(C(n).t("csvExport.exportAsCsv")), 9, kt)
|
|
563
578
|
]),
|
|
564
579
|
_: 1
|
|
565
580
|
}, 8, ["data-testid"])) : I("", !0)
|
|
566
581
|
]),
|
|
567
|
-
default:
|
|
568
|
-
|
|
582
|
+
default: N(() => [
|
|
583
|
+
U(C(rt), {
|
|
569
584
|
class: "kebab-action-menu",
|
|
570
|
-
color:
|
|
571
|
-
"data-testid": `kebab-action-menu-${
|
|
572
|
-
size:
|
|
585
|
+
color: C(we),
|
|
586
|
+
"data-testid": `kebab-action-menu-${p.tileId}`,
|
|
587
|
+
size: C(Ee)
|
|
573
588
|
}, null, 8, ["color", "data-testid", "size"])
|
|
574
589
|
]),
|
|
575
590
|
_: 1
|
|
576
591
|
}, 8, ["data-testid"])) : I("", !0)
|
|
577
|
-
], 8,
|
|
592
|
+
], 8, Tt)) : "description" in p.definition.chart ? (x(), A("div", {
|
|
578
593
|
key: 1,
|
|
579
594
|
class: "header-description",
|
|
580
|
-
"data-testid": `tile-description-${
|
|
581
|
-
},
|
|
582
|
-
d.value ? (
|
|
595
|
+
"data-testid": `tile-description-${p.tileId}`
|
|
596
|
+
}, K(p.definition.chart.description), 9, Nt)) : I("", !0),
|
|
597
|
+
d.value ? (x(), T(C(je), {
|
|
583
598
|
key: 2,
|
|
584
599
|
"chart-data": h.value,
|
|
585
|
-
"data-testid": `csv-export-modal-${
|
|
586
|
-
filename:
|
|
587
|
-
onToggleModal:
|
|
600
|
+
"data-testid": `csv-export-modal-${p.tileId}`,
|
|
601
|
+
filename: v.value,
|
|
602
|
+
onToggleModal: G
|
|
588
603
|
}, null, 8, ["chart-data", "data-testid", "filename"])) : I("", !0)
|
|
589
604
|
])) : I("", !0),
|
|
590
|
-
|
|
605
|
+
Y("div", {
|
|
591
606
|
class: "tile-content",
|
|
592
|
-
"data-testid": `tile-content-${
|
|
607
|
+
"data-testid": `tile-content-${p.tileId}`
|
|
593
608
|
}, [
|
|
594
|
-
|
|
595
|
-
], 8,
|
|
596
|
-
], 8,
|
|
609
|
+
w.value ? (x(), T(ze(w.value.component), Re({ key: 0 }, w.value.rendererProps, { onChartData: R }), null, 16)) : I("", !0)
|
|
610
|
+
], 8, Ht)
|
|
611
|
+
], 8, zt);
|
|
597
612
|
};
|
|
598
613
|
}
|
|
599
|
-
}),
|
|
614
|
+
}), Lt = /* @__PURE__ */ V(At, [["__scopeId", "data-v-30fafa9c"]]), Ot = (c, e, t) => {
|
|
600
615
|
const i = /* @__PURE__ */ new Map();
|
|
601
616
|
t.forEach((r) => {
|
|
602
617
|
const o = r.layout.position.row, n = i.get(o), l = r.layout.size.rows === 1 && !!r.layout.size.fitToContent;
|
|
@@ -606,7 +621,7 @@ const F = {
|
|
|
606
621
|
for (let r = 0; r < c; r++)
|
|
607
622
|
i.get(r) ? s.push("auto") : s.push(`${e}px`);
|
|
608
623
|
return s;
|
|
609
|
-
},
|
|
624
|
+
}, Mt = /* @__PURE__ */ M({
|
|
610
625
|
__name: "GridLayout",
|
|
611
626
|
props: {
|
|
612
627
|
gridSize: {
|
|
@@ -616,7 +631,7 @@ const F = {
|
|
|
616
631
|
tileHeight: {
|
|
617
632
|
type: Number,
|
|
618
633
|
required: !1,
|
|
619
|
-
default: () =>
|
|
634
|
+
default: () => ue
|
|
620
635
|
},
|
|
621
636
|
tiles: {
|
|
622
637
|
type: Array,
|
|
@@ -628,20 +643,20 @@ const F = {
|
|
|
628
643
|
"3bc5e939": c.gridSize.cols,
|
|
629
644
|
"77aa3028": r.value
|
|
630
645
|
}));
|
|
631
|
-
const e = c, t =
|
|
646
|
+
const e = c, t = L(null), i = L(0), s = new ResizeObserver((n) => {
|
|
632
647
|
window.requestAnimationFrame(() => {
|
|
633
648
|
!Array.isArray(n) || !n.length || (i.value = n[0].contentRect.width);
|
|
634
649
|
});
|
|
635
650
|
});
|
|
636
|
-
|
|
651
|
+
Se(() => {
|
|
637
652
|
t.value && s.observe(t.value);
|
|
638
|
-
}),
|
|
653
|
+
}), he(() => {
|
|
639
654
|
t.value && s.unobserve(t.value);
|
|
640
655
|
});
|
|
641
|
-
const r =
|
|
656
|
+
const r = z(() => {
|
|
642
657
|
var l;
|
|
643
|
-
return
|
|
644
|
-
}), o =
|
|
658
|
+
return Ot((l = e.gridSize) == null ? void 0 : l.rows, e.tileHeight, e.tiles).join(" ");
|
|
659
|
+
}), o = z(() => e.tiles.map((n, l) => ({
|
|
645
660
|
key: `tile-${l}`,
|
|
646
661
|
tile: n,
|
|
647
662
|
style: {
|
|
@@ -651,27 +666,27 @@ const F = {
|
|
|
651
666
|
"grid-row-end": n.layout.position.row + 1 + n.layout.size.rows
|
|
652
667
|
}
|
|
653
668
|
})));
|
|
654
|
-
return (n, l) => (
|
|
669
|
+
return (n, l) => (x(), A("div", {
|
|
655
670
|
ref_key: "gridContainer",
|
|
656
671
|
ref: t,
|
|
657
672
|
class: "kong-ui-public-grid-layout"
|
|
658
673
|
}, [
|
|
659
|
-
(
|
|
674
|
+
(x(!0), A(Te, null, ke(o.value, (h) => (x(), A("div", {
|
|
660
675
|
key: h.key,
|
|
661
|
-
class:
|
|
676
|
+
class: Fe(["grid-cell", {
|
|
662
677
|
"empty-cell": !h.tile
|
|
663
678
|
}]),
|
|
664
|
-
style:
|
|
679
|
+
style: me(h.style)
|
|
665
680
|
}, [
|
|
666
681
|
ne(n.$slots, "tile", {
|
|
667
|
-
style:
|
|
682
|
+
style: me(h.style),
|
|
668
683
|
tile: h.tile
|
|
669
684
|
}, void 0, !0)
|
|
670
685
|
], 6))), 128))
|
|
671
686
|
], 512));
|
|
672
687
|
}
|
|
673
|
-
}),
|
|
674
|
-
function
|
|
688
|
+
}), It = /* @__PURE__ */ V(Mt, [["__scopeId", "data-v-f43eb7b8"]]);
|
|
689
|
+
function Pt(c, e, t, i, s) {
|
|
675
690
|
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(c, o));
|
|
676
691
|
return r.prototype = e.prototype, r;
|
|
677
692
|
}
|
|
@@ -1500,7 +1515,7 @@ class P {
|
|
|
1500
1515
|
}
|
|
1501
1516
|
}
|
|
1502
1517
|
P._idSeq = 0;
|
|
1503
|
-
const
|
|
1518
|
+
const H = {
|
|
1504
1519
|
alwaysShowResizeHandle: "mobile",
|
|
1505
1520
|
animate: !0,
|
|
1506
1521
|
auto: !0,
|
|
@@ -1573,7 +1588,7 @@ function Z(c, e) {
|
|
|
1573
1588
|
// relatedTarget
|
|
1574
1589
|
), c.target.dispatchEvent(i);
|
|
1575
1590
|
}
|
|
1576
|
-
function
|
|
1591
|
+
function Oe(c, e) {
|
|
1577
1592
|
c.cancelable && c.preventDefault();
|
|
1578
1593
|
const t = document.createEvent("MouseEvents");
|
|
1579
1594
|
t.initMouseEvent(
|
|
@@ -1625,12 +1640,12 @@ function ie(c) {
|
|
|
1625
1640
|
function se(c) {
|
|
1626
1641
|
c.pointerType !== "mouse" && c.target.releasePointerCapture(c.pointerId);
|
|
1627
1642
|
}
|
|
1628
|
-
function
|
|
1629
|
-
m.dragElement && c.pointerType !== "mouse" &&
|
|
1643
|
+
function xe(c) {
|
|
1644
|
+
m.dragElement && c.pointerType !== "mouse" && Oe(c, "mouseenter");
|
|
1630
1645
|
}
|
|
1631
|
-
function
|
|
1646
|
+
function Ce(c) {
|
|
1632
1647
|
m.dragElement && c.pointerType !== "mouse" && (B.pointerLeaveTimeout = window.setTimeout(() => {
|
|
1633
|
-
delete B.pointerLeaveTimeout,
|
|
1648
|
+
delete B.pointerLeaveTimeout, Oe(c, "mouseleave");
|
|
1634
1649
|
}, 10));
|
|
1635
1650
|
}
|
|
1636
1651
|
class ae {
|
|
@@ -1670,7 +1685,7 @@ class ae {
|
|
|
1670
1685
|
}
|
|
1671
1686
|
}
|
|
1672
1687
|
ae.prefix = "ui-resizable-";
|
|
1673
|
-
class
|
|
1688
|
+
class fe {
|
|
1674
1689
|
constructor() {
|
|
1675
1690
|
this._eventRegister = {};
|
|
1676
1691
|
}
|
|
@@ -1698,7 +1713,7 @@ class ue {
|
|
|
1698
1713
|
return this._eventRegister[e](t);
|
|
1699
1714
|
}
|
|
1700
1715
|
}
|
|
1701
|
-
class
|
|
1716
|
+
class X extends fe {
|
|
1702
1717
|
// have to be public else complains for HTMLElementExtendOpt ?
|
|
1703
1718
|
constructor(e, t = {}) {
|
|
1704
1719
|
super(), this.el = e, this.option = t, this.rectScale = { x: 1, y: 1 }, this._ui = () => {
|
|
@@ -1799,7 +1814,7 @@ class Y extends ue {
|
|
|
1799
1814
|
}
|
|
1800
1815
|
/** @internal */
|
|
1801
1816
|
_setupHelper() {
|
|
1802
|
-
this.elOriginStyleVal =
|
|
1817
|
+
this.elOriginStyleVal = X._originStyleProp.map((i) => this.el.style[i]), this.parentOriginStylePosition = this.el.parentElement.style.position;
|
|
1803
1818
|
const e = this.el.parentElement, t = a.getValuesFromTransformedElement(e);
|
|
1804
1819
|
return this.rectScale = {
|
|
1805
1820
|
x: t.xScale,
|
|
@@ -1808,7 +1823,7 @@ class Y extends ue {
|
|
|
1808
1823
|
}
|
|
1809
1824
|
/** @internal */
|
|
1810
1825
|
_cleanHelper() {
|
|
1811
|
-
return
|
|
1826
|
+
return X._originStyleProp.forEach((e, t) => {
|
|
1812
1827
|
this.el.style[e] = this.elOriginStyleVal[t] || null;
|
|
1813
1828
|
}), this.el.parentElement.style.position = this.parentOriginStylePosition || null, this;
|
|
1814
1829
|
}
|
|
@@ -1847,9 +1862,9 @@ class Y extends ue {
|
|
|
1847
1862
|
return this.handlers.forEach((e) => e.destroy()), delete this.handlers, this;
|
|
1848
1863
|
}
|
|
1849
1864
|
}
|
|
1850
|
-
|
|
1851
|
-
const
|
|
1852
|
-
class
|
|
1865
|
+
X._originStyleProp = ["width", "height", "position", "left", "top", "opacity", "zIndex"];
|
|
1866
|
+
const Bt = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
1867
|
+
class j extends fe {
|
|
1853
1868
|
constructor(e, t = {}) {
|
|
1854
1869
|
var r;
|
|
1855
1870
|
super(), this.el = e, this.option = t, this.dragTransform = {
|
|
@@ -1886,7 +1901,7 @@ class X extends ue {
|
|
|
1886
1901
|
/** @internal call when mouse goes down before a dragstart happens */
|
|
1887
1902
|
_mouseDown(e) {
|
|
1888
1903
|
if (!m.mouseHandled)
|
|
1889
|
-
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(
|
|
1904
|
+
return e.button !== 0 || !this.dragEls.find((t) => t === e.target) && e.target.closest(Bt) || this.option.cancel && e.target.closest(this.option.cancel) || (this.mouseDownEvent = e, delete this.dragging, delete m.dragElement, delete m.dropElement, document.addEventListener("mousemove", this._mouseMove, { capture: !0, passive: !0 }), document.addEventListener("mouseup", this._mouseUp, !0), O && (e.currentTarget.addEventListener("touchmove", te), e.currentTarget.addEventListener("touchend", ie)), e.preventDefault(), document.activeElement && document.activeElement.blur(), m.mouseHandled = !0), !0;
|
|
1890
1905
|
}
|
|
1891
1906
|
/** @internal method to call actual drag event */
|
|
1892
1907
|
_callDrag(e) {
|
|
@@ -1939,7 +1954,7 @@ class X extends ue {
|
|
|
1939
1954
|
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
1940
1955
|
_createHelper() {
|
|
1941
1956
|
let e = this.el;
|
|
1942
|
-
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = a.cloneNode(this.el)), document.body.contains(e) || a.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle =
|
|
1957
|
+
return typeof this.option.helper == "function" ? e = this.option.helper(this.el) : this.option.helper === "clone" && (e = a.cloneNode(this.el)), document.body.contains(e) || a.appendTo(e, this.option.appendTo === "parent" ? this.el.parentElement : this.option.appendTo), this.dragElementOriginStyle = j.originStyleProp.map((t) => this.el.style[t]), e;
|
|
1943
1958
|
}
|
|
1944
1959
|
/** @internal set the fix position of the dragged item */
|
|
1945
1960
|
_setupHelperStyle(e) {
|
|
@@ -1956,7 +1971,7 @@ class X extends ue {
|
|
|
1956
1971
|
const e = (t = this.helper) == null ? void 0 : t.gridstackNode;
|
|
1957
1972
|
if (!(e != null && e._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
1958
1973
|
const i = this.helper, s = this.dragElementOriginStyle.transition || null;
|
|
1959
|
-
i.style.transition = this.dragElementOriginStyle.transition = "none",
|
|
1974
|
+
i.style.transition = this.dragElementOriginStyle.transition = "none", j.originStyleProp.forEach((r) => i.style[r] = this.dragElementOriginStyle[r] || null), setTimeout(() => i.style.transition = s, 50);
|
|
1960
1975
|
}
|
|
1961
1976
|
return delete this.dragElementOriginStyle, this;
|
|
1962
1977
|
}
|
|
@@ -1998,8 +2013,8 @@ class X extends ue {
|
|
|
1998
2013
|
};
|
|
1999
2014
|
}
|
|
2000
2015
|
}
|
|
2001
|
-
|
|
2002
|
-
class
|
|
2016
|
+
j.originStyleProp = ["width", "height", "transform", "transform-origin", "transition", "pointerEvents", "position", "left", "top", "minWidth", "willChange"];
|
|
2017
|
+
class qt extends fe {
|
|
2003
2018
|
constructor(e, t = {}) {
|
|
2004
2019
|
super(), this.el = e, this.option = t, this._mouseEnter = this._mouseEnter.bind(this), this._mouseLeave = this._mouseLeave.bind(this), this.enable(), this._setupAccept();
|
|
2005
2020
|
}
|
|
@@ -2010,10 +2025,10 @@ class It extends ue {
|
|
|
2010
2025
|
super.off(e);
|
|
2011
2026
|
}
|
|
2012
2027
|
enable() {
|
|
2013
|
-
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), O && (this.el.addEventListener("pointerenter",
|
|
2028
|
+
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), O && (this.el.addEventListener("pointerenter", xe), this.el.addEventListener("pointerleave", Ce)));
|
|
2014
2029
|
}
|
|
2015
2030
|
disable(e = !1) {
|
|
2016
|
-
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), O && (this.el.removeEventListener("pointerenter",
|
|
2031
|
+
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), O && (this.el.removeEventListener("pointerenter", xe), this.el.removeEventListener("pointerleave", Ce)));
|
|
2017
2032
|
}
|
|
2018
2033
|
destroy() {
|
|
2019
2034
|
this.disable(!0), this.el.classList.remove("ui-droppable"), this.el.classList.remove("ui-droppable-disabled"), super.destroy();
|
|
@@ -2065,9 +2080,9 @@ class It extends ue {
|
|
|
2065
2080
|
};
|
|
2066
2081
|
}
|
|
2067
2082
|
}
|
|
2068
|
-
class
|
|
2083
|
+
class ge {
|
|
2069
2084
|
static init(e) {
|
|
2070
|
-
return e.ddElement || (e.ddElement = new
|
|
2085
|
+
return e.ddElement || (e.ddElement = new ge(e)), e.ddElement;
|
|
2071
2086
|
}
|
|
2072
2087
|
constructor(e) {
|
|
2073
2088
|
this.el = e;
|
|
@@ -2079,25 +2094,25 @@ class ce {
|
|
|
2079
2094
|
return this.ddDraggable && ["drag", "dragstart", "dragstop"].indexOf(e) > -1 ? this.ddDraggable.off(e) : this.ddDroppable && ["drop", "dropover", "dropout"].indexOf(e) > -1 ? this.ddDroppable.off(e) : this.ddResizable && ["resizestart", "resize", "resizestop"].indexOf(e) > -1 && this.ddResizable.off(e), this;
|
|
2080
2095
|
}
|
|
2081
2096
|
setupDraggable(e) {
|
|
2082
|
-
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new
|
|
2097
|
+
return this.ddDraggable ? this.ddDraggable.updateOption(e) : this.ddDraggable = new j(this.el, e), this;
|
|
2083
2098
|
}
|
|
2084
2099
|
cleanDraggable() {
|
|
2085
2100
|
return this.ddDraggable && (this.ddDraggable.destroy(), delete this.ddDraggable), this;
|
|
2086
2101
|
}
|
|
2087
2102
|
setupResizable(e) {
|
|
2088
|
-
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new
|
|
2103
|
+
return this.ddResizable ? this.ddResizable.updateOption(e) : this.ddResizable = new X(this.el, e), this;
|
|
2089
2104
|
}
|
|
2090
2105
|
cleanResizable() {
|
|
2091
2106
|
return this.ddResizable && (this.ddResizable.destroy(), delete this.ddResizable), this;
|
|
2092
2107
|
}
|
|
2093
2108
|
setupDroppable(e) {
|
|
2094
|
-
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new
|
|
2109
|
+
return this.ddDroppable ? this.ddDroppable.updateOption(e) : this.ddDroppable = new qt(this.el, e), this;
|
|
2095
2110
|
}
|
|
2096
2111
|
cleanDroppable() {
|
|
2097
2112
|
return this.ddDroppable && (this.ddDroppable.destroy(), delete this.ddDroppable), this;
|
|
2098
2113
|
}
|
|
2099
2114
|
}
|
|
2100
|
-
class
|
|
2115
|
+
class Ut {
|
|
2101
2116
|
resizable(e, t, i, s) {
|
|
2102
2117
|
return this._getDDElements(e).forEach((r) => {
|
|
2103
2118
|
if (t === "disable" || t === "enable")
|
|
@@ -2178,7 +2193,7 @@ class Pt {
|
|
|
2178
2193
|
const i = a.getElements(e);
|
|
2179
2194
|
if (!i.length)
|
|
2180
2195
|
return [];
|
|
2181
|
-
const s = i.map((r) => r.ddElement || (t ?
|
|
2196
|
+
const s = i.map((r) => r.ddElement || (t ? ge.init(r) : null));
|
|
2182
2197
|
return t || s.filter((r) => r), s;
|
|
2183
2198
|
}
|
|
2184
2199
|
}
|
|
@@ -2189,7 +2204,7 @@ class Pt {
|
|
|
2189
2204
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
2190
2205
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
2191
2206
|
*/
|
|
2192
|
-
const k = new
|
|
2207
|
+
const k = new Ut();
|
|
2193
2208
|
class g {
|
|
2194
2209
|
/**
|
|
2195
2210
|
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
@@ -2254,7 +2269,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2254
2269
|
/** @internal create placeholder DIV as needed */
|
|
2255
2270
|
get placeholder() {
|
|
2256
2271
|
if (!this._placeholder) {
|
|
2257
|
-
this._placeholder = a.createDiv([this.opts.placeholderClass,
|
|
2272
|
+
this._placeholder = a.createDiv([this.opts.placeholderClass, H.itemClass, this.opts.itemClass]);
|
|
2258
2273
|
const e = a.createDiv(["placeholder-content"], this._placeholder);
|
|
2259
2274
|
this.opts.placeholderText && (e.textContent = this.opts.placeholderText);
|
|
2260
2275
|
}
|
|
@@ -2275,29 +2290,29 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2275
2290
|
if (r.oneColumnModeDomSort && (delete r.oneColumnModeDomSort, console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")), r.oneColumnSize || r.disableOneColumnMode === !1) {
|
|
2276
2291
|
const v = r.oneColumnSize || 768;
|
|
2277
2292
|
delete r.oneColumnSize, delete r.disableOneColumnMode, t.columnOpts = t.columnOpts || {}, s = t.columnOpts.breakpoints = t.columnOpts.breakpoints || [];
|
|
2278
|
-
let b = s.find((
|
|
2293
|
+
let b = s.find((y) => y.c === 1);
|
|
2279
2294
|
b ? b.w = v : (b = { c: 1, w: v }, s.push(b, { c: 12, w: v + 1 }));
|
|
2280
2295
|
}
|
|
2281
2296
|
const o = t.columnOpts;
|
|
2282
2297
|
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((v, b) => (b.w || 0) - (v.w || 0));
|
|
2283
2298
|
const n = {
|
|
2284
|
-
...a.cloneDeep(
|
|
2285
|
-
column: a.toNumber(e.getAttribute("gs-column")) ||
|
|
2286
|
-
minRow: i || a.toNumber(e.getAttribute("gs-min-row")) ||
|
|
2287
|
-
maxRow: i || a.toNumber(e.getAttribute("gs-max-row")) ||
|
|
2288
|
-
staticGrid: a.toBool(e.getAttribute("gs-static")) ||
|
|
2299
|
+
...a.cloneDeep(H),
|
|
2300
|
+
column: a.toNumber(e.getAttribute("gs-column")) || H.column,
|
|
2301
|
+
minRow: i || a.toNumber(e.getAttribute("gs-min-row")) || H.minRow,
|
|
2302
|
+
maxRow: i || a.toNumber(e.getAttribute("gs-max-row")) || H.maxRow,
|
|
2303
|
+
staticGrid: a.toBool(e.getAttribute("gs-static")) || H.staticGrid,
|
|
2289
2304
|
sizeToContent: a.toBool(e.getAttribute("gs-size-to-content")) || void 0,
|
|
2290
2305
|
draggable: {
|
|
2291
|
-
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") ||
|
|
2306
|
+
handle: (t.handleClass ? "." + t.handleClass : t.handle ? t.handle : "") || H.draggable.handle
|
|
2292
2307
|
},
|
|
2293
2308
|
removableOptions: {
|
|
2294
|
-
accept: t.itemClass ||
|
|
2295
|
-
decline:
|
|
2309
|
+
accept: t.itemClass || H.removableOptions.accept,
|
|
2310
|
+
decline: H.removableOptions.decline
|
|
2296
2311
|
}
|
|
2297
2312
|
};
|
|
2298
2313
|
e.getAttribute("gs-animate") && (n.animate = a.toBool(e.getAttribute("gs-animate"))), t = a.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");
|
|
2299
|
-
const l = this.el.closest("." +
|
|
2300
|
-
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 !==
|
|
2314
|
+
const l = this.el.closest("." + H.itemClass), h = l == null ? void 0 : l.gridstackNode;
|
|
2315
|
+
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 !== H.cellHeightUnit && (t.cellHeight = t.cellHeight + t.cellHeightUnit, delete t.cellHeightUnit), this.cellHeight(t.cellHeight, !1)), t.alwaysShowResizeHandle === "mobile" && (t.alwaysShowResizeHandle = O), this._styleSheetClass = "gs-id-" + P._idSeq++, this.el.classList.add(this._styleSheetClass), this._setStaticClass();
|
|
2301
2316
|
const d = t.engineClass || g.engineClass || P;
|
|
2302
2317
|
if (this.engine = new d({
|
|
2303
2318
|
column: this.getColumn(),
|
|
@@ -2305,11 +2320,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2305
2320
|
maxRow: t.maxRow,
|
|
2306
2321
|
onChange: (v) => {
|
|
2307
2322
|
let b = 0;
|
|
2308
|
-
this.engine.nodes.forEach((
|
|
2309
|
-
b = Math.max(b,
|
|
2310
|
-
}), v.forEach((
|
|
2311
|
-
const w =
|
|
2312
|
-
w && (
|
|
2323
|
+
this.engine.nodes.forEach((y) => {
|
|
2324
|
+
b = Math.max(b, y.y + y.h);
|
|
2325
|
+
}), v.forEach((y) => {
|
|
2326
|
+
const w = y.el;
|
|
2327
|
+
w && (y._removeDOM ? (w && w.remove(), delete y._removeDOM) : this._writePosAttr(w, y));
|
|
2313
2328
|
}), this._updateStyles(!1, b);
|
|
2314
2329
|
}
|
|
2315
2330
|
}), this._updateStyles(!1, 0), t.auto && (this.batchUpdate(), this.engine._loading = !0, this.getGridItems().forEach((v) => this._prepareElement(v)), delete this.engine._loading, this.batchUpdate(!1)), t.children) {
|
|
@@ -2379,8 +2394,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2379
2394
|
t.column === "auto" && (l = !0, t.column = Math.max(r.w || 1, (i == null ? void 0 : i.w) || 1), delete t.columnOpts);
|
|
2380
2395
|
let h = r.el.querySelector(".grid-stack-item-content"), d, u;
|
|
2381
2396
|
if (s && (this._removeDD(r.el), u = { ...r, x: 0, y: 0 }, a.removeInternalForSave(u), delete u.subGridOpts, r.content && (u.content = r.content, delete r.content), g.addRemoveCB ? d = g.addRemoveCB(this.el, u, !0, !1) : (d = a.createDiv(["grid-stack-item"]), d.appendChild(h), h = a.createDiv(["grid-stack-item-content"], r.el)), this._prepareDragDropByNode(r)), i) {
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2397
|
+
const y = l ? t.column : r.w, w = r.h + i.h, E = r.el.style;
|
|
2398
|
+
E.transition = "none", this.update(r.el, { w: y, h: w }), setTimeout(() => E.transition = null);
|
|
2384
2399
|
}
|
|
2385
2400
|
const f = r.subGrid = g.addGrid(h, t);
|
|
2386
2401
|
return i != null && i._moving && (f._isTemp = !0), l && (f._autoColumn = !0), s && f.makeWidget(d, u), i && (i._moving ? window.setTimeout(() => a.simulateMouseEvent(i._event, "mouseenter", f.el), 0) : f.makeWidget(r.el, r)), this.resizeToContentCheck(!1, r), f;
|
|
@@ -2421,7 +2436,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2421
2436
|
const r = a.cloneDeep(this.opts);
|
|
2422
2437
|
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");
|
|
2423
2438
|
const o = r._alwaysShowResizeHandle;
|
|
2424
|
-
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, a.removeInternalAndSame(r,
|
|
2439
|
+
return delete r._alwaysShowResizeHandle, o !== void 0 ? r.alwaysShowResizeHandle = o : delete r.alwaysShowResizeHandle, a.removeInternalAndSame(r, H), r.children = s, r;
|
|
2425
2440
|
}
|
|
2426
2441
|
return s;
|
|
2427
2442
|
}
|
|
@@ -2968,7 +2983,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
2968
2983
|
}
|
|
2969
2984
|
/** @internal */
|
|
2970
2985
|
_prepareElement(e, t = !1, i) {
|
|
2971
|
-
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(
|
|
2986
|
+
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(H.itemClass, this.opts.itemClass);
|
|
2972
2987
|
const s = a.shouldSizeToContent(i);
|
|
2973
2988
|
return s ? e.classList.add("size-to-content") : e.classList.remove("size-to-content"), s && this.resizeToContentCheck(!1, i), this._prepareDragDropByNode(i), this;
|
|
2974
2989
|
}
|
|
@@ -3257,8 +3272,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3257
3272
|
d && this.setAnimation(!1);
|
|
3258
3273
|
const u = r._gridstackNodeOrig;
|
|
3259
3274
|
if (delete r._gridstackNodeOrig, l && (u != null && u.grid) && u.grid !== this) {
|
|
3260
|
-
const
|
|
3261
|
-
|
|
3275
|
+
const y = u.grid;
|
|
3276
|
+
y.engine.removeNodeFromLayoutCache(u), y.engine.removedNodes.push(u), y._triggerRemoveEvent()._triggerChangeEvent(), y.parentGridNode && !y.engine.nodes.length && y.opts.subGridDynamic && y.removeAsSubGrid();
|
|
3262
3277
|
}
|
|
3263
3278
|
if (!n || (l && (this.engine.cleanupNode(n), n.grid = this), (_ = n.grid) == null || delete _._isTemp, k.off(r, "drag"), o !== r ? (o.remove(), r = o) : r.remove(), this._removeDD(r), !l))
|
|
3264
3279
|
return !1;
|
|
@@ -3343,15 +3358,15 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3343
3358
|
if (h = Math.min(h, v), d = Math.min(d, v), u = Math.min(u, _), f = Math.min(f, _), t.type === "drag") {
|
|
3344
3359
|
if (s._temporaryRemoved)
|
|
3345
3360
|
return;
|
|
3346
|
-
const
|
|
3347
|
-
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && a.updateScrollPosition(e, i.position,
|
|
3348
|
-
const w = i.position.left + (i.position.left > s._lastUiPosition.left ? -d : h),
|
|
3349
|
-
n.x = Math.round(w / r), n.y = Math.round(
|
|
3361
|
+
const y = i.position.top - s._prevYPix;
|
|
3362
|
+
s._prevYPix = i.position.top, this.opts.draggable.scroll !== !1 && a.updateScrollPosition(e, i.position, y);
|
|
3363
|
+
const w = i.position.left + (i.position.left > s._lastUiPosition.left ? -d : h), E = i.position.top + (i.position.top > s._lastUiPosition.top ? -f : u);
|
|
3364
|
+
n.x = Math.round(w / r), n.y = Math.round(E / o);
|
|
3350
3365
|
const D = this._extraDragRow;
|
|
3351
3366
|
if (this.engine.collide(s, n)) {
|
|
3352
|
-
const
|
|
3353
|
-
let R = Math.max(0, n.y + s.h -
|
|
3354
|
-
this.opts.maxRow &&
|
|
3367
|
+
const S = this.getRow();
|
|
3368
|
+
let R = Math.max(0, n.y + s.h - S);
|
|
3369
|
+
this.opts.maxRow && S + R > this.opts.maxRow && (R = Math.max(0, this.opts.maxRow - S)), this._extraDragRow = R;
|
|
3355
3370
|
} else
|
|
3356
3371
|
this._extraDragRow = 0;
|
|
3357
3372
|
if (this._extraDragRow !== D && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
@@ -3359,8 +3374,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3359
3374
|
} else if (t.type === "resize") {
|
|
3360
3375
|
if (n.x < 0 || (a.updateScrollResize(t, e, o), n.w = Math.round((i.size.width - h) / r), n.h = Math.round((i.size.height - u) / o), s.w === n.w && s.h === n.h) || s._lastTried && s._lastTried.w === n.w && s._lastTried.h === n.h)
|
|
3361
3376
|
return;
|
|
3362
|
-
const
|
|
3363
|
-
n.x = Math.round(
|
|
3377
|
+
const y = i.position.left + h, w = i.position.top + u;
|
|
3378
|
+
n.x = Math.round(y / r), n.y = Math.round(w / o), l = !0;
|
|
3364
3379
|
}
|
|
3365
3380
|
s._event = t, s._lastTried = n;
|
|
3366
3381
|
const b = {
|
|
@@ -3371,8 +3386,8 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3371
3386
|
};
|
|
3372
3387
|
if (this.engine.moveNodeCheck(s, { ...n, cellWidth: r, cellHeight: o, rect: b, resizing: l })) {
|
|
3373
3388
|
s._lastUiPosition = i.position, this.engine.cacheRects(r, o, u, d, f, h), delete s._skipDown, l && s.subGrid && s.subGrid.onResize(), this._extraDragRow = 0, this._updateContainerHeight();
|
|
3374
|
-
const
|
|
3375
|
-
this._writePosAttr(
|
|
3389
|
+
const y = t.target;
|
|
3390
|
+
this._writePosAttr(y, s), this._gsEventHandler[t.type] && this._gsEventHandler[t.type](t, y);
|
|
3376
3391
|
}
|
|
3377
3392
|
}
|
|
3378
3393
|
/** @internal called when item leaving our area by either cursor dropout event
|
|
@@ -3386,7 +3401,7 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
3386
3401
|
}
|
|
3387
3402
|
// legacy method removed
|
|
3388
3403
|
commit() {
|
|
3389
|
-
return
|
|
3404
|
+
return Pt(this, this.batchUpdate(!1), "commit", "batchUpdate", "5.2"), this;
|
|
3390
3405
|
}
|
|
3391
3406
|
}
|
|
3392
3407
|
g.renderCB = (c, e) => {
|
|
@@ -3396,7 +3411,7 @@ g.resizeToContentParent = ".grid-stack-item-content";
|
|
|
3396
3411
|
g.Utils = a;
|
|
3397
3412
|
g.Engine = P;
|
|
3398
3413
|
g.GDRev = "11.3.0";
|
|
3399
|
-
const
|
|
3414
|
+
const Ft = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], $t = { class: "grid-stack-item-content" }, Gt = /* @__PURE__ */ M({
|
|
3400
3415
|
__name: "DraggableGridLayout",
|
|
3401
3416
|
props: {
|
|
3402
3417
|
tiles: {},
|
|
@@ -3405,13 +3420,15 @@ const Bt = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], qt = { class: "grid-s
|
|
|
3405
3420
|
},
|
|
3406
3421
|
emits: ["update-tiles"],
|
|
3407
3422
|
setup(c, { emit: e }) {
|
|
3408
|
-
const t = c, i = e, s =
|
|
3423
|
+
const t = c, i = e, s = L(null);
|
|
3409
3424
|
let r = null;
|
|
3410
|
-
return
|
|
3425
|
+
return Se(() => {
|
|
3411
3426
|
s.value && (r = g.init({
|
|
3412
3427
|
column: t.gridSize.cols,
|
|
3413
3428
|
cellHeight: t.tileHeight,
|
|
3414
|
-
resizable: { handles: "
|
|
3429
|
+
resizable: { handles: "se" },
|
|
3430
|
+
lazyLoad: !0,
|
|
3431
|
+
handle: ".tile-header"
|
|
3415
3432
|
}, s.value), r.on("change", (o, n) => {
|
|
3416
3433
|
const l = t.tiles.map((h, d) => {
|
|
3417
3434
|
const u = n.find((f) => {
|
|
@@ -3428,9 +3445,9 @@ const Bt = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], qt = { class: "grid-s
|
|
|
3428
3445
|
});
|
|
3429
3446
|
i("update-tiles", l);
|
|
3430
3447
|
}));
|
|
3431
|
-
}),
|
|
3448
|
+
}), he(() => {
|
|
3432
3449
|
r && r.destroy(!1);
|
|
3433
|
-
}),
|
|
3450
|
+
}), de(() => t.tiles, (o) => {
|
|
3434
3451
|
r && s.value && o.forEach((n, l) => {
|
|
3435
3452
|
var d;
|
|
3436
3453
|
const h = (d = s.value) == null ? void 0 : d.querySelector(`[data-index="${l}"]`);
|
|
@@ -3441,12 +3458,12 @@ const Bt = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], qt = { class: "grid-s
|
|
|
3441
3458
|
h: n.layout.size.rows
|
|
3442
3459
|
}));
|
|
3443
3460
|
});
|
|
3444
|
-
}, { deep: !0 }), (o, n) => (
|
|
3461
|
+
}, { deep: !0 }), (o, n) => (x(), A("div", {
|
|
3445
3462
|
ref_key: "gridContainer",
|
|
3446
3463
|
ref: s,
|
|
3447
3464
|
class: "grid-stack"
|
|
3448
3465
|
}, [
|
|
3449
|
-
(
|
|
3466
|
+
(x(!0), A(Te, null, ke(o.tiles, (l, h) => (x(), A("div", {
|
|
3450
3467
|
key: "tile-" + h,
|
|
3451
3468
|
class: "grid-stack-item",
|
|
3452
3469
|
"data-index": h,
|
|
@@ -3455,16 +3472,16 @@ const Bt = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], qt = { class: "grid-s
|
|
|
3455
3472
|
"gs-x": l.layout.position.col,
|
|
3456
3473
|
"gs-y": l.layout.position.row
|
|
3457
3474
|
}, [
|
|
3458
|
-
|
|
3459
|
-
ne(o.$slots, "tile", { tile: l })
|
|
3475
|
+
Y("div", $t, [
|
|
3476
|
+
ne(o.$slots, "tile", { tile: l }, void 0, !0)
|
|
3460
3477
|
])
|
|
3461
|
-
], 8,
|
|
3478
|
+
], 8, Ft))), 128))
|
|
3462
3479
|
], 512));
|
|
3463
3480
|
}
|
|
3464
|
-
}),
|
|
3481
|
+
}), Wt = /* @__PURE__ */ V(Gt, [["__scopeId", "data-v-2c11d103"]]), Kt = { class: "kong-ui-public-dashboard-renderer" }, Vt = {
|
|
3465
3482
|
key: 0,
|
|
3466
3483
|
class: "tile-container"
|
|
3467
|
-
},
|
|
3484
|
+
}, Yt = /* @__PURE__ */ M({
|
|
3468
3485
|
__name: "DashboardRenderer",
|
|
3469
3486
|
props: {
|
|
3470
3487
|
context: {},
|
|
@@ -3473,99 +3490,99 @@ const Bt = ["data-index", "gs-h", "gs-w", "gs-x", "gs-y"], qt = { class: "grid-s
|
|
|
3473
3490
|
},
|
|
3474
3491
|
emits: ["edit-tile", "update-tiles"],
|
|
3475
3492
|
setup(c, { expose: e, emit: t }) {
|
|
3476
|
-
const i = c, s = t, { i18n: r } =
|
|
3493
|
+
const i = c, s = t, { i18n: r } = $.useI18n(), o = L(0), n = Q(J);
|
|
3477
3494
|
n || (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"));
|
|
3478
|
-
const l =
|
|
3495
|
+
const l = nt(), h = z(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
3479
3496
|
type: "relative",
|
|
3480
3497
|
time_range: l.defaultQueryTimeForOrg
|
|
3481
|
-
}), d =
|
|
3498
|
+
}), d = z(() => !!i.context.timeSpec || !l.loading), u = z(() => i.config.tiles.map((y, w) => {
|
|
3482
3499
|
var D;
|
|
3483
|
-
let
|
|
3484
|
-
if ("description" in
|
|
3485
|
-
const
|
|
3486
|
-
const
|
|
3487
|
-
return r.te(
|
|
3500
|
+
let E = y.definition;
|
|
3501
|
+
if ("description" in E.chart) {
|
|
3502
|
+
const S = (D = E.chart.description) == null ? void 0 : D.replace(pt, () => {
|
|
3503
|
+
const G = `renderer.trendRange.${h.value.type === "absolute" ? "custom" : h.value.time_range}`;
|
|
3504
|
+
return r.te(G) ? r.t(G) : "";
|
|
3488
3505
|
});
|
|
3489
|
-
|
|
3490
|
-
...
|
|
3506
|
+
E = {
|
|
3507
|
+
...E,
|
|
3491
3508
|
chart: {
|
|
3492
|
-
...
|
|
3493
|
-
description:
|
|
3509
|
+
...E.chart,
|
|
3510
|
+
description: S
|
|
3494
3511
|
}
|
|
3495
3512
|
};
|
|
3496
3513
|
}
|
|
3497
3514
|
return {
|
|
3498
|
-
layout:
|
|
3499
|
-
meta:
|
|
3515
|
+
layout: y.layout,
|
|
3516
|
+
meta: E,
|
|
3500
3517
|
// Add a unique key to each tile internally.
|
|
3501
3518
|
id: w
|
|
3502
3519
|
};
|
|
3503
|
-
})), f =
|
|
3504
|
-
let { tz:
|
|
3505
|
-
return
|
|
3520
|
+
})), f = z(() => {
|
|
3521
|
+
let { tz: y, refreshInterval: w, editable: E } = i.context;
|
|
3522
|
+
return y || (y = new Intl.DateTimeFormat().resolvedOptions().timeZone), w === void 0 && (w = mt), E === void 0 && (E = !1), {
|
|
3506
3523
|
...i.context,
|
|
3507
|
-
tz:
|
|
3524
|
+
tz: y,
|
|
3508
3525
|
timeSpec: h.value,
|
|
3509
3526
|
refreshInterval: w,
|
|
3510
|
-
editable:
|
|
3527
|
+
editable: E
|
|
3511
3528
|
};
|
|
3512
|
-
}), _ = (
|
|
3513
|
-
s("edit-tile",
|
|
3529
|
+
}), _ = (y) => {
|
|
3530
|
+
s("edit-tile", y);
|
|
3514
3531
|
}, v = () => {
|
|
3515
3532
|
o.value++;
|
|
3516
|
-
}, b = (
|
|
3517
|
-
const w =
|
|
3518
|
-
layout:
|
|
3519
|
-
definition:
|
|
3533
|
+
}, b = (y) => {
|
|
3534
|
+
const w = y.map((E) => ({
|
|
3535
|
+
layout: E.layout,
|
|
3536
|
+
definition: E.meta
|
|
3520
3537
|
}));
|
|
3521
3538
|
s("update-tiles", w);
|
|
3522
3539
|
};
|
|
3523
|
-
return e({ refresh: v }), (
|
|
3524
|
-
const
|
|
3525
|
-
return
|
|
3526
|
-
|
|
3540
|
+
return e({ refresh: v }), (y, w) => {
|
|
3541
|
+
const E = F("KAlert");
|
|
3542
|
+
return x(), A("div", Kt, [
|
|
3543
|
+
C(n) ? (x(), T(ze(y.draggable ? Wt : It), {
|
|
3527
3544
|
key: 1,
|
|
3528
|
-
"grid-size":
|
|
3529
|
-
"tile-height":
|
|
3545
|
+
"grid-size": y.config.gridSize,
|
|
3546
|
+
"tile-height": y.config.tileHeight,
|
|
3530
3547
|
tiles: u.value,
|
|
3531
3548
|
onUpdateTiles: b
|
|
3532
3549
|
}, {
|
|
3533
|
-
tile:
|
|
3534
|
-
D.meta.chart.type === "slottable" ? (
|
|
3535
|
-
ne(
|
|
3536
|
-
])) : (
|
|
3550
|
+
tile: N(({ tile: D }) => [
|
|
3551
|
+
D.meta.chart.type === "slottable" ? (x(), A("div", Vt, [
|
|
3552
|
+
ne(y.$slots, D.meta.chart.id, {}, void 0, !0)
|
|
3553
|
+
])) : (x(), T(Lt, {
|
|
3537
3554
|
key: 1,
|
|
3538
3555
|
class: "tile-container",
|
|
3539
3556
|
context: f.value,
|
|
3540
3557
|
definition: D.meta,
|
|
3541
|
-
height: D.layout.size.rows * (
|
|
3558
|
+
height: D.layout.size.rows * (y.config.tileHeight || C(ue)) + parseInt(C(Le), 10),
|
|
3542
3559
|
"query-ready": d.value,
|
|
3543
3560
|
"refresh-counter": o.value,
|
|
3544
3561
|
"tile-id": D.id,
|
|
3545
|
-
onEditTile: (
|
|
3562
|
+
onEditTile: (S) => _(D)
|
|
3546
3563
|
}, null, 8, ["context", "definition", "height", "query-ready", "refresh-counter", "tile-id", "onEditTile"]))
|
|
3547
3564
|
]),
|
|
3548
3565
|
_: 3
|
|
3549
|
-
}, 40, ["grid-size", "tile-height", "tiles"])) : (
|
|
3566
|
+
}, 40, ["grid-size", "tile-height", "tiles"])) : (x(), T(E, {
|
|
3550
3567
|
key: 0,
|
|
3551
3568
|
appearance: "danger"
|
|
3552
3569
|
}, {
|
|
3553
|
-
default:
|
|
3554
|
-
re(
|
|
3570
|
+
default: N(() => [
|
|
3571
|
+
re(K(C(r).t("renderer.noQueryBridge")), 1)
|
|
3555
3572
|
]),
|
|
3556
3573
|
_: 1
|
|
3557
3574
|
}))
|
|
3558
3575
|
]);
|
|
3559
3576
|
};
|
|
3560
3577
|
}
|
|
3561
|
-
}),
|
|
3578
|
+
}), oi = /* @__PURE__ */ V(Yt, [["__scopeId", "data-v-921334ea"]]);
|
|
3562
3579
|
export {
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3580
|
+
gt as CP_ID_TOKEN,
|
|
3581
|
+
ue as DEFAULT_TILE_HEIGHT,
|
|
3582
|
+
mt as DEFAULT_TILE_REFRESH_INTERVAL_MS,
|
|
3583
|
+
oi as DashboardRenderer,
|
|
3584
|
+
_e as ENTITY_ID_TOKEN,
|
|
3585
|
+
It as GridLayout,
|
|
3586
|
+
J as INJECT_QUERY_PROVIDER,
|
|
3587
|
+
pt as TIMEFRAME_TOKEN
|
|
3571
3588
|
};
|