@declarion/react 0.36.3 → 0.36.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { T as e } from "./ActionRunner-BrXXs8ga.js";
1
+ import { D as e } from "./useCurrentScreen-Bgp6_vne.js";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import r, { defaultUrlTransform as i } from "react-markdown";
4
4
  import a from "remark-breaks";
@@ -1,5 +1,5 @@
1
1
  import { s as e } from "./DynamicIcon-BWO6QtNF.js";
2
- import { Bn as t, Hn as n, Mn as r, Q as i, Un as a, Wn as o, Z as s, cn as c, ht as l, it as u, jn as d, kt as f, n as p, yn as m } from "./ActionRunner-BrXXs8ga.js";
2
+ import { $ as t, Gn as n, Hn as r, Kn as i, Nn as a, Pn as o, Wn as s, _t as c, et as l, i as u, jt as d, ot as f, un as p, xn as m } from "./useCurrentScreen-Bgp6_vne.js";
3
3
  import { useCallback as h, useEffect as g, useId as _, useMemo as v, useRef as y, useState as b } from "react";
4
4
  import { useLocation as x } from "react-router-dom";
5
5
  import { useQuery as S, useQueryClient as C } from "@tanstack/react-query";
@@ -182,7 +182,7 @@ function ce(e) {
182
182
  //#endregion
183
183
  //#region src/api/params.ts
184
184
  async function le() {
185
- let e = (await f("/api/params/public")).data;
185
+ let e = (await d("/api/params/public")).data;
186
186
  if (Array.isArray(e)) return { parameters: e };
187
187
  let t = e ?? {};
188
188
  return {
@@ -193,7 +193,7 @@ async function le() {
193
193
  };
194
194
  }
195
195
  async function z(e) {
196
- return (await f(`/api/params/${encodeURIComponent(e)}`)).data;
196
+ return (await d(`/api/params/${encodeURIComponent(e)}`)).data;
197
197
  }
198
198
  //#endregion
199
199
  //#region src/hooks/useParams.ts
@@ -214,7 +214,7 @@ function V(e, t = {}) {
214
214
  });
215
215
  }
