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