@declarion/react 0.66.1 → 0.81.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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/api/auth.js +24 -14
  3. package/dist-lib/app.js +28 -23
  4. package/dist-lib/components/chrome/AssociationTabs.js +35 -38
  5. package/dist-lib/components/chrome/HighlightsStrip.js +2 -1
  6. package/dist-lib/components/chrome/RecordHeader.js +33 -38
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +10 -21
  8. package/dist-lib/components/detail-layout/ChildrenBlock.js +1 -8
  9. package/dist-lib/components/detail-layout/ChildrenCards.js +1 -8
  10. package/dist-lib/components/detail-layout/ChildrenList.js +1 -8
  11. package/dist-lib/components/detail-layout/ChildrenTable.js +1 -8
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +1 -8
  13. package/dist-lib/components/detail-layout/DetailAuditStrip.js +33 -29
  14. package/dist-lib/components/detail-layout/DetailHighlights.js +7 -2
  15. package/dist-lib/components/detail-layout/FieldsBlock.js +12 -9
  16. package/dist-lib/components/detail-layout/LayoutRenderer.js +10 -10
  17. package/dist-lib/components/detail-layout/LayoutTabs.js +49 -48
  18. package/dist-lib/components/detail-layout/SectionBlock.js +20 -28
  19. package/dist-lib/components/detail-layout/visibility.js +28 -0
  20. package/dist-lib/components/fields/IntArrayField.js +37 -33
  21. package/dist-lib/components/fields/NumberField.js +28 -55
  22. package/dist-lib/components/fields/RichTextField.js +1 -1
  23. package/dist-lib/components/fields/TimestampField.js +50 -89
  24. package/dist-lib/components/fields/cells/factories/date.js +13 -14
  25. package/dist-lib/components/fields/cells/factories/money.js +1 -1
  26. package/dist-lib/components/fields/cells/factories/number.js +4 -4
  27. package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
  28. package/dist-lib/components/file-widgets/Grid.js +153 -152
  29. package/dist-lib/components/file-widgets/ImageWidget.js +90 -91
  30. package/dist-lib/components/file-widgets/LabeledSlots.js +1 -0
  31. package/dist-lib/components/file-widgets/helpers.js +15 -19
  32. package/dist-lib/components/file-widgets/host.js +33 -32
  33. package/dist-lib/components/file-widgets/upload.js +10 -6
  34. package/dist-lib/components/layout/Layout.js +125 -123
  35. package/dist-lib/components/pages/NoScreensPage.impl.js +14 -0
  36. package/dist-lib/components/pages/NoScreensPage.js +12 -0
  37. package/dist-lib/components/pages/SmartDetailPage.impl.js +451 -451
  38. package/dist-lib/components/pages/auth/AuthShell.js +62 -61
  39. package/dist-lib/components/pages/auth/CodeInput.js +63 -0
  40. package/dist-lib/components/pages/auth/SignIn.js +12 -4
  41. package/dist-lib/components/pages/auth/SignUp.impl.js +80 -103
  42. package/dist-lib/components/pages/auth/SignUpCode.js +122 -0
  43. package/dist-lib/components/pages/auth/TwoFA.impl.js +9 -55
  44. package/dist-lib/components/pages/list/cardProjection.js +135 -122
  45. package/dist-lib/components/pages/list/columns.js +58 -43
  46. package/dist-lib/components/pages/profile/Profile.impl.js +87 -104
  47. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +1 -1
  48. package/dist-lib/components/params/ParamsBlock.js +6 -17
  49. package/dist-lib/components/params/param-editors.js +14 -10
  50. package/dist-lib/components/primitives/Fields.js +314 -236
  51. package/dist-lib/components/shared/MarkdownRenderer.js +44 -43
  52. package/dist-lib/declarion-react.css +1 -1
  53. package/dist-lib/hooks/useActiveTabFollowsRoute.js +49 -0
  54. package/dist-lib/hooks/useAuth.js +44 -37
  55. package/dist-lib/hooks/useDocumentTitle.js +20 -0
  56. package/dist-lib/hooks/useFollowAgentOpen.js +1 -0
  57. package/dist-lib/hooks/useTabTitle.js +1 -1
  58. package/dist-lib/index.d.ts +21 -7
  59. package/dist-lib/lib/date-text.js +57 -0
  60. package/dist-lib/lib/number-text.js +9 -0
  61. package/dist-lib/lib/timestamp.js +29 -29
  62. package/dist-lib/stores/tabs.js +7 -5
  63. package/dist-lib/testing.d.ts +1 -1
  64. package/dist-lib/testing.js +1 -0
  65. package/dist-lib/{useResponsiveMode-DmrpMbZX.d.ts → useResponsiveMode-D3SKz5z4.d.ts} +20 -9
  66. package/package.json +11 -11