216
216
  function H(e) {
217
- let t = l((e) => e.isAuthenticated), n = B(), r = V(e, { enabled: t }), i = ue(n.data?.parameters, e);
217
+ let t = c((e) => e.isAuthenticated), n = B(), r = V(e, { enabled: t }), i = ue(n.data?.parameters, e);
218
218
  if (t && r.data?.found) return {
219
219
  value: r.data.value,
220
220
  found: !0,
@@ -394,11 +394,11 @@ function me(e) {
394
394
  return e.length > 1 && e.endsWith("/") ? e.replace(/\/+$/, "") || "/" : e;
395
395
  }
396
396
  function Q(e) {
397
- let t = me(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, a = new URLSearchParams(r);
398
- for (let e of i) a.delete(e);
399
- a.sort();
400
- let o = a.toString();
401
- return o ? `${t}?${o}` : t;
397
+ let t = me(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
398
+ for (let e of l) i.delete(e);
399
+ i.sort();
400
+ let a = i.toString();
401
+ return a ? `${t}?${a}` : t;
402
402
  }
403
403
  function he(e) {
404
404
  return me(e.pathname);
@@ -453,20 +453,20 @@ var Ce = "record-documents";
453
453
  //#endregion
454
454
  //#region src/hooks/useBrandingChrome.ts
455
455
  function we() {
456
- let e = s(), t = G();
457
- return (e.enabled ? t?.embed?.viewport : t?.full?.viewport) ?? "auto";
456
+ let e = t(), n = G();
457
+ return (e.enabled ? n?.embed?.viewport : n?.full?.viewport) ?? "auto";
458
458
  }
459
459
  function Te(e) {
460
- let t = s(), n = G();
460
+ let n = t(), r = G();
461
461
  return v(() => {
462
- let r = { ...t.enabled ? n?.embed?.surfaces?.[e] : n?.full?.surfaces?.[e] };
462
+ let t = { ...n.enabled ? r?.embed?.surfaces?.[e] : r?.full?.surfaces?.[e] };
463
463
  return {
464
- ...r,
465
- isVisible: (e) => r[e] !== !1
464
+ ...t,
465
+ isVisible: (e) => t[e] !== !1
466
466
  };
467
467
  }, [
468
- n,
469
- t.enabled,
468
+ r,
469
+ n.enabled,
470
470
  e
471
471
  ]);
472
472
  }
@@ -499,19 +499,19 @@ function ke(e, t) {
499
499
  //#endregion
500
500
  //#region src/components/pages/DocumentsMenu.tsx
501
501
  var Ae = "document-templates-available";
502
- function je({ entityCode: n, scope: i, objectIds: a = [], viewState: s, selectedIds: l = [], capability: d, canManageTemplates: f = !1 }) {
503
- let { run: m } = p(), h = y(null), [g, _] = b(!1), x = i === "detail" ? !!d?.generate_one : !!d?.generate_many, C = f && !x, { data: D, isLoading: O, error: k } = S({
504
- queryKey: [Ae, n],
505
- queryFn: async () => (await u("document.templates.available", { entity: n })).result?.templates ?? [],
502
+ function je({ entityCode: t, scope: n, objectIds: a = [], viewState: s, selectedIds: c = [], capability: l, canManageTemplates: d = !1 }) {
503
+ let { run: m } = u(), h = y(null), [g, _] = b(!1), x = n === "detail" ? !!l?.generate_one : !!l?.generate_many, C = d && !x, { data: D, isLoading: O, error: k } = S({
504
+ queryKey: [Ae, t],
505
+ queryFn: async () => (await f("document.templates.available", { entity: t })).result?.templates ?? [],
506
506
  enabled: g || C,
507
507
  staleTime: 6e4
508
- }), A = O, j = v(() => (D ?? []).filter((e) => i === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [i, D]), M = C && j.length > 0, N = x || M;
508
+ }), A = O, j = v(() => (D ?? []).filter((e) => n === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [n, D]), M = C && j.length > 0, N = x || M;
509
509
  function P() {
510
510
  _((e) => !e);
511
511
  }
512
512
  function F(e) {
513
513
  if (e.input_mode === "global") return [{ kind: "global" }];
514
- if (i === "detail") return e.input_mode === "one" && a.length === 1 ? [{
514
+ if (n === "detail") return e.input_mode === "one" && a.length === 1 ? [{
515
515
  kind: "one",
516
516
  objectIds: a
517
517
  }] : [];
@@ -520,15 +520,15 @@ function je({ entityCode: n, scope: i, objectIds: a = [], viewState: s, selected
520
520
  return s && e.push({
521
521
  kind: "current_view",
522
522
  query: Oe(s)
523
- }), l.length > 0 && e.push({
523
+ }), c.length > 0 && e.push({
524
524
  kind: "selected",
525
- objectIds: l
525
+ objectIds: c
526
526
  }), e;
527
527
  }
528
528
  return [];
529
529
  }
530
530
  function I(e, t, n) {
531
- let r = Me(e), i = c(e.name) || e.code;
531
+ let r = Me(e), i = p(e.name) || e.code;
532
532
  _(!1), m({
533
533
  action: r,
534
534
  title: i,
@@ -541,11 +541,11 @@ function je({ entityCode: n, scope: i, objectIds: a = [], viewState: s, selected
541
541
  return Object.keys(r).length > 0 && (i.params = r), "objectIds" in t && (i.object_ids = t.objectIds), "query" in t && (i.query = {
542
542
  scope: "current_view",
543
543
  query: t.query
544
- }), u("document.generate", i);
544
+ }), f("document.generate", i);
545
545
  }
546
546
  });
547
547
  }
548
- return N ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(o, {
548
+ return N ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(i, {
549
549
  ref: h,
550
550
  kind: "ghost",
551
551
  size: "sm",
@@ -553,45 +553,45 @@ function je({ entityCode: n, scope: i, objectIds: a = [], viewState: s, selected
553
553
  onClick: P,
554
554
  disabled: A,
555
555
  children: "Generate"
556
- }), /* @__PURE__ */ E(t, {
556
+ }), /* @__PURE__ */ E(r, {
557
557
  open: g,
558
558
  anchor: h.current,
559
559
  onClose: () => _(!1),
560
560
  align: "end",
561
561
  width: 300,
562
562
  children: [
563
- A && /* @__PURE__ */ T(r, {
563
+ A && /* @__PURE__ */ T(o, {
564
564
  disabled: !0,
565
565
  icon: /* @__PURE__ */ T(e.loader, { size: 12 }),
566
566
  children: "Loading templates..."
567
567
  }),
568
- k && /* @__PURE__ */ T(r, {
568
+ k && /* @__PURE__ */ T(o, {
569
569
  disabled: !0,
570
570
  icon: /* @__PURE__ */ T(e.warning, { size: 12 }),
571
571
  children: k instanceof Error ? k.message : String(k)
572
572
  }),
573
- !A && !k && j.length === 0 && /* @__PURE__ */ T(r, {
573
+ !A && !k && j.length === 0 && /* @__PURE__ */ T(o, {
574
574
  disabled: !0,
575
575
  icon: /* @__PURE__ */ T(e.file, { size: 12 }),
576
576
  children: "No document templates"
577
577
  }),
578
578
  !A && !k && j.map((t) => {
579
579
  let n = F(t);
580
- return n.length === 0 ? null : Ne(t).flatMap((i) => n.map((n) => i.available ? /* @__PURE__ */ T(r, {
580
+ return n.length === 0 ? null : Ne(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ T(o, {
581
581
  icon: /* @__PURE__ */ T(e.file, { size: 12 }),
582
- onClick: () => I(t, n, i.format),
583
- title: c(t.description),
584
- children: Pe(t, n, i.format)
585
- }, `${t.source}:${t.code}:${n.kind}:${i.format}`) : /* @__PURE__ */ E(r, {
582
+ onClick: () => I(t, n, r.format),
583
+ title: p(t.description),
584
+ children: Pe(t, n, r.format)
585
+ }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ E(o, {
586
586
  disabled: !0,
587
587
  icon: /* @__PURE__ */ T(e.file, { size: 12 }),
588
- title: i.disabled_reason,
588
+ title: r.disabled_reason,
589
589
  children: [
590
- Pe(t, n, i.format),
590
+ Pe(t, n, r.format),
591
591
  " - ",
592
- i.disabled_reason || "Unavailable"
592
+ r.disabled_reason || "Unavailable"
593
593
  ]
594
- }, `${t.source}:${t.code}:${n.kind}:${i.format}:disabled`)));
594
+ }, `${t.source}:${t.code}:${n.kind}:${r.format}:disabled`)));
595
595
  })
596
596
  ]
597
597
  })] }) : null;
@@ -618,7 +618,7 @@ function Ne(e) {
618
618
  }));
619
619
  }
620
620
  function Pe(e, t, n) {
621
- let r = c(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
621
+ let r = p(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
622
622
  switch (t.kind) {
623
623
  case "one": return `${r}${i}`;
624
624
  case "selected": return `${r}${i} - selected rows`;
@@ -808,11 +808,11 @@ function Ze({ liveObject: t, realtime: r = !0 }) {
808
808
  alignItems: "center",
809
809
  gap: 8
810
810
  },
811
- children: [/* @__PURE__ */ T(a, {
811
+ children: [/* @__PURE__ */ T(n, {
812
812
  icon: t.isFetching ? /* @__PURE__ */ T("span", {
813
813
  "data-testid": "refresh-spinner",
814
814
  style: { display: "inline-flex" },
815
- children: /* @__PURE__ */ T(d, { size: 14 })
815
+ children: /* @__PURE__ */ T(a, { size: 14 })
816
816
  }) : /* @__PURE__ */ T(e.refresh, { size: 14 }),
817
817
  title: "Refresh",
818
818
  disabled: t.isLoading || t.isFetching,
@@ -822,7 +822,7 @@ function Ze({ liveObject: t, realtime: r = !0 }) {
822
822
  }), r && /* @__PURE__ */ T("span", {
823
823
  "data-testid": "live-indicator",
824
824
  title: t.isLive ? "This view updates automatically in realtime." : "Realtime updates are paused. Refresh manually to load the latest data.",
825
- children: /* @__PURE__ */ T(n, {
825
+ children: /* @__PURE__ */ T(s, {
826
826
  tone: t.isLive ? "emerald" : "amber",
827
827
  size: "xs",
828
828
  dot: !0,