@feedmepos/mf-kitchen 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AdvanceModeView-e386f866.js +3312 -0
- package/dist/NormalModeView-5ae53fb1.js +222 -0
- package/dist/{ReceiptTemplate-6fd26b0f.js → ReceiptTemplate-ad04045a.js} +1 -1
- package/dist/app.d.ts +3 -0
- package/dist/app.js +44 -37
- package/dist/components/ReceiptEditor.vue.d.ts +5 -5
- package/dist/{restaurant-821ac89e.js → restaurant-a106b257.js} +2172 -2196
- package/dist/router/shared.d.ts +2 -1
- package/dist/stores/restaurant.d.ts +2 -2
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/AdvanceModeView-1ae75ba9.js +0 -6200
- package/dist/NormalModeView-39415dd5.js +0 -222
|
@@ -0,0 +1,3312 @@
|
|
|
1
|
+
import { defineComponent as ee, computed as L, toRefs as jo, unref as y, ref as j, reactive as Ko, h as qo, getCurrentInstance as jt, watch as Ge, onUnmounted as Jo, onMounted as _o, nextTick as Co, isRef as Ot, openBlock as x, createElementBlock as W, normalizeStyle as ge, createElementVNode as V, toDisplayString as H, resolveComponent as J, createBlock as ye, resolveDynamicComponent as Eo, markRaw as Zo, mergeProps as Qo, createVNode as S, withCtx as be, Fragment as we, renderList as Se, normalizeClass as Zt, createCommentVNode as Ue, createTextVNode as en, onBeforeUnmount as tn } from "vue";
|
|
2
|
+
import { e as R, t as on, w as at, c as rt, d as nn, f as ln, Z as an, g as Vt, F as pe, W as Le, h as rn, K as it, I as sn, i as dn, j as To, k as un, l as cn, m as mn, n as pn, u as fn, _ as gn, P as vn, a as hn, r as Qt, o as eo, b as bn, T as yn, p as to } from "./restaurant-a106b257.js";
|
|
3
|
+
import { useI18n as me, useCoreStore as _n } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as wo } from "@feedmepos/ui-library";
|
|
5
|
+
import "pinia";
|
|
6
|
+
var Cn = Object.defineProperty, _t = Object.getOwnPropertySymbols, So = Object.prototype.hasOwnProperty, Vo = Object.prototype.propertyIsEnumerable, oo = (e, o, t) => o in e ? Cn(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, Xe = (e, o) => {
|
|
7
|
+
for (var t in o || (o = {}))
|
|
8
|
+
So.call(o, t) && oo(e, t, o[t]);
|
|
9
|
+
if (_t)
|
|
10
|
+
for (var t of _t(o))
|
|
11
|
+
Vo.call(o, t) && oo(e, t, o[t]);
|
|
12
|
+
return e;
|
|
13
|
+
}, ko = (e, o) => {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var n in e)
|
|
16
|
+
So.call(e, n) && o.indexOf(n) < 0 && (t[n] = e[n]);
|
|
17
|
+
if (e != null && _t)
|
|
18
|
+
for (var n of _t(e))
|
|
19
|
+
o.indexOf(n) < 0 && Vo.call(e, n) && (t[n] = e[n]);
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
const xo = "[vue-draggable-plus]: ";
|
|
23
|
+
function En(e) {
|
|
24
|
+
console.warn(xo + e);
|
|
25
|
+
}
|
|
26
|
+
function Tn(e) {
|
|
27
|
+
console.error(xo + e);
|
|
28
|
+
}
|
|
29
|
+
function no(e, o, t) {
|
|
30
|
+
return t >= 0 && t < e.length && e.splice(t, 0, e.splice(o, 1)[0]), e;
|
|
31
|
+
}
|
|
32
|
+
function wn(e) {
|
|
33
|
+
return e.replace(/-(\w)/g, (o, t) => t ? t.toUpperCase() : "");
|
|
34
|
+
}
|
|
35
|
+
function Sn(e) {
|
|
36
|
+
return Object.keys(e).reduce((o, t) => (typeof e[t] < "u" && (o[wn(t)] = e[t]), o), {});
|
|
37
|
+
}
|
|
38
|
+
function lo(e, o) {
|
|
39
|
+
return Array.isArray(e) && e.splice(o, 1), e;
|
|
40
|
+
}
|
|
41
|
+
function io(e, o, t) {
|
|
42
|
+
return Array.isArray(e) && e.splice(o, 0, t), e;
|
|
43
|
+
}
|
|
44
|
+
function Vn(e) {
|
|
45
|
+
return typeof e > "u";
|
|
46
|
+
}
|
|
47
|
+
function kn(e) {
|
|
48
|
+
return typeof e == "string";
|
|
49
|
+
}
|
|
50
|
+
function ao(e, o, t) {
|
|
51
|
+
const n = e.children[t];
|
|
52
|
+
e.insertBefore(o, n);
|
|
53
|
+
}
|
|
54
|
+
function Rt(e) {
|
|
55
|
+
e.parentNode && e.parentNode.removeChild(e);
|
|
56
|
+
}
|
|
57
|
+
function xn(e, o = document) {
|
|
58
|
+
var t;
|
|
59
|
+
let n = null;
|
|
60
|
+
return typeof (o == null ? void 0 : o.querySelector) == "function" ? n = (t = o == null ? void 0 : o.querySelector) == null ? void 0 : t.call(o, e) : n = document.querySelector(e), n || En(`Element not found: ${e}`), n;
|
|
61
|
+
}
|
|
62
|
+
function Dn(e, o, t = null) {
|
|
63
|
+
return function(...n) {
|
|
64
|
+
return e.apply(t, n), o.apply(t, n);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function In(e, o) {
|
|
68
|
+
const t = Xe({}, e);
|
|
69
|
+
return Object.keys(o).forEach((n) => {
|
|
70
|
+
t[n] ? t[n] = Dn(e[n], o[n]) : t[n] = o[n];
|
|
71
|
+
}), t;
|
|
72
|
+
}
|
|
73
|
+
function Fn(e) {
|
|
74
|
+
return e instanceof HTMLElement;
|
|
75
|
+
}
|
|
76
|
+
function ro(e, o) {
|
|
77
|
+
Object.keys(e).forEach((t) => {
|
|
78
|
+
o(t, e[t]);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function On(e) {
|
|
82
|
+
return e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
|
|
83
|
+
(e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97);
|
|
84
|
+
}
|
|
85
|
+
const Rn = Object.assign;
|
|
86
|
+
/**!
|
|
87
|
+
* Sortable 1.15.2
|
|
88
|
+
* @author RubaXa <trash@rubaxa.org>
|
|
89
|
+
* @author owenm <owen23355@gmail.com>
|
|
90
|
+
* @license MIT
|
|
91
|
+
*/
|
|
92
|
+
function so(e, o) {
|
|
93
|
+
var t = Object.keys(e);
|
|
94
|
+
if (Object.getOwnPropertySymbols) {
|
|
95
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
96
|
+
o && (n = n.filter(function(l) {
|
|
97
|
+
return Object.getOwnPropertyDescriptor(e, l).enumerable;
|
|
98
|
+
})), t.push.apply(t, n);
|
|
99
|
+
}
|
|
100
|
+
return t;
|
|
101
|
+
}
|
|
102
|
+
function Ee(e) {
|
|
103
|
+
for (var o = 1; o < arguments.length; o++) {
|
|
104
|
+
var t = arguments[o] != null ? arguments[o] : {};
|
|
105
|
+
o % 2 ? so(Object(t), !0).forEach(function(n) {
|
|
106
|
+
An(e, n, t[n]);
|
|
107
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : so(Object(t)).forEach(function(n) {
|
|
108
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return e;
|
|
112
|
+
}
|
|
113
|
+
function gt(e) {
|
|
114
|
+
"@babel/helpers - typeof";
|
|
115
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? gt = function(o) {
|
|
116
|
+
return typeof o;
|
|
117
|
+
} : gt = function(o) {
|
|
118
|
+
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
119
|
+
}, gt(e);
|
|
120
|
+
}
|
|
121
|
+
function An(e, o, t) {
|
|
122
|
+
return o in e ? Object.defineProperty(e, o, {
|
|
123
|
+
value: t,
|
|
124
|
+
enumerable: !0,
|
|
125
|
+
configurable: !0,
|
|
126
|
+
writable: !0
|
|
127
|
+
}) : e[o] = t, e;
|
|
128
|
+
}
|
|
129
|
+
function ke() {
|
|
130
|
+
return ke = Object.assign || function(e) {
|
|
131
|
+
for (var o = 1; o < arguments.length; o++) {
|
|
132
|
+
var t = arguments[o];
|
|
133
|
+
for (var n in t)
|
|
134
|
+
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
135
|
+
}
|
|
136
|
+
return e;
|
|
137
|
+
}, ke.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
function Wn(e, o) {
|
|
140
|
+
if (e == null)
|
|
141
|
+
return {};
|
|
142
|
+
var t = {}, n = Object.keys(e), l, i;
|
|
143
|
+
for (i = 0; i < n.length; i++)
|
|
144
|
+
l = n[i], !(o.indexOf(l) >= 0) && (t[l] = e[l]);
|
|
145
|
+
return t;
|
|
146
|
+
}
|
|
147
|
+
function Nn(e, o) {
|
|
148
|
+
if (e == null)
|
|
149
|
+
return {};
|
|
150
|
+
var t = Wn(e, o), n, l;
|
|
151
|
+
if (Object.getOwnPropertySymbols) {
|
|
152
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
153
|
+
for (l = 0; l < i.length; l++)
|
|
154
|
+
n = i[l], !(o.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (t[n] = e[n]);
|
|
155
|
+
}
|
|
156
|
+
return t;
|
|
157
|
+
}
|
|
158
|
+
var Pn = "1.15.2";
|
|
159
|
+
function Ve(e) {
|
|
160
|
+
if (typeof window < "u" && window.navigator)
|
|
161
|
+
return !!/* @__PURE__ */ navigator.userAgent.match(e);
|
|
162
|
+
}
|
|
163
|
+
var xe = Ve(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), st = Ve(/Edge/i), uo = Ve(/firefox/i), Qe = Ve(/safari/i) && !Ve(/chrome/i) && !Ve(/android/i), Do = Ve(/iP(ad|od|hone)/i), Io = Ve(/chrome/i) && Ve(/android/i), Fo = {
|
|
164
|
+
capture: !1,
|
|
165
|
+
passive: !1
|
|
166
|
+
};
|
|
167
|
+
function z(e, o, t) {
|
|
168
|
+
e.addEventListener(o, t, !xe && Fo);
|
|
169
|
+
}
|
|
170
|
+
function U(e, o, t) {
|
|
171
|
+
e.removeEventListener(o, t, !xe && Fo);
|
|
172
|
+
}
|
|
173
|
+
function Ct(e, o) {
|
|
174
|
+
if (o) {
|
|
175
|
+
if (o[0] === ">" && (o = o.substring(1)), e)
|
|
176
|
+
try {
|
|
177
|
+
if (e.matches)
|
|
178
|
+
return e.matches(o);
|
|
179
|
+
if (e.msMatchesSelector)
|
|
180
|
+
return e.msMatchesSelector(o);
|
|
181
|
+
if (e.webkitMatchesSelector)
|
|
182
|
+
return e.webkitMatchesSelector(o);
|
|
183
|
+
} catch {
|
|
184
|
+
return !1;
|
|
185
|
+
}
|
|
186
|
+
return !1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function Ln(e) {
|
|
190
|
+
return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode;
|
|
191
|
+
}
|
|
192
|
+
function he(e, o, t, n) {
|
|
193
|
+
if (e) {
|
|
194
|
+
t = t || document;
|
|
195
|
+
do {
|
|
196
|
+
if (o != null && (o[0] === ">" ? e.parentNode === t && Ct(e, o) : Ct(e, o)) || n && e === t)
|
|
197
|
+
return e;
|
|
198
|
+
if (e === t)
|
|
199
|
+
break;
|
|
200
|
+
} while (e = Ln(e));
|
|
201
|
+
}
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
var co = /\s+/g;
|
|
205
|
+
function de(e, o, t) {
|
|
206
|
+
if (e && o)
|
|
207
|
+
if (e.classList)
|
|
208
|
+
e.classList[t ? "add" : "remove"](o);
|
|
209
|
+
else {
|
|
210
|
+
var n = (" " + e.className + " ").replace(co, " ").replace(" " + o + " ", " ");
|
|
211
|
+
e.className = (n + (t ? " " + o : "")).replace(co, " ");
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function I(e, o, t) {
|
|
215
|
+
var n = e && e.style;
|
|
216
|
+
if (n) {
|
|
217
|
+
if (t === void 0)
|
|
218
|
+
return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (t = e.currentStyle), o === void 0 ? t : t[o];
|
|
219
|
+
!(o in n) && o.indexOf("webkit") === -1 && (o = "-webkit-" + o), n[o] = t + (typeof t == "string" ? "" : "px");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function Ye(e, o) {
|
|
223
|
+
var t = "";
|
|
224
|
+
if (typeof e == "string")
|
|
225
|
+
t = e;
|
|
226
|
+
else
|
|
227
|
+
do {
|
|
228
|
+
var n = I(e, "transform");
|
|
229
|
+
n && n !== "none" && (t = n + " " + t);
|
|
230
|
+
} while (!o && (e = e.parentNode));
|
|
231
|
+
var l = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
|
232
|
+
return l && new l(t);
|
|
233
|
+
}
|
|
234
|
+
function Oo(e, o, t) {
|
|
235
|
+
if (e) {
|
|
236
|
+
var n = e.getElementsByTagName(o), l = 0, i = n.length;
|
|
237
|
+
if (t)
|
|
238
|
+
for (; l < i; l++)
|
|
239
|
+
t(n[l], l);
|
|
240
|
+
return n;
|
|
241
|
+
}
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
function Ce() {
|
|
245
|
+
var e = document.scrollingElement;
|
|
246
|
+
return e || document.documentElement;
|
|
247
|
+
}
|
|
248
|
+
function oe(e, o, t, n, l) {
|
|
249
|
+
if (!(!e.getBoundingClientRect && e !== window)) {
|
|
250
|
+
var i, a, s, r, d, u, f;
|
|
251
|
+
if (e !== window && e.parentNode && e !== Ce() ? (i = e.getBoundingClientRect(), a = i.top, s = i.left, r = i.bottom, d = i.right, u = i.height, f = i.width) : (a = 0, s = 0, r = window.innerHeight, d = window.innerWidth, u = window.innerHeight, f = window.innerWidth), (o || t) && e !== window && (l = l || e.parentNode, !xe))
|
|
252
|
+
do
|
|
253
|
+
if (l && l.getBoundingClientRect && (I(l, "transform") !== "none" || t && I(l, "position") !== "static")) {
|
|
254
|
+
var c = l.getBoundingClientRect();
|
|
255
|
+
a -= c.top + parseInt(I(l, "border-top-width")), s -= c.left + parseInt(I(l, "border-left-width")), r = a + i.height, d = s + i.width;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
while (l = l.parentNode);
|
|
259
|
+
if (n && e !== window) {
|
|
260
|
+
var m = Ye(l || e), E = m && m.a, T = m && m.d;
|
|
261
|
+
m && (a /= T, s /= E, f /= E, u /= T, r = a + u, d = s + f);
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
top: a,
|
|
265
|
+
left: s,
|
|
266
|
+
bottom: r,
|
|
267
|
+
right: d,
|
|
268
|
+
width: f,
|
|
269
|
+
height: u
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function mo(e, o, t) {
|
|
274
|
+
for (var n = Oe(e, !0), l = oe(e)[o]; n; ) {
|
|
275
|
+
var i = oe(n)[t], a = void 0;
|
|
276
|
+
if (a = l >= i, !a)
|
|
277
|
+
return n;
|
|
278
|
+
if (n === Ce())
|
|
279
|
+
break;
|
|
280
|
+
n = Oe(n, !1);
|
|
281
|
+
}
|
|
282
|
+
return !1;
|
|
283
|
+
}
|
|
284
|
+
function He(e, o, t, n) {
|
|
285
|
+
for (var l = 0, i = 0, a = e.children; i < a.length; ) {
|
|
286
|
+
if (a[i].style.display !== "none" && a[i] !== F.ghost && (n || a[i] !== F.dragged) && he(a[i], t.draggable, e, !1)) {
|
|
287
|
+
if (l === o)
|
|
288
|
+
return a[i];
|
|
289
|
+
l++;
|
|
290
|
+
}
|
|
291
|
+
i++;
|
|
292
|
+
}
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
function Kt(e, o) {
|
|
296
|
+
for (var t = e.lastElementChild; t && (t === F.ghost || I(t, "display") === "none" || o && !Ct(t, o)); )
|
|
297
|
+
t = t.previousElementSibling;
|
|
298
|
+
return t || null;
|
|
299
|
+
}
|
|
300
|
+
function fe(e, o) {
|
|
301
|
+
var t = 0;
|
|
302
|
+
if (!e || !e.parentNode)
|
|
303
|
+
return -1;
|
|
304
|
+
for (; e = e.previousElementSibling; )
|
|
305
|
+
e.nodeName.toUpperCase() !== "TEMPLATE" && e !== F.clone && (!o || Ct(e, o)) && t++;
|
|
306
|
+
return t;
|
|
307
|
+
}
|
|
308
|
+
function po(e) {
|
|
309
|
+
var o = 0, t = 0, n = Ce();
|
|
310
|
+
if (e)
|
|
311
|
+
do {
|
|
312
|
+
var l = Ye(e), i = l.a, a = l.d;
|
|
313
|
+
o += e.scrollLeft * i, t += e.scrollTop * a;
|
|
314
|
+
} while (e !== n && (e = e.parentNode));
|
|
315
|
+
return [o, t];
|
|
316
|
+
}
|
|
317
|
+
function $n(e, o) {
|
|
318
|
+
for (var t in e)
|
|
319
|
+
if (e.hasOwnProperty(t)) {
|
|
320
|
+
for (var n in o)
|
|
321
|
+
if (o.hasOwnProperty(n) && o[n] === e[t][n])
|
|
322
|
+
return Number(t);
|
|
323
|
+
}
|
|
324
|
+
return -1;
|
|
325
|
+
}
|
|
326
|
+
function Oe(e, o) {
|
|
327
|
+
if (!e || !e.getBoundingClientRect)
|
|
328
|
+
return Ce();
|
|
329
|
+
var t = e, n = !1;
|
|
330
|
+
do
|
|
331
|
+
if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
|
|
332
|
+
var l = I(t);
|
|
333
|
+
if (t.clientWidth < t.scrollWidth && (l.overflowX == "auto" || l.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (l.overflowY == "auto" || l.overflowY == "scroll")) {
|
|
334
|
+
if (!t.getBoundingClientRect || t === document.body)
|
|
335
|
+
return Ce();
|
|
336
|
+
if (n || o)
|
|
337
|
+
return t;
|
|
338
|
+
n = !0;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
while (t = t.parentNode);
|
|
342
|
+
return Ce();
|
|
343
|
+
}
|
|
344
|
+
function Bn(e, o) {
|
|
345
|
+
if (e && o)
|
|
346
|
+
for (var t in o)
|
|
347
|
+
o.hasOwnProperty(t) && (e[t] = o[t]);
|
|
348
|
+
return e;
|
|
349
|
+
}
|
|
350
|
+
function At(e, o) {
|
|
351
|
+
return Math.round(e.top) === Math.round(o.top) && Math.round(e.left) === Math.round(o.left) && Math.round(e.height) === Math.round(o.height) && Math.round(e.width) === Math.round(o.width);
|
|
352
|
+
}
|
|
353
|
+
var et;
|
|
354
|
+
function Ro(e, o) {
|
|
355
|
+
return function() {
|
|
356
|
+
if (!et) {
|
|
357
|
+
var t = arguments, n = this;
|
|
358
|
+
t.length === 1 ? e.call(n, t[0]) : e.apply(n, t), et = setTimeout(function() {
|
|
359
|
+
et = void 0;
|
|
360
|
+
}, o);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function Mn() {
|
|
365
|
+
clearTimeout(et), et = void 0;
|
|
366
|
+
}
|
|
367
|
+
function Ao(e, o, t) {
|
|
368
|
+
e.scrollLeft += o, e.scrollTop += t;
|
|
369
|
+
}
|
|
370
|
+
function Wo(e) {
|
|
371
|
+
var o = window.Polymer, t = window.jQuery || window.Zepto;
|
|
372
|
+
return o && o.dom ? o.dom(e).cloneNode(!0) : t ? t(e).clone(!0)[0] : e.cloneNode(!0);
|
|
373
|
+
}
|
|
374
|
+
function No(e, o, t) {
|
|
375
|
+
var n = {};
|
|
376
|
+
return Array.from(e.children).forEach(function(l) {
|
|
377
|
+
var i, a, s, r;
|
|
378
|
+
if (!(!he(l, o.draggable, e, !1) || l.animated || l === t)) {
|
|
379
|
+
var d = oe(l);
|
|
380
|
+
n.left = Math.min((i = n.left) !== null && i !== void 0 ? i : 1 / 0, d.left), n.top = Math.min((a = n.top) !== null && a !== void 0 ? a : 1 / 0, d.top), n.right = Math.max((s = n.right) !== null && s !== void 0 ? s : -1 / 0, d.right), n.bottom = Math.max((r = n.bottom) !== null && r !== void 0 ? r : -1 / 0, d.bottom);
|
|
381
|
+
}
|
|
382
|
+
}), n.width = n.right - n.left, n.height = n.bottom - n.top, n.x = n.left, n.y = n.top, n;
|
|
383
|
+
}
|
|
384
|
+
var ce = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
|
|
385
|
+
function Un() {
|
|
386
|
+
var e = [], o;
|
|
387
|
+
return {
|
|
388
|
+
captureAnimationState: function() {
|
|
389
|
+
if (e = [], !!this.options.animation) {
|
|
390
|
+
var t = [].slice.call(this.el.children);
|
|
391
|
+
t.forEach(function(n) {
|
|
392
|
+
if (!(I(n, "display") === "none" || n === F.ghost)) {
|
|
393
|
+
e.push({
|
|
394
|
+
target: n,
|
|
395
|
+
rect: oe(n)
|
|
396
|
+
});
|
|
397
|
+
var l = Ee({}, e[e.length - 1].rect);
|
|
398
|
+
if (n.thisAnimationDuration) {
|
|
399
|
+
var i = Ye(n, !0);
|
|
400
|
+
i && (l.top -= i.f, l.left -= i.e);
|
|
401
|
+
}
|
|
402
|
+
n.fromRect = l;
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
addAnimationState: function(t) {
|
|
408
|
+
e.push(t);
|
|
409
|
+
},
|
|
410
|
+
removeAnimationState: function(t) {
|
|
411
|
+
e.splice($n(e, {
|
|
412
|
+
target: t
|
|
413
|
+
}), 1);
|
|
414
|
+
},
|
|
415
|
+
animateAll: function(t) {
|
|
416
|
+
var n = this;
|
|
417
|
+
if (!this.options.animation) {
|
|
418
|
+
clearTimeout(o), typeof t == "function" && t();
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
var l = !1, i = 0;
|
|
422
|
+
e.forEach(function(a) {
|
|
423
|
+
var s = 0, r = a.target, d = r.fromRect, u = oe(r), f = r.prevFromRect, c = r.prevToRect, m = a.rect, E = Ye(r, !0);
|
|
424
|
+
E && (u.top -= E.f, u.left -= E.e), r.toRect = u, r.thisAnimationDuration && At(f, u) && !At(d, u) && // Make sure animatingRect is on line between toRect & fromRect
|
|
425
|
+
(m.top - u.top) / (m.left - u.left) === (d.top - u.top) / (d.left - u.left) && (s = zn(m, f, c, n.options)), At(u, d) || (r.prevFromRect = d, r.prevToRect = u, s || (s = n.options.animation), n.animate(r, m, u, s)), s && (l = !0, i = Math.max(i, s), clearTimeout(r.animationResetTimer), r.animationResetTimer = setTimeout(function() {
|
|
426
|
+
r.animationTime = 0, r.prevFromRect = null, r.fromRect = null, r.prevToRect = null, r.thisAnimationDuration = null;
|
|
427
|
+
}, s), r.thisAnimationDuration = s);
|
|
428
|
+
}), clearTimeout(o), l ? o = setTimeout(function() {
|
|
429
|
+
typeof t == "function" && t();
|
|
430
|
+
}, i) : typeof t == "function" && t(), e = [];
|
|
431
|
+
},
|
|
432
|
+
animate: function(t, n, l, i) {
|
|
433
|
+
if (i) {
|
|
434
|
+
I(t, "transition", ""), I(t, "transform", "");
|
|
435
|
+
var a = Ye(this.el), s = a && a.a, r = a && a.d, d = (n.left - l.left) / (s || 1), u = (n.top - l.top) / (r || 1);
|
|
436
|
+
t.animatingX = !!d, t.animatingY = !!u, I(t, "transform", "translate3d(" + d + "px," + u + "px,0)"), this.forRepaintDummy = Xn(t), I(t, "transition", "transform " + i + "ms" + (this.options.easing ? " " + this.options.easing : "")), I(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
|
|
437
|
+
I(t, "transition", ""), I(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
|
|
438
|
+
}, i);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function Xn(e) {
|
|
444
|
+
return e.offsetWidth;
|
|
445
|
+
}
|
|
446
|
+
function zn(e, o, t, n) {
|
|
447
|
+
return Math.sqrt(Math.pow(o.top - e.top, 2) + Math.pow(o.left - e.left, 2)) / Math.sqrt(Math.pow(o.top - t.top, 2) + Math.pow(o.left - t.left, 2)) * n.animation;
|
|
448
|
+
}
|
|
449
|
+
var $e = [], Wt = {
|
|
450
|
+
initializeByDefault: !0
|
|
451
|
+
}, dt = {
|
|
452
|
+
mount: function(e) {
|
|
453
|
+
for (var o in Wt)
|
|
454
|
+
Wt.hasOwnProperty(o) && !(o in e) && (e[o] = Wt[o]);
|
|
455
|
+
$e.forEach(function(t) {
|
|
456
|
+
if (t.pluginName === e.pluginName)
|
|
457
|
+
throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
|
|
458
|
+
}), $e.push(e);
|
|
459
|
+
},
|
|
460
|
+
pluginEvent: function(e, o, t) {
|
|
461
|
+
var n = this;
|
|
462
|
+
this.eventCanceled = !1, t.cancel = function() {
|
|
463
|
+
n.eventCanceled = !0;
|
|
464
|
+
};
|
|
465
|
+
var l = e + "Global";
|
|
466
|
+
$e.forEach(function(i) {
|
|
467
|
+
o[i.pluginName] && (o[i.pluginName][l] && o[i.pluginName][l](Ee({
|
|
468
|
+
sortable: o
|
|
469
|
+
}, t)), o.options[i.pluginName] && o[i.pluginName][e] && o[i.pluginName][e](Ee({
|
|
470
|
+
sortable: o
|
|
471
|
+
}, t)));
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
initializePlugins: function(e, o, t, n) {
|
|
475
|
+
$e.forEach(function(a) {
|
|
476
|
+
var s = a.pluginName;
|
|
477
|
+
if (!(!e.options[s] && !a.initializeByDefault)) {
|
|
478
|
+
var r = new a(e, o, e.options);
|
|
479
|
+
r.sortable = e, r.options = e.options, e[s] = r, ke(t, r.defaults);
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
for (var l in e.options)
|
|
483
|
+
if (e.options.hasOwnProperty(l)) {
|
|
484
|
+
var i = this.modifyOption(e, l, e.options[l]);
|
|
485
|
+
typeof i < "u" && (e.options[l] = i);
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
getEventProperties: function(e, o) {
|
|
489
|
+
var t = {};
|
|
490
|
+
return $e.forEach(function(n) {
|
|
491
|
+
typeof n.eventProperties == "function" && ke(t, n.eventProperties.call(o[n.pluginName], e));
|
|
492
|
+
}), t;
|
|
493
|
+
},
|
|
494
|
+
modifyOption: function(e, o, t) {
|
|
495
|
+
var n;
|
|
496
|
+
return $e.forEach(function(l) {
|
|
497
|
+
e[l.pluginName] && l.optionListeners && typeof l.optionListeners[o] == "function" && (n = l.optionListeners[o].call(e[l.pluginName], t));
|
|
498
|
+
}), n;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
function Yn(e) {
|
|
502
|
+
var o = e.sortable, t = e.rootEl, n = e.name, l = e.targetEl, i = e.cloneEl, a = e.toEl, s = e.fromEl, r = e.oldIndex, d = e.newIndex, u = e.oldDraggableIndex, f = e.newDraggableIndex, c = e.originalEvent, m = e.putSortable, E = e.extraEventProperties;
|
|
503
|
+
if (o = o || t && t[ce], !!o) {
|
|
504
|
+
var T, D = o.options, M = "on" + n.charAt(0).toUpperCase() + n.substr(1);
|
|
505
|
+
window.CustomEvent && !xe && !st ? T = new CustomEvent(n, {
|
|
506
|
+
bubbles: !0,
|
|
507
|
+
cancelable: !0
|
|
508
|
+
}) : (T = document.createEvent("Event"), T.initEvent(n, !0, !0)), T.to = a || t, T.from = s || t, T.item = l || t, T.clone = i, T.oldIndex = r, T.newIndex = d, T.oldDraggableIndex = u, T.newDraggableIndex = f, T.originalEvent = c, T.pullMode = m ? m.lastPutMode : void 0;
|
|
509
|
+
var K = Ee(Ee({}, E), dt.getEventProperties(n, o));
|
|
510
|
+
for (var $ in K)
|
|
511
|
+
T[$] = K[$];
|
|
512
|
+
t && t.dispatchEvent(T), D[M] && D[M].call(o, T);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
var Gn = ["evt"], se = function(e, o) {
|
|
516
|
+
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = t.evt, l = Nn(t, Gn);
|
|
517
|
+
dt.pluginEvent.bind(F)(e, o, Ee({
|
|
518
|
+
dragEl: g,
|
|
519
|
+
parentEl: Q,
|
|
520
|
+
ghostEl: A,
|
|
521
|
+
rootEl: q,
|
|
522
|
+
nextEl: Ne,
|
|
523
|
+
lastDownEl: vt,
|
|
524
|
+
cloneEl: Z,
|
|
525
|
+
cloneHidden: Fe,
|
|
526
|
+
dragStarted: qe,
|
|
527
|
+
putSortable: ne,
|
|
528
|
+
activeSortable: F.active,
|
|
529
|
+
originalEvent: n,
|
|
530
|
+
oldIndex: ze,
|
|
531
|
+
oldDraggableIndex: tt,
|
|
532
|
+
newIndex: ue,
|
|
533
|
+
newDraggableIndex: Ie,
|
|
534
|
+
hideGhostForTarget: Bo,
|
|
535
|
+
unhideGhostForTarget: Mo,
|
|
536
|
+
cloneNowHidden: function() {
|
|
537
|
+
Fe = !0;
|
|
538
|
+
},
|
|
539
|
+
cloneNowShown: function() {
|
|
540
|
+
Fe = !1;
|
|
541
|
+
},
|
|
542
|
+
dispatchSortableEvent: function(i) {
|
|
543
|
+
re({
|
|
544
|
+
sortable: o,
|
|
545
|
+
name: i,
|
|
546
|
+
originalEvent: n
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}, l));
|
|
550
|
+
};
|
|
551
|
+
function re(e) {
|
|
552
|
+
Yn(Ee({
|
|
553
|
+
putSortable: ne,
|
|
554
|
+
cloneEl: Z,
|
|
555
|
+
targetEl: g,
|
|
556
|
+
rootEl: q,
|
|
557
|
+
oldIndex: ze,
|
|
558
|
+
oldDraggableIndex: tt,
|
|
559
|
+
newIndex: ue,
|
|
560
|
+
newDraggableIndex: Ie
|
|
561
|
+
}, e));
|
|
562
|
+
}
|
|
563
|
+
var g, Q, A, q, Ne, vt, Z, Fe, ze, ue, tt, Ie, ct, ne, Me = !1, Et = !1, Tt = [], Ae, ve, Nt, Pt, fo, go, qe, Be, ot, nt = !1, mt = !1, ht, ie, Lt = [], Xt = !1, wt = [], kt = typeof document < "u", pt = Do, vo = st || xe ? "cssFloat" : "float", Hn = kt && !Io && !Do && "draggable" in document.createElement("div"), Po = function() {
|
|
564
|
+
if (kt) {
|
|
565
|
+
if (xe)
|
|
566
|
+
return !1;
|
|
567
|
+
var e = document.createElement("x");
|
|
568
|
+
return e.style.cssText = "pointer-events:auto", e.style.pointerEvents === "auto";
|
|
569
|
+
}
|
|
570
|
+
}(), Lo = function(e, o) {
|
|
571
|
+
var t = I(e), n = parseInt(t.width) - parseInt(t.paddingLeft) - parseInt(t.paddingRight) - parseInt(t.borderLeftWidth) - parseInt(t.borderRightWidth), l = He(e, 0, o), i = He(e, 1, o), a = l && I(l), s = i && I(i), r = a && parseInt(a.marginLeft) + parseInt(a.marginRight) + oe(l).width, d = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + oe(i).width;
|
|
572
|
+
if (t.display === "flex")
|
|
573
|
+
return t.flexDirection === "column" || t.flexDirection === "column-reverse" ? "vertical" : "horizontal";
|
|
574
|
+
if (t.display === "grid")
|
|
575
|
+
return t.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
|
|
576
|
+
if (l && a.float && a.float !== "none") {
|
|
577
|
+
var u = a.float === "left" ? "left" : "right";
|
|
578
|
+
return i && (s.clear === "both" || s.clear === u) ? "vertical" : "horizontal";
|
|
579
|
+
}
|
|
580
|
+
return l && (a.display === "block" || a.display === "flex" || a.display === "table" || a.display === "grid" || r >= n && t[vo] === "none" || i && t[vo] === "none" && r + d > n) ? "vertical" : "horizontal";
|
|
581
|
+
}, jn = function(e, o, t) {
|
|
582
|
+
var n = t ? e.left : e.top, l = t ? e.right : e.bottom, i = t ? e.width : e.height, a = t ? o.left : o.top, s = t ? o.right : o.bottom, r = t ? o.width : o.height;
|
|
583
|
+
return n === a || l === s || n + i / 2 === a + r / 2;
|
|
584
|
+
}, Kn = function(e, o) {
|
|
585
|
+
var t;
|
|
586
|
+
return Tt.some(function(n) {
|
|
587
|
+
var l = n[ce].options.emptyInsertThreshold;
|
|
588
|
+
if (!(!l || Kt(n))) {
|
|
589
|
+
var i = oe(n), a = e >= i.left - l && e <= i.right + l, s = o >= i.top - l && o <= i.bottom + l;
|
|
590
|
+
if (a && s)
|
|
591
|
+
return t = n;
|
|
592
|
+
}
|
|
593
|
+
}), t;
|
|
594
|
+
}, $o = function(e) {
|
|
595
|
+
function o(l, i) {
|
|
596
|
+
return function(a, s, r, d) {
|
|
597
|
+
var u = a.options.group.name && s.options.group.name && a.options.group.name === s.options.group.name;
|
|
598
|
+
if (l == null && (i || u))
|
|
599
|
+
return !0;
|
|
600
|
+
if (l == null || l === !1)
|
|
601
|
+
return !1;
|
|
602
|
+
if (i && l === "clone")
|
|
603
|
+
return l;
|
|
604
|
+
if (typeof l == "function")
|
|
605
|
+
return o(l(a, s, r, d), i)(a, s, r, d);
|
|
606
|
+
var f = (i ? a : s).options.group.name;
|
|
607
|
+
return l === !0 || typeof l == "string" && l === f || l.join && l.indexOf(f) > -1;
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
var t = {}, n = e.group;
|
|
611
|
+
(!n || gt(n) != "object") && (n = {
|
|
612
|
+
name: n
|
|
613
|
+
}), t.name = n.name, t.checkPull = o(n.pull, !0), t.checkPut = o(n.put), t.revertClone = n.revertClone, e.group = t;
|
|
614
|
+
}, Bo = function() {
|
|
615
|
+
!Po && A && I(A, "display", "none");
|
|
616
|
+
}, Mo = function() {
|
|
617
|
+
!Po && A && I(A, "display", "");
|
|
618
|
+
};
|
|
619
|
+
kt && !Io && document.addEventListener("click", function(e) {
|
|
620
|
+
if (Et)
|
|
621
|
+
return e.preventDefault(), e.stopPropagation && e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), Et = !1, !1;
|
|
622
|
+
}, !0);
|
|
623
|
+
var We = function(e) {
|
|
624
|
+
if (g) {
|
|
625
|
+
e = e.touches ? e.touches[0] : e;
|
|
626
|
+
var o = Kn(e.clientX, e.clientY);
|
|
627
|
+
if (o) {
|
|
628
|
+
var t = {};
|
|
629
|
+
for (var n in e)
|
|
630
|
+
e.hasOwnProperty(n) && (t[n] = e[n]);
|
|
631
|
+
t.target = t.rootEl = o, t.preventDefault = void 0, t.stopPropagation = void 0, o[ce]._onDragOver(t);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}, qn = function(e) {
|
|
635
|
+
g && g.parentNode[ce]._isOutsideThisEl(e.target);
|
|
636
|
+
};
|
|
637
|
+
function F(e, o) {
|
|
638
|
+
if (!(e && e.nodeType && e.nodeType === 1))
|
|
639
|
+
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));
|
|
640
|
+
this.el = e, this.options = o = ke({}, o), e[ce] = this;
|
|
641
|
+
var t = {
|
|
642
|
+
group: null,
|
|
643
|
+
sort: !0,
|
|
644
|
+
disabled: !1,
|
|
645
|
+
store: null,
|
|
646
|
+
handle: null,
|
|
647
|
+
draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
|
|
648
|
+
swapThreshold: 1,
|
|
649
|
+
// percentage; 0 <= x <= 1
|
|
650
|
+
invertSwap: !1,
|
|
651
|
+
// invert always
|
|
652
|
+
invertedSwapThreshold: null,
|
|
653
|
+
// will be set to same as swapThreshold if default
|
|
654
|
+
removeCloneOnHide: !0,
|
|
655
|
+
direction: function() {
|
|
656
|
+
return Lo(e, this.options);
|
|
657
|
+
},
|
|
658
|
+
ghostClass: "sortable-ghost",
|
|
659
|
+
chosenClass: "sortable-chosen",
|
|
660
|
+
dragClass: "sortable-drag",
|
|
661
|
+
ignore: "a, img",
|
|
662
|
+
filter: null,
|
|
663
|
+
preventOnFilter: !0,
|
|
664
|
+
animation: 0,
|
|
665
|
+
easing: null,
|
|
666
|
+
setData: function(i, a) {
|
|
667
|
+
i.setData("Text", a.textContent);
|
|
668
|
+
},
|
|
669
|
+
dropBubble: !1,
|
|
670
|
+
dragoverBubble: !1,
|
|
671
|
+
dataIdAttr: "data-id",
|
|
672
|
+
delay: 0,
|
|
673
|
+
delayOnTouchOnly: !1,
|
|
674
|
+
touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
|
|
675
|
+
forceFallback: !1,
|
|
676
|
+
fallbackClass: "sortable-fallback",
|
|
677
|
+
fallbackOnBody: !1,
|
|
678
|
+
fallbackTolerance: 0,
|
|
679
|
+
fallbackOffset: {
|
|
680
|
+
x: 0,
|
|
681
|
+
y: 0
|
|
682
|
+
},
|
|
683
|
+
supportPointer: F.supportPointer !== !1 && "PointerEvent" in window && !Qe,
|
|
684
|
+
emptyInsertThreshold: 5
|
|
685
|
+
};
|
|
686
|
+
dt.initializePlugins(this, e, t);
|
|
687
|
+
for (var n in t)
|
|
688
|
+
!(n in o) && (o[n] = t[n]);
|
|
689
|
+
$o(o);
|
|
690
|
+
for (var l in this)
|
|
691
|
+
l.charAt(0) === "_" && typeof this[l] == "function" && (this[l] = this[l].bind(this));
|
|
692
|
+
this.nativeDraggable = o.forceFallback ? !1 : Hn, this.nativeDraggable && (this.options.touchStartThreshold = 1), o.supportPointer ? z(e, "pointerdown", this._onTapStart) : (z(e, "mousedown", this._onTapStart), z(e, "touchstart", this._onTapStart)), this.nativeDraggable && (z(e, "dragover", this), z(e, "dragenter", this)), Tt.push(this.el), o.store && o.store.get && this.sort(o.store.get(this) || []), ke(this, Un());
|
|
693
|
+
}
|
|
694
|
+
F.prototype = /** @lends Sortable.prototype */
|
|
695
|
+
{
|
|
696
|
+
constructor: F,
|
|
697
|
+
_isOutsideThisEl: function(e) {
|
|
698
|
+
!this.el.contains(e) && e !== this.el && (Be = null);
|
|
699
|
+
},
|
|
700
|
+
_getDirection: function(e, o) {
|
|
701
|
+
return typeof this.options.direction == "function" ? this.options.direction.call(this, e, o, g) : this.options.direction;
|
|
702
|
+
},
|
|
703
|
+
_onTapStart: function(e) {
|
|
704
|
+
if (e.cancelable) {
|
|
705
|
+
var o = this, t = this.el, n = this.options, l = n.preventOnFilter, i = e.type, a = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (a || e).target, r = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, d = n.filter;
|
|
706
|
+
if (ll(t), !g && !(/mousedown|pointerdown/.test(i) && e.button !== 0 || n.disabled) && !r.isContentEditable && !(!this.nativeDraggable && Qe && s && s.tagName.toUpperCase() === "SELECT") && (s = he(s, n.draggable, t, !1), !(s && s.animated) && vt !== s)) {
|
|
707
|
+
if (ze = fe(s), tt = fe(s, n.draggable), typeof d == "function") {
|
|
708
|
+
if (d.call(this, e, s, this)) {
|
|
709
|
+
re({
|
|
710
|
+
sortable: o,
|
|
711
|
+
rootEl: r,
|
|
712
|
+
name: "filter",
|
|
713
|
+
targetEl: s,
|
|
714
|
+
toEl: t,
|
|
715
|
+
fromEl: t
|
|
716
|
+
}), se("filter", o, {
|
|
717
|
+
evt: e
|
|
718
|
+
}), l && e.cancelable && e.preventDefault();
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
} else if (d && (d = d.split(",").some(function(u) {
|
|
722
|
+
if (u = he(r, u.trim(), t, !1), u)
|
|
723
|
+
return re({
|
|
724
|
+
sortable: o,
|
|
725
|
+
rootEl: u,
|
|
726
|
+
name: "filter",
|
|
727
|
+
targetEl: s,
|
|
728
|
+
fromEl: t,
|
|
729
|
+
toEl: t
|
|
730
|
+
}), se("filter", o, {
|
|
731
|
+
evt: e
|
|
732
|
+
}), !0;
|
|
733
|
+
}), d)) {
|
|
734
|
+
l && e.cancelable && e.preventDefault();
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
n.handle && !he(r, n.handle, t, !1) || this._prepareDragStart(e, a, s);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
_prepareDragStart: function(e, o, t) {
|
|
742
|
+
var n = this, l = n.el, i = n.options, a = l.ownerDocument, s;
|
|
743
|
+
if (t && !g && t.parentNode === l) {
|
|
744
|
+
var r = oe(t);
|
|
745
|
+
if (q = l, g = t, Q = g.parentNode, Ne = g.nextSibling, vt = t, ct = i.group, F.dragged = g, Ae = {
|
|
746
|
+
target: g,
|
|
747
|
+
clientX: (o || e).clientX,
|
|
748
|
+
clientY: (o || e).clientY
|
|
749
|
+
}, fo = Ae.clientX - r.left, go = Ae.clientY - r.top, this._lastX = (o || e).clientX, this._lastY = (o || e).clientY, g.style["will-change"] = "all", s = function() {
|
|
750
|
+
if (se("delayEnded", n, {
|
|
751
|
+
evt: e
|
|
752
|
+
}), F.eventCanceled) {
|
|
753
|
+
n._onDrop();
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
n._disableDelayedDragEvents(), !uo && n.nativeDraggable && (g.draggable = !0), n._triggerDragStart(e, o), re({
|
|
757
|
+
sortable: n,
|
|
758
|
+
name: "choose",
|
|
759
|
+
originalEvent: e
|
|
760
|
+
}), de(g, i.chosenClass, !0);
|
|
761
|
+
}, i.ignore.split(",").forEach(function(d) {
|
|
762
|
+
Oo(g, d.trim(), $t);
|
|
763
|
+
}), z(a, "dragover", We), z(a, "mousemove", We), z(a, "touchmove", We), z(a, "mouseup", n._onDrop), z(a, "touchend", n._onDrop), z(a, "touchcancel", n._onDrop), uo && this.nativeDraggable && (this.options.touchStartThreshold = 4, g.draggable = !0), se("delayStart", this, {
|
|
764
|
+
evt: e
|
|
765
|
+
}), i.delay && (!i.delayOnTouchOnly || o) && (!this.nativeDraggable || !(st || xe))) {
|
|
766
|
+
if (F.eventCanceled) {
|
|
767
|
+
this._onDrop();
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
z(a, "mouseup", n._disableDelayedDrag), z(a, "touchend", n._disableDelayedDrag), z(a, "touchcancel", n._disableDelayedDrag), z(a, "mousemove", n._delayedDragTouchMoveHandler), z(a, "touchmove", n._delayedDragTouchMoveHandler), i.supportPointer && z(a, "pointermove", n._delayedDragTouchMoveHandler), n._dragStartTimer = setTimeout(s, i.delay);
|
|
771
|
+
} else
|
|
772
|
+
s();
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
_delayedDragTouchMoveHandler: function(e) {
|
|
776
|
+
var o = e.touches ? e.touches[0] : e;
|
|
777
|
+
Math.max(Math.abs(o.clientX - this._lastX), Math.abs(o.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
|
|
778
|
+
},
|
|
779
|
+
_disableDelayedDrag: function() {
|
|
780
|
+
g && $t(g), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
|
|
781
|
+
},
|
|
782
|
+
_disableDelayedDragEvents: function() {
|
|
783
|
+
var e = this.el.ownerDocument;
|
|
784
|
+
U(e, "mouseup", this._disableDelayedDrag), U(e, "touchend", this._disableDelayedDrag), U(e, "touchcancel", this._disableDelayedDrag), U(e, "mousemove", this._delayedDragTouchMoveHandler), U(e, "touchmove", this._delayedDragTouchMoveHandler), U(e, "pointermove", this._delayedDragTouchMoveHandler);
|
|
785
|
+
},
|
|
786
|
+
_triggerDragStart: function(e, o) {
|
|
787
|
+
o = o || e.pointerType == "touch" && e, !this.nativeDraggable || o ? this.options.supportPointer ? z(document, "pointermove", this._onTouchMove) : o ? z(document, "touchmove", this._onTouchMove) : z(document, "mousemove", this._onTouchMove) : (z(g, "dragend", this), z(q, "dragstart", this._onDragStart));
|
|
788
|
+
try {
|
|
789
|
+
document.selection ? bt(function() {
|
|
790
|
+
document.selection.empty();
|
|
791
|
+
}) : window.getSelection().removeAllRanges();
|
|
792
|
+
} catch {
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
_dragStarted: function(e, o) {
|
|
796
|
+
if (Me = !1, q && g) {
|
|
797
|
+
se("dragStarted", this, {
|
|
798
|
+
evt: o
|
|
799
|
+
}), this.nativeDraggable && z(document, "dragover", qn);
|
|
800
|
+
var t = this.options;
|
|
801
|
+
!e && de(g, t.dragClass, !1), de(g, t.ghostClass, !0), F.active = this, e && this._appendGhost(), re({
|
|
802
|
+
sortable: this,
|
|
803
|
+
name: "start",
|
|
804
|
+
originalEvent: o
|
|
805
|
+
});
|
|
806
|
+
} else
|
|
807
|
+
this._nulling();
|
|
808
|
+
},
|
|
809
|
+
_emulateDragOver: function() {
|
|
810
|
+
if (ve) {
|
|
811
|
+
this._lastX = ve.clientX, this._lastY = ve.clientY, Bo();
|
|
812
|
+
for (var e = document.elementFromPoint(ve.clientX, ve.clientY), o = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(ve.clientX, ve.clientY), e !== o); )
|
|
813
|
+
o = e;
|
|
814
|
+
if (g.parentNode[ce]._isOutsideThisEl(e), o)
|
|
815
|
+
do {
|
|
816
|
+
if (o[ce]) {
|
|
817
|
+
var t = void 0;
|
|
818
|
+
if (t = o[ce]._onDragOver({
|
|
819
|
+
clientX: ve.clientX,
|
|
820
|
+
clientY: ve.clientY,
|
|
821
|
+
target: e,
|
|
822
|
+
rootEl: o
|
|
823
|
+
}), t && !this.options.dragoverBubble)
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
e = o;
|
|
827
|
+
} while (o = o.parentNode);
|
|
828
|
+
Mo();
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
_onTouchMove: function(e) {
|
|
832
|
+
if (Ae) {
|
|
833
|
+
var o = this.options, t = o.fallbackTolerance, n = o.fallbackOffset, l = e.touches ? e.touches[0] : e, i = A && Ye(A, !0), a = A && i && i.a, s = A && i && i.d, r = pt && ie && po(ie), d = (l.clientX - Ae.clientX + n.x) / (a || 1) + (r ? r[0] - Lt[0] : 0) / (a || 1), u = (l.clientY - Ae.clientY + n.y) / (s || 1) + (r ? r[1] - Lt[1] : 0) / (s || 1);
|
|
834
|
+
if (!F.active && !Me) {
|
|
835
|
+
if (t && Math.max(Math.abs(l.clientX - this._lastX), Math.abs(l.clientY - this._lastY)) < t)
|
|
836
|
+
return;
|
|
837
|
+
this._onDragStart(e, !0);
|
|
838
|
+
}
|
|
839
|
+
if (A) {
|
|
840
|
+
i ? (i.e += d - (Nt || 0), i.f += u - (Pt || 0)) : i = {
|
|
841
|
+
a: 1,
|
|
842
|
+
b: 0,
|
|
843
|
+
c: 0,
|
|
844
|
+
d: 1,
|
|
845
|
+
e: d,
|
|
846
|
+
f: u
|
|
847
|
+
};
|
|
848
|
+
var f = "matrix(".concat(i.a, ",").concat(i.b, ",").concat(i.c, ",").concat(i.d, ",").concat(i.e, ",").concat(i.f, ")");
|
|
849
|
+
I(A, "webkitTransform", f), I(A, "mozTransform", f), I(A, "msTransform", f), I(A, "transform", f), Nt = d, Pt = u, ve = l;
|
|
850
|
+
}
|
|
851
|
+
e.cancelable && e.preventDefault();
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
_appendGhost: function() {
|
|
855
|
+
if (!A) {
|
|
856
|
+
var e = this.options.fallbackOnBody ? document.body : q, o = oe(g, !0, pt, !0, e), t = this.options;
|
|
857
|
+
if (pt) {
|
|
858
|
+
for (ie = e; I(ie, "position") === "static" && I(ie, "transform") === "none" && ie !== document; )
|
|
859
|
+
ie = ie.parentNode;
|
|
860
|
+
ie !== document.body && ie !== document.documentElement ? (ie === document && (ie = Ce()), o.top += ie.scrollTop, o.left += ie.scrollLeft) : ie = Ce(), Lt = po(ie);
|
|
861
|
+
}
|
|
862
|
+
A = g.cloneNode(!0), de(A, t.ghostClass, !1), de(A, t.fallbackClass, !0), de(A, t.dragClass, !0), I(A, "transition", ""), I(A, "transform", ""), I(A, "box-sizing", "border-box"), I(A, "margin", 0), I(A, "top", o.top), I(A, "left", o.left), I(A, "width", o.width), I(A, "height", o.height), I(A, "opacity", "0.8"), I(A, "position", pt ? "absolute" : "fixed"), I(A, "zIndex", "100000"), I(A, "pointerEvents", "none"), F.ghost = A, e.appendChild(A), I(A, "transform-origin", fo / parseInt(A.style.width) * 100 + "% " + go / parseInt(A.style.height) * 100 + "%");
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
_onDragStart: function(e, o) {
|
|
866
|
+
var t = this, n = e.dataTransfer, l = t.options;
|
|
867
|
+
if (se("dragStart", this, {
|
|
868
|
+
evt: e
|
|
869
|
+
}), F.eventCanceled) {
|
|
870
|
+
this._onDrop();
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
se("setupClone", this), F.eventCanceled || (Z = Wo(g), Z.removeAttribute("id"), Z.draggable = !1, Z.style["will-change"] = "", this._hideClone(), de(Z, this.options.chosenClass, !1), F.clone = Z), t.cloneId = bt(function() {
|
|
874
|
+
se("clone", t), !F.eventCanceled && (t.options.removeCloneOnHide || q.insertBefore(Z, g), t._hideClone(), re({
|
|
875
|
+
sortable: t,
|
|
876
|
+
name: "clone"
|
|
877
|
+
}));
|
|
878
|
+
}), !o && de(g, l.dragClass, !0), o ? (Et = !0, t._loopId = setInterval(t._emulateDragOver, 50)) : (U(document, "mouseup", t._onDrop), U(document, "touchend", t._onDrop), U(document, "touchcancel", t._onDrop), n && (n.effectAllowed = "move", l.setData && l.setData.call(t, n, g)), z(document, "drop", t), I(g, "transform", "translateZ(0)")), Me = !0, t._dragStartId = bt(t._dragStarted.bind(t, o, e)), z(document, "selectstart", t), qe = !0, Qe && I(document.body, "user-select", "none");
|
|
879
|
+
},
|
|
880
|
+
// Returns true - if no further action is needed (either inserted or another condition)
|
|
881
|
+
_onDragOver: function(e) {
|
|
882
|
+
var o = this.el, t = e.target, n, l, i, a = this.options, s = a.group, r = F.active, d = ct === s, u = a.sort, f = ne || r, c, m = this, E = !1;
|
|
883
|
+
if (Xt)
|
|
884
|
+
return;
|
|
885
|
+
function T(le, _e) {
|
|
886
|
+
se(le, m, Ee({
|
|
887
|
+
evt: e,
|
|
888
|
+
isOwner: d,
|
|
889
|
+
axis: c ? "vertical" : "horizontal",
|
|
890
|
+
revert: i,
|
|
891
|
+
dragRect: n,
|
|
892
|
+
targetRect: l,
|
|
893
|
+
canSort: u,
|
|
894
|
+
fromSortable: f,
|
|
895
|
+
target: t,
|
|
896
|
+
completed: M,
|
|
897
|
+
onMove: function(Re, Dt) {
|
|
898
|
+
return ft(q, o, g, n, Re, oe(Re), e, Dt);
|
|
899
|
+
},
|
|
900
|
+
changed: K
|
|
901
|
+
}, _e));
|
|
902
|
+
}
|
|
903
|
+
function D() {
|
|
904
|
+
T("dragOverAnimationCapture"), m.captureAnimationState(), m !== f && f.captureAnimationState();
|
|
905
|
+
}
|
|
906
|
+
function M(le) {
|
|
907
|
+
return T("dragOverCompleted", {
|
|
908
|
+
insertion: le
|
|
909
|
+
}), le && (d ? r._hideClone() : r._showClone(m), m !== f && (de(g, ne ? ne.options.ghostClass : r.options.ghostClass, !1), de(g, a.ghostClass, !0)), ne !== m && m !== F.active ? ne = m : m === F.active && ne && (ne = null), f === m && (m._ignoreWhileAnimating = t), m.animateAll(function() {
|
|
910
|
+
T("dragOverAnimationComplete"), m._ignoreWhileAnimating = null;
|
|
911
|
+
}), m !== f && (f.animateAll(), f._ignoreWhileAnimating = null)), (t === g && !g.animated || t === o && !t.animated) && (Be = null), !a.dragoverBubble && !e.rootEl && t !== document && (g.parentNode[ce]._isOutsideThisEl(e.target), !le && We(e)), !a.dragoverBubble && e.stopPropagation && e.stopPropagation(), E = !0;
|
|
912
|
+
}
|
|
913
|
+
function K() {
|
|
914
|
+
ue = fe(g), Ie = fe(g, a.draggable), re({
|
|
915
|
+
sortable: m,
|
|
916
|
+
name: "change",
|
|
917
|
+
toEl: o,
|
|
918
|
+
newIndex: ue,
|
|
919
|
+
newDraggableIndex: Ie,
|
|
920
|
+
originalEvent: e
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), t = he(t, a.draggable, o, !0), T("dragOver"), F.eventCanceled)
|
|
924
|
+
return E;
|
|
925
|
+
if (g.contains(e.target) || t.animated && t.animatingX && t.animatingY || m._ignoreWhileAnimating === t)
|
|
926
|
+
return M(!1);
|
|
927
|
+
if (Et = !1, r && !a.disabled && (d ? u || (i = Q !== q) : ne === this || (this.lastPutMode = ct.checkPull(this, r, g, e)) && s.checkPut(this, r, g, e))) {
|
|
928
|
+
if (c = this._getDirection(e, t) === "vertical", n = oe(g), T("dragOverValid"), F.eventCanceled)
|
|
929
|
+
return E;
|
|
930
|
+
if (i)
|
|
931
|
+
return Q = q, D(), this._hideClone(), T("revert"), F.eventCanceled || (Ne ? q.insertBefore(g, Ne) : q.appendChild(g)), M(!0);
|
|
932
|
+
var $ = Kt(o, a.draggable);
|
|
933
|
+
if (!$ || el(e, c, this) && !$.animated) {
|
|
934
|
+
if ($ === g)
|
|
935
|
+
return M(!1);
|
|
936
|
+
if ($ && o === e.target && (t = $), t && (l = oe(t)), ft(q, o, g, n, t, l, e, !!t) !== !1)
|
|
937
|
+
return D(), $ && $.nextSibling ? o.insertBefore(g, $.nextSibling) : o.appendChild(g), Q = o, K(), M(!0);
|
|
938
|
+
} else if ($ && Qn(e, c, this)) {
|
|
939
|
+
var N = He(o, 0, a, !0);
|
|
940
|
+
if (N === g)
|
|
941
|
+
return M(!1);
|
|
942
|
+
if (t = N, l = oe(t), ft(q, o, g, n, t, l, e, !1) !== !1)
|
|
943
|
+
return D(), o.insertBefore(g, N), Q = o, K(), M(!0);
|
|
944
|
+
} else if (t.parentNode === o) {
|
|
945
|
+
l = oe(t);
|
|
946
|
+
var Y = 0, B, h = g.parentNode !== o, v = !jn(g.animated && g.toRect || n, t.animated && t.toRect || l, c), _ = c ? "top" : "left", p = mo(t, "top", "top") || mo(g, "top", "top"), k = p ? p.scrollTop : void 0;
|
|
947
|
+
Be !== t && (B = l[_], nt = !1, mt = !v && a.invertSwap || h), Y = tl(e, t, l, c, v ? 1 : a.swapThreshold, a.invertedSwapThreshold == null ? a.swapThreshold : a.invertedSwapThreshold, mt, Be === t);
|
|
948
|
+
var C;
|
|
949
|
+
if (Y !== 0) {
|
|
950
|
+
var w = fe(g);
|
|
951
|
+
do
|
|
952
|
+
w -= Y, C = Q.children[w];
|
|
953
|
+
while (C && (I(C, "display") === "none" || C === A));
|
|
954
|
+
}
|
|
955
|
+
if (Y === 0 || C === t)
|
|
956
|
+
return M(!1);
|
|
957
|
+
Be = t, ot = Y;
|
|
958
|
+
var b = t.nextElementSibling, P = !1;
|
|
959
|
+
P = Y === 1;
|
|
960
|
+
var G = ft(q, o, g, n, t, l, e, P);
|
|
961
|
+
if (G !== !1)
|
|
962
|
+
return (G === 1 || G === -1) && (P = G === 1), Xt = !0, setTimeout(Zn, 30), D(), P && !b ? o.appendChild(g) : t.parentNode.insertBefore(g, P ? b : t), p && Ao(p, 0, k - p.scrollTop), Q = g.parentNode, B !== void 0 && !mt && (ht = Math.abs(B - oe(t)[_])), K(), M(!0);
|
|
963
|
+
}
|
|
964
|
+
if (o.contains(g))
|
|
965
|
+
return M(!1);
|
|
966
|
+
}
|
|
967
|
+
return !1;
|
|
968
|
+
},
|
|
969
|
+
_ignoreWhileAnimating: null,
|
|
970
|
+
_offMoveEvents: function() {
|
|
971
|
+
U(document, "mousemove", this._onTouchMove), U(document, "touchmove", this._onTouchMove), U(document, "pointermove", this._onTouchMove), U(document, "dragover", We), U(document, "mousemove", We), U(document, "touchmove", We);
|
|
972
|
+
},
|
|
973
|
+
_offUpEvents: function() {
|
|
974
|
+
var e = this.el.ownerDocument;
|
|
975
|
+
U(e, "mouseup", this._onDrop), U(e, "touchend", this._onDrop), U(e, "pointerup", this._onDrop), U(e, "touchcancel", this._onDrop), U(document, "selectstart", this);
|
|
976
|
+
},
|
|
977
|
+
_onDrop: function(e) {
|
|
978
|
+
var o = this.el, t = this.options;
|
|
979
|
+
if (ue = fe(g), Ie = fe(g, t.draggable), se("drop", this, {
|
|
980
|
+
evt: e
|
|
981
|
+
}), Q = g && g.parentNode, ue = fe(g), Ie = fe(g, t.draggable), F.eventCanceled) {
|
|
982
|
+
this._nulling();
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
Me = !1, mt = !1, nt = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), zt(this.cloneId), zt(this._dragStartId), this.nativeDraggable && (U(document, "drop", this), U(o, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Qe && I(document.body, "user-select", ""), I(g, "transform", ""), e && (qe && (e.cancelable && e.preventDefault(), !t.dropBubble && e.stopPropagation()), A && A.parentNode && A.parentNode.removeChild(A), (q === Q || ne && ne.lastPutMode !== "clone") && Z && Z.parentNode && Z.parentNode.removeChild(Z), g && (this.nativeDraggable && U(g, "dragend", this), $t(g), g.style["will-change"] = "", qe && !Me && de(g, ne ? ne.options.ghostClass : this.options.ghostClass, !1), de(g, this.options.chosenClass, !1), re({
|
|
986
|
+
sortable: this,
|
|
987
|
+
name: "unchoose",
|
|
988
|
+
toEl: Q,
|
|
989
|
+
newIndex: null,
|
|
990
|
+
newDraggableIndex: null,
|
|
991
|
+
originalEvent: e
|
|
992
|
+
}), q !== Q ? (ue >= 0 && (re({
|
|
993
|
+
rootEl: Q,
|
|
994
|
+
name: "add",
|
|
995
|
+
toEl: Q,
|
|
996
|
+
fromEl: q,
|
|
997
|
+
originalEvent: e
|
|
998
|
+
}), re({
|
|
999
|
+
sortable: this,
|
|
1000
|
+
name: "remove",
|
|
1001
|
+
toEl: Q,
|
|
1002
|
+
originalEvent: e
|
|
1003
|
+
}), re({
|
|
1004
|
+
rootEl: Q,
|
|
1005
|
+
name: "sort",
|
|
1006
|
+
toEl: Q,
|
|
1007
|
+
fromEl: q,
|
|
1008
|
+
originalEvent: e
|
|
1009
|
+
}), re({
|
|
1010
|
+
sortable: this,
|
|
1011
|
+
name: "sort",
|
|
1012
|
+
toEl: Q,
|
|
1013
|
+
originalEvent: e
|
|
1014
|
+
})), ne && ne.save()) : ue !== ze && ue >= 0 && (re({
|
|
1015
|
+
sortable: this,
|
|
1016
|
+
name: "update",
|
|
1017
|
+
toEl: Q,
|
|
1018
|
+
originalEvent: e
|
|
1019
|
+
}), re({
|
|
1020
|
+
sortable: this,
|
|
1021
|
+
name: "sort",
|
|
1022
|
+
toEl: Q,
|
|
1023
|
+
originalEvent: e
|
|
1024
|
+
})), F.active && ((ue == null || ue === -1) && (ue = ze, Ie = tt), re({
|
|
1025
|
+
sortable: this,
|
|
1026
|
+
name: "end",
|
|
1027
|
+
toEl: Q,
|
|
1028
|
+
originalEvent: e
|
|
1029
|
+
}), this.save()))), this._nulling();
|
|
1030
|
+
},
|
|
1031
|
+
_nulling: function() {
|
|
1032
|
+
se("nulling", this), q = g = Q = A = Ne = Z = vt = Fe = Ae = ve = qe = ue = Ie = ze = tt = Be = ot = ne = ct = F.dragged = F.ghost = F.clone = F.active = null, wt.forEach(function(e) {
|
|
1033
|
+
e.checked = !0;
|
|
1034
|
+
}), wt.length = Nt = Pt = 0;
|
|
1035
|
+
},
|
|
1036
|
+
handleEvent: function(e) {
|
|
1037
|
+
switch (e.type) {
|
|
1038
|
+
case "drop":
|
|
1039
|
+
case "dragend":
|
|
1040
|
+
this._onDrop(e);
|
|
1041
|
+
break;
|
|
1042
|
+
case "dragenter":
|
|
1043
|
+
case "dragover":
|
|
1044
|
+
g && (this._onDragOver(e), Jn(e));
|
|
1045
|
+
break;
|
|
1046
|
+
case "selectstart":
|
|
1047
|
+
e.preventDefault();
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
/**
|
|
1052
|
+
* Serializes the item into an array of string.
|
|
1053
|
+
* @returns {String[]}
|
|
1054
|
+
*/
|
|
1055
|
+
toArray: function() {
|
|
1056
|
+
for (var e = [], o, t = this.el.children, n = 0, l = t.length, i = this.options; n < l; n++)
|
|
1057
|
+
o = t[n], he(o, i.draggable, this.el, !1) && e.push(o.getAttribute(i.dataIdAttr) || nl(o));
|
|
1058
|
+
return e;
|
|
1059
|
+
},
|
|
1060
|
+
/**
|
|
1061
|
+
* Sorts the elements according to the array.
|
|
1062
|
+
* @param {String[]} order order of the items
|
|
1063
|
+
*/
|
|
1064
|
+
sort: function(e, o) {
|
|
1065
|
+
var t = {}, n = this.el;
|
|
1066
|
+
this.toArray().forEach(function(l, i) {
|
|
1067
|
+
var a = n.children[i];
|
|
1068
|
+
he(a, this.options.draggable, n, !1) && (t[l] = a);
|
|
1069
|
+
}, this), o && this.captureAnimationState(), e.forEach(function(l) {
|
|
1070
|
+
t[l] && (n.removeChild(t[l]), n.appendChild(t[l]));
|
|
1071
|
+
}), o && this.animateAll();
|
|
1072
|
+
},
|
|
1073
|
+
/**
|
|
1074
|
+
* Save the current sorting
|
|
1075
|
+
*/
|
|
1076
|
+
save: function() {
|
|
1077
|
+
var e = this.options.store;
|
|
1078
|
+
e && e.set && e.set(this);
|
|
1079
|
+
},
|
|
1080
|
+
/**
|
|
1081
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
1082
|
+
* @param {HTMLElement} el
|
|
1083
|
+
* @param {String} [selector] default: `options.draggable`
|
|
1084
|
+
* @returns {HTMLElement|null}
|
|
1085
|
+
*/
|
|
1086
|
+
closest: function(e, o) {
|
|
1087
|
+
return he(e, o || this.options.draggable, this.el, !1);
|
|
1088
|
+
},
|
|
1089
|
+
/**
|
|
1090
|
+
* Set/get option
|
|
1091
|
+
* @param {string} name
|
|
1092
|
+
* @param {*} [value]
|
|
1093
|
+
* @returns {*}
|
|
1094
|
+
*/
|
|
1095
|
+
option: function(e, o) {
|
|
1096
|
+
var t = this.options;
|
|
1097
|
+
if (o === void 0)
|
|
1098
|
+
return t[e];
|
|
1099
|
+
var n = dt.modifyOption(this, e, o);
|
|
1100
|
+
typeof n < "u" ? t[e] = n : t[e] = o, e === "group" && $o(t);
|
|
1101
|
+
},
|
|
1102
|
+
/**
|
|
1103
|
+
* Destroy
|
|
1104
|
+
*/
|
|
1105
|
+
destroy: function() {
|
|
1106
|
+
se("destroy", this);
|
|
1107
|
+
var e = this.el;
|
|
1108
|
+
e[ce] = null, U(e, "mousedown", this._onTapStart), U(e, "touchstart", this._onTapStart), U(e, "pointerdown", this._onTapStart), this.nativeDraggable && (U(e, "dragover", this), U(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(o) {
|
|
1109
|
+
o.removeAttribute("draggable");
|
|
1110
|
+
}), this._onDrop(), this._disableDelayedDragEvents(), Tt.splice(Tt.indexOf(this.el), 1), this.el = e = null;
|
|
1111
|
+
},
|
|
1112
|
+
_hideClone: function() {
|
|
1113
|
+
if (!Fe) {
|
|
1114
|
+
if (se("hideClone", this), F.eventCanceled)
|
|
1115
|
+
return;
|
|
1116
|
+
I(Z, "display", "none"), this.options.removeCloneOnHide && Z.parentNode && Z.parentNode.removeChild(Z), Fe = !0;
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
_showClone: function(e) {
|
|
1120
|
+
if (e.lastPutMode !== "clone") {
|
|
1121
|
+
this._hideClone();
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
if (Fe) {
|
|
1125
|
+
if (se("showClone", this), F.eventCanceled)
|
|
1126
|
+
return;
|
|
1127
|
+
g.parentNode == q && !this.options.group.revertClone ? q.insertBefore(Z, g) : Ne ? q.insertBefore(Z, Ne) : q.appendChild(Z), this.options.group.revertClone && this.animate(g, Z), I(Z, "display", ""), Fe = !1;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
function Jn(e) {
|
|
1132
|
+
e.dataTransfer && (e.dataTransfer.dropEffect = "move"), e.cancelable && e.preventDefault();
|
|
1133
|
+
}
|
|
1134
|
+
function ft(e, o, t, n, l, i, a, s) {
|
|
1135
|
+
var r, d = e[ce], u = d.options.onMove, f;
|
|
1136
|
+
return window.CustomEvent && !xe && !st ? r = new CustomEvent("move", {
|
|
1137
|
+
bubbles: !0,
|
|
1138
|
+
cancelable: !0
|
|
1139
|
+
}) : (r = document.createEvent("Event"), r.initEvent("move", !0, !0)), r.to = o, r.from = e, r.dragged = t, r.draggedRect = n, r.related = l || o, r.relatedRect = i || oe(o), r.willInsertAfter = s, r.originalEvent = a, e.dispatchEvent(r), u && (f = u.call(d, r, a)), f;
|
|
1140
|
+
}
|
|
1141
|
+
function $t(e) {
|
|
1142
|
+
e.draggable = !1;
|
|
1143
|
+
}
|
|
1144
|
+
function Zn() {
|
|
1145
|
+
Xt = !1;
|
|
1146
|
+
}
|
|
1147
|
+
function Qn(e, o, t) {
|
|
1148
|
+
var n = oe(He(t.el, 0, t.options, !0)), l = No(t.el, t.options, A), i = 10;
|
|
1149
|
+
return o ? e.clientX < l.left - i || e.clientY < n.top && e.clientX < n.right : e.clientY < l.top - i || e.clientY < n.bottom && e.clientX < n.left;
|
|
1150
|
+
}
|
|
1151
|
+
function el(e, o, t) {
|
|
1152
|
+
var n = oe(Kt(t.el, t.options.draggable)), l = No(t.el, t.options, A), i = 10;
|
|
1153
|
+
return o ? e.clientX > l.right + i || e.clientY > n.bottom && e.clientX > n.left : e.clientY > l.bottom + i || e.clientX > n.right && e.clientY > n.top;
|
|
1154
|
+
}
|
|
1155
|
+
function tl(e, o, t, n, l, i, a, s) {
|
|
1156
|
+
var r = n ? e.clientY : e.clientX, d = n ? t.height : t.width, u = n ? t.top : t.left, f = n ? t.bottom : t.right, c = !1;
|
|
1157
|
+
if (!a) {
|
|
1158
|
+
if (s && ht < d * l) {
|
|
1159
|
+
if (!nt && (ot === 1 ? r > u + d * i / 2 : r < f - d * i / 2) && (nt = !0), nt)
|
|
1160
|
+
c = !0;
|
|
1161
|
+
else if (ot === 1 ? r < u + ht : r > f - ht)
|
|
1162
|
+
return -ot;
|
|
1163
|
+
} else if (r > u + d * (1 - l) / 2 && r < f - d * (1 - l) / 2)
|
|
1164
|
+
return ol(o);
|
|
1165
|
+
}
|
|
1166
|
+
return c = c || a, c && (r < u + d * i / 2 || r > f - d * i / 2) ? r > u + d / 2 ? 1 : -1 : 0;
|
|
1167
|
+
}
|
|
1168
|
+
function ol(e) {
|
|
1169
|
+
return fe(g) < fe(e) ? 1 : -1;
|
|
1170
|
+
}
|
|
1171
|
+
function nl(e) {
|
|
1172
|
+
for (var o = e.tagName + e.className + e.src + e.href + e.textContent, t = o.length, n = 0; t--; )
|
|
1173
|
+
n += o.charCodeAt(t);
|
|
1174
|
+
return n.toString(36);
|
|
1175
|
+
}
|
|
1176
|
+
function ll(e) {
|
|
1177
|
+
wt.length = 0;
|
|
1178
|
+
for (var o = e.getElementsByTagName("input"), t = o.length; t--; ) {
|
|
1179
|
+
var n = o[t];
|
|
1180
|
+
n.checked && wt.push(n);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function bt(e) {
|
|
1184
|
+
return setTimeout(e, 0);
|
|
1185
|
+
}
|
|
1186
|
+
function zt(e) {
|
|
1187
|
+
return clearTimeout(e);
|
|
1188
|
+
}
|
|
1189
|
+
kt && z(document, "touchmove", function(e) {
|
|
1190
|
+
(F.active || Me) && e.cancelable && e.preventDefault();
|
|
1191
|
+
});
|
|
1192
|
+
F.utils = {
|
|
1193
|
+
on: z,
|
|
1194
|
+
off: U,
|
|
1195
|
+
css: I,
|
|
1196
|
+
find: Oo,
|
|
1197
|
+
is: function(e, o) {
|
|
1198
|
+
return !!he(e, o, e, !1);
|
|
1199
|
+
},
|
|
1200
|
+
extend: Bn,
|
|
1201
|
+
throttle: Ro,
|
|
1202
|
+
closest: he,
|
|
1203
|
+
toggleClass: de,
|
|
1204
|
+
clone: Wo,
|
|
1205
|
+
index: fe,
|
|
1206
|
+
nextTick: bt,
|
|
1207
|
+
cancelNextTick: zt,
|
|
1208
|
+
detectDirection: Lo,
|
|
1209
|
+
getChild: He
|
|
1210
|
+
};
|
|
1211
|
+
F.get = function(e) {
|
|
1212
|
+
return e[ce];
|
|
1213
|
+
};
|
|
1214
|
+
F.mount = function() {
|
|
1215
|
+
for (var e = arguments.length, o = new Array(e), t = 0; t < e; t++)
|
|
1216
|
+
o[t] = arguments[t];
|
|
1217
|
+
o[0].constructor === Array && (o = o[0]), o.forEach(function(n) {
|
|
1218
|
+
if (!n.prototype || !n.prototype.constructor)
|
|
1219
|
+
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));
|
|
1220
|
+
n.utils && (F.utils = Ee(Ee({}, F.utils), n.utils)), dt.mount(n);
|
|
1221
|
+
});
|
|
1222
|
+
};
|
|
1223
|
+
F.create = function(e, o) {
|
|
1224
|
+
return new F(e, o);
|
|
1225
|
+
};
|
|
1226
|
+
F.version = Pn;
|
|
1227
|
+
var te = [], Je, Yt, Gt = !1, Bt, Mt, St, Ze;
|
|
1228
|
+
function il() {
|
|
1229
|
+
function e() {
|
|
1230
|
+
this.defaults = {
|
|
1231
|
+
scroll: !0,
|
|
1232
|
+
forceAutoScrollFallback: !1,
|
|
1233
|
+
scrollSensitivity: 30,
|
|
1234
|
+
scrollSpeed: 10,
|
|
1235
|
+
bubbleScroll: !0
|
|
1236
|
+
};
|
|
1237
|
+
for (var o in this)
|
|
1238
|
+
o.charAt(0) === "_" && typeof this[o] == "function" && (this[o] = this[o].bind(this));
|
|
1239
|
+
}
|
|
1240
|
+
return e.prototype = {
|
|
1241
|
+
dragStarted: function(o) {
|
|
1242
|
+
var t = o.originalEvent;
|
|
1243
|
+
this.sortable.nativeDraggable ? z(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? z(document, "pointermove", this._handleFallbackAutoScroll) : t.touches ? z(document, "touchmove", this._handleFallbackAutoScroll) : z(document, "mousemove", this._handleFallbackAutoScroll);
|
|
1244
|
+
},
|
|
1245
|
+
dragOverCompleted: function(o) {
|
|
1246
|
+
var t = o.originalEvent;
|
|
1247
|
+
!this.options.dragOverBubble && !t.rootEl && this._handleAutoScroll(t);
|
|
1248
|
+
},
|
|
1249
|
+
drop: function() {
|
|
1250
|
+
this.sortable.nativeDraggable ? U(document, "dragover", this._handleAutoScroll) : (U(document, "pointermove", this._handleFallbackAutoScroll), U(document, "touchmove", this._handleFallbackAutoScroll), U(document, "mousemove", this._handleFallbackAutoScroll)), ho(), yt(), Mn();
|
|
1251
|
+
},
|
|
1252
|
+
nulling: function() {
|
|
1253
|
+
St = Yt = Je = Gt = Ze = Bt = Mt = null, te.length = 0;
|
|
1254
|
+
},
|
|
1255
|
+
_handleFallbackAutoScroll: function(o) {
|
|
1256
|
+
this._handleAutoScroll(o, !0);
|
|
1257
|
+
},
|
|
1258
|
+
_handleAutoScroll: function(o, t) {
|
|
1259
|
+
var n = this, l = (o.touches ? o.touches[0] : o).clientX, i = (o.touches ? o.touches[0] : o).clientY, a = document.elementFromPoint(l, i);
|
|
1260
|
+
if (St = o, t || this.options.forceAutoScrollFallback || st || xe || Qe) {
|
|
1261
|
+
Ut(o, this.options, a, t);
|
|
1262
|
+
var s = Oe(a, !0);
|
|
1263
|
+
Gt && (!Ze || l !== Bt || i !== Mt) && (Ze && ho(), Ze = setInterval(function() {
|
|
1264
|
+
var r = Oe(document.elementFromPoint(l, i), !0);
|
|
1265
|
+
r !== s && (s = r, yt()), Ut(o, n.options, r, t);
|
|
1266
|
+
}, 10), Bt = l, Mt = i);
|
|
1267
|
+
} else {
|
|
1268
|
+
if (!this.options.bubbleScroll || Oe(a, !0) === Ce()) {
|
|
1269
|
+
yt();
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
Ut(o, this.options, Oe(a, !1), !1);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}, ke(e, {
|
|
1276
|
+
pluginName: "scroll",
|
|
1277
|
+
initializeByDefault: !0
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
function yt() {
|
|
1281
|
+
te.forEach(function(e) {
|
|
1282
|
+
clearInterval(e.pid);
|
|
1283
|
+
}), te = [];
|
|
1284
|
+
}
|
|
1285
|
+
function ho() {
|
|
1286
|
+
clearInterval(Ze);
|
|
1287
|
+
}
|
|
1288
|
+
var Ut = Ro(function(e, o, t, n) {
|
|
1289
|
+
if (o.scroll) {
|
|
1290
|
+
var l = (e.touches ? e.touches[0] : e).clientX, i = (e.touches ? e.touches[0] : e).clientY, a = o.scrollSensitivity, s = o.scrollSpeed, r = Ce(), d = !1, u;
|
|
1291
|
+
Yt !== t && (Yt = t, yt(), Je = o.scroll, u = o.scrollFn, Je === !0 && (Je = Oe(t, !0)));
|
|
1292
|
+
var f = 0, c = Je;
|
|
1293
|
+
do {
|
|
1294
|
+
var m = c, E = oe(m), T = E.top, D = E.bottom, M = E.left, K = E.right, $ = E.width, N = E.height, Y = void 0, B = void 0, h = m.scrollWidth, v = m.scrollHeight, _ = I(m), p = m.scrollLeft, k = m.scrollTop;
|
|
1295
|
+
m === r ? (Y = $ < h && (_.overflowX === "auto" || _.overflowX === "scroll" || _.overflowX === "visible"), B = N < v && (_.overflowY === "auto" || _.overflowY === "scroll" || _.overflowY === "visible")) : (Y = $ < h && (_.overflowX === "auto" || _.overflowX === "scroll"), B = N < v && (_.overflowY === "auto" || _.overflowY === "scroll"));
|
|
1296
|
+
var C = Y && (Math.abs(K - l) <= a && p + $ < h) - (Math.abs(M - l) <= a && !!p), w = B && (Math.abs(D - i) <= a && k + N < v) - (Math.abs(T - i) <= a && !!k);
|
|
1297
|
+
if (!te[f])
|
|
1298
|
+
for (var b = 0; b <= f; b++)
|
|
1299
|
+
te[b] || (te[b] = {});
|
|
1300
|
+
(te[f].vx != C || te[f].vy != w || te[f].el !== m) && (te[f].el = m, te[f].vx = C, te[f].vy = w, clearInterval(te[f].pid), (C != 0 || w != 0) && (d = !0, te[f].pid = setInterval((function() {
|
|
1301
|
+
n && this.layer === 0 && F.active._onTouchMove(St);
|
|
1302
|
+
var P = te[this.layer].vy ? te[this.layer].vy * s : 0, G = te[this.layer].vx ? te[this.layer].vx * s : 0;
|
|
1303
|
+
typeof u == "function" && u.call(F.dragged.parentNode[ce], G, P, e, St, te[this.layer].el) !== "continue" || Ao(te[this.layer].el, G, P);
|
|
1304
|
+
}).bind({
|
|
1305
|
+
layer: f
|
|
1306
|
+
}), 24))), f++;
|
|
1307
|
+
} while (o.bubbleScroll && c !== r && (c = Oe(c, !1)));
|
|
1308
|
+
Gt = d;
|
|
1309
|
+
}
|
|
1310
|
+
}, 30), Uo = function(e) {
|
|
1311
|
+
var o = e.originalEvent, t = e.putSortable, n = e.dragEl, l = e.activeSortable, i = e.dispatchSortableEvent, a = e.hideGhostForTarget, s = e.unhideGhostForTarget;
|
|
1312
|
+
if (o) {
|
|
1313
|
+
var r = t || l;
|
|
1314
|
+
a();
|
|
1315
|
+
var d = o.changedTouches && o.changedTouches.length ? o.changedTouches[0] : o, u = document.elementFromPoint(d.clientX, d.clientY);
|
|
1316
|
+
s(), r && !r.el.contains(u) && (i("spill"), this.onSpill({
|
|
1317
|
+
dragEl: n,
|
|
1318
|
+
putSortable: t
|
|
1319
|
+
}));
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
function qt() {
|
|
1323
|
+
}
|
|
1324
|
+
qt.prototype = {
|
|
1325
|
+
startIndex: null,
|
|
1326
|
+
dragStart: function(e) {
|
|
1327
|
+
var o = e.oldDraggableIndex;
|
|
1328
|
+
this.startIndex = o;
|
|
1329
|
+
},
|
|
1330
|
+
onSpill: function(e) {
|
|
1331
|
+
var o = e.dragEl, t = e.putSortable;
|
|
1332
|
+
this.sortable.captureAnimationState(), t && t.captureAnimationState();
|
|
1333
|
+
var n = He(this.sortable.el, this.startIndex, this.options);
|
|
1334
|
+
n ? this.sortable.el.insertBefore(o, n) : this.sortable.el.appendChild(o), this.sortable.animateAll(), t && t.animateAll();
|
|
1335
|
+
},
|
|
1336
|
+
drop: Uo
|
|
1337
|
+
};
|
|
1338
|
+
ke(qt, {
|
|
1339
|
+
pluginName: "revertOnSpill"
|
|
1340
|
+
});
|
|
1341
|
+
function Jt() {
|
|
1342
|
+
}
|
|
1343
|
+
Jt.prototype = {
|
|
1344
|
+
onSpill: function(e) {
|
|
1345
|
+
var o = e.dragEl, t = e.putSortable, n = t || this.sortable;
|
|
1346
|
+
n.captureAnimationState(), o.parentNode && o.parentNode.removeChild(o), n.animateAll();
|
|
1347
|
+
},
|
|
1348
|
+
drop: Uo
|
|
1349
|
+
};
|
|
1350
|
+
ke(Jt, {
|
|
1351
|
+
pluginName: "removeOnSpill"
|
|
1352
|
+
});
|
|
1353
|
+
F.mount(new il());
|
|
1354
|
+
F.mount(Jt, qt);
|
|
1355
|
+
function al(e) {
|
|
1356
|
+
return e == null ? e : JSON.parse(JSON.stringify(e));
|
|
1357
|
+
}
|
|
1358
|
+
function rl(e) {
|
|
1359
|
+
jt() && Jo(e);
|
|
1360
|
+
}
|
|
1361
|
+
function sl(e) {
|
|
1362
|
+
jt() ? _o(e) : Co(e);
|
|
1363
|
+
}
|
|
1364
|
+
let Xo = null, zo = null;
|
|
1365
|
+
function bo(e = null, o = null) {
|
|
1366
|
+
Xo = e, zo = o;
|
|
1367
|
+
}
|
|
1368
|
+
function dl() {
|
|
1369
|
+
return {
|
|
1370
|
+
data: Xo,
|
|
1371
|
+
clonedData: zo
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
const yo = Symbol("cloneElement");
|
|
1375
|
+
function ul(...e) {
|
|
1376
|
+
var o, t;
|
|
1377
|
+
const n = (o = jt()) == null ? void 0 : o.proxy;
|
|
1378
|
+
let l = null;
|
|
1379
|
+
const i = e[0];
|
|
1380
|
+
let [, a, s] = e;
|
|
1381
|
+
Array.isArray(y(a)) || (s = a, a = null);
|
|
1382
|
+
let r = null;
|
|
1383
|
+
const {
|
|
1384
|
+
immediate: d = !0,
|
|
1385
|
+
clone: u = al,
|
|
1386
|
+
customUpdate: f
|
|
1387
|
+
} = (t = y(s)) != null ? t : {};
|
|
1388
|
+
function c(v) {
|
|
1389
|
+
var _;
|
|
1390
|
+
const { from: p, oldIndex: k, item: C } = v;
|
|
1391
|
+
l = Array.from(p.childNodes);
|
|
1392
|
+
const w = y((_ = y(a)) == null ? void 0 : _[k]), b = u(w);
|
|
1393
|
+
bo(w, b), C[yo] = b;
|
|
1394
|
+
}
|
|
1395
|
+
function m(v) {
|
|
1396
|
+
const _ = v.item[yo];
|
|
1397
|
+
if (!Vn(_)) {
|
|
1398
|
+
if (Rt(v.item), Ot(a)) {
|
|
1399
|
+
const p = [...y(a)];
|
|
1400
|
+
a.value = io(p, v.newDraggableIndex, _);
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
io(y(a), v.newDraggableIndex, _);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
function E(v) {
|
|
1407
|
+
const { from: _, item: p, oldIndex: k, oldDraggableIndex: C, pullMode: w, clone: b } = v;
|
|
1408
|
+
if (ao(_, p, k), w === "clone") {
|
|
1409
|
+
Rt(b);
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1412
|
+
if (Ot(a)) {
|
|
1413
|
+
const P = [...y(a)];
|
|
1414
|
+
a.value = lo(P, C);
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
lo(y(a), C);
|
|
1418
|
+
}
|
|
1419
|
+
function T(v) {
|
|
1420
|
+
if (f) {
|
|
1421
|
+
f(v);
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
const { from: _, item: p, oldIndex: k, oldDraggableIndex: C, newDraggableIndex: w } = v;
|
|
1425
|
+
if (Rt(p), ao(_, p, k), Ot(a)) {
|
|
1426
|
+
const b = [...y(a)];
|
|
1427
|
+
a.value = no(
|
|
1428
|
+
b,
|
|
1429
|
+
C,
|
|
1430
|
+
w
|
|
1431
|
+
);
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
no(y(a), C, w);
|
|
1435
|
+
}
|
|
1436
|
+
function D(v) {
|
|
1437
|
+
const { newIndex: _, oldIndex: p, from: k, to: C } = v;
|
|
1438
|
+
let w = null;
|
|
1439
|
+
const b = _ === p && k === C;
|
|
1440
|
+
try {
|
|
1441
|
+
if (b) {
|
|
1442
|
+
let P = null;
|
|
1443
|
+
l == null || l.some((G, le) => {
|
|
1444
|
+
if (P && (l == null ? void 0 : l.length) !== C.childNodes.length)
|
|
1445
|
+
return k.insertBefore(P, G.nextSibling), !0;
|
|
1446
|
+
const _e = C.childNodes[le];
|
|
1447
|
+
P = C == null ? void 0 : C.replaceChild(G, _e);
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
} catch (P) {
|
|
1451
|
+
w = P;
|
|
1452
|
+
} finally {
|
|
1453
|
+
l = null;
|
|
1454
|
+
}
|
|
1455
|
+
Co(() => {
|
|
1456
|
+
if (bo(), w)
|
|
1457
|
+
throw w;
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
const M = {
|
|
1461
|
+
onUpdate: T,
|
|
1462
|
+
onStart: c,
|
|
1463
|
+
onAdd: m,
|
|
1464
|
+
onRemove: E,
|
|
1465
|
+
onEnd: D
|
|
1466
|
+
};
|
|
1467
|
+
function K(v) {
|
|
1468
|
+
const _ = y(i);
|
|
1469
|
+
return v || (v = kn(_) ? xn(_, n == null ? void 0 : n.$el) : _), v && !Fn(v) && (v = v.$el), v || Tn("Root element not found"), v;
|
|
1470
|
+
}
|
|
1471
|
+
function $() {
|
|
1472
|
+
var v;
|
|
1473
|
+
const _ = (v = y(s)) != null ? v : {}, p = ko(_, ["immediate", "clone"]);
|
|
1474
|
+
return ro(p, (k, C) => {
|
|
1475
|
+
On(k) && (p[k] = (w, ...b) => {
|
|
1476
|
+
const P = dl();
|
|
1477
|
+
return Rn(w, P), C(w, ...b);
|
|
1478
|
+
});
|
|
1479
|
+
}), In(
|
|
1480
|
+
a === null ? {} : M,
|
|
1481
|
+
p
|
|
1482
|
+
);
|
|
1483
|
+
}
|
|
1484
|
+
const N = (v) => {
|
|
1485
|
+
v = K(v), r && Y.destroy(), r = new F(v, $());
|
|
1486
|
+
};
|
|
1487
|
+
Ge(
|
|
1488
|
+
() => s,
|
|
1489
|
+
() => {
|
|
1490
|
+
r && ro($(), (v, _) => {
|
|
1491
|
+
r == null || r.option(v, _);
|
|
1492
|
+
});
|
|
1493
|
+
},
|
|
1494
|
+
{ deep: !0 }
|
|
1495
|
+
);
|
|
1496
|
+
const Y = {
|
|
1497
|
+
option: (v, _) => r == null ? void 0 : r.option(v, _),
|
|
1498
|
+
destroy: () => {
|
|
1499
|
+
r == null || r.destroy(), r = null;
|
|
1500
|
+
},
|
|
1501
|
+
save: () => r == null ? void 0 : r.save(),
|
|
1502
|
+
toArray: () => r == null ? void 0 : r.toArray(),
|
|
1503
|
+
closest: (...v) => r == null ? void 0 : r.closest(...v)
|
|
1504
|
+
}, B = () => Y == null ? void 0 : Y.option("disabled", !0), h = () => Y == null ? void 0 : Y.option("disabled", !1);
|
|
1505
|
+
return sl(() => {
|
|
1506
|
+
d && N();
|
|
1507
|
+
}), rl(Y.destroy), Xe({ start: N, pause: B, resume: h }, Y);
|
|
1508
|
+
}
|
|
1509
|
+
const Ht = [
|
|
1510
|
+
"update",
|
|
1511
|
+
"start",
|
|
1512
|
+
"add",
|
|
1513
|
+
"remove",
|
|
1514
|
+
"choose",
|
|
1515
|
+
"unchoose",
|
|
1516
|
+
"end",
|
|
1517
|
+
"sort",
|
|
1518
|
+
"filter",
|
|
1519
|
+
"clone",
|
|
1520
|
+
"move",
|
|
1521
|
+
"change"
|
|
1522
|
+
], cl = [
|
|
1523
|
+
"clone",
|
|
1524
|
+
"animation",
|
|
1525
|
+
"ghostClass",
|
|
1526
|
+
"group",
|
|
1527
|
+
"sort",
|
|
1528
|
+
"disabled",
|
|
1529
|
+
"store",
|
|
1530
|
+
"handle",
|
|
1531
|
+
"draggable",
|
|
1532
|
+
"swapThreshold",
|
|
1533
|
+
"invertSwap",
|
|
1534
|
+
"invertedSwapThreshold",
|
|
1535
|
+
"removeCloneOnHide",
|
|
1536
|
+
"direction",
|
|
1537
|
+
"chosenClass",
|
|
1538
|
+
"dragClass",
|
|
1539
|
+
"ignore",
|
|
1540
|
+
"filter",
|
|
1541
|
+
"preventOnFilter",
|
|
1542
|
+
"easing",
|
|
1543
|
+
"setData",
|
|
1544
|
+
"dropBubble",
|
|
1545
|
+
"dragoverBubble",
|
|
1546
|
+
"dataIdAttr",
|
|
1547
|
+
"delay",
|
|
1548
|
+
"delayOnTouchOnly",
|
|
1549
|
+
"touchStartThreshold",
|
|
1550
|
+
"forceFallback",
|
|
1551
|
+
"fallbackClass",
|
|
1552
|
+
"fallbackOnBody",
|
|
1553
|
+
"fallbackTolerance",
|
|
1554
|
+
"fallbackOffset",
|
|
1555
|
+
"supportPointer",
|
|
1556
|
+
"emptyInsertThreshold",
|
|
1557
|
+
"scroll",
|
|
1558
|
+
"forceAutoScrollFallback",
|
|
1559
|
+
"scrollSensitivity",
|
|
1560
|
+
"scrollSpeed",
|
|
1561
|
+
"bubbleScroll",
|
|
1562
|
+
"modelValue",
|
|
1563
|
+
"tag",
|
|
1564
|
+
"target",
|
|
1565
|
+
"customUpdate",
|
|
1566
|
+
...Ht.map((e) => `on${e.replace(/^\S/, (o) => o.toUpperCase())}`)
|
|
1567
|
+
], lt = ee({
|
|
1568
|
+
name: "VueDraggable",
|
|
1569
|
+
model: {
|
|
1570
|
+
prop: "modelValue",
|
|
1571
|
+
event: "update:modelValue"
|
|
1572
|
+
},
|
|
1573
|
+
props: cl,
|
|
1574
|
+
emits: ["update:modelValue", ...Ht],
|
|
1575
|
+
setup(e, { slots: o, emit: t, expose: n, attrs: l }) {
|
|
1576
|
+
const i = Ht.reduce((u, f) => {
|
|
1577
|
+
const c = `on${f.replace(/^\S/, (m) => m.toUpperCase())}`;
|
|
1578
|
+
return u[c] = (...m) => t(f, ...m), u;
|
|
1579
|
+
}, {}), a = L(() => {
|
|
1580
|
+
const u = jo(e), f = ko(u, ["modelValue"]), c = Object.entries(f).reduce((m, [E, T]) => {
|
|
1581
|
+
const D = y(T);
|
|
1582
|
+
return D !== void 0 && (m[E] = D), m;
|
|
1583
|
+
}, {});
|
|
1584
|
+
return Xe(Xe({}, i), Sn(Xe(Xe({}, l), c)));
|
|
1585
|
+
}), s = L({
|
|
1586
|
+
get: () => e.modelValue,
|
|
1587
|
+
set: (u) => t("update:modelValue", u)
|
|
1588
|
+
}), r = j(), d = Ko(
|
|
1589
|
+
ul(e.target || r, s, a)
|
|
1590
|
+
);
|
|
1591
|
+
return n(d), () => {
|
|
1592
|
+
var u;
|
|
1593
|
+
return qo(e.tag || "div", { ref: r }, (u = o == null ? void 0 : o.default) == null ? void 0 : u.call(o, d));
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
}), Pe = {
|
|
1597
|
+
BLACK: "#000000",
|
|
1598
|
+
WHITE: "#FFFFFF",
|
|
1599
|
+
RED: "#FF0000",
|
|
1600
|
+
NEUTRAL_GRAY_200_HEX: "#BCC1C3",
|
|
1601
|
+
NEUTRAL_GRAY_200: "var(--fm-color-neutral-gray-200)"
|
|
1602
|
+
}, ml = /* @__PURE__ */ ee({
|
|
1603
|
+
__name: "TextWidget",
|
|
1604
|
+
props: {
|
|
1605
|
+
modelValue: {},
|
|
1606
|
+
fontSize: {},
|
|
1607
|
+
disabled: { type: Boolean }
|
|
1608
|
+
},
|
|
1609
|
+
setup(e) {
|
|
1610
|
+
const o = e, t = L(() => {
|
|
1611
|
+
const i = (o.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK) === R.F_PRINT_COLOR.Enum.BLACK, a = o.modelValue.isInvert, s = o.disabled ? Pe.NEUTRAL_GRAY_200 : a ? "white" : i ? "black" : "red", r = a ? i ? "black" : "red" : "transparent";
|
|
1612
|
+
return {
|
|
1613
|
+
textAlign: on(o.modelValue.textAlign),
|
|
1614
|
+
fontSize: `${o.fontSize * o.modelValue.factor}px`,
|
|
1615
|
+
fontWeight: o.modelValue.isBold ? "bold" : "normal",
|
|
1616
|
+
fontStyle: o.modelValue.isItalic ? "italic" : "normal",
|
|
1617
|
+
color: s,
|
|
1618
|
+
textDecoration: o.modelValue.isUnderline ? "underline" : "none",
|
|
1619
|
+
backgroundColor: r
|
|
1620
|
+
};
|
|
1621
|
+
}), n = L(() => ({
|
|
1622
|
+
height: o.modelValue.height === null ? "auto" : `${o.modelValue.height}px`
|
|
1623
|
+
}));
|
|
1624
|
+
return (l, i) => (x(), W("div", {
|
|
1625
|
+
style: ge(n.value)
|
|
1626
|
+
}, [
|
|
1627
|
+
V("div", {
|
|
1628
|
+
class: "text-sm",
|
|
1629
|
+
style: ge(t.value)
|
|
1630
|
+
}, H(o.modelValue.value.length ? o.modelValue.value : "Enter value here"), 5)
|
|
1631
|
+
], 4));
|
|
1632
|
+
}
|
|
1633
|
+
}), pl = /* @__PURE__ */ ee({
|
|
1634
|
+
__name: "CheckboxWidget",
|
|
1635
|
+
props: {
|
|
1636
|
+
modelValue: {},
|
|
1637
|
+
disabled: { type: Boolean }
|
|
1638
|
+
},
|
|
1639
|
+
setup(e) {
|
|
1640
|
+
const o = e, t = L(() => o.modelValue.height == null ? o.modelValue.size : Math.min(o.modelValue.height, o.modelValue.size)), n = L(() => {
|
|
1641
|
+
const a = (o.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK) === R.F_PRINT_COLOR.Enum.BLACK;
|
|
1642
|
+
return {
|
|
1643
|
+
width: `${o.modelValue.size}px`,
|
|
1644
|
+
height: `${t.value}px`,
|
|
1645
|
+
borderColor: o.disabled ? Pe.NEUTRAL_GRAY_200 : a ? "black" : "red"
|
|
1646
|
+
};
|
|
1647
|
+
}), l = L(() => {
|
|
1648
|
+
const i = at(o.modelValue.alignment), a = rt(o.modelValue.alignment);
|
|
1649
|
+
return {
|
|
1650
|
+
display: "flex",
|
|
1651
|
+
justifyContent: i,
|
|
1652
|
+
alignItems: a
|
|
1653
|
+
};
|
|
1654
|
+
});
|
|
1655
|
+
return (i, a) => (x(), W("div", {
|
|
1656
|
+
style: ge(l.value)
|
|
1657
|
+
}, [
|
|
1658
|
+
V("div", {
|
|
1659
|
+
class: "border",
|
|
1660
|
+
style: ge(n.value)
|
|
1661
|
+
}, null, 4)
|
|
1662
|
+
], 4));
|
|
1663
|
+
}
|
|
1664
|
+
}), fl = { class: "flex flex-col gap-2" }, gl = /* @__PURE__ */ ee({
|
|
1665
|
+
__name: "SpacerWidget",
|
|
1666
|
+
props: {
|
|
1667
|
+
modelValue: {}
|
|
1668
|
+
},
|
|
1669
|
+
setup(e) {
|
|
1670
|
+
const o = e, t = L(() => ({
|
|
1671
|
+
height: `${o.modelValue.height}px`
|
|
1672
|
+
}));
|
|
1673
|
+
return (n, l) => (x(), W("div", fl, [
|
|
1674
|
+
V("div", {
|
|
1675
|
+
class: "w-full",
|
|
1676
|
+
style: ge(t.value)
|
|
1677
|
+
}, null, 4)
|
|
1678
|
+
]));
|
|
1679
|
+
}
|
|
1680
|
+
}), vl = ["src"], hl = /* @__PURE__ */ ee({
|
|
1681
|
+
__name: "ImageWidget",
|
|
1682
|
+
props: {
|
|
1683
|
+
modelValue: {}
|
|
1684
|
+
},
|
|
1685
|
+
setup(e) {
|
|
1686
|
+
const o = e, t = L(() => nn(o.modelValue.imgData).value), n = L(() => ({
|
|
1687
|
+
height: o.modelValue.height ? `${o.modelValue.height}px` : "auto",
|
|
1688
|
+
width: o.modelValue.width ? `${o.modelValue.width}px` : "auto",
|
|
1689
|
+
maxWidth: "100%"
|
|
1690
|
+
})), l = L(() => {
|
|
1691
|
+
const i = at(o.modelValue.alignment), a = rt(o.modelValue.alignment);
|
|
1692
|
+
return {
|
|
1693
|
+
display: "flex",
|
|
1694
|
+
justifyContent: i,
|
|
1695
|
+
alignItems: a
|
|
1696
|
+
};
|
|
1697
|
+
});
|
|
1698
|
+
return (i, a) => {
|
|
1699
|
+
const s = J("FmIcon");
|
|
1700
|
+
return x(), W("div", {
|
|
1701
|
+
style: ge(l.value)
|
|
1702
|
+
}, [
|
|
1703
|
+
t.value ? (x(), W("img", {
|
|
1704
|
+
key: 0,
|
|
1705
|
+
src: t.value,
|
|
1706
|
+
alt: "Image Widget",
|
|
1707
|
+
style: ge(n.value)
|
|
1708
|
+
}, null, 12, vl)) : (x(), ye(s, {
|
|
1709
|
+
key: 1,
|
|
1710
|
+
name: "image",
|
|
1711
|
+
size: "md"
|
|
1712
|
+
}))
|
|
1713
|
+
], 4);
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
}), bl = ["src"], yl = /* @__PURE__ */ ee({
|
|
1717
|
+
__name: "QrCodeWidget",
|
|
1718
|
+
props: {
|
|
1719
|
+
modelValue: {},
|
|
1720
|
+
disabled: { type: Boolean }
|
|
1721
|
+
},
|
|
1722
|
+
setup(e) {
|
|
1723
|
+
const o = e, t = j(""), { t: n } = me(), l = wo(), i = async (s, r) => {
|
|
1724
|
+
try {
|
|
1725
|
+
const u = (r ?? R.F_PRINT_COLOR.Enum.BLACK) === R.F_PRINT_COLOR.Enum.BLACK;
|
|
1726
|
+
t.value = await ln.toDataURL(s, {
|
|
1727
|
+
width: o.modelValue.size,
|
|
1728
|
+
color: {
|
|
1729
|
+
dark: o.disabled ? Pe.NEUTRAL_GRAY_200_HEX : u ? Pe.BLACK : Pe.RED,
|
|
1730
|
+
light: Pe.WHITE
|
|
1731
|
+
},
|
|
1732
|
+
margin: 0
|
|
1733
|
+
});
|
|
1734
|
+
} catch (d) {
|
|
1735
|
+
l.open(
|
|
1736
|
+
{
|
|
1737
|
+
title: n("mf-kitchen.editor.qrCodeFail"),
|
|
1738
|
+
message: `${d}`,
|
|
1739
|
+
type: "error"
|
|
1740
|
+
},
|
|
1741
|
+
3e3
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
}, a = L(() => {
|
|
1745
|
+
const s = at(o.modelValue.alignment), r = rt(o.modelValue.alignment);
|
|
1746
|
+
return {
|
|
1747
|
+
display: "flex",
|
|
1748
|
+
justifyContent: s,
|
|
1749
|
+
alignItems: r,
|
|
1750
|
+
height: `${o.modelValue.height}px`
|
|
1751
|
+
};
|
|
1752
|
+
});
|
|
1753
|
+
return Ge(
|
|
1754
|
+
() => [o.modelValue.link, o.modelValue.color, o.disabled],
|
|
1755
|
+
([s, r]) => {
|
|
1756
|
+
s ? i(s, r) : t.value = "";
|
|
1757
|
+
},
|
|
1758
|
+
{ immediate: !0 }
|
|
1759
|
+
), (s, r) => {
|
|
1760
|
+
const d = J("FmIcon");
|
|
1761
|
+
return x(), W("div", {
|
|
1762
|
+
style: ge(a.value)
|
|
1763
|
+
}, [
|
|
1764
|
+
t.value ? (x(), W("img", {
|
|
1765
|
+
key: 0,
|
|
1766
|
+
src: t.value,
|
|
1767
|
+
alt: "QR Code"
|
|
1768
|
+
}, null, 8, bl)) : (x(), ye(d, {
|
|
1769
|
+
key: 1,
|
|
1770
|
+
name: "qr_code_scanner",
|
|
1771
|
+
size: "md"
|
|
1772
|
+
}))
|
|
1773
|
+
], 4);
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
}), _l = /* @__PURE__ */ ee({
|
|
1777
|
+
__name: "DividerWidget",
|
|
1778
|
+
props: {
|
|
1779
|
+
modelValue: {},
|
|
1780
|
+
disabled: { type: Boolean }
|
|
1781
|
+
},
|
|
1782
|
+
setup(e) {
|
|
1783
|
+
const o = e, t = L(() => {
|
|
1784
|
+
const l = (o.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK) === R.F_PRINT_COLOR.Enum.BLACK;
|
|
1785
|
+
return {
|
|
1786
|
+
borderTop: `${o.modelValue.thickness}px solid black`,
|
|
1787
|
+
width: "100%",
|
|
1788
|
+
borderColor: o.disabled ? Pe.NEUTRAL_GRAY_200 : l ? "black" : "red"
|
|
1789
|
+
};
|
|
1790
|
+
});
|
|
1791
|
+
return (n, l) => (x(), W("div", {
|
|
1792
|
+
style: ge({ height: `${n.modelValue.height}px` })
|
|
1793
|
+
}, [
|
|
1794
|
+
V("div", {
|
|
1795
|
+
style: ge(t.value)
|
|
1796
|
+
}, null, 4)
|
|
1797
|
+
], 4));
|
|
1798
|
+
}
|
|
1799
|
+
}), Cl = /* @__PURE__ */ ee({
|
|
1800
|
+
__name: "WidgetView",
|
|
1801
|
+
props: {
|
|
1802
|
+
modelValue: {
|
|
1803
|
+
type: Object,
|
|
1804
|
+
required: !0
|
|
1805
|
+
},
|
|
1806
|
+
fontSize: {
|
|
1807
|
+
type: Number,
|
|
1808
|
+
required: !0
|
|
1809
|
+
},
|
|
1810
|
+
disabled: {
|
|
1811
|
+
type: Boolean,
|
|
1812
|
+
default: !1
|
|
1813
|
+
}
|
|
1814
|
+
},
|
|
1815
|
+
setup(e) {
|
|
1816
|
+
const o = e, t = L(() => {
|
|
1817
|
+
switch (o.modelValue.data.type) {
|
|
1818
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.TEXT:
|
|
1819
|
+
return {
|
|
1820
|
+
component: ml,
|
|
1821
|
+
properties: {
|
|
1822
|
+
modelValue: o.modelValue.data,
|
|
1823
|
+
fontSize: o.fontSize,
|
|
1824
|
+
disabled: o.disabled
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.CHECKBOX:
|
|
1828
|
+
return {
|
|
1829
|
+
component: pl,
|
|
1830
|
+
properties: { modelValue: o.modelValue.data, disabled: o.disabled }
|
|
1831
|
+
};
|
|
1832
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.IMAGE:
|
|
1833
|
+
return {
|
|
1834
|
+
component: hl,
|
|
1835
|
+
properties: { modelValue: o.modelValue.data }
|
|
1836
|
+
};
|
|
1837
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.QR:
|
|
1838
|
+
return {
|
|
1839
|
+
component: yl,
|
|
1840
|
+
properties: { modelValue: o.modelValue.data, disabled: o.disabled }
|
|
1841
|
+
};
|
|
1842
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.DIVIDER:
|
|
1843
|
+
return {
|
|
1844
|
+
component: _l,
|
|
1845
|
+
properties: { modelValue: o.modelValue.data, disabled: o.disabled }
|
|
1846
|
+
};
|
|
1847
|
+
case R.F_WIDGET_TEMPLATE_TYPE.enum.EMPTY:
|
|
1848
|
+
default:
|
|
1849
|
+
return {
|
|
1850
|
+
component: gl,
|
|
1851
|
+
properties: { modelValue: o.modelValue.data }
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
}), n = L(() => {
|
|
1855
|
+
const i = at(o.modelValue.data.alignment), a = rt(o.modelValue.data.alignment);
|
|
1856
|
+
return {
|
|
1857
|
+
display: "flex",
|
|
1858
|
+
justifyContent: i,
|
|
1859
|
+
alignItems: a
|
|
1860
|
+
};
|
|
1861
|
+
}), l = L(() => {
|
|
1862
|
+
const { top: i, right: a, bottom: s, left: r } = o.modelValue.data.padding;
|
|
1863
|
+
return {
|
|
1864
|
+
padding: `${i}px ${a}px ${s}px ${r}px`,
|
|
1865
|
+
overflow: "hidden"
|
|
1866
|
+
};
|
|
1867
|
+
});
|
|
1868
|
+
return (i, a) => {
|
|
1869
|
+
var s, r;
|
|
1870
|
+
return x(), W("div", {
|
|
1871
|
+
style: ge(l.value)
|
|
1872
|
+
}, [
|
|
1873
|
+
(x(), ye(Eo(Zo((s = t.value) == null ? void 0 : s.component)), Qo({
|
|
1874
|
+
class: "widget",
|
|
1875
|
+
style: n.value
|
|
1876
|
+
}, (r = t.value) == null ? void 0 : r.properties), null, 16, ["style"]))
|
|
1877
|
+
], 4);
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
}), El = { class: "flex h-fit w-[375px] bg-fm-color-neutral-white" }, Tl = { class: "rows-zone" }, wl = ["onClick"], Sl = /* @__PURE__ */ ee({
|
|
1881
|
+
__name: "ReceiptEditor",
|
|
1882
|
+
props: {
|
|
1883
|
+
modelValue: {},
|
|
1884
|
+
fontSize: {},
|
|
1885
|
+
selectedWidget: {},
|
|
1886
|
+
selectedWidgetSectionType: {},
|
|
1887
|
+
selectedWidgetColumn: {}
|
|
1888
|
+
},
|
|
1889
|
+
emits: ["selectWidget", "update:model-value"],
|
|
1890
|
+
setup(e, { emit: o }) {
|
|
1891
|
+
const t = e, n = o, l = j(t.modelValue), i = j(null), a = j(null), s = j(null), r = j(null), d = j(null), u = j(null);
|
|
1892
|
+
function f(p, k, C, w) {
|
|
1893
|
+
a.value = p, s.value = k, r.value = C, N({ config: p, position: { row: k, col: C, cell: w } });
|
|
1894
|
+
}
|
|
1895
|
+
function c(p) {
|
|
1896
|
+
return p.newIndex;
|
|
1897
|
+
}
|
|
1898
|
+
function m(p, k, C, w) {
|
|
1899
|
+
var le, _e, Re;
|
|
1900
|
+
const b = c(p);
|
|
1901
|
+
if (b == null)
|
|
1902
|
+
return;
|
|
1903
|
+
const P = {
|
|
1904
|
+
row: k ?? b,
|
|
1905
|
+
col: C ?? b,
|
|
1906
|
+
cell: w ?? b
|
|
1907
|
+
}, G = (Re = (_e = (le = l.value) == null ? void 0 : le[P.row].columns) == null ? void 0 : _e[P.col]) == null ? void 0 : Re.cells[P.cell];
|
|
1908
|
+
G != null && N({ config: G, position: P });
|
|
1909
|
+
}
|
|
1910
|
+
function E(p) {
|
|
1911
|
+
m(p, void 0, 0, 0);
|
|
1912
|
+
}
|
|
1913
|
+
function T(p, k) {
|
|
1914
|
+
m(p, k, void 0, 0);
|
|
1915
|
+
}
|
|
1916
|
+
function D(p, k, C) {
|
|
1917
|
+
m(p, k, C, void 0);
|
|
1918
|
+
}
|
|
1919
|
+
function M() {
|
|
1920
|
+
const p = l.value.map((k) => ({
|
|
1921
|
+
...k,
|
|
1922
|
+
columns: k.columns.filter((C) => C.cells && C.cells.length > 0)
|
|
1923
|
+
})).filter((k) => k.columns.length > 0);
|
|
1924
|
+
l.value = p, n("update:model-value", p);
|
|
1925
|
+
}
|
|
1926
|
+
function K(p) {
|
|
1927
|
+
const k = p.map((C, w) => {
|
|
1928
|
+
var P;
|
|
1929
|
+
if (C.columns)
|
|
1930
|
+
return C;
|
|
1931
|
+
let b;
|
|
1932
|
+
return s.value != null ? b = p[s.value].sectionType ?? u.value : b = C.sectionType ? C.sectionType : w > 0 && ((P = p[w - 1]) != null && P.sectionType) ? p[w - 1].sectionType : u.value, {
|
|
1933
|
+
columns: [
|
|
1934
|
+
{
|
|
1935
|
+
width: {
|
|
1936
|
+
type: R.F_CELL_WIDTH_TYPE.Enum.FLEX,
|
|
1937
|
+
value: 100
|
|
1938
|
+
},
|
|
1939
|
+
cells: [{ ...C }]
|
|
1940
|
+
}
|
|
1941
|
+
],
|
|
1942
|
+
sectionType: b
|
|
1943
|
+
};
|
|
1944
|
+
});
|
|
1945
|
+
l.value = k, n("update:model-value", k);
|
|
1946
|
+
}
|
|
1947
|
+
function $(p, k) {
|
|
1948
|
+
const C = p.map((b) => b.cells ? b : {
|
|
1949
|
+
cells: [{ ...b }]
|
|
1950
|
+
}), w = l.value.map(
|
|
1951
|
+
(b, P) => P === k ? { ...b, columns: C } : b
|
|
1952
|
+
);
|
|
1953
|
+
l.value = w, n("update:model-value", w);
|
|
1954
|
+
}
|
|
1955
|
+
function N(p) {
|
|
1956
|
+
i.value = p.position, d.value = p.position.row, n("selectWidget", p);
|
|
1957
|
+
}
|
|
1958
|
+
const Y = (p, k, C) => {
|
|
1959
|
+
if (t.selectedWidget != null) {
|
|
1960
|
+
const w = i.value;
|
|
1961
|
+
return (w == null ? void 0 : w.row) === p && (w == null ? void 0 : w.col) === k && (w == null ? void 0 : w.cell) === C;
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
function B(p) {
|
|
1965
|
+
return p == null ? {} : p.type === R.F_CELL_WIDTH_TYPE.Enum.FLEX ? {
|
|
1966
|
+
flex: p.value
|
|
1967
|
+
} : p.type === R.F_CELL_WIDTH_TYPE.Enum.FIXED ? {
|
|
1968
|
+
width: `${p.value}px`,
|
|
1969
|
+
flex: "none"
|
|
1970
|
+
} : {};
|
|
1971
|
+
}
|
|
1972
|
+
function h(p, k) {
|
|
1973
|
+
d.value = k, u.value = p;
|
|
1974
|
+
}
|
|
1975
|
+
function v(p) {
|
|
1976
|
+
return p === d.value;
|
|
1977
|
+
}
|
|
1978
|
+
function _(p) {
|
|
1979
|
+
return t.selectedWidgetSectionType ? p !== t.selectedWidgetSectionType : !1;
|
|
1980
|
+
}
|
|
1981
|
+
return Ge(
|
|
1982
|
+
() => t.modelValue,
|
|
1983
|
+
(p) => {
|
|
1984
|
+
l.value = p;
|
|
1985
|
+
},
|
|
1986
|
+
{ deep: !0 }
|
|
1987
|
+
), Ge(
|
|
1988
|
+
() => t.selectedWidget,
|
|
1989
|
+
(p) => {
|
|
1990
|
+
p === null && (d.value = null);
|
|
1991
|
+
}
|
|
1992
|
+
), (p, k) => (x(), W("div", El, [
|
|
1993
|
+
V("div", Tl, [
|
|
1994
|
+
S(y(lt), {
|
|
1995
|
+
modelValue: l.value,
|
|
1996
|
+
"onUpdate:modelValue": [
|
|
1997
|
+
k[0] || (k[0] = (C) => l.value = C),
|
|
1998
|
+
k[2] || (k[2] = (C) => K(C))
|
|
1999
|
+
],
|
|
2000
|
+
"item-key": "index",
|
|
2001
|
+
group: "widgets",
|
|
2002
|
+
onAdd: k[1] || (k[1] = (C) => E(C)),
|
|
2003
|
+
class: "row-container"
|
|
2004
|
+
}, {
|
|
2005
|
+
default: be(() => [
|
|
2006
|
+
(x(!0), W(we, null, Se(l.value, (C, w) => (x(), W("div", { key: w }, [
|
|
2007
|
+
V("div", {
|
|
2008
|
+
class: Zt(["row", {
|
|
2009
|
+
rowBorder: v(w)
|
|
2010
|
+
}])
|
|
2011
|
+
}, [
|
|
2012
|
+
S(y(lt), {
|
|
2013
|
+
modelValue: C.columns,
|
|
2014
|
+
"onUpdate:modelValue": [(b) => C.columns = b, (b) => $(b, w)],
|
|
2015
|
+
"item-key": "index",
|
|
2016
|
+
group: "widgets",
|
|
2017
|
+
"row-index": w,
|
|
2018
|
+
disabled: _(C.sectionType),
|
|
2019
|
+
onAdd: (b) => T(b, w),
|
|
2020
|
+
onDragover: (b) => h(C.sectionType, w),
|
|
2021
|
+
class: "column-container"
|
|
2022
|
+
}, {
|
|
2023
|
+
default: be(() => [
|
|
2024
|
+
(x(!0), W(we, null, Se(C.columns, (b, P) => (x(), W("div", {
|
|
2025
|
+
class: "w-full",
|
|
2026
|
+
key: P
|
|
2027
|
+
}, [
|
|
2028
|
+
V("div", {
|
|
2029
|
+
class: "column",
|
|
2030
|
+
style: ge(B(b.width ?? void 0))
|
|
2031
|
+
}, [
|
|
2032
|
+
S(y(lt), {
|
|
2033
|
+
modelValue: b.cells,
|
|
2034
|
+
"onUpdate:modelValue": (G) => b.cells = G,
|
|
2035
|
+
"item-key": "index",
|
|
2036
|
+
group: "widgets",
|
|
2037
|
+
"row-index": w,
|
|
2038
|
+
"col-index": P,
|
|
2039
|
+
disabled: _(C.sectionType),
|
|
2040
|
+
onAdd: (G) => D(G, w, P),
|
|
2041
|
+
onUpdate: (G) => D(G, w, P),
|
|
2042
|
+
onStart: (G) => {
|
|
2043
|
+
f(
|
|
2044
|
+
b.cells[G.oldIndex],
|
|
2045
|
+
w,
|
|
2046
|
+
P,
|
|
2047
|
+
G.oldIndex
|
|
2048
|
+
);
|
|
2049
|
+
},
|
|
2050
|
+
onEnd: M,
|
|
2051
|
+
class: "cell-container"
|
|
2052
|
+
}, {
|
|
2053
|
+
default: be(() => [
|
|
2054
|
+
(x(!0), W(we, null, Se(b.cells, (G, le) => (x(), W("div", { key: le }, [
|
|
2055
|
+
V("div", {
|
|
2056
|
+
class: Zt(["cell", {
|
|
2057
|
+
"selected-widget": Y(w, P, le)
|
|
2058
|
+
}]),
|
|
2059
|
+
onClick: (_e) => N({
|
|
2060
|
+
config: G,
|
|
2061
|
+
position: { row: w, col: P, cell: le }
|
|
2062
|
+
})
|
|
2063
|
+
}, [
|
|
2064
|
+
S(Cl, {
|
|
2065
|
+
"model-value": G,
|
|
2066
|
+
"font-size": p.fontSize,
|
|
2067
|
+
disabled: _(C.sectionType)
|
|
2068
|
+
}, null, 8, ["model-value", "font-size", "disabled"])
|
|
2069
|
+
], 10, wl)
|
|
2070
|
+
]))), 128))
|
|
2071
|
+
]),
|
|
2072
|
+
_: 2
|
|
2073
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "row-index", "col-index", "disabled", "onAdd", "onUpdate", "onStart"])
|
|
2074
|
+
], 4)
|
|
2075
|
+
]))), 128))
|
|
2076
|
+
]),
|
|
2077
|
+
_: 2
|
|
2078
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "row-index", "disabled", "onAdd", "onDragover"])
|
|
2079
|
+
], 2)
|
|
2080
|
+
]))), 128))
|
|
2081
|
+
]),
|
|
2082
|
+
_: 1
|
|
2083
|
+
}, 8, ["modelValue"]),
|
|
2084
|
+
S(an)
|
|
2085
|
+
])
|
|
2086
|
+
]));
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
const Vl = /* @__PURE__ */ Vt(Sl, [["__scopeId", "data-v-4bfaa477"]]), kl = { class: "gap" }, xl = { class: "block fm-typo-en-body-md-600" }, Dl = {
|
|
2090
|
+
key: 1,
|
|
2091
|
+
class: "flex items-center fm-typo-en-body-md-600 h-9 my-8"
|
|
2092
|
+
}, Il = { class: "gap" }, Fl = { class: "block fm-typo-en-body-md-600" }, Ol = { class: "grid grid-cols-2 gap-2" }, Rl = { class: "gap" }, Al = { class: "fm-typo-en-body-lg-600" }, Wl = { class: "flex flex-row justify-between" }, Nl = { class: "alignButtonGap" }, Pl = { class: "alignButtonGap" }, Ll = /* @__PURE__ */ ee({
|
|
2093
|
+
__name: "CommonWidgetEditor",
|
|
2094
|
+
props: {
|
|
2095
|
+
modelValue: {},
|
|
2096
|
+
selectedWidgetColumn: {}
|
|
2097
|
+
},
|
|
2098
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2099
|
+
setup(e, { emit: o }) {
|
|
2100
|
+
const t = e, n = o, { t: l } = me(), i = j(at(t.modelValue.alignment)), a = j(rt(t.modelValue.alignment)), s = [
|
|
2101
|
+
pe.FLEX_START,
|
|
2102
|
+
pe.CENTER,
|
|
2103
|
+
pe.FLEX_END
|
|
2104
|
+
], r = [
|
|
2105
|
+
pe.FLEX_START,
|
|
2106
|
+
pe.CENTER,
|
|
2107
|
+
pe.FLEX_END
|
|
2108
|
+
], d = (h) => {
|
|
2109
|
+
switch (h) {
|
|
2110
|
+
case pe.FLEX_START:
|
|
2111
|
+
return "align_horizontal_left";
|
|
2112
|
+
case pe.CENTER:
|
|
2113
|
+
return "align_horizontal_center";
|
|
2114
|
+
case pe.FLEX_END:
|
|
2115
|
+
return "align_horizontal_right";
|
|
2116
|
+
}
|
|
2117
|
+
}, u = (h) => {
|
|
2118
|
+
switch (h) {
|
|
2119
|
+
case pe.FLEX_START:
|
|
2120
|
+
return "vertical_align_top";
|
|
2121
|
+
case pe.CENTER:
|
|
2122
|
+
return "vertical_align_center";
|
|
2123
|
+
case pe.FLEX_END:
|
|
2124
|
+
return "vertical_align_bottom";
|
|
2125
|
+
}
|
|
2126
|
+
}, f = (h) => {
|
|
2127
|
+
var _;
|
|
2128
|
+
const v = (_ = t.selectedWidgetColumn.width) == null ? void 0 : _.value;
|
|
2129
|
+
switch (h) {
|
|
2130
|
+
case Le.AUTO:
|
|
2131
|
+
return null;
|
|
2132
|
+
case Le.PERCENTAGE:
|
|
2133
|
+
return {
|
|
2134
|
+
type: R.F_CELL_WIDTH_TYPE.Enum.FLEX,
|
|
2135
|
+
value: v ?? 100
|
|
2136
|
+
};
|
|
2137
|
+
case Le.PX:
|
|
2138
|
+
return {
|
|
2139
|
+
type: R.F_CELL_WIDTH_TYPE.Enum.FIXED,
|
|
2140
|
+
value: v ?? 10
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
}, c = [
|
|
2144
|
+
{ label: Le.AUTO },
|
|
2145
|
+
{ label: Le.PX },
|
|
2146
|
+
{ label: Le.PERCENTAGE }
|
|
2147
|
+
], m = L(() => {
|
|
2148
|
+
var v;
|
|
2149
|
+
switch ((v = t.selectedWidgetColumn.width) == null ? void 0 : v.type) {
|
|
2150
|
+
case R.F_CELL_WIDTH_TYPE.Enum.FIXED:
|
|
2151
|
+
return c[1];
|
|
2152
|
+
case R.F_CELL_WIDTH_TYPE.Enum.FLEX:
|
|
2153
|
+
return c[2];
|
|
2154
|
+
default:
|
|
2155
|
+
return c[0];
|
|
2156
|
+
}
|
|
2157
|
+
});
|
|
2158
|
+
function E(h) {
|
|
2159
|
+
var _;
|
|
2160
|
+
const v = Math.max(1, Math.min(h, 720));
|
|
2161
|
+
n("update:selected-widget-column", {
|
|
2162
|
+
...t.selectedWidgetColumn,
|
|
2163
|
+
width: {
|
|
2164
|
+
type: ((_ = t.selectedWidgetColumn.width) == null ? void 0 : _.type) ?? R.F_CELL_WIDTH_TYPE.Enum.FLEX,
|
|
2165
|
+
value: v
|
|
2166
|
+
}
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
function T(h) {
|
|
2170
|
+
const v = f(h.label);
|
|
2171
|
+
v == null ? n("update:selected-widget-column", {
|
|
2172
|
+
...t.selectedWidgetColumn,
|
|
2173
|
+
width: null
|
|
2174
|
+
}) : n("update:selected-widget-column", {
|
|
2175
|
+
...t.selectedWidgetColumn,
|
|
2176
|
+
width: {
|
|
2177
|
+
type: v.type,
|
|
2178
|
+
value: v.value
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
function D(h, v) {
|
|
2183
|
+
let _ = v;
|
|
2184
|
+
h === "height" && v === 0 && (_ = null), n("update:model-value", {
|
|
2185
|
+
...t.modelValue,
|
|
2186
|
+
[h]: _
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
function M(h, v) {
|
|
2190
|
+
D("padding", { ...t.modelValue.padding, [h]: v });
|
|
2191
|
+
}
|
|
2192
|
+
function K(h) {
|
|
2193
|
+
i.value = h, N();
|
|
2194
|
+
}
|
|
2195
|
+
function $(h) {
|
|
2196
|
+
a.value = h, N();
|
|
2197
|
+
}
|
|
2198
|
+
function N() {
|
|
2199
|
+
D(
|
|
2200
|
+
"alignment",
|
|
2201
|
+
rn({ justify: i.value, align: a.value })
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
function Y(h) {
|
|
2205
|
+
return h ? "neutral-gray-400" : "neutral-gray-300";
|
|
2206
|
+
}
|
|
2207
|
+
function B(h) {
|
|
2208
|
+
return h ? "neutral-gray-100" : "";
|
|
2209
|
+
}
|
|
2210
|
+
return (h, v) => {
|
|
2211
|
+
var C, w;
|
|
2212
|
+
const _ = J("FmStepperField"), p = J("FmButtonGroup"), k = J("FmButton");
|
|
2213
|
+
return x(), W("div", kl, [
|
|
2214
|
+
V("div", null, [
|
|
2215
|
+
V("label", xl, H(y(l)("mf-kitchen.editor.columnWidth")), 1),
|
|
2216
|
+
(C = t.selectedWidgetColumn.width) != null && C.type ? (x(), ye(_, {
|
|
2217
|
+
key: 0,
|
|
2218
|
+
"model-value": ((w = t.selectedWidgetColumn.width) == null ? void 0 : w.value) ?? null,
|
|
2219
|
+
max: 720,
|
|
2220
|
+
min: 1,
|
|
2221
|
+
step: 1,
|
|
2222
|
+
rules: [(b) => b <= 720 || y(l)("mf-kitchen.editor.validation.columnWidthMax")],
|
|
2223
|
+
"onUpdate:modelValue": E
|
|
2224
|
+
}, null, 8, ["model-value", "rules"])) : (x(), W("label", Dl, H(y(l)("mf-kitchen.editor.autoWidth")), 1)),
|
|
2225
|
+
S(p, {
|
|
2226
|
+
"model-value": m.value,
|
|
2227
|
+
items: c,
|
|
2228
|
+
"onUpdate:modelValue": T
|
|
2229
|
+
}, null, 8, ["model-value"])
|
|
2230
|
+
]),
|
|
2231
|
+
V("div", Il, [
|
|
2232
|
+
V("label", Fl, H(y(l)("mf-kitchen.editor.spacing")), 1),
|
|
2233
|
+
V("div", Ol, [
|
|
2234
|
+
S(_, {
|
|
2235
|
+
"model-value": h.modelValue.padding.top,
|
|
2236
|
+
min: 0,
|
|
2237
|
+
step: 1,
|
|
2238
|
+
label: y(l)("mf-kitchen.editor.alignmentTop"),
|
|
2239
|
+
"onUpdate:modelValue": v[0] || (v[0] = (b) => M("top", b))
|
|
2240
|
+
}, null, 8, ["model-value", "label"]),
|
|
2241
|
+
S(_, {
|
|
2242
|
+
"model-value": h.modelValue.padding.bottom,
|
|
2243
|
+
min: 0,
|
|
2244
|
+
step: 1,
|
|
2245
|
+
label: y(l)("mf-kitchen.editor.alignmentBottom"),
|
|
2246
|
+
"onUpdate:modelValue": v[1] || (v[1] = (b) => M("bottom", b))
|
|
2247
|
+
}, null, 8, ["model-value", "label"]),
|
|
2248
|
+
S(_, {
|
|
2249
|
+
"model-value": h.modelValue.padding.left,
|
|
2250
|
+
min: 0,
|
|
2251
|
+
step: 1,
|
|
2252
|
+
label: y(l)("mf-kitchen.editor.alignmentLeft"),
|
|
2253
|
+
"onUpdate:modelValue": v[2] || (v[2] = (b) => M("left", b))
|
|
2254
|
+
}, null, 8, ["model-value", "label"]),
|
|
2255
|
+
S(_, {
|
|
2256
|
+
"model-value": h.modelValue.padding.right,
|
|
2257
|
+
min: 0,
|
|
2258
|
+
step: 1,
|
|
2259
|
+
label: y(l)("mf-kitchen.editor.alignmentRight"),
|
|
2260
|
+
"onUpdate:modelValue": v[3] || (v[3] = (b) => M("right", b))
|
|
2261
|
+
}, null, 8, ["model-value", "label"])
|
|
2262
|
+
])
|
|
2263
|
+
]),
|
|
2264
|
+
S(_, {
|
|
2265
|
+
"model-value": h.modelValue.height ?? 0,
|
|
2266
|
+
min: 0,
|
|
2267
|
+
step: 1,
|
|
2268
|
+
label: y(l)("mf-kitchen.editor.size"),
|
|
2269
|
+
"onUpdate:modelValue": v[4] || (v[4] = (b) => D("height", b))
|
|
2270
|
+
}, null, 8, ["model-value", "label"]),
|
|
2271
|
+
V("div", Rl, [
|
|
2272
|
+
V("label", Al, H(y(l)("mf-kitchen.editor.alignment")), 1),
|
|
2273
|
+
V("div", Wl, [
|
|
2274
|
+
V("div", Nl, [
|
|
2275
|
+
(x(), W(we, null, Se(r, (b) => V("div", { key: b }, [
|
|
2276
|
+
S(k, {
|
|
2277
|
+
variant: "tertiary",
|
|
2278
|
+
size: "md",
|
|
2279
|
+
class: "alignButtonBorder",
|
|
2280
|
+
icon: u(b),
|
|
2281
|
+
iconColor: Y(a.value === b),
|
|
2282
|
+
bgColor: B(a.value === b),
|
|
2283
|
+
onClick: (P) => $(b)
|
|
2284
|
+
}, null, 8, ["icon", "iconColor", "bgColor", "onClick"])
|
|
2285
|
+
])), 64))
|
|
2286
|
+
]),
|
|
2287
|
+
V("div", Pl, [
|
|
2288
|
+
(x(), W(we, null, Se(s, (b) => V("div", { key: b }, [
|
|
2289
|
+
S(k, {
|
|
2290
|
+
variant: "tertiary",
|
|
2291
|
+
size: "md",
|
|
2292
|
+
class: "alignButtonBorder",
|
|
2293
|
+
icon: d(b),
|
|
2294
|
+
iconColor: Y(i.value === b),
|
|
2295
|
+
bgColor: B(i.value === b),
|
|
2296
|
+
onClick: (P) => K(b)
|
|
2297
|
+
}, null, 8, ["icon", "iconColor", "bgColor", "onClick"])
|
|
2298
|
+
])), 64))
|
|
2299
|
+
])
|
|
2300
|
+
])
|
|
2301
|
+
])
|
|
2302
|
+
]);
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
});
|
|
2306
|
+
const je = /* @__PURE__ */ Vt(Ll, [["__scopeId", "data-v-4c013ae2"]]), $l = /* @__PURE__ */ ee({
|
|
2307
|
+
__name: "FormatColorButton",
|
|
2308
|
+
props: {
|
|
2309
|
+
isFormatColor: { type: Boolean },
|
|
2310
|
+
selectedFormatColor: {}
|
|
2311
|
+
},
|
|
2312
|
+
emits: ["update:model-value"],
|
|
2313
|
+
setup(e, { emit: o }) {
|
|
2314
|
+
const t = e, n = o;
|
|
2315
|
+
function l(s) {
|
|
2316
|
+
return s ? "neutral-gray-400" : "neutral-gray-300";
|
|
2317
|
+
}
|
|
2318
|
+
function i(s) {
|
|
2319
|
+
return s ? "neutral-gray-100" : "";
|
|
2320
|
+
}
|
|
2321
|
+
function a(s) {
|
|
2322
|
+
const r = s === R.F_PRINT_COLOR.Enum.COLORED ? R.F_PRINT_COLOR.Enum.BLACK : R.F_PRINT_COLOR.Enum.COLORED;
|
|
2323
|
+
n("update:model-value", r);
|
|
2324
|
+
}
|
|
2325
|
+
return (s, r) => {
|
|
2326
|
+
const d = J("FmButton");
|
|
2327
|
+
return x(), ye(d, {
|
|
2328
|
+
variant: "tertiary",
|
|
2329
|
+
size: "md",
|
|
2330
|
+
class: "buttonBorder",
|
|
2331
|
+
icon: "palette",
|
|
2332
|
+
iconColor: l(t.isFormatColor),
|
|
2333
|
+
bgColor: i(t.isFormatColor),
|
|
2334
|
+
onClick: r[0] || (r[0] = (u) => a(t.selectedFormatColor))
|
|
2335
|
+
}, null, 8, ["iconColor", "bgColor"]);
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
const xt = /* @__PURE__ */ Vt($l, [["__scopeId", "data-v-bee8f17f"]]), Bl = { class: "gap" }, Ml = { class: "fm-typo--body-lg-600 mb-2" }, Ul = { class: "fm-typo-en-body-md-600" }, Xl = { class: "flex flex-wrap gap-[8px]" }, zl = { class: "fm-typo-en-body-lg-600" }, Yl = { class: "flex flex-row gap-2" }, Gl = { class: "fm-typo-en-body-lg-600" }, Hl = { class: "flex flex-row gap-2" }, jl = /* @__PURE__ */ ee({
|
|
2340
|
+
__name: "TextWidgetEditor",
|
|
2341
|
+
props: {
|
|
2342
|
+
modelValue: {},
|
|
2343
|
+
sectionType: {},
|
|
2344
|
+
selectedWidgetColumn: {}
|
|
2345
|
+
},
|
|
2346
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2347
|
+
setup(e, { emit: o }) {
|
|
2348
|
+
const t = e, n = o, l = L(() => t.modelValue.textAlign == R.F_TEXT_ALIGN.Enum.LEFT), i = L(() => t.modelValue.textAlign == R.F_TEXT_ALIGN.Enum.CENTER), a = L(() => t.modelValue.textAlign == R.F_TEXT_ALIGN.Enum.RIGHT), s = L(() => t.modelValue.isBold), r = L(() => t.modelValue.isItalic), d = L(() => t.modelValue.isUnderline), u = L(() => t.modelValue.isInvert ?? !1), f = L(() => t.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK), c = L(() => f.value == R.F_PRINT_COLOR.Enum.COLORED), m = j(it.receipt.schema()), { t: E, locale: T } = me();
|
|
2349
|
+
function D(B, h) {
|
|
2350
|
+
n("update:model-value", {
|
|
2351
|
+
...t.modelValue,
|
|
2352
|
+
[B]: h
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
function M(B) {
|
|
2356
|
+
n("update:selected-widget-column", {
|
|
2357
|
+
...t.selectedWidgetColumn,
|
|
2358
|
+
...B
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
function K(B) {
|
|
2362
|
+
let h = R.F_WIDGET_ALIGNMENT.Enum.CENTER;
|
|
2363
|
+
switch (B) {
|
|
2364
|
+
case R.F_TEXT_ALIGN.Enum.LEFT:
|
|
2365
|
+
h = R.F_WIDGET_ALIGNMENT.Enum.CENTER_LEFT;
|
|
2366
|
+
break;
|
|
2367
|
+
case R.F_TEXT_ALIGN.Enum.CENTER:
|
|
2368
|
+
h = R.F_WIDGET_ALIGNMENT.Enum.CENTER;
|
|
2369
|
+
break;
|
|
2370
|
+
case R.F_TEXT_ALIGN.Enum.RIGHT:
|
|
2371
|
+
h = R.F_WIDGET_ALIGNMENT.Enum.CENTER_RIGHT;
|
|
2372
|
+
break;
|
|
2373
|
+
}
|
|
2374
|
+
n("update:model-value", {
|
|
2375
|
+
...t.modelValue,
|
|
2376
|
+
alignment: h,
|
|
2377
|
+
textAlign: B
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
function $(B) {
|
|
2381
|
+
return B ? "neutral-gray-400" : "neutral-gray-300";
|
|
2382
|
+
}
|
|
2383
|
+
function N(B) {
|
|
2384
|
+
return B ? "neutral-gray-100" : "";
|
|
2385
|
+
}
|
|
2386
|
+
function Y(B) {
|
|
2387
|
+
const h = (t.modelValue.value || "") + `${B}`;
|
|
2388
|
+
D("value", h);
|
|
2389
|
+
}
|
|
2390
|
+
return Ge(
|
|
2391
|
+
() => T.value,
|
|
2392
|
+
() => {
|
|
2393
|
+
m.value = it.receipt.schema();
|
|
2394
|
+
}
|
|
2395
|
+
), (B, h) => {
|
|
2396
|
+
const v = J("FmTextField"), _ = J("FmButton");
|
|
2397
|
+
return x(), W("div", Bl, [
|
|
2398
|
+
V("label", Ml, H(y(E)("mf-kitchen.editor.textWidget")), 1),
|
|
2399
|
+
S(je, {
|
|
2400
|
+
"model-value": B.modelValue,
|
|
2401
|
+
"selected-widget-column": B.selectedWidgetColumn,
|
|
2402
|
+
"onUpdate:modelValue": h[0] || (h[0] = (p) => n("update:model-value", {
|
|
2403
|
+
...B.modelValue,
|
|
2404
|
+
...p
|
|
2405
|
+
})),
|
|
2406
|
+
"onUpdate:selectedWidgetColumn": h[1] || (h[1] = (p) => M(p))
|
|
2407
|
+
}, null, 8, ["model-value", "selected-widget-column"]),
|
|
2408
|
+
V("label", Ul, H(y(E)("mf-kitchen.editor.editor")), 1),
|
|
2409
|
+
S(v, {
|
|
2410
|
+
"model-value": B.modelValue.value,
|
|
2411
|
+
label: y(E)("mf-kitchen.editor.text"),
|
|
2412
|
+
"onUpdate:modelValue": h[2] || (h[2] = (p) => D("value", p))
|
|
2413
|
+
}, null, 8, ["model-value", "label"]),
|
|
2414
|
+
V("div", Xl, [
|
|
2415
|
+
(x(!0), W(we, null, Se(m.value[B.sectionType], (p, k) => (x(), W("div", { key: k }, [
|
|
2416
|
+
S(_, {
|
|
2417
|
+
variant: "tertiary",
|
|
2418
|
+
size: "md",
|
|
2419
|
+
label: p.label,
|
|
2420
|
+
bgColor: "neutral-gray-100",
|
|
2421
|
+
onClick: (C) => Y(p.variable)
|
|
2422
|
+
}, null, 8, ["label", "onClick"])
|
|
2423
|
+
]))), 128))
|
|
2424
|
+
]),
|
|
2425
|
+
S(v, {
|
|
2426
|
+
"model-value": B.modelValue.factor,
|
|
2427
|
+
label: y(E)("mf-kitchen.editor.scale"),
|
|
2428
|
+
type: "number",
|
|
2429
|
+
rules: [(p) => p >= 0.1 || y(E)("mf-kitchen.editor.validation.scale")],
|
|
2430
|
+
"onUpdate:modelValue": h[3] || (h[3] = (p) => {
|
|
2431
|
+
const k = Math.max(0.1, Number(p));
|
|
2432
|
+
D("factor", k);
|
|
2433
|
+
})
|
|
2434
|
+
}, null, 8, ["model-value", "label", "rules"]),
|
|
2435
|
+
V("label", zl, H(y(E)("mf-kitchen.editor.textAlignment")), 1),
|
|
2436
|
+
V("div", Yl, [
|
|
2437
|
+
S(_, {
|
|
2438
|
+
variant: "tertiary",
|
|
2439
|
+
size: "md",
|
|
2440
|
+
class: "buttonBorder",
|
|
2441
|
+
icon: "format_align_left",
|
|
2442
|
+
iconColor: $(l.value),
|
|
2443
|
+
bgColor: N(l.value),
|
|
2444
|
+
onClick: h[4] || (h[4] = (p) => K(y(R.F_TEXT_ALIGN).Enum.LEFT))
|
|
2445
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2446
|
+
S(_, {
|
|
2447
|
+
variant: "tertiary",
|
|
2448
|
+
size: "md",
|
|
2449
|
+
class: "buttonBorder",
|
|
2450
|
+
icon: "format_align_center",
|
|
2451
|
+
iconColor: $(i.value),
|
|
2452
|
+
bgColor: N(i.value),
|
|
2453
|
+
onClick: h[5] || (h[5] = (p) => K(y(R.F_TEXT_ALIGN).Enum.CENTER))
|
|
2454
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2455
|
+
S(_, {
|
|
2456
|
+
variant: "tertiary",
|
|
2457
|
+
size: "md",
|
|
2458
|
+
class: "buttonBorder",
|
|
2459
|
+
icon: "format_align_right",
|
|
2460
|
+
iconColor: $(a.value),
|
|
2461
|
+
bgColor: N(a.value),
|
|
2462
|
+
onClick: h[6] || (h[6] = (p) => K(y(R.F_TEXT_ALIGN).Enum.RIGHT))
|
|
2463
|
+
}, null, 8, ["iconColor", "bgColor"])
|
|
2464
|
+
]),
|
|
2465
|
+
V("label", Gl, H(y(E)("mf-kitchen.editor.textStyle")), 1),
|
|
2466
|
+
V("div", Hl, [
|
|
2467
|
+
S(_, {
|
|
2468
|
+
variant: "tertiary",
|
|
2469
|
+
size: "md",
|
|
2470
|
+
class: "buttonBorder",
|
|
2471
|
+
icon: "format_bold",
|
|
2472
|
+
iconColor: $(s.value),
|
|
2473
|
+
bgColor: N(s.value),
|
|
2474
|
+
onClick: h[7] || (h[7] = (p) => D("isBold", !t.modelValue.isBold))
|
|
2475
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2476
|
+
S(_, {
|
|
2477
|
+
variant: "tertiary",
|
|
2478
|
+
size: "md",
|
|
2479
|
+
class: "buttonBorder",
|
|
2480
|
+
icon: "format_italic",
|
|
2481
|
+
iconColor: $(r.value),
|
|
2482
|
+
bgColor: N(r.value),
|
|
2483
|
+
onClick: h[8] || (h[8] = (p) => D("isItalic", !t.modelValue.isItalic))
|
|
2484
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2485
|
+
S(_, {
|
|
2486
|
+
variant: "tertiary",
|
|
2487
|
+
size: "md",
|
|
2488
|
+
class: "buttonBorder",
|
|
2489
|
+
icon: "format_underlined",
|
|
2490
|
+
iconColor: $(d.value),
|
|
2491
|
+
bgColor: N(d.value),
|
|
2492
|
+
onClick: h[9] || (h[9] = (p) => D("isUnderline", !t.modelValue.isUnderline))
|
|
2493
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2494
|
+
S(_, {
|
|
2495
|
+
variant: "tertiary",
|
|
2496
|
+
size: "md",
|
|
2497
|
+
class: "buttonBorder",
|
|
2498
|
+
icon: "ink_highlighter",
|
|
2499
|
+
iconColor: $(u.value),
|
|
2500
|
+
bgColor: N(u.value),
|
|
2501
|
+
onClick: h[10] || (h[10] = (p) => D("isInvert", !t.modelValue.isInvert))
|
|
2502
|
+
}, null, 8, ["iconColor", "bgColor"]),
|
|
2503
|
+
S(xt, {
|
|
2504
|
+
"is-format-color": c.value,
|
|
2505
|
+
"selected-format-color": f.value,
|
|
2506
|
+
"onUpdate:modelValue": h[11] || (h[11] = (p) => D("color", p))
|
|
2507
|
+
}, null, 8, ["is-format-color", "selected-format-color"])
|
|
2508
|
+
])
|
|
2509
|
+
]);
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
const Kl = /* @__PURE__ */ Vt(jl, [["__scopeId", "data-v-3d715f0b"]]), ql = { class: "gap" }, Jl = { class: "fm-typo--body-lg-600 mb-2" }, Zl = { class: "fm-typo-en-body-md-600" }, Ql = { class: "fm-typo-en-body-lg-600" }, ei = /* @__PURE__ */ ee({
|
|
2514
|
+
__name: "CheckboxWidgetEditor",
|
|
2515
|
+
props: {
|
|
2516
|
+
modelValue: {},
|
|
2517
|
+
selectedWidgetColumn: {}
|
|
2518
|
+
},
|
|
2519
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2520
|
+
setup(e, { emit: o }) {
|
|
2521
|
+
const t = e, n = o, { t: l } = me(), i = L(() => t.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK), a = L(() => i.value == R.F_PRINT_COLOR.Enum.COLORED);
|
|
2522
|
+
function s(d) {
|
|
2523
|
+
n("update:selected-widget-column", {
|
|
2524
|
+
...t.selectedWidgetColumn,
|
|
2525
|
+
...d
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
function r(d) {
|
|
2529
|
+
n("update:model-value", {
|
|
2530
|
+
...t.modelValue,
|
|
2531
|
+
size: d
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
return (d, u) => {
|
|
2535
|
+
const f = J("FmTextField");
|
|
2536
|
+
return x(), W("div", ql, [
|
|
2537
|
+
V("label", Jl, H(y(l)("mf-kitchen.editor.checkboxWidget")), 1),
|
|
2538
|
+
S(je, {
|
|
2539
|
+
"model-value": {
|
|
2540
|
+
padding: d.modelValue.padding,
|
|
2541
|
+
alignment: d.modelValue.alignment,
|
|
2542
|
+
height: d.modelValue.height,
|
|
2543
|
+
type: d.modelValue.type
|
|
2544
|
+
},
|
|
2545
|
+
"selected-widget-column": d.selectedWidgetColumn,
|
|
2546
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => n("update:model-value", { ...d.modelValue, ...c })),
|
|
2547
|
+
"onUpdate:selectedWidgetColumn": u[1] || (u[1] = (c) => s(c))
|
|
2548
|
+
}, null, 8, ["model-value", "selected-widget-column"]),
|
|
2549
|
+
V("label", Zl, H(y(l)("mf-kitchen.editor.editor")), 1),
|
|
2550
|
+
S(f, {
|
|
2551
|
+
"model-value": d.modelValue.size,
|
|
2552
|
+
label: y(l)("mf-kitchen.editor.size"),
|
|
2553
|
+
type: "number",
|
|
2554
|
+
rules: [(c) => c >= 1 || y(l)("mf-kitchen.editor.validation.minOne")],
|
|
2555
|
+
"onUpdate:modelValue": u[2] || (u[2] = (c) => {
|
|
2556
|
+
const m = Math.max(1, Number(c));
|
|
2557
|
+
r(m);
|
|
2558
|
+
})
|
|
2559
|
+
}, null, 8, ["model-value", "label", "rules"]),
|
|
2560
|
+
V("label", Ql, H(y(l)("mf-kitchen.editor.textStyle")), 1),
|
|
2561
|
+
S(xt, {
|
|
2562
|
+
class: "w-fit",
|
|
2563
|
+
"is-format-color": a.value,
|
|
2564
|
+
"selected-format-color": i.value,
|
|
2565
|
+
"onUpdate:modelValue": u[3] || (u[3] = (c) => n("update:model-value", { ...d.modelValue, color: c }))
|
|
2566
|
+
}, null, 8, ["is-format-color", "selected-format-color"])
|
|
2567
|
+
]);
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
}), ti = { class: "gap" }, oi = { class: "fm-typo--body-lg-600 mb-2" }, ni = /* @__PURE__ */ ee({
|
|
2571
|
+
__name: "SpacerWidgetEditor",
|
|
2572
|
+
props: {
|
|
2573
|
+
modelValue: {},
|
|
2574
|
+
selectedWidgetColumn: {}
|
|
2575
|
+
},
|
|
2576
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2577
|
+
setup(e, { emit: o }) {
|
|
2578
|
+
const t = e, n = o, { t: l } = me();
|
|
2579
|
+
function i(a) {
|
|
2580
|
+
n("update:selected-widget-column", {
|
|
2581
|
+
...t.selectedWidgetColumn,
|
|
2582
|
+
...a
|
|
2583
|
+
});
|
|
2584
|
+
}
|
|
2585
|
+
return (a, s) => (x(), W("div", ti, [
|
|
2586
|
+
V("label", oi, H(y(l)("mf-kitchen.editor.spacerWidget")), 1),
|
|
2587
|
+
S(je, {
|
|
2588
|
+
"model-value": {
|
|
2589
|
+
padding: a.modelValue.padding,
|
|
2590
|
+
alignment: a.modelValue.alignment,
|
|
2591
|
+
height: a.modelValue.height,
|
|
2592
|
+
type: a.modelValue.type
|
|
2593
|
+
},
|
|
2594
|
+
"selected-widget-column": a.selectedWidgetColumn,
|
|
2595
|
+
"onUpdate:modelValue": s[0] || (s[0] = (r) => n("update:model-value", { ...a.modelValue, ...r })),
|
|
2596
|
+
"onUpdate:selectedWidgetColumn": s[1] || (s[1] = (r) => i(r))
|
|
2597
|
+
}, null, 8, ["model-value", "selected-widget-column"])
|
|
2598
|
+
]));
|
|
2599
|
+
}
|
|
2600
|
+
}), li = { class: "gap" }, ii = { class: "fm-typo-en-body-lg-600 mb-2" }, ai = { class: "fm-typo-en-body-md-600" }, ri = { class: "flex flex-row gap-[24px]" }, si = /* @__PURE__ */ ee({
|
|
2601
|
+
__name: "ImageWidgetEditor",
|
|
2602
|
+
props: {
|
|
2603
|
+
modelValue: {},
|
|
2604
|
+
selectedWidgetColumn: {}
|
|
2605
|
+
},
|
|
2606
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2607
|
+
setup(e, { emit: o }) {
|
|
2608
|
+
const t = e, n = o, { t: l } = me();
|
|
2609
|
+
function i(r) {
|
|
2610
|
+
n("update:model-value", r(t.modelValue));
|
|
2611
|
+
}
|
|
2612
|
+
function a(r, d) {
|
|
2613
|
+
n("update:model-value", { ...t.modelValue, [r]: d });
|
|
2614
|
+
}
|
|
2615
|
+
function s(r) {
|
|
2616
|
+
n("update:selected-widget-column", {
|
|
2617
|
+
...t.selectedWidgetColumn,
|
|
2618
|
+
...r
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
return (r, d) => {
|
|
2622
|
+
const u = J("FmTextField");
|
|
2623
|
+
return x(), W("div", li, [
|
|
2624
|
+
V("label", ii, H(y(l)("mf-kitchen.editor.imageWidget")), 1),
|
|
2625
|
+
S(je, {
|
|
2626
|
+
"model-value": {
|
|
2627
|
+
padding: r.modelValue.padding,
|
|
2628
|
+
alignment: r.modelValue.alignment,
|
|
2629
|
+
height: r.modelValue.height,
|
|
2630
|
+
type: r.modelValue.type
|
|
2631
|
+
},
|
|
2632
|
+
"selected-widget-column": r.selectedWidgetColumn,
|
|
2633
|
+
"onUpdate:modelValue": d[0] || (d[0] = (f) => n("update:model-value", { ...r.modelValue, ...f })),
|
|
2634
|
+
"onUpdate:selectedWidgetColumn": d[1] || (d[1] = (f) => s(f))
|
|
2635
|
+
}, null, 8, ["model-value", "selected-widget-column"]),
|
|
2636
|
+
V("label", ai, H(y(l)("mf-kitchen.editor.editor")), 1),
|
|
2637
|
+
S(sn, {
|
|
2638
|
+
"model-value": r.modelValue.imgData,
|
|
2639
|
+
"onUpdate:modelValue": d[2] || (d[2] = (f) => i((c) => ({ ...c, imgData: f }))),
|
|
2640
|
+
title: y(l)("mf-kitchen.editor.image")
|
|
2641
|
+
}, null, 8, ["model-value", "title"]),
|
|
2642
|
+
V("div", ri, [
|
|
2643
|
+
S(u, {
|
|
2644
|
+
"model-value": r.modelValue.height,
|
|
2645
|
+
label: y(l)("mf-kitchen.editor.height"),
|
|
2646
|
+
type: "number",
|
|
2647
|
+
rules: [(f) => f >= 1 || y(l)("mf-kitchen.editor.validation.minOne")],
|
|
2648
|
+
"onUpdate:modelValue": d[3] || (d[3] = (f) => {
|
|
2649
|
+
const c = Math.max(1, Number(f));
|
|
2650
|
+
a("height", c);
|
|
2651
|
+
})
|
|
2652
|
+
}, null, 8, ["model-value", "label", "rules"]),
|
|
2653
|
+
S(u, {
|
|
2654
|
+
"model-value": r.modelValue.width,
|
|
2655
|
+
label: y(l)("mf-kitchen.editor.width"),
|
|
2656
|
+
type: "number",
|
|
2657
|
+
rules: [(f) => f >= 1 || y(l)("mf-kitchen.editor.validation.minOne")],
|
|
2658
|
+
"onUpdate:modelValue": d[4] || (d[4] = (f) => {
|
|
2659
|
+
const c = Math.max(1, Number(f));
|
|
2660
|
+
a("width", c);
|
|
2661
|
+
})
|
|
2662
|
+
}, null, 8, ["model-value", "label", "rules"])
|
|
2663
|
+
])
|
|
2664
|
+
]);
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
}), di = { class: "gap" }, ui = { class: "fm-typo--body-lg-600 mb-2" }, ci = { class: "fm-typo-en-body-md-600" }, mi = { class: "flex flex-wrap gap-[8px]" }, pi = { class: "fm-typo-en-body-lg-600" }, fi = /* @__PURE__ */ ee({
|
|
2668
|
+
__name: "QrCodeWidgetEditor",
|
|
2669
|
+
props: {
|
|
2670
|
+
modelValue: {},
|
|
2671
|
+
sectionType: {},
|
|
2672
|
+
selectedWidgetColumn: {}
|
|
2673
|
+
},
|
|
2674
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2675
|
+
setup(e, { emit: o }) {
|
|
2676
|
+
const t = e, n = o, l = L(() => t.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK), i = L(() => l.value == R.F_PRINT_COLOR.Enum.COLORED), a = it.receipt.schema(), { t: s } = me();
|
|
2677
|
+
function r(c) {
|
|
2678
|
+
n("update:model-value", { ...t.modelValue, link: c });
|
|
2679
|
+
}
|
|
2680
|
+
function d(c) {
|
|
2681
|
+
n("update:selected-widget-column", {
|
|
2682
|
+
...t.selectedWidgetColumn,
|
|
2683
|
+
...c
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
function u(c) {
|
|
2687
|
+
const m = (t.modelValue.link || "") + `${c}`;
|
|
2688
|
+
r(m);
|
|
2689
|
+
}
|
|
2690
|
+
function f(c) {
|
|
2691
|
+
const m = {
|
|
2692
|
+
...t.modelValue,
|
|
2693
|
+
...c
|
|
2694
|
+
};
|
|
2695
|
+
if ("height" in c) {
|
|
2696
|
+
const E = c.height === null ? 160 : c.height;
|
|
2697
|
+
m.height = E, m.size = E;
|
|
2698
|
+
}
|
|
2699
|
+
n("update:model-value", m);
|
|
2700
|
+
}
|
|
2701
|
+
return (c, m) => {
|
|
2702
|
+
const E = J("FmTextField"), T = J("FmButton");
|
|
2703
|
+
return x(), W("div", di, [
|
|
2704
|
+
V("label", ui, H(y(s)("mf-kitchen.editor.qrCodeWidget")), 1),
|
|
2705
|
+
S(je, {
|
|
2706
|
+
"model-value": {
|
|
2707
|
+
padding: c.modelValue.padding,
|
|
2708
|
+
alignment: c.modelValue.alignment,
|
|
2709
|
+
height: c.modelValue.height,
|
|
2710
|
+
type: c.modelValue.type
|
|
2711
|
+
},
|
|
2712
|
+
"selected-widget-column": c.selectedWidgetColumn,
|
|
2713
|
+
"onUpdate:modelValue": m[0] || (m[0] = (D) => f(D)),
|
|
2714
|
+
"onUpdate:selectedWidgetColumn": m[1] || (m[1] = (D) => d(D))
|
|
2715
|
+
}, null, 8, ["model-value", "selected-widget-column"]),
|
|
2716
|
+
V("label", ci, H(y(s)("mf-kitchen.editor.editor")), 1),
|
|
2717
|
+
S(E, {
|
|
2718
|
+
"model-value": c.modelValue.link,
|
|
2719
|
+
label: y(s)("mf-kitchen.editor.text"),
|
|
2720
|
+
"onUpdate:modelValue": m[2] || (m[2] = (D) => r(D))
|
|
2721
|
+
}, null, 8, ["model-value", "label"]),
|
|
2722
|
+
V("div", mi, [
|
|
2723
|
+
(x(!0), W(we, null, Se(y(a)[c.sectionType], (D, M) => (x(), W("div", { key: M }, [
|
|
2724
|
+
S(T, {
|
|
2725
|
+
variant: "tertiary",
|
|
2726
|
+
size: "md",
|
|
2727
|
+
label: y(s)(`${D.label}`),
|
|
2728
|
+
bgColor: "neutral-gray-100",
|
|
2729
|
+
onClick: (K) => u(D.variable)
|
|
2730
|
+
}, null, 8, ["label", "onClick"])
|
|
2731
|
+
]))), 128))
|
|
2732
|
+
]),
|
|
2733
|
+
V("label", pi, H(y(s)("mf-kitchen.editor.textStyle")), 1),
|
|
2734
|
+
S(xt, {
|
|
2735
|
+
class: "w-fit",
|
|
2736
|
+
"is-format-color": i.value,
|
|
2737
|
+
"selected-format-color": l.value,
|
|
2738
|
+
"onUpdate:modelValue": m[3] || (m[3] = (D) => n("update:model-value", { ...c.modelValue, color: D }))
|
|
2739
|
+
}, null, 8, ["is-format-color", "selected-format-color"])
|
|
2740
|
+
]);
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
}), gi = { class: "gap" }, vi = { class: "fm-typo--body-lg-600 mb-2" }, hi = { class: "fm-typo-en-body-md-600" }, bi = { class: "fm-typo-en-body-lg-600" }, yi = /* @__PURE__ */ ee({
|
|
2744
|
+
__name: "DividerWidgetEditor",
|
|
2745
|
+
props: {
|
|
2746
|
+
modelValue: {},
|
|
2747
|
+
selectedWidgetColumn: {}
|
|
2748
|
+
},
|
|
2749
|
+
emits: ["update:model-value", "update:selected-widget-column"],
|
|
2750
|
+
setup(e, { emit: o }) {
|
|
2751
|
+
const t = e, n = o, { t: l } = me(), i = L(() => t.modelValue.color ?? R.F_PRINT_COLOR.Enum.BLACK), a = L(() => i.value == R.F_PRINT_COLOR.Enum.COLORED);
|
|
2752
|
+
function s(d) {
|
|
2753
|
+
n("update:selected-widget-column", {
|
|
2754
|
+
...t.selectedWidgetColumn,
|
|
2755
|
+
...d
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
function r(d) {
|
|
2759
|
+
n("update:model-value", {
|
|
2760
|
+
...t.modelValue,
|
|
2761
|
+
thickness: d
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
return (d, u) => {
|
|
2765
|
+
const f = J("FmTextField");
|
|
2766
|
+
return x(), W("div", gi, [
|
|
2767
|
+
V("label", vi, H(y(l)("mf-kitchen.editor.dividerWidget")), 1),
|
|
2768
|
+
S(je, {
|
|
2769
|
+
"model-value": {
|
|
2770
|
+
padding: d.modelValue.padding,
|
|
2771
|
+
alignment: d.modelValue.alignment,
|
|
2772
|
+
height: d.modelValue.height,
|
|
2773
|
+
type: d.modelValue.type
|
|
2774
|
+
},
|
|
2775
|
+
"selected-widget-column": d.selectedWidgetColumn,
|
|
2776
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => n("update:model-value", { ...d.modelValue, ...c })),
|
|
2777
|
+
"onUpdate:selectedWidgetColumn": u[1] || (u[1] = (c) => s(c))
|
|
2778
|
+
}, null, 8, ["model-value", "selected-widget-column"]),
|
|
2779
|
+
V("label", hi, H(y(l)("mf-kitchen.editor.editor")), 1),
|
|
2780
|
+
S(f, {
|
|
2781
|
+
"model-value": d.modelValue.thickness,
|
|
2782
|
+
label: y(l)("mf-kitchen.editor.thickness"),
|
|
2783
|
+
type: "number",
|
|
2784
|
+
rules: [(c) => c >= 1 || y(l)("mf-kitchen.editor.validation.minOne")],
|
|
2785
|
+
"onUpdate:modelValue": u[2] || (u[2] = (c) => {
|
|
2786
|
+
const m = Math.max(1, Number(c));
|
|
2787
|
+
r(m);
|
|
2788
|
+
})
|
|
2789
|
+
}, null, 8, ["model-value", "label", "rules"]),
|
|
2790
|
+
V("label", bi, H(y(l)("mf-kitchen.editor.textStyle")), 1),
|
|
2791
|
+
S(xt, {
|
|
2792
|
+
class: "w-fit",
|
|
2793
|
+
"is-format-color": a.value,
|
|
2794
|
+
"selected-format-color": i.value,
|
|
2795
|
+
"onUpdate:modelValue": u[3] || (u[3] = (c) => n("update:model-value", { ...d.modelValue, color: c }))
|
|
2796
|
+
}, null, 8, ["is-format-color", "selected-format-color"])
|
|
2797
|
+
]);
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2800
|
+
}), _i = { class: "px-[24px] py-[16px] overflow-y-auto" }, Ci = { key: 0 }, Ei = { key: 1 }, Ti = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary mb-3" }, wi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Si = /* @__PURE__ */ ee({
|
|
2801
|
+
__name: "EditingPanel",
|
|
2802
|
+
props: {
|
|
2803
|
+
selectedWidget: {},
|
|
2804
|
+
selectedWidgetSectionType: {},
|
|
2805
|
+
selectedWidgetColumn: {}
|
|
2806
|
+
},
|
|
2807
|
+
emits: ["update:widget", "update:selected-widget-column"],
|
|
2808
|
+
setup(e, { emit: o }) {
|
|
2809
|
+
const t = e, n = o, { t: l } = me(), i = {
|
|
2810
|
+
TEXT: Kl,
|
|
2811
|
+
CHECKBOX: ei,
|
|
2812
|
+
EMPTY: ni,
|
|
2813
|
+
IMAGE: si,
|
|
2814
|
+
QR: fi,
|
|
2815
|
+
DIVIDER: yi
|
|
2816
|
+
}, a = L(() => t.selectedWidget ? i[t.selectedWidget.config.data.type] : null);
|
|
2817
|
+
function s(d) {
|
|
2818
|
+
if (t.selectedWidget) {
|
|
2819
|
+
const u = { ...t.selectedWidget };
|
|
2820
|
+
u.config = {
|
|
2821
|
+
...u.config,
|
|
2822
|
+
data: {
|
|
2823
|
+
...u.config.data,
|
|
2824
|
+
...d
|
|
2825
|
+
}
|
|
2826
|
+
}, n("update:widget", u);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
function r(d) {
|
|
2830
|
+
n("update:selected-widget-column", d);
|
|
2831
|
+
}
|
|
2832
|
+
return (d, u) => (x(), W("div", _i, [
|
|
2833
|
+
d.selectedWidget ? (x(), W("div", Ci, [
|
|
2834
|
+
a.value ? (x(), ye(Eo(a.value), {
|
|
2835
|
+
key: 0,
|
|
2836
|
+
"model-value": d.selectedWidget.config.data,
|
|
2837
|
+
"section-type": d.selectedWidgetSectionType,
|
|
2838
|
+
"selected-widget-column": d.selectedWidgetColumn,
|
|
2839
|
+
"onUpdate:modelValue": s,
|
|
2840
|
+
"onUpdate:selectedWidgetColumn": r
|
|
2841
|
+
}, null, 40, ["model-value", "section-type", "selected-widget-column"])) : Ue("", !0)
|
|
2842
|
+
])) : (x(), W("div", Ei, [
|
|
2843
|
+
V("h2", Ti, H(y(l)("mf-kitchen.designPanel")), 1),
|
|
2844
|
+
V("p", wi, H(y(l)("mf-kitchen.editorDescription")), 1)
|
|
2845
|
+
]))
|
|
2846
|
+
]));
|
|
2847
|
+
}
|
|
2848
|
+
}), Vi = { class: "gap" }, ki = { class: "fm-typo-en-body-lg-600" }, xi = /* @__PURE__ */ ee({
|
|
2849
|
+
__name: "WidgetsComponent",
|
|
2850
|
+
emits: ["removeSelectedWidget"],
|
|
2851
|
+
setup(e, { emit: o }) {
|
|
2852
|
+
const t = o, { t: n } = me(), l = L(() => [
|
|
2853
|
+
{ data: dn(), name: n("mf-kitchen.editor.spacer"), icon: "add" },
|
|
2854
|
+
{ data: To(), name: n("mf-kitchen.editor.text"), icon: "title" },
|
|
2855
|
+
{ data: un(), name: n("mf-kitchen.editor.checkbox"), icon: "check_box" },
|
|
2856
|
+
{ data: cn(), name: n("mf-kitchen.editor.divider"), icon: "horizontal_rule" },
|
|
2857
|
+
{ data: mn(), name: n("mf-kitchen.editor.image"), icon: "image" },
|
|
2858
|
+
{ data: pn(), name: n("mf-kitchen.editor.qrCode"), icon: "qr_code_scanner" }
|
|
2859
|
+
]), i = (s) => ({ ...s });
|
|
2860
|
+
function a() {
|
|
2861
|
+
t("removeSelectedWidget", !0);
|
|
2862
|
+
}
|
|
2863
|
+
return (s, r) => {
|
|
2864
|
+
const d = J("FmIcon"), u = J("FmCardSection"), f = J("FmCard"), c = J("v-list");
|
|
2865
|
+
return x(), W("div", Vi, [
|
|
2866
|
+
V("label", ki, H(y(n)("mf-kitchen.editor.widget_plural")), 1),
|
|
2867
|
+
S(c, null, {
|
|
2868
|
+
default: be(() => [
|
|
2869
|
+
S(y(lt), {
|
|
2870
|
+
modelValue: l.value,
|
|
2871
|
+
"onUpdate:modelValue": r[0] || (r[0] = (m) => l.value = m),
|
|
2872
|
+
"item-key": "id",
|
|
2873
|
+
group: { name: "widgets", pull: "clone", put: !1 },
|
|
2874
|
+
sort: !1,
|
|
2875
|
+
clone: i,
|
|
2876
|
+
onStart: a,
|
|
2877
|
+
class: "grid grid-cols-2 gap-x-[24px] gap-y-[15px] cursor-grab"
|
|
2878
|
+
}, {
|
|
2879
|
+
default: be(() => [
|
|
2880
|
+
(x(!0), W(we, null, Se(l.value, (m) => (x(), W("div", {
|
|
2881
|
+
key: m.name
|
|
2882
|
+
}, [
|
|
2883
|
+
S(f, {
|
|
2884
|
+
variant: "outlined",
|
|
2885
|
+
class: "flex flex-col justify-center items-center p-[16px]"
|
|
2886
|
+
}, {
|
|
2887
|
+
default: be(() => [
|
|
2888
|
+
S(d, {
|
|
2889
|
+
name: m.icon,
|
|
2890
|
+
size: "md",
|
|
2891
|
+
class: "mb-[5px] text-fm-color-neutral-gray-400"
|
|
2892
|
+
}, null, 8, ["name"]),
|
|
2893
|
+
S(u, { class: "p-0" }, {
|
|
2894
|
+
default: be(() => [
|
|
2895
|
+
en(H(m.name), 1)
|
|
2896
|
+
]),
|
|
2897
|
+
_: 2
|
|
2898
|
+
}, 1024)
|
|
2899
|
+
]),
|
|
2900
|
+
_: 2
|
|
2901
|
+
}, 1024)
|
|
2902
|
+
]))), 128))
|
|
2903
|
+
]),
|
|
2904
|
+
_: 1
|
|
2905
|
+
}, 8, ["modelValue"])
|
|
2906
|
+
]),
|
|
2907
|
+
_: 1
|
|
2908
|
+
})
|
|
2909
|
+
]);
|
|
2910
|
+
};
|
|
2911
|
+
}
|
|
2912
|
+
}), Di = { class: "flex flex-col justify-between w-[420px]" }, Ii = { class: "flex flex-col px-[24px] py-[16px] overflow-y-auto gap-24" }, Fi = { class: "flex flex-col gap-2" }, Oi = { class: "fm-typo-en-body-lg-600" }, Ri = { class: "fm-typo-en-body-lg-600" }, Ai = { class: "p-[16px] fm-shadow-light-300" }, Wi = /* @__PURE__ */ ee({
|
|
2913
|
+
__name: "AdvanceModeLeftPanel",
|
|
2914
|
+
props: {
|
|
2915
|
+
receiptInfo: {},
|
|
2916
|
+
template: {},
|
|
2917
|
+
selectedWidgetSectionType: {}
|
|
2918
|
+
},
|
|
2919
|
+
emits: ["updateReceiptInfo", "updateReceiptTemplate", "reset", "removeSelectedWidget", "variableSectionType"],
|
|
2920
|
+
setup(e, { emit: o }) {
|
|
2921
|
+
const t = e, n = o, l = fn(() => {
|
|
2922
|
+
n("reset");
|
|
2923
|
+
}), { t: i, locale: a } = me(), s = j(it.receipt.schema()), r = L(
|
|
2924
|
+
() => Object.entries(s.value).flatMap(
|
|
2925
|
+
([E, T]) => T.map((D) => ({
|
|
2926
|
+
...D,
|
|
2927
|
+
sectionType: E
|
|
2928
|
+
}))
|
|
2929
|
+
)
|
|
2930
|
+
), d = L(
|
|
2931
|
+
() => r.value.map((E) => ({
|
|
2932
|
+
data: {
|
|
2933
|
+
...To(),
|
|
2934
|
+
value: E.variable
|
|
2935
|
+
},
|
|
2936
|
+
name: E.label,
|
|
2937
|
+
sectionType: E.sectionType
|
|
2938
|
+
}))
|
|
2939
|
+
), u = L(
|
|
2940
|
+
() => t.selectedWidgetSectionType ? d.value.filter((E) => E.sectionType === t.selectedWidgetSectionType) : d.value
|
|
2941
|
+
);
|
|
2942
|
+
function f(E) {
|
|
2943
|
+
return JSON.parse(JSON.stringify(E));
|
|
2944
|
+
}
|
|
2945
|
+
function c(E) {
|
|
2946
|
+
n("updateReceiptTemplate", E(t.template));
|
|
2947
|
+
}
|
|
2948
|
+
function m(E) {
|
|
2949
|
+
const T = u.value[E.oldIndex];
|
|
2950
|
+
n("variableSectionType", T.sectionType);
|
|
2951
|
+
}
|
|
2952
|
+
return Ge(
|
|
2953
|
+
() => a.value,
|
|
2954
|
+
() => {
|
|
2955
|
+
s.value = it.receipt.schema();
|
|
2956
|
+
}
|
|
2957
|
+
), (E, T) => {
|
|
2958
|
+
var $;
|
|
2959
|
+
const D = J("FmStepperField"), M = J("FmButton"), K = J("v-list");
|
|
2960
|
+
return x(), W("div", Di, [
|
|
2961
|
+
V("div", Ii, [
|
|
2962
|
+
V("div", Fi, [
|
|
2963
|
+
V("label", Oi, H(y(i)("mf-kitchen.receiptSetting")), 1),
|
|
2964
|
+
E.receiptInfo ? (x(), ye(gn, {
|
|
2965
|
+
key: 0,
|
|
2966
|
+
"model-value": E.receiptInfo,
|
|
2967
|
+
"onUpdate:modelValue": T[0] || (T[0] = (N) => n("updateReceiptInfo", N))
|
|
2968
|
+
}, null, 8, ["model-value"])) : Ue("", !0)
|
|
2969
|
+
]),
|
|
2970
|
+
S(D, {
|
|
2971
|
+
"model-value": (($ = t.template) == null ? void 0 : $.fontSize) ?? 12,
|
|
2972
|
+
max: 40,
|
|
2973
|
+
min: 1,
|
|
2974
|
+
step: 1,
|
|
2975
|
+
label: y(i)("mf-kitchen.editor.overallFontSize"),
|
|
2976
|
+
rules: [(N) => N <= 40 || "More than 40"],
|
|
2977
|
+
"onUpdate:modelValue": T[1] || (T[1] = (N) => {
|
|
2978
|
+
const Y = Math.min(N, 40);
|
|
2979
|
+
c((B) => ({ ...B, fontSize: Y }));
|
|
2980
|
+
})
|
|
2981
|
+
}, null, 8, ["model-value", "label", "rules"]),
|
|
2982
|
+
S(xi, {
|
|
2983
|
+
onRemoveSelectedWidget: T[2] || (T[2] = (N) => n("removeSelectedWidget", N))
|
|
2984
|
+
}),
|
|
2985
|
+
V("label", Ri, H(y(i)("mf-kitchen.editor.variable_plural")), 1),
|
|
2986
|
+
S(K, null, {
|
|
2987
|
+
default: be(() => [
|
|
2988
|
+
S(y(lt), {
|
|
2989
|
+
modelValue: u.value,
|
|
2990
|
+
"onUpdate:modelValue": T[3] || (T[3] = (N) => u.value = N),
|
|
2991
|
+
"item-key": "name",
|
|
2992
|
+
group: { name: "widgets", pull: "clone", put: !1 },
|
|
2993
|
+
sort: !1,
|
|
2994
|
+
clone: f,
|
|
2995
|
+
onStart: T[4] || (T[4] = (N) => {
|
|
2996
|
+
m(N), n("removeSelectedWidget", !0);
|
|
2997
|
+
}),
|
|
2998
|
+
class: "flex flex-wrap gap-[8px] cursor-grab"
|
|
2999
|
+
}, {
|
|
3000
|
+
default: be(() => [
|
|
3001
|
+
(x(!0), W(we, null, Se(u.value, (N) => (x(), W("div", {
|
|
3002
|
+
key: N.name
|
|
3003
|
+
}, [
|
|
3004
|
+
S(M, {
|
|
3005
|
+
variant: "secondary",
|
|
3006
|
+
size: "md",
|
|
3007
|
+
label: N.name
|
|
3008
|
+
}, null, 8, ["label"])
|
|
3009
|
+
]))), 128))
|
|
3010
|
+
]),
|
|
3011
|
+
_: 1
|
|
3012
|
+
}, 8, ["modelValue"])
|
|
3013
|
+
]),
|
|
3014
|
+
_: 1
|
|
3015
|
+
})
|
|
3016
|
+
]),
|
|
3017
|
+
V("div", Ai, [
|
|
3018
|
+
S(M, {
|
|
3019
|
+
class: "w-full",
|
|
3020
|
+
variant: "secondary",
|
|
3021
|
+
label: y(i)("mf-kitchen.resetToDefault"),
|
|
3022
|
+
size: "md",
|
|
3023
|
+
onClick: y(l)
|
|
3024
|
+
}, null, 8, ["label", "onClick"])
|
|
3025
|
+
])
|
|
3026
|
+
]);
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
}), Ni = /* @__PURE__ */ ee({
|
|
3030
|
+
__name: "PreviewDialog",
|
|
3031
|
+
props: {
|
|
3032
|
+
receiptInfo: {},
|
|
3033
|
+
profile: {},
|
|
3034
|
+
receiptTemplate: {}
|
|
3035
|
+
},
|
|
3036
|
+
setup(e) {
|
|
3037
|
+
const o = e, t = j(!1), { t: n } = me();
|
|
3038
|
+
return (l, i) => {
|
|
3039
|
+
const a = J("FmButton"), s = J("FmDialog");
|
|
3040
|
+
return x(), ye(s, {
|
|
3041
|
+
modelValue: t.value,
|
|
3042
|
+
"onUpdate:modelValue": i[0] || (i[0] = (r) => t.value = r),
|
|
3043
|
+
overlay: !0
|
|
3044
|
+
}, {
|
|
3045
|
+
"dialog-button": be(() => [
|
|
3046
|
+
S(a, {
|
|
3047
|
+
variant: "primary",
|
|
3048
|
+
label: y(n)("mf-kitchen.preview")
|
|
3049
|
+
}, null, 8, ["label"])
|
|
3050
|
+
]),
|
|
3051
|
+
default: be(() => [
|
|
3052
|
+
V("div", null, [
|
|
3053
|
+
S(vn, {
|
|
3054
|
+
"receipt-info": o.receiptInfo,
|
|
3055
|
+
profile: o.profile,
|
|
3056
|
+
"receipt-template": o.receiptTemplate
|
|
3057
|
+
}, null, 8, ["receipt-info", "profile", "receipt-template"])
|
|
3058
|
+
])
|
|
3059
|
+
]),
|
|
3060
|
+
_: 1
|
|
3061
|
+
}, 8, ["modelValue"]);
|
|
3062
|
+
};
|
|
3063
|
+
}
|
|
3064
|
+
}), Pi = { class: "h-full flex flex-col" }, Li = { class: "flex flex-row min-h-0" }, $i = { class: "flex flex-col flex-1" }, Bi = { class: "templateBuilderHeader" }, Mi = { class: "fm-typo-en-body-lg-600" }, Ui = { class: "flex flex-row gap-2" }, Xi = {
|
|
3065
|
+
key: 0,
|
|
3066
|
+
class: "h-full flex justify-center items-center"
|
|
3067
|
+
}, zi = { class: "flex flex-col justify-between w-[420px]" }, Yi = {
|
|
3068
|
+
key: 0,
|
|
3069
|
+
class: "p-[16px] fm-shadow-light-300"
|
|
3070
|
+
}, Ji = /* @__PURE__ */ ee({
|
|
3071
|
+
__name: "AdvanceModeView",
|
|
3072
|
+
emits: ["change-mode"],
|
|
3073
|
+
setup(e, { emit: o }) {
|
|
3074
|
+
const t = wo(), { t: n } = me(), l = _n(), i = hn(), a = L(() => i.profile.value), s = j(), r = j(), d = j(), u = j(), f = j([]), c = j([]), m = j(null), E = L(() => {
|
|
3075
|
+
var X;
|
|
3076
|
+
if (D.value !== null)
|
|
3077
|
+
return D.value;
|
|
3078
|
+
if (m.value == null)
|
|
3079
|
+
return null;
|
|
3080
|
+
const O = (X = c.value) == null ? void 0 : X[m.value.position.row];
|
|
3081
|
+
return (O == null ? void 0 : O.sectionType) ?? null;
|
|
3082
|
+
}), T = j(null), D = j(null), M = j(null), K = j(null), $ = j(!1), N = L(() => {
|
|
3083
|
+
var O;
|
|
3084
|
+
return ((O = u.value) == null ? void 0 : O.fontSize) ?? 12;
|
|
3085
|
+
});
|
|
3086
|
+
function Y(O) {
|
|
3087
|
+
m.value = O;
|
|
3088
|
+
const X = c.value[O.position.row];
|
|
3089
|
+
T.value = (X == null ? void 0 : X.columns[O.position.col]) ?? null, D.value = null;
|
|
3090
|
+
}
|
|
3091
|
+
function B(O) {
|
|
3092
|
+
const { row: X, col: ae, cell: Te } = O.position;
|
|
3093
|
+
c.value = c.value.map((De, It) => {
|
|
3094
|
+
if (It === X) {
|
|
3095
|
+
const ut = De.columns.map((Ke, Yo) => {
|
|
3096
|
+
if (Yo === ae) {
|
|
3097
|
+
const Go = Ke.cells.map((Ft, Ho) => Ho === Te ? {
|
|
3098
|
+
...Ft,
|
|
3099
|
+
data: {
|
|
3100
|
+
...Ft.data,
|
|
3101
|
+
...O.config.data
|
|
3102
|
+
}
|
|
3103
|
+
} : Ft);
|
|
3104
|
+
return {
|
|
3105
|
+
...Ke,
|
|
3106
|
+
cells: Go
|
|
3107
|
+
};
|
|
3108
|
+
}
|
|
3109
|
+
return Ke;
|
|
3110
|
+
});
|
|
3111
|
+
return {
|
|
3112
|
+
...De,
|
|
3113
|
+
columns: ut
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
return De;
|
|
3117
|
+
}), m.value && (m.value.config.data = {
|
|
3118
|
+
...m.value.config.data,
|
|
3119
|
+
...O.config.data
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
function h(O) {
|
|
3123
|
+
if (!m.value)
|
|
3124
|
+
return;
|
|
3125
|
+
const { row: X, col: ae } = m.value.position;
|
|
3126
|
+
c.value = c.value.map((Te, De) => {
|
|
3127
|
+
if (De !== X)
|
|
3128
|
+
return Te;
|
|
3129
|
+
const It = Te.columns.map((ut, Ke) => Ke !== ae ? ut : {
|
|
3130
|
+
...ut,
|
|
3131
|
+
...O
|
|
3132
|
+
});
|
|
3133
|
+
return {
|
|
3134
|
+
...Te,
|
|
3135
|
+
columns: It
|
|
3136
|
+
};
|
|
3137
|
+
}), T.value = O;
|
|
3138
|
+
}
|
|
3139
|
+
function v(O) {
|
|
3140
|
+
const { row: X, col: ae, cell: Te } = O.position;
|
|
3141
|
+
c.value[X].columns[ae].cells.splice(Te, 1), c.value[X].columns[ae].cells.length === 0 && c.value[X].columns.splice(ae, 1), c.value[X].columns.length === 0 && c.value.splice(X, 1), m.value = null;
|
|
3142
|
+
}
|
|
3143
|
+
const _ = o;
|
|
3144
|
+
function p() {
|
|
3145
|
+
_("change-mode", "normal");
|
|
3146
|
+
}
|
|
3147
|
+
async function k() {
|
|
3148
|
+
try {
|
|
3149
|
+
if ($.value = !0, !u.value || !r.value)
|
|
3150
|
+
return;
|
|
3151
|
+
u.value.template = to(c.value);
|
|
3152
|
+
const O = await eo.updateTemplate(u.value);
|
|
3153
|
+
G(O);
|
|
3154
|
+
const X = await Qt.updateInfo(r.value);
|
|
3155
|
+
P(X), m.value = null, $.value = !1, t.open(
|
|
3156
|
+
{
|
|
3157
|
+
title: n("mf-kitchen.template.save.success", { file: n("mf-kitchen.receiptTemplate") }),
|
|
3158
|
+
type: "success"
|
|
3159
|
+
},
|
|
3160
|
+
2e3
|
|
3161
|
+
);
|
|
3162
|
+
} catch {
|
|
3163
|
+
t.open(
|
|
3164
|
+
{
|
|
3165
|
+
title: n("mf-kitchen.template.save.failed", { file: n("mf-kitchen.receiptTemplate") }),
|
|
3166
|
+
type: "error"
|
|
3167
|
+
},
|
|
3168
|
+
3e3
|
|
3169
|
+
);
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
function C(O) {
|
|
3173
|
+
d.value = O, u.value = O;
|
|
3174
|
+
}
|
|
3175
|
+
function w(O) {
|
|
3176
|
+
r.value = O;
|
|
3177
|
+
}
|
|
3178
|
+
function b(O) {
|
|
3179
|
+
u.value = O;
|
|
3180
|
+
}
|
|
3181
|
+
function P(O) {
|
|
3182
|
+
s.value = O, r.value = O;
|
|
3183
|
+
}
|
|
3184
|
+
function G(O) {
|
|
3185
|
+
c.value = O.template.flatMap(
|
|
3186
|
+
(X) => X.group.rows.map((ae) => ({ ...ae, sectionType: X.type }))
|
|
3187
|
+
), f.value = JSON.parse(JSON.stringify(c.value));
|
|
3188
|
+
}
|
|
3189
|
+
function le() {
|
|
3190
|
+
r.value = s.value, u.value = d.value, c.value = JSON.parse(JSON.stringify(f.value)), m.value = null, T.value = null;
|
|
3191
|
+
}
|
|
3192
|
+
function _e(O) {
|
|
3193
|
+
const X = M.value, ae = K.value;
|
|
3194
|
+
!X || !ae || X.contains(O.target) && !ae.contains(O.target) && (m.value = null);
|
|
3195
|
+
}
|
|
3196
|
+
function Re(O) {
|
|
3197
|
+
O && (m.value = null);
|
|
3198
|
+
}
|
|
3199
|
+
function Dt(O) {
|
|
3200
|
+
D.value = O;
|
|
3201
|
+
}
|
|
3202
|
+
return _o(async () => {
|
|
3203
|
+
try {
|
|
3204
|
+
await l.readRestaurants();
|
|
3205
|
+
const O = await Qt.readInfo();
|
|
3206
|
+
P(O);
|
|
3207
|
+
const X = await eo.readTemplate();
|
|
3208
|
+
C(X), G(X), document.addEventListener("click", _e);
|
|
3209
|
+
} catch (O) {
|
|
3210
|
+
t.open(
|
|
3211
|
+
{
|
|
3212
|
+
title: n("mf-kitchen.template.load.fail", { file: n("mf-kitchen.receiptTemplate") }),
|
|
3213
|
+
message: `${O}`,
|
|
3214
|
+
type: "error"
|
|
3215
|
+
},
|
|
3216
|
+
3e3
|
|
3217
|
+
);
|
|
3218
|
+
}
|
|
3219
|
+
}), tn(() => {
|
|
3220
|
+
document.removeEventListener("click", _e);
|
|
3221
|
+
}), (O, X) => {
|
|
3222
|
+
const ae = J("FmButton"), Te = J("FmCircularProgress");
|
|
3223
|
+
return x(), W("div", Pi, [
|
|
3224
|
+
S(bn),
|
|
3225
|
+
S(yn, { onUpdateTemplate: k }),
|
|
3226
|
+
V("div", Li, [
|
|
3227
|
+
r.value && u.value ? (x(), ye(Wi, {
|
|
3228
|
+
key: 0,
|
|
3229
|
+
"receipt-info": r.value,
|
|
3230
|
+
template: u.value,
|
|
3231
|
+
selectedWidgetSectionType: E.value,
|
|
3232
|
+
onUpdateReceiptInfo: w,
|
|
3233
|
+
onUpdateReceiptTemplate: b,
|
|
3234
|
+
onReset: le,
|
|
3235
|
+
onRemoveSelectedWidget: Re,
|
|
3236
|
+
onVariableSectionType: Dt
|
|
3237
|
+
}, null, 8, ["receipt-info", "template", "selectedWidgetSectionType"])) : Ue("", !0),
|
|
3238
|
+
V("div", $i, [
|
|
3239
|
+
V("div", Bi, [
|
|
3240
|
+
V("label", Mi, H(y(n)("mf-kitchen.advanceTemplateBuilder")), 1),
|
|
3241
|
+
V("div", Ui, [
|
|
3242
|
+
r.value && a.value && u.value ? (x(), ye(Ni, {
|
|
3243
|
+
key: 0,
|
|
3244
|
+
"receipt-info": r.value,
|
|
3245
|
+
profile: a.value,
|
|
3246
|
+
"receipt-template": {
|
|
3247
|
+
...u.value,
|
|
3248
|
+
template: y(to)(c.value)
|
|
3249
|
+
}
|
|
3250
|
+
}, null, 8, ["receipt-info", "profile", "receipt-template"])) : Ue("", !0),
|
|
3251
|
+
S(ae, {
|
|
3252
|
+
variant: "secondary",
|
|
3253
|
+
label: y(n)("mf-kitchen.returnToBasicMode"),
|
|
3254
|
+
"text-color": "primary",
|
|
3255
|
+
bgColor: "typo-white",
|
|
3256
|
+
"border-color": "primary",
|
|
3257
|
+
onClick: p
|
|
3258
|
+
}, null, 8, ["label"])
|
|
3259
|
+
])
|
|
3260
|
+
]),
|
|
3261
|
+
V("div", {
|
|
3262
|
+
class: "h-full flex justify-center py-10 overflow-y-auto bg-fm-color-neutral-gray-100",
|
|
3263
|
+
ref_key: "receiptEditorRef",
|
|
3264
|
+
ref: M
|
|
3265
|
+
}, [
|
|
3266
|
+
$.value ? (x(), W("div", Xi, [
|
|
3267
|
+
S(Te, { size: "xxl" })
|
|
3268
|
+
])) : (x(), W("div", {
|
|
3269
|
+
key: 1,
|
|
3270
|
+
ref_key: "receiptEditorContentRef",
|
|
3271
|
+
ref: K
|
|
3272
|
+
}, [
|
|
3273
|
+
r.value ? (x(), ye(Vl, {
|
|
3274
|
+
key: 0,
|
|
3275
|
+
modelValue: c.value,
|
|
3276
|
+
"onUpdate:modelValue": X[0] || (X[0] = (De) => c.value = De),
|
|
3277
|
+
onSelectWidget: Y,
|
|
3278
|
+
"font-size": N.value,
|
|
3279
|
+
"selected-widget": m.value,
|
|
3280
|
+
"selected-widget-section-type": E.value
|
|
3281
|
+
}, null, 8, ["modelValue", "font-size", "selected-widget", "selected-widget-section-type"])) : Ue("", !0)
|
|
3282
|
+
], 512))
|
|
3283
|
+
], 512)
|
|
3284
|
+
]),
|
|
3285
|
+
V("div", zi, [
|
|
3286
|
+
S(Si, {
|
|
3287
|
+
"selected-widget": m.value,
|
|
3288
|
+
"selected-widget-section-type": E.value,
|
|
3289
|
+
"selected-widget-column": T.value,
|
|
3290
|
+
"onUpdate:widget": B,
|
|
3291
|
+
"onUpdate:selectedWidgetColumn": h
|
|
3292
|
+
}, null, 8, ["selected-widget", "selected-widget-section-type", "selected-widget-column"]),
|
|
3293
|
+
m.value ? (x(), W("div", Yi, [
|
|
3294
|
+
S(ae, {
|
|
3295
|
+
class: "w-full",
|
|
3296
|
+
variant: "secondary",
|
|
3297
|
+
label: "Remove widget",
|
|
3298
|
+
size: "md",
|
|
3299
|
+
"border-color": "system-error-300",
|
|
3300
|
+
"text-color": "system-error-300",
|
|
3301
|
+
onClick: X[1] || (X[1] = (De) => v(m.value))
|
|
3302
|
+
})
|
|
3303
|
+
])) : Ue("", !0)
|
|
3304
|
+
])
|
|
3305
|
+
])
|
|
3306
|
+
]);
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
export {
|
|
3311
|
+
Ji as default
|
|
3312
|
+
};
|