@lumal/cockpit 0.0.1-beta → 0.0.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/cockpit.css +1 -1
- package/dist/designer.cjs +1 -1
- package/dist/designer.js +613 -546
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/{resolveComponent-QbJRsdxR.js → resolveComponent-BZJb6nHc.js} +102 -90
- package/dist/resolveComponent-BwChMZGV.cjs +1 -0
- package/dist/runtime-CZWB99yu.cjs +1 -0
- package/dist/{runtime-CXiih7DE.js → runtime-jYdPGqNX.js} +167 -155
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +2 -2
- package/dist/src/composables/index.d.ts +2 -2
- package/dist/src/composables/index.d.ts.map +1 -1
- package/dist/src/composables/useCanvasScale.d.ts +2 -1
- package/dist/src/composables/useCanvasScale.d.ts.map +1 -1
- package/dist/src/composables/useCockpitAutoRefresh.d.ts +1 -1
- package/dist/src/composables/useCockpitAutoRefresh.d.ts.map +1 -1
- package/dist/src/composables/useCockpitRefresh.d.ts +1 -1
- package/dist/src/composables/useCockpitRefresh.d.ts.map +1 -1
- package/dist/src/designer/CockpitComponentLibrary.vue.d.ts.map +1 -1
- package/dist/src/designer/CockpitLayoutEditor.vue.d.ts.map +1 -1
- package/dist/src/designer/CockpitWidgetPreview.vue.d.ts +3 -1
- package/dist/src/designer/CockpitWidgetPreview.vue.d.ts.map +1 -1
- package/dist/src/designer/LumalCockpitDesigner.vue.d.ts +2 -2
- package/dist/src/designer/useCockpitDraft.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/runtime/LumalCockpit.vue.d.ts.map +1 -1
- package/dist/src/runtime/LumalCockpitContainer.vue.d.ts.map +1 -1
- package/dist/src/runtime/LumalCockpitWidgetHost.vue.d.ts.map +1 -1
- package/dist/{validate-DkC_IHrC.js → validate-DRblcHTt.js} +1 -1
- package/dist/{validate-KSzm5SZW.cjs → validate-Df_kkc31.cjs} +1 -1
- package/package.json +3 -3
- package/dist/resolveComponent-BF1aCxAk.cjs +0 -1
- package/dist/runtime-wzWMTWrS.cjs +0 -1
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r, v as i, x as a } from "./resolveComponent-
|
|
2
|
-
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createTextVNode as p, createVNode as m, defineComponent as h, guardReactiveProps as g, inject as _, mergeModels as v, nextTick as y, normalizeClass as b, normalizeProps as x, normalizeStyle as S, onBeforeUnmount as C, openBlock as w, provide as ee, reactive as T, ref as E, renderList as D, renderSlot as O, resolveDynamicComponent as k,
|
|
3
|
-
import { ElButton as
|
|
4
|
-
import { LumalIcon as
|
|
5
|
-
//#region src/
|
|
6
|
-
var V = "cockpit:refresh", H = 300 * 1e3;
|
|
1
|
+
import { i as e, n as t, r as n, t as r, v as i, x as a } from "./resolveComponent-BZJb6nHc.js";
|
|
2
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createTextVNode as p, createVNode as m, defineComponent as h, guardReactiveProps as g, inject as _, mergeModels as v, nextTick as y, normalizeClass as b, normalizeProps as x, normalizeStyle as S, onBeforeUnmount as C, openBlock as w, provide as ee, reactive as T, ref as E, renderList as D, renderSlot as O, resolveDynamicComponent as k, shallowReactive as A, shallowRef as j, toDisplayString as M, toValue as N, unref as P, useId as F, useModel as I, useSlots as te, vShow as L, watch as R, watchEffect as z, withCtx as B, withDirectives as V } from "vue";
|
|
3
|
+
import { ElButton as H, ElSwitch as ne, ElTooltip as re } from "element-plus";
|
|
4
|
+
import { LumalIcon as ie } from "@lumal/icons-vue";
|
|
5
|
+
//#region src/composables/useCockpit.ts
|
|
7
6
|
function U(e) {
|
|
7
|
+
let t = s(() => {
|
|
8
|
+
let t = e.config().layouts;
|
|
9
|
+
if (!t.length) return;
|
|
10
|
+
let n = e.activeLayoutId.value ?? e.config().activeLayoutId;
|
|
11
|
+
return t.find((e) => e.id === n) ?? t[0];
|
|
12
|
+
});
|
|
13
|
+
function n(t) {
|
|
14
|
+
e.activeLayoutId.value = t;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
activeLayout: t,
|
|
18
|
+
selectLayout: n
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/messaging/topics.ts
|
|
23
|
+
var W = "cockpit:refresh", G = 300 * 1e3;
|
|
24
|
+
function K(e) {
|
|
8
25
|
let t = e.enabled ?? E(e.defaultEnabled ?? !1), n;
|
|
9
26
|
function r(t = "manual") {
|
|
10
27
|
let n = {
|
|
@@ -12,8 +29,8 @@ function U(e) {
|
|
|
12
29
|
at: Date.now()
|
|
13
30
|
};
|
|
14
31
|
e.messages.publish({
|
|
15
|
-
topic:
|
|
16
|
-
sourceId:
|
|
32
|
+
topic: W,
|
|
33
|
+
sourceId: N(e.sourceId),
|
|
17
34
|
payload: n
|
|
18
35
|
});
|
|
19
36
|
}
|
|
@@ -22,48 +39,36 @@ function U(e) {
|
|
|
22
39
|
}
|
|
23
40
|
function a() {
|
|
24
41
|
i();
|
|
25
|
-
let t = Math.max(1e3,
|
|
42
|
+
let t = Math.max(1e3, N(e.intervalMs) ?? 3e5);
|
|
26
43
|
n = setInterval(() => {
|
|
27
|
-
r("interval");
|
|
44
|
+
typeof document < "u" && document.hidden || r("interval");
|
|
28
45
|
}, t);
|
|
29
46
|
}
|
|
30
|
-
|
|
47
|
+
function o() {
|
|
48
|
+
!document.hidden && t.value && r("interval");
|
|
49
|
+
}
|
|
50
|
+
return typeof document < "u" && document.addEventListener("visibilitychange", o), R(t, (e) => {
|
|
31
51
|
e ? a() : i();
|
|
32
|
-
}, { immediate: !0 }),
|
|
52
|
+
}, { immediate: !0 }), R(() => N(e.intervalMs), () => {
|
|
33
53
|
t.value && a();
|
|
34
|
-
}), C(
|
|
54
|
+
}), C(() => {
|
|
55
|
+
i(), typeof document < "u" && document.removeEventListener("visibilitychange", o);
|
|
56
|
+
}), {
|
|
35
57
|
enabled: t,
|
|
36
58
|
refreshNow: r
|
|
37
59
|
};
|
|
38
60
|
}
|
|
39
61
|
//#endregion
|
|
40
|
-
//#region src/composables/useCockpit.ts
|
|
41
|
-
function W(e) {
|
|
42
|
-
let t = s(() => {
|
|
43
|
-
let t = e.config().layouts;
|
|
44
|
-
if (!t.length) return;
|
|
45
|
-
let n = e.activeLayoutId.value ?? e.config().activeLayoutId;
|
|
46
|
-
return t.find((e) => e.id === n) ?? t[0];
|
|
47
|
-
});
|
|
48
|
-
function n(t) {
|
|
49
|
-
e.activeLayoutId.value = t;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
activeLayout: t,
|
|
53
|
-
selectLayout: n
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
62
|
//#region src/runtime/context.ts
|
|
58
|
-
var
|
|
59
|
-
function
|
|
60
|
-
let e = _(
|
|
63
|
+
var q = Symbol("lumal-cockpit-runtime-env");
|
|
64
|
+
function J() {
|
|
65
|
+
let e = _(q, null);
|
|
61
66
|
if (!e) throw Error("[cockpit] 运行时环境缺失,组件必须在 LumalCockpit 内渲染。");
|
|
62
67
|
return e;
|
|
63
68
|
}
|
|
64
69
|
//#endregion
|
|
65
70
|
//#region src/runtime/LumalCockpitWidgetHost.vue?vue&type=script&setup=true&lang.ts
|
|
66
|
-
var
|
|
71
|
+
var Y = [
|
|
67
72
|
"data-widget-type",
|
|
68
73
|
"data-instance-id",
|
|
69
74
|
"data-cockpit-node-id",
|
|
@@ -76,7 +81,7 @@ var ie = [
|
|
|
76
81
|
key: 1,
|
|
77
82
|
class: "lumal-cockpit-widget__error",
|
|
78
83
|
role: "alert"
|
|
79
|
-
},
|
|
84
|
+
}, X = /* @__PURE__ */ h({
|
|
80
85
|
__name: "LumalCockpitWidgetHost",
|
|
81
86
|
props: {
|
|
82
87
|
layoutId: {},
|
|
@@ -85,17 +90,19 @@ var ie = [
|
|
|
85
90
|
embedded: { type: Boolean }
|
|
86
91
|
},
|
|
87
92
|
setup(e) {
|
|
88
|
-
let n = e, a =
|
|
93
|
+
let n = e, a = J(), l = s(() => a.registry.resolveWidget(n.widget.type)), h = s(() => {
|
|
89
94
|
let e = l.value;
|
|
90
95
|
return e ? r(e.component) : null;
|
|
91
|
-
}), _ =
|
|
96
|
+
}), _ = A({
|
|
92
97
|
cockpitId: a.cockpitId,
|
|
93
98
|
layoutId: n.layoutId,
|
|
94
99
|
instanceId: n.widget.id,
|
|
95
100
|
mode: a.mode,
|
|
96
101
|
messages: a.messages
|
|
97
|
-
})
|
|
98
|
-
|
|
102
|
+
});
|
|
103
|
+
z(() => {
|
|
104
|
+
_.cockpitId = a.cockpitId, _.layoutId = n.layoutId, _.instanceId = n.widget.id, _.mode = a.mode, _.messages = a.messages;
|
|
105
|
+
}), i(_), C(() => {
|
|
99
106
|
a.messages.clearInstance(n.widget.id);
|
|
100
107
|
});
|
|
101
108
|
let v = s(() => n.widget.title ?? l.value?.label ?? n.widget.type), y = s(() => n.embedded ? "div" : a.cardComponent), b = s(() => n.embedded ? { class: "lumal-cockpit-widget__embedded" } : {
|
|
@@ -110,38 +117,38 @@ var ie = [
|
|
|
110
117
|
"data-cockpit-node-id": e.widget.id,
|
|
111
118
|
"data-cockpit-side": e.side
|
|
112
119
|
}, [(w(), c(k(y.value), x(g(b.value)), f({
|
|
113
|
-
default:
|
|
114
|
-
error:
|
|
120
|
+
default: B(() => [d("div", ae, [l.value ? (w(), c(t, { key: 1 }, {
|
|
121
|
+
error: B(({ retry: t }) => [P(a).slots.error ? (w(), c(k(P(a).slots.error), {
|
|
115
122
|
key: 0,
|
|
116
123
|
retry: t,
|
|
117
124
|
"instance-id": e.widget.id
|
|
118
|
-
}, null, 8, ["retry", "instance-id"])) : (w(), u("div", se, [r[1] ||= d("span", null, "模块加载失败", -1), m(
|
|
125
|
+
}, null, 8, ["retry", "instance-id"])) : (w(), u("div", se, [r[1] ||= d("span", null, "模块加载失败", -1), m(P(H), {
|
|
119
126
|
text: "",
|
|
120
127
|
type: "primary",
|
|
121
128
|
onClick: t
|
|
122
129
|
}, {
|
|
123
|
-
default:
|
|
130
|
+
default: B(() => [m(P(ie), {
|
|
124
131
|
name: "lumal:refresh",
|
|
125
132
|
size: 14
|
|
126
133
|
}), r[0] ||= p(" 重试 ", -1)]),
|
|
127
134
|
_: 1
|
|
128
135
|
}, 8, ["onClick"])]))]),
|
|
129
|
-
default:
|
|
136
|
+
default: B(() => [(w(), c(k(h.value), { context: P(_) }, null, 8, ["context"]))]),
|
|
130
137
|
_: 1
|
|
131
|
-
})) : (w(), u(o, { key: 0 }, [
|
|
138
|
+
})) : (w(), u(o, { key: 0 }, [P(a).slots["missing-widget"] ? (w(), c(k(P(a).slots["missing-widget"]), {
|
|
132
139
|
key: 0,
|
|
133
140
|
type: e.widget.type,
|
|
134
141
|
"instance-id": e.widget.id
|
|
135
|
-
}, null, 8, ["type", "instance-id"])) : (w(), u("div", oe, " 未注册模块:" +
|
|
142
|
+
}, null, 8, ["type", "instance-id"])) : (w(), u("div", oe, " 未注册模块:" + M(e.widget.type), 1))], 64))])]),
|
|
136
143
|
_: 2
|
|
137
|
-
}, [!e.embedded &&
|
|
144
|
+
}, [!e.embedded && P(a).slots["widget-title"] ? {
|
|
138
145
|
name: "title",
|
|
139
|
-
fn:
|
|
146
|
+
fn: B(() => [(w(), c(k(P(a).slots["widget-title"]), {
|
|
140
147
|
widget: e.widget,
|
|
141
148
|
title: v.value
|
|
142
149
|
}, null, 8, ["widget", "title"]))]),
|
|
143
150
|
key: "0"
|
|
144
|
-
} : void 0]), 1040))], 8,
|
|
151
|
+
} : void 0]), 1040))], 8, Y));
|
|
145
152
|
}
|
|
146
153
|
}), ce = ["data-cockpit-node-id", "data-cockpit-side"], le = ["data-cockpit-node-id", "data-cockpit-side"], ue = {
|
|
147
154
|
key: 1,
|
|
@@ -154,7 +161,7 @@ var ie = [
|
|
|
154
161
|
key: 1,
|
|
155
162
|
class: "lumal-cockpit-container__empty",
|
|
156
163
|
role: "status"
|
|
157
|
-
},
|
|
164
|
+
}, Z = /* @__PURE__ */ h({
|
|
158
165
|
__name: "LumalCockpitContainer",
|
|
159
166
|
props: {
|
|
160
167
|
columns: {},
|
|
@@ -163,7 +170,7 @@ var ie = [
|
|
|
163
170
|
side: {}
|
|
164
171
|
},
|
|
165
172
|
setup(e) {
|
|
166
|
-
let t = e, n = s(() => ({ height: `${t.row.height}%` })), r = s(() => ({ gridTemplateColumns: t.columns.map((e) => `calc(${e.width} * var(--lumal-cockpit-x-unit, 1px))`).join(" ") })), i = E(), a = T(/* @__PURE__ */ new Set()), d =
|
|
173
|
+
let t = e, n = s(() => ({ height: `${t.row.height}%` })), r = s(() => ({ gridTemplateColumns: t.columns.map((e) => `calc(${e.width} * var(--lumal-cockpit-x-unit, 1px))`).join(" ") })), i = E(), a = T(/* @__PURE__ */ new Set()), d = J(), p = s(() => t.row.widgets.map((e) => ({
|
|
167
174
|
id: e.id,
|
|
168
175
|
title: e.title ?? d.registry.resolveWidget(e.type)?.label ?? e.type,
|
|
169
176
|
widget: e
|
|
@@ -172,14 +179,14 @@ var ie = [
|
|
|
172
179
|
let e = t.row.activeWidgetId;
|
|
173
180
|
return t.row.widgets.some((t) => t.id === e) ? e : t.row.widgets[0]?.id;
|
|
174
181
|
}
|
|
175
|
-
return
|
|
182
|
+
return R(() => [t.row.id, t.row.activeWidgetId], () => {
|
|
176
183
|
i.value = h();
|
|
177
|
-
}, { immediate: !0 }),
|
|
184
|
+
}, { immediate: !0 }), R(() => t.row.widgets.map((e) => e.id).join(","), () => {
|
|
178
185
|
let e = new Set(t.row.widgets.map((e) => e.id));
|
|
179
186
|
a.forEach((t) => {
|
|
180
187
|
e.has(t) || a.delete(t);
|
|
181
188
|
}), t.row.widgets.some((e) => e.id === i.value) || (i.value = h());
|
|
182
|
-
}),
|
|
189
|
+
}), R(i, (e) => {
|
|
183
190
|
e && a.add(e);
|
|
184
191
|
}, { immediate: !0 }), (t, s) => (w(), u("section", {
|
|
185
192
|
class: b(["lumal-cockpit-container", { "is-tabs": e.row.mode === "tabs" }]),
|
|
@@ -197,7 +204,7 @@ var ie = [
|
|
|
197
204
|
"data-cockpit-node": "cell",
|
|
198
205
|
"data-cockpit-node-id": t.id,
|
|
199
206
|
"data-cockpit-side": e.side
|
|
200
|
-
}, [t.widget ? (w(), c(
|
|
207
|
+
}, [t.widget ? (w(), c(X, {
|
|
201
208
|
key: t.widget.id,
|
|
202
209
|
"layout-id": e.layoutId,
|
|
203
210
|
side: e.side,
|
|
@@ -206,13 +213,13 @@ var ie = [
|
|
|
206
213
|
"layout-id",
|
|
207
214
|
"side",
|
|
208
215
|
"widget"
|
|
209
|
-
])) : (w(), u("div", ue, " 空模块槽 "))], 8, le))), 128))], 4)) : (w(), u(o, { key: 1 }, [e.row.widgets.length ? (w(), c(k(
|
|
216
|
+
])) : (w(), u("div", ue, " 空模块槽 "))], 8, le))), 128))], 4)) : (w(), u(o, { key: 1 }, [e.row.widgets.length ? (w(), c(k(P(d).cardComponent), {
|
|
210
217
|
key: 0,
|
|
211
218
|
"active-tab-id": i.value,
|
|
212
219
|
"onUpdate:activeTabId": s[0] ||= (e) => i.value = e,
|
|
213
220
|
tabs: p.value
|
|
214
221
|
}, f({
|
|
215
|
-
default:
|
|
222
|
+
default: B(() => [(w(!0), u(o, null, D(e.row.widgets, (t) => (w(), u(o, { key: t.id }, [(P(d).cachePages ? a.has(t.id) : t.id === i.value) ? V((w(), u("div", de, [m(X, {
|
|
216
223
|
embedded: "",
|
|
217
224
|
"layout-id": e.layoutId,
|
|
218
225
|
side: e.side,
|
|
@@ -221,18 +228,18 @@ var ie = [
|
|
|
221
228
|
"layout-id",
|
|
222
229
|
"side",
|
|
223
230
|
"widget"
|
|
224
|
-
])], 512)), [[
|
|
231
|
+
])], 512)), [[L, t.id === i.value]]) : l("", !0)], 64))), 128))]),
|
|
225
232
|
_: 2
|
|
226
|
-
}, [
|
|
233
|
+
}, [P(d).slots["widget-title"] ? {
|
|
227
234
|
name: "title",
|
|
228
|
-
fn:
|
|
235
|
+
fn: B(({ title: e, widget: t }) => [(w(), c(k(P(d).slots["widget-title"]), {
|
|
229
236
|
widget: t,
|
|
230
237
|
title: e
|
|
231
238
|
}, null, 8, ["widget", "title"]))]),
|
|
232
239
|
key: "0"
|
|
233
|
-
} : void 0,
|
|
240
|
+
} : void 0, P(d).slots["widget-title"] ? {
|
|
234
241
|
name: "tab",
|
|
235
|
-
fn:
|
|
242
|
+
fn: B(({ tab: e }) => [(w(), c(k(P(d).slots["widget-title"]), {
|
|
236
243
|
widget: e.widget,
|
|
237
244
|
title: e.title
|
|
238
245
|
}, null, 8, ["widget", "title"]))]),
|
|
@@ -243,7 +250,7 @@ var ie = [
|
|
|
243
250
|
"data-side",
|
|
244
251
|
"data-cockpit-node-id",
|
|
245
252
|
"data-cockpit-side"
|
|
246
|
-
],
|
|
253
|
+
], Q = /* @__PURE__ */ h({
|
|
247
254
|
__name: "LumalCockpitRegion",
|
|
248
255
|
props: {
|
|
249
256
|
layoutId: {},
|
|
@@ -259,7 +266,7 @@ var ie = [
|
|
|
259
266
|
"data-cockpit-node-id": `${e.layoutId}:${e.side}`,
|
|
260
267
|
"data-cockpit-side": e.side,
|
|
261
268
|
style: S(r.value)
|
|
262
|
-
}, [(w(!0), u(o, null, D(e.region.rows, (t) => (w(), c(
|
|
269
|
+
}, [(w(!0), u(o, null, D(e.region.rows, (t) => (w(), c(Z, {
|
|
263
270
|
key: t.id,
|
|
264
271
|
"layout-id": e.layoutId,
|
|
265
272
|
side: e.side,
|
|
@@ -272,7 +279,7 @@ var ie = [
|
|
|
272
279
|
"row"
|
|
273
280
|
]))), 128))], 12, pe));
|
|
274
281
|
}
|
|
275
|
-
}), me = ["data-scale", "data-viewport-mode"], he = { class: "lumal-cockpit-canvas__header" }, ge = { class: "lumal-cockpit-canvas__header-prefix" }, _e = { class: "lumal-cockpit-canvas__title" }, ve = { class: "lumal-cockpit-canvas__header-actions" },
|
|
282
|
+
}), me = ["data-scale", "data-viewport-mode"], he = { class: "lumal-cockpit-canvas__header" }, ge = { class: "lumal-cockpit-canvas__header-prefix" }, _e = { class: "lumal-cockpit-canvas__title" }, ve = { class: "lumal-cockpit-canvas__header-actions" }, ye = { class: "lumal-cockpit-canvas__body" }, be = { class: "lumal-cockpit-canvas__center" }, xe = { class: "lumal-cockpit-canvas__left" }, Se = { class: "lumal-cockpit-canvas__right" }, Ce = /* @__PURE__ */ h({
|
|
276
283
|
__name: "LumalCockpitCanvas",
|
|
277
284
|
props: {
|
|
278
285
|
title: {},
|
|
@@ -308,65 +315,65 @@ var ie = [
|
|
|
308
315
|
ref_key: "containerRef",
|
|
309
316
|
ref: n,
|
|
310
317
|
class: "lumal-cockpit-canvas",
|
|
311
|
-
"data-scale":
|
|
318
|
+
"data-scale": P(r).scale.toFixed(3),
|
|
312
319
|
"data-viewport-mode": e.viewportMode
|
|
313
320
|
}, [d("div", {
|
|
314
321
|
class: "lumal-cockpit-canvas__stage",
|
|
315
322
|
style: S(i.value)
|
|
316
323
|
}, [d("header", he, [
|
|
317
324
|
d("div", ge, [O(t.$slots, "header-prefix")]),
|
|
318
|
-
d("div", _e, [O(t.$slots, "header-title", { title: e.title }, () => [d("h1", null,
|
|
325
|
+
d("div", _e, [O(t.$slots, "header-title", { title: e.title }, () => [d("h1", null, M(e.title), 1)])]),
|
|
319
326
|
d("div", ve, [O(t.$slots, "header-actions")])
|
|
320
|
-
]), d("div",
|
|
321
|
-
d("main",
|
|
327
|
+
]), d("div", ye, [
|
|
328
|
+
d("main", be, [O(t.$slots, "center", {
|
|
322
329
|
context: e.centerContext,
|
|
323
330
|
layout: e.layout
|
|
324
331
|
}, () => [a[0] ||= d("div", {
|
|
325
332
|
class: "lumal-cockpit-center__empty",
|
|
326
333
|
role: "status"
|
|
327
334
|
}, " 由应用提供中央内容 ", -1)])]),
|
|
328
|
-
d("div",
|
|
335
|
+
d("div", xe, [O(t.$slots, "left", {
|
|
329
336
|
layout: e.layout,
|
|
330
337
|
region: e.layout.left,
|
|
331
338
|
side: "left"
|
|
332
|
-
}, () => [m(
|
|
339
|
+
}, () => [m(Q, {
|
|
333
340
|
side: "left",
|
|
334
341
|
"layout-id": e.layout.id,
|
|
335
342
|
region: e.layout.left
|
|
336
343
|
}, null, 8, ["layout-id", "region"])])]),
|
|
337
|
-
d("div",
|
|
344
|
+
d("div", Se, [O(t.$slots, "right", {
|
|
338
345
|
layout: e.layout,
|
|
339
346
|
region: e.layout.right,
|
|
340
347
|
side: "right"
|
|
341
|
-
}, () => [m(
|
|
348
|
+
}, () => [m(Q, {
|
|
342
349
|
side: "right",
|
|
343
350
|
"layout-id": e.layout.id,
|
|
344
351
|
region: e.layout.right
|
|
345
352
|
}, null, 8, ["layout-id", "region"])])])
|
|
346
353
|
])], 4)], 8, me));
|
|
347
354
|
}
|
|
348
|
-
}),
|
|
355
|
+
}), we = {
|
|
349
356
|
key: 0,
|
|
350
357
|
class: "lumal-cockpit-card__header"
|
|
351
|
-
},
|
|
358
|
+
}, Te = {
|
|
352
359
|
class: "lumal-cockpit-card__tablist",
|
|
353
360
|
role: "tablist",
|
|
354
361
|
"aria-label": "模块切换"
|
|
355
|
-
},
|
|
362
|
+
}, Ee = [
|
|
356
363
|
"id",
|
|
357
364
|
"aria-selected",
|
|
358
365
|
"tabindex",
|
|
359
366
|
"onClick",
|
|
360
367
|
"onKeydown"
|
|
361
|
-
],
|
|
368
|
+
], De = {
|
|
362
369
|
key: 1,
|
|
363
370
|
class: "lumal-cockpit-card__header"
|
|
364
|
-
},
|
|
371
|
+
}, Oe = { class: "lumal-cockpit-card__title" }, ke = [
|
|
365
372
|
"id",
|
|
366
373
|
"role",
|
|
367
374
|
"aria-labelledby",
|
|
368
375
|
"tabindex"
|
|
369
|
-
],
|
|
376
|
+
], $ = /* @__PURE__ */ h({
|
|
370
377
|
__name: "LumalCockpitCard",
|
|
371
378
|
props: {
|
|
372
379
|
title: {},
|
|
@@ -376,7 +383,7 @@ var ie = [
|
|
|
376
383
|
},
|
|
377
384
|
emits: ["update:activeTabId"],
|
|
378
385
|
setup(e, { emit: t }) {
|
|
379
|
-
let n = e, r = t, i =
|
|
386
|
+
let n = e, r = t, i = F(), a = /* @__PURE__ */ new Map(), c = s(() => n.tabs.length > 1), f = s(() => n.tabs[0]), m = s(() => {
|
|
380
387
|
let e = n.activeTabId;
|
|
381
388
|
return n.tabs.some((t) => t.id === e) ? e : n.tabs[0]?.id;
|
|
382
389
|
}), h = s(() => n.widget ?? f.value?.widget), g = s(() => n.title ?? n.widget?.title ?? f.value?.title ?? h.value?.title ?? h.value?.type), _ = `${i}-tabpanel`;
|
|
@@ -401,10 +408,10 @@ var ie = [
|
|
|
401
408
|
}[e.key], i = n.tabs[r];
|
|
402
409
|
i && (e.preventDefault(), S(i.id), y(() => a.get(i.id)?.focus()));
|
|
403
410
|
}
|
|
404
|
-
return
|
|
411
|
+
return R(() => [n.activeTabId, n.tabs.map((e) => e.id).join(",")], () => {
|
|
405
412
|
let e = m.value;
|
|
406
413
|
c.value && e && e !== n.activeTabId && r("update:activeTabId", e);
|
|
407
|
-
}, { immediate: !0 }), (t, n) => (w(), u("section", { class: b(["lumal-cockpit-card", { "is-tabs": c.value }]) }, [c.value ? (w(), u("header",
|
|
414
|
+
}, { immediate: !0 }), (t, n) => (w(), u("section", { class: b(["lumal-cockpit-card", { "is-tabs": c.value }]) }, [c.value ? (w(), u("header", we, [d("div", Te, [(w(!0), u(o, null, D(e.tabs, (e, n) => (w(), u("button", {
|
|
408
415
|
id: v(n),
|
|
409
416
|
key: e.id,
|
|
410
417
|
ref_for: !0,
|
|
@@ -420,25 +427,25 @@ var ie = [
|
|
|
420
427
|
}, [O(t.$slots, "tab", {
|
|
421
428
|
tab: e,
|
|
422
429
|
active: e.id === m.value
|
|
423
|
-
}, () => [p(
|
|
430
|
+
}, () => [p(M(e.title), 1)])], 42, Ee))), 128))])])) : g.value || t.$slots.title ? (w(), u("header", De, [d("div", Oe, [O(t.$slots, "title", {
|
|
424
431
|
title: g.value,
|
|
425
432
|
widget: h.value
|
|
426
|
-
}, () => [p(
|
|
433
|
+
}, () => [p(M(g.value), 1)])])])) : l("", !0), d("div", {
|
|
427
434
|
id: c.value ? _ : void 0,
|
|
428
435
|
class: "lumal-cockpit-card__body",
|
|
429
436
|
role: c.value ? "tabpanel" : void 0,
|
|
430
437
|
"aria-labelledby": c.value ? v(Math.max(0, e.tabs.findIndex((e) => e.id === m.value))) : void 0,
|
|
431
438
|
tabindex: c.value ? 0 : void 0
|
|
432
|
-
}, [O(t.$slots, "default", { activeTabId: m.value })], 8,
|
|
439
|
+
}, [O(t.$slots, "default", { activeTabId: m.value })], 8, ke)], 2));
|
|
433
440
|
}
|
|
434
|
-
}),
|
|
441
|
+
}), Ae = [
|
|
435
442
|
"data-mode",
|
|
436
443
|
"data-cockpit-theme",
|
|
437
444
|
"data-viewport-mode"
|
|
438
|
-
],
|
|
445
|
+
], je = {
|
|
439
446
|
key: 0,
|
|
440
447
|
class: "lumal-cockpit__auto-refresh"
|
|
441
|
-
},
|
|
448
|
+
}, Me = { class: "lumal-cockpit__auto-refresh-control" }, Ne = /* @__PURE__ */ h({
|
|
442
449
|
__name: "LumalCockpit",
|
|
443
450
|
props: /*@__PURE__*/ v({
|
|
444
451
|
config: {},
|
|
@@ -457,7 +464,7 @@ var ie = [
|
|
|
457
464
|
type: Boolean,
|
|
458
465
|
default: !1
|
|
459
466
|
},
|
|
460
|
-
autoRefreshIntervalMs: { default:
|
|
467
|
+
autoRefreshIntervalMs: { default: G }
|
|
461
468
|
}, {
|
|
462
469
|
activeLayoutId: {},
|
|
463
470
|
activeLayoutIdModifiers: {},
|
|
@@ -479,83 +486,88 @@ var ie = [
|
|
|
479
486
|
"update:autoRefreshEnabled"
|
|
480
487
|
]),
|
|
481
488
|
setup(t, { expose: r, emit: i }) {
|
|
482
|
-
let a = t, c = i, f =
|
|
489
|
+
let a = t, c = i, f = I(t, "activeLayoutId"), p = I(t, "themeMode"), h = I(t, "autoRefreshEnabled"), _ = te(), v = j(null), y = j(null), b = "", S = "";
|
|
490
|
+
z(() => {
|
|
483
491
|
try {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
492
|
+
let t = JSON.stringify(a.config);
|
|
493
|
+
if (t === b) {
|
|
494
|
+
y.value = null;
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
let n = e(a.config), r = JSON.stringify(n);
|
|
498
|
+
b = t, y.value = null, r !== S && (v.value = n, S = r);
|
|
488
499
|
} catch (e) {
|
|
489
|
-
|
|
490
|
-
config: null,
|
|
491
|
-
error: e
|
|
492
|
-
};
|
|
500
|
+
y.value = e;
|
|
493
501
|
}
|
|
494
|
-
})
|
|
495
|
-
|
|
502
|
+
});
|
|
503
|
+
let C = s(() => ({
|
|
504
|
+
config: v.value,
|
|
505
|
+
error: y.value
|
|
506
|
+
}));
|
|
507
|
+
R(() => C.value.error, (e) => {
|
|
496
508
|
e && c("configError", e);
|
|
497
509
|
}, { immediate: !0 });
|
|
498
|
-
let
|
|
499
|
-
ee(G, {
|
|
510
|
+
let T = a.messageBus ?? n(), D = A({
|
|
500
511
|
cockpitId: a.config.id,
|
|
501
512
|
mode: a.renderMode,
|
|
502
513
|
registry: a.registry,
|
|
503
|
-
messages:
|
|
514
|
+
messages: T,
|
|
504
515
|
cachePages: a.cachePages,
|
|
505
516
|
slots: _,
|
|
506
|
-
|
|
507
|
-
return a.cardComponent ?? Q;
|
|
508
|
-
}
|
|
517
|
+
cardComponent: a.cardComponent ?? $
|
|
509
518
|
});
|
|
510
|
-
|
|
511
|
-
|
|
519
|
+
z(() => {
|
|
520
|
+
D.cockpitId = v.value?.id ?? a.config.id, D.mode = a.renderMode, D.registry = a.registry, D.cachePages = a.cachePages, D.cardComponent = a.cardComponent ?? $;
|
|
521
|
+
}), ee(q, D);
|
|
522
|
+
let k = U({
|
|
523
|
+
config: () => v.value ?? a.config,
|
|
512
524
|
activeLayoutId: f
|
|
513
|
-
}),
|
|
514
|
-
let e =
|
|
525
|
+
}), M = s(() => {
|
|
526
|
+
let e = k.activeLayout.value;
|
|
515
527
|
if (e) return {
|
|
516
|
-
cockpitId:
|
|
528
|
+
cockpitId: v.value?.id ?? a.config.id,
|
|
517
529
|
layoutId: e.id,
|
|
518
530
|
instanceId: `${e.id}:center`,
|
|
519
531
|
mode: a.renderMode,
|
|
520
|
-
messages:
|
|
532
|
+
messages: T
|
|
521
533
|
};
|
|
522
|
-
}),
|
|
523
|
-
|
|
524
|
-
|
|
534
|
+
}), N = E(!1);
|
|
535
|
+
R([() => a.autoRefresh, h], ([e, t]) => {
|
|
536
|
+
N.value = !!(e && t);
|
|
525
537
|
}, { immediate: !0 });
|
|
526
|
-
let
|
|
538
|
+
let F = s(() => {
|
|
527
539
|
let e = Math.round(a.autoRefreshIntervalMs / 6e4);
|
|
528
540
|
return e >= 1 ? `${e} 分钟` : `${Math.round(a.autoRefreshIntervalMs / 1e3)} 秒`;
|
|
529
|
-
}), { refreshNow:
|
|
530
|
-
messages:
|
|
531
|
-
sourceId: () =>
|
|
541
|
+
}), { refreshNow: L } = K({
|
|
542
|
+
messages: T,
|
|
543
|
+
sourceId: () => v.value?.id ?? a.config.id,
|
|
532
544
|
intervalMs: () => a.autoRefreshIntervalMs,
|
|
533
|
-
enabled:
|
|
534
|
-
}),
|
|
535
|
-
async function
|
|
536
|
-
|
|
545
|
+
enabled: N
|
|
546
|
+
}), V = E(null);
|
|
547
|
+
async function H() {
|
|
548
|
+
V.value?.requestFullscreen && await V.value.requestFullscreen();
|
|
537
549
|
}
|
|
538
|
-
async function
|
|
550
|
+
async function ie() {
|
|
539
551
|
document.fullscreenElement && await document.exitFullscreen();
|
|
540
552
|
}
|
|
541
|
-
function
|
|
553
|
+
function W() {
|
|
542
554
|
p.value = p.value === "dark" ? "light" : "dark";
|
|
543
555
|
}
|
|
544
556
|
r({
|
|
545
|
-
enterFullscreen:
|
|
546
|
-
exitFullscreen:
|
|
547
|
-
messages:
|
|
548
|
-
toggleTheme:
|
|
549
|
-
refreshNow:
|
|
557
|
+
enterFullscreen: H,
|
|
558
|
+
exitFullscreen: ie,
|
|
559
|
+
messages: T,
|
|
560
|
+
toggleTheme: W,
|
|
561
|
+
refreshNow: L
|
|
550
562
|
});
|
|
551
|
-
let
|
|
552
|
-
function
|
|
563
|
+
let G = s(() => !!v.value?.layouts.length);
|
|
564
|
+
function J() {
|
|
553
565
|
c("configure");
|
|
554
566
|
}
|
|
555
|
-
function
|
|
567
|
+
function Y(e) {
|
|
556
568
|
if (a.renderMode !== "design") return;
|
|
557
569
|
let t = (e.target instanceof Element ? e.target : null)?.closest("[data-cockpit-node]");
|
|
558
|
-
if (!t || !
|
|
570
|
+
if (!t || !V.value?.contains(t)) return;
|
|
559
571
|
let n = t.dataset.cockpitNode, r = t.dataset.cockpitNodeId;
|
|
560
572
|
!n || !r || c("nodeSelect", {
|
|
561
573
|
kind: n,
|
|
@@ -565,41 +577,41 @@ var ie = [
|
|
|
565
577
|
}
|
|
566
578
|
return (e, n) => (w(), u("div", {
|
|
567
579
|
ref_key: "rootRef",
|
|
568
|
-
ref:
|
|
580
|
+
ref: V,
|
|
569
581
|
class: "lumal-cockpit",
|
|
570
582
|
"data-mode": t.renderMode,
|
|
571
583
|
"data-cockpit-theme": p.value,
|
|
572
584
|
"data-viewport-mode": t.viewportMode,
|
|
573
|
-
onClickCapture:
|
|
574
|
-
}, [
|
|
585
|
+
onClickCapture: Y
|
|
586
|
+
}, [C.value.error ? O(e.$slots, "error", {
|
|
575
587
|
key: 0,
|
|
576
|
-
error:
|
|
588
|
+
error: C.value.error
|
|
577
589
|
}, () => [n[1] ||= d("div", {
|
|
578
590
|
class: "lumal-cockpit__error",
|
|
579
591
|
role: "alert"
|
|
580
|
-
}, " 配置加载失败 ", -1)]) :
|
|
581
|
-
title:
|
|
592
|
+
}, " 配置加载失败 ", -1)]) : G.value ? P(k).activeLayout.value && M.value ? (w(), u(o, { key: 2 }, [m(Ce, {
|
|
593
|
+
title: v.value.title,
|
|
582
594
|
"base-width": t.baseWidth,
|
|
583
595
|
"base-height": t.baseHeight,
|
|
584
596
|
"viewport-mode": t.viewportMode,
|
|
585
|
-
layout:
|
|
586
|
-
"center-context":
|
|
597
|
+
layout: P(k).activeLayout.value,
|
|
598
|
+
"center-context": M.value
|
|
587
599
|
}, {
|
|
588
|
-
"header-prefix":
|
|
589
|
-
"header-title":
|
|
590
|
-
"header-actions":
|
|
591
|
-
default:
|
|
600
|
+
"header-prefix": B(() => [O(e.$slots, "header-prefix")]),
|
|
601
|
+
"header-title": B((t) => [O(e.$slots, "header-title", x(g(t)))]),
|
|
602
|
+
"header-actions": B(() => [t.autoRefresh ? (w(), u("div", je, [m(P(re), { content: h.value ? `关闭自动刷新(每 ${F.value})` : `开启自动刷新(每 ${F.value})` }, {
|
|
603
|
+
default: B(() => [d("label", Me, [n[3] ||= d("span", null, "自动刷新", -1), m(P(ne), {
|
|
592
604
|
modelValue: h.value,
|
|
593
605
|
"onUpdate:modelValue": n[0] ||= (e) => h.value = e,
|
|
594
606
|
size: "small",
|
|
595
607
|
"data-action": "cockpit-auto-refresh",
|
|
596
|
-
"aria-label": `全局自动刷新,间隔 ${
|
|
608
|
+
"aria-label": `全局自动刷新,间隔 ${F.value}`
|
|
597
609
|
}, null, 8, ["modelValue", "aria-label"])])]),
|
|
598
610
|
_: 1
|
|
599
611
|
}, 8, ["content"])])) : l("", !0), O(e.$slots, "header-actions")]),
|
|
600
|
-
center:
|
|
601
|
-
left:
|
|
602
|
-
right:
|
|
612
|
+
center: B((t) => [O(e.$slots, "center", x(g(t)))]),
|
|
613
|
+
left: B((t) => [O(e.$slots, "left", x(g(t)))]),
|
|
614
|
+
right: B((t) => [O(e.$slots, "right", x(g(t)))]),
|
|
603
615
|
_: 3
|
|
604
616
|
}, 8, [
|
|
605
617
|
"title",
|
|
@@ -608,20 +620,20 @@ var ie = [
|
|
|
608
620
|
"viewport-mode",
|
|
609
621
|
"layout",
|
|
610
622
|
"center-context"
|
|
611
|
-
]), O(e.$slots, "configure-trigger", { configure:
|
|
623
|
+
]), O(e.$slots, "configure-trigger", { configure: J })], 64)) : l("", !0) : O(e.$slots, "empty", { key: 1 }, () => [n[2] ||= d("div", {
|
|
612
624
|
class: "lumal-cockpit__empty",
|
|
613
625
|
role: "status"
|
|
614
|
-
}, " 空驾驶舱 ", -1)])], 40,
|
|
626
|
+
}, " 空驾驶舱 ", -1)])], 40, Ae));
|
|
615
627
|
}
|
|
616
628
|
});
|
|
617
629
|
//#endregion
|
|
618
630
|
//#region src/runtime/index.ts
|
|
619
|
-
function
|
|
631
|
+
function Pe(e, t) {
|
|
620
632
|
let n = e;
|
|
621
633
|
return n.install = function(n) {
|
|
622
634
|
n.component(t, e);
|
|
623
635
|
}, n;
|
|
624
636
|
}
|
|
625
|
-
var
|
|
637
|
+
var Fe = Pe(Ne, "LumalCockpit"), Ie = Pe($, "LumalCockpitCard");
|
|
626
638
|
//#endregion
|
|
627
|
-
export {
|
|
639
|
+
export { Z as a, J as c, W as d, U as f, Q as i, G as l, Ie as n, X as o, Ce as r, q as s, Fe as t, K as u };
|
package/dist/runtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./resolveComponent-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./resolveComponent-BwChMZGV.cjs"),t=require("./runtime-CZWB99yu.cjs");exports.LumalCockpit=t.t,exports.LumalCockpitCanvas=t.r,exports.LumalCockpitCard=t.n,exports.LumalCockpitContainer=t.a,exports.LumalCockpitRegion=t.i,exports.LumalCockpitWidgetHost=t.o,exports.cockpitRuntimeEnvKey=t.s,exports.resolveCockpitComponent=e.t,exports.useCockpitRuntimeEnv=t.c;
|