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