@stonecrop/stonecrop 0.11.3 → 0.11.5

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/stonecrop.js CHANGED
@@ -1,4 +1,4 @@
1
- import { watch as Mt, onMounted as An, nextTick as br, readonly as kn, getCurrentInstance as Mn, toRef as $i, customRef as zi, ref as B, reactive as lr, computed as G, toValue as It, shallowRef as $n, unref as Ti, inject as xe, provide as Xr } from "vue";
1
+ import { watch as Mt, onMounted as An, nextTick as br, readonly as kn, getCurrentInstance as Mn, toRef as $i, customRef as zi, ref as F, reactive as lr, computed as G, toValue as It, shallowRef as $n, unref as Ti, inject as xe, provide as Xr } from "vue";
2
2
  import { defineStore as Li, storeToRefs as zn } from "pinia";
3
3
  const Di = typeof window < "u" && typeof document < "u";
4
4
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
@@ -10,7 +10,7 @@ function Ni(...e) {
10
10
  return typeof t == "function" ? kn(zi(() => ({
11
11
  get: t,
12
12
  set: Tn
13
- }))) : B(t);
13
+ }))) : F(t);
14
14
  }
15
15
  function Pi(e, t) {
16
16
  function r(...n) {
@@ -46,17 +46,17 @@ function ji(e = Ln, t = {}) {
46
46
  function nr(e) {
47
47
  return Array.isArray(e) ? e : [e];
48
48
  }
49
- function Bi(e) {
49
+ function Fi(e) {
50
50
  return Mn();
51
51
  }
52
- function Fi(e, t, r = {}) {
52
+ function Bi(e, t, r = {}) {
53
53
  const { eventFilter: n = Ln, ...i } = r;
54
54
  return Mt(e, Pi(n, t), i);
55
55
  }
56
56
  function xi(e, t, r = {}) {
57
57
  const { eventFilter: n, initialState: i = "active", ...o } = r, { eventFilter: s, pause: a, resume: u, isActive: c } = ji(n, { initialState: i });
58
58
  return {
59
- stop: Fi(e, t, {
59
+ stop: Bi(e, t, {
60
60
  ...o,
61
61
  eventFilter: s
62
62
  }),
@@ -66,7 +66,7 @@ function xi(e, t, r = {}) {
66
66
  };
67
67
  }
68
68
  function Ui(e, t = !0, r) {
69
- Bi() ? An(e, r) : t ? e() : br(e);
69
+ Fi() ? An(e, r) : t ? e() : br(e);
70
70
  }
71
71
  function Wi(e, t, r) {
72
72
  return Mt(e, t, {
@@ -103,7 +103,7 @@ function Wt(...e) {
103
103
  ];
104
104
  }, ([n, i, o, s], a, u) => {
105
105
  if (!n?.length || !i?.length || !o?.length) return;
106
- const c = qi(s) ? { ...s } : s, f = n.flatMap((h) => i.flatMap((l) => o.map((d) => t(h, l, d, c))));
106
+ const c = qi(s) ? { ...s } : s, f = n.flatMap((h) => i.flatMap((l) => o.map((g) => t(h, l, g, c))));
107
107
  u(() => {
108
108
  f.forEach((h) => h());
109
109
  });
@@ -155,16 +155,16 @@ const Gi = {
155
155
  }, Qr = "vueuse-storage";
156
156
  function Zi(e, t, r, n = {}) {
157
157
  var i;
158
- const { flush: o = "pre", deep: s = !0, listenToStorageChanges: a = !0, writeDefaults: u = !0, mergeDefaults: c = !1, shallow: f, window: h = Nt, eventFilter: l, onError: d = (R) => {
158
+ const { flush: o = "pre", deep: s = !0, listenToStorageChanges: a = !0, writeDefaults: u = !0, mergeDefaults: c = !1, shallow: f, window: h = Nt, eventFilter: l, onError: g = (R) => {
159
159
  console.error(R);
160
- }, initOnMounted: p } = n, g = (f ? $n : B)(t), S = G(() => It(e));
160
+ }, initOnMounted: p } = n, d = (f ? $n : F)(t), S = G(() => It(e));
161
161
  if (!r) try {
162
162
  r = Yi("getDefaultStorage", () => Nt?.localStorage)();
163
163
  } catch (R) {
164
- d(R);
164
+ g(R);
165
165
  }
166
- if (!r) return g;
167
- const I = It(t), O = Ji(I), w = (i = n.serializer) !== null && i !== void 0 ? i : Gi[O], { pause: K, resume: k } = xi(g, (R) => ae(R), {
166
+ if (!r) return d;
167
+ const I = It(t), O = Ji(I), w = (i = n.serializer) !== null && i !== void 0 ? i : Gi[O], { pause: K, resume: k } = xi(d, (R) => ae(R), {
168
168
  flush: o,
169
169
  deep: s,
170
170
  eventFilter: l
@@ -200,7 +200,7 @@ function Zi(e, t, r, n = {}) {
200
200
  j !== Q && (r.setItem(S.value, Q), W(j, Q));
201
201
  }
202
202
  } catch (j) {
203
- d(j);
203
+ g(j);
204
204
  }
205
205
  }
206
206
  function ue(R) {
@@ -218,16 +218,16 @@ function Zi(e, t, r, n = {}) {
218
218
  function wt(R) {
219
219
  if (!(R && R.storageArea !== r)) {
220
220
  if (R && R.key == null) {
221
- g.value = I;
221
+ d.value = I;
222
222
  return;
223
223
  }
224
224
  if (!(R && R.key !== S.value)) {
225
225
  K();
226
226
  try {
227
- const j = w.write(g.value);
228
- (R === void 0 || R?.newValue !== j) && (g.value = ue(R));
227
+ const j = w.write(d.value);
228
+ (R === void 0 || R?.newValue !== j) && (d.value = ue(R));
229
229
  } catch (j) {
230
- d(j);
230
+ g(j);
231
231
  } finally {
232
232
  R ? br(k) : k();
233
233
  }
@@ -237,7 +237,7 @@ function Zi(e, t, r, n = {}) {
237
237
  function ce(R) {
238
238
  wt(R.detail);
239
239
  }
240
- return g;
240
+ return d;
241
241
  }
242
242
  function Xi(e, t, r = {}) {
243
243
  const { window: n = Nt } = r;
@@ -267,7 +267,7 @@ function to(e = {}) {
267
267
  function l(O, w) {
268
268
  O in u && (t ? u[O] = w : u[O].value = w);
269
269
  }
270
- function d() {
270
+ function g() {
271
271
  s.clear();
272
272
  for (const O of h) l(O, !1);
273
273
  }
@@ -279,7 +279,7 @@ function to(e = {}) {
279
279
  }
280
280
  }
281
281
  }
282
- function g(O, w) {
282
+ function d(O, w) {
283
283
  if (O) return;
284
284
  const K = `${w[0].toUpperCase()}${w.slice(1)}`, k = f.get(K);
285
285
  if (!["shift", "alt"].includes(w) || !k) return;
@@ -295,12 +295,12 @@ function to(e = {}) {
295
295
  $ && (w ? s.add($) : s.delete($));
296
296
  for (const J of H)
297
297
  h.add(J), l(J, w);
298
- p(w, O, [...s, ...H]), g(w, $), $ === "meta" && !w && (c.forEach((J) => {
298
+ p(w, O, [...s, ...H]), d(w, $), $ === "meta" && !w && (c.forEach((J) => {
299
299
  s.delete(J), l(J, !1);
300
300
  }), c.clear());
301
301
  }
302
302
  }
303
- Wt(r, "keydown", (O) => (S(O, !0), o(O)), { passive: i }), Wt(r, "keyup", (O) => (S(O, !1), o(O)), { passive: i }), Wt("blur", d, { passive: i }), Wt("focus", d, { passive: i });
303
+ Wt(r, "keydown", (O) => (S(O, !0), o(O)), { passive: i }), Wt(r, "keyup", (O) => (S(O, !1), o(O)), { passive: i }), Wt("blur", g, { passive: i }), Wt("focus", g, { passive: i });
304
304
  const I = new Proxy(u, { get(O, w, K) {
305
305
  if (typeof w != "string") return Reflect.get(O, w, K);
306
306
  if (w = w.toLowerCase(), w in n && (w = n[w]), !(w in u)) if (/[+_-]/.test(w)) {
@@ -344,13 +344,13 @@ function eo(e) {
344
344
  }))), t;
345
345
  }
346
346
  const Ie = Li("hst-operation-log", () => {
347
- const e = B({
347
+ const e = F({
348
348
  maxOperations: 100,
349
349
  enableCrossTabSync: !0,
350
350
  autoSyncInterval: 3e4,
351
351
  enablePersistence: !1,
352
352
  persistenceKeyPrefix: "stonecrop-ops"
353
- }), t = B([]), r = B(-1), n = B(ir()), i = B(!1), o = B([]), s = G(() => r.value < 0 ? !1 : t.value[r.value]?.reversible ?? !1), a = G(() => r.value < t.value.length - 1), u = G(() => {
353
+ }), t = F([]), r = F(-1), n = F(ir()), i = F(!1), o = F([]), s = G(() => r.value < 0 ? !1 : t.value[r.value]?.reversible ?? !1), a = G(() => r.value < t.value.length - 1), u = G(() => {
354
354
  let _ = 0;
355
355
  for (let v = r.value; v >= 0 && t.value[v]?.reversible; v--)
356
356
  _++;
@@ -383,7 +383,7 @@ const Ie = Li("hst-operation-log", () => {
383
383
  }
384
384
  return e.value.enableCrossTabSync && ue(y), y.id;
385
385
  }
386
- function d() {
386
+ function g() {
387
387
  i.value = !0, o.value.push({
388
388
  id: ir(),
389
389
  operations: []
@@ -415,7 +415,7 @@ const Ie = Li("hst-operation-log", () => {
415
415
  E.ancestorOperationId = x;
416
416
  }), o.value.length > 0 ? o.value[o.value.length - 1].operations.push(m) : (t.value.push(...y, m), r.value = t.value.length - 1), e.value.enableCrossTabSync && wt(y, m), o.value.length === 0 && (i.value = !1), x;
417
417
  }
418
- function g() {
418
+ function d() {
419
419
  o.value = [], i.value = !1;
420
420
  }
421
421
  function S(_) {
@@ -609,9 +609,9 @@ const Ie = Li("hst-operation-log", () => {
609
609
  // Methods
610
610
  configure: h,
611
611
  addOperation: l,
612
- startBatch: d,
612
+ startBatch: g,
613
613
  commitBatch: p,
614
- cancelBatch: g,
614
+ cancelBatch: d,
615
615
  undo: S,
616
616
  redo: I,
617
617
  clear: k,
@@ -768,7 +768,7 @@ class _e {
768
768
  } catch (S) {
769
769
  console.error("[FieldTriggers] Rollback failed:", S);
770
770
  }
771
- const d = performance.now() - s, p = a.filter((S) => !S.success && S.error != null);
771
+ const g = performance.now() - s, p = a.filter((S) => !S.success && S.error != null);
772
772
  if (p.length > 0 && this.options.errorHandler)
773
773
  for (const S of p)
774
774
  try {
@@ -779,7 +779,7 @@ class _e {
779
779
  return {
780
780
  path: t.path,
781
781
  actionResults: a,
782
- totalExecutionTime: d,
782
+ totalExecutionTime: g,
783
783
  allSucceeded: a.every((S) => S.success),
784
784
  stoppedOnError: u,
785
785
  rolledBack: c,
@@ -1455,11 +1455,11 @@ class At {
1455
1455
  try {
1456
1456
  if (o && o.length > 0) {
1457
1457
  const l = bt();
1458
- o.forEach((d) => {
1458
+ o.forEach((g) => {
1459
1459
  try {
1460
- const p = l.getAction(d);
1461
- if (!p) throw new Error(`Action "${d}" is not registered in FieldTriggerEngine`);
1462
- const g = {
1460
+ const p = l.getAction(g);
1461
+ if (!p) throw new Error(`Action "${g}" is not registered in FieldTriggerEngine`);
1462
+ const d = {
1463
1463
  path: `${t.slug}.${s?.[0] ?? ""}`,
1464
1464
  fieldname: r,
1465
1465
  beforeValue: void 0,
@@ -1469,7 +1469,7 @@ class At {
1469
1469
  recordId: a,
1470
1470
  timestamp: /* @__PURE__ */ new Date()
1471
1471
  };
1472
- p(g);
1472
+ p(d);
1473
1473
  } catch (p) {
1474
1474
  throw f = "failure", h = p instanceof Error ? p.message : "Unknown error", p;
1475
1475
  }
@@ -1699,7 +1699,7 @@ function hs(e, t, r) {
1699
1699
  const n = xe("$stonecrop") || At._root;
1700
1700
  if (!n)
1701
1701
  throw new Error("Stonecrop instance not available. Ensure useStonecrop() has been called first.");
1702
- const i = B(!1), o = B(!1), s = B(null), a = n.getStore(), u = () => `${e.slug || e.doctype}.${t}.${r}`, c = () => e.links?.[r]?.fetch, f = async (p) => {
1702
+ const i = F(!1), o = F(!1), s = F(null), a = n.getStore(), u = () => `${e.slug || e.doctype}.${t}.${r}`, c = () => e.links?.[r]?.fetch, f = async (p) => {
1703
1703
  try {
1704
1704
  return await new Function(
1705
1705
  "stonecrop",
@@ -1709,17 +1709,17 @@ function hs(e, t, r) {
1709
1709
  return (${p})(stonecrop, path, hst)
1710
1710
  `
1711
1711
  )(n, u(), a);
1712
- } catch (g) {
1713
- throw new Error(`Custom handler failed: ${g instanceof Error ? g.message : String(g)}`);
1712
+ } catch (d) {
1713
+ throw new Error(`Custom handler failed: ${d instanceof Error ? d.message : String(d)}`);
1714
1714
  }
1715
1715
  }, h = async () => {
1716
- const p = c(), g = `${e.slug || e.doctype}.${t}`;
1716
+ const p = c(), d = `${e.slug || e.doctype}.${t}`;
1717
1717
  if (p?.method === "custom") {
1718
- a.has(g) || a.set(g, {}, "system");
1718
+ a.has(d) || a.set(d, {}, "system");
1719
1719
  const S = await f(p.handler);
1720
1720
  a.set(u(), S, "system");
1721
1721
  } else
1722
- await n.fetchNestedData(g, e, t, { includeNested: [r] });
1722
+ await n.fetchNestedData(d, e, t, { includeNested: [r] });
1723
1723
  }, l = async () => {
1724
1724
  if (!i.value) {
1725
1725
  i.value = !0, s.value = null;
@@ -1731,7 +1731,7 @@ function hs(e, t, r) {
1731
1731
  i.value = !1;
1732
1732
  }
1733
1733
  }
1734
- }, d = G(() => {
1734
+ }, g = G(() => {
1735
1735
  if (o.value)
1736
1736
  return a.get(u());
1737
1737
  });
@@ -1741,16 +1741,16 @@ function hs(e, t, r) {
1741
1741
  loaded: o,
1742
1742
  error: s,
1743
1743
  // Computed
1744
- data: d,
1744
+ data: g,
1745
1745
  // Actions
1746
1746
  reload: l
1747
1747
  };
1748
1748
  }
1749
1749
  function ls(e) {
1750
1750
  e || (e = {});
1751
- const t = e.registry || xe("$registry"), r = xe("$stonecrop"), n = B(), i = B(), o = B({}), s = B(), a = B(), u = B([]), c = B(!1), f = B(null), h = B(), l = G(() => !n.value || !h.value || !e.recordId || e.recordId === "new" ? !0 : n.value.isWorkflowReady(h.value, e.recordId).ready), d = G(() => !n.value || !h.value || !e.recordId || e.recordId === "new" ? [] : n.value.isWorkflowReady(h.value, e.recordId).blockedLinks ?? []), p = r || At._root;
1751
+ const t = e.registry || xe("$registry"), r = xe("$stonecrop"), n = F(), i = F(), o = F({}), s = F(), a = F(), u = F([]), c = F(!1), f = F(null), h = F(), l = G(() => !n.value || !h.value || !e.recordId || e.recordId === "new" ? !0 : n.value.isWorkflowReady(h.value, e.recordId).ready), g = G(() => !n.value || !h.value || !e.recordId || e.recordId === "new" ? [] : n.value.isWorkflowReady(h.value, e.recordId).blockedLinks ?? []), p = r || At._root;
1752
1752
  p && (n.value = p), e?.doctype && typeof e.doctype != "string" && (h.value = e.doctype);
1753
- const g = B([]), S = B(-1), I = G(() => n.value?.getOperationLogStore().canUndo ?? !1), O = G(() => n.value?.getOperationLogStore().canRedo ?? !1), w = G(() => n.value?.getOperationLogStore().undoCount ?? 0), K = G(() => n.value?.getOperationLogStore().redoCount ?? 0), k = G(
1753
+ const d = F([]), S = F(-1), I = G(() => n.value?.getOperationLogStore().canUndo ?? !1), O = G(() => n.value?.getOperationLogStore().canRedo ?? !1), w = G(() => n.value?.getOperationLogStore().undoCount ?? 0), K = G(() => n.value?.getOperationLogStore().redoCount ?? 0), k = G(
1754
1754
  () => n.value?.getOperationLogStore().undoRedoState ?? {
1755
1755
  canUndo: !1,
1756
1756
  canRedo: !1,
@@ -1778,10 +1778,10 @@ function ls(e) {
1778
1778
  if (t && n.value)
1779
1779
  try {
1780
1780
  const m = n.value.getOperationLogStore(), E = zn(m);
1781
- g.value = E.operations.value, S.value = E.currentIndex.value, Mt(
1781
+ d.value = E.operations.value, S.value = E.currentIndex.value, Mt(
1782
1782
  () => E.operations.value,
1783
1783
  (b) => {
1784
- g.value = b;
1784
+ d.value = b;
1785
1785
  }
1786
1786
  ), Mt(
1787
1787
  () => E.currentIndex.value,
@@ -1924,7 +1924,7 @@ function ls(e) {
1924
1924
  });
1925
1925
  }
1926
1926
  }), it = {
1927
- operations: g,
1927
+ operations: d,
1928
1928
  currentIndex: S,
1929
1929
  undoRedoState: k,
1930
1930
  canUndo: I,
@@ -1959,7 +1959,7 @@ function ls(e) {
1959
1959
  error: f,
1960
1960
  resolvedDoctype: h,
1961
1961
  isWorkflowReady: l,
1962
- blockedLinks: d
1962
+ blockedLinks: g
1963
1963
  } : !e.doctype && t?.router ? {
1964
1964
  stonecrop: n,
1965
1965
  operationLog: it,
@@ -1976,7 +1976,7 @@ function ls(e) {
1976
1976
  error: f,
1977
1977
  resolvedDoctype: h,
1978
1978
  isWorkflowReady: l,
1979
- blockedLinks: d
1979
+ blockedLinks: g
1980
1980
  } : {
1981
1981
  stonecrop: n,
1982
1982
  operationLog: it
@@ -2020,13 +2020,13 @@ function Dn(e) {
2020
2020
  function l() {
2021
2021
  r.startBatch();
2022
2022
  }
2023
- function d(k) {
2023
+ function g(k) {
2024
2024
  return r.commitBatch(k);
2025
2025
  }
2026
2026
  function p() {
2027
2027
  r.cancelBatch();
2028
2028
  }
2029
- function g() {
2029
+ function d() {
2030
2030
  r.clear();
2031
2031
  }
2032
2032
  function S(k, $) {
@@ -2057,9 +2057,9 @@ function Dn(e) {
2057
2057
  undo: f,
2058
2058
  redo: h,
2059
2059
  startBatch: l,
2060
- commitBatch: d,
2060
+ commitBatch: g,
2061
2061
  cancelBatch: p,
2062
- clear: g,
2062
+ clear: d,
2063
2063
  getOperationsFor: S,
2064
2064
  getSnapshot: I,
2065
2065
  markIrreversible: O,
@@ -2207,7 +2207,7 @@ function Pn() {
2207
2207
  return !0;
2208
2208
  }
2209
2209
  function Ge(e, t, r) {
2210
- return (e === 0 && !Bn(e) || r !== void 0 && e <= -r) && (t === void 0 || r !== void 0 && t >= r);
2210
+ return (e === 0 && !Fn(e) || r !== void 0 && e <= -r) && (t === void 0 || r !== void 0 && t >= r);
2211
2211
  }
2212
2212
  function ke(e, t) {
2213
2213
  return jn(e, t, 0);
@@ -2216,15 +2216,15 @@ function Ze(e, t) {
2216
2216
  return jn(e, t, t);
2217
2217
  }
2218
2218
  function jn(e, t, r) {
2219
- return e === void 0 ? r : Bn(e) ? t === 1 / 0 ? t : Math.max(0, t + e) | 0 : t === void 0 || t === e ? e : Math.min(t, e) | 0;
2219
+ return e === void 0 ? r : Fn(e) ? t === 1 / 0 ? t : Math.max(0, t + e) | 0 : t === void 0 || t === e ? e : Math.min(t, e) | 0;
2220
2220
  }
2221
- function Bn(e) {
2221
+ function Fn(e) {
2222
2222
  return e < 0 || e === 0 && 1 / e === -1 / 0;
2223
2223
  }
2224
- var Fn = "@@__IMMUTABLE_RECORD__@@";
2224
+ var Bn = "@@__IMMUTABLE_RECORD__@@";
2225
2225
  function jt(e) {
2226
2226
  return !!(e && // @ts-expect-error: maybeRecord is typed as `{}`, need to change in 6.0 to `maybeRecord && typeof maybeRecord === 'object' && IS_RECORD_SYMBOL in maybeRecord`
2227
- e[Fn]);
2227
+ e[Bn]);
2228
2228
  }
2229
2229
  function mt(e) {
2230
2230
  return ct(e) || jt(e);
@@ -2864,24 +2864,24 @@ function zr(e, t, r, n) {
2864
2864
  return 0;
2865
2865
  if (h)
2866
2866
  return this.cacheResult().__iterate(f, h);
2867
- var d = 0, p = !0, g = 0;
2867
+ var g = 0, p = !0, d = 0;
2868
2868
  return e.__iterate(function(S, I) {
2869
- if (!(p && (p = d++ < o)))
2870
- return g++, f(S, n ? I : g - 1, l) !== !1 && g !== u;
2871
- }), g;
2869
+ if (!(p && (p = g++ < o)))
2870
+ return d++, f(S, n ? I : d - 1, l) !== !1 && d !== u;
2871
+ }), d;
2872
2872
  }, c.__iteratorUncached = function(f, h) {
2873
2873
  if (u !== 0 && h)
2874
2874
  return this.cacheResult().__iterator(f, h);
2875
2875
  if (u === 0)
2876
2876
  return new M(et);
2877
- var l = e.__iterator(f, h), d = 0, p = 0;
2877
+ var l = e.__iterator(f, h), g = 0, p = 0;
2878
2878
  return new M(function() {
2879
- for (; d++ < o; )
2879
+ for (; g++ < o; )
2880
2880
  l.next();
2881
2881
  if (++p > u)
2882
2882
  return et();
2883
- var g = l.next();
2884
- return n || f === ft || g.done ? g : f === re ? P(f, p - 1, void 0, g) : P(f, p - 1, g.value[1], g);
2883
+ var d = l.next();
2884
+ return n || f === ft || d.done ? d : f === re ? P(f, p - 1, void 0, d) : P(f, p - 1, d.value[1], d);
2885
2885
  });
2886
2886
  }, c;
2887
2887
  }
@@ -2930,14 +2930,14 @@ function Xn(e, t, r, n) {
2930
2930
  return this.cacheResult().__iterator(o, s);
2931
2931
  var u = e.__iterator(ht, s), c = !0, f = 0;
2932
2932
  return new M(function() {
2933
- var h, l, d;
2933
+ var h, l, g;
2934
2934
  do {
2935
2935
  if (h = u.next(), h.done)
2936
2936
  return n || o === ft ? h : o === re ? P(o, f++, void 0, h) : P(o, f++, h.value[1], h);
2937
2937
  var p = h.value;
2938
- l = p[0], d = p[1], c && (c = t.call(r, d, l, a));
2938
+ l = p[0], g = p[1], c && (c = t.call(r, g, l, a));
2939
2939
  } while (c);
2940
- return o === ht ? h : P(o, l, d, h);
2940
+ return o === ht ? h : P(o, l, g, h);
2941
2941
  });
2942
2942
  }, i;
2943
2943
  }
@@ -3307,10 +3307,10 @@ function Pr(e, t) {
3307
3307
  function jr(e, t, r) {
3308
3308
  return arguments.length === 1 ? e(this) : ei(this, e, t, r);
3309
3309
  }
3310
- function Br(e, t, r) {
3310
+ function Fr(e, t, r) {
3311
3311
  return oe(this, e, t, r);
3312
3312
  }
3313
- function Fr() {
3313
+ function Br() {
3314
3314
  return this.__altered;
3315
3315
  }
3316
3316
  function ze(e) {
@@ -3385,7 +3385,7 @@ q.removeAll = q.deleteAll;
3385
3385
  q.setIn = Pr;
3386
3386
  q.removeIn = q.deleteIn = Hr;
3387
3387
  q.update = jr;
3388
- q.updateIn = Br;
3388
+ q.updateIn = Fr;
3389
3389
  q.merge = q.concat = ri;
3390
3390
  q.mergeWith = ni;
3391
3391
  q.mergeDeep = oi;
@@ -3393,7 +3393,7 @@ q.mergeDeepWith = si;
3393
3393
  q.mergeIn = Nr;
3394
3394
  q.mergeDeepIn = qr;
3395
3395
  q.withMutations = ze;
3396
- q.wasAltered = Fr;
3396
+ q.wasAltered = Br;
3397
3397
  q.asImmutable = Me;
3398
3398
  q["@@transducer/init"] = q.asMutable = $e;
3399
3399
  q["@@transducer/step"] = function(e, t) {
@@ -3420,8 +3420,8 @@ Se.prototype.update = function(t, r, n, i, o, s, a) {
3420
3420
  if (lt(a), (u || !l) && lt(s), !(u && c.length === 1)) {
3421
3421
  if (!l && !u && c.length >= No)
3422
3422
  return To(t, c, i, o);
3423
- var d = t && t === this.ownerID, p = d ? c : _t(c);
3424
- return l ? u ? f === h - 1 ? p.pop() : p[f] = p.pop() : p[f] = [i, o] : p.push([i, o]), d ? (this.entries = p, this) : new Se(t, p);
3423
+ var g = t && t === this.ownerID, p = g ? c : _t(c);
3424
+ return l ? u ? f === h - 1 ? p.pop() : p[f] = p.pop() : p[f] = [i, o] : p.push([i, o]), g ? (this.entries = p, this) : new Se(t, p);
3425
3425
  }
3426
3426
  };
3427
3427
  var Jt = function(t, r, n) {
@@ -3442,7 +3442,7 @@ Jt.prototype.update = function(t, r, n, i, o, s, a) {
3442
3442
  var u = (r === 0 ? n : n >>> r) & tt, c = 1 << u, f = this.bitmap, h = (f & c) !== 0;
3443
3443
  if (!h && o === A)
3444
3444
  return this;
3445
- var l = ui(f & c - 1), d = this.nodes, p = h ? d[l] : void 0, g = Wr(
3445
+ var l = ui(f & c - 1), g = this.nodes, p = h ? g[l] : void 0, d = Wr(
3446
3446
  p,
3447
3447
  t,
3448
3448
  r + T,
@@ -3452,15 +3452,15 @@ Jt.prototype.update = function(t, r, n, i, o, s, a) {
3452
3452
  s,
3453
3453
  a
3454
3454
  );
3455
- if (g === p)
3455
+ if (d === p)
3456
3456
  return this;
3457
- if (!h && g && d.length >= Po)
3458
- return Do(t, d, f, u, g);
3459
- if (h && !g && d.length === 2 && gn(d[l ^ 1]))
3460
- return d[l ^ 1];
3461
- if (h && g && d.length === 1 && gn(g))
3462
- return g;
3463
- var S = t && t === this.ownerID, I = h ? g ? f : f ^ c : f | c, O = h ? g ? ci(d, l, g, S) : qo(d, l, S) : Co(d, l, g, S);
3457
+ if (!h && d && g.length >= Po)
3458
+ return Do(t, g, f, u, d);
3459
+ if (h && !d && g.length === 2 && gn(g[l ^ 1]))
3460
+ return g[l ^ 1];
3461
+ if (h && d && g.length === 1 && gn(d))
3462
+ return d;
3463
+ var S = t && t === this.ownerID, I = h ? d ? f : f ^ c : f | c, O = h ? d ? ci(g, l, d, S) : qo(g, l, S) : Co(g, l, d, S);
3464
3464
  return S ? (this.bitmap = I, this.nodes = O, this) : new Jt(t, I, O);
3465
3465
  };
3466
3466
  var we = function(t, r, n) {
@@ -3488,13 +3488,13 @@ we.prototype.update = function(t, r, n, i, o, s, a) {
3488
3488
  );
3489
3489
  if (l === h)
3490
3490
  return this;
3491
- var d = this.count;
3491
+ var g = this.count;
3492
3492
  if (!h)
3493
- d++;
3494
- else if (!l && (d--, d < jo))
3495
- return Lo(t, f, d, u);
3496
- var p = t && t === this.ownerID, g = ci(f, u, l, p);
3497
- return p ? (this.count = d, this.nodes = g, this) : new we(t, d, g);
3493
+ g++;
3494
+ else if (!l && (g--, g < jo))
3495
+ return Lo(t, f, g, u);
3496
+ var p = t && t === this.ownerID, d = ci(f, u, l, p);
3497
+ return p ? (this.count = g, this.nodes = d, this) : new we(t, g, d);
3498
3498
  };
3499
3499
  var Gt = function(t, r, n) {
3500
3500
  this.ownerID = t, this.keyHash = r, this.entries = n;
@@ -3517,8 +3517,8 @@ Gt.prototype.update = function(t, r, n, i, o, s, a) {
3517
3517
  return this;
3518
3518
  if (lt(a), (u || !l) && lt(s), u && h === 2)
3519
3519
  return new Ot(t, this.keyHash, c[f ^ 1]);
3520
- var d = t && t === this.ownerID, p = d ? c : _t(c);
3521
- return l ? u ? f === h - 1 ? p.pop() : p[f] = p.pop() : p[f] = [i, o] : p.push([i, o]), d ? (this.entries = p, this) : new Gt(t, this.keyHash, p);
3520
+ var g = t && t === this.ownerID, p = g ? c : _t(c);
3521
+ return l ? u ? f === h - 1 ? p.pop() : p[f] = p.pop() : p[f] = [i, o] : p.push([i, o]), g ? (this.entries = p, this) : new Gt(t, this.keyHash, p);
3522
3522
  };
3523
3523
  var Ot = function(t, r, n) {
3524
3524
  this.ownerID = t, this.keyHash = r, this.entry = n;
@@ -3700,7 +3700,7 @@ function be(e) {
3700
3700
  return JSON.stringify(e);
3701
3701
  }
3702
3702
  }
3703
- function Bo(e, t) {
3703
+ function Fo(e, t) {
3704
3704
  return mt(e) ? (
3705
3705
  // @ts-expect-error key might be a number or symbol, which is not handled be Record key type
3706
3706
  e.has(t)
@@ -3710,7 +3710,7 @@ function Bo(e, t) {
3710
3710
  );
3711
3711
  }
3712
3712
  function hi(e, t, r) {
3713
- return mt(e) ? e.get(t, r) : Bo(e, t) ? (
3713
+ return mt(e) ? e.get(t, r) : Fo(e, t) ? (
3714
3714
  // @ts-expect-error weird "get" here,
3715
3715
  typeof e.get == "function" ? (
3716
3716
  // @ts-expect-error weird "get" here,
@@ -3721,7 +3721,7 @@ function hi(e, t, r) {
3721
3721
  )
3722
3722
  ) : r;
3723
3723
  }
3724
- function Fo(e, t) {
3724
+ function Bo(e, t) {
3725
3725
  if (!Tt(e))
3726
3726
  throw new TypeError("Cannot update non-data-structure value: " + e);
3727
3727
  if (mt(e)) {
@@ -3777,7 +3777,7 @@ function li(e, t, r, n, i, o) {
3777
3777
  i,
3778
3778
  o
3779
3779
  );
3780
- return h === f ? t : h === A ? Fo(t, c) : xo(s ? e ? vt() : {} : t, c, h);
3780
+ return h === f ? t : h === A ? Bo(t, c) : xo(s ? e ? vt() : {} : t, c, h);
3781
3781
  }
3782
3782
  function Uo(e, t) {
3783
3783
  return oe(e, t, function() {
@@ -3794,7 +3794,7 @@ function di(e) {
3794
3794
  }
3795
3795
  var Zt = /* @__PURE__ */ (function(e) {
3796
3796
  function t(r) {
3797
- var n = Fe();
3797
+ var n = Be();
3798
3798
  if (r == null)
3799
3799
  return n;
3800
3800
  if (di(r))
@@ -3824,7 +3824,7 @@ var Zt = /* @__PURE__ */ (function(e) {
3824
3824
  }, t.prototype.insert = function(n, i) {
3825
3825
  return this.splice(n, 0, i);
3826
3826
  }, t.prototype.clear = function() {
3827
- return this.size === 0 ? this : this.__ownerID ? (this.size = this._origin = this._capacity = 0, this._level = T, this._root = this._tail = this.__hash = void 0, this.__altered = !0, this) : Fe();
3827
+ return this.size === 0 ? this : this.__ownerID ? (this.size = this._origin = this._capacity = 0, this._level = T, this._root = this._tail = this.__hash = void 0, this.__altered = !0, this) : Be();
3828
3828
  }, t.prototype.push = function() {
3829
3829
  var n = arguments, i = this.size;
3830
3830
  return this.withMutations(function(o) {
@@ -3896,7 +3896,7 @@ var Zt = /* @__PURE__ */ (function(e) {
3896
3896
  this._tail,
3897
3897
  n,
3898
3898
  this.__hash
3899
- ) : this.size === 0 ? Fe() : (this.__ownerID = n, this.__altered = !1, this);
3899
+ ) : this.size === 0 ? Be() : (this.__ownerID = n, this.__altered = !1, this);
3900
3900
  }, t;
3901
3901
  })(Pt);
3902
3902
  Zt.isList = di;
@@ -3907,11 +3907,11 @@ U.merge = U.concat;
3907
3907
  U.setIn = Pr;
3908
3908
  U.deleteIn = U.removeIn = Hr;
3909
3909
  U.update = jr;
3910
- U.updateIn = Br;
3910
+ U.updateIn = Fr;
3911
3911
  U.mergeIn = Nr;
3912
3912
  U.mergeDeepIn = qr;
3913
3913
  U.withMutations = ze;
3914
- U.wasAltered = Fr;
3914
+ U.wasAltered = Br;
3915
3915
  U.asImmutable = Me;
3916
3916
  U["@@transducer/init"] = U.asMutable = $e;
3917
3917
  U["@@transducer/step"] = function(e, t) {
@@ -3966,17 +3966,17 @@ function _n(e, t) {
3966
3966
  return f === 0 ? a(c, h) : u(c, f, h);
3967
3967
  }
3968
3968
  function a(c, f) {
3969
- var h = f === i ? o && o.array : c && c.array, l = f > r ? 0 : r - f, d = n - f;
3970
- return d > at && (d = at), function() {
3971
- if (l === d)
3969
+ var h = f === i ? o && o.array : c && c.array, l = f > r ? 0 : r - f, g = n - f;
3970
+ return g > at && (g = at), function() {
3971
+ if (l === g)
3972
3972
  return ye;
3973
- var p = t ? --d : l++;
3973
+ var p = t ? --g : l++;
3974
3974
  return h && h[p];
3975
3975
  };
3976
3976
  }
3977
3977
  function u(c, f, h) {
3978
- var l, d = c && c.array, p = h > r ? 0 : r - h >> f, g = (n - h >> f) + 1;
3979
- return g > at && (g = at), function() {
3978
+ var l, g = c && c.array, p = h > r ? 0 : r - h >> f, d = (n - h >> f) + 1;
3979
+ return d > at && (d = at), function() {
3980
3980
  for (; ; ) {
3981
3981
  if (l) {
3982
3982
  var S = l();
@@ -3984,11 +3984,11 @@ function _n(e, t) {
3984
3984
  return S;
3985
3985
  l = null;
3986
3986
  }
3987
- if (p === g)
3987
+ if (p === d)
3988
3988
  return ye;
3989
- var I = t ? --g : p++;
3989
+ var I = t ? --d : p++;
3990
3990
  l = s(
3991
- d && d[I],
3991
+ g && g[I],
3992
3992
  f - T,
3993
3993
  h + (I << f)
3994
3994
  );
@@ -4000,7 +4000,7 @@ function Oe(e, t, r, n, i, o, s) {
4000
4000
  var a = Object.create(U);
4001
4001
  return a.size = t - e, a._origin = e, a._capacity = t, a._level = r, a._root = n, a._tail = i, a.__ownerID = o, a.__hash = s, a.__altered = !1, a;
4002
4002
  }
4003
- function Fe() {
4003
+ function Be() {
4004
4004
  return Oe(0, 0, T);
4005
4005
  }
4006
4006
  function Wo(e, t, r) {
@@ -4069,14 +4069,14 @@ function Rt(e, t, r) {
4069
4069
  c && c.array.length ? [c] : [],
4070
4070
  n
4071
4071
  ), u += T;
4072
- var d = e._tail, p = l < h ? gi(e, a - 1) : l > h ? new kt([], n) : d;
4073
- if (d && l > h && s < o && d.array.length) {
4072
+ var g = e._tail, p = l < h ? gi(e, a - 1) : l > h ? new kt([], n) : g;
4073
+ if (g && l > h && s < o && g.array.length) {
4074
4074
  c = Xt(c, n);
4075
- for (var g = c, S = u; S > T; S -= T) {
4075
+ for (var d = c, S = u; S > T; S -= T) {
4076
4076
  var I = h >>> S & tt;
4077
- g = g.array[I] = Xt(g.array[I], n);
4077
+ d = d.array[I] = Xt(d.array[I], n);
4078
4078
  }
4079
- g.array[h >>> T & tt] = d;
4079
+ d.array[h >>> T & tt] = g;
4080
4080
  }
4081
4081
  if (a < o && (p = p && p.removeAfter(n, 0, a)), s >= l)
4082
4082
  s -= l, a -= l, u = T, c = null, p = p && p.removeBefore(n, 0, s);
@@ -4149,7 +4149,7 @@ function Vr(e, t, r, n) {
4149
4149
  }
4150
4150
  var vn;
4151
4151
  function pe() {
4152
- return vn || (vn = Vr(vt(), Fe()));
4152
+ return vn || (vn = Vr(vt(), Be()));
4153
4153
  }
4154
4154
  function yn(e, t, r) {
4155
4155
  var n = e._map, i = e._list, o = n.get(t), s = o !== void 0, a, u;
@@ -4263,7 +4263,7 @@ rt.shift = rt.pop;
4263
4263
  rt.unshift = rt.push;
4264
4264
  rt.unshiftAll = rt.pushAll;
4265
4265
  rt.withMutations = ze;
4266
- rt.wasAltered = Fr;
4266
+ rt.wasAltered = Br;
4267
4267
  rt.asImmutable = Me;
4268
4268
  rt["@@transducer/init"] = rt.asMutable = $e;
4269
4269
  rt["@@transducer/step"] = function(e, t) {
@@ -4435,13 +4435,13 @@ var tr = /* @__PURE__ */ (function(e) {
4435
4435
  }, t.prototype.has = function(n) {
4436
4436
  return this._map.has(n);
4437
4437
  }, t.prototype.add = function(n) {
4438
- return Be(this, this._map.set(n, n));
4438
+ return Fe(this, this._map.set(n, n));
4439
4439
  }, t.prototype.remove = function(n) {
4440
- return Be(this, this._map.remove(n));
4440
+ return Fe(this, this._map.remove(n));
4441
4441
  }, t.prototype.clear = function() {
4442
- return Be(this, this._map.clear());
4442
+ return Fe(this, this._map.clear());
4443
4443
  }, t.prototype.map = function(n, i) {
4444
- var o = this, s = !1, a = Be(
4444
+ var o = this, s = !1, a = Fe(
4445
4445
  this,
4446
4446
  this._map.mapEntries(function(u) {
4447
4447
  var c = u[1], f = n.call(i, c, c, o);
@@ -4529,7 +4529,7 @@ Y["@@transducer/result"] = function(e) {
4529
4529
  };
4530
4530
  Y.__empty = ge;
4531
4531
  Y.__make = Si;
4532
- function Be(e, t) {
4532
+ function Fe(e, t) {
4533
4533
  return e.__ownerID ? (e.size = t.size, e._map = t, e) : t === e._map ? e : t.size === 0 ? e.__empty() : e.__make(t);
4534
4534
  }
4535
4535
  function Si(e, t) {
@@ -4601,14 +4601,14 @@ function Zo(e, t) {
4601
4601
  function En(e, t) {
4602
4602
  return e ^ t + 2654435769 + (e << 6) + (e >> 2) | 0;
4603
4603
  }
4604
- function Bt(e, t) {
4604
+ function Ft(e, t) {
4605
4605
  var r = function(n) {
4606
4606
  e.prototype[n] = t[n];
4607
4607
  };
4608
4608
  return Object.keys(t).forEach(r), Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(t).forEach(r), e;
4609
4609
  }
4610
4610
  Z.Iterator = M;
4611
- Bt(Z, {
4611
+ Ft(Z, {
4612
4612
  // ### Conversion to other types
4613
4613
  toArray: function() {
4614
4614
  st(this.size);
@@ -4917,7 +4917,7 @@ X.inspect = X.toSource = function() {
4917
4917
  };
4918
4918
  X.chain = X.flatMap;
4919
4919
  X.contains = X.includes;
4920
- Bt(dt, {
4920
+ Ft(dt, {
4921
4921
  // ### More sequential methods
4922
4922
  flip: function() {
4923
4923
  return z(this, Jn(this));
@@ -4948,7 +4948,7 @@ Te.toJSON = Oi;
4948
4948
  Te.__toStringMapper = function(e, t) {
4949
4949
  return be(t) + ": " + be(e);
4950
4950
  };
4951
- Bt(Pt, {
4951
+ Ft(Pt, {
4952
4952
  // ### Conversion to other types
4953
4953
  toKeyedSeq: function() {
4954
4954
  return new Qe(this, !1);
@@ -5037,7 +5037,7 @@ Bt(Pt, {
5037
5037
  var se = Pt.prototype;
5038
5038
  se[We] = !0;
5039
5039
  se[zt] = !0;
5040
- Bt(ee, {
5040
+ Ft(ee, {
5041
5041
  // ### ES6 Collection methods (ES6 Array and Map)
5042
5042
  get: function(t, r) {
5043
5043
  return this.has(t) ? t : r;
@@ -5054,9 +5054,9 @@ var Qt = ee.prototype;
5054
5054
  Qt.has = X.includes;
5055
5055
  Qt.contains = Qt.includes;
5056
5056
  Qt.keys = Qt.values;
5057
- Bt(Dt, Te);
5058
- Bt(gt, se);
5059
- Bt(ie, Qt);
5057
+ Ft(Dt, Te);
5058
+ Ft(gt, se);
5059
+ Ft(ie, Qt);
5060
5060
  function Rn() {
5061
5061
  return _t(arguments);
5062
5062
  }
@@ -5081,15 +5081,15 @@ var Re = /* @__PURE__ */ (function(e) {
5081
5081
  }, t;
5082
5082
  })(tr);
5083
5083
  Re.isOrderedSet = Ei;
5084
- var Ft = Re.prototype;
5085
- Ft[zt] = !0;
5086
- Ft.zip = se.zip;
5087
- Ft.zipWith = se.zipWith;
5088
- Ft.zipAll = se.zipAll;
5089
- Ft.__empty = wr;
5090
- Ft.__make = Ri;
5084
+ var Bt = Re.prototype;
5085
+ Bt[zt] = !0;
5086
+ Bt.zip = se.zip;
5087
+ Bt.zipWith = se.zipWith;
5088
+ Bt.zipAll = se.zipAll;
5089
+ Bt.__empty = wr;
5090
+ Bt.__make = Ri;
5091
5091
  function Ri(e, t) {
5092
- var r = Object.create(Ft);
5092
+ var r = Object.create(Bt);
5093
5093
  return r.size = e ? e.size : 0, r._map = e, r.__ownerID = t, r;
5094
5094
  }
5095
5095
  var In;
@@ -5130,9 +5130,9 @@ var V = function(t, r) {
5130
5130
  ) : Qo(o, l);
5131
5131
  }
5132
5132
  }
5133
- return this.__ownerID = void 0, this._values = Zt().withMutations(function(d) {
5134
- d.setSize(u._keys.length), dt(a).forEach(function(p, g) {
5135
- d.set(u._indices[g], p === u._defaultValues[g] ? void 0 : p);
5133
+ return this.__ownerID = void 0, this._values = Zt().withMutations(function(g) {
5134
+ g.setSize(u._keys.length), dt(a).forEach(function(p, d) {
5135
+ g.set(u._indices[d], p === u._defaultValues[d] ? void 0 : p);
5136
5136
  });
5137
5137
  }), this;
5138
5138
  }, o = i.prototype = Object.create(C);
@@ -5203,7 +5203,7 @@ V.prototype.__ensureOwner = function(t) {
5203
5203
  V.isRecord = jt;
5204
5204
  V.getDescriptiveName = Zr;
5205
5205
  var C = V.prototype;
5206
- C[Fn] = !0;
5206
+ C[Bn] = !0;
5207
5207
  C[Ae] = C.remove;
5208
5208
  C.deleteIn = C.removeIn = Hr;
5209
5209
  C.getIn = bi;
@@ -5216,7 +5216,7 @@ C.mergeDeepWith = si;
5216
5216
  C.mergeDeepIn = qr;
5217
5217
  C.setIn = Pr;
5218
5218
  C.update = jr;
5219
- C.updateIn = Br;
5219
+ C.updateIn = Fr;
5220
5220
  C.withMutations = ze;
5221
5221
  C.asMutable = $e;
5222
5222
  C.asImmutable = Me;
@@ -5534,7 +5534,7 @@ class me {
5534
5534
  * For each link field:
5535
5535
  * - Looks up the corresponding link declaration in `links` by fieldname
5536
5536
  * - `cardinality: 'noneOrMany'` or `'atLeastOne'`: auto-derives `columns` from the target's schema,
5537
- * sets `component` to `link.component ?? 'ATable'`, `config: { view: 'list' }`, `rows: []`.
5537
+ * sets `component` to `link.component ?? 'ATable'`, `config: { view: 'list' }`.
5538
5538
  * - `cardinality: 'one'` or `'atMostOne'`: embeds the target schema as the entry's
5539
5539
  * `schema` property, sets `component` to `link.component ?? 'AForm'`.
5540
5540
  *
@@ -5571,34 +5571,83 @@ class me {
5571
5571
  a.push({ ...u });
5572
5572
  continue;
5573
5573
  }
5574
- const h = this.resolveSchema(f, n);
5574
+ const h = this.resolveSchema(f, n), {
5575
+ fieldtype: l,
5576
+ options: g,
5577
+ cardinality: p,
5578
+ ...d
5579
+ } = u;
5575
5580
  c.cardinality === "noneOrMany" || c.cardinality === "atLeastOne" ? a.push(
5576
5581
  this.buildTableConfig(
5577
- { fieldname: u.fieldname, label: u.label || u.fieldname },
5582
+ { ...d, label: d.label || u.fieldname },
5578
5583
  h,
5579
5584
  c.component
5580
5585
  )
5581
5586
  ) : a.push({
5582
- fieldname: u.fieldname,
5583
- label: u.label || u.fieldname,
5584
- component: c.component || "AForm",
5587
+ ...d,
5588
+ label: d.label || u.fieldname,
5589
+ component: c.component || d.component || "AForm",
5585
5590
  schema: h
5586
5591
  });
5592
+ } else if ("schema" in u && Array.isArray(u.schema)) {
5593
+ const c = this.resolveFields(u.schema, s, n);
5594
+ a.push({ ...u, schema: c });
5587
5595
  } else
5588
5596
  a.push({ ...u });
5589
5597
  return n.delete(i), a;
5590
5598
  }
5591
5599
  /**
5592
- * Build an ATable configuration from a field and child schema
5600
+ * Recursively resolve a flat fields array using the provided link context.
5601
+ * Used by resolveSchema to handle fieldset children.
5602
+ * @internal
5603
+ */
5604
+ resolveFields(t, r, n) {
5605
+ const i = [];
5606
+ for (const o of t)
5607
+ if ("fieldtype" in o && o.fieldtype === "Link") {
5608
+ const s = r.get(o.fieldname);
5609
+ if (!s) {
5610
+ i.push({ ...o });
5611
+ continue;
5612
+ }
5613
+ const a = this.registry[s.target];
5614
+ if (!a) {
5615
+ i.push({ ...o });
5616
+ continue;
5617
+ }
5618
+ const u = this.resolveSchema(a, new Set(n)), {
5619
+ fieldtype: c,
5620
+ options: f,
5621
+ cardinality: h,
5622
+ ...l
5623
+ } = o;
5624
+ s.cardinality === "noneOrMany" || s.cardinality === "atLeastOne" ? i.push(
5625
+ this.buildTableConfig(
5626
+ { ...l, label: l.label || o.fieldname },
5627
+ u,
5628
+ s.component
5629
+ )
5630
+ ) : i.push({
5631
+ ...l,
5632
+ label: l.label || o.fieldname,
5633
+ component: s.component || l.component || "AForm",
5634
+ schema: u
5635
+ });
5636
+ } else "schema" in o && Array.isArray(o.schema) ? i.push({ ...o, schema: this.resolveFields(o.schema, r, n) }) : i.push({ ...o });
5637
+ return i;
5638
+ }
5639
+ /**
5640
+ * Build an ATable configuration from a field and child schema.
5641
+ * Data-model properties from the source field are preserved via the spread `field` argument.
5593
5642
  * @internal
5594
5643
  */
5595
5644
  buildTableConfig(t, r, n) {
5596
5645
  const i = {
5646
+ ...t,
5597
5647
  fieldname: t.fieldname,
5598
5648
  component: n || t.component || "ATable",
5599
5649
  columns: t.columns,
5600
- config: t.config,
5601
- rows: t.rows
5650
+ config: t.config
5602
5651
  };
5603
5652
  return i.columns || (i.columns = r.filter((o) => "fieldtype" in o).map((o) => ({
5604
5653
  name: o.fieldname,
@@ -5607,7 +5656,7 @@ class me {
5607
5656
  align: "align" in o ? o.align : "left",
5608
5657
  edit: "edit" in o ? o.edit : !0,
5609
5658
  width: "width" in o && o.width || "20ch"
5610
- }))), i.config || (i.config = { view: "list" }), i.rows || (i.rows = []), i;
5659
+ }))), i.config || (i.config = { view: "list" }), i;
5611
5660
  }
5612
5661
  /**
5613
5662
  * Initialize a new record with default values based on a schema.
@@ -5645,7 +5694,7 @@ class me {
5645
5694
  r[n.fieldname] = [];
5646
5695
  return;
5647
5696
  }
5648
- if ("rows" in n) {
5697
+ if ("columns" in n) {
5649
5698
  r[n.fieldname] = [];
5650
5699
  return;
5651
5700
  }
@@ -5797,7 +5846,7 @@ const gs = {
5797
5846
  t?.autoInitializeRouter && t.onRouterInitialized && ts(o, s, t.onRouterInitialized);
5798
5847
  }
5799
5848
  };
5800
- var F = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.WARNING = "warning", e.INFO = "info", e))(F || {});
5849
+ var B = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.WARNING = "warning", e.INFO = "info", e))(B || {});
5801
5850
  class es {
5802
5851
  options;
5803
5852
  /**
@@ -5829,7 +5878,7 @@ class es {
5829
5878
  const h = i instanceof Map ? i : i.toObject();
5830
5879
  s.push(...this.validateActionRegistration(t, h));
5831
5880
  }
5832
- const u = s.filter((h) => h.severity === F.ERROR).length, c = s.filter((h) => h.severity === F.WARNING).length, f = s.filter((h) => h.severity === F.INFO).length;
5881
+ const u = s.filter((h) => h.severity === B.ERROR).length, c = s.filter((h) => h.severity === B.WARNING).length, f = s.filter((h) => h.severity === B.INFO).length;
5833
5882
  return {
5834
5883
  valid: u === 0,
5835
5884
  issues: s,
@@ -5847,7 +5896,7 @@ class es {
5847
5896
  for (const i of r) {
5848
5897
  if (!i.fieldname) {
5849
5898
  n.push({
5850
- severity: F.ERROR,
5899
+ severity: B.ERROR,
5851
5900
  rule: "required-fieldname",
5852
5901
  message: "Field is missing required property: fieldname",
5853
5902
  doctype: t,
@@ -5856,7 +5905,7 @@ class es {
5856
5905
  continue;
5857
5906
  }
5858
5907
  if (!i.component && !("fieldtype" in i) && n.push({
5859
- severity: F.ERROR,
5908
+ severity: B.ERROR,
5860
5909
  rule: "required-component-or-fieldtype",
5861
5910
  message: `Field "${i.fieldname}" must have either component or fieldtype property`,
5862
5911
  doctype: t,
@@ -5879,7 +5928,7 @@ class es {
5879
5928
  const a = "options" in o ? o.options : void 0;
5880
5929
  if (!a) {
5881
5930
  i.push({
5882
- severity: F.ERROR,
5931
+ severity: B.ERROR,
5883
5932
  rule: "link-missing-options",
5884
5933
  message: `Link field "${o.fieldname}" is missing options property (target doctype)`,
5885
5934
  doctype: t,
@@ -5890,7 +5939,7 @@ class es {
5890
5939
  const u = typeof a == "string" ? a : "";
5891
5940
  if (!u) {
5892
5941
  i.push({
5893
- severity: F.ERROR,
5942
+ severity: B.ERROR,
5894
5943
  rule: "link-invalid-options",
5895
5944
  message: `Link field "${o.fieldname}" has invalid options format (expected string doctype name)`,
5896
5945
  doctype: t,
@@ -5899,7 +5948,7 @@ class es {
5899
5948
  continue;
5900
5949
  }
5901
5950
  n.registry[u] || n.registry[u.toLowerCase()] || i.push({
5902
- severity: F.ERROR,
5951
+ severity: B.ERROR,
5903
5952
  rule: "link-invalid-target",
5904
5953
  message: `Link field "${o.fieldname}" references non-existent doctype: "${u}"`,
5905
5954
  doctype: t,
@@ -5926,7 +5975,7 @@ class es {
5926
5975
  const c = i.registry[u.target];
5927
5976
  if (!c) {
5928
5977
  o.push({
5929
- severity: F.ERROR,
5978
+ severity: B.ERROR,
5930
5979
  rule: "link-invalid-target",
5931
5980
  message: `Link "${a}" references non-existent doctype: "${u.target}"`,
5932
5981
  doctype: t,
@@ -5936,7 +5985,7 @@ class es {
5936
5985
  continue;
5937
5986
  }
5938
5987
  if (u.target === t && o.push({
5939
- severity: F.WARNING,
5988
+ severity: B.WARNING,
5940
5989
  rule: "link-self-referential",
5941
5990
  message: `Link "${a}" is self-referential (target: "${u.target}")`,
5942
5991
  doctype: t,
@@ -5945,14 +5994,14 @@ class es {
5945
5994
  }), u.backlink && c.links) {
5946
5995
  const f = c.links[u.backlink];
5947
5996
  f ? f.target !== t && o.push({
5948
- severity: F.WARNING,
5997
+ severity: B.WARNING,
5949
5998
  rule: "link-backlink-mismatch",
5950
5999
  message: `Backlink "${u.backlink}" on "${u.target}" points to "${f.target}" instead of "${t}"`,
5951
6000
  doctype: t,
5952
6001
  fieldname: a,
5953
6002
  context: { backlink: u.backlink, target: u.target, actualTarget: f.target }
5954
6003
  }) : o.push({
5955
- severity: F.ERROR,
6004
+ severity: B.ERROR,
5956
6005
  rule: "link-backlink-missing",
5957
6006
  message: `Backlink "${u.backlink}" not found on target doctype "${u.target}"`,
5958
6007
  doctype: t,
@@ -5965,7 +6014,7 @@ class es {
5965
6014
  if (f) {
5966
6015
  const h = "options" in f ? f.options : void 0, l = typeof h == "string" ? h : void 0;
5967
6016
  l && l !== u.target && o.push({
5968
- severity: F.ERROR,
6017
+ severity: B.ERROR,
5969
6018
  rule: "link-field-target-mismatch",
5970
6019
  message: `Link field "${u.fieldname}" targets "${l}" but link declaration targets "${u.target}"`,
5971
6020
  doctype: t,
@@ -5977,7 +6026,7 @@ class es {
5977
6026
  }
5978
6027
  for (const [a, u] of s)
5979
6028
  Object.values(r).some((f) => f.fieldname === a) || o.push({
5980
- severity: F.ERROR,
6029
+ severity: B.ERROR,
5981
6030
  rule: "link-field-without-declaration",
5982
6031
  message: `Link field "${a}" has no corresponding link declaration`,
5983
6032
  doctype: t,
@@ -5992,19 +6041,19 @@ class es {
5992
6041
  validateWorkflow(t, r) {
5993
6042
  const n = [];
5994
6043
  if (!r.initial && !r.type && n.push({
5995
- severity: F.WARNING,
6044
+ severity: B.WARNING,
5996
6045
  rule: "workflow-missing-initial",
5997
6046
  message: "Workflow is missing initial state property",
5998
6047
  doctype: t
5999
6048
  }), !r.states || Object.keys(r.states).length === 0)
6000
6049
  return n.push({
6001
- severity: F.WARNING,
6050
+ severity: B.WARNING,
6002
6051
  rule: "workflow-no-states",
6003
6052
  message: "Workflow has no states defined",
6004
6053
  doctype: t
6005
6054
  }), n;
6006
6055
  r.initial && typeof r.initial == "string" && !r.states[r.initial] && n.push({
6007
- severity: F.ERROR,
6056
+ severity: B.ERROR,
6008
6057
  rule: "workflow-invalid-initial",
6009
6058
  message: `Workflow initial state "${r.initial}" does not exist in states`,
6010
6059
  doctype: t,
@@ -6028,7 +6077,7 @@ class es {
6028
6077
  }
6029
6078
  for (const s of i)
6030
6079
  o.has(s) || n.push({
6031
- severity: F.WARNING,
6080
+ severity: B.WARNING,
6032
6081
  rule: "workflow-unreachable-state",
6033
6082
  message: `Workflow state "${s}" may not be reachable`,
6034
6083
  doctype: t,
@@ -6045,7 +6094,7 @@ class es {
6045
6094
  for (const [o, s] of Object.entries(r)) {
6046
6095
  if (!Array.isArray(s)) {
6047
6096
  n.push({
6048
- severity: F.ERROR,
6097
+ severity: B.ERROR,
6049
6098
  rule: "action-invalid-format",
6050
6099
  message: `Action configuration for "${o}" must be an array`,
6051
6100
  doctype: t,
@@ -6056,7 +6105,7 @@ class es {
6056
6105
  for (const a of s) {
6057
6106
  const u = i;
6058
6107
  u.globalActions?.has(a) || u.globalTransitionActions?.has(a) || n.push({
6059
- severity: F.WARNING,
6108
+ severity: B.WARNING,
6060
6109
  rule: "action-not-registered",
6061
6110
  message: `Action "${a}" referenced in "${o}" is not registered in FieldTriggerEngine`,
6062
6111
  doctype: t,
@@ -6083,7 +6132,7 @@ export {
6083
6132
  me as Registry,
6084
6133
  es as SchemaValidator,
6085
6134
  At as Stonecrop,
6086
- F as ValidationSeverity,
6135
+ B as ValidationSeverity,
6087
6136
  ro as createHST,
6088
6137
  rs as createValidator,
6089
6138
  gs as default,