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