@stonecrop/desktop 0.7.9 → 0.8.1
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 +1328 -1178
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.umd.cjs +13 -13
- package/dist/desktop.umd.cjs.map +1 -1
- package/package.json +5 -5
package/dist/desktop.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as Se, ref as C, onMounted as xe, createElementBlock as L, openBlock as j, normalizeClass as Oe, createElementVNode as T, Fragment as ue, renderList as be, createCommentVNode as ce, toDisplayString as ee, withDirectives as Re, vShow as ze, useTemplateRef as vt, computed as I, watch as H, nextTick as re, createBlock as Qe, Teleport as At, createVNode as ae, Transition as It, withCtx as we, withModifiers as ft, vModelText as ht, renderSlot as Me, createTextVNode as Ce, inject as Je, provide as Ge, reactive as gt, toRaw as mt, isRef as de, isReactive as Pe, toRef as ne, hasInjectionContext as Tt, getCurrentInstance as yt, markRaw as fe, effectScope as xt, getCurrentScope as Xe, onScopeDispose as Ye, toRefs as ot, shallowRef as $e, toValue as X, readonly as Ve, customRef as et, unref as Ne, mergeModels as at, useModel as Pt, watchEffect as Ee, resolveComponent as bt, resolveDynamicComponent as Vt, mergeProps as Mt, withKeys as ve, normalizeStyle as je } from "vue";
|
|
2
|
+
const jt = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Ft = { key: 1 }, Bt = ["onClick"], Ht = { class: "dropdown-container" }, Ut = { class: "dropdown" }, Wt = ["onClick"], Kt = ["href"], zt = { class: "dropdown-item" }, Jt = /* @__PURE__ */ Se({
|
|
3
3
|
__name: "ActionSet",
|
|
4
4
|
props: {
|
|
5
5
|
elements: { default: () => [] }
|
|
6
6
|
},
|
|
7
7
|
emits: ["actionClick"],
|
|
8
|
-
setup(
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
setup(t, { emit: e }) {
|
|
9
|
+
const o = e, a = C({}), n = C(!1), i = C(-1), r = C(!1), c = C(!1);
|
|
10
|
+
xe(() => {
|
|
11
|
+
s();
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const s = () => {
|
|
14
14
|
a.value = {};
|
|
15
15
|
}, u = () => {
|
|
16
|
-
r.value = !0,
|
|
16
|
+
r.value = !0, i.value = setTimeout(() => {
|
|
17
17
|
r.value && (n.value = !0);
|
|
18
18
|
}, 500);
|
|
19
19
|
}, p = () => {
|
|
20
|
-
r.value = !1, c.value = !1, clearTimeout(
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
20
|
+
r.value = !1, c.value = !1, clearTimeout(i.value), n.value = !1;
|
|
21
|
+
}, h = (D) => {
|
|
22
|
+
const k = !a.value[D];
|
|
23
|
+
s(), k && (a.value[D] = !0);
|
|
24
|
+
}, b = (D, k) => {
|
|
25
|
+
o("actionClick", k, D);
|
|
26
26
|
};
|
|
27
|
-
return (
|
|
28
|
-
class:
|
|
27
|
+
return (D, k) => (j(), L("div", {
|
|
28
|
+
class: Oe([{ "open-set": n.value, "hovered-and-closed": c.value }, "action-set collapse"]),
|
|
29
29
|
onMouseover: u,
|
|
30
30
|
onMouseleave: p
|
|
31
31
|
}, [
|
|
32
|
-
T("div",
|
|
32
|
+
T("div", jt, [
|
|
33
33
|
T("div", {
|
|
34
34
|
id: "chevron",
|
|
35
|
-
onClick:
|
|
36
|
-
}, [...
|
|
35
|
+
onClick: k[0] || (k[0] = (O) => c.value = !c.value)
|
|
36
|
+
}, [...k[1] || (k[1] = [
|
|
37
37
|
T("svg", {
|
|
38
38
|
id: "Layer_1",
|
|
39
39
|
class: "leftBar",
|
|
@@ -66,58 +66,58 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
|
|
|
66
66
|
], -1)
|
|
67
67
|
])])
|
|
68
68
|
]),
|
|
69
|
-
|
|
70
|
-
(
|
|
71
|
-
key:
|
|
69
|
+
k[2] || (k[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
70
|
+
(j(!0), L(ue, null, be(t.elements, (O, V) => (j(), L("div", {
|
|
71
|
+
key: O.label,
|
|
72
72
|
class: "action-element"
|
|
73
73
|
}, [
|
|
74
|
-
|
|
74
|
+
O.type == "button" ? (j(), L("button", {
|
|
75
75
|
key: 0,
|
|
76
|
-
disabled:
|
|
76
|
+
disabled: O.disabled,
|
|
77
77
|
class: "button-default",
|
|
78
|
-
onClick: (
|
|
79
|
-
},
|
|
80
|
-
|
|
78
|
+
onClick: (M) => b(O.action, O.label)
|
|
79
|
+
}, ee(O.label), 9, Lt)) : ce("", !0),
|
|
80
|
+
O.type == "dropdown" ? (j(), L("div", Ft, [
|
|
81
81
|
T("button", {
|
|
82
82
|
class: "button-default",
|
|
83
|
-
onClick: (
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
T("div",
|
|
87
|
-
(
|
|
88
|
-
key:
|
|
83
|
+
onClick: (M) => h(V)
|
|
84
|
+
}, ee(O.label), 9, Bt),
|
|
85
|
+
Re(T("div", Ht, [
|
|
86
|
+
T("div", Ut, [
|
|
87
|
+
(j(!0), L(ue, null, be(O.actions, (M, x) => (j(), L("div", {
|
|
88
|
+
key: M.label
|
|
89
89
|
}, [
|
|
90
|
-
|
|
90
|
+
M.action != null ? (j(), L("button", {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "dropdown-item",
|
|
93
|
-
onClick: (W) =>
|
|
94
|
-
},
|
|
93
|
+
onClick: (W) => b(M.action, M.label)
|
|
94
|
+
}, ee(M.label), 9, Wt)) : M.link != null ? (j(), L("a", {
|
|
95
95
|
key: 1,
|
|
96
|
-
href:
|
|
96
|
+
href: M.link
|
|
97
97
|
}, [
|
|
98
|
-
T("button",
|
|
99
|
-
], 8,
|
|
98
|
+
T("button", zt, ee(M.label), 1)
|
|
99
|
+
], 8, Kt)) : ce("", !0)
|
|
100
100
|
]))), 128))
|
|
101
101
|
])
|
|
102
102
|
], 512), [
|
|
103
|
-
[
|
|
103
|
+
[ze, a.value[V]]
|
|
104
104
|
])
|
|
105
|
-
])) :
|
|
105
|
+
])) : ce("", !0)
|
|
106
106
|
]))), 128))
|
|
107
107
|
], 34));
|
|
108
108
|
}
|
|
109
|
-
}),
|
|
110
|
-
const
|
|
109
|
+
}), wt = (t, e) => {
|
|
110
|
+
const o = t.__vccOpts || t;
|
|
111
111
|
for (const [a, n] of e)
|
|
112
|
-
|
|
113
|
-
return
|
|
114
|
-
},
|
|
112
|
+
o[a] = n;
|
|
113
|
+
return o;
|
|
114
|
+
}, St = /* @__PURE__ */ wt(Jt, [["__scopeId", "data-v-eb01c863"]]), Gt = { class: "command-palette-header" }, qt = ["placeholder"], Zt = {
|
|
115
115
|
key: 0,
|
|
116
116
|
class: "command-palette-results"
|
|
117
|
-
},
|
|
117
|
+
}, Qt = ["onClick", "onMouseover"], Xt = { class: "result-title" }, Yt = { class: "result-content" }, eo = {
|
|
118
118
|
key: 1,
|
|
119
119
|
class: "command-palette-no-results"
|
|
120
|
-
},
|
|
120
|
+
}, $t = /* @__PURE__ */ Se({
|
|
121
121
|
__name: "CommandPalette",
|
|
122
122
|
props: {
|
|
123
123
|
search: { type: Function },
|
|
@@ -126,19 +126,19 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
|
|
|
126
126
|
maxResults: { default: 10 }
|
|
127
127
|
},
|
|
128
128
|
emits: ["select", "close"],
|
|
129
|
-
setup(
|
|
130
|
-
const
|
|
129
|
+
setup(t, { emit: e }) {
|
|
130
|
+
const o = e, a = C(""), n = C(0), i = vt("input"), r = I(() => a.value ? t.search(a.value).slice(0, t.maxResults) : []);
|
|
131
131
|
H(
|
|
132
|
-
() =>
|
|
132
|
+
() => t.isOpen,
|
|
133
133
|
async (p) => {
|
|
134
|
-
p && (a.value = "", n.value = 0, await
|
|
134
|
+
p && (a.value = "", n.value = 0, await re(), i.value?.focus());
|
|
135
135
|
}
|
|
136
136
|
), H(r, () => {
|
|
137
137
|
n.value = 0;
|
|
138
138
|
});
|
|
139
139
|
const c = () => {
|
|
140
|
-
|
|
141
|
-
},
|
|
140
|
+
o("close");
|
|
141
|
+
}, s = (p) => {
|
|
142
142
|
switch (p.key) {
|
|
143
143
|
case "Escape":
|
|
144
144
|
c();
|
|
@@ -154,689 +154,689 @@ const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { k
|
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
156
|
}, u = (p) => {
|
|
157
|
-
|
|
157
|
+
o("select", p), c();
|
|
158
158
|
};
|
|
159
|
-
return (p,
|
|
160
|
-
|
|
161
|
-
default:
|
|
162
|
-
|
|
159
|
+
return (p, h) => (j(), Qe(At, { to: "body" }, [
|
|
160
|
+
ae(It, { name: "fade" }, {
|
|
161
|
+
default: we(() => [
|
|
162
|
+
t.isOpen ? (j(), L("div", {
|
|
163
163
|
key: 0,
|
|
164
164
|
class: "command-palette-overlay",
|
|
165
165
|
onClick: c
|
|
166
166
|
}, [
|
|
167
167
|
T("div", {
|
|
168
168
|
class: "command-palette",
|
|
169
|
-
onClick:
|
|
169
|
+
onClick: h[1] || (h[1] = ft(() => {
|
|
170
170
|
}, ["stop"]))
|
|
171
171
|
}, [
|
|
172
|
-
T("div",
|
|
173
|
-
|
|
172
|
+
T("div", Gt, [
|
|
173
|
+
Re(T("input", {
|
|
174
174
|
ref: "input",
|
|
175
|
-
"onUpdate:modelValue":
|
|
175
|
+
"onUpdate:modelValue": h[0] || (h[0] = (b) => a.value = b),
|
|
176
176
|
type: "text",
|
|
177
177
|
class: "command-palette-input",
|
|
178
|
-
placeholder:
|
|
178
|
+
placeholder: t.placeholder,
|
|
179
179
|
autofocus: "",
|
|
180
|
-
onKeydown:
|
|
181
|
-
}, null, 40,
|
|
182
|
-
[
|
|
180
|
+
onKeydown: s
|
|
181
|
+
}, null, 40, qt), [
|
|
182
|
+
[ht, a.value]
|
|
183
183
|
])
|
|
184
184
|
]),
|
|
185
|
-
r.value.length ? (
|
|
186
|
-
(
|
|
187
|
-
key:
|
|
188
|
-
class:
|
|
189
|
-
onClick: (
|
|
190
|
-
onMouseover: (
|
|
185
|
+
r.value.length ? (j(), L("div", Zt, [
|
|
186
|
+
(j(!0), L(ue, null, be(r.value, (b, D) => (j(), L("div", {
|
|
187
|
+
key: D,
|
|
188
|
+
class: Oe(["command-palette-result", { selected: D === n.value }]),
|
|
189
|
+
onClick: (k) => u(b),
|
|
190
|
+
onMouseover: (k) => n.value = D
|
|
191
191
|
}, [
|
|
192
|
-
T("div",
|
|
193
|
-
|
|
192
|
+
T("div", Xt, [
|
|
193
|
+
Me(p.$slots, "title", { result: b })
|
|
194
194
|
]),
|
|
195
|
-
T("div",
|
|
196
|
-
|
|
195
|
+
T("div", Yt, [
|
|
196
|
+
Me(p.$slots, "content", { result: b })
|
|
197
197
|
])
|
|
198
|
-
], 42,
|
|
199
|
-
])) : a.value && !r.value.length ? (
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
], 42, Qt))), 128))
|
|
199
|
+
])) : a.value && !r.value.length ? (j(), L("div", eo, [
|
|
200
|
+
Me(p.$slots, "empty", {}, () => [
|
|
201
|
+
Ce(' No results found for "' + ee(a.value) + '" ', 1)
|
|
202
202
|
])
|
|
203
|
-
])) :
|
|
203
|
+
])) : ce("", !0)
|
|
204
204
|
])
|
|
205
|
-
])) :
|
|
205
|
+
])) : ce("", !0)
|
|
206
206
|
]),
|
|
207
207
|
_: 3
|
|
208
208
|
})
|
|
209
209
|
]));
|
|
210
210
|
}
|
|
211
|
-
}),
|
|
212
|
-
let
|
|
213
|
-
const
|
|
211
|
+
}), he = typeof window < "u";
|
|
212
|
+
let ge;
|
|
213
|
+
const Ae = (t) => ge = t;
|
|
214
214
|
process.env.NODE_ENV;
|
|
215
|
-
const
|
|
215
|
+
const to = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
216
216
|
/* istanbul ignore next */
|
|
217
217
|
/* @__PURE__ */ Symbol()
|
|
218
218
|
);
|
|
219
|
-
function
|
|
220
|
-
return
|
|
219
|
+
function se(t) {
|
|
220
|
+
return t && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && typeof t.toJSON != "function";
|
|
221
221
|
}
|
|
222
|
-
var
|
|
223
|
-
(function(
|
|
224
|
-
|
|
225
|
-
})(
|
|
226
|
-
function
|
|
227
|
-
for (const
|
|
228
|
-
const a = e[
|
|
229
|
-
if (!(
|
|
222
|
+
var me;
|
|
223
|
+
(function(t) {
|
|
224
|
+
t.direct = "direct", t.patchObject = "patch object", t.patchFunction = "patch function";
|
|
225
|
+
})(me || (me = {}));
|
|
226
|
+
function Et(t, e) {
|
|
227
|
+
for (const o in e) {
|
|
228
|
+
const a = e[o];
|
|
229
|
+
if (!(o in t))
|
|
230
230
|
continue;
|
|
231
|
-
const n = o
|
|
232
|
-
|
|
231
|
+
const n = t[o];
|
|
232
|
+
se(n) && se(a) && !de(a) && !Pe(a) ? t[o] = Et(n, a) : t[o] = a;
|
|
233
233
|
}
|
|
234
|
-
return
|
|
234
|
+
return t;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const _t = () => {
|
|
237
237
|
};
|
|
238
|
-
function
|
|
239
|
-
|
|
238
|
+
function nt(t, e, o, a = _t) {
|
|
239
|
+
t.add(e);
|
|
240
240
|
const n = () => {
|
|
241
|
-
|
|
241
|
+
t.delete(e) && a();
|
|
242
242
|
};
|
|
243
|
-
return !
|
|
243
|
+
return !o && Xe() && Ye(n), n;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
function ie(t, ...e) {
|
|
246
|
+
t.forEach((o) => {
|
|
247
|
+
o(...e);
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
const
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
for (const
|
|
254
|
-
if (!e.hasOwnProperty(
|
|
250
|
+
const oo = (t) => t(), rt = /* @__PURE__ */ Symbol(), Le = /* @__PURE__ */ Symbol();
|
|
251
|
+
function qe(t, e) {
|
|
252
|
+
t instanceof Map && e instanceof Map ? e.forEach((o, a) => t.set(a, o)) : t instanceof Set && e instanceof Set && e.forEach(t.add, t);
|
|
253
|
+
for (const o in e) {
|
|
254
|
+
if (!e.hasOwnProperty(o))
|
|
255
255
|
continue;
|
|
256
|
-
const a = e[
|
|
257
|
-
|
|
256
|
+
const a = e[o], n = t[o];
|
|
257
|
+
se(n) && se(a) && t.hasOwnProperty(o) && !de(a) && !Pe(a) ? t[o] = qe(n, a) : t[o] = a;
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return t;
|
|
260
260
|
}
|
|
261
|
-
const
|
|
261
|
+
const ao = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
262
262
|
/* istanbul ignore next */
|
|
263
263
|
/* @__PURE__ */ Symbol()
|
|
264
264
|
);
|
|
265
|
-
function
|
|
266
|
-
return !
|
|
265
|
+
function no(t) {
|
|
266
|
+
return !se(t) || !Object.prototype.hasOwnProperty.call(t, ao);
|
|
267
267
|
}
|
|
268
|
-
const { assign:
|
|
269
|
-
function
|
|
270
|
-
return !!(
|
|
268
|
+
const { assign: Q } = Object;
|
|
269
|
+
function st(t) {
|
|
270
|
+
return !!(de(t) && t.effect);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
const { state: n, actions:
|
|
274
|
-
let
|
|
272
|
+
function it(t, e, o, a) {
|
|
273
|
+
const { state: n, actions: i, getters: r } = e, c = o.state.value[t];
|
|
274
|
+
let s;
|
|
275
275
|
function u() {
|
|
276
|
-
!c && (process.env.NODE_ENV === "production" || !a) && (
|
|
276
|
+
!c && (process.env.NODE_ENV === "production" || !a) && (o.state.value[t] = n ? n() : {});
|
|
277
277
|
const p = process.env.NODE_ENV !== "production" && a ? (
|
|
278
278
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
279
|
-
|
|
280
|
-
) :
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
return r[
|
|
285
|
-
})),
|
|
286
|
-
}
|
|
287
|
-
return
|
|
279
|
+
ot(C(n ? n() : {}).value)
|
|
280
|
+
) : ot(o.state.value[t]);
|
|
281
|
+
return Q(p, i, Object.keys(r || {}).reduce((h, b) => (process.env.NODE_ENV !== "production" && b in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${b}" in store "${t}".`), h[b] = fe(I(() => {
|
|
282
|
+
Ae(o);
|
|
283
|
+
const D = o._s.get(t);
|
|
284
|
+
return r[b].call(D, D);
|
|
285
|
+
})), h), {}));
|
|
286
|
+
}
|
|
287
|
+
return s = Ze(t, u, e, o, a, !0), s;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ze(t, e, o = {}, a, n, i) {
|
|
290
290
|
let r;
|
|
291
|
-
const c =
|
|
291
|
+
const c = Q({ actions: {} }, o);
|
|
292
292
|
if (process.env.NODE_ENV !== "production" && !a._e.active)
|
|
293
293
|
throw new Error("Pinia destroyed");
|
|
294
|
-
const
|
|
295
|
-
process.env.NODE_ENV !== "production" && (
|
|
296
|
-
u ?
|
|
294
|
+
const s = { deep: !0 };
|
|
295
|
+
process.env.NODE_ENV !== "production" && (s.onTrigger = (m) => {
|
|
296
|
+
u ? D = m : u == !1 && !E._hotUpdating && (Array.isArray(D) ? D.push(m) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
297
297
|
});
|
|
298
|
-
let u, p,
|
|
299
|
-
const
|
|
300
|
-
!
|
|
301
|
-
const
|
|
298
|
+
let u, p, h = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), D;
|
|
299
|
+
const k = a.state.value[t];
|
|
300
|
+
!i && !k && (process.env.NODE_ENV === "production" || !n) && (a.state.value[t] = {});
|
|
301
|
+
const O = C({});
|
|
302
302
|
let V;
|
|
303
|
-
function
|
|
304
|
-
let
|
|
305
|
-
u = p = !1, process.env.NODE_ENV !== "production" && (
|
|
306
|
-
type:
|
|
307
|
-
storeId:
|
|
308
|
-
events:
|
|
309
|
-
}) : (
|
|
310
|
-
type:
|
|
303
|
+
function M(m) {
|
|
304
|
+
let g;
|
|
305
|
+
u = p = !1, process.env.NODE_ENV !== "production" && (D = []), typeof m == "function" ? (m(a.state.value[t]), g = {
|
|
306
|
+
type: me.patchFunction,
|
|
307
|
+
storeId: t,
|
|
308
|
+
events: D
|
|
309
|
+
}) : (qe(a.state.value[t], m), g = {
|
|
310
|
+
type: me.patchObject,
|
|
311
311
|
payload: m,
|
|
312
|
-
storeId:
|
|
313
|
-
events:
|
|
312
|
+
storeId: t,
|
|
313
|
+
events: D
|
|
314
314
|
});
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
V ===
|
|
318
|
-
}), p = !0,
|
|
319
|
-
}
|
|
320
|
-
const x =
|
|
321
|
-
const { state: m } =
|
|
322
|
-
this.$patch((
|
|
323
|
-
|
|
315
|
+
const A = V = /* @__PURE__ */ Symbol();
|
|
316
|
+
re().then(() => {
|
|
317
|
+
V === A && (u = !0);
|
|
318
|
+
}), p = !0, ie(h, g, a.state.value[t]);
|
|
319
|
+
}
|
|
320
|
+
const x = i ? function() {
|
|
321
|
+
const { state: m } = o, g = m ? m() : {};
|
|
322
|
+
this.$patch((A) => {
|
|
323
|
+
Q(A, g);
|
|
324
324
|
});
|
|
325
325
|
} : (
|
|
326
326
|
/* istanbul ignore next */
|
|
327
327
|
process.env.NODE_ENV !== "production" ? () => {
|
|
328
|
-
throw new Error(`🍍: Store "${
|
|
329
|
-
} :
|
|
328
|
+
throw new Error(`🍍: Store "${t}" is built using the setup syntax and does not implement $reset().`);
|
|
329
|
+
} : _t
|
|
330
330
|
);
|
|
331
331
|
function W() {
|
|
332
|
-
r.stop(),
|
|
333
|
-
}
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
-
return m[
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
const F = Array.from(arguments),
|
|
340
|
-
function $
|
|
341
|
-
|
|
332
|
+
r.stop(), h.clear(), b.clear(), a._s.delete(t);
|
|
333
|
+
}
|
|
334
|
+
const Z = (m, g = "") => {
|
|
335
|
+
if (rt in m)
|
|
336
|
+
return m[Le] = g, m;
|
|
337
|
+
const A = function() {
|
|
338
|
+
Ae(a);
|
|
339
|
+
const F = Array.from(arguments), G = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set();
|
|
340
|
+
function P($) {
|
|
341
|
+
G.add($);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
|
|
343
|
+
function B($) {
|
|
344
|
+
N.add($);
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
ie(b, {
|
|
347
347
|
args: F,
|
|
348
|
-
name:
|
|
349
|
-
store:
|
|
350
|
-
after:
|
|
351
|
-
onError:
|
|
348
|
+
name: A[Le],
|
|
349
|
+
store: E,
|
|
350
|
+
after: P,
|
|
351
|
+
onError: B
|
|
352
352
|
});
|
|
353
|
-
let
|
|
353
|
+
let w;
|
|
354
354
|
try {
|
|
355
|
-
|
|
356
|
-
} catch (
|
|
357
|
-
throw
|
|
355
|
+
w = m.apply(this && this.$id === t ? this : E, F);
|
|
356
|
+
} catch ($) {
|
|
357
|
+
throw ie(N, $), $;
|
|
358
358
|
}
|
|
359
|
-
return
|
|
359
|
+
return w instanceof Promise ? w.then(($) => (ie(G, $), $)).catch(($) => (ie(N, $), Promise.reject($))) : (ie(G, w), w);
|
|
360
360
|
};
|
|
361
|
-
return
|
|
362
|
-
},
|
|
361
|
+
return A[rt] = !0, A[Le] = g, A;
|
|
362
|
+
}, J = /* @__PURE__ */ fe({
|
|
363
363
|
actions: {},
|
|
364
364
|
getters: {},
|
|
365
365
|
state: [],
|
|
366
|
-
hotState:
|
|
367
|
-
}),
|
|
366
|
+
hotState: O
|
|
367
|
+
}), K = {
|
|
368
368
|
_p: a,
|
|
369
369
|
// _s: scope,
|
|
370
|
-
$id:
|
|
371
|
-
$onAction:
|
|
372
|
-
$patch:
|
|
370
|
+
$id: t,
|
|
371
|
+
$onAction: nt.bind(null, b),
|
|
372
|
+
$patch: M,
|
|
373
373
|
$reset: x,
|
|
374
|
-
$subscribe(m,
|
|
375
|
-
const
|
|
376
|
-
(
|
|
377
|
-
storeId:
|
|
378
|
-
type:
|
|
379
|
-
events:
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
return
|
|
374
|
+
$subscribe(m, g = {}) {
|
|
375
|
+
const A = nt(h, m, g.detached, () => F()), F = r.run(() => H(() => a.state.value[t], (G) => {
|
|
376
|
+
(g.flush === "sync" ? p : u) && m({
|
|
377
|
+
storeId: t,
|
|
378
|
+
type: me.direct,
|
|
379
|
+
events: D
|
|
380
|
+
}, G);
|
|
381
|
+
}, Q({}, s, g)));
|
|
382
|
+
return A;
|
|
383
383
|
},
|
|
384
384
|
$dispose: W
|
|
385
|
-
},
|
|
385
|
+
}, E = gt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he ? Q(
|
|
386
386
|
{
|
|
387
|
-
_hmrPayload:
|
|
388
|
-
_customProperties:
|
|
387
|
+
_hmrPayload: J,
|
|
388
|
+
_customProperties: fe(/* @__PURE__ */ new Set())
|
|
389
389
|
// devtools custom properties
|
|
390
390
|
},
|
|
391
|
-
|
|
391
|
+
K
|
|
392
392
|
// must be added later
|
|
393
393
|
// setupStore
|
|
394
|
-
) :
|
|
395
|
-
a._s.set(
|
|
396
|
-
const U = (a._a && a._a.runWithContext ||
|
|
394
|
+
) : K);
|
|
395
|
+
a._s.set(t, E);
|
|
396
|
+
const U = (a._a && a._a.runWithContext || oo)(() => a._e.run(() => (r = xt()).run(() => e({ action: Z }))));
|
|
397
397
|
for (const m in U) {
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
process.env.NODE_ENV !== "production" && n ?
|
|
401
|
-
else if (typeof
|
|
402
|
-
const
|
|
403
|
-
U[m] =
|
|
404
|
-
} else process.env.NODE_ENV !== "production" &&
|
|
398
|
+
const g = U[m];
|
|
399
|
+
if (de(g) && !st(g) || Pe(g))
|
|
400
|
+
process.env.NODE_ENV !== "production" && n ? O.value[m] = ne(U, m) : i || (k && no(g) && (de(g) ? g.value = k[m] : qe(g, k[m])), a.state.value[t][m] = g), process.env.NODE_ENV !== "production" && J.state.push(m);
|
|
401
|
+
else if (typeof g == "function") {
|
|
402
|
+
const A = process.env.NODE_ENV !== "production" && n ? g : Z(g, m);
|
|
403
|
+
U[m] = A, process.env.NODE_ENV !== "production" && (J.actions[m] = g), c.actions[m] = g;
|
|
404
|
+
} else process.env.NODE_ENV !== "production" && st(g) && (J.getters[m] = i ? (
|
|
405
405
|
// @ts-expect-error
|
|
406
|
-
|
|
407
|
-
) :
|
|
408
|
-
(U._getters =
|
|
406
|
+
o.getters[m]
|
|
407
|
+
) : g, he && (U._getters || // @ts-expect-error: same
|
|
408
|
+
(U._getters = fe([]))).push(m));
|
|
409
409
|
}
|
|
410
|
-
if (
|
|
411
|
-
get: () => process.env.NODE_ENV !== "production" && n ?
|
|
410
|
+
if (Q(E, U), Q(mt(E), U), Object.defineProperty(E, "$state", {
|
|
411
|
+
get: () => process.env.NODE_ENV !== "production" && n ? O.value : a.state.value[t],
|
|
412
412
|
set: (m) => {
|
|
413
413
|
if (process.env.NODE_ENV !== "production" && n)
|
|
414
414
|
throw new Error("cannot set hotState");
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
M((g) => {
|
|
416
|
+
Q(g, m);
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
}), process.env.NODE_ENV !== "production" && (
|
|
420
|
-
|
|
421
|
-
if (
|
|
422
|
-
const
|
|
423
|
-
typeof
|
|
419
|
+
}), process.env.NODE_ENV !== "production" && (E._hotUpdate = fe((m) => {
|
|
420
|
+
E._hotUpdating = !0, m._hmrPayload.state.forEach((g) => {
|
|
421
|
+
if (g in E.$state) {
|
|
422
|
+
const A = m.$state[g], F = E.$state[g];
|
|
423
|
+
typeof A == "object" && se(A) && se(F) ? Et(A, F) : m.$state[g] = F;
|
|
424
424
|
}
|
|
425
|
-
|
|
426
|
-
}), Object.keys(
|
|
427
|
-
|
|
428
|
-
}), u = !1, p = !1, a.state.value[
|
|
425
|
+
E[g] = ne(m.$state, g);
|
|
426
|
+
}), Object.keys(E.$state).forEach((g) => {
|
|
427
|
+
g in m.$state || delete E[g];
|
|
428
|
+
}), u = !1, p = !1, a.state.value[t] = ne(m._hmrPayload, "hotState"), p = !0, re().then(() => {
|
|
429
429
|
u = !0;
|
|
430
430
|
});
|
|
431
|
-
for (const
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
for (const g in m._hmrPayload.actions) {
|
|
432
|
+
const A = m[g];
|
|
433
|
+
E[g] = //
|
|
434
|
+
Z(A, g);
|
|
435
435
|
}
|
|
436
|
-
for (const
|
|
437
|
-
const
|
|
436
|
+
for (const g in m._hmrPayload.getters) {
|
|
437
|
+
const A = m._hmrPayload.getters[g], F = i ? (
|
|
438
438
|
// special handling of options api
|
|
439
|
-
|
|
440
|
-
) :
|
|
441
|
-
|
|
439
|
+
I(() => (Ae(a), A.call(E, E)))
|
|
440
|
+
) : A;
|
|
441
|
+
E[g] = //
|
|
442
442
|
F;
|
|
443
443
|
}
|
|
444
|
-
Object.keys(
|
|
445
|
-
|
|
446
|
-
}), Object.keys(
|
|
447
|
-
|
|
448
|
-
}),
|
|
449
|
-
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
444
|
+
Object.keys(E._hmrPayload.getters).forEach((g) => {
|
|
445
|
+
g in m._hmrPayload.getters || delete E[g];
|
|
446
|
+
}), Object.keys(E._hmrPayload.actions).forEach((g) => {
|
|
447
|
+
g in m._hmrPayload.actions || delete E[g];
|
|
448
|
+
}), E._hmrPayload = m._hmrPayload, E._getters = m._getters, E._hotUpdating = !1;
|
|
449
|
+
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he) {
|
|
450
450
|
const m = {
|
|
451
451
|
writable: !0,
|
|
452
452
|
configurable: !0,
|
|
453
453
|
// avoid warning on devtools trying to display this property
|
|
454
454
|
enumerable: !1
|
|
455
455
|
};
|
|
456
|
-
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((
|
|
457
|
-
Object.defineProperty(
|
|
456
|
+
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((g) => {
|
|
457
|
+
Object.defineProperty(E, g, Q({ value: E[g] }, m));
|
|
458
458
|
});
|
|
459
459
|
}
|
|
460
460
|
return a._p.forEach((m) => {
|
|
461
|
-
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
462
|
-
const
|
|
463
|
-
store:
|
|
461
|
+
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && he) {
|
|
462
|
+
const g = r.run(() => m({
|
|
463
|
+
store: E,
|
|
464
464
|
app: a._a,
|
|
465
465
|
pinia: a,
|
|
466
466
|
options: c
|
|
467
467
|
}));
|
|
468
|
-
Object.keys(
|
|
468
|
+
Object.keys(g || {}).forEach((A) => E._customProperties.add(A)), Q(E, g);
|
|
469
469
|
} else
|
|
470
|
-
|
|
471
|
-
store:
|
|
470
|
+
Q(E, r.run(() => m({
|
|
471
|
+
store: E,
|
|
472
472
|
app: a._a,
|
|
473
473
|
pinia: a,
|
|
474
474
|
options: c
|
|
475
475
|
})));
|
|
476
|
-
}), process.env.NODE_ENV !== "production" &&
|
|
476
|
+
}), process.env.NODE_ENV !== "production" && E.$state && typeof E.$state == "object" && typeof E.$state.constructor == "function" && !E.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
477
477
|
state: () => new MyClass()
|
|
478
|
-
Found in store "${
|
|
478
|
+
Found in store "${E.$id}".`), k && i && o.hydrate && o.hydrate(E.$state, k), u = !0, p = !0, E;
|
|
479
479
|
}
|
|
480
480
|
// @__NO_SIDE_EFFECTS__
|
|
481
|
-
function
|
|
481
|
+
function ro(t, e, o) {
|
|
482
482
|
let a;
|
|
483
483
|
const n = typeof e == "function";
|
|
484
|
-
a = n ?
|
|
485
|
-
function
|
|
486
|
-
const
|
|
484
|
+
a = n ? o : e;
|
|
485
|
+
function i(r, c) {
|
|
486
|
+
const s = Tt();
|
|
487
487
|
if (r = // in test mode, ignore the argument provided as we can always retrieve a
|
|
488
488
|
// pinia instance with getActivePinia()
|
|
489
|
-
(process.env.NODE_ENV === "test" &&
|
|
489
|
+
(process.env.NODE_ENV === "test" && ge && ge._testing ? null : r) || (s ? Je(to, null) : null), r && Ae(r), process.env.NODE_ENV !== "production" && !ge)
|
|
490
490
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
491
491
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
492
492
|
This will fail in production.`);
|
|
493
|
-
r =
|
|
494
|
-
const u = r._s.get(
|
|
493
|
+
r = ge, r._s.has(t) || (n ? Ze(t, e, a, r) : it(t, a, r), process.env.NODE_ENV !== "production" && (i._pinia = r));
|
|
494
|
+
const u = r._s.get(t);
|
|
495
495
|
if (process.env.NODE_ENV !== "production" && c) {
|
|
496
|
-
const p = "__hot:" +
|
|
497
|
-
c._hotUpdate(
|
|
496
|
+
const p = "__hot:" + t, h = n ? Ze(p, e, a, r, !0) : it(p, Q({}, a), r, !0);
|
|
497
|
+
c._hotUpdate(h), delete r.state.value[p], r._s.delete(p);
|
|
498
498
|
}
|
|
499
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
500
|
-
const p =
|
|
499
|
+
if (process.env.NODE_ENV !== "production" && he) {
|
|
500
|
+
const p = yt();
|
|
501
501
|
if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
|
|
502
502
|
!c) {
|
|
503
|
-
const
|
|
504
|
-
|
|
503
|
+
const h = p.proxy, b = "_pStores" in h ? h._pStores : h._pStores = {};
|
|
504
|
+
b[t] = u;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
return u;
|
|
508
508
|
}
|
|
509
|
-
return
|
|
509
|
+
return i.$id = t, i;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
const e =
|
|
511
|
+
function so(t) {
|
|
512
|
+
const e = mt(t), o = {};
|
|
513
513
|
for (const a in e) {
|
|
514
514
|
const n = e[a];
|
|
515
|
-
n.effect ?
|
|
516
|
-
|
|
517
|
-
get: () =>
|
|
518
|
-
set(
|
|
519
|
-
|
|
515
|
+
n.effect ? o[a] = // ...
|
|
516
|
+
I({
|
|
517
|
+
get: () => t[a],
|
|
518
|
+
set(i) {
|
|
519
|
+
t[a] = i;
|
|
520
520
|
}
|
|
521
|
-
}) : (
|
|
522
|
-
|
|
521
|
+
}) : (de(n) || Pe(n)) && (o[a] = // ---
|
|
522
|
+
ne(t, a));
|
|
523
523
|
}
|
|
524
|
-
return
|
|
524
|
+
return o;
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const io = typeof window < "u" && typeof document < "u";
|
|
527
527
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
528
|
-
const
|
|
528
|
+
const lo = Object.prototype.toString, co = (t) => lo.call(t) === "[object Object]", uo = () => {
|
|
529
529
|
};
|
|
530
|
-
function
|
|
531
|
-
if (
|
|
532
|
-
const e =
|
|
533
|
-
return typeof e == "function" ?
|
|
530
|
+
function po(...t) {
|
|
531
|
+
if (t.length !== 1) return ne(...t);
|
|
532
|
+
const e = t[0];
|
|
533
|
+
return typeof e == "function" ? Ve(et(() => ({
|
|
534
534
|
get: e,
|
|
535
|
-
set:
|
|
536
|
-
}))) :
|
|
535
|
+
set: uo
|
|
536
|
+
}))) : C(e);
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
function
|
|
540
|
-
return new Promise((n,
|
|
541
|
-
Promise.resolve(
|
|
538
|
+
function vo(t, e) {
|
|
539
|
+
function o(...a) {
|
|
540
|
+
return new Promise((n, i) => {
|
|
541
|
+
Promise.resolve(t(() => e.apply(this, a), {
|
|
542
542
|
fn: e,
|
|
543
543
|
thisArg: this,
|
|
544
544
|
args: a
|
|
545
|
-
})).then(n).catch(
|
|
545
|
+
})).then(n).catch(i);
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
return
|
|
548
|
+
return o;
|
|
549
549
|
}
|
|
550
|
-
const
|
|
551
|
-
function
|
|
552
|
-
const { initialState:
|
|
550
|
+
const kt = (t) => t();
|
|
551
|
+
function fo(t = kt, e = {}) {
|
|
552
|
+
const { initialState: o = "active" } = e, a = po(o === "active");
|
|
553
553
|
function n() {
|
|
554
554
|
a.value = !1;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function i() {
|
|
557
557
|
a.value = !0;
|
|
558
558
|
}
|
|
559
559
|
const r = (...c) => {
|
|
560
|
-
a.value &&
|
|
560
|
+
a.value && t(...c);
|
|
561
561
|
};
|
|
562
562
|
return {
|
|
563
|
-
isActive:
|
|
563
|
+
isActive: Ve(a),
|
|
564
564
|
pause: n,
|
|
565
|
-
resume:
|
|
565
|
+
resume: i,
|
|
566
566
|
eventFilter: r
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return Array.isArray(
|
|
569
|
+
function Fe(t) {
|
|
570
|
+
return Array.isArray(t) ? t : [t];
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
572
|
+
function ho(t) {
|
|
573
|
+
return yt();
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const { eventFilter: a =
|
|
577
|
-
return H(
|
|
575
|
+
function go(t, e, o = {}) {
|
|
576
|
+
const { eventFilter: a = kt, ...n } = o;
|
|
577
|
+
return H(t, vo(a, e), n);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const { eventFilter: a, initialState: n = "active", ...
|
|
579
|
+
function mo(t, e, o = {}) {
|
|
580
|
+
const { eventFilter: a, initialState: n = "active", ...i } = o, { eventFilter: r, pause: c, resume: s, isActive: u } = fo(a, { initialState: n });
|
|
581
581
|
return {
|
|
582
|
-
stop:
|
|
583
|
-
...
|
|
582
|
+
stop: go(t, e, {
|
|
583
|
+
...i,
|
|
584
584
|
eventFilter: r
|
|
585
585
|
}),
|
|
586
586
|
pause: c,
|
|
587
|
-
resume:
|
|
587
|
+
resume: s,
|
|
588
588
|
isActive: u
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
function
|
|
593
|
-
|
|
591
|
+
const yo = mo;
|
|
592
|
+
function bo(t, e = !0, o) {
|
|
593
|
+
ho() ? xe(t, o) : e ? t() : re(t);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
return H(
|
|
597
|
-
...
|
|
595
|
+
function wo(t, e, o) {
|
|
596
|
+
return H(t, e, {
|
|
597
|
+
...o,
|
|
598
598
|
immediate: !0
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
const
|
|
602
|
-
function
|
|
601
|
+
const Ie = io ? window : void 0;
|
|
602
|
+
function So(t) {
|
|
603
603
|
var e;
|
|
604
|
-
const
|
|
605
|
-
return (e =
|
|
604
|
+
const o = X(t);
|
|
605
|
+
return (e = o?.$el) !== null && e !== void 0 ? e : o;
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
const e = (a, n,
|
|
609
|
-
const a =
|
|
607
|
+
function lt(...t) {
|
|
608
|
+
const e = (a, n, i, r) => (a.addEventListener(n, i, r), () => a.removeEventListener(n, i, r)), o = I(() => {
|
|
609
|
+
const a = Fe(X(t[0])).filter((n) => n != null);
|
|
610
610
|
return a.every((n) => typeof n != "string") ? a : void 0;
|
|
611
611
|
});
|
|
612
|
-
return
|
|
612
|
+
return wo(() => {
|
|
613
613
|
var a, n;
|
|
614
614
|
return [
|
|
615
|
-
(a = (n =
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
615
|
+
(a = (n = o.value) === null || n === void 0 ? void 0 : n.map((i) => So(i))) !== null && a !== void 0 ? a : [Ie].filter((i) => i != null),
|
|
616
|
+
Fe(X(o.value ? t[1] : t[0])),
|
|
617
|
+
Fe(Ne(o.value ? t[2] : t[1])),
|
|
618
|
+
X(o.value ? t[3] : t[2])
|
|
619
619
|
];
|
|
620
|
-
}, ([a, n,
|
|
621
|
-
if (!a?.length || !n?.length || !
|
|
622
|
-
const u =
|
|
623
|
-
|
|
624
|
-
p.forEach((
|
|
620
|
+
}, ([a, n, i, r], c, s) => {
|
|
621
|
+
if (!a?.length || !n?.length || !i?.length) return;
|
|
622
|
+
const u = co(r) ? { ...r } : r, p = a.flatMap((h) => n.flatMap((b) => i.map((D) => e(h, b, D, u))));
|
|
623
|
+
s(() => {
|
|
624
|
+
p.forEach((h) => h());
|
|
625
625
|
});
|
|
626
626
|
}, { flush: "post" });
|
|
627
627
|
}
|
|
628
|
-
const
|
|
629
|
-
function
|
|
630
|
-
return
|
|
628
|
+
const _e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ke = "__vueuse_ssr_handlers__", $o = /* @__PURE__ */ Eo();
|
|
629
|
+
function Eo() {
|
|
630
|
+
return ke in _e || (_e[ke] = _e[ke] || {}), _e[ke];
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function _o(t, e) {
|
|
633
|
+
return $o[t] || e;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
635
|
+
function ko(t) {
|
|
636
|
+
return t == null ? "any" : t instanceof Set ? "set" : t instanceof Map ? "map" : t instanceof Date ? "date" : typeof t == "boolean" ? "boolean" : typeof t == "string" ? "string" : typeof t == "object" ? "object" : Number.isNaN(t) ? "any" : "number";
|
|
637
637
|
}
|
|
638
|
-
const
|
|
638
|
+
const Do = {
|
|
639
639
|
boolean: {
|
|
640
|
-
read: (
|
|
641
|
-
write: (
|
|
640
|
+
read: (t) => t === "true",
|
|
641
|
+
write: (t) => String(t)
|
|
642
642
|
},
|
|
643
643
|
object: {
|
|
644
|
-
read: (
|
|
645
|
-
write: (
|
|
644
|
+
read: (t) => JSON.parse(t),
|
|
645
|
+
write: (t) => JSON.stringify(t)
|
|
646
646
|
},
|
|
647
647
|
number: {
|
|
648
|
-
read: (
|
|
649
|
-
write: (
|
|
648
|
+
read: (t) => Number.parseFloat(t),
|
|
649
|
+
write: (t) => String(t)
|
|
650
650
|
},
|
|
651
651
|
any: {
|
|
652
|
-
read: (
|
|
653
|
-
write: (
|
|
652
|
+
read: (t) => t,
|
|
653
|
+
write: (t) => String(t)
|
|
654
654
|
},
|
|
655
655
|
string: {
|
|
656
|
-
read: (
|
|
657
|
-
write: (
|
|
656
|
+
read: (t) => t,
|
|
657
|
+
write: (t) => String(t)
|
|
658
658
|
},
|
|
659
659
|
map: {
|
|
660
|
-
read: (
|
|
661
|
-
write: (
|
|
660
|
+
read: (t) => new Map(JSON.parse(t)),
|
|
661
|
+
write: (t) => JSON.stringify(Array.from(t.entries()))
|
|
662
662
|
},
|
|
663
663
|
set: {
|
|
664
|
-
read: (
|
|
665
|
-
write: (
|
|
664
|
+
read: (t) => new Set(JSON.parse(t)),
|
|
665
|
+
write: (t) => JSON.stringify(Array.from(t))
|
|
666
666
|
},
|
|
667
667
|
date: {
|
|
668
|
-
read: (
|
|
669
|
-
write: (
|
|
668
|
+
read: (t) => new Date(t),
|
|
669
|
+
write: (t) => t.toISOString()
|
|
670
670
|
}
|
|
671
|
-
},
|
|
672
|
-
function
|
|
671
|
+
}, ct = "vueuse-storage";
|
|
672
|
+
function No(t, e, o, a = {}) {
|
|
673
673
|
var n;
|
|
674
|
-
const { flush:
|
|
675
|
-
console.error(
|
|
676
|
-
}, initOnMounted:
|
|
677
|
-
if (!
|
|
678
|
-
|
|
679
|
-
} catch (
|
|
680
|
-
N
|
|
681
|
-
}
|
|
682
|
-
if (!
|
|
683
|
-
const
|
|
684
|
-
flush:
|
|
674
|
+
const { flush: i = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: s = !0, mergeDefaults: u = !1, shallow: p, window: h = Ie, eventFilter: b, onError: D = (N) => {
|
|
675
|
+
console.error(N);
|
|
676
|
+
}, initOnMounted: k } = a, O = (p ? $e : C)(e), V = I(() => X(t));
|
|
677
|
+
if (!o) try {
|
|
678
|
+
o = _o("getDefaultStorage", () => Ie?.localStorage)();
|
|
679
|
+
} catch (N) {
|
|
680
|
+
D(N);
|
|
681
|
+
}
|
|
682
|
+
if (!o) return O;
|
|
683
|
+
const M = X(e), x = ko(M), W = (n = a.serializer) !== null && n !== void 0 ? n : Do[x], { pause: Z, resume: J } = yo(O, (N) => g(N), {
|
|
684
|
+
flush: i,
|
|
685
685
|
deep: r,
|
|
686
|
-
eventFilter:
|
|
686
|
+
eventFilter: b
|
|
687
687
|
});
|
|
688
|
-
H(V, () => F(), { flush:
|
|
689
|
-
let
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
}, U = (
|
|
693
|
-
|
|
688
|
+
H(V, () => F(), { flush: i });
|
|
689
|
+
let K = !1;
|
|
690
|
+
const E = (N) => {
|
|
691
|
+
k && !K || F(N);
|
|
692
|
+
}, U = (N) => {
|
|
693
|
+
k && !K || G(N);
|
|
694
694
|
};
|
|
695
|
-
|
|
696
|
-
|
|
695
|
+
h && c && (o instanceof Storage ? lt(h, "storage", E, { passive: !0 }) : lt(h, ct, U)), k ? bo(() => {
|
|
696
|
+
K = !0, F();
|
|
697
697
|
}) : F();
|
|
698
|
-
function m(
|
|
699
|
-
if (
|
|
700
|
-
const
|
|
698
|
+
function m(N, P) {
|
|
699
|
+
if (h) {
|
|
700
|
+
const B = {
|
|
701
701
|
key: V.value,
|
|
702
|
-
oldValue:
|
|
703
|
-
newValue:
|
|
704
|
-
storageArea:
|
|
702
|
+
oldValue: N,
|
|
703
|
+
newValue: P,
|
|
704
|
+
storageArea: o
|
|
705
705
|
};
|
|
706
|
-
|
|
706
|
+
h.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", B) : new CustomEvent(ct, { detail: B }));
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function g(N) {
|
|
710
710
|
try {
|
|
711
|
-
const
|
|
712
|
-
if (
|
|
713
|
-
m(
|
|
711
|
+
const P = o.getItem(V.value);
|
|
712
|
+
if (N == null)
|
|
713
|
+
m(P, null), o.removeItem(V.value);
|
|
714
714
|
else {
|
|
715
|
-
const
|
|
716
|
-
|
|
715
|
+
const B = W.write(N);
|
|
716
|
+
P !== B && (o.setItem(V.value, B), m(P, B));
|
|
717
717
|
}
|
|
718
|
-
} catch (
|
|
719
|
-
|
|
718
|
+
} catch (P) {
|
|
719
|
+
D(P);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
function
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
return
|
|
726
|
-
if (!
|
|
727
|
-
const
|
|
728
|
-
return typeof u == "function" ? u(
|
|
729
|
-
...
|
|
730
|
-
...
|
|
731
|
-
} :
|
|
732
|
-
} else return typeof
|
|
733
|
-
}
|
|
734
|
-
function F(
|
|
735
|
-
if (!(
|
|
736
|
-
if (
|
|
737
|
-
|
|
722
|
+
function A(N) {
|
|
723
|
+
const P = N ? N.newValue : o.getItem(V.value);
|
|
724
|
+
if (P == null)
|
|
725
|
+
return s && M != null && o.setItem(V.value, W.write(M)), M;
|
|
726
|
+
if (!N && u) {
|
|
727
|
+
const B = W.read(P);
|
|
728
|
+
return typeof u == "function" ? u(B, M) : x === "object" && !Array.isArray(B) ? {
|
|
729
|
+
...M,
|
|
730
|
+
...B
|
|
731
|
+
} : B;
|
|
732
|
+
} else return typeof P != "string" ? P : W.read(P);
|
|
733
|
+
}
|
|
734
|
+
function F(N) {
|
|
735
|
+
if (!(N && N.storageArea !== o)) {
|
|
736
|
+
if (N && N.key == null) {
|
|
737
|
+
O.value = M;
|
|
738
738
|
return;
|
|
739
739
|
}
|
|
740
|
-
if (!(
|
|
741
|
-
|
|
740
|
+
if (!(N && N.key !== V.value)) {
|
|
741
|
+
Z();
|
|
742
742
|
try {
|
|
743
|
-
const
|
|
744
|
-
(
|
|
745
|
-
} catch (
|
|
746
|
-
|
|
743
|
+
const P = W.write(O.value);
|
|
744
|
+
(N === void 0 || N?.newValue !== P) && (O.value = A(N));
|
|
745
|
+
} catch (P) {
|
|
746
|
+
D(P);
|
|
747
747
|
} finally {
|
|
748
|
-
|
|
748
|
+
N ? re(J) : J();
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
F(
|
|
753
|
+
function G(N) {
|
|
754
|
+
F(N.detail);
|
|
755
755
|
}
|
|
756
|
-
return
|
|
756
|
+
return O;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
const { window: a =
|
|
760
|
-
return
|
|
758
|
+
function Oo(t, e, o = {}) {
|
|
759
|
+
const { window: a = Ie } = o;
|
|
760
|
+
return No(t, e, a?.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 De(t) {
|
|
766
766
|
const e = {
|
|
767
|
-
type:
|
|
768
|
-
clientId:
|
|
769
|
-
timestamp: o.timestamp.toISOString()
|
|
770
|
-
};
|
|
771
|
-
return o.operation && (e.operation = {
|
|
772
|
-
...o.operation,
|
|
773
|
-
timestamp: o.operation.timestamp.toISOString()
|
|
774
|
-
}), o.operations && (e.operations = o.operations.map((t) => ({
|
|
775
|
-
...t,
|
|
767
|
+
type: t.type,
|
|
768
|
+
clientId: t.clientId,
|
|
776
769
|
timestamp: t.timestamp.toISOString()
|
|
770
|
+
};
|
|
771
|
+
return t.operation && (e.operation = {
|
|
772
|
+
...t.operation,
|
|
773
|
+
timestamp: t.operation.timestamp.toISOString()
|
|
774
|
+
}), t.operations && (e.operations = t.operations.map((o) => ({
|
|
775
|
+
...o,
|
|
776
|
+
timestamp: o.timestamp.toISOString()
|
|
777
777
|
}))), e;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Ro(t) {
|
|
780
780
|
const e = {
|
|
781
|
-
type:
|
|
782
|
-
clientId:
|
|
783
|
-
timestamp: new Date(o.timestamp)
|
|
784
|
-
};
|
|
785
|
-
return o.operation && (e.operation = {
|
|
786
|
-
...o.operation,
|
|
787
|
-
timestamp: new Date(o.operation.timestamp)
|
|
788
|
-
}), o.operations && (e.operations = o.operations.map((t) => ({
|
|
789
|
-
...t,
|
|
781
|
+
type: t.type,
|
|
782
|
+
clientId: t.clientId,
|
|
790
783
|
timestamp: new Date(t.timestamp)
|
|
784
|
+
};
|
|
785
|
+
return t.operation && (e.operation = {
|
|
786
|
+
...t.operation,
|
|
787
|
+
timestamp: new Date(t.operation.timestamp)
|
|
788
|
+
}), t.operations && (e.operations = t.operations.map((o) => ({
|
|
789
|
+
...o,
|
|
790
|
+
timestamp: new Date(o.timestamp)
|
|
791
791
|
}))), e;
|
|
792
792
|
}
|
|
793
|
-
const
|
|
794
|
-
const
|
|
793
|
+
const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
|
|
794
|
+
const t = C({
|
|
795
795
|
maxOperations: 100,
|
|
796
796
|
enableCrossTabSync: !0,
|
|
797
797
|
autoSyncInterval: 3e4,
|
|
798
798
|
enablePersistence: !1,
|
|
799
799
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
800
|
-
}), e =
|
|
801
|
-
let
|
|
802
|
-
for (let f =
|
|
803
|
-
|
|
804
|
-
return
|
|
805
|
-
}), p =
|
|
800
|
+
}), e = C([]), o = C(-1), a = C(Be()), n = C(!1), i = C([]), r = C(null), c = I(() => o.value < 0 ? !1 : e.value[o.value]?.reversible ?? !1), s = I(() => o.value < e.value.length - 1), u = I(() => {
|
|
801
|
+
let v = 0;
|
|
802
|
+
for (let f = o.value; f >= 0 && e.value[f]?.reversible; f--)
|
|
803
|
+
v++;
|
|
804
|
+
return v;
|
|
805
|
+
}), p = I(() => e.value.length - 1 - o.value), h = I(() => ({
|
|
806
806
|
canUndo: c.value,
|
|
807
|
-
canRedo:
|
|
807
|
+
canRedo: s.value,
|
|
808
808
|
undoCount: u.value,
|
|
809
809
|
redoCount: p.value,
|
|
810
|
-
currentIndex:
|
|
810
|
+
currentIndex: o.value
|
|
811
811
|
}));
|
|
812
|
-
function
|
|
813
|
-
|
|
812
|
+
function b(v) {
|
|
813
|
+
t.value = { ...t.value, ...v }, t.value.enablePersistence && (w(), _()), t.value.enableCrossTabSync && A();
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function D(v, f = "user") {
|
|
816
816
|
const y = {
|
|
817
|
-
...
|
|
818
|
-
id:
|
|
817
|
+
...v,
|
|
818
|
+
id: Be(),
|
|
819
819
|
timestamp: /* @__PURE__ */ new Date(),
|
|
820
820
|
source: f,
|
|
821
|
-
userId:
|
|
821
|
+
userId: t.value.userId
|
|
822
822
|
};
|
|
823
|
-
if (
|
|
823
|
+
if (t.value.operationFilter && !t.value.operationFilter(y))
|
|
824
824
|
return y.id;
|
|
825
825
|
if (n.value)
|
|
826
|
-
return
|
|
827
|
-
if (
|
|
828
|
-
const l = e.value.length -
|
|
829
|
-
e.value = e.value.slice(l),
|
|
826
|
+
return i.value.push(y), y.id;
|
|
827
|
+
if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(y), o.value++, t.value.maxOperations && e.value.length > t.value.maxOperations) {
|
|
828
|
+
const l = e.value.length - t.value.maxOperations;
|
|
829
|
+
e.value = e.value.slice(l), o.value -= l;
|
|
830
830
|
}
|
|
831
|
-
return
|
|
831
|
+
return t.value.enableCrossTabSync && F(y), y.id;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
834
|
-
n.value = !0,
|
|
833
|
+
function k() {
|
|
834
|
+
n.value = !0, i.value = [], r.value = Be();
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
if (!n.value ||
|
|
838
|
-
return n.value = !1,
|
|
839
|
-
const f = r.value, y =
|
|
836
|
+
function O(v) {
|
|
837
|
+
if (!n.value || i.value.length === 0)
|
|
838
|
+
return n.value = !1, i.value = [], r.value = null, null;
|
|
839
|
+
const f = r.value, y = i.value.every((S) => S.reversible), l = {
|
|
840
840
|
id: f,
|
|
841
841
|
type: "batch",
|
|
842
842
|
path: "",
|
|
@@ -844,93 +844,93 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
|
|
|
844
844
|
fieldname: "",
|
|
845
845
|
beforeValue: null,
|
|
846
846
|
afterValue: null,
|
|
847
|
-
doctype:
|
|
847
|
+
doctype: i.value[0]?.doctype || "",
|
|
848
848
|
timestamp: /* @__PURE__ */ new Date(),
|
|
849
849
|
source: "user",
|
|
850
850
|
reversible: y,
|
|
851
851
|
irreversibleReason: y ? void 0 : "Contains irreversible operations",
|
|
852
|
-
childOperationIds:
|
|
853
|
-
metadata: { description:
|
|
852
|
+
childOperationIds: i.value.map((S) => S.id),
|
|
853
|
+
metadata: { description: v }
|
|
854
854
|
};
|
|
855
|
-
|
|
855
|
+
i.value.forEach((S) => {
|
|
856
856
|
S.parentOperationId = f;
|
|
857
|
-
}), e.value.push(...
|
|
857
|
+
}), e.value.push(...i.value, l), o.value = e.value.length - 1, t.value.enableCrossTabSync && G(i.value, l);
|
|
858
858
|
const d = f;
|
|
859
|
-
return n.value = !1,
|
|
859
|
+
return n.value = !1, i.value = [], r.value = null, d;
|
|
860
860
|
}
|
|
861
861
|
function V() {
|
|
862
|
-
n.value = !1,
|
|
862
|
+
n.value = !1, i.value = [], r.value = null;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function M(v) {
|
|
865
865
|
if (!c.value) return !1;
|
|
866
|
-
const f = e.value[
|
|
866
|
+
const f = e.value[o.value];
|
|
867
867
|
if (!f.reversible)
|
|
868
868
|
return typeof console < "u" && f.irreversibleReason && console.warn("Cannot undo irreversible operation:", f.irreversibleReason), !1;
|
|
869
869
|
try {
|
|
870
870
|
if (f.type === "batch" && f.childOperationIds)
|
|
871
871
|
for (let y = f.childOperationIds.length - 1; y >= 0; y--) {
|
|
872
872
|
const l = f.childOperationIds[y], d = e.value.find((S) => S.id === l);
|
|
873
|
-
d && W(d,
|
|
873
|
+
d && W(d, v);
|
|
874
874
|
}
|
|
875
875
|
else
|
|
876
|
-
W(f,
|
|
877
|
-
return
|
|
876
|
+
W(f, v);
|
|
877
|
+
return o.value--, t.value.enableCrossTabSync && N(f), !0;
|
|
878
878
|
} catch (y) {
|
|
879
879
|
return typeof console < "u" && console.error("Undo failed:", y), !1;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
function x(
|
|
883
|
-
if (!
|
|
884
|
-
const f = e.value[
|
|
882
|
+
function x(v) {
|
|
883
|
+
if (!s.value) return !1;
|
|
884
|
+
const f = e.value[o.value + 1];
|
|
885
885
|
try {
|
|
886
886
|
if (f.type === "batch" && f.childOperationIds)
|
|
887
887
|
for (const y of f.childOperationIds) {
|
|
888
888
|
const l = e.value.find((d) => d.id === y);
|
|
889
|
-
l &&
|
|
889
|
+
l && Z(l, v);
|
|
890
890
|
}
|
|
891
891
|
else
|
|
892
|
-
|
|
893
|
-
return
|
|
892
|
+
Z(f, v);
|
|
893
|
+
return o.value++, t.value.enableCrossTabSync && P(f), !0;
|
|
894
894
|
} catch (y) {
|
|
895
895
|
return typeof console < "u" && console.error("Redo failed:", y), !1;
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
|
-
function W(
|
|
899
|
-
(
|
|
898
|
+
function W(v, f) {
|
|
899
|
+
(v.type === "set" || v.type === "delete") && f && typeof f.set == "function" && f.set(v.path, v.beforeValue, "undo");
|
|
900
900
|
}
|
|
901
|
-
function
|
|
902
|
-
(
|
|
901
|
+
function Z(v, f) {
|
|
902
|
+
(v.type === "set" || v.type === "delete") && f && typeof f.set == "function" && f.set(v.path, v.afterValue, "redo");
|
|
903
903
|
}
|
|
904
|
-
function
|
|
905
|
-
const
|
|
904
|
+
function J() {
|
|
905
|
+
const v = e.value.filter((y) => y.reversible).length, f = e.value.map((y) => y.timestamp);
|
|
906
906
|
return {
|
|
907
907
|
operations: [...e.value],
|
|
908
|
-
currentIndex:
|
|
908
|
+
currentIndex: o.value,
|
|
909
909
|
totalOperations: e.value.length,
|
|
910
|
-
reversibleOperations:
|
|
911
|
-
irreversibleOperations: e.value.length -
|
|
910
|
+
reversibleOperations: v,
|
|
911
|
+
irreversibleOperations: e.value.length - v,
|
|
912
912
|
oldestOperation: f.length > 0 ? new Date(Math.min(...f.map((y) => y.getTime()))) : void 0,
|
|
913
913
|
newestOperation: f.length > 0 ? new Date(Math.max(...f.map((y) => y.getTime()))) : void 0
|
|
914
914
|
};
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
e.value = [],
|
|
916
|
+
function K() {
|
|
917
|
+
e.value = [], o.value = -1;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
920
|
-
return e.value.filter((y) => y.doctype ===
|
|
919
|
+
function E(v, f) {
|
|
920
|
+
return e.value.filter((y) => y.doctype === v && (f === void 0 || y.recordId === f));
|
|
921
921
|
}
|
|
922
|
-
function U(
|
|
923
|
-
const y = e.value.find((l) => l.id ===
|
|
922
|
+
function U(v, f) {
|
|
923
|
+
const y = e.value.find((l) => l.id === v);
|
|
924
924
|
y && (y.reversible = !1, y.irreversibleReason = f);
|
|
925
925
|
}
|
|
926
|
-
function m(
|
|
926
|
+
function m(v, f, y, l = "success", d) {
|
|
927
927
|
const S = {
|
|
928
928
|
type: "action",
|
|
929
|
-
path: y && y.length > 0 ? `${
|
|
929
|
+
path: y && y.length > 0 ? `${v}.${y[0]}` : v,
|
|
930
930
|
fieldname: "",
|
|
931
931
|
beforeValue: null,
|
|
932
932
|
afterValue: null,
|
|
933
|
-
doctype:
|
|
933
|
+
doctype: v,
|
|
934
934
|
recordId: y && y.length > 0 ? y[0] : void 0,
|
|
935
935
|
reversible: !1,
|
|
936
936
|
// Actions are typically not reversible
|
|
@@ -939,100 +939,100 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
|
|
|
939
939
|
actionResult: l,
|
|
940
940
|
actionError: d
|
|
941
941
|
};
|
|
942
|
-
return
|
|
942
|
+
return D(S);
|
|
943
943
|
}
|
|
944
|
-
let
|
|
945
|
-
function
|
|
946
|
-
typeof window > "u" || !window.BroadcastChannel || (
|
|
947
|
-
const f =
|
|
944
|
+
let g = null;
|
|
945
|
+
function A() {
|
|
946
|
+
typeof window > "u" || !window.BroadcastChannel || (g = new BroadcastChannel("stonecrop-operation-log"), g.addEventListener("message", (v) => {
|
|
947
|
+
const f = v.data;
|
|
948
948
|
if (!f || typeof f != "object") return;
|
|
949
|
-
const y =
|
|
950
|
-
y.clientId !== a.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }),
|
|
949
|
+
const y = Ro(f);
|
|
950
|
+
y.clientId !== a.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), o.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((l) => ({ ...l, source: "sync" }))), o.value = e.value.length - 1));
|
|
951
951
|
}));
|
|
952
952
|
}
|
|
953
|
-
function F(
|
|
954
|
-
if (!
|
|
953
|
+
function F(v) {
|
|
954
|
+
if (!g) return;
|
|
955
955
|
const f = {
|
|
956
956
|
type: "operation",
|
|
957
|
-
operation:
|
|
957
|
+
operation: v,
|
|
958
958
|
clientId: a.value,
|
|
959
959
|
timestamp: /* @__PURE__ */ new Date()
|
|
960
960
|
};
|
|
961
|
-
|
|
961
|
+
g.postMessage(De(f));
|
|
962
962
|
}
|
|
963
|
-
function
|
|
964
|
-
if (!
|
|
963
|
+
function G(v, f) {
|
|
964
|
+
if (!g) return;
|
|
965
965
|
const y = {
|
|
966
966
|
type: "operation",
|
|
967
|
-
operations: [...
|
|
967
|
+
operations: [...v, f],
|
|
968
968
|
clientId: a.value,
|
|
969
969
|
timestamp: /* @__PURE__ */ new Date()
|
|
970
970
|
};
|
|
971
|
-
|
|
971
|
+
g.postMessage(De(y));
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
if (!
|
|
973
|
+
function N(v) {
|
|
974
|
+
if (!g) return;
|
|
975
975
|
const f = {
|
|
976
976
|
type: "undo",
|
|
977
|
-
operation:
|
|
977
|
+
operation: v,
|
|
978
978
|
clientId: a.value,
|
|
979
979
|
timestamp: /* @__PURE__ */ new Date()
|
|
980
980
|
};
|
|
981
|
-
|
|
981
|
+
g.postMessage(De(f));
|
|
982
982
|
}
|
|
983
|
-
function
|
|
984
|
-
if (!
|
|
983
|
+
function P(v) {
|
|
984
|
+
if (!g) return;
|
|
985
985
|
const f = {
|
|
986
986
|
type: "redo",
|
|
987
|
-
operation:
|
|
987
|
+
operation: v,
|
|
988
988
|
clientId: a.value,
|
|
989
989
|
timestamp: /* @__PURE__ */ new Date()
|
|
990
990
|
};
|
|
991
|
-
|
|
991
|
+
g.postMessage(De(f));
|
|
992
992
|
}
|
|
993
|
-
const
|
|
993
|
+
const B = Oo("stonecrop-ops-operations", null, {
|
|
994
994
|
serializer: {
|
|
995
|
-
read: (
|
|
995
|
+
read: (v) => {
|
|
996
996
|
try {
|
|
997
|
-
return JSON.parse(
|
|
997
|
+
return JSON.parse(v);
|
|
998
998
|
} catch {
|
|
999
999
|
return null;
|
|
1000
1000
|
}
|
|
1001
1001
|
},
|
|
1002
|
-
write: (
|
|
1002
|
+
write: (v) => v ? JSON.stringify(v) : ""
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
1005
|
-
function
|
|
1005
|
+
function w() {
|
|
1006
1006
|
if (!(typeof window > "u"))
|
|
1007
1007
|
try {
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1008
|
+
const v = B.value;
|
|
1009
|
+
v && Array.isArray(v.operations) && (e.value = v.operations.map((f) => ({
|
|
1010
1010
|
...f,
|
|
1011
1011
|
timestamp: new Date(f.timestamp)
|
|
1012
|
-
})),
|
|
1013
|
-
} catch (
|
|
1014
|
-
typeof console < "u" && console.error("Failed to load operations from persistence:",
|
|
1012
|
+
})), o.value = v.currentIndex ?? -1);
|
|
1013
|
+
} catch (v) {
|
|
1014
|
+
typeof console < "u" && console.error("Failed to load operations from persistence:", v);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function $() {
|
|
1018
1018
|
if (!(typeof window > "u"))
|
|
1019
1019
|
try {
|
|
1020
|
-
|
|
1021
|
-
operations: e.value.map((
|
|
1022
|
-
...
|
|
1023
|
-
timestamp:
|
|
1020
|
+
B.value = {
|
|
1021
|
+
operations: e.value.map((v) => ({
|
|
1022
|
+
...v,
|
|
1023
|
+
timestamp: v.timestamp.toISOString()
|
|
1024
1024
|
})),
|
|
1025
|
-
currentIndex:
|
|
1025
|
+
currentIndex: o.value
|
|
1026
1026
|
};
|
|
1027
|
-
} catch (
|
|
1028
|
-
typeof console < "u" && console.error("Failed to save operations to persistence:",
|
|
1027
|
+
} catch (v) {
|
|
1028
|
+
typeof console < "u" && console.error("Failed to save operations to persistence:", v);
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function _() {
|
|
1032
1032
|
H(
|
|
1033
|
-
[e,
|
|
1033
|
+
[e, o],
|
|
1034
1034
|
() => {
|
|
1035
|
-
|
|
1035
|
+
t.value.enablePersistence && $();
|
|
1036
1036
|
},
|
|
1037
1037
|
{ deep: !0 }
|
|
1038
1038
|
);
|
|
@@ -1040,31 +1040,31 @@ const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
|
|
|
1040
1040
|
return {
|
|
1041
1041
|
// State
|
|
1042
1042
|
operations: e,
|
|
1043
|
-
currentIndex:
|
|
1044
|
-
config:
|
|
1043
|
+
currentIndex: o,
|
|
1044
|
+
config: t,
|
|
1045
1045
|
clientId: a,
|
|
1046
|
-
undoRedoState:
|
|
1046
|
+
undoRedoState: h,
|
|
1047
1047
|
// Computed
|
|
1048
1048
|
canUndo: c,
|
|
1049
|
-
canRedo:
|
|
1049
|
+
canRedo: s,
|
|
1050
1050
|
undoCount: u,
|
|
1051
1051
|
redoCount: p,
|
|
1052
1052
|
// Methods
|
|
1053
|
-
configure:
|
|
1054
|
-
addOperation:
|
|
1055
|
-
startBatch:
|
|
1056
|
-
commitBatch:
|
|
1053
|
+
configure: b,
|
|
1054
|
+
addOperation: D,
|
|
1055
|
+
startBatch: k,
|
|
1056
|
+
commitBatch: O,
|
|
1057
1057
|
cancelBatch: V,
|
|
1058
|
-
undo:
|
|
1058
|
+
undo: M,
|
|
1059
1059
|
redo: x,
|
|
1060
|
-
clear:
|
|
1061
|
-
getOperationsFor:
|
|
1062
|
-
getSnapshot:
|
|
1060
|
+
clear: K,
|
|
1061
|
+
getOperationsFor: E,
|
|
1062
|
+
getSnapshot: J,
|
|
1063
1063
|
markIrreversible: U,
|
|
1064
1064
|
logAction: m
|
|
1065
1065
|
};
|
|
1066
1066
|
});
|
|
1067
|
-
class
|
|
1067
|
+
class ye {
|
|
1068
1068
|
/**
|
|
1069
1069
|
* The root FieldTriggerEngine instance
|
|
1070
1070
|
*/
|
|
@@ -1085,9 +1085,9 @@ class ge {
|
|
|
1085
1085
|
* @param options - Configuration options for the field trigger engine
|
|
1086
1086
|
*/
|
|
1087
1087
|
constructor(e = {}) {
|
|
1088
|
-
if (
|
|
1089
|
-
return
|
|
1090
|
-
|
|
1088
|
+
if (ye._root)
|
|
1089
|
+
return ye._root;
|
|
1090
|
+
ye._root = this, this.options = {
|
|
1091
1091
|
defaultTimeout: e.defaultTimeout ?? 5e3,
|
|
1092
1092
|
debug: e.debug ?? !1,
|
|
1093
1093
|
enableRollback: e.enableRollback ?? !0,
|
|
@@ -1099,16 +1099,16 @@ class ge {
|
|
|
1099
1099
|
* @param name - The name of the action
|
|
1100
1100
|
* @param fn - The action function
|
|
1101
1101
|
*/
|
|
1102
|
-
registerAction(e,
|
|
1103
|
-
this.globalActions.set(e,
|
|
1102
|
+
registerAction(e, o) {
|
|
1103
|
+
this.globalActions.set(e, o);
|
|
1104
1104
|
}
|
|
1105
1105
|
/**
|
|
1106
1106
|
* Register a global XState transition action function
|
|
1107
1107
|
* @param name - The name of the transition action
|
|
1108
1108
|
* @param fn - The transition action function
|
|
1109
1109
|
*/
|
|
1110
|
-
registerTransitionAction(e,
|
|
1111
|
-
this.globalTransitionActions.set(e,
|
|
1110
|
+
registerTransitionAction(e, o) {
|
|
1111
|
+
this.globalTransitionActions.set(e, o);
|
|
1112
1112
|
}
|
|
1113
1113
|
/**
|
|
1114
1114
|
* Configure rollback behavior for a specific field trigger
|
|
@@ -1116,14 +1116,14 @@ class ge {
|
|
|
1116
1116
|
* @param fieldname - The field name
|
|
1117
1117
|
* @param enableRollback - Whether to enable rollback
|
|
1118
1118
|
*/
|
|
1119
|
-
setFieldRollback(e,
|
|
1120
|
-
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(
|
|
1119
|
+
setFieldRollback(e, o, a) {
|
|
1120
|
+
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(o, a);
|
|
1121
1121
|
}
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Get rollback configuration for a specific field trigger
|
|
1124
1124
|
*/
|
|
1125
|
-
getFieldRollback(e,
|
|
1126
|
-
return this.fieldRollbackConfig.get(e)?.get(
|
|
1125
|
+
getFieldRollback(e, o) {
|
|
1126
|
+
return this.fieldRollbackConfig.get(e)?.get(o);
|
|
1127
1127
|
}
|
|
1128
1128
|
/**
|
|
1129
1129
|
* Register actions from a doctype - both regular actions and field triggers
|
|
@@ -1131,18 +1131,18 @@ class ge {
|
|
|
1131
1131
|
* @param doctype - The doctype name
|
|
1132
1132
|
* @param actions - The actions to register (supports Immutable Map, Map, or plain object)
|
|
1133
1133
|
*/
|
|
1134
|
-
registerDoctypeActions(e,
|
|
1135
|
-
if (!
|
|
1134
|
+
registerDoctypeActions(e, o) {
|
|
1135
|
+
if (!o) return;
|
|
1136
1136
|
const a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1137
|
-
if (typeof
|
|
1138
|
-
|
|
1139
|
-
this.categorizeAction(
|
|
1137
|
+
if (typeof o.entrySeq == "function")
|
|
1138
|
+
o.entrySeq().forEach(([i, r]) => {
|
|
1139
|
+
this.categorizeAction(i, r, a, n);
|
|
1140
1140
|
});
|
|
1141
|
-
else if (
|
|
1142
|
-
for (const [
|
|
1143
|
-
this.categorizeAction(
|
|
1144
|
-
else
|
|
1145
|
-
this.categorizeAction(
|
|
1141
|
+
else if (o instanceof Map)
|
|
1142
|
+
for (const [i, r] of o)
|
|
1143
|
+
this.categorizeAction(i, r, a, n);
|
|
1144
|
+
else o && typeof o == "object" && Object.entries(o).forEach(([i, r]) => {
|
|
1145
|
+
this.categorizeAction(i, r, a, n);
|
|
1146
1146
|
});
|
|
1147
1147
|
this.doctypeActions.set(e, a), this.doctypeTransitions.set(e, n);
|
|
1148
1148
|
}
|
|
@@ -1150,8 +1150,8 @@ class ge {
|
|
|
1150
1150
|
* Categorize an action as either a field trigger or XState transition
|
|
1151
1151
|
* Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
|
|
1152
1152
|
*/
|
|
1153
|
-
categorizeAction(e,
|
|
1154
|
-
this.isTransitionKey(e) ? n.set(e,
|
|
1153
|
+
categorizeAction(e, o, a, n) {
|
|
1154
|
+
this.isTransitionKey(e) ? n.set(e, o) : a.set(e, o);
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
1157
|
* Determine if a key represents an XState transition
|
|
@@ -1165,9 +1165,9 @@ class ge {
|
|
|
1165
1165
|
* @param context - The field change context
|
|
1166
1166
|
* @param options - Execution options (timeout and enableRollback)
|
|
1167
1167
|
*/
|
|
1168
|
-
async executeFieldTriggers(e,
|
|
1169
|
-
const { doctype: a, fieldname: n } = e,
|
|
1170
|
-
if (
|
|
1168
|
+
async executeFieldTriggers(e, o = {}) {
|
|
1169
|
+
const { doctype: a, fieldname: n } = e, i = this.findFieldTriggers(a, n);
|
|
1170
|
+
if (i.length === 0)
|
|
1171
1171
|
return {
|
|
1172
1172
|
path: e.path,
|
|
1173
1173
|
actionResults: [],
|
|
@@ -1177,48 +1177,48 @@ class ge {
|
|
|
1177
1177
|
rolledBack: !1
|
|
1178
1178
|
};
|
|
1179
1179
|
const r = performance.now(), c = [];
|
|
1180
|
-
let
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
for (const
|
|
1180
|
+
let s = !1, u = !1, p;
|
|
1181
|
+
const h = this.getFieldRollback(a, n), b = o.enableRollback ?? h ?? this.options.enableRollback;
|
|
1182
|
+
b && e.store && (p = this.captureSnapshot(e));
|
|
1183
|
+
for (const O of i)
|
|
1184
1184
|
try {
|
|
1185
|
-
const V = await this.executeAction(
|
|
1185
|
+
const V = await this.executeAction(O, e, o.timeout);
|
|
1186
1186
|
if (c.push(V), !V.success) {
|
|
1187
|
-
|
|
1187
|
+
s = !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
|
-
action:
|
|
1195
|
+
action: O
|
|
1196
1196
|
};
|
|
1197
|
-
c.push(
|
|
1197
|
+
c.push(M), s = !0;
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
|
-
if (
|
|
1200
|
+
if (b && s && p && e.store)
|
|
1201
1201
|
try {
|
|
1202
1202
|
this.restoreSnapshot(e, p), u = !0;
|
|
1203
|
-
} catch (
|
|
1204
|
-
console.error("[FieldTriggers] Rollback failed:",
|
|
1203
|
+
} catch (O) {
|
|
1204
|
+
console.error("[FieldTriggers] Rollback failed:", O);
|
|
1205
1205
|
}
|
|
1206
|
-
const
|
|
1207
|
-
if (
|
|
1208
|
-
for (const
|
|
1206
|
+
const D = performance.now() - r, k = c.filter((O) => !O.success);
|
|
1207
|
+
if (k.length > 0 && this.options.errorHandler)
|
|
1208
|
+
for (const O of k)
|
|
1209
1209
|
try {
|
|
1210
|
-
this.options.errorHandler(
|
|
1210
|
+
this.options.errorHandler(O.error, e, O.action);
|
|
1211
1211
|
} catch (V) {
|
|
1212
1212
|
console.error("[FieldTriggers] Error in global error handler:", V);
|
|
1213
1213
|
}
|
|
1214
1214
|
return {
|
|
1215
1215
|
path: e.path,
|
|
1216
1216
|
actionResults: c,
|
|
1217
|
-
totalExecutionTime:
|
|
1218
|
-
allSucceeded: c.every((
|
|
1219
|
-
stoppedOnError:
|
|
1217
|
+
totalExecutionTime: D,
|
|
1218
|
+
allSucceeded: c.every((O) => O.success),
|
|
1219
|
+
stoppedOnError: s,
|
|
1220
1220
|
rolledBack: u,
|
|
1221
|
-
snapshot: this.options.debug &&
|
|
1221
|
+
snapshot: this.options.debug && b ? p : void 0
|
|
1222
1222
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
@@ -1228,14 +1228,14 @@ class ge {
|
|
|
1228
1228
|
* @param context - The transition change context
|
|
1229
1229
|
* @param options - Execution options (timeout)
|
|
1230
1230
|
*/
|
|
1231
|
-
async executeTransitionActions(e,
|
|
1232
|
-
const { doctype: a, transition: n } = e,
|
|
1233
|
-
if (
|
|
1231
|
+
async executeTransitionActions(e, o = {}) {
|
|
1232
|
+
const { doctype: a, transition: n } = e, i = this.findTransitionActions(a, n);
|
|
1233
|
+
if (i.length === 0)
|
|
1234
1234
|
return [];
|
|
1235
1235
|
const r = [];
|
|
1236
|
-
for (const
|
|
1236
|
+
for (const s of i)
|
|
1237
1237
|
try {
|
|
1238
|
-
const u = await this.executeTransitionAction(
|
|
1238
|
+
const u = await this.executeTransitionAction(s, e, o.timeout);
|
|
1239
1239
|
if (r.push(u), !u.success)
|
|
1240
1240
|
break;
|
|
1241
1241
|
} catch (u) {
|
|
@@ -1243,17 +1243,17 @@ class ge {
|
|
|
1243
1243
|
success: !1,
|
|
1244
1244
|
error: u instanceof Error ? u : new Error(String(u)),
|
|
1245
1245
|
executionTime: 0,
|
|
1246
|
-
action:
|
|
1246
|
+
action: s,
|
|
1247
1247
|
transition: n
|
|
1248
1248
|
};
|
|
1249
1249
|
r.push(p);
|
|
1250
1250
|
break;
|
|
1251
1251
|
}
|
|
1252
|
-
const c = r.filter((
|
|
1252
|
+
const c = r.filter((s) => !s.success);
|
|
1253
1253
|
if (c.length > 0 && this.options.errorHandler)
|
|
1254
|
-
for (const
|
|
1254
|
+
for (const s of c)
|
|
1255
1255
|
try {
|
|
1256
|
-
this.options.errorHandler(
|
|
1256
|
+
this.options.errorHandler(s.error, e, s.action);
|
|
1257
1257
|
} catch (u) {
|
|
1258
1258
|
console.error("[FieldTriggers] Error in global error handler:", u);
|
|
1259
1259
|
}
|
|
@@ -1262,15 +1262,15 @@ class ge {
|
|
|
1262
1262
|
/**
|
|
1263
1263
|
* Find transition actions for a specific doctype and transition
|
|
1264
1264
|
*/
|
|
1265
|
-
findTransitionActions(e,
|
|
1265
|
+
findTransitionActions(e, o) {
|
|
1266
1266
|
const a = this.doctypeTransitions.get(e);
|
|
1267
|
-
return a ? a.get(
|
|
1267
|
+
return a ? a.get(o) || [] : [];
|
|
1268
1268
|
}
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Execute a single transition action by name
|
|
1271
1271
|
*/
|
|
1272
|
-
async executeTransitionAction(e,
|
|
1273
|
-
const n = performance.now(),
|
|
1272
|
+
async executeTransitionAction(e, o, a) {
|
|
1273
|
+
const n = performance.now(), i = a ?? this.options.defaultTimeout;
|
|
1274
1274
|
try {
|
|
1275
1275
|
let r = this.globalTransitionActions.get(e);
|
|
1276
1276
|
if (!r) {
|
|
@@ -1279,11 +1279,11 @@ class ge {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
if (!r)
|
|
1281
1281
|
throw new Error(`Transition action "${e}" not found in registry`);
|
|
1282
|
-
return await this.executeWithTimeout(r,
|
|
1282
|
+
return await this.executeWithTimeout(r, o, i), {
|
|
1283
1283
|
success: !0,
|
|
1284
1284
|
executionTime: performance.now() - n,
|
|
1285
1285
|
action: e,
|
|
1286
|
-
transition:
|
|
1286
|
+
transition: o.transition
|
|
1287
1287
|
};
|
|
1288
1288
|
} catch (r) {
|
|
1289
1289
|
const c = performance.now() - n;
|
|
@@ -1292,7 +1292,7 @@ class ge {
|
|
|
1292
1292
|
error: r instanceof Error ? r : new Error(String(r)),
|
|
1293
1293
|
executionTime: c,
|
|
1294
1294
|
action: e,
|
|
1295
|
-
transition:
|
|
1295
|
+
transition: o.transition
|
|
1296
1296
|
};
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
@@ -1300,12 +1300,12 @@ class ge {
|
|
|
1300
1300
|
* Find field triggers for a specific doctype and field
|
|
1301
1301
|
* Field triggers are identified by keys that look like field paths (contain dots or match field names)
|
|
1302
1302
|
*/
|
|
1303
|
-
findFieldTriggers(e,
|
|
1303
|
+
findFieldTriggers(e, o) {
|
|
1304
1304
|
const a = this.doctypeActions.get(e);
|
|
1305
1305
|
if (!a) return [];
|
|
1306
1306
|
const n = [];
|
|
1307
|
-
for (const [
|
|
1308
|
-
this.isFieldTriggerKey(
|
|
1307
|
+
for (const [i, r] of a)
|
|
1308
|
+
this.isFieldTriggerKey(i, o) && n.push(...r);
|
|
1309
1309
|
return n;
|
|
1310
1310
|
}
|
|
1311
1311
|
/**
|
|
@@ -1315,19 +1315,19 @@ class ge {
|
|
|
1315
1315
|
* - Wildcard patterns: "emailAddress.*", "*.is_primary"
|
|
1316
1316
|
* - Nested field paths: "address.street", "contact.email"
|
|
1317
1317
|
*/
|
|
1318
|
-
isFieldTriggerKey(e,
|
|
1319
|
-
return e ===
|
|
1318
|
+
isFieldTriggerKey(e, o) {
|
|
1319
|
+
return e === o ? !0 : e.includes(".") ? this.matchFieldPattern(e, o) : e.includes("*") ? this.matchFieldPattern(e, o) : !1;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
1322
1322
|
* Match a field pattern against a field name
|
|
1323
1323
|
* Supports wildcards (*) for dynamic segments
|
|
1324
1324
|
*/
|
|
1325
|
-
matchFieldPattern(e,
|
|
1326
|
-
const a = e.split("."), n =
|
|
1325
|
+
matchFieldPattern(e, o) {
|
|
1326
|
+
const a = e.split("."), n = o.split(".");
|
|
1327
1327
|
if (a.length !== n.length)
|
|
1328
1328
|
return !1;
|
|
1329
|
-
for (let
|
|
1330
|
-
const r = a[
|
|
1329
|
+
for (let i = 0; i < a.length; i++) {
|
|
1330
|
+
const r = a[i], c = n[i];
|
|
1331
1331
|
if (r !== "*" && r !== c)
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
}
|
|
@@ -1336,13 +1336,13 @@ class ge {
|
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Execute a single action by name
|
|
1338
1338
|
*/
|
|
1339
|
-
async executeAction(e,
|
|
1340
|
-
const n = performance.now(),
|
|
1339
|
+
async executeAction(e, o, a) {
|
|
1340
|
+
const n = performance.now(), i = a ?? 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,
|
|
1345
|
+
return await this.executeWithTimeout(r, o, i), {
|
|
1346
1346
|
success: !0,
|
|
1347
1347
|
executionTime: performance.now() - n,
|
|
1348
1348
|
action: e
|
|
@@ -1360,15 +1360,15 @@ class ge {
|
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Execute a function with timeout
|
|
1362
1362
|
*/
|
|
1363
|
-
async executeWithTimeout(e,
|
|
1364
|
-
return new Promise((n,
|
|
1363
|
+
async executeWithTimeout(e, o, a) {
|
|
1364
|
+
return new Promise((n, i) => {
|
|
1365
1365
|
const r = setTimeout(() => {
|
|
1366
|
-
|
|
1366
|
+
i(new Error(`Action timeout after ${a}ms`));
|
|
1367
1367
|
}, a);
|
|
1368
|
-
Promise.resolve(e(
|
|
1368
|
+
Promise.resolve(e(o)).then((c) => {
|
|
1369
1369
|
clearTimeout(r), n(c);
|
|
1370
1370
|
}).catch((c) => {
|
|
1371
|
-
clearTimeout(r),
|
|
1371
|
+
clearTimeout(r), i(c);
|
|
1372
1372
|
});
|
|
1373
1373
|
});
|
|
1374
1374
|
}
|
|
@@ -1379,10 +1379,10 @@ class ge {
|
|
|
1379
1379
|
captureSnapshot(e) {
|
|
1380
1380
|
if (!(!e.store || !e.doctype || !e.recordId))
|
|
1381
1381
|
try {
|
|
1382
|
-
const
|
|
1382
|
+
const o = `${e.doctype}.${e.recordId}`, a = e.store.get(o);
|
|
1383
1383
|
return !a || typeof a != "object" ? void 0 : JSON.parse(JSON.stringify(a));
|
|
1384
|
-
} catch (
|
|
1385
|
-
this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:",
|
|
1384
|
+
} catch (o) {
|
|
1385
|
+
this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", o);
|
|
1386
1386
|
return;
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
@@ -1390,34 +1390,34 @@ class ge {
|
|
|
1390
1390
|
* Restore a previously captured snapshot
|
|
1391
1391
|
* This reverts the record to its state before actions were executed
|
|
1392
1392
|
*/
|
|
1393
|
-
restoreSnapshot(e,
|
|
1394
|
-
if (!(!e.store || !e.doctype || !e.recordId || !
|
|
1393
|
+
restoreSnapshot(e, o) {
|
|
1394
|
+
if (!(!e.store || !e.doctype || !e.recordId || !o))
|
|
1395
1395
|
try {
|
|
1396
1396
|
const a = `${e.doctype}.${e.recordId}`;
|
|
1397
|
-
e.store.set(a,
|
|
1397
|
+
e.store.set(a, o), this.options.debug && console.log(`[FieldTriggers] Rolled back ${a} to previous state`);
|
|
1398
1398
|
} catch (a) {
|
|
1399
1399
|
throw console.error("[FieldTriggers] Failed to restore snapshot:", a), a;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1404
|
-
return new
|
|
1403
|
+
function ut(t) {
|
|
1404
|
+
return new ye(t);
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function dt() {
|
|
1407
1407
|
try {
|
|
1408
|
-
return
|
|
1408
|
+
return Dt();
|
|
1409
1409
|
} catch {
|
|
1410
1410
|
return null;
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
-
class
|
|
1413
|
+
class le {
|
|
1414
1414
|
static instance;
|
|
1415
1415
|
/**
|
|
1416
1416
|
* Gets the singleton instance of HST
|
|
1417
1417
|
* @returns The HST singleton instance
|
|
1418
1418
|
*/
|
|
1419
1419
|
static getInstance() {
|
|
1420
|
-
return
|
|
1420
|
+
return le.instance || (le.instance = new le()), le.instance;
|
|
1421
1421
|
}
|
|
1422
1422
|
/**
|
|
1423
1423
|
* Gets the global registry instance
|
|
@@ -1446,28 +1446,28 @@ class re {
|
|
|
1446
1446
|
* @returns The doctype metadata object or undefined if not found
|
|
1447
1447
|
*/
|
|
1448
1448
|
getDoctypeMeta(e) {
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
return
|
|
1449
|
+
const o = this.getRegistry();
|
|
1450
|
+
if (o && typeof o == "object" && "registry" in o)
|
|
1451
|
+
return o.registry[e];
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
|
-
class
|
|
1454
|
+
class Te {
|
|
1455
1455
|
target;
|
|
1456
1456
|
parentPath;
|
|
1457
1457
|
rootNode;
|
|
1458
1458
|
doctype;
|
|
1459
1459
|
parentDoctype;
|
|
1460
1460
|
hst;
|
|
1461
|
-
constructor(e,
|
|
1462
|
-
return this.target = e, this.parentPath = a, this.rootNode = n || this, this.doctype =
|
|
1461
|
+
constructor(e, o, a = "", n = null, i) {
|
|
1462
|
+
return this.target = e, this.parentPath = a, this.rootNode = n || this, this.doctype = o, this.parentDoctype = i, this.hst = le.getInstance(), new Proxy(this, {
|
|
1463
1463
|
get(r, c) {
|
|
1464
1464
|
if (c in r) return r[c];
|
|
1465
|
-
const
|
|
1466
|
-
return r.getNode(
|
|
1465
|
+
const s = String(c);
|
|
1466
|
+
return r.getNode(s);
|
|
1467
1467
|
},
|
|
1468
|
-
set(r, c,
|
|
1468
|
+
set(r, c, s) {
|
|
1469
1469
|
const u = String(c);
|
|
1470
|
-
return r.set(u,
|
|
1470
|
+
return r.set(u, s), !0;
|
|
1471
1471
|
}
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
@@ -1476,24 +1476,24 @@ class Ie {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
// Method to get a tree-wrapped node for navigation
|
|
1478
1478
|
getNode(e) {
|
|
1479
|
-
const
|
|
1480
|
-
let
|
|
1481
|
-
return this.doctype === "StonecropStore" && n.length >= 1 && (
|
|
1479
|
+
const o = this.resolvePath(e), a = this.resolveValue(e), n = o.split(".");
|
|
1480
|
+
let i = this.doctype;
|
|
1481
|
+
return this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), typeof a == "object" && a !== null && !this.isPrimitive(a) ? new Te(a, i, o, this.rootNode, this.parentDoctype) : new Te(a, i, o, this.rootNode, this.parentDoctype);
|
|
1482
1482
|
}
|
|
1483
|
-
set(e,
|
|
1484
|
-
const n = this.resolvePath(e),
|
|
1483
|
+
set(e, o, a = "user") {
|
|
1484
|
+
const n = this.resolvePath(e), i = this.has(e) ? this.get(e) : void 0;
|
|
1485
1485
|
if (a !== "undo" && a !== "redo") {
|
|
1486
|
-
const r =
|
|
1486
|
+
const r = dt();
|
|
1487
1487
|
if (r && typeof r.addOperation == "function") {
|
|
1488
|
-
const c = n.split("."),
|
|
1488
|
+
const c = n.split("."), s = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, p = c.slice(2).join(".") || c[c.length - 1], h = o === void 0 && i !== void 0 ? "delete" : "set";
|
|
1489
1489
|
r.addOperation(
|
|
1490
1490
|
{
|
|
1491
|
-
type:
|
|
1491
|
+
type: h,
|
|
1492
1492
|
path: n,
|
|
1493
1493
|
fieldname: p,
|
|
1494
|
-
beforeValue:
|
|
1495
|
-
afterValue:
|
|
1496
|
-
doctype:
|
|
1494
|
+
beforeValue: i,
|
|
1495
|
+
afterValue: o,
|
|
1496
|
+
doctype: s,
|
|
1497
1497
|
recordId: u,
|
|
1498
1498
|
reversible: !0
|
|
1499
1499
|
// Default to reversible, can be changed by field triggers
|
|
@@ -1502,21 +1502,21 @@ class Ie {
|
|
|
1502
1502
|
);
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
|
-
this.updateValue(e,
|
|
1505
|
+
this.updateValue(e, o), this.triggerFieldActions(n, i, o);
|
|
1506
1506
|
}
|
|
1507
1507
|
has(e) {
|
|
1508
1508
|
try {
|
|
1509
1509
|
if (e === "")
|
|
1510
1510
|
return !0;
|
|
1511
|
-
const
|
|
1511
|
+
const o = this.parsePath(e);
|
|
1512
1512
|
let a = this.target;
|
|
1513
|
-
for (let n = 0; n <
|
|
1514
|
-
const
|
|
1513
|
+
for (let n = 0; n < o.length; n++) {
|
|
1514
|
+
const i = o[n];
|
|
1515
1515
|
if (a == null)
|
|
1516
1516
|
return !1;
|
|
1517
|
-
if (n ===
|
|
1518
|
-
return this.isImmutable(a) ? a.has(
|
|
1519
|
-
a = this.getProperty(a,
|
|
1517
|
+
if (n === o.length - 1)
|
|
1518
|
+
return this.isImmutable(a) ? a.has(i) : this.isPiniaStore(a) && a.$state && i in a.$state || i in a;
|
|
1519
|
+
a = this.getProperty(a, i);
|
|
1520
1520
|
}
|
|
1521
1521
|
return !1;
|
|
1522
1522
|
} catch {
|
|
@@ -1544,10 +1544,10 @@ class Ie {
|
|
|
1544
1544
|
/**
|
|
1545
1545
|
* Trigger an XState transition with optional context data
|
|
1546
1546
|
*/
|
|
1547
|
-
async triggerTransition(e,
|
|
1548
|
-
const a =
|
|
1549
|
-
let
|
|
1550
|
-
this.doctype === "StonecropStore" && n.length >= 1 && (
|
|
1547
|
+
async triggerTransition(e, o) {
|
|
1548
|
+
const a = ut(), n = this.parentPath.split(".");
|
|
1549
|
+
let i = this.doctype, r;
|
|
1550
|
+
this.doctype === "StonecropStore" && n.length >= 1 && (i = n[0]), n.length >= 2 && (r = n[1]);
|
|
1551
1551
|
const c = {
|
|
1552
1552
|
path: this.parentPath,
|
|
1553
1553
|
fieldname: "",
|
|
@@ -1555,31 +1555,31 @@ class Ie {
|
|
|
1555
1555
|
beforeValue: void 0,
|
|
1556
1556
|
afterValue: void 0,
|
|
1557
1557
|
operation: "set",
|
|
1558
|
-
doctype:
|
|
1558
|
+
doctype: i,
|
|
1559
1559
|
recordId: r,
|
|
1560
1560
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1561
1561
|
store: this.rootNode || void 0,
|
|
1562
1562
|
transition: e,
|
|
1563
|
-
currentState:
|
|
1564
|
-
targetState:
|
|
1565
|
-
fsmContext:
|
|
1566
|
-
},
|
|
1567
|
-
return
|
|
1563
|
+
currentState: o?.currentState,
|
|
1564
|
+
targetState: o?.targetState,
|
|
1565
|
+
fsmContext: o?.fsmContext
|
|
1566
|
+
}, s = dt();
|
|
1567
|
+
return s && typeof s.addOperation == "function" && s.addOperation(
|
|
1568
1568
|
{
|
|
1569
1569
|
type: "transition",
|
|
1570
1570
|
path: this.parentPath,
|
|
1571
1571
|
fieldname: e,
|
|
1572
|
-
beforeValue:
|
|
1573
|
-
afterValue:
|
|
1574
|
-
doctype:
|
|
1572
|
+
beforeValue: o?.currentState,
|
|
1573
|
+
afterValue: o?.targetState,
|
|
1574
|
+
doctype: i,
|
|
1575
1575
|
recordId: r,
|
|
1576
1576
|
reversible: !1,
|
|
1577
1577
|
// FSM transitions are generally not reversible
|
|
1578
1578
|
metadata: {
|
|
1579
1579
|
transition: e,
|
|
1580
|
-
currentState:
|
|
1581
|
-
targetState:
|
|
1582
|
-
fsmContext:
|
|
1580
|
+
currentState: o?.currentState,
|
|
1581
|
+
targetState: o?.targetState,
|
|
1582
|
+
fsmContext: o?.fsmContext
|
|
1583
1583
|
}
|
|
1584
1584
|
},
|
|
1585
1585
|
"user"
|
|
@@ -1592,62 +1592,62 @@ class Ie {
|
|
|
1592
1592
|
resolveValue(e) {
|
|
1593
1593
|
if (e === "")
|
|
1594
1594
|
return this.target;
|
|
1595
|
-
const
|
|
1595
|
+
const o = this.parsePath(e);
|
|
1596
1596
|
let a = this.target;
|
|
1597
|
-
for (const n of
|
|
1597
|
+
for (const n of o) {
|
|
1598
1598
|
if (a == null)
|
|
1599
1599
|
return;
|
|
1600
1600
|
a = this.getProperty(a, n);
|
|
1601
1601
|
}
|
|
1602
1602
|
return a;
|
|
1603
1603
|
}
|
|
1604
|
-
updateValue(e,
|
|
1604
|
+
updateValue(e, o) {
|
|
1605
1605
|
if (e === "")
|
|
1606
1606
|
throw new Error("Cannot set value on empty path");
|
|
1607
1607
|
const a = this.parsePath(e), n = a.pop();
|
|
1608
|
-
let
|
|
1608
|
+
let i = this.target;
|
|
1609
1609
|
for (const r of a)
|
|
1610
|
-
if (
|
|
1610
|
+
if (i = this.getProperty(i, r), i == null)
|
|
1611
1611
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1612
|
-
this.setProperty(
|
|
1612
|
+
this.setProperty(i, n, o);
|
|
1613
1613
|
}
|
|
1614
|
-
getProperty(e,
|
|
1615
|
-
return this.isImmutable(e) ? e.get(
|
|
1614
|
+
getProperty(e, o) {
|
|
1615
|
+
return this.isImmutable(e) ? e.get(o) : this.isVueReactive(e) ? e[o] : this.isPiniaStore(e) ? e.$state?.[o] ?? e[o] : e[o];
|
|
1616
1616
|
}
|
|
1617
|
-
setProperty(e,
|
|
1617
|
+
setProperty(e, o, a) {
|
|
1618
1618
|
if (this.isImmutable(e))
|
|
1619
1619
|
throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
|
|
1620
1620
|
if (this.isPiniaStore(e)) {
|
|
1621
|
-
e.$patch ? e.$patch({ [
|
|
1621
|
+
e.$patch ? e.$patch({ [o]: a }) : e[o] = a;
|
|
1622
1622
|
return;
|
|
1623
1623
|
}
|
|
1624
|
-
e[
|
|
1624
|
+
e[o] = a;
|
|
1625
1625
|
}
|
|
1626
|
-
async triggerFieldActions(e,
|
|
1626
|
+
async triggerFieldActions(e, o, a) {
|
|
1627
1627
|
try {
|
|
1628
1628
|
if (!e || typeof e != "string")
|
|
1629
1629
|
return;
|
|
1630
1630
|
const n = e.split(".");
|
|
1631
1631
|
if (n.length < 3)
|
|
1632
1632
|
return;
|
|
1633
|
-
const
|
|
1633
|
+
const i = ut(), r = n.slice(2).join(".") || n[n.length - 1];
|
|
1634
1634
|
let c = this.doctype;
|
|
1635
1635
|
this.doctype === "StonecropStore" && n.length >= 1 && (c = n[0]);
|
|
1636
|
-
let
|
|
1637
|
-
n.length >= 2 && (
|
|
1636
|
+
let s;
|
|
1637
|
+
n.length >= 2 && (s = n[1]);
|
|
1638
1638
|
const u = {
|
|
1639
1639
|
path: e,
|
|
1640
1640
|
fieldname: r,
|
|
1641
|
-
beforeValue:
|
|
1641
|
+
beforeValue: o,
|
|
1642
1642
|
afterValue: a,
|
|
1643
1643
|
operation: "set",
|
|
1644
1644
|
doctype: c,
|
|
1645
|
-
recordId:
|
|
1645
|
+
recordId: s,
|
|
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 i.executeFieldTriggers(u);
|
|
1651
1651
|
} catch (n) {
|
|
1652
1652
|
n instanceof Error && console.warn("Field trigger error:", n.message);
|
|
1653
1653
|
}
|
|
@@ -1661,31 +1661,36 @@ class Ie {
|
|
|
1661
1661
|
isImmutable(e) {
|
|
1662
1662
|
if (!e || typeof e != "object")
|
|
1663
1663
|
return !1;
|
|
1664
|
-
const
|
|
1664
|
+
const o = "get" in e && typeof e.get == "function", a = "set" in e && typeof e.set == "function", n = "has" in e && typeof e.has == "function", i = "__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 && a;
|
|
1665
1665
|
let r;
|
|
1666
1666
|
try {
|
|
1667
|
-
const
|
|
1668
|
-
if ("constructor" in
|
|
1669
|
-
const u =
|
|
1667
|
+
const s = e;
|
|
1668
|
+
if ("constructor" in s && s.constructor && typeof s.constructor == "object" && "name" in s.constructor) {
|
|
1669
|
+
const u = s.constructor.name;
|
|
1670
1670
|
r = typeof u == "string" ? u : void 0;
|
|
1671
1671
|
}
|
|
1672
1672
|
} catch {
|
|
1673
1673
|
r = void 0;
|
|
1674
1674
|
}
|
|
1675
|
-
const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (
|
|
1676
|
-
return !!(
|
|
1675
|
+
const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (o || a);
|
|
1676
|
+
return !!(o && a && n && i || o && a && c);
|
|
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";
|
|
1680
1680
|
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Parse a path string into segments, handling both dot notation and array bracket notation
|
|
1683
|
+
* @param path - The path string to parse (e.g., "order.456.line_items[0].product")
|
|
1684
|
+
* @returns Array of path segments (e.g., ['order', '456', 'line_items', '0', 'product'])
|
|
1685
|
+
*/
|
|
1681
1686
|
parsePath(e) {
|
|
1682
|
-
return e ? e.split(".").filter((
|
|
1687
|
+
return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((o) => o.length > 0) : [];
|
|
1683
1688
|
}
|
|
1684
1689
|
}
|
|
1685
|
-
function
|
|
1686
|
-
return new
|
|
1690
|
+
function Co(t, e, o) {
|
|
1691
|
+
return new Te(t, e, "", null, o);
|
|
1687
1692
|
}
|
|
1688
|
-
class
|
|
1693
|
+
class Ao {
|
|
1689
1694
|
hstStore;
|
|
1690
1695
|
_operationLogStore;
|
|
1691
1696
|
_operationLogConfig;
|
|
@@ -1696,32 +1701,32 @@ class ko {
|
|
|
1696
1701
|
* @param registry - The Registry instance containing doctype definitions
|
|
1697
1702
|
* @param operationLogConfig - Optional configuration for the operation log
|
|
1698
1703
|
*/
|
|
1699
|
-
constructor(e,
|
|
1700
|
-
this.registry = e, this._operationLogConfig =
|
|
1704
|
+
constructor(e, o) {
|
|
1705
|
+
this.registry = e, this._operationLogConfig = o, this.initializeHSTStore(), this.setupRegistrySync();
|
|
1701
1706
|
}
|
|
1702
1707
|
/**
|
|
1703
1708
|
* Get the operation log store (lazy initialization)
|
|
1704
1709
|
* @internal
|
|
1705
1710
|
*/
|
|
1706
1711
|
getOperationLogStore() {
|
|
1707
|
-
return this._operationLogStore || (this._operationLogStore =
|
|
1712
|
+
return this._operationLogStore || (this._operationLogStore = Dt(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
|
|
1708
1713
|
}
|
|
1709
1714
|
/**
|
|
1710
1715
|
* Initialize the HST store structure
|
|
1711
1716
|
*/
|
|
1712
1717
|
initializeHSTStore() {
|
|
1713
1718
|
const e = {};
|
|
1714
|
-
Object.keys(this.registry.registry).forEach((
|
|
1715
|
-
e[
|
|
1716
|
-
}), this.hstStore =
|
|
1719
|
+
Object.keys(this.registry.registry).forEach((o) => {
|
|
1720
|
+
e[o] = {};
|
|
1721
|
+
}), this.hstStore = Co(gt(e), "StonecropStore");
|
|
1717
1722
|
}
|
|
1718
1723
|
/**
|
|
1719
1724
|
* Setup automatic sync with Registry when doctypes are added
|
|
1720
1725
|
*/
|
|
1721
1726
|
setupRegistrySync() {
|
|
1722
1727
|
const e = this.registry.addDoctype.bind(this.registry);
|
|
1723
|
-
this.registry.addDoctype = (
|
|
1724
|
-
e(
|
|
1728
|
+
this.registry.addDoctype = (o) => {
|
|
1729
|
+
e(o), this.hstStore.has(o.slug) || this.hstStore.set(o.slug, {});
|
|
1725
1730
|
};
|
|
1726
1731
|
}
|
|
1727
1732
|
/**
|
|
@@ -1730,8 +1735,8 @@ class ko {
|
|
|
1730
1735
|
* @returns HST node containing records hash
|
|
1731
1736
|
*/
|
|
1732
1737
|
records(e) {
|
|
1733
|
-
const
|
|
1734
|
-
return this.ensureDoctypeExists(
|
|
1738
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1739
|
+
return this.ensureDoctypeExists(o), this.hstStore.getNode(o);
|
|
1735
1740
|
}
|
|
1736
1741
|
/**
|
|
1737
1742
|
* Add a record to the store
|
|
@@ -1739,9 +1744,9 @@ class ko {
|
|
|
1739
1744
|
* @param recordId - The record ID
|
|
1740
1745
|
* @param recordData - The record data
|
|
1741
1746
|
*/
|
|
1742
|
-
addRecord(e,
|
|
1747
|
+
addRecord(e, o, a) {
|
|
1743
1748
|
const n = typeof e == "string" ? e : e.slug;
|
|
1744
|
-
this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${
|
|
1749
|
+
this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${o}`, a);
|
|
1745
1750
|
}
|
|
1746
1751
|
/**
|
|
1747
1752
|
* Get a specific record
|
|
@@ -1749,19 +1754,19 @@ class ko {
|
|
|
1749
1754
|
* @param recordId - The record ID
|
|
1750
1755
|
* @returns HST node for the record or undefined
|
|
1751
1756
|
*/
|
|
1752
|
-
getRecordById(e,
|
|
1757
|
+
getRecordById(e, o) {
|
|
1753
1758
|
const a = typeof e == "string" ? e : e.slug;
|
|
1754
|
-
if (this.ensureDoctypeExists(a), !(!this.hstStore.has(`${a}.${
|
|
1755
|
-
return this.hstStore.getNode(`${a}.${
|
|
1759
|
+
if (this.ensureDoctypeExists(a), !(!this.hstStore.has(`${a}.${o}`) || this.hstStore.get(`${a}.${o}`) === void 0))
|
|
1760
|
+
return this.hstStore.getNode(`${a}.${o}`);
|
|
1756
1761
|
}
|
|
1757
1762
|
/**
|
|
1758
1763
|
* Remove a record from the store
|
|
1759
1764
|
* @param doctype - The doctype
|
|
1760
1765
|
* @param recordId - The record ID
|
|
1761
1766
|
*/
|
|
1762
|
-
removeRecord(e,
|
|
1767
|
+
removeRecord(e, o) {
|
|
1763
1768
|
const a = typeof e == "string" ? e : e.slug;
|
|
1764
|
-
this.ensureDoctypeExists(a), this.hstStore.has(`${a}.${
|
|
1769
|
+
this.ensureDoctypeExists(a), this.hstStore.has(`${a}.${o}`) && this.hstStore.set(`${a}.${o}`, void 0);
|
|
1765
1770
|
}
|
|
1766
1771
|
/**
|
|
1767
1772
|
* Get all record IDs for a doctype
|
|
@@ -1769,9 +1774,9 @@ class ko {
|
|
|
1769
1774
|
* @returns Array of record IDs
|
|
1770
1775
|
*/
|
|
1771
1776
|
getRecordIds(e) {
|
|
1772
|
-
const
|
|
1773
|
-
this.ensureDoctypeExists(
|
|
1774
|
-
const a = this.hstStore.get(
|
|
1777
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1778
|
+
this.ensureDoctypeExists(o);
|
|
1779
|
+
const a = this.hstStore.get(o);
|
|
1775
1780
|
return !a || typeof a != "object" ? [] : Object.keys(a).filter((n) => a[n] !== void 0);
|
|
1776
1781
|
}
|
|
1777
1782
|
/**
|
|
@@ -1779,9 +1784,9 @@ class ko {
|
|
|
1779
1784
|
* @param doctype - The doctype
|
|
1780
1785
|
*/
|
|
1781
1786
|
clearRecords(e) {
|
|
1782
|
-
const
|
|
1783
|
-
this.ensureDoctypeExists(
|
|
1784
|
-
this.hstStore.set(`${
|
|
1787
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1788
|
+
this.ensureDoctypeExists(o), this.getRecordIds(o).forEach((a) => {
|
|
1789
|
+
this.hstStore.set(`${o}.${a}`, void 0);
|
|
1785
1790
|
});
|
|
1786
1791
|
}
|
|
1787
1792
|
/**
|
|
@@ -1798,20 +1803,20 @@ class ko {
|
|
|
1798
1803
|
* @param action - The action to run
|
|
1799
1804
|
* @param args - Action arguments (typically record IDs)
|
|
1800
1805
|
*/
|
|
1801
|
-
runAction(e,
|
|
1802
|
-
const n = this.registry.registry[e.slug]?.actions?.get(
|
|
1803
|
-
let c = "success",
|
|
1806
|
+
runAction(e, o, a) {
|
|
1807
|
+
const n = this.registry.registry[e.slug]?.actions?.get(o), i = Array.isArray(a) ? a.filter((u) => typeof u == "string") : void 0, r = this.getOperationLogStore();
|
|
1808
|
+
let c = "success", s;
|
|
1804
1809
|
try {
|
|
1805
1810
|
n && n.length > 0 && n.forEach((u) => {
|
|
1806
1811
|
try {
|
|
1807
1812
|
new Function("args", u)(a);
|
|
1808
1813
|
} catch (p) {
|
|
1809
|
-
throw c = "failure",
|
|
1814
|
+
throw c = "failure", s = p instanceof Error ? p.message : "Unknown error", p;
|
|
1810
1815
|
}
|
|
1811
1816
|
});
|
|
1812
1817
|
} catch {
|
|
1813
1818
|
} finally {
|
|
1814
|
-
r.logAction(e.doctype,
|
|
1819
|
+
r.logAction(e.doctype, o, i, c, s);
|
|
1815
1820
|
}
|
|
1816
1821
|
}
|
|
1817
1822
|
/**
|
|
@@ -1819,8 +1824,8 @@ class ko {
|
|
|
1819
1824
|
* @param doctype - The doctype
|
|
1820
1825
|
*/
|
|
1821
1826
|
async getRecords(e) {
|
|
1822
|
-
(await (await fetch(`/${e.slug}`)).json()).forEach((
|
|
1823
|
-
|
|
1827
|
+
(await (await fetch(`/${e.slug}`)).json()).forEach((o) => {
|
|
1828
|
+
o.id && this.addRecord(e, o.id, o);
|
|
1824
1829
|
});
|
|
1825
1830
|
}
|
|
1826
1831
|
/**
|
|
@@ -1828,9 +1833,9 @@ class ko {
|
|
|
1828
1833
|
* @param doctype - The doctype
|
|
1829
1834
|
* @param recordId - The record ID
|
|
1830
1835
|
*/
|
|
1831
|
-
async getRecord(e,
|
|
1832
|
-
const a = await (await fetch(`/${e.slug}/${
|
|
1833
|
-
this.addRecord(e,
|
|
1836
|
+
async getRecord(e, o) {
|
|
1837
|
+
const a = await (await fetch(`/${e.slug}/${o}`)).json();
|
|
1838
|
+
this.addRecord(e, o, a);
|
|
1834
1839
|
}
|
|
1835
1840
|
/**
|
|
1836
1841
|
* Ensure doctype section exists in HST store
|
|
@@ -1857,9 +1862,14 @@ class ko {
|
|
|
1857
1862
|
return this.hstStore;
|
|
1858
1863
|
}
|
|
1859
1864
|
}
|
|
1860
|
-
function
|
|
1861
|
-
|
|
1862
|
-
const e =
|
|
1865
|
+
function Io(t) {
|
|
1866
|
+
t || (t = {});
|
|
1867
|
+
const e = t.registry || Je("$registry"), o = Je("$stonecrop"), a = C(), n = C(), i = C({}), r = C(), c = C(), s = C([]);
|
|
1868
|
+
if (t.doctype && e) {
|
|
1869
|
+
const w = t.doctype.schema ? Array.isArray(t.doctype.schema) ? t.doctype.schema : Array.from(t.doctype.schema) : [];
|
|
1870
|
+
s.value = e.resolveSchema(w);
|
|
1871
|
+
}
|
|
1872
|
+
const u = C([]), p = C(-1), h = I(() => a.value?.getOperationLogStore().canUndo ?? !1), b = I(() => a.value?.getOperationLogStore().canRedo ?? !1), D = I(() => a.value?.getOperationLogStore().undoCount ?? 0), k = I(() => a.value?.getOperationLogStore().redoCount ?? 0), O = I(
|
|
1863
1873
|
() => a.value?.getOperationLogStore().undoRedoState ?? {
|
|
1864
1874
|
canUndo: !1,
|
|
1865
1875
|
canRedo: !1,
|
|
@@ -1867,191 +1877,234 @@ function No(o) {
|
|
|
1867
1877
|
redoCount: 0,
|
|
1868
1878
|
currentIndex: -1
|
|
1869
1879
|
}
|
|
1870
|
-
),
|
|
1880
|
+
), V = (w) => a.value?.getOperationLogStore().undo(w) ?? !1, M = (w) => a.value?.getOperationLogStore().redo(w) ?? !1, x = () => {
|
|
1871
1881
|
a.value?.getOperationLogStore().startBatch();
|
|
1872
|
-
},
|
|
1882
|
+
}, W = (w) => a.value?.getOperationLogStore().commitBatch(w) ?? null, Z = () => {
|
|
1873
1883
|
a.value?.getOperationLogStore().cancelBatch();
|
|
1874
1884
|
}, J = () => {
|
|
1875
1885
|
a.value?.getOperationLogStore().clear();
|
|
1876
|
-
}, K = (
|
|
1886
|
+
}, K = (w, $) => a.value?.getOperationLogStore().getOperationsFor(w, $) ?? [], E = () => a.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1877
1887
|
operations: [],
|
|
1878
1888
|
currentIndex: -1,
|
|
1879
1889
|
totalOperations: 0,
|
|
1880
1890
|
reversibleOperations: 0,
|
|
1881
1891
|
irreversibleOperations: 0
|
|
1882
|
-
},
|
|
1883
|
-
a.value?.getOperationLogStore().markIrreversible(
|
|
1884
|
-
},
|
|
1885
|
-
a.value?.getOperationLogStore().configure(
|
|
1892
|
+
}, U = (w, $) => {
|
|
1893
|
+
a.value?.getOperationLogStore().markIrreversible(w, $);
|
|
1894
|
+
}, m = (w, $, _, v = "success", f) => a.value?.getOperationLogStore().logAction(w, $, _, v, f) ?? "", g = (w) => {
|
|
1895
|
+
a.value?.getOperationLogStore().configure(w);
|
|
1886
1896
|
};
|
|
1887
|
-
|
|
1897
|
+
xe(async () => {
|
|
1888
1898
|
if (e) {
|
|
1889
|
-
a.value =
|
|
1899
|
+
a.value = o || new Ao(e);
|
|
1890
1900
|
try {
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
() =>
|
|
1894
|
-
(
|
|
1895
|
-
|
|
1901
|
+
const w = a.value.getOperationLogStore(), $ = so(w);
|
|
1902
|
+
u.value = $.operations.value, p.value = $.currentIndex.value, H(
|
|
1903
|
+
() => $.operations.value,
|
|
1904
|
+
(_) => {
|
|
1905
|
+
u.value = _;
|
|
1896
1906
|
}
|
|
1897
1907
|
), H(
|
|
1898
|
-
() =>
|
|
1899
|
-
(
|
|
1900
|
-
|
|
1908
|
+
() => $.currentIndex.value,
|
|
1909
|
+
(_) => {
|
|
1910
|
+
p.value = _;
|
|
1901
1911
|
}
|
|
1902
1912
|
);
|
|
1903
1913
|
} catch {
|
|
1904
1914
|
}
|
|
1905
|
-
if (!
|
|
1906
|
-
const
|
|
1907
|
-
if (!
|
|
1908
|
-
const
|
|
1909
|
-
if (
|
|
1910
|
-
const
|
|
1911
|
-
path:
|
|
1912
|
-
segments:
|
|
1913
|
-
},
|
|
1914
|
-
if (
|
|
1915
|
-
if (e.addDoctype(
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
|
|
1915
|
+
if (!t.doctype && e.router) {
|
|
1916
|
+
const w = e.router.currentRoute.value;
|
|
1917
|
+
if (!w.path) return;
|
|
1918
|
+
const $ = w.path.split("/").filter((v) => v.length > 0), _ = $[1]?.toLowerCase();
|
|
1919
|
+
if ($.length > 0) {
|
|
1920
|
+
const v = {
|
|
1921
|
+
path: w.path,
|
|
1922
|
+
segments: $
|
|
1923
|
+
}, f = await e.getMeta?.(v);
|
|
1924
|
+
if (f) {
|
|
1925
|
+
if (e.addDoctype(f), a.value.setup(f), r.value = f, c.value = _, n.value = a.value.getStore(), e) {
|
|
1926
|
+
const y = f.schema ? Array.isArray(f.schema) ? f.schema : Array.from(f.schema) : [];
|
|
1927
|
+
s.value = e.resolveSchema(y);
|
|
1928
|
+
}
|
|
1929
|
+
if (_ && _ !== "new") {
|
|
1930
|
+
const y = a.value.getRecordById(f, _);
|
|
1931
|
+
if (y)
|
|
1932
|
+
i.value = y.get("") || {};
|
|
1919
1933
|
else
|
|
1920
1934
|
try {
|
|
1921
|
-
await a.value.getRecord(
|
|
1922
|
-
const
|
|
1923
|
-
|
|
1935
|
+
await a.value.getRecord(f, _);
|
|
1936
|
+
const l = a.value.getRecordById(f, _);
|
|
1937
|
+
l && (i.value = l.get("") || {});
|
|
1924
1938
|
} catch {
|
|
1925
|
-
|
|
1939
|
+
i.value = oe(f);
|
|
1926
1940
|
}
|
|
1927
1941
|
} else
|
|
1928
|
-
|
|
1929
|
-
n.value &&
|
|
1942
|
+
i.value = oe(f);
|
|
1943
|
+
n.value && pt(f, _ || "new", i, n.value), a.value.runAction(f, "load", _ ? [_] : void 0);
|
|
1930
1944
|
}
|
|
1931
1945
|
}
|
|
1932
1946
|
}
|
|
1933
|
-
if (
|
|
1947
|
+
if (t.doctype) {
|
|
1934
1948
|
n.value = a.value.getStore();
|
|
1935
|
-
const
|
|
1936
|
-
if (
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1939
|
-
|
|
1949
|
+
const w = t.doctype, $ = t.recordId;
|
|
1950
|
+
if ($ && $ !== "new") {
|
|
1951
|
+
const _ = a.value.getRecordById(w, $);
|
|
1952
|
+
if (_)
|
|
1953
|
+
i.value = _.get("") || {};
|
|
1940
1954
|
else
|
|
1941
1955
|
try {
|
|
1942
|
-
await a.value.getRecord(
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1956
|
+
await a.value.getRecord(w, $);
|
|
1957
|
+
const v = a.value.getRecordById(w, $);
|
|
1958
|
+
v && (i.value = v.get("") || {});
|
|
1945
1959
|
} catch {
|
|
1946
|
-
|
|
1960
|
+
i.value = oe(w);
|
|
1947
1961
|
}
|
|
1948
1962
|
} else
|
|
1949
|
-
|
|
1950
|
-
n.value &&
|
|
1963
|
+
i.value = oe(w);
|
|
1964
|
+
n.value && pt(w, $ || "new", i, n.value);
|
|
1951
1965
|
}
|
|
1952
1966
|
}
|
|
1953
1967
|
});
|
|
1954
|
-
const
|
|
1955
|
-
const
|
|
1956
|
-
if (
|
|
1957
|
-
const
|
|
1958
|
-
return `${
|
|
1959
|
-
},
|
|
1960
|
-
const
|
|
1961
|
-
if (!(!n.value || !a.value ||
|
|
1968
|
+
const A = (w, $) => {
|
|
1969
|
+
const _ = t.doctype || r.value;
|
|
1970
|
+
if (!_) return "";
|
|
1971
|
+
const v = $ || t.recordId || c.value || "new";
|
|
1972
|
+
return `${_.slug}.${v}.${w}`;
|
|
1973
|
+
}, F = (w) => {
|
|
1974
|
+
const $ = t.doctype || r.value;
|
|
1975
|
+
if (!(!n.value || !a.value || !$))
|
|
1962
1976
|
try {
|
|
1963
|
-
const
|
|
1964
|
-
if (
|
|
1965
|
-
const
|
|
1966
|
-
if (n.value.has(`${
|
|
1967
|
-
const
|
|
1968
|
-
let
|
|
1969
|
-
for (let
|
|
1970
|
-
if (
|
|
1971
|
-
const
|
|
1972
|
-
n.value.set(
|
|
1977
|
+
const _ = w.path.split(".");
|
|
1978
|
+
if (_.length >= 2) {
|
|
1979
|
+
const y = _[0], l = _[1];
|
|
1980
|
+
if (n.value.has(`${y}.${l}`) || a.value.addRecord($, l, { ...i.value }), _.length > 3) {
|
|
1981
|
+
const d = `${y}.${l}`, S = _.slice(2);
|
|
1982
|
+
let R = d;
|
|
1983
|
+
for (let z = 0; z < S.length - 1; z++)
|
|
1984
|
+
if (R += `.${S[z]}`, !n.value.has(R)) {
|
|
1985
|
+
const te = S[z + 1], q = !isNaN(Number(te));
|
|
1986
|
+
n.value.set(R, q ? [] : {});
|
|
1973
1987
|
}
|
|
1974
1988
|
}
|
|
1975
1989
|
}
|
|
1976
|
-
n.value.set(
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1990
|
+
n.value.set(w.path, w.value);
|
|
1991
|
+
const v = w.fieldname.split("."), f = { ...i.value };
|
|
1992
|
+
v.length === 1 ? f[v[0]] = w.value : To(f, v, w.value), i.value = f;
|
|
1979
1993
|
} catch {
|
|
1980
1994
|
}
|
|
1981
1995
|
};
|
|
1982
|
-
(
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1985
|
-
|
|
1996
|
+
(t.doctype || e?.router) && (Ge("hstPathProvider", A), Ge("hstChangeHandler", F));
|
|
1997
|
+
const G = (w, $, _) => {
|
|
1998
|
+
if (!a.value)
|
|
1999
|
+
return oe($);
|
|
2000
|
+
if (_)
|
|
2001
|
+
try {
|
|
2002
|
+
const v = n.value?.get(w);
|
|
2003
|
+
return v && typeof v == "object" ? v : oe($);
|
|
2004
|
+
} catch {
|
|
2005
|
+
return oe($);
|
|
2006
|
+
}
|
|
2007
|
+
return oe($);
|
|
2008
|
+
}, N = async (w, $) => {
|
|
2009
|
+
if (!n.value || !a.value)
|
|
2010
|
+
throw new Error("HST store not initialized");
|
|
2011
|
+
const _ = `${w.slug}.${$}`, v = { ...n.value.get(_) || {} }, f = w.schema ? Array.isArray(w.schema) ? w.schema : Array.from(w.schema) : [], y = (e ? e.resolveSchema(f) : f).filter(
|
|
2012
|
+
(l) => "fieldtype" in l && l.fieldtype === "Doctype" && "schema" in l && Array.isArray(l.schema)
|
|
2013
|
+
);
|
|
2014
|
+
for (const l of y) {
|
|
2015
|
+
const d = l, S = `${_}.${d.fieldname}`, R = Nt(d.schema, S, n.value);
|
|
2016
|
+
v[d.fieldname] = R;
|
|
2017
|
+
}
|
|
2018
|
+
return v;
|
|
2019
|
+
}, P = (w, $) => ({
|
|
2020
|
+
provideHSTPath: (_) => `${w}.${_}`,
|
|
2021
|
+
handleHSTChange: (_) => {
|
|
2022
|
+
const v = _.path.startsWith(w) ? _.path : `${w}.${_.fieldname}`;
|
|
2023
|
+
F({
|
|
2024
|
+
..._,
|
|
2025
|
+
path: v
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
}), B = {
|
|
2029
|
+
operations: u,
|
|
2030
|
+
currentIndex: p,
|
|
1986
2031
|
undoRedoState: O,
|
|
1987
|
-
canUndo:
|
|
2032
|
+
canUndo: h,
|
|
1988
2033
|
canRedo: b,
|
|
1989
|
-
undoCount:
|
|
1990
|
-
redoCount:
|
|
1991
|
-
undo:
|
|
1992
|
-
redo:
|
|
1993
|
-
startBatch:
|
|
1994
|
-
commitBatch:
|
|
1995
|
-
cancelBatch:
|
|
2034
|
+
undoCount: D,
|
|
2035
|
+
redoCount: k,
|
|
2036
|
+
undo: V,
|
|
2037
|
+
redo: M,
|
|
2038
|
+
startBatch: x,
|
|
2039
|
+
commitBatch: W,
|
|
2040
|
+
cancelBatch: Z,
|
|
1996
2041
|
clear: J,
|
|
1997
2042
|
getOperationsFor: K,
|
|
1998
|
-
getSnapshot:
|
|
1999
|
-
markIrreversible:
|
|
2000
|
-
logAction:
|
|
2001
|
-
configure:
|
|
2043
|
+
getSnapshot: E,
|
|
2044
|
+
markIrreversible: U,
|
|
2045
|
+
logAction: m,
|
|
2046
|
+
configure: g
|
|
2002
2047
|
};
|
|
2003
|
-
return
|
|
2048
|
+
return t.doctype ? {
|
|
2004
2049
|
stonecrop: a,
|
|
2005
|
-
operationLog:
|
|
2006
|
-
provideHSTPath:
|
|
2007
|
-
handleHSTChange:
|
|
2050
|
+
operationLog: B,
|
|
2051
|
+
provideHSTPath: A,
|
|
2052
|
+
handleHSTChange: F,
|
|
2008
2053
|
hstStore: n,
|
|
2009
|
-
formData:
|
|
2010
|
-
|
|
2054
|
+
formData: i,
|
|
2055
|
+
resolvedSchema: s,
|
|
2056
|
+
loadNestedData: G,
|
|
2057
|
+
saveRecursive: N,
|
|
2058
|
+
createNestedContext: P
|
|
2059
|
+
} : !t.doctype && e?.router ? {
|
|
2011
2060
|
stonecrop: a,
|
|
2012
|
-
operationLog:
|
|
2013
|
-
provideHSTPath:
|
|
2014
|
-
handleHSTChange:
|
|
2061
|
+
operationLog: B,
|
|
2062
|
+
provideHSTPath: A,
|
|
2063
|
+
handleHSTChange: F,
|
|
2015
2064
|
hstStore: n,
|
|
2016
|
-
formData:
|
|
2065
|
+
formData: i,
|
|
2066
|
+
resolvedSchema: s,
|
|
2067
|
+
loadNestedData: G,
|
|
2068
|
+
saveRecursive: N,
|
|
2069
|
+
createNestedContext: P
|
|
2017
2070
|
} : {
|
|
2018
2071
|
stonecrop: a,
|
|
2019
|
-
operationLog:
|
|
2072
|
+
operationLog: B
|
|
2020
2073
|
};
|
|
2021
2074
|
}
|
|
2022
|
-
function
|
|
2075
|
+
function oe(t) {
|
|
2023
2076
|
const e = {};
|
|
2024
|
-
return
|
|
2025
|
-
switch ("fieldtype" in
|
|
2077
|
+
return t.schema && t.schema.forEach((o) => {
|
|
2078
|
+
switch ("fieldtype" in o ? o.fieldtype : "Data") {
|
|
2026
2079
|
case "Data":
|
|
2027
2080
|
case "Text":
|
|
2028
|
-
e[
|
|
2081
|
+
e[o.fieldname] = "";
|
|
2029
2082
|
break;
|
|
2030
2083
|
case "Check":
|
|
2031
|
-
e[
|
|
2084
|
+
e[o.fieldname] = !1;
|
|
2032
2085
|
break;
|
|
2033
2086
|
case "Int":
|
|
2034
2087
|
case "Float":
|
|
2035
|
-
e[
|
|
2088
|
+
e[o.fieldname] = 0;
|
|
2036
2089
|
break;
|
|
2037
2090
|
case "Table":
|
|
2038
|
-
e[
|
|
2091
|
+
e[o.fieldname] = [];
|
|
2039
2092
|
break;
|
|
2040
2093
|
case "JSON":
|
|
2041
|
-
e[
|
|
2094
|
+
e[o.fieldname] = {};
|
|
2042
2095
|
break;
|
|
2043
2096
|
default:
|
|
2044
|
-
e[
|
|
2097
|
+
e[o.fieldname] = null;
|
|
2045
2098
|
}
|
|
2046
2099
|
}), e;
|
|
2047
2100
|
}
|
|
2048
|
-
function
|
|
2101
|
+
function pt(t, e, o, a) {
|
|
2049
2102
|
H(
|
|
2050
|
-
|
|
2103
|
+
o,
|
|
2051
2104
|
(n) => {
|
|
2052
|
-
const
|
|
2105
|
+
const i = `${t.slug}.${e}`;
|
|
2053
2106
|
Object.keys(n).forEach((r) => {
|
|
2054
|
-
const c = `${
|
|
2107
|
+
const c = `${i}.${r}`;
|
|
2055
2108
|
try {
|
|
2056
2109
|
a.set(c, n[r]);
|
|
2057
2110
|
} catch {
|
|
@@ -2061,165 +2114,262 @@ function rt(o, e, t, a) {
|
|
|
2061
2114
|
{ deep: !0 }
|
|
2062
2115
|
);
|
|
2063
2116
|
}
|
|
2064
|
-
function
|
|
2065
|
-
let a =
|
|
2066
|
-
for (let
|
|
2067
|
-
const r = e[
|
|
2068
|
-
(!(r in a) || typeof a[r] != "object") && (a[r] = isNaN(Number(e[
|
|
2117
|
+
function To(t, e, o) {
|
|
2118
|
+
let a = t;
|
|
2119
|
+
for (let i = 0; i < e.length - 1; i++) {
|
|
2120
|
+
const r = e[i];
|
|
2121
|
+
(!(r in a) || typeof a[r] != "object") && (a[r] = isNaN(Number(e[i + 1])) ? {} : []), a = a[r];
|
|
2069
2122
|
}
|
|
2070
2123
|
const n = e[e.length - 1];
|
|
2071
|
-
a[n] =
|
|
2124
|
+
a[n] = o;
|
|
2125
|
+
}
|
|
2126
|
+
function Nt(t, e, o) {
|
|
2127
|
+
const a = { ...o.get(e) || {} }, n = t.filter(
|
|
2128
|
+
(i) => "fieldtype" in i && i.fieldtype === "Doctype" && "schema" in i && Array.isArray(i.schema)
|
|
2129
|
+
);
|
|
2130
|
+
for (const i of n) {
|
|
2131
|
+
const r = i, c = `${e}.${r.fieldname}`, s = Nt(r.schema, c, o);
|
|
2132
|
+
a[r.fieldname] = s;
|
|
2133
|
+
}
|
|
2134
|
+
return a;
|
|
2135
|
+
}
|
|
2136
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2137
|
+
function xo(t, e) {
|
|
2138
|
+
return Xe() ? (Ye(t, e), !0) : !1;
|
|
2139
|
+
}
|
|
2140
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2141
|
+
const Po = () => {
|
|
2142
|
+
};
|
|
2143
|
+
function Vo(...t) {
|
|
2144
|
+
if (t.length !== 1) return ne(...t);
|
|
2145
|
+
const e = t[0];
|
|
2146
|
+
return typeof e == "function" ? Ve(et(() => ({
|
|
2147
|
+
get: e,
|
|
2148
|
+
set: Po
|
|
2149
|
+
}))) : C(e);
|
|
2150
|
+
}
|
|
2151
|
+
function He(t) {
|
|
2152
|
+
return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
|
|
2072
2153
|
}
|
|
2073
|
-
const
|
|
2074
|
-
|
|
2154
|
+
const Ue = /* @__PURE__ */ new WeakMap();
|
|
2155
|
+
function Mo(t, e = !1) {
|
|
2156
|
+
const o = $e(e);
|
|
2157
|
+
let a = "";
|
|
2158
|
+
H(Vo(t), (r) => {
|
|
2159
|
+
const c = He(X(r));
|
|
2160
|
+
if (c) {
|
|
2161
|
+
const s = c;
|
|
2162
|
+
if (Ue.get(s) || Ue.set(s, s.style.overflow), s.style.overflow !== "hidden" && (a = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
|
|
2163
|
+
if (o.value) return s.style.overflow = "hidden";
|
|
2164
|
+
}
|
|
2165
|
+
}, { immediate: !0 });
|
|
2166
|
+
const n = () => {
|
|
2167
|
+
const r = He(X(t));
|
|
2168
|
+
!r || o.value || (r.style.overflow = "hidden", o.value = !0);
|
|
2169
|
+
}, i = () => {
|
|
2170
|
+
const r = He(X(t));
|
|
2171
|
+
!r || !o.value || (r.style.overflow = a, Ue.delete(r), o.value = !1);
|
|
2172
|
+
};
|
|
2173
|
+
return xo(i), I({
|
|
2174
|
+
get() {
|
|
2175
|
+
return o.value;
|
|
2176
|
+
},
|
|
2177
|
+
set(r) {
|
|
2178
|
+
r ? n() : i();
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
function jo() {
|
|
2183
|
+
let t = !1;
|
|
2184
|
+
const e = $e(!1);
|
|
2185
|
+
return (o, a) => {
|
|
2186
|
+
if (e.value = a.value, t) return;
|
|
2187
|
+
t = !0;
|
|
2188
|
+
const n = Mo(o, a.value);
|
|
2189
|
+
H(e, (i) => n.value = i);
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
jo();
|
|
2193
|
+
const Lo = (t, e) => {
|
|
2194
|
+
const o = t.__vccOpts || t;
|
|
2075
2195
|
for (const [a, n] of e)
|
|
2076
|
-
|
|
2077
|
-
return
|
|
2196
|
+
o[a] = n;
|
|
2197
|
+
return o;
|
|
2078
2198
|
};
|
|
2079
|
-
function
|
|
2080
|
-
return
|
|
2199
|
+
function Fo(t, e) {
|
|
2200
|
+
return Xe() ? (Ye(t, e), !0) : !1;
|
|
2081
2201
|
}
|
|
2082
2202
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2083
|
-
const
|
|
2203
|
+
const Bo = () => {
|
|
2084
2204
|
};
|
|
2085
|
-
function
|
|
2086
|
-
if (
|
|
2087
|
-
const e =
|
|
2088
|
-
return typeof e == "function" ?
|
|
2205
|
+
function Ho(...t) {
|
|
2206
|
+
if (t.length !== 1) return ne(...t);
|
|
2207
|
+
const e = t[0];
|
|
2208
|
+
return typeof e == "function" ? Ve(et(() => ({
|
|
2089
2209
|
get: e,
|
|
2090
|
-
set:
|
|
2091
|
-
}))) :
|
|
2210
|
+
set: Bo
|
|
2211
|
+
}))) : C(e);
|
|
2092
2212
|
}
|
|
2093
|
-
function
|
|
2094
|
-
return typeof Window < "u" &&
|
|
2213
|
+
function We(t) {
|
|
2214
|
+
return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
|
|
2095
2215
|
}
|
|
2096
|
-
const
|
|
2097
|
-
function
|
|
2098
|
-
const
|
|
2216
|
+
const Ke = /* @__PURE__ */ new WeakMap();
|
|
2217
|
+
function Uo(t, e = !1) {
|
|
2218
|
+
const o = $e(e);
|
|
2099
2219
|
let a = "";
|
|
2100
|
-
H(
|
|
2101
|
-
const c =
|
|
2220
|
+
H(Ho(t), (r) => {
|
|
2221
|
+
const c = We(X(r));
|
|
2102
2222
|
if (c) {
|
|
2103
|
-
const
|
|
2104
|
-
if (
|
|
2105
|
-
if (
|
|
2223
|
+
const s = c;
|
|
2224
|
+
if (Ke.get(s) || Ke.set(s, s.style.overflow), s.style.overflow !== "hidden" && (a = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
|
|
2225
|
+
if (o.value) return s.style.overflow = "hidden";
|
|
2106
2226
|
}
|
|
2107
2227
|
}, { immediate: !0 });
|
|
2108
2228
|
const n = () => {
|
|
2109
|
-
const r =
|
|
2110
|
-
!r ||
|
|
2111
|
-
},
|
|
2112
|
-
const r =
|
|
2113
|
-
!r || !
|
|
2229
|
+
const r = We(X(t));
|
|
2230
|
+
!r || o.value || (r.style.overflow = "hidden", o.value = !0);
|
|
2231
|
+
}, i = () => {
|
|
2232
|
+
const r = We(X(t));
|
|
2233
|
+
!r || !o.value || (r.style.overflow = a, Ke.delete(r), o.value = !1);
|
|
2114
2234
|
};
|
|
2115
|
-
return
|
|
2235
|
+
return Fo(i), I({
|
|
2116
2236
|
get() {
|
|
2117
|
-
return
|
|
2237
|
+
return o.value;
|
|
2118
2238
|
},
|
|
2119
2239
|
set(r) {
|
|
2120
|
-
r ? n() :
|
|
2240
|
+
r ? n() : i();
|
|
2121
2241
|
}
|
|
2122
2242
|
});
|
|
2123
2243
|
}
|
|
2124
|
-
function
|
|
2125
|
-
let
|
|
2126
|
-
const e =
|
|
2127
|
-
return (
|
|
2128
|
-
if (e.value = a.value,
|
|
2129
|
-
|
|
2130
|
-
const n =
|
|
2131
|
-
H(e, (
|
|
2244
|
+
function Wo() {
|
|
2245
|
+
let t = !1;
|
|
2246
|
+
const e = $e(!1);
|
|
2247
|
+
return (o, a) => {
|
|
2248
|
+
if (e.value = a.value, t) return;
|
|
2249
|
+
t = !0;
|
|
2250
|
+
const n = Uo(o, a.value);
|
|
2251
|
+
H(e, (i) => n.value = i);
|
|
2132
2252
|
};
|
|
2133
2253
|
}
|
|
2134
|
-
|
|
2254
|
+
Wo();
|
|
2135
2255
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2136
|
-
const
|
|
2256
|
+
const Ko = { class: "aform" }, zo = {
|
|
2257
|
+
key: 0,
|
|
2258
|
+
class: "aform-nested-section"
|
|
2259
|
+
}, Jo = {
|
|
2260
|
+
key: 0,
|
|
2261
|
+
class: "aform-nested-label"
|
|
2262
|
+
}, Go = /* @__PURE__ */ Se({
|
|
2137
2263
|
__name: "AForm",
|
|
2138
|
-
props: {
|
|
2139
|
-
|
|
2140
|
-
data: {},
|
|
2264
|
+
props: /* @__PURE__ */ at({
|
|
2265
|
+
schema: {},
|
|
2141
2266
|
readOnly: { type: Boolean }
|
|
2142
|
-
},
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2267
|
+
}, {
|
|
2268
|
+
data: { required: !0 },
|
|
2269
|
+
dataModifiers: {}
|
|
2270
|
+
}),
|
|
2271
|
+
emits: /* @__PURE__ */ at(["update:schema", "update:data"], ["update:data"]),
|
|
2272
|
+
setup(t, { emit: e }) {
|
|
2273
|
+
const o = e, a = Pt(t, "data"), n = C({});
|
|
2274
|
+
Ee(() => {
|
|
2275
|
+
!t.schema || !a.value || t.schema.forEach((s) => {
|
|
2276
|
+
"schema" in s && Array.isArray(s.schema) && s.schema.length > 0 && (!n.value[s.fieldname] && a.value[s.fieldname] ? n.value[s.fieldname] = a.value[s.fieldname] : n.value[s.fieldname] || (n.value[s.fieldname] = {}));
|
|
2277
|
+
});
|
|
2278
|
+
}), Ee(() => {
|
|
2279
|
+
Object.keys(n.value).forEach((s) => {
|
|
2280
|
+
a.value && n.value[s] !== a.value[s] && (a.value[s] = n.value[s], o("update:data", a.value));
|
|
2281
|
+
});
|
|
2282
|
+
}), Ee(() => {
|
|
2283
|
+
a.value && t.schema && t.schema.forEach((s) => {
|
|
2284
|
+
s.fieldname && a.value[s.fieldname] !== void 0 && (s.value = a.value[s.fieldname]);
|
|
2285
|
+
});
|
|
2150
2286
|
});
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2153
|
-
for (const [
|
|
2154
|
-
["component", "fieldtype"].includes(
|
|
2155
|
-
return
|
|
2156
|
-
},
|
|
2157
|
-
|
|
2287
|
+
const i = (s) => {
|
|
2288
|
+
const u = {};
|
|
2289
|
+
for (const [p, h] of Object.entries(s))
|
|
2290
|
+
["component", "fieldtype"].includes(p) || (u[p] = h), p === "rows" && (!h || Array.isArray(h) && h.length === 0) && (u.rows = a.value[s.fieldname] || []);
|
|
2291
|
+
return u;
|
|
2292
|
+
}, r = C([]);
|
|
2293
|
+
Ee(() => {
|
|
2294
|
+
t.schema && r.value.length !== t.schema.length && (r.value = t.schema.map((s, u) => I({
|
|
2158
2295
|
get() {
|
|
2159
|
-
return
|
|
2296
|
+
return s.value;
|
|
2160
2297
|
},
|
|
2161
|
-
set: (
|
|
2162
|
-
|
|
2298
|
+
set: (p) => {
|
|
2299
|
+
const h = t.schema[u].fieldname;
|
|
2300
|
+
t.schema[u].value = p, h && a.value && (a.value[h] = p, o("update:data", a.value)), o("update:schema", t.schema);
|
|
2163
2301
|
}
|
|
2164
|
-
}))
|
|
2165
|
-
set: () => {
|
|
2166
|
-
}
|
|
2302
|
+
})));
|
|
2167
2303
|
});
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2304
|
+
const c = I(() => r.value);
|
|
2305
|
+
return (s, u) => {
|
|
2306
|
+
const p = bt("AForm", !0);
|
|
2307
|
+
return j(), L("form", Ko, [
|
|
2308
|
+
(j(!0), L(ue, null, be(t.schema, (h, b) => (j(), L(ue, { key: b }, [
|
|
2309
|
+
"schema" in h && Array.isArray(h.schema) && h.schema.length > 0 ? (j(), L("div", zo, [
|
|
2310
|
+
h.label ? (j(), L("h4", Jo, ee(h.label), 1)) : ce("", !0),
|
|
2311
|
+
ae(p, {
|
|
2312
|
+
data: n.value[h.fieldname],
|
|
2313
|
+
"onUpdate:data": (D) => n.value[h.fieldname] = D,
|
|
2314
|
+
schema: h.schema,
|
|
2315
|
+
"read-only": t.readOnly || h.readOnly
|
|
2316
|
+
}, null, 8, ["data", "onUpdate:data", "schema", "read-only"])
|
|
2317
|
+
])) : (j(), Qe(Vt(h.component), Mt({
|
|
2318
|
+
key: 1,
|
|
2319
|
+
modelValue: c.value[b].value,
|
|
2320
|
+
"onUpdate:modelValue": (D) => c.value[b].value = D,
|
|
2321
|
+
schema: h,
|
|
2322
|
+
data: a.value[h.fieldname],
|
|
2323
|
+
"read-only": t.readOnly
|
|
2324
|
+
}, { ref_for: !0 }, i(h)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "read-only"]))
|
|
2325
|
+
], 64))), 128))
|
|
2326
|
+
]);
|
|
2327
|
+
};
|
|
2178
2328
|
}
|
|
2179
|
-
}),
|
|
2329
|
+
}), qo = /* @__PURE__ */ Lo(Go, [["__scopeId", "data-v-06e17c5b"]]), Zo = { class: "tabs" }, Qo = { tabindex: "0" }, Xo = { tabindex: "0" }, Yo = /* @__PURE__ */ Se({
|
|
2180
2330
|
__name: "SheetNav",
|
|
2181
2331
|
props: {
|
|
2182
2332
|
breadcrumbs: { default: () => [] }
|
|
2183
2333
|
},
|
|
2184
|
-
setup(
|
|
2185
|
-
const e =
|
|
2334
|
+
setup(t) {
|
|
2335
|
+
const e = C(!0), o = C(!1), a = C(""), n = vt("searchinput"), i = I(() => e.value ? "unrotated" : "rotated"), r = () => {
|
|
2186
2336
|
e.value = !e.value;
|
|
2187
2337
|
}, c = async () => {
|
|
2188
|
-
|
|
2338
|
+
o.value = !o.value, await re(() => {
|
|
2189
2339
|
n.value?.focus();
|
|
2190
2340
|
});
|
|
2191
|
-
},
|
|
2192
|
-
|
|
2193
|
-
}, u = async (
|
|
2194
|
-
|
|
2341
|
+
}, s = (h) => {
|
|
2342
|
+
h.preventDefault(), h.stopPropagation();
|
|
2343
|
+
}, u = async (h) => {
|
|
2344
|
+
h.preventDefault(), h.stopPropagation(), await c();
|
|
2195
2345
|
}, p = () => {
|
|
2196
2346
|
};
|
|
2197
|
-
return (
|
|
2198
|
-
const
|
|
2199
|
-
return
|
|
2200
|
-
T("ul",
|
|
2347
|
+
return (h, b) => {
|
|
2348
|
+
const D = bt("router-link");
|
|
2349
|
+
return j(), L("footer", null, [
|
|
2350
|
+
T("ul", Zo, [
|
|
2201
2351
|
T("li", {
|
|
2202
2352
|
class: "hidebreadcrumbs",
|
|
2203
2353
|
onClick: r,
|
|
2204
|
-
onKeydown:
|
|
2354
|
+
onKeydown: ve(r, ["enter"])
|
|
2205
2355
|
}, [
|
|
2206
|
-
T("a",
|
|
2356
|
+
T("a", Qo, [
|
|
2207
2357
|
T("div", {
|
|
2208
|
-
class:
|
|
2358
|
+
class: Oe(i.value)
|
|
2209
2359
|
}, "×", 2)
|
|
2210
2360
|
])
|
|
2211
2361
|
], 32),
|
|
2212
2362
|
T("li", {
|
|
2213
2363
|
class: "hometab",
|
|
2214
|
-
style:
|
|
2364
|
+
style: je({ display: e.value ? "block" : "none" }),
|
|
2215
2365
|
onClick: p,
|
|
2216
|
-
onKeydown:
|
|
2366
|
+
onKeydown: ve(p, ["enter"])
|
|
2217
2367
|
}, [
|
|
2218
|
-
|
|
2368
|
+
ae(D, {
|
|
2219
2369
|
to: "/",
|
|
2220
2370
|
tabindex: "0"
|
|
2221
2371
|
}, {
|
|
2222
|
-
default:
|
|
2372
|
+
default: we(() => [...b[5] || (b[5] = [
|
|
2223
2373
|
T("svg", {
|
|
2224
2374
|
class: "icon",
|
|
2225
2375
|
"aria-label": "Home",
|
|
@@ -2236,11 +2386,11 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2236
2386
|
})
|
|
2237
2387
|
], 36),
|
|
2238
2388
|
T("li", {
|
|
2239
|
-
class:
|
|
2240
|
-
style:
|
|
2389
|
+
class: Oe(["searchtab", { "search-active": o.value }]),
|
|
2390
|
+
style: je({ display: e.value ? "block" : "none" })
|
|
2241
2391
|
}, [
|
|
2242
|
-
T("a",
|
|
2243
|
-
|
|
2392
|
+
T("a", Xo, [
|
|
2393
|
+
Re((j(), L("svg", {
|
|
2244
2394
|
class: "icon search-icon",
|
|
2245
2395
|
role: "button",
|
|
2246
2396
|
"aria-label": "Search",
|
|
@@ -2249,8 +2399,8 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2249
2399
|
stroke: "currentColor",
|
|
2250
2400
|
"stroke-width": "2",
|
|
2251
2401
|
onClick: c,
|
|
2252
|
-
onKeydown:
|
|
2253
|
-
}, [...
|
|
2402
|
+
onKeydown: ve(c, ["enter"])
|
|
2403
|
+
}, [...b[6] || (b[6] = [
|
|
2254
2404
|
T("circle", {
|
|
2255
2405
|
cx: "11",
|
|
2256
2406
|
cy: "11",
|
|
@@ -2258,37 +2408,37 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2258
2408
|
}, null, -1),
|
|
2259
2409
|
T("path", { d: "M21 21l-4.35-4.35" }, null, -1)
|
|
2260
2410
|
])], 544)), [
|
|
2261
|
-
[
|
|
2411
|
+
[ze, !o.value]
|
|
2262
2412
|
]),
|
|
2263
|
-
|
|
2413
|
+
Re(T("input", {
|
|
2264
2414
|
ref: "searchinput",
|
|
2265
|
-
"onUpdate:modelValue":
|
|
2415
|
+
"onUpdate:modelValue": b[0] || (b[0] = (k) => a.value = k),
|
|
2266
2416
|
type: "text",
|
|
2267
2417
|
placeholder: "Search...",
|
|
2268
|
-
onClick:
|
|
2418
|
+
onClick: b[1] || (b[1] = ft(() => {
|
|
2269
2419
|
}, ["stop"])),
|
|
2270
|
-
onInput:
|
|
2271
|
-
onBlur:
|
|
2420
|
+
onInput: b[2] || (b[2] = (k) => s(k)),
|
|
2421
|
+
onBlur: b[3] || (b[3] = (k) => u(k)),
|
|
2272
2422
|
onKeydown: [
|
|
2273
|
-
|
|
2274
|
-
|
|
2423
|
+
b[4] || (b[4] = ve((k) => u(k), ["enter"])),
|
|
2424
|
+
ve(c, ["escape"])
|
|
2275
2425
|
]
|
|
2276
2426
|
}, null, 544), [
|
|
2277
|
-
[
|
|
2278
|
-
[
|
|
2427
|
+
[ze, o.value],
|
|
2428
|
+
[ht, a.value]
|
|
2279
2429
|
])
|
|
2280
2430
|
])
|
|
2281
2431
|
], 6),
|
|
2282
|
-
(
|
|
2283
|
-
key:
|
|
2284
|
-
style:
|
|
2432
|
+
(j(!0), L(ue, null, be(t.breadcrumbs, (k) => (j(), L("li", {
|
|
2433
|
+
key: k.title,
|
|
2434
|
+
style: je({ display: e.value ? "block" : "none" })
|
|
2285
2435
|
}, [
|
|
2286
|
-
|
|
2436
|
+
ae(D, {
|
|
2287
2437
|
tabindex: "0",
|
|
2288
|
-
to:
|
|
2438
|
+
to: k.to
|
|
2289
2439
|
}, {
|
|
2290
|
-
default:
|
|
2291
|
-
|
|
2440
|
+
default: we(() => [
|
|
2441
|
+
Ce(ee(k.title), 1)
|
|
2292
2442
|
]),
|
|
2293
2443
|
_: 2
|
|
2294
2444
|
}, 1032, ["to"])
|
|
@@ -2297,41 +2447,41 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2297
2447
|
]);
|
|
2298
2448
|
};
|
|
2299
2449
|
}
|
|
2300
|
-
}),
|
|
2450
|
+
}), Ot = /* @__PURE__ */ wt(Yo, [["__scopeId", "data-v-eb5bcbb6"]]), ea = {
|
|
2301
2451
|
key: 1,
|
|
2302
2452
|
class: "loading"
|
|
2303
|
-
},
|
|
2453
|
+
}, ta = {
|
|
2304
2454
|
key: 2,
|
|
2305
2455
|
class: "loading"
|
|
2306
|
-
},
|
|
2456
|
+
}, oa = /* @__PURE__ */ Se({
|
|
2307
2457
|
__name: "Desktop",
|
|
2308
2458
|
props: {
|
|
2309
2459
|
availableDoctypes: { default: () => [] }
|
|
2310
2460
|
},
|
|
2311
|
-
setup(
|
|
2312
|
-
const { stonecrop: e } =
|
|
2461
|
+
setup(t) {
|
|
2462
|
+
const { stonecrop: e } = Io(), o = C(!1), a = C(!1), n = C(!1), i = I({
|
|
2313
2463
|
get() {
|
|
2314
|
-
if (!e.value || !
|
|
2464
|
+
if (!e.value || !s.value || !p.value)
|
|
2315
2465
|
return {};
|
|
2316
2466
|
try {
|
|
2317
|
-
return e.value.getRecordById(
|
|
2467
|
+
return e.value.getRecordById(s.value, p.value)?.get("") || {};
|
|
2318
2468
|
} catch {
|
|
2319
2469
|
return {};
|
|
2320
2470
|
}
|
|
2321
2471
|
},
|
|
2322
2472
|
set(l) {
|
|
2323
|
-
if (!(!e.value || !
|
|
2473
|
+
if (!(!e.value || !s.value || !p.value))
|
|
2324
2474
|
try {
|
|
2325
2475
|
const d = e.value.getStore();
|
|
2326
|
-
for (const [S,
|
|
2327
|
-
const
|
|
2328
|
-
d.set(
|
|
2476
|
+
for (const [S, R] of Object.entries(l)) {
|
|
2477
|
+
const z = `${s.value}.${p.value}.${S}`;
|
|
2478
|
+
d.set(z, R);
|
|
2329
2479
|
}
|
|
2330
2480
|
} catch (d) {
|
|
2331
2481
|
console.warn("HST update failed:", d);
|
|
2332
2482
|
}
|
|
2333
2483
|
}
|
|
2334
|
-
}), r =
|
|
2484
|
+
}), r = I(() => Ne(e.value?.registry.router?.currentRoute)), c = I(() => e.value?.registry.router), s = I(() => {
|
|
2335
2485
|
if (!r.value) return "";
|
|
2336
2486
|
if (r.value.meta?.actualDoctype)
|
|
2337
2487
|
return r.value.meta.actualDoctype;
|
|
@@ -2339,7 +2489,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2339
2489
|
return r.value.params.doctype;
|
|
2340
2490
|
const l = r.value.params.pathMatch;
|
|
2341
2491
|
return l && l.length > 0 ? l[0] : "";
|
|
2342
|
-
}), u =
|
|
2492
|
+
}), u = I(() => {
|
|
2343
2493
|
if (!r.value) return "";
|
|
2344
2494
|
if (r.value.meta?.doctype)
|
|
2345
2495
|
return r.value.meta.doctype;
|
|
@@ -2347,13 +2497,13 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2347
2497
|
return r.value.params.doctype;
|
|
2348
2498
|
const l = r.value.params.pathMatch;
|
|
2349
2499
|
return l && l.length > 0 ? l[0] : "";
|
|
2350
|
-
}), p =
|
|
2500
|
+
}), p = I(() => {
|
|
2351
2501
|
if (!r.value) return "";
|
|
2352
2502
|
if (r.value.params.recordId)
|
|
2353
2503
|
return r.value.params.recordId;
|
|
2354
2504
|
const l = r.value.params.pathMatch;
|
|
2355
2505
|
return l && l.length > 1 ? l[1] : "";
|
|
2356
|
-
}),
|
|
2506
|
+
}), h = I(() => p.value?.startsWith("new-")), b = I(() => {
|
|
2357
2507
|
if (!r.value || r.value.name === "home" || r.value.path === "/")
|
|
2358
2508
|
return "doctypes";
|
|
2359
2509
|
if (r.value.name && r.value.name !== "catch-all") {
|
|
@@ -2365,37 +2515,37 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2365
2515
|
}
|
|
2366
2516
|
const l = r.value.params.pathMatch;
|
|
2367
2517
|
return l && l.length > 0 ? l.length === 1 ? "records" : "record" : "doctypes";
|
|
2368
|
-
}),
|
|
2369
|
-
if (!e.value || !
|
|
2518
|
+
}), D = () => {
|
|
2519
|
+
if (!e.value || !s.value || !p.value)
|
|
2370
2520
|
return [];
|
|
2371
2521
|
try {
|
|
2372
|
-
const d = e.value.registry.registry[
|
|
2522
|
+
const d = e.value.registry.registry[s.value];
|
|
2373
2523
|
if (!d?.workflow?.states)
|
|
2374
2524
|
return [];
|
|
2375
|
-
const S =
|
|
2376
|
-
return
|
|
2377
|
-
const
|
|
2378
|
-
const
|
|
2379
|
-
if (
|
|
2380
|
-
const
|
|
2381
|
-
await
|
|
2525
|
+
const S = h.value ? "creating" : "editing", R = d.workflow.states[S];
|
|
2526
|
+
return R?.on ? Object.keys(R.on).map((q) => {
|
|
2527
|
+
const pe = R.on?.[q], Y = typeof pe == "string" ? pe : "unknown", Rt = async () => {
|
|
2528
|
+
const tt = e.value?.getRecordById(s.value, p.value);
|
|
2529
|
+
if (tt) {
|
|
2530
|
+
const Ct = i.value || {};
|
|
2531
|
+
await tt.triggerTransition(q, {
|
|
2382
2532
|
currentState: S,
|
|
2383
|
-
targetState:
|
|
2384
|
-
fsmContext:
|
|
2533
|
+
targetState: Y,
|
|
2534
|
+
fsmContext: Ct
|
|
2385
2535
|
});
|
|
2386
2536
|
}
|
|
2387
2537
|
};
|
|
2388
2538
|
return {
|
|
2389
|
-
label: `${q} (→ ${
|
|
2390
|
-
action:
|
|
2539
|
+
label: `${q} (→ ${Y})`,
|
|
2540
|
+
action: Rt
|
|
2391
2541
|
};
|
|
2392
2542
|
}) : [];
|
|
2393
2543
|
} catch (l) {
|
|
2394
2544
|
return console.warn("Error getting available transitions:", l), [];
|
|
2395
2545
|
}
|
|
2396
|
-
},
|
|
2546
|
+
}, k = I(() => {
|
|
2397
2547
|
const l = [];
|
|
2398
|
-
switch (
|
|
2548
|
+
switch (b.value) {
|
|
2399
2549
|
case "doctypes":
|
|
2400
2550
|
l.push({
|
|
2401
2551
|
type: "button",
|
|
@@ -2411,7 +2561,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2411
2561
|
type: "button",
|
|
2412
2562
|
label: "New Record",
|
|
2413
2563
|
action: () => {
|
|
2414
|
-
|
|
2564
|
+
K();
|
|
2415
2565
|
}
|
|
2416
2566
|
},
|
|
2417
2567
|
{
|
|
@@ -2424,7 +2574,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2424
2574
|
);
|
|
2425
2575
|
break;
|
|
2426
2576
|
case "record": {
|
|
2427
|
-
const d =
|
|
2577
|
+
const d = D();
|
|
2428
2578
|
d.length > 0 && l.push({
|
|
2429
2579
|
type: "dropdown",
|
|
2430
2580
|
label: "Actions",
|
|
@@ -2434,15 +2584,15 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2434
2584
|
}
|
|
2435
2585
|
}
|
|
2436
2586
|
return l;
|
|
2437
|
-
}),
|
|
2587
|
+
}), O = I(() => {
|
|
2438
2588
|
const l = [];
|
|
2439
|
-
return
|
|
2589
|
+
return b.value === "records" && u.value ? l.push(
|
|
2440
2590
|
{ title: "Home", to: "/" },
|
|
2441
2591
|
{ title: x(u.value), to: `/${u.value}` }
|
|
2442
|
-
) :
|
|
2592
|
+
) : b.value === "record" && u.value && l.push(
|
|
2443
2593
|
{ title: "Home", to: "/" },
|
|
2444
2594
|
{ title: x(u.value), to: `/${u.value}` },
|
|
2445
|
-
{ title:
|
|
2595
|
+
{ title: h.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
|
|
2446
2596
|
), l;
|
|
2447
2597
|
}), V = (l) => {
|
|
2448
2598
|
const d = [
|
|
@@ -2469,9 +2619,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2469
2619
|
title: `Create New ${x(u.value)}`,
|
|
2470
2620
|
description: `Create a new ${u.value} record`,
|
|
2471
2621
|
action: () => {
|
|
2472
|
-
|
|
2622
|
+
K();
|
|
2473
2623
|
}
|
|
2474
|
-
})),
|
|
2624
|
+
})), t.availableDoctypes.forEach((S) => {
|
|
2475
2625
|
d.push({
|
|
2476
2626
|
title: `View ${x(S)}`,
|
|
2477
2627
|
description: `Navigate to ${S} list`,
|
|
@@ -2482,24 +2632,24 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2482
2632
|
}), l ? d.filter(
|
|
2483
2633
|
(S) => S.title.toLowerCase().includes(l.toLowerCase()) || S.description.toLowerCase().includes(l.toLowerCase())
|
|
2484
2634
|
) : d;
|
|
2485
|
-
},
|
|
2635
|
+
}, M = (l) => {
|
|
2486
2636
|
l.action(), n.value = !1;
|
|
2487
|
-
}, x = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), W = (l) => e.value ? e.value.getRecordIds(l).length : 0,
|
|
2637
|
+
}, x = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), W = (l) => e.value ? e.value.getRecordIds(l).length : 0, Z = async (l) => {
|
|
2488
2638
|
await c.value?.push(`/${l}`);
|
|
2489
|
-
},
|
|
2639
|
+
}, J = async (l) => {
|
|
2490
2640
|
await c.value?.push(`/${u.value}/${l}`);
|
|
2491
|
-
},
|
|
2641
|
+
}, K = async () => {
|
|
2492
2642
|
const l = `new-${Date.now()}`;
|
|
2493
2643
|
await c.value?.push(`/${u.value}/${l}`);
|
|
2494
|
-
},
|
|
2644
|
+
}, E = (l) => {
|
|
2495
2645
|
if (e.value)
|
|
2496
2646
|
try {
|
|
2497
2647
|
e.value.records(l);
|
|
2498
2648
|
} catch {
|
|
2499
2649
|
}
|
|
2500
2650
|
}, U = () => {
|
|
2501
|
-
if (!
|
|
2502
|
-
const l =
|
|
2651
|
+
if (!t.availableDoctypes.length) return [];
|
|
2652
|
+
const l = t.availableDoctypes.map((d) => ({
|
|
2503
2653
|
id: d,
|
|
2504
2654
|
doctype: d,
|
|
2505
2655
|
display_name: x(d),
|
|
@@ -2561,9 +2711,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2561
2711
|
}
|
|
2562
2712
|
];
|
|
2563
2713
|
}, m = () => {
|
|
2564
|
-
if (!
|
|
2714
|
+
if (!s.value) return [];
|
|
2565
2715
|
if (!e.value) return [];
|
|
2566
|
-
const l =
|
|
2716
|
+
const l = A(), d = F();
|
|
2567
2717
|
if (d.length === 0)
|
|
2568
2718
|
return [
|
|
2569
2719
|
{
|
|
@@ -2574,9 +2724,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2574
2724
|
<nav class="breadcrumbs">
|
|
2575
2725
|
<a href="/">Home</a>
|
|
2576
2726
|
<span class="separator">/</span>
|
|
2577
|
-
<span class="current">${x(u.value ||
|
|
2727
|
+
<span class="current">${x(u.value || s.value)}</span>
|
|
2578
2728
|
</nav>
|
|
2579
|
-
<h1>${x(u.value ||
|
|
2729
|
+
<h1>${x(u.value || s.value)} Records</h1>
|
|
2580
2730
|
</div>
|
|
2581
2731
|
`
|
|
2582
2732
|
},
|
|
@@ -2585,15 +2735,15 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2585
2735
|
component: "div",
|
|
2586
2736
|
value: `
|
|
2587
2737
|
<div class="loading-state">
|
|
2588
|
-
<p>Loading ${x(u.value ||
|
|
2738
|
+
<p>Loading ${x(u.value || s.value)} schema...</p>
|
|
2589
2739
|
</div>
|
|
2590
2740
|
`
|
|
2591
2741
|
}
|
|
2592
2742
|
];
|
|
2593
|
-
const S = l.map((
|
|
2594
|
-
...
|
|
2743
|
+
const S = l.map((R) => ({
|
|
2744
|
+
...R,
|
|
2595
2745
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2596
|
-
id:
|
|
2746
|
+
id: R.id || "",
|
|
2597
2747
|
actions: "Edit | Delete"
|
|
2598
2748
|
}));
|
|
2599
2749
|
return [
|
|
@@ -2605,9 +2755,9 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2605
2755
|
<nav class="breadcrumbs">
|
|
2606
2756
|
<a href="/">Home</a>
|
|
2607
2757
|
<span class="separator">/</span>
|
|
2608
|
-
<span class="current">${x(u.value ||
|
|
2758
|
+
<span class="current">${x(u.value || s.value)}</span>
|
|
2609
2759
|
</nav>
|
|
2610
|
-
<h1>${x(u.value ||
|
|
2760
|
+
<h1>${x(u.value || s.value)} Records</h1>
|
|
2611
2761
|
</div>
|
|
2612
2762
|
`
|
|
2613
2763
|
},
|
|
@@ -2617,7 +2767,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2617
2767
|
value: `
|
|
2618
2768
|
<div class="view-actions">
|
|
2619
2769
|
<button class="btn-primary" data-action="create">
|
|
2620
|
-
New ${x(u.value ||
|
|
2770
|
+
New ${x(u.value || s.value)}
|
|
2621
2771
|
</button>
|
|
2622
2772
|
</div>
|
|
2623
2773
|
`
|
|
@@ -2628,7 +2778,7 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2628
2778
|
component: "div",
|
|
2629
2779
|
value: `
|
|
2630
2780
|
<div class="empty-state">
|
|
2631
|
-
<p>No ${u.value ||
|
|
2781
|
+
<p>No ${u.value || s.value} records found.</p>
|
|
2632
2782
|
<button class="btn-primary" data-action="create">
|
|
2633
2783
|
Create First Record
|
|
2634
2784
|
</button>
|
|
@@ -2640,10 +2790,10 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2640
2790
|
fieldname: "records_table",
|
|
2641
2791
|
component: "ATable",
|
|
2642
2792
|
columns: [
|
|
2643
|
-
...d.map((
|
|
2644
|
-
label:
|
|
2645
|
-
name:
|
|
2646
|
-
fieldtype:
|
|
2793
|
+
...d.map((R) => ({
|
|
2794
|
+
label: R.label,
|
|
2795
|
+
name: R.fieldname,
|
|
2796
|
+
fieldtype: R.fieldtype,
|
|
2647
2797
|
align: "left",
|
|
2648
2798
|
edit: !1,
|
|
2649
2799
|
width: "20ch"
|
|
@@ -2665,11 +2815,11 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2665
2815
|
}
|
|
2666
2816
|
]
|
|
2667
2817
|
];
|
|
2668
|
-
},
|
|
2669
|
-
if (!
|
|
2818
|
+
}, g = () => {
|
|
2819
|
+
if (!s.value) return [];
|
|
2670
2820
|
if (!e.value) return [];
|
|
2671
2821
|
try {
|
|
2672
|
-
const d = e.value?.registry?.registry[
|
|
2822
|
+
const d = e.value?.registry?.registry[s.value];
|
|
2673
2823
|
if (!d?.schema)
|
|
2674
2824
|
return [
|
|
2675
2825
|
{
|
|
@@ -2680,13 +2830,13 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2680
2830
|
<nav class="breadcrumbs">
|
|
2681
2831
|
<a href="/">Home</a>
|
|
2682
2832
|
<span class="separator">/</span>
|
|
2683
|
-
<a href="/${u.value ||
|
|
2684
|
-
u.value ||
|
|
2833
|
+
<a href="/${u.value || s.value}">${x(
|
|
2834
|
+
u.value || s.value
|
|
2685
2835
|
)}</a>
|
|
2686
2836
|
<span class="separator">/</span>
|
|
2687
|
-
<span class="current">${
|
|
2837
|
+
<span class="current">${h.value ? "New Record" : p.value}</span>
|
|
2688
2838
|
</nav>
|
|
2689
|
-
<h1>${
|
|
2839
|
+
<h1>${h.value ? `New ${x(u.value || s.value)}` : `Edit ${x(u.value || s.value)}`}</h1>
|
|
2690
2840
|
</div>
|
|
2691
2841
|
`
|
|
2692
2842
|
},
|
|
@@ -2695,12 +2845,12 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2695
2845
|
component: "div",
|
|
2696
2846
|
value: `
|
|
2697
2847
|
<div class="loading-state">
|
|
2698
|
-
<p>Loading ${x(u.value ||
|
|
2848
|
+
<p>Loading ${x(u.value || s.value)} form...</p>
|
|
2699
2849
|
</div>
|
|
2700
2850
|
`
|
|
2701
2851
|
}
|
|
2702
2852
|
];
|
|
2703
|
-
const S = "toArray" in d.schema ? d.schema.toArray() : d.schema,
|
|
2853
|
+
const S = "toArray" in d.schema ? d.schema.toArray() : d.schema, R = G();
|
|
2704
2854
|
return [
|
|
2705
2855
|
{
|
|
2706
2856
|
fieldname: "header",
|
|
@@ -2710,14 +2860,14 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2710
2860
|
<nav class="breadcrumbs">
|
|
2711
2861
|
<a href="/">Home</a>
|
|
2712
2862
|
<span class="separator">/</span>
|
|
2713
|
-
<a href="/${u.value ||
|
|
2714
|
-
u.value ||
|
|
2863
|
+
<a href="/${u.value || s.value}">${x(
|
|
2864
|
+
u.value || s.value
|
|
2715
2865
|
)}</a>
|
|
2716
2866
|
<span class="separator">/</span>
|
|
2717
|
-
<span class="current">${
|
|
2867
|
+
<span class="current">${h.value ? "New Record" : p.value}</span>
|
|
2718
2868
|
</nav>
|
|
2719
2869
|
<h1>
|
|
2720
|
-
${
|
|
2870
|
+
${h.value ? `New ${x(u.value || s.value)}` : `Edit ${x(u.value || s.value)}`}
|
|
2721
2871
|
</h1>
|
|
2722
2872
|
</div>
|
|
2723
2873
|
`
|
|
@@ -2731,14 +2881,14 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2731
2881
|
${a.value ? "Saving..." : "Save"}
|
|
2732
2882
|
</button>
|
|
2733
2883
|
<button class="btn-secondary" data-action="cancel">Cancel</button>
|
|
2734
|
-
${
|
|
2884
|
+
${h.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
|
|
2735
2885
|
</div>
|
|
2736
2886
|
`
|
|
2737
2887
|
},
|
|
2738
|
-
...S.map((
|
|
2739
|
-
...
|
|
2888
|
+
...S.map((z) => ({
|
|
2889
|
+
...z,
|
|
2740
2890
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2741
|
-
value:
|
|
2891
|
+
value: R[z.fieldname] || ""
|
|
2742
2892
|
}))
|
|
2743
2893
|
];
|
|
2744
2894
|
} catch {
|
|
@@ -2748,58 +2898,58 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2748
2898
|
component: "div",
|
|
2749
2899
|
value: `
|
|
2750
2900
|
<div class="error-state">
|
|
2751
|
-
<p>Unable to load form schema for ${x(u.value ||
|
|
2901
|
+
<p>Unable to load form schema for ${x(u.value || s.value)}</p>
|
|
2752
2902
|
</div>
|
|
2753
2903
|
`
|
|
2754
2904
|
}
|
|
2755
2905
|
];
|
|
2756
2906
|
}
|
|
2757
|
-
},
|
|
2758
|
-
if (!e.value || !
|
|
2907
|
+
}, A = () => {
|
|
2908
|
+
if (!e.value || !s.value)
|
|
2759
2909
|
return [];
|
|
2760
|
-
const d = e.value.records(
|
|
2910
|
+
const d = e.value.records(s.value)?.get("");
|
|
2761
2911
|
return d && typeof d == "object" && !Array.isArray(d) ? Object.values(d) : [];
|
|
2762
2912
|
}, F = () => {
|
|
2763
|
-
if (!e.value || !
|
|
2913
|
+
if (!e.value || !s.value) return [];
|
|
2764
2914
|
try {
|
|
2765
|
-
const d = e.value.registry.registry[
|
|
2915
|
+
const d = e.value.registry.registry[s.value];
|
|
2766
2916
|
if (d?.schema)
|
|
2767
|
-
return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((
|
|
2768
|
-
fieldname:
|
|
2769
|
-
label: "label" in
|
|
2770
|
-
fieldtype: "fieldtype" in
|
|
2917
|
+
return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((R) => ({
|
|
2918
|
+
fieldname: R.fieldname,
|
|
2919
|
+
label: "label" in R && R.label || R.fieldname,
|
|
2920
|
+
fieldtype: "fieldtype" in R && R.fieldtype || "Data"
|
|
2771
2921
|
}));
|
|
2772
2922
|
} catch {
|
|
2773
2923
|
}
|
|
2774
2924
|
return [];
|
|
2775
|
-
},
|
|
2776
|
-
switch (
|
|
2925
|
+
}, G = () => !e.value || !s.value || h.value ? {} : e.value.getRecordById(s.value, p.value)?.get("") || {}, N = I(() => {
|
|
2926
|
+
switch (b.value) {
|
|
2777
2927
|
case "doctypes":
|
|
2778
2928
|
return U();
|
|
2779
2929
|
case "records":
|
|
2780
2930
|
return m();
|
|
2781
2931
|
case "record":
|
|
2782
|
-
return
|
|
2932
|
+
return g();
|
|
2783
2933
|
default:
|
|
2784
2934
|
return [];
|
|
2785
2935
|
}
|
|
2786
|
-
}),
|
|
2936
|
+
}), P = C([]);
|
|
2787
2937
|
H(
|
|
2788
|
-
|
|
2938
|
+
N,
|
|
2789
2939
|
(l) => {
|
|
2790
|
-
|
|
2940
|
+
P.value = [...l];
|
|
2791
2941
|
},
|
|
2792
2942
|
{ immediate: !0, deep: !0 }
|
|
2793
2943
|
), H(
|
|
2794
|
-
|
|
2944
|
+
P,
|
|
2795
2945
|
(l) => {
|
|
2796
|
-
if (!(!e.value || !
|
|
2946
|
+
if (!(!e.value || !s.value || !p.value || h.value))
|
|
2797
2947
|
try {
|
|
2798
2948
|
const d = e.value.getStore();
|
|
2799
2949
|
l.forEach((S) => {
|
|
2800
2950
|
if (S.fieldname && "value" in S && !["header", "actions", "loading", "error"].includes(S.fieldname)) {
|
|
2801
|
-
const
|
|
2802
|
-
(d.has(
|
|
2951
|
+
const R = `${s.value}.${p.value}.${S.fieldname}`;
|
|
2952
|
+
(d.has(R) ? d.get(R) : void 0) !== S.value && d.set(R, S.value);
|
|
2803
2953
|
}
|
|
2804
2954
|
});
|
|
2805
2955
|
} catch (d) {
|
|
@@ -2808,24 +2958,24 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2808
2958
|
},
|
|
2809
2959
|
{ deep: !0 }
|
|
2810
2960
|
);
|
|
2811
|
-
const
|
|
2961
|
+
const B = async () => {
|
|
2812
2962
|
if (e.value) {
|
|
2813
2963
|
a.value = !0;
|
|
2814
2964
|
try {
|
|
2815
|
-
const l =
|
|
2816
|
-
if (
|
|
2965
|
+
const l = i.value || {};
|
|
2966
|
+
if (h.value) {
|
|
2817
2967
|
const d = `record-${Date.now()}`, S = { id: d, ...l };
|
|
2818
|
-
e.value.addRecord(
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2968
|
+
e.value.addRecord(s.value, d, S);
|
|
2969
|
+
const R = e.value.getRecordById(s.value, d);
|
|
2970
|
+
R && await R.triggerTransition("SAVE", {
|
|
2821
2971
|
currentState: "creating",
|
|
2822
2972
|
targetState: "saved",
|
|
2823
2973
|
fsmContext: S
|
|
2824
2974
|
}), await c.value?.replace(`/${u.value}/${d}`);
|
|
2825
2975
|
} else {
|
|
2826
2976
|
const d = { id: p.value, ...l };
|
|
2827
|
-
e.value.addRecord(
|
|
2828
|
-
const S = e.value.getRecordById(
|
|
2977
|
+
e.value.addRecord(s.value, p.value, d);
|
|
2978
|
+
const S = e.value.getRecordById(s.value, p.value);
|
|
2829
2979
|
S && await S.triggerTransition("SAVE", {
|
|
2830
2980
|
currentState: "editing",
|
|
2831
2981
|
targetState: "saved",
|
|
@@ -2837,12 +2987,12 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2837
2987
|
a.value = !1;
|
|
2838
2988
|
}
|
|
2839
2989
|
}
|
|
2840
|
-
},
|
|
2841
|
-
if (
|
|
2990
|
+
}, w = async () => {
|
|
2991
|
+
if (h.value)
|
|
2842
2992
|
await c.value?.push(`/${u.value}`);
|
|
2843
2993
|
else {
|
|
2844
2994
|
if (e.value) {
|
|
2845
|
-
const l = e.value.getRecordById(
|
|
2995
|
+
const l = e.value.getRecordById(s.value, p.value);
|
|
2846
2996
|
l && await l.triggerTransition("CANCEL", {
|
|
2847
2997
|
currentState: "editing",
|
|
2848
2998
|
targetState: "cancelled"
|
|
@@ -2850,63 +3000,63 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2850
3000
|
}
|
|
2851
3001
|
f();
|
|
2852
3002
|
}
|
|
2853
|
-
},
|
|
3003
|
+
}, $ = (l, d) => {
|
|
2854
3004
|
d && d();
|
|
2855
|
-
},
|
|
3005
|
+
}, _ = async (l) => {
|
|
2856
3006
|
if (!e.value) return;
|
|
2857
3007
|
const d = l || p.value;
|
|
2858
3008
|
if (d && confirm("Are you sure you want to delete this record?")) {
|
|
2859
|
-
const S = e.value.getRecordById(
|
|
3009
|
+
const S = e.value.getRecordById(s.value, d);
|
|
2860
3010
|
S && await S.triggerTransition("DELETE", {
|
|
2861
3011
|
currentState: "editing",
|
|
2862
3012
|
targetState: "deleted"
|
|
2863
|
-
}), e.value.removeRecord(
|
|
3013
|
+
}), e.value.removeRecord(s.value, d), b.value === "record" && await c.value?.push(`/${u.value}`);
|
|
2864
3014
|
}
|
|
2865
|
-
},
|
|
3015
|
+
}, v = async (l) => {
|
|
2866
3016
|
const d = l.target, S = d.getAttribute("data-action");
|
|
2867
3017
|
if (S)
|
|
2868
3018
|
switch (S) {
|
|
2869
3019
|
case "create":
|
|
2870
|
-
await
|
|
3020
|
+
await K();
|
|
2871
3021
|
break;
|
|
2872
3022
|
case "save":
|
|
2873
|
-
await
|
|
3023
|
+
await B();
|
|
2874
3024
|
break;
|
|
2875
3025
|
case "cancel":
|
|
2876
|
-
await
|
|
3026
|
+
await w();
|
|
2877
3027
|
break;
|
|
2878
3028
|
case "delete":
|
|
2879
|
-
await
|
|
3029
|
+
await _();
|
|
2880
3030
|
break;
|
|
2881
3031
|
}
|
|
2882
|
-
const
|
|
2883
|
-
if (
|
|
2884
|
-
const
|
|
2885
|
-
if (
|
|
3032
|
+
const R = d.closest("td, th");
|
|
3033
|
+
if (R) {
|
|
3034
|
+
const z = R.textContent?.trim(), te = R.closest("tr");
|
|
3035
|
+
if (z === "View Records" && te) {
|
|
2886
3036
|
const q = te.querySelectorAll("td");
|
|
2887
3037
|
if (q.length > 0) {
|
|
2888
|
-
const
|
|
2889
|
-
|
|
3038
|
+
const Y = q[1].textContent?.trim();
|
|
3039
|
+
Y && await Z(Y);
|
|
2890
3040
|
}
|
|
2891
|
-
} else if (
|
|
3041
|
+
} else if (z?.includes("Edit") && te) {
|
|
2892
3042
|
const q = te.querySelectorAll("td");
|
|
2893
3043
|
if (q.length > 0) {
|
|
2894
|
-
const
|
|
2895
|
-
|
|
3044
|
+
const Y = q[0].textContent?.trim();
|
|
3045
|
+
Y && await J(Y);
|
|
2896
3046
|
}
|
|
2897
|
-
} else if (
|
|
3047
|
+
} else if (z?.includes("Delete") && te) {
|
|
2898
3048
|
const q = te.querySelectorAll("td");
|
|
2899
3049
|
if (q.length > 0) {
|
|
2900
|
-
const
|
|
2901
|
-
|
|
3050
|
+
const Y = q[0].textContent?.trim();
|
|
3051
|
+
Y && await _(Y);
|
|
2902
3052
|
}
|
|
2903
3053
|
}
|
|
2904
3054
|
}
|
|
2905
3055
|
};
|
|
2906
3056
|
H(
|
|
2907
|
-
[
|
|
3057
|
+
[b, s, p],
|
|
2908
3058
|
() => {
|
|
2909
|
-
|
|
3059
|
+
b.value === "record" && f();
|
|
2910
3060
|
},
|
|
2911
3061
|
{ immediate: !0 }
|
|
2912
3062
|
), H(
|
|
@@ -2915,34 +3065,34 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2915
3065
|
},
|
|
2916
3066
|
{ immediate: !0 }
|
|
2917
3067
|
), H(
|
|
2918
|
-
[
|
|
3068
|
+
[b, s, e],
|
|
2919
3069
|
([l, d, S]) => {
|
|
2920
|
-
l === "records" && d && S &&
|
|
3070
|
+
l === "records" && d && S && E(d);
|
|
2921
3071
|
},
|
|
2922
3072
|
{ immediate: !0 }
|
|
2923
3073
|
);
|
|
2924
3074
|
const f = () => {
|
|
2925
|
-
if (!(!e.value || !
|
|
2926
|
-
|
|
3075
|
+
if (!(!e.value || !s.value)) {
|
|
3076
|
+
o.value = !0;
|
|
2927
3077
|
try {
|
|
2928
|
-
|
|
3078
|
+
h.value || e.value.getRecordById(s.value, p.value);
|
|
2929
3079
|
} catch (l) {
|
|
2930
3080
|
console.warn("Error loading record data:", l);
|
|
2931
3081
|
} finally {
|
|
2932
|
-
|
|
3082
|
+
o.value = !1;
|
|
2933
3083
|
}
|
|
2934
3084
|
}
|
|
2935
3085
|
};
|
|
2936
|
-
return
|
|
2937
|
-
navigateToDoctype:
|
|
2938
|
-
openRecord:
|
|
2939
|
-
createNewRecord:
|
|
2940
|
-
handleSave:
|
|
2941
|
-
handleCancel:
|
|
2942
|
-
handleDelete:
|
|
2943
|
-
}),
|
|
2944
|
-
|
|
2945
|
-
|
|
3086
|
+
return Ge("desktopMethods", {
|
|
3087
|
+
navigateToDoctype: Z,
|
|
3088
|
+
openRecord: J,
|
|
3089
|
+
createNewRecord: K,
|
|
3090
|
+
handleSave: B,
|
|
3091
|
+
handleCancel: w,
|
|
3092
|
+
handleDelete: _
|
|
3093
|
+
}), xe(() => {
|
|
3094
|
+
re(() => {
|
|
3095
|
+
b.value === "records" && s.value && e.value && E(s.value);
|
|
2946
3096
|
});
|
|
2947
3097
|
const l = (d) => {
|
|
2948
3098
|
(d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(), n.value = !0), d.key === "Escape" && n.value && (n.value = !1);
|
|
@@ -2950,52 +3100,52 @@ const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
|
2950
3100
|
return document.addEventListener("keydown", l), () => {
|
|
2951
3101
|
document.removeEventListener("keydown", l);
|
|
2952
3102
|
};
|
|
2953
|
-
}), (l, d) => (
|
|
3103
|
+
}), (l, d) => (j(), L("div", {
|
|
2954
3104
|
class: "desktop",
|
|
2955
|
-
onClick:
|
|
3105
|
+
onClick: v
|
|
2956
3106
|
}, [
|
|
2957
|
-
|
|
2958
|
-
elements:
|
|
2959
|
-
onActionClick:
|
|
3107
|
+
ae(St, {
|
|
3108
|
+
elements: k.value,
|
|
3109
|
+
onActionClick: $
|
|
2960
3110
|
}, null, 8, ["elements"]),
|
|
2961
|
-
|
|
3111
|
+
P.value.length > 0 ? (j(), Qe(Ne(qo), {
|
|
2962
3112
|
key: 0,
|
|
2963
|
-
modelValue:
|
|
2964
|
-
"onUpdate:modelValue": d[0] || (d[0] = (S) =>
|
|
2965
|
-
data:
|
|
2966
|
-
}, null, 8, ["modelValue", "data"])) :
|
|
2967
|
-
T("p", null, "Loading " +
|
|
2968
|
-
])) : (
|
|
3113
|
+
modelValue: P.value,
|
|
3114
|
+
"onUpdate:modelValue": d[0] || (d[0] = (S) => P.value = S),
|
|
3115
|
+
data: i.value
|
|
3116
|
+
}, null, 8, ["modelValue", "data"])) : Ne(e) ? (j(), L("div", ta, [
|
|
3117
|
+
T("p", null, "Loading " + ee(b.value) + " data...", 1)
|
|
3118
|
+
])) : (j(), L("div", ea, [...d[2] || (d[2] = [
|
|
2969
3119
|
T("p", null, "Initializing Stonecrop...", -1)
|
|
2970
3120
|
])])),
|
|
2971
|
-
|
|
2972
|
-
|
|
3121
|
+
ae(Ot, { breadcrumbs: O.value }, null, 8, ["breadcrumbs"]),
|
|
3122
|
+
ae($t, {
|
|
2973
3123
|
"is-open": n.value,
|
|
2974
3124
|
search: V,
|
|
2975
3125
|
placeholder: "Type a command or search...",
|
|
2976
|
-
onSelect:
|
|
3126
|
+
onSelect: M,
|
|
2977
3127
|
onClose: d[1] || (d[1] = (S) => n.value = !1)
|
|
2978
3128
|
}, {
|
|
2979
|
-
title:
|
|
2980
|
-
|
|
3129
|
+
title: we(({ result: S }) => [
|
|
3130
|
+
Ce(ee(S.title), 1)
|
|
2981
3131
|
]),
|
|
2982
|
-
content:
|
|
2983
|
-
|
|
3132
|
+
content: we(({ result: S }) => [
|
|
3133
|
+
Ce(ee(S.description), 1)
|
|
2984
3134
|
]),
|
|
2985
3135
|
_: 1
|
|
2986
3136
|
}, 8, ["is-open"])
|
|
2987
3137
|
]));
|
|
2988
3138
|
}
|
|
2989
|
-
}),
|
|
2990
|
-
install: (
|
|
2991
|
-
|
|
3139
|
+
}), ra = {
|
|
3140
|
+
install: (t) => {
|
|
3141
|
+
t.component("ActionSet", St), t.component("CommandPalette", $t), t.component("Desktop", oa), t.component("SheetNav", Ot);
|
|
2992
3142
|
}
|
|
2993
3143
|
};
|
|
2994
3144
|
export {
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3145
|
+
St as ActionSet,
|
|
3146
|
+
$t as CommandPalette,
|
|
3147
|
+
oa as Desktop,
|
|
3148
|
+
Ot as SheetNav,
|
|
3149
|
+
ra as StonecropDesktop
|
|
3000
3150
|
};
|
|
3001
3151
|
//# sourceMappingURL=desktop.js.map
|