@declarion/react 0.43.0 → 0.45.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.
@@ -1,6 +1,6 @@
1
1
  import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as n, An as r, At as i, B as a, C as o, Cn as s, E as c, En as l, Gn as u, Gt as d, I as f, In as p, Jn as m, K as h, L as g, Ln as _, Mn as v, O as y, P as b, R as x, St as S, T as C, Tt as w, U as T, V as E, W as D, X as O, Xn as k, Zn as A, _ as j, _t as M, ar as N, b as P, bn as F, bt as I, cr as L, d as R, g as z, gt as ee, i as te, j as B, kt as ne, lr as V, mn as re, nr as ie, ot as ae, pt as oe, rt as H, sr as se, st as ce, u as le, v as ue, vt as de, wn as U, wt as fe, xn as pe, yn as me, yt as he, z as ge } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-fUHxMV4r.js";
2
+ import { A as n, At as r, B as i, C as a, Dn as o, E as s, Gt as c, I as l, K as u, Kn as d, L as f, Ln as p, Nn as m, O as h, P as g, Qn as _, R as v, Rn as y, Sn as b, St as x, T as S, Tn as C, Tt as w, U as T, V as E, W as D, X as O, Yn as k, Zn as A, _ as j, _t as M, b as N, bn as P, bt as F, cr as I, d as L, g as ee, gt as R, i as te, j as z, jn as ne, kt as re, lr as B, mn as ie, or as V, ot as ae, pt as oe, rr as se, rt as H, st as ce, u as le, ur as U, v as ue, vt as de, wn as fe, wt as pe, xn as me, yt as he, z as ge } from "./useCurrentScreen-A3xZDs7U.js";
3
+ import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-CHY7LgZ-.js";
4
4
  import { n as Ae, r as je, t as Me } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Component as Ne, Suspense as Pe, lazy as Fe, useCallback as W, useEffect as G, useId as Ie, useLayoutEffect as Le, useMemo as K, useRef as q, useState as J } from "react";
6
6
  import { parsePath as Re, useNavigate as ze } from "react-router";
@@ -119,14 +119,14 @@ function Je({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
119
119
  ]
120
120
  })
121
121
  }),
