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