@stonecrop/desktop 0.9.0 → 0.9.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/desktop.css +1 -1
- package/dist/desktop.js +794 -790
- package/dist/desktop.js.map +1 -1
- package/package.json +5 -5
package/dist/desktop.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as Ee, ref as A, onMounted as
|
|
2
|
-
const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { key: 1 }, Ht = ["onClick"], Wt = { class: "dropdown-container" }, Ut = { class: "dropdown" }, zt = ["onClick"],
|
|
1
|
+
import { defineComponent as Ee, ref as A, onMounted as Te, openBlock as j, createElementBlock as F, normalizeClass as De, createElementVNode as T, Fragment as pe, renderList as be, toDisplayString as Y, createCommentVNode as de, withDirectives as Ce, vShow as Je, useTemplateRef as ht, computed as x, watch as H, nextTick as se, createBlock as Xe, Teleport as xt, createVNode as ae, Transition as Tt, withCtx as we, withModifiers as gt, vModelText as mt, renderSlot as Me, createTextVNode as Re, toRaw as yt, isRef as fe, isReactive as Pe, toRef as re, hasInjectionContext as Ke, inject as Se, getCurrentInstance as bt, reactive as wt, markRaw as ge, effectScope as Pt, getCurrentScope as Ye, onScopeDispose as et, toRefs as nt, provide as Ge, shallowRef as _e, toValue as Q, readonly as Ve, customRef as tt, unref as Oe, useModel as Vt, watchEffect as at, resolveComponent as St, resolveDynamicComponent as Mt, mergeProps as jt, mergeModels as rt, withKeys as he, normalizeStyle as je } from "vue";
|
|
2
|
+
const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { key: 1 }, Ht = ["onClick"], Wt = { class: "dropdown-container" }, Ut = { class: "dropdown" }, zt = ["onClick"], Jt = ["href"], Kt = { class: "dropdown-item" }, Gt = /* @__PURE__ */ Ee({
|
|
3
3
|
__name: "ActionSet",
|
|
4
4
|
props: {
|
|
5
5
|
elements: { default: () => [] }
|
|
6
6
|
},
|
|
7
7
|
emits: ["actionClick"],
|
|
8
8
|
setup(t, { emit: e }) {
|
|
9
|
-
const o = e, n = A({}), a = A(!1),
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const o = e, n = A({}), a = A(!1), s = A(-1), r = A(!1), u = A(!1);
|
|
10
|
+
Te(() => {
|
|
11
|
+
i();
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const i = () => {
|
|
14
14
|
n.value = {};
|
|
15
|
-
},
|
|
16
|
-
r.value = !0,
|
|
15
|
+
}, c = () => {
|
|
16
|
+
r.value = !0, s.value = setTimeout(() => {
|
|
17
17
|
r.value && (a.value = !0);
|
|
18
18
|
}, 500);
|
|
19
|
-
},
|
|
20
|
-
r.value = !1,
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
o("actionClick",
|
|
19
|
+
}, p = () => {
|
|
20
|
+
r.value = !1, u.value = !1, clearTimeout(s.value), a.value = !1;
|
|
21
|
+
}, y = (O) => {
|
|
22
|
+
const _ = !n.value[O];
|
|
23
|
+
i(), _ && (n.value[O] = !0);
|
|
24
|
+
}, h = (O, _) => {
|
|
25
|
+
o("actionClick", _, O);
|
|
26
26
|
};
|
|
27
|
-
return (O,
|
|
28
|
-
class:
|
|
29
|
-
onMouseover:
|
|
30
|
-
onMouseleave:
|
|
27
|
+
return (O, _) => (j(), F("div", {
|
|
28
|
+
class: De([{ "open-set": a.value, "hovered-and-closed": u.value }, "action-set collapse"]),
|
|
29
|
+
onMouseover: c,
|
|
30
|
+
onMouseleave: p
|
|
31
31
|
}, [
|
|
32
32
|
T("div", Ft, [
|
|
33
33
|
T("div", {
|
|
34
34
|
id: "chevron",
|
|
35
|
-
onClick:
|
|
36
|
-
}, [
|
|
35
|
+
onClick: _[0] || (_[0] = (D) => u.value = !u.value)
|
|
36
|
+
}, [..._[1] || (_[1] = [
|
|
37
37
|
T("svg", {
|
|
38
38
|
id: "Layer_1",
|
|
39
39
|
class: "leftBar",
|
|
@@ -66,41 +66,41 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
|
|
|
66
66
|
], -1)
|
|
67
67
|
])])
|
|
68
68
|
]),
|
|
69
|
-
|
|
70
|
-
(
|
|
69
|
+
_[2] || (_[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
70
|
+
(j(!0), F(pe, null, be(t.elements, (D, V) => (j(), F("div", {
|
|
71
71
|
key: D.label,
|
|
72
72
|
class: "action-element"
|
|
73
73
|
}, [
|
|
74
|
-
D.type == "button" ? (
|
|
74
|
+
D.type == "button" ? (j(), F("button", {
|
|
75
75
|
key: 0,
|
|
76
76
|
disabled: D.disabled,
|
|
77
77
|
class: "button-default",
|
|
78
|
-
onClick: (
|
|
78
|
+
onClick: (M) => h(D.action, D.label)
|
|
79
79
|
}, Y(D.label), 9, Lt)) : de("", !0),
|
|
80
|
-
D.type == "dropdown" ? (
|
|
80
|
+
D.type == "dropdown" ? (j(), F("div", Bt, [
|
|
81
81
|
T("button", {
|
|
82
82
|
class: "button-default",
|
|
83
|
-
onClick: (
|
|
83
|
+
onClick: (M) => y(V)
|
|
84
84
|
}, Y(D.label), 9, Ht),
|
|
85
|
-
|
|
85
|
+
Ce(T("div", Wt, [
|
|
86
86
|
T("div", Ut, [
|
|
87
|
-
(
|
|
88
|
-
key:
|
|
87
|
+
(j(!0), F(pe, null, be(D.actions, (M, P) => (j(), F("div", {
|
|
88
|
+
key: M.label
|
|
89
89
|
}, [
|
|
90
|
-
|
|
90
|
+
M.action != null ? (j(), F("button", {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "dropdown-item",
|
|
93
|
-
onClick: (U) =>
|
|
94
|
-
}, Y(
|
|
93
|
+
onClick: (U) => h(M.action, M.label)
|
|
94
|
+
}, Y(M.label), 9, zt)) : M.link != null ? (j(), F("a", {
|
|
95
95
|
key: 1,
|
|
96
|
-
href:
|
|
96
|
+
href: M.link
|
|
97
97
|
}, [
|
|
98
|
-
T("button",
|
|
99
|
-
], 8,
|
|
98
|
+
T("button", Kt, Y(M.label), 1)
|
|
99
|
+
], 8, Jt)) : de("", !0)
|
|
100
100
|
]))), 128))
|
|
101
101
|
])
|
|
102
102
|
], 512), [
|
|
103
|
-
[
|
|
103
|
+
[Je, n.value[V]]
|
|
104
104
|
])
|
|
105
105
|
])) : de("", !0)
|
|
106
106
|
]))), 128))
|
|
@@ -111,7 +111,7 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
|
|
|
111
111
|
for (const [n, a] of e)
|
|
112
112
|
o[n] = a;
|
|
113
113
|
return o;
|
|
114
|
-
}, _t = /* @__PURE__ */ Et(
|
|
114
|
+
}, _t = /* @__PURE__ */ Et(Gt, [["__scopeId", "data-v-eb01c863"]]), qt = { class: "command-palette-header" }, Zt = ["placeholder"], Qt = {
|
|
115
115
|
key: 0,
|
|
116
116
|
class: "command-palette-results"
|
|
117
117
|
}, Xt = ["onClick", "onMouseover"], Yt = { class: "result-title" }, eo = { class: "result-content" }, to = {
|
|
@@ -127,78 +127,78 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
|
|
|
127
127
|
},
|
|
128
128
|
emits: ["select", "close"],
|
|
129
129
|
setup(t, { emit: e }) {
|
|
130
|
-
const o = e, n = A(""), a = A(0),
|
|
130
|
+
const o = e, n = A(""), a = A(0), s = ht("input"), r = x(() => n.value ? t.search(n.value).slice(0, t.maxResults) : []);
|
|
131
131
|
H(
|
|
132
132
|
() => t.isOpen,
|
|
133
|
-
async (
|
|
134
|
-
|
|
133
|
+
async (p) => {
|
|
134
|
+
p && (n.value = "", a.value = 0, await se(), s.value?.focus());
|
|
135
135
|
}
|
|
136
136
|
), H(r, () => {
|
|
137
137
|
a.value = 0;
|
|
138
138
|
});
|
|
139
|
-
const
|
|
139
|
+
const u = () => {
|
|
140
140
|
o("close");
|
|
141
|
-
},
|
|
142
|
-
switch (
|
|
141
|
+
}, i = (p) => {
|
|
142
|
+
switch (p.key) {
|
|
143
143
|
case "Escape":
|
|
144
|
-
|
|
144
|
+
u();
|
|
145
145
|
break;
|
|
146
146
|
case "ArrowDown":
|
|
147
|
-
|
|
147
|
+
p.preventDefault(), r.value.length && (a.value = (a.value + 1) % r.value.length);
|
|
148
148
|
break;
|
|
149
149
|
case "ArrowUp":
|
|
150
|
-
|
|
150
|
+
p.preventDefault(), r.value.length && (a.value = (a.value - 1 + r.value.length) % r.value.length);
|
|
151
151
|
break;
|
|
152
152
|
case "Enter":
|
|
153
|
-
r.value.length && a.value >= 0 &&
|
|
153
|
+
r.value.length && a.value >= 0 && c(r.value[a.value]);
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
|
-
},
|
|
157
|
-
o("select",
|
|
156
|
+
}, c = (p) => {
|
|
157
|
+
o("select", p), u();
|
|
158
158
|
};
|
|
159
|
-
return (
|
|
159
|
+
return (p, y) => (j(), Xe(xt, { to: "body" }, [
|
|
160
160
|
ae(Tt, { name: "fade" }, {
|
|
161
161
|
default: we(() => [
|
|
162
|
-
t.isOpen ? (
|
|
162
|
+
t.isOpen ? (j(), F("div", {
|
|
163
163
|
key: 0,
|
|
164
164
|
class: "command-palette-overlay",
|
|
165
|
-
onClick:
|
|
165
|
+
onClick: u
|
|
166
166
|
}, [
|
|
167
167
|
T("div", {
|
|
168
168
|
class: "command-palette",
|
|
169
|
-
onClick:
|
|
169
|
+
onClick: y[1] || (y[1] = gt(() => {
|
|
170
170
|
}, ["stop"]))
|
|
171
171
|
}, [
|
|
172
172
|
T("div", qt, [
|
|
173
|
-
|
|
173
|
+
Ce(T("input", {
|
|
174
174
|
ref: "input",
|
|
175
|
-
"onUpdate:modelValue":
|
|
175
|
+
"onUpdate:modelValue": y[0] || (y[0] = (h) => n.value = h),
|
|
176
176
|
type: "text",
|
|
177
177
|
class: "command-palette-input",
|
|
178
178
|
placeholder: t.placeholder,
|
|
179
179
|
autofocus: "",
|
|
180
|
-
onKeydown:
|
|
180
|
+
onKeydown: i
|
|
181
181
|
}, null, 40, Zt), [
|
|
182
182
|
[mt, n.value]
|
|
183
183
|
])
|
|
184
184
|
]),
|
|
185
|
-
r.value.length ? (
|
|
186
|
-
(
|
|
185
|
+
r.value.length ? (j(), F("div", Qt, [
|
|
186
|
+
(j(!0), F(pe, null, be(r.value, (h, O) => (j(), F("div", {
|
|
187
187
|
key: O,
|
|
188
|
-
class:
|
|
189
|
-
onClick: (
|
|
190
|
-
onMouseover: (
|
|
188
|
+
class: De(["command-palette-result", { selected: O === a.value }]),
|
|
189
|
+
onClick: (_) => c(h),
|
|
190
|
+
onMouseover: (_) => a.value = O
|
|
191
191
|
}, [
|
|
192
192
|
T("div", Yt, [
|
|
193
|
-
Me(
|
|
193
|
+
Me(p.$slots, "title", { result: h })
|
|
194
194
|
]),
|
|
195
195
|
T("div", eo, [
|
|
196
|
-
Me(
|
|
196
|
+
Me(p.$slots, "content", { result: h })
|
|
197
197
|
])
|
|
198
198
|
], 42, Xt))), 128))
|
|
199
|
-
])) : n.value && !r.value.length ? (
|
|
200
|
-
Me(
|
|
201
|
-
|
|
199
|
+
])) : n.value && !r.value.length ? (j(), F("div", to, [
|
|
200
|
+
Me(p.$slots, "empty", {}, () => [
|
|
201
|
+
Re(' No results found for "' + Y(n.value) + '" ', 1)
|
|
202
202
|
])
|
|
203
203
|
])) : de("", !0)
|
|
204
204
|
])
|
|
@@ -211,9 +211,9 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
|
|
|
211
211
|
});
|
|
212
212
|
const ce = typeof window < "u";
|
|
213
213
|
let ne;
|
|
214
|
-
const
|
|
214
|
+
const Ae = (t) => ne = t;
|
|
215
215
|
process.env.NODE_ENV;
|
|
216
|
-
const
|
|
216
|
+
const qe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
217
217
|
/* istanbul ignore next */
|
|
218
218
|
/* @__PURE__ */ Symbol()
|
|
219
219
|
);
|
|
@@ -230,7 +230,7 @@ function kt(t, e) {
|
|
|
230
230
|
if (!(o in t))
|
|
231
231
|
continue;
|
|
232
232
|
const a = t[o];
|
|
233
|
-
ie(a) && ie(n) && !
|
|
233
|
+
ie(a) && ie(n) && !fe(n) && !Pe(n) ? t[o] = kt(a, n) : t[o] = n;
|
|
234
234
|
}
|
|
235
235
|
return t;
|
|
236
236
|
}
|
|
@@ -241,21 +241,21 @@ function st(t, e, o, n = Nt) {
|
|
|
241
241
|
const a = () => {
|
|
242
242
|
t.delete(e) && n();
|
|
243
243
|
};
|
|
244
|
-
return !o &&
|
|
244
|
+
return !o && Ye() && et(a), a;
|
|
245
245
|
}
|
|
246
246
|
function le(t, ...e) {
|
|
247
247
|
t.forEach((o) => {
|
|
248
248
|
o(...e);
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
const oo = (t) => t(), it = /* @__PURE__ */ Symbol(),
|
|
252
|
-
function
|
|
251
|
+
const oo = (t) => t(), it = /* @__PURE__ */ Symbol(), Fe = /* @__PURE__ */ Symbol();
|
|
252
|
+
function Ze(t, e) {
|
|
253
253
|
t instanceof Map && e instanceof Map ? e.forEach((o, n) => t.set(n, o)) : t instanceof Set && e instanceof Set && e.forEach(t.add, t);
|
|
254
254
|
for (const o in e) {
|
|
255
255
|
if (!e.hasOwnProperty(o))
|
|
256
256
|
continue;
|
|
257
257
|
const n = e[o], a = t[o];
|
|
258
|
-
ie(a) && ie(n) && t.hasOwnProperty(o) && !
|
|
258
|
+
ie(a) && ie(n) && t.hasOwnProperty(o) && !fe(n) && !Pe(n) ? t[o] = Ze(a, n) : t[o] = n;
|
|
259
259
|
}
|
|
260
260
|
return t;
|
|
261
261
|
}
|
|
@@ -268,46 +268,46 @@ function ao(t) {
|
|
|
268
268
|
}
|
|
269
269
|
const { assign: Z } = Object;
|
|
270
270
|
function lt(t) {
|
|
271
|
-
return !!(
|
|
271
|
+
return !!(fe(t) && t.effect);
|
|
272
272
|
}
|
|
273
273
|
function ct(t, e, o, n) {
|
|
274
|
-
const { state: a, actions:
|
|
275
|
-
let
|
|
276
|
-
function
|
|
277
|
-
!
|
|
278
|
-
const
|
|
274
|
+
const { state: a, actions: s, getters: r } = e, u = o.state.value[t];
|
|
275
|
+
let i;
|
|
276
|
+
function c() {
|
|
277
|
+
!u && (process.env.NODE_ENV === "production" || !n) && (o.state.value[t] = a ? a() : {});
|
|
278
|
+
const p = process.env.NODE_ENV !== "production" && n ? (
|
|
279
279
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
280
|
-
|
|
281
|
-
) :
|
|
282
|
-
return Z(
|
|
283
|
-
|
|
280
|
+
nt(A(a ? a() : {}).value)
|
|
281
|
+
) : nt(o.state.value[t]);
|
|
282
|
+
return Z(p, s, Object.keys(r || {}).reduce((y, h) => (process.env.NODE_ENV !== "production" && h in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${h}" in store "${t}".`), y[h] = ge(x(() => {
|
|
283
|
+
Ae(o);
|
|
284
284
|
const O = o._s.get(t);
|
|
285
|
-
return r[
|
|
286
|
-
})),
|
|
285
|
+
return r[h].call(O, O);
|
|
286
|
+
})), y), {}));
|
|
287
287
|
}
|
|
288
|
-
return
|
|
288
|
+
return i = Qe(t, c, e, o, n, !0), i;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Qe(t, e, o = {}, n, a, s) {
|
|
291
291
|
let r;
|
|
292
|
-
const
|
|
292
|
+
const u = Z({ actions: {} }, o);
|
|
293
293
|
if (process.env.NODE_ENV !== "production" && !n._e.active)
|
|
294
294
|
throw new Error("Pinia destroyed");
|
|
295
|
-
const
|
|
296
|
-
process.env.NODE_ENV !== "production" && (
|
|
297
|
-
|
|
295
|
+
const i = { deep: !0 };
|
|
296
|
+
process.env.NODE_ENV !== "production" && (i.onTrigger = (g) => {
|
|
297
|
+
c ? O = g : c == !1 && !$._hotUpdating && (Array.isArray(O) ? O.push(g) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
298
298
|
});
|
|
299
|
-
let
|
|
300
|
-
const
|
|
301
|
-
!
|
|
299
|
+
let c, p, y = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), O;
|
|
300
|
+
const _ = n.state.value[t];
|
|
301
|
+
!s && !_ && (process.env.NODE_ENV === "production" || !a) && (n.state.value[t] = {});
|
|
302
302
|
const D = A({});
|
|
303
303
|
let V;
|
|
304
|
-
function
|
|
304
|
+
function M(g) {
|
|
305
305
|
let m;
|
|
306
|
-
|
|
306
|
+
c = p = !1, process.env.NODE_ENV !== "production" && (O = []), typeof g == "function" ? (g(n.state.value[t]), m = {
|
|
307
307
|
type: me.patchFunction,
|
|
308
308
|
storeId: t,
|
|
309
309
|
events: O
|
|
310
|
-
}) : (
|
|
310
|
+
}) : (Ze(n.state.value[t], g), m = {
|
|
311
311
|
type: me.patchObject,
|
|
312
312
|
payload: g,
|
|
313
313
|
storeId: t,
|
|
@@ -315,10 +315,10 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
315
315
|
});
|
|
316
316
|
const C = V = /* @__PURE__ */ Symbol();
|
|
317
317
|
se().then(() => {
|
|
318
|
-
V === C && (
|
|
319
|
-
}),
|
|
318
|
+
V === C && (c = !0);
|
|
319
|
+
}), p = !0, le(y, m, n.state.value[t]);
|
|
320
320
|
}
|
|
321
|
-
const P =
|
|
321
|
+
const P = s ? function() {
|
|
322
322
|
const { state: m } = o, C = m ? m() : {};
|
|
323
323
|
this.$patch((B) => {
|
|
324
324
|
Z(B, C);
|
|
@@ -330,13 +330,13 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
330
330
|
} : Nt
|
|
331
331
|
);
|
|
332
332
|
function U() {
|
|
333
|
-
r.stop(),
|
|
333
|
+
r.stop(), y.clear(), h.clear(), n._s.delete(t);
|
|
334
334
|
}
|
|
335
335
|
const q = (g, m = "") => {
|
|
336
336
|
if (it in g)
|
|
337
|
-
return g[
|
|
337
|
+
return g[Fe] = m, g;
|
|
338
338
|
const C = function() {
|
|
339
|
-
|
|
339
|
+
Ae(n);
|
|
340
340
|
const B = Array.from(arguments), k = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Set();
|
|
341
341
|
function L(S) {
|
|
342
342
|
k.add(S);
|
|
@@ -344,23 +344,23 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
344
344
|
function E(S) {
|
|
345
345
|
I.add(S);
|
|
346
346
|
}
|
|
347
|
-
le(
|
|
347
|
+
le(h, {
|
|
348
348
|
args: B,
|
|
349
|
-
name: C[
|
|
350
|
-
store:
|
|
349
|
+
name: C[Fe],
|
|
350
|
+
store: $,
|
|
351
351
|
after: L,
|
|
352
352
|
onError: E
|
|
353
353
|
});
|
|
354
354
|
let N;
|
|
355
355
|
try {
|
|
356
|
-
N = g.apply(this && this.$id === t ? this :
|
|
356
|
+
N = g.apply(this && this.$id === t ? this : $, B);
|
|
357
357
|
} catch (S) {
|
|
358
358
|
throw le(I, S), S;
|
|
359
359
|
}
|
|
360
360
|
return N instanceof Promise ? N.then((S) => (le(k, S), S)).catch((S) => (le(I, S), Promise.reject(S))) : (le(k, N), N);
|
|
361
361
|
};
|
|
362
|
-
return C[it] = !0, C[
|
|
363
|
-
},
|
|
362
|
+
return C[it] = !0, C[Fe] = m, C;
|
|
363
|
+
}, K = /* @__PURE__ */ ge({
|
|
364
364
|
actions: {},
|
|
365
365
|
getters: {},
|
|
366
366
|
state: [],
|
|
@@ -369,23 +369,23 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
369
369
|
_p: n,
|
|
370
370
|
// _s: scope,
|
|
371
371
|
$id: t,
|
|
372
|
-
$onAction: st.bind(null,
|
|
373
|
-
$patch:
|
|
372
|
+
$onAction: st.bind(null, h),
|
|
373
|
+
$patch: M,
|
|
374
374
|
$reset: P,
|
|
375
375
|
$subscribe(g, m = {}) {
|
|
376
|
-
const C = st(
|
|
377
|
-
(m.flush === "sync" ?
|
|
376
|
+
const C = st(y, g, m.detached, () => B()), B = r.run(() => H(() => n.state.value[t], (k) => {
|
|
377
|
+
(m.flush === "sync" ? p : c) && g({
|
|
378
378
|
storeId: t,
|
|
379
379
|
type: me.direct,
|
|
380
380
|
events: O
|
|
381
381
|
}, k);
|
|
382
|
-
}, Z({},
|
|
382
|
+
}, Z({}, i, m)));
|
|
383
383
|
return C;
|
|
384
384
|
},
|
|
385
385
|
$dispose: U
|
|
386
|
-
},
|
|
386
|
+
}, $ = wt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce ? Z(
|
|
387
387
|
{
|
|
388
|
-
_hmrPayload:
|
|
388
|
+
_hmrPayload: K,
|
|
389
389
|
_customProperties: ge(/* @__PURE__ */ new Set())
|
|
390
390
|
// devtools custom properties
|
|
391
391
|
},
|
|
@@ -393,60 +393,60 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
393
393
|
// must be added later
|
|
394
394
|
// setupStore
|
|
395
395
|
) : z);
|
|
396
|
-
n._s.set(t,
|
|
396
|
+
n._s.set(t, $);
|
|
397
397
|
const W = (n._a && n._a.runWithContext || oo)(() => n._e.run(() => (r = Pt()).run(() => e({ action: q }))));
|
|
398
398
|
for (const g in W) {
|
|
399
399
|
const m = W[g];
|
|
400
|
-
if (
|
|
401
|
-
process.env.NODE_ENV !== "production" && a ? D.value[g] = re(W, g) :
|
|
400
|
+
if (fe(m) && !lt(m) || Pe(m))
|
|
401
|
+
process.env.NODE_ENV !== "production" && a ? D.value[g] = re(W, g) : s || (_ && ao(m) && (fe(m) ? m.value = _[g] : Ze(m, _[g])), n.state.value[t][g] = m), process.env.NODE_ENV !== "production" && K.state.push(g);
|
|
402
402
|
else if (typeof m == "function") {
|
|
403
403
|
const C = process.env.NODE_ENV !== "production" && a ? m : q(m, g);
|
|
404
|
-
W[g] = C, process.env.NODE_ENV !== "production" && (
|
|
405
|
-
} else process.env.NODE_ENV !== "production" && lt(m) && (
|
|
404
|
+
W[g] = C, process.env.NODE_ENV !== "production" && (K.actions[g] = m), u.actions[g] = m;
|
|
405
|
+
} else process.env.NODE_ENV !== "production" && lt(m) && (K.getters[g] = s ? (
|
|
406
406
|
// @ts-expect-error
|
|
407
407
|
o.getters[g]
|
|
408
408
|
) : m, ce && (W._getters || // @ts-expect-error: same
|
|
409
409
|
(W._getters = ge([]))).push(g));
|
|
410
410
|
}
|
|
411
|
-
if (Z(
|
|
411
|
+
if (Z($, W), Z(yt($), W), Object.defineProperty($, "$state", {
|
|
412
412
|
get: () => process.env.NODE_ENV !== "production" && a ? D.value : n.state.value[t],
|
|
413
413
|
set: (g) => {
|
|
414
414
|
if (process.env.NODE_ENV !== "production" && a)
|
|
415
415
|
throw new Error("cannot set hotState");
|
|
416
|
-
|
|
416
|
+
M((m) => {
|
|
417
417
|
Z(m, g);
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
|
-
}), process.env.NODE_ENV !== "production" && (
|
|
421
|
-
|
|
422
|
-
if (m in
|
|
423
|
-
const C = g.$state[m], B =
|
|
420
|
+
}), process.env.NODE_ENV !== "production" && ($._hotUpdate = ge((g) => {
|
|
421
|
+
$._hotUpdating = !0, g._hmrPayload.state.forEach((m) => {
|
|
422
|
+
if (m in $.$state) {
|
|
423
|
+
const C = g.$state[m], B = $.$state[m];
|
|
424
424
|
typeof C == "object" && ie(C) && ie(B) ? kt(C, B) : g.$state[m] = B;
|
|
425
425
|
}
|
|
426
|
-
|
|
427
|
-
}), Object.keys(
|
|
428
|
-
m in g.$state || delete
|
|
429
|
-
}),
|
|
430
|
-
|
|
426
|
+
$[m] = re(g.$state, m);
|
|
427
|
+
}), Object.keys($.$state).forEach((m) => {
|
|
428
|
+
m in g.$state || delete $[m];
|
|
429
|
+
}), c = !1, p = !1, n.state.value[t] = re(g._hmrPayload, "hotState"), p = !0, se().then(() => {
|
|
430
|
+
c = !0;
|
|
431
431
|
});
|
|
432
432
|
for (const m in g._hmrPayload.actions) {
|
|
433
433
|
const C = g[m];
|
|
434
|
-
|
|
434
|
+
$[m] = //
|
|
435
435
|
q(C, m);
|
|
436
436
|
}
|
|
437
437
|
for (const m in g._hmrPayload.getters) {
|
|
438
|
-
const C = g._hmrPayload.getters[m], B =
|
|
438
|
+
const C = g._hmrPayload.getters[m], B = s ? (
|
|
439
439
|
// special handling of options api
|
|
440
|
-
x(() => (
|
|
440
|
+
x(() => (Ae(n), C.call($, $)))
|
|
441
441
|
) : C;
|
|
442
|
-
|
|
442
|
+
$[m] = //
|
|
443
443
|
B;
|
|
444
444
|
}
|
|
445
|
-
Object.keys(
|
|
446
|
-
m in g._hmrPayload.getters || delete
|
|
447
|
-
}), Object.keys(
|
|
448
|
-
m in g._hmrPayload.actions || delete
|
|
449
|
-
}),
|
|
445
|
+
Object.keys($._hmrPayload.getters).forEach((m) => {
|
|
446
|
+
m in g._hmrPayload.getters || delete $[m];
|
|
447
|
+
}), Object.keys($._hmrPayload.actions).forEach((m) => {
|
|
448
|
+
m in g._hmrPayload.actions || delete $[m];
|
|
449
|
+
}), $._hmrPayload = g._hmrPayload, $._getters = g._getters, $._hotUpdating = !1;
|
|
450
450
|
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce) {
|
|
451
451
|
const g = {
|
|
452
452
|
writable: !0,
|
|
@@ -455,59 +455,59 @@ function Xe(t, e, o = {}, n, a, i) {
|
|
|
455
455
|
enumerable: !1
|
|
456
456
|
};
|
|
457
457
|
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((m) => {
|
|
458
|
-
Object.defineProperty(
|
|
458
|
+
Object.defineProperty($, m, Z({ value: $[m] }, g));
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
return n._p.forEach((g) => {
|
|
462
462
|
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce) {
|
|
463
463
|
const m = r.run(() => g({
|
|
464
|
-
store:
|
|
464
|
+
store: $,
|
|
465
465
|
app: n._a,
|
|
466
466
|
pinia: n,
|
|
467
|
-
options:
|
|
467
|
+
options: u
|
|
468
468
|
}));
|
|
469
|
-
Object.keys(m || {}).forEach((C) =>
|
|
469
|
+
Object.keys(m || {}).forEach((C) => $._customProperties.add(C)), Z($, m);
|
|
470
470
|
} else
|
|
471
|
-
Z(
|
|
472
|
-
store:
|
|
471
|
+
Z($, r.run(() => g({
|
|
472
|
+
store: $,
|
|
473
473
|
app: n._a,
|
|
474
474
|
pinia: n,
|
|
475
|
-
options:
|
|
475
|
+
options: u
|
|
476
476
|
})));
|
|
477
|
-
}), process.env.NODE_ENV !== "production" &&
|
|
477
|
+
}), process.env.NODE_ENV !== "production" && $.$state && typeof $.$state == "object" && typeof $.$state.constructor == "function" && !$.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
478
478
|
state: () => new MyClass()
|
|
479
|
-
Found in store "${
|
|
479
|
+
Found in store "${$.$id}".`), _ && s && o.hydrate && o.hydrate($.$state, _), c = !0, p = !0, $;
|
|
480
480
|
}
|
|
481
481
|
// @__NO_SIDE_EFFECTS__
|
|
482
482
|
function ro(t, e, o) {
|
|
483
483
|
let n;
|
|
484
484
|
const a = typeof e == "function";
|
|
485
485
|
n = a ? o : e;
|
|
486
|
-
function
|
|
487
|
-
const
|
|
486
|
+
function s(r, u) {
|
|
487
|
+
const i = Ke();
|
|
488
488
|
if (r = // in test mode, ignore the argument provided as we can always retrieve a
|
|
489
489
|
// pinia instance with getActivePinia()
|
|
490
|
-
(process.env.NODE_ENV === "test" && ne && ne._testing ? null : r) || (
|
|
490
|
+
(process.env.NODE_ENV === "test" && ne && ne._testing ? null : r) || (i ? Se(qe, null) : null), r && Ae(r), process.env.NODE_ENV !== "production" && !ne)
|
|
491
491
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
492
492
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
493
493
|
This will fail in production.`);
|
|
494
|
-
r = ne, r._s.has(t) || (a ?
|
|
495
|
-
const
|
|
496
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
497
|
-
const
|
|
498
|
-
|
|
494
|
+
r = ne, r._s.has(t) || (a ? Qe(t, e, n, r) : ct(t, n, r), process.env.NODE_ENV !== "production" && (s._pinia = r));
|
|
495
|
+
const c = r._s.get(t);
|
|
496
|
+
if (process.env.NODE_ENV !== "production" && u) {
|
|
497
|
+
const p = "__hot:" + t, y = a ? Qe(p, e, n, r, !0) : ct(p, Z({}, n), r, !0);
|
|
498
|
+
u._hotUpdate(y), delete r.state.value[p], r._s.delete(p);
|
|
499
499
|
}
|
|
500
500
|
if (process.env.NODE_ENV !== "production" && ce) {
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
!
|
|
504
|
-
const
|
|
505
|
-
|
|
501
|
+
const p = bt();
|
|
502
|
+
if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
|
|
503
|
+
!u) {
|
|
504
|
+
const y = p.proxy, h = "_pStores" in y ? y._pStores : y._pStores = {};
|
|
505
|
+
h[t] = c;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
return
|
|
508
|
+
return c;
|
|
509
509
|
}
|
|
510
|
-
return
|
|
510
|
+
return s.$id = t, s;
|
|
511
511
|
}
|
|
512
512
|
function so(t) {
|
|
513
513
|
const e = yt(t), o = {};
|
|
@@ -516,10 +516,10 @@ function so(t) {
|
|
|
516
516
|
a.effect ? o[n] = // ...
|
|
517
517
|
x({
|
|
518
518
|
get: () => t[n],
|
|
519
|
-
set(
|
|
520
|
-
t[n] =
|
|
519
|
+
set(s) {
|
|
520
|
+
t[n] = s;
|
|
521
521
|
}
|
|
522
|
-
}) : (
|
|
522
|
+
}) : (fe(a) || Pe(a)) && (o[n] = // ---
|
|
523
523
|
re(t, n));
|
|
524
524
|
}
|
|
525
525
|
return o;
|
|
@@ -528,46 +528,46 @@ const io = typeof window < "u" && typeof document < "u";
|
|
|
528
528
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
529
529
|
const lo = Object.prototype.toString, co = (t) => lo.call(t) === "[object Object]", uo = () => {
|
|
530
530
|
};
|
|
531
|
-
function
|
|
531
|
+
function po(...t) {
|
|
532
532
|
if (t.length !== 1) return re(...t);
|
|
533
533
|
const e = t[0];
|
|
534
|
-
return typeof e == "function" ?
|
|
534
|
+
return typeof e == "function" ? Ve(tt(() => ({
|
|
535
535
|
get: e,
|
|
536
536
|
set: uo
|
|
537
537
|
}))) : A(e);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function fo(t, e) {
|
|
540
540
|
function o(...n) {
|
|
541
|
-
return new Promise((a,
|
|
541
|
+
return new Promise((a, s) => {
|
|
542
542
|
Promise.resolve(t(() => e.apply(this, n), {
|
|
543
543
|
fn: e,
|
|
544
544
|
thisArg: this,
|
|
545
545
|
args: n
|
|
546
|
-
})).then(a).catch(
|
|
546
|
+
})).then(a).catch(s);
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
return o;
|
|
550
550
|
}
|
|
551
551
|
const Ot = (t) => t();
|
|
552
|
-
function
|
|
553
|
-
const { initialState: o = "active" } = e, n =
|
|
552
|
+
function vo(t = Ot, e = {}) {
|
|
553
|
+
const { initialState: o = "active" } = e, n = po(o === "active");
|
|
554
554
|
function a() {
|
|
555
555
|
n.value = !1;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function s() {
|
|
558
558
|
n.value = !0;
|
|
559
559
|
}
|
|
560
|
-
const r = (...
|
|
561
|
-
n.value && t(...
|
|
560
|
+
const r = (...u) => {
|
|
561
|
+
n.value && t(...u);
|
|
562
562
|
};
|
|
563
563
|
return {
|
|
564
|
-
isActive:
|
|
564
|
+
isActive: Ve(n),
|
|
565
565
|
pause: a,
|
|
566
|
-
resume:
|
|
566
|
+
resume: s,
|
|
567
567
|
eventFilter: r
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function Le(t) {
|
|
571
571
|
return Array.isArray(t) ? t : [t];
|
|
572
572
|
}
|
|
573
573
|
function ho(t) {
|
|
@@ -575,22 +575,22 @@ function ho(t) {
|
|
|
575
575
|
}
|
|
576
576
|
function go(t, e, o = {}) {
|
|
577
577
|
const { eventFilter: n = Ot, ...a } = o;
|
|
578
|
-
return H(t,
|
|
578
|
+
return H(t, fo(n, e), a);
|
|
579
579
|
}
|
|
580
580
|
function mo(t, e, o = {}) {
|
|
581
|
-
const { eventFilter: n, initialState: a = "active", ...
|
|
581
|
+
const { eventFilter: n, initialState: a = "active", ...s } = o, { eventFilter: r, pause: u, resume: i, isActive: c } = vo(n, { initialState: a });
|
|
582
582
|
return {
|
|
583
583
|
stop: go(t, e, {
|
|
584
|
-
...
|
|
584
|
+
...s,
|
|
585
585
|
eventFilter: r
|
|
586
586
|
}),
|
|
587
|
-
pause:
|
|
588
|
-
resume:
|
|
589
|
-
isActive:
|
|
587
|
+
pause: u,
|
|
588
|
+
resume: i,
|
|
589
|
+
isActive: c
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
function yo(t, e = !0, o) {
|
|
593
|
-
ho() ?
|
|
593
|
+
ho() ? Te(t, o) : e ? t() : se(t);
|
|
594
594
|
}
|
|
595
595
|
function bo(t, e, o) {
|
|
596
596
|
return H(t, e, {
|
|
@@ -598,36 +598,36 @@ function bo(t, e, o) {
|
|
|
598
598
|
immediate: !0
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
const
|
|
601
|
+
const Ie = io ? window : void 0;
|
|
602
602
|
function wo(t) {
|
|
603
603
|
var e;
|
|
604
604
|
const o = Q(t);
|
|
605
605
|
return (e = o?.$el) !== null && e !== void 0 ? e : o;
|
|
606
606
|
}
|
|
607
607
|
function ut(...t) {
|
|
608
|
-
const e = (n, a,
|
|
609
|
-
const n =
|
|
608
|
+
const e = (n, a, s, r) => (n.addEventListener(a, s, r), () => n.removeEventListener(a, s, r)), o = x(() => {
|
|
609
|
+
const n = Le(Q(t[0])).filter((a) => a != null);
|
|
610
610
|
return n.every((a) => typeof a != "string") ? n : void 0;
|
|
611
611
|
});
|
|
612
612
|
return bo(() => {
|
|
613
613
|
var n, a;
|
|
614
614
|
return [
|
|
615
|
-
(n = (a = o.value) === null || a === void 0 ? void 0 : a.map((
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
(n = (a = o.value) === null || a === void 0 ? void 0 : a.map((s) => wo(s))) !== null && n !== void 0 ? n : [Ie].filter((s) => s != null),
|
|
616
|
+
Le(Q(o.value ? t[1] : t[0])),
|
|
617
|
+
Le(Oe(o.value ? t[2] : t[1])),
|
|
618
618
|
Q(o.value ? t[3] : t[2])
|
|
619
619
|
];
|
|
620
|
-
}, ([n, a,
|
|
621
|
-
if (!n?.length || !a?.length || !
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
620
|
+
}, ([n, a, s, r], u, i) => {
|
|
621
|
+
if (!n?.length || !a?.length || !s?.length) return;
|
|
622
|
+
const c = co(r) ? { ...r } : r, p = n.flatMap((y) => a.flatMap((h) => s.map((O) => e(y, h, O, c))));
|
|
623
|
+
i(() => {
|
|
624
|
+
p.forEach((y) => y());
|
|
625
625
|
});
|
|
626
626
|
}, { flush: "post" });
|
|
627
627
|
}
|
|
628
|
-
const
|
|
628
|
+
const $e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ke = "__vueuse_ssr_handlers__", So = /* @__PURE__ */ Eo();
|
|
629
629
|
function Eo() {
|
|
630
|
-
return
|
|
630
|
+
return ke in $e || ($e[ke] = $e[ke] || {}), $e[ke];
|
|
631
631
|
}
|
|
632
632
|
function _o(t, e) {
|
|
633
633
|
return So[t] || e;
|
|
@@ -671,39 +671,39 @@ const ko = {
|
|
|
671
671
|
}, dt = "vueuse-storage";
|
|
672
672
|
function No(t, e, o, n = {}) {
|
|
673
673
|
var a;
|
|
674
|
-
const { flush:
|
|
674
|
+
const { flush: s = "pre", deep: r = !0, listenToStorageChanges: u = !0, writeDefaults: i = !0, mergeDefaults: c = !1, shallow: p, window: y = Ie, eventFilter: h, onError: O = (k) => {
|
|
675
675
|
console.error(k);
|
|
676
|
-
}, initOnMounted:
|
|
676
|
+
}, initOnMounted: _ } = n, D = (p ? _e : A)(e), V = x(() => Q(t));
|
|
677
677
|
if (!o) try {
|
|
678
|
-
o = _o("getDefaultStorage", () =>
|
|
678
|
+
o = _o("getDefaultStorage", () => Ie?.localStorage)();
|
|
679
679
|
} catch (k) {
|
|
680
680
|
O(k);
|
|
681
681
|
}
|
|
682
682
|
if (!o) return D;
|
|
683
|
-
const
|
|
684
|
-
flush:
|
|
683
|
+
const M = Q(e), P = $o(M), U = (a = n.serializer) !== null && a !== void 0 ? a : ko[P], { pause: q, resume: K } = mo(D, (k) => g(k), {
|
|
684
|
+
flush: s,
|
|
685
685
|
deep: r,
|
|
686
|
-
eventFilter:
|
|
686
|
+
eventFilter: h
|
|
687
687
|
});
|
|
688
|
-
H(V, () => C(), { flush:
|
|
688
|
+
H(V, () => C(), { flush: s });
|
|
689
689
|
let z = !1;
|
|
690
|
-
const
|
|
691
|
-
|
|
690
|
+
const $ = (k) => {
|
|
691
|
+
_ && !z || C(k);
|
|
692
692
|
}, te = (k) => {
|
|
693
|
-
|
|
693
|
+
_ && !z || B(k);
|
|
694
694
|
};
|
|
695
|
-
|
|
695
|
+
y && u && (o instanceof Storage ? ut(y, "storage", $, { passive: !0 }) : ut(y, dt, te)), _ ? yo(() => {
|
|
696
696
|
z = !0, C();
|
|
697
697
|
}) : C();
|
|
698
698
|
function W(k, I) {
|
|
699
|
-
if (
|
|
699
|
+
if (y) {
|
|
700
700
|
const L = {
|
|
701
701
|
key: V.value,
|
|
702
702
|
oldValue: k,
|
|
703
703
|
newValue: I,
|
|
704
704
|
storageArea: o
|
|
705
705
|
};
|
|
706
|
-
|
|
706
|
+
y.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", L) : new CustomEvent(dt, { detail: L }));
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
function g(k) {
|
|
@@ -722,11 +722,11 @@ function No(t, e, o, n = {}) {
|
|
|
722
722
|
function m(k) {
|
|
723
723
|
const I = k ? k.newValue : o.getItem(V.value);
|
|
724
724
|
if (I == null)
|
|
725
|
-
return
|
|
726
|
-
if (!k &&
|
|
725
|
+
return i && M != null && o.setItem(V.value, U.write(M)), M;
|
|
726
|
+
if (!k && c) {
|
|
727
727
|
const L = U.read(I);
|
|
728
|
-
return typeof
|
|
729
|
-
...
|
|
728
|
+
return typeof c == "function" ? c(L, M) : P === "object" && !Array.isArray(L) ? {
|
|
729
|
+
...M,
|
|
730
730
|
...L
|
|
731
731
|
} : L;
|
|
732
732
|
} else return typeof I != "string" ? I : U.read(I);
|
|
@@ -734,7 +734,7 @@ function No(t, e, o, n = {}) {
|
|
|
734
734
|
function C(k) {
|
|
735
735
|
if (!(k && k.storageArea !== o)) {
|
|
736
736
|
if (k && k.key == null) {
|
|
737
|
-
D.value =
|
|
737
|
+
D.value = M;
|
|
738
738
|
return;
|
|
739
739
|
}
|
|
740
740
|
if (!(k && k.key !== V.value)) {
|
|
@@ -745,7 +745,7 @@ function No(t, e, o, n = {}) {
|
|
|
745
745
|
} catch (I) {
|
|
746
746
|
O(I);
|
|
747
747
|
} finally {
|
|
748
|
-
k ? se(
|
|
748
|
+
k ? se(K) : K();
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
}
|
|
@@ -756,13 +756,13 @@ function No(t, e, o, n = {}) {
|
|
|
756
756
|
return D;
|
|
757
757
|
}
|
|
758
758
|
function Oo(t, e, o = {}) {
|
|
759
|
-
const { window: n =
|
|
759
|
+
const { window: n = Ie } = o;
|
|
760
760
|
return No(t, e, n?.localStorage, o);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Be() {
|
|
763
763
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Ne(t) {
|
|
766
766
|
const e = {
|
|
767
767
|
type: t.type,
|
|
768
768
|
clientId: t.clientId,
|
|
@@ -797,145 +797,145 @@ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
|
|
|
797
797
|
autoSyncInterval: 3e4,
|
|
798
798
|
enablePersistence: !1,
|
|
799
799
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
800
|
-
}), e = A([]), o = A(-1), n = A(
|
|
801
|
-
let
|
|
802
|
-
for (let
|
|
803
|
-
|
|
804
|
-
return
|
|
805
|
-
}),
|
|
806
|
-
canUndo:
|
|
807
|
-
canRedo:
|
|
808
|
-
undoCount:
|
|
809
|
-
redoCount:
|
|
800
|
+
}), e = A([]), o = A(-1), n = A(Be()), a = A(!1), s = A([]), r = A(null), u = x(() => o.value < 0 ? !1 : e.value[o.value]?.reversible ?? !1), i = x(() => o.value < e.value.length - 1), c = x(() => {
|
|
801
|
+
let f = 0;
|
|
802
|
+
for (let v = o.value; v >= 0 && e.value[v]?.reversible; v--)
|
|
803
|
+
f++;
|
|
804
|
+
return f;
|
|
805
|
+
}), p = x(() => e.value.length - 1 - o.value), y = x(() => ({
|
|
806
|
+
canUndo: u.value,
|
|
807
|
+
canRedo: i.value,
|
|
808
|
+
undoCount: c.value,
|
|
809
|
+
redoCount: p.value,
|
|
810
810
|
currentIndex: o.value
|
|
811
811
|
}));
|
|
812
|
-
function
|
|
813
|
-
t.value = { ...t.value, ...
|
|
812
|
+
function h(f) {
|
|
813
|
+
t.value = { ...t.value, ...f }, t.value.enablePersistence && (E(), S()), t.value.enableCrossTabSync && m();
|
|
814
814
|
}
|
|
815
|
-
function O(
|
|
816
|
-
const
|
|
817
|
-
...
|
|
818
|
-
id:
|
|
815
|
+
function O(f, v = "user") {
|
|
816
|
+
const b = {
|
|
817
|
+
...f,
|
|
818
|
+
id: Be(),
|
|
819
819
|
timestamp: /* @__PURE__ */ new Date(),
|
|
820
|
-
source:
|
|
820
|
+
source: v,
|
|
821
821
|
userId: t.value.userId
|
|
822
822
|
};
|
|
823
|
-
if (t.value.operationFilter && !t.value.operationFilter(
|
|
824
|
-
return
|
|
823
|
+
if (t.value.operationFilter && !t.value.operationFilter(b))
|
|
824
|
+
return b.id;
|
|
825
825
|
if (a.value)
|
|
826
|
-
return
|
|
827
|
-
if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(
|
|
826
|
+
return s.value.push(b), b.id;
|
|
827
|
+
if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(b), o.value++, t.value.maxOperations && e.value.length > t.value.maxOperations) {
|
|
828
828
|
const l = e.value.length - t.value.maxOperations;
|
|
829
829
|
e.value = e.value.slice(l), o.value -= l;
|
|
830
830
|
}
|
|
831
|
-
return t.value.enableCrossTabSync && C(
|
|
831
|
+
return t.value.enableCrossTabSync && C(b), b.id;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
834
|
-
a.value = !0,
|
|
833
|
+
function _() {
|
|
834
|
+
a.value = !0, s.value = [], r.value = Be();
|
|
835
835
|
}
|
|
836
|
-
function D(
|
|
837
|
-
if (!a.value ||
|
|
838
|
-
return a.value = !1,
|
|
839
|
-
const
|
|
840
|
-
id:
|
|
836
|
+
function D(f) {
|
|
837
|
+
if (!a.value || s.value.length === 0)
|
|
838
|
+
return a.value = !1, s.value = [], r.value = null, null;
|
|
839
|
+
const v = r.value, b = s.value.every((w) => w.reversible), l = {
|
|
840
|
+
id: v,
|
|
841
841
|
type: "batch",
|
|
842
842
|
path: "",
|
|
843
843
|
// Batch doesn't have a single path
|
|
844
844
|
fieldname: "",
|
|
845
845
|
beforeValue: null,
|
|
846
846
|
afterValue: null,
|
|
847
|
-
doctype:
|
|
847
|
+
doctype: s.value[0]?.doctype || "",
|
|
848
848
|
timestamp: /* @__PURE__ */ new Date(),
|
|
849
849
|
source: "user",
|
|
850
|
-
reversible:
|
|
851
|
-
irreversibleReason:
|
|
852
|
-
childOperationIds:
|
|
853
|
-
metadata: { description:
|
|
850
|
+
reversible: b,
|
|
851
|
+
irreversibleReason: b ? void 0 : "Contains irreversible operations",
|
|
852
|
+
childOperationIds: s.value.map((w) => w.id),
|
|
853
|
+
metadata: { description: f }
|
|
854
854
|
};
|
|
855
|
-
|
|
856
|
-
w.parentOperationId =
|
|
857
|
-
}), e.value.push(...
|
|
858
|
-
const d =
|
|
859
|
-
return a.value = !1,
|
|
855
|
+
s.value.forEach((w) => {
|
|
856
|
+
w.parentOperationId = v;
|
|
857
|
+
}), e.value.push(...s.value, l), o.value = e.value.length - 1, t.value.enableCrossTabSync && B(s.value, l);
|
|
858
|
+
const d = v;
|
|
859
|
+
return a.value = !1, s.value = [], r.value = null, d;
|
|
860
860
|
}
|
|
861
861
|
function V() {
|
|
862
|
-
a.value = !1,
|
|
862
|
+
a.value = !1, s.value = [], r.value = null;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
865
|
-
if (!
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
868
|
-
return typeof console < "u" &&
|
|
864
|
+
function M(f) {
|
|
865
|
+
if (!u.value) return !1;
|
|
866
|
+
const v = e.value[o.value];
|
|
867
|
+
if (!v.reversible)
|
|
868
|
+
return typeof console < "u" && v.irreversibleReason && console.warn("Cannot undo irreversible operation:", v.irreversibleReason), !1;
|
|
869
869
|
try {
|
|
870
|
-
if (
|
|
871
|
-
for (let
|
|
872
|
-
const l =
|
|
873
|
-
d && U(d,
|
|
870
|
+
if (v.type === "batch" && v.childOperationIds)
|
|
871
|
+
for (let b = v.childOperationIds.length - 1; b >= 0; b--) {
|
|
872
|
+
const l = v.childOperationIds[b], d = e.value.find((w) => w.id === l);
|
|
873
|
+
d && U(d, f);
|
|
874
874
|
}
|
|
875
875
|
else
|
|
876
|
-
U(
|
|
877
|
-
return o.value--, t.value.enableCrossTabSync && k(
|
|
878
|
-
} catch (
|
|
879
|
-
return typeof console < "u" && console.error("Undo failed:",
|
|
876
|
+
U(v, f);
|
|
877
|
+
return o.value--, t.value.enableCrossTabSync && k(v), !0;
|
|
878
|
+
} catch (b) {
|
|
879
|
+
return typeof console < "u" && console.error("Undo failed:", b), !1;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
function P(
|
|
883
|
-
if (!
|
|
884
|
-
const
|
|
882
|
+
function P(f) {
|
|
883
|
+
if (!i.value) return !1;
|
|
884
|
+
const v = e.value[o.value + 1];
|
|
885
885
|
try {
|
|
886
|
-
if (
|
|
887
|
-
for (const
|
|
888
|
-
const l = e.value.find((d) => d.id ===
|
|
889
|
-
l && q(l,
|
|
886
|
+
if (v.type === "batch" && v.childOperationIds)
|
|
887
|
+
for (const b of v.childOperationIds) {
|
|
888
|
+
const l = e.value.find((d) => d.id === b);
|
|
889
|
+
l && q(l, f);
|
|
890
890
|
}
|
|
891
891
|
else
|
|
892
|
-
q(
|
|
893
|
-
return o.value++, t.value.enableCrossTabSync && I(
|
|
894
|
-
} catch (
|
|
895
|
-
return typeof console < "u" && console.error("Redo failed:",
|
|
892
|
+
q(v, f);
|
|
893
|
+
return o.value++, t.value.enableCrossTabSync && I(v), !0;
|
|
894
|
+
} catch (b) {
|
|
895
|
+
return typeof console < "u" && console.error("Redo failed:", b), !1;
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
-
function U(
|
|
899
|
-
(
|
|
898
|
+
function U(f, v) {
|
|
899
|
+
(f.type === "set" || f.type === "delete") && v && typeof v.set == "function" && v.set(f.path, f.beforeValue, "undo");
|
|
900
900
|
}
|
|
901
|
-
function q(
|
|
902
|
-
(
|
|
901
|
+
function q(f, v) {
|
|
902
|
+
(f.type === "set" || f.type === "delete") && v && typeof v.set == "function" && v.set(f.path, f.afterValue, "redo");
|
|
903
903
|
}
|
|
904
|
-
function
|
|
905
|
-
const
|
|
904
|
+
function K() {
|
|
905
|
+
const f = e.value.filter((b) => b.reversible).length, v = e.value.map((b) => b.timestamp);
|
|
906
906
|
return {
|
|
907
907
|
operations: [...e.value],
|
|
908
908
|
currentIndex: o.value,
|
|
909
909
|
totalOperations: e.value.length,
|
|
910
|
-
reversibleOperations:
|
|
911
|
-
irreversibleOperations: e.value.length -
|
|
912
|
-
oldestOperation:
|
|
913
|
-
newestOperation:
|
|
910
|
+
reversibleOperations: f,
|
|
911
|
+
irreversibleOperations: e.value.length - f,
|
|
912
|
+
oldestOperation: v.length > 0 ? new Date(Math.min(...v.map((b) => b.getTime()))) : void 0,
|
|
913
|
+
newestOperation: v.length > 0 ? new Date(Math.max(...v.map((b) => b.getTime()))) : void 0
|
|
914
914
|
};
|
|
915
915
|
}
|
|
916
916
|
function z() {
|
|
917
917
|
e.value = [], o.value = -1;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
920
|
-
return e.value.filter((
|
|
919
|
+
function $(f, v) {
|
|
920
|
+
return e.value.filter((b) => b.doctype === f && (v === void 0 || b.recordId === v));
|
|
921
921
|
}
|
|
922
|
-
function te(
|
|
923
|
-
const
|
|
924
|
-
|
|
922
|
+
function te(f, v) {
|
|
923
|
+
const b = e.value.find((l) => l.id === f);
|
|
924
|
+
b && (b.reversible = !1, b.irreversibleReason = v);
|
|
925
925
|
}
|
|
926
|
-
function W(
|
|
926
|
+
function W(f, v, b, l = "success", d) {
|
|
927
927
|
const w = {
|
|
928
928
|
type: "action",
|
|
929
|
-
path:
|
|
929
|
+
path: b && b.length > 0 ? `${f}.${b[0]}` : f,
|
|
930
930
|
fieldname: "",
|
|
931
931
|
beforeValue: null,
|
|
932
932
|
afterValue: null,
|
|
933
|
-
doctype:
|
|
934
|
-
recordId:
|
|
933
|
+
doctype: f,
|
|
934
|
+
recordId: b && b.length > 0 ? b[0] : void 0,
|
|
935
935
|
reversible: !1,
|
|
936
936
|
// Actions are typically not reversible
|
|
937
|
-
actionName:
|
|
938
|
-
actionRecordIds:
|
|
937
|
+
actionName: v,
|
|
938
|
+
actionRecordIds: b,
|
|
939
939
|
actionResult: l,
|
|
940
940
|
actionError: d
|
|
941
941
|
};
|
|
@@ -943,89 +943,89 @@ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
|
|
|
943
943
|
}
|
|
944
944
|
let g = null;
|
|
945
945
|
function m() {
|
|
946
|
-
typeof window > "u" || !window.BroadcastChannel || (g = new BroadcastChannel("stonecrop-operation-log"), g.addEventListener("message", (
|
|
947
|
-
const
|
|
948
|
-
if (!
|
|
949
|
-
const
|
|
950
|
-
|
|
946
|
+
typeof window > "u" || !window.BroadcastChannel || (g = new BroadcastChannel("stonecrop-operation-log"), g.addEventListener("message", (f) => {
|
|
947
|
+
const v = f.data;
|
|
948
|
+
if (!v || typeof v != "object") return;
|
|
949
|
+
const b = Do(v);
|
|
950
|
+
b.clientId !== n.value && (b.type === "operation" && b.operation ? (e.value.push({ ...b.operation, source: "sync" }), o.value = e.value.length - 1) : b.type === "operation" && b.operations && (e.value.push(...b.operations.map((l) => ({ ...l, source: "sync" }))), o.value = e.value.length - 1));
|
|
951
951
|
}));
|
|
952
952
|
}
|
|
953
|
-
function C(
|
|
953
|
+
function C(f) {
|
|
954
954
|
if (!g) return;
|
|
955
|
-
const
|
|
955
|
+
const v = {
|
|
956
956
|
type: "operation",
|
|
957
|
-
operation:
|
|
957
|
+
operation: f,
|
|
958
958
|
clientId: n.value,
|
|
959
959
|
timestamp: /* @__PURE__ */ new Date()
|
|
960
960
|
};
|
|
961
|
-
g.postMessage(
|
|
961
|
+
g.postMessage(Ne(v));
|
|
962
962
|
}
|
|
963
|
-
function B(
|
|
963
|
+
function B(f, v) {
|
|
964
964
|
if (!g) return;
|
|
965
|
-
const
|
|
965
|
+
const b = {
|
|
966
966
|
type: "operation",
|
|
967
|
-
operations: [...
|
|
967
|
+
operations: [...f, v],
|
|
968
968
|
clientId: n.value,
|
|
969
969
|
timestamp: /* @__PURE__ */ new Date()
|
|
970
970
|
};
|
|
971
|
-
g.postMessage(
|
|
971
|
+
g.postMessage(Ne(b));
|
|
972
972
|
}
|
|
973
|
-
function k(
|
|
973
|
+
function k(f) {
|
|
974
974
|
if (!g) return;
|
|
975
|
-
const
|
|
975
|
+
const v = {
|
|
976
976
|
type: "undo",
|
|
977
|
-
operation:
|
|
977
|
+
operation: f,
|
|
978
978
|
clientId: n.value,
|
|
979
979
|
timestamp: /* @__PURE__ */ new Date()
|
|
980
980
|
};
|
|
981
|
-
g.postMessage(
|
|
981
|
+
g.postMessage(Ne(v));
|
|
982
982
|
}
|
|
983
|
-
function I(
|
|
983
|
+
function I(f) {
|
|
984
984
|
if (!g) return;
|
|
985
|
-
const
|
|
985
|
+
const v = {
|
|
986
986
|
type: "redo",
|
|
987
|
-
operation:
|
|
987
|
+
operation: f,
|
|
988
988
|
clientId: n.value,
|
|
989
989
|
timestamp: /* @__PURE__ */ new Date()
|
|
990
990
|
};
|
|
991
|
-
g.postMessage(
|
|
991
|
+
g.postMessage(Ne(v));
|
|
992
992
|
}
|
|
993
993
|
const L = Oo("stonecrop-ops-operations", null, {
|
|
994
994
|
serializer: {
|
|
995
|
-
read: (
|
|
995
|
+
read: (f) => {
|
|
996
996
|
try {
|
|
997
|
-
return JSON.parse(
|
|
997
|
+
return JSON.parse(f);
|
|
998
998
|
} catch {
|
|
999
999
|
return null;
|
|
1000
1000
|
}
|
|
1001
1001
|
},
|
|
1002
|
-
write: (
|
|
1002
|
+
write: (f) => f ? JSON.stringify(f) : ""
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
1005
1005
|
function E() {
|
|
1006
1006
|
if (!(typeof window > "u"))
|
|
1007
1007
|
try {
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
...
|
|
1011
|
-
timestamp: new Date(
|
|
1012
|
-
})), o.value =
|
|
1013
|
-
} catch (
|
|
1014
|
-
typeof console < "u" && console.error("Failed to load operations from persistence:",
|
|
1008
|
+
const f = L.value;
|
|
1009
|
+
f && Array.isArray(f.operations) && (e.value = f.operations.map((v) => ({
|
|
1010
|
+
...v,
|
|
1011
|
+
timestamp: new Date(v.timestamp)
|
|
1012
|
+
})), o.value = f.currentIndex ?? -1);
|
|
1013
|
+
} catch (f) {
|
|
1014
|
+
typeof console < "u" && console.error("Failed to load operations from persistence:", f);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
function N() {
|
|
1018
1018
|
if (!(typeof window > "u"))
|
|
1019
1019
|
try {
|
|
1020
1020
|
L.value = {
|
|
1021
|
-
operations: e.value.map((
|
|
1022
|
-
...
|
|
1023
|
-
timestamp:
|
|
1021
|
+
operations: e.value.map((f) => ({
|
|
1022
|
+
...f,
|
|
1023
|
+
timestamp: f.timestamp.toISOString()
|
|
1024
1024
|
})),
|
|
1025
1025
|
currentIndex: o.value
|
|
1026
1026
|
};
|
|
1027
|
-
} catch (
|
|
1028
|
-
typeof console < "u" && console.error("Failed to save operations to persistence:",
|
|
1027
|
+
} catch (f) {
|
|
1028
|
+
typeof console < "u" && console.error("Failed to save operations to persistence:", f);
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
1031
|
function S() {
|
|
@@ -1043,23 +1043,23 @@ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
|
|
|
1043
1043
|
currentIndex: o,
|
|
1044
1044
|
config: t,
|
|
1045
1045
|
clientId: n,
|
|
1046
|
-
undoRedoState:
|
|
1046
|
+
undoRedoState: y,
|
|
1047
1047
|
// Computed
|
|
1048
|
-
canUndo:
|
|
1049
|
-
canRedo:
|
|
1050
|
-
undoCount:
|
|
1051
|
-
redoCount:
|
|
1048
|
+
canUndo: u,
|
|
1049
|
+
canRedo: i,
|
|
1050
|
+
undoCount: c,
|
|
1051
|
+
redoCount: p,
|
|
1052
1052
|
// Methods
|
|
1053
|
-
configure:
|
|
1053
|
+
configure: h,
|
|
1054
1054
|
addOperation: O,
|
|
1055
|
-
startBatch:
|
|
1055
|
+
startBatch: _,
|
|
1056
1056
|
commitBatch: D,
|
|
1057
1057
|
cancelBatch: V,
|
|
1058
|
-
undo:
|
|
1058
|
+
undo: M,
|
|
1059
1059
|
redo: P,
|
|
1060
1060
|
clear: z,
|
|
1061
|
-
getOperationsFor:
|
|
1062
|
-
getSnapshot:
|
|
1061
|
+
getOperationsFor: $,
|
|
1062
|
+
getSnapshot: K,
|
|
1063
1063
|
markIrreversible: te,
|
|
1064
1064
|
logAction: W
|
|
1065
1065
|
};
|
|
@@ -1135,14 +1135,14 @@ class ye {
|
|
|
1135
1135
|
if (!o) return;
|
|
1136
1136
|
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
1137
1137
|
if (typeof o.entrySeq == "function")
|
|
1138
|
-
o.entrySeq().forEach(([
|
|
1139
|
-
this.categorizeAction(
|
|
1138
|
+
o.entrySeq().forEach(([s, r]) => {
|
|
1139
|
+
this.categorizeAction(s, r, n, a);
|
|
1140
1140
|
});
|
|
1141
1141
|
else if (o instanceof Map)
|
|
1142
|
-
for (const [
|
|
1143
|
-
this.categorizeAction(
|
|
1144
|
-
else o && typeof o == "object" && Object.entries(o).forEach(([
|
|
1145
|
-
this.categorizeAction(
|
|
1142
|
+
for (const [s, r] of o)
|
|
1143
|
+
this.categorizeAction(s, r, n, a);
|
|
1144
|
+
else o && typeof o == "object" && Object.entries(o).forEach(([s, r]) => {
|
|
1145
|
+
this.categorizeAction(s, r, n, a);
|
|
1146
1146
|
});
|
|
1147
1147
|
this.doctypeActions.set(e, n), this.doctypeTransitions.set(e, a);
|
|
1148
1148
|
}
|
|
@@ -1166,8 +1166,8 @@ class ye {
|
|
|
1166
1166
|
* @param options - Execution options (timeout and enableRollback)
|
|
1167
1167
|
*/
|
|
1168
1168
|
async executeFieldTriggers(e, o = {}) {
|
|
1169
|
-
const { doctype: n, fieldname: a } = e,
|
|
1170
|
-
if (
|
|
1169
|
+
const { doctype: n, fieldname: a } = e, s = this.findFieldTriggers(n, a);
|
|
1170
|
+
if (s.length === 0)
|
|
1171
1171
|
return {
|
|
1172
1172
|
path: e.path,
|
|
1173
1173
|
actionResults: [],
|
|
@@ -1176,36 +1176,36 @@ class ye {
|
|
|
1176
1176
|
stoppedOnError: !1,
|
|
1177
1177
|
rolledBack: !1
|
|
1178
1178
|
};
|
|
1179
|
-
const r = performance.now(),
|
|
1180
|
-
let
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
for (const D of
|
|
1179
|
+
const r = performance.now(), u = [];
|
|
1180
|
+
let i = !1, c = !1, p;
|
|
1181
|
+
const y = this.getFieldRollback(n, a), h = o.enableRollback ?? y ?? this.options.enableRollback;
|
|
1182
|
+
h && e.store && (p = this.captureSnapshot(e));
|
|
1183
|
+
for (const D of s)
|
|
1184
1184
|
try {
|
|
1185
1185
|
const V = await this.executeAction(D, e, o.timeout);
|
|
1186
|
-
if (
|
|
1187
|
-
|
|
1186
|
+
if (u.push(V), !V.success) {
|
|
1187
|
+
i = !0;
|
|
1188
1188
|
break;
|
|
1189
1189
|
}
|
|
1190
1190
|
} catch (V) {
|
|
1191
|
-
const
|
|
1191
|
+
const M = {
|
|
1192
1192
|
success: !1,
|
|
1193
1193
|
error: V instanceof Error ? V : new Error(String(V)),
|
|
1194
1194
|
executionTime: 0,
|
|
1195
1195
|
action: D
|
|
1196
1196
|
};
|
|
1197
|
-
|
|
1197
|
+
u.push(M), i = !0;
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
|
-
if (
|
|
1200
|
+
if (h && i && p && e.store)
|
|
1201
1201
|
try {
|
|
1202
|
-
this.restoreSnapshot(e,
|
|
1202
|
+
this.restoreSnapshot(e, p), c = !0;
|
|
1203
1203
|
} catch (D) {
|
|
1204
1204
|
console.error("[FieldTriggers] Rollback failed:", D);
|
|
1205
1205
|
}
|
|
1206
|
-
const O = performance.now() - r,
|
|
1207
|
-
if (
|
|
1208
|
-
for (const D of
|
|
1206
|
+
const O = performance.now() - r, _ = u.filter((D) => !D.success);
|
|
1207
|
+
if (_.length > 0 && this.options.errorHandler)
|
|
1208
|
+
for (const D of _)
|
|
1209
1209
|
try {
|
|
1210
1210
|
this.options.errorHandler(D.error, e, D.action);
|
|
1211
1211
|
} catch (V) {
|
|
@@ -1213,12 +1213,12 @@ class ye {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
return {
|
|
1215
1215
|
path: e.path,
|
|
1216
|
-
actionResults:
|
|
1216
|
+
actionResults: u,
|
|
1217
1217
|
totalExecutionTime: O,
|
|
1218
|
-
allSucceeded:
|
|
1219
|
-
stoppedOnError:
|
|
1220
|
-
rolledBack:
|
|
1221
|
-
snapshot: this.options.debug &&
|
|
1218
|
+
allSucceeded: u.every((D) => D.success),
|
|
1219
|
+
stoppedOnError: i,
|
|
1220
|
+
rolledBack: c,
|
|
1221
|
+
snapshot: this.options.debug && h ? p : void 0
|
|
1222
1222
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
@@ -1229,33 +1229,33 @@ class ye {
|
|
|
1229
1229
|
* @param options - Execution options (timeout)
|
|
1230
1230
|
*/
|
|
1231
1231
|
async executeTransitionActions(e, o = {}) {
|
|
1232
|
-
const { doctype: n, transition: a } = e,
|
|
1233
|
-
if (
|
|
1232
|
+
const { doctype: n, transition: a } = e, s = this.findTransitionActions(n, a);
|
|
1233
|
+
if (s.length === 0)
|
|
1234
1234
|
return [];
|
|
1235
1235
|
const r = [];
|
|
1236
|
-
for (const
|
|
1236
|
+
for (const i of s)
|
|
1237
1237
|
try {
|
|
1238
|
-
const
|
|
1239
|
-
if (r.push(
|
|
1238
|
+
const c = await this.executeTransitionAction(i, e, o.timeout);
|
|
1239
|
+
if (r.push(c), !c.success)
|
|
1240
1240
|
break;
|
|
1241
|
-
} catch (
|
|
1242
|
-
const
|
|
1241
|
+
} catch (c) {
|
|
1242
|
+
const p = {
|
|
1243
1243
|
success: !1,
|
|
1244
|
-
error:
|
|
1244
|
+
error: c instanceof Error ? c : new Error(String(c)),
|
|
1245
1245
|
executionTime: 0,
|
|
1246
|
-
action:
|
|
1246
|
+
action: i,
|
|
1247
1247
|
transition: a
|
|
1248
1248
|
};
|
|
1249
|
-
r.push(
|
|
1249
|
+
r.push(p);
|
|
1250
1250
|
break;
|
|
1251
1251
|
}
|
|
1252
|
-
const
|
|
1253
|
-
if (
|
|
1254
|
-
for (const
|
|
1252
|
+
const u = r.filter((i) => !i.success);
|
|
1253
|
+
if (u.length > 0 && this.options.errorHandler)
|
|
1254
|
+
for (const i of u)
|
|
1255
1255
|
try {
|
|
1256
|
-
this.options.errorHandler(
|
|
1257
|
-
} catch (
|
|
1258
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1256
|
+
this.options.errorHandler(i.error, e, i.action);
|
|
1257
|
+
} catch (c) {
|
|
1258
|
+
console.error("[FieldTriggers] Error in global error handler:", c);
|
|
1259
1259
|
}
|
|
1260
1260
|
return r;
|
|
1261
1261
|
}
|
|
@@ -1270,27 +1270,27 @@ class ye {
|
|
|
1270
1270
|
* Execute a single transition action by name
|
|
1271
1271
|
*/
|
|
1272
1272
|
async executeTransitionAction(e, o, n) {
|
|
1273
|
-
const a = performance.now(),
|
|
1273
|
+
const a = performance.now(), s = n ?? this.options.defaultTimeout;
|
|
1274
1274
|
try {
|
|
1275
1275
|
let r = this.globalTransitionActions.get(e);
|
|
1276
1276
|
if (!r) {
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1277
|
+
const u = this.globalActions.get(e);
|
|
1278
|
+
u && (r = u);
|
|
1279
1279
|
}
|
|
1280
1280
|
if (!r)
|
|
1281
1281
|
throw new Error(`Transition action "${e}" not found in registry`);
|
|
1282
|
-
return await this.executeWithTimeout(r, o,
|
|
1282
|
+
return await this.executeWithTimeout(r, o, s), {
|
|
1283
1283
|
success: !0,
|
|
1284
1284
|
executionTime: performance.now() - a,
|
|
1285
1285
|
action: e,
|
|
1286
1286
|
transition: o.transition
|
|
1287
1287
|
};
|
|
1288
1288
|
} catch (r) {
|
|
1289
|
-
const
|
|
1289
|
+
const u = performance.now() - a;
|
|
1290
1290
|
return {
|
|
1291
1291
|
success: !1,
|
|
1292
1292
|
error: r instanceof Error ? r : new Error(String(r)),
|
|
1293
|
-
executionTime:
|
|
1293
|
+
executionTime: u,
|
|
1294
1294
|
action: e,
|
|
1295
1295
|
transition: o.transition
|
|
1296
1296
|
};
|
|
@@ -1304,8 +1304,8 @@ class ye {
|
|
|
1304
1304
|
const n = this.doctypeActions.get(e);
|
|
1305
1305
|
if (!n) return [];
|
|
1306
1306
|
const a = [];
|
|
1307
|
-
for (const [
|
|
1308
|
-
this.isFieldTriggerKey(
|
|
1307
|
+
for (const [s, r] of n)
|
|
1308
|
+
this.isFieldTriggerKey(s, o) && a.push(...r);
|
|
1309
1309
|
return a;
|
|
1310
1310
|
}
|
|
1311
1311
|
/**
|
|
@@ -1326,9 +1326,9 @@ class ye {
|
|
|
1326
1326
|
const n = e.split("."), a = o.split(".");
|
|
1327
1327
|
if (n.length !== a.length)
|
|
1328
1328
|
return !1;
|
|
1329
|
-
for (let
|
|
1330
|
-
const r = n[
|
|
1331
|
-
if (r !== "*" && r !==
|
|
1329
|
+
for (let s = 0; s < n.length; s++) {
|
|
1330
|
+
const r = n[s], u = a[s];
|
|
1331
|
+
if (r !== "*" && r !== u)
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
}
|
|
1334
1334
|
return !0;
|
|
@@ -1337,22 +1337,22 @@ class ye {
|
|
|
1337
1337
|
* Execute a single action by name
|
|
1338
1338
|
*/
|
|
1339
1339
|
async executeAction(e, o, n) {
|
|
1340
|
-
const a = performance.now(),
|
|
1340
|
+
const a = performance.now(), s = n ?? this.options.defaultTimeout;
|
|
1341
1341
|
try {
|
|
1342
1342
|
const r = this.globalActions.get(e);
|
|
1343
1343
|
if (!r)
|
|
1344
1344
|
throw new Error(`Action "${e}" not found in registry`);
|
|
1345
|
-
return await this.executeWithTimeout(r, o,
|
|
1345
|
+
return await this.executeWithTimeout(r, o, s), {
|
|
1346
1346
|
success: !0,
|
|
1347
1347
|
executionTime: performance.now() - a,
|
|
1348
1348
|
action: e
|
|
1349
1349
|
};
|
|
1350
1350
|
} catch (r) {
|
|
1351
|
-
const
|
|
1351
|
+
const u = performance.now() - a;
|
|
1352
1352
|
return {
|
|
1353
1353
|
success: !1,
|
|
1354
1354
|
error: r instanceof Error ? r : new Error(String(r)),
|
|
1355
|
-
executionTime:
|
|
1355
|
+
executionTime: u,
|
|
1356
1356
|
action: e
|
|
1357
1357
|
};
|
|
1358
1358
|
}
|
|
@@ -1361,14 +1361,14 @@ class ye {
|
|
|
1361
1361
|
* Execute a function with timeout
|
|
1362
1362
|
*/
|
|
1363
1363
|
async executeWithTimeout(e, o, n) {
|
|
1364
|
-
return new Promise((a,
|
|
1364
|
+
return new Promise((a, s) => {
|
|
1365
1365
|
const r = setTimeout(() => {
|
|
1366
|
-
|
|
1366
|
+
s(new Error(`Action timeout after ${n}ms`));
|
|
1367
1367
|
}, n);
|
|
1368
|
-
Promise.resolve(e(o)).then((
|
|
1369
|
-
clearTimeout(r), a(
|
|
1370
|
-
}).catch((
|
|
1371
|
-
clearTimeout(r),
|
|
1368
|
+
Promise.resolve(e(o)).then((u) => {
|
|
1369
|
+
clearTimeout(r), a(u);
|
|
1370
|
+
}).catch((u) => {
|
|
1371
|
+
clearTimeout(r), s(u);
|
|
1372
1372
|
});
|
|
1373
1373
|
});
|
|
1374
1374
|
}
|
|
@@ -1400,10 +1400,10 @@ class ye {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function pt(t) {
|
|
1404
1404
|
return new ye(t);
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function ft() {
|
|
1407
1407
|
try {
|
|
1408
1408
|
return Dt();
|
|
1409
1409
|
} catch {
|
|
@@ -1451,23 +1451,23 @@ class ue {
|
|
|
1451
1451
|
return o.registry[e];
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
|
-
class
|
|
1454
|
+
class xe {
|
|
1455
1455
|
target;
|
|
1456
1456
|
parentPath;
|
|
1457
1457
|
rootNode;
|
|
1458
1458
|
doctype;
|
|
1459
1459
|
parentDoctype;
|
|
1460
1460
|
hst;
|
|
1461
|
-
constructor(e, o, n = "", a = null,
|
|
1462
|
-
return this.target = e, this.parentPath = n, this.rootNode = a || this, this.doctype = o, this.parentDoctype =
|
|
1463
|
-
get(r,
|
|
1464
|
-
if (
|
|
1465
|
-
const
|
|
1466
|
-
return r.getNode(
|
|
1461
|
+
constructor(e, o, n = "", a = null, s) {
|
|
1462
|
+
return this.target = e, this.parentPath = n, this.rootNode = a || this, this.doctype = o, this.parentDoctype = s, this.hst = ue.getInstance(), new Proxy(this, {
|
|
1463
|
+
get(r, u) {
|
|
1464
|
+
if (u in r) return r[u];
|
|
1465
|
+
const i = String(u);
|
|
1466
|
+
return r.getNode(i);
|
|
1467
1467
|
},
|
|
1468
|
-
set(r,
|
|
1469
|
-
const
|
|
1470
|
-
return r.set(
|
|
1468
|
+
set(r, u, i) {
|
|
1469
|
+
const c = String(u);
|
|
1470
|
+
return r.set(c, i), !0;
|
|
1471
1471
|
}
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
@@ -1477,24 +1477,24 @@ class Te {
|
|
|
1477
1477
|
// Method to get a tree-wrapped node for navigation
|
|
1478
1478
|
getNode(e) {
|
|
1479
1479
|
const o = this.resolvePath(e), n = this.resolveValue(e), a = o.split(".");
|
|
1480
|
-
let
|
|
1481
|
-
return this.doctype === "StonecropStore" && a.length >= 1 && (
|
|
1480
|
+
let s = this.doctype;
|
|
1481
|
+
return this.doctype === "StonecropStore" && a.length >= 1 && (s = a[0]), typeof n == "object" && n !== null && !this.isPrimitive(n) ? new xe(n, s, o, this.rootNode, this.parentDoctype) : new xe(n, s, o, this.rootNode, this.parentDoctype);
|
|
1482
1482
|
}
|
|
1483
1483
|
set(e, o, n = "user") {
|
|
1484
|
-
const a = this.resolvePath(e),
|
|
1484
|
+
const a = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
|
|
1485
1485
|
if (n !== "undo" && n !== "redo") {
|
|
1486
|
-
const r =
|
|
1486
|
+
const r = ft();
|
|
1487
1487
|
if (r && typeof r.addOperation == "function") {
|
|
1488
|
-
const
|
|
1488
|
+
const u = a.split("."), i = this.doctype === "StonecropStore" && u.length >= 1 ? u[0] : this.doctype, c = u.length >= 2 ? u[1] : void 0, p = u.slice(2).join(".") || u[u.length - 1], y = o === void 0 && s !== void 0 ? "delete" : "set";
|
|
1489
1489
|
r.addOperation(
|
|
1490
1490
|
{
|
|
1491
|
-
type:
|
|
1491
|
+
type: y,
|
|
1492
1492
|
path: a,
|
|
1493
|
-
fieldname:
|
|
1494
|
-
beforeValue:
|
|
1493
|
+
fieldname: p,
|
|
1494
|
+
beforeValue: s,
|
|
1495
1495
|
afterValue: o,
|
|
1496
|
-
doctype:
|
|
1497
|
-
recordId:
|
|
1496
|
+
doctype: i,
|
|
1497
|
+
recordId: c,
|
|
1498
1498
|
reversible: !0
|
|
1499
1499
|
// Default to reversible, can be changed by field triggers
|
|
1500
1500
|
},
|
|
@@ -1502,7 +1502,7 @@ class Te {
|
|
|
1502
1502
|
);
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
|
-
this.updateValue(e, o), this.triggerFieldActions(a,
|
|
1505
|
+
this.updateValue(e, o), this.triggerFieldActions(a, s, o);
|
|
1506
1506
|
}
|
|
1507
1507
|
has(e) {
|
|
1508
1508
|
try {
|
|
@@ -1511,12 +1511,12 @@ class Te {
|
|
|
1511
1511
|
const o = this.parsePath(e);
|
|
1512
1512
|
let n = this.target;
|
|
1513
1513
|
for (let a = 0; a < o.length; a++) {
|
|
1514
|
-
const
|
|
1514
|
+
const s = o[a];
|
|
1515
1515
|
if (n == null)
|
|
1516
1516
|
return !1;
|
|
1517
1517
|
if (a === o.length - 1)
|
|
1518
|
-
return this.isImmutable(n) ? n.has(
|
|
1519
|
-
n = this.getProperty(n,
|
|
1518
|
+
return this.isImmutable(n) ? n.has(s) : this.isPiniaStore(n) && n.$state && s in n.$state || s in n;
|
|
1519
|
+
n = this.getProperty(n, s);
|
|
1520
1520
|
}
|
|
1521
1521
|
return !1;
|
|
1522
1522
|
} catch {
|
|
@@ -1545,17 +1545,17 @@ class Te {
|
|
|
1545
1545
|
* Trigger an XState transition with optional context data
|
|
1546
1546
|
*/
|
|
1547
1547
|
async triggerTransition(e, o) {
|
|
1548
|
-
const n =
|
|
1549
|
-
let
|
|
1550
|
-
this.doctype === "StonecropStore" && a.length >= 1 && (
|
|
1551
|
-
const
|
|
1548
|
+
const n = pt(), a = this.parentPath.split(".");
|
|
1549
|
+
let s = this.doctype, r;
|
|
1550
|
+
this.doctype === "StonecropStore" && a.length >= 1 && (s = a[0]), a.length >= 2 && (r = a[1]);
|
|
1551
|
+
const u = {
|
|
1552
1552
|
path: this.parentPath,
|
|
1553
1553
|
fieldname: "",
|
|
1554
1554
|
// No specific field for transitions
|
|
1555
1555
|
beforeValue: void 0,
|
|
1556
1556
|
afterValue: void 0,
|
|
1557
1557
|
operation: "set",
|
|
1558
|
-
doctype:
|
|
1558
|
+
doctype: s,
|
|
1559
1559
|
recordId: r,
|
|
1560
1560
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1561
1561
|
store: this.rootNode || void 0,
|
|
@@ -1563,15 +1563,15 @@ class Te {
|
|
|
1563
1563
|
currentState: o?.currentState,
|
|
1564
1564
|
targetState: o?.targetState,
|
|
1565
1565
|
fsmContext: o?.fsmContext
|
|
1566
|
-
},
|
|
1567
|
-
return
|
|
1566
|
+
}, i = ft();
|
|
1567
|
+
return i && typeof i.addOperation == "function" && i.addOperation(
|
|
1568
1568
|
{
|
|
1569
1569
|
type: "transition",
|
|
1570
1570
|
path: this.parentPath,
|
|
1571
1571
|
fieldname: e,
|
|
1572
1572
|
beforeValue: o?.currentState,
|
|
1573
1573
|
afterValue: o?.targetState,
|
|
1574
|
-
doctype:
|
|
1574
|
+
doctype: s,
|
|
1575
1575
|
recordId: r,
|
|
1576
1576
|
reversible: !1,
|
|
1577
1577
|
// FSM transitions are generally not reversible
|
|
@@ -1583,7 +1583,7 @@ class Te {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
},
|
|
1585
1585
|
"user"
|
|
1586
|
-
), await n.executeTransitionActions(
|
|
1586
|
+
), await n.executeTransitionActions(u);
|
|
1587
1587
|
}
|
|
1588
1588
|
// Private helper methods
|
|
1589
1589
|
resolvePath(e) {
|
|
@@ -1605,11 +1605,11 @@ class Te {
|
|
|
1605
1605
|
if (e === "")
|
|
1606
1606
|
throw new Error("Cannot set value on empty path");
|
|
1607
1607
|
const n = this.parsePath(e), a = n.pop();
|
|
1608
|
-
let
|
|
1608
|
+
let s = this.target;
|
|
1609
1609
|
for (const r of n)
|
|
1610
|
-
if (
|
|
1610
|
+
if (s = this.getProperty(s, r), s == null)
|
|
1611
1611
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1612
|
-
this.setProperty(
|
|
1612
|
+
this.setProperty(s, a, o);
|
|
1613
1613
|
}
|
|
1614
1614
|
getProperty(e, o) {
|
|
1615
1615
|
return this.isImmutable(e) ? e.get(o) : this.isVueReactive(e) ? e[o] : this.isPiniaStore(e) ? e.$state?.[o] ?? e[o] : e[o];
|
|
@@ -1630,24 +1630,24 @@ class Te {
|
|
|
1630
1630
|
const a = e.split(".");
|
|
1631
1631
|
if (a.length < 3)
|
|
1632
1632
|
return;
|
|
1633
|
-
const
|
|
1634
|
-
let
|
|
1635
|
-
this.doctype === "StonecropStore" && a.length >= 1 && (
|
|
1636
|
-
let
|
|
1637
|
-
a.length >= 2 && (
|
|
1638
|
-
const
|
|
1633
|
+
const s = pt(), r = a.slice(2).join(".") || a[a.length - 1];
|
|
1634
|
+
let u = this.doctype;
|
|
1635
|
+
this.doctype === "StonecropStore" && a.length >= 1 && (u = a[0]);
|
|
1636
|
+
let i;
|
|
1637
|
+
a.length >= 2 && (i = a[1]);
|
|
1638
|
+
const c = {
|
|
1639
1639
|
path: e,
|
|
1640
1640
|
fieldname: r,
|
|
1641
1641
|
beforeValue: o,
|
|
1642
1642
|
afterValue: n,
|
|
1643
1643
|
operation: "set",
|
|
1644
|
-
doctype:
|
|
1645
|
-
recordId:
|
|
1644
|
+
doctype: u,
|
|
1645
|
+
recordId: i,
|
|
1646
1646
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1647
1647
|
store: this.rootNode || void 0
|
|
1648
1648
|
// Pass the root store for snapshot/rollback capabilities
|
|
1649
1649
|
};
|
|
1650
|
-
await
|
|
1650
|
+
await s.executeFieldTriggers(c);
|
|
1651
1651
|
} catch (a) {
|
|
1652
1652
|
a instanceof Error && console.warn("Field trigger error:", a.message);
|
|
1653
1653
|
}
|
|
@@ -1661,19 +1661,19 @@ class Te {
|
|
|
1661
1661
|
isImmutable(e) {
|
|
1662
1662
|
if (!e || typeof e != "object")
|
|
1663
1663
|
return !1;
|
|
1664
|
-
const o = "get" in e && typeof e.get == "function", n = "set" in e && typeof e.set == "function", a = "has" in e && typeof e.has == "function",
|
|
1664
|
+
const o = "get" in e && typeof e.get == "function", n = "set" in e && typeof e.set == "function", a = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && o && n;
|
|
1665
1665
|
let r;
|
|
1666
1666
|
try {
|
|
1667
|
-
const
|
|
1668
|
-
if ("constructor" in
|
|
1669
|
-
const
|
|
1670
|
-
r = typeof
|
|
1667
|
+
const i = e;
|
|
1668
|
+
if ("constructor" in i && i.constructor && typeof i.constructor == "object" && "name" in i.constructor) {
|
|
1669
|
+
const c = i.constructor.name;
|
|
1670
|
+
r = typeof c == "string" ? c : void 0;
|
|
1671
1671
|
}
|
|
1672
1672
|
} catch {
|
|
1673
1673
|
r = void 0;
|
|
1674
1674
|
}
|
|
1675
|
-
const
|
|
1676
|
-
return !!(o && n && a &&
|
|
1675
|
+
const u = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (o || n);
|
|
1676
|
+
return !!(o && n && a && s || o && n && u);
|
|
1677
1677
|
}
|
|
1678
1678
|
isPrimitive(e) {
|
|
1679
1679
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
|
|
@@ -1688,7 +1688,7 @@ class Te {
|
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
1690
1690
|
function Co(t, e, o) {
|
|
1691
|
-
return new
|
|
1691
|
+
return new xe(t, e, "", null, o);
|
|
1692
1692
|
}
|
|
1693
1693
|
class Ro {
|
|
1694
1694
|
hstStore;
|
|
@@ -1804,19 +1804,19 @@ class Ro {
|
|
|
1804
1804
|
* @param args - Action arguments (typically record IDs)
|
|
1805
1805
|
*/
|
|
1806
1806
|
runAction(e, o, n) {
|
|
1807
|
-
const a = this.registry.registry[e.slug]?.actions?.get(o),
|
|
1808
|
-
let
|
|
1807
|
+
const a = this.registry.registry[e.slug]?.actions?.get(o), s = Array.isArray(n) ? n.filter((c) => typeof c == "string") : void 0, r = this.getOperationLogStore();
|
|
1808
|
+
let u = "success", i;
|
|
1809
1809
|
try {
|
|
1810
|
-
a && a.length > 0 && a.forEach((
|
|
1810
|
+
a && a.length > 0 && a.forEach((c) => {
|
|
1811
1811
|
try {
|
|
1812
|
-
new Function("args",
|
|
1813
|
-
} catch (
|
|
1814
|
-
throw
|
|
1812
|
+
new Function("args", c)(n);
|
|
1813
|
+
} catch (p) {
|
|
1814
|
+
throw u = "failure", i = p instanceof Error ? p.message : "Unknown error", p;
|
|
1815
1815
|
}
|
|
1816
1816
|
});
|
|
1817
1817
|
} catch {
|
|
1818
1818
|
} finally {
|
|
1819
|
-
r.logAction(e.doctype, o,
|
|
1819
|
+
r.logAction(e.doctype, o, s, u, i);
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
1822
|
/**
|
|
@@ -1864,12 +1864,12 @@ class Ro {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
function Ao(t) {
|
|
1866
1866
|
t || (t = {});
|
|
1867
|
-
const e = t.registry || Se("$registry"), o = Se("$stonecrop"), n = A(), a = A(),
|
|
1867
|
+
const e = t.registry || Se("$registry"), o = Se("$stonecrop"), n = A(), a = A(), s = A({}), r = A(), u = A(), i = A([]);
|
|
1868
1868
|
if (t.doctype && e) {
|
|
1869
1869
|
const E = t.doctype.schema ? Array.isArray(t.doctype.schema) ? t.doctype.schema : Array.from(t.doctype.schema) : [];
|
|
1870
|
-
|
|
1870
|
+
i.value = e.resolveSchema(E);
|
|
1871
1871
|
}
|
|
1872
|
-
const
|
|
1872
|
+
const c = A([]), p = A(-1), y = x(() => n.value?.getOperationLogStore().canUndo ?? !1), h = x(() => n.value?.getOperationLogStore().canRedo ?? !1), O = x(() => n.value?.getOperationLogStore().undoCount ?? 0), _ = x(() => n.value?.getOperationLogStore().redoCount ?? 0), D = x(
|
|
1873
1873
|
() => n.value?.getOperationLogStore().undoRedoState ?? {
|
|
1874
1874
|
canUndo: !1,
|
|
1875
1875
|
canRedo: !1,
|
|
@@ -1877,13 +1877,13 @@ function Ao(t) {
|
|
|
1877
1877
|
redoCount: 0,
|
|
1878
1878
|
currentIndex: -1
|
|
1879
1879
|
}
|
|
1880
|
-
), V = (E) => n.value?.getOperationLogStore().undo(E) ?? !1,
|
|
1880
|
+
), V = (E) => n.value?.getOperationLogStore().undo(E) ?? !1, M = (E) => n.value?.getOperationLogStore().redo(E) ?? !1, P = () => {
|
|
1881
1881
|
n.value?.getOperationLogStore().startBatch();
|
|
1882
1882
|
}, U = (E) => n.value?.getOperationLogStore().commitBatch(E) ?? null, q = () => {
|
|
1883
1883
|
n.value?.getOperationLogStore().cancelBatch();
|
|
1884
|
-
},
|
|
1884
|
+
}, K = () => {
|
|
1885
1885
|
n.value?.getOperationLogStore().clear();
|
|
1886
|
-
}, z = (E, N) => n.value?.getOperationLogStore().getOperationsFor(E, N) ?? [],
|
|
1886
|
+
}, z = (E, N) => n.value?.getOperationLogStore().getOperationsFor(E, N) ?? [], $ = () => n.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1887
1887
|
operations: [],
|
|
1888
1888
|
currentIndex: -1,
|
|
1889
1889
|
totalOperations: 0,
|
|
@@ -1891,23 +1891,23 @@ function Ao(t) {
|
|
|
1891
1891
|
irreversibleOperations: 0
|
|
1892
1892
|
}, te = (E, N) => {
|
|
1893
1893
|
n.value?.getOperationLogStore().markIrreversible(E, N);
|
|
1894
|
-
}, W = (E, N, S,
|
|
1894
|
+
}, W = (E, N, S, f = "success", v) => n.value?.getOperationLogStore().logAction(E, N, S, f, v) ?? "", g = (E) => {
|
|
1895
1895
|
n.value?.getOperationLogStore().configure(E);
|
|
1896
1896
|
};
|
|
1897
|
-
|
|
1897
|
+
Te(async () => {
|
|
1898
1898
|
if (e) {
|
|
1899
1899
|
n.value = o || new Ro(e);
|
|
1900
1900
|
try {
|
|
1901
1901
|
const E = n.value.getOperationLogStore(), N = so(E);
|
|
1902
|
-
|
|
1902
|
+
c.value = N.operations.value, p.value = N.currentIndex.value, H(
|
|
1903
1903
|
() => N.operations.value,
|
|
1904
1904
|
(S) => {
|
|
1905
|
-
|
|
1905
|
+
c.value = S;
|
|
1906
1906
|
}
|
|
1907
1907
|
), H(
|
|
1908
1908
|
() => N.currentIndex.value,
|
|
1909
1909
|
(S) => {
|
|
1910
|
-
|
|
1910
|
+
p.value = S;
|
|
1911
1911
|
}
|
|
1912
1912
|
);
|
|
1913
1913
|
} catch {
|
|
@@ -1915,32 +1915,32 @@ function Ao(t) {
|
|
|
1915
1915
|
if (!t.doctype && e.router) {
|
|
1916
1916
|
const E = e.router.currentRoute.value;
|
|
1917
1917
|
if (!E.path) return;
|
|
1918
|
-
const N = E.path.split("/").filter((
|
|
1918
|
+
const N = E.path.split("/").filter((f) => f.length > 0), S = N[1]?.toLowerCase();
|
|
1919
1919
|
if (N.length > 0) {
|
|
1920
|
-
const
|
|
1920
|
+
const f = {
|
|
1921
1921
|
path: E.path,
|
|
1922
1922
|
segments: N
|
|
1923
|
-
},
|
|
1924
|
-
if (
|
|
1925
|
-
if (e.addDoctype(
|
|
1926
|
-
const
|
|
1927
|
-
|
|
1923
|
+
}, v = await e.getMeta?.(f);
|
|
1924
|
+
if (v) {
|
|
1925
|
+
if (e.addDoctype(v), n.value.setup(v), r.value = v, u.value = S, a.value = n.value.getStore(), e) {
|
|
1926
|
+
const b = v.schema ? Array.isArray(v.schema) ? v.schema : Array.from(v.schema) : [];
|
|
1927
|
+
i.value = e.resolveSchema(b);
|
|
1928
1928
|
}
|
|
1929
1929
|
if (S && S !== "new") {
|
|
1930
|
-
const
|
|
1931
|
-
if (
|
|
1932
|
-
|
|
1930
|
+
const b = n.value.getRecordById(v, S);
|
|
1931
|
+
if (b)
|
|
1932
|
+
s.value = b.get("") || {};
|
|
1933
1933
|
else
|
|
1934
1934
|
try {
|
|
1935
|
-
await n.value.getRecord(
|
|
1936
|
-
const l = n.value.getRecordById(
|
|
1937
|
-
l && (
|
|
1935
|
+
await n.value.getRecord(v, S);
|
|
1936
|
+
const l = n.value.getRecordById(v, S);
|
|
1937
|
+
l && (s.value = l.get("") || {});
|
|
1938
1938
|
} catch {
|
|
1939
|
-
|
|
1939
|
+
s.value = oe(v);
|
|
1940
1940
|
}
|
|
1941
1941
|
} else
|
|
1942
|
-
|
|
1943
|
-
a.value &&
|
|
1942
|
+
s.value = oe(v);
|
|
1943
|
+
a.value && vt(v, S || "new", s, a.value), n.value.runAction(v, "load", S ? [S] : void 0);
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
@@ -1950,57 +1950,57 @@ function Ao(t) {
|
|
|
1950
1950
|
if (N && N !== "new") {
|
|
1951
1951
|
const S = n.value.getRecordById(E, N);
|
|
1952
1952
|
if (S)
|
|
1953
|
-
|
|
1953
|
+
s.value = S.get("") || {};
|
|
1954
1954
|
else
|
|
1955
1955
|
try {
|
|
1956
1956
|
await n.value.getRecord(E, N);
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1957
|
+
const f = n.value.getRecordById(E, N);
|
|
1958
|
+
f && (s.value = f.get("") || {});
|
|
1959
1959
|
} catch {
|
|
1960
|
-
|
|
1960
|
+
s.value = oe(E);
|
|
1961
1961
|
}
|
|
1962
1962
|
} else
|
|
1963
|
-
|
|
1964
|
-
a.value &&
|
|
1963
|
+
s.value = oe(E);
|
|
1964
|
+
a.value && vt(E, N || "new", s, a.value);
|
|
1965
1965
|
}
|
|
1966
1966
|
}
|
|
1967
1967
|
});
|
|
1968
1968
|
const m = (E, N) => {
|
|
1969
1969
|
const S = t.doctype || r.value;
|
|
1970
1970
|
if (!S) return "";
|
|
1971
|
-
const
|
|
1972
|
-
return `${S.slug}.${
|
|
1971
|
+
const f = N || t.recordId || u.value || "new";
|
|
1972
|
+
return `${S.slug}.${f}.${E}`;
|
|
1973
1973
|
}, C = (E) => {
|
|
1974
1974
|
const N = t.doctype || r.value;
|
|
1975
1975
|
if (!(!a.value || !n.value || !N))
|
|
1976
1976
|
try {
|
|
1977
1977
|
const S = E.path.split(".");
|
|
1978
1978
|
if (S.length >= 2) {
|
|
1979
|
-
const
|
|
1980
|
-
if (a.value.has(`${
|
|
1981
|
-
const d = `${
|
|
1979
|
+
const b = S[0], l = S[1];
|
|
1980
|
+
if (a.value.has(`${b}.${l}`) || n.value.addRecord(N, l, { ...s.value }), S.length > 3) {
|
|
1981
|
+
const d = `${b}.${l}`, w = S.slice(2);
|
|
1982
1982
|
let R = d;
|
|
1983
|
-
for (let
|
|
1984
|
-
if (R += `.${w[
|
|
1985
|
-
const ee = w[
|
|
1986
|
-
a.value.set(R,
|
|
1983
|
+
for (let J = 0; J < w.length - 1; J++)
|
|
1984
|
+
if (R += `.${w[J]}`, !a.value.has(R)) {
|
|
1985
|
+
const ee = w[J + 1], G = !isNaN(Number(ee));
|
|
1986
|
+
a.value.set(R, G ? [] : {});
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
1989
|
}
|
|
1990
1990
|
a.value.set(E.path, E.value);
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1991
|
+
const f = E.fieldname.split("."), v = { ...s.value };
|
|
1992
|
+
f.length === 1 ? v[f[0]] = E.value : Io(v, f, E.value), s.value = v;
|
|
1993
1993
|
} catch {
|
|
1994
1994
|
}
|
|
1995
1995
|
};
|
|
1996
|
-
(t.doctype || e?.router) && (
|
|
1996
|
+
(t.doctype || e?.router) && (Ge("hstPathProvider", m), Ge("hstChangeHandler", C));
|
|
1997
1997
|
const B = (E, N, S) => {
|
|
1998
1998
|
if (!n.value)
|
|
1999
1999
|
return oe(N);
|
|
2000
2000
|
if (S)
|
|
2001
2001
|
try {
|
|
2002
|
-
const
|
|
2003
|
-
return
|
|
2002
|
+
const f = a.value?.get(E);
|
|
2003
|
+
return f && typeof f == "object" ? f : oe(N);
|
|
2004
2004
|
} catch {
|
|
2005
2005
|
return oe(N);
|
|
2006
2006
|
}
|
|
@@ -2008,39 +2008,39 @@ function Ao(t) {
|
|
|
2008
2008
|
}, k = async (E, N) => {
|
|
2009
2009
|
if (!a.value || !n.value)
|
|
2010
2010
|
throw new Error("HST store not initialized");
|
|
2011
|
-
const S = `${E.slug}.${N}`,
|
|
2011
|
+
const S = `${E.slug}.${N}`, f = { ...a.value.get(S) || {} }, v = E.schema ? Array.isArray(E.schema) ? E.schema : Array.from(E.schema) : [], b = (e ? e.resolveSchema(v) : v).filter(
|
|
2012
2012
|
(l) => "fieldtype" in l && l.fieldtype === "Doctype" && "schema" in l && Array.isArray(l.schema)
|
|
2013
2013
|
);
|
|
2014
|
-
for (const l of
|
|
2014
|
+
for (const l of b) {
|
|
2015
2015
|
const d = l, w = `${S}.${d.fieldname}`, R = Ct(d.schema, w, a.value);
|
|
2016
|
-
|
|
2016
|
+
f[d.fieldname] = R;
|
|
2017
2017
|
}
|
|
2018
|
-
return
|
|
2018
|
+
return f;
|
|
2019
2019
|
}, I = (E, N) => ({
|
|
2020
2020
|
provideHSTPath: (S) => `${E}.${S}`,
|
|
2021
2021
|
handleHSTChange: (S) => {
|
|
2022
|
-
const
|
|
2022
|
+
const f = S.path.startsWith(E) ? S.path : `${E}.${S.fieldname}`;
|
|
2023
2023
|
C({
|
|
2024
2024
|
...S,
|
|
2025
|
-
path:
|
|
2025
|
+
path: f
|
|
2026
2026
|
});
|
|
2027
2027
|
}
|
|
2028
2028
|
}), L = {
|
|
2029
|
-
operations:
|
|
2030
|
-
currentIndex:
|
|
2029
|
+
operations: c,
|
|
2030
|
+
currentIndex: p,
|
|
2031
2031
|
undoRedoState: D,
|
|
2032
|
-
canUndo:
|
|
2033
|
-
canRedo:
|
|
2032
|
+
canUndo: y,
|
|
2033
|
+
canRedo: h,
|
|
2034
2034
|
undoCount: O,
|
|
2035
|
-
redoCount:
|
|
2035
|
+
redoCount: _,
|
|
2036
2036
|
undo: V,
|
|
2037
|
-
redo:
|
|
2037
|
+
redo: M,
|
|
2038
2038
|
startBatch: P,
|
|
2039
2039
|
commitBatch: U,
|
|
2040
2040
|
cancelBatch: q,
|
|
2041
|
-
clear:
|
|
2041
|
+
clear: K,
|
|
2042
2042
|
getOperationsFor: z,
|
|
2043
|
-
getSnapshot:
|
|
2043
|
+
getSnapshot: $,
|
|
2044
2044
|
markIrreversible: te,
|
|
2045
2045
|
logAction: W,
|
|
2046
2046
|
configure: g
|
|
@@ -2051,8 +2051,8 @@ function Ao(t) {
|
|
|
2051
2051
|
provideHSTPath: m,
|
|
2052
2052
|
handleHSTChange: C,
|
|
2053
2053
|
hstStore: a,
|
|
2054
|
-
formData:
|
|
2055
|
-
resolvedSchema:
|
|
2054
|
+
formData: s,
|
|
2055
|
+
resolvedSchema: i,
|
|
2056
2056
|
loadNestedData: B,
|
|
2057
2057
|
saveRecursive: k,
|
|
2058
2058
|
createNestedContext: I
|
|
@@ -2062,8 +2062,8 @@ function Ao(t) {
|
|
|
2062
2062
|
provideHSTPath: m,
|
|
2063
2063
|
handleHSTChange: C,
|
|
2064
2064
|
hstStore: a,
|
|
2065
|
-
formData:
|
|
2066
|
-
resolvedSchema:
|
|
2065
|
+
formData: s,
|
|
2066
|
+
resolvedSchema: i,
|
|
2067
2067
|
loadNestedData: B,
|
|
2068
2068
|
saveRecursive: k,
|
|
2069
2069
|
createNestedContext: I
|
|
@@ -2098,15 +2098,15 @@ function oe(t) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
}), e;
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function vt(t, e, o, n) {
|
|
2102
2102
|
H(
|
|
2103
2103
|
o,
|
|
2104
2104
|
(a) => {
|
|
2105
|
-
const
|
|
2105
|
+
const s = `${t.slug}.${e}`;
|
|
2106
2106
|
Object.keys(a).forEach((r) => {
|
|
2107
|
-
const
|
|
2107
|
+
const u = `${s}.${r}`;
|
|
2108
2108
|
try {
|
|
2109
|
-
n.set(
|
|
2109
|
+
n.set(u, a[r]);
|
|
2110
2110
|
} catch {
|
|
2111
2111
|
}
|
|
2112
2112
|
});
|
|
@@ -2116,26 +2116,26 @@ function pt(t, e, o, n) {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
function Io(t, e, o) {
|
|
2118
2118
|
let n = t;
|
|
2119
|
-
for (let
|
|
2120
|
-
const r = e[
|
|
2121
|
-
(!(r in n) || typeof n[r] != "object") && (n[r] = isNaN(Number(e[
|
|
2119
|
+
for (let s = 0; s < e.length - 1; s++) {
|
|
2120
|
+
const r = e[s];
|
|
2121
|
+
(!(r in n) || typeof n[r] != "object") && (n[r] = isNaN(Number(e[s + 1])) ? {} : []), n = n[r];
|
|
2122
2122
|
}
|
|
2123
2123
|
const a = e[e.length - 1];
|
|
2124
2124
|
n[a] = o;
|
|
2125
2125
|
}
|
|
2126
2126
|
function Ct(t, e, o) {
|
|
2127
2127
|
const n = { ...o.get(e) || {} }, a = t.filter(
|
|
2128
|
-
(
|
|
2128
|
+
(s) => "fieldtype" in s && s.fieldtype === "Doctype" && "schema" in s && Array.isArray(s.schema)
|
|
2129
2129
|
);
|
|
2130
|
-
for (const
|
|
2131
|
-
const r =
|
|
2132
|
-
n[r.fieldname] =
|
|
2130
|
+
for (const s of a) {
|
|
2131
|
+
const r = s, u = `${e}.${r.fieldname}`, i = Ct(r.schema, u, o);
|
|
2132
|
+
n[r.fieldname] = i;
|
|
2133
2133
|
}
|
|
2134
2134
|
return n;
|
|
2135
2135
|
}
|
|
2136
2136
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2137
2137
|
function xo(t, e) {
|
|
2138
|
-
return
|
|
2138
|
+
return Ye() ? (et(t, e), !0) : !1;
|
|
2139
2139
|
}
|
|
2140
2140
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2141
2141
|
const To = () => {
|
|
@@ -2143,61 +2143,61 @@ const To = () => {
|
|
|
2143
2143
|
function Po(...t) {
|
|
2144
2144
|
if (t.length !== 1) return re(...t);
|
|
2145
2145
|
const e = t[0];
|
|
2146
|
-
return typeof e == "function" ?
|
|
2146
|
+
return typeof e == "function" ? Ve(tt(() => ({
|
|
2147
2147
|
get: e,
|
|
2148
2148
|
set: To
|
|
2149
2149
|
}))) : A(e);
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function He(t) {
|
|
2152
2152
|
return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
|
|
2153
2153
|
}
|
|
2154
|
-
const
|
|
2154
|
+
const We = /* @__PURE__ */ new WeakMap();
|
|
2155
2155
|
function Vo(t, e = !1) {
|
|
2156
2156
|
const o = _e(e);
|
|
2157
2157
|
let n = "";
|
|
2158
2158
|
H(Po(t), (r) => {
|
|
2159
|
-
const
|
|
2160
|
-
if (
|
|
2161
|
-
const
|
|
2162
|
-
if (
|
|
2163
|
-
if (o.value) return
|
|
2159
|
+
const u = He(Q(r));
|
|
2160
|
+
if (u) {
|
|
2161
|
+
const i = u;
|
|
2162
|
+
if (We.get(i) || We.set(i, i.style.overflow), i.style.overflow !== "hidden" && (n = i.style.overflow), i.style.overflow === "hidden") return o.value = !0;
|
|
2163
|
+
if (o.value) return i.style.overflow = "hidden";
|
|
2164
2164
|
}
|
|
2165
2165
|
}, { immediate: !0 });
|
|
2166
2166
|
const a = () => {
|
|
2167
|
-
const r =
|
|
2167
|
+
const r = He(Q(t));
|
|
2168
2168
|
!r || o.value || (r.style.overflow = "hidden", o.value = !0);
|
|
2169
|
-
},
|
|
2170
|
-
const r =
|
|
2171
|
-
!r || !o.value || (r.style.overflow = n,
|
|
2169
|
+
}, s = () => {
|
|
2170
|
+
const r = He(Q(t));
|
|
2171
|
+
!r || !o.value || (r.style.overflow = n, We.delete(r), o.value = !1);
|
|
2172
2172
|
};
|
|
2173
|
-
return xo(
|
|
2173
|
+
return xo(s), x({
|
|
2174
2174
|
get() {
|
|
2175
2175
|
return o.value;
|
|
2176
2176
|
},
|
|
2177
2177
|
set(r) {
|
|
2178
|
-
r ? a() :
|
|
2178
|
+
r ? a() : s();
|
|
2179
2179
|
}
|
|
2180
2180
|
});
|
|
2181
2181
|
}
|
|
2182
|
-
function
|
|
2182
|
+
function Mo() {
|
|
2183
2183
|
let t = !1;
|
|
2184
2184
|
const e = _e(!1);
|
|
2185
2185
|
return (o, n) => {
|
|
2186
2186
|
if (e.value = n.value, t) return;
|
|
2187
2187
|
t = !0;
|
|
2188
2188
|
const a = Vo(o, n.value);
|
|
2189
|
-
H(e, (
|
|
2189
|
+
H(e, (s) => a.value = s);
|
|
2190
2190
|
};
|
|
2191
2191
|
}
|
|
2192
|
-
|
|
2193
|
-
const
|
|
2192
|
+
Mo();
|
|
2193
|
+
const jo = (t, e) => {
|
|
2194
2194
|
const o = t.__vccOpts || t;
|
|
2195
2195
|
for (const [n, a] of e)
|
|
2196
2196
|
o[n] = a;
|
|
2197
2197
|
return o;
|
|
2198
2198
|
};
|
|
2199
2199
|
function Fo(t, e) {
|
|
2200
|
-
return
|
|
2200
|
+
return Ye() ? (et(t, e), !0) : !1;
|
|
2201
2201
|
}
|
|
2202
2202
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2203
2203
|
const Lo = () => {
|
|
@@ -2205,39 +2205,39 @@ const Lo = () => {
|
|
|
2205
2205
|
function Bo(...t) {
|
|
2206
2206
|
if (t.length !== 1) return re(...t);
|
|
2207
2207
|
const e = t[0];
|
|
2208
|
-
return typeof e == "function" ?
|
|
2208
|
+
return typeof e == "function" ? Ve(tt(() => ({
|
|
2209
2209
|
get: e,
|
|
2210
2210
|
set: Lo
|
|
2211
2211
|
}))) : A(e);
|
|
2212
2212
|
}
|
|
2213
|
-
function
|
|
2213
|
+
function Ue(t) {
|
|
2214
2214
|
return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
|
|
2215
2215
|
}
|
|
2216
|
-
const
|
|
2216
|
+
const ze = /* @__PURE__ */ new WeakMap();
|
|
2217
2217
|
function Ho(t, e = !1) {
|
|
2218
2218
|
const o = _e(e);
|
|
2219
2219
|
let n = "";
|
|
2220
2220
|
H(Bo(t), (r) => {
|
|
2221
|
-
const
|
|
2222
|
-
if (
|
|
2223
|
-
const
|
|
2224
|
-
if (
|
|
2225
|
-
if (o.value) return
|
|
2221
|
+
const u = Ue(Q(r));
|
|
2222
|
+
if (u) {
|
|
2223
|
+
const i = u;
|
|
2224
|
+
if (ze.get(i) || ze.set(i, i.style.overflow), i.style.overflow !== "hidden" && (n = i.style.overflow), i.style.overflow === "hidden") return o.value = !0;
|
|
2225
|
+
if (o.value) return i.style.overflow = "hidden";
|
|
2226
2226
|
}
|
|
2227
2227
|
}, { immediate: !0 });
|
|
2228
2228
|
const a = () => {
|
|
2229
|
-
const r =
|
|
2229
|
+
const r = Ue(Q(t));
|
|
2230
2230
|
!r || o.value || (r.style.overflow = "hidden", o.value = !0);
|
|
2231
|
-
},
|
|
2232
|
-
const r =
|
|
2233
|
-
!r || !o.value || (r.style.overflow = n,
|
|
2231
|
+
}, s = () => {
|
|
2232
|
+
const r = Ue(Q(t));
|
|
2233
|
+
!r || !o.value || (r.style.overflow = n, ze.delete(r), o.value = !1);
|
|
2234
2234
|
};
|
|
2235
|
-
return Fo(
|
|
2235
|
+
return Fo(s), x({
|
|
2236
2236
|
get() {
|
|
2237
2237
|
return o.value;
|
|
2238
2238
|
},
|
|
2239
2239
|
set(r) {
|
|
2240
|
-
r ? a() :
|
|
2240
|
+
r ? a() : s();
|
|
2241
2241
|
}
|
|
2242
2242
|
});
|
|
2243
2243
|
}
|
|
@@ -2248,7 +2248,7 @@ function Wo() {
|
|
|
2248
2248
|
if (e.value = n.value, t) return;
|
|
2249
2249
|
t = !0;
|
|
2250
2250
|
const a = Ho(o, n.value);
|
|
2251
|
-
H(e, (
|
|
2251
|
+
H(e, (s) => a.value = s);
|
|
2252
2252
|
};
|
|
2253
2253
|
}
|
|
2254
2254
|
Wo();
|
|
@@ -2256,10 +2256,10 @@ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
|
2256
2256
|
const Uo = { class: "aform" }, zo = {
|
|
2257
2257
|
key: 0,
|
|
2258
2258
|
class: "aform-nested-section"
|
|
2259
|
-
},
|
|
2259
|
+
}, Jo = {
|
|
2260
2260
|
key: 0,
|
|
2261
2261
|
class: "aform-nested-label"
|
|
2262
|
-
},
|
|
2262
|
+
}, Ko = /* @__PURE__ */ Ee({
|
|
2263
2263
|
__name: "AForm",
|
|
2264
2264
|
props: /* @__PURE__ */ rt({
|
|
2265
2265
|
schema: {},
|
|
@@ -2271,82 +2271,86 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2271
2271
|
emits: /* @__PURE__ */ rt(["update:schema", "update:data"], ["update:data"]),
|
|
2272
2272
|
setup(t, { emit: e }) {
|
|
2273
2273
|
const o = e, n = Vt(t, "data"), a = A({});
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2274
|
+
H(
|
|
2275
|
+
() => n.value,
|
|
2276
|
+
(c) => {
|
|
2277
|
+
!t.schema || !c || t.schema.forEach((p) => {
|
|
2278
|
+
"schema" in p && Array.isArray(p.schema) && p.schema.length > 0 && (a.value[p.fieldname] = c[p.fieldname] ?? {});
|
|
2279
|
+
});
|
|
2280
|
+
},
|
|
2281
|
+
{ immediate: !0 }
|
|
2282
|
+
);
|
|
2283
|
+
const s = (c, p) => {
|
|
2284
|
+
a.value[c] = p, n.value && (n.value[c] = p, o("update:data", n.value));
|
|
2285
|
+
};
|
|
2286
|
+
at(() => {
|
|
2287
|
+
n.value && t.schema && t.schema.forEach((c) => {
|
|
2288
|
+
c.fieldname && n.value[c.fieldname] !== void 0 && (c.value = n.value[c.fieldname]);
|
|
2285
2289
|
});
|
|
2286
2290
|
});
|
|
2287
|
-
const
|
|
2288
|
-
const
|
|
2289
|
-
for (const [
|
|
2290
|
-
["component", "fieldtype"].includes(
|
|
2291
|
-
return
|
|
2292
|
-
},
|
|
2293
|
-
|
|
2294
|
-
t.schema &&
|
|
2291
|
+
const r = (c) => {
|
|
2292
|
+
const p = {};
|
|
2293
|
+
for (const [y, h] of Object.entries(c))
|
|
2294
|
+
["component", "fieldtype"].includes(y) || (p[y] = h), y === "rows" && (!h || Array.isArray(h) && h.length === 0) && (p.rows = n.value[c.fieldname] || []);
|
|
2295
|
+
return p;
|
|
2296
|
+
}, u = A([]);
|
|
2297
|
+
at(() => {
|
|
2298
|
+
t.schema && u.value.length !== t.schema.length && (u.value = t.schema.map((c, p) => x({
|
|
2295
2299
|
get() {
|
|
2296
|
-
return
|
|
2300
|
+
return c.value;
|
|
2297
2301
|
},
|
|
2298
|
-
set: (
|
|
2299
|
-
const h = t.schema[
|
|
2300
|
-
t.schema[
|
|
2302
|
+
set: (y) => {
|
|
2303
|
+
const h = t.schema[p].fieldname;
|
|
2304
|
+
t.schema[p].value = y, h && n.value && (n.value[h] = y, o("update:data", n.value)), o("update:schema", t.schema);
|
|
2301
2305
|
}
|
|
2302
2306
|
})));
|
|
2303
2307
|
});
|
|
2304
|
-
const
|
|
2305
|
-
return (
|
|
2306
|
-
const
|
|
2307
|
-
return
|
|
2308
|
-
(
|
|
2309
|
-
"schema" in h && Array.isArray(h.schema) && h.schema.length > 0 ? (
|
|
2310
|
-
h.label ? (
|
|
2311
|
-
ae(
|
|
2308
|
+
const i = x(() => u.value);
|
|
2309
|
+
return (c, p) => {
|
|
2310
|
+
const y = St("AForm", !0);
|
|
2311
|
+
return j(), F("form", Uo, [
|
|
2312
|
+
(j(!0), F(pe, null, be(t.schema, (h, O) => (j(), F(pe, { key: O }, [
|
|
2313
|
+
"schema" in h && Array.isArray(h.schema) && h.schema.length > 0 ? (j(), F("div", zo, [
|
|
2314
|
+
h.label ? (j(), F("h4", Jo, Y(h.label), 1)) : de("", !0),
|
|
2315
|
+
ae(y, {
|
|
2312
2316
|
data: a.value[h.fieldname],
|
|
2313
|
-
"onUpdate:data": (
|
|
2317
|
+
"onUpdate:data": (_) => s(h.fieldname, _),
|
|
2314
2318
|
schema: h.schema,
|
|
2315
2319
|
"read-only": t.readOnly || h.readOnly
|
|
2316
2320
|
}, null, 8, ["data", "onUpdate:data", "schema", "read-only"])
|
|
2317
|
-
])) : (
|
|
2321
|
+
])) : (j(), Xe(Mt(h.component), jt({
|
|
2318
2322
|
key: 1,
|
|
2319
|
-
modelValue:
|
|
2320
|
-
"onUpdate:modelValue": (
|
|
2323
|
+
modelValue: i.value[O].value,
|
|
2324
|
+
"onUpdate:modelValue": (_) => i.value[O].value = _,
|
|
2321
2325
|
schema: h,
|
|
2322
2326
|
data: n.value[h.fieldname],
|
|
2323
2327
|
"read-only": t.readOnly
|
|
2324
|
-
}, { ref_for: !0 },
|
|
2328
|
+
}, { ref_for: !0 }, r(h)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "read-only"]))
|
|
2325
2329
|
], 64))), 128))
|
|
2326
2330
|
]);
|
|
2327
2331
|
};
|
|
2328
2332
|
}
|
|
2329
|
-
}),
|
|
2333
|
+
}), Go = /* @__PURE__ */ jo(Ko, [["__scopeId", "data-v-a3cba83d"]]), qo = { class: "tabs" }, Zo = { tabindex: "0" }, Qo = { tabindex: "0" }, Xo = /* @__PURE__ */ Ee({
|
|
2330
2334
|
__name: "SheetNav",
|
|
2331
2335
|
props: {
|
|
2332
2336
|
breadcrumbs: { default: () => [] }
|
|
2333
2337
|
},
|
|
2334
2338
|
setup(t) {
|
|
2335
|
-
const e = A(!0), o = A(!1), n = A(""), a = ht("searchinput"),
|
|
2339
|
+
const e = A(!0), o = A(!1), n = A(""), a = ht("searchinput"), s = x(() => e.value ? "unrotated" : "rotated"), r = () => {
|
|
2336
2340
|
e.value = !e.value;
|
|
2337
|
-
},
|
|
2341
|
+
}, u = async () => {
|
|
2338
2342
|
o.value = !o.value, await se(() => {
|
|
2339
2343
|
a.value?.focus();
|
|
2340
2344
|
});
|
|
2341
|
-
},
|
|
2342
|
-
|
|
2343
|
-
},
|
|
2344
|
-
|
|
2345
|
-
},
|
|
2345
|
+
}, i = (y) => {
|
|
2346
|
+
y.preventDefault(), y.stopPropagation();
|
|
2347
|
+
}, c = async (y) => {
|
|
2348
|
+
y.preventDefault(), y.stopPropagation(), await u();
|
|
2349
|
+
}, p = () => {
|
|
2346
2350
|
};
|
|
2347
|
-
return (
|
|
2351
|
+
return (y, h) => {
|
|
2348
2352
|
const O = St("router-link");
|
|
2349
|
-
return
|
|
2353
|
+
return j(), F("footer", null, [
|
|
2350
2354
|
T("ul", qo, [
|
|
2351
2355
|
T("li", {
|
|
2352
2356
|
class: "hidebreadcrumbs",
|
|
@@ -2355,21 +2359,21 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2355
2359
|
}, [
|
|
2356
2360
|
T("a", Zo, [
|
|
2357
2361
|
T("div", {
|
|
2358
|
-
class:
|
|
2362
|
+
class: De(s.value)
|
|
2359
2363
|
}, "×", 2)
|
|
2360
2364
|
])
|
|
2361
2365
|
], 32),
|
|
2362
2366
|
T("li", {
|
|
2363
2367
|
class: "hometab",
|
|
2364
|
-
style:
|
|
2365
|
-
onClick:
|
|
2366
|
-
onKeydown: he(
|
|
2368
|
+
style: je({ display: e.value ? "block" : "none" }),
|
|
2369
|
+
onClick: p,
|
|
2370
|
+
onKeydown: he(p, ["enter"])
|
|
2367
2371
|
}, [
|
|
2368
2372
|
ae(O, {
|
|
2369
2373
|
to: "/",
|
|
2370
2374
|
tabindex: "0"
|
|
2371
2375
|
}, {
|
|
2372
|
-
default: we(() => [...
|
|
2376
|
+
default: we(() => [...h[5] || (h[5] = [
|
|
2373
2377
|
T("svg", {
|
|
2374
2378
|
class: "icon",
|
|
2375
2379
|
"aria-label": "Home",
|
|
@@ -2386,11 +2390,11 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2386
2390
|
})
|
|
2387
2391
|
], 36),
|
|
2388
2392
|
T("li", {
|
|
2389
|
-
class:
|
|
2390
|
-
style:
|
|
2393
|
+
class: De(["searchtab", { "search-active": o.value }]),
|
|
2394
|
+
style: je({ display: e.value ? "block" : "none" })
|
|
2391
2395
|
}, [
|
|
2392
2396
|
T("a", Qo, [
|
|
2393
|
-
|
|
2397
|
+
Ce((j(), F("svg", {
|
|
2394
2398
|
class: "icon search-icon",
|
|
2395
2399
|
role: "button",
|
|
2396
2400
|
"aria-label": "Search",
|
|
@@ -2398,9 +2402,9 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2398
2402
|
fill: "none",
|
|
2399
2403
|
stroke: "currentColor",
|
|
2400
2404
|
"stroke-width": "2",
|
|
2401
|
-
onClick:
|
|
2402
|
-
onKeydown: he(
|
|
2403
|
-
}, [...
|
|
2405
|
+
onClick: u,
|
|
2406
|
+
onKeydown: he(u, ["enter"])
|
|
2407
|
+
}, [...h[6] || (h[6] = [
|
|
2404
2408
|
T("circle", {
|
|
2405
2409
|
cx: "11",
|
|
2406
2410
|
cy: "11",
|
|
@@ -2408,37 +2412,37 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2408
2412
|
}, null, -1),
|
|
2409
2413
|
T("path", { d: "M21 21l-4.35-4.35" }, null, -1)
|
|
2410
2414
|
])], 544)), [
|
|
2411
|
-
[
|
|
2415
|
+
[Je, !o.value]
|
|
2412
2416
|
]),
|
|
2413
|
-
|
|
2417
|
+
Ce(T("input", {
|
|
2414
2418
|
ref: "searchinput",
|
|
2415
|
-
"onUpdate:modelValue":
|
|
2419
|
+
"onUpdate:modelValue": h[0] || (h[0] = (_) => n.value = _),
|
|
2416
2420
|
type: "text",
|
|
2417
2421
|
placeholder: "Search...",
|
|
2418
|
-
onClick:
|
|
2422
|
+
onClick: h[1] || (h[1] = gt(() => {
|
|
2419
2423
|
}, ["stop"])),
|
|
2420
|
-
onInput:
|
|
2421
|
-
onBlur:
|
|
2424
|
+
onInput: h[2] || (h[2] = (_) => i(_)),
|
|
2425
|
+
onBlur: h[3] || (h[3] = (_) => c(_)),
|
|
2422
2426
|
onKeydown: [
|
|
2423
|
-
|
|
2424
|
-
he(
|
|
2427
|
+
h[4] || (h[4] = he((_) => c(_), ["enter"])),
|
|
2428
|
+
he(u, ["escape"])
|
|
2425
2429
|
]
|
|
2426
2430
|
}, null, 544), [
|
|
2427
|
-
[
|
|
2431
|
+
[Je, o.value],
|
|
2428
2432
|
[mt, n.value]
|
|
2429
2433
|
])
|
|
2430
2434
|
])
|
|
2431
2435
|
], 6),
|
|
2432
|
-
(
|
|
2433
|
-
key:
|
|
2434
|
-
style:
|
|
2436
|
+
(j(!0), F(pe, null, be(t.breadcrumbs, (_) => (j(), F("li", {
|
|
2437
|
+
key: _.title,
|
|
2438
|
+
style: je({ display: e.value ? "block" : "none" })
|
|
2435
2439
|
}, [
|
|
2436
2440
|
ae(O, {
|
|
2437
2441
|
tabindex: "0",
|
|
2438
|
-
to:
|
|
2442
|
+
to: _.to
|
|
2439
2443
|
}, {
|
|
2440
2444
|
default: we(() => [
|
|
2441
|
-
|
|
2445
|
+
Re(Y(_.title), 1)
|
|
2442
2446
|
]),
|
|
2443
2447
|
_: 2
|
|
2444
2448
|
}, 1032, ["to"])
|
|
@@ -2459,29 +2463,29 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2459
2463
|
availableDoctypes: { default: () => [] }
|
|
2460
2464
|
},
|
|
2461
2465
|
setup(t) {
|
|
2462
|
-
const { stonecrop: e } = Ao(), o = A(!1), n = A(!1), a = A(!1),
|
|
2466
|
+
const { stonecrop: e } = Ao(), o = A(!1), n = A(!1), a = A(!1), s = x({
|
|
2463
2467
|
get() {
|
|
2464
|
-
if (!e.value || !
|
|
2468
|
+
if (!e.value || !i.value || !p.value)
|
|
2465
2469
|
return {};
|
|
2466
2470
|
try {
|
|
2467
|
-
return e.value.getRecordById(
|
|
2471
|
+
return e.value.getRecordById(i.value, p.value)?.get("") || {};
|
|
2468
2472
|
} catch {
|
|
2469
2473
|
return {};
|
|
2470
2474
|
}
|
|
2471
2475
|
},
|
|
2472
2476
|
set(l) {
|
|
2473
|
-
if (!(!e.value || !
|
|
2477
|
+
if (!(!e.value || !i.value || !p.value))
|
|
2474
2478
|
try {
|
|
2475
2479
|
const d = e.value.getStore();
|
|
2476
2480
|
for (const [w, R] of Object.entries(l)) {
|
|
2477
|
-
const
|
|
2478
|
-
d.set(
|
|
2481
|
+
const J = `${i.value}.${p.value}.${w}`;
|
|
2482
|
+
d.set(J, R);
|
|
2479
2483
|
}
|
|
2480
2484
|
} catch (d) {
|
|
2481
2485
|
console.warn("HST update failed:", d);
|
|
2482
2486
|
}
|
|
2483
2487
|
}
|
|
2484
|
-
}), r = x(() =>
|
|
2488
|
+
}), r = x(() => Oe(e.value?.registry.router?.currentRoute)), u = x(() => e.value?.registry.router), i = x(() => {
|
|
2485
2489
|
if (!r.value) return "";
|
|
2486
2490
|
if (r.value.meta?.actualDoctype)
|
|
2487
2491
|
return r.value.meta.actualDoctype;
|
|
@@ -2489,7 +2493,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2489
2493
|
return r.value.params.doctype;
|
|
2490
2494
|
const l = r.value.params.pathMatch;
|
|
2491
2495
|
return l && l.length > 0 ? l[0] : "";
|
|
2492
|
-
}),
|
|
2496
|
+
}), c = x(() => {
|
|
2493
2497
|
if (!r.value) return "";
|
|
2494
2498
|
if (r.value.meta?.doctype)
|
|
2495
2499
|
return r.value.meta.doctype;
|
|
@@ -2497,13 +2501,13 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2497
2501
|
return r.value.params.doctype;
|
|
2498
2502
|
const l = r.value.params.pathMatch;
|
|
2499
2503
|
return l && l.length > 0 ? l[0] : "";
|
|
2500
|
-
}),
|
|
2504
|
+
}), p = x(() => {
|
|
2501
2505
|
if (!r.value) return "";
|
|
2502
2506
|
if (r.value.params.recordId)
|
|
2503
2507
|
return r.value.params.recordId;
|
|
2504
2508
|
const l = r.value.params.pathMatch;
|
|
2505
2509
|
return l && l.length > 1 ? l[1] : "";
|
|
2506
|
-
}),
|
|
2510
|
+
}), y = x(() => p.value?.startsWith("new-")), h = x(() => {
|
|
2507
2511
|
if (!r.value || r.value.name === "home" || r.value.path === "/")
|
|
2508
2512
|
return "doctypes";
|
|
2509
2513
|
if (r.value.name && r.value.name !== "catch-all") {
|
|
@@ -2516,19 +2520,19 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2516
2520
|
const l = r.value.params.pathMatch;
|
|
2517
2521
|
return l && l.length > 0 ? l.length === 1 ? "records" : "record" : "doctypes";
|
|
2518
2522
|
}), O = () => {
|
|
2519
|
-
if (!e.value || !
|
|
2523
|
+
if (!e.value || !i.value || !p.value)
|
|
2520
2524
|
return [];
|
|
2521
2525
|
try {
|
|
2522
|
-
const d = e.value.registry.registry[
|
|
2526
|
+
const d = e.value.registry.registry[i.value];
|
|
2523
2527
|
if (!d?.workflow?.states)
|
|
2524
2528
|
return [];
|
|
2525
|
-
const w =
|
|
2526
|
-
return R?.on ? Object.keys(R.on).map((
|
|
2527
|
-
const
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2530
|
-
const It =
|
|
2531
|
-
await
|
|
2529
|
+
const w = y.value ? "creating" : "editing", R = d.workflow.states[w];
|
|
2530
|
+
return R?.on ? Object.keys(R.on).map((G) => {
|
|
2531
|
+
const ve = R.on?.[G], X = typeof ve == "string" ? ve : "unknown", At = async () => {
|
|
2532
|
+
const ot = e.value?.getRecordById(i.value, p.value);
|
|
2533
|
+
if (ot) {
|
|
2534
|
+
const It = s.value || {};
|
|
2535
|
+
await ot.triggerTransition(G, {
|
|
2532
2536
|
currentState: w,
|
|
2533
2537
|
targetState: X,
|
|
2534
2538
|
fsmContext: It
|
|
@@ -2536,16 +2540,16 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2536
2540
|
}
|
|
2537
2541
|
};
|
|
2538
2542
|
return {
|
|
2539
|
-
label: `${
|
|
2543
|
+
label: `${G} (→ ${X})`,
|
|
2540
2544
|
action: At
|
|
2541
2545
|
};
|
|
2542
2546
|
}) : [];
|
|
2543
2547
|
} catch (l) {
|
|
2544
2548
|
return console.warn("Error getting available transitions:", l), [];
|
|
2545
2549
|
}
|
|
2546
|
-
},
|
|
2550
|
+
}, _ = x(() => {
|
|
2547
2551
|
const l = [];
|
|
2548
|
-
switch (
|
|
2552
|
+
switch (h.value) {
|
|
2549
2553
|
case "doctypes":
|
|
2550
2554
|
l.push({
|
|
2551
2555
|
type: "button",
|
|
@@ -2586,13 +2590,13 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2586
2590
|
return l;
|
|
2587
2591
|
}), D = x(() => {
|
|
2588
2592
|
const l = [];
|
|
2589
|
-
return
|
|
2593
|
+
return h.value === "records" && c.value ? l.push(
|
|
2590
2594
|
{ title: "Home", to: "/" },
|
|
2591
|
-
{ title: P(
|
|
2592
|
-
) :
|
|
2595
|
+
{ title: P(c.value), to: `/${c.value}` }
|
|
2596
|
+
) : h.value === "record" && c.value && l.push(
|
|
2593
2597
|
{ title: "Home", to: "/" },
|
|
2594
|
-
{ title: P(
|
|
2595
|
-
{ title:
|
|
2598
|
+
{ title: P(c.value), to: `/${c.value}` },
|
|
2599
|
+
{ title: y.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
|
|
2596
2600
|
), l;
|
|
2597
2601
|
}), V = (l) => {
|
|
2598
2602
|
const d = [
|
|
@@ -2600,7 +2604,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2600
2604
|
title: "Go Home",
|
|
2601
2605
|
description: "Navigate to the home page",
|
|
2602
2606
|
action: () => {
|
|
2603
|
-
|
|
2607
|
+
u.value?.push("/");
|
|
2604
2608
|
}
|
|
2605
2609
|
},
|
|
2606
2610
|
{
|
|
@@ -2609,15 +2613,15 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2609
2613
|
action: () => a.value = !a.value
|
|
2610
2614
|
}
|
|
2611
2615
|
];
|
|
2612
|
-
return
|
|
2613
|
-
title: `View ${P(
|
|
2614
|
-
description: `Navigate to ${
|
|
2616
|
+
return c.value && (d.push({
|
|
2617
|
+
title: `View ${P(c.value)} Records`,
|
|
2618
|
+
description: `Navigate to ${c.value} list`,
|
|
2615
2619
|
action: () => {
|
|
2616
|
-
|
|
2620
|
+
u.value?.push(`/${c.value}`);
|
|
2617
2621
|
}
|
|
2618
2622
|
}), d.push({
|
|
2619
|
-
title: `Create New ${P(
|
|
2620
|
-
description: `Create a new ${
|
|
2623
|
+
title: `Create New ${P(c.value)}`,
|
|
2624
|
+
description: `Create a new ${c.value} record`,
|
|
2621
2625
|
action: () => {
|
|
2622
2626
|
z();
|
|
2623
2627
|
}
|
|
@@ -2626,22 +2630,22 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2626
2630
|
title: `View ${P(w)}`,
|
|
2627
2631
|
description: `Navigate to ${w} list`,
|
|
2628
2632
|
action: () => {
|
|
2629
|
-
|
|
2633
|
+
u.value?.push(`/${w}`);
|
|
2630
2634
|
}
|
|
2631
2635
|
});
|
|
2632
2636
|
}), l ? d.filter(
|
|
2633
2637
|
(w) => w.title.toLowerCase().includes(l.toLowerCase()) || w.description.toLowerCase().includes(l.toLowerCase())
|
|
2634
2638
|
) : d;
|
|
2635
|
-
},
|
|
2639
|
+
}, M = (l) => {
|
|
2636
2640
|
l.action(), a.value = !1;
|
|
2637
2641
|
}, P = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), U = (l) => e.value ? e.value.getRecordIds(l).length : 0, q = async (l) => {
|
|
2638
|
-
await
|
|
2639
|
-
},
|
|
2640
|
-
await
|
|
2642
|
+
await u.value?.push(`/${l}`);
|
|
2643
|
+
}, K = async (l) => {
|
|
2644
|
+
await u.value?.push(`/${c.value}/${l}`);
|
|
2641
2645
|
}, z = async () => {
|
|
2642
2646
|
const l = `new-${Date.now()}`;
|
|
2643
|
-
await
|
|
2644
|
-
},
|
|
2647
|
+
await u.value?.push(`/${c.value}/${l}`);
|
|
2648
|
+
}, $ = (l) => {
|
|
2645
2649
|
if (e.value)
|
|
2646
2650
|
try {
|
|
2647
2651
|
e.value.records(l);
|
|
@@ -2711,7 +2715,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2711
2715
|
}
|
|
2712
2716
|
];
|
|
2713
2717
|
}, W = () => {
|
|
2714
|
-
if (!
|
|
2718
|
+
if (!i.value) return [];
|
|
2715
2719
|
if (!e.value) return [];
|
|
2716
2720
|
const l = m(), d = C();
|
|
2717
2721
|
if (d.length === 0)
|
|
@@ -2724,9 +2728,9 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2724
2728
|
<nav class="breadcrumbs">
|
|
2725
2729
|
<a href="/">Home</a>
|
|
2726
2730
|
<span class="separator">/</span>
|
|
2727
|
-
<span class="current">${P(
|
|
2731
|
+
<span class="current">${P(c.value || i.value)}</span>
|
|
2728
2732
|
</nav>
|
|
2729
|
-
<h1>${P(
|
|
2733
|
+
<h1>${P(c.value || i.value)} Records</h1>
|
|
2730
2734
|
</div>
|
|
2731
2735
|
`
|
|
2732
2736
|
},
|
|
@@ -2735,7 +2739,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2735
2739
|
component: "div",
|
|
2736
2740
|
value: `
|
|
2737
2741
|
<div class="loading-state">
|
|
2738
|
-
<p>Loading ${P(
|
|
2742
|
+
<p>Loading ${P(c.value || i.value)} schema...</p>
|
|
2739
2743
|
</div>
|
|
2740
2744
|
`
|
|
2741
2745
|
}
|
|
@@ -2755,9 +2759,9 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2755
2759
|
<nav class="breadcrumbs">
|
|
2756
2760
|
<a href="/">Home</a>
|
|
2757
2761
|
<span class="separator">/</span>
|
|
2758
|
-
<span class="current">${P(
|
|
2762
|
+
<span class="current">${P(c.value || i.value)}</span>
|
|
2759
2763
|
</nav>
|
|
2760
|
-
<h1>${P(
|
|
2764
|
+
<h1>${P(c.value || i.value)} Records</h1>
|
|
2761
2765
|
</div>
|
|
2762
2766
|
`
|
|
2763
2767
|
},
|
|
@@ -2767,7 +2771,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2767
2771
|
value: `
|
|
2768
2772
|
<div class="view-actions">
|
|
2769
2773
|
<button class="btn-primary" data-action="create">
|
|
2770
|
-
New ${P(
|
|
2774
|
+
New ${P(c.value || i.value)}
|
|
2771
2775
|
</button>
|
|
2772
2776
|
</div>
|
|
2773
2777
|
`
|
|
@@ -2778,7 +2782,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2778
2782
|
component: "div",
|
|
2779
2783
|
value: `
|
|
2780
2784
|
<div class="empty-state">
|
|
2781
|
-
<p>No ${
|
|
2785
|
+
<p>No ${c.value || i.value} records found.</p>
|
|
2782
2786
|
<button class="btn-primary" data-action="create">
|
|
2783
2787
|
Create First Record
|
|
2784
2788
|
</button>
|
|
@@ -2816,10 +2820,10 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2816
2820
|
]
|
|
2817
2821
|
];
|
|
2818
2822
|
}, g = () => {
|
|
2819
|
-
if (!
|
|
2823
|
+
if (!i.value) return [];
|
|
2820
2824
|
if (!e.value) return [];
|
|
2821
2825
|
try {
|
|
2822
|
-
const d = e.value?.registry?.registry[
|
|
2826
|
+
const d = e.value?.registry?.registry[i.value];
|
|
2823
2827
|
if (!d?.schema)
|
|
2824
2828
|
return [
|
|
2825
2829
|
{
|
|
@@ -2830,13 +2834,13 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2830
2834
|
<nav class="breadcrumbs">
|
|
2831
2835
|
<a href="/">Home</a>
|
|
2832
2836
|
<span class="separator">/</span>
|
|
2833
|
-
<a href="/${
|
|
2834
|
-
|
|
2837
|
+
<a href="/${c.value || i.value}">${P(
|
|
2838
|
+
c.value || i.value
|
|
2835
2839
|
)}</a>
|
|
2836
2840
|
<span class="separator">/</span>
|
|
2837
|
-
<span class="current">${
|
|
2841
|
+
<span class="current">${y.value ? "New Record" : p.value}</span>
|
|
2838
2842
|
</nav>
|
|
2839
|
-
<h1>${
|
|
2843
|
+
<h1>${y.value ? `New ${P(c.value || i.value)}` : `Edit ${P(c.value || i.value)}`}</h1>
|
|
2840
2844
|
</div>
|
|
2841
2845
|
`
|
|
2842
2846
|
},
|
|
@@ -2845,7 +2849,7 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2845
2849
|
component: "div",
|
|
2846
2850
|
value: `
|
|
2847
2851
|
<div class="loading-state">
|
|
2848
|
-
<p>Loading ${P(
|
|
2852
|
+
<p>Loading ${P(c.value || i.value)} form...</p>
|
|
2849
2853
|
</div>
|
|
2850
2854
|
`
|
|
2851
2855
|
}
|
|
@@ -2860,14 +2864,14 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2860
2864
|
<nav class="breadcrumbs">
|
|
2861
2865
|
<a href="/">Home</a>
|
|
2862
2866
|
<span class="separator">/</span>
|
|
2863
|
-
<a href="/${
|
|
2864
|
-
|
|
2867
|
+
<a href="/${c.value || i.value}">${P(
|
|
2868
|
+
c.value || i.value
|
|
2865
2869
|
)}</a>
|
|
2866
2870
|
<span class="separator">/</span>
|
|
2867
|
-
<span class="current">${
|
|
2871
|
+
<span class="current">${y.value ? "New Record" : p.value}</span>
|
|
2868
2872
|
</nav>
|
|
2869
2873
|
<h1>
|
|
2870
|
-
${
|
|
2874
|
+
${y.value ? `New ${P(c.value || i.value)}` : `Edit ${P(c.value || i.value)}`}
|
|
2871
2875
|
</h1>
|
|
2872
2876
|
</div>
|
|
2873
2877
|
`
|
|
@@ -2881,14 +2885,14 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2881
2885
|
${n.value ? "Saving..." : "Save"}
|
|
2882
2886
|
</button>
|
|
2883
2887
|
<button class="btn-secondary" data-action="cancel">Cancel</button>
|
|
2884
|
-
${
|
|
2888
|
+
${y.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
|
|
2885
2889
|
</div>
|
|
2886
2890
|
`
|
|
2887
2891
|
},
|
|
2888
|
-
...w.map((
|
|
2889
|
-
...
|
|
2892
|
+
...w.map((J) => ({
|
|
2893
|
+
...J,
|
|
2890
2894
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2891
|
-
value: R[
|
|
2895
|
+
value: R[J.fieldname] || ""
|
|
2892
2896
|
}))
|
|
2893
2897
|
];
|
|
2894
2898
|
} catch {
|
|
@@ -2898,21 +2902,21 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2898
2902
|
component: "div",
|
|
2899
2903
|
value: `
|
|
2900
2904
|
<div class="error-state">
|
|
2901
|
-
<p>Unable to load form schema for ${P(
|
|
2905
|
+
<p>Unable to load form schema for ${P(c.value || i.value)}</p>
|
|
2902
2906
|
</div>
|
|
2903
2907
|
`
|
|
2904
2908
|
}
|
|
2905
2909
|
];
|
|
2906
2910
|
}
|
|
2907
2911
|
}, m = () => {
|
|
2908
|
-
if (!e.value || !
|
|
2912
|
+
if (!e.value || !i.value)
|
|
2909
2913
|
return [];
|
|
2910
|
-
const d = e.value.records(
|
|
2914
|
+
const d = e.value.records(i.value)?.get("");
|
|
2911
2915
|
return d && typeof d == "object" && !Array.isArray(d) ? Object.values(d) : [];
|
|
2912
2916
|
}, C = () => {
|
|
2913
|
-
if (!e.value || !
|
|
2917
|
+
if (!e.value || !i.value) return [];
|
|
2914
2918
|
try {
|
|
2915
|
-
const d = e.value.registry.registry[
|
|
2919
|
+
const d = e.value.registry.registry[i.value];
|
|
2916
2920
|
if (d?.schema)
|
|
2917
2921
|
return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((R) => ({
|
|
2918
2922
|
fieldname: R.fieldname,
|
|
@@ -2922,8 +2926,8 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2922
2926
|
} catch {
|
|
2923
2927
|
}
|
|
2924
2928
|
return [];
|
|
2925
|
-
}, B = () => !e.value || !
|
|
2926
|
-
switch (
|
|
2929
|
+
}, B = () => !e.value || !i.value || y.value ? {} : e.value.getRecordById(i.value, p.value)?.get("") || {}, k = x(() => {
|
|
2930
|
+
switch (h.value) {
|
|
2927
2931
|
case "doctypes":
|
|
2928
2932
|
return te();
|
|
2929
2933
|
case "records":
|
|
@@ -2943,12 +2947,12 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2943
2947
|
), H(
|
|
2944
2948
|
I,
|
|
2945
2949
|
(l) => {
|
|
2946
|
-
if (!(!e.value || !
|
|
2950
|
+
if (!(!e.value || !i.value || !p.value || y.value))
|
|
2947
2951
|
try {
|
|
2948
2952
|
const d = e.value.getStore();
|
|
2949
2953
|
l.forEach((w) => {
|
|
2950
2954
|
if (w.fieldname && "value" in w && !["header", "actions", "loading", "error"].includes(w.fieldname)) {
|
|
2951
|
-
const R = `${
|
|
2955
|
+
const R = `${i.value}.${p.value}.${w.fieldname}`;
|
|
2952
2956
|
(d.has(R) ? d.get(R) : void 0) !== w.value && d.set(R, w.value);
|
|
2953
2957
|
}
|
|
2954
2958
|
});
|
|
@@ -2962,20 +2966,20 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2962
2966
|
if (e.value) {
|
|
2963
2967
|
n.value = !0;
|
|
2964
2968
|
try {
|
|
2965
|
-
const l =
|
|
2966
|
-
if (
|
|
2969
|
+
const l = s.value || {};
|
|
2970
|
+
if (y.value) {
|
|
2967
2971
|
const d = `record-${Date.now()}`, w = { id: d, ...l };
|
|
2968
|
-
e.value.addRecord(
|
|
2969
|
-
const R = e.value.getRecordById(
|
|
2972
|
+
e.value.addRecord(i.value, d, w);
|
|
2973
|
+
const R = e.value.getRecordById(i.value, d);
|
|
2970
2974
|
R && await R.triggerTransition("SAVE", {
|
|
2971
2975
|
currentState: "creating",
|
|
2972
2976
|
targetState: "saved",
|
|
2973
2977
|
fsmContext: w
|
|
2974
|
-
}), await
|
|
2978
|
+
}), await u.value?.replace(`/${c.value}/${d}`);
|
|
2975
2979
|
} else {
|
|
2976
|
-
const d = { id:
|
|
2977
|
-
e.value.addRecord(
|
|
2978
|
-
const w = e.value.getRecordById(
|
|
2980
|
+
const d = { id: p.value, ...l };
|
|
2981
|
+
e.value.addRecord(i.value, p.value, d);
|
|
2982
|
+
const w = e.value.getRecordById(i.value, p.value);
|
|
2979
2983
|
w && await w.triggerTransition("SAVE", {
|
|
2980
2984
|
currentState: "editing",
|
|
2981
2985
|
targetState: "saved",
|
|
@@ -2988,31 +2992,31 @@ const Uo = { class: "aform" }, zo = {
|
|
|
2988
2992
|
}
|
|
2989
2993
|
}
|
|
2990
2994
|
}, E = async () => {
|
|
2991
|
-
if (
|
|
2992
|
-
await
|
|
2995
|
+
if (y.value)
|
|
2996
|
+
await u.value?.push(`/${c.value}`);
|
|
2993
2997
|
else {
|
|
2994
2998
|
if (e.value) {
|
|
2995
|
-
const l = e.value.getRecordById(
|
|
2999
|
+
const l = e.value.getRecordById(i.value, p.value);
|
|
2996
3000
|
l && await l.triggerTransition("CANCEL", {
|
|
2997
3001
|
currentState: "editing",
|
|
2998
3002
|
targetState: "cancelled"
|
|
2999
3003
|
});
|
|
3000
3004
|
}
|
|
3001
|
-
|
|
3005
|
+
v();
|
|
3002
3006
|
}
|
|
3003
3007
|
}, N = (l, d) => {
|
|
3004
3008
|
d && d();
|
|
3005
3009
|
}, S = async (l) => {
|
|
3006
3010
|
if (!e.value) return;
|
|
3007
|
-
const d = l ||
|
|
3011
|
+
const d = l || p.value;
|
|
3008
3012
|
if (d && confirm("Are you sure you want to delete this record?")) {
|
|
3009
|
-
const w = e.value.getRecordById(
|
|
3013
|
+
const w = e.value.getRecordById(i.value, d);
|
|
3010
3014
|
w && await w.triggerTransition("DELETE", {
|
|
3011
3015
|
currentState: "editing",
|
|
3012
3016
|
targetState: "deleted"
|
|
3013
|
-
}), e.value.removeRecord(
|
|
3017
|
+
}), e.value.removeRecord(i.value, d), h.value === "record" && await u.value?.push(`/${c.value}`);
|
|
3014
3018
|
}
|
|
3015
|
-
},
|
|
3019
|
+
}, f = async (l) => {
|
|
3016
3020
|
const d = l.target, w = d.getAttribute("data-action");
|
|
3017
3021
|
if (w)
|
|
3018
3022
|
switch (w) {
|
|
@@ -3031,32 +3035,32 @@ const Uo = { class: "aform" }, zo = {
|
|
|
3031
3035
|
}
|
|
3032
3036
|
const R = d.closest("td, th");
|
|
3033
3037
|
if (R) {
|
|
3034
|
-
const
|
|
3035
|
-
if (
|
|
3036
|
-
const
|
|
3037
|
-
if (
|
|
3038
|
-
const X =
|
|
3038
|
+
const J = R.textContent?.trim(), ee = R.closest("tr");
|
|
3039
|
+
if (J === "View Records" && ee) {
|
|
3040
|
+
const G = ee.querySelectorAll("td");
|
|
3041
|
+
if (G.length > 0) {
|
|
3042
|
+
const X = G[1].textContent?.trim();
|
|
3039
3043
|
X && await q(X);
|
|
3040
3044
|
}
|
|
3041
|
-
} else if (
|
|
3042
|
-
const
|
|
3043
|
-
if (
|
|
3044
|
-
const X =
|
|
3045
|
-
X && await
|
|
3045
|
+
} else if (J?.includes("Edit") && ee) {
|
|
3046
|
+
const G = ee.querySelectorAll("td");
|
|
3047
|
+
if (G.length > 0) {
|
|
3048
|
+
const X = G[0].textContent?.trim();
|
|
3049
|
+
X && await K(X);
|
|
3046
3050
|
}
|
|
3047
|
-
} else if (
|
|
3048
|
-
const
|
|
3049
|
-
if (
|
|
3050
|
-
const X =
|
|
3051
|
+
} else if (J?.includes("Delete") && ee) {
|
|
3052
|
+
const G = ee.querySelectorAll("td");
|
|
3053
|
+
if (G.length > 0) {
|
|
3054
|
+
const X = G[0].textContent?.trim();
|
|
3051
3055
|
X && await S(X);
|
|
3052
3056
|
}
|
|
3053
3057
|
}
|
|
3054
3058
|
}
|
|
3055
3059
|
};
|
|
3056
3060
|
H(
|
|
3057
|
-
[
|
|
3061
|
+
[h, i, p],
|
|
3058
3062
|
() => {
|
|
3059
|
-
|
|
3063
|
+
h.value === "record" && v();
|
|
3060
3064
|
},
|
|
3061
3065
|
{ immediate: !0 }
|
|
3062
3066
|
), H(
|
|
@@ -3065,17 +3069,17 @@ const Uo = { class: "aform" }, zo = {
|
|
|
3065
3069
|
},
|
|
3066
3070
|
{ immediate: !0 }
|
|
3067
3071
|
), H(
|
|
3068
|
-
[
|
|
3072
|
+
[h, i, e],
|
|
3069
3073
|
([l, d, w]) => {
|
|
3070
|
-
l === "records" && d && w &&
|
|
3074
|
+
l === "records" && d && w && $(d);
|
|
3071
3075
|
},
|
|
3072
3076
|
{ immediate: !0 }
|
|
3073
3077
|
);
|
|
3074
|
-
const
|
|
3075
|
-
if (!(!e.value || !
|
|
3078
|
+
const v = () => {
|
|
3079
|
+
if (!(!e.value || !i.value)) {
|
|
3076
3080
|
o.value = !0;
|
|
3077
3081
|
try {
|
|
3078
|
-
|
|
3082
|
+
y.value || e.value.getRecordById(i.value, p.value);
|
|
3079
3083
|
} catch (l) {
|
|
3080
3084
|
console.warn("Error loading record data:", l);
|
|
3081
3085
|
} finally {
|
|
@@ -3083,16 +3087,16 @@ const Uo = { class: "aform" }, zo = {
|
|
|
3083
3087
|
}
|
|
3084
3088
|
}
|
|
3085
3089
|
};
|
|
3086
|
-
return
|
|
3090
|
+
return Ge("desktopMethods", {
|
|
3087
3091
|
navigateToDoctype: q,
|
|
3088
|
-
openRecord:
|
|
3092
|
+
openRecord: K,
|
|
3089
3093
|
createNewRecord: z,
|
|
3090
3094
|
handleSave: L,
|
|
3091
3095
|
handleCancel: E,
|
|
3092
3096
|
handleDelete: S
|
|
3093
|
-
}),
|
|
3097
|
+
}), Te(() => {
|
|
3094
3098
|
se(() => {
|
|
3095
|
-
|
|
3099
|
+
h.value === "records" && i.value && e.value && $(i.value);
|
|
3096
3100
|
});
|
|
3097
3101
|
const l = (d) => {
|
|
3098
3102
|
(d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(), a.value = !0), d.key === "Escape" && a.value && (a.value = !1);
|
|
@@ -3100,22 +3104,22 @@ const Uo = { class: "aform" }, zo = {
|
|
|
3100
3104
|
return document.addEventListener("keydown", l), () => {
|
|
3101
3105
|
document.removeEventListener("keydown", l);
|
|
3102
3106
|
};
|
|
3103
|
-
}), (l, d) => (
|
|
3107
|
+
}), (l, d) => (j(), F("div", {
|
|
3104
3108
|
class: "desktop",
|
|
3105
|
-
onClick:
|
|
3109
|
+
onClick: f
|
|
3106
3110
|
}, [
|
|
3107
3111
|
ae(_t, {
|
|
3108
|
-
elements:
|
|
3112
|
+
elements: _.value,
|
|
3109
3113
|
onActionClick: N
|
|
3110
3114
|
}, null, 8, ["elements"]),
|
|
3111
|
-
I.value.length > 0 ? (
|
|
3115
|
+
I.value.length > 0 ? (j(), Xe(Oe(Go), {
|
|
3112
3116
|
key: 0,
|
|
3113
3117
|
modelValue: I.value,
|
|
3114
3118
|
"onUpdate:modelValue": d[0] || (d[0] = (w) => I.value = w),
|
|
3115
|
-
data:
|
|
3116
|
-
}, null, 8, ["modelValue", "data"])) :
|
|
3117
|
-
T("p", null, "Loading " + Y(
|
|
3118
|
-
])) : (
|
|
3119
|
+
data: s.value
|
|
3120
|
+
}, null, 8, ["modelValue", "data"])) : Oe(e) ? (j(), F("div", en, [
|
|
3121
|
+
T("p", null, "Loading " + Y(h.value) + " data...", 1)
|
|
3122
|
+
])) : (j(), F("div", Yo, [...d[2] || (d[2] = [
|
|
3119
3123
|
T("p", null, "Initializing Stonecrop...", -1)
|
|
3120
3124
|
])])),
|
|
3121
3125
|
ae(Rt, { breadcrumbs: D.value }, null, 8, ["breadcrumbs"]),
|
|
@@ -3123,14 +3127,14 @@ const Uo = { class: "aform" }, zo = {
|
|
|
3123
3127
|
"is-open": a.value,
|
|
3124
3128
|
search: V,
|
|
3125
3129
|
placeholder: "Type a command or search...",
|
|
3126
|
-
onSelect:
|
|
3130
|
+
onSelect: M,
|
|
3127
3131
|
onClose: d[1] || (d[1] = (w) => a.value = !1)
|
|
3128
3132
|
}, {
|
|
3129
3133
|
title: we(({ result: w }) => [
|
|
3130
|
-
|
|
3134
|
+
Re(Y(w.title), 1)
|
|
3131
3135
|
]),
|
|
3132
3136
|
content: we(({ result: w }) => [
|
|
3133
|
-
|
|
3137
|
+
Re(Y(w.description), 1)
|
|
3134
3138
|
]),
|
|
3135
3139
|
_: 1
|
|
3136
3140
|
}, 8, ["is-open"])
|