@stonecrop/desktop 0.24.0 → 0.25.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 +320 -329
- package/dist/desktop.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Desktop.vue +16 -31
package/dist/desktop.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { defineComponent as Q, ref as M, onMounted as de, openBlock 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 de, openBlock as h, 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 ve, computed as $, watch as H, nextTick as pe, createBlock as fe, Teleport as Ve, createVNode as L, Transition as Ee, withCtx as z, withModifiers as me, vModelText as he, renderSlot as Y, createTextVNode as J, resolveComponent as Be, withKeys as j, normalizeStyle as Z, unref as ee, provide as te, onUnmounted as Fe } from "vue";
|
|
2
|
+
import { useStonecrop as Oe, useValidationStore as Le, isDraftRecordId as Pe, DRAFT_RECORD_ID as je } from "@stonecrop/stonecrop";
|
|
3
|
+
import { AForm 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 =
|
|
11
|
+
setup(l, { emit: S }) {
|
|
12
|
+
const D = S, w = M({}), d = M(!0), o = M([]);
|
|
13
13
|
de(() => {
|
|
14
|
-
|
|
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) => (h(), 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
|
+
(h(!0), g(W, null, q(l.elements, (s, r) => (h(), 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" ? (h(), 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" ? (h(), 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
|
+
(h(!0), g(W, null, q(s.actions, (u) => (h(), g("div", {
|
|
63
63
|
key: u.label
|
|
64
64
|
}, [
|
|
65
|
-
u.action != null ? (
|
|
65
|
+
u.action != null ? (h(), 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 ? (h(), 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
|
-
}, ge = /* @__PURE__ */ ye(
|
|
89
|
+
}, ge = /* @__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
|
}, we = /* @__PURE__ */ Q({
|
|
@@ -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 = ve("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 pe(),
|
|
109
|
+
i && (w.value = "", d.value = 0, await pe(), 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) => (h(), fe(Ve, { to: "body" }, [
|
|
135
|
+
L(Ee, { name: "fade" }, {
|
|
136
136
|
default: z(() => [
|
|
137
|
-
l.isOpen ? (
|
|
137
|
+
l.isOpen ? (h(), 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] = me(() => {
|
|
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,
|
|
155
|
+
onKeydown: T
|
|
156
|
+
}, null, 40, rt), [
|
|
157
157
|
[he, w.value]
|
|
158
158
|
])
|
|
159
159
|
]),
|
|
160
|
-
|
|
161
|
-
(
|
|
162
|
-
key:
|
|
163
|
-
class:
|
|
160
|
+
p.value.length ? (h(), g("div", lt, [
|
|
161
|
+
(h(!0), g(W, null, q(p.value, (s, r) => (h(), 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 ? (h(), 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
|
-
},
|
|
192
|
+
const S = M(!0), D = M(!1), w = M(""), d = ve("searchinput"), o = $(() => S.value ? "unrotated" : "rotated"), p = () => {
|
|
193
|
+
S.value = !S.value;
|
|
194
|
+
}, _ = async () => {
|
|
195
195
|
D.value = !D.value, await pe(() => {
|
|
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 = Be("router-link");
|
|
206
|
+
return h(), 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((h(), 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,7 +265,7 @@ 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",
|
|
@@ -274,23 +274,23 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
274
274
|
placeholder: "Search...",
|
|
275
275
|
onClick: s[1] || (s[1] = me(() => {
|
|
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
|
-
[
|
|
284
|
+
[oe, D.value],
|
|
285
285
|
[he, w.value]
|
|
286
286
|
])
|
|
287
287
|
])
|
|
288
288
|
], 6),
|
|
289
|
-
(
|
|
289
|
+
(h(!0), g(W, null, q(l.breadcrumbs, (u) => (h(), 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,53 +304,50 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
304
304
|
]);
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
}), be = /* @__PURE__ */ ye(
|
|
307
|
+
}), be = /* @__PURE__ */ ye(ft, [["__scopeId", "data-v-0072260b"]]), mt = {
|
|
308
308
|
key: 1,
|
|
309
309
|
class: "loading"
|
|
310
|
-
},
|
|
310
|
+
}, ht = {
|
|
311
311
|
key: 2,
|
|
312
312
|
class: "loading"
|
|
313
|
-
},
|
|
314
|
-
key: 3,
|
|
315
|
-
class: "truncation-note"
|
|
316
|
-
}, wt = /* @__PURE__ */ Q({
|
|
313
|
+
}, yt = /* @__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 } = Oe();
|
|
331
|
+
let p = null;
|
|
335
332
|
try {
|
|
336
|
-
|
|
333
|
+
p = Le();
|
|
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
352
|
records_table: se().map(
|
|
356
353
|
(e) => Object.assign({}, e, {
|
|
@@ -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 || !y.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, y.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,105 +381,105 @@ 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 || !y.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}.${y.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 || !y.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, y.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
|
-
}),
|
|
446
|
+
}), y = $(() => {
|
|
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 = $(() => Pe(y.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
466
|
}), ke = () => {
|
|
470
|
-
if (!
|
|
467
|
+
if (!o.value || !n.value || !y.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, y.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:
|
|
484
|
-
recordId:
|
|
485
|
-
data:
|
|
479
|
+
name: v,
|
|
480
|
+
doctype: n.value,
|
|
481
|
+
recordId: y.value,
|
|
482
|
+
data: m
|
|
486
483
|
});
|
|
487
484
|
}
|
|
488
485
|
}));
|
|
@@ -490,29 +487,29 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
490
487
|
return console.warn("Error getting available transitions:", e), [];
|
|
491
488
|
}
|
|
492
489
|
}, Ce = () => {
|
|
493
|
-
if (!
|
|
490
|
+
if (!o.value || !n.value || !y.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, y.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:
|
|
505
|
-
recordId:
|
|
506
|
-
data:
|
|
500
|
+
name: v,
|
|
501
|
+
doctype: n.value,
|
|
502
|
+
recordId: y.value,
|
|
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
|
-
}, Ae =
|
|
510
|
+
}, Ae = $(() => {
|
|
514
511
|
const e = [];
|
|
515
|
-
switch (
|
|
512
|
+
switch (x.value) {
|
|
516
513
|
case "records":
|
|
517
514
|
e.push({
|
|
518
515
|
type: "button",
|
|
@@ -533,19 +530,19 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
533
530
|
}
|
|
534
531
|
}
|
|
535
532
|
return e;
|
|
536
|
-
}), De =
|
|
533
|
+
}), De = $(() => {
|
|
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 =
|
|
540
|
+
else if (x.value === "record" && R.value) {
|
|
541
|
+
const t = y.value ? `/${R.value}/${y.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;
|
|
@@ -565,43 +562,48 @@ 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
|
}, Se = (e) => {
|
|
591
588
|
e.action(), C.value = !1;
|
|
592
|
-
},
|
|
589
|
+
}, $e = (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
|
+
await E({ view: "record", doctype: R.value, recordId: je });
|
|
603
|
+
}, re = (e) => {
|
|
602
604
|
const t = [];
|
|
603
|
-
for (const
|
|
604
|
-
|
|
605
|
+
for (const a of e)
|
|
606
|
+
a.kind === "fieldset" ? t.push(...re(a.schema)) : t.push(a);
|
|
605
607
|
return t;
|
|
606
608
|
}, Ie = () => l.availableDoctypes?.length ? [
|
|
607
609
|
{
|
|
@@ -642,39 +644,42 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
642
644
|
config: { view: "list", fullWidth: !0 }
|
|
643
645
|
}
|
|
644
646
|
] : [], _e = () => {
|
|
645
|
-
if (!
|
|
646
|
-
if (!
|
|
647
|
-
const e =
|
|
647
|
+
if (!n.value) return [];
|
|
648
|
+
if (!o.value) return [];
|
|
649
|
+
const e = o.value.registry, t = e.registry[n.value];
|
|
648
650
|
if (!t) return [];
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
+
const a = e.resolveSchema(t);
|
|
652
|
+
if (a.length === 0) return [];
|
|
653
|
+
const m = n.value, v = !!o.value.getClient();
|
|
654
|
+
return [
|
|
651
655
|
{
|
|
652
656
|
kind: "table",
|
|
653
657
|
fieldname: "records_table",
|
|
654
658
|
component: "ATable",
|
|
655
659
|
schema: [
|
|
656
|
-
...
|
|
660
|
+
...re(a),
|
|
657
661
|
{ fieldname: "actions", label: "Actions", component: "ATextInput" }
|
|
658
662
|
],
|
|
659
|
-
config: { view: "list", fullWidth: !0 }
|
|
663
|
+
config: { view: "list", fullWidth: !0 },
|
|
664
|
+
...v ? { getRecords: $e, sourceKey: m } : {}
|
|
660
665
|
}
|
|
661
666
|
];
|
|
662
667
|
}, le = () => {
|
|
663
|
-
if (!
|
|
664
|
-
if (!
|
|
668
|
+
if (!n.value) return [];
|
|
669
|
+
if (!o.value) return [];
|
|
665
670
|
try {
|
|
666
|
-
const e =
|
|
671
|
+
const e = o.value?.registry, t = e?.registry[n.value];
|
|
667
672
|
return t?.schema ? e.resolveSchema(t) : [];
|
|
668
673
|
} catch {
|
|
669
674
|
return [];
|
|
670
675
|
}
|
|
671
676
|
}, se = () => {
|
|
672
|
-
if (!
|
|
677
|
+
if (!o.value || !n.value)
|
|
673
678
|
return [];
|
|
674
|
-
const t =
|
|
679
|
+
const t = o.value.records(n.value)?.get("");
|
|
675
680
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.values(t) : [];
|
|
676
|
-
}, ce =
|
|
677
|
-
switch (
|
|
681
|
+
}, ce = $(() => {
|
|
682
|
+
switch (x.value) {
|
|
678
683
|
case "doctypes":
|
|
679
684
|
return Ie();
|
|
680
685
|
case "records":
|
|
@@ -687,86 +692,73 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
687
692
|
}), xe = (e, t) => {
|
|
688
693
|
t && t();
|
|
689
694
|
}, ie = (e) => {
|
|
690
|
-
if (!(!
|
|
691
|
-
return
|
|
695
|
+
if (!(!o.value || !n.value))
|
|
696
|
+
return o.value.registry.registry[n.value]?.getRecordId(e);
|
|
692
697
|
}, Ne = (e) => {
|
|
693
698
|
const t = e.querySelector("td[data-rowindex]");
|
|
694
699
|
if (!t) return null;
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
697
|
-
const
|
|
698
|
-
if (isNaN(
|
|
699
|
-
const A = se()[
|
|
700
|
+
const a = t.getAttribute("data-rowindex");
|
|
701
|
+
if (a === null) return null;
|
|
702
|
+
const m = parseInt(a, 10);
|
|
703
|
+
if (isNaN(m)) return null;
|
|
704
|
+
const A = se()[m];
|
|
700
705
|
return A ? ie(A) ?? null : null;
|
|
701
|
-
},
|
|
706
|
+
}, Me = async (e) => {
|
|
702
707
|
const t = e.target;
|
|
703
708
|
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
|
|
709
|
+
const m = t.closest("td, th");
|
|
710
|
+
if (m) {
|
|
711
|
+
const v = m.textContent?.trim(), A = m.closest("tr");
|
|
712
|
+
if (v === "View Records" && A) {
|
|
713
|
+
const I = A.querySelectorAll("td");
|
|
714
|
+
if (I.length > 0) {
|
|
715
|
+
const b = I[1].textContent?.trim();
|
|
716
|
+
b && await ae(b);
|
|
712
717
|
}
|
|
713
|
-
} else if (
|
|
714
|
-
const
|
|
715
|
-
|
|
718
|
+
} else if (v === "Edit" && A) {
|
|
719
|
+
const I = Ne(A);
|
|
720
|
+
I && await ne(I);
|
|
716
721
|
}
|
|
717
722
|
}
|
|
718
|
-
},
|
|
719
|
-
if (!(!
|
|
720
|
-
|
|
723
|
+
}, Te = async () => {
|
|
724
|
+
if (!(!o.value || !n.value || !o.value.getClient())) {
|
|
725
|
+
T.value = !0;
|
|
721
726
|
try {
|
|
722
|
-
await
|
|
727
|
+
await o.value.getRecord(n.value, y.value);
|
|
723
728
|
} catch (e) {
|
|
724
729
|
console.warn("Error fetching record:", e);
|
|
725
730
|
} 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;
|
|
731
|
+
T.value = !1;
|
|
740
732
|
}
|
|
741
733
|
}
|
|
742
734
|
};
|
|
743
735
|
H(
|
|
744
|
-
[
|
|
736
|
+
[x, n, y],
|
|
745
737
|
() => {
|
|
746
|
-
if (
|
|
747
|
-
d("load-records", { doctype:
|
|
748
|
-
else if (
|
|
749
|
-
if (
|
|
750
|
-
d("load-record", { doctype:
|
|
738
|
+
if (x.value === "records" && n.value)
|
|
739
|
+
d("load-records", { doctype: n.value });
|
|
740
|
+
else if (x.value === "record" && n.value && y.value) {
|
|
741
|
+
if (B.value) return;
|
|
742
|
+
d("load-record", { doctype: n.value, recordId: y.value }), Te();
|
|
751
743
|
}
|
|
752
744
|
},
|
|
753
745
|
{ immediate: !0 }
|
|
754
|
-
), H([
|
|
755
|
-
|
|
746
|
+
), H([n, y], () => {
|
|
747
|
+
p?.clearAll();
|
|
756
748
|
}), H(
|
|
757
|
-
[
|
|
749
|
+
[n, y],
|
|
758
750
|
() => {
|
|
759
|
-
if (!
|
|
751
|
+
if (!B.value) {
|
|
760
752
|
i.value = {};
|
|
761
753
|
return;
|
|
762
754
|
}
|
|
763
|
-
const e =
|
|
755
|
+
const e = o.value?.registry;
|
|
764
756
|
i.value = e ? e.initializeRecord(le()) : {};
|
|
765
757
|
},
|
|
766
758
|
{ immediate: !0 }
|
|
767
759
|
), te("desktopMethods", {
|
|
768
|
-
navigateToDoctype:
|
|
769
|
-
openRecord:
|
|
760
|
+
navigateToDoctype: ae,
|
|
761
|
+
openRecord: ne,
|
|
770
762
|
createNewRecord: U,
|
|
771
763
|
/**
|
|
772
764
|
* Convenience wrapper so child components (e.g. slot content) can emit
|
|
@@ -775,9 +767,9 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
775
767
|
emitAction: (e, t) => {
|
|
776
768
|
d("action", {
|
|
777
769
|
name: e,
|
|
778
|
-
doctype:
|
|
779
|
-
recordId:
|
|
780
|
-
data: t ??
|
|
770
|
+
doctype: n.value,
|
|
771
|
+
recordId: y.value,
|
|
772
|
+
data: t ?? f.value ?? {}
|
|
781
773
|
});
|
|
782
774
|
}
|
|
783
775
|
}), te("aformLinkNavigator", {
|
|
@@ -785,19 +777,19 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
785
777
|
E({ view: "record", doctype: e, recordId: String(t) });
|
|
786
778
|
}
|
|
787
779
|
}), te("aformLinkResolver", async (e, t) => {
|
|
788
|
-
if (
|
|
780
|
+
if (o.value)
|
|
789
781
|
try {
|
|
790
|
-
const
|
|
791
|
-
if (!
|
|
792
|
-
const
|
|
782
|
+
const m = (await o.value.getMeta({ path: `/${e}`, segments: [e] }))?.displayField;
|
|
783
|
+
if (!m) return;
|
|
784
|
+
const v = (b) => {
|
|
793
785
|
if (!b) return;
|
|
794
|
-
const
|
|
795
|
-
return typeof
|
|
796
|
-
}, A =
|
|
797
|
-
if (
|
|
798
|
-
await
|
|
799
|
-
const k =
|
|
800
|
-
return
|
|
786
|
+
const N = b[m];
|
|
787
|
+
return typeof N == "string" || typeof N == "number" ? String(N) : void 0;
|
|
788
|
+
}, A = o.value.getRecordById(e, t)?.get(""), I = v(A);
|
|
789
|
+
if (I != null) return I;
|
|
790
|
+
await o.value.getRecord(e, t);
|
|
791
|
+
const k = o.value.getRecordById(e, t)?.get("");
|
|
792
|
+
return v(k);
|
|
801
793
|
} catch {
|
|
802
794
|
return;
|
|
803
795
|
}
|
|
@@ -809,54 +801,53 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
|
|
|
809
801
|
document.addEventListener("keydown", ue);
|
|
810
802
|
}), Fe(() => {
|
|
811
803
|
document.removeEventListener("keydown", ue);
|
|
812
|
-
}), (e, t) => (
|
|
804
|
+
}), (e, t) => (h(), g("div", {
|
|
813
805
|
class: "desktop",
|
|
814
|
-
onClick:
|
|
806
|
+
onClick: Me
|
|
815
807
|
}, [
|
|
816
|
-
|
|
808
|
+
L(ge, {
|
|
817
809
|
elements: Ae.value,
|
|
818
810
|
onActionClick: xe
|
|
819
811
|
}, null, 8, ["elements"]),
|
|
820
|
-
ce.value.length > 0 ? (
|
|
812
|
+
ce.value.length > 0 ? (h(), fe(ee(Ke), {
|
|
821
813
|
key: 0,
|
|
822
|
-
data:
|
|
823
|
-
"onUpdate:data": t[0] || (t[0] = (
|
|
814
|
+
data: f.value,
|
|
815
|
+
"onUpdate:data": t[0] || (t[0] = (a) => f.value = a),
|
|
824
816
|
schema: ce.value,
|
|
825
|
-
errors:
|
|
826
|
-
}, null, 8, ["data", "schema", "errors"])) : ee(
|
|
827
|
-
c("p", null, "Loading " + V(
|
|
828
|
-
])) : (
|
|
817
|
+
errors: _.value
|
|
818
|
+
}, null, 8, ["data", "schema", "errors"])) : ee(o) ? (h(), g("div", ht, [
|
|
819
|
+
c("p", null, "Loading " + V(x.value) + " data...", 1)
|
|
820
|
+
])) : (h(), g("div", mt, [...t[2] || (t[2] = [
|
|
829
821
|
c("p", null, "Initializing Stonecrop...", -1)
|
|
830
822
|
])])),
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
j(we, {
|
|
823
|
+
L(be, { breadcrumbs: De.value }, null, 8, ["breadcrumbs"]),
|
|
824
|
+
L(we, {
|
|
834
825
|
"is-open": C.value,
|
|
835
826
|
search: Re,
|
|
836
827
|
placeholder: "Type a command or search...",
|
|
837
828
|
onSelect: Se,
|
|
838
|
-
onClose: t[1] || (t[1] = (
|
|
829
|
+
onClose: t[1] || (t[1] = (a) => C.value = !1)
|
|
839
830
|
}, {
|
|
840
|
-
title: z(({ result:
|
|
841
|
-
J(V(
|
|
831
|
+
title: z(({ result: a }) => [
|
|
832
|
+
J(V(a.title), 1)
|
|
842
833
|
]),
|
|
843
|
-
content: z(({ result:
|
|
844
|
-
J(V(
|
|
834
|
+
content: z(({ result: a }) => [
|
|
835
|
+
J(V(a.description), 1)
|
|
845
836
|
]),
|
|
846
837
|
_: 1
|
|
847
838
|
}, 8, ["is-open"])
|
|
848
839
|
]));
|
|
849
840
|
}
|
|
850
|
-
}),
|
|
841
|
+
}), Dt = {
|
|
851
842
|
install: (l) => {
|
|
852
|
-
l.component("ActionSet", ge), l.component("CommandPalette", we), l.component("Desktop",
|
|
843
|
+
l.component("ActionSet", ge), l.component("CommandPalette", we), l.component("Desktop", yt), l.component("SheetNav", be);
|
|
853
844
|
}
|
|
854
845
|
};
|
|
855
846
|
export {
|
|
856
847
|
ge as ActionSet,
|
|
857
848
|
we as CommandPalette,
|
|
858
|
-
|
|
849
|
+
yt as Desktop,
|
|
859
850
|
be as SheetNav,
|
|
860
|
-
|
|
851
|
+
Dt as StonecropDesktop
|
|
861
852
|
};
|
|
862
853
|
//# sourceMappingURL=desktop.js.map
|