122
- i && /* @__PURE__ */ X(se, {
122
+ i && /* @__PURE__ */ X(I, {
123
123
  tone: i.tone ?? "violet",
124
124
  size: "xs",
125
125
  dot: i.dot,
126
126
  children: i.text
127
127
  }),
128
128
  r,
129
- c && /* @__PURE__ */ X(L, {
129
+ c && /* @__PURE__ */ X(B, {
130
130
  size: 24,
131
131
  icon: X(m ? e.up : e.down, { size: 14 }),
132
132
  onClick: () => h((e) => !e),
@@ -579,11 +579,11 @@ function zt(e) {
579
579
  if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
580
580
  }
581
581
  function Bt() {
582
- let e = ze(), { data: t } = i(), n = oe(), r = ce();
583
- return W((i, a) => {
584
- let { pathname: o, search: s, hash: c } = Rt(i, a?.search);
582
+ let e = ze(), { data: t } = r(), n = oe(), i = ce();
583
+ return W((r, a) => {
584
+ let { pathname: o, search: s, hash: c } = Rt(r, a?.search);
585
585
  if (n.enabled) {
586
- r(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
586
+ i(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
587
587
  return;
588
588
  }
589
589
  let l = kt.getState(), u = a?.topLevel ?? !1, d = Nt(s), f = u || typeof window > "u" ? void 0 : Ft({
@@ -614,12 +614,12 @@ function Bt() {
614
614
  }, { replace: a?.replace });
615
615
  return;
616
616
  }
617
- let m = a?.title ? void 0 : v(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
617
+ let h = a?.title ? void 0 : m(o, t?.screens, t?.entities), g = a?.title ?? h?.title ?? o, _ = a?.icon ?? h?.icon;
618
618
  l.openTab({
619
619
  pathname: o,
620
620
  search: d,
621
- title: h,
622
- icon: g,
621
+ title: g,
622
+ icon: _,
623
623
  closable: !0,
624
624
  returnTo: u ? null : f
625
625
  }), e({
@@ -632,7 +632,7 @@ function Bt() {
632
632
  t?.screens,
633
633
  t?.entities,
634
634
  n.enabled,
635
- r
635
+ i
636
636
  ]);
637
637
  }
638
638
  //#endregion
@@ -669,19 +669,19 @@ function Xt(e) {
669
669
  return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
670
670
  }
671
671
  function Zt(e) {
672
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, p = Ce(r), [m, h] = J("idle"), [_, v] = J(null), [y, x] = J(null), [S, C] = J(null), [w, T] = J(!1), E = q(null), D = q(!1), O = q(null), { register: k, unregister: A, isDraft: j } = b();
672
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, alt: s, disabled: c, visual: u, uploadFieldCode: d, uploadSlotCode: p } = e, m = Ce(r), [h, _] = J("idle"), [v, y] = J(null), [b, x] = J(null), [S, C] = J(null), [w, T] = J(!1), E = q(null), D = q(!1), O = q(null), { register: k, unregister: A, isDraft: j } = g();
673
673
  G(() => () => {
674
674
  E.current && E.current.abort();
675
675
  }, []);
676
- let M = K(() => be(p, s, t.display?.placeholder || n), [
676
+ let M = K(() => be(m, s, t.display?.placeholder || n), [
677
677
  s,
678
678
  t.display?.placeholder,
679
679
  n,
680
- p
680
+ m
681
681
  ]), N = (t.accepts ?? ["image/*"]).join(","), P = W(async (r) => {
682
- let o = a(r, t.accepts, t.max_size_bytes);
682
+ let o = i(r, t.accepts, t.max_size_bytes);
683
683
  if (o) {
684
- x(o), h("error");
684
+ x(o), _("error");
685
685
  return;
686
686
  }
687
687
  let s = r;
@@ -695,10 +695,10 @@ function Zt(e) {
695
695
  x({
696
696
  code: "CROP_FAILED",
697
697
  message: e instanceof Error ? e.message : "Crop failed"
698
- }), h("error");
698
+ }), _("error");
699
699
  return;
700
700
  }
701
- x(null), D.current = !1, h("uploading"), v({
701
+ x(null), D.current = !1, _("uploading"), y({
702
702
  loaded: 0,
703
703
  total: s.size,
704
704
  pct: 0
@@ -709,17 +709,17 @@ function Zt(e) {
709
709
  let r = await ge({
710
710
  file: s,
711
711
  entityCode: e.entityCode,
712
- fieldCode: u ?? n,
713
- slotCode: d,
712
+ fieldCode: d ?? n,
713
+ slotCode: p,
714
714
  signal: c.signal,
715
- onProgress: v
715
+ onProgress: y
716
716
  });
717
717
  if (D.current) {
718
- g(r.id).catch(() => {}), A(r.id);
718
+ f(r.id).catch(() => {}), A(r.id);
719
719
  return;
720
720
  }
721
- p && j(p.id) && (g(p.id).catch(() => {}), A(p.id)), k(r.id, () => g(r.id)), C(r.id), h("idle"), v(null);
722
- let a = {
721
+ m && j(m.id) && (f(m.id).catch(() => {}), A(m.id)), k(r.id, () => f(r.id)), C(r.id), _("idle"), y(null);
722
+ let i = {
723
723
  id: r.id,
724
724
  filename: r.filename,
725
725
  content_type: r.content_type,
@@ -730,17 +730,17 @@ function Zt(e) {
730
730
  url: r.url,
731
731
  metadata: r.metadata
732
732
  };
733
- i?.(t.mode === "array" ? [a] : a);
733
+ a?.(t.mode === "array" ? [i] : i);
734
734
  } catch (e) {
735
- if (e instanceof f && e.code === "ABORTED") return;
736
- let t = e instanceof f ? {
735
+ if (e instanceof l && e.code === "ABORTED") return;
736
+ let t = e instanceof l ? {
737
737
  code: e.code,
738
738
  message: e.message
739
739
  } : {
740
740
  code: "UNKNOWN",
741
741
  message: e instanceof Error ? e.message : "Upload failed"
742
742
  };
743
- x(t), h("error"), v(null);
743
+ x(t), _("error"), y(null);
744
744
  }
745
745
  }, [
746
746
  t.accepts,
@@ -749,119 +749,119 @@ function Zt(e) {
749
749
  t.display?.aspect_ratio,
750
750
  t.mode,
751
751
  n,
752
- i,
752
+ a,
753
753
  e.entityCode,
754
754
  k,
755
755
  j,
756
- p,
756
+ m,
757
757
  A,
758
- u,
759
- d
758
+ d,
759
+ p
760
760
  ]), F = W(() => {
761
- m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), v(null)), S && (g(S).catch(() => {}), A(S), C(null));
761
+ h === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, _("idle"), y(null)), S && (f(S).catch(() => {}), A(S), C(null));
762
762
  }, [
763
- m,
763
+ h,
764
764
  S,
765
765
  A
766
766
  ]), I = W(() => {
767
- p && j(p.id) && (g(p.id).catch(() => {}), A(p.id), C(null)), i?.(t.mode === "array" ? [] : null);
767
+ m && j(m.id) && (f(m.id).catch(() => {}), A(m.id), C(null)), a?.(t.mode === "array" ? [] : null);
768
768
  }, [
769
- p,
769
+ m,
770
770
  t.mode,
771
771
  j,
772
- i,
772
+ a,
773
773
  A
774
774
  ]), L = W(() => {
775
- x(null), h("idle"), O.current?.click();
776
- }, []), R = W(() => {
775
+ x(null), _("idle"), O.current?.click();
776
+ }, []), ee = W(() => {
777
777
  c || O.current?.click();
778
- }, [c]), z = W((e) => {
779
- c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
780
- }, [c, R]), ee = W((e) => {
778
+ }, [c]), R = W((e) => {
779
+ c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ee());
780
+ }, [c, ee]), te = W((e) => {
781
781
  c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
782
- }, [c]), te = W((e) => {
782
+ }, [c]), z = W((e) => {
783
783
  if (c) return;
784
784
  e.preventDefault();
785
785
  let t = e.dataTransfer.files?.[0];
786
786
  t && P(t);
787
- }, [c, P]), B = W((e) => {
787
+ }, [c, P]), ne = W((e) => {
788
788
  let t = e.target.files?.[0];
789
789
  e.target.value = "", t && P(t);
790
- }, [P]), ne = l.aspectRatio ?? en(l.shape, t.display?.aspect_ratio), V = ye(p), re = {
791
- aspectRatio: ne,
792
- width: l.width ?? (l.shape === "wide" ? "100%" : "120px")
793
- }, ie = !!p, ae = Yt(p, t.display?.listable_thumbnail), oe = Se(p, t.display?.listable_thumbnail), H = xe(p?.id, oe, ae), se = o === "display", ce = W((e) => {
790
+ }, [P]), re = u.aspectRatio ?? en(u.shape, t.display?.aspect_ratio), B = ye(m), ie = {
791
+ aspectRatio: re,
792
+ width: u.width ?? (u.shape === "wide" ? "100%" : "120px")
793
+ }, V = !!m, ae = Yt(m, t.display?.listable_thumbnail), oe = Se(m, t.display?.listable_thumbnail), se = xe(m?.id, oe, ae), H = o === "display", ce = W((e) => {
794
794
  e.stopPropagation(), T((e) => !e);
795
795
  }, []), le = W((e) => {
796
- if (!p || !w) return;
797
- let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, a = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = Te(p, {
796
+ if (!m || !w) return;
797
+ let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, i = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = Te(m, {
798
798
  x: Math.max(0, Math.min(1, r)),
799
- y: Math.max(0, Math.min(1, a))
799
+ y: Math.max(0, Math.min(1, i))
800
800
  });
801
- i?.(t.mode === "array" ? [o] : o), T(!1);
801
+ a?.(t.mode === "array" ? [o] : o), T(!1);
802
802
  }, [
803
803
  t.mode,
804
- p,
804
+ m,
805
805
  w,
806
- i
806
+ a
807
807
  ]);
808
- return se ? /* @__PURE__ */ X("div", {
809
- className: Qt(l.shape, !1),
810
- style: re,
808
+ return H ? /* @__PURE__ */ X("div", {
809
+ className: Qt(u.shape, !1),
810
+ style: ie,
811
811
  "aria-label": M,
812
- children: ie && H ? /* @__PURE__ */ X("img", {
813
- src: H,
812
+ children: V && se ? /* @__PURE__ */ X("img", {
813
+ src: se,
814
814
  alt: M,
815
- className: $t(l.shape),
816
- style: { objectPosition: De(V) },
815
+ className: $t(u.shape),
816
+ style: { objectPosition: De(B) },
817
817
  loading: "lazy"
818
818
  }) : /* @__PURE__ */ X(nn, {
819
- shape: l.shape,
819
+ shape: u.shape,
820
820
  label: M,
821
821
  placeholder: t.display?.placeholder
822
822
  })
823
823
  }) : /* @__PURE__ */ Z("div", {
824
- className: Qt(l.shape, !c),
825
- style: re,
824
+ className: Qt(u.shape, !c),
825
+ style: ie,
826
826
  tabIndex: c ? -1 : 0,
827
827
  role: "button",
828
828
  "aria-label": M,
829
829
  "aria-disabled": c || void 0,
830
- "aria-busy": m === "uploading" || void 0,
831
- "aria-invalid": m === "error" || void 0,
832
- onClick: m === "idle" && !ie ? R : void 0,
830
+ "aria-busy": h === "uploading" || void 0,
831
+ "aria-invalid": h === "error" || void 0,
832
+ onClick: h === "idle" && !V ? ee : void 0,
833
833
  onMouseDown: w ? le : void 0,
834
- onKeyDown: z,
835
- onDragOver: ee,
836
- onDrop: te,
834
+ onKeyDown: R,
835
+ onDragOver: te,
836
+ onDrop: z,
837
837
  "data-testid": w ? "focal-point-target" : `file-widget-${n}`,
838
838
  children: [
839
839
  /* @__PURE__ */ X("input", {
840
840
  ref: O,
841
841
  type: "file",
842
842
  accept: N,
843
- onChange: B,
843
+ onChange: ne,
844
844
  style: { display: "none" },
845
845
  "data-testid": `file-input-${n}`
846
846
  }),
847
- ie && H ? /* @__PURE__ */ X("img", {
848
- src: H,
847
+ V && se ? /* @__PURE__ */ X("img", {
848
+ src: se,
849
849
  alt: M,
850
- className: $t(l.shape),
851
- style: { objectPosition: De(V) },
850
+ className: $t(u.shape),
851
+ style: { objectPosition: De(B) },
852
852
  loading: "lazy"
853
- }) : m === "uploading" ? null : /* @__PURE__ */ X(nn, {
854
- shape: l.shape,
853
+ }) : h === "uploading" ? null : /* @__PURE__ */ X(nn, {
854
+ shape: u.shape,
855
855
  label: M,
856
856
  placeholder: t.display?.placeholder
857
857
  }),
858
- m === "uploading" && /* @__PURE__ */ X(rn, { pct: _?.pct ?? 0 }),
858
+ h === "uploading" && /* @__PURE__ */ X(rn, { pct: v?.pct ?? 0 }),
859
859
  S && /* @__PURE__ */ X("span", {
860
860
  className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
861
861
  "aria-hidden": "true",
862
862
  "data-testid": "draft-indicator"
863
863
  }),
864
- ie && m === "idle" && !c && /* @__PURE__ */ Z("div", {
864
+ V && h === "idle" && !c && /* @__PURE__ */ Z("div", {
865
865
  className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
866
866
  children: [
867
867
  t.display?.focal_point && /* @__PURE__ */ X("button", {
@@ -875,7 +875,7 @@ function Zt(e) {
875
875
  type: "button",
876
876
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
877
877
  onClick: (e) => {
878
- e.stopPropagation(), R();
878
+ e.stopPropagation(), ee();
879
879
  },
880
880
  children: "Change"
881
881
  }),
@@ -889,15 +889,15 @@ function Zt(e) {
889
889
  })
890
890
  ]
891
891
  }),
892
- V && ie && /* @__PURE__ */ X("span", {
892
+ B && V && /* @__PURE__ */ X("span", {
893
893
  className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
894
894
  style: {
895
- left: `${V.x * 100}%`,
896
- top: `${V.y * 100}%`
895
+ left: `${B.x * 100}%`,
896
+ top: `${B.y * 100}%`
897
897
  },
898
898
  "data-testid": "focal-point-marker"
899
899
  }),
900
- m === "uploading" && /* @__PURE__ */ X("button", {
900
+ h === "uploading" && /* @__PURE__ */ X("button", {
901
901
  type: "button",
902
902
  className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
903
903
  onClick: (e) => {
@@ -906,13 +906,13 @@ function Zt(e) {
906
906
  "data-testid": "cancel-upload",
907
907
  children: "Cancel"
908
908
  }),
909
- m === "error" && y && /* @__PURE__ */ Z("div", {
909
+ h === "error" && b && /* @__PURE__ */ Z("div", {
910
910
  className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
911
911
  role: "alert",
912
912
  children: [/* @__PURE__ */ X("span", {
913
913
  className: "truncate",
914
- title: y.message,
915
- children: y.message
914
+ title: b.message,
915
+ children: b.message
916
916
  }), /* @__PURE__ */ X("button", {
917
917
  type: "button",
918
918
  className: "underline",
@@ -1029,7 +1029,7 @@ function sn(e) {
1029
1029
  }
1030
1030
  //#endregion
1031
1031
  //#region src/components/file-widgets/GridLazy.tsx
1032
- var cn = Fe(() => import("./Grid-CXn-IK3H.js").then((e) => ({ default: e.Grid })));
1032
+ var cn = Fe(() => import("./Grid-CcCveEE7.js").then((e) => ({ default: e.Grid })));
1033
1033
  function ln() {
1034
1034
  return /* @__PURE__ */ X("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
1035
1035
  }
@@ -1048,19 +1048,19 @@ function dn({ contentType: e }) {
1048
1048
  });
1049
1049
  }
1050
1050
  function fn(e) {
1051
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = Ce(r), [d, p] = J("idle"), [m, h] = J(null), [_, v] = J(null), [y, S] = J(!1), [C, w] = J(u?.filename ?? ""), T = q(null), E = q(!1), D = q(null), { register: O, unregister: k, isDraft: A } = b(), { open: j } = Ee();
1051
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: u } = e, d = Ce(r), [p, m] = J("idle"), [h, _] = J(null), [y, b] = J(null), [x, S] = J(!1), [C, w] = J(d?.filename ?? ""), T = q(null), E = q(!1), D = q(null), { register: O, unregister: k, isDraft: A } = g(), { open: j } = Ee();
1052
1052
  G(() => () => {
1053
1053
  T.current && T.current.abort();
1054
1054
  }, []), G(() => {
1055
- w(u?.filename ?? "");
1056
- }, [u?.filename]);
1055
+ w(d?.filename ?? "");
1056
+ }, [d?.filename]);
1057
1057
  let M = (t.accepts ?? []).join(","), N = W(async (r) => {
1058
- let o = a(r, t.accepts, t.max_size_bytes);
1058
+ let o = i(r, t.accepts, t.max_size_bytes);
1059
1059
  if (o) {
1060
- v(o), p("error");
1060
+ b(o), m("error");
1061
1061
  return;
1062
1062
  }
1063
- v(null), E.current = !1, p("uploading"), h({
1063
+ b(null), E.current = !1, m("uploading"), _({
1064
1064
  loaded: 0,
1065
1065
  total: r.size,
1066
1066
  pct: 0
@@ -1068,96 +1068,96 @@ function fn(e) {
1068
1068
  let s = new AbortController();
1069
1069
  T.current = s;
1070
1070
  try {
1071
- let a = await ge({
1071
+ let i = await ge({
1072
1072
  file: r,
1073
1073
  entityCode: e.entityCode,
1074
1074
  fieldCode: c ?? n,
1075
- slotCode: l,
1075
+ slotCode: u,
1076
1076
  signal: s.signal,
1077
- onProgress: h
1077
+ onProgress: _
1078
1078
  });
1079
1079
  if (E.current) {
1080
- g(a.id).catch(() => {}), k(a.id);
1080
+ f(i.id).catch(() => {}), k(i.id);
1081
1081
  return;
1082
1082
  }
1083
- u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), O(a.id, () => g(a.id)), p("idle"), h(null);
1083
+ d && A(d.id) && (f(d.id).catch(() => {}), k(d.id)), O(i.id, () => f(i.id)), m("idle"), _(null);
1084
1084
  let o = {
1085
- id: a.id,
1086
- filename: a.filename,
1087
- content_type: a.content_type,
1088
- size_bytes: a.size_bytes,
1089
- sha256: a.sha256,
1090
- width: a.width,
1091
- height: a.height,
1092
- url: a.url,
1093
- metadata: a.metadata
1085
+ id: i.id,
1086
+ filename: i.filename,
1087
+ content_type: i.content_type,
1088
+ size_bytes: i.size_bytes,
1089
+ sha256: i.sha256,
1090
+ width: i.width,
1091
+ height: i.height,
1092
+ url: i.url,
1093
+ metadata: i.metadata
1094
1094
  };
1095
- i?.(t.mode === "array" ? [o] : o);
1095
+ a?.(t.mode === "array" ? [o] : o);
1096
1096
  } catch (e) {
1097
- if (e instanceof f && e.code === "ABORTED") return;
1098
- let t = e instanceof f ? {
1097
+ if (e instanceof l && e.code === "ABORTED") return;
1098
+ let t = e instanceof l ? {
1099
1099
  code: e.code,
1100
1100
  message: e.message
1101
1101
  } : {
1102
1102
  code: "UNKNOWN",
1103
1103
  message: e instanceof Error ? e.message : "Upload failed"
1104
1104
  };
1105
- v(t), p("error"), h(null);
1105
+ b(t), m("error"), _(null);
1106
1106
  }
1107
1107
  }, [
1108
1108
  t.accepts,
1109
1109
  t.max_size_bytes,
1110
1110
  t.mode,
1111
1111
  n,
1112
- u,
1112
+ d,
1113
1113
  A,
1114
- i,
1114
+ a,
1115
1115
  e.entityCode,
1116
1116
  O,
1117
1117
  k,
1118
1118
  c,
1119
- l
1119
+ u
1120
1120
  ]), P = W(() => {
1121
1121
  s || D.current?.click();
1122
1122
  }, [s]), F = W((e) => {
1123
1123
  let t = e.target.files?.[0];
1124
1124
  e.target.value = "", t && N(t);
1125
1125
  }, [N]), I = W(() => {
1126
- u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), i?.(t.mode === "array" ? [] : null);
1126
+ d && A(d.id) && (f(d.id).catch(() => {}), k(d.id)), a?.(t.mode === "array" ? [] : null);
1127
1127
  }, [
1128
- u,
1128
+ d,
1129
1129
  t.mode,
1130
1130
  A,
1131
- i,
1131
+ a,
1132
1132
  k
1133
1133
  ]), L = W(() => {
1134
- d === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, p("idle"), h(null));
1135
- }, [d]), R = W(() => {
1136
- u && j(u.id, "download", we(u));
1137
- }, [u, j]), z = u ? _e(u) : !1, ee = W(() => {
1138
- !u || !_e(u) || j(u.id, "preview", ke(u));
1139
- }, [u, j]), te = W(() => {
1140
- if (!u) {
1134
+ p === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, m("idle"), _(null));
1135
+ }, [p]), ee = W(() => {
1136
+ d && j(d.id, "download", we(d));
1137
+ }, [d, j]), R = d ? _e(d) : !1, te = W(() => {
1138
+ !d || !_e(d) || j(d.id, "preview", ke(d));
1139
+ }, [d, j]), z = W(() => {
1140
+ if (!d) {
1141
1141
  S(!1);
1142
1142
  return;
1143
1143
  }
1144
1144
  let e = C.trim();
1145
- if (S(!1), !e || e === u.filename) {
1146
- w(u.filename);
1145
+ if (S(!1), !e || e === d.filename) {
1146
+ w(d.filename);
1147
1147
  return;
1148
1148
  }
1149
1149
  let n = {
1150
- ...u,
1150
+ ...d,
1151
1151
  filename: e
1152
1152
  };
1153
- i?.(t.mode === "array" ? [n] : n);
1153
+ a?.(t.mode === "array" ? [n] : n);
1154
1154
  }, [
1155
1155
  C,
1156
- u,
1157
- i,
1156
+ d,
1157
+ a,
1158
1158
  t.mode
1159
- ]), B = o === "display";
1160
- return !u && d !== "uploading" ? /* @__PURE__ */ Z("div", {
1159
+ ]), ne = o === "display";
1160
+ return !d && p !== "uploading" ? /* @__PURE__ */ Z("div", {
1161
1161
  "data-testid": `file-widget-${n}`,
1162
1162
  className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
1163
1163
  children: [
@@ -1167,7 +1167,7 @@ function fn(e) {
1167
1167
  children: [/* @__PURE__ */ X("span", {
1168
1168
  className: "text-sm text-foreground",
1169
1169
  children: t.display?.placeholder || "No document attached"
1170
- }), !B && /* @__PURE__ */ X("button", {
1170
+ }), !ne && /* @__PURE__ */ X("button", {
1171
1171
  type: "button",
1172
1172
  className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1173
1173
  onClick: P,
@@ -1176,7 +1176,7 @@ function fn(e) {
1176
1176
  children: "Upload"
1177
1177
  })]
1178
1178
  }),
1179
- !B && /* @__PURE__ */ X("input", {
1179
+ !ne && /* @__PURE__ */ X("input", {
1180
1180
  ref: D,
1181
1181
  type: "file",
1182
1182
  accept: M || void 0,
@@ -1184,95 +1184,95 @@ function fn(e) {
1184
1184
  style: { display: "none" },
1185
1185
  "data-testid": `file-input-${n}`
1186
1186
  }),
1187
- d === "error" && _ && /* @__PURE__ */ X("div", {
1187
+ p === "error" && y && /* @__PURE__ */ X("div", {
1188
1188
  className: "ml-auto text-xs text-destructive",
1189
1189
  role: "alert",
1190
- children: _.message
1190
+ children: y.message
1191
1191
  })
1192
1192
  ]
1193
1193
  }) : /* @__PURE__ */ Z("div", {
1194
1194
  "data-testid": `file-widget-${n}`,
1195
1195
  className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
1196
- "aria-busy": d === "uploading" || void 0,
1197
- "aria-invalid": d === "error" || void 0,
1196
+ "aria-busy": p === "uploading" || void 0,
1197
+ "aria-invalid": p === "error" || void 0,
1198
1198
  children: [
1199
- /* @__PURE__ */ X(dn, { contentType: u?.content_type }),
1199
+ /* @__PURE__ */ X(dn, { contentType: d?.content_type }),
1200
1200
  /* @__PURE__ */ Z("div", {
1201
1201
  className: "flex min-w-0 flex-1 flex-col gap-1",
1202
1202
  children: [
1203
- y && u ? /* @__PURE__ */ X("input", {
1203
+ x && d ? /* @__PURE__ */ X("input", {
1204
1204
  type: "text",
1205
1205
  className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
1206
1206
  value: C,
1207
1207
  autoFocus: !0,
1208
1208
  onChange: (e) => w(e.target.value),
1209
- onBlur: te,
1209
+ onBlur: z,
1210
1210
  onKeyDown: (e) => {
1211
- e.key === "Enter" ? te() : e.key === "Escape" && (S(!1), w(u.filename));
1211
+ e.key === "Enter" ? z() : e.key === "Escape" && (S(!1), w(d.filename));
1212
1212
  },
1213
1213
  "data-testid": "filename-input"
1214
1214
  }) : /* @__PURE__ */ X("button", {
1215
1215
  type: "button",
1216
1216
  className: "truncate text-left text-sm font-medium text-foreground hover:underline",
1217
- onClick: () => !B && u && S(!0),
1218
- disabled: B || s || !u,
1219
- title: u?.filename,
1217
+ onClick: () => !ne && d && S(!0),
1218
+ disabled: ne || s || !d,
1219
+ title: d?.filename,
1220
1220
  "data-testid": "filename",
1221
- children: u?.filename ?? "Uploading…"
1221
+ children: d?.filename ?? "Uploading…"
1222
1222
  }),
1223
1223
  /* @__PURE__ */ Z("div", {
1224
1224
  className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
1225
1225
  children: [
1226
- u && /* @__PURE__ */ X("span", { children: x(u.size_bytes) }),
1227
- u?.page_count != null && /* @__PURE__ */ Z("span", { children: [u.page_count, " pages"] }),
1228
- u?.uploaded_at && /* @__PURE__ */ X("span", { children: pn(u.uploaded_at) }),
1229
- u?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", u.uploaded_by] }),
1230
- u?.version?.number != null && /* @__PURE__ */ Z("span", {
1226
+ d && /* @__PURE__ */ X("span", { children: v(d.size_bytes) }),
1227
+ d?.page_count != null && /* @__PURE__ */ Z("span", { children: [d.page_count, " pages"] }),
1228
+ d?.uploaded_at && /* @__PURE__ */ X("span", { children: pn(d.uploaded_at) }),
1229
+ d?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", d.uploaded_by] }),
1230
+ d?.version?.number != null && /* @__PURE__ */ Z("span", {
1231
1231
  "data-testid": "version-badge",
1232
- children: ["v", u.version.number]
1232
+ children: ["v", d.version.number]
1233
1233
  })
1234
1234
  ]
1235
1235
  }),
1236
- d === "uploading" && /* @__PURE__ */ Z("div", {
1236
+ p === "uploading" && /* @__PURE__ */ Z("div", {
1237
1237
  className: "text-xs text-muted-foreground",
1238
1238
  role: "progressbar",
1239
- "aria-valuenow": m?.pct ?? 0,
1239
+ "aria-valuenow": h?.pct ?? 0,
1240
1240
  "aria-valuemin": 0,
1241
1241
  "aria-valuemax": 100,
1242
1242
  "data-testid": "upload-progress",
1243
1243
  children: [
1244
1244
  "Uploading ",
1245
- m?.pct ?? 0,
1245
+ h?.pct ?? 0,
1246
1246
  "%"
1247
1247
  ]
1248
1248
  }),
1249
- d === "error" && _ && /* @__PURE__ */ X("div", {
1249
+ p === "error" && y && /* @__PURE__ */ X("div", {
1250
1250
  className: "text-xs text-destructive",
1251
1251
  role: "alert",
1252
- children: _.message
1252
+ children: y.message
1253
1253
  })
1254
1254
  ]
1255
1255
  }),
1256
1256
  /* @__PURE__ */ Z("div", {
1257
1257
  className: "flex flex-none items-center gap-1",
1258
- children: [u && d !== "uploading" && /* @__PURE__ */ Z(Y, { children: [
1258
+ children: [d && p !== "uploading" && /* @__PURE__ */ Z(Y, { children: [
1259
1259
  /* @__PURE__ */ X("button", {
1260
1260
  type: "button",
1261
1261
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1262
- onClick: R,
1262
+ onClick: ee,
1263
1263
  "data-testid": "download",
1264
1264
  children: "Download"
1265
1265
  }),
1266
1266
  /* @__PURE__ */ X("button", {
1267
1267
  type: "button",
1268
1268
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
1269
- onClick: ee,
1270
- disabled: !z,
1271
- title: z ? void 0 : "Preview is available only for images and PDFs",
1269
+ onClick: te,
1270
+ disabled: !R,
1271
+ title: R ? void 0 : "Preview is available only for images and PDFs",
1272
1272
  "data-testid": "preview",
1273
1273
  children: "Preview"
1274
1274
  }),
1275
- !B && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("button", {
1275
+ !ne && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("button", {
1276
1276
  type: "button",
1277
1277
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
1278
1278
  onClick: P,
@@ -1287,7 +1287,7 @@ function fn(e) {
1287
1287
  "data-testid": "remove",
1288
1288
  children: "Remove"
1289
1289
  })] })
1290
- ] }), d === "uploading" && /* @__PURE__ */ X("button", {
1290
+ ] }), p === "uploading" && /* @__PURE__ */ X("button", {
1291
1291
  type: "button",
1292
1292
  className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
1293
1293
  onClick: L,
@@ -1295,7 +1295,7 @@ function fn(e) {
1295
1295
  children: "Cancel"
1296
1296
  })]
1297
1297
  }),
1298
- !B && /* @__PURE__ */ X("input", {
1298
+ !ne && /* @__PURE__ */ X("input", {
1299
1299
  ref: D,
1300
1300
  type: "file",
1301
1301
  accept: M || void 0,
@@ -1316,18 +1316,18 @@ function mn(e) {
1316
1316
  return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
1317
1317
  }
1318
1318
  function hn(e) {
1319
- let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s } = e, c = Oe(r), [l, u] = J([]), { register: d, unregister: p, isDraft: m } = b(), h = q(c);
1320
- h.current = c;
1321
- let _ = q(null), v = q(/* @__PURE__ */ new Set()), y = q([]);
1322
- y.current = l;
1319
+ let { field: t, fieldName: n, value: r, onChange: a, mode: o, disabled: s } = e, c = Oe(r), [u, d] = J([]), { register: p, unregister: m, isDraft: h } = g(), _ = q(c);
1320
+ _.current = c;
1321
+ let y = q(null), b = q(/* @__PURE__ */ new Set()), x = q([]);
1322
+ x.current = u;
1323
1323
  let { open: S } = Ee();
1324
1324
  G(() => () => {
1325
- y.current.forEach((e) => e.abort());
1325
+ x.current.forEach((e) => e.abort());
1326
1326
  }, []);
1327
1327
  let C = (t.accepts ?? []).join(","), w = o === "display", T = W(async (r) => {
1328
- let o = a(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1328
+ let o = i(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
1329
1329
  if (o) {
1330
- u((e) => [...e, {
1330
+ d((e) => [...e, {
1331
1331
  localId: s,
1332
1332
  filename: r.name,
1333
1333
  progress: null,
@@ -1336,7 +1336,7 @@ function hn(e) {
1336
1336
  }]);
1337
1337
  return;
1338
1338
  }
1339
- u((e) => [...e, {
1339
+ d((e) => [...e, {
1340
1340
  localId: s,
1341
1341
  filename: r.name,
1342
1342
  progress: {
@@ -1353,17 +1353,17 @@ function hn(e) {
1353
1353
  entityCode: e.entityCode,
1354
1354
  fieldCode: n,
1355
1355
  signal: c.signal,
1356
- onProgress: (e) => u((t) => t.map((t) => t.localId === s ? {
1356
+ onProgress: (e) => d((t) => t.map((t) => t.localId === s ? {
1357
1357
  ...t,
1358
1358
  progress: e
1359
1359
  } : t))
1360
1360
  });
1361
- if (v.current.delete(s)) {
1362
- g(t.id).catch(() => {}), p(t.id);
1361
+ if (b.current.delete(s)) {
1362
+ f(t.id).catch(() => {}), m(t.id);
1363
1363
  return;
1364
1364
  }
1365
- d(t.id, () => g(t.id));
1366
- let a = {
1365
+ p(t.id, () => f(t.id));
1366
+ let i = {
1367
1367
  id: t.id,
1368
1368
  filename: t.filename,
1369
1369
  content_type: t.content_type,
@@ -1373,21 +1373,21 @@ function hn(e) {
1373
1373
  height: t.height,
1374
1374
  url: t.url,
1375
1375
  metadata: t.metadata
1376
- }, o = [...h.current, a];
1377
- h.current = o, i?.(o), u((e) => e.filter((e) => e.localId !== s));
1376
+ }, o = [..._.current, i];
1377
+ _.current = o, a?.(o), d((e) => e.filter((e) => e.localId !== s));
1378
1378
  } catch (e) {
1379
- if (e instanceof f && e.code === "ABORTED") {
1380
- u((e) => e.filter((e) => e.localId !== s));
1379
+ if (e instanceof l && e.code === "ABORTED") {
1380
+ d((e) => e.filter((e) => e.localId !== s));
1381
1381
  return;
1382
1382
  }
1383
- let t = e instanceof f ? {
1383
+ let t = e instanceof l ? {
1384
1384
  code: e.code,
1385
1385
  message: e.message
1386
1386
  } : {
1387
1387
  code: "UNKNOWN",
1388
1388
  message: e instanceof Error ? e.message : "Upload failed"
1389
1389
  };
1390
- u((e) => e.map((e) => e.localId === s ? {
1390
+ d((e) => e.map((e) => e.localId === s ? {
1391
1391
  ...e,
1392
1392
  error: t,
1393
1393
  progress: null,
@@ -1398,24 +1398,24 @@ function hn(e) {
1398
1398
  t.accepts,
1399
1399
  t.max_size_bytes,
1400
1400
  n,
1401
- i,
1401
+ a,
1402
1402
  e.entityCode,
1403
- d,
1404
- p
1403
+ p,
1404
+ m
1405
1405
  ]), E = W((e) => {
1406
1406
  Array.from(e).forEach((e) => void T(e));
1407
1407
  }, [T]), D = W(() => {
1408
- s || _.current?.click();
1408
+ s || y.current?.click();
1409
1409
  }, [s]), O = W((e) => {
1410
1410
  let t = e.target.files;
1411
1411
  e.target.value = "", t && t.length > 0 && E(t);
1412
1412
  }, [E]), k = W((e) => {
1413
- m(e) && (g(e).catch(() => {}), p(e)), i?.(c.filter((t) => t.id !== e));
1413
+ h(e) && (f(e).catch(() => {}), m(e)), a?.(c.filter((t) => t.id !== e));
1414
1414
  }, [
1415
- m,
1415
+ h,
1416
1416
  c,
1417
- i,
1418
- p
1417
+ a,
1418
+ m
1419
1419
  ]), A = W((e) => {
1420
1420
  S(e.id, "download", we(e));
1421
1421
  }, [S]);
@@ -1425,7 +1425,7 @@ function hn(e) {
1425
1425
  children: [/* @__PURE__ */ Z("ul", {
1426
1426
  className: "flex flex-col divide-y divide-divider rounded-md border border-border bg-surface",
1427
1427
  children: [
1428
- c.length === 0 && l.length === 0 && /* @__PURE__ */ X("li", {
1428
+ c.length === 0 && u.length === 0 && /* @__PURE__ */ X("li", {
1429
1429
  className: "px-3 py-4 text-center text-sm text-muted-foreground",
1430
1430
  children: t.display?.placeholder || "No files"
1431
1431
  }),
@@ -1446,7 +1446,7 @@ function hn(e) {
1446
1446
  }),
1447
1447
  /* @__PURE__ */ X("span", {
1448
1448
  className: "flex-none text-xs text-muted-foreground",
1449
- children: x(e.size_bytes)
1449
+ children: v(e.size_bytes)
1450
1450
  }),
1451
1451
  /* @__PURE__ */ X("button", {
1452
1452
  type: "button",
@@ -1465,7 +1465,7 @@ function hn(e) {
1465
1465
  })
1466
1466
  ]
1467
1467
  }, e.id)),
1468
- l.map((e) => /* @__PURE__ */ Z("li", {
1468
+ u.map((e) => /* @__PURE__ */ Z("li", {
1469
1469
  className: "flex items-center gap-3 px-3 py-2",
1470
1470
  "data-testid": `pending-row-${e.localId}`,
1471
1471
  "aria-busy": !e.error,
@@ -1493,7 +1493,7 @@ function hn(e) {
1493
1493
  type: "button",
1494
1494
  className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
1495
1495
  onClick: () => {
1496
- e.abort(), v.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
1496
+ e.abort(), b.current.add(e.localId), d((t) => t.filter((t) => t.localId !== e.localId));
1497
1497
  },
1498
1498
  children: e.error ? "Dismiss" : "Cancel"
1499
1499
  })
@@ -1508,7 +1508,7 @@ function hn(e) {
1508
1508
  "data-testid": "add-files",
1509
1509
  children: "Add files"
1510
1510
  }), /* @__PURE__ */ X("input", {
1511
- ref: _,
1511
+ ref: y,
1512
1512
  type: "file",
1513
1513
  accept: C || void 0,
1514
1514
  multiple: !0,
@@ -1633,7 +1633,7 @@ function Dn(e, t, n) {
1633
1633
  let r = Cn(e, t);
1634
1634
  if (r) return r.name || t;
1635
1635
  let i = e.fields.get(t);
1636
- return i ? pe(i, t, n) : t;
1636
+ return i ? b(i, t, n) : t;
1637
1637
  }
1638
1638
  function On(e) {
1639
1639
  let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m } = e, h = Cn(t, r);
@@ -1654,7 +1654,7 @@ function On(e) {
1654
1654
  });
1655
1655
  }
1656
1656
  let g = t.fields.get(r);
1657
- return g ? B({
1657
+ return g ? z({
1658
1658
  field: g,
1659
1659
  entityCode: n,
1660
1660
  fieldName: r,
@@ -1933,7 +1933,7 @@ function er(e) {
1933
1933
  //#region src/hooks/useChildrenData.ts
1934
1934
  var tr = "entity-children";
1935
1935
  function nr(e, t, n, r, i, a) {
1936
- let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? l(t, o.length) : [t];
1936
+ let s = Array.isArray(r) ? r : [r], l = Array.isArray(r) ? o(t, s.length) : [t];
1937
1937
  return He({
1938
1938
  queryKey: [
1939
1939
  tr,
@@ -1945,15 +1945,15 @@ function nr(e, t, n, r, i, a) {
1945
1945
  ],
1946
1946
  queryFn: () => {
1947
1947
  let e = new URLSearchParams();
1948
- if (!s) throw Error("invalid composite parent id");
1949
- let t = o.map((e, t) => ({
1948
+ if (!l) throw Error("invalid composite parent id");
1949
+ let t = s.map((e, t) => ({
1950
1950
  field: e,
1951
1951
  op: "eq",
1952
- value: s[t]
1952
+ value: l[t]
1953
1953
  }));
1954
- return e.set("filters", JSON.stringify(t)), i && e.set("sort", i), a && e.set("limit", String(a)), d(`/api/data/${n}?${e.toString()}`);
1954
+ return e.set("filters", JSON.stringify(t)), i && e.set("sort", i), a && e.set("limit", String(a)), c(`/api/data/${n}?${e.toString()}`);
1955
1955
  },
1956
- enabled: !!e && !!t && !!n && !!r && s !== null
1956
+ enabled: !!e && !!t && !!n && !!r && l !== null
1957
1957
  });
1958
1958
  }
1959
1959
  //#endregion
@@ -1984,17 +1984,17 @@ function ar(e, t, n, r, i, a, o, s) {
1984
1984
  s ? JSON.stringify(Object.entries(s).sort()) : void 0
1985
1985
  ],
1986
1986
  queryFn: ({ pageParam: e }) => {
1987
- let c = new URLSearchParams(), l = [{
1987
+ let l = new URLSearchParams(), u = [{
1988
1988
  field: r,
1989
1989
  op: "eq",
1990
1990
  value: t
1991
1991
  }];
1992
- if (s) for (let [e, t] of Object.entries(s)) t && t !== "__all__" && l.push({
1992
+ if (s) for (let [e, t] of Object.entries(s)) t && t !== "__all__" && u.push({
1993
1993
  field: e,
1994
1994
  op: "eq",
1995
1995
  value: t
1996
1996
  });
1997
- return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), d(`/api/data/${n}?${c.toString()}`);
1997
+ return l.set("filters", JSON.stringify(u)), i && l.set("sort", i), a && l.set("limit", String(a)), o && l.set("search", o), e && l.set("after", e), c(`/api/data/${n}?${l.toString()}`);
1998
1998
  },
1999
1999
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
2000
2000
  initialPageParam: void 0,
@@ -2003,25 +2003,25 @@ function ar(e, t, n, r, i, a, o, s) {
2003
2003
  }
2004
2004
  //#endregion
2005
2005
  //#region src/components/shared/ActionButton.tsx
2006
- function or({ actionCode: n, action: r, entityCode: a, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
2007
- let [f, p] = J(!1), [m, h] = J(!1), { data: g } = i(), _ = Bt(), { run: v } = te(), b = C(r), x = !c || P(r.conditions, c), S = W(async () => {
2008
- if (!(!r.association || s.length === 0)) {
2006
+ function or({ actionCode: n, action: i, entityCode: o, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
2007
+ let [f, p] = J(!1), [m, g] = J(!1), { data: _ } = r(), v = Bt(), { run: y } = te(), b = S(i), x = !c || N(i.conditions, c), w = W(async () => {
2008
+ if (!(!i.association || s.length === 0)) {
2009
2009
  p(!0);
2010
2010
  try {
2011
- let e = await fe(a ? `${a}.${r.association}` : r.association, s), t = o(g, e.target_entity);
2011
+ let e = await pe(o ? `${o}.${i.association}` : i.association, s), t = a(_, e.target_entity);
2012
2012
  if (!t) {
2013
2013
  H.error(`No list screen found for ${e.target_entity}`);
2014
2014
  return;
2015
2015
  }
2016
- let n = g?.entities[e.target_entity], i = U(r.display?.name) || e.target_entity;
2016
+ let n = _?.entities[e.target_entity], r = C(i.display?.name) || e.target_entity;
2017
2017
  if (e.ids.length === 0) {
2018
- H.info(`No related ${i} found`);
2018
+ H.info(`No related ${r} found`);
2019
2019
  return;
2020
2020
  }
2021
2021
  let c = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
2022
- l.set(`filter_${c}`, e.ids.join(",")), _(t.route, {
2023
- title: i,
2024
- icon: r.display?.icon || t.icon,
2022
+ l.set(`filter_${c}`, e.ids.join(",")), v(t.route, {
2023
+ title: r,
2024
+ icon: i.display?.icon || t.icon,
2025
2025
  search: l.toString()
2026
2026
  }), d?.();
2027
2027
  } catch (e) {
@@ -2031,77 +2031,77 @@ function or({ actionCode: n, action: r, entityCode: a, objectIds: s = [], row: c
2031
2031
  }
2032
2032
  }
2033
2033
  }, [
2034
- r,
2035
- a,
2034
+ i,
2035
+ o,
2036
2036
  s,
2037
- g,
2038
2037
  _,
2038
+ v,
2039
2039
  d
2040
- ]), w = r.entity ? `${r.entity}.${n}` : n, T = s.length > 0 ? s : void 0, E = W(() => {
2041
- h(!0), v({
2042
- action: r,
2043
- title: U(r.display?.name) || n,
2040
+ ]), T = i.entity ? `${i.entity}.${n}` : n, E = s.length > 0 ? s : void 0, D = W(() => {
2041
+ g(!0), y({
2042
+ action: i,
2043
+ title: C(i.display?.name) || n,
2044
2044
  row: c,
2045
- entity: a,
2046
- execute: (e) => I(w, ee(e, T)),
2045
+ entity: o,
2046
+ execute: (e) => F(T, R(e, E)),
2047
2047
  onSuccess: () => d?.()
2048
- }).finally(() => h(!1));
2048
+ }).finally(() => g(!1));
2049
2049
  }, [
2050
- v,
2051
- r,
2050
+ y,
2051
+ i,
2052
2052
  n,
2053
2053
  c,
2054
- a,
2055
- w,
2054
+ o,
2056
2055
  T,
2056
+ E,
2057
2057
  d
2058
- ]), D = W(() => {
2059
- if (R(r)) {
2060
- le(r.ui_steps, { row: c }).then(() => d?.());
2058
+ ]), O = W(() => {
2059
+ if (L(i)) {
2060
+ le(i.ui_steps, { row: c }).then(() => d?.());
2061
2061
  return;
2062
2062
  }
2063
2063
  if (b) {
2064
- S();
2064
+ w();
2065
2065
  return;
2066
2066
  }
2067
- if (r.href && !r.handler && !r.association) {
2068
- let e = y(c, a ? g?.entities[a] : void 0), t = r.href;
2069
- a && (t = t.replaceAll("${entity}", a)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), _(t, {
2070
- title: U(r.display?.name) || n,
2071
- icon: r.display?.icon
2067
+ if (i.href && !i.handler && !i.association) {
2068
+ let e = h(c, o ? _?.entities[o] : void 0), t = i.href;
2069
+ o && (t = t.replaceAll("${entity}", o)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), v(t, {
2070
+ title: C(i.display?.name) || n,
2071
+ icon: i.display?.icon
2072
2072
  }), d?.();
2073
2073
  return;
2074
2074
  }
2075
- E();
2075
+ D();
2076
2076
  }, [
2077
- r,
2077
+ i,
2078
2078
  c,
2079
- a,
2080
- g?.entities,
2079
+ o,
2080
+ _?.entities,
2081
2081
  n,
2082
- _,
2082
+ v,
2083
2083
  b,
2084
- S,
2085
- E,
2084
+ w,
2085
+ D,
2086
2086
  d
2087
- ]), O = U(r.display?.name), k = r.display?.icon, A = k && e[k], j = A ? /* @__PURE__ */ X(A, { size: 13 }) : k ? /* @__PURE__ */ X(t, {
2088
- name: k,
2087
+ ]), k = C(i.display?.name), A = i.display?.icon, j = A && e[A], M = j ? /* @__PURE__ */ X(j, { size: 13 }) : A ? /* @__PURE__ */ X(t, {
2088
+ name: A,
2089
2089
  size: 13
2090
- }) : null, M = !x || m || f;
2091
- return u === "icon" ? /* @__PURE__ */ X(L, {
2092
- icon: j ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
2093
- onClick: D,
2094
- title: O
2095
- }) : /* @__PURE__ */ X(V, {
2090
+ }) : null, P = !x || m || f;
2091
+ return u === "icon" ? /* @__PURE__ */ X(B, {
2092
+ icon: M ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
2093
+ onClick: O,
2094
+ title: k
2095
+ }) : /* @__PURE__ */ X(U, {
2096
2096
  kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
2097
2097
  size: "sm",
2098
- icon: j,
2099
- danger: r.destructive,
2100
- onClick: D,
2101
- disabled: M,
2102
- title: O,
2103
- "aria-label": O,
2104
- children: O
2098
+ icon: M,
2099
+ danger: i.destructive,
2100
+ onClick: O,
2101
+ disabled: P,
2102
+ title: k,
2103
+ "aria-label": k,
2104
+ children: k
2105
2105
  });
2106
2106
  }
2107
2107
  //#endregion
@@ -2113,7 +2113,7 @@ function cr(e) {
2113
2113
  return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
2114
2114
  }
2115
2115
  function lr(e, t, n, r, i) {
2116
- let a = cr(t), o = y(n, r?.entity), s = r?.entityCode ?? "";
2116
+ let a = cr(t), o = h(n, r?.entity), s = r?.entityCode ?? "";
2117
2117
  if (e === "__peek") return i?.({
2118
2118
  code: e,
2119
2119
  entity: s,
@@ -2181,7 +2181,7 @@ function pr(e, t, n) {
2181
2181
  if (n && e in n) return n[e];
2182
2182
  }
2183
2183
  function mr(e, t, n) {
2184
- return U(pr(e, t, n)?.display?.name) || e;
2184
+ return C(pr(e, t, n)?.display?.name) || e;
2185
2185
  }
2186
2186
  function hr(e, t, n) {
2187
2187
  return pr(e, t, n)?.display?.icon || void 0;
@@ -2209,7 +2209,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2209
2209
  l,
2210
2210
  u,
2211
2211
  d
2212
- ]), b = a ? /* @__PURE__ */ X(k, { size: 12 }) : m ? /* @__PURE__ */ X(t, {
2212
+ ]), b = a ? /* @__PURE__ */ X(A, { size: 12 }) : m ? /* @__PURE__ */ X(t, {
2213
2213
  name: m,
2214
2214
  size: 12
2215
2215
  }) : null;
@@ -2224,7 +2224,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2224
2224
  clip: "rect(0,0,0,0)"
2225
2225
  },
2226
2226
  children: e.reason
2227
- }), /* @__PURE__ */ X(V, {
2227
+ }), /* @__PURE__ */ X(U, {
2228
2228
  ref: s,
2229
2229
  kind: g ? "primary" : "default",
2230
2230
  danger: h,
@@ -2232,23 +2232,23 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2232
2232
  disabled: _ || a,
2233
2233
  "aria-disabled": _ ? "true" : void 0,
2234
2234
  "aria-describedby": v,
2235
- title: z(f, p, _, e.reason),
2235
+ title: ee(f, p, _, e.reason),
2236
2236
  onClick: y,
2237
2237
  style: c,
2238
2238
  children: p
2239
2239
  })] });
2240
2240
  }
2241
2241
  function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: l, row: u, widgetContext: d, onActionClick: f }) {
2242
- let p = q(null), [m, h] = J(!1), g = n.name ? U(n.name) : "Actions", _ = W((e) => {
2242
+ let p = q(null), [m, h] = J(!1), g = n.name ? C(n.name) : "Actions", _ = W((e) => {
2243
2243
  p.current = e, c?.(e);
2244
2244
  }, [c]), v = W((e, t) => (h(!1), a(e, t)), [a]);
2245
- return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
2245
+ return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(U, {
2246
2246
  ref: _,
2247
2247
  kind: "default",
2248
2248
  icon: o == null ? n.icon ? /* @__PURE__ */ X(t, {
2249
2249
  name: n.icon,
2250
2250
  size: 12
2251
- }) : void 0 : /* @__PURE__ */ X(k, { size: 12 }),
2251
+ }) : void 0 : /* @__PURE__ */ X(A, { size: 12 }),
2252
2252
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2253
2253
  "aria-haspopup": "menu",
2254
2254
  "aria-expanded": m ? "true" : "false",
@@ -2256,7 +2256,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
2256
2256
  onClick: () => h((e) => !e),
2257
2257
  style: l,
2258
2258
  children: g
2259
- }), /* @__PURE__ */ X(N, {
2259
+ }), /* @__PURE__ */ X(V, {
2260
2260
  open: m,
2261
2261
  anchor: p.current,
2262
2262
  onClose: () => h(!1),
@@ -2290,7 +2290,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
2290
2290
  })] });
2291
2291
  }
2292
2292
  function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
2293
- let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(k, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
2293
+ let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(A, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
2294
2294
  name: f,
2295
2295
  size: 12
2296
2296
  }) : null;
@@ -2309,7 +2309,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2309
2309
  role: "menuitem",
2310
2310
  "aria-disabled": m ? "true" : void 0,
2311
2311
  "aria-describedby": h,
2312
- title: z(u, d, m, e.reason),
2312
+ title: ee(u, d, m, e.reason),
2313
2313
  onClick: async () => {
2314
2314
  if (!(!u || m || a)) {
2315
2315
  o(!0);
@@ -2350,7 +2350,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
2350
2350
  })] });
2351
2351
  }
2352
2352
  function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
2353
- let l = e.name ? U(e.name) : void 0;
2353
+ let l = e.name ? C(e.name) : void 0;
2354
2354
  return /* @__PURE__ */ Z(Y, { children: [l && /* @__PURE__ */ X("div", {
2355
2355
  style: {
2356
2356
  padding: "4px 10px 2px",
@@ -2390,13 +2390,13 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
2390
2390
  display: "inline-flex",
2391
2391
  alignItems: "center"
2392
2392
  },
2393
- children: [/* @__PURE__ */ X(L, {
2393
+ children: [/* @__PURE__ */ X(B, {
2394
2394
  ref: c,
2395
- icon: X(d == null ? e.more : k, { size: 14 }),
2395
+ icon: X(d == null ? e.more : A, { size: 14 }),
2396
2396
  title: "Actions",
2397
2397
  size: 28,
2398
2398
  onClick: () => u((e) => !e)
2399
- }), /* @__PURE__ */ X(N, {
2399
+ }), /* @__PURE__ */ X(V, {
2400
2400
  open: l,
2401
2401
  anchor: c.current,
2402
2402
  onClose: () => u(!1),
@@ -2418,12 +2418,12 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
2418
2418
  }
2419
2419
  function Sr(e) {
2420
2420
  let t = 0;
2421
- for (let n of e) if (n.kind === "action" && c(n.code)) t++;
2421
+ for (let n of e) if (n.kind === "action" && s(n.code)) t++;
2422
2422
  else break;
2423
2423
  return t;
2424
2424
  }
2425
2425
  function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c, ariaLabel: l = "Row actions" }) {
2426
- let { normal: u, destructive: d } = dr(e, t, n), f = Sr(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, _ = (e) => /* @__PURE__ */ X(yr, {
2426
+ let { normal: u, destructive: d } = dr(e, t, n), f = Sr(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, v = (e) => /* @__PURE__ */ X(yr, {
2427
2427
  leaf: e,
2428
2428
  entityActions: t,
2429
2429
  globalActions: n,
@@ -2438,9 +2438,9 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
2438
2438
  role: "menu",
2439
2439
  "aria-label": l,
2440
2440
  children: [
2441
- p.map((e) => e.kind === "action" ? _(e) : null),
2442
- p.length > 0 && g && /* @__PURE__ */ X(A, { divider: !0 }),
2443
- m.map((e) => e.kind === "action" ? _(e) : /* @__PURE__ */ X(br, {
2441
+ p.map((e) => e.kind === "action" ? v(e) : null),
2442
+ p.length > 0 && g && /* @__PURE__ */ X(_, { divider: !0 }),
2443
+ m.map((e) => e.kind === "action" ? v(e) : /* @__PURE__ */ X(br, {
2444
2444
  group: e,
2445
2445
  entityActions: t,
2446
2446
  globalActions: n,
@@ -2451,8 +2451,8 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
2451
2451
  widgetContext: s,
2452
2452
  onActionClick: c
2453
2453
  }, e.icon ?? "group")),
2454
- h && /* @__PURE__ */ X(A, { divider: !0 }),
2455
- d.map((e) => _(e))
2454
+ h && /* @__PURE__ */ X(_, { divider: !0 }),
2455
+ d.map((e) => v(e))
2456
2456
  ]
2457
2457
  });
2458
2458
  }
@@ -2479,66 +2479,66 @@ function Or(e, t, n, r, i, a, o, s) {
2479
2479
  };
2480
2480
  }
2481
2481
  function Q(e) {
2482
- return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? U(e.name) : ""}`;
2482
+ return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? C(e.name) : ""}`;
2483
2483
  }
2484
2484
  function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", align: l = "trailing", constrain: u = !0, row: d, widgetContext: f, onActionClick: p }) {
2485
- let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [S, C] = J(null), [w, T] = J(() => typeof document < "u" && document.documentElement.dir === "rtl");
2485
+ let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [S, w] = J(null), [T, E] = J(() => typeof document < "u" && document.documentElement.dir === "rtl");
2486
2486
  G(() => {
2487
2487
  if (typeof MutationObserver > "u") return;
2488
2488
  let e = new MutationObserver((e) => {
2489
- for (let t of e) t.attributeName === "dir" && T(document.documentElement.dir === "rtl"), t.attributeName === "lang" && x(!1);
2489
+ for (let t of e) t.attributeName === "dir" && E(document.documentElement.dir === "rtl"), t.attributeName === "lang" && x(!1);
2490
2490
  });
2491
2491
  return e.observe(document.documentElement, {
2492
2492
  attributes: !0,
2493
2493
  attributeFilter: ["dir", "lang"]
2494
2494
  }), () => e.disconnect();
2495
2495
  }, []);
2496
- let E = q(null), [D, O] = J(!1), k = W((e, t) => (O(!1), a(e, t)), [a]), A = ur(n), j = !!s, M = W(() => {
2497
- if (j || !h.current) return;
2496
+ let D = q(null), [O, k] = J(!1), A = W((e, t) => (k(!1), a(e, t)), [a]), j = ur(n), M = !!s, N = W(() => {
2497
+ if (M || !h.current) return;
2498
2498
  let e = Array.from(h.current.children), t = /* @__PURE__ */ new Map();
2499
2499
  e.forEach((e) => {
2500
2500
  let n = e.dataset.nodeKey;
2501
2501
  n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
2502
2502
  }), y(t), x(!0);
2503
- }, [j]), P = K(() => JSON.stringify(n.map((e) => Q(e))), [n]);
2503
+ }, [M]), P = K(() => JSON.stringify(n.map((e) => Q(e))), [n]);
2504
2504
  Le(() => {
2505
- if (j) {
2505
+ if (M) {
2506
2506
  x(!0);
2507
2507
  return;
2508
2508
  }
2509
2509
  x(!1);
2510
2510
  let e = requestAnimationFrame(() => {
2511
- M();
2511
+ N();
2512
2512
  });
2513
2513
  return () => cancelAnimationFrame(e);
2514
2514
  }, [
2515
2515
  P,
2516
- M,
2517
- j
2516
+ N,
2517
+ M
2518
2518
  ]), G(() => {
2519
- if (j || b) return;
2519
+ if (M || b) return;
2520
2520
  let e = setTimeout(() => {
2521
- M(), x(!0);
2521
+ N(), x(!0);
2522
2522
  }, 16);
2523
2523
  return () => clearTimeout(e);
2524
2524
  }, [
2525
2525
  b,
2526
- M,
2527
- j
2526
+ N,
2527
+ M
2528
2528
  ]), G(() => {
2529
- if (j || !u || !b || g === 0) return;
2529
+ if (M || !u || !b || g === 0) return;
2530
2530
  let e = m.current;
2531
2531
  if (!e) return;
2532
2532
  let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
2533
2533
  r > 0 && Math.abs(g - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(g)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
2534
2534
  }, [
2535
- j,
2535
+ M,
2536
2536
  u,
2537
2537
  b,
2538
2538
  g,
2539
2539
  v
2540
2540
  ]), G(() => {
2541
- if (j) return;
2541
+ if (M) return;
2542
2542
  let e = m.current;
2543
2543
  if (!e) return;
2544
2544
  if (typeof ResizeObserver > "u") {
@@ -2550,18 +2550,18 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2550
2550
  t && _(t.contentRect.width);
2551
2551
  });
2552
2552
  return t.observe(e), _(e.getBoundingClientRect().width), () => t.disconnect();
2553
- }, [j]);
2553
+ }, [M]);
2554
2554
  let F = q(void 0);
2555
2555
  G(() => {
2556
2556
  F.current = void 0;
2557
2557
  }, [P]);
2558
- let I = K(() => j || !u ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : b ? g === 0 ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : Or(n, g, o, v, r, i, s, F.current) : {
2558
+ let I = K(() => M || !u ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : b ? g === 0 ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : Or(n, g, o, v, r, i, s, F.current) : {
2559
2559
  primaryInline: [],
2560
2560
  inline: [],
2561
2561
  overflow: [],
2562
2562
  destructiveInline: []
2563
2563
  }, [
2564
- j,
2564
+ M,
2565
2565
  u,
2566
2566
  b,
2567
2567
  g,
@@ -2574,7 +2574,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2574
2574
  ]);
2575
2575
  if (G(() => {
2576
2576
  F.current = new Set([...I.inline, ...I.primaryInline].map(Q));
2577
- }, [I]), A === 0) return null;
2577
+ }, [I]), j === 0) return null;
2578
2578
  let L = I.overflow.length > 0;
2579
2579
  return /* @__PURE__ */ Z("div", {
2580
2580
  ref: m,
@@ -2582,10 +2582,10 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2582
2582
  "aria-label": c,
2583
2583
  style: {
2584
2584
  display: "flex",
2585
- flexDirection: w ? "row-reverse" : "row",
2585
+ flexDirection: T ? "row-reverse" : "row",
2586
2586
  alignItems: "center",
2587
2587
  gap: 4,
2588
- visibility: b || j ? "visible" : "hidden",
2588
+ visibility: b || M ? "visible" : "hidden",
2589
2589
  position: "relative",
2590
2590
  flex: u ? "1 1 auto" : "0 1 auto",
2591
2591
  justifyContent: l === "trailing" ? "flex-end" : "flex-start",
@@ -2605,7 +2605,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2605
2605
  top: 0,
2606
2606
  left: 0
2607
2607
  },
2608
- children: [/* @__PURE__ */ X(V, {
2608
+ children: [/* @__PURE__ */ X(U, {
2609
2609
  "data-node-key": wr,
2610
2610
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2611
2611
  tabIndex: -1,
@@ -2614,7 +2614,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2614
2614
  let a = Q(n);
2615
2615
  if (n.kind === "action") {
2616
2616
  let e = pr(n.code, r, i), o = mr(n.code, r, i), s = hr(n.code, r, i);
2617
- return /* @__PURE__ */ X(V, {
2617
+ return /* @__PURE__ */ X(U, {
2618
2618
  "data-node-key": a,
2619
2619
  icon: s ? /* @__PURE__ */ X(t, {
2620
2620
  name: s,
@@ -2625,8 +2625,8 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2625
2625
  children: o
2626
2626
  }, a);
2627
2627
  } else {
2628
- let t = n.name ? U(n.name) : "Actions";
2629
- return /* @__PURE__ */ X(V, {
2628
+ let t = n.name ? C(n.name) : "Actions";
2629
+ return /* @__PURE__ */ X(U, {
2630
2630
  "data-node-key": a,
2631
2631
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2632
2632
  tabIndex: -1,
@@ -2641,7 +2641,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2641
2641
  globalActions: i,
2642
2642
  onRun: a,
2643
2643
  loading: S === e.code,
2644
- onLoadingChange: (t) => C(t ? e.code : null),
2644
+ onLoadingChange: (t) => w(t ? e.code : null),
2645
2645
  row: d,
2646
2646
  widgetContext: f,
2647
2647
  onActionClick: p
@@ -2654,7 +2654,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2654
2654
  globalActions: i,
2655
2655
  onRun: a,
2656
2656
  loading: S === e.code,
2657
- onLoadingChange: (t) => C(t ? e.code : null),
2657
+ onLoadingChange: (t) => w(t ? e.code : null),
2658
2658
  row: d,
2659
2659
  widgetContext: f,
2660
2660
  onActionClick: p
@@ -2664,25 +2664,25 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2664
2664
  globalActions: i,
2665
2665
  onRun: a,
2666
2666
  loading: S,
2667
- onLoadingChange: C,
2667
+ onLoadingChange: w,
2668
2668
  row: d,
2669
2669
  widgetContext: f,
2670
2670
  onActionClick: p
2671
2671
  }, t);
2672
2672
  }),
2673
- L && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
2674
- ref: E,
2673
+ L && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(U, {
2674
+ ref: D,
2675
2675
  kind: "default",
2676
2676
  iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
2677
2677
  "aria-haspopup": "menu",
2678
- "aria-expanded": D ? "true" : "false",
2679
- onClick: () => O((e) => !e),
2678
+ "aria-expanded": O ? "true" : "false",
2679
+ onClick: () => k((e) => !e),
2680
2680
  children: "Actions"
2681
- }), /* @__PURE__ */ X(N, {
2682
- open: D,
2683
- anchor: E.current,
2684
- onClose: () => O(!1),
2685
- align: w ? "start" : "end",
2681
+ }), /* @__PURE__ */ X(V, {
2682
+ open: O,
2683
+ anchor: D.current,
2684
+ onClose: () => k(!1),
2685
+ align: T ? "start" : "end",
2686
2686
  width: 220,
2687
2687
  children: /* @__PURE__ */ X("div", {
2688
2688
  role: "menu",
@@ -2691,9 +2691,9 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2691
2691
  leaf: e,
2692
2692
  entityActions: r,
2693
2693
  globalActions: i,
2694
- onRun: k,
2694
+ onRun: A,
2695
2695
  loading: S === e.code,
2696
- onLoadingChange: (t) => C(t ? e.code : null),
2696
+ onLoadingChange: (t) => w(t ? e.code : null),
2697
2697
  row: d,
2698
2698
  widgetContext: f,
2699
2699
  onActionClick: p
@@ -2701,9 +2701,9 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2701
2701
  group: e,
2702
2702
  entityActions: r,
2703
2703
  globalActions: i,
2704
- onRun: k,
2704
+ onRun: A,
2705
2705
  loading: S,
2706
- onLoadingChange: C,
2706
+ onLoadingChange: w,
2707
2707
  row: d,
2708
2708
  widgetContext: f,
2709
2709
  onActionClick: p
@@ -2716,7 +2716,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
2716
2716
  globalActions: i,
2717
2717
  onRun: a,
2718
2718
  loading: S === e.code,
2719
- onLoadingChange: (t) => C(t ? e.code : null),
2719
+ onLoadingChange: (t) => w(t ? e.code : null),
2720
2720
  row: d,
2721
2721
  widgetContext: f,
2722
2722
  onActionClick: p
@@ -2805,15 +2805,15 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2805
2805
  t,
2806
2806
  h,
2807
2807
  r
2808
- ]), _ = W((e, t) => {
2808
+ ]), v = W((e, t) => {
2809
2809
  d(!1);
2810
2810
  let a = t.entity ? `${t.entity}.${e}` : e;
2811
2811
  return m({
2812
2812
  action: t,
2813
- title: U(t.display?.name) || e,
2813
+ title: C(t.display?.name) || e,
2814
2814
  row: r,
2815
2815
  execute: async (e) => {
2816
- let t = await I(a, ee(e, n));
2816
+ let t = await F(a, R(e, n));
2817
2817
  return i?.(), t;
2818
2818
  }
2819
2819
  });
@@ -2831,13 +2831,13 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2831
2831
  alignItems: "center",
2832
2832
  justifyContent: "flex-end"
2833
2833
  },
2834
- children: [/* @__PURE__ */ X(L, {
2834
+ children: [/* @__PURE__ */ X(B, {
2835
2835
  ref: l,
2836
2836
  size: s,
2837
2837
  icon: /* @__PURE__ */ X(e.more, { size: Math.round(s * .55) }),
2838
2838
  onClick: () => d((e) => !e),
2839
2839
  title: "Actions"
2840
- }), /* @__PURE__ */ Z(N, {
2840
+ }), /* @__PURE__ */ Z(V, {
2841
2841
  open: u,
2842
2842
  anchor: l.current,
2843
2843
  onClose: () => d(!1),
@@ -2845,11 +2845,11 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2845
2845
  align: c,
2846
2846
  children: [
2847
2847
  a,
2848
- a && o && g.length > 0 && /* @__PURE__ */ X(A, { divider: !0 }),
2848
+ a && o && g.length > 0 && /* @__PURE__ */ X(_, { divider: !0 }),
2849
2849
  /* @__PURE__ */ X(Cr, {
2850
2850
  layout: g,
2851
2851
  entityActions: h,
2852
- onRun: _,
2852
+ onRun: v,
2853
2853
  loading: f,
2854
2854
  onLoadingChange: p,
2855
2855
  row: r
@@ -2861,8 +2861,8 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2861
2861
  //#endregion
2862
2862
  //#region src/components/detail-layout/AssociatedToolbar.tsx
2863
2863
  function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
2864
- let l = n === !0, d = r && r.length > 0;
2865
- return !l && !d ? null : /* @__PURE__ */ Z("div", {
2864
+ let l = n === !0, u = r && r.length > 0;
2865
+ return !l && !u ? null : /* @__PURE__ */ Z("div", {
2866
2866
  style: {
2867
2867
  display: "flex",
2868
2868
  alignItems: "center",
@@ -2874,16 +2874,16 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
2874
2874
  flex: 1,
2875
2875
  maxWidth: 220
2876
2876
  },
2877
- children: /* @__PURE__ */ X(m, {
2877
+ children: /* @__PURE__ */ X(k, {
2878
2878
  value: i,
2879
2879
  onChange: a,
2880
2880
  placeholder: "Search…",
2881
2881
  prefix: /* @__PURE__ */ X(e.search, { size: 12 })
2882
2882
  })
2883
- }), d && r.map((e) => {
2883
+ }), u && r.map((e) => {
2884
2884
  let n = t.fields.get(e);
2885
2885
  if (!n) return null;
2886
- let r = o[e] ?? "__all__", i = pe(n, e, c);
2886
+ let r = o[e] ?? "__all__", i = b(n, e, c);
2887
2887
  return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ X(Pr, {
2888
2888
  field: n,
2889
2889
  label: i,
@@ -2891,14 +2891,14 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
2891
2891
  onChange: (t) => s(e, t)
2892
2892
  }, e) : n.values ? /* @__PURE__ */ X("div", {
2893
2893
  style: { width: 160 },
2894
- children: /* @__PURE__ */ X(u, {
2894
+ children: /* @__PURE__ */ X(d, {
2895
2895
  value: r,
2896
2896
  options: [{
2897
2897
  value: "__all__",
2898
2898
  label: `All ${i}`
2899
2899
  }, ...n.values.map((e) => ({
2900
2900
  value: e.code,
2901
- label: U(e.name) || e.code
2901
+ label: C(e.name) || e.code
2902
2902
  }))],
2903
2903
  onChange: (t) => s(e, t),
2904
2904
  placeholder: i
@@ -2908,7 +2908,7 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
2908
2908
  });
2909
2909
  }
2910
2910
  function Pr({ field: e, label: t, value: n, onChange: r }) {
2911
- let i = h(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = K(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
2911
+ let i = u(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = K(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
2912
2912
  per_page: 200,
2913
2913
  sort: a ? `${a}:asc` : void 0
2914
2914
  }), c = s?.data ?? [], l = (e) => {
@@ -2921,13 +2921,13 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
2921
2921
  };
2922
2922
  return /* @__PURE__ */ X("div", {
2923
2923
  style: { width: 160 },
2924
- children: /* @__PURE__ */ X(u, {
2924
+ children: /* @__PURE__ */ X(d, {
2925
2925
  value: n,
2926
2926
  options: [{
2927
2927
  value: "__all__",
2928
2928
  label: `All ${t}`
2929
2929
  }, ...c.map((e) => {
2930
- let t = String(e[o]), n = e[re];
2930
+ let t = String(e[o]), n = e[ie];
2931
2931
  return {
2932
2932
  value: t,
2933
2933
  label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
@@ -2941,14 +2941,14 @@ function Pr({ field: e, label: t, value: n, onChange: r }) {
2941
2941
  //#endregion
2942
2942
  //#region src/lib/action-dispatch.ts
2943
2943
  function Fr(e, t, n, r) {
2944
- return R(t) ? (le(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
2944
+ return L(t) ? (le(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
2945
2945
  }
2946
2946
  //#endregion
2947
2947
  //#region src/components/detail-layout/AssociatedBlock.tsx
2948
2948
  function Ir(e) {
2949
2949
  if (!e) return [];
2950
2950
  let t = [];
2951
- for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || c(n) || t.push({
2951
+ for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || s(n) || t.push({
2952
2952
  code: n,
2953
2953
  action: r
2954
2954
  }));
@@ -2970,7 +2970,7 @@ function Lr(e, t, n) {
2970
2970
  let n = a.resolved_params.items().filter((e) => e.name !== t);
2971
2971
  e = {
2972
2972
  ...e,
2973
- resolved_params: new _(n)
2973
+ resolved_params: new y(n)
2974
2974
  };
2975
2975
  }
2976
2976
  r.push({
@@ -3003,7 +3003,7 @@ function Rr(e, t, n) {
3003
3003
  return null;
3004
3004
  }
3005
3005
  function zr(e, t, n) {
3006
- let r = new Set(s(e));
3006
+ let r = new Set(fe(e));
3007
3007
  return new Set(t.filter((t) => {
3008
3008
  if (t === n || r.has(t)) return !1;
3009
3009
  let i = e.fields.get(t);
@@ -3065,7 +3065,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3065
3065
  if (e === s) return !1;
3066
3066
  let t = o.fields.get(e);
3067
3067
  return !(!t || t.primary || t.display?.is_listable === !1);
3068
- }), l = me(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = U(o.display?.name_plural) || U(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = K(() => Lr(o.actions, s, i.recordId), [
3068
+ }), l = P(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = C(o.display?.name_plural) || C(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = K(() => Lr(o.actions, s, i.recordId), [
3069
3069
  o.actions,
3070
3070
  s,
3071
3071
  i.recordId
@@ -3085,7 +3085,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3085
3085
  icon: t?.icon,
3086
3086
  search: t?.search
3087
3087
  }),
3088
- runActionApi: (e, t) => I(e, t)
3088
+ runActionApi: (e, t) => F(e, t)
3089
3089
  }), [
3090
3090
  o,
3091
3091
  a,
@@ -3096,13 +3096,13 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3096
3096
  let t = e.queryKey;
3097
3097
  return t[0] === "entity-children" && t[3] === a;
3098
3098
  } });
3099
- }, [x, a]), C = W((e, t) => {
3099
+ }, [x, a]), w = W((e, t) => {
3100
3100
  let n = Fr(e, t, {}, a);
3101
3101
  if (n !== null) return _({
3102
3102
  action: t,
3103
- title: U(t.display?.name) || e,
3103
+ title: C(t.display?.name) || e,
3104
3104
  execute: async (e) => {
3105
- let t = await I(n, ee(e, void 0));
3105
+ let t = await F(n, R(e, void 0));
3106
3106
  return S(), t;
3107
3107
  }
3108
3108
  });
@@ -3110,7 +3110,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3110
3110
  _,
3111
3111
  a,
3112
3112
  S
3113
- ]), [w, T] = J(0), E = /* @__PURE__ */ Z("div", {
3113
+ ]), [T, E] = J(0), D = /* @__PURE__ */ Z("div", {
3114
3114
  style: {
3115
3115
  display: "flex",
3116
3116
  alignItems: "center",
@@ -3123,7 +3123,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3123
3123
  kind: "toolbar",
3124
3124
  layout: g,
3125
3125
  entityActions: h,
3126
- onRun: C,
3126
+ onRun: w,
3127
3127
  widgetContext: b,
3128
3128
  ariaLabel: `${f} toolbar actions`
3129
3129
  }) : m.map(({ code: e, action: t }) => /* @__PURE__ */ X(or, {
@@ -3133,14 +3133,14 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3133
3133
  variant: "ghost",
3134
3134
  size: "sm",
3135
3135
  onSuccess: S
3136
- }, e)), d && /* @__PURE__ */ X(V, {
3136
+ }, e)), d && /* @__PURE__ */ X(U, {
3137
3137
  kind: "ghost",
3138
3138
  size: "xs",
3139
3139
  icon: /* @__PURE__ */ X(e.plus, { size: 12 }),
3140
- onClick: () => T((e) => e + 1),
3140
+ onClick: () => E((e) => e + 1),
3141
3141
  children: "Add row"
3142
3142
  })]
3143
- }), D = p ? /* @__PURE__ */ X(Gr, {
3143
+ }), O = p ? /* @__PURE__ */ X(Gr, {
3144
3144
  entityCode: a,
3145
3145
  entity: o,
3146
3146
  parentEntity: i.entityCode,
@@ -3153,7 +3153,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3153
3153
  searchable: r.searchable,
3154
3154
  filterFields: r.filters,
3155
3155
  sort: r.sort,
3156
- startDraftSignal: w
3156
+ startDraftSignal: T
3157
3157
  }) : /* @__PURE__ */ X(Wr, {
3158
3158
  entityCode: a,
3159
3159
  entity: o,
@@ -3165,7 +3165,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3165
3165
  interaction: u,
3166
3166
  ctx: i,
3167
3167
  sort: r.sort,
3168
- startDraftSignal: w
3168
+ startDraftSignal: T
3169
3169
  });
3170
3170
  return i.withinCard ? /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("div", {
3171
3171
  style: {
@@ -3173,15 +3173,15 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
3173
3173
  justifyContent: "flex-end",
3174
3174
  marginBottom: 8
3175
3175
  },
3176
- children: E
3177
- }), D] }) : /* @__PURE__ */ X(Je, {
3176
+ children: D
3177
+ }), O] }) : /* @__PURE__ */ X(Je, {
3178
3178
  title: f,
3179
3179
  icon: o.display?.icon ? /* @__PURE__ */ X(t, {
3180
3180
  name: o.display.icon,
3181
3181
  size: 14
3182
3182
  }) : void 0,
3183
- right: E,
3184
- children: D
3183
+ right: D,
3184
+ children: O
3185
3185
  });
3186
3186
  }
3187
3187
  function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
@@ -3233,7 +3233,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3233
3233
  [e]: t
3234
3234
  };
3235
3235
  });
3236
- }, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows: A, refs: j } = K(() => {
3236
+ }, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows: k, refs: j } = K(() => {
3237
3237
  if (!C?.pages) return {
3238
3238
  rows: [],
3239
3239
  refs: void 0
@@ -3274,7 +3274,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3274
3274
  editable: o,
3275
3275
  interaction: s,
3276
3276
  ctx: c,
3277
- rows: A,
3277
+ rows: k,
3278
3278
  refs: j,
3279
3279
  isLoading: w,
3280
3280
  isError: T,
@@ -3283,10 +3283,10 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3283
3283
  }),
3284
3284
  E && /* @__PURE__ */ X("div", {
3285
3285
  style: { marginTop: 4 },
3286
- children: /* @__PURE__ */ X(V, {
3286
+ children: /* @__PURE__ */ X(U, {
3287
3287
  kind: "ghost",
3288
3288
  size: "xs",
3289
- icon: O ? /* @__PURE__ */ X(k, { size: 12 }) : void 0,
3289
+ icon: O ? /* @__PURE__ */ X(A, { size: 12 }) : void 0,
3290
3290
  onClick: () => D(),
3291
3291
  disabled: O,
3292
3292
  children: "Load more"
@@ -3294,45 +3294,45 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
3294
3294
  })
3295
3295
  ] });
3296
3296
  }
3297
- function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, rows: l, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
3298
- let h = ie(), g = h.isPhone && c.relatedRecordsPresentation === "table", _ = a.find((e) => e !== i), v = K(() => s === "navigate" ? r(void 0, t, c.schema.screens) : null, [
3299
- s,
3297
+ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: p }) {
3298
+ let m = se(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ = K(() => o === "navigate" ? ne(void 0, t, s.schema.screens) : null, [
3299
+ o,
3300
3300
  t,
3301
- c.schema.screens
3302
- ]), y = K(() => o ? zr(t, a, i) : /* @__PURE__ */ new Set(), [
3303
- a,
3301
+ s.schema.screens
3302
+ ]), v = K(() => a ? zr(t, i, r) : /* @__PURE__ */ new Set(), [
3304
3303
  i,
3304
+ r,
3305
3305
  t,
3306
- o
3307
- ]), b = K(() => Br(t, a, i), [
3308
- a,
3306
+ a
3307
+ ]), y = K(() => Br(t, i, r), [
3309
3308
  i,
3309
+ r,
3310
3310
  t
3311
3311
  ]), x = K(() => {
3312
3312
  let e = /* @__PURE__ */ new Map();
3313
- for (let n of l) {
3314
- let r = F(t, n);
3313
+ for (let n of c) {
3314
+ let r = me(t, n);
3315
3315
  e.set(he(r), r);
3316
3316
  }
3317
3317
  return e;
3318
- }, [l, t]), S = K(() => {
3318
+ }, [c, t]), S = K(() => {
3319
3319
  let e = /* @__PURE__ */ new Map();
3320
- for (let n of l) {
3320
+ for (let n of c) {
3321
3321
  let r = n.$row_version;
3322
- typeof r == "string" && r !== "" && e.set(he(F(t, n)), r);
3322
+ typeof r == "string" && r !== "" && e.set(he(me(t, n)), r);
3323
3323
  }
3324
3324
  return e;
3325
- }, [l, t]), C = K(() => Ir(t.actions), [t.actions]), [w, T] = J(null), [E, D] = J(null), [O, k] = J([]), [A, j] = J({}), N = q(A);
3326
- N.current = A;
3327
- let P = q({});
3325
+ }, [c, t]), w = K(() => Ir(t.actions), [t.actions]), [T, E] = J(null), [D, O] = J(null), [k, A] = J([]), [j, N] = J({}), P = q(j);
3326
+ P.current = j;
3327
+ let F = q({});
3328
3328
  G(() => {
3329
- let e = P.current;
3329
+ let e = F.current;
3330
3330
  return () => {
3331
3331
  for (let t of Object.values(e)) clearTimeout(t);
3332
3332
  };
3333
3333
  }, []);
3334
- let [I, L] = J(null), [R, z] = J([]), [ee, B] = J(!1), { run: V } = te(), [re, ae] = J(/* @__PURE__ */ new Set()), oe = W(async (t, n, r) => {
3335
- j((e) => ({
3334
+ let [I, L] = J(null), [ee, R] = J([]), [z, B] = J(!1), { run: ie } = te(), [V, ae] = J(/* @__PURE__ */ new Set()), oe = W(async (t, n, r) => {
3335
+ N((e) => ({
3336
3336
  ...e,
3337
3337
  [t]: {
3338
3338
  ...e[t],
@@ -3345,7 +3345,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3345
3345
  ...n,
3346
3346
  $row_version: i
3347
3347
  } : n;
3348
- return await ne(e, x.get(t) ?? t, a), j((e) => {
3348
+ return await re(e, x.get(t) ?? t, a), N((e) => {
3349
3349
  let n = e[t];
3350
3350
  if (!n) return e;
3351
3351
  if (n.ver > r) return {
@@ -3357,10 +3357,10 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3357
3357
  };
3358
3358
  let { [t]: i, ...a } = e;
3359
3359
  return a;
3360
- }), p(), !0;
3360
+ }), f(), !0;
3361
3361
  } catch (e) {
3362
3362
  let n = e instanceof Error ? e.message : "Save failed";
3363
- return j((e) => ({
3363
+ return N((e) => ({
3364
3364
  ...e,
3365
3365
  [t]: {
3366
3366
  ...e[t],
@@ -3371,11 +3371,11 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3371
3371
  }
3372
3372
  }, [
3373
3373
  e,
3374
- p,
3374
+ f,
3375
3375
  x,
3376
3376
  S
3377
3377
  ]), H = W((e, t, n) => {
3378
- j((r) => {
3378
+ N((r) => {
3379
3379
  let i = r[e] ?? {
3380
3380
  buffer: {},
3381
3381
  ver: 0,
@@ -3392,89 +3392,89 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3392
3392
  ver: a
3393
3393
  }
3394
3394
  };
3395
- }), s === "inline_edit" && (P.current[e] && clearTimeout(P.current[e]), P.current[e] = setTimeout(() => {
3396
- let t = N.current[e];
3395
+ }), o === "inline_edit" && (F.current[e] && clearTimeout(F.current[e]), F.current[e] = setTimeout(() => {
3396
+ let t = P.current[e];
3397
3397
  t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
3398
3398
  }, 500));
3399
- }, [oe, s]), se = W(() => {
3399
+ }, [oe, o]), ce = W(() => {
3400
3400
  let e = {};
3401
- e[i] = n;
3402
- for (let n of a) {
3401
+ e[r] = n;
3402
+ for (let n of i) {
3403
3403
  let r = t.fields.get(n);
3404
3404
  r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
3405
3405
  }
3406
- L(e), z([]);
3406
+ L(e), R([]);
3407
3407
  }, [
3408
- i,
3408
+ r,
3409
3409
  n,
3410
- a,
3410
+ i,
3411
3411
  t.fields
3412
- ]), ce = q(m);
3412
+ ]), le = q(p);
3413
3413
  G(() => {
3414
- m !== void 0 && m !== ce.current && (ce.current = m, !I && se());
3414
+ p !== void 0 && p !== le.current && (le.current = p, !I && ce());
3415
3415
  }, [
3416
- m,
3416
+ p,
3417
3417
  I,
3418
- se
3418
+ ce
3419
3419
  ]);
3420
- let le = W(async () => {
3420
+ let U = W(async () => {
3421
3421
  if (!I) return;
3422
- let n = Vr(I, a, t, i);
3422
+ let n = Vr(I, i, t, r);
3423
3423
  if (n.length > 0) {
3424
- z(n);
3424
+ R(n);
3425
3425
  return;
3426
3426
  }
3427
3427
  B(!0);
3428
3428
  try {
3429
- await M(e, I), L(null), z([]), p();
3429
+ await M(e, I), L(null), R([]), f();
3430
3430
  } catch (e) {
3431
3431
  let t = e instanceof Error ? e.message : "Create failed";
3432
- z([`_error:${t}`]);
3432
+ R([`_error:${t}`]);
3433
3433
  } finally {
3434
3434
  B(!1);
3435
3435
  }
3436
3436
  }, [
3437
3437
  I,
3438
- a,
3439
- t,
3440
3438
  i,
3439
+ t,
3440
+ r,
3441
3441
  e,
3442
- p
3442
+ f
3443
3443
  ]), ue = W((e) => {
3444
- j({}), k([]), D(e);
3444
+ N({}), A([]), O(e);
3445
3445
  }, []), fe = W(async (e) => {
3446
- let n = N.current[e], r = n?.buffer ?? {};
3447
- if (Object.keys(r).length === 0) {
3448
- D(null), k([]);
3446
+ let n = P.current[e], a = n?.buffer ?? {};
3447
+ if (Object.keys(a).length === 0) {
3448
+ O(null), A([]);
3449
3449
  return;
3450
3450
  }
3451
3451
  let o = Vr({
3452
- ...l.find((n) => he(F(t, n)) === e) ?? {},
3453
- ...r
3454
- }, a, t, i);
3452
+ ...c.find((n) => he(me(t, n)) === e) ?? {},
3453
+ ...a
3454
+ }, i, t, r);
3455
3455
  if (o.length > 0) {
3456
- k(o);
3456
+ A(o);
3457
3457
  return;
3458
3458
  }
3459
- await oe(e, { ...r }, n?.ver ?? 0) && (D(null), k([]));
3459
+ await oe(e, { ...a }, n?.ver ?? 0) && (O(null), A([]));
3460
3460
  }, [
3461
- l,
3461
+ c,
3462
3462
  t,
3463
- a,
3464
3463
  i,
3464
+ r,
3465
3465
  oe
3466
- ]), me = W((e) => {
3467
- j((t) => {
3466
+ ]), pe = W((e) => {
3467
+ N((t) => {
3468
3468
  if (!t[e]) return t;
3469
3469
  let { [e]: n, ...r } = t;
3470
3470
  return r;
3471
- }), k([]), D(null);
3471
+ }), A([]), O(null);
3472
3472
  }, []), ge = W((n, r) => {
3473
3473
  let i = x.get(n) ?? n;
3474
- return V({
3474
+ return ie({
3475
3475
  action: t.actions?.__delete,
3476
3476
  destructive: !0,
3477
- title: U(t.display?.name) || "Delete",
3477
+ title: C(t.display?.name) || "Delete",
3478
3478
  row: r,
3479
3479
  entity: e,
3480
3480
  execute: async () => {
@@ -3488,16 +3488,16 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3488
3488
  });
3489
3489
  }
3490
3490
  },
3491
- onSuccess: () => p()
3491
+ onSuccess: () => f()
3492
3492
  });
3493
3493
  }, [
3494
- V,
3494
+ ie,
3495
3495
  t,
3496
3496
  e,
3497
- p,
3497
+ f,
3498
3498
  x
3499
3499
  ]);
3500
- if (f) return /* @__PURE__ */ X("div", {
3500
+ if (d) return /* @__PURE__ */ X("div", {
3501
3501
  style: {
3502
3502
  fontSize: 12.5,
3503
3503
  color: "var(--danger)",
@@ -3505,7 +3505,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3505
3505
  },
3506
3506
  children: "Failed to load."
3507
3507
  });
3508
- if (d) return /* @__PURE__ */ Z("div", {
3508
+ if (u) return /* @__PURE__ */ Z("div", {
3509
3509
  style: {
3510
3510
  display: "flex",
3511
3511
  flexDirection: "column",
@@ -3522,153 +3522,153 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
3522
3522
  borderRadius: 6
3523
3523
  } })]
3524
3524
  });
3525
- let _e = l.length === 0 && !I;
3526
- return h.isPhone && !g ? /* @__PURE__ */ Z("div", { children: [_e && !o && /* @__PURE__ */ X("div", {
3525
+ let _e = c.length === 0 && !I;
3526
+ return m.isPhone && !h ? /* @__PURE__ */ Z("div", { children: [_e && !a && /* @__PURE__ */ X("div", {
3527
3527
  style: {
3528
3528
  fontSize: 12.5,
3529
3529
  color: "var(--text-3)",
3530
3530
  padding: "12px 0"
3531
3531
  },
3532
3532
  children: "No records yet."
3533
- }), (!_e || o) && /* @__PURE__ */ Z("div", {
3533
+ }), (!_e || a) && /* @__PURE__ */ Z("div", {
3534
3534
  style: {
3535
3535
  display: "flex",
3536
3536
  flexDirection: "column",
3537
3537
  gap: 10
3538
3538
  },
3539
- children: [l.map((n) => {
3540
- let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3539
+ children: [c.map((n) => {
3540
+ let r = he(me(t, n)), c = V.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
3541
3541
  return /* @__PURE__ */ X(qr, {
3542
3542
  rowId: r,
3543
3543
  row: n,
3544
3544
  entity: t,
3545
- entities: c.schema.entities,
3546
- screens: c.schema.screens,
3547
- columns: a,
3548
- editableColumns: y,
3549
- editable: o,
3550
- interaction: s,
3551
- isEditing: E === r,
3552
- editErrors: O,
3553
- isDeleting: i,
3554
- activeCell: w,
3555
- setActiveCell: T,
3556
- rowState: l,
3545
+ entities: s.schema.entities,
3546
+ screens: s.schema.screens,
3547
+ columns: i,
3548
+ editableColumns: v,
3549
+ editable: a,
3550
+ interaction: o,
3551
+ isEditing: D === r,
3552
+ editErrors: k,
3553
+ isDeleting: c,
3554
+ activeCell: T,
3555
+ setActiveCell: E,
3556
+ rowState: u,
3557
3557
  onCellChange: H,
3558
3558
  onDeleteClick: (e) => void ge(e, n),
3559
3559
  onStartEdit: ue,
3560
3560
  onConfirmEdit: fe,
3561
- onCancelEdit: me,
3562
- refs: u,
3563
- identityCol: _,
3561
+ onCancelEdit: pe,
3562
+ refs: l,
3563
+ identityCol: g,
3564
3564
  href: d,
3565
- rowActions: C,
3565
+ rowActions: w,
3566
3566
  entityCode: e,
3567
- onRowActionSuccess: p
3567
+ onRowActionSuccess: f
3568
3568
  }, r);
3569
3569
  }), I && /* @__PURE__ */ X(Qr, {
3570
3570
  draftRow: I,
3571
3571
  entity: t,
3572
- columns: a,
3573
- editableColumns: b,
3574
- foreignKey: i,
3575
- draftErrors: R,
3576
- draftSaving: ee,
3572
+ columns: i,
3573
+ editableColumns: y,
3574
+ foreignKey: r,
3575
+ draftErrors: ee,
3576
+ draftSaving: z,
3577
3577
  onChange: (e, t) => L((n) => n && {
3578
3578
  ...n,
3579
3579
  [e]: t
3580
3580
  }),
3581
- onConfirm: le,
3581
+ onConfirm: U,
3582
3582
  onCancel: () => {
3583
- L(null), z([]);
3583
+ L(null), R([]);
3584
3584
  },
3585
- refs: u
3585
+ refs: l
3586
3586
  })]
3587
- })] }) : /* @__PURE__ */ Z("div", { children: [_e && !o && /* @__PURE__ */ X("div", {
3587
+ })] }) : /* @__PURE__ */ Z("div", { children: [_e && !a && /* @__PURE__ */ X("div", {
3588
3588
  style: {
3589
3589
  fontSize: 12.5,
3590
3590
  color: "var(--text-3)",
3591
3591
  padding: "12px 0"
3592
3592
  },
3593
3593
  children: "No records yet."
3594
- }), (!_e || o) && /* @__PURE__ */ X("div", {
3594
+ }), (!_e || a) && /* @__PURE__ */ X("div", {
3595
3595
  style: { overflowX: "auto" },
3596
3596
  children: /* @__PURE__ */ Z("table", {
3597
3597
  style: je,
3598
3598
  children: [/* @__PURE__ */ X("thead", { children: /* @__PURE__ */ Z("tr", { children: [
3599
- a.map((e) => {
3599
+ i.map((e) => {
3600
3600
  let n = t.fields.get(e);
3601
3601
  return /* @__PURE__ */ X("th", {
3602
3602
  style: Ae,
3603
- children: n ? pe(n, e, c.schema.entities) : e
3603
+ children: n ? b(n, e, s.schema.entities) : e
3604
3604
  }, e);
3605
3605
  }),
3606
- o && /* @__PURE__ */ X("th", { style: {
3606
+ a && /* @__PURE__ */ X("th", { style: {
3607
3607
  height: 30,
3608
3608
  width: 72
3609
3609
  } }),
3610
- !o && C.length > 0 && /* @__PURE__ */ X("th", { style: {
3610
+ !a && w.length > 0 && /* @__PURE__ */ X("th", { style: {
3611
3611
  height: 30,
3612
3612
  width: 40
3613
3613
  } })
3614
- ] }) }), /* @__PURE__ */ Z("tbody", { children: [l.map((n) => {
3615
- let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
3614
+ ] }) }), /* @__PURE__ */ Z("tbody", { children: [c.map((n) => {
3615
+ let r = he(me(t, n)), c = V.has(r), u = j[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
3616
3616
  return /* @__PURE__ */ X(Jr, {
3617
3617
  rowId: r,
3618
3618
  row: n,
3619
3619
  entity: t,
3620
- entities: c.schema.entities,
3621
- screens: c.schema.screens,
3622
- columns: a,
3623
- editableColumns: y,
3624
- editable: o,
3625
- interaction: s,
3626
- isEditing: E === r,
3627
- editErrors: O,
3628
- isDeleting: i,
3629
- activeCell: w,
3630
- setActiveCell: T,
3631
- rowState: l,
3620
+ entities: s.schema.entities,
3621
+ screens: s.schema.screens,
3622
+ columns: i,
3623
+ editableColumns: v,
3624
+ editable: a,
3625
+ interaction: o,
3626
+ isEditing: D === r,
3627
+ editErrors: k,
3628
+ isDeleting: c,
3629
+ activeCell: T,
3630
+ setActiveCell: E,
3631
+ rowState: u,
3632
3632
  onCellChange: H,
3633
3633
  onDeleteClick: (e) => void ge(e, n),
3634
3634
  onStartEdit: ue,
3635
3635
  onConfirmEdit: fe,
3636
- onCancelEdit: me,
3637
- refs: u,
3638
- identityCol: _,
3636
+ onCancelEdit: pe,
3637
+ refs: l,
3638
+ identityCol: g,
3639
3639
  href: d,
3640
- rowActions: C,
3640
+ rowActions: w,
3641
3641
  entityCode: e,
3642
- onRowActionSuccess: p
3642
+ onRowActionSuccess: f
3643
3643
  }, r);
3644
3644
  }), I && /* @__PURE__ */ X(Zr, {
3645
3645
  draftRow: I,
3646
3646
  entity: t,
3647
- columns: a,
3648
- editableColumns: b,
3649
- foreignKey: i,
3650
- draftErrors: R,
3651
- draftSaving: ee,
3647
+ columns: i,
3648
+ editableColumns: y,
3649
+ foreignKey: r,
3650
+ draftErrors: ee,
3651
+ draftSaving: z,
3652
3652
  onChange: (e, t) => L((n) => n && {
3653
3653
  ...n,
3654
3654
  [e]: t
3655
3655
  }),
3656
- onConfirm: le,
3656
+ onConfirm: U,
3657
3657
  onCancel: () => {
3658
- L(null), z([]);
3658
+ L(null), R([]);
3659
3659
  },
3660
- refs: u
3660
+ refs: l
3661
3661
  })] })]
3662
3662
  })
3663
3663
  })] });
3664
3664
  }
3665
- function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: b, refs: x, identityCol: S, href: C, rowActions: w, onRowActionSuccess: T }) {
3666
- let E = n(), D = Ie(), O = K(() => !h || Object.keys(h.buffer).length === 0 ? r : {
3665
+ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
3666
+ let D = n(), O = Ie(), k = K(() => !h || Object.keys(h.buffer).length === 0 ? r : {
3667
3667
  ...r,
3668
3668
  ...h.buffer
3669
3669
  }, [r, h]);
3670
3670
  return u === "row_edit" && d ? /* @__PURE__ */ X(Xr, {
3671
- values: O,
3671
+ values: k,
3672
3672
  entity: i,
3673
3673
  columns: s,
3674
3674
  editableColumns: c,
@@ -3676,8 +3676,8 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3676
3676
  saving: h?.saving ?? !1,
3677
3677
  onChange: (e, n) => g(t, e, n),
3678
3678
  onConfirm: () => y(t),
3679
- onCancel: () => b(t),
3680
- refs: x
3679
+ onCancel: () => x(t),
3680
+ refs: S
3681
3681
  }) : /* @__PURE__ */ Z("div", {
3682
3682
  style: {
3683
3683
  border: "1px solid var(--border)",
@@ -3694,26 +3694,26 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3694
3694
  gap: 12
3695
3695
  },
3696
3696
  children: s.map((e) => {
3697
- let n = i.fields.get(e), r = l && u === "inline_edit" && c.has(e), s = C && e === S, d = n ? pe(n, e, a) : e, f = `${D}-${t}-${e}`, m = `${f}-label`, h = {
3697
+ let n = i.fields.get(e), r = l && u === "inline_edit" && c.has(e), s = w && e === C, d = n ? b(n, e, a) : e, f = `${O}-${t}-${e}`, m = `${f}-label`, h = {
3698
3698
  fontSize: 11.5,
3699
3699
  fontWeight: 600,
3700
3700
  color: "var(--text-3)"
3701
- }, _ = n ? B({
3701
+ }, _ = n ? z({
3702
3702
  field: n,
3703
3703
  fieldName: e,
3704
- value: O[e],
3704
+ value: k[e],
3705
3705
  mode: r ? "edit" : "display",
3706
3706
  onChange: r ? (n) => g(t, e, n) : void 0,
3707
- record: O,
3708
- refs: x,
3707
+ record: k,
3708
+ refs: S,
3709
3709
  compact: r,
3710
3710
  entity: i,
3711
3711
  entities: a,
3712
3712
  screens: s ? void 0 : o,
3713
3713
  fieldId: f,
3714
3714
  labelId: m,
3715
- locale: E
3716
- }) : p(O[e]);
3715
+ locale: D
3716
+ }) : p(k[e]);
3717
3717
  return /* @__PURE__ */ Z("div", {
3718
3718
  style: {
3719
3719
  display: "flex",
@@ -3733,7 +3733,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3733
3733
  }), /* @__PURE__ */ X("div", {
3734
3734
  style: { minWidth: 0 },
3735
3735
  children: s && !r ? /* @__PURE__ */ X("a", {
3736
- href: C,
3736
+ href: w,
3737
3737
  style: {
3738
3738
  color: "var(--accent)",
3739
3739
  textDecoration: "none",
@@ -3744,7 +3744,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3744
3744
  })]
3745
3745
  }, e);
3746
3746
  })
3747
- }), (l || w && w.length > 0) && /* @__PURE__ */ Z("div", {
3747
+ }), (l || T && T.length > 0) && /* @__PURE__ */ Z("div", {
3748
3748
  style: {
3749
3749
  minHeight: 42,
3750
3750
  padding: "6px 8px",
@@ -3755,7 +3755,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3755
3755
  gap: 6
3756
3756
  },
3757
3757
  children: [l && /* @__PURE__ */ Z(Y, { children: [
3758
- h?.saving && /* @__PURE__ */ X(k, { size: 12 }),
3758
+ h?.saving && /* @__PURE__ */ X(A, { size: 12 }),
3759
3759
  h?.error && /* @__PURE__ */ X("span", {
3760
3760
  style: {
3761
3761
  fontSize: 11,
@@ -3764,34 +3764,34 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3764
3764
  title: h.error,
3765
3765
  children: "!"
3766
3766
  }),
3767
- u === "row_edit" && /* @__PURE__ */ X(L, {
3767
+ u === "row_edit" && /* @__PURE__ */ X(B, {
3768
3768
  size: 32,
3769
3769
  icon: /* @__PURE__ */ X(e.edit, { size: 14 }),
3770
3770
  onClick: () => v(t),
3771
3771
  title: "Edit row"
3772
3772
  }),
3773
- /* @__PURE__ */ X(L, {
3773
+ /* @__PURE__ */ X(B, {
3774
3774
  size: 32,
3775
3775
  icon: /* @__PURE__ */ X(e.trash, { size: 14 }),
3776
3776
  onClick: () => _(t),
3777
3777
  title: "Delete row"
3778
3778
  })
3779
- ] }), !l && w && w.length > 0 && /* @__PURE__ */ X(Mr, {
3780
- actions: w,
3779
+ ] }), !l && T && T.length > 0 && /* @__PURE__ */ X(Mr, {
3780
+ actions: T,
3781
3781
  objectIds: [t],
3782
- row: O,
3783
- onSuccess: T
3782
+ row: k,
3783
+ onSuccess: E
3784
3784
  })]
3785
3785
  })]
3786
3786
  });
3787
3787
  }
3788
3788
  function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
3789
- let O = n(), A = K(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
3789
+ let O = n(), k = K(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
3790
3790
  ...r,
3791
3791
  ..._.buffer
3792
3792
  }, [r, _]);
3793
3793
  if (u === "row_edit" && d) return /* @__PURE__ */ X(Yr, {
3794
- values: A,
3794
+ values: k,
3795
3795
  entity: i,
3796
3796
  columns: s,
3797
3797
  editableColumns: c,
@@ -3814,30 +3814,30 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3814
3814
  let n = i.fields.get(e), r = c.has(e);
3815
3815
  if (N && h?.rowId === t && h?.col === e && r) return /* @__PURE__ */ X("td", {
3816
3816
  style: M,
3817
- children: n ? B({
3817
+ children: n ? z({
3818
3818
  field: n,
3819
3819
  fieldName: e,
3820
- value: A[e],
3820
+ value: k[e],
3821
3821
  mode: "edit",
3822
3822
  onChange: (n) => v(t, e, n),
3823
- record: A,
3823
+ record: k,
3824
3824
  refs: C,
3825
3825
  compact: !0,
3826
3826
  locale: O
3827
- }) : p(A[e])
3827
+ }) : p(k[e])
3828
3828
  }, e);
3829
- let s = T && e === w, l = n ? B({
3829
+ let s = T && e === w, l = n ? z({
3830
3830
  field: n,
3831
3831
  fieldName: e,
3832
- value: A[e],
3832
+ value: k[e],
3833
3833
  mode: "display",
3834
- record: A,
3834
+ record: k,
3835
3835
  refs: C,
3836
3836
  entity: i,
3837
3837
  entities: a,
3838
3838
  screens: s ? void 0 : o,
3839
3839
  locale: O
3840
- }) : p(A[e]), u = N && r && !m;
3840
+ }) : p(k[e]), u = N && r && !m;
3841
3841
  return /* @__PURE__ */ X("td", {
3842
3842
  style: {
3843
3843
  ...j,
@@ -3873,7 +3873,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3873
3873
  gap: 4
3874
3874
  },
3875
3875
  children: [
3876
- _?.saving && /* @__PURE__ */ X(k, { size: 12 }),
3876
+ _?.saving && /* @__PURE__ */ X(A, { size: 12 }),
3877
3877
  _?.error && /* @__PURE__ */ X("span", {
3878
3878
  style: {
3879
3879
  fontSize: 11,
@@ -3882,13 +3882,13 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3882
3882
  title: _.error,
3883
3883
  children: "!"
3884
3884
  }),
3885
- u === "row_edit" && /* @__PURE__ */ X(L, {
3885
+ u === "row_edit" && /* @__PURE__ */ X(B, {
3886
3886
  size: 24,
3887
3887
  icon: /* @__PURE__ */ X(e.edit, { size: 12 }),
3888
3888
  onClick: () => b(t),
3889
3889
  title: "Edit row"
3890
3890
  }),
3891
- /* @__PURE__ */ X(L, {
3891
+ /* @__PURE__ */ X(B, {
3892
3892
  size: 24,
3893
3893
  icon: /* @__PURE__ */ X(e.trash, { size: 12 }),
3894
3894
  onClick: () => y(t),
@@ -3906,7 +3906,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
3906
3906
  children: /* @__PURE__ */ X(Mr, {
3907
3907
  actions: E,
3908
3908
  objectIds: [t],
3909
- row: A,
3909
+ row: k,
3910
3910
  onSuccess: D
3911
3911
  })
3912
3912
  })
@@ -3942,7 +3942,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
3942
3942
  title: o ? `${e} is required` : void 0,
3943
3943
  children: /* @__PURE__ */ X("div", {
3944
3944
  style: v,
3945
- children: n ? B({
3945
+ children: n ? z({
3946
3946
  field: n,
3947
3947
  fieldName: e,
3948
3948
  value: t[e],
@@ -3979,13 +3979,13 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
3979
3979
  title: h.slice(7),
3980
3980
  children: "!"
3981
3981
  }),
3982
- /* @__PURE__ */ X(L, {
3982
+ /* @__PURE__ */ X(B, {
3983
3983
  size: 24,
3984
- icon: X(s ? k : e.check, { size: 12 }),
3984
+ icon: X(s ? A : e.check, { size: 12 }),
3985
3985
  onClick: l,
3986
3986
  title: "Confirm (Enter)"
3987
3987
  }),
3988
- /* @__PURE__ */ X(L, {
3988
+ /* @__PURE__ */ X(B, {
3989
3989
  size: 24,
3990
3990
  icon: /* @__PURE__ */ X(e.x, { size: 12 }),
3991
3991
  onClick: u,
@@ -4017,7 +4017,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4017
4017
  gap: 12
4018
4018
  },
4019
4019
  children: i.map((e) => {
4020
- let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ? pe(n, e) : e, l = `${h}-${e}`, u = `${l}-label`, f = {
4020
+ let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ? b(n, e) : e, l = `${h}-${e}`, u = `${l}-label`, f = {
4021
4021
  fontSize: 11.5,
4022
4022
  fontWeight: 600,
4023
4023
  color: "var(--text-3)"
@@ -4046,7 +4046,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4046
4046
  borderRadius: o ? 5 : 0
4047
4047
  },
4048
4048
  title: o ? `${e} is required` : void 0,
4049
- children: i ? n ? B({
4049
+ children: i ? n ? z({
4050
4050
  field: n,
4051
4051
  fieldName: e,
4052
4052
  value: t[e],
@@ -4081,13 +4081,13 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
4081
4081
  title: g.slice(7),
4082
4082
  children: "!"
4083
4083
  }),
4084
- /* @__PURE__ */ X(L, {
4084
+ /* @__PURE__ */ X(B, {
4085
4085
  size: 32,
4086
- icon: X(s ? k : e.check, { size: 14 }),
4086
+ icon: X(s ? A : e.check, { size: 14 }),
4087
4087
  onClick: l,
4088
4088
  title: "Confirm (Enter)"
4089
4089
  }),
4090
- /* @__PURE__ */ X(L, {
4090
+ /* @__PURE__ */ X(B, {
4091
4091
  size: 32,
4092
4092
  icon: /* @__PURE__ */ X(e.x, { size: 14 }),
4093
4093
  onClick: u,
@@ -4154,7 +4154,7 @@ function ti(e) {
4154
4154
  function ni(e) {
4155
4155
  let t = Ue();
4156
4156
  return Ve({
4157
- mutationFn: ({ pkValues: t, data: n }) => ne(e, t, n),
4157
+ mutationFn: ({ pkValues: t, data: n }) => re(e, t, n),
4158
4158
  onSuccess: () => {
4159
4159
  ei(t, e, {
4160
4160
  item: !0,
@@ -4364,39 +4364,39 @@ function hi(e, t) {
4364
4364
  //#endregion
4365
4365
  //#region src/hooks/useScreenBack.ts
4366
4366
  function gi(e) {
4367
- let t = ze(), n = oe(), r = ae(), a = At((e) => e.depth), { data: o } = i(), s = e?.fallback, c = kt((e) => {
4367
+ let t = ze(), n = oe(), i = ae(), a = At((e) => e.depth), { data: o } = r(), s = e?.fallback, c = kt((e) => {
4368
4368
  let t = e.tabs.find((t) => t.id === e.activeTabId);
4369
4369
  return t ? t.returnTo : void 0;
4370
4370
  }), { hasOriginBack: l, allowFallbackBack: u } = K(() => It(c, n.enabled), [c, n.enabled]), d = W(() => {
4371
4371
  if (n.enabled) {
4372
- At.getState().depth > 0 ? r() : s?.();
4372
+ At.getState().depth > 0 ? i() : s?.();
4373
4373
  return;
4374
4374
  }
4375
- let e = kt.getState(), i = Lt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4376
- if (!i) {
4375
+ let e = kt.getState(), r = Lt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
4376
+ if (!r) {
4377
4377
  s?.();
4378
4378
  return;
4379
4379
  }
4380
- if (i.kind === "live" && i.tabId) e.commitTabNavigation(i.tabId, { search: i.search ?? "" });
4381
- else if (i.kind === "reopen") {
4382
- let t = i.title ? void 0 : v(i.pathname, o?.screens, o?.entities);
4380
+ if (r.kind === "live" && r.tabId) e.commitTabNavigation(r.tabId, { search: r.search ?? "" });
4381
+ else if (r.kind === "reopen") {
4382
+ let t = r.title ? void 0 : m(r.pathname, o?.screens, o?.entities);
4383
4383
  e.openTab({
4384
- pathname: i.pathname,
4385
- search: i.search ?? "",
4386
- title: i.title ?? t?.title ?? i.pathname,
4387
- icon: i.icon ?? t?.icon,
4388
- screen: i.screen,
4384
+ pathname: r.pathname,
4385
+ search: r.search ?? "",
4386
+ title: r.title ?? t?.title ?? r.pathname,
4387
+ icon: r.icon ?? t?.icon,
4388
+ screen: r.screen,
4389
4389
  closable: !0
4390
4390
  });
4391
4391
  }
4392
4392
  t({
4393
- pathname: i.pathname,
4394
- search: Pt(i.search),
4395
- hash: i.hash || void 0
4393
+ pathname: r.pathname,
4394
+ search: Pt(r.search),
4395
+ hash: r.hash || void 0
4396
4396
  });
4397
4397
  }, [
4398
4398
  n.enabled,
4399
- r,
4399
+ i,
4400
4400
  s,
4401
4401
  t,
4402
4402
  o?.screens,
@@ -4684,7 +4684,7 @@ function Zi(e, t) {
4684
4684
  function Qi(e, t) {
4685
4685
  if (!e) return [];
4686
4686
  let n = new $();
4687
- for (let r of s(e)) n.add(r), t.addField(r, "identity");
4687
+ for (let r of fe(e)) n.add(r), t.addField(r, "identity");
4688
4688
  let r = Hi(e, e.display.display_field, { explicit: !0 });
4689
4689
  r && (n.add(r), t.addField(r, "display"), da(e, r, t, "display"));
4690
4690
  for (let r of $i(e.display.display_template)) {
@@ -4949,7 +4949,7 @@ var $ = class {
4949
4949
  },
4950
4950
  children: this.state.error?.message || "An unexpected error occurred."
4951
4951
  }),
4952
- /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(V, {
4952
+ /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(U, {
4953
4953
  onClick: this.handleRetry,
4954
4954
  children: "Try again"
4955
4955
  }) })
@@ -4971,7 +4971,7 @@ function _a(e, t) {
4971
4971
  let n = ga(e, t), r = n[2];
4972
4972
  return He({
4973
4973
  queryKey: n,
4974
- queryFn: () => S(e, t),
4974
+ queryFn: () => x(e, t),
4975
4975
  enabled: !!e && !!t && t !== "new" && r !== void 0
4976
4976
  });
4977
4977
  }