@stonecrop/desktop 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/desktop.js +353 -367
- package/dist/desktop.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Desktop.vue +28 -52
package/dist/desktop.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { defineComponent as Q, ref as M, onMounted as
|
|
2
|
-
import { useStonecrop as
|
|
3
|
-
import { AForm as
|
|
4
|
-
import { flattenFields as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as Q, ref as M, onMounted as ue, openBlock as y, createElementBlock as g, normalizeClass as O, createElementVNode as c, Fragment as W, renderList as q, toDisplayString as V, createCommentVNode as K, withDirectives as G, vShow as oe, useTemplateRef as de, computed as $, watch as H, nextTick as ve, createBlock as pe, Teleport as Te, createVNode as L, Transition as Ve, withCtx as z, withModifiers as fe, vModelText as me, renderSlot as Y, createTextVNode as J, resolveComponent as Ee, withKeys as j, normalizeStyle as Z, unref as ee, provide as te, onUnmounted as Be } from "vue";
|
|
2
|
+
import { useStonecrop as Fe, useValidationStore as Oe, isDraftRecordId as Le, DRAFT_RECORD_ID as Pe } from "@stonecrop/stonecrop";
|
|
3
|
+
import { AForm as je, resolvedFieldsToColumns as Ke } from "@stonecrop/aform";
|
|
4
|
+
import { flattenFields as He, componentLinkExpansion as ze } from "@stonecrop/schema";
|
|
5
|
+
const Ue = { class: "action-menu-icon" }, We = { class: "action-element-header" }, qe = ["disabled", "onClick"], Ge = { key: 0 }, Je = { class: "dropdown-header" }, Qe = ["onClick"], Xe = ["onClick"], Ye = { class: "dropdown-container" }, Ze = { class: "dropdown" }, et = ["onClick"], tt = ["href"], ot = { class: "dropdown-item" }, at = /* @__PURE__ */ Q({
|
|
6
6
|
__name: "ActionSet",
|
|
7
7
|
props: {
|
|
8
8
|
elements: { default: () => [] }
|
|
9
9
|
},
|
|
10
10
|
emits: ["actionClick"],
|
|
11
|
-
setup(l, { emit:
|
|
12
|
-
const D =
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
setup(l, { emit: S }) {
|
|
12
|
+
const D = S, w = M({}), d = M(!0), o = M([]);
|
|
13
|
+
ue(() => {
|
|
14
|
+
p();
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
w.value = {},
|
|
18
|
-
},
|
|
16
|
+
const p = () => {
|
|
17
|
+
w.value = {}, o.value = [];
|
|
18
|
+
}, _ = () => {
|
|
19
19
|
d.value = !d.value;
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, C = (i,
|
|
24
|
-
D("actionClick",
|
|
20
|
+
}, T = (i) => {
|
|
21
|
+
const f = !w.value[i];
|
|
22
|
+
p(), f && (w.value[i] = !0, o.value[i] = !0);
|
|
23
|
+
}, C = (i, f) => {
|
|
24
|
+
D("actionClick", f, i);
|
|
25
25
|
};
|
|
26
|
-
return (i,
|
|
27
|
-
class:
|
|
26
|
+
return (i, f) => (y(), g("div", {
|
|
27
|
+
class: O([{ collapsed: !d.value }, "action-set"])
|
|
28
28
|
}, [
|
|
29
|
-
c("div",
|
|
29
|
+
c("div", Ue, [
|
|
30
30
|
c("div", {
|
|
31
31
|
id: "cross",
|
|
32
|
-
class:
|
|
33
|
-
onClick:
|
|
32
|
+
class: O({ rotated: d.value }),
|
|
33
|
+
onClick: _
|
|
34
34
|
}, "×", 2)
|
|
35
35
|
]),
|
|
36
|
-
|
|
37
|
-
(
|
|
36
|
+
f[0] || (f[0] = c("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
37
|
+
(y(!0), g(W, null, q(l.elements, (s, r) => (y(), g("div", {
|
|
38
38
|
key: s.label,
|
|
39
39
|
class: "action-element"
|
|
40
40
|
}, [
|
|
41
|
-
c("div",
|
|
42
|
-
s.type == "button" ? (
|
|
41
|
+
c("div", We, [
|
|
42
|
+
s.type == "button" ? (y(), g("button", {
|
|
43
43
|
key: 0,
|
|
44
44
|
disabled: s.disabled,
|
|
45
45
|
class: "button-default",
|
|
46
46
|
onClick: (u) => C(s.action, s.label)
|
|
47
|
-
}, V(s.label), 9,
|
|
47
|
+
}, V(s.label), 9, qe)) : K("", !0)
|
|
48
48
|
]),
|
|
49
|
-
s.type == "dropdown" ? (
|
|
50
|
-
c("div",
|
|
49
|
+
s.type == "dropdown" ? (y(), g("div", Ge, [
|
|
50
|
+
c("div", Je, [
|
|
51
51
|
c("div", {
|
|
52
|
-
class:
|
|
53
|
-
onClick: (u) =>
|
|
54
|
-
}, "×", 10,
|
|
52
|
+
class: O(["cross", { rotated: o.value[r] }]),
|
|
53
|
+
onClick: (u) => T(r)
|
|
54
|
+
}, "×", 10, Qe),
|
|
55
55
|
c("button", {
|
|
56
56
|
class: "button-default dropdown-title",
|
|
57
|
-
onClick: (u) =>
|
|
58
|
-
}, V(s.label), 9,
|
|
57
|
+
onClick: (u) => T(r)
|
|
58
|
+
}, V(s.label), 9, Xe)
|
|
59
59
|
]),
|
|
60
|
-
G(c("div",
|
|
61
|
-
c("div",
|
|
62
|
-
(
|
|
60
|
+
G(c("div", Ye, [
|
|
61
|
+
c("div", Ze, [
|
|
62
|
+
(y(!0), g(W, null, q(s.actions, (u) => (y(), g("div", {
|
|
63
63
|
key: u.label
|
|
64
64
|
}, [
|
|
65
|
-
u.action != null ? (
|
|
65
|
+
u.action != null ? (y(), g("button", {
|
|
66
66
|
key: 0,
|
|
67
67
|
class: "dropdown-item",
|
|
68
|
-
onClick: (
|
|
69
|
-
}, V(u.label), 9,
|
|
68
|
+
onClick: (n) => C(u.action, u.label)
|
|
69
|
+
}, V(u.label), 9, et)) : u.link != null ? (y(), g("a", {
|
|
70
70
|
key: 1,
|
|
71
71
|
href: u.link
|
|
72
72
|
}, [
|
|
73
73
|
c("button", ot, V(u.label), 1)
|
|
74
|
-
], 8,
|
|
74
|
+
], 8, tt)) : K("", !0)
|
|
75
75
|
]))), 128))
|
|
76
76
|
])
|
|
77
77
|
], 512), [
|
|
78
|
-
[
|
|
78
|
+
[oe, w.value[r]]
|
|
79
79
|
])
|
|
80
|
-
])) :
|
|
80
|
+
])) : K("", !0)
|
|
81
81
|
]))), 128))
|
|
82
82
|
], 2));
|
|
83
83
|
}
|
|
84
|
-
}), ye = (l,
|
|
84
|
+
}), ye = (l, S) => {
|
|
85
85
|
const D = l.__vccOpts || l;
|
|
86
|
-
for (const [w, d] of
|
|
86
|
+
for (const [w, d] of S)
|
|
87
87
|
D[w] = d;
|
|
88
88
|
return D;
|
|
89
|
-
},
|
|
89
|
+
}, he = /* @__PURE__ */ ye(at, [["__scopeId", "data-v-54797d4b"]]), nt = { class: "command-palette-header" }, rt = ["placeholder"], lt = {
|
|
90
90
|
key: 0,
|
|
91
91
|
class: "command-palette-results"
|
|
92
|
-
},
|
|
92
|
+
}, st = ["onClick", "onMouseover"], ct = { class: "result-title" }, it = { class: "result-content" }, ut = {
|
|
93
93
|
key: 1,
|
|
94
94
|
class: "command-palette-no-results"
|
|
95
|
-
},
|
|
95
|
+
}, ge = /* @__PURE__ */ Q({
|
|
96
96
|
__name: "CommandPalette",
|
|
97
97
|
props: {
|
|
98
98
|
search: { type: Function },
|
|
@@ -101,128 +101,128 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
101
101
|
maxResults: { default: 10 }
|
|
102
102
|
},
|
|
103
103
|
emits: ["select", "close"],
|
|
104
|
-
setup(l, { emit:
|
|
105
|
-
const D =
|
|
104
|
+
setup(l, { emit: S }) {
|
|
105
|
+
const D = S, w = M(""), d = M(0), o = de("input"), p = $(() => w.value ? l.search(w.value).slice(0, l.maxResults) : []);
|
|
106
106
|
H(
|
|
107
107
|
() => l.isOpen,
|
|
108
108
|
async (i) => {
|
|
109
|
-
i && (w.value = "", d.value = 0, await
|
|
109
|
+
i && (w.value = "", d.value = 0, await ve(), o.value?.focus());
|
|
110
110
|
}
|
|
111
|
-
), H(
|
|
111
|
+
), H(p, () => {
|
|
112
112
|
d.value = 0;
|
|
113
113
|
});
|
|
114
|
-
const
|
|
114
|
+
const _ = () => {
|
|
115
115
|
D("close");
|
|
116
|
-
},
|
|
116
|
+
}, T = (i) => {
|
|
117
117
|
switch (i.key) {
|
|
118
118
|
case "Escape":
|
|
119
|
-
|
|
119
|
+
_();
|
|
120
120
|
break;
|
|
121
121
|
case "ArrowDown":
|
|
122
|
-
i.preventDefault(),
|
|
122
|
+
i.preventDefault(), p.value.length && (d.value = (d.value + 1) % p.value.length);
|
|
123
123
|
break;
|
|
124
124
|
case "ArrowUp":
|
|
125
|
-
i.preventDefault(),
|
|
125
|
+
i.preventDefault(), p.value.length && (d.value = (d.value - 1 + p.value.length) % p.value.length);
|
|
126
126
|
break;
|
|
127
127
|
case "Enter":
|
|
128
|
-
|
|
128
|
+
p.value.length && d.value >= 0 && C(p.value[d.value]);
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
131
131
|
}, C = (i) => {
|
|
132
|
-
D("select", i),
|
|
132
|
+
D("select", i), _();
|
|
133
133
|
};
|
|
134
|
-
return (i,
|
|
135
|
-
|
|
134
|
+
return (i, f) => (y(), pe(Te, { to: "body" }, [
|
|
135
|
+
L(Ve, { name: "fade" }, {
|
|
136
136
|
default: z(() => [
|
|
137
|
-
l.isOpen ? (
|
|
137
|
+
l.isOpen ? (y(), g("div", {
|
|
138
138
|
key: 0,
|
|
139
139
|
class: "command-palette-overlay",
|
|
140
|
-
onClick:
|
|
140
|
+
onClick: _
|
|
141
141
|
}, [
|
|
142
142
|
c("div", {
|
|
143
143
|
class: "command-palette",
|
|
144
|
-
onClick:
|
|
144
|
+
onClick: f[1] || (f[1] = fe(() => {
|
|
145
145
|
}, ["stop"]))
|
|
146
146
|
}, [
|
|
147
147
|
c("div", nt, [
|
|
148
148
|
G(c("input", {
|
|
149
149
|
ref: "input",
|
|
150
|
-
"onUpdate:modelValue":
|
|
150
|
+
"onUpdate:modelValue": f[0] || (f[0] = (s) => w.value = s),
|
|
151
151
|
type: "text",
|
|
152
152
|
class: "command-palette-input",
|
|
153
153
|
placeholder: l.placeholder,
|
|
154
154
|
autofocus: "",
|
|
155
|
-
onKeydown:
|
|
156
|
-
}, null, 40,
|
|
157
|
-
[
|
|
155
|
+
onKeydown: T
|
|
156
|
+
}, null, 40, rt), [
|
|
157
|
+
[me, w.value]
|
|
158
158
|
])
|
|
159
159
|
]),
|
|
160
|
-
|
|
161
|
-
(
|
|
162
|
-
key:
|
|
163
|
-
class:
|
|
160
|
+
p.value.length ? (y(), g("div", lt, [
|
|
161
|
+
(y(!0), g(W, null, q(p.value, (s, r) => (y(), g("div", {
|
|
162
|
+
key: r,
|
|
163
|
+
class: O(["command-palette-result", { selected: r === d.value }]),
|
|
164
164
|
onClick: (u) => C(s),
|
|
165
|
-
onMouseover: (u) => d.value =
|
|
165
|
+
onMouseover: (u) => d.value = r
|
|
166
166
|
}, [
|
|
167
|
-
c("div",
|
|
167
|
+
c("div", ct, [
|
|
168
168
|
Y(i.$slots, "title", { result: s })
|
|
169
169
|
]),
|
|
170
|
-
c("div",
|
|
170
|
+
c("div", it, [
|
|
171
171
|
Y(i.$slots, "content", { result: s })
|
|
172
172
|
])
|
|
173
|
-
], 42,
|
|
174
|
-
])) : w.value && !
|
|
173
|
+
], 42, st))), 128))
|
|
174
|
+
])) : w.value && !p.value.length ? (y(), g("div", ut, [
|
|
175
175
|
Y(i.$slots, "empty", {}, () => [
|
|
176
176
|
J(' No results found for "' + V(w.value) + '" ', 1)
|
|
177
177
|
])
|
|
178
|
-
])) :
|
|
178
|
+
])) : K("", !0)
|
|
179
179
|
])
|
|
180
|
-
])) :
|
|
180
|
+
])) : K("", !0)
|
|
181
181
|
]),
|
|
182
182
|
_: 3
|
|
183
183
|
})
|
|
184
184
|
]));
|
|
185
185
|
}
|
|
186
|
-
}),
|
|
186
|
+
}), dt = { class: "tabs" }, vt = { tabindex: "0" }, pt = { tabindex: "0" }, ft = /* @__PURE__ */ Q({
|
|
187
187
|
__name: "SheetNav",
|
|
188
188
|
props: {
|
|
189
189
|
breadcrumbs: { default: () => [] }
|
|
190
190
|
},
|
|
191
191
|
setup(l) {
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
D.value = !D.value, await
|
|
192
|
+
const S = M(!0), D = M(!1), w = M(""), d = de("searchinput"), o = $(() => S.value ? "unrotated" : "rotated"), p = () => {
|
|
193
|
+
S.value = !S.value;
|
|
194
|
+
}, _ = async () => {
|
|
195
|
+
D.value = !D.value, await ve(() => {
|
|
196
196
|
d.value?.focus();
|
|
197
197
|
});
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
}, C = async (
|
|
201
|
-
|
|
198
|
+
}, T = (f) => {
|
|
199
|
+
f.preventDefault(), f.stopPropagation();
|
|
200
|
+
}, C = async (f) => {
|
|
201
|
+
f.preventDefault(), f.stopPropagation(), await _();
|
|
202
202
|
}, i = () => {
|
|
203
203
|
};
|
|
204
|
-
return (
|
|
205
|
-
const
|
|
206
|
-
return
|
|
207
|
-
c("ul",
|
|
204
|
+
return (f, s) => {
|
|
205
|
+
const r = Ee("router-link");
|
|
206
|
+
return y(), g("footer", null, [
|
|
207
|
+
c("ul", dt, [
|
|
208
208
|
c("li", {
|
|
209
209
|
class: "hidebreadcrumbs",
|
|
210
|
-
onClick:
|
|
211
|
-
onKeydown:
|
|
210
|
+
onClick: p,
|
|
211
|
+
onKeydown: j(p, ["enter"])
|
|
212
212
|
}, [
|
|
213
|
-
c("a",
|
|
213
|
+
c("a", vt, [
|
|
214
214
|
c("div", {
|
|
215
|
-
class:
|
|
215
|
+
class: O(o.value)
|
|
216
216
|
}, "×", 2)
|
|
217
217
|
])
|
|
218
218
|
], 32),
|
|
219
219
|
c("li", {
|
|
220
220
|
class: "hometab",
|
|
221
|
-
style: Z({ display:
|
|
221
|
+
style: Z({ display: S.value ? "block" : "none" }),
|
|
222
222
|
onClick: i,
|
|
223
|
-
onKeydown:
|
|
223
|
+
onKeydown: j(i, ["enter"])
|
|
224
224
|
}, [
|
|
225
|
-
|
|
225
|
+
L(r, {
|
|
226
226
|
to: "/",
|
|
227
227
|
tabindex: "0"
|
|
228
228
|
}, {
|
|
@@ -243,11 +243,11 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
243
243
|
})
|
|
244
244
|
], 36),
|
|
245
245
|
c("li", {
|
|
246
|
-
class:
|
|
247
|
-
style: Z({ display:
|
|
246
|
+
class: O(["searchtab", { "search-active": D.value }]),
|
|
247
|
+
style: Z({ display: S.value ? "block" : "none" })
|
|
248
248
|
}, [
|
|
249
|
-
c("a",
|
|
250
|
-
G((
|
|
249
|
+
c("a", pt, [
|
|
250
|
+
G((y(), g("svg", {
|
|
251
251
|
class: "icon search-icon",
|
|
252
252
|
role: "button",
|
|
253
253
|
"aria-label": "Search",
|
|
@@ -255,8 +255,8 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
255
255
|
fill: "none",
|
|
256
256
|
stroke: "currentColor",
|
|
257
257
|
"stroke-width": "2",
|
|
258
|
-
onClick:
|
|
259
|
-
onKeydown:
|
|
258
|
+
onClick: _,
|
|
259
|
+
onKeydown: j(_, ["enter"])
|
|
260
260
|
}, [...s[6] || (s[6] = [
|
|
261
261
|
c("circle", {
|
|
262
262
|
cx: "11",
|
|
@@ -265,32 +265,32 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
265
265
|
}, null, -1),
|
|
266
266
|
c("path", { d: "M21 21l-4.35-4.35" }, null, -1)
|
|
267
267
|
])], 544)), [
|
|
268
|
-
[
|
|
268
|
+
[oe, !D.value]
|
|
269
269
|
]),
|
|
270
270
|
G(c("input", {
|
|
271
271
|
ref: "searchinput",
|
|
272
272
|
"onUpdate:modelValue": s[0] || (s[0] = (u) => w.value = u),
|
|
273
273
|
type: "text",
|
|
274
274
|
placeholder: "Search...",
|
|
275
|
-
onClick: s[1] || (s[1] =
|
|
275
|
+
onClick: s[1] || (s[1] = fe(() => {
|
|
276
276
|
}, ["stop"])),
|
|
277
|
-
onInput: s[2] || (s[2] = (u) =>
|
|
277
|
+
onInput: s[2] || (s[2] = (u) => T(u)),
|
|
278
278
|
onBlur: s[3] || (s[3] = (u) => C(u)),
|
|
279
279
|
onKeydown: [
|
|
280
|
-
s[4] || (s[4] =
|
|
281
|
-
|
|
280
|
+
s[4] || (s[4] = j((u) => C(u), ["enter"])),
|
|
281
|
+
j(_, ["escape"])
|
|
282
282
|
]
|
|
283
283
|
}, null, 544), [
|
|
284
|
-
[
|
|
285
|
-
[
|
|
284
|
+
[oe, D.value],
|
|
285
|
+
[me, w.value]
|
|
286
286
|
])
|
|
287
287
|
])
|
|
288
288
|
], 6),
|
|
289
|
-
(
|
|
289
|
+
(y(!0), g(W, null, q(l.breadcrumbs, (u) => (y(), g("li", {
|
|
290
290
|
key: u.title,
|
|
291
|
-
style: Z({ display:
|
|
291
|
+
style: Z({ display: S.value ? "block" : "none" })
|
|
292
292
|
}, [
|
|
293
|
-
|
|
293
|
+
L(r, {
|
|
294
294
|
tabindex: "0",
|
|
295
295
|
to: u.to
|
|
296
296
|
}, {
|
|
@@ -304,57 +304,54 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
304
304
|
]);
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
}),
|
|
307
|
+
}), we = /* @__PURE__ */ ye(ft, [["__scopeId", "data-v-0072260b"]]), mt = {
|
|
308
308
|
key: 1,
|
|
309
309
|
class: "loading"
|
|
310
310
|
}, yt = {
|
|
311
311
|
key: 2,
|
|
312
312
|
class: "loading"
|
|
313
|
-
},
|
|
314
|
-
key: 3,
|
|
315
|
-
class: "truncation-note"
|
|
316
|
-
}, wt = /* @__PURE__ */ Q({
|
|
313
|
+
}, ht = /* @__PURE__ */ Q({
|
|
317
314
|
__name: "Desktop",
|
|
318
315
|
props: {
|
|
319
316
|
availableDoctypes: { default: () => [] },
|
|
320
317
|
routeAdapter: {}
|
|
321
318
|
},
|
|
322
319
|
emits: ["action", "navigate", "record:open", "load-records", "load-record"],
|
|
323
|
-
setup(l, { emit:
|
|
320
|
+
setup(l, { emit: S }) {
|
|
324
321
|
function D(e) {
|
|
325
|
-
const t =
|
|
322
|
+
const t = He(e).filter((a) => a.kind === "field" && !!a.doctype);
|
|
326
323
|
return new Set(
|
|
327
|
-
t.filter((
|
|
324
|
+
t.filter((a) => ze(a.component) === "inline").map((a) => a.fieldname)
|
|
328
325
|
);
|
|
329
326
|
}
|
|
330
327
|
function w(e) {
|
|
331
328
|
return e !== null && typeof e == "object" && !Array.isArray(e) && "id" in e ? e.id : e;
|
|
332
329
|
}
|
|
333
|
-
const d =
|
|
334
|
-
let
|
|
330
|
+
const d = S, { stonecrop: o } = Fe();
|
|
331
|
+
let p = null;
|
|
335
332
|
try {
|
|
336
|
-
|
|
333
|
+
p = Oe();
|
|
337
334
|
} catch {
|
|
338
|
-
|
|
335
|
+
p = null;
|
|
339
336
|
}
|
|
340
|
-
const
|
|
341
|
-
() =>
|
|
342
|
-
),
|
|
337
|
+
const _ = $(
|
|
338
|
+
() => x.value === "record" ? p?.errorsByField ?? {} : {}
|
|
339
|
+
), T = M(!1), C = M(!1), i = M({}), f = $({
|
|
343
340
|
get() {
|
|
344
|
-
if (
|
|
341
|
+
if (x.value === "doctypes")
|
|
345
342
|
return {
|
|
346
343
|
doctypes_table: l.availableDoctypes?.map((e) => ({
|
|
347
344
|
id: e,
|
|
348
345
|
doctype: e,
|
|
349
|
-
display_name:
|
|
346
|
+
display_name: F(e),
|
|
350
347
|
actions: "View Records"
|
|
351
348
|
})) ?? []
|
|
352
349
|
};
|
|
353
|
-
if (
|
|
350
|
+
if (x.value === "records")
|
|
354
351
|
return {
|
|
355
|
-
records_table:
|
|
352
|
+
records_table: le().map(
|
|
356
353
|
(e) => Object.assign({}, e, {
|
|
357
|
-
id:
|
|
354
|
+
id: ce(e) ?? "",
|
|
358
355
|
// A list row is navigation. Actions live on the record view, where the Actions
|
|
359
356
|
// dropdown is built from what the doctype declares and what the record's
|
|
360
357
|
// current state allows. This cell used to also offer Delete, which dispatched
|
|
@@ -365,17 +362,17 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
365
362
|
})
|
|
366
363
|
)
|
|
367
364
|
};
|
|
368
|
-
if (!
|
|
365
|
+
if (!o.value || !n.value || !h.value)
|
|
369
366
|
return {};
|
|
370
367
|
try {
|
|
371
|
-
const t = { ...
|
|
372
|
-
if (
|
|
373
|
-
for (const
|
|
374
|
-
if (
|
|
375
|
-
const
|
|
376
|
-
for (const A of
|
|
377
|
-
A.fieldname && (
|
|
378
|
-
t[
|
|
368
|
+
const t = { ...B.value ? i.value : o.value.getRecordById(n.value, h.value)?.get("") }, a = o.value.registry.registry[n.value];
|
|
369
|
+
if (a) {
|
|
370
|
+
for (const m of a.getSchemaArray())
|
|
371
|
+
if (m.kind === "fieldset") {
|
|
372
|
+
const v = {};
|
|
373
|
+
for (const A of m.schema)
|
|
374
|
+
A.fieldname && (v[A.fieldname] = t[A.fieldname]);
|
|
375
|
+
t[m.fieldname] = v;
|
|
379
376
|
}
|
|
380
377
|
}
|
|
381
378
|
return t;
|
|
@@ -384,135 +381,135 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
384
381
|
}
|
|
385
382
|
},
|
|
386
383
|
set(e) {
|
|
387
|
-
if (
|
|
384
|
+
if (x.value === "record" && !(!o.value || !n.value || !h.value))
|
|
388
385
|
try {
|
|
389
|
-
const t =
|
|
386
|
+
const t = o.value.registry.registry[n.value], a = /* @__PURE__ */ new Set();
|
|
390
387
|
if (t)
|
|
391
388
|
for (const k of t.getSchemaArray())
|
|
392
|
-
k.kind === "fieldset" &&
|
|
393
|
-
const
|
|
389
|
+
k.kind === "fieldset" && a.add(k.fieldname);
|
|
390
|
+
const m = D(t ? t.getSchemaArray() : []), v = {}, A = [];
|
|
394
391
|
for (const [k, b] of Object.entries(e))
|
|
395
|
-
|
|
392
|
+
a.has(k) && b && typeof b == "object" && !Array.isArray(b) ? A.push(b) : v[k] = b;
|
|
396
393
|
for (const k of A)
|
|
397
|
-
Object.assign(
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
394
|
+
Object.assign(v, k);
|
|
395
|
+
const I = [];
|
|
396
|
+
if (B.value) {
|
|
400
397
|
const k = { ...i.value };
|
|
401
|
-
for (const [b,
|
|
402
|
-
if (
|
|
403
|
-
const P =
|
|
404
|
-
k[b] !== P && (k[b] = P,
|
|
398
|
+
for (const [b, N] of Object.entries(v)) {
|
|
399
|
+
if (N === void 0) continue;
|
|
400
|
+
const P = m.has(b) ? w(N) : N;
|
|
401
|
+
k[b] !== P && (k[b] = P, I.push(b));
|
|
405
402
|
}
|
|
406
403
|
i.value = k;
|
|
407
404
|
} else {
|
|
408
|
-
const k =
|
|
409
|
-
for (const [b,
|
|
410
|
-
if (
|
|
411
|
-
const P =
|
|
412
|
-
(k.has(X) ? k.get(X) : void 0) !== P && (k.set(X, P),
|
|
405
|
+
const k = o.value.getStore();
|
|
406
|
+
for (const [b, N] of Object.entries(v)) {
|
|
407
|
+
if (N === void 0) continue;
|
|
408
|
+
const P = m.has(b) ? w(N) : N, X = `${n.value}.${h.value}.${b}`;
|
|
409
|
+
(k.has(X) ? k.get(X) : void 0) !== P && (k.set(X, P), I.push(b));
|
|
413
410
|
}
|
|
414
411
|
}
|
|
415
|
-
|
|
412
|
+
I.length > 0 && s(I);
|
|
416
413
|
} catch (t) {
|
|
417
414
|
console.warn("HST update failed:", t);
|
|
418
415
|
}
|
|
419
416
|
}
|
|
420
417
|
});
|
|
421
418
|
function s(e) {
|
|
422
|
-
if (!
|
|
423
|
-
const
|
|
424
|
-
if (!
|
|
425
|
-
const
|
|
426
|
-
...
|
|
419
|
+
if (!p || !o.value || !n.value || !h.value) return;
|
|
420
|
+
const a = o.value.registry.getDoctype(n.value)?.getTriggers();
|
|
421
|
+
if (!a || Object.keys(a).length === 0) return;
|
|
422
|
+
const m = B.value ? { ...i.value } : {
|
|
423
|
+
...o.value.getRecordById(n.value, h.value)?.get("")
|
|
427
424
|
};
|
|
428
|
-
for (const
|
|
429
|
-
|
|
425
|
+
for (const v of e)
|
|
426
|
+
p.validateField(a, v, m);
|
|
430
427
|
}
|
|
431
|
-
const
|
|
428
|
+
const r = $(() => l.routeAdapter ? null : ee(o.value?.registry.router?.currentRoute)), u = $(() => l.routeAdapter ? null : o.value?.registry.router), n = $(() => {
|
|
432
429
|
if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
|
|
433
|
-
if (!
|
|
434
|
-
if (
|
|
435
|
-
return
|
|
436
|
-
if (
|
|
437
|
-
return
|
|
438
|
-
const e =
|
|
430
|
+
if (!r.value) return "";
|
|
431
|
+
if (r.value.meta?.actualDoctype)
|
|
432
|
+
return r.value.meta.actualDoctype;
|
|
433
|
+
if (r.value.params.doctype)
|
|
434
|
+
return r.value.params.doctype.toString();
|
|
435
|
+
const e = r.value.params.pathMatch;
|
|
439
436
|
return e && e.length > 0 ? e[0] : "";
|
|
440
|
-
}), R =
|
|
437
|
+
}), R = $(() => {
|
|
441
438
|
if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
|
|
442
|
-
if (!
|
|
443
|
-
if (
|
|
444
|
-
return
|
|
445
|
-
if (
|
|
446
|
-
return
|
|
447
|
-
const e =
|
|
439
|
+
if (!r.value) return "";
|
|
440
|
+
if (r.value.meta?.doctype)
|
|
441
|
+
return r.value.meta.doctype;
|
|
442
|
+
if (r.value.params.doctype)
|
|
443
|
+
return r.value.params.doctype.toString();
|
|
444
|
+
const e = r.value.params.pathMatch;
|
|
448
445
|
return e && e.length > 0 ? e[0] : "";
|
|
449
|
-
}), h =
|
|
446
|
+
}), h = $(() => {
|
|
450
447
|
if (l.routeAdapter) return l.routeAdapter.getCurrentRecordId();
|
|
451
|
-
if (!
|
|
452
|
-
if (
|
|
453
|
-
return
|
|
454
|
-
const e =
|
|
448
|
+
if (!r.value) return "";
|
|
449
|
+
if (r.value.params.recordId)
|
|
450
|
+
return r.value.params.recordId.toString();
|
|
451
|
+
const e = r.value.params.pathMatch;
|
|
455
452
|
return e && e.length > 1 ? e[1] : "";
|
|
456
|
-
}),
|
|
453
|
+
}), B = $(() => Le(h.value)), x = $(() => {
|
|
457
454
|
if (l.routeAdapter) return l.routeAdapter.getCurrentView();
|
|
458
|
-
if (!
|
|
455
|
+
if (!r.value || r.value.name === "home" || r.value.path === "/")
|
|
459
456
|
return "doctypes";
|
|
460
|
-
if (
|
|
461
|
-
const t =
|
|
462
|
-
if (t.includes("form") ||
|
|
457
|
+
if (r.value.name && r.value.name !== "catch-all") {
|
|
458
|
+
const t = r.value.name;
|
|
459
|
+
if (t.includes("form") || r.value.params.recordId)
|
|
463
460
|
return "record";
|
|
464
|
-
if (t.includes("list") ||
|
|
461
|
+
if (t.includes("list") || r.value.params.doctype)
|
|
465
462
|
return "records";
|
|
466
463
|
}
|
|
467
|
-
const e =
|
|
464
|
+
const e = r.value.params.pathMatch;
|
|
468
465
|
return e && e.length > 0 ? e.length === 1 ? "records" : "record" : "doctypes";
|
|
469
|
-
}),
|
|
470
|
-
if (!
|
|
466
|
+
}), be = () => {
|
|
467
|
+
if (!o.value || !n.value || !h.value)
|
|
471
468
|
return [];
|
|
472
469
|
try {
|
|
473
|
-
const e =
|
|
470
|
+
const e = o.value.registry.getDoctype(n.value);
|
|
474
471
|
if (!e?.workflow) return [];
|
|
475
|
-
const t =
|
|
476
|
-
return
|
|
472
|
+
const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableTransitions(t), m = f.value || {};
|
|
473
|
+
return a.map(({ name: v }) => ({
|
|
477
474
|
// Prefer the workflow action's human-readable label (WorkflowMeta format);
|
|
478
475
|
// fall back to the raw transition name for XState workflows with no action meta.
|
|
479
|
-
label: e.getActionMeta(
|
|
476
|
+
label: e.getActionMeta(v)?.label ?? v,
|
|
480
477
|
action: () => {
|
|
481
478
|
d("action", {
|
|
482
|
-
name:
|
|
483
|
-
doctype:
|
|
479
|
+
name: v,
|
|
480
|
+
doctype: n.value,
|
|
484
481
|
recordId: h.value,
|
|
485
|
-
data:
|
|
482
|
+
data: m
|
|
486
483
|
});
|
|
487
484
|
}
|
|
488
485
|
}));
|
|
489
486
|
} catch (e) {
|
|
490
487
|
return console.warn("Error getting available transitions:", e), [];
|
|
491
488
|
}
|
|
492
|
-
},
|
|
493
|
-
if (!
|
|
489
|
+
}, ke = () => {
|
|
490
|
+
if (!o.value || !n.value || !h.value)
|
|
494
491
|
return [];
|
|
495
492
|
try {
|
|
496
|
-
const e =
|
|
493
|
+
const e = o.value.registry.getDoctype(n.value);
|
|
497
494
|
if (!e?.workflow) return [];
|
|
498
|
-
const t =
|
|
499
|
-
return
|
|
500
|
-
label: e.getActionMeta(
|
|
495
|
+
const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableCommands(t), m = f.value || {};
|
|
496
|
+
return a.map(({ name: v }) => ({
|
|
497
|
+
label: e.getActionMeta(v)?.label ?? v,
|
|
501
498
|
action: () => {
|
|
502
499
|
d("action", {
|
|
503
|
-
name:
|
|
504
|
-
doctype:
|
|
500
|
+
name: v,
|
|
501
|
+
doctype: n.value,
|
|
505
502
|
recordId: h.value,
|
|
506
|
-
data:
|
|
503
|
+
data: m
|
|
507
504
|
});
|
|
508
505
|
}
|
|
509
506
|
}));
|
|
510
507
|
} catch (e) {
|
|
511
508
|
return console.warn("Error getting available commands:", e), [];
|
|
512
509
|
}
|
|
513
|
-
},
|
|
510
|
+
}, Ce = $(() => {
|
|
514
511
|
const e = [];
|
|
515
|
-
switch (
|
|
512
|
+
switch (x.value) {
|
|
516
513
|
case "records":
|
|
517
514
|
e.push({
|
|
518
515
|
type: "button",
|
|
@@ -523,7 +520,7 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
523
520
|
});
|
|
524
521
|
break;
|
|
525
522
|
case "record": {
|
|
526
|
-
const t = [...
|
|
523
|
+
const t = [...be(), ...ke()];
|
|
527
524
|
t.length > 0 && e.push({
|
|
528
525
|
type: "dropdown",
|
|
529
526
|
label: "Actions",
|
|
@@ -533,23 +530,23 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
533
530
|
}
|
|
534
531
|
}
|
|
535
532
|
return e;
|
|
536
|
-
}),
|
|
533
|
+
}), Ae = $(() => {
|
|
537
534
|
const e = [];
|
|
538
|
-
if (
|
|
535
|
+
if (x.value === "records" && R.value)
|
|
539
536
|
e.push(
|
|
540
537
|
{ title: "Home", to: "/" },
|
|
541
|
-
{ title:
|
|
538
|
+
{ title: F(R.value), to: `/${R.value}` }
|
|
542
539
|
);
|
|
543
|
-
else if (
|
|
544
|
-
const t = h.value ? `/${R.value}/${h.value}` :
|
|
540
|
+
else if (x.value === "record" && R.value) {
|
|
541
|
+
const t = h.value ? `/${R.value}/${h.value}` : r.value?.fullPath ?? "";
|
|
545
542
|
e.push(
|
|
546
543
|
{ title: "Home", to: "/" },
|
|
547
|
-
{ title:
|
|
548
|
-
{ title:
|
|
544
|
+
{ title: F(R.value), to: `/${R.value}` },
|
|
545
|
+
{ title: B.value ? "New Record" : "Edit Record", to: t }
|
|
549
546
|
);
|
|
550
547
|
}
|
|
551
548
|
return e;
|
|
552
|
-
}),
|
|
549
|
+
}), De = (e) => {
|
|
553
550
|
const t = [
|
|
554
551
|
{
|
|
555
552
|
title: "Go Home",
|
|
@@ -565,45 +562,45 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
565
562
|
}
|
|
566
563
|
];
|
|
567
564
|
return R.value && (t.push({
|
|
568
|
-
title: `View ${
|
|
565
|
+
title: `View ${F(R.value)} Records`,
|
|
569
566
|
description: `Navigate to ${R.value} list`,
|
|
570
567
|
action: () => {
|
|
571
568
|
E({ view: "records", doctype: R.value });
|
|
572
569
|
}
|
|
573
570
|
}), t.push({
|
|
574
|
-
title: `Create New ${
|
|
571
|
+
title: `Create New ${F(R.value)}`,
|
|
575
572
|
description: `Create a new ${R.value} record`,
|
|
576
573
|
action: () => {
|
|
577
574
|
U();
|
|
578
575
|
}
|
|
579
|
-
})), l.availableDoctypes.forEach((
|
|
576
|
+
})), l.availableDoctypes.forEach((a) => {
|
|
580
577
|
t.push({
|
|
581
|
-
title: `View ${
|
|
582
|
-
description: `Navigate to ${
|
|
578
|
+
title: `View ${F(a)}`,
|
|
579
|
+
description: `Navigate to ${a} list`,
|
|
583
580
|
action: () => {
|
|
584
|
-
E({ view: "records", doctype:
|
|
581
|
+
E({ view: "records", doctype: a });
|
|
585
582
|
}
|
|
586
583
|
});
|
|
587
584
|
}), e ? t.filter(
|
|
588
|
-
(
|
|
585
|
+
(a) => a.title.toLowerCase().includes(e.toLowerCase()) || a.description.toLowerCase().includes(e.toLowerCase())
|
|
589
586
|
) : t;
|
|
590
|
-
},
|
|
587
|
+
}, Re = (e) => {
|
|
591
588
|
e.action(), C.value = !1;
|
|
592
|
-
},
|
|
589
|
+
}, Se = (e) => {
|
|
590
|
+
if (!o.value || !n.value)
|
|
591
|
+
return Promise.resolve({ data: [], hasMore: !1 });
|
|
592
|
+
const t = o.value.registry.getDoctype(n.value);
|
|
593
|
+
return t ? o.value.getRecords(t, e) : Promise.resolve({ data: [], hasMore: !1 });
|
|
594
|
+
}, F = (e) => e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), E = async (e) => {
|
|
593
595
|
d("navigate", e), l.routeAdapter ? await l.routeAdapter.navigate(e) : e.view === "doctypes" ? await u.value?.push("/") : e.view === "records" && e.doctype ? await u.value?.push(`/${e.doctype}`) : e.view === "record" && e.doctype && e.recordId && await u.value?.push(`/${e.doctype}/${e.recordId}`);
|
|
594
|
-
},
|
|
596
|
+
}, ae = async (e) => {
|
|
595
597
|
await E({ view: "records", doctype: e });
|
|
596
|
-
},
|
|
598
|
+
}, ne = async (e) => {
|
|
597
599
|
const t = R.value;
|
|
598
600
|
d("record:open", { doctype: t, recordId: e }), await E({ view: "record", doctype: t, recordId: e });
|
|
599
601
|
}, U = async () => {
|
|
600
|
-
await E({ view: "record", doctype: R.value, recordId:
|
|
601
|
-
},
|
|
602
|
-
const t = [];
|
|
603
|
-
for (const o of e)
|
|
604
|
-
o.kind === "fieldset" ? t.push(...ne(o.schema)) : t.push(o);
|
|
605
|
-
return t;
|
|
606
|
-
}, Ie = () => l.availableDoctypes?.length ? [
|
|
602
|
+
await E({ view: "record", doctype: R.value, recordId: Pe });
|
|
603
|
+
}, $e = () => l.availableDoctypes?.length ? [
|
|
607
604
|
{
|
|
608
605
|
kind: "table",
|
|
609
606
|
fieldname: "doctypes_table",
|
|
@@ -641,132 +638,122 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
641
638
|
],
|
|
642
639
|
config: { view: "list", fullWidth: !0 }
|
|
643
640
|
}
|
|
644
|
-
] : [],
|
|
645
|
-
if (!
|
|
646
|
-
if (!
|
|
647
|
-
const e =
|
|
641
|
+
] : [], Ie = () => {
|
|
642
|
+
if (!n.value) return [];
|
|
643
|
+
if (!o.value) return [];
|
|
644
|
+
const e = o.value.registry, t = e.registry[n.value];
|
|
648
645
|
if (!t) return [];
|
|
649
|
-
const
|
|
650
|
-
|
|
646
|
+
const a = e.resolveSchema(t);
|
|
647
|
+
if (a.length === 0) return [];
|
|
648
|
+
const m = n.value, v = !!o.value.getClient();
|
|
649
|
+
return [
|
|
651
650
|
{
|
|
652
651
|
kind: "table",
|
|
653
652
|
fieldname: "records_table",
|
|
654
653
|
component: "ATable",
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
],
|
|
659
|
-
config: { view: "list", fullWidth: !0 }
|
|
654
|
+
// Which resolved fields a cell can render is answered once, in @stonecrop/aform, and
|
|
655
|
+
// called by the child-table builder too. Flattening alone is not the rule: it kept the
|
|
656
|
+
// expanding links, whose value is a nested record or an array of them.
|
|
657
|
+
schema: [...Ke(a), { fieldname: "actions", label: "Actions", component: "ATextInput" }],
|
|
658
|
+
config: { view: "list", fullWidth: !0 },
|
|
659
|
+
...v ? { getRecords: Se, sourceKey: m } : {}
|
|
660
660
|
}
|
|
661
661
|
];
|
|
662
|
-
},
|
|
663
|
-
if (!
|
|
664
|
-
if (!
|
|
662
|
+
}, re = () => {
|
|
663
|
+
if (!n.value) return [];
|
|
664
|
+
if (!o.value) return [];
|
|
665
665
|
try {
|
|
666
|
-
const e =
|
|
666
|
+
const e = o.value?.registry, t = e?.registry[n.value];
|
|
667
667
|
return t?.schema ? e.resolveSchema(t) : [];
|
|
668
668
|
} catch {
|
|
669
669
|
return [];
|
|
670
670
|
}
|
|
671
|
-
},
|
|
672
|
-
if (!
|
|
671
|
+
}, le = () => {
|
|
672
|
+
if (!o.value || !n.value)
|
|
673
673
|
return [];
|
|
674
|
-
const t =
|
|
674
|
+
const t = o.value.records(n.value)?.get("");
|
|
675
675
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.values(t) : [];
|
|
676
|
-
},
|
|
677
|
-
switch (
|
|
676
|
+
}, se = $(() => {
|
|
677
|
+
switch (x.value) {
|
|
678
678
|
case "doctypes":
|
|
679
|
-
return
|
|
679
|
+
return $e();
|
|
680
680
|
case "records":
|
|
681
|
-
return
|
|
681
|
+
return Ie();
|
|
682
682
|
case "record":
|
|
683
|
-
return
|
|
683
|
+
return re();
|
|
684
684
|
default:
|
|
685
685
|
return [];
|
|
686
686
|
}
|
|
687
|
-
}),
|
|
687
|
+
}), _e = (e, t) => {
|
|
688
688
|
t && t();
|
|
689
|
-
},
|
|
690
|
-
if (!(!
|
|
691
|
-
return
|
|
692
|
-
},
|
|
689
|
+
}, ce = (e) => {
|
|
690
|
+
if (!(!o.value || !n.value))
|
|
691
|
+
return o.value.registry.registry[n.value]?.getRecordId(e);
|
|
692
|
+
}, xe = (e) => {
|
|
693
693
|
const t = e.querySelector("td[data-rowindex]");
|
|
694
694
|
if (!t) return null;
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
697
|
-
const
|
|
698
|
-
if (isNaN(
|
|
699
|
-
const A =
|
|
700
|
-
return A ?
|
|
701
|
-
},
|
|
695
|
+
const a = t.getAttribute("data-rowindex");
|
|
696
|
+
if (a === null) return null;
|
|
697
|
+
const m = parseInt(a, 10);
|
|
698
|
+
if (isNaN(m)) return null;
|
|
699
|
+
const A = le()[m];
|
|
700
|
+
return A ? ce(A) ?? null : null;
|
|
701
|
+
}, Ne = async (e) => {
|
|
702
702
|
const t = e.target;
|
|
703
703
|
t.getAttribute("data-action") === "create" && await U();
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
706
|
-
const
|
|
707
|
-
if (
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
710
|
-
const b =
|
|
711
|
-
b && await
|
|
704
|
+
const m = t.closest("td, th");
|
|
705
|
+
if (m) {
|
|
706
|
+
const v = m.textContent?.trim(), A = m.closest("tr");
|
|
707
|
+
if (v === "View Records" && A) {
|
|
708
|
+
const I = A.querySelectorAll("td");
|
|
709
|
+
if (I.length > 0) {
|
|
710
|
+
const b = I[1].textContent?.trim();
|
|
711
|
+
b && await ae(b);
|
|
712
712
|
}
|
|
713
|
-
} else if (
|
|
714
|
-
const
|
|
715
|
-
|
|
713
|
+
} else if (v === "Edit" && A) {
|
|
714
|
+
const I = xe(A);
|
|
715
|
+
I && await ne(I);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
718
|
}, Me = async () => {
|
|
719
|
-
if (!(!
|
|
720
|
-
|
|
719
|
+
if (!(!o.value || !n.value || !o.value.getClient())) {
|
|
720
|
+
T.value = !0;
|
|
721
721
|
try {
|
|
722
|
-
await
|
|
722
|
+
await o.value.getRecord(n.value, h.value);
|
|
723
723
|
} catch (e) {
|
|
724
724
|
console.warn("Error fetching record:", e);
|
|
725
725
|
} finally {
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}, Ve = async () => {
|
|
730
|
-
if (!a.value || !r.value || !a.value.getClient()) return;
|
|
731
|
-
const e = a.value.registry.getDoctype(r.value);
|
|
732
|
-
if (e) {
|
|
733
|
-
N.value = !0;
|
|
734
|
-
try {
|
|
735
|
-
await a.value.getRecords(e);
|
|
736
|
-
} catch (t) {
|
|
737
|
-
console.warn("Error fetching records:", t);
|
|
738
|
-
} finally {
|
|
739
|
-
N.value = !1;
|
|
726
|
+
T.value = !1;
|
|
740
727
|
}
|
|
741
728
|
}
|
|
742
729
|
};
|
|
743
730
|
H(
|
|
744
|
-
[
|
|
731
|
+
[x, n, h],
|
|
745
732
|
() => {
|
|
746
|
-
if (
|
|
747
|
-
d("load-records", { doctype:
|
|
748
|
-
else if (
|
|
749
|
-
if (
|
|
750
|
-
d("load-record", { doctype:
|
|
733
|
+
if (x.value === "records" && n.value)
|
|
734
|
+
d("load-records", { doctype: n.value });
|
|
735
|
+
else if (x.value === "record" && n.value && h.value) {
|
|
736
|
+
if (B.value) return;
|
|
737
|
+
d("load-record", { doctype: n.value, recordId: h.value }), Me();
|
|
751
738
|
}
|
|
752
739
|
},
|
|
753
740
|
{ immediate: !0 }
|
|
754
|
-
), H([
|
|
755
|
-
|
|
741
|
+
), H([n, h], () => {
|
|
742
|
+
p?.clearAll();
|
|
756
743
|
}), H(
|
|
757
|
-
[
|
|
744
|
+
[n, h],
|
|
758
745
|
() => {
|
|
759
|
-
if (!
|
|
746
|
+
if (!B.value) {
|
|
760
747
|
i.value = {};
|
|
761
748
|
return;
|
|
762
749
|
}
|
|
763
|
-
const e =
|
|
764
|
-
i.value = e ? e.initializeRecord(
|
|
750
|
+
const e = o.value?.registry;
|
|
751
|
+
i.value = e ? e.initializeRecord(re()) : {};
|
|
765
752
|
},
|
|
766
753
|
{ immediate: !0 }
|
|
767
754
|
), te("desktopMethods", {
|
|
768
|
-
navigateToDoctype:
|
|
769
|
-
openRecord:
|
|
755
|
+
navigateToDoctype: ae,
|
|
756
|
+
openRecord: ne,
|
|
770
757
|
createNewRecord: U,
|
|
771
758
|
/**
|
|
772
759
|
* Convenience wrapper so child components (e.g. slot content) can emit
|
|
@@ -775,9 +762,9 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
775
762
|
emitAction: (e, t) => {
|
|
776
763
|
d("action", {
|
|
777
764
|
name: e,
|
|
778
|
-
doctype:
|
|
765
|
+
doctype: n.value,
|
|
779
766
|
recordId: h.value,
|
|
780
|
-
data: t ??
|
|
767
|
+
data: t ?? f.value ?? {}
|
|
781
768
|
});
|
|
782
769
|
}
|
|
783
770
|
}), te("aformLinkNavigator", {
|
|
@@ -785,78 +772,77 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
785
772
|
E({ view: "record", doctype: e, recordId: String(t) });
|
|
786
773
|
}
|
|
787
774
|
}), te("aformLinkResolver", async (e, t) => {
|
|
788
|
-
if (
|
|
775
|
+
if (o.value)
|
|
789
776
|
try {
|
|
790
|
-
const
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
777
|
+
const m = (await o.value.getMeta({ path: `/${e}`, segments: [e] }))?.displayField;
|
|
778
|
+
if (!m) return;
|
|
779
|
+
const v = (b) => {
|
|
793
780
|
if (!b) return;
|
|
794
|
-
const
|
|
795
|
-
return typeof
|
|
796
|
-
}, A =
|
|
797
|
-
if (
|
|
798
|
-
await
|
|
799
|
-
const k =
|
|
800
|
-
return
|
|
781
|
+
const N = b[m];
|
|
782
|
+
return typeof N == "string" || typeof N == "number" ? String(N) : void 0;
|
|
783
|
+
}, A = o.value.getRecordById(e, t)?.get(""), I = v(A);
|
|
784
|
+
if (I != null) return I;
|
|
785
|
+
await o.value.getRecord(e, t);
|
|
786
|
+
const k = o.value.getRecordById(e, t)?.get("");
|
|
787
|
+
return v(k);
|
|
801
788
|
} catch {
|
|
802
789
|
return;
|
|
803
790
|
}
|
|
804
791
|
});
|
|
805
|
-
const
|
|
792
|
+
const ie = (e) => {
|
|
806
793
|
(e.ctrlKey || e.metaKey) && e.key === "k" && (e.preventDefault(), C.value = !0), e.key === "Escape" && C.value && (C.value = !1);
|
|
807
794
|
};
|
|
808
|
-
return
|
|
809
|
-
document.addEventListener("keydown",
|
|
810
|
-
}),
|
|
811
|
-
document.removeEventListener("keydown",
|
|
812
|
-
}), (e, t) => (
|
|
795
|
+
return ue(() => {
|
|
796
|
+
document.addEventListener("keydown", ie);
|
|
797
|
+
}), Be(() => {
|
|
798
|
+
document.removeEventListener("keydown", ie);
|
|
799
|
+
}), (e, t) => (y(), g("div", {
|
|
813
800
|
class: "desktop",
|
|
814
|
-
onClick:
|
|
801
|
+
onClick: Ne
|
|
815
802
|
}, [
|
|
816
|
-
|
|
817
|
-
elements:
|
|
818
|
-
onActionClick:
|
|
803
|
+
L(he, {
|
|
804
|
+
elements: Ce.value,
|
|
805
|
+
onActionClick: _e
|
|
819
806
|
}, null, 8, ["elements"]),
|
|
820
|
-
|
|
807
|
+
se.value.length > 0 ? (y(), pe(ee(je), {
|
|
821
808
|
key: 0,
|
|
822
|
-
data:
|
|
823
|
-
"onUpdate:data": t[0] || (t[0] = (
|
|
824
|
-
schema:
|
|
825
|
-
errors:
|
|
826
|
-
}, null, 8, ["data", "schema", "errors"])) : ee(
|
|
827
|
-
c("p", null, "Loading " + V(
|
|
828
|
-
])) : (
|
|
809
|
+
data: f.value,
|
|
810
|
+
"onUpdate:data": t[0] || (t[0] = (a) => f.value = a),
|
|
811
|
+
schema: se.value,
|
|
812
|
+
errors: _.value
|
|
813
|
+
}, null, 8, ["data", "schema", "errors"])) : ee(o) ? (y(), g("div", yt, [
|
|
814
|
+
c("p", null, "Loading " + V(x.value) + " data...", 1)
|
|
815
|
+
])) : (y(), g("div", mt, [...t[2] || (t[2] = [
|
|
829
816
|
c("p", null, "Initializing Stonecrop...", -1)
|
|
830
817
|
])])),
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
j(we, {
|
|
818
|
+
L(we, { breadcrumbs: Ae.value }, null, 8, ["breadcrumbs"]),
|
|
819
|
+
L(ge, {
|
|
834
820
|
"is-open": C.value,
|
|
835
|
-
search:
|
|
821
|
+
search: De,
|
|
836
822
|
placeholder: "Type a command or search...",
|
|
837
|
-
onSelect:
|
|
838
|
-
onClose: t[1] || (t[1] = (
|
|
823
|
+
onSelect: Re,
|
|
824
|
+
onClose: t[1] || (t[1] = (a) => C.value = !1)
|
|
839
825
|
}, {
|
|
840
|
-
title: z(({ result:
|
|
841
|
-
J(V(
|
|
826
|
+
title: z(({ result: a }) => [
|
|
827
|
+
J(V(a.title), 1)
|
|
842
828
|
]),
|
|
843
|
-
content: z(({ result:
|
|
844
|
-
J(V(
|
|
829
|
+
content: z(({ result: a }) => [
|
|
830
|
+
J(V(a.description), 1)
|
|
845
831
|
]),
|
|
846
832
|
_: 1
|
|
847
833
|
}, 8, ["is-open"])
|
|
848
834
|
]));
|
|
849
835
|
}
|
|
850
|
-
}),
|
|
836
|
+
}), Dt = {
|
|
851
837
|
install: (l) => {
|
|
852
|
-
l.component("ActionSet",
|
|
838
|
+
l.component("ActionSet", he), l.component("CommandPalette", ge), l.component("Desktop", ht), l.component("SheetNav", we);
|
|
853
839
|
}
|
|
854
840
|
};
|
|
855
841
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
842
|
+
he as ActionSet,
|
|
843
|
+
ge as CommandPalette,
|
|
844
|
+
ht as Desktop,
|
|
845
|
+
we as SheetNav,
|
|
846
|
+
Dt as StonecropDesktop
|
|
861
847
|
};
|
|
862
848
|
//# sourceMappingURL=desktop.js.map
|