@stonecrop/desktop 0.29.0 → 0.31.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 CHANGED
@@ -1,98 +1,97 @@
1
- import { defineComponent as Q, ref as M, onMounted as ue, openBlock as y, createElementBlock as g, normalizeClass as O, createElementVNode as c, Fragment as W, renderList as q, toDisplayString as V, createCommentVNode as K, withDirectives as G, vShow as oe, useTemplateRef as de, computed as $, watch as H, nextTick as ve, createBlock as pe, Teleport as Te, createVNode as L, Transition as Ve, withCtx as z, withModifiers as fe, vModelText as me, renderSlot as Y, createTextVNode as J, resolveComponent as Ee, withKeys as j, normalizeStyle as Z, unref as ee, provide as te, onUnmounted as Be } from "vue";
2
- import { useStonecrop as Fe, useValidationStore as Oe, isDraftRecordId as Le, DRAFT_RECORD_ID as Pe } from "@stonecrop/stonecrop";
3
- import { AForm as je, resolvedFieldsToColumns as Ke } from "@stonecrop/aform";
4
- import { flattenFields as He, componentLinkExpansion as ze } from "@stonecrop/schema";
5
- const Ue = { class: "action-menu-icon" }, We = { class: "action-element-header" }, qe = ["disabled", "onClick"], Ge = { key: 0 }, Je = { class: "dropdown-header" }, Qe = ["onClick"], Xe = ["onClick"], Ye = { class: "dropdown-container" }, Ze = { class: "dropdown" }, et = ["onClick"], tt = ["href"], ot = { class: "dropdown-item" }, at = /* @__PURE__ */ Q({
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(l, { emit: S }) {
12
- const D = S, w = M({}), d = M(!0), o = M([]);
13
- ue(() => {
14
- p();
10
+ setup(c, { emit: A }) {
11
+ const y = A, a = _({}), u = _(!0), x = _([]);
12
+ le(() => {
13
+ w();
15
14
  });
16
- const p = () => {
17
- w.value = {}, o.value = [];
18
- }, _ = () => {
19
- d.value = !d.value;
20
- }, T = (i) => {
21
- const f = !w.value[i];
22
- p(), f && (w.value[i] = !0, o.value[i] = !0);
23
- }, C = (i, f) => {
24
- D("actionClick", f, i);
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 (i, f) => (y(), g("div", {
27
- class: O([{ collapsed: !d.value }, "action-set"])
25
+ return (v, r) => (h(), g("div", {
26
+ class: O([{ collapsed: !u.value }, "action-set"])
28
27
  }, [
29
- c("div", Ue, [
30
- c("div", {
28
+ i("div", Pe, [
29
+ i("div", {
31
30
  id: "cross",
32
- class: O({ rotated: d.value }),
33
- onClick: _
31
+ class: O({ rotated: u.value }),
32
+ onClick: b
34
33
  }, "×", 2)
35
34
  ]),
36
- f[0] || (f[0] = c("div", { style: { "margin-right": "30px" } }, null, -1)),
37
- (y(!0), g(W, null, q(l.elements, (s, r) => (y(), g("div", {
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
- c("div", We, [
42
- s.type == "button" ? (y(), g("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: (u) => C(s.action, s.label)
47
- }, V(s.label), 9, qe)) : K("", !0)
45
+ onClick: (n) => D(s.action, s.label)
46
+ }, N(s.label), 9, je)) : P("", !0)
48
47
  ]),
49
- s.type == "dropdown" ? (y(), g("div", Ge, [
50
- c("div", Je, [
51
- c("div", {
52
- class: O(["cross", { rotated: o.value[r] }]),
53
- onClick: (u) => T(r)
54
- }, "×", 10, Qe),
55
- c("button", {
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: (u) => T(r)
58
- }, V(s.label), 9, Xe)
56
+ onClick: (n) => S(o)
57
+ }, N(s.label), 9, ze)
59
58
  ]),
60
- G(c("div", Ye, [
61
- c("div", Ze, [
62
- (y(!0), g(W, null, q(s.actions, (u) => (y(), g("div", {
63
- key: u.label
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
- u.action != null ? (y(), g("button", {
64
+ n.action != null ? (h(), g("button", {
66
65
  key: 0,
67
66
  class: "dropdown-item",
68
- onClick: (n) => C(u.action, u.label)
69
- }, V(u.label), 9, et)) : u.link != null ? (y(), g("a", {
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: u.link
70
+ href: n.link
72
71
  }, [
73
- c("button", ot, V(u.label), 1)
74
- ], 8, tt)) : K("", !0)
72
+ i("button", Qe, N(n.label), 1)
73
+ ], 8, Je)) : P("", !0)
75
74
  ]))), 128))
76
75
  ])
77
76
  ], 512), [
78
- [oe, w.value[r]]
77
+ [Y, a.value[o]]
79
78
  ])
80
- ])) : K("", !0)
79
+ ])) : P("", !0)
81
80
  ]))), 128))
82
81
  ], 2));
83
82
  }
84
- }), ye = (l, S) => {
85
- const D = l.__vccOpts || l;
86
- for (const [w, d] of S)
87
- D[w] = d;
88
- return D;
89
- }, he = /* @__PURE__ */ ye(at, [["__scopeId", "data-v-8e18f635"]]), nt = { class: "command-palette-header" }, rt = ["placeholder"], lt = {
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
- }, st = ["onClick", "onMouseover"], ct = { class: "result-title" }, it = { class: "result-content" }, ut = {
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
- }, ge = /* @__PURE__ */ Q({
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(l, { emit: S }) {
105
- const D = S, w = M(""), d = M(0), o = de("input"), p = $(() => w.value ? l.search(w.value).slice(0, l.maxResults) : []);
106
- H(
107
- () => l.isOpen,
108
- async (i) => {
109
- i && (w.value = "", d.value = 0, await ve(), o.value?.focus());
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
- ), H(p, () => {
112
- d.value = 0;
110
+ ), K(w, () => {
111
+ u.value = 0;
113
112
  });
114
- const _ = () => {
115
- D("close");
116
- }, T = (i) => {
117
- switch (i.key) {
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
- i.preventDefault(), p.value.length && (d.value = (d.value + 1) % p.value.length);
121
+ v.preventDefault(), w.value.length && (u.value = (u.value + 1) % w.value.length);
123
122
  break;
124
123
  case "ArrowUp":
125
- i.preventDefault(), p.value.length && (d.value = (d.value - 1 + p.value.length) % p.value.length);
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
- p.value.length && d.value >= 0 && C(p.value[d.value]);
127
+ w.value.length && u.value >= 0 && D(w.value[u.value]);
129
128
  break;
130
129
  }
131
- }, C = (i) => {
132
- D("select", i), _();
130
+ }, D = (v) => {
131
+ y("select", v), b();
133
132
  };
134
- return (i, f) => (y(), pe(Te, { to: "body" }, [
135
- L(Ve, { name: "fade" }, {
136
- default: z(() => [
137
- l.isOpen ? (y(), g("div", {
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
- c("div", {
141
+ i("div", {
143
142
  class: "command-palette",
144
- onClick: f[1] || (f[1] = fe(() => {
143
+ onClick: r[1] || (r[1] = ue(() => {
145
144
  }, ["stop"]))
146
145
  }, [
147
- c("div", nt, [
148
- G(c("input", {
146
+ i("div", Ye, [
147
+ z(i("input", {
149
148
  ref: "input",
150
- "onUpdate:modelValue": f[0] || (f[0] = (s) => w.value = s),
149
+ "onUpdate:modelValue": r[0] || (r[0] = (s) => a.value = s),
151
150
  type: "text",
152
151
  class: "command-palette-input",
153
- placeholder: l.placeholder,
152
+ placeholder: c.placeholder,
154
153
  autofocus: "",
155
- onKeydown: T
156
- }, null, 40, rt), [
157
- [me, w.value]
154
+ onKeydown: S
155
+ }, null, 40, Ze), [
156
+ [de, a.value]
158
157
  ])
159
158
  ]),
160
- p.value.length ? (y(), g("div", lt, [
161
- (y(!0), g(W, null, q(p.value, (s, r) => (y(), g("div", {
162
- key: r,
163
- class: O(["command-palette-result", { selected: r === d.value }]),
164
- onClick: (u) => C(s),
165
- onMouseover: (u) => d.value = r
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
- c("div", ct, [
168
- Y(i.$slots, "title", { result: s })
166
+ i("div", at, [
167
+ G(v.$slots, "title", { result: s })
169
168
  ]),
170
- c("div", it, [
171
- Y(i.$slots, "content", { result: s })
169
+ i("div", ot, [
170
+ G(v.$slots, "content", { result: s })
172
171
  ])
173
- ], 42, st))), 128))
174
- ])) : w.value && !p.value.length ? (y(), g("div", ut, [
175
- Y(i.$slots, "empty", {}, () => [
176
- J(' No results found for "' + V(w.value) + '" ', 1)
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
- ])) : K("", !0)
177
+ ])) : P("", !0)
179
178
  ])
180
- ])) : K("", !0)
179
+ ])) : P("", !0)
181
180
  ]),
182
181
  _: 3
183
182
  })
184
183
  ]));
185
184
  }
186
- }), dt = { class: "tabs" }, vt = { tabindex: "0" }, pt = { tabindex: "0" }, ft = /* @__PURE__ */ Q({
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(l) {
192
- const S = M(!0), D = M(!1), w = M(""), d = de("searchinput"), o = $(() => S.value ? "unrotated" : "rotated"), p = () => {
193
- S.value = !S.value;
194
- }, _ = async () => {
195
- D.value = !D.value, await ve(() => {
196
- d.value?.focus();
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
- }, T = (f) => {
199
- f.preventDefault(), f.stopPropagation();
200
- }, C = async (f) => {
201
- f.preventDefault(), f.stopPropagation(), await _();
202
- }, i = () => {
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 (f, s) => {
205
- const r = Ee("router-link");
206
- return y(), g("footer", null, [
207
- c("ul", dt, [
208
- c("li", {
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: p,
211
- onKeydown: j(p, ["enter"])
209
+ onClick: w,
210
+ onKeydown: F(w, ["enter"])
212
211
  }, [
213
- c("a", vt, [
214
- c("div", {
215
- class: O(o.value)
212
+ i("a", lt, [
213
+ i("div", {
214
+ class: O(x.value)
216
215
  }, "×", 2)
217
216
  ])
218
217
  ], 32),
219
- c("li", {
218
+ i("li", {
220
219
  class: "hometab",
221
- style: Z({ display: S.value ? "block" : "none" }),
222
- onClick: i,
223
- onKeydown: j(i, ["enter"])
220
+ style: J({ display: A.value ? "block" : "none" }),
221
+ onClick: v,
222
+ onKeydown: F(v, ["enter"])
224
223
  }, [
225
- L(r, {
224
+ B(o, {
226
225
  to: "/",
227
226
  tabindex: "0"
228
227
  }, {
229
- default: z(() => [...s[5] || (s[5] = [
230
- c("svg", {
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
- c("path", { d: "M3 12l9-9 9 9" }),
239
- c("path", { d: "M9 21V12h6v9" })
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
- c("li", {
246
- class: O(["searchtab", { "search-active": D.value }]),
247
- style: Z({ display: S.value ? "block" : "none" })
244
+ i("li", {
245
+ class: O(["searchtab", { "search-active": y.value }]),
246
+ style: J({ display: A.value ? "block" : "none" })
248
247
  }, [
249
- c("a", pt, [
250
- G((y(), g("svg", {
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: j(_, ["enter"])
257
+ onClick: b,
258
+ onKeydown: F(b, ["enter"])
260
259
  }, [...s[6] || (s[6] = [
261
- c("circle", {
260
+ i("circle", {
262
261
  cx: "11",
263
262
  cy: "11",
264
263
  r: "7"
265
264
  }, null, -1),
266
- c("path", { d: "M21 21l-4.35-4.35" }, null, -1)
265
+ i("path", { d: "M21 21l-4.35-4.35" }, null, -1)
267
266
  ])], 544)), [
268
- [oe, !D.value]
267
+ [Y, !y.value]
269
268
  ]),
270
- G(c("input", {
269
+ z(i("input", {
271
270
  ref: "searchinput",
272
- "onUpdate:modelValue": s[0] || (s[0] = (u) => w.value = u),
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] = fe(() => {
274
+ onClick: s[1] || (s[1] = ue(() => {
276
275
  }, ["stop"])),
277
- onInput: s[2] || (s[2] = (u) => T(u)),
278
- onBlur: s[3] || (s[3] = (u) => C(u)),
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] = j((u) => C(u), ["enter"])),
281
- j(_, ["escape"])
279
+ s[4] || (s[4] = F((n) => D(n), ["enter"])),
280
+ F(b, ["escape"])
282
281
  ]
283
282
  }, null, 544), [
284
- [oe, D.value],
285
- [me, w.value]
283
+ [Y, y.value],
284
+ [de, a.value]
286
285
  ])
287
286
  ])
288
287
  ], 6),
289
- (y(!0), g(W, null, q(l.breadcrumbs, (u) => (y(), g("li", {
290
- key: u.title,
291
- style: Z({ display: S.value ? "block" : "none" })
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
- L(r, {
292
+ B(o, {
294
293
  tabindex: "0",
295
- to: u.to
294
+ to: n.to
296
295
  }, {
297
- default: z(() => [
298
- J(V(u.title), 1)
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
- }), we = /* @__PURE__ */ ye(ft, [["__scopeId", "data-v-cd118b06"]]), mt = {
306
+ }), me = /* @__PURE__ */ ve(ct, [["__scopeId", "data-v-cd118b06"]]), it = {
308
307
  key: 1,
309
308
  class: "loading"
310
- }, yt = {
309
+ }, ut = {
311
310
  key: 2,
312
311
  class: "loading"
313
- }, ht = /* @__PURE__ */ Q({
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(l, { emit: S }) {
321
- function D(e) {
322
- const t = He(e).filter((a) => a.kind === "field" && !!a.doctype);
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
- p = Oe();
323
+ u = Ve();
334
324
  } catch {
335
- p = null;
325
+ u = null;
336
326
  }
337
- const _ = $(
338
- () => x.value === "record" ? p?.errorsByField ?? {} : {}
339
- ), T = M(!1), C = M(!1), i = M({}), f = $({
327
+ const x = R(
328
+ () => I.value === "record" ? u?.errorsByField ?? {} : {}
329
+ ), w = _(!1), b = _(!1), S = _({}), D = R({
340
330
  get() {
341
- if (x.value === "doctypes")
331
+ if (I.value === "doctypes")
342
332
  return {
343
- doctypes_table: l.availableDoctypes?.map((e) => ({
333
+ doctypes_table: c.availableDoctypes?.map((e) => ({
344
334
  id: e,
345
335
  doctype: e,
346
- display_name: F(e),
336
+ display_name: E(e),
347
337
  actions: "View Records"
348
338
  })) ?? []
349
339
  };
350
- if (x.value === "records")
340
+ if (I.value === "records")
351
341
  return {
352
- records_table: le().map(
342
+ records_table: ae().map(
353
343
  (e) => Object.assign({}, e, {
354
- id: ce(e) ?? "",
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 (!o.value || !n.value || !h.value)
355
+ if (!a.value || !o.value || !m.value)
366
356
  return {};
367
357
  try {
368
- const t = { ...B.value ? i.value : o.value.getRecordById(n.value, h.value)?.get("") }, a = o.value.registry.registry[n.value];
369
- if (a) {
370
- for (const m of a.getSchemaArray())
371
- if (m.kind === "fieldset") {
372
- const v = {};
373
- for (const A of m.schema)
374
- A.fieldname && (v[A.fieldname] = t[A.fieldname]);
375
- t[m.fieldname] = v;
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 (x.value === "record" && !(!o.value || !n.value || !h.value))
374
+ if (I.value === "record" && !(!a.value || !o.value || !m.value))
385
375
  try {
386
- const t = o.value.registry.registry[n.value], a = /* @__PURE__ */ new Set();
376
+ const t = a.value.registry.registry[o.value], l = /* @__PURE__ */ new Set();
387
377
  if (t)
388
- for (const k of t.getSchemaArray())
389
- k.kind === "fieldset" && a.add(k.fieldname);
390
- const m = D(t ? t.getSchemaArray() : []), v = {}, A = [];
391
- for (const [k, b] of Object.entries(e))
392
- a.has(k) && b && typeof b == "object" && !Array.isArray(b) ? A.push(b) : v[k] = b;
393
- for (const k of A)
394
- Object.assign(v, k);
395
- const I = [];
396
- if (B.value) {
397
- const k = { ...i.value };
398
- for (const [b, N] of Object.entries(v)) {
399
- if (N === void 0) continue;
400
- const P = m.has(b) ? w(N) : N;
401
- k[b] !== P && (k[b] = P, I.push(b));
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 k = o.value.getStore();
406
- for (const [b, N] of Object.entries(v)) {
407
- if (N === void 0) continue;
408
- const P = m.has(b) ? w(N) : N, X = `${n.value}.${h.value}.${b}`;
409
- (k.has(X) ? k.get(X) : void 0) !== P && (k.set(X, P), I.push(b));
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
- I.length > 0 && s(I);
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 s(e) {
419
- if (!p || !o.value || !n.value || !h.value) return;
420
- const a = o.value.registry.getDoctype(n.value)?.getTriggers();
421
- if (!a || Object.keys(a).length === 0) return;
422
- const m = B.value ? { ...i.value } : {
423
- ...o.value.getRecordById(n.value, h.value)?.get("")
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 v of e)
426
- p.validateField(a, v, m);
412
+ for (const p of e)
413
+ u.validateField(l, p, d);
427
414
  }
428
- const r = $(() => l.routeAdapter ? null : ee(o.value?.registry.router?.currentRoute)), u = $(() => l.routeAdapter ? null : o.value?.registry.router), n = $(() => {
429
- if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
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
- }), R = $(() => {
438
- if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
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
- }), h = $(() => {
447
- if (l.routeAdapter) return l.routeAdapter.getCurrentRecordId();
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
- }), B = $(() => Le(h.value)), x = $(() => {
454
- if (l.routeAdapter) return l.routeAdapter.getCurrentView();
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
- }), be = () => {
467
- if (!o.value || !n.value || !h.value)
453
+ }), he = () => {
454
+ if (!a.value || !o.value || !m.value)
468
455
  return [];
469
456
  try {
470
- const e = o.value.registry.getDoctype(n.value);
457
+ const e = a.value.registry.getDoctype(o.value);
471
458
  if (!e?.workflow) return [];
472
- const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableTransitions(t), m = f.value || {};
473
- return a.map(({ name: v }) => ({
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(v)?.label ?? v,
463
+ label: e.getActionMeta(p)?.label ?? p,
477
464
  action: () => {
478
- d("action", {
479
- name: v,
480
- doctype: n.value,
481
- recordId: h.value,
482
- data: m
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
- }, ke = () => {
490
- if (!o.value || !n.value || !h.value)
476
+ }, ye = () => {
477
+ if (!a.value || !o.value || !m.value)
491
478
  return [];
492
479
  try {
493
- const e = o.value.registry.getDoctype(n.value);
480
+ const e = a.value.registry.getDoctype(o.value);
494
481
  if (!e?.workflow) return [];
495
- const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableCommands(t), m = f.value || {};
496
- return a.map(({ name: v }) => ({
497
- label: e.getActionMeta(v)?.label ?? v,
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
- d("action", {
500
- name: v,
501
- doctype: n.value,
502
- recordId: h.value,
503
- data: m
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
- }, Ce = $(() => {
497
+ }, ge = R(() => {
511
498
  const e = [];
512
- switch (x.value) {
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
- U();
505
+ L();
519
506
  }
520
507
  });
521
508
  break;
522
509
  case "record": {
523
- const t = [...be(), ...ke()];
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
- }), Ae = $(() => {
520
+ }), we = R(() => {
534
521
  const e = [];
535
- if (x.value === "records" && R.value)
522
+ if (I.value === "records" && n.value)
536
523
  e.push(
537
524
  { title: "Home", to: "/" },
538
- { title: F(R.value), to: `/${R.value}` }
525
+ { title: E(n.value), to: `/${n.value}` }
539
526
  );
540
- else if (x.value === "record" && R.value) {
541
- const t = h.value ? `/${R.value}/${h.value}` : r.value?.fullPath ?? "";
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: F(R.value), to: `/${R.value}` },
545
- { title: B.value ? "New Record" : "Edit Record", to: t }
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
- }), De = (e) => {
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
- E({ view: "doctypes" });
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: () => C.value = !C.value
548
+ action: () => b.value = !b.value
562
549
  }
563
550
  ];
564
- return R.value && (t.push({
565
- title: `View ${F(R.value)} Records`,
566
- description: `Navigate to ${R.value} list`,
551
+ return n.value && (t.push({
552
+ title: `View ${E(n.value)} Records`,
553
+ description: `Navigate to ${n.value} list`,
567
554
  action: () => {
568
- E({ view: "records", doctype: R.value });
555
+ M({ view: "records", doctype: n.value });
569
556
  }
570
557
  }), t.push({
571
- title: `Create New ${F(R.value)}`,
572
- description: `Create a new ${R.value} record`,
558
+ title: `Create New ${E(n.value)}`,
559
+ description: `Create a new ${n.value} record`,
573
560
  action: () => {
574
- U();
561
+ L();
575
562
  }
576
- })), l.availableDoctypes.forEach((a) => {
563
+ })), c.availableDoctypes.forEach((l) => {
577
564
  t.push({
578
- title: `View ${F(a)}`,
579
- description: `Navigate to ${a} list`,
565
+ title: `View ${E(l)}`,
566
+ description: `Navigate to ${l} list`,
580
567
  action: () => {
581
- E({ view: "records", doctype: a });
568
+ M({ view: "records", doctype: l });
582
569
  }
583
570
  });
584
571
  }), e ? t.filter(
585
- (a) => a.title.toLowerCase().includes(e.toLowerCase()) || a.description.toLowerCase().includes(e.toLowerCase())
572
+ (l) => l.title.toLowerCase().includes(e.toLowerCase()) || l.description.toLowerCase().includes(e.toLowerCase())
586
573
  ) : t;
587
- }, Re = (e) => {
588
- e.action(), C.value = !1;
589
- }, Se = (e) => {
590
- if (!o.value || !n.value)
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 = o.value.registry.getDoctype(n.value);
593
- return t ? o.value.getRecords(t, e) : Promise.resolve({ data: [], hasMore: !1 });
594
- }, F = (e) => e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), E = async (e) => {
595
- d("navigate", e), l.routeAdapter ? await l.routeAdapter.navigate(e) : e.view === "doctypes" ? await u.value?.push("/") : e.view === "records" && e.doctype ? await u.value?.push(`/${e.doctype}`) : e.view === "record" && e.doctype && e.recordId && await u.value?.push(`/${e.doctype}/${e.recordId}`);
596
- }, ae = async (e) => {
597
- await E({ view: "records", doctype: e });
598
- }, ne = async (e) => {
599
- const t = R.value;
600
- d("record:open", { doctype: t, recordId: e }), await E({ view: "record", doctype: t, recordId: e });
601
- }, U = async () => {
602
- await E({ view: "record", doctype: R.value, recordId: Pe });
603
- }, $e = () => l.availableDoctypes?.length ? [
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
- ] : [], Ie = () => {
642
- if (!n.value) return [];
628
+ ] : [], De = () => {
643
629
  if (!o.value) return [];
644
- const e = o.value.registry, t = e.registry[n.value];
630
+ if (!a.value) return [];
631
+ const e = a.value.registry, t = e.registry[o.value];
645
632
  if (!t) return [];
646
- const a = e.resolveSchema(t);
647
- if (a.length === 0) return [];
648
- const m = n.value, v = !!o.value.getClient();
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: [...Ke(a), { fieldname: "actions", label: "Actions", component: "ATextInput" }],
644
+ schema: [...Fe(l), { fieldname: "actions", label: "Actions", component: "ATextInput" }],
658
645
  config: { view: "list", fullWidth: !0 },
659
- ...v ? { getRecords: Se, sourceKey: m } : {}
646
+ ...p ? { getRecords: Ce, sourceKey: d } : {}
660
647
  }
661
648
  ];
662
- }, re = () => {
663
- if (!n.value) return [];
649
+ }, te = () => {
664
650
  if (!o.value) return [];
651
+ if (!a.value) return [];
665
652
  try {
666
- const e = o.value?.registry, t = e?.registry[n.value];
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
- }, le = () => {
672
- if (!o.value || !n.value)
658
+ }, ae = () => {
659
+ if (!a.value || !o.value)
673
660
  return [];
674
- const t = o.value.records(n.value)?.get("");
661
+ const t = a.value.records(o.value)?.get("");
675
662
  return t && typeof t == "object" && !Array.isArray(t) ? Object.values(t) : [];
676
- }, se = $(() => {
677
- switch (x.value) {
663
+ }, oe = R(() => {
664
+ switch (I.value) {
678
665
  case "doctypes":
679
- return $e();
666
+ return Ae();
680
667
  case "records":
681
- return Ie();
668
+ return De();
682
669
  case "record":
683
- return re();
670
+ return te();
684
671
  default:
685
672
  return [];
686
673
  }
687
- }), _e = (e, t) => {
674
+ }), Re = (e, t) => {
688
675
  t && t();
689
- }, ce = (e) => {
690
- if (!(!o.value || !n.value))
691
- return o.value.registry.registry[n.value]?.getRecordId(e);
692
- }, xe = (e) => {
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 a = t.getAttribute("data-rowindex");
696
- if (a === null) return null;
697
- const m = parseInt(a, 10);
698
- if (isNaN(m)) return null;
699
- const A = le()[m];
700
- return A ? ce(A) ?? null : null;
701
- }, Ne = async (e) => {
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 U();
704
- const m = t.closest("td, th");
705
- if (m) {
706
- const v = m.textContent?.trim(), A = m.closest("tr");
707
- if (v === "View Records" && A) {
708
- const I = A.querySelectorAll("td");
709
- if (I.length > 0) {
710
- const b = I[1].textContent?.trim();
711
- b && await ae(b);
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 (v === "Edit" && A) {
714
- const I = xe(A);
715
- I && await ne(I);
700
+ } else if (p === "Edit" && k) {
701
+ const f = Se(k);
702
+ f && await ee(f);
716
703
  }
717
704
  }
718
- }, Me = async () => {
719
- if (!(!o.value || !n.value || !o.value.getClient())) {
720
- T.value = !0;
705
+ }, Ie = async () => {
706
+ if (!(!a.value || !o.value || !a.value.getClient())) {
707
+ w.value = !0;
721
708
  try {
722
- await o.value.getRecord(n.value, h.value);
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
- T.value = !1;
713
+ w.value = !1;
727
714
  }
728
715
  }
729
716
  };
730
- H(
731
- [x, n, h],
717
+ K(
718
+ [I, o, m],
732
719
  () => {
733
- if (x.value === "records" && n.value)
734
- d("load-records", { doctype: n.value });
735
- else if (x.value === "record" && n.value && h.value) {
736
- if (B.value) return;
737
- d("load-record", { doctype: n.value, recordId: h.value }), Me();
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
- ), H([n, h], () => {
742
- p?.clearAll();
743
- }), H(
744
- [n, h],
728
+ ), K([o, m], () => {
729
+ u?.clearAll();
730
+ }), K(
731
+ [o, m],
745
732
  () => {
746
- if (!B.value) {
747
- i.value = {};
733
+ if (!V.value) {
734
+ S.value = {};
748
735
  return;
749
736
  }
750
- const e = o.value?.registry;
751
- i.value = e ? e.initializeRecord(re()) : {};
737
+ const e = a.value?.registry;
738
+ S.value = e ? e.initializeRecord(te()) : {};
752
739
  },
753
740
  { immediate: !0 }
754
- ), te("desktopMethods", {
755
- navigateToDoctype: ae,
756
- openRecord: ne,
757
- createNewRecord: U,
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
- d("action", {
750
+ y("action", {
764
751
  name: e,
765
- doctype: n.value,
766
- recordId: h.value,
767
- data: t ?? f.value ?? {}
752
+ doctype: o.value,
753
+ recordId: m.value,
754
+ data: t ?? D.value ?? {}
768
755
  });
769
756
  }
770
- }), te("aformLinkNavigator", {
757
+ }), X("aformLinkNavigator", {
771
758
  navigate: (e, t) => {
772
- E({ view: "record", doctype: e, recordId: String(t) });
759
+ M({ view: "record", doctype: e, recordId: String(t) });
773
760
  }
774
- }), te("aformLinkResolver", async (e, t) => {
775
- if (o.value)
761
+ }), X("aformLinkResolver", async (e, t) => {
762
+ if (a.value)
776
763
  try {
777
- const m = (await o.value.getMeta({ path: `/${e}`, segments: [e] }))?.displayField;
778
- if (!m) return;
779
- const v = (b) => {
780
- if (!b) return;
781
- const N = b[m];
782
- return typeof N == "string" || typeof N == "number" ? String(N) : void 0;
783
- }, A = o.value.getRecordById(e, t)?.get(""), I = v(A);
784
- if (I != null) return I;
785
- await o.value.getRecord(e, t);
786
- const k = o.value.getRecordById(e, t)?.get("");
787
- return v(k);
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 ie = (e) => {
793
- (e.ctrlKey || e.metaKey) && e.key === "k" && (e.preventDefault(), C.value = !0), e.key === "Escape" && C.value && (C.value = !1);
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 ue(() => {
796
- document.addEventListener("keydown", ie);
797
- }), Be(() => {
798
- document.removeEventListener("keydown", ie);
799
- }), (e, t) => (y(), g("div", {
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: Ne
788
+ onClick: $e
802
789
  }, [
803
- L(he, {
804
- elements: Ce.value,
805
- onActionClick: _e
790
+ B(pe, {
791
+ elements: ge.value,
792
+ onActionClick: Re
806
793
  }, null, 8, ["elements"]),
807
- se.value.length > 0 ? (y(), pe(ee(je), {
794
+ oe.value.length > 0 ? (h(), ie(Q(Be), {
808
795
  key: 0,
809
- data: f.value,
810
- "onUpdate:data": t[0] || (t[0] = (a) => f.value = a),
811
- schema: se.value,
812
- errors: _.value
813
- }, null, 8, ["data", "schema", "errors"])) : ee(o) ? (y(), g("div", yt, [
814
- c("p", null, "Loading " + V(x.value) + " data...", 1)
815
- ])) : (y(), g("div", mt, [...t[2] || (t[2] = [
816
- c("p", null, "Initializing Stonecrop...", -1)
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
- L(we, { breadcrumbs: Ae.value }, null, 8, ["breadcrumbs"]),
819
- L(ge, {
820
- "is-open": C.value,
821
- search: De,
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: Re,
824
- onClose: t[1] || (t[1] = (a) => C.value = !1)
810
+ onSelect: ke,
811
+ onClose: t[1] || (t[1] = (l) => b.value = !1)
825
812
  }, {
826
- title: z(({ result: a }) => [
827
- J(V(a.title), 1)
813
+ title: j(({ result: l }) => [
814
+ W(N(l.title), 1)
828
815
  ]),
829
- content: z(({ result: a }) => [
830
- J(V(a.description), 1)
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
- }), Dt = {
837
- install: (l) => {
838
- l.component("ActionSet", he), l.component("CommandPalette", ge), l.component("Desktop", ht), l.component("SheetNav", we);
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
- he as ActionSet,
843
- ge as CommandPalette,
844
- ht as Desktop,
845
- we as SheetNav,
846
- Dt as StonecropDesktop
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