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