@nivaro/react 0.3.67 → 0.3.69

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 (32) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ConformanceView.js +34 -34
  6. package/dist/shared/components/ReportView.js +196 -196
  7. package/dist/shared/components/SlaRulesView.js +36 -36
  8. package/dist/shared/components/chat/ChatPanel.js +484 -487
  9. package/dist/shared/components/chat/ChatViews.js +66 -66
  10. package/dist/shared/components/chat/RoomParts.js +159 -157
  11. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  12. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  13. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  14. package/dist/shared/components/item-edit/FieldRenderer.js +186 -182
  15. package/dist/shared/components/item-edit/FieldRow.js +87 -87
  16. package/dist/shared/components/item-edit/FileDownloadCount.js +94 -0
  17. package/dist/shared/components/item-edit/FilePickerField.js +350 -349
  18. package/dist/shared/components/item-edit/RecordInsights.js +90 -91
  19. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  20. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  21. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +175 -138
  22. package/dist/shared/components/layout-editor/inspector/RulesTab.js +53 -52
  23. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  24. package/dist/shared/components/panels/CommentPanel.js +169 -162
  25. package/dist/shared/components/panels/PipelinePanel.js +75 -75
  26. package/dist/shared/components/panels/RevisionsPanel.js +103 -103
  27. package/dist/shared/components/queue/QueueWorklist.js +142 -141
  28. package/dist/shared/lib/activity-sentence.js +154 -144
  29. package/dist/shared/lib/format-value.js +15 -15
  30. package/dist/shared/lib/placement-behaviour.js +39 -31
  31. package/dist/shared/lib/utils.js +58 -53
  32. package/package.json +1 -1
@@ -13,10 +13,10 @@ import { FieldDefaultValueControl as Y } from "../editors/field-default-value.js
13
13
  import { RoleConditionRow as Z, PipelineStateConditionRow as ee } from "../editors/lock-conditions.js";
14
14
  import { useLayoutEditorHost as le } from "../host.js";
