@stonecrop/desktop 0.10.2 → 0.10.3
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 +739 -687
- package/dist/desktop.js.map +1 -1
- package/package.json +5 -5
package/dist/desktop.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as be, ref as $, onMounted as xe, openBlock as P, createElementBlock as j, normalizeClass as De, createElementVNode as x, Fragment as ue, renderList as ye, toDisplayString as X, createCommentVNode as ce, withDirectives as Oe, vShow as Je, useTemplateRef as pt, computed as R, watch as H, nextTick as de, createBlock as Qe, Teleport as Ot, createVNode as ne, Transition as At, withCtx as me, withModifiers as ft, vModelText as ht, renderSlot as Ve, createTextVNode as Ae, toRaw as vt, isRef as pe, isReactive as Te, toRef as re, hasInjectionContext as ze, inject as we, getCurrentInstance as gt, reactive as yt, markRaw as he, effectScope as $t, getCurrentScope as Xe, onScopeDispose as Ye, toRefs as tt, provide as Ge, shallowRef as Se, toValue as K, readonly as Pe, customRef as et, unref as Ne, useModel as It, watchEffect as Rt, resolveComponent as mt, resolveDynamicComponent as xt, mergeProps as Tt, mergeModels as ot, withKeys as fe, normalizeStyle as je } from "vue";
|
|
2
|
+
const Pt = { class: "action-menu-icon" }, Vt = ["disabled", "onClick"], jt = { key: 1 }, Mt = ["onClick"], Ft = { class: "dropdown-container" }, Lt = { class: "dropdown" }, Bt = ["onClick"], Wt = ["href"], Ht = { class: "dropdown-item" }, Ut = /* @__PURE__ */ be({
|
|
3
3
|
__name: "ActionSet",
|
|
4
4
|
props: {
|
|
5
5
|
elements: { default: () => [] }
|
|
6
6
|
},
|
|
7
7
|
emits: ["actionClick"],
|
|
8
|
-
setup(
|
|
9
|
-
const t = e,
|
|
8
|
+
setup(n, { emit: e }) {
|
|
9
|
+
const t = e, o = $({}), r = $(!1), a = $(-1), s = $(!1), c = $(!1);
|
|
10
10
|
xe(() => {
|
|
11
11
|
d();
|
|
12
12
|
});
|
|
13
13
|
const d = () => {
|
|
14
|
-
|
|
14
|
+
o.value = {};
|
|
15
15
|
}, u = () => {
|
|
16
16
|
s.value = !0, a.value = setTimeout(() => {
|
|
17
17
|
s.value && (r.value = !0);
|
|
18
18
|
}, 500);
|
|
19
|
-
},
|
|
19
|
+
}, w = () => {
|
|
20
20
|
s.value = !1, c.value = !1, clearTimeout(a.value), r.value = !1;
|
|
21
|
-
}, v = (
|
|
22
|
-
const m = !
|
|
23
|
-
d(), m && (
|
|
24
|
-
}, h = (
|
|
25
|
-
t("actionClick", m,
|
|
21
|
+
}, v = (b) => {
|
|
22
|
+
const m = !o.value[b];
|
|
23
|
+
d(), m && (o.value[b] = !0);
|
|
24
|
+
}, h = (b, m) => {
|
|
25
|
+
t("actionClick", m, b);
|
|
26
26
|
};
|
|
27
|
-
return (
|
|
27
|
+
return (b, m) => (P(), j("div", {
|
|
28
28
|
class: De([{ "open-set": r.value, "hovered-and-closed": c.value }, "action-set collapse"]),
|
|
29
29
|
onMouseover: u,
|
|
30
|
-
onMouseleave:
|
|
30
|
+
onMouseleave: w
|
|
31
31
|
}, [
|
|
32
|
-
x("div",
|
|
32
|
+
x("div", Pt, [
|
|
33
33
|
x("div", {
|
|
34
34
|
id: "chevron",
|
|
35
35
|
onClick: m[0] || (m[0] = (k) => c.value = !c.value)
|
|
@@ -67,57 +67,57 @@ const Tt = { class: "action-menu-icon" }, Vt = ["disabled", "onClick"], jt = { k
|
|
|
67
67
|
])])
|
|
68
68
|
]),
|
|
69
69
|
m[2] || (m[2] = x("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
70
|
-
(
|
|
70
|
+
(P(!0), j(ue, null, ye(n.elements, (k, I) => (P(), j("div", {
|
|
71
71
|
key: k.label,
|
|
72
72
|
class: "action-element"
|
|
73
73
|
}, [
|
|
74
|
-
k.type == "button" ? (
|
|
74
|
+
k.type == "button" ? (P(), j("button", {
|
|
75
75
|
key: 0,
|
|
76
76
|
disabled: k.disabled,
|
|
77
77
|
class: "button-default",
|
|
78
|
-
onClick: (
|
|
78
|
+
onClick: (T) => h(k.action, k.label)
|
|
79
79
|
}, X(k.label), 9, Vt)) : ce("", !0),
|
|
80
|
-
k.type == "dropdown" ? (
|
|
80
|
+
k.type == "dropdown" ? (P(), j("div", jt, [
|
|
81
81
|
x("button", {
|
|
82
82
|
class: "button-default",
|
|
83
|
-
onClick: (
|
|
83
|
+
onClick: (T) => v(I)
|
|
84
84
|
}, X(k.label), 9, Mt),
|
|
85
|
-
|
|
85
|
+
Oe(x("div", Ft, [
|
|
86
86
|
x("div", Lt, [
|
|
87
|
-
(
|
|
88
|
-
key:
|
|
87
|
+
(P(!0), j(ue, null, ye(k.actions, (T, Z) => (P(), j("div", {
|
|
88
|
+
key: T.label
|
|
89
89
|
}, [
|
|
90
|
-
|
|
90
|
+
T.action != null ? (P(), j("button", {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "dropdown-item",
|
|
93
|
-
onClick: (U) => h(
|
|
94
|
-
}, X(
|
|
93
|
+
onClick: (U) => h(T.action, T.label)
|
|
94
|
+
}, X(T.label), 9, Bt)) : T.link != null ? (P(), j("a", {
|
|
95
95
|
key: 1,
|
|
96
|
-
href:
|
|
96
|
+
href: T.link
|
|
97
97
|
}, [
|
|
98
|
-
x("button", Ht, X(
|
|
98
|
+
x("button", Ht, X(T.label), 1)
|
|
99
99
|
], 8, Wt)) : ce("", !0)
|
|
100
100
|
]))), 128))
|
|
101
101
|
])
|
|
102
102
|
], 512), [
|
|
103
|
-
[
|
|
103
|
+
[Je, o.value[I]]
|
|
104
104
|
])
|
|
105
105
|
])) : ce("", !0)
|
|
106
106
|
]))), 128))
|
|
107
107
|
], 34));
|
|
108
108
|
}
|
|
109
|
-
}),
|
|
110
|
-
const t =
|
|
111
|
-
for (const [
|
|
112
|
-
t[
|
|
109
|
+
}), wt = (n, e) => {
|
|
110
|
+
const t = n.__vccOpts || n;
|
|
111
|
+
for (const [o, r] of e)
|
|
112
|
+
t[o] = r;
|
|
113
113
|
return t;
|
|
114
|
-
},
|
|
114
|
+
}, bt = /* @__PURE__ */ wt(Ut, [["__scopeId", "data-v-eb01c863"]]), Jt = { class: "command-palette-header" }, zt = ["placeholder"], Gt = {
|
|
115
115
|
key: 0,
|
|
116
116
|
class: "command-palette-results"
|
|
117
|
-
},
|
|
117
|
+
}, qt = ["onClick", "onMouseover"], Kt = { class: "result-title" }, Zt = { class: "result-content" }, Qt = {
|
|
118
118
|
key: 1,
|
|
119
119
|
class: "command-palette-no-results"
|
|
120
|
-
}, St = /* @__PURE__ */
|
|
120
|
+
}, St = /* @__PURE__ */ be({
|
|
121
121
|
__name: "CommandPalette",
|
|
122
122
|
props: {
|
|
123
123
|
search: { type: Function },
|
|
@@ -126,40 +126,40 @@ const Tt = { class: "action-menu-icon" }, Vt = ["disabled", "onClick"], jt = { k
|
|
|
126
126
|
maxResults: { default: 10 }
|
|
127
127
|
},
|
|
128
128
|
emits: ["select", "close"],
|
|
129
|
-
setup(
|
|
130
|
-
const t = e,
|
|
129
|
+
setup(n, { emit: e }) {
|
|
130
|
+
const t = e, o = $(""), r = $(0), a = pt("input"), s = R(() => o.value ? n.search(o.value).slice(0, n.maxResults) : []);
|
|
131
131
|
H(
|
|
132
|
-
() =>
|
|
133
|
-
async (
|
|
134
|
-
|
|
132
|
+
() => n.isOpen,
|
|
133
|
+
async (w) => {
|
|
134
|
+
w && (o.value = "", r.value = 0, await de(), a.value?.focus());
|
|
135
135
|
}
|
|
136
136
|
), H(s, () => {
|
|
137
137
|
r.value = 0;
|
|
138
138
|
});
|
|
139
139
|
const c = () => {
|
|
140
140
|
t("close");
|
|
141
|
-
}, d = (
|
|
142
|
-
switch (
|
|
141
|
+
}, d = (w) => {
|
|
142
|
+
switch (w.key) {
|
|
143
143
|
case "Escape":
|
|
144
144
|
c();
|
|
145
145
|
break;
|
|
146
146
|
case "ArrowDown":
|
|
147
|
-
|
|
147
|
+
w.preventDefault(), s.value.length && (r.value = (r.value + 1) % s.value.length);
|
|
148
148
|
break;
|
|
149
149
|
case "ArrowUp":
|
|
150
|
-
|
|
150
|
+
w.preventDefault(), s.value.length && (r.value = (r.value - 1 + s.value.length) % s.value.length);
|
|
151
151
|
break;
|
|
152
152
|
case "Enter":
|
|
153
153
|
s.value.length && r.value >= 0 && u(s.value[r.value]);
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
|
-
}, u = (
|
|
157
|
-
t("select",
|
|
156
|
+
}, u = (w) => {
|
|
157
|
+
t("select", w), c();
|
|
158
158
|
};
|
|
159
|
-
return (
|
|
159
|
+
return (w, v) => (P(), Qe(Ot, { to: "body" }, [
|
|
160
160
|
ne(At, { name: "fade" }, {
|
|
161
161
|
default: me(() => [
|
|
162
|
-
|
|
162
|
+
n.isOpen ? (P(), j("div", {
|
|
163
163
|
key: 0,
|
|
164
164
|
class: "command-palette-overlay",
|
|
165
165
|
onClick: c
|
|
@@ -169,36 +169,36 @@ const Tt = { class: "action-menu-icon" }, Vt = ["disabled", "onClick"], jt = { k
|
|
|
169
169
|
onClick: v[1] || (v[1] = ft(() => {
|
|
170
170
|
}, ["stop"]))
|
|
171
171
|
}, [
|
|
172
|
-
x("div",
|
|
173
|
-
|
|
172
|
+
x("div", Jt, [
|
|
173
|
+
Oe(x("input", {
|
|
174
174
|
ref: "input",
|
|
175
|
-
"onUpdate:modelValue": v[0] || (v[0] = (h) =>
|
|
175
|
+
"onUpdate:modelValue": v[0] || (v[0] = (h) => o.value = h),
|
|
176
176
|
type: "text",
|
|
177
177
|
class: "command-palette-input",
|
|
178
|
-
placeholder:
|
|
178
|
+
placeholder: n.placeholder,
|
|
179
179
|
autofocus: "",
|
|
180
180
|
onKeydown: d
|
|
181
|
-
}, null, 40,
|
|
182
|
-
[ht,
|
|
181
|
+
}, null, 40, zt), [
|
|
182
|
+
[ht, o.value]
|
|
183
183
|
])
|
|
184
184
|
]),
|
|
185
|
-
s.value.length ? (
|
|
186
|
-
(
|
|
187
|
-
key:
|
|
188
|
-
class: De(["command-palette-result", { selected:
|
|
185
|
+
s.value.length ? (P(), j("div", Gt, [
|
|
186
|
+
(P(!0), j(ue, null, ye(s.value, (h, b) => (P(), j("div", {
|
|
187
|
+
key: b,
|
|
188
|
+
class: De(["command-palette-result", { selected: b === r.value }]),
|
|
189
189
|
onClick: (m) => u(h),
|
|
190
|
-
onMouseover: (m) => r.value =
|
|
190
|
+
onMouseover: (m) => r.value = b
|
|
191
191
|
}, [
|
|
192
|
-
x("div",
|
|
193
|
-
Ve(
|
|
192
|
+
x("div", Kt, [
|
|
193
|
+
Ve(w.$slots, "title", { result: h })
|
|
194
194
|
]),
|
|
195
195
|
x("div", Zt, [
|
|
196
|
-
Ve(
|
|
196
|
+
Ve(w.$slots, "content", { result: h })
|
|
197
197
|
])
|
|
198
|
-
], 42,
|
|
199
|
-
])) :
|
|
200
|
-
Ve(
|
|
201
|
-
Ae(' No results found for "' + X(
|
|
198
|
+
], 42, qt))), 128))
|
|
199
|
+
])) : o.value && !s.value.length ? (P(), j("div", Qt, [
|
|
200
|
+
Ve(w.$slots, "empty", {}, () => [
|
|
201
|
+
Ae(' No results found for "' + X(o.value) + '" ', 1)
|
|
202
202
|
])
|
|
203
203
|
])) : ce("", !0)
|
|
204
204
|
])
|
|
@@ -211,132 +211,132 @@ const Tt = { class: "action-menu-icon" }, Vt = ["disabled", "onClick"], jt = { k
|
|
|
211
211
|
});
|
|
212
212
|
const ie = typeof window < "u";
|
|
213
213
|
let oe;
|
|
214
|
-
const
|
|
214
|
+
const $e = (n) => oe = n;
|
|
215
215
|
process.env.NODE_ENV;
|
|
216
|
-
const
|
|
216
|
+
const qe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
217
217
|
/* istanbul ignore next */
|
|
218
218
|
/* @__PURE__ */ Symbol()
|
|
219
219
|
);
|
|
220
|
-
function ae(
|
|
221
|
-
return
|
|
220
|
+
function ae(n) {
|
|
221
|
+
return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
|
|
222
222
|
}
|
|
223
223
|
var ve;
|
|
224
|
-
(function(
|
|
225
|
-
|
|
224
|
+
(function(n) {
|
|
225
|
+
n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
|
|
226
226
|
})(ve || (ve = {}));
|
|
227
|
-
function _t(
|
|
227
|
+
function _t(n, e) {
|
|
228
228
|
for (const t in e) {
|
|
229
|
-
const
|
|
230
|
-
if (!(t in
|
|
229
|
+
const o = e[t];
|
|
230
|
+
if (!(t in n))
|
|
231
231
|
continue;
|
|
232
|
-
const r =
|
|
233
|
-
ae(r) && ae(
|
|
232
|
+
const r = n[t];
|
|
233
|
+
ae(r) && ae(o) && !pe(o) && !Te(o) ? n[t] = _t(r, o) : n[t] = o;
|
|
234
234
|
}
|
|
235
|
-
return
|
|
235
|
+
return n;
|
|
236
236
|
}
|
|
237
237
|
const Et = () => {
|
|
238
238
|
};
|
|
239
|
-
function nt(
|
|
240
|
-
|
|
239
|
+
function nt(n, e, t, o = Et) {
|
|
240
|
+
n.add(e);
|
|
241
241
|
const r = () => {
|
|
242
|
-
|
|
242
|
+
n.delete(e) && o();
|
|
243
243
|
};
|
|
244
244
|
return !t && Xe() && Ye(r), r;
|
|
245
245
|
}
|
|
246
|
-
function se(
|
|
247
|
-
|
|
246
|
+
function se(n, ...e) {
|
|
247
|
+
n.forEach((t) => {
|
|
248
248
|
t(...e);
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
const Xt = (
|
|
252
|
-
function
|
|
253
|
-
|
|
251
|
+
const Xt = (n) => n(), rt = /* @__PURE__ */ Symbol(), Me = /* @__PURE__ */ Symbol();
|
|
252
|
+
function Ke(n, e) {
|
|
253
|
+
n instanceof Map && e instanceof Map ? e.forEach((t, o) => n.set(o, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n);
|
|
254
254
|
for (const t in e) {
|
|
255
255
|
if (!e.hasOwnProperty(t))
|
|
256
256
|
continue;
|
|
257
|
-
const
|
|
258
|
-
ae(r) && ae(
|
|
257
|
+
const o = e[t], r = n[t];
|
|
258
|
+
ae(r) && ae(o) && n.hasOwnProperty(t) && !pe(o) && !Te(o) ? n[t] = Ke(r, o) : n[t] = o;
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return n;
|
|
261
261
|
}
|
|
262
262
|
const Yt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
263
263
|
/* istanbul ignore next */
|
|
264
264
|
/* @__PURE__ */ Symbol()
|
|
265
265
|
);
|
|
266
|
-
function eo(
|
|
267
|
-
return !ae(
|
|
266
|
+
function eo(n) {
|
|
267
|
+
return !ae(n) || !Object.prototype.hasOwnProperty.call(n, Yt);
|
|
268
268
|
}
|
|
269
|
-
const { assign:
|
|
270
|
-
function at(
|
|
271
|
-
return !!(pe(
|
|
269
|
+
const { assign: q } = Object;
|
|
270
|
+
function at(n) {
|
|
271
|
+
return !!(pe(n) && n.effect);
|
|
272
272
|
}
|
|
273
|
-
function st(
|
|
274
|
-
const { state: r, actions: a, getters: s } = e, c = t.state.value[
|
|
273
|
+
function st(n, e, t, o) {
|
|
274
|
+
const { state: r, actions: a, getters: s } = e, c = t.state.value[n];
|
|
275
275
|
let d;
|
|
276
276
|
function u() {
|
|
277
|
-
!c && (process.env.NODE_ENV === "production" || !
|
|
278
|
-
const
|
|
277
|
+
!c && (process.env.NODE_ENV === "production" || !o) && (t.state.value[n] = r ? r() : {});
|
|
278
|
+
const w = process.env.NODE_ENV !== "production" && o ? (
|
|
279
279
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
280
|
-
tt(
|
|
281
|
-
) : tt(t.state.value[
|
|
282
|
-
return
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
return s[h].call(
|
|
280
|
+
tt($(r ? r() : {}).value)
|
|
281
|
+
) : tt(t.state.value[n]);
|
|
282
|
+
return q(w, a, Object.keys(s || {}).reduce((v, h) => (process.env.NODE_ENV !== "production" && h in w && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${h}" in store "${n}".`), v[h] = he(R(() => {
|
|
283
|
+
$e(t);
|
|
284
|
+
const b = t._s.get(n);
|
|
285
|
+
return s[h].call(b, b);
|
|
286
286
|
})), v), {}));
|
|
287
287
|
}
|
|
288
|
-
return d = Ze(
|
|
288
|
+
return d = Ze(n, u, e, t, o, !0), d;
|
|
289
289
|
}
|
|
290
|
-
function Ze(
|
|
290
|
+
function Ze(n, e, t = {}, o, r, a) {
|
|
291
291
|
let s;
|
|
292
|
-
const c =
|
|
293
|
-
if (process.env.NODE_ENV !== "production" && !
|
|
292
|
+
const c = q({ actions: {} }, t);
|
|
293
|
+
if (process.env.NODE_ENV !== "production" && !o._e.active)
|
|
294
294
|
throw new Error("Pinia destroyed");
|
|
295
295
|
const d = { deep: !0 };
|
|
296
296
|
process.env.NODE_ENV !== "production" && (d.onTrigger = (g) => {
|
|
297
|
-
u ?
|
|
297
|
+
u ? b = g : u == !1 && !E._hotUpdating && (Array.isArray(b) ? b.push(g) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
298
298
|
});
|
|
299
|
-
let u,
|
|
300
|
-
const m =
|
|
301
|
-
!a && !m && (process.env.NODE_ENV === "production" || !r) && (
|
|
302
|
-
const k =
|
|
299
|
+
let u, w, v = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), b;
|
|
300
|
+
const m = o.state.value[n];
|
|
301
|
+
!a && !m && (process.env.NODE_ENV === "production" || !r) && (o.state.value[n] = {});
|
|
302
|
+
const k = $({});
|
|
303
303
|
let I;
|
|
304
|
-
function
|
|
304
|
+
function T(g) {
|
|
305
305
|
let y;
|
|
306
|
-
u =
|
|
306
|
+
u = w = !1, process.env.NODE_ENV !== "production" && (b = []), typeof g == "function" ? (g(o.state.value[n]), y = {
|
|
307
307
|
type: ve.patchFunction,
|
|
308
|
-
storeId:
|
|
309
|
-
events:
|
|
310
|
-
}) : (
|
|
308
|
+
storeId: n,
|
|
309
|
+
events: b
|
|
310
|
+
}) : (Ke(o.state.value[n], g), y = {
|
|
311
311
|
type: ve.patchObject,
|
|
312
312
|
payload: g,
|
|
313
|
-
storeId:
|
|
314
|
-
events:
|
|
313
|
+
storeId: n,
|
|
314
|
+
events: b
|
|
315
315
|
});
|
|
316
316
|
const D = I = /* @__PURE__ */ Symbol();
|
|
317
317
|
de().then(() => {
|
|
318
318
|
I === D && (u = !0);
|
|
319
|
-
}),
|
|
319
|
+
}), w = !0, se(v, y, o.state.value[n]);
|
|
320
320
|
}
|
|
321
321
|
const Z = a ? function() {
|
|
322
322
|
const { state: y } = t, D = y ? y() : {};
|
|
323
323
|
this.$patch((F) => {
|
|
324
|
-
|
|
324
|
+
q(F, D);
|
|
325
325
|
});
|
|
326
326
|
} : (
|
|
327
327
|
/* istanbul ignore next */
|
|
328
328
|
process.env.NODE_ENV !== "production" ? () => {
|
|
329
|
-
throw new Error(`🍍: Store "${
|
|
329
|
+
throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
|
|
330
330
|
} : Et
|
|
331
331
|
);
|
|
332
332
|
function U() {
|
|
333
|
-
s.stop(), v.clear(), h.clear(),
|
|
333
|
+
s.stop(), v.clear(), h.clear(), o._s.delete(n);
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const z = (g, y = "") => {
|
|
336
336
|
if (rt in g)
|
|
337
337
|
return g[Me] = y, g;
|
|
338
338
|
const D = function() {
|
|
339
|
-
|
|
339
|
+
$e(o);
|
|
340
340
|
const F = Array.from(arguments), N = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set();
|
|
341
341
|
function M(S) {
|
|
342
342
|
N.add(S);
|
|
@@ -351,13 +351,13 @@ function Ze(o, e, t = {}, n, r, a) {
|
|
|
351
351
|
after: M,
|
|
352
352
|
onError: _
|
|
353
353
|
});
|
|
354
|
-
let
|
|
354
|
+
let C;
|
|
355
355
|
try {
|
|
356
|
-
|
|
356
|
+
C = g.apply(this && this.$id === n ? this : E, F);
|
|
357
357
|
} catch (S) {
|
|
358
358
|
throw se(V, S), S;
|
|
359
359
|
}
|
|
360
|
-
return
|
|
360
|
+
return C instanceof Promise ? C.then((S) => (se(N, S), S)).catch((S) => (se(V, S), Promise.reject(S))) : (se(N, C), C);
|
|
361
361
|
};
|
|
362
362
|
return D[rt] = !0, D[Me] = y, D;
|
|
363
363
|
}, L = /* @__PURE__ */ he({
|
|
@@ -365,42 +365,42 @@ function Ze(o, e, t = {}, n, r, a) {
|
|
|
365
365
|
getters: {},
|
|
366
366
|
state: [],
|
|
367
367
|
hotState: k
|
|
368
|
-
}),
|
|
369
|
-
_p:
|
|
368
|
+
}), G = {
|
|
369
|
+
_p: o,
|
|
370
370
|
// _s: scope,
|
|
371
|
-
$id:
|
|
371
|
+
$id: n,
|
|
372
372
|
$onAction: nt.bind(null, h),
|
|
373
|
-
$patch:
|
|
373
|
+
$patch: T,
|
|
374
374
|
$reset: Z,
|
|
375
375
|
$subscribe(g, y = {}) {
|
|
376
|
-
const D = nt(v, g, y.detached, () => F()), F = s.run(() => H(() =>
|
|
377
|
-
(y.flush === "sync" ?
|
|
378
|
-
storeId:
|
|
376
|
+
const D = nt(v, g, y.detached, () => F()), F = s.run(() => H(() => o.state.value[n], (N) => {
|
|
377
|
+
(y.flush === "sync" ? w : u) && g({
|
|
378
|
+
storeId: n,
|
|
379
379
|
type: ve.direct,
|
|
380
|
-
events:
|
|
380
|
+
events: b
|
|
381
381
|
}, N);
|
|
382
|
-
},
|
|
382
|
+
}, q({}, d, y)));
|
|
383
383
|
return D;
|
|
384
384
|
},
|
|
385
385
|
$dispose: U
|
|
386
|
-
}, E = yt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ie ?
|
|
386
|
+
}, E = yt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ie ? q(
|
|
387
387
|
{
|
|
388
388
|
_hmrPayload: L,
|
|
389
389
|
_customProperties: he(/* @__PURE__ */ new Set())
|
|
390
390
|
// devtools custom properties
|
|
391
391
|
},
|
|
392
|
-
|
|
392
|
+
G
|
|
393
393
|
// must be added later
|
|
394
394
|
// setupStore
|
|
395
|
-
) :
|
|
396
|
-
|
|
397
|
-
const B = (
|
|
395
|
+
) : G);
|
|
396
|
+
o._s.set(n, E);
|
|
397
|
+
const B = (o._a && o._a.runWithContext || Xt)(() => o._e.run(() => (s = $t()).run(() => e({ action: z }))));
|
|
398
398
|
for (const g in B) {
|
|
399
399
|
const y = B[g];
|
|
400
|
-
if (pe(y) && !at(y) ||
|
|
401
|
-
process.env.NODE_ENV !== "production" && r ? k.value[g] = re(B, g) : a || (m && eo(y) && (pe(y) ? y.value = m[g] :
|
|
400
|
+
if (pe(y) && !at(y) || Te(y))
|
|
401
|
+
process.env.NODE_ENV !== "production" && r ? k.value[g] = re(B, g) : a || (m && eo(y) && (pe(y) ? y.value = m[g] : Ke(y, m[g])), o.state.value[n][g] = y), process.env.NODE_ENV !== "production" && L.state.push(g);
|
|
402
402
|
else if (typeof y == "function") {
|
|
403
|
-
const D = process.env.NODE_ENV !== "production" && r ? y :
|
|
403
|
+
const D = process.env.NODE_ENV !== "production" && r ? y : z(y, g);
|
|
404
404
|
B[g] = D, process.env.NODE_ENV !== "production" && (L.actions[g] = y), c.actions[g] = y;
|
|
405
405
|
} else process.env.NODE_ENV !== "production" && at(y) && (L.getters[g] = a ? (
|
|
406
406
|
// @ts-expect-error
|
|
@@ -408,13 +408,13 @@ function Ze(o, e, t = {}, n, r, a) {
|
|
|
408
408
|
) : y, ie && (B._getters || // @ts-expect-error: same
|
|
409
409
|
(B._getters = he([]))).push(g));
|
|
410
410
|
}
|
|
411
|
-
if (
|
|
412
|
-
get: () => process.env.NODE_ENV !== "production" && r ? k.value :
|
|
411
|
+
if (q(E, B), q(vt(E), B), Object.defineProperty(E, "$state", {
|
|
412
|
+
get: () => process.env.NODE_ENV !== "production" && r ? k.value : o.state.value[n],
|
|
413
413
|
set: (g) => {
|
|
414
414
|
if (process.env.NODE_ENV !== "production" && r)
|
|
415
415
|
throw new Error("cannot set hotState");
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
T((y) => {
|
|
417
|
+
q(y, g);
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
420
|
}), process.env.NODE_ENV !== "production" && (E._hotUpdate = he((g) => {
|
|
@@ -426,18 +426,18 @@ function Ze(o, e, t = {}, n, r, a) {
|
|
|
426
426
|
E[y] = re(g.$state, y);
|
|
427
427
|
}), Object.keys(E.$state).forEach((y) => {
|
|
428
428
|
y in g.$state || delete E[y];
|
|
429
|
-
}), u = !1,
|
|
429
|
+
}), u = !1, w = !1, o.state.value[n] = re(g._hmrPayload, "hotState"), w = !0, de().then(() => {
|
|
430
430
|
u = !0;
|
|
431
431
|
});
|
|
432
432
|
for (const y in g._hmrPayload.actions) {
|
|
433
433
|
const D = g[y];
|
|
434
434
|
E[y] = //
|
|
435
|
-
|
|
435
|
+
z(D, y);
|
|
436
436
|
}
|
|
437
437
|
for (const y in g._hmrPayload.getters) {
|
|
438
438
|
const D = g._hmrPayload.getters[y], F = a ? (
|
|
439
439
|
// special handling of options api
|
|
440
|
-
R(() => (
|
|
440
|
+
R(() => ($e(o), D.call(E, E)))
|
|
441
441
|
) : D;
|
|
442
442
|
E[y] = //
|
|
443
443
|
F;
|
|
@@ -455,132 +455,132 @@ function Ze(o, e, t = {}, n, r, a) {
|
|
|
455
455
|
enumerable: !1
|
|
456
456
|
};
|
|
457
457
|
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((y) => {
|
|
458
|
-
Object.defineProperty(E, y,
|
|
458
|
+
Object.defineProperty(E, y, q({ value: E[y] }, g));
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
return
|
|
461
|
+
return o._p.forEach((g) => {
|
|
462
462
|
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ie) {
|
|
463
463
|
const y = s.run(() => g({
|
|
464
464
|
store: E,
|
|
465
|
-
app:
|
|
466
|
-
pinia:
|
|
465
|
+
app: o._a,
|
|
466
|
+
pinia: o,
|
|
467
467
|
options: c
|
|
468
468
|
}));
|
|
469
|
-
Object.keys(y || {}).forEach((D) => E._customProperties.add(D)),
|
|
469
|
+
Object.keys(y || {}).forEach((D) => E._customProperties.add(D)), q(E, y);
|
|
470
470
|
} else
|
|
471
|
-
|
|
471
|
+
q(E, s.run(() => g({
|
|
472
472
|
store: E,
|
|
473
|
-
app:
|
|
474
|
-
pinia:
|
|
473
|
+
app: o._a,
|
|
474
|
+
pinia: o,
|
|
475
475
|
options: c
|
|
476
476
|
})));
|
|
477
477
|
}), process.env.NODE_ENV !== "production" && E.$state && typeof E.$state == "object" && typeof E.$state.constructor == "function" && !E.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
478
478
|
state: () => new MyClass()
|
|
479
|
-
Found in store "${E.$id}".`), m && a && t.hydrate && t.hydrate(E.$state, m), u = !0,
|
|
479
|
+
Found in store "${E.$id}".`), m && a && t.hydrate && t.hydrate(E.$state, m), u = !0, w = !0, E;
|
|
480
480
|
}
|
|
481
481
|
// @__NO_SIDE_EFFECTS__
|
|
482
|
-
function to(
|
|
483
|
-
let
|
|
482
|
+
function to(n, e, t) {
|
|
483
|
+
let o;
|
|
484
484
|
const r = typeof e == "function";
|
|
485
|
-
|
|
485
|
+
o = r ? t : e;
|
|
486
486
|
function a(s, c) {
|
|
487
|
-
const d =
|
|
487
|
+
const d = ze();
|
|
488
488
|
if (s = // in test mode, ignore the argument provided as we can always retrieve a
|
|
489
489
|
// pinia instance with getActivePinia()
|
|
490
|
-
(process.env.NODE_ENV === "test" && oe && oe._testing ? null : s) || (d ?
|
|
490
|
+
(process.env.NODE_ENV === "test" && oe && oe._testing ? null : s) || (d ? we(qe, null) : null), s && $e(s), process.env.NODE_ENV !== "production" && !oe)
|
|
491
491
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
492
492
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
493
493
|
This will fail in production.`);
|
|
494
|
-
s = oe, s._s.has(
|
|
495
|
-
const u = s._s.get(
|
|
494
|
+
s = oe, s._s.has(n) || (r ? Ze(n, e, o, s) : st(n, o, s), process.env.NODE_ENV !== "production" && (a._pinia = s));
|
|
495
|
+
const u = s._s.get(n);
|
|
496
496
|
if (process.env.NODE_ENV !== "production" && c) {
|
|
497
|
-
const
|
|
498
|
-
c._hotUpdate(v), delete s.state.value[
|
|
497
|
+
const w = "__hot:" + n, v = r ? Ze(w, e, o, s, !0) : st(w, q({}, o), s, !0);
|
|
498
|
+
c._hotUpdate(v), delete s.state.value[w], s._s.delete(w);
|
|
499
499
|
}
|
|
500
500
|
if (process.env.NODE_ENV !== "production" && ie) {
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
501
|
+
const w = gt();
|
|
502
|
+
if (w && w.proxy && // avoid adding stores that are just built for hot module replacement
|
|
503
503
|
!c) {
|
|
504
|
-
const v =
|
|
505
|
-
h[
|
|
504
|
+
const v = w.proxy, h = "_pStores" in v ? v._pStores : v._pStores = {};
|
|
505
|
+
h[n] = u;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
return u;
|
|
509
509
|
}
|
|
510
|
-
return a.$id =
|
|
510
|
+
return a.$id = n, a;
|
|
511
511
|
}
|
|
512
|
-
function oo(
|
|
513
|
-
const e = vt(
|
|
514
|
-
for (const
|
|
515
|
-
const r = e[
|
|
516
|
-
r.effect ? t[
|
|
512
|
+
function oo(n) {
|
|
513
|
+
const e = vt(n), t = {};
|
|
514
|
+
for (const o in e) {
|
|
515
|
+
const r = e[o];
|
|
516
|
+
r.effect ? t[o] = // ...
|
|
517
517
|
R({
|
|
518
|
-
get: () => o
|
|
518
|
+
get: () => n[o],
|
|
519
519
|
set(a) {
|
|
520
|
-
o
|
|
520
|
+
n[o] = a;
|
|
521
521
|
}
|
|
522
|
-
}) : (pe(r) ||
|
|
523
|
-
re(
|
|
522
|
+
}) : (pe(r) || Te(r)) && (t[o] = // ---
|
|
523
|
+
re(n, o));
|
|
524
524
|
}
|
|
525
525
|
return t;
|
|
526
526
|
}
|
|
527
527
|
const no = typeof window < "u" && typeof document < "u";
|
|
528
528
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
529
|
-
const ro = Object.prototype.toString, ao = (
|
|
529
|
+
const ro = Object.prototype.toString, ao = (n) => ro.call(n) === "[object Object]", so = () => {
|
|
530
530
|
};
|
|
531
|
-
function io(...
|
|
532
|
-
if (
|
|
533
|
-
const e =
|
|
534
|
-
return typeof e == "function" ?
|
|
531
|
+
function io(...n) {
|
|
532
|
+
if (n.length !== 1) return re(...n);
|
|
533
|
+
const e = n[0];
|
|
534
|
+
return typeof e == "function" ? Pe(et(() => ({
|
|
535
535
|
get: e,
|
|
536
536
|
set: so
|
|
537
|
-
}))) :
|
|
537
|
+
}))) : $(e);
|
|
538
538
|
}
|
|
539
|
-
function lo(
|
|
540
|
-
function t(...
|
|
539
|
+
function lo(n, e) {
|
|
540
|
+
function t(...o) {
|
|
541
541
|
return new Promise((r, a) => {
|
|
542
|
-
Promise.resolve(
|
|
542
|
+
Promise.resolve(n(() => e.apply(this, o), {
|
|
543
543
|
fn: e,
|
|
544
544
|
thisArg: this,
|
|
545
|
-
args:
|
|
545
|
+
args: o
|
|
546
546
|
})).then(r).catch(a);
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
return t;
|
|
550
550
|
}
|
|
551
|
-
const kt = (
|
|
552
|
-
function co(
|
|
553
|
-
const { initialState: t = "active" } = e,
|
|
551
|
+
const kt = (n) => n();
|
|
552
|
+
function co(n = kt, e = {}) {
|
|
553
|
+
const { initialState: t = "active" } = e, o = io(t === "active");
|
|
554
554
|
function r() {
|
|
555
|
-
|
|
555
|
+
o.value = !1;
|
|
556
556
|
}
|
|
557
557
|
function a() {
|
|
558
|
-
|
|
558
|
+
o.value = !0;
|
|
559
559
|
}
|
|
560
560
|
const s = (...c) => {
|
|
561
|
-
|
|
561
|
+
o.value && n(...c);
|
|
562
562
|
};
|
|
563
563
|
return {
|
|
564
|
-
isActive:
|
|
564
|
+
isActive: Pe(o),
|
|
565
565
|
pause: r,
|
|
566
566
|
resume: a,
|
|
567
567
|
eventFilter: s
|
|
568
568
|
};
|
|
569
569
|
}
|
|
570
|
-
function Fe(
|
|
571
|
-
return Array.isArray(
|
|
570
|
+
function Fe(n) {
|
|
571
|
+
return Array.isArray(n) ? n : [n];
|
|
572
572
|
}
|
|
573
|
-
function uo(
|
|
573
|
+
function uo(n) {
|
|
574
574
|
return gt();
|
|
575
575
|
}
|
|
576
|
-
function po(
|
|
577
|
-
const { eventFilter:
|
|
578
|
-
return H(
|
|
576
|
+
function po(n, e, t = {}) {
|
|
577
|
+
const { eventFilter: o = kt, ...r } = t;
|
|
578
|
+
return H(n, lo(o, e), r);
|
|
579
579
|
}
|
|
580
|
-
function fo(
|
|
581
|
-
const { eventFilter:
|
|
580
|
+
function fo(n, e, t = {}) {
|
|
581
|
+
const { eventFilter: o, initialState: r = "active", ...a } = t, { eventFilter: s, pause: c, resume: d, isActive: u } = co(o, { initialState: r });
|
|
582
582
|
return {
|
|
583
|
-
stop: po(
|
|
583
|
+
stop: po(n, e, {
|
|
584
584
|
...a,
|
|
585
585
|
eventFilter: s
|
|
586
586
|
}),
|
|
@@ -589,39 +589,39 @@ function fo(o, e, t = {}) {
|
|
|
589
589
|
isActive: u
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
function ho(
|
|
593
|
-
uo() ? xe(
|
|
592
|
+
function ho(n, e = !0, t) {
|
|
593
|
+
uo() ? xe(n, t) : e ? n() : de(n);
|
|
594
594
|
}
|
|
595
|
-
function vo(
|
|
596
|
-
return H(
|
|
595
|
+
function vo(n, e, t) {
|
|
596
|
+
return H(n, e, {
|
|
597
597
|
...t,
|
|
598
598
|
immediate: !0
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
const Ie = no ? window : void 0;
|
|
602
|
-
function go(
|
|
602
|
+
function go(n) {
|
|
603
603
|
var e;
|
|
604
|
-
const t =
|
|
604
|
+
const t = K(n);
|
|
605
605
|
return (e = t?.$el) !== null && e !== void 0 ? e : t;
|
|
606
606
|
}
|
|
607
|
-
function it(...
|
|
608
|
-
const e = (
|
|
609
|
-
const
|
|
610
|
-
return
|
|
607
|
+
function it(...n) {
|
|
608
|
+
const e = (o, r, a, s) => (o.addEventListener(r, a, s), () => o.removeEventListener(r, a, s)), t = R(() => {
|
|
609
|
+
const o = Fe(K(n[0])).filter((r) => r != null);
|
|
610
|
+
return o.every((r) => typeof r != "string") ? o : void 0;
|
|
611
611
|
});
|
|
612
612
|
return vo(() => {
|
|
613
|
-
var
|
|
613
|
+
var o, r;
|
|
614
614
|
return [
|
|
615
|
-
(
|
|
616
|
-
Fe(
|
|
617
|
-
Fe(Ne(t.value ?
|
|
618
|
-
|
|
615
|
+
(o = (r = t.value) === null || r === void 0 ? void 0 : r.map((a) => go(a))) !== null && o !== void 0 ? o : [Ie].filter((a) => a != null),
|
|
616
|
+
Fe(K(t.value ? n[1] : n[0])),
|
|
617
|
+
Fe(Ne(t.value ? n[2] : n[1])),
|
|
618
|
+
K(t.value ? n[3] : n[2])
|
|
619
619
|
];
|
|
620
|
-
}, ([
|
|
621
|
-
if (!
|
|
622
|
-
const u = ao(s) ? { ...s } : s,
|
|
620
|
+
}, ([o, r, a, s], c, d) => {
|
|
621
|
+
if (!o?.length || !r?.length || !a?.length) return;
|
|
622
|
+
const u = ao(s) ? { ...s } : s, w = o.flatMap((v) => r.flatMap((h) => a.map((b) => e(v, h, b, u))));
|
|
623
623
|
d(() => {
|
|
624
|
-
|
|
624
|
+
w.forEach((v) => v());
|
|
625
625
|
});
|
|
626
626
|
}, { flush: "post" });
|
|
627
627
|
}
|
|
@@ -629,71 +629,71 @@ const Ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window :
|
|
|
629
629
|
function mo() {
|
|
630
630
|
return ke in Ee || (Ee[ke] = Ee[ke] || {}), Ee[ke];
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return yo[
|
|
632
|
+
function wo(n, e) {
|
|
633
|
+
return yo[n] || e;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
635
|
+
function bo(n) {
|
|
636
|
+
return n == null ? "any" : n instanceof Set ? "set" : n instanceof Map ? "map" : n instanceof Date ? "date" : typeof n == "boolean" ? "boolean" : typeof n == "string" ? "string" : typeof n == "object" ? "object" : Number.isNaN(n) ? "any" : "number";
|
|
637
637
|
}
|
|
638
638
|
const So = {
|
|
639
639
|
boolean: {
|
|
640
|
-
read: (
|
|
641
|
-
write: (
|
|
640
|
+
read: (n) => n === "true",
|
|
641
|
+
write: (n) => String(n)
|
|
642
642
|
},
|
|
643
643
|
object: {
|
|
644
|
-
read: (
|
|
645
|
-
write: (
|
|
644
|
+
read: (n) => JSON.parse(n),
|
|
645
|
+
write: (n) => JSON.stringify(n)
|
|
646
646
|
},
|
|
647
647
|
number: {
|
|
648
|
-
read: (
|
|
649
|
-
write: (
|
|
648
|
+
read: (n) => Number.parseFloat(n),
|
|
649
|
+
write: (n) => String(n)
|
|
650
650
|
},
|
|
651
651
|
any: {
|
|
652
|
-
read: (
|
|
653
|
-
write: (
|
|
652
|
+
read: (n) => n,
|
|
653
|
+
write: (n) => String(n)
|
|
654
654
|
},
|
|
655
655
|
string: {
|
|
656
|
-
read: (
|
|
657
|
-
write: (
|
|
656
|
+
read: (n) => n,
|
|
657
|
+
write: (n) => String(n)
|
|
658
658
|
},
|
|
659
659
|
map: {
|
|
660
|
-
read: (
|
|
661
|
-
write: (
|
|
660
|
+
read: (n) => new Map(JSON.parse(n)),
|
|
661
|
+
write: (n) => JSON.stringify(Array.from(n.entries()))
|
|
662
662
|
},
|
|
663
663
|
set: {
|
|
664
|
-
read: (
|
|
665
|
-
write: (
|
|
664
|
+
read: (n) => new Set(JSON.parse(n)),
|
|
665
|
+
write: (n) => JSON.stringify(Array.from(n))
|
|
666
666
|
},
|
|
667
667
|
date: {
|
|
668
|
-
read: (
|
|
669
|
-
write: (
|
|
668
|
+
read: (n) => new Date(n),
|
|
669
|
+
write: (n) => n.toISOString()
|
|
670
670
|
}
|
|
671
671
|
}, lt = "vueuse-storage";
|
|
672
|
-
function _o(
|
|
672
|
+
function _o(n, e, t, o = {}) {
|
|
673
673
|
var r;
|
|
674
|
-
const { flush: a = "pre", deep: s = !0, listenToStorageChanges: c = !0, writeDefaults: d = !0, mergeDefaults: u = !1, shallow:
|
|
674
|
+
const { flush: a = "pre", deep: s = !0, listenToStorageChanges: c = !0, writeDefaults: d = !0, mergeDefaults: u = !1, shallow: w, window: v = Ie, eventFilter: h, onError: b = (N) => {
|
|
675
675
|
console.error(N);
|
|
676
|
-
}, initOnMounted: m } =
|
|
676
|
+
}, initOnMounted: m } = o, k = (w ? Se : $)(e), I = R(() => K(n));
|
|
677
677
|
if (!t) try {
|
|
678
|
-
t =
|
|
678
|
+
t = wo("getDefaultStorage", () => Ie?.localStorage)();
|
|
679
679
|
} catch (N) {
|
|
680
|
-
|
|
680
|
+
b(N);
|
|
681
681
|
}
|
|
682
682
|
if (!t) return k;
|
|
683
|
-
const
|
|
683
|
+
const T = K(e), Z = bo(T), U = (r = o.serializer) !== null && r !== void 0 ? r : So[Z], { pause: z, resume: L } = fo(k, (N) => g(N), {
|
|
684
684
|
flush: a,
|
|
685
685
|
deep: s,
|
|
686
686
|
eventFilter: h
|
|
687
687
|
});
|
|
688
688
|
H(I, () => D(), { flush: a });
|
|
689
|
-
let
|
|
689
|
+
let G = !1;
|
|
690
690
|
const E = (N) => {
|
|
691
|
-
m && !
|
|
691
|
+
m && !G || D(N);
|
|
692
692
|
}, Y = (N) => {
|
|
693
|
-
m && !
|
|
693
|
+
m && !G || F(N);
|
|
694
694
|
};
|
|
695
695
|
v && c && (t instanceof Storage ? it(v, "storage", E, { passive: !0 }) : it(v, lt, Y)), m ? ho(() => {
|
|
696
|
-
|
|
696
|
+
G = !0, D();
|
|
697
697
|
}) : D();
|
|
698
698
|
function B(N, V) {
|
|
699
699
|
if (v) {
|
|
@@ -716,17 +716,17 @@ function _o(o, e, t, n = {}) {
|
|
|
716
716
|
V !== M && (t.setItem(I.value, M), B(V, M));
|
|
717
717
|
}
|
|
718
718
|
} catch (V) {
|
|
719
|
-
|
|
719
|
+
b(V);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
function y(N) {
|
|
723
723
|
const V = N ? N.newValue : t.getItem(I.value);
|
|
724
724
|
if (V == null)
|
|
725
|
-
return d &&
|
|
725
|
+
return d && T != null && t.setItem(I.value, U.write(T)), T;
|
|
726
726
|
if (!N && u) {
|
|
727
727
|
const M = U.read(V);
|
|
728
|
-
return typeof u == "function" ? u(M,
|
|
729
|
-
...
|
|
728
|
+
return typeof u == "function" ? u(M, T) : Z === "object" && !Array.isArray(M) ? {
|
|
729
|
+
...T,
|
|
730
730
|
...M
|
|
731
731
|
} : M;
|
|
732
732
|
} else return typeof V != "string" ? V : U.read(V);
|
|
@@ -734,16 +734,16 @@ function _o(o, e, t, n = {}) {
|
|
|
734
734
|
function D(N) {
|
|
735
735
|
if (!(N && N.storageArea !== t)) {
|
|
736
736
|
if (N && N.key == null) {
|
|
737
|
-
k.value =
|
|
737
|
+
k.value = T;
|
|
738
738
|
return;
|
|
739
739
|
}
|
|
740
740
|
if (!(N && N.key !== I.value)) {
|
|
741
|
-
|
|
741
|
+
z();
|
|
742
742
|
try {
|
|
743
743
|
const V = U.write(k.value);
|
|
744
744
|
(N === void 0 || N?.newValue !== V) && (k.value = y(N));
|
|
745
745
|
} catch (V) {
|
|
746
|
-
|
|
746
|
+
b(V);
|
|
747
747
|
} finally {
|
|
748
748
|
N ? de(L) : L();
|
|
749
749
|
}
|
|
@@ -755,80 +755,80 @@ function _o(o, e, t, n = {}) {
|
|
|
755
755
|
}
|
|
756
756
|
return k;
|
|
757
757
|
}
|
|
758
|
-
function Eo(
|
|
759
|
-
const { window:
|
|
760
|
-
return _o(
|
|
758
|
+
function Eo(n, e, t = {}) {
|
|
759
|
+
const { window: o = Ie } = t;
|
|
760
|
+
return _o(n, e, o?.localStorage, t);
|
|
761
761
|
}
|
|
762
762
|
function Le() {
|
|
763
763
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Ce(n) {
|
|
766
766
|
const e = {
|
|
767
|
-
type:
|
|
768
|
-
clientId:
|
|
769
|
-
timestamp:
|
|
767
|
+
type: n.type,
|
|
768
|
+
clientId: n.clientId,
|
|
769
|
+
timestamp: n.timestamp.toISOString()
|
|
770
770
|
};
|
|
771
|
-
return
|
|
772
|
-
...
|
|
773
|
-
timestamp:
|
|
774
|
-
}),
|
|
771
|
+
return n.operation && (e.operation = {
|
|
772
|
+
...n.operation,
|
|
773
|
+
timestamp: n.operation.timestamp.toISOString()
|
|
774
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
775
775
|
...t,
|
|
776
776
|
timestamp: t.timestamp.toISOString()
|
|
777
777
|
}))), e;
|
|
778
778
|
}
|
|
779
|
-
function ko(
|
|
779
|
+
function ko(n) {
|
|
780
780
|
const e = {
|
|
781
|
-
type:
|
|
782
|
-
clientId:
|
|
783
|
-
timestamp: new Date(
|
|
781
|
+
type: n.type,
|
|
782
|
+
clientId: n.clientId,
|
|
783
|
+
timestamp: new Date(n.timestamp)
|
|
784
784
|
};
|
|
785
|
-
return
|
|
786
|
-
...
|
|
787
|
-
timestamp: new Date(
|
|
788
|
-
}),
|
|
785
|
+
return n.operation && (e.operation = {
|
|
786
|
+
...n.operation,
|
|
787
|
+
timestamp: new Date(n.operation.timestamp)
|
|
788
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
789
789
|
...t,
|
|
790
790
|
timestamp: new Date(t.timestamp)
|
|
791
791
|
}))), e;
|
|
792
792
|
}
|
|
793
|
-
const
|
|
794
|
-
const
|
|
793
|
+
const Ct = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
794
|
+
const n = $({
|
|
795
795
|
maxOperations: 100,
|
|
796
796
|
enableCrossTabSync: !0,
|
|
797
797
|
autoSyncInterval: 3e4,
|
|
798
798
|
enablePersistence: !1,
|
|
799
799
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
800
|
-
}), e =
|
|
800
|
+
}), e = $([]), t = $(-1), o = $(Le()), r = $(!1), a = $([]), s = $(null), c = R(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), d = R(() => t.value < e.value.length - 1), u = R(() => {
|
|
801
801
|
let p = 0;
|
|
802
802
|
for (let f = t.value; f >= 0 && e.value[f]?.reversible; f--)
|
|
803
803
|
p++;
|
|
804
804
|
return p;
|
|
805
|
-
}),
|
|
805
|
+
}), w = R(() => e.value.length - 1 - t.value), v = R(() => ({
|
|
806
806
|
canUndo: c.value,
|
|
807
807
|
canRedo: d.value,
|
|
808
808
|
undoCount: u.value,
|
|
809
|
-
redoCount:
|
|
809
|
+
redoCount: w.value,
|
|
810
810
|
currentIndex: t.value
|
|
811
811
|
}));
|
|
812
812
|
function h(p) {
|
|
813
|
-
|
|
813
|
+
n.value = { ...n.value, ...p }, n.value.enablePersistence && (_(), S()), n.value.enableCrossTabSync && y();
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function b(p, f = "user") {
|
|
816
816
|
const i = {
|
|
817
817
|
...p,
|
|
818
818
|
id: Le(),
|
|
819
819
|
timestamp: /* @__PURE__ */ new Date(),
|
|
820
820
|
source: f,
|
|
821
|
-
userId:
|
|
821
|
+
userId: n.value.userId
|
|
822
822
|
};
|
|
823
|
-
if (
|
|
823
|
+
if (n.value.operationFilter && !n.value.operationFilter(i))
|
|
824
824
|
return i.id;
|
|
825
825
|
if (r.value)
|
|
826
826
|
return a.value.push(i), i.id;
|
|
827
|
-
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(i), t.value++,
|
|
828
|
-
const l = e.value.length -
|
|
827
|
+
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(i), t.value++, n.value.maxOperations && e.value.length > n.value.maxOperations) {
|
|
828
|
+
const l = e.value.length - n.value.maxOperations;
|
|
829
829
|
e.value = e.value.slice(l), t.value -= l;
|
|
830
830
|
}
|
|
831
|
-
return
|
|
831
|
+
return n.value.enableCrossTabSync && D(i), i.id;
|
|
832
832
|
}
|
|
833
833
|
function m() {
|
|
834
834
|
r.value = !0, a.value = [], s.value = Le();
|
|
@@ -836,7 +836,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
836
836
|
function k(p) {
|
|
837
837
|
if (!r.value || a.value.length === 0)
|
|
838
838
|
return r.value = !1, a.value = [], s.value = null, null;
|
|
839
|
-
const f = s.value, i = a.value.every((
|
|
839
|
+
const f = s.value, i = a.value.every((O) => O.reversible), l = {
|
|
840
840
|
id: f,
|
|
841
841
|
type: "batch",
|
|
842
842
|
path: "",
|
|
@@ -849,19 +849,19 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
849
849
|
source: "user",
|
|
850
850
|
reversible: i,
|
|
851
851
|
irreversibleReason: i ? void 0 : "Contains irreversible operations",
|
|
852
|
-
childOperationIds: a.value.map((
|
|
852
|
+
childOperationIds: a.value.map((O) => O.id),
|
|
853
853
|
metadata: { description: p }
|
|
854
854
|
};
|
|
855
|
-
a.value.forEach((
|
|
856
|
-
|
|
857
|
-
}), e.value.push(...a.value, l), t.value = e.value.length - 1,
|
|
855
|
+
a.value.forEach((O) => {
|
|
856
|
+
O.parentOperationId = f;
|
|
857
|
+
}), e.value.push(...a.value, l), t.value = e.value.length - 1, n.value.enableCrossTabSync && F(a.value, l);
|
|
858
858
|
const A = f;
|
|
859
859
|
return r.value = !1, a.value = [], s.value = null, A;
|
|
860
860
|
}
|
|
861
861
|
function I() {
|
|
862
862
|
r.value = !1, a.value = [], s.value = null;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function T(p) {
|
|
865
865
|
if (!c.value) return !1;
|
|
866
866
|
const f = e.value[t.value];
|
|
867
867
|
if (!f.reversible)
|
|
@@ -869,12 +869,12 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
869
869
|
try {
|
|
870
870
|
if (f.type === "batch" && f.childOperationIds)
|
|
871
871
|
for (let i = f.childOperationIds.length - 1; i >= 0; i--) {
|
|
872
|
-
const l = f.childOperationIds[i], A = e.value.find((
|
|
872
|
+
const l = f.childOperationIds[i], A = e.value.find((O) => O.id === l);
|
|
873
873
|
A && U(A, p);
|
|
874
874
|
}
|
|
875
875
|
else
|
|
876
876
|
U(f, p);
|
|
877
|
-
return t.value--,
|
|
877
|
+
return t.value--, n.value.enableCrossTabSync && N(f), !0;
|
|
878
878
|
} catch (i) {
|
|
879
879
|
return typeof console < "u" && console.error("Undo failed:", i), !1;
|
|
880
880
|
}
|
|
@@ -886,11 +886,11 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
886
886
|
if (f.type === "batch" && f.childOperationIds)
|
|
887
887
|
for (const i of f.childOperationIds) {
|
|
888
888
|
const l = e.value.find((A) => A.id === i);
|
|
889
|
-
l &&
|
|
889
|
+
l && z(l, p);
|
|
890
890
|
}
|
|
891
891
|
else
|
|
892
|
-
|
|
893
|
-
return t.value++,
|
|
892
|
+
z(f, p);
|
|
893
|
+
return t.value++, n.value.enableCrossTabSync && V(f), !0;
|
|
894
894
|
} catch (i) {
|
|
895
895
|
return typeof console < "u" && console.error("Redo failed:", i), !1;
|
|
896
896
|
}
|
|
@@ -898,7 +898,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
898
898
|
function U(p, f) {
|
|
899
899
|
(p.type === "set" || p.type === "delete") && f && typeof f.set == "function" && f.set(p.path, p.beforeValue, "undo");
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function z(p, f) {
|
|
902
902
|
(p.type === "set" || p.type === "delete") && f && typeof f.set == "function" && f.set(p.path, p.afterValue, "redo");
|
|
903
903
|
}
|
|
904
904
|
function L() {
|
|
@@ -913,7 +913,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
913
913
|
newestOperation: f.length > 0 ? new Date(Math.max(...f.map((i) => i.getTime()))) : void 0
|
|
914
914
|
};
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function G() {
|
|
917
917
|
e.value = [], t.value = -1;
|
|
918
918
|
}
|
|
919
919
|
function E(p, f) {
|
|
@@ -924,7 +924,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
924
924
|
i && (i.reversible = !1, i.irreversibleReason = f);
|
|
925
925
|
}
|
|
926
926
|
function B(p, f, i, l = "success", A) {
|
|
927
|
-
const
|
|
927
|
+
const O = {
|
|
928
928
|
type: "action",
|
|
929
929
|
path: i && i.length > 0 ? `${p}.${i[0]}` : p,
|
|
930
930
|
fieldname: "",
|
|
@@ -939,7 +939,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
939
939
|
actionResult: l,
|
|
940
940
|
actionError: A
|
|
941
941
|
};
|
|
942
|
-
return
|
|
942
|
+
return b(O);
|
|
943
943
|
}
|
|
944
944
|
let g = null;
|
|
945
945
|
function y() {
|
|
@@ -947,7 +947,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
947
947
|
const f = p.data;
|
|
948
948
|
if (!f || typeof f != "object") return;
|
|
949
949
|
const i = ko(f);
|
|
950
|
-
i.clientId !==
|
|
950
|
+
i.clientId !== o.value && (i.type === "operation" && i.operation ? (e.value.push({ ...i.operation, source: "sync" }), t.value = e.value.length - 1) : i.type === "operation" && i.operations && (e.value.push(...i.operations.map((l) => ({ ...l, source: "sync" }))), t.value = e.value.length - 1));
|
|
951
951
|
}));
|
|
952
952
|
}
|
|
953
953
|
function D(p) {
|
|
@@ -955,40 +955,40 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
955
955
|
const f = {
|
|
956
956
|
type: "operation",
|
|
957
957
|
operation: p,
|
|
958
|
-
clientId:
|
|
958
|
+
clientId: o.value,
|
|
959
959
|
timestamp: /* @__PURE__ */ new Date()
|
|
960
960
|
};
|
|
961
|
-
g.postMessage(
|
|
961
|
+
g.postMessage(Ce(f));
|
|
962
962
|
}
|
|
963
963
|
function F(p, f) {
|
|
964
964
|
if (!g) return;
|
|
965
965
|
const i = {
|
|
966
966
|
type: "operation",
|
|
967
967
|
operations: [...p, f],
|
|
968
|
-
clientId:
|
|
968
|
+
clientId: o.value,
|
|
969
969
|
timestamp: /* @__PURE__ */ new Date()
|
|
970
970
|
};
|
|
971
|
-
g.postMessage(
|
|
971
|
+
g.postMessage(Ce(i));
|
|
972
972
|
}
|
|
973
973
|
function N(p) {
|
|
974
974
|
if (!g) return;
|
|
975
975
|
const f = {
|
|
976
976
|
type: "undo",
|
|
977
977
|
operation: p,
|
|
978
|
-
clientId:
|
|
978
|
+
clientId: o.value,
|
|
979
979
|
timestamp: /* @__PURE__ */ new Date()
|
|
980
980
|
};
|
|
981
|
-
g.postMessage(
|
|
981
|
+
g.postMessage(Ce(f));
|
|
982
982
|
}
|
|
983
983
|
function V(p) {
|
|
984
984
|
if (!g) return;
|
|
985
985
|
const f = {
|
|
986
986
|
type: "redo",
|
|
987
987
|
operation: p,
|
|
988
|
-
clientId:
|
|
988
|
+
clientId: o.value,
|
|
989
989
|
timestamp: /* @__PURE__ */ new Date()
|
|
990
990
|
};
|
|
991
|
-
g.postMessage(
|
|
991
|
+
g.postMessage(Ce(f));
|
|
992
992
|
}
|
|
993
993
|
const M = Eo("stonecrop-ops-operations", null, {
|
|
994
994
|
serializer: {
|
|
@@ -1014,7 +1014,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
1014
1014
|
typeof console < "u" && console.error("Failed to load operations from persistence:", p);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function C() {
|
|
1018
1018
|
if (!(typeof window > "u"))
|
|
1019
1019
|
try {
|
|
1020
1020
|
M.value = {
|
|
@@ -1032,7 +1032,7 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
1032
1032
|
H(
|
|
1033
1033
|
[e, t],
|
|
1034
1034
|
() => {
|
|
1035
|
-
|
|
1035
|
+
n.value.enablePersistence && C();
|
|
1036
1036
|
},
|
|
1037
1037
|
{ deep: !0 }
|
|
1038
1038
|
);
|
|
@@ -1041,23 +1041,23 @@ const Ot = /* @__PURE__ */ to("hst-operation-log", () => {
|
|
|
1041
1041
|
// State
|
|
1042
1042
|
operations: e,
|
|
1043
1043
|
currentIndex: t,
|
|
1044
|
-
config:
|
|
1045
|
-
clientId:
|
|
1044
|
+
config: n,
|
|
1045
|
+
clientId: o,
|
|
1046
1046
|
undoRedoState: v,
|
|
1047
1047
|
// Computed
|
|
1048
1048
|
canUndo: c,
|
|
1049
1049
|
canRedo: d,
|
|
1050
1050
|
undoCount: u,
|
|
1051
|
-
redoCount:
|
|
1051
|
+
redoCount: w,
|
|
1052
1052
|
// Methods
|
|
1053
1053
|
configure: h,
|
|
1054
|
-
addOperation:
|
|
1054
|
+
addOperation: b,
|
|
1055
1055
|
startBatch: m,
|
|
1056
1056
|
commitBatch: k,
|
|
1057
1057
|
cancelBatch: I,
|
|
1058
|
-
undo:
|
|
1058
|
+
undo: T,
|
|
1059
1059
|
redo: Z,
|
|
1060
|
-
clear:
|
|
1060
|
+
clear: G,
|
|
1061
1061
|
getOperationsFor: E,
|
|
1062
1062
|
getSnapshot: L,
|
|
1063
1063
|
markIrreversible: Y,
|
|
@@ -1116,8 +1116,8 @@ class ge {
|
|
|
1116
1116
|
* @param fieldname - The field name
|
|
1117
1117
|
* @param enableRollback - Whether to enable rollback
|
|
1118
1118
|
*/
|
|
1119
|
-
setFieldRollback(e, t,
|
|
1120
|
-
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t,
|
|
1119
|
+
setFieldRollback(e, t, o) {
|
|
1120
|
+
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, o);
|
|
1121
1121
|
}
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Get rollback configuration for a specific field trigger
|
|
@@ -1133,25 +1133,25 @@ class ge {
|
|
|
1133
1133
|
*/
|
|
1134
1134
|
registerDoctypeActions(e, t) {
|
|
1135
1135
|
if (!t) return;
|
|
1136
|
-
const
|
|
1136
|
+
const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1137
1137
|
if (typeof t.entrySeq == "function")
|
|
1138
1138
|
t.entrySeq().forEach(([a, s]) => {
|
|
1139
|
-
this.categorizeAction(a, s,
|
|
1139
|
+
this.categorizeAction(a, s, o, r);
|
|
1140
1140
|
});
|
|
1141
1141
|
else if (t instanceof Map)
|
|
1142
1142
|
for (const [a, s] of t)
|
|
1143
|
-
this.categorizeAction(a, s,
|
|
1143
|
+
this.categorizeAction(a, s, o, r);
|
|
1144
1144
|
else t && typeof t == "object" && Object.entries(t).forEach(([a, s]) => {
|
|
1145
|
-
this.categorizeAction(a, s,
|
|
1145
|
+
this.categorizeAction(a, s, o, r);
|
|
1146
1146
|
});
|
|
1147
|
-
this.doctypeActions.set(e,
|
|
1147
|
+
this.doctypeActions.set(e, o), this.doctypeTransitions.set(e, r);
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
1150
1150
|
* Categorize an action as either a field trigger or XState transition
|
|
1151
1151
|
* Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
|
|
1152
1152
|
*/
|
|
1153
|
-
categorizeAction(e, t,
|
|
1154
|
-
this.isTransitionKey(e) ? r.set(e, t) :
|
|
1153
|
+
categorizeAction(e, t, o, r) {
|
|
1154
|
+
this.isTransitionKey(e) ? r.set(e, t) : o.set(e, t);
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
1157
|
* Determine if a key represents an XState transition
|
|
@@ -1166,7 +1166,7 @@ class ge {
|
|
|
1166
1166
|
* @param options - Execution options (timeout and enableRollback)
|
|
1167
1167
|
*/
|
|
1168
1168
|
async executeFieldTriggers(e, t = {}) {
|
|
1169
|
-
const { doctype:
|
|
1169
|
+
const { doctype: o, fieldname: r } = e, a = this.findFieldTriggers(o, r);
|
|
1170
1170
|
if (a.length === 0)
|
|
1171
1171
|
return {
|
|
1172
1172
|
path: e.path,
|
|
@@ -1177,9 +1177,9 @@ class ge {
|
|
|
1177
1177
|
rolledBack: !1
|
|
1178
1178
|
};
|
|
1179
1179
|
const s = performance.now(), c = [];
|
|
1180
|
-
let d = !1, u = !1,
|
|
1181
|
-
const v = this.getFieldRollback(
|
|
1182
|
-
h && e.store && (
|
|
1180
|
+
let d = !1, u = !1, w;
|
|
1181
|
+
const v = this.getFieldRollback(o, r), h = t.enableRollback ?? v ?? this.options.enableRollback;
|
|
1182
|
+
h && e.store && (w = this.captureSnapshot(e));
|
|
1183
1183
|
for (const k of a)
|
|
1184
1184
|
try {
|
|
1185
1185
|
const I = await this.executeAction(k, e, t.timeout);
|
|
@@ -1188,22 +1188,22 @@ class ge {
|
|
|
1188
1188
|
break;
|
|
1189
1189
|
}
|
|
1190
1190
|
} catch (I) {
|
|
1191
|
-
const
|
|
1191
|
+
const T = {
|
|
1192
1192
|
success: !1,
|
|
1193
1193
|
error: I instanceof Error ? I : new Error(String(I)),
|
|
1194
1194
|
executionTime: 0,
|
|
1195
1195
|
action: k
|
|
1196
1196
|
};
|
|
1197
|
-
c.push(
|
|
1197
|
+
c.push(T), d = !0;
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
|
-
if (h && d &&
|
|
1200
|
+
if (h && d && w && e.store)
|
|
1201
1201
|
try {
|
|
1202
|
-
this.restoreSnapshot(e,
|
|
1202
|
+
this.restoreSnapshot(e, w), u = !0;
|
|
1203
1203
|
} catch (k) {
|
|
1204
1204
|
console.error("[FieldTriggers] Rollback failed:", k);
|
|
1205
1205
|
}
|
|
1206
|
-
const
|
|
1206
|
+
const b = performance.now() - s, m = c.filter((k) => !k.success);
|
|
1207
1207
|
if (m.length > 0 && this.options.errorHandler)
|
|
1208
1208
|
for (const k of m)
|
|
1209
1209
|
try {
|
|
@@ -1214,11 +1214,11 @@ class ge {
|
|
|
1214
1214
|
return {
|
|
1215
1215
|
path: e.path,
|
|
1216
1216
|
actionResults: c,
|
|
1217
|
-
totalExecutionTime:
|
|
1217
|
+
totalExecutionTime: b,
|
|
1218
1218
|
allSucceeded: c.every((k) => k.success),
|
|
1219
1219
|
stoppedOnError: d,
|
|
1220
1220
|
rolledBack: u,
|
|
1221
|
-
snapshot: this.options.debug && h ?
|
|
1221
|
+
snapshot: this.options.debug && h ? w : void 0
|
|
1222
1222
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
@@ -1229,7 +1229,7 @@ class ge {
|
|
|
1229
1229
|
* @param options - Execution options (timeout)
|
|
1230
1230
|
*/
|
|
1231
1231
|
async executeTransitionActions(e, t = {}) {
|
|
1232
|
-
const { doctype:
|
|
1232
|
+
const { doctype: o, transition: r } = e, a = this.findTransitionActions(o, r);
|
|
1233
1233
|
if (a.length === 0)
|
|
1234
1234
|
return [];
|
|
1235
1235
|
const s = [];
|
|
@@ -1239,14 +1239,14 @@ class ge {
|
|
|
1239
1239
|
if (s.push(u), !u.success)
|
|
1240
1240
|
break;
|
|
1241
1241
|
} catch (u) {
|
|
1242
|
-
const
|
|
1242
|
+
const w = {
|
|
1243
1243
|
success: !1,
|
|
1244
1244
|
error: u instanceof Error ? u : new Error(String(u)),
|
|
1245
1245
|
executionTime: 0,
|
|
1246
1246
|
action: d,
|
|
1247
1247
|
transition: r
|
|
1248
1248
|
};
|
|
1249
|
-
s.push(
|
|
1249
|
+
s.push(w);
|
|
1250
1250
|
break;
|
|
1251
1251
|
}
|
|
1252
1252
|
const c = s.filter((d) => !d.success);
|
|
@@ -1263,14 +1263,14 @@ class ge {
|
|
|
1263
1263
|
* Find transition actions for a specific doctype and transition
|
|
1264
1264
|
*/
|
|
1265
1265
|
findTransitionActions(e, t) {
|
|
1266
|
-
const
|
|
1267
|
-
return
|
|
1266
|
+
const o = this.doctypeTransitions.get(e);
|
|
1267
|
+
return o ? o.get(t) || [] : [];
|
|
1268
1268
|
}
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Execute a single transition action by name
|
|
1271
1271
|
*/
|
|
1272
|
-
async executeTransitionAction(e, t,
|
|
1273
|
-
const r = performance.now(), a =
|
|
1272
|
+
async executeTransitionAction(e, t, o) {
|
|
1273
|
+
const r = performance.now(), a = o ?? this.options.defaultTimeout;
|
|
1274
1274
|
try {
|
|
1275
1275
|
let s = this.globalTransitionActions.get(e);
|
|
1276
1276
|
if (!s) {
|
|
@@ -1301,10 +1301,10 @@ class ge {
|
|
|
1301
1301
|
* Field triggers are identified by keys that look like field paths (contain dots or match field names)
|
|
1302
1302
|
*/
|
|
1303
1303
|
findFieldTriggers(e, t) {
|
|
1304
|
-
const
|
|
1305
|
-
if (!
|
|
1304
|
+
const o = this.doctypeActions.get(e);
|
|
1305
|
+
if (!o) return [];
|
|
1306
1306
|
const r = [];
|
|
1307
|
-
for (const [a, s] of
|
|
1307
|
+
for (const [a, s] of o)
|
|
1308
1308
|
this.isFieldTriggerKey(a, t) && r.push(...s);
|
|
1309
1309
|
return r;
|
|
1310
1310
|
}
|
|
@@ -1323,11 +1323,11 @@ class ge {
|
|
|
1323
1323
|
* Supports wildcards (*) for dynamic segments
|
|
1324
1324
|
*/
|
|
1325
1325
|
matchFieldPattern(e, t) {
|
|
1326
|
-
const
|
|
1327
|
-
if (
|
|
1326
|
+
const o = e.split("."), r = t.split(".");
|
|
1327
|
+
if (o.length !== r.length)
|
|
1328
1328
|
return !1;
|
|
1329
|
-
for (let a = 0; a <
|
|
1330
|
-
const s =
|
|
1329
|
+
for (let a = 0; a < o.length; a++) {
|
|
1330
|
+
const s = o[a], c = r[a];
|
|
1331
1331
|
if (s !== "*" && s !== c)
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
}
|
|
@@ -1336,8 +1336,8 @@ class ge {
|
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Execute a single action by name
|
|
1338
1338
|
*/
|
|
1339
|
-
async executeAction(e, t,
|
|
1340
|
-
const r = performance.now(), a =
|
|
1339
|
+
async executeAction(e, t, o) {
|
|
1340
|
+
const r = performance.now(), a = o ?? this.options.defaultTimeout;
|
|
1341
1341
|
try {
|
|
1342
1342
|
const s = this.globalActions.get(e);
|
|
1343
1343
|
if (!s)
|
|
@@ -1360,11 +1360,11 @@ class ge {
|
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Execute a function with timeout
|
|
1362
1362
|
*/
|
|
1363
|
-
async executeWithTimeout(e, t,
|
|
1363
|
+
async executeWithTimeout(e, t, o) {
|
|
1364
1364
|
return new Promise((r, a) => {
|
|
1365
1365
|
const s = setTimeout(() => {
|
|
1366
|
-
a(new Error(`Action timeout after ${
|
|
1367
|
-
},
|
|
1366
|
+
a(new Error(`Action timeout after ${o}ms`));
|
|
1367
|
+
}, o);
|
|
1368
1368
|
Promise.resolve(e(t)).then((c) => {
|
|
1369
1369
|
clearTimeout(s), r(c);
|
|
1370
1370
|
}).catch((c) => {
|
|
@@ -1379,8 +1379,8 @@ class ge {
|
|
|
1379
1379
|
captureSnapshot(e) {
|
|
1380
1380
|
if (!(!e.store || !e.doctype || !e.recordId))
|
|
1381
1381
|
try {
|
|
1382
|
-
const t = `${e.doctype}.${e.recordId}`,
|
|
1383
|
-
return !
|
|
1382
|
+
const t = `${e.doctype}.${e.recordId}`, o = e.store.get(t);
|
|
1383
|
+
return !o || typeof o != "object" ? void 0 : JSON.parse(JSON.stringify(o));
|
|
1384
1384
|
} catch (t) {
|
|
1385
1385
|
this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", t);
|
|
1386
1386
|
return;
|
|
@@ -1393,19 +1393,19 @@ class ge {
|
|
|
1393
1393
|
restoreSnapshot(e, t) {
|
|
1394
1394
|
if (!(!e.store || !e.doctype || !e.recordId || !t))
|
|
1395
1395
|
try {
|
|
1396
|
-
const
|
|
1397
|
-
e.store.set(
|
|
1398
|
-
} catch (
|
|
1399
|
-
throw console.error("[FieldTriggers] Failed to restore snapshot:",
|
|
1396
|
+
const o = `${e.doctype}.${e.recordId}`;
|
|
1397
|
+
e.store.set(o, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${o} to previous state`);
|
|
1398
|
+
} catch (o) {
|
|
1399
|
+
throw console.error("[FieldTriggers] Failed to restore snapshot:", o), o;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
function ct(
|
|
1404
|
-
return new ge(
|
|
1403
|
+
function ct(n) {
|
|
1404
|
+
return new ge(n);
|
|
1405
1405
|
}
|
|
1406
1406
|
function ut() {
|
|
1407
1407
|
try {
|
|
1408
|
-
return
|
|
1408
|
+
return Ct();
|
|
1409
1409
|
} catch {
|
|
1410
1410
|
return null;
|
|
1411
1411
|
}
|
|
@@ -1458,8 +1458,8 @@ class Re {
|
|
|
1458
1458
|
doctype;
|
|
1459
1459
|
parentDoctype;
|
|
1460
1460
|
hst;
|
|
1461
|
-
constructor(e, t,
|
|
1462
|
-
return this.target = e, this.parentPath =
|
|
1461
|
+
constructor(e, t, o = "", r = null, a) {
|
|
1462
|
+
return this.target = e, this.parentPath = o, this.rootNode = r || this, this.doctype = t, this.parentDoctype = a, this.hst = le.getInstance(), new Proxy(this, {
|
|
1463
1463
|
get(s, c) {
|
|
1464
1464
|
if (c in s) return s[c];
|
|
1465
1465
|
const d = String(c);
|
|
@@ -1476,21 +1476,21 @@ class Re {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
// Method to get a tree-wrapped node for navigation
|
|
1478
1478
|
getNode(e) {
|
|
1479
|
-
const t = this.resolvePath(e),
|
|
1479
|
+
const t = this.resolvePath(e), o = this.resolveValue(e), r = t.split(".");
|
|
1480
1480
|
let a = this.doctype;
|
|
1481
|
-
return this.doctype === "StonecropStore" && r.length >= 1 && (a = r[0]), typeof
|
|
1481
|
+
return this.doctype === "StonecropStore" && r.length >= 1 && (a = r[0]), typeof o == "object" && o !== null && !this.isPrimitive(o) ? new Re(o, a, t, this.rootNode, this.parentDoctype) : new Re(o, a, t, this.rootNode, this.parentDoctype);
|
|
1482
1482
|
}
|
|
1483
|
-
set(e, t,
|
|
1483
|
+
set(e, t, o = "user") {
|
|
1484
1484
|
const r = this.resolvePath(e), a = this.has(e) ? this.get(e) : void 0;
|
|
1485
|
-
if (
|
|
1485
|
+
if (o !== "undo" && o !== "redo") {
|
|
1486
1486
|
const s = ut();
|
|
1487
1487
|
if (s && typeof s.addOperation == "function") {
|
|
1488
|
-
const c = r.split("."), d = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0,
|
|
1488
|
+
const c = r.split("."), d = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, w = c.slice(2).join(".") || c[c.length - 1], v = t === void 0 && a !== void 0 ? "delete" : "set";
|
|
1489
1489
|
s.addOperation(
|
|
1490
1490
|
{
|
|
1491
1491
|
type: v,
|
|
1492
1492
|
path: r,
|
|
1493
|
-
fieldname:
|
|
1493
|
+
fieldname: w,
|
|
1494
1494
|
beforeValue: a,
|
|
1495
1495
|
afterValue: t,
|
|
1496
1496
|
doctype: d,
|
|
@@ -1498,7 +1498,7 @@ class Re {
|
|
|
1498
1498
|
reversible: !0
|
|
1499
1499
|
// Default to reversible, can be changed by field triggers
|
|
1500
1500
|
},
|
|
1501
|
-
|
|
1501
|
+
o
|
|
1502
1502
|
);
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
@@ -1509,14 +1509,14 @@ class Re {
|
|
|
1509
1509
|
if (e === "")
|
|
1510
1510
|
return !0;
|
|
1511
1511
|
const t = this.parsePath(e);
|
|
1512
|
-
let
|
|
1512
|
+
let o = this.target;
|
|
1513
1513
|
for (let r = 0; r < t.length; r++) {
|
|
1514
1514
|
const a = t[r];
|
|
1515
|
-
if (
|
|
1515
|
+
if (o == null)
|
|
1516
1516
|
return !1;
|
|
1517
1517
|
if (r === t.length - 1)
|
|
1518
|
-
return this.isImmutable(
|
|
1519
|
-
|
|
1518
|
+
return this.isImmutable(o) ? o.has(a) : this.isPiniaStore(o) && o.$state && a in o.$state || a in o;
|
|
1519
|
+
o = this.getProperty(o, a);
|
|
1520
1520
|
}
|
|
1521
1521
|
return !1;
|
|
1522
1522
|
} catch {
|
|
@@ -1545,7 +1545,7 @@ class Re {
|
|
|
1545
1545
|
* Trigger an XState transition with optional context data
|
|
1546
1546
|
*/
|
|
1547
1547
|
async triggerTransition(e, t) {
|
|
1548
|
-
const
|
|
1548
|
+
const o = ct(), r = this.parentPath.split(".");
|
|
1549
1549
|
let a = this.doctype, s;
|
|
1550
1550
|
this.doctype === "StonecropStore" && r.length >= 1 && (a = r[0]), r.length >= 2 && (s = r[1]);
|
|
1551
1551
|
const c = {
|
|
@@ -1583,7 +1583,7 @@ class Re {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
},
|
|
1585
1585
|
"user"
|
|
1586
|
-
), await
|
|
1586
|
+
), await o.executeTransitionActions(c);
|
|
1587
1587
|
}
|
|
1588
1588
|
// Private helper methods
|
|
1589
1589
|
resolvePath(e) {
|
|
@@ -1593,20 +1593,20 @@ class Re {
|
|
|
1593
1593
|
if (e === "")
|
|
1594
1594
|
return this.target;
|
|
1595
1595
|
const t = this.parsePath(e);
|
|
1596
|
-
let
|
|
1596
|
+
let o = this.target;
|
|
1597
1597
|
for (const r of t) {
|
|
1598
|
-
if (
|
|
1598
|
+
if (o == null)
|
|
1599
1599
|
return;
|
|
1600
|
-
|
|
1600
|
+
o = this.getProperty(o, r);
|
|
1601
1601
|
}
|
|
1602
|
-
return
|
|
1602
|
+
return o;
|
|
1603
1603
|
}
|
|
1604
1604
|
updateValue(e, t) {
|
|
1605
1605
|
if (e === "")
|
|
1606
1606
|
throw new Error("Cannot set value on empty path");
|
|
1607
|
-
const
|
|
1607
|
+
const o = this.parsePath(e), r = o.pop();
|
|
1608
1608
|
let a = this.target;
|
|
1609
|
-
for (const s of
|
|
1609
|
+
for (const s of o)
|
|
1610
1610
|
if (a = this.getProperty(a, s), a == null)
|
|
1611
1611
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1612
1612
|
this.setProperty(a, r, t);
|
|
@@ -1614,18 +1614,18 @@ class Re {
|
|
|
1614
1614
|
getProperty(e, t) {
|
|
1615
1615
|
return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
|
|
1616
1616
|
}
|
|
1617
|
-
setProperty(e, t,
|
|
1617
|
+
setProperty(e, t, o) {
|
|
1618
1618
|
if (this.isImmutable(e))
|
|
1619
1619
|
throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
|
|
1620
1620
|
if (this.isPiniaStore(e)) {
|
|
1621
|
-
e.$patch ? e.$patch({ [t]:
|
|
1621
|
+
e.$patch ? e.$patch({ [t]: o }) : e[t] = o;
|
|
1622
1622
|
return;
|
|
1623
1623
|
}
|
|
1624
|
-
e[t] =
|
|
1624
|
+
e[t] = o;
|
|
1625
1625
|
}
|
|
1626
|
-
async triggerFieldActions(e, t,
|
|
1626
|
+
async triggerFieldActions(e, t, o) {
|
|
1627
1627
|
try {
|
|
1628
|
-
if (!e || typeof e != "string" || Object.is(t,
|
|
1628
|
+
if (!e || typeof e != "string" || Object.is(t, o))
|
|
1629
1629
|
return;
|
|
1630
1630
|
const r = e.split(".");
|
|
1631
1631
|
if (r.length < 3)
|
|
@@ -1639,7 +1639,7 @@ class Re {
|
|
|
1639
1639
|
path: e,
|
|
1640
1640
|
fieldname: s,
|
|
1641
1641
|
beforeValue: t,
|
|
1642
|
-
afterValue:
|
|
1642
|
+
afterValue: o,
|
|
1643
1643
|
operation: "set",
|
|
1644
1644
|
doctype: c,
|
|
1645
1645
|
recordId: d,
|
|
@@ -1661,7 +1661,7 @@ class Re {
|
|
|
1661
1661
|
isImmutable(e) {
|
|
1662
1662
|
if (!e || typeof e != "object")
|
|
1663
1663
|
return !1;
|
|
1664
|
-
const t = "get" in e && typeof e.get == "function",
|
|
1664
|
+
const t = "get" in e && typeof e.get == "function", o = "set" in e && typeof e.set == "function", r = "has" in e && typeof e.has == "function", a = "__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 && t && o;
|
|
1665
1665
|
let s;
|
|
1666
1666
|
try {
|
|
1667
1667
|
const d = e;
|
|
@@ -1672,8 +1672,8 @@ class Re {
|
|
|
1672
1672
|
} catch {
|
|
1673
1673
|
s = void 0;
|
|
1674
1674
|
}
|
|
1675
|
-
const c = s && (s.includes("Map") || s.includes("List") || s.includes("Set") || s.includes("Stack") || s.includes("Seq")) && (t ||
|
|
1676
|
-
return !!(t &&
|
|
1675
|
+
const c = s && (s.includes("Map") || s.includes("List") || s.includes("Set") || s.includes("Stack") || s.includes("Seq")) && (t || o);
|
|
1676
|
+
return !!(t && o && r && a || t && o && c);
|
|
1677
1677
|
}
|
|
1678
1678
|
isPrimitive(e) {
|
|
1679
1679
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
|
|
@@ -1687,29 +1687,54 @@ class Re {
|
|
|
1687
1687
|
return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((t) => t.length > 0) : [];
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1691
|
-
return new Re(
|
|
1690
|
+
function Co(n, e, t) {
|
|
1691
|
+
return new Re(n, e, "", null, t);
|
|
1692
1692
|
}
|
|
1693
1693
|
class No {
|
|
1694
1694
|
hstStore;
|
|
1695
1695
|
_operationLogStore;
|
|
1696
1696
|
_operationLogConfig;
|
|
1697
|
+
_client;
|
|
1697
1698
|
/** The registry instance containing all doctype definitions */
|
|
1698
1699
|
registry;
|
|
1699
1700
|
/**
|
|
1700
1701
|
* Creates a new Stonecrop instance with HST integration
|
|
1701
1702
|
* @param registry - The Registry instance containing doctype definitions
|
|
1702
1703
|
* @param operationLogConfig - Optional configuration for the operation log
|
|
1704
|
+
* @param options - Options including the data client (can be set later via setClient)
|
|
1703
1705
|
*/
|
|
1704
|
-
constructor(e, t) {
|
|
1705
|
-
this.registry = e, this._operationLogConfig = t, this.initializeHSTStore(), this.setupRegistrySync();
|
|
1706
|
+
constructor(e, t, o) {
|
|
1707
|
+
this.registry = e, this._operationLogConfig = t, this._client = o?.client, this.initializeHSTStore(), this.setupRegistrySync();
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Set the data client for fetching doctype metadata and records.
|
|
1711
|
+
* Use this for deferred configuration in Nuxt/Vue plugin setups.
|
|
1712
|
+
*
|
|
1713
|
+
* @param client - DataClient implementation (e.g., StonecropClient from \@stonecrop/graphql-client)
|
|
1714
|
+
*
|
|
1715
|
+
* @example
|
|
1716
|
+
* ```ts
|
|
1717
|
+
* const { setClient } = useStonecropRegistry()
|
|
1718
|
+
* const client = new StonecropClient({ endpoint: '/graphql' })
|
|
1719
|
+
* setClient(client)
|
|
1720
|
+
* ```
|
|
1721
|
+
*/
|
|
1722
|
+
setClient(e) {
|
|
1723
|
+
this._client = e;
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Get the current data client
|
|
1727
|
+
* @returns The DataClient instance or undefined if not set
|
|
1728
|
+
*/
|
|
1729
|
+
getClient() {
|
|
1730
|
+
return this._client;
|
|
1706
1731
|
}
|
|
1707
1732
|
/**
|
|
1708
1733
|
* Get the operation log store (lazy initialization)
|
|
1709
1734
|
* @internal
|
|
1710
1735
|
*/
|
|
1711
1736
|
getOperationLogStore() {
|
|
1712
|
-
return this._operationLogStore || (this._operationLogStore =
|
|
1737
|
+
return this._operationLogStore || (this._operationLogStore = Ct(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
|
|
1713
1738
|
}
|
|
1714
1739
|
/**
|
|
1715
1740
|
* Initialize the HST store structure
|
|
@@ -1718,7 +1743,7 @@ class No {
|
|
|
1718
1743
|
const e = {};
|
|
1719
1744
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1720
1745
|
e[t] = {};
|
|
1721
|
-
}), this.hstStore =
|
|
1746
|
+
}), this.hstStore = Co(yt(e), "StonecropStore");
|
|
1722
1747
|
}
|
|
1723
1748
|
/**
|
|
1724
1749
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1744,9 +1769,9 @@ class No {
|
|
|
1744
1769
|
* @param recordId - The record ID
|
|
1745
1770
|
* @param recordData - The record data
|
|
1746
1771
|
*/
|
|
1747
|
-
addRecord(e, t,
|
|
1772
|
+
addRecord(e, t, o) {
|
|
1748
1773
|
const r = typeof e == "string" ? e : e.slug;
|
|
1749
|
-
this.ensureDoctypeExists(r), this.hstStore.set(`${r}.${t}`,
|
|
1774
|
+
this.ensureDoctypeExists(r), this.hstStore.set(`${r}.${t}`, o);
|
|
1750
1775
|
}
|
|
1751
1776
|
/**
|
|
1752
1777
|
* Get a specific record
|
|
@@ -1755,9 +1780,9 @@ class No {
|
|
|
1755
1780
|
* @returns HST node for the record or undefined
|
|
1756
1781
|
*/
|
|
1757
1782
|
getRecordById(e, t) {
|
|
1758
|
-
const
|
|
1759
|
-
if (this.ensureDoctypeExists(
|
|
1760
|
-
return this.hstStore.getNode(`${
|
|
1783
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1784
|
+
if (this.ensureDoctypeExists(o), !(!this.hstStore.has(`${o}.${t}`) || this.hstStore.get(`${o}.${t}`) === void 0))
|
|
1785
|
+
return this.hstStore.getNode(`${o}.${t}`);
|
|
1761
1786
|
}
|
|
1762
1787
|
/**
|
|
1763
1788
|
* Remove a record from the store
|
|
@@ -1765,8 +1790,8 @@ class No {
|
|
|
1765
1790
|
* @param recordId - The record ID
|
|
1766
1791
|
*/
|
|
1767
1792
|
removeRecord(e, t) {
|
|
1768
|
-
const
|
|
1769
|
-
this.ensureDoctypeExists(
|
|
1793
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1794
|
+
this.ensureDoctypeExists(o), this.hstStore.has(`${o}.${t}`) && this.hstStore.set(`${o}.${t}`, void 0);
|
|
1770
1795
|
}
|
|
1771
1796
|
/**
|
|
1772
1797
|
* Get all record IDs for a doctype
|
|
@@ -1776,8 +1801,8 @@ class No {
|
|
|
1776
1801
|
getRecordIds(e) {
|
|
1777
1802
|
const t = typeof e == "string" ? e : e.slug;
|
|
1778
1803
|
this.ensureDoctypeExists(t);
|
|
1779
|
-
const
|
|
1780
|
-
return !
|
|
1804
|
+
const o = this.hstStore.get(t);
|
|
1805
|
+
return !o || typeof o != "object" ? [] : Object.keys(o).filter((r) => o[r] !== void 0);
|
|
1781
1806
|
}
|
|
1782
1807
|
/**
|
|
1783
1808
|
* Clear all records for a doctype
|
|
@@ -1785,8 +1810,8 @@ class No {
|
|
|
1785
1810
|
*/
|
|
1786
1811
|
clearRecords(e) {
|
|
1787
1812
|
const t = typeof e == "string" ? e : e.slug;
|
|
1788
|
-
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((
|
|
1789
|
-
this.hstStore.set(`${t}.${
|
|
1813
|
+
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((o) => {
|
|
1814
|
+
this.hstStore.set(`${t}.${o}`, void 0);
|
|
1790
1815
|
});
|
|
1791
1816
|
}
|
|
1792
1817
|
/**
|
|
@@ -1803,15 +1828,15 @@ class No {
|
|
|
1803
1828
|
* @param action - The action to run
|
|
1804
1829
|
* @param args - Action arguments (typically record IDs)
|
|
1805
1830
|
*/
|
|
1806
|
-
runAction(e, t,
|
|
1807
|
-
const r = this.registry.registry[e.slug]?.actions?.get(t), a = Array.isArray(
|
|
1831
|
+
runAction(e, t, o) {
|
|
1832
|
+
const r = this.registry.registry[e.slug]?.actions?.get(t), a = Array.isArray(o) ? o.filter((u) => typeof u == "string") : void 0, s = this.getOperationLogStore();
|
|
1808
1833
|
let c = "success", d;
|
|
1809
1834
|
try {
|
|
1810
1835
|
r && r.length > 0 && r.forEach((u) => {
|
|
1811
1836
|
try {
|
|
1812
|
-
new Function("args", u)(
|
|
1813
|
-
} catch (
|
|
1814
|
-
throw c = "failure", d =
|
|
1837
|
+
new Function("args", u)(o);
|
|
1838
|
+
} catch (w) {
|
|
1839
|
+
throw c = "failure", d = w instanceof Error ? w.message : "Unknown error", w;
|
|
1815
1840
|
}
|
|
1816
1841
|
});
|
|
1817
1842
|
} catch {
|
|
@@ -1820,22 +1845,49 @@ class No {
|
|
|
1820
1845
|
}
|
|
1821
1846
|
}
|
|
1822
1847
|
/**
|
|
1823
|
-
* Get records from server
|
|
1848
|
+
* Get records from server using the configured data client.
|
|
1824
1849
|
* @param doctype - The doctype
|
|
1850
|
+
* @throws Error if no data client has been configured
|
|
1825
1851
|
*/
|
|
1826
1852
|
async getRecords(e) {
|
|
1827
|
-
|
|
1853
|
+
if (!this._client)
|
|
1854
|
+
throw new Error(
|
|
1855
|
+
"No data client configured. Call setClient() with a DataClient implementation (e.g., StonecropClient from @stonecrop/graphql-client) before fetching records."
|
|
1856
|
+
);
|
|
1857
|
+
(await this._client.getRecords(e)).forEach((t) => {
|
|
1828
1858
|
t.id && this.addRecord(e, t.id, t);
|
|
1829
1859
|
});
|
|
1830
1860
|
}
|
|
1831
1861
|
/**
|
|
1832
|
-
* Get single record from server
|
|
1862
|
+
* Get single record from server using the configured data client.
|
|
1833
1863
|
* @param doctype - The doctype
|
|
1834
1864
|
* @param recordId - The record ID
|
|
1865
|
+
* @throws Error if no data client has been configured
|
|
1835
1866
|
*/
|
|
1836
1867
|
async getRecord(e, t) {
|
|
1837
|
-
|
|
1838
|
-
|
|
1868
|
+
if (!this._client)
|
|
1869
|
+
throw new Error(
|
|
1870
|
+
"No data client configured. Call setClient() with a DataClient implementation (e.g., StonecropClient from @stonecrop/graphql-client) before fetching records."
|
|
1871
|
+
);
|
|
1872
|
+
const o = await this._client.getRecord(e, t);
|
|
1873
|
+
o && this.addRecord(e, t, o);
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Dispatch an action to the server via the configured data client.
|
|
1877
|
+
* All state changes flow through this single mutation endpoint.
|
|
1878
|
+
*
|
|
1879
|
+
* @param doctype - The doctype
|
|
1880
|
+
* @param action - Action name to execute (e.g., 'SUBMIT', 'APPROVE', 'save')
|
|
1881
|
+
* @param args - Action arguments (typically record ID and/or form data)
|
|
1882
|
+
* @returns Action result with success status, response data, and any error
|
|
1883
|
+
* @throws Error if no data client has been configured
|
|
1884
|
+
*/
|
|
1885
|
+
async dispatchAction(e, t, o) {
|
|
1886
|
+
if (!this._client)
|
|
1887
|
+
throw new Error(
|
|
1888
|
+
"No data client configured. Call setClient() with a DataClient implementation (e.g., StonecropClient from @stonecrop/graphql-client) before dispatching actions."
|
|
1889
|
+
);
|
|
1890
|
+
return this._client.runAction(e, t, o);
|
|
1839
1891
|
}
|
|
1840
1892
|
/**
|
|
1841
1893
|
* Ensure doctype section exists in HST store
|
|
@@ -1875,167 +1927,167 @@ class No {
|
|
|
1875
1927
|
* @public
|
|
1876
1928
|
*/
|
|
1877
1929
|
getRecordState(e, t) {
|
|
1878
|
-
const
|
|
1930
|
+
const o = typeof e == "string" ? e : e.slug, r = this.registry.getDoctype(o);
|
|
1879
1931
|
if (!r?.workflow) return "";
|
|
1880
|
-
const a = this.getRecordById(
|
|
1932
|
+
const a = this.getRecordById(o, t)?.get("status"), s = typeof r.workflow.initial == "string" ? r.workflow.initial : Object.keys(r.workflow.states ?? {})[0] ?? "";
|
|
1881
1933
|
return a || s;
|
|
1882
1934
|
}
|
|
1883
1935
|
}
|
|
1884
|
-
function Do(
|
|
1885
|
-
|
|
1886
|
-
const e =
|
|
1887
|
-
if (
|
|
1888
|
-
const _ =
|
|
1936
|
+
function Do(n) {
|
|
1937
|
+
n || (n = {});
|
|
1938
|
+
const e = n.registry || we("$registry"), t = we("$stonecrop"), o = $(), r = $(), a = $({}), s = $(), c = $(), d = $([]);
|
|
1939
|
+
if (n.doctype && e) {
|
|
1940
|
+
const _ = n.doctype.schema ? Array.isArray(n.doctype.schema) ? n.doctype.schema : Array.from(n.doctype.schema) : [];
|
|
1889
1941
|
d.value = e.resolveSchema(_);
|
|
1890
1942
|
}
|
|
1891
|
-
const u =
|
|
1892
|
-
() =>
|
|
1943
|
+
const u = $([]), w = $(-1), v = R(() => o.value?.getOperationLogStore().canUndo ?? !1), h = R(() => o.value?.getOperationLogStore().canRedo ?? !1), b = R(() => o.value?.getOperationLogStore().undoCount ?? 0), m = R(() => o.value?.getOperationLogStore().redoCount ?? 0), k = R(
|
|
1944
|
+
() => o.value?.getOperationLogStore().undoRedoState ?? {
|
|
1893
1945
|
canUndo: !1,
|
|
1894
1946
|
canRedo: !1,
|
|
1895
1947
|
undoCount: 0,
|
|
1896
1948
|
redoCount: 0,
|
|
1897
1949
|
currentIndex: -1
|
|
1898
1950
|
}
|
|
1899
|
-
), I = (_) =>
|
|
1900
|
-
|
|
1901
|
-
}, U = (_) =>
|
|
1902
|
-
|
|
1951
|
+
), I = (_) => o.value?.getOperationLogStore().undo(_) ?? !1, T = (_) => o.value?.getOperationLogStore().redo(_) ?? !1, Z = () => {
|
|
1952
|
+
o.value?.getOperationLogStore().startBatch();
|
|
1953
|
+
}, U = (_) => o.value?.getOperationLogStore().commitBatch(_) ?? null, z = () => {
|
|
1954
|
+
o.value?.getOperationLogStore().cancelBatch();
|
|
1903
1955
|
}, L = () => {
|
|
1904
|
-
|
|
1905
|
-
},
|
|
1956
|
+
o.value?.getOperationLogStore().clear();
|
|
1957
|
+
}, G = (_, C) => o.value?.getOperationLogStore().getOperationsFor(_, C) ?? [], E = () => o.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1906
1958
|
operations: [],
|
|
1907
1959
|
currentIndex: -1,
|
|
1908
1960
|
totalOperations: 0,
|
|
1909
1961
|
reversibleOperations: 0,
|
|
1910
1962
|
irreversibleOperations: 0
|
|
1911
|
-
}, Y = (_,
|
|
1912
|
-
|
|
1913
|
-
}, B = (_,
|
|
1914
|
-
|
|
1963
|
+
}, Y = (_, C) => {
|
|
1964
|
+
o.value?.getOperationLogStore().markIrreversible(_, C);
|
|
1965
|
+
}, B = (_, C, S, p = "success", f) => o.value?.getOperationLogStore().logAction(_, C, S, p, f) ?? "", g = (_) => {
|
|
1966
|
+
o.value?.getOperationLogStore().configure(_);
|
|
1915
1967
|
};
|
|
1916
1968
|
xe(async () => {
|
|
1917
1969
|
if (e) {
|
|
1918
|
-
|
|
1970
|
+
o.value = t || new No(e);
|
|
1919
1971
|
try {
|
|
1920
|
-
const _ =
|
|
1921
|
-
u.value =
|
|
1922
|
-
() =>
|
|
1972
|
+
const _ = o.value.getOperationLogStore(), C = oo(_);
|
|
1973
|
+
u.value = C.operations.value, w.value = C.currentIndex.value, H(
|
|
1974
|
+
() => C.operations.value,
|
|
1923
1975
|
(S) => {
|
|
1924
1976
|
u.value = S;
|
|
1925
1977
|
}
|
|
1926
1978
|
), H(
|
|
1927
|
-
() =>
|
|
1979
|
+
() => C.currentIndex.value,
|
|
1928
1980
|
(S) => {
|
|
1929
|
-
|
|
1981
|
+
w.value = S;
|
|
1930
1982
|
}
|
|
1931
1983
|
);
|
|
1932
1984
|
} catch {
|
|
1933
1985
|
}
|
|
1934
|
-
if (!
|
|
1986
|
+
if (!n.doctype && e.router) {
|
|
1935
1987
|
const _ = e.router.currentRoute.value;
|
|
1936
1988
|
if (!_.path) return;
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1989
|
+
const C = _.path.split("/").filter((p) => p.length > 0), S = C[1]?.toLowerCase();
|
|
1990
|
+
if (C.length > 0) {
|
|
1939
1991
|
const p = {
|
|
1940
1992
|
path: _.path,
|
|
1941
|
-
segments:
|
|
1993
|
+
segments: C
|
|
1942
1994
|
}, f = await e.getMeta?.(p);
|
|
1943
1995
|
if (f) {
|
|
1944
|
-
if (e.addDoctype(f),
|
|
1996
|
+
if (e.addDoctype(f), o.value.setup(f), s.value = f, c.value = S, r.value = o.value.getStore(), e) {
|
|
1945
1997
|
const i = f.schema ? Array.isArray(f.schema) ? f.schema : Array.from(f.schema) : [];
|
|
1946
1998
|
d.value = e.resolveSchema(i);
|
|
1947
1999
|
}
|
|
1948
2000
|
if (S && S !== "new") {
|
|
1949
|
-
const i =
|
|
2001
|
+
const i = o.value.getRecordById(f, S);
|
|
1950
2002
|
if (i)
|
|
1951
2003
|
a.value = i.get("") || {};
|
|
1952
2004
|
else
|
|
1953
2005
|
try {
|
|
1954
|
-
await
|
|
1955
|
-
const l =
|
|
2006
|
+
await o.value.getRecord(f, S);
|
|
2007
|
+
const l = o.value.getRecordById(f, S);
|
|
1956
2008
|
l && (a.value = l.get("") || {});
|
|
1957
2009
|
} catch {
|
|
1958
2010
|
a.value = te(f);
|
|
1959
2011
|
}
|
|
1960
2012
|
} else
|
|
1961
2013
|
a.value = te(f);
|
|
1962
|
-
r.value && dt(f, S || "new", a, r.value),
|
|
2014
|
+
r.value && dt(f, S || "new", a, r.value), o.value.runAction(f, "load", S ? [S] : void 0);
|
|
1963
2015
|
}
|
|
1964
2016
|
}
|
|
1965
2017
|
}
|
|
1966
|
-
if (
|
|
1967
|
-
r.value =
|
|
1968
|
-
const _ =
|
|
1969
|
-
if (
|
|
1970
|
-
const S =
|
|
2018
|
+
if (n.doctype) {
|
|
2019
|
+
r.value = o.value.getStore();
|
|
2020
|
+
const _ = n.doctype, C = n.recordId;
|
|
2021
|
+
if (C && C !== "new") {
|
|
2022
|
+
const S = o.value.getRecordById(_, C);
|
|
1971
2023
|
if (S)
|
|
1972
2024
|
a.value = S.get("") || {};
|
|
1973
2025
|
else
|
|
1974
2026
|
try {
|
|
1975
|
-
await
|
|
1976
|
-
const p =
|
|
2027
|
+
await o.value.getRecord(_, C);
|
|
2028
|
+
const p = o.value.getRecordById(_, C);
|
|
1977
2029
|
p && (a.value = p.get("") || {});
|
|
1978
2030
|
} catch {
|
|
1979
2031
|
a.value = te(_);
|
|
1980
2032
|
}
|
|
1981
2033
|
} else
|
|
1982
2034
|
a.value = te(_);
|
|
1983
|
-
r.value && dt(_,
|
|
2035
|
+
r.value && dt(_, C || "new", a, r.value);
|
|
1984
2036
|
}
|
|
1985
2037
|
}
|
|
1986
2038
|
});
|
|
1987
|
-
const y = (_,
|
|
1988
|
-
const S =
|
|
2039
|
+
const y = (_, C) => {
|
|
2040
|
+
const S = n.doctype || s.value;
|
|
1989
2041
|
if (!S) return "";
|
|
1990
|
-
const p =
|
|
2042
|
+
const p = C || n.recordId || c.value || "new";
|
|
1991
2043
|
return `${S.slug}.${p}.${_}`;
|
|
1992
2044
|
}, D = (_) => {
|
|
1993
|
-
const
|
|
1994
|
-
if (!(!r.value || !
|
|
2045
|
+
const C = n.doctype || s.value;
|
|
2046
|
+
if (!(!r.value || !o.value || !C))
|
|
1995
2047
|
try {
|
|
1996
2048
|
const S = _.path.split(".");
|
|
1997
2049
|
if (S.length >= 2) {
|
|
1998
2050
|
const i = S[0], l = S[1];
|
|
1999
|
-
if (r.value.has(`${i}.${l}`) ||
|
|
2000
|
-
const A = `${i}.${l}`,
|
|
2051
|
+
if (r.value.has(`${i}.${l}`) || o.value.addRecord(C, l, { ...a.value }), S.length > 3) {
|
|
2052
|
+
const A = `${i}.${l}`, O = S.slice(2);
|
|
2001
2053
|
let W = A;
|
|
2002
|
-
for (let
|
|
2003
|
-
if (W += `.${
|
|
2004
|
-
const Q =
|
|
2054
|
+
for (let J = 0; J < O.length - 1; J++)
|
|
2055
|
+
if (W += `.${O[J]}`, !r.value.has(W)) {
|
|
2056
|
+
const Q = O[J + 1], _e = !isNaN(Number(Q));
|
|
2005
2057
|
r.value.set(W, _e ? [] : {});
|
|
2006
2058
|
}
|
|
2007
2059
|
}
|
|
2008
2060
|
}
|
|
2009
2061
|
r.value.set(_.path, _.value);
|
|
2010
2062
|
const p = _.fieldname.split("."), f = { ...a.value };
|
|
2011
|
-
p.length === 1 ? f[p[0]] = _.value :
|
|
2063
|
+
p.length === 1 ? f[p[0]] = _.value : Oo(f, p, _.value), a.value = f;
|
|
2012
2064
|
} catch {
|
|
2013
2065
|
}
|
|
2014
2066
|
};
|
|
2015
|
-
(
|
|
2016
|
-
const F = (_,
|
|
2017
|
-
if (!
|
|
2018
|
-
return te(
|
|
2067
|
+
(n.doctype || e?.router) && (Ge("hstPathProvider", y), Ge("hstChangeHandler", D));
|
|
2068
|
+
const F = (_, C, S) => {
|
|
2069
|
+
if (!o.value)
|
|
2070
|
+
return te(C);
|
|
2019
2071
|
if (S)
|
|
2020
2072
|
try {
|
|
2021
2073
|
const p = r.value?.get(_);
|
|
2022
|
-
return p && typeof p == "object" ? p : te(
|
|
2074
|
+
return p && typeof p == "object" ? p : te(C);
|
|
2023
2075
|
} catch {
|
|
2024
|
-
return te(
|
|
2076
|
+
return te(C);
|
|
2025
2077
|
}
|
|
2026
|
-
return te(
|
|
2027
|
-
}, N =
|
|
2028
|
-
if (!r.value || !
|
|
2078
|
+
return te(C);
|
|
2079
|
+
}, N = (_, C) => {
|
|
2080
|
+
if (!r.value || !o.value)
|
|
2029
2081
|
throw new Error("HST store not initialized");
|
|
2030
|
-
const S = `${_.slug}.${
|
|
2082
|
+
const S = `${_.slug}.${C}`, p = { ...r.value.get(S) || {} }, f = _.schema ? Array.isArray(_.schema) ? _.schema : Array.from(_.schema) : [], i = (e ? e.resolveSchema(f) : f).filter(
|
|
2031
2083
|
(l) => "fieldtype" in l && l.fieldtype === "Doctype" && "schema" in l && Array.isArray(l.schema)
|
|
2032
2084
|
);
|
|
2033
2085
|
for (const l of i) {
|
|
2034
|
-
const A = l,
|
|
2086
|
+
const A = l, O = `${S}.${A.fieldname}`, W = Nt(A.schema, O, r.value);
|
|
2035
2087
|
p[A.fieldname] = W;
|
|
2036
2088
|
}
|
|
2037
2089
|
return p;
|
|
2038
|
-
}, V = (_,
|
|
2090
|
+
}, V = (_, C) => ({
|
|
2039
2091
|
provideHSTPath: (S) => `${_}.${S}`,
|
|
2040
2092
|
handleHSTChange: (S) => {
|
|
2041
2093
|
const p = S.path.startsWith(_) ? S.path : `${_}.${S.fieldname}`;
|
|
@@ -2046,26 +2098,26 @@ function Do(o) {
|
|
|
2046
2098
|
}
|
|
2047
2099
|
}), M = {
|
|
2048
2100
|
operations: u,
|
|
2049
|
-
currentIndex:
|
|
2101
|
+
currentIndex: w,
|
|
2050
2102
|
undoRedoState: k,
|
|
2051
2103
|
canUndo: v,
|
|
2052
2104
|
canRedo: h,
|
|
2053
|
-
undoCount:
|
|
2105
|
+
undoCount: b,
|
|
2054
2106
|
redoCount: m,
|
|
2055
2107
|
undo: I,
|
|
2056
|
-
redo:
|
|
2108
|
+
redo: T,
|
|
2057
2109
|
startBatch: Z,
|
|
2058
2110
|
commitBatch: U,
|
|
2059
|
-
cancelBatch:
|
|
2111
|
+
cancelBatch: z,
|
|
2060
2112
|
clear: L,
|
|
2061
|
-
getOperationsFor:
|
|
2113
|
+
getOperationsFor: G,
|
|
2062
2114
|
getSnapshot: E,
|
|
2063
2115
|
markIrreversible: Y,
|
|
2064
2116
|
logAction: B,
|
|
2065
2117
|
configure: g
|
|
2066
2118
|
};
|
|
2067
|
-
return
|
|
2068
|
-
stonecrop:
|
|
2119
|
+
return n.doctype ? {
|
|
2120
|
+
stonecrop: o,
|
|
2069
2121
|
operationLog: M,
|
|
2070
2122
|
provideHSTPath: y,
|
|
2071
2123
|
handleHSTChange: D,
|
|
@@ -2075,8 +2127,8 @@ function Do(o) {
|
|
|
2075
2127
|
loadNestedData: F,
|
|
2076
2128
|
saveRecursive: N,
|
|
2077
2129
|
createNestedContext: V
|
|
2078
|
-
} : !
|
|
2079
|
-
stonecrop:
|
|
2130
|
+
} : !n.doctype && e?.router ? {
|
|
2131
|
+
stonecrop: o,
|
|
2080
2132
|
operationLog: M,
|
|
2081
2133
|
provideHSTPath: y,
|
|
2082
2134
|
handleHSTChange: D,
|
|
@@ -2087,13 +2139,13 @@ function Do(o) {
|
|
|
2087
2139
|
saveRecursive: N,
|
|
2088
2140
|
createNestedContext: V
|
|
2089
2141
|
} : {
|
|
2090
|
-
stonecrop:
|
|
2142
|
+
stonecrop: o,
|
|
2091
2143
|
operationLog: M
|
|
2092
2144
|
};
|
|
2093
2145
|
}
|
|
2094
|
-
function te(
|
|
2146
|
+
function te(n) {
|
|
2095
2147
|
const e = {};
|
|
2096
|
-
return
|
|
2148
|
+
return n.schema && n.schema.forEach((t) => {
|
|
2097
2149
|
switch ("fieldtype" in t ? t.fieldtype : "Data") {
|
|
2098
2150
|
case "Data":
|
|
2099
2151
|
case "Text":
|
|
@@ -2117,15 +2169,15 @@ function te(o) {
|
|
|
2117
2169
|
}
|
|
2118
2170
|
}), e;
|
|
2119
2171
|
}
|
|
2120
|
-
function dt(
|
|
2172
|
+
function dt(n, e, t, o) {
|
|
2121
2173
|
H(
|
|
2122
2174
|
t,
|
|
2123
2175
|
(r) => {
|
|
2124
|
-
const a = `${
|
|
2176
|
+
const a = `${n.slug}.${e}`;
|
|
2125
2177
|
Object.keys(r).forEach((s) => {
|
|
2126
2178
|
const c = `${a}.${s}`;
|
|
2127
2179
|
try {
|
|
2128
|
-
|
|
2180
|
+
o.set(c, r[s]);
|
|
2129
2181
|
} catch {
|
|
2130
2182
|
}
|
|
2131
2183
|
});
|
|
@@ -2133,61 +2185,61 @@ function dt(o, e, t, n) {
|
|
|
2133
2185
|
{ deep: !0 }
|
|
2134
2186
|
);
|
|
2135
2187
|
}
|
|
2136
|
-
function
|
|
2137
|
-
let
|
|
2188
|
+
function Oo(n, e, t) {
|
|
2189
|
+
let o = n;
|
|
2138
2190
|
for (let a = 0; a < e.length - 1; a++) {
|
|
2139
2191
|
const s = e[a];
|
|
2140
|
-
(!(s in
|
|
2192
|
+
(!(s in o) || typeof o[s] != "object") && (o[s] = isNaN(Number(e[a + 1])) ? {} : []), o = o[s];
|
|
2141
2193
|
}
|
|
2142
2194
|
const r = e[e.length - 1];
|
|
2143
|
-
|
|
2195
|
+
o[r] = t;
|
|
2144
2196
|
}
|
|
2145
|
-
function Nt(
|
|
2146
|
-
const
|
|
2197
|
+
function Nt(n, e, t) {
|
|
2198
|
+
const o = { ...t.get(e) || {} }, r = n.filter(
|
|
2147
2199
|
(a) => "fieldtype" in a && a.fieldtype === "Doctype" && "schema" in a && Array.isArray(a.schema)
|
|
2148
2200
|
);
|
|
2149
2201
|
for (const a of r) {
|
|
2150
2202
|
const s = a, c = `${e}.${s.fieldname}`, d = Nt(s.schema, c, t);
|
|
2151
|
-
|
|
2203
|
+
o[s.fieldname] = d;
|
|
2152
2204
|
}
|
|
2153
|
-
return
|
|
2205
|
+
return o;
|
|
2154
2206
|
}
|
|
2155
2207
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2156
|
-
function Ao(
|
|
2157
|
-
return Xe() ? (Ye(
|
|
2208
|
+
function Ao(n, e) {
|
|
2209
|
+
return Xe() ? (Ye(n, e), !0) : !1;
|
|
2158
2210
|
}
|
|
2159
2211
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2160
|
-
const
|
|
2212
|
+
const $o = () => {
|
|
2161
2213
|
};
|
|
2162
|
-
function Io(...
|
|
2163
|
-
if (
|
|
2164
|
-
const e =
|
|
2165
|
-
return typeof e == "function" ?
|
|
2214
|
+
function Io(...n) {
|
|
2215
|
+
if (n.length !== 1) return re(...n);
|
|
2216
|
+
const e = n[0];
|
|
2217
|
+
return typeof e == "function" ? Pe(et(() => ({
|
|
2166
2218
|
get: e,
|
|
2167
|
-
set:
|
|
2168
|
-
}))) :
|
|
2219
|
+
set: $o
|
|
2220
|
+
}))) : $(e);
|
|
2169
2221
|
}
|
|
2170
|
-
function Be(
|
|
2171
|
-
return typeof Window < "u" &&
|
|
2222
|
+
function Be(n) {
|
|
2223
|
+
return typeof Window < "u" && n instanceof Window ? n.document.documentElement : typeof Document < "u" && n instanceof Document ? n.documentElement : n;
|
|
2172
2224
|
}
|
|
2173
2225
|
const We = /* @__PURE__ */ new WeakMap();
|
|
2174
|
-
function Ro(
|
|
2226
|
+
function Ro(n, e = !1) {
|
|
2175
2227
|
const t = Se(e);
|
|
2176
|
-
let
|
|
2177
|
-
H(Io(
|
|
2178
|
-
const c = Be(
|
|
2228
|
+
let o = "";
|
|
2229
|
+
H(Io(n), (s) => {
|
|
2230
|
+
const c = Be(K(s));
|
|
2179
2231
|
if (c) {
|
|
2180
2232
|
const d = c;
|
|
2181
|
-
if (We.get(d) || We.set(d, d.style.overflow), d.style.overflow !== "hidden" && (
|
|
2233
|
+
if (We.get(d) || We.set(d, d.style.overflow), d.style.overflow !== "hidden" && (o = d.style.overflow), d.style.overflow === "hidden") return t.value = !0;
|
|
2182
2234
|
if (t.value) return d.style.overflow = "hidden";
|
|
2183
2235
|
}
|
|
2184
2236
|
}, { immediate: !0 });
|
|
2185
2237
|
const r = () => {
|
|
2186
|
-
const s = Be(
|
|
2238
|
+
const s = Be(K(n));
|
|
2187
2239
|
!s || t.value || (s.style.overflow = "hidden", t.value = !0);
|
|
2188
2240
|
}, a = () => {
|
|
2189
|
-
const s = Be(
|
|
2190
|
-
!s || !t.value || (s.style.overflow =
|
|
2241
|
+
const s = Be(K(n));
|
|
2242
|
+
!s || !t.value || (s.style.overflow = o, We.delete(s), t.value = !1);
|
|
2191
2243
|
};
|
|
2192
2244
|
return Ao(a), R({
|
|
2193
2245
|
get() {
|
|
@@ -2199,59 +2251,59 @@ function Ro(o, e = !1) {
|
|
|
2199
2251
|
});
|
|
2200
2252
|
}
|
|
2201
2253
|
function xo() {
|
|
2202
|
-
let
|
|
2254
|
+
let n = !1;
|
|
2203
2255
|
const e = Se(!1);
|
|
2204
|
-
return (t,
|
|
2205
|
-
if (e.value =
|
|
2206
|
-
|
|
2207
|
-
const r = Ro(t,
|
|
2256
|
+
return (t, o) => {
|
|
2257
|
+
if (e.value = o.value, n) return;
|
|
2258
|
+
n = !0;
|
|
2259
|
+
const r = Ro(t, o.value);
|
|
2208
2260
|
H(e, (a) => r.value = a);
|
|
2209
2261
|
};
|
|
2210
2262
|
}
|
|
2211
2263
|
xo();
|
|
2212
|
-
const
|
|
2213
|
-
const t =
|
|
2214
|
-
for (const [
|
|
2215
|
-
t[
|
|
2264
|
+
const To = (n, e) => {
|
|
2265
|
+
const t = n.__vccOpts || n;
|
|
2266
|
+
for (const [o, r] of e)
|
|
2267
|
+
t[o] = r;
|
|
2216
2268
|
return t;
|
|
2217
2269
|
};
|
|
2218
|
-
function
|
|
2219
|
-
return Xe() ? (Ye(
|
|
2270
|
+
function Po(n, e) {
|
|
2271
|
+
return Xe() ? (Ye(n, e), !0) : !1;
|
|
2220
2272
|
}
|
|
2221
2273
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2222
2274
|
const Vo = () => {
|
|
2223
2275
|
};
|
|
2224
|
-
function jo(...
|
|
2225
|
-
if (
|
|
2226
|
-
const e =
|
|
2227
|
-
return typeof e == "function" ?
|
|
2276
|
+
function jo(...n) {
|
|
2277
|
+
if (n.length !== 1) return re(...n);
|
|
2278
|
+
const e = n[0];
|
|
2279
|
+
return typeof e == "function" ? Pe(et(() => ({
|
|
2228
2280
|
get: e,
|
|
2229
2281
|
set: Vo
|
|
2230
|
-
}))) :
|
|
2282
|
+
}))) : $(e);
|
|
2231
2283
|
}
|
|
2232
|
-
function He(
|
|
2233
|
-
return typeof Window < "u" &&
|
|
2284
|
+
function He(n) {
|
|
2285
|
+
return typeof Window < "u" && n instanceof Window ? n.document.documentElement : typeof Document < "u" && n instanceof Document ? n.documentElement : n;
|
|
2234
2286
|
}
|
|
2235
2287
|
const Ue = /* @__PURE__ */ new WeakMap();
|
|
2236
|
-
function Mo(
|
|
2288
|
+
function Mo(n, e = !1) {
|
|
2237
2289
|
const t = Se(e);
|
|
2238
|
-
let
|
|
2239
|
-
H(jo(
|
|
2240
|
-
const c = He(
|
|
2290
|
+
let o = "";
|
|
2291
|
+
H(jo(n), (s) => {
|
|
2292
|
+
const c = He(K(s));
|
|
2241
2293
|
if (c) {
|
|
2242
2294
|
const d = c;
|
|
2243
|
-
if (Ue.get(d) || Ue.set(d, d.style.overflow), d.style.overflow !== "hidden" && (
|
|
2295
|
+
if (Ue.get(d) || Ue.set(d, d.style.overflow), d.style.overflow !== "hidden" && (o = d.style.overflow), d.style.overflow === "hidden") return t.value = !0;
|
|
2244
2296
|
if (t.value) return d.style.overflow = "hidden";
|
|
2245
2297
|
}
|
|
2246
2298
|
}, { immediate: !0 });
|
|
2247
2299
|
const r = () => {
|
|
2248
|
-
const s = He(
|
|
2300
|
+
const s = He(K(n));
|
|
2249
2301
|
!s || t.value || (s.style.overflow = "hidden", t.value = !0);
|
|
2250
2302
|
}, a = () => {
|
|
2251
|
-
const s = He(
|
|
2252
|
-
!s || !t.value || (s.style.overflow =
|
|
2303
|
+
const s = He(K(n));
|
|
2304
|
+
!s || !t.value || (s.style.overflow = o, Ue.delete(s), t.value = !1);
|
|
2253
2305
|
};
|
|
2254
|
-
return
|
|
2306
|
+
return Po(a), R({
|
|
2255
2307
|
get() {
|
|
2256
2308
|
return t.value;
|
|
2257
2309
|
},
|
|
@@ -2261,12 +2313,12 @@ function Mo(o, e = !1) {
|
|
|
2261
2313
|
});
|
|
2262
2314
|
}
|
|
2263
2315
|
function Fo() {
|
|
2264
|
-
let
|
|
2316
|
+
let n = !1;
|
|
2265
2317
|
const e = Se(!1);
|
|
2266
|
-
return (t,
|
|
2267
|
-
if (e.value =
|
|
2268
|
-
|
|
2269
|
-
const r = Mo(t,
|
|
2318
|
+
return (t, o) => {
|
|
2319
|
+
if (e.value = o.value, n) return;
|
|
2320
|
+
n = !0;
|
|
2321
|
+
const r = Mo(t, o.value);
|
|
2270
2322
|
H(e, (a) => r.value = a);
|
|
2271
2323
|
};
|
|
2272
2324
|
}
|
|
@@ -2278,7 +2330,7 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2278
2330
|
}, Wo = {
|
|
2279
2331
|
key: 0,
|
|
2280
2332
|
class: "aform-nested-label"
|
|
2281
|
-
}, Ho = /* @__PURE__ */
|
|
2333
|
+
}, Ho = /* @__PURE__ */ be({
|
|
2282
2334
|
__name: "AForm",
|
|
2283
2335
|
props: /* @__PURE__ */ ot({
|
|
2284
2336
|
schema: {},
|
|
@@ -2288,72 +2340,72 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2288
2340
|
dataModifiers: {}
|
|
2289
2341
|
}),
|
|
2290
2342
|
emits: /* @__PURE__ */ ot(["update:schema", "update:data"], ["update:data"]),
|
|
2291
|
-
setup(
|
|
2292
|
-
const t = e,
|
|
2343
|
+
setup(n, { emit: e }) {
|
|
2344
|
+
const t = e, o = It(n, "data"), r = $({});
|
|
2293
2345
|
H(
|
|
2294
|
-
() =>
|
|
2346
|
+
() => o.value,
|
|
2295
2347
|
(v) => {
|
|
2296
|
-
!
|
|
2348
|
+
!n.schema || !v || n.schema.forEach((h) => {
|
|
2297
2349
|
"schema" in h && Array.isArray(h.schema) && h.schema.length > 0 && (r.value[h.fieldname] = v[h.fieldname] ?? {});
|
|
2298
2350
|
});
|
|
2299
2351
|
},
|
|
2300
2352
|
{ immediate: !0 }
|
|
2301
2353
|
);
|
|
2302
2354
|
const a = (v, h) => {
|
|
2303
|
-
r.value[v] = h,
|
|
2355
|
+
r.value[v] = h, o.value && (o.value[v] = h, t("update:data", { ...o.value }));
|
|
2304
2356
|
}, s = (v) => {
|
|
2305
2357
|
const h = {};
|
|
2306
|
-
for (const [
|
|
2307
|
-
["component", "fieldtype", "mode"].includes(
|
|
2358
|
+
for (const [b, m] of Object.entries(v))
|
|
2359
|
+
["component", "fieldtype", "mode"].includes(b) || (h[b] = m), b === "rows" && (!m || Array.isArray(m) && m.length === 0) && (h.rows = o.value[v.fieldname] || []);
|
|
2308
2360
|
return h;
|
|
2309
|
-
}, c = R(() =>
|
|
2361
|
+
}, c = R(() => n.mode ?? "edit");
|
|
2310
2362
|
function d(v) {
|
|
2311
2363
|
return v.mode || c.value;
|
|
2312
2364
|
}
|
|
2313
|
-
const u =
|
|
2365
|
+
const u = $([]);
|
|
2314
2366
|
Rt(() => {
|
|
2315
|
-
|
|
2367
|
+
n.schema && u.value.length !== n.schema.length && (u.value = n.schema.map((v, h) => R({
|
|
2316
2368
|
get() {
|
|
2317
|
-
return
|
|
2369
|
+
return o.value?.[n.schema[h].fieldname];
|
|
2318
2370
|
},
|
|
2319
|
-
set: (
|
|
2320
|
-
const m =
|
|
2321
|
-
m &&
|
|
2371
|
+
set: (b) => {
|
|
2372
|
+
const m = n.schema[h].fieldname;
|
|
2373
|
+
m && o.value && (o.value[m] = b, t("update:data", { ...o.value })), t("update:schema", n.schema);
|
|
2322
2374
|
}
|
|
2323
2375
|
})));
|
|
2324
2376
|
});
|
|
2325
|
-
const
|
|
2377
|
+
const w = R(() => u.value);
|
|
2326
2378
|
return (v, h) => {
|
|
2327
|
-
const
|
|
2328
|
-
return
|
|
2329
|
-
(
|
|
2330
|
-
"schema" in m && Array.isArray(m.schema) && m.schema.length > 0 ? (
|
|
2331
|
-
m.label ? (
|
|
2332
|
-
ne(
|
|
2379
|
+
const b = mt("AForm", !0);
|
|
2380
|
+
return P(), j("form", Lo, [
|
|
2381
|
+
(P(!0), j(ue, null, ye(n.schema, (m, k) => (P(), j(ue, { key: k }, [
|
|
2382
|
+
"schema" in m && Array.isArray(m.schema) && m.schema.length > 0 ? (P(), j("div", Bo, [
|
|
2383
|
+
m.label ? (P(), j("h4", Wo, X(m.label), 1)) : ce("", !0),
|
|
2384
|
+
ne(b, {
|
|
2333
2385
|
data: r.value[m.fieldname],
|
|
2334
2386
|
mode: d(m),
|
|
2335
2387
|
schema: m.schema,
|
|
2336
2388
|
"onUpdate:data": (I) => a(m.fieldname, I)
|
|
2337
2389
|
}, null, 8, ["data", "mode", "schema", "onUpdate:data"])
|
|
2338
|
-
])) : (
|
|
2390
|
+
])) : (P(), Qe(xt(m.component), Tt({
|
|
2339
2391
|
key: 1,
|
|
2340
|
-
modelValue:
|
|
2341
|
-
"onUpdate:modelValue": (I) =>
|
|
2392
|
+
modelValue: w.value[k].value,
|
|
2393
|
+
"onUpdate:modelValue": (I) => w.value[k].value = I,
|
|
2342
2394
|
schema: m,
|
|
2343
|
-
data:
|
|
2395
|
+
data: o.value[m.fieldname],
|
|
2344
2396
|
mode: d(m)
|
|
2345
2397
|
}, { ref_for: !0 }, s(m)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "mode"]))
|
|
2346
2398
|
], 64))), 128))
|
|
2347
2399
|
]);
|
|
2348
2400
|
};
|
|
2349
2401
|
}
|
|
2350
|
-
}), Uo = /* @__PURE__ */
|
|
2402
|
+
}), Uo = /* @__PURE__ */ To(Ho, [["__scopeId", "data-v-5c01cea5"]]), Jo = { class: "tabs" }, zo = { tabindex: "0" }, Go = { tabindex: "0" }, qo = /* @__PURE__ */ be({
|
|
2351
2403
|
__name: "SheetNav",
|
|
2352
2404
|
props: {
|
|
2353
2405
|
breadcrumbs: { default: () => [] }
|
|
2354
2406
|
},
|
|
2355
|
-
setup(
|
|
2356
|
-
const e =
|
|
2407
|
+
setup(n) {
|
|
2408
|
+
const e = $(!0), t = $(!1), o = $(""), r = pt("searchinput"), a = R(() => e.value ? "unrotated" : "rotated"), s = () => {
|
|
2357
2409
|
e.value = !e.value;
|
|
2358
2410
|
}, c = async () => {
|
|
2359
2411
|
t.value = !t.value, await de(() => {
|
|
@@ -2363,18 +2415,18 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2363
2415
|
v.preventDefault(), v.stopPropagation();
|
|
2364
2416
|
}, u = async (v) => {
|
|
2365
2417
|
v.preventDefault(), v.stopPropagation(), await c();
|
|
2366
|
-
},
|
|
2418
|
+
}, w = () => {
|
|
2367
2419
|
};
|
|
2368
2420
|
return (v, h) => {
|
|
2369
|
-
const
|
|
2370
|
-
return
|
|
2371
|
-
x("ul",
|
|
2421
|
+
const b = mt("router-link");
|
|
2422
|
+
return P(), j("footer", null, [
|
|
2423
|
+
x("ul", Jo, [
|
|
2372
2424
|
x("li", {
|
|
2373
2425
|
class: "hidebreadcrumbs",
|
|
2374
2426
|
onClick: s,
|
|
2375
2427
|
onKeydown: fe(s, ["enter"])
|
|
2376
2428
|
}, [
|
|
2377
|
-
x("a",
|
|
2429
|
+
x("a", zo, [
|
|
2378
2430
|
x("div", {
|
|
2379
2431
|
class: De(a.value)
|
|
2380
2432
|
}, "×", 2)
|
|
@@ -2383,10 +2435,10 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2383
2435
|
x("li", {
|
|
2384
2436
|
class: "hometab",
|
|
2385
2437
|
style: je({ display: e.value ? "block" : "none" }),
|
|
2386
|
-
onClick:
|
|
2387
|
-
onKeydown: fe(
|
|
2438
|
+
onClick: w,
|
|
2439
|
+
onKeydown: fe(w, ["enter"])
|
|
2388
2440
|
}, [
|
|
2389
|
-
ne(
|
|
2441
|
+
ne(b, {
|
|
2390
2442
|
to: "/",
|
|
2391
2443
|
tabindex: "0"
|
|
2392
2444
|
}, {
|
|
@@ -2410,8 +2462,8 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2410
2462
|
class: De(["searchtab", { "search-active": t.value }]),
|
|
2411
2463
|
style: je({ display: e.value ? "block" : "none" })
|
|
2412
2464
|
}, [
|
|
2413
|
-
x("a",
|
|
2414
|
-
|
|
2465
|
+
x("a", Go, [
|
|
2466
|
+
Oe((P(), j("svg", {
|
|
2415
2467
|
class: "icon search-icon",
|
|
2416
2468
|
role: "button",
|
|
2417
2469
|
"aria-label": "Search",
|
|
@@ -2429,11 +2481,11 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2429
2481
|
}, null, -1),
|
|
2430
2482
|
x("path", { d: "M21 21l-4.35-4.35" }, null, -1)
|
|
2431
2483
|
])], 544)), [
|
|
2432
|
-
[
|
|
2484
|
+
[Je, !t.value]
|
|
2433
2485
|
]),
|
|
2434
|
-
|
|
2486
|
+
Oe(x("input", {
|
|
2435
2487
|
ref: "searchinput",
|
|
2436
|
-
"onUpdate:modelValue": h[0] || (h[0] = (m) =>
|
|
2488
|
+
"onUpdate:modelValue": h[0] || (h[0] = (m) => o.value = m),
|
|
2437
2489
|
type: "text",
|
|
2438
2490
|
placeholder: "Search...",
|
|
2439
2491
|
onClick: h[1] || (h[1] = ft(() => {
|
|
@@ -2445,16 +2497,16 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2445
2497
|
fe(c, ["escape"])
|
|
2446
2498
|
]
|
|
2447
2499
|
}, null, 544), [
|
|
2448
|
-
[
|
|
2449
|
-
[ht,
|
|
2500
|
+
[Je, t.value],
|
|
2501
|
+
[ht, o.value]
|
|
2450
2502
|
])
|
|
2451
2503
|
])
|
|
2452
2504
|
], 6),
|
|
2453
|
-
(
|
|
2505
|
+
(P(!0), j(ue, null, ye(n.breadcrumbs, (m) => (P(), j("li", {
|
|
2454
2506
|
key: m.title,
|
|
2455
2507
|
style: je({ display: e.value ? "block" : "none" })
|
|
2456
2508
|
}, [
|
|
2457
|
-
ne(
|
|
2509
|
+
ne(b, {
|
|
2458
2510
|
tabindex: "0",
|
|
2459
2511
|
to: m.to
|
|
2460
2512
|
}, {
|
|
@@ -2468,13 +2520,13 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2468
2520
|
]);
|
|
2469
2521
|
};
|
|
2470
2522
|
}
|
|
2471
|
-
}), Dt = /* @__PURE__ */
|
|
2523
|
+
}), Dt = /* @__PURE__ */ wt(qo, [["__scopeId", "data-v-eb5bcbb6"]]), Ko = {
|
|
2472
2524
|
key: 1,
|
|
2473
2525
|
class: "loading"
|
|
2474
2526
|
}, Zo = {
|
|
2475
2527
|
key: 2,
|
|
2476
2528
|
class: "loading"
|
|
2477
|
-
}, Qo = /* @__PURE__ */
|
|
2529
|
+
}, Qo = /* @__PURE__ */ be({
|
|
2478
2530
|
__name: "Desktop",
|
|
2479
2531
|
props: {
|
|
2480
2532
|
availableDoctypes: {},
|
|
@@ -2482,30 +2534,30 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2482
2534
|
confirmFn: { type: Function }
|
|
2483
2535
|
},
|
|
2484
2536
|
emits: ["action", "navigate", "record:open"],
|
|
2485
|
-
setup(
|
|
2486
|
-
const t =
|
|
2537
|
+
setup(n, { emit: e }) {
|
|
2538
|
+
const t = n, o = e, { availableDoctypes: r = [] } = t, { stonecrop: a } = Do(), s = $(!1), c = $(!1), d = R({
|
|
2487
2539
|
get() {
|
|
2488
|
-
if (!a.value || !v.value || !
|
|
2540
|
+
if (!a.value || !v.value || !b.value)
|
|
2489
2541
|
return {};
|
|
2490
2542
|
try {
|
|
2491
|
-
return { ...a.value.getRecordById(v.value,
|
|
2543
|
+
return { ...a.value.getRecordById(v.value, b.value)?.get("") || {} };
|
|
2492
2544
|
} catch {
|
|
2493
2545
|
return {};
|
|
2494
2546
|
}
|
|
2495
2547
|
},
|
|
2496
2548
|
set(i) {
|
|
2497
|
-
if (!(!a.value || !v.value || !
|
|
2549
|
+
if (!(!a.value || !v.value || !b.value))
|
|
2498
2550
|
try {
|
|
2499
2551
|
const l = a.value.getStore();
|
|
2500
|
-
for (const [A,
|
|
2501
|
-
const W = `${v.value}.${
|
|
2502
|
-
(l.has(W) ? l.get(W) : void 0) !==
|
|
2552
|
+
for (const [A, O] of Object.entries(i)) {
|
|
2553
|
+
const W = `${v.value}.${b.value}.${A}`;
|
|
2554
|
+
(l.has(W) ? l.get(W) : void 0) !== O && l.set(W, O);
|
|
2503
2555
|
}
|
|
2504
2556
|
} catch (l) {
|
|
2505
2557
|
console.warn("HST update failed:", l);
|
|
2506
2558
|
}
|
|
2507
2559
|
}
|
|
2508
|
-
}), u = R(() => t.routeAdapter ? null : Ne(a.value?.registry.router?.currentRoute)),
|
|
2560
|
+
}), u = R(() => t.routeAdapter ? null : Ne(a.value?.registry.router?.currentRoute)), w = R(() => t.routeAdapter ? null : a.value?.registry.router), v = R(() => {
|
|
2509
2561
|
if (t.routeAdapter) return t.routeAdapter.getCurrentDoctype();
|
|
2510
2562
|
if (!u.value) return "";
|
|
2511
2563
|
if (u.value.meta?.actualDoctype)
|
|
@@ -2523,14 +2575,14 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2523
2575
|
return u.value.params.doctype;
|
|
2524
2576
|
const i = u.value.params.pathMatch;
|
|
2525
2577
|
return i && i.length > 0 ? i[0] : "";
|
|
2526
|
-
}),
|
|
2578
|
+
}), b = R(() => {
|
|
2527
2579
|
if (t.routeAdapter) return t.routeAdapter.getCurrentRecordId();
|
|
2528
2580
|
if (!u.value) return "";
|
|
2529
2581
|
if (u.value.params.recordId)
|
|
2530
2582
|
return u.value.params.recordId;
|
|
2531
2583
|
const i = u.value.params.pathMatch;
|
|
2532
2584
|
return i && i.length > 1 ? i[1] : "";
|
|
2533
|
-
}), m = R(() =>
|
|
2585
|
+
}), m = R(() => b.value?.startsWith("new-")), k = R(() => {
|
|
2534
2586
|
if (t.routeAdapter) return t.routeAdapter.getCurrentView();
|
|
2535
2587
|
if (!u.value || u.value.name === "home" || u.value.path === "/")
|
|
2536
2588
|
return "doctypes";
|
|
@@ -2544,27 +2596,27 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2544
2596
|
const i = u.value.params.pathMatch;
|
|
2545
2597
|
return i && i.length > 0 ? i.length === 1 ? "records" : "record" : "doctypes";
|
|
2546
2598
|
}), I = () => {
|
|
2547
|
-
if (!a.value || !v.value || !
|
|
2599
|
+
if (!a.value || !v.value || !b.value)
|
|
2548
2600
|
return [];
|
|
2549
2601
|
try {
|
|
2550
2602
|
const i = a.value.registry.getDoctype(v.value);
|
|
2551
2603
|
if (!i?.workflow) return [];
|
|
2552
|
-
const l = a.value.getRecordState(v.value,
|
|
2553
|
-
return A.map(({ name: W, targetState:
|
|
2554
|
-
label: `${W} (→ ${
|
|
2604
|
+
const l = a.value.getRecordState(v.value, b.value), A = i.getAvailableTransitions(l), O = d.value || {};
|
|
2605
|
+
return A.map(({ name: W, targetState: J }) => ({
|
|
2606
|
+
label: `${W} (→ ${J})`,
|
|
2555
2607
|
action: () => {
|
|
2556
|
-
|
|
2608
|
+
o("action", {
|
|
2557
2609
|
name: W,
|
|
2558
2610
|
doctype: v.value,
|
|
2559
|
-
recordId:
|
|
2560
|
-
data:
|
|
2611
|
+
recordId: b.value,
|
|
2612
|
+
data: O
|
|
2561
2613
|
});
|
|
2562
2614
|
}
|
|
2563
2615
|
}));
|
|
2564
2616
|
} catch (i) {
|
|
2565
2617
|
return console.warn("Error getting available transitions:", i), [];
|
|
2566
2618
|
}
|
|
2567
|
-
},
|
|
2619
|
+
}, T = R(() => {
|
|
2568
2620
|
const i = [];
|
|
2569
2621
|
switch (k.value) {
|
|
2570
2622
|
case "records":
|
|
@@ -2595,7 +2647,7 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2595
2647
|
{ title: L(h.value), to: `/${h.value}` }
|
|
2596
2648
|
);
|
|
2597
2649
|
else if (k.value === "record" && h.value) {
|
|
2598
|
-
const l =
|
|
2650
|
+
const l = b.value ? `/${h.value}/${b.value}` : u.value?.fullPath ?? "";
|
|
2599
2651
|
i.push(
|
|
2600
2652
|
{ title: "Home", to: "/" },
|
|
2601
2653
|
{ title: L(h.value), to: `/${h.value}` },
|
|
@@ -2641,15 +2693,15 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2641
2693
|
}), i ? l.filter(
|
|
2642
2694
|
(A) => A.title.toLowerCase().includes(i.toLowerCase()) || A.description.toLowerCase().includes(i.toLowerCase())
|
|
2643
2695
|
) : l;
|
|
2644
|
-
},
|
|
2696
|
+
}, z = (i) => {
|
|
2645
2697
|
i.action(), c.value = !1;
|
|
2646
|
-
}, L = (i) => i.split("-").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" "),
|
|
2647
|
-
|
|
2698
|
+
}, L = (i) => i.split("-").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" "), G = (i) => a.value ? a.value.getRecordIds(i).length : 0, E = async (i) => {
|
|
2699
|
+
o("navigate", i), t.routeAdapter ? await t.routeAdapter.navigate(i) : i.view === "doctypes" ? await w.value?.push("/") : i.view === "records" && i.doctype ? await w.value?.push(`/${i.doctype}`) : i.view === "record" && i.doctype && i.recordId && await w.value?.push(`/${i.doctype}/${i.recordId}`);
|
|
2648
2700
|
}, Y = async (i) => {
|
|
2649
2701
|
await E({ view: "records", doctype: i });
|
|
2650
2702
|
}, B = async (i) => {
|
|
2651
2703
|
const l = h.value;
|
|
2652
|
-
|
|
2704
|
+
o("record:open", { doctype: l, recordId: i }), await E({ view: "record", doctype: l, recordId: i });
|
|
2653
2705
|
}, g = async () => {
|
|
2654
2706
|
const i = `new-${Date.now()}`;
|
|
2655
2707
|
await E({ view: "record", doctype: h.value, recordId: i });
|
|
@@ -2659,7 +2711,7 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2659
2711
|
id: l,
|
|
2660
2712
|
doctype: l,
|
|
2661
2713
|
display_name: L(l),
|
|
2662
|
-
record_count:
|
|
2714
|
+
record_count: G(l),
|
|
2663
2715
|
actions: "View Records"
|
|
2664
2716
|
}));
|
|
2665
2717
|
return [
|
|
@@ -2713,10 +2765,10 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2713
2765
|
const i = N(), l = V();
|
|
2714
2766
|
if (l.length === 0)
|
|
2715
2767
|
return [];
|
|
2716
|
-
const A = i.map((
|
|
2717
|
-
|
|
2768
|
+
const A = i.map((O) => ({
|
|
2769
|
+
...O,
|
|
2718
2770
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2719
|
-
id:
|
|
2771
|
+
id: O.id || "",
|
|
2720
2772
|
actions: "Edit | Delete"
|
|
2721
2773
|
}));
|
|
2722
2774
|
return [
|
|
@@ -2724,10 +2776,10 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2724
2776
|
fieldname: "records_table",
|
|
2725
2777
|
component: "ATable",
|
|
2726
2778
|
columns: [
|
|
2727
|
-
...l.map((
|
|
2728
|
-
label:
|
|
2729
|
-
name:
|
|
2730
|
-
fieldtype:
|
|
2779
|
+
...l.map((O) => ({
|
|
2780
|
+
label: O.label,
|
|
2781
|
+
name: O.fieldname,
|
|
2782
|
+
fieldtype: O.fieldtype,
|
|
2731
2783
|
align: "left",
|
|
2732
2784
|
edit: !1,
|
|
2733
2785
|
width: "20ch"
|
|
@@ -2767,10 +2819,10 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2767
2819
|
try {
|
|
2768
2820
|
const l = a.value.registry.registry[v.value];
|
|
2769
2821
|
if (l?.schema)
|
|
2770
|
-
return ("toArray" in l.schema ? l.schema.toArray() : l.schema).map((
|
|
2771
|
-
fieldname:
|
|
2772
|
-
label: "label" in
|
|
2773
|
-
fieldtype: "fieldtype" in
|
|
2822
|
+
return ("toArray" in l.schema ? l.schema.toArray() : l.schema).map((O) => ({
|
|
2823
|
+
fieldname: O.fieldname,
|
|
2824
|
+
label: "label" in O && O.label || O.fieldname,
|
|
2825
|
+
fieldtype: "fieldtype" in O && O.fieldtype || "Data"
|
|
2774
2826
|
}));
|
|
2775
2827
|
} catch {
|
|
2776
2828
|
}
|
|
@@ -2788,10 +2840,10 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2788
2840
|
}
|
|
2789
2841
|
}), _ = (i, l) => {
|
|
2790
2842
|
l && l();
|
|
2791
|
-
},
|
|
2792
|
-
const l = i ||
|
|
2843
|
+
}, C = async (i) => {
|
|
2844
|
+
const l = i || b.value;
|
|
2793
2845
|
if (!l) return;
|
|
2794
|
-
(t.confirmFn ? await t.confirmFn("Are you sure you want to delete this record?") : confirm("Are you sure you want to delete this record?")) &&
|
|
2846
|
+
(t.confirmFn ? await t.confirmFn("Are you sure you want to delete this record?") : confirm("Are you sure you want to delete this record?")) && o("action", {
|
|
2795
2847
|
name: "DELETE",
|
|
2796
2848
|
doctype: v.value,
|
|
2797
2849
|
recordId: l,
|
|
@@ -2800,26 +2852,26 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2800
2852
|
}, S = async (i) => {
|
|
2801
2853
|
const l = i.target;
|
|
2802
2854
|
l.getAttribute("data-action") === "create" && await g();
|
|
2803
|
-
const
|
|
2804
|
-
if (
|
|
2805
|
-
const W =
|
|
2806
|
-
if (W === "View Records" &&
|
|
2807
|
-
const Q =
|
|
2855
|
+
const O = l.closest("td, th");
|
|
2856
|
+
if (O) {
|
|
2857
|
+
const W = O.textContent?.trim(), J = O.closest("tr");
|
|
2858
|
+
if (W === "View Records" && J) {
|
|
2859
|
+
const Q = J.querySelectorAll("td");
|
|
2808
2860
|
if (Q.length > 0) {
|
|
2809
2861
|
const ee = Q[1].textContent?.trim();
|
|
2810
2862
|
ee && await Y(ee);
|
|
2811
2863
|
}
|
|
2812
|
-
} else if (W?.includes("Edit") &&
|
|
2813
|
-
const Q =
|
|
2864
|
+
} else if (W?.includes("Edit") && J) {
|
|
2865
|
+
const Q = J.querySelectorAll("td");
|
|
2814
2866
|
if (Q.length > 0) {
|
|
2815
2867
|
const ee = Q[0].textContent?.trim();
|
|
2816
2868
|
ee && await B(ee);
|
|
2817
2869
|
}
|
|
2818
|
-
} else if (W?.includes("Delete") &&
|
|
2819
|
-
const Q =
|
|
2870
|
+
} else if (W?.includes("Delete") && J) {
|
|
2871
|
+
const Q = J.querySelectorAll("td");
|
|
2820
2872
|
if (Q.length > 0) {
|
|
2821
2873
|
const ee = Q[0].textContent?.trim();
|
|
2822
|
-
ee && await
|
|
2874
|
+
ee && await C(ee);
|
|
2823
2875
|
}
|
|
2824
2876
|
}
|
|
2825
2877
|
}
|
|
@@ -2827,7 +2879,7 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2827
2879
|
if (!(!a.value || !v.value)) {
|
|
2828
2880
|
s.value = !0;
|
|
2829
2881
|
try {
|
|
2830
|
-
m.value || a.value.getRecordById(v.value,
|
|
2882
|
+
m.value || a.value.getRecordById(v.value, b.value);
|
|
2831
2883
|
} catch (i) {
|
|
2832
2884
|
console.warn("Error loading record data:", i);
|
|
2833
2885
|
} finally {
|
|
@@ -2836,25 +2888,25 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2836
2888
|
}
|
|
2837
2889
|
};
|
|
2838
2890
|
return H(
|
|
2839
|
-
[k, v,
|
|
2891
|
+
[k, v, b],
|
|
2840
2892
|
() => {
|
|
2841
2893
|
k.value === "record" && p();
|
|
2842
2894
|
},
|
|
2843
2895
|
{ immediate: !0 }
|
|
2844
|
-
),
|
|
2896
|
+
), Ge("desktopMethods", {
|
|
2845
2897
|
navigateToDoctype: Y,
|
|
2846
2898
|
openRecord: B,
|
|
2847
2899
|
createNewRecord: g,
|
|
2848
|
-
handleDelete:
|
|
2900
|
+
handleDelete: C,
|
|
2849
2901
|
/**
|
|
2850
2902
|
* Convenience wrapper so child components (e.g. slot content) can emit
|
|
2851
2903
|
* an action event without needing a direct reference to the emit function.
|
|
2852
2904
|
*/
|
|
2853
2905
|
emitAction: (i, l) => {
|
|
2854
|
-
|
|
2906
|
+
o("action", {
|
|
2855
2907
|
name: i,
|
|
2856
2908
|
doctype: v.value,
|
|
2857
|
-
recordId:
|
|
2909
|
+
recordId: b.value,
|
|
2858
2910
|
data: l ?? d.value ?? {}
|
|
2859
2911
|
});
|
|
2860
2912
|
}
|
|
@@ -2865,22 +2917,22 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2865
2917
|
return document.addEventListener("keydown", i), () => {
|
|
2866
2918
|
document.removeEventListener("keydown", i);
|
|
2867
2919
|
};
|
|
2868
|
-
}), (i, l) => (
|
|
2920
|
+
}), (i, l) => (P(), j("div", {
|
|
2869
2921
|
class: "desktop",
|
|
2870
2922
|
onClick: S
|
|
2871
2923
|
}, [
|
|
2872
|
-
ne(
|
|
2873
|
-
elements:
|
|
2924
|
+
ne(bt, {
|
|
2925
|
+
elements: T.value,
|
|
2874
2926
|
onActionClick: _
|
|
2875
2927
|
}, null, 8, ["elements"]),
|
|
2876
|
-
M.value.length > 0 ? (
|
|
2928
|
+
M.value.length > 0 ? (P(), Qe(Ne(Uo), {
|
|
2877
2929
|
key: 0,
|
|
2878
2930
|
data: d.value,
|
|
2879
2931
|
"onUpdate:data": l[0] || (l[0] = (A) => d.value = A),
|
|
2880
2932
|
schema: M.value
|
|
2881
|
-
}, null, 8, ["data", "schema"])) : Ne(a) ? (
|
|
2933
|
+
}, null, 8, ["data", "schema"])) : Ne(a) ? (P(), j("div", Zo, [
|
|
2882
2934
|
x("p", null, "Loading " + X(k.value) + " data...", 1)
|
|
2883
|
-
])) : (
|
|
2935
|
+
])) : (P(), j("div", Ko, [...l[2] || (l[2] = [
|
|
2884
2936
|
x("p", null, "Initializing Stonecrop...", -1)
|
|
2885
2937
|
])])),
|
|
2886
2938
|
ne(Dt, { breadcrumbs: Z.value }, null, 8, ["breadcrumbs"]),
|
|
@@ -2888,7 +2940,7 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2888
2940
|
"is-open": c.value,
|
|
2889
2941
|
search: U,
|
|
2890
2942
|
placeholder: "Type a command or search...",
|
|
2891
|
-
onSelect:
|
|
2943
|
+
onSelect: z,
|
|
2892
2944
|
onClose: l[1] || (l[1] = (A) => c.value = !1)
|
|
2893
2945
|
}, {
|
|
2894
2946
|
title: me(({ result: A }) => [
|
|
@@ -2902,12 +2954,12 @@ const Lo = { class: "aform" }, Bo = {
|
|
|
2902
2954
|
]));
|
|
2903
2955
|
}
|
|
2904
2956
|
}), Yo = {
|
|
2905
|
-
install: (
|
|
2906
|
-
|
|
2957
|
+
install: (n) => {
|
|
2958
|
+
n.component("ActionSet", bt), n.component("CommandPalette", St), n.component("Desktop", Qo), n.component("SheetNav", Dt);
|
|
2907
2959
|
}
|
|
2908
2960
|
};
|
|
2909
2961
|
export {
|
|
2910
|
-
|
|
2962
|
+
bt as ActionSet,
|
|
2911
2963
|
St as CommandPalette,
|
|
2912
2964
|
Qo as Desktop,
|
|
2913
2965
|
Dt as SheetNav,
|