@stonecrop/desktop 0.17.0 → 0.19.0

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