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