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