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