@nivaro/react 0.2.53 → 0.2.54

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 (191) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +113 -2
  4. package/dist/layout-editor.d.ts +248 -2
  5. package/dist/shared/components/FormWhatsNew.js +60 -0
  6. package/dist/shared/components/ItemEditForm.js +4058 -3942
  7. package/dist/shared/components/RecordReadView.js +219 -211
  8. package/dist/shared/components/TipLayer.js +27 -27
  9. package/dist/shared/components/help-videos/api.js +51 -41
  10. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  11. package/dist/shared/components/item-edit/FieldAffordances.js +7 -6
  12. package/dist/shared/components/item-edit/FieldRow.js +353 -304
  13. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  14. package/dist/shared/components/item-edit/GroupSection.js +419 -396
  15. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  16. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  17. package/dist/shared/components/item-edit/lock-why.js +87 -0
  18. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -0
  19. package/dist/shared/components/layout-editor/AddPanel.js +204 -146
  20. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  21. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  22. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  23. package/dist/shared/components/layout-editor/ChangeNote.js +146 -0
  24. package/dist/shared/components/layout-editor/CollabParts.js +170 -0
  25. package/dist/shared/components/layout-editor/DesignNode.js +304 -115
  26. package/dist/shared/components/layout-editor/EditorCanvas.js +21 -20
  27. package/dist/shared/components/layout-editor/EditorTopBar.js +452 -175
  28. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  29. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  30. package/dist/shared/components/layout-editor/HistoryPanel.js +234 -109
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +1101 -307
  32. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  33. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  34. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  35. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  36. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  37. package/dist/shared/components/layout-editor/StructureMenu.js +413 -0
  38. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  39. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  40. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  41. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  42. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  43. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  44. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  45. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  46. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  47. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  48. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  49. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  50. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  51. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  52. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  53. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  54. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  55. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  56. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  57. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  58. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  59. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  60. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  61. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  62. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  63. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  64. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  65. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  66. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  67. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  68. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  69. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  70. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  71. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  72. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  73. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  74. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  75. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  76. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +342 -0
  77. package/dist/shared/components/layout-editor/collab/collab-api.js +77 -0
  78. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  79. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  80. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  81. package/dist/shared/components/layout-editor/design-context.js +26 -6
  82. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +179 -163
  83. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  84. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  85. package/dist/shared/components/layout-editor/draft-recovery.js +61 -0
  86. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  87. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  88. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  89. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  90. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  91. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  92. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  93. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  94. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  95. package/dist/shared/components/layout-editor/form-map.js +138 -0
  96. package/dist/shared/components/layout-editor/history-api.js +87 -0
  97. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  98. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  99. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  100. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  101. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  102. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  103. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +175 -0
  104. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  105. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +146 -92
  106. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  107. package/dist/shared/components/layout-editor/inspector/Inspector.js +256 -175
  108. package/dist/shared/components/layout-editor/inspector/LookTab.js +46 -40
  109. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  110. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  111. package/dist/shared/components/layout-editor/inspector/PickerTab.js +167 -141
  112. package/dist/shared/components/layout-editor/inspector/RulesTab.js +175 -128
  113. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  114. package/dist/shared/components/layout-editor/inspector/kit.js +3 -3
  115. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  116. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  117. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  118. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  119. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  120. package/dist/shared/components/layout-editor/load-error.js +37 -0
  121. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  122. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  123. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  124. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  125. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  126. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  127. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  128. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  129. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  130. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  131. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  132. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  133. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  134. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  135. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  136. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  137. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  138. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  139. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  140. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  141. package/dist/shared/components/layout-editor/overview/describe-conditions.js +18 -14
  142. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  143. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  144. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  145. package/dist/shared/components/layout-editor/pin.js +25 -0
  146. package/dist/shared/components/layout-editor/presence.js +111 -0
  147. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  148. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  149. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  150. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  151. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  152. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  153. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  154. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  155. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  156. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  157. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  158. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  159. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  160. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  161. package/dist/shared/components/layout-editor/settings/FormSettings.js +123 -103
  162. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  163. package/dist/shared/components/layout-editor/settings/ToolsSection.js +174 -100
  164. package/dist/shared/components/layout-editor/settings/WhoSection.js +136 -100
  165. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  166. package/dist/shared/components/layout-editor/settings/settings-registry.js +35 -11
  167. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  168. package/dist/shared/components/layout-editor/show-when.js +35 -0
  169. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  170. package/dist/shared/components/layout-editor/structure-ops.js +399 -0
  171. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  172. package/dist/shared/components/layout-editor/testing/TestingPanels.js +551 -0
  173. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  174. package/dist/shared/components/layout-editor/testing/testing-model.js +393 -0
  175. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  176. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  177. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  178. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  179. package/dist/shared/components/layout-editor/usage/UsagePanel.js +158 -0
  180. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  181. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  182. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -307
  183. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  184. package/dist/shared/lib/ai-fill.js +37 -0
  185. package/dist/shared/lib/form-usage-beacon.js +84 -0
  186. package/dist/shared/lib/layout-i18n.js +66 -0
  187. package/dist/shared/lib/layout-lint.js +490 -0
  188. package/dist/shared/lib/layout-ops.js +110 -106
  189. package/dist/shared/lib/screenshot.js +54 -28
  190. package/dist/shared/lib/visible-when.js +34 -0
  191. package/package.json +1 -1
