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