@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +836 -835
- package/dist/shared/components/ConformanceView.js +34 -34
- package/dist/shared/components/ReportView.js +196 -196
- package/dist/shared/components/SlaRulesView.js +36 -36
- package/dist/shared/components/chat/ChatPanel.js +484 -487
- package/dist/shared/components/chat/ChatViews.js +66 -66
- package/dist/shared/components/chat/RoomParts.js +159 -157
- package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
- package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
- package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
- package/dist/shared/components/item-edit/FieldRenderer.js +186 -182
- package/dist/shared/components/item-edit/FieldRow.js +87 -87
- package/dist/shared/components/item-edit/FileDownloadCount.js +94 -0
- package/dist/shared/components/item-edit/FilePickerField.js +350 -349
- package/dist/shared/components/item-edit/RecordInsights.js +90 -91
- package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +175 -138
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +53 -52
- package/dist/shared/components/panels/AddendumPanel.js +409 -411
- package/dist/shared/components/panels/CommentPanel.js +169 -162
- package/dist/shared/components/panels/PipelinePanel.js +75 -75
- package/dist/shared/components/panels/RevisionsPanel.js +103 -103
- package/dist/shared/components/queue/QueueWorklist.js +142 -141
- package/dist/shared/lib/activity-sentence.js +154 -144
- package/dist/shared/lib/format-value.js +15 -15
- package/dist/shared/lib/placement-behaviour.js +39 -31
- package/dist/shared/lib/utils.js +58 -53
- 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
|
|
17
|
-
import { useFieldCtx as
|
|
18
|
-
import { Toggle as v, Setting as
|
|
19
|
-
import { lockConditionsOf as
|
|
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
|
|
30
|
+
function ge(t, o) {
|
|
31
31
|
const f = j();
|
|
32
32
|
return V({
|
|
33
|
-
queryKey: ["layout-editor", "field-rows", t,
|
|
33
|
+
queryKey: ["layout-editor", "field-rows", t, o ?? null],
|
|
34
34
|
queryFn: () => f.request(
|
|
35
|
-
E(`/field-config/${t}`,
|
|
36
|
-
).then((
|
|
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
|
|
42
|
-
const t =
|
|
43
|
-
g.map((d, h) => h === e ? { ...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 =
|
|
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,
|
|
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(
|
|
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(
|
|
89
|
+
/* @__PURE__ */ l(oe, {}),
|
|
90
90
|
/* @__PURE__ */ l(ae, {}),
|
|
91
91
|
/* @__PURE__ */ l(ne, {}),
|
|
92
92
|
/* @__PURE__ */ l(re, {}),
|
|
93
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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 ===
|
|
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 !==
|
|
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(
|
|
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
|
-
|
|
165
|
+
i,
|
|
165
166
|
{ pipeline_id: n, state_keys: [] },
|
|
166
167
|
`Change the pipeline that locks ${a}`
|
|
167
168
|
),
|
|
168
|
-
onStateKeysChange: (n) => w(
|
|
169
|
+
onStateKeysChange: (n) => w(i, { state_keys: n }, `Change the states that lock ${a}`)
|
|
169
170
|
}
|
|
170
171
|
)
|
|
171
172
|
]
|
|
172
173
|
},
|
|
173
|
-
|
|
174
|
+
i
|
|
174
175
|
)),
|
|
175
176
|
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
176
177
|
/* @__PURE__ */ l(
|
|
177
|
-
|
|
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,
|
|
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 &&
|
|
201
|
-
|
|
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,
|
|
212
|
+
onChange: (e, i) => s.apply(
|
|
212
213
|
[
|
|
213
214
|
{
|
|
214
215
|
op: "layout_update",
|
|
215
|
-
patch: { default_values:
|
|
216
|
+
patch: { default_values: ye(y, u.field, e) }
|
|
216
217
|
}
|
|
217
218
|
],
|
|
218
|
-
{ label: `Change the default of ${a}`, text:
|
|
219
|
+
{ label: `Change the default of ${a}`, text: i }
|
|
219
220
|
),
|
|
220
|
-
isM2O:
|
|
221
|
-
isM2M:
|
|
222
|
-
relatedCollection:
|
|
223
|
-
settings: { options: t.globalOptions, interface:
|
|
224
|
-
abstractType:
|
|
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
|
-
|
|
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,
|
|
252
|
-
const h = d.columns.validation_rules, R = Array.isArray(h) ? h :
|
|
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
|
-
|
|
260
|
+
o.relKind === "M2M" && /* @__PURE__ */ c(S, { title: "How many", children: [
|
|
260
261
|
/* @__PURE__ */ l(
|
|
261
|
-
|
|
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
|
|
275
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
388
|
-
|
|
388
|
+
Be as RulesTab,
|
|
389
|
+
ge as useFieldRows
|
|
389
390
|
};
|