@@ -1,108 +1,110 @@
1
- import { jsxs as s, Fragment as X, jsx as t } from "react/jsx-runtime";
2
- import { useQuery as A } from "@tanstack/react-query";
3
- import { useState as Y, useEffect as Z, useContext as ee } from "react";
4
- import { useNivaroClient as M } from "../../../context.js";
5
- import { get as L } from "../../../lib/commands.js";
6
- import { CascadeFiltersEditor as le } from "../editors/cascade-filters.js";
7
- import { editorQueryKeys as oe } from "../editors/editor-queries.js";
8
- import { useFieldCtx as te } from "./field-context.js";
9
- import { useGlobalValue as g, GlobalWriterContext as ie, Toggle as p, Setting as u, TextInput as ne, Section as O, Choice as $ } from "./kit.js";
10
- import { asObject as ae, asArray as re, relKindOf as de, describeField as se, withKey as ce } from "./model.js";
11
- function fe(l) {
12
- const o = M();
13
- return A({
14
- queryKey: oe.relationsFor(l),
15
- queryFn: () => o.request(L(`/data-model/relations/for/${l}`)).then((r) => Array.isArray(r.data) ? r.data : []),
16
- enabled: !!l,
1
+ import { jsxs as c, Fragment as Y, jsx as t } from "react/jsx-runtime";
2
+ import { useQuery as E } from "@tanstack/react-query";
3
+ import { useState as Z, useEffect as ee, useContext as oe } from "react";
4
+ import { useNivaroClient as K } from "../../../context.js";
5
+ import { get as j } from "../../../lib/commands.js";
6
+ import { CascadeWriter as le } from "../ai-rules/CascadeWriter.js";
7
+ import { CascadeFiltersEditor as te } from "../editors/cascade-filters.js";
8
+ import { editorQueryKeys as ie } from "../editors/editor-queries.js";
9
+ import { useFieldCtx as ne } from "./field-context.js";
10
+ import { useGlobalValue as m, GlobalWriterContext as ae, Toggle as g, Setting as _, TextInput as re, Section as $, Choice as x } from "./kit.js";
11
+ import { asObject as de, asArray as se, relKindOf as ce, describeField as fe, withKey as F } from "./model.js";
12
+ import { PickerPreview as pe } from "./PickerPreview.js";
13
+ function ue(o) {
14
+ const l = K();
15
+ return E({
16
+ queryKey: ie.relationsFor(o),
17
+ queryFn: () => l.request(j(`/data-model/relations/for/${o}`)).then((d) => Array.isArray(d.data) ? d.data : []),
18
+ enabled: !!o,
17
19
  staleTime: 5 * 6e4
18
20
  });
19
21
  }
20
- function pe(l) {
21
- const o = M();
22
- return A({
23
- queryKey: ["layout-editor", "layouts-of", l],
24
- queryFn: () => o.request(
25
- L("/collection-layouts", { collection: l })
26
- ).then((r) => Array.isArray(r.data) ? r.data : []),
27
- enabled: !!l,
22
+ function he(o) {
23
+ const l = K();
24
+ return E({
25
+ queryKey: ["layout-editor", "layouts-of", o],
26
+ queryFn: () => l.request(
27
+ j("/collection-layouts", { collection: o })
28
+ ).then((d) => Array.isArray(d.data) ? d.data : []),
29
+ enabled: !!o,
28
30
  staleTime: 6e4
29
31
  });
30
32
  }
31
- function x(l) {
32
- const o = l.trim();
33
- if (!o) return null;
34
- const r = /^(\d{1,3})%$/.exec(o);
35
- if (r) {
36
- const a = Number(r[1]);
33
+ function S(o) {
34
+ const l = o.trim();
35
+ if (!l) return null;
36
+ const d = /^(\d{1,3})%$/.exec(l);
37
+ if (d) {
38
+ const a = Number(d[1]);
37
39
  return a >= 10 && a <= 96 ? `${a}%` : "invalid";
38
40
  }
39
- if (/^\d+$/.test(o)) {
40
- const a = Number(o);
41
+ if (/^\d+$/.test(l)) {
42
+ const a = Number(l);
41
43
  return a >= 320 && a <= 2e3 ? a : "invalid";
42
44
  }
43
45
  return "invalid";
44
46
  }
45
- function Ce() {
46
- var P;
47
- const l = te(), { info: o, ov: r, opts: a, env: b, globalOptions: d, globalDependency: E } = l, i = o.label, c = o.relKind === "M2O", h = o.relKind === "M2M", _ = o.iface === "relation-path" || o.isPath, S = o.iface === "file-image" || o.iface === "files-m2m", F = o.iface === "relation-grouped", f = ae(r.drilldown), m = f.enabled ?? _, K = o.relatedCollection ?? (typeof d.path_target_collection == "string" ? d.path_target_collection : null), { data: q = [] } = pe(c || h || _ ? K : null), j = q.filter((e) => e.layout_type === "detail"), y = f.width == null ? "" : String(f.width), [G, T] = Y(y);
48
- Z(() => {
49
- T((e) => {
50
- const n = x(e);
51
- return (n === null ? "" : String(n)) === y ? e : y;
47
+ function Fe() {
48
+ var L;
49
+ const o = ne(), { info: l, ov: d, opts: a, env: p, globalOptions: r, globalDependency: q } = o, n = l.label, f = l.relKind === "M2O", u = l.relKind === "M2M", b = l.iface === "relation-path" || l.isPath, G = l.iface === "file-image" || l.iface === "files-m2m", P = l.iface === "relation-grouped", h = de(d.drilldown), y = h.enabled ?? b, W = l.relatedCollection ?? (typeof r.path_target_collection == "string" ? r.path_target_collection : null), { data: D = [] } = he(f || u || b ? W : null), R = D.filter((e) => e.layout_type === "detail"), w = h.width == null ? "" : String(h.width), [A, N] = Z(w);
50
+ ee(() => {
51
+ N((e) => {
52
+ const i = S(e);
53
+ return (i === null ? "" : String(i)) === w ? e : w;
52
54
  });
53
- }, [y]);
54
- const D = x(G), k = (e, n, w) => l.setOverride("drilldown", { ...f, enabled: m, ...e }, n, w), { data: W = [] } = fe(F ? o.relatedCollection : null), N = W.filter(
55
- (e) => e.many_collection === o.relatedCollection && e.many_field && !e.junction_field
56
- ).map((e) => ({ value: e.many_field, label: `${e.many_field} → ${e.one_collection}` })), R = g(
55
+ }, [w]);
56
+ const I = S(A), k = (e, i, s) => o.setOverride("drilldown", { ...h, enabled: y, ...e }, i, s), { data: Q = [] } = ue(P ? l.relatedCollection : null), T = Q.filter(
57
+ (e) => e.many_collection === l.relatedCollection && e.many_field && !e.junction_field
58
+ ).map((e) => ({ value: e.many_field, label: `${e.many_field} → ${e.one_collection}` })), B = m(
57
59
  "field.group_field",
58
- typeof d.group_field == "string" ? d.group_field : ""
59
- ), Q = g(
60
+ typeof r.group_field == "string" ? r.group_field : ""
61
+ ), U = m(
60
62
  "field.option_field",
61
- typeof d.option_field == "string" ? d.option_field : ""
62
- ), B = (P = ee(ie)) == null ? void 0 : P.draft.dependency_config, I = re((B ?? E).cascade_filters), v = new Set(l.globals.map((e) => e.field));
63
- for (const e of l.relations)
64
- e.one_field && e.one_field !== "id" && e.one_collection === b.collection && v.add(e.one_field), e.many_field && e.many_collection === b.collection && v.add(e.many_field);
65
- const U = [...v].filter((e) => e !== o.field).map((e) => ({ f: e, kind: de(e, l.relations) })).filter((e) => e.kind === "M2O" || e.kind === "M2M").map(({ f: e, kind: n }) => {
66
- const w = b.bundle.placements.find((J) => J.field === e) ?? null;
63
+ typeof r.option_field == "string" ? r.option_field : ""
64
+ ), V = (L = oe(ae)) == null ? void 0 : L.draft.dependency_config, v = se((V ?? q).cascade_filters), C = new Set(o.globals.map((e) => e.field));
65
+ for (const e of o.relations)
66
+ e.one_field && e.one_field !== "id" && e.one_collection === p.collection && C.add(e.one_field), e.many_field && e.many_collection === p.collection && C.add(e.many_field);
67
+ const M = [...C].filter((e) => e !== l.field).map((e) => ({ f: e, kind: ce(e, o.relations) })).filter((e) => e.kind === "M2O" || e.kind === "M2M").map(({ f: e, kind: i }) => {
68
+ const s = p.bundle.placements.find((X) => X.field === e) ?? null;
67
69
  return {
68
70
  field: e,
69
- label: se(e, l.globals, l.relations, w).label,
70
- kind: n
71
+ label: fe(e, o.globals, o.relations, s).label,
72
+ kind: i
71
73
  };
72
- }).sort((e, n) => e.label.localeCompare(n.label)), C = (e, n) => typeof d[e] == "boolean" ? d[e] : n, V = g("field.allow_upload", C("allow_upload", !0)), z = g("field.allow_pick", C("allow_pick", !0)), H = g("field.pending_save", C("pending_save", !1));
73
- return /* @__PURE__ */ s("div", { className: "space-y-5", children: [
74
- (c || h) && /* @__PURE__ */ s(X, { children: [
74
+ }).sort((e, i) => e.label.localeCompare(i.label)), O = (e, i) => typeof r[e] == "boolean" ? r[e] : i, z = m("field.allow_upload", O("allow_upload", !0)), H = m("field.allow_pick", O("allow_pick", !0)), J = m("field.pending_save", O("pending_save", !1));
75
+ return /* @__PURE__ */ c("div", { className: "space-y-5", children: [
76
+ (f || u) && /* @__PURE__ */ c(Y, { children: [
75
77
  /* @__PURE__ */ t(
76
- p,
78
+ g,
77
79
  {
78
80
  k: "field.inline_relation",
79
81
  label: "Edit the related record here",
80
82
  effect: "Shows the picked record’s fields inline so people can change them without leaving.",
81
83
  checked: a.inline_relation === !0,
82
- onChange: (e) => l.setOption(
84
+ onChange: (e) => o.setOption(
83
85
  "inline_relation",
84
86
  e ? !0 : void 0,
85
- e ? `Edit ${i} inline` : `Stop editing ${i} inline`
87
+ e ? `Edit ${n} inline` : `Stop editing ${n} inline`
86
88
  )
87
89
  }
88
90
  ),
89
91
  /* @__PURE__ */ t(
90
- u,
92
+ _,
91
93
  {
92
94
  k: "field.option_sort",
93
95
  label: "Order of the options",
94
96
  effect: 'Columns of the related record, "-" for descending; "label" sorts by what people read.',
95
97
  children: /* @__PURE__ */ t(
96
- ne,
98
+ re,
97
99
  {
98
100
  ariaLabel: "Order of the options",
99
101
  mono: !0,
100
102
  value: typeof a.option_sort == "string" ? a.option_sort : "",
101
103
  placeholder: "-year, name",
102
- onChange: (e) => l.setOption(
104
+ onChange: (e) => o.setOption(
103
105
  "option_sort",
104
106
  e.trim() ? e : void 0,
105
- `Change the order of ${i} options`,
107
+ `Change the order of ${n} options`,
106
108
  !0
107
109
  )
108
110
  }
@@ -110,58 +112,59 @@ function Ce() {
110
112
  }
111
113
  )
112
114
  ] }),
113
- c && /* @__PURE__ */ t(
114
- p,
115
+ f && /* @__PURE__ */ t(
116
+ g,
115
117
  {
116
118
  k: "field.enforce_picker_rules",
117
119
  label: "Refuse values the picker would not offer",
118
120
  effect: "The server rejects a value outside the cascade filters and option filters, from any writer.",
119
121
  enforced: !0,
120
122
  checked: a.enforce_picker_rules === !0,
121
- onChange: (e) => l.setOption(
123
+ onChange: (e) => o.setOption(
122
124
  "enforce_picker_rules",
123
125
  e ? !0 : void 0,
124
- e ? `Enforce the picker rules of ${i}` : `Stop enforcing the picker rules of ${i}`
126
+ e ? `Enforce the picker rules of ${n}` : `Stop enforcing the picker rules of ${n}`
125
127
  )
126
128
  }
127
129
  ),
128
- (c || h || _) && /* @__PURE__ */ s(O, { title: "Detail panel", children: [
130
+ (f || u) && l.iface !== "files-m2m" && /* @__PURE__ */ t(pe, { rules: v }),
131
+ (f || u || b) && /* @__PURE__ */ c($, { title: "Detail panel", children: [
129
132
  /* @__PURE__ */ t(
130
- p,
133
+ g,
131
134
  {
132
135
  k: "field.drilldown.enabled",
133
136
  label: "Click the value to open it",
134
137
  effect: "Opens the related record in a side panel.",
135
- checked: m,
138
+ checked: y,
136
139
  onChange: (e) => k(
137
140
  { enabled: e },
138
- e ? `Open ${i} in a panel` : `Stop opening ${i} in a panel`
141
+ e ? `Open ${n} in a panel` : `Stop opening ${n} in a panel`
139
142
  )
140
143
  }
141
144
  ),
142
145
  /* @__PURE__ */ t(
143
- u,
146
+ _,
144
147
  {
145
148
  k: "field.drilldown.layout_id",
146
149
  label: "Panel layout",
147
150
  effect: "The layout the side panel shows the record with.",
148
151
  children: /* @__PURE__ */ t(
149
- $,
152
+ x,
150
153
  {
151
154
  ariaLabel: "Panel layout",
152
- disabled: !m,
153
- value: f.layout_id == null ? "" : String(f.layout_id),
155
+ disabled: !y,
156
+ value: h.layout_id == null ? "" : String(h.layout_id),
154
157
  options: [
155
158
  { value: "", label: "The default detail view" },
156
- ...j.map((e) => ({ value: String(e.id), label: e.name }))
159
+ ...R.map((e) => ({ value: String(e.id), label: e.name }))
157
160
  ],
158
- onChange: (e) => k({ layout_id: e ? Number(e) : null }, `Change the panel layout of ${i}`)
161
+ onChange: (e) => k({ layout_id: e ? Number(e) : null }, `Change the panel layout of ${n}`)
159
162
  }
160
163
  )
161
164
  }
162
165
  ),
163
- /* @__PURE__ */ s(
164
- u,
166
+ /* @__PURE__ */ c(
167
+ _,
165
168
  {
166
169
  k: "field.drilldown.width",
167
170
  label: "Panel width",
@@ -171,42 +174,42 @@ function Ce() {
171
174
  "input",
172
175
  {
173
176
  "aria-label": "Panel width",
174
- disabled: !m,
175
- value: G,
177
+ disabled: !y,
178
+ value: A,
176
179
  placeholder: "60%",
177
180
  onChange: (e) => {
178
- T(e.target.value);
179
- const n = x(e.target.value);
180
- n !== "invalid" && k({ width: n }, `Change the panel width of ${i}`, !0);
181
+ N(e.target.value);
182
+ const i = S(e.target.value);
183
+ i !== "invalid" && k({ width: i }, `Change the panel width of ${n}`, !0);
181
184
  },
182
- onBlur: () => b.flush(),
185
+ onBlur: () => p.flush(),
183
186
  className: "h-7 w-full rounded-md border border-slate-200 bg-white px-2 font-mono text-[12px] focus:border-nvr-cyan focus:outline-none disabled:opacity-40 dark:border-border dark:bg-card"
184
187
  }
185
188
  ),
186
- D === "invalid" && /* @__PURE__ */ t("p", { className: "text-[11px] text-red-600 dark:text-red-400", children: "Not a width — nothing saved" })
189
+ I === "invalid" && /* @__PURE__ */ t("p", { className: "text-[11px] text-red-600 dark:text-red-400", children: "Not a width — nothing saved" })
187
190
  ]
188
191
  }
189
192
  )
190
193
  ] }),
191
- F && /* @__PURE__ */ s(O, { title: "Grouped list", children: [
194
+ P && /* @__PURE__ */ c($, { title: "Grouped list", children: [
192
195
  /* @__PURE__ */ t(
193
- u,
196
+ _,
194
197
  {
195
198
  k: "field.group_field",
196
199
  label: "Group options by",
197
200
  scope: "field",
198
201
  effect: "A field of the related record whose value heads each group.",
199
202
  children: /* @__PURE__ */ t(
200
- $,
203
+ x,
201
204
  {
202
205
  ariaLabel: "Group options by",
203
- value: R,
204
- options: [{ value: "", label: "Not grouped" }, ...N],
205
- onChange: (e) => l.proposeGlobalOption(
206
+ value: B,
207
+ options: [{ value: "", label: "Not grouped" }, ...T],
208
+ onChange: (e) => o.proposeGlobalOption(
206
209
  "field.group_field",
207
210
  "group_field",
208
211
  e || void 0,
209
- `Group the ${i} options`,
212
+ `Group the ${n} options`,
210
213
  e
211
214
  )
212
215
  }
@@ -214,23 +217,23 @@ function Ce() {
214
217
  }
215
218
  ),
216
219
  /* @__PURE__ */ t(
217
- u,
220
+ _,
218
221
  {
219
222
  k: "field.option_field",
220
223
  label: "Option field",
221
224
  scope: "field",
222
225
  effect: "The field whose records are the options inside each group.",
223
226
  children: /* @__PURE__ */ t(
224
- $,
227
+ x,
225
228
  {
226
229
  ariaLabel: "Option field",
227
- value: Q,
228
- options: [{ value: "", label: "The related record itself" }, ...N],
229
- onChange: (e) => l.proposeGlobalOption(
230
+ value: U,
231
+ options: [{ value: "", label: "The related record itself" }, ...T],
232
+ onChange: (e) => o.proposeGlobalOption(
230
233
  "field.option_field",
231
234
  "option_field",
232
235
  e || void 0,
233
- `Change the ${i} options`,
236
+ `Change the ${n} options`,
234
237
  e
235
238
  )
236
239
  }
@@ -238,96 +241,119 @@ function Ce() {
238
241
  }
239
242
  )
240
243
  ] }),
241
- (c || h) && /* @__PURE__ */ t(
242
- u,
244
+ (f || u) && /* @__PURE__ */ c(
245
+ _,
243
246
  {
244
247
  k: "field.cascade_filters",
245
248
  label: "Narrow the options by another field",
246
249
  scope: "field",
247
250
  effect: "Only options matching the value picked in a parent field are offered.",
248
- children: /* @__PURE__ */ t(
249
- le,
250
- {
251
- rules: I,
252
- m2oFields: U,
253
- relatedCollection: o.relatedCollection,
254
- onChange: (e) => l.proposeGlobal(
255
- "field.cascade_filters",
256
- e,
257
- `Change how ${i} options are narrowed`,
258
- (n) => ({
259
- ...n,
260
- dependency_config: ce(
261
- n.dependency_config,
251
+ children: [
252
+ /* @__PURE__ */ t(
253
+ te,
254
+ {
255
+ rules: v,
256
+ m2oFields: M,
257
+ relatedCollection: l.relatedCollection,
258
+ onChange: (e) => o.proposeGlobal(
259
+ "field.cascade_filters",
260
+ e,
261
+ `Change how ${n} options are narrowed`,
262
+ (i) => ({
263
+ ...i,
264
+ dependency_config: F(
265
+ i.dependency_config,
266
+ "cascade_filters",
267
+ e.length ? e : void 0
268
+ ) ?? {}
269
+ })
270
+ )
271
+ }
272
+ ),
273
+ /* @__PURE__ */ t(
274
+ le,
275
+ {
276
+ layoutId: Number(p.bundle.layout.id),
277
+ collection: p.collection,
278
+ field: l.field,
279
+ rules: v,
280
+ currentOptionFilter: r.option_filter && typeof r.option_filter == "object" && !Array.isArray(r.option_filter) ? r.option_filter : null,
281
+ parentFields: M.filter((e) => e.kind === "M2O").map((e) => e.field),
282
+ disabled: o.readOnly,
283
+ onApply: (e, i) => o.proposeGlobal("field.cascade_filters", e.rules, i, (s) => ({
284
+ ...s,
285
+ dependency_config: F(
286
+ s.dependency_config,
262
287
  "cascade_filters",
263
- e.length ? e : void 0
264
- ) ?? {}
265
- })
266
- )
267
- }
268
- )
288
+ e.rules.length ? e.rules : void 0
289
+ ) ?? {},
290
+ options: F(s.options, "option_filter", e.optionFilter ?? void 0) ?? {}
291
+ }))
292
+ }
293
+ )
294
+ ]
269
295
  }
270
296
  ),
271
- S && /* @__PURE__ */ s(O, { title: "Files", children: [
297
+ G && /* @__PURE__ */ c($, { title: "Files", children: [
272
298
  /* @__PURE__ */ t(
273
- p,
299
+ g,
274
300
  {
275
301
  k: "field.allow_upload",
276
302
  label: "Allow uploads",
277
303
  effect: "People can upload new files into this field.",
278
304
  scope: "field",
279
- checked: V,
280
- onChange: (e) => l.proposeGlobalOption(
305
+ checked: z,
306
+ onChange: (e) => o.proposeGlobalOption(
281
307
  "field.allow_upload",
282
308
  "allow_upload",
283
309
  e,
284
- e ? `Allow uploads to ${i}` : `Stop uploads to ${i}`
310
+ e ? `Allow uploads to ${n}` : `Stop uploads to ${n}`
285
311
  )
286
312
  }
287
313
  ),
288
314
  /* @__PURE__ */ t(
289
- p,
315
+ g,
290
316
  {
291
317
  k: "field.allow_pick",
292
318
  label: "Allow picking existing files",
293
319
  effect: "People can attach files that are already stored.",
294
320
  scope: "field",
295
- checked: z,
296
- onChange: (e) => l.proposeGlobalOption(
321
+ checked: H,
322
+ onChange: (e) => o.proposeGlobalOption(
297
323
  "field.allow_pick",
298
324
  "allow_pick",
299
325
  e,
300
- `Change file picking for ${i}`
326
+ `Change file picking for ${n}`
301
327
  )
302
328
  }
303
329
  ),
304
- o.iface === "files-m2m" && /* @__PURE__ */ t(
305
- p,
330
+ l.iface === "files-m2m" && /* @__PURE__ */ t(
331
+ g,
306
332
  {
307
333
  k: "field.pending_save",
308
334
  label: "Save files with the form",
309
335
  scope: "field",
310
336
  effect: "Links wait for the record’s Save instead of saving at once.",
311
- checked: H,
312
- onChange: (e) => l.proposeGlobalOption(
337
+ checked: J,
338
+ onChange: (e) => o.proposeGlobalOption(
313
339
  "field.pending_save",
314
340
  "pending_save",
315
341
  e || void 0,
316
- `Change when ${i} files save`,
342
+ `Change when ${n} files save`,
317
343
  e
318
344
  )
319
345
  }
320
346
  )
321
347
  ] }),
322
- !(c || h || _ || S) && /* @__PURE__ */ s("p", { className: "text-[12px] text-muted-foreground", children: [
323
- i,
348
+ !(f || u || b || G) && /* @__PURE__ */ c("p", { className: "text-[12px] text-muted-foreground", children: [
349
+ n,
324
350
  " is not a picker. Nothing to set here."
325
351
  ] })
326
352
  ] });
327
353
  }
328
354
  export {
329
- Ce as PickerTab,
330
- x as parsePanelWidth,
331
- pe as useLayoutsOf,
332
- fe as useRelationsFor
355
+ Fe as PickerTab,
356
+ S as parsePanelWidth,
357
+ he as useLayoutsOf,
358
+ ue as useRelationsFor
333
359
  };