@@ -9,14 +9,7 @@ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
9
  //#region src/components/detail-layout/ChildrenCards.tsx
10
10
  function l({ config: l, parentEntity: u, parentId: d, schema: f }) {
11
11
  let p = f.entities[l.entity], m = r(), h = r("errors"), { data: g, isLoading: _, isError: v } = i(u, d, l.entity, l.foreign_key, l.sort, l.limit), y = g?.data ?? [], b = g?.$refs, x = l.columns, S = l.cards, C = S?.header_field ?? x[0], w = S?.badge_field, T = S?.columns_count ?? 3;
12
- if (!p) return /* @__PURE__ */ s("div", {
13
- style: {
14
- fontSize: 12.5,
15
- color: "var(--text-3)",
16
- padding: "8px 0"
17
- },
18
- children: h("record.related_entity_not_found", "The related record type is not declared in this deployment.")
19
- });
12
+ if (!p) return null;
20
13
  let E = {
21
14
  display: "grid",
22
15
  gridTemplateColumns: `repeat(auto-fill, minmax(${T >= 4 ? 180 : 240}px, 1fr))`,
@@ -8,14 +8,7 @@ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
8
  //#region src/components/detail-layout/ChildrenList.tsx
9
9
  function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
10
10
  let f = d.entities[c.entity], p = n(), m = n("errors"), { data: h, isLoading: g, isError: _ } = r(l, u, c.entity, c.foreign_key, c.sort, c.limit), v = h?.data ?? [], y = h?.$refs, b = c.columns;
11
- if (!f) return /* @__PURE__ */ o("div", {
12
- style: {
13
- fontSize: 12.5,
14
- color: "var(--text-3)",
15
- padding: "8px 0"
16
- },
17
- children: m("record.related_entity_not_found", "The related record type is not declared in this deployment.")
18
- });
11
+ if (!f) return null;
19
12
  let x = /* @__PURE__ */ o(a, {
20
13
  config: c,
21
14
  parentEntity: l,
@@ -45,14 +45,7 @@ function w({ config: w, parentEntity: T, parentId: E, schema: D }) {
45
45
  D.screens,
46
46
  O
47
47
  ]);
48
- if (!A) return /* @__PURE__ */ S("div", {
49
- style: {
50
- fontSize: 12.5,
51
- color: "var(--text-3)",
52
- padding: "8px 0"
53
- },
54
- children: k("record.related_entity_not_found", "The related record type is not declared in this deployment.")
55
- });
48
+ if (!A) return null;
56
49
  let Y = /* @__PURE__ */ S(g, {
57
50
  config: w,
58
51
  parentEntity: T,
@@ -85,14 +85,7 @@ function L({ config: e, parentEntity: t, parentId: n, schema: r }) {
85
85
  d
86
86
  ]);
87
87
  let [J, Y] = C(null);
88
- if (!s) return /* @__PURE__ */ D("div", {
89
- style: {
90
- fontSize: 12.5,
91
- color: "var(--text-3)",
92
- padding: "8px 0"
93
- },
94
- children: o("record.related_entity_not_found", "The related record type is not declared in this deployment.")
95
- });
88
+ if (!s) return null;
96
89
  let X = e.quick_add?.fields ?? [h?.content_field].filter(Boolean), Z = i(s.display?.name_plural) || i(s.display?.name) || e.entity, Q = f ? /* @__PURE__ */ D("div", {
97
90
  style: {
98
91
  display: "flex",
@@ -1,40 +1,44 @@
1
1
  import { useText as e } from "../../hooks/useText.js";
2
- import { renderSchemaField as t } from "../file-widgets/host.js";
3
- import { AuditMetaStrip as n } from "../chrome/AuditMetaStrip.js";
4
- import { jsx as r } from "react/jsx-runtime";
2
+ import { RecordIdBadge as t } from "../primitives/RecordIdBadge.js";
3
+ import { renderSchemaField as n } from "../file-widgets/host.js";
4
+ import { AuditMetaStrip as r } from "../chrome/AuditMetaStrip.js";
5
+ import { jsx as i } from "react/jsx-runtime";
5
6
  //#region src/components/detail-layout/DetailAuditStrip.tsx
6
- function i({ screen: i, entity: a, entityCode: o, record: s, refs: c, schema: l }) {
7
- let u = e(), d = i.audit;
8
- if (d?.enabled === !1) return null;
9
- let f = (e) => {
10
- if (!e || !a.fields.get(e)) return;
11
- let n = s[e];
12
- if (n != null && n !== "") return t({
13
- entity: a,
14
- entityCode: o,
7
+ function a({ screen: a, entity: o, entityCode: s, record: c, recordId: l, refs: u, schema: d }) {
8
+ let f = e(), p = a.audit, m = l ? [{
9
+ label: f("record.audit.id", "ID"),
10
+ by: /* @__PURE__ */ i(t, { value: l })
11
+ }] : [];
12
+ if (p?.enabled === !1) return /* @__PURE__ */ i(r, { lines: m });
13
+ let h = (e) => {
14
+ if (!e || !o.fields.get(e)) return;
15
+ let t = c[e];
16
+ if (t != null && t !== "") return n({
17
+ entity: o,
18
+ entityCode: s,
15
19
  fieldName: e,
16
- record: s,
20
+ record: c,
17
21
  mode: "display",
18
- refs: c,
19
- entities: l.entities,
20
- screens: l.screens,
22
+ refs: u,
23
+ entities: d.entities,
24
+ screens: d.screens,
21
25
  surface: "list",
22
- t: u
26
+ t: f
23
27
  });
24
- }, p = d?.lines && d.lines.length > 0 ? d.lines.map((e) => ({
25
- label: u(e.label),
26
- at: f(e.at),
27
- by: f(e.by)
28
+ }, g = p?.lines && p.lines.length > 0 ? p.lines.map((e) => ({
29
+ label: f(e.label),
30
+ at: h(e.at),
31
+ by: h(e.by)
28
32
  })) : [{
29
- label: u("record.audit.created", "Created"),
30
- at: f("created_at"),
31
- by: f("created_by")
33
+ label: f("record.audit.created", "Created"),
34
+ at: h("created_at"),
35
+ by: h("created_by")
32
36
  }, {
33
- label: u("record.audit.updated", "Updated"),
34
- at: f("updated_at"),
35
- by: f("updated_by")
37
+ label: f("record.audit.updated", "Updated"),
38
+ at: h("updated_at"),
39
+ by: h("updated_by")
36
40
  }];
37
- return /* @__PURE__ */ r(n, { lines: p });
41
+ return /* @__PURE__ */ i(r, { lines: [...m, ...g] });
38
42
  }
39
43
  //#endregion
40
- export { i as DetailAuditStrip };
44
+ export { a as DetailAuditStrip };
@@ -6,7 +6,10 @@ import { copyableValue as a } from "./FieldRow.js";
6
6
  import { HighlightsStrip as o } from "../chrome/HighlightsStrip.js";
7
7
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region src/components/detail-layout/DetailHighlights.tsx
9
- function u({ screen: u, entity: d, entityCode: f, record: p, refs: m, objectStatuses: h, schema: g }) {
9
+ function u(e, t) {
10
+ return new Set((e.highlights ?? []).filter((e) => t.fields.get(e) || t.files?.get(e)));
11
+ }
12
+ function d({ screen: u, entity: d, entityCode: f, record: p, refs: m, objectStatuses: h, schema: g }) {
10
13
  let _ = t(), v = u.highlights;
11
14
  if (!v || v.length === 0) return null;
12
15
  let y = [];
@@ -15,6 +18,7 @@ function u({ screen: u, entity: d, entityCode: f, record: p, refs: m, objectStat
15
18
  if (o) {
16
19
  let n = h?.find((e) => e.group_code === t), r = n ? o.statuses.find((e) => e.code === n.status_code) : void 0;
17
20
  y.push({
21
+ code: t,
18
22
  label: _(o.name),
19
23
  value: r ? /* @__PURE__ */ c(e, {
20
24
  tone: r.color ?? "slate",
@@ -39,6 +43,7 @@ function u({ screen: u, entity: d, entityCode: f, record: p, refs: m, objectStat
39
43
  t: _
40
44
  }), o = a(d.fields.get(t), p[t]);
41
45
  y.push({
46
+ code: t,
42
47
  label: i(_, d, t, g.entities),
43
48
  value: o ? /* @__PURE__ */ l(s, { children: [e, /* @__PURE__ */ c(n, {
44
49
  value: o,
@@ -51,4 +56,4 @@ function u({ screen: u, entity: d, entityCode: f, record: p, refs: m, objectStat
51
56
  return y.length === 0 ? null : /* @__PURE__ */ c(o, { items: y });
52
57
  }
53
58
  //#endregion
54
- export { u as DetailHighlights };
59
+ export { d as DetailHighlights, u as highlightedFieldCodes };
@@ -6,12 +6,12 @@ import { ActionButton as s } from "../actions/ActionButton.js";
6
6
  import { FieldRow as c, FieldsGrid as l, SPAN_FIELD_TYPES as u, copyableValue as d } from "./FieldRow.js";
7
7
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
8
8
  //#region src/components/detail-layout/FieldsBlock.tsx
9
- function h({ fields: h, ctx: g }) {
10
- let _ = e(), { entity: v, entityCode: y, record: b, mode: x, onFieldChange: S, schema: C } = g, w = g.columns ?? 2, T = g.hideEmptyFields && x === "display" ? h.filter((e) => o(v, b, e.code)) : h, E = w === 1 && h.length === 1;
9
+ function h({ fields: o, ctx: h }) {
10
+ let _ = e(), { entity: v, entityCode: y, record: b, mode: x, onFieldChange: S, schema: C } = h, w = h.columns ?? 2, T = o.filter((e) => g(h, e.code)), E = w === 1 && o.length === 1;
11
11
  return T.length === 0 ? null : /* @__PURE__ */ p(l, {
12
12
  columns: w,
13
13
  children: T.map((e) => {
14
- let o = e.code, l = `${y ?? "field"}-${o}`, h = `${l}-label`, w = v.fields.get(o), T = !!(w?.auto || w?.readonly || w?.source), D = r(v, o), O = D?.read === "denied", k = D?.write === "denied", A = x === "display" ? O : k || O, j = T || x === "edit" && k ? "display" : x, M = A ? /* @__PURE__ */ p(t, {
14
+ let o = e.code, l = `${y ?? "field"}-${o}`, g = `${l}-label`, w = v.fields.get(o), T = !!(w?.auto || w?.readonly || w?.source), D = r(v, o), O = D?.read === "denied", k = D?.write === "denied", A = x === "display" ? O : k || O, j = T || x === "edit" && k ? "display" : x, M = A ? /* @__PURE__ */ p(t, {
15
15
  tier: D.classification,
16
16
  tierDef: n(C, v, o),
17
17
  requiredPermission: D?.required_permission,
@@ -23,12 +23,12 @@ function h({ fields: h, ctx: g }) {
23
23
  record: b,
24
24
  mode: j,
25
25
  onChange: S && !T ? (e) => S(o, e) : void 0,
26
- refs: g.refs,
26
+ refs: h.refs,
27
27
  entities: C?.entities,
28
28
  screens: C?.screens,
29
29
  t: _,
30
30
  fieldId: l,
31
- labelId: h,
31
+ labelId: g,
32
32
  structure: e.structure,
33
33
  detailScreen: e.detail_screen
34
34
  });
@@ -41,7 +41,7 @@ function h({ fields: h, ctx: g }) {
41
41
  variant: "ghost",
42
42
  size: "icon"
43
43
  }, t)) }) : void 0, P = !!w && u.has(w.type), F = j === "display" ? d(w, b?.[o]) : void 0, I = _(w?.display?.description);
44
- return E && (P || e.structure) ? /* @__PURE__ */ m("div", {
44
+ return E && (P || e.structure || v.files?.get(o)) ? /* @__PURE__ */ m("div", {
45
45
  style: { gridColumn: "1 / -1" },
46
46
  children: [M, j === "edit" && I && /* @__PURE__ */ p("div", {
47
47
  style: {
@@ -56,12 +56,12 @@ function h({ fields: h, ctx: g }) {
56
56
  "data-testid": `field-${o}`,
57
57
  label: a(_, v, o, C.entities),
58
58
  htmlFor: j === "edit" ? l : void 0,
59
- labelId: h,
59
+ labelId: g,
60
60
  labelTitle: I || void 0,
61
61
  required: w?.required ?? !1,
62
62
  mode: j,
63
63
  span: P,
64
- error: g.fieldErrors?.[o],
64
+ error: h.fieldErrors?.[o],
65
65
  hint: j === "edit" && I ? I : void 0,
66
66
  actions: N,
67
67
  copyValue: F,
@@ -70,5 +70,8 @@ function h({ fields: h, ctx: g }) {
70
70
  })
71
71
  });
72
72
  }
73
+ function g(e, t) {
74
+ return e.mode === "display" ? e.headerFields?.has(t) ? !1 : !e.hideEmptyFields || o(e.entity, e.record, t) : !0;
75
+ }
73
76
  //#endregion
74
- export { h as FieldsBlock };
77
+ export { h as FieldsBlock, g as displaysField };
@@ -1,10 +1,10 @@
1
1
  import { LayoutRow as e } from "./LayoutRow.js";
2
2
  import { LayoutColumn as t } from "./LayoutColumn.js";
3
- import { LayoutTabs as n } from "./LayoutTabs.js";
4
- import { SectionBlock as r } from "./SectionBlock.js";
5
- import { ChildrenBlock as i } from "./ChildrenBlock.js";
6
- import { AssociatedBlock as a } from "./AssociatedBlock.js";
7
- import { FieldsBlock as o } from "./FieldsBlock.js";
3
+ import { FieldsBlock as n } from "./FieldsBlock.js";
4
+ import { LayoutTabs as r } from "./LayoutTabs.js";
5
+ import { SectionBlock as i } from "./SectionBlock.js";
6
+ import { ChildrenBlock as a } from "./ChildrenBlock.js";
7
+ import { AssociatedBlock as o } from "./AssociatedBlock.js";
8
8
  import { PropertiesBlock as s } from "./PropertiesBlock.js";
9
9
  import { StatusesBlock as c } from "./StatusesBlock.js";
10
10
  import { WidgetHost as l } from "./widgets/WidgetHost.js";
@@ -24,19 +24,19 @@ function p({ node: u, ctx: f }) {
24
24
  config: u.column,
25
25
  node: u,
26
26
  ctx: f
27
- }) : u.tabs ? /* @__PURE__ */ d(n, {
27
+ }) : u.tabs ? /* @__PURE__ */ d(r, {
28
28
  config: u.tabs,
29
29
  ctx: f
30
- }) : u.section ? /* @__PURE__ */ d(r, {
30
+ }) : u.section ? /* @__PURE__ */ d(i, {
31
31
  config: u.section,
32
32
  ctx: f
33
- }) : u.children ? /* @__PURE__ */ d(i, {
33
+ }) : u.children ? /* @__PURE__ */ d(a, {
34
34
  node: u,
35
35
  ctx: f
36
- }) : u.associated ? /* @__PURE__ */ d(a, {
36
+ }) : u.associated ? /* @__PURE__ */ d(o, {
37
37
  node: u,
38
38
  ctx: f
39
- }) : u.fields ? /* @__PURE__ */ d(o, {
39
+ }) : u.fields ? /* @__PURE__ */ d(n, {
40
40
  fields: u.fields,
41
41
  ctx: f
42
42
  }) : u.properties == null ? u.statuses == null ? u.widget ? /* @__PURE__ */ d(l, {
@@ -2,24 +2,25 @@ import { useText as e } from "../../hooks/useText.js";
2
2
  import { useResponsiveMode as t } from "../../hooks/useResponsiveMode.js";
3
3
  import { DynamicIcon as n } from "../shared/DynamicIcon.js";
4
4
  import { resolveBlockIcon as r, resolveBlockLabel as i } from "./blockMeta.js";
5
- import { LayoutNodeRenderer as a } from "./LayoutRenderer.js";
6
- import { useState as o } from "react";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { layoutNodeShows as a } from "./visibility.js";
6
+ import { LayoutNodeRenderer as o } from "./LayoutRenderer.js";
7
+ import { useState as s } from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
9
  //#region src/components/detail-layout/LayoutTabs.tsx
9
- function l({ config: l, ctx: u }) {
10
- let d = e(), { items: f } = l, [p, m] = o(0), h = t(), g = u.detailTabsPresentation ?? (h.isPhone ? "sections" : "scroll");
11
- if (f.length === 0) return null;
12
- if (g === "sections") {
13
- let e = f.map((e, t) => `detail-tab-section-${t}`);
14
- return /* @__PURE__ */ c("div", {
10
+ function u({ config: u, ctx: d }) {
11
+ let f = e(), p = u.items.filter((e) => a(e, d)), [m, h] = s(0), g = t(), _ = d.detailTabsPresentation ?? (g.isPhone ? "sections" : "scroll");
12
+ if (p.length === 0) return null;
13
+ if (_ === "sections") {
14
+ let e = p.map((e, t) => `detail-tab-section-${t}`);
15
+ return /* @__PURE__ */ l("div", {
15
16
  style: {
16
17
  display: "flex",
17
18
  flexDirection: "column",
18
19
  gap: 10,
19
20
  minWidth: 0
20
21
  },
21
- children: [f.length > 1 && /* @__PURE__ */ s("nav", {
22
- "aria-label": d("record.tabs.sections", "Detail sections"),
22
+ children: [p.length > 1 && /* @__PURE__ */ c("nav", {
23
+ "aria-label": f("record.tabs.sections", "Detail sections"),
23
24
  style: {
24
25
  display: "flex",
25
26
  gap: 6,
@@ -27,9 +28,9 @@ function l({ config: l, ctx: u }) {
27
28
  padding: "0 2px 2px",
28
29
  WebkitOverflowScrolling: "touch"
29
30
  },
30
- children: f.map((t, a) => {
31
- let o = i(t, u, d), l = r(t, u);
32
- return /* @__PURE__ */ c("button", {
31
+ children: p.map((t, a) => {
32
+ let o = i(t, d, f), s = r(t, d);
33
+ return /* @__PURE__ */ l("button", {
33
34
  type: "button",
34
35
  onClick: () => document.getElementById(e[a])?.scrollIntoView({
35
36
  block: "start",
@@ -51,10 +52,10 @@ function l({ config: l, ctx: u }) {
51
52
  whiteSpace: "nowrap",
52
53
  cursor: "pointer"
53
54
  },
54
- children: [l && /* @__PURE__ */ s(n, {
55
- name: l,
55
+ children: [s && /* @__PURE__ */ c(n, {
56
+ name: s,
56
57
  size: 13
57
- }), /* @__PURE__ */ s("span", {
58
+ }), /* @__PURE__ */ c("span", {
58
59
  style: {
59
60
  overflow: "hidden",
60
61
  textOverflow: "ellipsis"
@@ -63,10 +64,10 @@ function l({ config: l, ctx: u }) {
63
64
  })]
64
65
  }, a);
65
66
  })
66
- }), f.map((t, o) => {
67
- let l = i(t, u, d), f = r(t, u);
68
- return /* @__PURE__ */ c("section", {
69
- id: e[o],
67
+ }), p.map((t, a) => {
68
+ let s = i(t, d, f), u = r(t, d);
69
+ return /* @__PURE__ */ l("section", {
70
+ id: e[a],
70
71
  style: {
71
72
  background: "var(--surface)",
72
73
  border: "1px solid var(--border)",
@@ -76,7 +77,7 @@ function l({ config: l, ctx: u }) {
76
77
  minWidth: 0,
77
78
  scrollMarginTop: 12
78
79
  },
79
- children: [/* @__PURE__ */ c("div", {
80
+ children: [/* @__PURE__ */ l("div", {
80
81
  style: {
81
82
  display: "flex",
82
83
  alignItems: "center",
@@ -87,31 +88,31 @@ function l({ config: l, ctx: u }) {
87
88
  fontSize: 13,
88
89
  fontWeight: 700
89
90
  },
90
- children: [f && /* @__PURE__ */ s(n, {
91
- name: f,
91
+ children: [u && /* @__PURE__ */ c(n, {
92
+ name: u,
92
93
  size: 14
93
- }), /* @__PURE__ */ s("span", {
94
+ }), /* @__PURE__ */ c("span", {
94
95
  style: { overflowWrap: "anywhere" },
95
- children: l
96
+ children: s
96
97
  })]
97
- }), /* @__PURE__ */ s("div", {
98
+ }), /* @__PURE__ */ c("div", {
98
99
  style: {
99
100
  padding: 14,
100
101
  minWidth: 0
101
102
  },
102
- children: /* @__PURE__ */ s(a, {
103
+ children: /* @__PURE__ */ c(o, {
103
104
  node: t,
104
105
  ctx: {
105
- ...u,
106
+ ...d,
106
107
  withinCard: !0
107
108
  }
108
109
  })
109
110
  })]
110
- }, o);
111
+ }, a);
111
112
  })]
112
113
  });
113
114
  }
114
- return /* @__PURE__ */ c("div", {
115
+ return /* @__PURE__ */ l("div", {
115
116
  style: {
116
117
  background: "var(--surface)",
117
118
  border: "1px solid var(--border)",
@@ -120,7 +121,7 @@ function l({ config: l, ctx: u }) {
120
121
  boxShadow: "var(--shadow-xs)",
121
122
  flexShrink: 0
122
123
  },
123
- children: [/* @__PURE__ */ s("div", {
124
+ children: [/* @__PURE__ */ c("div", {
124
125
  role: "tablist",
125
126
  style: {
126
127
  display: "flex",
@@ -130,13 +131,13 @@ function l({ config: l, ctx: u }) {
130
131
  padding: "6px 10px 0 10px",
131
132
  overflowX: "auto"
132
133
  },
133
- children: f.map((e, t) => {
134
- let a = i(e, u, d), o = r(e, u), l = t === p;
135
- return /* @__PURE__ */ c("button", {
134
+ children: p.map((e, t) => {
135
+ let a = i(e, d, f), o = r(e, d), s = t === m;
136
+ return /* @__PURE__ */ l("button", {
136
137
  role: "tab",
137
- "aria-selected": l,
138
+ "aria-selected": s,
138
139
  onClick: (e) => {
139
- e.stopPropagation(), m(t);
140
+ e.stopPropagation(), h(t);
140
141
  },
141
142
  style: {
142
143
  position: "relative",
@@ -150,23 +151,23 @@ function l({ config: l, ctx: u }) {
150
151
  fontSize: 12.5,
151
152
  fontWeight: 500,
152
153
  fontFamily: "inherit",
153
- color: l ? "var(--text)" : "var(--text-3)",
154
+ color: s ? "var(--text)" : "var(--text-3)",
154
155
  whiteSpace: "nowrap",
155
156
  transition: "color .12s"
156
157
  },
157
158
  onMouseEnter: (e) => {
158
- l || (e.currentTarget.style.color = "var(--text-2)");
159
+ s || (e.currentTarget.style.color = "var(--text-2)");
159
160
  },
160
161
  onMouseLeave: (e) => {
161
- l || (e.currentTarget.style.color = "var(--text-3)");
162
+ s || (e.currentTarget.style.color = "var(--text-3)");
162
163
  },
163
164
  children: [
164
- o && /* @__PURE__ */ s(n, {
165
+ o && /* @__PURE__ */ c(n, {
165
166
  name: o,
166
167
  size: 13
167
168
  }),
168
169
  a,
169
- l && /* @__PURE__ */ s("span", { style: {
170
+ s && /* @__PURE__ */ c("span", { style: {
170
171
  position: "absolute",
171
172
  left: 4,
172
173
  right: 4,
@@ -178,18 +179,18 @@ function l({ config: l, ctx: u }) {
178
179
  ]
179
180
  }, t);
180
181
  })
181
- }), /* @__PURE__ */ s("div", {
182
+ }), /* @__PURE__ */ c("div", {
182
183
  role: "tabpanel",
183
184
  style: { padding: 14 },
184
- children: /* @__PURE__ */ s(a, {
185
- node: f[p],
185
+ children: /* @__PURE__ */ c(o, {
186
+ node: p[m],
186
187
  ctx: {
187
- ...u,
188
+ ...d,
188
189
  withinCard: !0
189
190
  }
190
- }, p)
191
+ }, m)
191
192
  })]
192
193
  });
193
194
  }
194
195
  //#endregion
195
- export { l as LayoutTabs };
196
+ export { u as LayoutTabs };
@@ -1,48 +1,40 @@
1
1
  import { useText as e } from "../../hooks/useText.js";
2
2
  import { SectionCard as t } from "../primitives/SectionCard.js";
3
3
  import { DynamicIcon as n } from "../shared/DynamicIcon.js";
4
- import { schemaFieldHasValue as r } from "../file-widgets/host.js";
5
- import { LayoutRenderer as i } from "./LayoutRenderer.js";
6
- import { jsx as a } from "react/jsx-runtime";
4
+ import { sectionContext as r, sectionShows as i } from "./visibility.js";
5
+ import { LayoutRenderer as a } from "./LayoutRenderer.js";
6
+ import { jsx as o } from "react/jsx-runtime";
7
7
  //#region src/components/detail-layout/SectionBlock.tsx
8
- function o({ config: r, ctx: o }) {
9
- let c = e(), { name: l, items: u, collapsed: d = !1, columns: f, icon: p, badge: m, emphasis: h } = r, g = r.hide_empty_fields === !0 && o.mode === "display";
10
- if (g && !s(u, o)) return null;
11
- let _ = {
12
- ...o,
13
- withinCard: !0,
14
- ...f ? { columns: f } : null,
15
- ...g ? { hideEmptyFields: g } : null
16
- }, v = p ? /* @__PURE__ */ a(n, {
8
+ function s({ config: s, ctx: c }) {
9
+ let l = e(), { name: u, items: d, collapsed: f = !1, icon: p, badge: m, emphasis: h } = s, g = r(s, c);
10
+ if (!i(s, g)) return null;
11
+ let _ = p ? /* @__PURE__ */ o(n, {
17
12
  name: p,
18
13
  size: 14
19
- }) : void 0, y = m ? {
20
- text: c(m.text),
14
+ }) : void 0, v = m ? {
15
+ text: l(m.text),
21
16
  tone: m.tone,
22
17
  dot: m.dot
23
18
  } : void 0;
24
- return /* @__PURE__ */ a(t, {
25
- title: c(l),
26
- defaultOpen: !d,
27
- icon: v,
28
- badge: y,
19
+ return /* @__PURE__ */ o(t, {
20
+ title: l(u),
21
+ defaultOpen: !f,
22
+ icon: _,
23
+ badge: v,
29
24
  emphasis: h,
30
- headingLevel: o.withinCard ? 3 : 2,
31
- children: /* @__PURE__ */ a("div", {
25
+ headingLevel: c.withinCard ? 3 : 2,
26
+ children: /* @__PURE__ */ o("div", {
32
27
  style: {
33
28
  display: "flex",
34
29
  flexDirection: "column",
35
30
  gap: 12
36
31
  },
37
- children: /* @__PURE__ */ a(i, {
38
- nodes: u,
39
- ctx: _
32
+ children: /* @__PURE__ */ o(a, {
33
+ nodes: d,
34
+ ctx: g
40
35
  })
41
36
  })
42
37
  });
43
38
  }
44
- function s(e, t) {
45
- return e.some((e) => !e.fields || e.fields.some((e) => r(t.entity, t.record, e.code)));
46
- }
47
39
  //#endregion
48
- export { o as SectionBlock };
40
+ export { s as SectionBlock };
@@ -0,0 +1,28 @@
1
+ import { findChildRelation as e } from "../../lib/child-config.js";
2
+ import { displaysField as t } from "./FieldsBlock.js";
3
+ //#region src/components/detail-layout/visibility.ts
4
+ function n(a, o) {
5
+ if (a.children) {
6
+ let t = e(o.entity, a.children);
7
+ return !t || !!o.schema.entities[t.entity];
8
+ }
9
+ if (a.associated) return !!o.schema.entities[a.associated];
10
+ if (a.fields) return a.fields.some((e) => t(o, e.code));
11
+ if (a.section) return i(a.section, r(a.section, o));
12
+ let s = a.row ?? a.column ?? a.tabs;
13
+ return !s || s.items.some((e) => n(e, o));
14
+ }
15
+ function r(e, t) {
16
+ let n = e.hide_empty_fields === !0 && t.mode === "display";
17
+ return {
18
+ ...t,
19
+ withinCard: !0,
20
+ ...e.columns ? { columns: e.columns } : null,
21
+ ...n ? { hideEmptyFields: n } : null
22
+ };
23
+ }
24
+ function i(e, t) {
25
+ return e.items.length === 0 || e.items.some((e) => n(e, t));
26
+ }
27
+ //#endregion
28
+ export { n as layoutNodeShows, r as sectionContext, i as sectionShows };