@nivaro/react 0.3.41 → 0.3.42

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 (96) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +644 -15
  5. package/dist/index.js +814 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/ProfileView.js +776 -1003
  20. package/dist/shared/components/RecentRecordsRail.js +34 -16
  21. package/dist/shared/components/RecordReadView.js +500 -477
  22. package/dist/shared/components/Skeletons.js +199 -0
  23. package/dist/shared/components/SlowNotice.js +63 -0
  24. package/dist/shared/components/Term.js +23 -0
  25. package/dist/shared/components/WidgetSlot.js +350 -353
  26. package/dist/shared/components/access/PermissionSummary.js +106 -0
  27. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  28. package/dist/shared/components/chat/ChatPanel.js +902 -886
  29. package/dist/shared/components/chat/MemberPaging.js +70 -0
  30. package/dist/shared/components/chat/RoomParts.js +147 -117
  31. package/dist/shared/components/chat/ScreenClip.js +73 -69
  32. package/dist/shared/components/chat/chat-core.js +449 -396
  33. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  34. package/dist/shared/components/help-videos/api.js +2 -5
  35. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  36. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  37. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  38. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  39. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  40. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  41. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  42. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  43. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  44. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  45. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  46. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  47. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  48. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  49. package/dist/shared/components/item-edit/field-sources.js +33 -0
  50. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  51. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  52. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  53. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  54. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  55. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  56. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  57. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  58. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  59. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  60. package/dist/shared/components/list/InlineEdit.js +363 -0
  61. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  62. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  63. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  64. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  65. package/dist/shared/components/notifications/changes-lines.js +24 -0
  66. package/dist/shared/components/notifications/why-lines.js +64 -0
  67. package/dist/shared/components/panels/CommentPanel.js +316 -281
  68. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  69. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  70. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  71. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  72. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  73. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  74. package/dist/shared/components/profile/PersonProfile.js +57 -52
  75. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  76. package/dist/shared/hooks/useSlowReason.js +39 -0
  77. package/dist/shared/lib/activity-sentence.js +670 -0
  78. package/dist/shared/lib/config-sentences.js +418 -0
  79. package/dist/shared/lib/core-glossary.js +229 -0
  80. package/dist/shared/lib/error-hints.js +159 -0
  81. package/dist/shared/lib/error-message.js +105 -0
  82. package/dist/shared/lib/error-toast.js +22 -0
  83. package/dist/shared/lib/field-comments.js +25 -0
  84. package/dist/shared/lib/filter-sentence.js +261 -0
  85. package/dist/shared/lib/glossary.js +55 -48
  86. package/dist/shared/lib/idle-reload.js +138 -0
  87. package/dist/shared/lib/layout-resolve.js +42 -29
  88. package/dist/shared/lib/list-inline-edit.js +190 -0
  89. package/dist/shared/lib/list-link.js +147 -0
  90. package/dist/shared/lib/prefetch.js +259 -106
  91. package/dist/shared/lib/record-ref.js +72 -0
  92. package/dist/shared/lib/reload-holds.js +25 -0
  93. package/dist/shared/lib/safe-error.js +52 -24
  94. package/dist/shared/lib/skeleton-shapes.js +72 -0
  95. package/dist/shared/lib/slow-reason.js +63 -0
  96. package/package.json +1 -1
@@ -1,21 +1,23 @@
1
1
  import { jsxs as c, jsx as l } from "react/jsx-runtime";
2
2
  import { useQuery as V } from "@tanstack/react-query";
3
- import { X as j } from "lucide-react";
4
- import { useNivaroClient as B } from "../../../context.js";
3
+ import { X as W } from "lucide-react";
4
+ import { useNivaroClient as j } from "../../../context.js";
5
5
  import { get as E } from "../../../lib/commands.js";
