@lumal/cockpit 0.0.1-beta → 0.0.3-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/CHANGELOG.md +19 -0
- package/LICENSE +21 -21
- package/dist/cockpit.css +1 -1
- package/dist/createCockpitRegistry-8t6uUH6d.js +31 -0
- package/dist/createCockpitRegistry-B2vNbpcw.cjs +1 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.js +613 -546
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/registry.cjs +1 -1
- package/dist/registry.js +1 -1
- package/dist/resolveComponent-DXwlDKov.cjs +1 -0
- package/dist/resolveComponent-_XUQaM5w.js +331 -0
- package/dist/runtime-Be4SmioJ.cjs +1 -0
- package/dist/{runtime-CXiih7DE.js → runtime-DTxtlBRg.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 +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/messaging/createCockpitMessageBus.d.ts +2 -2
- package/dist/src/messaging/createCockpitMessageBus.d.ts.map +1 -1
- package/dist/src/messaging/types.d.ts +5 -1
- package/dist/src/messaging/types.d.ts.map +1 -1
- package/dist/src/registry/createCockpitRegistry.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-KSzm5SZW.cjs → validate-CRxxljQ8.cjs} +1 -1
- package/dist/{validate-DkC_IHrC.js → validate-ip4tDXsj.js} +1 -1
- package/package.json +4 -3
- package/dist/createCockpitRegistry-D5F4d5By.js +0 -30
- package/dist/createCockpitRegistry-DHr9nXJY.cjs +0 -1
- package/dist/resolveComponent-BF1aCxAk.cjs +0 -1
- package/dist/resolveComponent-QbJRsdxR.js +0 -308
- package/dist/runtime-wzWMTWrS.cjs +0 -1
package/dist/designer.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { _ as e, d as t, f as n, g as r, i, m as a, n as o, p as s, r as c, t as l, v as u, x as d } from "./resolveComponent-
|
|
2
|
-
import { t as f } from "./validate-
|
|
3
|
-
import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, mergeModels as S, nextTick as ee, normalizeClass as C, normalizeStyle as w, onBeforeUnmount as T, onMounted as te, openBlock as E, ref as D, renderList as O, renderSlot as
|
|
4
|
-
import { ElAlert as
|
|
1
|
+
import { _ as e, d as t, f as n, g as r, i, m as a, n as o, p as s, r as c, t as l, v as u, x as d } from "./resolveComponent-_XUQaM5w.js";
|
|
2
|
+
import { t as f } from "./validate-ip4tDXsj.js";
|
|
3
|
+
import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, mergeModels as S, nextTick as ee, normalizeClass as C, normalizeStyle as w, onBeforeUnmount as T, onMounted as te, openBlock as E, ref as D, renderList as O, renderSlot as ne, resolveDynamicComponent as re, shallowReactive as ie, shallowRef as ae, toDisplayString as k, triggerRef as oe, unref as A, useModel as se, watch as ce, watchEffect as le, withCtx as j, withModifiers as ue } from "vue";
|
|
4
|
+
import { ElAlert as de, ElButton as M, ElEmpty as fe, ElInput as pe, ElInputNumber as me, ElMessage as he, ElMessageBox as ge, ElOption as _e, ElSelect as ve, ElSwitch as ye, ElTooltip as be } from "element-plus";
|
|
5
5
|
import { LumalIcon as N } from "@lumal/icons-vue";
|
|
6
6
|
//#region ../../node_modules/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js
|
|
7
|
-
function
|
|
8
|
-
return (t =
|
|
7
|
+
function xe(e, t, n) {
|
|
8
|
+
return (t = Oe(t)) in e ? Object.defineProperty(e, t, {
|
|
9
9
|
value: n,
|
|
10
10
|
enumerable: !0,
|
|
11
11
|
configurable: !0,
|
|
12
12
|
writable: !0
|
|
13
13
|
}) : e[t] = n, e;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function Se() {
|
|
16
|
+
return Se = Object.assign ? Object.assign.bind() : function(e) {
|
|
17
17
|
for (var t = 1; t < arguments.length; t++) {
|
|
18
18
|
var n = arguments[t];
|
|
19
19
|
for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
20
20
|
}
|
|
21
21
|
return e;
|
|
22
|
-
},
|
|
22
|
+
}, Se.apply(null, arguments);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Ce(e, t) {
|
|
25
25
|
var n = Object.keys(e);
|
|
26
26
|
if (Object.getOwnPropertySymbols) {
|
|
27
27
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -31,27 +31,27 @@ function xe(e, t) {
|
|
|
31
31
|
}
|
|
32
32
|
return n;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function we(e) {
|
|
35
35
|
for (var t = 1; t < arguments.length; t++) {
|
|
36
36
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
37
|
-
t % 2 ?
|
|
38
|
-
|
|
39
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
37
|
+
t % 2 ? Ce(Object(n), !0).forEach(function(t) {
|
|
38
|
+
xe(e, t, n[t]);
|
|
39
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ce(Object(n)).forEach(function(t) {
|
|
40
40
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
return e;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Te(e, t) {
|
|
46
46
|
if (e == null) return {};
|
|
47
|
-
var n, r, i =
|
|
47
|
+
var n, r, i = Ee(e, t);
|
|
48
48
|
if (Object.getOwnPropertySymbols) {
|
|
49
49
|
var a = Object.getOwnPropertySymbols(e);
|
|
50
50
|
for (r = 0; r < a.length; r++) n = a[r], t.indexOf(n) === -1 && {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
51
51
|
}
|
|
52
52
|
return i;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Ee(e, t) {
|
|
55
55
|
if (e == null) return {};
|
|
56
56
|
var n = {};
|
|
57
57
|
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
@@ -60,7 +60,7 @@ function we(e, t) {
|
|
|
60
60
|
}
|
|
61
61
|
return n;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function De(e, t) {
|
|
64
64
|
if (typeof e != "object" || !e) return e;
|
|
65
65
|
var n = e[Symbol.toPrimitive];
|
|
66
66
|
if (n !== void 0) {
|
|
@@ -70,33 +70,33 @@ function Te(e, t) {
|
|
|
70
70
|
}
|
|
71
71
|
return (t === "string" ? String : Number)(e);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
var t =
|
|
73
|
+
function Oe(e) {
|
|
74
|
+
var t = De(e, "string");
|
|
75
75
|
return typeof t == "symbol" ? t : t + "";
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ke(e) {
|
|
78
78
|
"@babel/helpers - typeof";
|
|
79
|
-
return
|
|
79
|
+
return ke = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
80
80
|
return typeof e;
|
|
81
81
|
} : function(e) {
|
|
82
82
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
83
|
-
},
|
|
83
|
+
}, ke(e);
|
|
84
84
|
}
|
|
85
|
-
var
|
|
86
|
-
function
|
|
85
|
+
var Ae = "1.15.7";
|
|
86
|
+
function je(e) {
|
|
87
87
|
if (typeof window < "u" && window.navigator) return !!/*@__PURE__*/ navigator.userAgent.match(e);
|
|
88
88
|
}
|
|
89
|
-
var
|
|
89
|
+
var Me = je(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ne = je(/Edge/i), Pe = je(/firefox/i), Fe = je(/safari/i) && !je(/chrome/i) && !je(/android/i), Ie = je(/iP(ad|od|hone)/i), Le = je(/chrome/i) && je(/android/i), Re = {
|
|
90
90
|
capture: !1,
|
|
91
91
|
passive: !1
|
|
92
92
|
};
|
|
93
93
|
function P(e, t, n) {
|
|
94
|
-
e.addEventListener(t, n, !
|
|
94
|
+
e.addEventListener(t, n, !Me && Re);
|
|
95
95
|
}
|
|
96
96
|
function F(e, t, n) {
|
|
97
|
-
e.removeEventListener(t, n, !
|
|
97
|
+
e.removeEventListener(t, n, !Me && Re);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function ze(e, t) {
|
|
100
100
|
if (t) {
|
|
101
101
|
if (t[0] === ">" && (t = t.substring(1)), e) try {
|
|
102
102
|
if (e.matches) return e.matches(t);
|
|
@@ -108,22 +108,22 @@ function Le(e, t) {
|
|
|
108
108
|
return !1;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Be(e) {
|
|
112
112
|
return e.host && e !== document && e.host.nodeType && e.host !== e ? e.host : e.parentNode;
|
|
113
113
|
}
|
|
114
114
|
function I(e, t, n, r) {
|
|
115
115
|
if (e) {
|
|
116
116
|
n ||= document;
|
|
117
117
|
do {
|
|
118
|
-
if (t != null && (t[0] === ">" ? e.parentNode === n &&
|
|
118
|
+
if (t != null && (t[0] === ">" ? e.parentNode === n && ze(e, t) : ze(e, t)) || r && e === n) return e;
|
|
119
119
|
if (e === n) break;
|
|
120
|
-
} while (e =
|
|
120
|
+
} while (e = Be(e));
|
|
121
121
|
}
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
124
|
-
var
|
|
124
|
+
var Ve = /\s+/g;
|
|
125
125
|
function L(e, t, n) {
|
|
126
|
-
e && t && (e.classList ? e.classList[n ? "add" : "remove"](t) : e.className = ((" " + e.className + " ").replace(
|
|
126
|
+
e && t && (e.classList ? e.classList[n ? "add" : "remove"](t) : e.className = ((" " + e.className + " ").replace(Ve, " ").replace(" " + t + " ", " ") + (n ? " " + t : "")).replace(Ve, " "));
|
|
127
127
|
}
|
|
128
128
|
function R(e, t, n) {
|
|
129
129
|
var r = e && e.style;
|
|
@@ -132,7 +132,7 @@ function R(e, t, n) {
|
|
|
132
132
|
!(t in r) && t.indexOf("webkit") === -1 && (t = "-webkit-" + t), r[t] = n + (typeof n == "string" ? "" : "px");
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function He(e, t) {
|
|
136
136
|
var n = "";
|
|
137
137
|
if (typeof e == "string") n = e;
|
|
138
138
|
else do {
|
|
@@ -142,7 +142,7 @@ function Be(e, t) {
|
|
|
142
142
|
var i = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
|
143
143
|
return i && new i(n);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Ue(e, t, n) {
|
|
146
146
|
if (e) {
|
|
147
147
|
var r = e.getElementsByTagName(t), i = 0, a = r.length;
|
|
148
148
|
if (n) for (; i < a; i++) n(r[i], i);
|
|
@@ -150,13 +150,13 @@ function Ve(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return [];
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function We() {
|
|
154
154
|
return document.scrollingElement || document.documentElement;
|
|
155
155
|
}
|
|
156
156
|
function z(e, t, n, r, i) {
|
|
157
157
|
if (!(!e.getBoundingClientRect && e !== window)) {
|
|
158
158
|
var a, o, s, c, l, u, d;
|
|
159
|
-
if (e !== window && e.parentNode && e !==
|
|
159
|
+
if (e !== window && e.parentNode && e !== We() ? (a = e.getBoundingClientRect(), o = a.top, s = a.left, c = a.bottom, l = a.right, u = a.height, d = a.width) : (o = 0, s = 0, c = window.innerHeight, l = window.innerWidth, u = window.innerHeight, d = window.innerWidth), (t || n) && e !== window && (i ||= e.parentNode, !Me)) do
|
|
160
160
|
if (i && i.getBoundingClientRect && (R(i, "transform") !== "none" || n && R(i, "position") !== "static")) {
|
|
161
161
|
var f = i.getBoundingClientRect();
|
|
162
162
|
o -= f.top + parseInt(R(i, "border-top-width")), s -= f.left + parseInt(R(i, "border-left-width")), c = o + a.height, l = s + a.width;
|
|
@@ -164,7 +164,7 @@ function z(e, t, n, r, i) {
|
|
|
164
164
|
}
|
|
165
165
|
while (i = i.parentNode);
|
|
166
166
|
if (r && e !== window) {
|
|
167
|
-
var p =
|
|
167
|
+
var p = He(i || e), m = p && p.a, h = p && p.d;
|
|
168
168
|
p && (o /= h, s /= m, d /= m, u /= h, c = o + u, l = s + d);
|
|
169
169
|
}
|
|
170
170
|
return {
|
|
@@ -177,16 +177,16 @@ function z(e, t, n, r, i) {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
for (var r =
|
|
180
|
+
function Ge(e, t, n) {
|
|
181
|
+
for (var r = Xe(e, !0), i = z(e)[t]; r;) {
|
|
182
182
|
var a = z(r)[n], o = void 0;
|
|
183
183
|
if (o = n === "top" || n === "left" ? i >= a : i <= a, !o) return r;
|
|
184
|
-
if (r ===
|
|
185
|
-
r =
|
|
184
|
+
if (r === We()) break;
|
|
185
|
+
r = Xe(r, !1);
|
|
186
186
|
}
|
|
187
187
|
return !1;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Ke(e, t, n, r) {
|
|
190
190
|
for (var i = 0, a = 0, o = e.children; a < o.length;) {
|
|
191
191
|
if (o[a].style.display !== "none" && o[a] !== Q.ghost && (r || o[a] !== Q.dragged) && I(o[a], n.draggable, e, !1)) {
|
|
192
192
|
if (i === t) return o[a];
|
|
@@ -196,74 +196,74 @@ function We(e, t, n, r) {
|
|
|
196
196
|
}
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
for (var n = e.lastElementChild; n && (n === Q.ghost || R(n, "display") === "none" || t && !
|
|
199
|
+
function qe(e, t) {
|
|
200
|
+
for (var n = e.lastElementChild; n && (n === Q.ghost || R(n, "display") === "none" || t && !ze(n, t));) n = n.previousElementSibling;
|
|
201
201
|
return n || null;
|
|
202
202
|
}
|
|
203
203
|
function B(e, t) {
|
|
204
204
|
var n = 0;
|
|
205
205
|
if (!e || !e.parentNode) return -1;
|
|
206
|
-
for (; e = e.previousElementSibling;) e.nodeName.toUpperCase() !== "TEMPLATE" && e !== Q.clone && (!t ||
|
|
206
|
+
for (; e = e.previousElementSibling;) e.nodeName.toUpperCase() !== "TEMPLATE" && e !== Q.clone && (!t || ze(e, t)) && n++;
|
|
207
207
|
return n;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
var t = 0, n = 0, r =
|
|
209
|
+
function Je(e) {
|
|
210
|
+
var t = 0, n = 0, r = We();
|
|
211
211
|
if (e) do {
|
|
212
|
-
var i =
|
|
212
|
+
var i = He(e), a = i.a, o = i.d;
|
|
213
213
|
t += e.scrollLeft * a, n += e.scrollTop * o;
|
|
214
214
|
} while (e !== r && (e = e.parentNode));
|
|
215
215
|
return [t, n];
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function Ye(e, t) {
|
|
218
218
|
for (var n in e) if (e.hasOwnProperty(n)) {
|
|
219
219
|
for (var r in t) if (t.hasOwnProperty(r) && t[r] === e[n][r]) return Number(n);
|
|
220
220
|
}
|
|
221
221
|
return -1;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
if (!e || !e.getBoundingClientRect) return
|
|
223
|
+
function Xe(e, t) {
|
|
224
|
+
if (!e || !e.getBoundingClientRect) return We();
|
|
225
225
|
var n = e, r = !1;
|
|
226
226
|
do
|
|
227
227
|
if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
|
|
228
228
|
var i = R(n);
|
|
229
229
|
if (n.clientWidth < n.scrollWidth && (i.overflowX == "auto" || i.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (i.overflowY == "auto" || i.overflowY == "scroll")) {
|
|
230
|
-
if (!n.getBoundingClientRect || n === document.body) return
|
|
230
|
+
if (!n.getBoundingClientRect || n === document.body) return We();
|
|
231
231
|
if (r || t) return n;
|
|
232
232
|
r = !0;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
while (n = n.parentNode);
|
|
236
|
-
return
|
|
236
|
+
return We();
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Ze(e, t) {
|
|
239
239
|
if (e && t) for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
|
|
240
240
|
return e;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function Qe(e, t) {
|
|
243
243
|
return Math.round(e.top) === Math.round(t.top) && Math.round(e.left) === Math.round(t.left) && Math.round(e.height) === Math.round(t.height) && Math.round(e.width) === Math.round(t.width);
|
|
244
244
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
245
|
+
var $e;
|
|
246
|
+
function et(e, t) {
|
|
247
247
|
return function() {
|
|
248
|
-
if (
|
|
248
|
+
if (!$e) {
|
|
249
249
|
var n = arguments, r = this;
|
|
250
|
-
n.length === 1 ? e.call(r, n[0]) : e.apply(r, n),
|
|
251
|
-
|
|
250
|
+
n.length === 1 ? e.call(r, n[0]) : e.apply(r, n), $e = setTimeout(function() {
|
|
251
|
+
$e = void 0;
|
|
252
252
|
}, t);
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
clearTimeout(
|
|
256
|
+
function tt() {
|
|
257
|
+
clearTimeout($e), $e = void 0;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function nt(e, t, n) {
|
|
260
260
|
e.scrollLeft += t, e.scrollTop += n;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function rt(e) {
|
|
263
263
|
var t = window.Polymer, n = window.jQuery || window.Zepto;
|
|
264
264
|
return t && t.dom ? t.dom(e).cloneNode(!0) : n ? n(e).clone(!0)[0] : e.cloneNode(!0);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function it(e, t, n) {
|
|
267
267
|
var r = {};
|
|
268
268
|
return Array.from(e.children).forEach(function(i) {
|
|
269
269
|
if (!(!I(i, t.draggable, e, !1) || i.animated || i === n)) {
|
|
@@ -273,7 +273,7 @@ function nt(e, t, n) {
|
|
|
273
273
|
}), r.width = r.right - r.left, r.height = r.bottom - r.top, r.x = r.left, r.y = r.top, r;
|
|
274
274
|
}
|
|
275
275
|
var V = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
|
|
276
|
-
function
|
|
276
|
+
function at() {
|
|
277
277
|
var e = [], t;
|
|
278
278
|
return {
|
|
279
279
|
captureAnimationState: function() {
|
|
@@ -283,9 +283,9 @@ function rt() {
|
|
|
283
283
|
target: t,
|
|
284
284
|
rect: z(t)
|
|
285
285
|
});
|
|
286
|
-
var n =
|
|
286
|
+
var n = we({}, e[e.length - 1].rect);
|
|
287
287
|
if (t.thisAnimationDuration) {
|
|
288
|
-
var r =
|
|
288
|
+
var r = He(t, !0);
|
|
289
289
|
r && (n.top -= r.f, n.left -= r.e);
|
|
290
290
|
}
|
|
291
291
|
t.fromRect = n;
|
|
@@ -296,7 +296,7 @@ function rt() {
|
|
|
296
296
|
e.push(t);
|
|
297
297
|
},
|
|
298
298
|
removeAnimationState: function(t) {
|
|
299
|
-
e.splice(
|
|
299
|
+
e.splice(Ye(e, { target: t }), 1);
|
|
300
300
|
},
|
|
301
301
|
animateAll: function(n) {
|
|
302
302
|
var r = this;
|
|
@@ -306,8 +306,8 @@ function rt() {
|
|
|
306
306
|
}
|
|
307
307
|
var i = !1, a = 0;
|
|
308
308
|
e.forEach(function(e) {
|
|
309
|
-
var t = 0, n = e.target, o = n.fromRect, s = z(n), c = n.prevFromRect, l = n.prevToRect, u = e.rect, d =
|
|
310
|
-
d && (s.top -= d.f, s.left -= d.e), n.toRect = s, n.thisAnimationDuration &&
|
|
309
|
+
var t = 0, n = e.target, o = n.fromRect, s = z(n), c = n.prevFromRect, l = n.prevToRect, u = e.rect, d = He(n, !0);
|
|
310
|
+
d && (s.top -= d.f, s.left -= d.e), n.toRect = s, n.thisAnimationDuration && Qe(c, s) && !Qe(o, s) && (u.top - s.top) / (u.left - s.left) === (o.top - s.top) / (o.left - s.left) && (t = st(u, c, l, r.options)), Qe(s, o) || (n.prevFromRect = o, n.prevToRect = s, t ||= r.options.animation, r.animate(n, u, s, t)), t && (i = !0, a = Math.max(a, t), clearTimeout(n.animationResetTimer), n.animationResetTimer = setTimeout(function() {
|
|
311
311
|
n.animationTime = 0, n.prevFromRect = null, n.fromRect = null, n.prevToRect = null, n.thisAnimationDuration = null;
|
|
312
312
|
}, t), n.thisAnimationDuration = t);
|
|
313
313
|
}), clearTimeout(t), i ? t = setTimeout(function() {
|
|
@@ -317,26 +317,26 @@ function rt() {
|
|
|
317
317
|
animate: function(e, t, n, r) {
|
|
318
318
|
if (r) {
|
|
319
319
|
R(e, "transition", ""), R(e, "transform", "");
|
|
320
|
-
var i =
|
|
321
|
-
e.animatingX = !!s, e.animatingY = !!c, R(e, "transform", "translate3d(" + s + "px," + c + "px,0)"), this.forRepaintDummy =
|
|
320
|
+
var i = He(this.el), a = i && i.a, o = i && i.d, s = (t.left - n.left) / (a || 1), c = (t.top - n.top) / (o || 1);
|
|
321
|
+
e.animatingX = !!s, e.animatingY = !!c, R(e, "transform", "translate3d(" + s + "px," + c + "px,0)"), this.forRepaintDummy = ot(e), R(e, "transition", "transform " + r + "ms" + (this.options.easing ? " " + this.options.easing : "")), R(e, "transform", "translate3d(0,0,0)"), typeof e.animated == "number" && clearTimeout(e.animated), e.animated = setTimeout(function() {
|
|
322
322
|
R(e, "transition", ""), R(e, "transform", ""), e.animated = !1, e.animatingX = !1, e.animatingY = !1;
|
|
323
323
|
}, r);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function ot(e) {
|
|
329
329
|
return e.offsetWidth;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function st(e, t, n, r) {
|
|
332
332
|
return Math.sqrt((t.top - e.top) ** 2 + (t.left - e.left) ** 2) / Math.sqrt((t.top - n.top) ** 2 + (t.left - n.left) ** 2) * r.animation;
|
|
333
333
|
}
|
|
334
|
-
var
|
|
334
|
+
var ct = [], lt = { initializeByDefault: !0 }, ut = {
|
|
335
335
|
mount: function(e) {
|
|
336
|
-
for (var t in
|
|
337
|
-
|
|
336
|
+
for (var t in lt) lt.hasOwnProperty(t) && !(t in e) && (e[t] = lt[t]);
|
|
337
|
+
ct.forEach(function(t) {
|
|
338
338
|
if (t.pluginName === e.pluginName) throw `Sortable: Cannot mount plugin ${e.pluginName} more than once`;
|
|
339
|
-
}),
|
|
339
|
+
}), ct.push(e);
|
|
340
340
|
},
|
|
341
341
|
pluginEvent: function(e, t, n) {
|
|
342
342
|
var r = this;
|
|
@@ -344,16 +344,16 @@ var ot = [], st = { initializeByDefault: !0 }, ct = {
|
|
|
344
344
|
r.eventCanceled = !0;
|
|
345
345
|
};
|
|
346
346
|
var i = e + "Global";
|
|
347
|
-
|
|
348
|
-
t[r.pluginName] && (t[r.pluginName][i] && t[r.pluginName][i](
|
|
347
|
+
ct.forEach(function(r) {
|
|
348
|
+
t[r.pluginName] && (t[r.pluginName][i] && t[r.pluginName][i](we({ sortable: t }, n)), t.options[r.pluginName] && t[r.pluginName][e] && t[r.pluginName][e](we({ sortable: t }, n)));
|
|
349
349
|
});
|
|
350
350
|
},
|
|
351
351
|
initializePlugins: function(e, t, n, r) {
|
|
352
|
-
for (var i in
|
|
352
|
+
for (var i in ct.forEach(function(r) {
|
|
353
353
|
var i = r.pluginName;
|
|
354
354
|
if (!(!e.options[i] && !r.initializeByDefault)) {
|
|
355
355
|
var a = new r(e, t, e.options);
|
|
356
|
-
a.sortable = e, a.options = e.options, e[i] = a,
|
|
356
|
+
a.sortable = e, a.options = e.options, e[i] = a, Se(n, a.defaults);
|
|
357
357
|
}
|
|
358
358
|
}), e.options) if (e.options.hasOwnProperty(i)) {
|
|
359
359
|
var a = this.modifyOption(e, i, e.options[i]);
|
|
@@ -362,56 +362,56 @@ var ot = [], st = { initializeByDefault: !0 }, ct = {
|
|
|
362
362
|
},
|
|
363
363
|
getEventProperties: function(e, t) {
|
|
364
364
|
var n = {};
|
|
365
|
-
return
|
|
366
|
-
typeof r.eventProperties == "function" &&
|
|
365
|
+
return ct.forEach(function(r) {
|
|
366
|
+
typeof r.eventProperties == "function" && Se(n, r.eventProperties.call(t[r.pluginName], e));
|
|
367
367
|
}), n;
|
|
368
368
|
},
|
|
369
369
|
modifyOption: function(e, t, n) {
|
|
370
370
|
var r;
|
|
371
|
-
return
|
|
371
|
+
return ct.forEach(function(i) {
|
|
372
372
|
e[i.pluginName] && i.optionListeners && typeof i.optionListeners[t] == "function" && (r = i.optionListeners[t].call(e[i.pluginName], n));
|
|
373
373
|
}), r;
|
|
374
374
|
}
|
|
375
375
|
};
|
|
376
|
-
function
|
|
376
|
+
function dt(e) {
|
|
377
377
|
var t = e.sortable, n = e.rootEl, r = e.name, i = e.targetEl, a = e.cloneEl, o = e.toEl, s = e.fromEl, c = e.oldIndex, l = e.newIndex, u = e.oldDraggableIndex, d = e.newDraggableIndex, f = e.originalEvent, p = e.putSortable, m = e.extraEventProperties;
|
|
378
378
|
if (t ||= n && n[V], t) {
|
|
379
379
|
var h, g = t.options, _ = "on" + r.charAt(0).toUpperCase() + r.substr(1);
|
|
380
|
-
window.CustomEvent && !
|
|
380
|
+
window.CustomEvent && !Me && !Ne ? h = new CustomEvent(r, {
|
|
381
381
|
bubbles: !0,
|
|
382
382
|
cancelable: !0
|
|
383
383
|
}) : (h = document.createEvent("Event"), h.initEvent(r, !0, !0)), h.to = o || n, h.from = s || n, h.item = i || n, h.clone = a, h.oldIndex = c, h.newIndex = l, h.oldDraggableIndex = u, h.newDraggableIndex = d, h.originalEvent = f, h.pullMode = p ? p.lastPutMode : void 0;
|
|
384
|
-
var v =
|
|
384
|
+
var v = we(we({}, m), ut.getEventProperties(r, t));
|
|
385
385
|
for (var y in v) h[y] = v[y];
|
|
386
386
|
n && n.dispatchEvent(h), g[_] && g[_].call(t, h);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
var
|
|
390
|
-
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = n.evt, i =
|
|
391
|
-
|
|
389
|
+
var ft = ["evt"], H = function(e, t) {
|
|
390
|
+
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = n.evt, i = Te(n, ft);
|
|
391
|
+
ut.pluginEvent.bind(Q)(e, t, we({
|
|
392
392
|
dragEl: W,
|
|
393
393
|
parentEl: G,
|
|
394
394
|
ghostEl: K,
|
|
395
395
|
rootEl: q,
|
|
396
|
-
nextEl:
|
|
397
|
-
lastDownEl:
|
|
396
|
+
nextEl: pt,
|
|
397
|
+
lastDownEl: mt,
|
|
398
398
|
cloneEl: J,
|
|
399
|
-
cloneHidden:
|
|
400
|
-
dragStarted:
|
|
399
|
+
cloneHidden: ht,
|
|
400
|
+
dragStarted: kt,
|
|
401
401
|
putSortable: X,
|
|
402
402
|
activeSortable: Q.active,
|
|
403
403
|
originalEvent: r,
|
|
404
|
-
oldIndex:
|
|
405
|
-
oldDraggableIndex:
|
|
404
|
+
oldIndex: gt,
|
|
405
|
+
oldDraggableIndex: _t,
|
|
406
406
|
newIndex: Y,
|
|
407
|
-
newDraggableIndex:
|
|
408
|
-
hideGhostForTarget:
|
|
409
|
-
unhideGhostForTarget:
|
|
407
|
+
newDraggableIndex: vt,
|
|
408
|
+
hideGhostForTarget: qt,
|
|
409
|
+
unhideGhostForTarget: Jt,
|
|
410
410
|
cloneNowHidden: function() {
|
|
411
|
-
|
|
411
|
+
ht = !0;
|
|
412
412
|
},
|
|
413
413
|
cloneNowShown: function() {
|
|
414
|
-
|
|
414
|
+
ht = !1;
|
|
415
415
|
},
|
|
416
416
|
dispatchSortableEvent: function(e) {
|
|
417
417
|
U({
|
|
@@ -423,45 +423,45 @@ var ut = ["evt"], H = function(e, t) {
|
|
|
423
423
|
}, i));
|
|
424
424
|
};
|
|
425
425
|
function U(e) {
|
|
426
|
-
|
|
426
|
+
dt(we({
|
|
427
427
|
putSortable: X,
|
|
428
428
|
cloneEl: J,
|
|
429
429
|
targetEl: W,
|
|
430
430
|
rootEl: q,
|
|
431
|
-
oldIndex:
|
|
432
|
-
oldDraggableIndex:
|
|
431
|
+
oldIndex: gt,
|
|
432
|
+
oldDraggableIndex: _t,
|
|
433
433
|
newIndex: Y,
|
|
434
|
-
newDraggableIndex:
|
|
434
|
+
newDraggableIndex: vt
|
|
435
435
|
}, e));
|
|
436
436
|
}
|
|
437
|
-
var W, G, K, q,
|
|
438
|
-
if (
|
|
439
|
-
if (
|
|
437
|
+
var W, G, K, q, pt, mt, J, ht, gt, Y, _t, vt, yt, X, bt = !1, xt = !1, St = [], Ct, wt, Tt, Et, Dt, Ot, kt, At, jt, Mt = !1, Nt = !1, Pt, Z, Ft = [], It = !1, Lt = [], Rt = typeof document < "u", zt = Ie, Bt = Ne || Me ? "cssFloat" : "float", Vt = Rt && !Le && !Ie && "draggable" in document.createElement("div"), Ht = function() {
|
|
438
|
+
if (Rt) {
|
|
439
|
+
if (Me) return !1;
|
|
440
440
|
var e = document.createElement("x");
|
|
441
441
|
return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
|
|
442
442
|
}
|
|
443
|
-
}(),
|
|
444
|
-
var n = R(e), r = parseInt(n.width) - parseInt(n.paddingLeft) - parseInt(n.paddingRight) - parseInt(n.borderLeftWidth) - parseInt(n.borderRightWidth), i =
|
|
443
|
+
}(), Ut = function(e, t) {
|
|
444
|
+
var n = R(e), r = parseInt(n.width) - parseInt(n.paddingLeft) - parseInt(n.paddingRight) - parseInt(n.borderLeftWidth) - parseInt(n.borderRightWidth), i = Ke(e, 0, t), a = Ke(e, 1, t), o = i && R(i), s = a && R(a), c = o && parseInt(o.marginLeft) + parseInt(o.marginRight) + z(i).width, l = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + z(a).width;
|
|
445
445
|
if (n.display === "flex") return n.flexDirection === "column" || n.flexDirection === "column-reverse" ? "vertical" : "horizontal";
|
|
446
446
|
if (n.display === "grid") return n.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
|
|
447
447
|
if (i && o.float && o.float !== "none") {
|
|
448
448
|
var u = o.float === "left" ? "left" : "right";
|
|
449
449
|
return a && (s.clear === "both" || s.clear === u) ? "vertical" : "horizontal";
|
|
450
450
|
}
|
|
451
|
-
return i && (o.display === "block" || o.display === "flex" || o.display === "table" || o.display === "grid" || c >= r && n[
|
|
452
|
-
},
|
|
451
|
+
return i && (o.display === "block" || o.display === "flex" || o.display === "table" || o.display === "grid" || c >= r && n[Bt] === "none" || a && n[Bt] === "none" && c + l > r) ? "vertical" : "horizontal";
|
|
452
|
+
}, Wt = function(e, t, n) {
|
|
453
453
|
var r = n ? e.left : e.top, i = n ? e.right : e.bottom, a = n ? e.width : e.height, o = n ? t.left : t.top, s = n ? t.right : t.bottom, c = n ? t.width : t.height;
|
|
454
454
|
return r === o || i === s || r + a / 2 === o + c / 2;
|
|
455
|
-
},
|
|
455
|
+
}, Gt = function(e, t) {
|
|
456
456
|
var n;
|
|
457
|
-
return
|
|
457
|
+
return St.some(function(r) {
|
|
458
458
|
var i = r[V].options.emptyInsertThreshold;
|
|
459
|
-
if (!(!i ||
|
|
459
|
+
if (!(!i || qe(r))) {
|
|
460
460
|
var a = z(r), o = e >= a.left - i && e <= a.right + i, s = t >= a.top - i && t <= a.bottom + i;
|
|
461
461
|
if (o && s) return n = r;
|
|
462
462
|
}
|
|
463
463
|
}), n;
|
|
464
|
-
},
|
|
464
|
+
}, Kt = function(e) {
|
|
465
465
|
function t(e, n) {
|
|
466
466
|
return function(r, i, a, o) {
|
|
467
467
|
var s = r.options.group.name && i.options.group.name && r.options.group.name === i.options.group.name;
|
|
@@ -474,31 +474,31 @@ var W, G, K, q, dt, ft, J, pt, mt, Y, ht, gt, _t, X, vt = !1, yt = !1, bt = [],
|
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
476
|
var n = {}, r = e.group;
|
|
477
|
-
(!r ||
|
|
478
|
-
},
|
|
479
|
-
!
|
|
480
|
-
},
|
|
481
|
-
!
|
|
477
|
+
(!r || ke(r) != "object") && (r = { name: r }), n.name = r.name, n.checkPull = t(r.pull, !0), n.checkPut = t(r.put), n.revertClone = r.revertClone, e.group = n;
|
|
478
|
+
}, qt = function() {
|
|
479
|
+
!Ht && K && R(K, "display", "none");
|
|
480
|
+
}, Jt = function() {
|
|
481
|
+
!Ht && K && R(K, "display", "");
|
|
482
482
|
};
|
|
483
|
-
|
|
484
|
-
if (
|
|
483
|
+
Rt && !Le && document.addEventListener("click", function(e) {
|
|
484
|
+
if (xt) return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), xt = !1, !1;
|
|
485
485
|
}, !0);
|
|
486
|
-
var
|
|
486
|
+
var Yt = function(e) {
|
|
487
487
|
if (W) {
|
|
488
488
|
e = e.touches ? e.touches[0] : e;
|
|
489
|
-
var t =
|
|
489
|
+
var t = Gt(e.clientX, e.clientY);
|
|
490
490
|
if (t) {
|
|
491
491
|
var n = {};
|
|
492
492
|
for (var r in e) e.hasOwnProperty(r) && (n[r] = e[r]);
|
|
493
493
|
n.target = n.rootEl = t, n.preventDefault = void 0, n.stopPropagation = void 0, t[V]._onDragOver(n);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
},
|
|
496
|
+
}, Xt = function(e) {
|
|
497
497
|
W && W.parentNode[V]._isOutsideThisEl(e.target);
|
|
498
498
|
};
|
|
499
499
|
function Q(e, t) {
|
|
500
500
|
if (!(e && e.nodeType && e.nodeType === 1)) throw `Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(e)}`;
|
|
501
|
-
this.el = e, this.options = t =
|
|
501
|
+
this.el = e, this.options = t = Se({}, t), e[V] = this;
|
|
502
502
|
var n = {
|
|
503
503
|
group: null,
|
|
504
504
|
sort: !0,
|
|
@@ -511,7 +511,7 @@ function Q(e, t) {
|
|
|
511
511
|
invertedSwapThreshold: null,
|
|
512
512
|
removeCloneOnHide: !0,
|
|
513
513
|
direction: function() {
|
|
514
|
-
return
|
|
514
|
+
return Ut(e, this.options);
|
|
515
515
|
},
|
|
516
516
|
ghostClass: "sortable-ghost",
|
|
517
517
|
chosenClass: "sortable-chosen",
|
|
@@ -538,17 +538,17 @@ function Q(e, t) {
|
|
|
538
538
|
x: 0,
|
|
539
539
|
y: 0
|
|
540
540
|
},
|
|
541
|
-
supportPointer: Q.supportPointer !== !1 && "PointerEvent" in window && (!
|
|
541
|
+
supportPointer: Q.supportPointer !== !1 && "PointerEvent" in window && (!Fe || Ie),
|
|
542
542
|
emptyInsertThreshold: 5
|
|
543
543
|
};
|
|
544
|
-
for (var r in
|
|
545
|
-
for (var i in
|
|
546
|
-
this.nativeDraggable = !t.forceFallback &&
|
|
544
|
+
for (var r in ut.initializePlugins(this, e, n), n) !(r in t) && (t[r] = n[r]);
|
|
545
|
+
for (var i in Kt(t), this) i.charAt(0) === "_" && typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
546
|
+
this.nativeDraggable = !t.forceFallback && Vt, this.nativeDraggable && (this.options.touchStartThreshold = 1), t.supportPointer ? P(e, "pointerdown", this._onTapStart) : (P(e, "mousedown", this._onTapStart), P(e, "touchstart", this._onTapStart)), this.nativeDraggable && (P(e, "dragover", this), P(e, "dragenter", this)), St.push(this.el), t.store && t.store.get && this.sort(t.store.get(this) || []), Se(this, at());
|
|
547
547
|
}
|
|
548
548
|
Q.prototype = {
|
|
549
549
|
constructor: Q,
|
|
550
550
|
_isOutsideThisEl: function(e) {
|
|
551
|
-
!this.el.contains(e) && e !== this.el && (
|
|
551
|
+
!this.el.contains(e) && e !== this.el && (At = null);
|
|
552
552
|
},
|
|
553
553
|
_getDirection: function(e, t) {
|
|
554
554
|
return typeof this.options.direction == "function" ? this.options.direction.call(this, e, t, W) : this.options.direction;
|
|
@@ -556,8 +556,8 @@ Q.prototype = {
|
|
|
556
556
|
_onTapStart: function(e) {
|
|
557
557
|
if (e.cancelable) {
|
|
558
558
|
var t = this, n = this.el, r = this.options, i = r.preventOnFilter, a = e.type, o = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (o || e).target, c = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, l = r.filter;
|
|
559
|
-
if (
|
|
560
|
-
if (
|
|
559
|
+
if (sn(n), !W && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !c.isContentEditable && !(!this.nativeDraggable && Fe && s && s.tagName.toUpperCase() === "SELECT") && (s = I(s, r.draggable, n, !1), !(s && s.animated) && mt !== s)) {
|
|
560
|
+
if (gt = B(s), _t = B(s, r.draggable), typeof l == "function") {
|
|
561
561
|
if (l.call(this, e, s, this)) {
|
|
562
562
|
U({
|
|
563
563
|
sortable: t,
|
|
@@ -590,23 +590,23 @@ Q.prototype = {
|
|
|
590
590
|
var r = this, i = r.el, a = r.options, o = i.ownerDocument, s;
|
|
591
591
|
if (n && !W && n.parentNode === i) {
|
|
592
592
|
var c = z(n);
|
|
593
|
-
if (q = i, W = n, G = W.parentNode,
|
|
593
|
+
if (q = i, W = n, G = W.parentNode, pt = W.nextSibling, mt = n, yt = a.group, Q.dragged = W, Ct = {
|
|
594
594
|
target: W,
|
|
595
595
|
clientX: (t || e).clientX,
|
|
596
596
|
clientY: (t || e).clientY
|
|
597
|
-
},
|
|
597
|
+
}, Dt = Ct.clientX - c.left, Ot = Ct.clientY - c.top, this._lastX = (t || e).clientX, this._lastY = (t || e).clientY, W.style["will-change"] = "all", s = function() {
|
|
598
598
|
if (H("delayEnded", r, { evt: e }), Q.eventCanceled) {
|
|
599
599
|
r._onDrop();
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
|
-
r._disableDelayedDragEvents(), !
|
|
602
|
+
r._disableDelayedDragEvents(), !Pe && r.nativeDraggable && (W.draggable = !0), r._triggerDragStart(e, t), U({
|
|
603
603
|
sortable: r,
|
|
604
604
|
name: "choose",
|
|
605
605
|
originalEvent: e
|
|
606
606
|
}), L(W, a.chosenClass, !0);
|
|
607
607
|
}, a.ignore.split(",").forEach(function(e) {
|
|
608
|
-
|
|
609
|
-
}), P(o, "dragover",
|
|
608
|
+
Ue(W, e.trim(), $t);
|
|
609
|
+
}), P(o, "dragover", Yt), P(o, "mousemove", Yt), P(o, "touchmove", Yt), a.supportPointer ? (P(o, "pointerup", r._onDrop), !this.nativeDraggable && P(o, "pointercancel", r._onDrop)) : (P(o, "mouseup", r._onDrop), P(o, "touchend", r._onDrop), P(o, "touchcancel", r._onDrop)), Pe && this.nativeDraggable && (this.options.touchStartThreshold = 4, W.draggable = !0), H("delayStart", this, { evt: e }), a.delay && (!a.delayOnTouchOnly || t) && (!this.nativeDraggable || !(Ne || Me))) {
|
|
610
610
|
if (Q.eventCanceled) {
|
|
611
611
|
this._onDrop();
|
|
612
612
|
return;
|
|
@@ -620,7 +620,7 @@ Q.prototype = {
|
|
|
620
620
|
Math.max(Math.abs(t.clientX - this._lastX), Math.abs(t.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
|
|
621
621
|
},
|
|
622
622
|
_disableDelayedDrag: function() {
|
|
623
|
-
W &&
|
|
623
|
+
W && $t(W), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
|
|
624
624
|
},
|
|
625
625
|
_disableDelayedDragEvents: function() {
|
|
626
626
|
var e = this.el.ownerDocument;
|
|
@@ -629,14 +629,14 @@ Q.prototype = {
|
|
|
629
629
|
_triggerDragStart: function(e, t) {
|
|
630
630
|
t ||= e.pointerType == "touch" && e, !this.nativeDraggable || t ? this.options.supportPointer ? P(document, "pointermove", this._onTouchMove) : t ? P(document, "touchmove", this._onTouchMove) : P(document, "mousemove", this._onTouchMove) : (P(W, "dragend", this), P(q, "dragstart", this._onDragStart));
|
|
631
631
|
try {
|
|
632
|
-
document.selection ?
|
|
632
|
+
document.selection ? cn(function() {
|
|
633
633
|
document.selection.empty();
|
|
634
634
|
}) : window.getSelection().removeAllRanges();
|
|
635
635
|
} catch {}
|
|
636
636
|
},
|
|
637
637
|
_dragStarted: function(e, t) {
|
|
638
|
-
if (
|
|
639
|
-
H("dragStarted", this, { evt: t }), this.nativeDraggable && P(document, "dragover",
|
|
638
|
+
if (bt = !1, q && W) {
|
|
639
|
+
H("dragStarted", this, { evt: t }), this.nativeDraggable && P(document, "dragover", Xt);
|
|
640
640
|
var n = this.options;
|
|
641
641
|
!e && L(W, n.dragClass, !1), L(W, n.ghostClass, !0), Q.active = this, e && this._appendGhost(), U({
|
|
642
642
|
sortable: this,
|
|
@@ -646,33 +646,33 @@ Q.prototype = {
|
|
|
646
646
|
} else this._nulling();
|
|
647
647
|
},
|
|
648
648
|
_emulateDragOver: function() {
|
|
649
|
-
if (
|
|
650
|
-
this._lastX =
|
|
651
|
-
for (var e = document.elementFromPoint(
|
|
649
|
+
if (wt) {
|
|
650
|
+
this._lastX = wt.clientX, this._lastY = wt.clientY, qt();
|
|
651
|
+
for (var e = document.elementFromPoint(wt.clientX, wt.clientY), t = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(wt.clientX, wt.clientY), e !== t);) t = e;
|
|
652
652
|
if (W.parentNode[V]._isOutsideThisEl(e), t) do {
|
|
653
653
|
if (t[V]) {
|
|
654
654
|
var n = void 0;
|
|
655
655
|
if (n = t[V]._onDragOver({
|
|
656
|
-
clientX:
|
|
657
|
-
clientY:
|
|
656
|
+
clientX: wt.clientX,
|
|
657
|
+
clientY: wt.clientY,
|
|
658
658
|
target: e,
|
|
659
659
|
rootEl: t
|
|
660
660
|
}), n && !this.options.dragoverBubble) break;
|
|
661
661
|
}
|
|
662
662
|
e = t;
|
|
663
|
-
} while (t =
|
|
664
|
-
|
|
663
|
+
} while (t = Be(t));
|
|
664
|
+
Jt();
|
|
665
665
|
}
|
|
666
666
|
},
|
|
667
667
|
_onTouchMove: function(e) {
|
|
668
|
-
if (
|
|
669
|
-
var t = this.options, n = t.fallbackTolerance, r = t.fallbackOffset, i = e.touches ? e.touches[0] : e, a = K &&
|
|
670
|
-
if (!Q.active && !
|
|
668
|
+
if (Ct) {
|
|
669
|
+
var t = this.options, n = t.fallbackTolerance, r = t.fallbackOffset, i = e.touches ? e.touches[0] : e, a = K && He(K, !0), o = K && a && a.a, s = K && a && a.d, c = zt && Z && Je(Z), l = (i.clientX - Ct.clientX + r.x) / (o || 1) + (c ? c[0] - Ft[0] : 0) / (o || 1), u = (i.clientY - Ct.clientY + r.y) / (s || 1) + (c ? c[1] - Ft[1] : 0) / (s || 1);
|
|
670
|
+
if (!Q.active && !bt) {
|
|
671
671
|
if (n && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < n) return;
|
|
672
672
|
this._onDragStart(e, !0);
|
|
673
673
|
}
|
|
674
674
|
if (K) {
|
|
675
|
-
a ? (a.e += l - (
|
|
675
|
+
a ? (a.e += l - (Tt || 0), a.f += u - (Et || 0)) : a = {
|
|
676
676
|
a: 1,
|
|
677
677
|
b: 0,
|
|
678
678
|
c: 0,
|
|
@@ -681,19 +681,19 @@ Q.prototype = {
|
|
|
681
681
|
f: u
|
|
682
682
|
};
|
|
683
683
|
var d = `matrix(${a.a},${a.b},${a.c},${a.d},${a.e},${a.f})`;
|
|
684
|
-
R(K, "webkitTransform", d), R(K, "mozTransform", d), R(K, "msTransform", d), R(K, "transform", d),
|
|
684
|
+
R(K, "webkitTransform", d), R(K, "mozTransform", d), R(K, "msTransform", d), R(K, "transform", d), Tt = l, Et = u, wt = i;
|
|
685
685
|
}
|
|
686
686
|
e.cancelable && e.preventDefault();
|
|
687
687
|
}
|
|
688
688
|
},
|
|
689
689
|
_appendGhost: function() {
|
|
690
690
|
if (!K) {
|
|
691
|
-
var e = this.options.fallbackOnBody ? document.body : q, t = z(W, !0,
|
|
692
|
-
if (
|
|
691
|
+
var e = this.options.fallbackOnBody ? document.body : q, t = z(W, !0, zt, !0, e), n = this.options;
|
|
692
|
+
if (zt) {
|
|
693
693
|
for (Z = e; R(Z, "position") === "static" && R(Z, "transform") === "none" && Z !== document;) Z = Z.parentNode;
|
|
694
|
-
Z !== document.body && Z !== document.documentElement ? (Z === document && (Z =
|
|
694
|
+
Z !== document.body && Z !== document.documentElement ? (Z === document && (Z = We()), t.top += Z.scrollTop, t.left += Z.scrollLeft) : Z = We(), Ft = Je(Z);
|
|
695
695
|
}
|
|
696
|
-
K = W.cloneNode(!0), L(K, n.ghostClass, !1), L(K, n.fallbackClass, !0), L(K, n.dragClass, !0), R(K, "transition", ""), R(K, "transform", ""), R(K, "box-sizing", "border-box"), R(K, "margin", 0), R(K, "top", t.top), R(K, "left", t.left), R(K, "width", t.width), R(K, "height", t.height), R(K, "opacity", "0.8"), R(K, "position",
|
|
696
|
+
K = W.cloneNode(!0), L(K, n.ghostClass, !1), L(K, n.fallbackClass, !0), L(K, n.dragClass, !0), R(K, "transition", ""), R(K, "transform", ""), R(K, "box-sizing", "border-box"), R(K, "margin", 0), R(K, "top", t.top), R(K, "left", t.left), R(K, "width", t.width), R(K, "height", t.height), R(K, "opacity", "0.8"), R(K, "position", zt ? "absolute" : "fixed"), R(K, "zIndex", "100000"), R(K, "pointerEvents", "none"), Q.ghost = K, e.appendChild(K), R(K, "transform-origin", Dt / parseInt(K.style.width) * 100 + "% " + Ot / parseInt(K.style.height) * 100 + "%");
|
|
697
697
|
}
|
|
698
698
|
},
|
|
699
699
|
_onDragStart: function(e, t) {
|
|
@@ -702,18 +702,18 @@ Q.prototype = {
|
|
|
702
702
|
this._onDrop();
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
|
-
H("setupClone", this), Q.eventCanceled || (J =
|
|
705
|
+
H("setupClone", this), Q.eventCanceled || (J = rt(W), J.removeAttribute("id"), J.draggable = !1, J.style["will-change"] = "", this._hideClone(), L(J, this.options.chosenClass, !1), Q.clone = J), n.cloneId = cn(function() {
|
|
706
706
|
H("clone", n), !Q.eventCanceled && (n.options.removeCloneOnHide || q.insertBefore(J, W), n._hideClone(), U({
|
|
707
707
|
sortable: n,
|
|
708
708
|
name: "clone"
|
|
709
709
|
}));
|
|
710
|
-
}), !t && L(W, i.dragClass, !0), t ? (
|
|
710
|
+
}), !t && L(W, i.dragClass, !0), t ? (xt = !0, n._loopId = setInterval(n._emulateDragOver, 50)) : (F(document, "mouseup", n._onDrop), F(document, "touchend", n._onDrop), F(document, "touchcancel", n._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(n, r, W)), P(document, "drop", n), R(W, "transform", "translateZ(0)")), bt = !0, n._dragStartId = cn(n._dragStarted.bind(n, t, e)), P(document, "selectstart", n), kt = !0, window.getSelection().removeAllRanges(), Fe && R(document.body, "user-select", "none");
|
|
711
711
|
},
|
|
712
712
|
_onDragOver: function(e) {
|
|
713
|
-
var t = this.el, n = e.target, r, i, a, o = this.options, s = o.group, c = Q.active, l =
|
|
714
|
-
if (
|
|
713
|
+
var t = this.el, n = e.target, r, i, a, o = this.options, s = o.group, c = Q.active, l = yt === s, u = o.sort, d = X || c, f, p = this, m = !1;
|
|
714
|
+
if (It) return;
|
|
715
715
|
function h(o, s) {
|
|
716
|
-
H(o, p,
|
|
716
|
+
H(o, p, we({
|
|
717
717
|
evt: e,
|
|
718
718
|
isOwner: l,
|
|
719
719
|
axis: f ? "vertical" : "horizontal",
|
|
@@ -725,7 +725,7 @@ Q.prototype = {
|
|
|
725
725
|
target: n,
|
|
726
726
|
completed: _,
|
|
727
727
|
onMove: function(n, i) {
|
|
728
|
-
return
|
|
728
|
+
return Qt(q, t, W, r, n, z(n), e, i);
|
|
729
729
|
},
|
|
730
730
|
changed: v
|
|
731
731
|
}, s));
|
|
@@ -736,35 +736,35 @@ Q.prototype = {
|
|
|
736
736
|
function _(r) {
|
|
737
737
|
return h("dragOverCompleted", { insertion: r }), r && (l ? c._hideClone() : c._showClone(p), p !== d && (L(W, X ? X.options.ghostClass : c.options.ghostClass, !1), L(W, o.ghostClass, !0)), X !== p && p !== Q.active ? X = p : p === Q.active && X && (X = null), d === p && (p._ignoreWhileAnimating = n), p.animateAll(function() {
|
|
738
738
|
h("dragOverAnimationComplete"), p._ignoreWhileAnimating = null;
|
|
739
|
-
}), p !== d && (d.animateAll(), d._ignoreWhileAnimating = null)), (n === W && !W.animated || n === t && !n.animated) && (
|
|
739
|
+
}), p !== d && (d.animateAll(), d._ignoreWhileAnimating = null)), (n === W && !W.animated || n === t && !n.animated) && (At = null), !o.dragoverBubble && !e.rootEl && n !== document && (W.parentNode[V]._isOutsideThisEl(e.target), !r && Yt(e)), !o.dragoverBubble && e.stopPropagation && e.stopPropagation(), m = !0;
|
|
740
740
|
}
|
|
741
741
|
function v() {
|
|
742
|
-
Y = B(W),
|
|
742
|
+
Y = B(W), vt = B(W, o.draggable), U({
|
|
743
743
|
sortable: p,
|
|
744
744
|
name: "change",
|
|
745
745
|
toEl: t,
|
|
746
746
|
newIndex: Y,
|
|
747
|
-
newDraggableIndex:
|
|
747
|
+
newDraggableIndex: vt,
|
|
748
748
|
originalEvent: e
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
751
|
if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), n = I(n, o.draggable, t, !0), h("dragOver"), Q.eventCanceled) return m;
|
|
752
752
|
if (W.contains(e.target) || n.animated && n.animatingX && n.animatingY || p._ignoreWhileAnimating === n) return _(!1);
|
|
753
|
-
if (
|
|
753
|
+
if (xt = !1, c && !o.disabled && (l ? u || (a = G !== q) : X === this || (this.lastPutMode = yt.checkPull(this, c, W, e)) && s.checkPut(this, c, W, e))) {
|
|
754
754
|
if (f = this._getDirection(e, n) === "vertical", r = z(W), h("dragOverValid"), Q.eventCanceled) return m;
|
|
755
|
-
if (a) return G = q, g(), this._hideClone(), h("revert"), Q.eventCanceled || (
|
|
756
|
-
var y =
|
|
757
|
-
if (!y ||
|
|
755
|
+
if (a) return G = q, g(), this._hideClone(), h("revert"), Q.eventCanceled || (pt ? q.insertBefore(W, pt) : q.appendChild(W)), _(!0);
|
|
756
|
+
var y = qe(t, o.draggable);
|
|
757
|
+
if (!y || nn(e, f, this) && !y.animated) {
|
|
758
758
|
if (y === W) return _(!1);
|
|
759
|
-
if (y && t === e.target && (n = y), n && (i = z(n)),
|
|
760
|
-
} else if (y &&
|
|
761
|
-
var b =
|
|
759
|
+
if (y && t === e.target && (n = y), n && (i = z(n)), Qt(q, t, W, r, n, i, e, !!n) !== !1) return g(), y && y.nextSibling ? t.insertBefore(W, y.nextSibling) : t.appendChild(W), G = t, v(), _(!0);
|
|
760
|
+
} else if (y && tn(e, f, this)) {
|
|
761
|
+
var b = Ke(t, 0, o, !0);
|
|
762
762
|
if (b === W) return _(!1);
|
|
763
|
-
if (n = b, i = z(n),
|
|
763
|
+
if (n = b, i = z(n), Qt(q, t, W, r, n, i, e, !1) !== !1) return g(), t.insertBefore(W, b), G = t, v(), _(!0);
|
|
764
764
|
} else if (n.parentNode === t) {
|
|
765
765
|
i = z(n);
|
|
766
|
-
var x = 0, S, ee = W.parentNode !== t, C = !
|
|
767
|
-
|
|
766
|
+
var x = 0, S, ee = W.parentNode !== t, C = !Wt(W.animated && W.toRect || r, n.animated && n.toRect || i, f), w = f ? "top" : "left", T = Ge(n, "top", "top") || Ge(W, "top", "top"), te = T ? T.scrollTop : void 0;
|
|
767
|
+
At !== n && (S = i[w], Mt = !1, Nt = !C && o.invertSwap || ee), x = rn(e, n, i, f, C ? 1 : o.swapThreshold, o.invertedSwapThreshold == null ? o.swapThreshold : o.invertedSwapThreshold, Nt, At === n);
|
|
768
768
|
var E;
|
|
769
769
|
if (x !== 0) {
|
|
770
770
|
var D = B(W);
|
|
@@ -773,11 +773,11 @@ Q.prototype = {
|
|
|
773
773
|
while (E && (R(E, "display") === "none" || E === K));
|
|
774
774
|
}
|
|
775
775
|
if (x === 0 || E === n) return _(!1);
|
|
776
|
-
|
|
777
|
-
var O = n.nextElementSibling,
|
|
778
|
-
|
|
779
|
-
var
|
|
780
|
-
if (
|
|
776
|
+
At = n, jt = x;
|
|
777
|
+
var O = n.nextElementSibling, ne = !1;
|
|
778
|
+
ne = x === 1;
|
|
779
|
+
var re = Qt(q, t, W, r, n, i, e, ne);
|
|
780
|
+
if (re !== !1) return (re === 1 || re === -1) && (ne = re === 1), It = !0, setTimeout(en, 30), g(), ne && !O ? t.appendChild(W) : n.parentNode.insertBefore(W, ne ? O : n), T && nt(T, 0, te - T.scrollTop), G = W.parentNode, S !== void 0 && !Nt && (Pt = Math.abs(S - z(n)[w])), v(), _(!0);
|
|
781
781
|
}
|
|
782
782
|
if (t.contains(W)) return _(!1);
|
|
783
783
|
}
|
|
@@ -785,7 +785,7 @@ Q.prototype = {
|
|
|
785
785
|
},
|
|
786
786
|
_ignoreWhileAnimating: null,
|
|
787
787
|
_offMoveEvents: function() {
|
|
788
|
-
F(document, "mousemove", this._onTouchMove), F(document, "touchmove", this._onTouchMove), F(document, "pointermove", this._onTouchMove), F(document, "dragover",
|
|
788
|
+
F(document, "mousemove", this._onTouchMove), F(document, "touchmove", this._onTouchMove), F(document, "pointermove", this._onTouchMove), F(document, "dragover", Yt), F(document, "mousemove", Yt), F(document, "touchmove", Yt);
|
|
789
789
|
},
|
|
790
790
|
_offUpEvents: function() {
|
|
791
791
|
var e = this.el.ownerDocument;
|
|
@@ -793,18 +793,18 @@ Q.prototype = {
|
|
|
793
793
|
},
|
|
794
794
|
_onDrop: function(e) {
|
|
795
795
|
var t = this.el, n = this.options;
|
|
796
|
-
if (Y = B(W),
|
|
796
|
+
if (Y = B(W), vt = B(W, n.draggable), H("drop", this, { evt: e }), G = W && W.parentNode, Y = B(W), vt = B(W, n.draggable), Q.eventCanceled) {
|
|
797
797
|
this._nulling();
|
|
798
798
|
return;
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
bt = !1, Nt = !1, Mt = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), ln(this.cloneId), ln(this._dragStartId), this.nativeDraggable && (F(document, "drop", this), F(t, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Fe && R(document.body, "user-select", ""), R(W, "transform", ""), e && (kt && (e.cancelable && e.preventDefault(), !n.dropBubble && e.stopPropagation()), K && K.parentNode && K.parentNode.removeChild(K), (q === G || X && X.lastPutMode !== "clone") && J && J.parentNode && J.parentNode.removeChild(J), W && (this.nativeDraggable && F(W, "dragend", this), $t(W), W.style["will-change"] = "", kt && !bt && L(W, X ? X.options.ghostClass : this.options.ghostClass, !1), L(W, this.options.chosenClass, !1), U({
|
|
801
801
|
sortable: this,
|
|
802
802
|
name: "unchoose",
|
|
803
803
|
toEl: G,
|
|
804
804
|
newIndex: null,
|
|
805
805
|
newDraggableIndex: null,
|
|
806
806
|
originalEvent: e
|
|
807
|
-
}), q === G ? Y !==
|
|
807
|
+
}), q === G ? Y !== gt && Y >= 0 && (U({
|
|
808
808
|
sortable: this,
|
|
809
809
|
name: "update",
|
|
810
810
|
toEl: G,
|
|
@@ -836,7 +836,7 @@ Q.prototype = {
|
|
|
836
836
|
name: "sort",
|
|
837
837
|
toEl: G,
|
|
838
838
|
originalEvent: e
|
|
839
|
-
})), X && X.save()), Q.active && ((Y == null || Y === -1) && (Y =
|
|
839
|
+
})), X && X.save()), Q.active && ((Y == null || Y === -1) && (Y = gt, vt = _t), U({
|
|
840
840
|
sortable: this,
|
|
841
841
|
name: "end",
|
|
842
842
|
toEl: G,
|
|
@@ -844,11 +844,11 @@ Q.prototype = {
|
|
|
844
844
|
}), this.save()))), this._nulling();
|
|
845
845
|
},
|
|
846
846
|
_nulling: function() {
|
|
847
|
-
H("nulling", this), q = W = G = K =
|
|
847
|
+
H("nulling", this), q = W = G = K = pt = J = mt = ht = Ct = wt = kt = Y = vt = gt = _t = At = jt = X = yt = Q.dragged = Q.ghost = Q.clone = Q.active = null;
|
|
848
848
|
var e = this.el;
|
|
849
|
-
|
|
849
|
+
Lt.forEach(function(t) {
|
|
850
850
|
e.contains(t) && (t.checked = !0);
|
|
851
|
-
}),
|
|
851
|
+
}), Lt.length = Tt = Et = 0;
|
|
852
852
|
},
|
|
853
853
|
handleEvent: function(e) {
|
|
854
854
|
switch (e.type) {
|
|
@@ -858,7 +858,7 @@ Q.prototype = {
|
|
|
858
858
|
break;
|
|
859
859
|
case "dragenter":
|
|
860
860
|
case "dragover":
|
|
861
|
-
W && (this._onDragOver(e),
|
|
861
|
+
W && (this._onDragOver(e), Zt(e));
|
|
862
862
|
break;
|
|
863
863
|
case "selectstart":
|
|
864
864
|
e.preventDefault();
|
|
@@ -866,7 +866,7 @@ Q.prototype = {
|
|
|
866
866
|
}
|
|
867
867
|
},
|
|
868
868
|
toArray: function() {
|
|
869
|
-
for (var e = [], t, n = this.el.children, r = 0, i = n.length, a = this.options; r < i; r++) t = n[r], I(t, a.draggable, this.el, !1) && e.push(t.getAttribute(a.dataIdAttr) ||
|
|
869
|
+
for (var e = [], t, n = this.el.children, r = 0, i = n.length, a = this.options; r < i; r++) t = n[r], I(t, a.draggable, this.el, !1) && e.push(t.getAttribute(a.dataIdAttr) || on(t));
|
|
870
870
|
return e;
|
|
871
871
|
},
|
|
872
872
|
sort: function(e, t) {
|
|
@@ -888,20 +888,20 @@ Q.prototype = {
|
|
|
888
888
|
option: function(e, t) {
|
|
889
889
|
var n = this.options;
|
|
890
890
|
if (t === void 0) return n[e];
|
|
891
|
-
var r =
|
|
892
|
-
r === void 0 ? n[e] = t : n[e] = r, e === "group" &&
|
|
891
|
+
var r = ut.modifyOption(this, e, t);
|
|
892
|
+
r === void 0 ? n[e] = t : n[e] = r, e === "group" && Kt(n);
|
|
893
893
|
},
|
|
894
894
|
destroy: function() {
|
|
895
895
|
H("destroy", this);
|
|
896
896
|
var e = this.el;
|
|
897
897
|
e[V] = null, F(e, "mousedown", this._onTapStart), F(e, "touchstart", this._onTapStart), F(e, "pointerdown", this._onTapStart), this.nativeDraggable && (F(e, "dragover", this), F(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(e) {
|
|
898
898
|
e.removeAttribute("draggable");
|
|
899
|
-
}), this._onDrop(), this._disableDelayedDragEvents(),
|
|
899
|
+
}), this._onDrop(), this._disableDelayedDragEvents(), St.splice(St.indexOf(this.el), 1), this.el = e = null;
|
|
900
900
|
},
|
|
901
901
|
_hideClone: function() {
|
|
902
|
-
if (!
|
|
902
|
+
if (!ht) {
|
|
903
903
|
if (H("hideClone", this), Q.eventCanceled) return;
|
|
904
|
-
R(J, "display", "none"), this.options.removeCloneOnHide && J.parentNode && J.parentNode.removeChild(J),
|
|
904
|
+
R(J, "display", "none"), this.options.removeCloneOnHide && J.parentNode && J.parentNode.removeChild(J), ht = !0;
|
|
905
905
|
}
|
|
906
906
|
},
|
|
907
907
|
_showClone: function(e) {
|
|
@@ -909,86 +909,86 @@ Q.prototype = {
|
|
|
909
909
|
this._hideClone();
|
|
910
910
|
return;
|
|
911
911
|
}
|
|
912
|
-
if (
|
|
912
|
+
if (ht) {
|
|
913
913
|
if (H("showClone", this), Q.eventCanceled) return;
|
|
914
|
-
W.parentNode == q && !this.options.group.revertClone ? q.insertBefore(J, W) :
|
|
914
|
+
W.parentNode == q && !this.options.group.revertClone ? q.insertBefore(J, W) : pt ? q.insertBefore(J, pt) : q.appendChild(J), this.options.group.revertClone && this.animate(W, J), R(J, "display", ""), ht = !1;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
|
-
function
|
|
918
|
+
function Zt(e) {
|
|
919
919
|
e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function Qt(e, t, n, r, i, a, o, s) {
|
|
922
922
|
var c, l = e[V], u = l.options.onMove, d;
|
|
923
|
-
return window.CustomEvent && !
|
|
923
|
+
return window.CustomEvent && !Me && !Ne ? c = new CustomEvent("move", {
|
|
924
924
|
bubbles: !0,
|
|
925
925
|
cancelable: !0
|
|
926
926
|
}) : (c = document.createEvent("Event"), c.initEvent("move", !0, !0)), c.to = t, c.from = e, c.dragged = n, c.draggedRect = r, c.related = i || t, c.relatedRect = a || z(t), c.willInsertAfter = s, c.originalEvent = o, e.dispatchEvent(c), u && (d = u.call(l, c, o)), d;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function $t(e) {
|
|
929
929
|
e.draggable = !1;
|
|
930
930
|
}
|
|
931
|
-
function
|
|
932
|
-
|
|
931
|
+
function en() {
|
|
932
|
+
It = !1;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
935
|
-
var r = z(
|
|
934
|
+
function tn(e, t, n) {
|
|
935
|
+
var r = z(Ke(n.el, 0, n.options, !0)), i = it(n.el, n.options, K), a = 10;
|
|
936
936
|
return t ? e.clientX < i.left - a || e.clientY < r.top && e.clientX < r.right : e.clientY < i.top - a || e.clientY < r.bottom && e.clientX < r.left;
|
|
937
937
|
}
|
|
938
|
-
function
|
|
939
|
-
var r = z(
|
|
938
|
+
function nn(e, t, n) {
|
|
939
|
+
var r = z(qe(n.el, n.options.draggable)), i = it(n.el, n.options, K), a = 10;
|
|
940
940
|
return t ? e.clientX > i.right + a || e.clientY > r.bottom && e.clientX > r.left : e.clientY > i.bottom + a || e.clientX > r.right && e.clientY > r.top;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function rn(e, t, n, r, i, a, o, s) {
|
|
943
943
|
var c = r ? e.clientY : e.clientX, l = r ? n.height : n.width, u = r ? n.top : n.left, d = r ? n.bottom : n.right, f = !1;
|
|
944
944
|
if (!o) {
|
|
945
|
-
if (s &&
|
|
946
|
-
if (!
|
|
947
|
-
else if (
|
|
948
|
-
} else if (c > u + l * (1 - i) / 2 && c < d - l * (1 - i) / 2) return
|
|
945
|
+
if (s && Pt < l * i) {
|
|
946
|
+
if (!Mt && (jt === 1 ? c > u + l * a / 2 : c < d - l * a / 2) && (Mt = !0), Mt) f = !0;
|
|
947
|
+
else if (jt === 1 ? c < u + Pt : c > d - Pt) return -jt;
|
|
948
|
+
} else if (c > u + l * (1 - i) / 2 && c < d - l * (1 - i) / 2) return an(t);
|
|
949
949
|
}
|
|
950
950
|
return f ||= o, f && (c < u + l * a / 2 || c > d - l * a / 2) ? c > u + l / 2 ? 1 : -1 : 0;
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function an(e) {
|
|
953
953
|
return B(W) < B(e) ? 1 : -1;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function on(e) {
|
|
956
956
|
for (var t = e.tagName + e.className + e.src + e.href + e.textContent, n = t.length, r = 0; n--;) r += t.charCodeAt(n);
|
|
957
957
|
return r.toString(36);
|
|
958
958
|
}
|
|
959
|
-
function
|
|
960
|
-
|
|
959
|
+
function sn(e) {
|
|
960
|
+
Lt.length = 0;
|
|
961
961
|
for (var t = e.getElementsByTagName("input"), n = t.length; n--;) {
|
|
962
962
|
var r = t[n];
|
|
963
|
-
r.checked &&
|
|
963
|
+
r.checked && Lt.push(r);
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
|
-
function
|
|
966
|
+
function cn(e) {
|
|
967
967
|
return setTimeout(e, 0);
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function ln(e) {
|
|
970
970
|
return clearTimeout(e);
|
|
971
971
|
}
|
|
972
|
-
|
|
973
|
-
(Q.active ||
|
|
972
|
+
Rt && P(document, "touchmove", function(e) {
|
|
973
|
+
(Q.active || bt) && e.cancelable && e.preventDefault();
|
|
974
974
|
}), Q.utils = {
|
|
975
975
|
on: P,
|
|
976
976
|
off: F,
|
|
977
977
|
css: R,
|
|
978
|
-
find:
|
|
978
|
+
find: Ue,
|
|
979
979
|
is: function(e, t) {
|
|
980
980
|
return !!I(e, t, e, !1);
|
|
981
981
|
},
|
|
982
|
-
extend:
|
|
983
|
-
throttle:
|
|
982
|
+
extend: Ze,
|
|
983
|
+
throttle: et,
|
|
984
984
|
closest: I,
|
|
985
985
|
toggleClass: L,
|
|
986
|
-
clone:
|
|
986
|
+
clone: rt,
|
|
987
987
|
index: B,
|
|
988
|
-
nextTick:
|
|
989
|
-
cancelNextTick:
|
|
990
|
-
detectDirection:
|
|
991
|
-
getChild:
|
|
988
|
+
nextTick: cn,
|
|
989
|
+
cancelNextTick: ln,
|
|
990
|
+
detectDirection: Ut,
|
|
991
|
+
getChild: Ke,
|
|
992
992
|
expando: V
|
|
993
993
|
}, Q.get = function(e) {
|
|
994
994
|
return e[V];
|
|
@@ -996,13 +996,13 @@ It && P(document, "touchmove", function(e) {
|
|
|
996
996
|
var e = [...arguments];
|
|
997
997
|
e[0].constructor === Array && (e = e[0]), e.forEach(function(e) {
|
|
998
998
|
if (!e.prototype || !e.prototype.constructor) throw `Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(e)}`;
|
|
999
|
-
e.utils && (Q.utils =
|
|
999
|
+
e.utils && (Q.utils = we(we({}, Q.utils), e.utils)), ut.mount(e);
|
|
1000
1000
|
});
|
|
1001
1001
|
}, Q.create = function(e, t) {
|
|
1002
1002
|
return new Q(e, t);
|
|
1003
|
-
}, Q.version =
|
|
1004
|
-
var $ = [],
|
|
1005
|
-
function
|
|
1003
|
+
}, Q.version = Ae;
|
|
1004
|
+
var $ = [], un, dn, fn = !1, pn, mn, hn, gn;
|
|
1005
|
+
function _n() {
|
|
1006
1006
|
function e() {
|
|
1007
1007
|
for (var e in this.defaults = {
|
|
1008
1008
|
scroll: !0,
|
|
@@ -1022,63 +1022,63 @@ function hn() {
|
|
|
1022
1022
|
!this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
|
|
1023
1023
|
},
|
|
1024
1024
|
drop: function() {
|
|
1025
|
-
this.sortable.nativeDraggable ? F(document, "dragover", this._handleAutoScroll) : (F(document, "pointermove", this._handleFallbackAutoScroll), F(document, "touchmove", this._handleFallbackAutoScroll), F(document, "mousemove", this._handleFallbackAutoScroll)),
|
|
1025
|
+
this.sortable.nativeDraggable ? F(document, "dragover", this._handleAutoScroll) : (F(document, "pointermove", this._handleFallbackAutoScroll), F(document, "touchmove", this._handleFallbackAutoScroll), F(document, "mousemove", this._handleFallbackAutoScroll)), yn(), vn(), tt();
|
|
1026
1026
|
},
|
|
1027
1027
|
nulling: function() {
|
|
1028
|
-
|
|
1028
|
+
hn = dn = un = fn = gn = pn = mn = null, $.length = 0;
|
|
1029
1029
|
},
|
|
1030
1030
|
_handleFallbackAutoScroll: function(e) {
|
|
1031
1031
|
this._handleAutoScroll(e, !0);
|
|
1032
1032
|
},
|
|
1033
1033
|
_handleAutoScroll: function(e, t) {
|
|
1034
1034
|
var n = this, r = (e.touches ? e.touches[0] : e).clientX, i = (e.touches ? e.touches[0] : e).clientY, a = document.elementFromPoint(r, i);
|
|
1035
|
-
if (
|
|
1036
|
-
|
|
1037
|
-
var o =
|
|
1038
|
-
|
|
1039
|
-
var a =
|
|
1040
|
-
a !== o && (o = a,
|
|
1041
|
-
}, 10),
|
|
1035
|
+
if (hn = e, t || this.options.forceAutoScrollFallback || Ne || Me || Fe) {
|
|
1036
|
+
bn(e, this.options, a, t);
|
|
1037
|
+
var o = Xe(a, !0);
|
|
1038
|
+
fn && (!gn || r !== pn || i !== mn) && (gn && yn(), gn = setInterval(function() {
|
|
1039
|
+
var a = Xe(document.elementFromPoint(r, i), !0);
|
|
1040
|
+
a !== o && (o = a, vn()), bn(e, n.options, a, t);
|
|
1041
|
+
}, 10), pn = r, mn = i);
|
|
1042
1042
|
} else {
|
|
1043
|
-
if (!this.options.bubbleScroll ||
|
|
1044
|
-
|
|
1043
|
+
if (!this.options.bubbleScroll || Xe(a, !0) === We()) {
|
|
1044
|
+
vn();
|
|
1045
1045
|
return;
|
|
1046
1046
|
}
|
|
1047
|
-
|
|
1047
|
+
bn(e, this.options, Xe(a, !1), !1);
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
|
-
},
|
|
1050
|
+
}, Se(e, {
|
|
1051
1051
|
pluginName: "scroll",
|
|
1052
1052
|
initializeByDefault: !0
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function vn() {
|
|
1056
1056
|
$.forEach(function(e) {
|
|
1057
1057
|
clearInterval(e.pid);
|
|
1058
1058
|
}), $ = [];
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1061
|
-
clearInterval(
|
|
1060
|
+
function yn() {
|
|
1061
|
+
clearInterval(gn);
|
|
1062
1062
|
}
|
|
1063
|
-
var
|
|
1063
|
+
var bn = et(function(e, t, n, r) {
|
|
1064
1064
|
if (t.scroll) {
|
|
1065
|
-
var i = (e.touches ? e.touches[0] : e).clientX, a = (e.touches ? e.touches[0] : e).clientY, o = t.scrollSensitivity, s = t.scrollSpeed, c =
|
|
1066
|
-
|
|
1067
|
-
var d = 0, f =
|
|
1065
|
+
var i = (e.touches ? e.touches[0] : e).clientX, a = (e.touches ? e.touches[0] : e).clientY, o = t.scrollSensitivity, s = t.scrollSpeed, c = We(), l = !1, u;
|
|
1066
|
+
dn !== n && (dn = n, vn(), un = t.scroll, u = t.scrollFn, un === !0 && (un = Xe(n, !0)));
|
|
1067
|
+
var d = 0, f = un;
|
|
1068
1068
|
do {
|
|
1069
1069
|
var p = f, m = z(p), h = m.top, g = m.bottom, _ = m.left, v = m.right, y = m.width, b = m.height, x = void 0, S = void 0, ee = p.scrollWidth, C = p.scrollHeight, w = R(p), T = p.scrollLeft, te = p.scrollTop;
|
|
1070
1070
|
p === c ? (x = y < ee && (w.overflowX === "auto" || w.overflowX === "scroll" || w.overflowX === "visible"), S = b < C && (w.overflowY === "auto" || w.overflowY === "scroll" || w.overflowY === "visible")) : (x = y < ee && (w.overflowX === "auto" || w.overflowX === "scroll"), S = b < C && (w.overflowY === "auto" || w.overflowY === "scroll"));
|
|
1071
1071
|
var E = x && (Math.abs(v - i) <= o && T + y < ee) - (Math.abs(_ - i) <= o && !!T), D = S && (Math.abs(g - a) <= o && te + b < C) - (Math.abs(h - a) <= o && !!te);
|
|
1072
1072
|
if (!$[d]) for (var O = 0; O <= d; O++) $[O] || ($[O] = {});
|
|
1073
1073
|
($[d].vx != E || $[d].vy != D || $[d].el !== p) && ($[d].el = p, $[d].vx = E, $[d].vy = D, clearInterval($[d].pid), (E != 0 || D != 0) && (l = !0, $[d].pid = setInterval(function() {
|
|
1074
|
-
r && this.layer === 0 && Q.active._onTouchMove(
|
|
1074
|
+
r && this.layer === 0 && Q.active._onTouchMove(hn);
|
|
1075
1075
|
var t = $[this.layer].vy ? $[this.layer].vy * s : 0, n = $[this.layer].vx ? $[this.layer].vx * s : 0;
|
|
1076
|
-
typeof u == "function" && u.call(Q.dragged.parentNode[V], n, t, e,
|
|
1076
|
+
typeof u == "function" && u.call(Q.dragged.parentNode[V], n, t, e, hn, $[this.layer].el) !== "continue" || nt($[this.layer].el, n, t);
|
|
1077
1077
|
}.bind({ layer: d }), 24))), d++;
|
|
1078
|
-
} while (t.bubbleScroll && f !== c && (f =
|
|
1079
|
-
|
|
1078
|
+
} while (t.bubbleScroll && f !== c && (f = Xe(f, !1)));
|
|
1079
|
+
fn = l;
|
|
1080
1080
|
}
|
|
1081
|
-
}, 30),
|
|
1081
|
+
}, 30), xn = function(e) {
|
|
1082
1082
|
var t = e.originalEvent, n = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, o = e.hideGhostForTarget, s = e.unhideGhostForTarget;
|
|
1083
1083
|
if (t) {
|
|
1084
1084
|
var c = n || i;
|
|
@@ -1090,8 +1090,8 @@ var vn = Qe(function(e, t, n, r) {
|
|
|
1090
1090
|
}));
|
|
1091
1091
|
}
|
|
1092
1092
|
};
|
|
1093
|
-
function
|
|
1094
|
-
|
|
1093
|
+
function Sn() {}
|
|
1094
|
+
Sn.prototype = {
|
|
1095
1095
|
startIndex: null,
|
|
1096
1096
|
dragStart: function(e) {
|
|
1097
1097
|
var t = e.oldDraggableIndex;
|
|
@@ -1100,22 +1100,26 @@ bn.prototype = {
|
|
|
1100
1100
|
onSpill: function(e) {
|
|
1101
1101
|
var t = e.dragEl, n = e.putSortable;
|
|
1102
1102
|
this.sortable.captureAnimationState(), n && n.captureAnimationState();
|
|
1103
|
-
var r =
|
|
1103
|
+
var r = Ke(this.sortable.el, this.startIndex, this.options);
|
|
1104
1104
|
r ? this.sortable.el.insertBefore(t, r) : this.sortable.el.appendChild(t), this.sortable.animateAll(), n && n.animateAll();
|
|
1105
1105
|
},
|
|
1106
|
-
drop:
|
|
1107
|
-
},
|
|
1108
|
-
function
|
|
1109
|
-
|
|
1106
|
+
drop: xn
|
|
1107
|
+
}, Se(Sn, { pluginName: "revertOnSpill" });
|
|
1108
|
+
function Cn() {}
|
|
1109
|
+
Cn.prototype = {
|
|
1110
1110
|
onSpill: function(e) {
|
|
1111
1111
|
var t = e.dragEl, n = e.putSortable || this.sortable;
|
|
1112
1112
|
n.captureAnimationState(), t.parentNode && t.parentNode.removeChild(t), n.animateAll();
|
|
1113
1113
|
},
|
|
1114
|
-
drop:
|
|
1115
|
-
},
|
|
1114
|
+
drop: xn
|
|
1115
|
+
}, Se(Cn, { pluginName: "removeOnSpill" }), Q.mount(new _n()), Q.mount(Cn, Sn);
|
|
1116
1116
|
//#endregion
|
|
1117
1117
|
//#region src/designer/CockpitWidgetPreview.vue?vue&type=script&setup=true&lang.ts
|
|
1118
|
-
var
|
|
1118
|
+
var wn = ["src", "alt"], Tn = { class: "lumal-cockpit-designer__widget-preview-fallback" }, En = {
|
|
1119
|
+
key: 2,
|
|
1120
|
+
class: "lumal-cockpit-designer__widget-preview-placeholder",
|
|
1121
|
+
"aria-hidden": "true"
|
|
1122
|
+
}, Dn = /* @__PURE__ */ x({
|
|
1119
1123
|
__name: "CockpitWidgetPreview",
|
|
1120
1124
|
props: {
|
|
1121
1125
|
cockpitId: {},
|
|
@@ -1124,22 +1128,27 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1124
1128
|
layoutId: {},
|
|
1125
1129
|
messageBus: {},
|
|
1126
1130
|
baseWidth: { default: 480 },
|
|
1127
|
-
baseHeight: { default: 270 }
|
|
1131
|
+
baseHeight: { default: 270 },
|
|
1132
|
+
live: {
|
|
1133
|
+
type: Boolean,
|
|
1134
|
+
default: !1
|
|
1135
|
+
}
|
|
1128
1136
|
},
|
|
1129
1137
|
setup(e) {
|
|
1130
|
-
let t = e, n = D(null), r = t.messageBus ?? c(), i =
|
|
1138
|
+
let t = e, n = D(null), r = t.messageBus ?? c(), i = ie({
|
|
1131
1139
|
cockpitId: t.cockpitId,
|
|
1132
1140
|
layoutId: t.layoutId,
|
|
1133
1141
|
instanceId: t.instanceId,
|
|
1134
1142
|
mode: "design",
|
|
1135
1143
|
messages: r
|
|
1136
1144
|
});
|
|
1137
|
-
|
|
1145
|
+
le(() => {
|
|
1138
1146
|
i.cockpitId = t.cockpitId, i.layoutId = t.layoutId, i.instanceId = t.instanceId;
|
|
1139
1147
|
}), u(i);
|
|
1140
1148
|
let a = m(() => l(t.definition.component)), { result: s } = d(n, {
|
|
1141
1149
|
baseWidth: () => t.baseWidth,
|
|
1142
|
-
baseHeight: () => t.baseHeight
|
|
1150
|
+
baseHeight: () => t.baseHeight,
|
|
1151
|
+
enabled: () => t.live
|
|
1143
1152
|
}), f = m(() => ({
|
|
1144
1153
|
width: `${t.baseWidth}px`,
|
|
1145
1154
|
height: `${t.baseHeight}px`,
|
|
@@ -1157,25 +1166,28 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1157
1166
|
src: e.definition.thumbnail,
|
|
1158
1167
|
alt: `${e.definition.label}预览`,
|
|
1159
1168
|
class: "lumal-cockpit-designer__widget-preview-image"
|
|
1160
|
-
}, null, 8,
|
|
1169
|
+
}, null, 8, wn)) : e.live ? (E(), _("div", {
|
|
1161
1170
|
key: 1,
|
|
1162
1171
|
class: "lumal-cockpit-designer__widget-preview-stage",
|
|
1163
1172
|
style: w(f.value),
|
|
1164
1173
|
inert: "",
|
|
1165
1174
|
"aria-hidden": "true"
|
|
1166
1175
|
}, [b(o, null, {
|
|
1167
|
-
error: j(() => [v("div",
|
|
1176
|
+
error: j(() => [v("div", Tn, [b(A(N), {
|
|
1168
1177
|
name: e.definition.icon || "lumal:grid",
|
|
1169
1178
|
size: 28
|
|
1170
1179
|
}, null, 8, ["name"]), r[0] ||= v("span", null, "预览不可用", -1)])]),
|
|
1171
|
-
default: j(() => [(E(), h(
|
|
1180
|
+
default: j(() => [(E(), h(re(a.value), { context: A(i) }, null, 8, ["context"]))]),
|
|
1172
1181
|
_: 1
|
|
1173
|
-
})], 4))
|
|
1182
|
+
})], 4)) : (E(), _("div", En, [b(A(N), {
|
|
1183
|
+
name: e.definition.icon || "lumal:grid",
|
|
1184
|
+
size: 28
|
|
1185
|
+
}, null, 8, ["name"])]))], 512));
|
|
1174
1186
|
}
|
|
1175
|
-
}),
|
|
1187
|
+
}), On = {
|
|
1176
1188
|
class: "lumal-cockpit-designer__library",
|
|
1177
|
-
"aria-label": "
|
|
1178
|
-
},
|
|
1189
|
+
"aria-label": "模块选择"
|
|
1190
|
+
}, kn = { class: "lumal-cockpit-designer__library-head" }, An = { class: "lumal-cockpit-designer__library-count" }, jn = ["data-cockpit-library-type", "data-cockpit-library-title"], Mn = /* @__PURE__ */ x({
|
|
1179
1191
|
__name: "CockpitComponentLibrary",
|
|
1180
1192
|
props: {
|
|
1181
1193
|
cockpitId: {},
|
|
@@ -1201,7 +1213,7 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1201
1213
|
}));
|
|
1202
1214
|
}), T(() => {
|
|
1203
1215
|
a?.destroy();
|
|
1204
|
-
}), (t, n) => (E(), _("aside",
|
|
1216
|
+
}), (t, n) => (E(), _("aside", On, [v("header", kn, [n[0] ||= v("div", { class: "lumal-cockpit-designer__library-head-copy" }, [v("strong", null, "模块选择"), v("span", null, "拖拽模块到左侧或右侧区域,也可点击后选择目标槽位")], -1), v("span", An, k(o.value.length) + " 个", 1)]), v("div", {
|
|
1205
1217
|
ref_key: "libraryRef",
|
|
1206
1218
|
ref: i,
|
|
1207
1219
|
class: "lumal-cockpit-designer__library-grid"
|
|
@@ -1210,11 +1222,12 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1210
1222
|
class: C(["lumal-cockpit-designer__library-card", { "is-selected": e.selectedType === t.type }]),
|
|
1211
1223
|
"data-cockpit-library-type": t.type,
|
|
1212
1224
|
"data-cockpit-library-title": t.label
|
|
1213
|
-
}, [b(
|
|
1225
|
+
}, [b(Dn, {
|
|
1214
1226
|
"cockpit-id": e.cockpitId,
|
|
1215
1227
|
definition: t,
|
|
1216
1228
|
"instance-id": `library-preview:${t.type}`,
|
|
1217
|
-
"layout-id": e.layoutId
|
|
1229
|
+
"layout-id": e.layoutId,
|
|
1230
|
+
live: ""
|
|
1218
1231
|
}, null, 8, [
|
|
1219
1232
|
"cockpit-id",
|
|
1220
1233
|
"definition",
|
|
@@ -1227,13 +1240,13 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1227
1240
|
"aria-pressed": e.selectedType === t.type,
|
|
1228
1241
|
onClick: (e) => r("selectWidget", t)
|
|
1229
1242
|
}, {
|
|
1230
|
-
default: j(() => [y(
|
|
1243
|
+
default: j(() => [y(k(t.label), 1)]),
|
|
1231
1244
|
_: 2
|
|
1232
1245
|
}, 1032, [
|
|
1233
1246
|
"aria-label",
|
|
1234
1247
|
"aria-pressed",
|
|
1235
1248
|
"onClick"
|
|
1236
|
-
])], 10,
|
|
1249
|
+
])], 10, jn))), 128)), o.value.length ? g("", !0) : (E(), h(A(fe), {
|
|
1237
1250
|
key: 0,
|
|
1238
1251
|
class: "lumal-cockpit-designer__library-empty",
|
|
1239
1252
|
description: "暂无可用模块",
|
|
@@ -1243,9 +1256,9 @@ var Sn = ["src", "alt"], Cn = { class: "lumal-cockpit-designer__widget-preview-f
|
|
|
1243
1256
|
});
|
|
1244
1257
|
//#endregion
|
|
1245
1258
|
//#region src/designer/confirmWidgetReplacement.ts
|
|
1246
|
-
async function
|
|
1259
|
+
async function Nn() {
|
|
1247
1260
|
try {
|
|
1248
|
-
return await
|
|
1261
|
+
return await ge.confirm("目标槽位已有模块,是否替换?", "确认替换", {
|
|
1249
1262
|
cancelButtonText: "取消",
|
|
1250
1263
|
confirmButtonText: "替换",
|
|
1251
1264
|
type: "warning"
|
|
@@ -1256,7 +1269,7 @@ async function On() {
|
|
|
1256
1269
|
}
|
|
1257
1270
|
//#endregion
|
|
1258
1271
|
//#region src/designer/CockpitWidgetDropZone.vue
|
|
1259
|
-
var
|
|
1272
|
+
var Pn = /* @__PURE__ */ x({
|
|
1260
1273
|
__name: "CockpitWidgetDropZone",
|
|
1261
1274
|
props: {
|
|
1262
1275
|
allowMultiple: {
|
|
@@ -1297,7 +1310,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1297
1310
|
}
|
|
1298
1311
|
async function l(e) {
|
|
1299
1312
|
let t = e.item, i = c(t), a = !n.allowMultiple && !!n.widget;
|
|
1300
|
-
if (a && !await
|
|
1313
|
+
if (a && !await Nn()) {
|
|
1301
1314
|
if (i.source) {
|
|
1302
1315
|
let n = e.from.children.item(e.oldIndex ?? e.from.children.length);
|
|
1303
1316
|
e.from.insertBefore(t, n);
|
|
@@ -1339,18 +1352,18 @@ var kn = /* @__PURE__ */ x({
|
|
|
1339
1352
|
ref_key: "zoneRef",
|
|
1340
1353
|
ref: i,
|
|
1341
1354
|
class: C(["lumal-cockpit-designer__drop-zone", { "is-tabs": e.allowMultiple }])
|
|
1342
|
-
}, [
|
|
1355
|
+
}, [ne(t.$slots, "default")], 2));
|
|
1343
1356
|
}
|
|
1344
|
-
}),
|
|
1357
|
+
}), Fn = ["data-side"], In = ["aria-label"], Ln = { class: "lumal-cockpit-designer__region-head-meta" }, Rn = { class: "lumal-cockpit-designer__field" }, zn = { class: "lumal-cockpit-designer__field" }, Bn = { class: "lumal-cockpit-designer__field lumal-cockpit-designer__region-width-field" }, Vn = {
|
|
1345
1358
|
key: 0,
|
|
1346
1359
|
class: "lumal-cockpit-designer__grid-rows"
|
|
1347
|
-
},
|
|
1360
|
+
}, Hn = ["aria-label"], Un = { class: "lumal-cockpit-designer__field" }, Wn = { class: "lumal-cockpit-designer__tabs-switch" }, Gn = ["data-cockpit-drag-source"], Kn = { class: "lumal-cockpit-designer__placed-widget-header" }, qn = { class: "lumal-cockpit-designer__placed-widget-actions" }, Jn = { class: "lumal-cockpit-designer__placed-widget-body" }, Yn = {
|
|
1348
1361
|
key: 1,
|
|
1349
1362
|
class: "lumal-cockpit-designer__widget-preview-fallback"
|
|
1350
|
-
},
|
|
1363
|
+
}, Xn = ["aria-label"], Zn = ["data-cockpit-drag-source"], Qn = ["id", "aria-labelledby"], $n = {
|
|
1351
1364
|
key: 1,
|
|
1352
1365
|
class: "lumal-cockpit-designer__widget-preview-fallback"
|
|
1353
|
-
},
|
|
1366
|
+
}, er = /* @__PURE__ */ x({
|
|
1354
1367
|
__name: "CockpitLayoutEditor",
|
|
1355
1368
|
props: {
|
|
1356
1369
|
cockpitId: {},
|
|
@@ -1364,95 +1377,143 @@ var kn = /* @__PURE__ */ x({
|
|
|
1364
1377
|
setup(e, { emit: t }) {
|
|
1365
1378
|
let n = e, r = t, i = m(() => {
|
|
1366
1379
|
let e = n.draft.activeLayout.value;
|
|
1367
|
-
if (e) return
|
|
1380
|
+
if (!e) return;
|
|
1381
|
+
let t = n.side === "left" ? e.left : e.right;
|
|
1382
|
+
return t ? { ...t } : void 0;
|
|
1383
|
+
}), a = m(() => {
|
|
1384
|
+
let e = /* @__PURE__ */ new Map();
|
|
1385
|
+
return i.value?.rows.forEach((t) => {
|
|
1386
|
+
t.cells.forEach((r) => {
|
|
1387
|
+
let i = {
|
|
1388
|
+
kind: "cell",
|
|
1389
|
+
side: n.side,
|
|
1390
|
+
rowId: t.id,
|
|
1391
|
+
cellId: r.id
|
|
1392
|
+
};
|
|
1393
|
+
e.set(r.id, {
|
|
1394
|
+
location: i,
|
|
1395
|
+
serialized: JSON.stringify(i)
|
|
1396
|
+
});
|
|
1397
|
+
});
|
|
1398
|
+
}), e;
|
|
1399
|
+
}), o = m(() => {
|
|
1400
|
+
let e = /* @__PURE__ */ new Map();
|
|
1401
|
+
return i.value?.rows.forEach((t) => {
|
|
1402
|
+
let r = {
|
|
1403
|
+
kind: "tabs",
|
|
1404
|
+
side: n.side,
|
|
1405
|
+
rowId: t.id
|
|
1406
|
+
};
|
|
1407
|
+
e.set(`row:${t.id}`, {
|
|
1408
|
+
location: r,
|
|
1409
|
+
serialized: JSON.stringify(r)
|
|
1410
|
+
}), t.widgets.forEach((t) => {
|
|
1411
|
+
let n = {
|
|
1412
|
+
...r,
|
|
1413
|
+
widgetId: t.id
|
|
1414
|
+
};
|
|
1415
|
+
e.set(`widget:${t.id}`, {
|
|
1416
|
+
location: n,
|
|
1417
|
+
serialized: JSON.stringify(n)
|
|
1418
|
+
});
|
|
1419
|
+
});
|
|
1420
|
+
}), e;
|
|
1368
1421
|
});
|
|
1369
|
-
function
|
|
1370
|
-
return {
|
|
1422
|
+
function s(e, t) {
|
|
1423
|
+
return a.value.get(t)?.location ?? {
|
|
1371
1424
|
kind: "cell",
|
|
1372
1425
|
side: n.side,
|
|
1373
1426
|
rowId: e.id,
|
|
1374
1427
|
cellId: t
|
|
1375
1428
|
};
|
|
1376
1429
|
}
|
|
1377
|
-
function
|
|
1378
|
-
|
|
1430
|
+
function c(e, t) {
|
|
1431
|
+
let r = t ? `widget:${t}` : `row:${e.id}`;
|
|
1432
|
+
return o.value.get(r)?.location ?? {
|
|
1379
1433
|
kind: "tabs",
|
|
1380
1434
|
side: n.side,
|
|
1381
1435
|
rowId: e.id,
|
|
1382
1436
|
widgetId: t
|
|
1383
1437
|
};
|
|
1384
1438
|
}
|
|
1385
|
-
function
|
|
1439
|
+
function l(e, t) {
|
|
1440
|
+
return a.value.get(t)?.serialized ?? JSON.stringify(s(e, t));
|
|
1441
|
+
}
|
|
1442
|
+
function u(e, t) {
|
|
1443
|
+
let n = t ? `widget:${t}` : `row:${e.id}`;
|
|
1444
|
+
return o.value.get(n)?.serialized ?? JSON.stringify(c(e, t));
|
|
1445
|
+
}
|
|
1446
|
+
function d(e) {
|
|
1386
1447
|
return n.registry.resolveWidget(e);
|
|
1387
1448
|
}
|
|
1388
|
-
function
|
|
1449
|
+
function f() {
|
|
1389
1450
|
let e = i.value?.columns.length ?? 1;
|
|
1390
|
-
return Array.from({ length: Math.max(1, e) }
|
|
1451
|
+
return Array.from({ length: Math.max(1, e) }).fill("minmax(0, 1fr)").join(" ");
|
|
1391
1452
|
}
|
|
1392
|
-
function
|
|
1453
|
+
function x(e) {
|
|
1393
1454
|
return e.widgets.find((t) => t.id === e.activeWidgetId) ?? e.widgets[0];
|
|
1394
1455
|
}
|
|
1395
|
-
function
|
|
1456
|
+
function S(e, t) {
|
|
1396
1457
|
return e.kind !== t.kind || e.side !== t.side || e.rowId !== t.rowId ? !1 : e.kind === "cell" ? e.cellId === t.cellId : e.widgetId === t.widgetId;
|
|
1397
1458
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return n.placementSelection?.kind === "placed" &&
|
|
1459
|
+
function T(e) {
|
|
1460
|
+
return n.placementSelection?.kind === "placed" && S(n.placementSelection.location, e);
|
|
1400
1461
|
}
|
|
1401
|
-
function
|
|
1462
|
+
function te(e) {
|
|
1402
1463
|
let t = n.placementSelection;
|
|
1403
|
-
return !!(t && (t.kind !== "placed" || !
|
|
1464
|
+
return !!(t && (t.kind !== "placed" || !S(t.location, e)));
|
|
1404
1465
|
}
|
|
1405
|
-
function
|
|
1406
|
-
n.draft.resizeRegion(n.side, e, t) ||
|
|
1466
|
+
function D(e, t) {
|
|
1467
|
+
n.draft.resizeRegion(n.side, e, t) || he.warning("缩减区域会移除已放置模块,请先拖动模块到保留槽位后再操作。");
|
|
1407
1468
|
}
|
|
1408
|
-
function
|
|
1469
|
+
function ne(e, t) {
|
|
1409
1470
|
if (!n.draft.setRowTabs(n.side, e.id, t)) {
|
|
1410
|
-
|
|
1471
|
+
he.warning("Tab 行中的模块数超过当前列数,无法解除合并。");
|
|
1411
1472
|
return;
|
|
1412
1473
|
}
|
|
1413
1474
|
n.placementSelection?.kind === "placed" && n.placementSelection.location.side === n.side && n.placementSelection.location.rowId === e.id && r("clearPlacement");
|
|
1414
1475
|
}
|
|
1415
|
-
function
|
|
1476
|
+
function re(e, t) {
|
|
1416
1477
|
r("selectPlaced", {
|
|
1417
1478
|
kind: "placed",
|
|
1418
1479
|
location: e,
|
|
1419
1480
|
widgetId: t.id,
|
|
1420
|
-
title: t.title ??
|
|
1481
|
+
title: t.title ?? d(t.type)?.label ?? t.type
|
|
1421
1482
|
});
|
|
1422
1483
|
}
|
|
1423
|
-
function
|
|
1424
|
-
|
|
1484
|
+
function ie(e) {
|
|
1485
|
+
T(e) && r("clearPlacement"), n.draft.removeWidget(e);
|
|
1425
1486
|
}
|
|
1426
|
-
async function
|
|
1487
|
+
async function ae(e) {
|
|
1427
1488
|
let t = n.placementSelection;
|
|
1428
|
-
if (!t || t.kind === "placed" &&
|
|
1489
|
+
if (!t || t.kind === "placed" && S(t.location, e)) return;
|
|
1429
1490
|
let i = !1;
|
|
1430
|
-
if (e.kind === "cell" && n.draft.hasWidgetAt(e) && (i = await
|
|
1491
|
+
if (e.kind === "cell" && n.draft.hasWidgetAt(e) && (i = await Nn(), !i)) return;
|
|
1431
1492
|
if (t.kind === "library") {
|
|
1432
|
-
n.draft.addWidget(e, t.type, t.title, i) ||
|
|
1493
|
+
n.draft.addWidget(e, t.type, t.title, i) || he.warning("模块放置失败,请检查目标槽位。");
|
|
1433
1494
|
return;
|
|
1434
1495
|
}
|
|
1435
1496
|
let a = n.draft.moveWidget(t.location, e, i);
|
|
1436
|
-
if (a.requiresReplace && await
|
|
1437
|
-
|
|
1497
|
+
if (a.requiresReplace && await Nn() && (a = n.draft.moveWidget(t.location, e, !0)), !a.moved) {
|
|
1498
|
+
he.warning("模块移动失败,请重新选择目标。");
|
|
1438
1499
|
return;
|
|
1439
1500
|
}
|
|
1440
1501
|
r("clearPlacement");
|
|
1441
1502
|
}
|
|
1442
|
-
function
|
|
1503
|
+
function oe(e, t) {
|
|
1443
1504
|
if (t.reorder && e.kind === "tabs") {
|
|
1444
1505
|
n.draft.reorderTabWidgets(n.side, e.rowId, t.reorder.oldIndex, t.reorder.newIndex);
|
|
1445
1506
|
return;
|
|
1446
1507
|
}
|
|
1447
1508
|
if (t.library) {
|
|
1448
|
-
n.draft.addWidget(e, t.library.type, t.library.title, t.replace) ||
|
|
1509
|
+
n.draft.addWidget(e, t.library.type, t.library.title, t.replace) || he.warning("目标槽位已有模块,请确认替换后再操作。");
|
|
1449
1510
|
return;
|
|
1450
1511
|
}
|
|
1451
1512
|
if (!t.source) return;
|
|
1452
1513
|
let i = n.draft.moveWidget(t.source, e, t.replace);
|
|
1453
|
-
!i.moved && !i.requiresReplace ?
|
|
1514
|
+
!i.moved && !i.requiresReplace ? he.error("模块移动失败。") : i.moved && n.placementSelection?.kind === "placed" && S(n.placementSelection.location, t.source) && r("clearPlacement");
|
|
1454
1515
|
}
|
|
1455
|
-
async function
|
|
1516
|
+
async function se(e, t, r) {
|
|
1456
1517
|
if (![
|
|
1457
1518
|
"ArrowLeft",
|
|
1458
1519
|
"ArrowRight",
|
|
@@ -1472,22 +1533,22 @@ var kn = /* @__PURE__ */ x({
|
|
|
1472
1533
|
role: "group",
|
|
1473
1534
|
"aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域布局设置`
|
|
1474
1535
|
}, [
|
|
1475
|
-
v("div",
|
|
1476
|
-
v("label",
|
|
1536
|
+
v("div", Ln, [v("strong", null, k(e.side === "left" ? "左侧区域" : "右侧区域"), 1), n[7] ||= v("span", null, "调整网格结构与区域宽", -1)]),
|
|
1537
|
+
v("label", Rn, [n[8] ||= v("span", null, "行", -1), b(A(me), {
|
|
1477
1538
|
"model-value": i.value?.rows.length ?? 1,
|
|
1478
1539
|
min: 1,
|
|
1479
1540
|
"aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域行数`,
|
|
1480
|
-
onChange: n[0] ||= (e) =>
|
|
1541
|
+
onChange: n[0] ||= (e) => D(e ?? 1, i.value?.columns.length ?? 1)
|
|
1481
1542
|
}, null, 8, ["model-value", "aria-label"])]),
|
|
1482
|
-
v("label",
|
|
1543
|
+
v("label", zn, [n[9] ||= v("span", null, "列", -1), b(A(me), {
|
|
1483
1544
|
"model-value": i.value?.columns.length ?? 1,
|
|
1484
1545
|
min: 1,
|
|
1485
1546
|
"aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域列数`,
|
|
1486
|
-
onChange: n[1] ||= (e) =>
|
|
1547
|
+
onChange: n[1] ||= (e) => D(i.value?.rows.length ?? 1, e ?? 1)
|
|
1487
1548
|
}, null, 8, ["model-value", "aria-label"])]),
|
|
1488
|
-
v("label",
|
|
1549
|
+
v("label", Bn, [
|
|
1489
1550
|
n[10] ||= v("span", null, "区域宽", -1),
|
|
1490
|
-
b(A(
|
|
1551
|
+
b(A(me), {
|
|
1491
1552
|
"model-value": i.value?.width ?? 0,
|
|
1492
1553
|
min: Math.max(1, i.value?.columns.length ?? 1),
|
|
1493
1554
|
"aria-label": `${e.side === "left" ? "左侧" : "右侧"}区域宽度像素`,
|
|
@@ -1499,7 +1560,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1499
1560
|
]),
|
|
1500
1561
|
n[11] ||= v("em", null, "px", -1)
|
|
1501
1562
|
])
|
|
1502
|
-
], 8,
|
|
1563
|
+
], 8, In), i.value ? (E(), _("div", Vn, [(E(!0), _(p, null, O(i.value.rows, (t, r) => (E(), _("section", {
|
|
1503
1564
|
key: t.id,
|
|
1504
1565
|
class: "lumal-cockpit-designer__grid-row",
|
|
1505
1566
|
style: w({ flex: `${t.height} 1 0` })
|
|
@@ -1509,10 +1570,10 @@ var kn = /* @__PURE__ */ x({
|
|
|
1509
1570
|
role: "group",
|
|
1510
1571
|
"aria-label": `${e.side === "left" ? "左侧" : "右侧"}第 ${r + 1} 行布局设置`
|
|
1511
1572
|
}, [
|
|
1512
|
-
v("strong", null, "第 " +
|
|
1513
|
-
v("label",
|
|
1573
|
+
v("strong", null, "第 " + k(r + 1) + " 行", 1),
|
|
1574
|
+
v("label", Un, [
|
|
1514
1575
|
n[12] ||= v("span", null, "行高", -1),
|
|
1515
|
-
b(A(
|
|
1576
|
+
b(A(me), {
|
|
1516
1577
|
"model-value": t.height,
|
|
1517
1578
|
min: 1,
|
|
1518
1579
|
max: 100,
|
|
@@ -1526,27 +1587,27 @@ var kn = /* @__PURE__ */ x({
|
|
|
1526
1587
|
]),
|
|
1527
1588
|
n[13] ||= v("em", null, "%", -1)
|
|
1528
1589
|
]),
|
|
1529
|
-
v("label",
|
|
1590
|
+
v("label", Wn, [n[14] ||= v("span", null, "合并列", -1), b(A(ye), {
|
|
1530
1591
|
"model-value": t.mode === "tabs",
|
|
1531
|
-
onChange: (e) =>
|
|
1592
|
+
onChange: (e) => ne(t, !!e)
|
|
1532
1593
|
}, null, 8, ["model-value", "onChange"])])
|
|
1533
|
-
], 8,
|
|
1594
|
+
], 8, Hn), t.mode === "grid" ? (E(), _("div", {
|
|
1534
1595
|
key: 0,
|
|
1535
1596
|
class: "lumal-cockpit-designer__grid-cells",
|
|
1536
|
-
style: w({ gridTemplateColumns:
|
|
1537
|
-
}, [(E(!0), _(p, null, O(t.cells, (r) => (E(), h(
|
|
1597
|
+
style: w({ gridTemplateColumns: f() })
|
|
1598
|
+
}, [(E(!0), _(p, null, O(t.cells, (r) => (E(), h(Pn, {
|
|
1538
1599
|
key: r.id,
|
|
1539
|
-
target:
|
|
1600
|
+
target: s(t, r.id),
|
|
1540
1601
|
widget: r.widget,
|
|
1541
|
-
onDrop: (e) =>
|
|
1602
|
+
onDrop: (e) => oe(s(t, r.id), e)
|
|
1542
1603
|
}, {
|
|
1543
1604
|
default: j(() => [r.widget ? (E(), _("article", {
|
|
1544
1605
|
key: 0,
|
|
1545
|
-
class: C(["lumal-cockpit-designer__placed-widget lumal-cockpit-designer__drag-item", { "is-keyboard-selected":
|
|
1546
|
-
"data-cockpit-drag-source":
|
|
1606
|
+
class: C(["lumal-cockpit-designer__placed-widget lumal-cockpit-designer__drag-item", { "is-keyboard-selected": T(s(t, r.id)) }]),
|
|
1607
|
+
"data-cockpit-drag-source": l(t, r.id),
|
|
1547
1608
|
"data-role": "placed-widget"
|
|
1548
|
-
}, [v("header",
|
|
1549
|
-
b(A(
|
|
1609
|
+
}, [v("header", Kn, [v("span", null, k(r.widget.title ?? r.widget.type), 1), v("div", qn, [
|
|
1610
|
+
b(A(be), {
|
|
1550
1611
|
content: "选择并移动模块",
|
|
1551
1612
|
placement: "top"
|
|
1552
1613
|
}, {
|
|
@@ -1554,9 +1615,9 @@ var kn = /* @__PURE__ */ x({
|
|
|
1554
1615
|
class: "lumal-cockpit-designer__widget-action",
|
|
1555
1616
|
"data-role": "select-move-source",
|
|
1556
1617
|
"aria-label": `选择移动模块 ${r.widget.title ?? r.widget.type}`,
|
|
1557
|
-
"aria-pressed":
|
|
1558
|
-
onMousedown: n[3] ||=
|
|
1559
|
-
onClick:
|
|
1618
|
+
"aria-pressed": T(s(t, r.id)),
|
|
1619
|
+
onMousedown: n[3] ||= ue(() => {}, ["stop"]),
|
|
1620
|
+
onClick: ue((e) => re(s(t, r.id), r.widget), ["stop"])
|
|
1560
1621
|
}, {
|
|
1561
1622
|
default: j(() => [b(A(N), {
|
|
1562
1623
|
name: "lumal:more",
|
|
@@ -1570,7 +1631,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1570
1631
|
])]),
|
|
1571
1632
|
_: 2
|
|
1572
1633
|
}, 1024),
|
|
1573
|
-
|
|
1634
|
+
te(s(t, r.id)) ? (E(), h(A(be), {
|
|
1574
1635
|
key: 0,
|
|
1575
1636
|
content: "移动并替换到此槽位",
|
|
1576
1637
|
placement: "top"
|
|
@@ -1579,8 +1640,8 @@ var kn = /* @__PURE__ */ x({
|
|
|
1579
1640
|
class: "lumal-cockpit-designer__widget-action",
|
|
1580
1641
|
"data-role": "keyboard-target",
|
|
1581
1642
|
"aria-label": `移动并替换 ${r.widget.title ?? r.widget.type}`,
|
|
1582
|
-
onMousedown: n[4] ||=
|
|
1583
|
-
onClick:
|
|
1643
|
+
onMousedown: n[4] ||= ue(() => {}, ["stop"]),
|
|
1644
|
+
onClick: ue((e) => ae(s(t, r.id)), ["stop"])
|
|
1584
1645
|
}, {
|
|
1585
1646
|
default: j(() => [b(A(N), {
|
|
1586
1647
|
name: "lumal:plus",
|
|
@@ -1590,7 +1651,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1590
1651
|
}, 8, ["aria-label", "onClick"])]),
|
|
1591
1652
|
_: 2
|
|
1592
1653
|
}, 1024)) : g("", !0),
|
|
1593
|
-
b(A(
|
|
1654
|
+
b(A(be), {
|
|
1594
1655
|
content: "移除模块",
|
|
1595
1656
|
placement: "top"
|
|
1596
1657
|
}, {
|
|
@@ -1599,7 +1660,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1599
1660
|
class: "lumal-cockpit-designer__widget-action",
|
|
1600
1661
|
"data-role": "remove-widget",
|
|
1601
1662
|
"aria-label": `移除模块 ${r.widget.title ?? r.widget.type}`,
|
|
1602
|
-
onClick: (e) =>
|
|
1663
|
+
onClick: (e) => ie(s(t, r.id))
|
|
1603
1664
|
}, {
|
|
1604
1665
|
default: j(() => [b(A(N), {
|
|
1605
1666
|
name: "lumal:close",
|
|
@@ -1609,28 +1670,29 @@ var kn = /* @__PURE__ */ x({
|
|
|
1609
1670
|
}, 8, ["aria-label", "onClick"])]),
|
|
1610
1671
|
_: 2
|
|
1611
1672
|
}, 1024)
|
|
1612
|
-
])]), v("div",
|
|
1673
|
+
])]), v("div", Jn, [d(r.widget.type) ? (E(), h(Dn, {
|
|
1613
1674
|
key: 0,
|
|
1614
1675
|
"cockpit-id": e.cockpitId,
|
|
1615
|
-
definition:
|
|
1676
|
+
definition: d(r.widget.type),
|
|
1616
1677
|
"instance-id": r.widget.id,
|
|
1617
1678
|
"layout-id": e.draft.activeLayout.value?.id ?? "",
|
|
1618
|
-
"message-bus": e.previewMessageBus
|
|
1679
|
+
"message-bus": e.previewMessageBus,
|
|
1680
|
+
live: ""
|
|
1619
1681
|
}, null, 8, [
|
|
1620
1682
|
"cockpit-id",
|
|
1621
1683
|
"definition",
|
|
1622
1684
|
"instance-id",
|
|
1623
1685
|
"layout-id",
|
|
1624
1686
|
"message-bus"
|
|
1625
|
-
])) : (E(), _("div",
|
|
1687
|
+
])) : (E(), _("div", Yn, " 未注册模块 "))])], 10, Gn)) : (E(), h(A(M), {
|
|
1626
1688
|
key: 1,
|
|
1627
1689
|
class: "lumal-cockpit-designer__empty-cell",
|
|
1628
1690
|
plain: "",
|
|
1629
1691
|
disabled: !e.placementSelection,
|
|
1630
1692
|
"data-role": "keyboard-target",
|
|
1631
|
-
onClick: (e) =>
|
|
1693
|
+
onClick: (e) => ae(s(t, r.id))
|
|
1632
1694
|
}, {
|
|
1633
|
-
default: j(() => [v("span", null,
|
|
1695
|
+
default: j(() => [v("span", null, k(e.placementSelection ? `放入 ${e.placementSelection.title}` : "请置入模块"), 1)]),
|
|
1634
1696
|
_: 1
|
|
1635
1697
|
}, 8, ["disabled", "onClick"]))]),
|
|
1636
1698
|
_: 2
|
|
@@ -1638,14 +1700,14 @@ var kn = /* @__PURE__ */ x({
|
|
|
1638
1700
|
"target",
|
|
1639
1701
|
"widget",
|
|
1640
1702
|
"onDrop"
|
|
1641
|
-
]))), 128))], 4)) : (E(), h(
|
|
1703
|
+
]))), 128))], 4)) : (E(), h(Pn, {
|
|
1642
1704
|
key: 1,
|
|
1643
1705
|
class: "lumal-cockpit-designer__tab-row",
|
|
1644
1706
|
"allow-multiple": "",
|
|
1645
1707
|
"drag-handle": ".lumal-cockpit-designer__tab-move",
|
|
1646
1708
|
"sortable-target": ".lumal-cockpit-designer__tab-list",
|
|
1647
|
-
target:
|
|
1648
|
-
onDrop: (e) =>
|
|
1709
|
+
target: c(t),
|
|
1710
|
+
onDrop: (e) => oe(c(t), e)
|
|
1649
1711
|
}, {
|
|
1650
1712
|
default: j(() => [v("section", { class: C(["lumal-cockpit-designer__tab-card", { "is-empty": !t.widgets.length }]) }, [v("header", {
|
|
1651
1713
|
class: "lumal-cockpit-designer__tab-list",
|
|
@@ -1655,22 +1717,22 @@ var kn = /* @__PURE__ */ x({
|
|
|
1655
1717
|
key: r.id,
|
|
1656
1718
|
class: C(["lumal-cockpit-designer__tab-item lumal-cockpit-designer__drag-item", {
|
|
1657
1719
|
"is-active": t.activeWidgetId === r.id,
|
|
1658
|
-
"is-keyboard-selected":
|
|
1720
|
+
"is-keyboard-selected": T(c(t, r.id))
|
|
1659
1721
|
}]),
|
|
1660
|
-
"data-cockpit-drag-source":
|
|
1722
|
+
"data-cockpit-drag-source": u(t, r.id)
|
|
1661
1723
|
}, [
|
|
1662
1724
|
b(A(M), {
|
|
1725
|
+
id: `designer-tab-${r.id}`,
|
|
1663
1726
|
text: "",
|
|
1664
1727
|
class: "lumal-cockpit-designer__tab-widget-title",
|
|
1665
1728
|
role: "tab",
|
|
1666
|
-
id: `designer-tab-${r.id}`,
|
|
1667
1729
|
"aria-controls": `designer-tabpanel-${t.id}`,
|
|
1668
1730
|
"aria-selected": t.activeWidgetId === r.id,
|
|
1669
1731
|
tabindex: t.activeWidgetId === r.id ? 0 : -1,
|
|
1670
1732
|
onClick: (n) => e.draft.setActiveTab(e.side, t.id, r.id),
|
|
1671
|
-
onKeydown: (e) =>
|
|
1733
|
+
onKeydown: (e) => se(t, i, e)
|
|
1672
1734
|
}, {
|
|
1673
|
-
default: j(() => [y(
|
|
1735
|
+
default: j(() => [y(k(r.title ?? r.type), 1)]),
|
|
1674
1736
|
_: 2
|
|
1675
1737
|
}, 1032, [
|
|
1676
1738
|
"id",
|
|
@@ -1680,7 +1742,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1680
1742
|
"onClick",
|
|
1681
1743
|
"onKeydown"
|
|
1682
1744
|
]),
|
|
1683
|
-
b(A(
|
|
1745
|
+
b(A(be), {
|
|
1684
1746
|
content: "拖拽或选择移动 Tab",
|
|
1685
1747
|
placement: "top"
|
|
1686
1748
|
}, {
|
|
@@ -1688,9 +1750,9 @@ var kn = /* @__PURE__ */ x({
|
|
|
1688
1750
|
class: "lumal-cockpit-designer__tab-action lumal-cockpit-designer__tab-move",
|
|
1689
1751
|
"data-role": "select-move-source",
|
|
1690
1752
|
"aria-label": `选择移动 Tab ${r.title ?? r.type}`,
|
|
1691
|
-
"aria-pressed":
|
|
1692
|
-
onMousedown: n[5] ||=
|
|
1693
|
-
onClick:
|
|
1753
|
+
"aria-pressed": T(c(t, r.id)),
|
|
1754
|
+
onMousedown: n[5] ||= ue(() => {}, ["stop"]),
|
|
1755
|
+
onClick: ue((e) => re(c(t, r.id), r), ["stop"])
|
|
1694
1756
|
}, {
|
|
1695
1757
|
default: j(() => [b(A(N), {
|
|
1696
1758
|
name: "lumal:more",
|
|
@@ -1704,7 +1766,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1704
1766
|
])]),
|
|
1705
1767
|
_: 2
|
|
1706
1768
|
}, 1024),
|
|
1707
|
-
b(A(
|
|
1769
|
+
b(A(be), {
|
|
1708
1770
|
content: "移除 Tab",
|
|
1709
1771
|
placement: "top"
|
|
1710
1772
|
}, {
|
|
@@ -1713,8 +1775,8 @@ var kn = /* @__PURE__ */ x({
|
|
|
1713
1775
|
class: "lumal-cockpit-designer__tab-action",
|
|
1714
1776
|
"data-role": "remove-widget",
|
|
1715
1777
|
"aria-label": `移除 Tab 模块 ${r.title ?? r.type}`,
|
|
1716
|
-
onMousedown: n[6] ||=
|
|
1717
|
-
onClick:
|
|
1778
|
+
onMousedown: n[6] ||= ue(() => {}, ["stop"]),
|
|
1779
|
+
onClick: ue((e) => ie(c(t, r.id)), ["stop"])
|
|
1718
1780
|
}, {
|
|
1719
1781
|
default: j(() => [b(A(N), {
|
|
1720
1782
|
name: "lumal:close",
|
|
@@ -1724,7 +1786,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1724
1786
|
}, 8, ["aria-label", "onClick"])]),
|
|
1725
1787
|
_: 2
|
|
1726
1788
|
}, 1024)
|
|
1727
|
-
], 10,
|
|
1789
|
+
], 10, Zn))), 128)), t.widgets.length && e.placementSelection ? (E(), h(A(be), {
|
|
1728
1790
|
key: 0,
|
|
1729
1791
|
content: "移入此 Tab 行",
|
|
1730
1792
|
placement: "top"
|
|
@@ -1733,7 +1795,7 @@ var kn = /* @__PURE__ */ x({
|
|
|
1733
1795
|
class: "lumal-cockpit-designer__tab-target",
|
|
1734
1796
|
"data-role": "keyboard-target",
|
|
1735
1797
|
"aria-label": "移入此 Tab 行",
|
|
1736
|
-
onClick: (e) =>
|
|
1798
|
+
onClick: (e) => ae(c(t))
|
|
1737
1799
|
}, {
|
|
1738
1800
|
default: j(() => [b(A(N), {
|
|
1739
1801
|
name: "lumal:plus",
|
|
@@ -1742,51 +1804,52 @@ var kn = /* @__PURE__ */ x({
|
|
|
1742
1804
|
_: 1
|
|
1743
1805
|
}, 8, ["onClick"])]),
|
|
1744
1806
|
_: 2
|
|
1745
|
-
}, 1024)) : g("", !0)], 8,
|
|
1807
|
+
}, 1024)) : g("", !0)], 8, Xn), v("div", {
|
|
1808
|
+
id: `designer-tabpanel-${t.id}`,
|
|
1746
1809
|
class: "lumal-cockpit-designer__tab-preview",
|
|
1747
1810
|
role: "tabpanel",
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
key: l(t).id,
|
|
1811
|
+
"aria-labelledby": x(t) ? `designer-tab-${x(t).id}` : void 0
|
|
1812
|
+
}, [x(t) ? (E(), _(p, { key: 0 }, [d(x(t).type) ? (E(), h(Dn, {
|
|
1813
|
+
key: x(t).id,
|
|
1752
1814
|
"cockpit-id": e.cockpitId,
|
|
1753
|
-
definition:
|
|
1754
|
-
"instance-id":
|
|
1815
|
+
definition: d(x(t).type),
|
|
1816
|
+
"instance-id": x(t).id,
|
|
1755
1817
|
"layout-id": e.draft.activeLayout.value?.id ?? "",
|
|
1756
|
-
"message-bus": e.previewMessageBus
|
|
1818
|
+
"message-bus": e.previewMessageBus,
|
|
1819
|
+
live: ""
|
|
1757
1820
|
}, null, 8, [
|
|
1758
1821
|
"cockpit-id",
|
|
1759
1822
|
"definition",
|
|
1760
1823
|
"instance-id",
|
|
1761
1824
|
"layout-id",
|
|
1762
1825
|
"message-bus"
|
|
1763
|
-
])) : (E(), _("div",
|
|
1826
|
+
])) : (E(), _("div", $n, " 未注册模块 "))], 64)) : (E(), h(A(M), {
|
|
1764
1827
|
key: 1,
|
|
1765
1828
|
class: "lumal-cockpit-designer__empty-cell",
|
|
1766
1829
|
plain: "",
|
|
1767
1830
|
disabled: !e.placementSelection,
|
|
1768
1831
|
"data-role": "keyboard-target",
|
|
1769
|
-
onClick: (e) =>
|
|
1832
|
+
onClick: (e) => ae(c(t))
|
|
1770
1833
|
}, {
|
|
1771
|
-
default: j(() => [v("span", null,
|
|
1834
|
+
default: j(() => [v("span", null, k(e.placementSelection ? `添加 ${e.placementSelection.title} 到 Tab` : "请置入模块"), 1)]),
|
|
1772
1835
|
_: 1
|
|
1773
|
-
}, 8, ["disabled", "onClick"]))], 8,
|
|
1836
|
+
}, 8, ["disabled", "onClick"]))], 8, Qn)], 2)]),
|
|
1774
1837
|
_: 2
|
|
1775
|
-
}, 1032, ["target", "onDrop"]))], 4))), 128))])) : g("", !0)], 8,
|
|
1838
|
+
}, 1032, ["target", "onDrop"]))], 4))), 128))])) : g("", !0)], 8, Fn));
|
|
1776
1839
|
}
|
|
1777
1840
|
});
|
|
1778
1841
|
//#endregion
|
|
1779
1842
|
//#region src/designer/useCockpitDraft.ts
|
|
1780
|
-
function
|
|
1843
|
+
function tr(e) {
|
|
1781
1844
|
return JSON.parse(JSON.stringify(e));
|
|
1782
1845
|
}
|
|
1783
|
-
function
|
|
1846
|
+
function nr(e) {
|
|
1784
1847
|
return e.mode === "tabs" ? e.widgets : e.cells.flatMap((e) => e.widget ? [e.widget] : []);
|
|
1785
1848
|
}
|
|
1786
|
-
function
|
|
1787
|
-
return
|
|
1849
|
+
function rr(e) {
|
|
1850
|
+
return nr(e).length > 0;
|
|
1788
1851
|
}
|
|
1789
|
-
function
|
|
1852
|
+
function ir(e) {
|
|
1790
1853
|
if (!e.length) return;
|
|
1791
1854
|
let t = e.reduce((e, t) => e + Math.max(0, t.height), 0);
|
|
1792
1855
|
if (t <= 0) {
|
|
@@ -1802,14 +1865,14 @@ function $n(e) {
|
|
|
1802
1865
|
let n = Number((100 - e.reduce((e, t) => e + t.height, 0)).toFixed(3));
|
|
1803
1866
|
e[e.length - 1].height = Number((e[e.length - 1].height + n).toFixed(3));
|
|
1804
1867
|
}
|
|
1805
|
-
function
|
|
1868
|
+
function ar(e, t) {
|
|
1806
1869
|
return t === "left" ? e.left : e.right;
|
|
1807
1870
|
}
|
|
1808
|
-
function
|
|
1871
|
+
function or(e) {
|
|
1809
1872
|
let i = JSON.parse(JSON.stringify(e));
|
|
1810
1873
|
i.id = a().id;
|
|
1811
1874
|
for (let e of ["left", "right"]) {
|
|
1812
|
-
let a =
|
|
1875
|
+
let a = ar(i, e);
|
|
1813
1876
|
a.columns.forEach((e) => {
|
|
1814
1877
|
e.id = n().id;
|
|
1815
1878
|
}), a.rows.forEach((e) => {
|
|
@@ -1823,138 +1886,142 @@ function tr(e) {
|
|
|
1823
1886
|
}
|
|
1824
1887
|
return i;
|
|
1825
1888
|
}
|
|
1826
|
-
function
|
|
1827
|
-
let c =
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
});
|
|
1831
|
-
function h(e, t) {
|
|
1832
|
-
let n = p.value;
|
|
1833
|
-
return n ? er(n, e).rows.find((e) => e.id === t) : void 0;
|
|
1889
|
+
function sr(o) {
|
|
1890
|
+
let c = tr(o), l = ae(tr(o)), u = D({ layoutId: o.activeLayoutId ?? o.layouts[0]?.id });
|
|
1891
|
+
function d() {
|
|
1892
|
+
oe(l);
|
|
1834
1893
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1894
|
+
let p = m(() => [...l.value.layouts]), h = m(() => {
|
|
1895
|
+
let e = u.value.layoutId, t = p.value.find((t) => t.id === e) ?? p.value[0];
|
|
1896
|
+
return t ? { ...t } : void 0;
|
|
1897
|
+
});
|
|
1898
|
+
function g(e, t) {
|
|
1899
|
+
let n = h.value;
|
|
1900
|
+
return n ? ar(n, e).rows.find((e) => e.id === t) : void 0;
|
|
1837
1901
|
}
|
|
1838
1902
|
function _(e) {
|
|
1839
|
-
|
|
1840
|
-
|
|
1903
|
+
return g(e.side, e.rowId)?.cells.find((t) => t.id === e.cellId);
|
|
1904
|
+
}
|
|
1905
|
+
function v(e) {
|
|
1906
|
+
if (e.kind === "cell") return _(e)?.widget;
|
|
1907
|
+
let t = g(e.side, e.rowId)?.widgets ?? [];
|
|
1841
1908
|
return e.widgetId ? t.find((t) => t.id === e.widgetId) : t[0];
|
|
1842
1909
|
}
|
|
1843
|
-
function
|
|
1844
|
-
let e = a(`布局 ${
|
|
1845
|
-
l.value.layouts.push(e), l.value.activeLayoutId = e.id, u.value = { layoutId: e.id };
|
|
1910
|
+
function y() {
|
|
1911
|
+
let e = a(`布局 ${p.value.length + 1}`);
|
|
1912
|
+
l.value.layouts.push(e), l.value.activeLayoutId = e.id, u.value = { layoutId: e.id }, d();
|
|
1846
1913
|
}
|
|
1847
|
-
function
|
|
1848
|
-
let t =
|
|
1914
|
+
function b(e) {
|
|
1915
|
+
let t = p.value.findIndex((t) => t.id === e);
|
|
1849
1916
|
if (t < 0) return;
|
|
1850
|
-
let n =
|
|
1851
|
-
n.title = `${n.title} 副本`,
|
|
1917
|
+
let n = or(p.value[t]);
|
|
1918
|
+
n.title = `${n.title} 副本`, l.value.layouts.splice(t + 1, 0, n), u.value = { layoutId: n.id }, d();
|
|
1852
1919
|
}
|
|
1853
|
-
function
|
|
1854
|
-
if (
|
|
1855
|
-
let t =
|
|
1920
|
+
function x(e) {
|
|
1921
|
+
if (p.value.length <= 1) return !1;
|
|
1922
|
+
let t = p.value.findIndex((t) => t.id === e);
|
|
1856
1923
|
if (t < 0) return !1;
|
|
1857
|
-
if (
|
|
1858
|
-
let e =
|
|
1924
|
+
if (l.value.layouts.splice(t, 1), u.value.layoutId === e) {
|
|
1925
|
+
let e = l.value.layouts[t] ?? l.value.layouts[t - 1];
|
|
1859
1926
|
u.value = { layoutId: e?.id }, l.value.activeLayoutId = e?.id;
|
|
1860
1927
|
}
|
|
1861
|
-
return !0;
|
|
1928
|
+
return d(), !0;
|
|
1862
1929
|
}
|
|
1863
|
-
function
|
|
1864
|
-
let n =
|
|
1865
|
-
n && t.trim() && (n.title = t.trim());
|
|
1930
|
+
function S(e, t) {
|
|
1931
|
+
let n = l.value.layouts.find((t) => t.id === e);
|
|
1932
|
+
n && t.trim() && (n.title = t.trim(), d());
|
|
1866
1933
|
}
|
|
1867
|
-
function
|
|
1868
|
-
|
|
1934
|
+
function ee(e) {
|
|
1935
|
+
p.value.some((t) => t.id === e) && (u.value = { layoutId: e }, l.value.activeLayoutId = e, d());
|
|
1869
1936
|
}
|
|
1870
|
-
function
|
|
1871
|
-
let c =
|
|
1937
|
+
function C(r, i, a, o = !1) {
|
|
1938
|
+
let c = h.value;
|
|
1872
1939
|
if (!c) return !1;
|
|
1873
|
-
let l =
|
|
1874
|
-
if (!o && (
|
|
1875
|
-
for (; l.columns.length <
|
|
1876
|
-
for (l.columns.length >
|
|
1940
|
+
let l = ar(c, r), u = Math.max(1, Math.floor(i)), f = Math.max(1, Math.floor(a)), p = l.rows.slice(u), m = l.rows.filter((e) => e.mode === "grid").flatMap((e) => e.cells.slice(f));
|
|
1941
|
+
if (!o && (p.some(rr) || m.some((e) => e.widget))) return !1;
|
|
1942
|
+
for (; l.columns.length < f;) l.columns.push(n());
|
|
1943
|
+
for (l.columns.length > f && l.columns.splice(f), e(l), l.rows.forEach((e) => {
|
|
1877
1944
|
if (e.mode === "grid") {
|
|
1878
|
-
for (; e.cells.length <
|
|
1879
|
-
e.cells.length >
|
|
1945
|
+
for (; e.cells.length < f;) e.cells.push(t());
|
|
1946
|
+
e.cells.length > f && e.cells.splice(f);
|
|
1880
1947
|
}
|
|
1881
|
-
}), l.rows.length > u && l.rows.splice(u); l.rows.length < u;) l.rows.push(s(
|
|
1882
|
-
return
|
|
1948
|
+
}), l.rows.length > u && l.rows.splice(u); l.rows.length < u;) l.rows.push(s(f, "grid", 100 / u));
|
|
1949
|
+
return ir(l.rows), d(), !0;
|
|
1883
1950
|
}
|
|
1884
|
-
function
|
|
1885
|
-
let r =
|
|
1951
|
+
function w(t, n) {
|
|
1952
|
+
let r = h.value;
|
|
1886
1953
|
if (!r || !Number.isFinite(n) || n <= 0) return;
|
|
1887
|
-
let i =
|
|
1888
|
-
i.width = Math.max(i.columns.length, Math.round(n)), e(i);
|
|
1954
|
+
let i = ar(r, t);
|
|
1955
|
+
i.width = Math.max(i.columns.length, Math.round(n)), e(i), d();
|
|
1889
1956
|
}
|
|
1890
|
-
function
|
|
1891
|
-
let r =
|
|
1957
|
+
function T(e, t, n) {
|
|
1958
|
+
let r = h.value;
|
|
1892
1959
|
if (!r || !Number.isFinite(n)) return;
|
|
1893
|
-
let i =
|
|
1960
|
+
let i = ar(r, e).rows, a = i.find((e) => e.id === t);
|
|
1894
1961
|
if (!a) return;
|
|
1895
1962
|
if (i.length === 1) {
|
|
1896
|
-
a.height = 100;
|
|
1963
|
+
a.height = 100, d();
|
|
1897
1964
|
return;
|
|
1898
1965
|
}
|
|
1899
1966
|
let o = i.filter((e) => e.id !== t), s = Math.min(Math.max(1, n), 100 - o.length), c = 100 - s, l = o.reduce((e, t) => e + t.height, 0);
|
|
1900
1967
|
a.height = s, o.forEach((e) => {
|
|
1901
1968
|
e.height = l > 0 ? e.height / l * c : c / o.length;
|
|
1902
|
-
}),
|
|
1969
|
+
}), ir(i), d();
|
|
1903
1970
|
}
|
|
1904
|
-
function
|
|
1905
|
-
let i =
|
|
1971
|
+
function te(e, n, r) {
|
|
1972
|
+
let i = h.value;
|
|
1906
1973
|
if (!i) return !1;
|
|
1907
|
-
let a =
|
|
1908
|
-
return !o || r && o.mode === "tabs" || !r && o.mode === "grid" ? !!o : r ? (o.widgets = o.cells.flatMap((e) => e.widget ? [e.widget] : []), o.cells = [], o.mode = "tabs", o.activeWidgetId = o.widgets[0]?.id, !0) : o.widgets.length > a.columns.length ? !1 : (o.cells = Array.from({ length: a.columns.length }, t), o.widgets.forEach((e, t) => {
|
|
1974
|
+
let a = ar(i, e), o = a.rows.find((e) => e.id === n);
|
|
1975
|
+
return !o || r && o.mode === "tabs" || !r && o.mode === "grid" ? !!o : r ? (o.widgets = o.cells.flatMap((e) => e.widget ? [e.widget] : []), o.cells = [], o.mode = "tabs", o.activeWidgetId = o.widgets[0]?.id, d(), !0) : o.widgets.length > a.columns.length ? !1 : (o.cells = Array.from({ length: a.columns.length }, t), o.widgets.forEach((e, t) => {
|
|
1909
1976
|
o.cells[t].widget = e;
|
|
1910
|
-
}), o.widgets = [], o.activeWidgetId = void 0, o.mode = "grid", !0);
|
|
1977
|
+
}), o.widgets = [], o.activeWidgetId = void 0, o.mode = "grid", d(), !0);
|
|
1911
1978
|
}
|
|
1912
|
-
function
|
|
1913
|
-
return !!
|
|
1979
|
+
function E(e) {
|
|
1980
|
+
return !!v(e);
|
|
1914
1981
|
}
|
|
1915
|
-
function
|
|
1982
|
+
function O(e, t, n, i = !1) {
|
|
1916
1983
|
let a = r(t, n);
|
|
1917
1984
|
if (e.kind === "tabs") {
|
|
1918
|
-
let t =
|
|
1919
|
-
return !t || t.mode !== "tabs" ? !1 : (t.widgets.push(a), t.activeWidgetId = a.id, !0);
|
|
1985
|
+
let t = g(e.side, e.rowId);
|
|
1986
|
+
return !t || t.mode !== "tabs" ? !1 : (t.widgets.push(a), t.activeWidgetId = a.id, d(), !0);
|
|
1920
1987
|
}
|
|
1921
|
-
let o =
|
|
1922
|
-
return !o || o.widget && !i ? !1 : (o.widget = a, !0);
|
|
1988
|
+
let o = _(e);
|
|
1989
|
+
return !o || o.widget && !i ? !1 : (o.widget = a, d(), !0);
|
|
1923
1990
|
}
|
|
1924
|
-
function
|
|
1991
|
+
function ne(e) {
|
|
1925
1992
|
if (e.kind === "cell") {
|
|
1926
|
-
let t =
|
|
1927
|
-
t && (t.widget = void 0);
|
|
1993
|
+
let t = _(e);
|
|
1994
|
+
t && (t.widget = void 0), d();
|
|
1928
1995
|
return;
|
|
1929
1996
|
}
|
|
1930
|
-
let t =
|
|
1997
|
+
let t = g(e.side, e.rowId);
|
|
1931
1998
|
if (!t || t.mode !== "tabs") return;
|
|
1932
1999
|
let n = e.widgetId ? t.widgets.findIndex((t) => t.id === e.widgetId) : 0;
|
|
1933
2000
|
if (n >= 0) {
|
|
1934
2001
|
let e = t.widgets[n]?.id === t.activeWidgetId;
|
|
1935
|
-
t.widgets.splice(n, 1), (e || !t.widgets.some((e) => e.id === t.activeWidgetId)) && (t.activeWidgetId = t.widgets[n]?.id ?? t.widgets[n - 1]?.id);
|
|
2002
|
+
t.widgets.splice(n, 1), (e || !t.widgets.some((e) => e.id === t.activeWidgetId)) && (t.activeWidgetId = t.widgets[n]?.id ?? t.widgets[n - 1]?.id), d();
|
|
1936
2003
|
}
|
|
1937
2004
|
}
|
|
1938
|
-
function
|
|
2005
|
+
function re(e, t) {
|
|
1939
2006
|
if (e.kind === "cell") {
|
|
1940
|
-
let t =
|
|
2007
|
+
let t = _(e), n = t?.widget;
|
|
1941
2008
|
return t && (t.widget = void 0), n;
|
|
1942
2009
|
}
|
|
1943
|
-
let n =
|
|
2010
|
+
let n = g(e.side, e.rowId);
|
|
1944
2011
|
if (!n || n.mode !== "tabs") return;
|
|
1945
2012
|
let r = t ? n.widgets.findIndex((e) => e.id === t) : 0;
|
|
1946
2013
|
if (r < 0) return;
|
|
1947
2014
|
let [i] = n.widgets.splice(r, 1);
|
|
1948
2015
|
return n.activeWidgetId = n.widgets.some((e) => e.id === n.activeWidgetId) ? n.activeWidgetId : n.widgets[0]?.id, i;
|
|
1949
2016
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let r =
|
|
2017
|
+
function ie(e, t, n = !1) {
|
|
2018
|
+
let r = v(e);
|
|
1952
2019
|
if (!r) return {
|
|
1953
2020
|
moved: !1,
|
|
1954
2021
|
requiresReplace: !1
|
|
1955
2022
|
};
|
|
1956
2023
|
if (t.kind === "cell") {
|
|
1957
|
-
let i =
|
|
2024
|
+
let i = _(t);
|
|
1958
2025
|
if (!i) return {
|
|
1959
2026
|
moved: !1,
|
|
1960
2027
|
requiresReplace: !1
|
|
@@ -1963,8 +2030,8 @@ function nr(o) {
|
|
|
1963
2030
|
moved: !1,
|
|
1964
2031
|
requiresReplace: !0
|
|
1965
2032
|
};
|
|
1966
|
-
let a =
|
|
1967
|
-
return a ? (i.widget = a, {
|
|
2033
|
+
let a = re(e, r.id);
|
|
2034
|
+
return a ? (i.widget = a, d(), {
|
|
1968
2035
|
moved: !0,
|
|
1969
2036
|
requiresReplace: !1
|
|
1970
2037
|
}) : {
|
|
@@ -1972,13 +2039,13 @@ function nr(o) {
|
|
|
1972
2039
|
requiresReplace: !1
|
|
1973
2040
|
};
|
|
1974
2041
|
}
|
|
1975
|
-
let i =
|
|
2042
|
+
let i = g(t.side, t.rowId);
|
|
1976
2043
|
if (!i || i.mode !== "tabs") return {
|
|
1977
2044
|
moved: !1,
|
|
1978
2045
|
requiresReplace: !1
|
|
1979
2046
|
};
|
|
1980
|
-
let a =
|
|
1981
|
-
return a ? (i.widgets.push(a), i.activeWidgetId = a.id, {
|
|
2047
|
+
let a = re(e, r.id);
|
|
2048
|
+
return a ? (i.widgets.push(a), i.activeWidgetId = a.id, d(), {
|
|
1982
2049
|
moved: !0,
|
|
1983
2050
|
requiresReplace: !1
|
|
1984
2051
|
}) : {
|
|
@@ -1986,20 +2053,20 @@ function nr(o) {
|
|
|
1986
2053
|
requiresReplace: !1
|
|
1987
2054
|
};
|
|
1988
2055
|
}
|
|
1989
|
-
function
|
|
1990
|
-
let i =
|
|
2056
|
+
function k(e, t, n, r) {
|
|
2057
|
+
let i = g(e, t);
|
|
1991
2058
|
if (!i || i.mode !== "tabs" || n === r || n < 0 || r < 0 || n >= i.widgets.length || r >= i.widgets.length) return;
|
|
1992
2059
|
let [a] = i.widgets.splice(n, 1);
|
|
1993
|
-
i.widgets.splice(r, 0, a);
|
|
2060
|
+
i.widgets.splice(r, 0, a), d();
|
|
1994
2061
|
}
|
|
1995
|
-
function
|
|
1996
|
-
let r =
|
|
1997
|
-
r?.mode === "tabs" && r.widgets.some((e) => e.id === n) && (r.activeWidgetId = n);
|
|
2062
|
+
function A(e, t, n) {
|
|
2063
|
+
let r = g(e, t);
|
|
2064
|
+
r?.mode === "tabs" && r.widgets.some((e) => e.id === n) && (r.activeWidgetId = n, d());
|
|
1998
2065
|
}
|
|
1999
|
-
function
|
|
2000
|
-
l.value =
|
|
2066
|
+
function se() {
|
|
2067
|
+
l.value = tr(c), u.value = { layoutId: c.activeLayoutId ?? c.layouts[0]?.id }, d();
|
|
2001
2068
|
}
|
|
2002
|
-
function
|
|
2069
|
+
function ce() {
|
|
2003
2070
|
let e = f(l.value);
|
|
2004
2071
|
return {
|
|
2005
2072
|
config: i(l.value),
|
|
@@ -2009,37 +2076,37 @@ function nr(o) {
|
|
|
2009
2076
|
return {
|
|
2010
2077
|
draft: l,
|
|
2011
2078
|
selection: u,
|
|
2012
|
-
layouts:
|
|
2013
|
-
activeLayout:
|
|
2014
|
-
addLayout:
|
|
2015
|
-
duplicateLayout:
|
|
2016
|
-
removeLayout:
|
|
2017
|
-
renameLayout:
|
|
2018
|
-
selectLayout:
|
|
2019
|
-
resizeRegion:
|
|
2020
|
-
setRegionWidth:
|
|
2021
|
-
setRowHeight:
|
|
2022
|
-
setRowTabs:
|
|
2023
|
-
hasWidgetAt:
|
|
2024
|
-
addWidget:
|
|
2025
|
-
moveWidget:
|
|
2026
|
-
removeWidget:
|
|
2027
|
-
reorderTabWidgets:
|
|
2028
|
-
setActiveTab:
|
|
2029
|
-
reset:
|
|
2030
|
-
buildSaveConfig:
|
|
2079
|
+
layouts: p,
|
|
2080
|
+
activeLayout: h,
|
|
2081
|
+
addLayout: y,
|
|
2082
|
+
duplicateLayout: b,
|
|
2083
|
+
removeLayout: x,
|
|
2084
|
+
renameLayout: S,
|
|
2085
|
+
selectLayout: ee,
|
|
2086
|
+
resizeRegion: C,
|
|
2087
|
+
setRegionWidth: w,
|
|
2088
|
+
setRowHeight: T,
|
|
2089
|
+
setRowTabs: te,
|
|
2090
|
+
hasWidgetAt: E,
|
|
2091
|
+
addWidget: O,
|
|
2092
|
+
moveWidget: ie,
|
|
2093
|
+
removeWidget: ne,
|
|
2094
|
+
reorderTabWidgets: k,
|
|
2095
|
+
setActiveTab: A,
|
|
2096
|
+
reset: se,
|
|
2097
|
+
buildSaveConfig: ce
|
|
2031
2098
|
};
|
|
2032
2099
|
}
|
|
2033
2100
|
//#endregion
|
|
2034
2101
|
//#region src/designer/LumalCockpitDesigner.vue?vue&type=script&setup=true&lang.ts
|
|
2035
|
-
var
|
|
2102
|
+
var cr = ["data-cockpit-theme"], lr = { class: "lumal-cockpit-designer__titlebar" }, ur = { class: "lumal-cockpit-designer__heading" }, dr = { class: "lumal-cockpit-designer__title-actions" }, fr = { class: "lumal-cockpit-designer__controlbar" }, pr = { class: "lumal-cockpit-designer__layout-controls" }, mr = { class: "lumal-cockpit-designer__field" }, hr = { class: "lumal-cockpit-designer__layout-tools" }, gr = { class: "lumal-cockpit-designer__workspace" }, _r = {
|
|
2036
2103
|
class: "lumal-cockpit-designer__assembly",
|
|
2037
2104
|
"aria-label": "驾驶舱布局装配区"
|
|
2038
|
-
},
|
|
2105
|
+
}, vr = { class: "lumal-cockpit-designer__assembly-stage" }, yr = { class: "lumal-cockpit-designer__footer" }, br = {
|
|
2039
2106
|
class: "lumal-cockpit-designer__placement-status",
|
|
2040
2107
|
role: "status",
|
|
2041
2108
|
"aria-live": "polite"
|
|
2042
|
-
},
|
|
2109
|
+
}, xr = { class: "lumal-cockpit-designer__footer-actions" }, Sr = /* @__PURE__ */ x({
|
|
2043
2110
|
__name: "LumalCockpitDesigner",
|
|
2044
2111
|
props: /*@__PURE__*/ S({
|
|
2045
2112
|
config: {},
|
|
@@ -2052,11 +2119,11 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2052
2119
|
}),
|
|
2053
2120
|
emits: /*@__PURE__*/ S(["save", "cancel"], ["update:themeMode"]),
|
|
2054
2121
|
setup(e, { expose: t, emit: n }) {
|
|
2055
|
-
let r = e, i = n, a =
|
|
2122
|
+
let r = e, i = n, a = se(e, "themeMode"), o = sr(r.config), s = D([]), l = D(), u = m(() => o.activeLayout.value), d = m(() => s.value.filter((e) => e.level === "error")), f = c(), x = m(() => {
|
|
2056
2123
|
let e = l.value;
|
|
2057
2124
|
return e ? e.kind === "library" ? `已选择模块“${e.title}”,可连续放入多个槽位,按 Esc 取消。` : `正在移动“${e.title}”,请选择目标槽位或 Tab 行,按 Esc 取消。` : "PS:将需要的业务板块拖入上方白框内,已占用槽位会在确认后替换。";
|
|
2058
2125
|
});
|
|
2059
|
-
|
|
2126
|
+
ce(() => u.value?.id, () => {
|
|
2060
2127
|
l.value = void 0;
|
|
2061
2128
|
});
|
|
2062
2129
|
function S(e) {
|
|
@@ -2084,18 +2151,18 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2084
2151
|
layout: n
|
|
2085
2152
|
});
|
|
2086
2153
|
}
|
|
2087
|
-
async function
|
|
2154
|
+
async function re() {
|
|
2088
2155
|
let e = u.value;
|
|
2089
2156
|
if (e) {
|
|
2090
2157
|
if (o.layouts.value.length <= 1) {
|
|
2091
|
-
await
|
|
2158
|
+
await ge.alert("至少保留一个布局。", "无法删除", {
|
|
2092
2159
|
confirmButtonText: "知道了",
|
|
2093
2160
|
type: "warning"
|
|
2094
2161
|
});
|
|
2095
2162
|
return;
|
|
2096
2163
|
}
|
|
2097
2164
|
try {
|
|
2098
|
-
await
|
|
2165
|
+
await ge.confirm(`确定删除布局“${e.title}”吗?`, "删除布局", {
|
|
2099
2166
|
cancelButtonText: "取消",
|
|
2100
2167
|
confirmButtonText: "删除",
|
|
2101
2168
|
type: "warning"
|
|
@@ -2103,51 +2170,51 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2103
2170
|
} catch {}
|
|
2104
2171
|
}
|
|
2105
2172
|
}
|
|
2106
|
-
async function
|
|
2173
|
+
async function ie() {
|
|
2107
2174
|
try {
|
|
2108
|
-
await
|
|
2175
|
+
await ge.confirm("将放弃本次尚未保存的所有布局调整,是否继续?", "重置草稿", {
|
|
2109
2176
|
cancelButtonText: "取消",
|
|
2110
2177
|
confirmButtonText: "重置",
|
|
2111
2178
|
type: "warning"
|
|
2112
2179
|
}), o.reset(), s.value = [];
|
|
2113
2180
|
} catch {}
|
|
2114
2181
|
}
|
|
2115
|
-
function
|
|
2182
|
+
function ae() {
|
|
2116
2183
|
a.value = a.value === "dark" ? "light" : "dark";
|
|
2117
2184
|
}
|
|
2118
|
-
return t({ toggleTheme:
|
|
2185
|
+
return t({ toggleTheme: ae }), (t, n) => (E(), _("div", {
|
|
2119
2186
|
class: "lumal-cockpit-designer",
|
|
2120
2187
|
"data-cockpit-theme": a.value,
|
|
2121
2188
|
onKeydown: T
|
|
2122
2189
|
}, [
|
|
2123
|
-
v("header",
|
|
2190
|
+
v("header", lr, [v("h2", ur, [b(A(N), {
|
|
2124
2191
|
name: "lumal:settings",
|
|
2125
2192
|
size: 18
|
|
2126
|
-
}), n[4] ||= y(" 模块设置 ", -1)]), v("div",
|
|
2193
|
+
}), n[4] ||= y(" 模块设置 ", -1)]), v("div", dr, [ne(t.$slots, "title-actions", {
|
|
2127
2194
|
themeMode: a.value,
|
|
2128
|
-
toggleTheme:
|
|
2195
|
+
toggleTheme: ae
|
|
2129
2196
|
})])]),
|
|
2130
|
-
v("section",
|
|
2131
|
-
v("label",
|
|
2197
|
+
v("section", fr, [v("div", pr, [
|
|
2198
|
+
v("label", mr, [n[5] ||= v("span", null, "模板名称", -1), b(A(ve), {
|
|
2132
2199
|
"model-value": u.value?.id,
|
|
2133
2200
|
"aria-label": "选择布局",
|
|
2134
2201
|
"onUpdate:modelValue": A(o).selectLayout
|
|
2135
2202
|
}, {
|
|
2136
|
-
default: j(() => [(E(!0), _(p, null, O(A(o).layouts.value, (e) => (E(), h(A(
|
|
2203
|
+
default: j(() => [(E(!0), _(p, null, O(A(o).layouts.value, (e) => (E(), h(A(_e), {
|
|
2137
2204
|
key: e.id,
|
|
2138
2205
|
label: e.title,
|
|
2139
2206
|
value: e.id
|
|
2140
2207
|
}, null, 8, ["label", "value"]))), 128))]),
|
|
2141
2208
|
_: 1
|
|
2142
2209
|
}, 8, ["model-value", "onUpdate:modelValue"])]),
|
|
2143
|
-
u.value ? (E(), h(A(
|
|
2210
|
+
u.value ? (E(), h(A(pe), {
|
|
2144
2211
|
key: 0,
|
|
2145
2212
|
"model-value": u.value.title,
|
|
2146
2213
|
"aria-label": "当前布局名称",
|
|
2147
2214
|
onChange: n[0] ||= (e) => A(o).renameLayout(u.value.id, e)
|
|
2148
2215
|
}, null, 8, ["model-value"])) : g("", !0),
|
|
2149
|
-
v("div",
|
|
2150
|
-
b(A(
|
|
2216
|
+
v("div", hr, [
|
|
2217
|
+
b(A(be), {
|
|
2151
2218
|
content: "添加布局",
|
|
2152
2219
|
placement: "top"
|
|
2153
2220
|
}, {
|
|
@@ -2175,7 +2242,7 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2175
2242
|
key: 1,
|
|
2176
2243
|
type: "danger",
|
|
2177
2244
|
plain: "",
|
|
2178
|
-
onClick:
|
|
2245
|
+
onClick: re
|
|
2179
2246
|
}, {
|
|
2180
2247
|
default: j(() => [...n[7] ||= [y(" 删除 ", -1)]]),
|
|
2181
2248
|
_: 1
|
|
@@ -2185,20 +2252,20 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2185
2252
|
v("div", {
|
|
2186
2253
|
class: C(["lumal-cockpit-designer__issues", { "is-empty": !d.value.length && !e.saveError }]),
|
|
2187
2254
|
role: "alert"
|
|
2188
|
-
}, [e.saveError ? (E(), h(A(
|
|
2255
|
+
}, [e.saveError ? (E(), h(A(de), {
|
|
2189
2256
|
key: 0,
|
|
2190
2257
|
type: "error",
|
|
2191
2258
|
closable: !1,
|
|
2192
2259
|
title: `保存失败:${e.saveError}`,
|
|
2193
2260
|
"show-icon": ""
|
|
2194
|
-
}, null, 8, ["title"])) : g("", !0), (E(!0), _(p, null, O(d.value, (e, t) => (E(), h(A(
|
|
2261
|
+
}, null, 8, ["title"])) : g("", !0), (E(!0), _(p, null, O(d.value, (e, t) => (E(), h(A(de), {
|
|
2195
2262
|
key: t,
|
|
2196
2263
|
type: "error",
|
|
2197
2264
|
closable: !1,
|
|
2198
2265
|
title: e.message,
|
|
2199
2266
|
"show-icon": ""
|
|
2200
2267
|
}, null, 8, ["title"]))), 128))], 2),
|
|
2201
|
-
v("main",
|
|
2268
|
+
v("main", gr, [v("section", _r, [v("div", vr, [b(er, {
|
|
2202
2269
|
"cockpit-id": e.config.id,
|
|
2203
2270
|
draft: A(o),
|
|
2204
2271
|
registry: e.registry,
|
|
@@ -2213,7 +2280,7 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2213
2280
|
"registry",
|
|
2214
2281
|
"placement-selection",
|
|
2215
2282
|
"preview-message-bus"
|
|
2216
|
-
]), b(
|
|
2283
|
+
]), b(er, {
|
|
2217
2284
|
"cockpit-id": e.config.id,
|
|
2218
2285
|
draft: A(o),
|
|
2219
2286
|
registry: e.registry,
|
|
@@ -2228,7 +2295,7 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2228
2295
|
"registry",
|
|
2229
2296
|
"placement-selection",
|
|
2230
2297
|
"preview-message-bus"
|
|
2231
|
-
])])]), b(
|
|
2298
|
+
])])]), b(Mn, {
|
|
2232
2299
|
"cockpit-id": e.config.id,
|
|
2233
2300
|
"layout-id": u.value?.id ?? "",
|
|
2234
2301
|
registry: e.registry,
|
|
@@ -2240,8 +2307,8 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2240
2307
|
"registry",
|
|
2241
2308
|
"selected-type"
|
|
2242
2309
|
])]),
|
|
2243
|
-
v("footer",
|
|
2244
|
-
b(A(M), { onClick:
|
|
2310
|
+
v("footer", yr, [v("p", br, k(x.value), 1), v("div", xr, [
|
|
2311
|
+
b(A(M), { onClick: ie }, {
|
|
2245
2312
|
default: j(() => [b(A(N), {
|
|
2246
2313
|
name: "lumal:reset",
|
|
2247
2314
|
size: 16
|
|
@@ -2262,21 +2329,21 @@ var rr = ["data-cockpit-theme"], ir = { class: "lumal-cockpit-designer__titlebar
|
|
|
2262
2329
|
"aria-busy": e.saving,
|
|
2263
2330
|
onClick: te
|
|
2264
2331
|
}, {
|
|
2265
|
-
default: j(() => [y(
|
|
2332
|
+
default: j(() => [y(k(e.saving ? "保存中…" : "保存"), 1)]),
|
|
2266
2333
|
_: 1
|
|
2267
2334
|
}, 8, ["loading", "aria-busy"])
|
|
2268
2335
|
])])
|
|
2269
|
-
], 40,
|
|
2336
|
+
], 40, cr));
|
|
2270
2337
|
}
|
|
2271
2338
|
});
|
|
2272
2339
|
//#endregion
|
|
2273
2340
|
//#region src/designer/index.ts
|
|
2274
|
-
function
|
|
2341
|
+
function Cr(e, t) {
|
|
2275
2342
|
let n = e;
|
|
2276
2343
|
return n.install = function(n) {
|
|
2277
2344
|
n.component(t, e);
|
|
2278
2345
|
}, n;
|
|
2279
2346
|
}
|
|
2280
|
-
var
|
|
2347
|
+
var wr = Cr(Sr, "LumalCockpitDesigner");
|
|
2281
2348
|
//#endregion
|
|
2282
|
-
export {
|
|
2349
|
+
export { Mn as CockpitComponentLibrary, er as CockpitLayoutEditor, Pn as CockpitWidgetDropZone, Dn as CockpitWidgetPreview, wr as LumalCockpitDesigner, sr as useCockpitDraft };
|