15
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";
16
+ import { RecommendedToggle as ie, PersonalDefaultToggle as oe, PersonalDefaultInlineToggle as ae, ConfirmChangeSetting as ne, RepeatLastToggle as re, FileChipToggles as de } from "./BehaviourSettings.js";
17
+ import { useFieldCtx as se } from "./field-context.js";
18
+ import { Toggle as v, Setting as p, Segmented as ce, AddButton as ue, Section as S, TextInput as T, Choice as L } from "./kit.js";
19
+ import { lockConditionsOf as fe, layoutGrids as pe, asObject as me, defaultValuesOf as he, withDefaultValue as ye, lockConditionsColumn as be } from "./model.js";
20
20
  const P = /* @__PURE__ */ new Set([
21
21
  "inline-table",
22
22
  "inline-grid",
@@ -27,24 +27,24 @@ const P = /* @__PURE__ */ new Set([
27
27
  "o2m",
28
28
  "relation-path"
29
29
  ]);
30
- function be(t, i) {
30
+ function ge(t, o) {
31
31
  const f = j();
32
32
  return V({
33
- queryKey: ["layout-editor", "field-rows", t, i ?? null],
33
+ queryKey: ["layout-editor", "field-rows", t, o ?? null],
34
34
  queryFn: () => f.request(
35
- E(`/field-config/${t}`, i ? { layout_id: i } : void 0)
36
- ).then((p) => Array.isArray(p.data) ? p.data : []),
35
+ E(`/field-config/${t}`, o ? { layout_id: o } : void 0)
36
+ ).then((m) => Array.isArray(m.data) ? m.data : []),
37
37
  enabled: !!t,
38
38
  staleTime: 6e4
39
39
  });
40
40
  }
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),
41
+ function Be() {
42
+ const t = se(), { info: o, ov: f, opts: m, env: s, row: u } = t, a = o.label, y = s.bundle.layout, b = u.field.startsWith("__") || o.isPath, g = fe(u), _ = (e, i) => t.setPlacement({ lock_conditions: be(e) }, i), w = (e, i, n) => _(
43
+ g.map((d, h) => h === e ? { ...d, ...i } : d),
44
44
  n
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(
45
+ ), x = pe(s.bundle, t.globals, t.relations), N = !b && o.relKind !== "M2M" && o.relKind !== "O2M" && !P.has(o.iface ?? "") && x.length > 0, r = me(f.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: F = [] } = ge(N ? $ == null ? void 0 : $.childCollection : null), K = F.filter(
46
46
  (e) => e.field !== "id" && !e.field.startsWith("__") && !e.field.includes(".") && !["alias", "o2m", "m2m"].includes(e.type ?? "")
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;
47
+ ), M = (e, i) => t.setOverride("apply_to_lines", e ?? void 0, i), I = le().isAdmin && !b && !o.relKind && !P.has(o.iface ?? "") && o.type !== "alias" && o.computedType !== "virtual", O = b ? null : X(t.globals, t.relations, s.collection)[u.field] ?? null, q = he(y), A = typeof m.max_values == "number" ? m.max_values : null;
48
48
  return /* @__PURE__ */ c("div", { className: "space-y-5", children: [
49
49
  O && /* @__PURE__ */ c(
50
50
  "div",
@@ -71,7 +71,7 @@ function qe() {
71
71
  )
72
72
  }
73
73
  ),
74
- /* @__PURE__ */ l(oe, {}),
74
+ /* @__PURE__ */ l(ie, {}),
75
75
  /* @__PURE__ */ l(
76
76
  v,
77
77
  {
@@ -86,11 +86,12 @@ function qe() {
86
86
  )
87
87
  }
88
88
  ),
89
- /* @__PURE__ */ l(ie, {}),
89
+ /* @__PURE__ */ l(oe, {}),
90
90
  /* @__PURE__ */ l(ae, {}),
91
91
  /* @__PURE__ */ l(ne, {}),
92
92
  /* @__PURE__ */ l(re, {}),
93
- (i.computedType === "rollup" || i.computedType === "write") && /* @__PURE__ */ l(
93
+ /* @__PURE__ */ l(de, {}),
94
+ (o.computedType === "rollup" || o.computedType === "write") && /* @__PURE__ */ l(
94
95
  v,
95
96
  {
96
97
  k: "field.editable_computed",
@@ -105,20 +106,20 @@ function qe() {
105
106
  }
106
107
  ),
107
108
  /* @__PURE__ */ l(
108
- m,
109
+ p,
109
110
  {
110
111
  k: "field.lock_conditions",
111
112
  label: "Read-only when",
112
113
  effect: "Locks the field while any of these holds. No conditions: always editable.",
113
114
  children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
114
- g.map((e, o) => /* @__PURE__ */ c(
115
+ g.map((e, i) => /* @__PURE__ */ c(
115
116
  "div",
116
117
  {
117
118
  className: G(te, "space-y-3 p-3"),
118
119
  children: [
119
120
  /* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
120
121
  /* @__PURE__ */ l("div", { className: "flex-1", "data-setting": "field.lock_conditions.type", children: /* @__PURE__ */ l(
121
- se,
122
+ ce,
122
123
  {
123
124
  value: e.type,
124
125
  options: [
@@ -127,7 +128,7 @@ function qe() {
127
128
  ],
128
129
  onChange: (n) => _(
129
130
  g.map(
130
- (d, h) => h === o ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
131
+ (d, h) => h === i ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
131
132
  ),
132
133
  `Change a lock condition of ${a}`
133
134
  )
@@ -139,7 +140,7 @@ function qe() {
139
140
  type: "button",
140
141
  "aria-label": "Remove condition",
141
142
  onClick: () => _(
142
- g.filter((n, d) => d !== o),
143
+ g.filter((n, d) => d !== i),
143
144
  `Remove a lock condition from ${a}`
144
145
  ),
145
146
  "data-tip": "Remove condition",
@@ -152,7 +153,7 @@ function qe() {
152
153
  Z,
153
154
  {
154
155
  roleIds: e.role_ids ?? [],
155
- onRoleIdsChange: (n) => w(o, { role_ids: n }, `Change the roles that lock ${a}`)
156
+ onRoleIdsChange: (n) => w(i, { role_ids: n }, `Change the roles that lock ${a}`)
156
157
  }
157
158
  ) }) : /* @__PURE__ */ l(
158
159
  ee,
@@ -161,20 +162,20 @@ function qe() {
161
162
  pipelineId: e.pipeline_id,
162
163
  stateKeys: e.state_keys ?? [],
163
164
  onPipelineChange: (n) => w(
164
- o,
165
+ i,
165
166
  { pipeline_id: n, state_keys: [] },
166
167
  `Change the pipeline that locks ${a}`
167
168
  ),
168
- onStateKeysChange: (n) => w(o, { state_keys: n }, `Change the states that lock ${a}`)
169
+ onStateKeysChange: (n) => w(i, { state_keys: n }, `Change the states that lock ${a}`)
169
170
  }
170
171
  )
171
172
  ]
172
173
  },
173
- o
174
+ i
174
175
  )),
175
176
  /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5", children: [
176
177
  /* @__PURE__ */ l(
177
- ce,
178
+ ue,
178
179
  {
179
180
  onClick: () => _(
180
181
  [...g, { type: "pipeline_state", state_keys: [] }],
@@ -189,7 +190,7 @@ function qe() {
189
190
  layoutId: Number(y.id),
190
191
  target: { kind: "lock", field: u.field },
191
192
  bundle: s.bundle,
192
- apply: (e, o) => s.apply(e, o),
193
+ apply: (e, i) => s.apply(e, i),
193
194
  disabled: t.readOnly
194
195
  }
195
196
  )
@@ -197,8 +198,8 @@ function qe() {
197
198
  ] })
198
199
  }
199
200
  ),
200
- !b && i.relKind !== "O2M" && /* @__PURE__ */ c(
201
- m,
201
+ !b && o.relKind !== "O2M" && /* @__PURE__ */ c(
202
+ p,
202
203
  {
203
204
  k: "field.default_value",
204
205
  label: "Default for new records",
@@ -208,20 +209,20 @@ function qe() {
208
209
  Y,
209
210
  {
210
211
  value: q[u.field],
211
- onChange: (e, o) => s.apply(
212
+ onChange: (e, i) => s.apply(
212
213
  [
213
214
  {
214
215
  op: "layout_update",
215
- patch: { default_values: he(y, u.field, e) }
216
+ patch: { default_values: ye(y, u.field, e) }
216
217
  }
217
218
  ],
218
- { label: `Change the default of ${a}`, text: o }
219
+ { label: `Change the default of ${a}`, text: i }
219
220
  ),
220
- isM2O: i.relKind === "M2O",
221
- isM2M: i.relKind === "M2M",
222
- relatedCollection: i.relatedCollection,
223
- settings: { options: t.globalOptions, interface: i.iface },
224
- abstractType: i.type
221
+ isM2O: o.relKind === "M2O",
222
+ isM2M: o.relKind === "M2M",
223
+ relatedCollection: o.relatedCollection,
224
+ settings: { options: t.globalOptions, interface: o.iface },
225
+ abstractType: o.type
225
226
  }
226
227
  ) }),
227
228
  /* @__PURE__ */ l("div", { className: "pt-1", children: /* @__PURE__ */ l(
@@ -236,7 +237,7 @@ function qe() {
236
237
  }
237
238
  ),
238
239
  I && /* @__PURE__ */ l(
239
- m,
240
+ p,
240
241
  {
241
242
  k: "field.validation_rules",
242
243
  label: "Checks",
@@ -248,17 +249,17 @@ function qe() {
248
249
  layoutId: Number(y.id),
249
250
  field: u.field,
250
251
  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)));
252
+ onApply: (e, i, n) => t.proposeGlobal("field.validation_rules", e.length, n, (d) => {
253
+ const h = d.columns.validation_rules, R = Array.isArray(h) ? h : i, B = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), D = e.filter((k) => !R.some((C) => B(C, k)));
253
254
  return { ...d, columns: { ...d.columns, validation_rules: [...R, ...D] } };
254
255
  })
255
256
  }
256
257
  )
257
258
  }
258
259
  ),
259
- i.relKind === "M2M" && /* @__PURE__ */ c(S, { title: "How many", children: [
260
+ o.relKind === "M2M" && /* @__PURE__ */ c(S, { title: "How many", children: [
260
261
  /* @__PURE__ */ l(
261
- m,
262
+ p,
262
263
  {
263
264
  k: "field.max_values",
264
265
  label: "Most values",
@@ -271,8 +272,8 @@ function qe() {
271
272
  value: A == null ? "" : String(A),
272
273
  placeholder: "No limit",
273
274
  onChange: (e) => {
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);
275
+ const i = e === "" ? void 0 : Math.max(1, Math.round(Number(e)));
276
+ i !== void 0 && Number.isNaN(i) || t.setOption("max_values", i, `Limit how many ${a} can be picked`, !0);
276
277
  }
277
278
  }
278
279
  )
@@ -285,7 +286,7 @@ function qe() {
285
286
  label: "Refuse more on the server too",
286
287
  effect: "Imports, the API and other forms cannot store more than the limit.",
287
288
  enforced: !0,
288
- checked: p.enforce_on_write === !0,
289
+ checked: m.enforce_on_write === !0,
289
290
  onChange: (e) => t.setOption(
290
291
  "enforce_on_write",
291
292
  e ? !0 : void 0,
@@ -297,7 +298,7 @@ function qe() {
297
298
  N && /* @__PURE__ */ c(S, { title: "Apply to lines", children: [
298
299
  /* @__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." }),
299
300
  /* @__PURE__ */ l(
300
- m,
301
+ p,
301
302
  {
302
303
  k: "field.apply_to_lines.grid",
303
304
  label: "Grid",
@@ -320,7 +321,7 @@ function qe() {
320
321
  }
321
322
  ),
322
323
  /* @__PURE__ */ l(
323
- m,
324
+ p,
324
325
  {
325
326
  k: "field.apply_to_lines.target",
326
327
  label: "Column",
@@ -333,7 +334,7 @@ function qe() {
333
334
  value: r.target ?? "",
334
335
  options: [
335
336
  { value: "", label: r.grid ? "Pick a column…" : "Pick a grid first" },
336
- ...F.map((e) => ({ value: e.field, label: e.label || Q(e.field) }))
337
+ ...K.map((e) => ({ value: e.field, label: e.label || Q(e.field) }))
337
338
  ],
338
339
  onChange: (e) => M({ ...r, target: e }, `Copy ${a} into a column`)
339
340
  }
@@ -341,7 +342,7 @@ function qe() {
341
342
  }
342
343
  ),
343
344
  /* @__PURE__ */ l(
344
- m,
345
+ p,
345
346
  {
346
347
  k: "field.apply_to_lines.label",
347
348
  label: "Button label",
@@ -354,7 +355,7 @@ function qe() {
354
355
  value: r.label ?? "",
355
356
  placeholder: "Apply to lines",
356
357
  onChange: (e) => {
357
- const { label: o, ...n } = r;
358
+ const { label: i, ...n } = r;
358
359
  t.setOverride(
359
360
  "apply_to_lines",
360
361
  e ? { ...n, label: e } : n,
@@ -384,6 +385,6 @@ function qe() {
384
385
  ] });
385
386
  }
386
387
  export {
387
- qe as RulesTab,
388
- be as useFieldRows
388
+ Be as RulesTab,
389
+ ge as useFieldRows
389
390
  };