6
- import { cn as W, titleCase as G } from "../../../lib/utils.js";
7
- import { FieldRuleWriter as Q } from "../ai-rules/FieldRuleWriter.js";
8
- import { RuleWriter as H } from "../ai-rules/RuleWriter.js";
9
- import { ValidationSuggest as X } from "../ai-rules/ValidationSuggest.js";
10
- import { FieldDefaultValueControl as z } from "../editors/field-default-value.js";
11
- import { RoleConditionRow as J, PipelineStateConditionRow as U } from "../editors/lock-conditions.js";
12
- import { useLayoutEditorHost as Y } from "../host.js";
13
- import { tintCard as Z } from "../panel-style.js";
14
- import { RecommendedToggle as ee, PersonalDefaultToggle as le, PersonalDefaultInlineToggle as te, ConfirmChangeSetting as ie, RepeatLastToggle as oe } from "./BehaviourSettings.js";
15
- import { useFieldCtx as ae } from "./field-context.js";
16
- import { Toggle as b, Setting as p, Segmented as ne, AddButton as re, Section as R, TextInput as T, Choice as S } from "./kit.js";
17
- import { lockConditionsOf as de, layoutGrids as se, asObject as ce, defaultValuesOf as ue, withDefaultValue as fe, lockConditionsColumn as pe } from "./model.js";
18
- const L = /* @__PURE__ */ new Set([
6
+ import { cn as G, titleCase as Q } from "../../../lib/utils.js";
7
+ import { FieldSourceBody as H } from "../../ConfigReadBack.js";
8
+ import { fieldSourcesFor as X } from "../../item-edit/field-sources.js";
9
+ import { FieldRuleWriter as z } from "../ai-rules/FieldRuleWriter.js";
10
+ import { RuleWriter as J } from "../ai-rules/RuleWriter.js";
11
+ import { ValidationSuggest as U } from "../ai-rules/ValidationSuggest.js";
12
+ import { FieldDefaultValueControl as Y } from "../editors/field-default-value.js";
13
+ import { RoleConditionRow as Z, PipelineStateConditionRow as ee } from "../editors/lock-conditions.js";
14
+ import { useLayoutEditorHost as le } from "../host.js";
15
+ import { tintCard as te } from "../panel-style.js";
16
+ import { RecommendedToggle as oe, PersonalDefaultToggle as ie, PersonalDefaultInlineToggle as ae, ConfirmChangeSetting as ne, RepeatLastToggle as re } from "./BehaviourSettings.js";
17
+ import { useFieldCtx as de } from "./field-context.js";
18
+ import { Toggle as v, Setting as m, Segmented as se, AddButton as ce, Section as S, TextInput as T, Choice as L } from "./kit.js";
19
+ import { lockConditionsOf as ue, layoutGrids as fe, asObject as me, defaultValuesOf as pe, withDefaultValue as he, lockConditionsColumn as ye } from "./model.js";
20
+ const P = /* @__PURE__ */ new Set([
19
21
  "inline-table",
20
22
  "inline-grid",
21
23
  "list-o2m",
@@ -25,87 +27,98 @@ const L = /* @__PURE__ */ new Set([
25
27
  "o2m",
26
28
  "relation-path"
27
29
  ]);
28
- function me(a, i) {
29
- const u = B();
30
+ function be(t, i) {
31
+ const f = j();
30
32
  return V({
31
- queryKey: ["layout-editor", "field-rows", a, i ?? null],
32
- queryFn: () => u.request(
33
- E(`/field-config/${a}`, i ? { layout_id: i } : void 0)
34
- ).then((m) => Array.isArray(m.data) ? m.data : []),
35
- enabled: !!a,
33
+ queryKey: ["layout-editor", "field-rows", t, i ?? null],
34
+ queryFn: () => f.request(
35
+ E(`/field-config/${t}`, i ? { layout_id: i } : void 0)
36
+ ).then((p) => Array.isArray(p.data) ? p.data : []),
37
+ enabled: !!t,
36
38
  staleTime: 6e4
37
39
  });
38
40
  }
39
- function Le() {
40
- const a = ae(), { info: i, ov: u, opts: m, env: s, row: f } = a, o = i.label, y = s.bundle.layout, v = f.field.startsWith("__") || i.isPath, g = de(f), _ = (e, t) => a.setPlacement({ lock_conditions: pe(e) }, t), w = (e, t, n) => _(
41
- g.map((d, h) => h === e ? { ...d, ...t } : d),
41
+ function qe() {
42
+ const t = de(), { info: i, ov: f, opts: p, env: s, row: u } = t, a = i.label, y = s.bundle.layout, b = u.field.startsWith("__") || i.isPath, g = ue(u), _ = (e, o) => t.setPlacement({ lock_conditions: ye(e) }, o), w = (e, o, n) => _(
43
+ g.map((d, h) => h === e ? { ...d, ...o } : d),
42
44
  n
43
- ), x = se(s.bundle, a.globals, a.relations), M = !v && i.relKind !== "M2M" && i.relKind !== "O2M" && !L.has(i.iface ?? "") && x.length > 0, r = ce(u.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: P = [] } = me(M ? $ == null ? void 0 : $.childCollection : null), K = P.filter(
45
+ ), x = fe(s.bundle, t.globals, t.relations), N = !b && i.relKind !== "M2M" && i.relKind !== "O2M" && !P.has(i.iface ?? "") && x.length > 0, r = me(f.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: K = [] } = be(N ? $ == null ? void 0 : $.childCollection : null), F = K.filter(
44
46
  (e) => e.field !== "id" && !e.field.startsWith("__") && !e.field.includes(".") && !["alias", "o2m", "m2m"].includes(e.type ?? "")
45
- ), N = (e, t) => a.setOverride("apply_to_lines", e ?? void 0, t), I = Y().isAdmin && !v && !i.relKind && !L.has(i.iface ?? "") && i.type !== "alias" && i.computedType !== "virtual", q = ue(y), A = typeof m.max_values == "number" ? m.max_values : null;
47
+ ), M = (e, o) => t.setOverride("apply_to_lines", e ?? void 0, o), I = le().isAdmin && !b && !i.relKind && !P.has(i.iface ?? "") && i.type !== "alias" && i.computedType !== "virtual", O = b ? null : X(t.globals, t.relations, s.collection)[u.field] ?? null, q = pe(y), A = typeof p.max_values == "number" ? p.max_values : null;
46
48
  return /* @__PURE__ */ c("div", { className: "space-y-5", children: [
49
+ O && /* @__PURE__ */ c(
50
+ "div",
51
+ {
52
+ "data-setting": "field.source",
53
+ className: "rounded-md border border-slate-200 bg-slate-50 p-2.5 dark:border-border dark:bg-muted/40",
54
+ children: [
55
+ /* @__PURE__ */ l("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Where the value comes from" }),
56
+ /* @__PURE__ */ l(H, { source: O })
57
+ ]
58
+ }
59
+ ),
47
60
  /* @__PURE__ */ l(
48
- b,
61
+ v,
49
62
  {
50
63
  k: "field.required",
51
64
  label: "Required",
52
65
  effect: "The form will not save without a value.",
53
- checked: u.required === !0,
54
- onChange: (e) => a.setOverride(
66
+ checked: f.required === !0,
67
+ onChange: (e) => t.setOverride(
55
68
  "required",
56
69
  e ? !0 : void 0,
57
- e ? `Make ${o} required` : `Make ${o} optional`
70
+ e ? `Make ${a} required` : `Make ${a} optional`
58
71
  )
59
72
  }
60
73
  ),
61
- /* @__PURE__ */ l(ee, {}),
74
+ /* @__PURE__ */ l(oe, {}),
62
75
  /* @__PURE__ */ l(
63
- b,
76
+ v,
64
77
  {
65
78
  k: "field.readonly",
66
79
  label: "Read-only",
67
80
  effect: "Shown but not editable on this form.",
68
- checked: u.readonly === !0,
69
- onChange: (e) => a.setOverride(
81
+ checked: f.readonly === !0,
82
+ onChange: (e) => t.setOverride(
70
83
  "readonly",
71
84
  e ? !0 : void 0,
72
- e ? `Make ${o} read-only` : `Make ${o} editable`
85
+ e ? `Make ${a} read-only` : `Make ${a} editable`
73
86
  )
74
87
  }
75
88
  ),
76
- /* @__PURE__ */ l(le, {}),
77
- /* @__PURE__ */ l(te, {}),
78
89
  /* @__PURE__ */ l(ie, {}),
79
- /* @__PURE__ */ l(oe, {}),
90
+ /* @__PURE__ */ l(ae, {}),
91
+ /* @__PURE__ */ l(ne, {}),
92
+ /* @__PURE__ */ l(re, {}),
80
93
  (i.computedType === "rollup" || i.computedType === "write") && /* @__PURE__ */ l(
81
- b,
94
+ v,
82
95
  {
83
96
  k: "field.editable_computed",
84
97
  label: "Allow manual entry",
85
98
  effect: "Lets people type over the calculated value here; the next recalculation still overwrites it.",
86
- checked: u.editable_computed === !0,
87
- onChange: (e) => a.setOverride(
99
+ checked: f.editable_computed === !0,
100
+ onChange: (e) => t.setOverride(
88
101
  "editable_computed",
89
102
  e ? !0 : void 0,
90
- e ? `Allow typing into ${o}` : `Keep ${o} calculated only`
103
+ e ? `Allow typing into ${a}` : `Keep ${a} calculated only`
91
104
  )
92
105
  }
93
106
  ),
94
107
  /* @__PURE__ */ l(
95
- p,
108
+ m,
96
109
  {
97
110
  k: "field.lock_conditions",
98
111
  label: "Read-only when",
99
112
  effect: "Locks the field while any of these holds. No conditions: always editable.",
100
113
  children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
101
- g.map((e, t) => /* @__PURE__ */ c(
114
+ g.map((e, o) => /* @__PURE__ */ c(
102
115
  "div",
103
116
  {
104
- className: W(Z, "space-y-3 p-3"),
117
+ className: G(te, "space-y-3 p-3"),
105
118
  children: [
106
119
  /* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
107
120
  /* @__PURE__ */ l("div", { className: "flex-1", "data-setting": "field.lock_conditions.type", children: /* @__PURE__ */ l(
108
- ne,
121
+ se,
109
122
  {
110
123
  value: e.type,
111
124
  options: [
@@ -114,9 +127,9 @@ function Le() {
114
127
  ],
115
128
  onChange: (n) => _(
116
129
  g.map(
117
- (d, h) => h === t ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
130
+ (d, h) => h === o ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
118
131
  ),
119
- `Change a lock condition of ${o}`
132
+ `Change a lock condition of ${a}`
120
133
  )
121
134
  }
122
135
  ) }),
@@ -126,126 +139,126 @@ function Le() {
126
139
  type: "button",
127
140
  "aria-label": "Remove condition",
128
141
  onClick: () => _(
129
- g.filter((n, d) => d !== t),
130
- `Remove a lock condition from ${o}`
142
+ g.filter((n, d) => d !== o),
143
+ `Remove a lock condition from ${a}`
131
144
  ),
132
145
  "data-tip": "Remove condition",
133
146
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-100 hover:text-red-600 dark:hover:bg-muted dark:hover:text-red-400",
134
- children: /* @__PURE__ */ l(j, { className: "h-3.5 w-3.5" })
147
+ children: /* @__PURE__ */ l(W, { className: "h-3.5 w-3.5" })
135
148
  }
136
149
  )
137
150
  ] }),
138
151
  e.type === "role" ? /* @__PURE__ */ l("div", { "data-setting": "field.lock_conditions.role_ids", children: /* @__PURE__ */ l(
139
- J,
152
+ Z,
140
153
  {
141
154
  roleIds: e.role_ids ?? [],
142
- onRoleIdsChange: (n) => w(t, { role_ids: n }, `Change the roles that lock ${o}`)
155
+ onRoleIdsChange: (n) => w(o, { role_ids: n }, `Change the roles that lock ${a}`)
143
156
  }
144
157
  ) }) : /* @__PURE__ */ l(
145
- U,
158
+ ee,
146
159
  {
147
160
  collection: s.collection,
148
161
  pipelineId: e.pipeline_id,
149
162
  stateKeys: e.state_keys ?? [],
150
163
  onPipelineChange: (n) => w(
151
- t,
164
+ o,
152
165
  { pipeline_id: n, state_keys: [] },
153
- `Change the pipeline that locks ${o}`
166
+ `Change the pipeline that locks ${a}`
154
167
  ),
155
- onStateKeysChange: (n) => w(t, { state_keys: n }, `Change the states that lock ${o}`)
168
+ onStateKeysChange: (n) => w(o, { state_keys: n }, `Change the states that lock ${a}`)
156
169
  }
157
170
  )
158
171
  ]
159
172
  },
160
- t
173
+ o
161
174
  )),
162
175
  /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5", children: [
163
176
  /* @__PURE__ */ l(
164
- re,
177
+ ce,
165
178
  {
166
179
  onClick: () => _(
167
180
  [...g, { type: "pipeline_state", state_keys: [] }],
168
- `Add a lock condition to ${o}`
181
+ `Add a lock condition to ${a}`
169
182
  ),
170
183
  children: "+ Add condition"
171
184
  }
172
185
  ),
173
- !v && /* @__PURE__ */ l(
174
- H,
186
+ !b && /* @__PURE__ */ l(
187
+ J,
175
188
  {
176
189
  layoutId: Number(y.id),
177
- target: { kind: "lock", field: f.field },
190
+ target: { kind: "lock", field: u.field },
178
191
  bundle: s.bundle,
179
- apply: (e, t) => s.apply(e, t),
180
- disabled: a.readOnly
192
+ apply: (e, o) => s.apply(e, o),
193
+ disabled: t.readOnly
181
194
  }
182
195
  )
183
196
  ] })
184
197
  ] })
185
198
  }
186
199
  ),
187
- !v && i.relKind !== "O2M" && /* @__PURE__ */ c(
188
- p,
200
+ !b && i.relKind !== "O2M" && /* @__PURE__ */ c(
201
+ m,
189
202
  {
190
203
  k: "field.default_value",
191
204
  label: "Default for new records",
192
205
  effect: "Filled in when someone creates a record on this form.",
193
206
  children: [
194
207
  /* @__PURE__ */ l("div", { onBlurCapture: () => s.flush(), children: /* @__PURE__ */ l(
195
- z,
208
+ Y,
196
209
  {
197
- value: q[f.field],
198
- onChange: (e, t) => s.apply(
210
+ value: q[u.field],
211
+ onChange: (e, o) => s.apply(
199
212
  [
200
213
  {
201
214
  op: "layout_update",
202
- patch: { default_values: fe(y, f.field, e) }
215
+ patch: { default_values: he(y, u.field, e) }
203
216
  }
204
217
  ],
205
- { label: `Change the default of ${o}`, text: t }
218
+ { label: `Change the default of ${a}`, text: o }
206
219
  ),
207
220
  isM2O: i.relKind === "M2O",
208
221
  isM2M: i.relKind === "M2M",
209
222
  relatedCollection: i.relatedCollection,
210
- settings: { options: a.globalOptions, interface: i.iface },
223
+ settings: { options: t.globalOptions, interface: i.iface },
211
224
  abstractType: i.type
212
225
  }
213
226
  ) }),
214
227
  /* @__PURE__ */ l("div", { className: "pt-1", children: /* @__PURE__ */ l(
215
- Q,
228
+ z,
216
229
  {
217
230
  layoutId: Number(y.id),
218
- field: f.field,
219
- disabled: a.readOnly
231
+ field: u.field,
232
+ disabled: t.readOnly
220
233
  }
221
234
  ) })
222
235
  ]
223
236
  }
224
237
  ),
225
238
  I && /* @__PURE__ */ l(
226
- p,
239
+ m,
227
240
  {
228
241
  k: "field.validation_rules",
229
242
  label: "Checks",
230
243
  scope: "field",
231
244
  effect: "Learned from the values stored today, each with how many existing values it would refuse.",
232
245
  children: /* @__PURE__ */ l(
233
- X,
246
+ U,
234
247
  {
235
248
  layoutId: Number(y.id),
236
- field: f.field,
237
- disabled: a.readOnly,
238
- onApply: (e, t, n) => a.proposeGlobal("field.validation_rules", e.length, n, (d) => {
239
- const h = d.columns.validation_rules, O = Array.isArray(h) ? h : t, F = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), D = e.filter((k) => !O.some((C) => F(C, k)));
240
- return { ...d, columns: { ...d.columns, validation_rules: [...O, ...D] } };
249
+ field: u.field,
250
+ disabled: t.readOnly,
251
+ onApply: (e, o, n) => t.proposeGlobal("field.validation_rules", e.length, n, (d) => {
252
+ const h = d.columns.validation_rules, R = Array.isArray(h) ? h : o, B = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), D = e.filter((k) => !R.some((C) => B(C, k)));
253
+ return { ...d, columns: { ...d.columns, validation_rules: [...R, ...D] } };
241
254
  })
242
255
  }
243
256
  )
244
257
  }
245
258
  ),
246
- i.relKind === "M2M" && /* @__PURE__ */ c(R, { title: "How many", children: [
259
+ i.relKind === "M2M" && /* @__PURE__ */ c(S, { title: "How many", children: [
247
260
  /* @__PURE__ */ l(
248
- p,
261
+ m,
249
262
  {
250
263
  k: "field.max_values",
251
264
  label: "Most values",
@@ -258,39 +271,39 @@ function Le() {
258
271
  value: A == null ? "" : String(A),
259
272
  placeholder: "No limit",
260
273
  onChange: (e) => {
261
- const t = e === "" ? void 0 : Math.max(1, Math.round(Number(e)));
262
- t !== void 0 && Number.isNaN(t) || a.setOption("max_values", t, `Limit how many ${o} can be picked`, !0);
274
+ const o = e === "" ? void 0 : Math.max(1, Math.round(Number(e)));
275
+ o !== void 0 && Number.isNaN(o) || t.setOption("max_values", o, `Limit how many ${a} can be picked`, !0);
263
276
  }
264
277
  }
265
278
  )
266
279
  }
267
280
  ),
268
281
  A != null && /* @__PURE__ */ l(
269
- b,
282
+ v,
270
283
  {
271
284
  k: "field.max_values_enforce_on_write",
272
285
  label: "Refuse more on the server too",
273
286
  effect: "Imports, the API and other forms cannot store more than the limit.",
274
287
  enforced: !0,
275
- checked: m.enforce_on_write === !0,
276
- onChange: (e) => a.setOption(
288
+ checked: p.enforce_on_write === !0,
289
+ onChange: (e) => t.setOption(
277
290
  "enforce_on_write",
278
291
  e ? !0 : void 0,
279
- e ? `Enforce the limit of ${o} on the server` : `Stop enforcing the limit of ${o}`
292
+ e ? `Enforce the limit of ${a} on the server` : `Stop enforcing the limit of ${a}`
280
293
  )
281
294
  }
282
295
  )
283
296
  ] }),
284
- M && /* @__PURE__ */ c(R, { title: "Apply to lines", children: [
297
+ N && /* @__PURE__ */ c(S, { title: "Apply to lines", children: [
285
298
  /* @__PURE__ */ l("p", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "A button beside the field copies its value into one column of every line of a grid." }),
286
299
  /* @__PURE__ */ l(
287
- p,
300
+ m,
288
301
  {
289
302
  k: "field.apply_to_lines.grid",
290
303
  label: "Grid",
291
304
  effect: "The grid whose lines get the value.",
292
305
  children: /* @__PURE__ */ l(
293
- S,
306
+ L,
294
307
  {
295
308
  ariaLabel: "Grid",
296
309
  value: r.grid ?? "",
@@ -298,37 +311,37 @@ function Le() {
298
311
  { value: "", label: "Off" },
299
312
  ...x.map((e) => ({ value: e.field, label: e.label }))
300
313
  ],
301
- onChange: (e) => N(
314
+ onChange: (e) => M(
302
315
  e ? { grid: e, target: "", ...r.label ? { label: r.label } : {} } : null,
303
- e ? `Copy ${o} into lines` : `Stop copying ${o} into lines`
316
+ e ? `Copy ${a} into lines` : `Stop copying ${a} into lines`
304
317
  )
305
318
  }
306
319
  )
307
320
  }
308
321
  ),
309
322
  /* @__PURE__ */ l(
310
- p,
323
+ m,
311
324
  {
312
325
  k: "field.apply_to_lines.target",
313
326
  label: "Column",
314
327
  effect: "The column of each line that receives the value.",
315
328
  children: /* @__PURE__ */ l(
316
- S,
329
+ L,
317
330
  {
318
331
  ariaLabel: "Column",
319
332
  disabled: !r.grid,
320
333
  value: r.target ?? "",
321
334
  options: [
322
335
  { value: "", label: r.grid ? "Pick a column…" : "Pick a grid first" },
323
- ...K.map((e) => ({ value: e.field, label: e.label || G(e.field) }))
336
+ ...F.map((e) => ({ value: e.field, label: e.label || Q(e.field) }))
324
337
  ],
325
- onChange: (e) => N({ ...r, target: e }, `Copy ${o} into a column`)
338
+ onChange: (e) => M({ ...r, target: e }, `Copy ${a} into a column`)
326
339
  }
327
340
  )
328
341
  }
329
342
  ),
330
343
  /* @__PURE__ */ l(
331
- p,
344
+ m,
332
345
  {
333
346
  k: "field.apply_to_lines.label",
334
347
  label: "Button label",
@@ -341,11 +354,11 @@ function Le() {
341
354
  value: r.label ?? "",
342
355
  placeholder: "Apply to lines",
343
356
  onChange: (e) => {
344
- const { label: t, ...n } = r;
345
- a.setOverride(
357
+ const { label: o, ...n } = r;
358
+ t.setOverride(
346
359
  "apply_to_lines",
347
360
  e ? { ...n, label: e } : n,
348
- `Rename the apply-to-lines button of ${o}`,
361
+ `Rename the apply-to-lines button of ${a}`,
349
362
  !0
350
363
  );
351
364
  }
@@ -355,22 +368,22 @@ function Le() {
355
368
  )
356
369
  ] }),
357
370
  s.layoutType === "addendum" && /* @__PURE__ */ l(
358
- b,
371
+ v,
359
372
  {
360
373
  k: "field.prefill_from_parent",
361
374
  label: "Prefill from the record",
362
375
  effect: "A new addendum starts with the record's current value.",
363
- checked: u.prefill_from_parent !== !1,
364
- onChange: (e) => a.setOverride(
376
+ checked: f.prefill_from_parent !== !1,
377
+ onChange: (e) => t.setOverride(
365
378
  "prefill_from_parent",
366
379
  e ? void 0 : !1,
367
- e ? `Prefill ${o} from the record` : `Start ${o} empty on addendums`
380
+ e ? `Prefill ${a} from the record` : `Start ${a} empty on addendums`
368
381
  )
369
382
  }
370
383
  )
371
384
  ] });
372
385
  }
373
386
  export {
374
- Le as RulesTab,
375
- me as useFieldRows
387
+ qe as RulesTab,
388
+ be as useFieldRows
376
389
  };