@nivaro/react 0.3.73 → 0.3.75
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CollectionBrowserView.js +2490 -2399
- package/dist/shared/components/DataTable.js +315 -289
- package/dist/shared/components/RecordReadView.js +661 -573
- package/dist/shared/components/item-edit/RecordLiveSync.js +46 -46
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +183 -165
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +47 -46
- package/dist/shared/lib/record-loader.js +30 -24
- package/package.json +1 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { jsxs as m, jsx as n, Fragment as
|
|
2
|
-
import { X as
|
|
1
|
+
import { jsxs as m, jsx as n, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { X as $ } from "lucide-react";
|
|
3
3
|
import { useMemo as O } from "react";
|
|
4
|
-
import { validateExpression as
|
|
5
|
-
import { displayFormulaOf as
|
|
4
|
+
import { validateExpression as T } from "../../../lib/expression.js";
|
|
5
|
+
import { displayFormulaOf as N, textRulesOf as R, counterOf as M, confirmChangeOf as F } from "../../../lib/placement-behaviour.js";
|
|
6
6
|
import { cn as L } from "../../../lib/utils.js";
|
|
7
|
-
import { RoleConditionRow as A, PipelineStateConditionRow as
|
|
8
|
-
import { useColumnFacts as P, columnOf as
|
|
9
|
-
import { effectText as
|
|
10
|
-
import { isRelational as
|
|
11
|
-
import { useFieldCtx as
|
|
12
|
-
import { useInspectorEnv as j, Setting as
|
|
7
|
+
import { RoleConditionRow as A, PipelineStateConditionRow as S } from "../editors/lock-conditions.js";
|
|
8
|
+
import { useColumnFacts as P, columnOf as I } from "../inspect/inspect-api.js";
|
|
9
|
+
import { effectText as D, tintCard as K } from "../panel-style.js";
|
|
10
|
+
import { isRelational as W } from "./applies.js";
|
|
11
|
+
import { useFieldCtx as g } from "./field-context.js";
|
|
12
|
+
import { useInspectorEnv as j, Setting as y, TextInput as w, TextArea as q, Segmented as k, DraftInput as E, AddButton as H, Toggle as p } from "./kit.js";
|
|
13
13
|
const U = "rounded p-0.5 text-slate-400 transition-colors hover:bg-muted hover:text-slate-700 dark:hover:text-foreground";
|
|
14
14
|
function z(t) {
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(t.type) || /textarea|rich|wysiwyg|markdown/i.test(
|
|
15
|
+
if (W(t)) return !1;
|
|
16
|
+
const a = t.iface ?? "";
|
|
17
|
+
return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(t.type) || /textarea|rich|wysiwyg|markdown/i.test(a);
|
|
18
18
|
}
|
|
19
|
-
function C(t,
|
|
20
|
-
const
|
|
21
|
-
return !
|
|
19
|
+
function C(t, a, l = {}) {
|
|
20
|
+
const r = l.allowM2M === !0 && t.relKind === "M2M";
|
|
21
|
+
return !a.startsWith("__") && !t.isPath && (r || t.type !== "alias" && t.relKind !== "M2M") && t.relKind !== "O2M" && t.computedType !== "virtual" && t.computedType !== "read";
|
|
22
22
|
}
|
|
23
23
|
function re() {
|
|
24
|
-
const t =
|
|
25
|
-
f.map((
|
|
24
|
+
const t = g(), { ov: a, info: l, env: r, row: c } = t, d = l.label, f = R(a), u = (s, i, e) => t.setOverride("text_rules", s.length ? s : void 0, i, e), o = (s, i, e, h) => u(
|
|
25
|
+
f.map((b, v) => v === s ? { ...b, ...i } : b),
|
|
26
26
|
e,
|
|
27
27
|
h
|
|
28
28
|
);
|
|
29
|
-
return
|
|
30
|
-
|
|
29
|
+
return c.field.startsWith("__") ? null : /* @__PURE__ */ m(
|
|
30
|
+
y,
|
|
31
31
|
{
|
|
32
32
|
k: "field.text_rules",
|
|
33
33
|
label: "Label and help by state or role",
|
|
34
34
|
effect: "Different words in a workflow state or for a role: “Requested date” becomes “Delivered date” once Completed. The first rule that matches wins; the record page, read view and PDF follow it.",
|
|
35
35
|
children: [
|
|
36
|
-
f.map((
|
|
36
|
+
f.map((s, i) => /* @__PURE__ */ m(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
|
-
"data-text-rule":
|
|
40
|
-
className: L(
|
|
39
|
+
"data-text-rule": i,
|
|
40
|
+
className: L(K, "space-y-2 px-2.5 py-2"),
|
|
41
41
|
children: [
|
|
42
42
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
43
43
|
/* @__PURE__ */ n("div", { className: "flex-1", children: /* @__PURE__ */ n(
|
|
44
44
|
k,
|
|
45
45
|
{
|
|
46
|
-
value:
|
|
46
|
+
value: s.type,
|
|
47
47
|
options: [
|
|
48
48
|
{ value: "pipeline_state", label: "In a state" },
|
|
49
49
|
{ value: "role", label: "For a role" }
|
|
50
50
|
],
|
|
51
|
-
onChange: (e) =>
|
|
52
|
-
|
|
51
|
+
onChange: (e) => o(
|
|
52
|
+
i,
|
|
53
53
|
e === "role" ? {
|
|
54
54
|
type: "role",
|
|
55
55
|
role_ids: [],
|
|
56
56
|
state_keys: void 0,
|
|
57
57
|
pipeline_id: void 0
|
|
58
58
|
} : { type: "pipeline_state", state_keys: [], role_ids: void 0 },
|
|
59
|
-
`Change when ${
|
|
59
|
+
`Change when ${d} reads differently`
|
|
60
60
|
)
|
|
61
61
|
}
|
|
62
62
|
) }),
|
|
@@ -68,57 +68,57 @@ function re() {
|
|
|
68
68
|
"data-tip": "Remove this rule",
|
|
69
69
|
className: U,
|
|
70
70
|
onClick: () => u(
|
|
71
|
-
f.filter((e, h) => h !==
|
|
72
|
-
`Remove a label rule from ${
|
|
71
|
+
f.filter((e, h) => h !== i),
|
|
72
|
+
`Remove a label rule from ${d}`
|
|
73
73
|
),
|
|
74
|
-
children: /* @__PURE__ */ n(
|
|
74
|
+
children: /* @__PURE__ */ n($, { className: "h-3.5 w-3.5" })
|
|
75
75
|
}
|
|
76
76
|
)
|
|
77
77
|
] }),
|
|
78
|
-
|
|
78
|
+
s.type === "role" ? /* @__PURE__ */ n(
|
|
79
79
|
A,
|
|
80
80
|
{
|
|
81
|
-
roleIds:
|
|
82
|
-
onRoleIdsChange: (e) =>
|
|
81
|
+
roleIds: s.role_ids ?? [],
|
|
82
|
+
onRoleIdsChange: (e) => o(i, { role_ids: e }, `Change the roles for ${d}`)
|
|
83
83
|
}
|
|
84
84
|
) : /* @__PURE__ */ n(
|
|
85
|
-
|
|
85
|
+
S,
|
|
86
86
|
{
|
|
87
|
-
collection:
|
|
88
|
-
pipelineId:
|
|
89
|
-
stateKeys:
|
|
90
|
-
onPipelineChange: (e) =>
|
|
91
|
-
onStateKeysChange: (e) =>
|
|
87
|
+
collection: r.collection,
|
|
88
|
+
pipelineId: s.pipeline_id,
|
|
89
|
+
stateKeys: s.state_keys ?? [],
|
|
90
|
+
onPipelineChange: (e) => o(i, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${d}`),
|
|
91
|
+
onStateKeysChange: (e) => o(i, { state_keys: e }, `Change the states for ${d}`)
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
94
|
/* @__PURE__ */ n(
|
|
95
|
-
|
|
95
|
+
w,
|
|
96
96
|
{
|
|
97
97
|
ariaLabel: "Label in this case",
|
|
98
|
-
value:
|
|
99
|
-
placeholder: `Label (${
|
|
100
|
-
onChange: (e) =>
|
|
98
|
+
value: s.label ?? "",
|
|
99
|
+
placeholder: `Label (${d})`,
|
|
100
|
+
onChange: (e) => o(i, { label: e || void 0 }, `Change a label rule of ${d}`, !0)
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
103
|
/* @__PURE__ */ n(
|
|
104
|
-
|
|
104
|
+
w,
|
|
105
105
|
{
|
|
106
106
|
ariaLabel: "Help text in this case",
|
|
107
|
-
value:
|
|
107
|
+
value: s.note ?? "",
|
|
108
108
|
placeholder: "Help text (unchanged when empty)",
|
|
109
|
-
onChange: (e) =>
|
|
109
|
+
onChange: (e) => o(i, { note: e || void 0 }, `Change a help rule of ${d}`, !0)
|
|
110
110
|
}
|
|
111
111
|
)
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
|
-
|
|
114
|
+
i
|
|
115
115
|
)),
|
|
116
116
|
/* @__PURE__ */ n(
|
|
117
117
|
H,
|
|
118
118
|
{
|
|
119
119
|
onClick: () => u(
|
|
120
120
|
[...f, { type: "pipeline_state", state_keys: [] }],
|
|
121
|
-
`Add a label rule to ${
|
|
121
|
+
`Add a label rule to ${d}`
|
|
122
122
|
),
|
|
123
123
|
children: "+ Add a rule"
|
|
124
124
|
}
|
|
@@ -128,58 +128,58 @@ function re() {
|
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
function ie() {
|
|
131
|
-
const t =
|
|
132
|
-
if (!z(
|
|
133
|
-
const u =
|
|
131
|
+
const t = g(), { ov: a, info: l, env: r, row: c } = t, { data: d } = P(r.collection), f = I(d, c.field);
|
|
132
|
+
if (!z(l) || c.field.startsWith("__")) return null;
|
|
133
|
+
const u = l.label, o = M(a), s = (f == null ? void 0 : f.max_length) != null && f.max_length > 0 ? f.max_length : null, i = (e, h, b) => t.setOverride("counter", e, h, b);
|
|
134
134
|
return /* @__PURE__ */ m("div", { "data-setting": "field.counter", className: "space-y-3", children: [
|
|
135
135
|
/* @__PURE__ */ n(
|
|
136
|
-
|
|
136
|
+
p,
|
|
137
137
|
{
|
|
138
138
|
k: "field.counter.on",
|
|
139
139
|
label: "Counter and limit",
|
|
140
|
-
effect:
|
|
141
|
-
checked: !!
|
|
142
|
-
onChange: (e) =>
|
|
143
|
-
e ? { unit: "characters", ...
|
|
140
|
+
effect: s ? `Counts as people type. The limit starts at the column size (${s.toLocaleString()} characters); past it the form will not save.` : "Counts as people type; past a limit the form will not save.",
|
|
141
|
+
checked: !!o,
|
|
142
|
+
onChange: (e) => i(
|
|
143
|
+
e ? { unit: "characters", ...s ? { limit: s } : {} } : void 0,
|
|
144
144
|
e ? `Count the characters of ${u}` : `Stop counting ${u}`
|
|
145
145
|
)
|
|
146
146
|
}
|
|
147
147
|
),
|
|
148
|
-
|
|
149
|
-
/* @__PURE__ */ n(
|
|
148
|
+
o && /* @__PURE__ */ m(_, { children: [
|
|
149
|
+
/* @__PURE__ */ n(y, { k: "field.counter.unit", label: "Count", effect: "Characters or words.", children: /* @__PURE__ */ n(
|
|
150
150
|
k,
|
|
151
151
|
{
|
|
152
|
-
value:
|
|
152
|
+
value: o.unit,
|
|
153
153
|
options: [
|
|
154
154
|
{ value: "characters", label: "Characters" },
|
|
155
155
|
{ value: "words", label: "Words" }
|
|
156
156
|
],
|
|
157
|
-
onChange: (e) =>
|
|
157
|
+
onChange: (e) => i(
|
|
158
158
|
{
|
|
159
159
|
unit: e,
|
|
160
|
-
...e === "words" ? {} :
|
|
160
|
+
...e === "words" ? {} : o.limit != null ? { limit: o.limit } : s ? { limit: s } : {}
|
|
161
161
|
},
|
|
162
162
|
`Count the ${e} of ${u}`
|
|
163
163
|
)
|
|
164
164
|
}
|
|
165
165
|
) }),
|
|
166
166
|
/* @__PURE__ */ n(
|
|
167
|
-
|
|
167
|
+
y,
|
|
168
168
|
{
|
|
169
169
|
k: "field.counter.limit",
|
|
170
170
|
label: "Limit",
|
|
171
|
-
effect:
|
|
171
|
+
effect: o.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${s ? `; the column holds ${s.toLocaleString()}` : ""}.`,
|
|
172
172
|
children: /* @__PURE__ */ n(
|
|
173
|
-
|
|
173
|
+
w,
|
|
174
174
|
{
|
|
175
175
|
type: "number",
|
|
176
176
|
ariaLabel: "Limit",
|
|
177
|
-
value:
|
|
178
|
-
placeholder:
|
|
177
|
+
value: o.limit == null ? "" : String(o.limit),
|
|
178
|
+
placeholder: o.unit === "characters" && s ? String(s) : "No limit",
|
|
179
179
|
onChange: (e) => {
|
|
180
180
|
const h = e === "" ? void 0 : Math.max(1, Math.floor(Number(e)));
|
|
181
|
-
h !== void 0 && !Number.isFinite(h) ||
|
|
182
|
-
{ unit:
|
|
181
|
+
h !== void 0 && !Number.isFinite(h) || i(
|
|
182
|
+
{ unit: o.unit, ...h ? { limit: h } : {} },
|
|
183
183
|
`Set the limit of ${u}`,
|
|
184
184
|
!0
|
|
185
185
|
);
|
|
@@ -192,63 +192,63 @@ function ie() {
|
|
|
192
192
|
] });
|
|
193
193
|
}
|
|
194
194
|
function se() {
|
|
195
|
-
var
|
|
196
|
-
const t =
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
195
|
+
var d;
|
|
196
|
+
const t = g(), { ov: a, info: l, row: r } = t;
|
|
197
|
+
if (r.field.startsWith("__")) return null;
|
|
198
|
+
const c = a.required === !0 || a.required === void 0 && !!((d = l.global) != null && d.required);
|
|
199
199
|
return /* @__PURE__ */ n(
|
|
200
|
-
|
|
200
|
+
p,
|
|
201
201
|
{
|
|
202
202
|
k: "field.recommended",
|
|
203
203
|
label: "Recommended",
|
|
204
|
-
effect:
|
|
205
|
-
checked:
|
|
206
|
-
disabled:
|
|
204
|
+
effect: c ? "Required already wins; switch Required off to make this a recommendation." : "An amber marker and a reminder on save listing what is still empty. Saving is never blocked.",
|
|
205
|
+
checked: a.recommended === !0 && !c,
|
|
206
|
+
disabled: c,
|
|
207
207
|
onChange: (f) => t.setOverride(
|
|
208
208
|
"recommended",
|
|
209
209
|
f ? !0 : void 0,
|
|
210
|
-
f ? `Recommend ${
|
|
210
|
+
f ? `Recommend ${l.label}` : `Stop recommending ${l.label}`
|
|
211
211
|
)
|
|
212
212
|
}
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
const t =
|
|
217
|
-
if (!C(
|
|
218
|
-
const
|
|
215
|
+
function ce() {
|
|
216
|
+
const t = g(), { ov: a, info: l, env: r, row: c } = t;
|
|
217
|
+
if (!C(l, c.field)) return null;
|
|
218
|
+
const d = l.label, f = F(a), u = a.confirm_change && typeof a.confirm_change == "object" ? a.confirm_change : {}, o = typeof u.pipeline_id == "string" ? u.pipeline_id : void 0, s = (i, e) => t.setOverride("confirm_change", i, e);
|
|
219
219
|
return /* @__PURE__ */ m("div", { "data-setting": "field.confirm_change", className: "space-y-3", children: [
|
|
220
220
|
/* @__PURE__ */ n(
|
|
221
|
-
|
|
221
|
+
p,
|
|
222
222
|
{
|
|
223
223
|
k: "field.confirm_change.on",
|
|
224
224
|
label: "Confirm changes on saved records",
|
|
225
225
|
effect: "Changing it on an existing record asks “Are you sure?” and a short reason, kept with the change in the history. New records are not asked.",
|
|
226
226
|
checked: !!f,
|
|
227
|
-
onChange: (
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
onChange: (i) => s(
|
|
228
|
+
i ? { state_keys: [] } : void 0,
|
|
229
|
+
i ? `Confirm changes to ${d}` : `Stop confirming changes to ${d}`
|
|
230
230
|
)
|
|
231
231
|
}
|
|
232
232
|
),
|
|
233
233
|
f && /* @__PURE__ */ n(
|
|
234
|
-
|
|
234
|
+
y,
|
|
235
235
|
{
|
|
236
236
|
k: "field.confirm_change.states",
|
|
237
237
|
label: "Only in these states",
|
|
238
238
|
effect: f.state_keys.length ? "Asked only while the record is in a ticked state." : "No state ticked: asked in every state.",
|
|
239
239
|
children: /* @__PURE__ */ n(
|
|
240
|
-
|
|
240
|
+
S,
|
|
241
241
|
{
|
|
242
|
-
collection:
|
|
243
|
-
pipelineId:
|
|
242
|
+
collection: r.collection,
|
|
243
|
+
pipelineId: o,
|
|
244
244
|
stateKeys: f.state_keys,
|
|
245
|
-
onPipelineChange: (
|
|
246
|
-
{ ...
|
|
247
|
-
`Change the pipeline that confirms ${
|
|
245
|
+
onPipelineChange: (i) => s(
|
|
246
|
+
{ ...i ? { pipeline_id: i } : {}, state_keys: [] },
|
|
247
|
+
`Change the pipeline that confirms ${d}`
|
|
248
248
|
),
|
|
249
|
-
onStateKeysChange: (
|
|
250
|
-
{ ...
|
|
251
|
-
`Change the states that confirm ${
|
|
249
|
+
onStateKeysChange: (i) => s(
|
|
250
|
+
{ ...o ? { pipeline_id: o } : {}, state_keys: i },
|
|
251
|
+
`Change the states that confirm ${d}`
|
|
252
252
|
)
|
|
253
253
|
}
|
|
254
254
|
)
|
|
@@ -256,53 +256,70 @@ function de() {
|
|
|
256
256
|
)
|
|
257
257
|
] });
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
const t =
|
|
261
|
-
return !C(
|
|
262
|
-
|
|
259
|
+
function de() {
|
|
260
|
+
const t = g(), { ov: a, info: l, row: r } = t;
|
|
261
|
+
return !C(l, r.field) || l.computedType ? null : /* @__PURE__ */ n(
|
|
262
|
+
p,
|
|
263
263
|
{
|
|
264
264
|
k: "field.repeat_last",
|
|
265
265
|
label: "Repeat last value",
|
|
266
266
|
effect: "A “Repeat last” button beside the label fills in what this person entered on their previous record here.",
|
|
267
|
-
checked:
|
|
268
|
-
onChange: (
|
|
267
|
+
checked: a.repeat_last === !0,
|
|
268
|
+
onChange: (c) => t.setOverride(
|
|
269
269
|
"repeat_last",
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
c ? !0 : void 0,
|
|
271
|
+
c ? `Offer to repeat the last ${l.label}` : `Stop offering to repeat ${l.label}`
|
|
272
272
|
)
|
|
273
273
|
}
|
|
274
274
|
);
|
|
275
275
|
}
|
|
276
276
|
function fe() {
|
|
277
|
-
const t =
|
|
278
|
-
return !C(
|
|
279
|
-
|
|
277
|
+
const t = g(), { ov: a, info: l, row: r } = t;
|
|
278
|
+
return !C(l, r.field, { allowM2M: !0 }) || l.computedType ? null : /* @__PURE__ */ n(
|
|
279
|
+
p,
|
|
280
280
|
{
|
|
281
281
|
k: "field.personal_default",
|
|
282
282
|
label: "Personal default",
|
|
283
283
|
effect: "On this form, people can save their own starting value for this field, and new records start with it.",
|
|
284
|
-
checked:
|
|
285
|
-
onChange: (
|
|
284
|
+
checked: a.personal_default === !0,
|
|
285
|
+
onChange: (c) => t.setOverride(
|
|
286
286
|
"personal_default",
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
c ? !0 : void 0,
|
|
288
|
+
c ? `Allow personal defaults for ${l.label}` : `Stop personal defaults for ${l.label}`
|
|
289
289
|
)
|
|
290
290
|
}
|
|
291
291
|
);
|
|
292
292
|
}
|
|
293
293
|
function ue() {
|
|
294
|
-
const t =
|
|
295
|
-
return
|
|
296
|
-
|
|
294
|
+
const t = g(), { ov: a, info: l } = t;
|
|
295
|
+
return a.personal_default !== !0 ? null : /* @__PURE__ */ n(
|
|
296
|
+
p,
|
|
297
297
|
{
|
|
298
298
|
k: "field.personal_default_inline",
|
|
299
299
|
label: "Make default on the form",
|
|
300
300
|
effect: "People can save, update and clear their default right beside this field. Off: they manage it only on their profile (My defaults); the form still fills it in.",
|
|
301
|
-
checked:
|
|
302
|
-
onChange: (
|
|
301
|
+
checked: a.personal_default_inline !== !1,
|
|
302
|
+
onChange: (r) => t.setOverride(
|
|
303
303
|
"personal_default_inline",
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
r ? void 0 : !1,
|
|
305
|
+
r ? `Offer Make default on the form for ${l.label}` : `Keep ${l.label}'s default to the profile`
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function he() {
|
|
311
|
+
const t = g(), { ov: a, info: l } = t;
|
|
312
|
+
return l.type !== "boolean" ? null : /* @__PURE__ */ n(
|
|
313
|
+
p,
|
|
314
|
+
{
|
|
315
|
+
k: "field.summary_toggle",
|
|
316
|
+
label: "Switch it from Summary view",
|
|
317
|
+
effect: "In Summary view this yes/no is a switch people can flip without opening Edit. Their access and the edit lock are checked as for any save.",
|
|
318
|
+
checked: a.summary_toggle === !0,
|
|
319
|
+
onChange: (r) => t.setOverride(
|
|
320
|
+
"summary_toggle",
|
|
321
|
+
r ? !0 : void 0,
|
|
322
|
+
r ? `Let ${l.label} be switched from Summary view` : `Keep ${l.label} read-only in Summary view`
|
|
306
323
|
)
|
|
307
324
|
}
|
|
308
325
|
);
|
|
@@ -310,34 +327,34 @@ function ue() {
|
|
|
310
327
|
function B(t) {
|
|
311
328
|
return ["file", "file-image", "files-m2m"].includes(t.iface ?? "");
|
|
312
329
|
}
|
|
313
|
-
function
|
|
314
|
-
const t =
|
|
315
|
-
return B(
|
|
330
|
+
function me() {
|
|
331
|
+
const t = g(), { ov: a, info: l } = t;
|
|
332
|
+
return B(l) ? /* @__PURE__ */ m(_, { children: [
|
|
316
333
|
/* @__PURE__ */ n(
|
|
317
|
-
|
|
334
|
+
p,
|
|
318
335
|
{
|
|
319
336
|
k: "field.file_used_in",
|
|
320
337
|
label: "Show where each file was used",
|
|
321
338
|
effect: "A small chip on each file lists the addendum, integration push, email or generated document on this record that carried it.",
|
|
322
|
-
checked:
|
|
323
|
-
onChange: (
|
|
339
|
+
checked: a.file_used_in !== !1,
|
|
340
|
+
onChange: (r) => t.setOverride(
|
|
324
341
|
"file_used_in",
|
|
325
|
-
|
|
326
|
-
|
|
342
|
+
r ? void 0 : !1,
|
|
343
|
+
r ? `Show where ${l.label} files were used` : `Hide where ${l.label} files were used`
|
|
327
344
|
)
|
|
328
345
|
}
|
|
329
346
|
),
|
|
330
347
|
/* @__PURE__ */ n(
|
|
331
|
-
|
|
348
|
+
p,
|
|
332
349
|
{
|
|
333
350
|
k: "field.file_downloads",
|
|
334
351
|
label: "Show who downloaded each file",
|
|
335
352
|
effect: "Administrators see how many people downloaded each file from this record; hover names them. Everyone else sees nothing.",
|
|
336
|
-
checked:
|
|
337
|
-
onChange: (
|
|
353
|
+
checked: a.file_downloads !== !1,
|
|
354
|
+
onChange: (r) => t.setOverride(
|
|
338
355
|
"file_downloads",
|
|
339
|
-
|
|
340
|
-
|
|
356
|
+
r ? void 0 : !1,
|
|
357
|
+
r ? `Show downloads for ${l.label}` : `Hide downloads for ${l.label}`
|
|
341
358
|
)
|
|
342
359
|
}
|
|
343
360
|
)
|
|
@@ -350,11 +367,11 @@ const J = [
|
|
|
350
367
|
{ value: "currency", label: "Money" },
|
|
351
368
|
{ value: "percent", label: "Percent" }
|
|
352
369
|
];
|
|
353
|
-
function
|
|
370
|
+
function pe({
|
|
354
371
|
row: t,
|
|
355
|
-
fields:
|
|
372
|
+
fields: a
|
|
356
373
|
}) {
|
|
357
|
-
const
|
|
374
|
+
const l = j(), r = O(() => {
|
|
358
375
|
const e = t.overrides;
|
|
359
376
|
if (typeof e == "string")
|
|
360
377
|
try {
|
|
@@ -363,32 +380,32 @@ function me({
|
|
|
363
380
|
return {};
|
|
364
381
|
}
|
|
365
382
|
return e && typeof e == "object" ? e : {};
|
|
366
|
-
}, [t.overrides]),
|
|
367
|
-
const
|
|
368
|
-
for (const x of Object.keys(
|
|
369
|
-
|
|
383
|
+
}, [t.overrides]), c = N(r) ?? { expr: "", format: "", currency: null }, d = typeof r.label == "string" ? r.label : "", f = { field: t.field, group_key: t.group_key }, u = (e, h, b) => {
|
|
384
|
+
const v = { ...r, ...e };
|
|
385
|
+
for (const x of Object.keys(v)) v[x] === void 0 && delete v[x];
|
|
386
|
+
l.apply([{ op: "update_placement", at: f, patch: { overrides: v } }], {
|
|
370
387
|
label: h,
|
|
371
|
-
text:
|
|
388
|
+
text: b
|
|
372
389
|
});
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
),
|
|
390
|
+
}, o = c.expr.trim() ? T(c.expr, a) : null, s = new Set(
|
|
391
|
+
l.bundle.placements.filter((e) => !e.field.startsWith("__")).map((e) => e.field)
|
|
392
|
+
), i = o != null && o.ok ? o.tokens.filter((e) => !s.has(e.split(".")[0])) : [];
|
|
376
393
|
return /* @__PURE__ */ m("div", { className: "space-y-5", children: [
|
|
377
|
-
/* @__PURE__ */ n(
|
|
378
|
-
|
|
394
|
+
/* @__PURE__ */ n(y, { k: "display_formula.label", label: "Label", effect: "What the form calls the value.", children: /* @__PURE__ */ n(
|
|
395
|
+
w,
|
|
379
396
|
{
|
|
380
397
|
ariaLabel: "Label",
|
|
381
|
-
value:
|
|
398
|
+
value: d,
|
|
382
399
|
placeholder: "Remaining",
|
|
383
400
|
onChange: (e) => u({ label: e || void 0 }, "Rename the formula", !0)
|
|
384
401
|
}
|
|
385
402
|
) }),
|
|
386
403
|
/* @__PURE__ */ m(
|
|
387
|
-
|
|
404
|
+
y,
|
|
388
405
|
{
|
|
389
406
|
k: "display_formula.expr",
|
|
390
407
|
label: "Formula",
|
|
391
|
-
effect: /* @__PURE__ */ m(
|
|
408
|
+
effect: /* @__PURE__ */ m(_, { children: [
|
|
392
409
|
"Fields in double braces, for example",
|
|
393
410
|
" ",
|
|
394
411
|
/* @__PURE__ */ n("code", { className: "font-mono text-[11.5px]", children: "{{budget}} - {{committed}}" }),
|
|
@@ -401,42 +418,42 @@ function me({
|
|
|
401
418
|
ariaLabel: "Formula",
|
|
402
419
|
rows: 3,
|
|
403
420
|
mono: !0,
|
|
404
|
-
value:
|
|
405
|
-
onChange: (e) => u({ display_formula: { ...
|
|
421
|
+
value: c.expr,
|
|
422
|
+
onChange: (e) => u({ display_formula: { ...c, expr: e } }, "Change the formula", !0)
|
|
406
423
|
}
|
|
407
424
|
),
|
|
408
|
-
|
|
425
|
+
o && !o.ok && /* @__PURE__ */ n(
|
|
409
426
|
"p",
|
|
410
427
|
{
|
|
411
428
|
role: "alert",
|
|
412
429
|
"data-formula-error": "",
|
|
413
430
|
className: "text-[12px] text-red-700 dark:text-red-300",
|
|
414
|
-
children:
|
|
431
|
+
children: o.error
|
|
415
432
|
}
|
|
416
433
|
),
|
|
417
|
-
(
|
|
434
|
+
(o == null ? void 0 : o.ok) && o.unknownTokens.length > 0 && /* @__PURE__ */ m("p", { "data-formula-unknown": "", className: "text-[12px] text-amber-700 dark:text-amber-300", children: [
|
|
418
435
|
"Not fields of this collection:",
|
|
419
436
|
" ",
|
|
420
|
-
/* @__PURE__ */ n("span", { className: "font-mono", children:
|
|
437
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: o.unknownTokens.join(", ") })
|
|
421
438
|
] }),
|
|
422
|
-
(
|
|
439
|
+
(o == null ? void 0 : o.ok) && !o.unknownTokens.length && i.length > 0 && /* @__PURE__ */ m("p", { "data-formula-offform": "", className: D, children: [
|
|
423
440
|
"Not on this form, so they read as empty here:",
|
|
424
441
|
" ",
|
|
425
|
-
/* @__PURE__ */ n("span", { className: "font-mono", children:
|
|
442
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: i.join(", ") })
|
|
426
443
|
] })
|
|
427
444
|
]
|
|
428
445
|
}
|
|
429
446
|
),
|
|
430
|
-
/* @__PURE__ */ n(
|
|
447
|
+
/* @__PURE__ */ n(y, { k: "display_formula.format", label: "Show as", effect: "How the number is written.", children: /* @__PURE__ */ n(
|
|
431
448
|
k,
|
|
432
449
|
{
|
|
433
|
-
value:
|
|
450
|
+
value: c.format,
|
|
434
451
|
options: J,
|
|
435
|
-
onChange: (e) => u({ display_formula: { ...
|
|
452
|
+
onChange: (e) => u({ display_formula: { ...c, format: e } }, "Change how the formula shows")
|
|
436
453
|
}
|
|
437
454
|
) }),
|
|
438
|
-
|
|
439
|
-
|
|
455
|
+
c.format === "currency" && /* @__PURE__ */ n(
|
|
456
|
+
y,
|
|
440
457
|
{
|
|
441
458
|
k: "display_formula.currency",
|
|
442
459
|
label: "Currency",
|
|
@@ -445,13 +462,13 @@ function me({
|
|
|
445
462
|
E,
|
|
446
463
|
{
|
|
447
464
|
ariaLabel: "Currency",
|
|
448
|
-
value:
|
|
465
|
+
value: c.currency ?? "",
|
|
449
466
|
mono: !0,
|
|
450
467
|
placeholder: "USD",
|
|
451
468
|
onCommit: (e) => {
|
|
452
469
|
const h = e.trim().toUpperCase();
|
|
453
470
|
h && !/^[A-Z]{3}$/.test(h) || u(
|
|
454
|
-
{ display_formula: { ...
|
|
471
|
+
{ display_formula: { ...c, currency: h || null } },
|
|
455
472
|
"Change the currency of the formula",
|
|
456
473
|
!0
|
|
457
474
|
);
|
|
@@ -463,14 +480,15 @@ function me({
|
|
|
463
480
|
] });
|
|
464
481
|
}
|
|
465
482
|
export {
|
|
466
|
-
|
|
483
|
+
ce as ConfirmChangeSetting,
|
|
467
484
|
ie as CounterSetting,
|
|
468
|
-
|
|
469
|
-
|
|
485
|
+
pe as DisplayFormulaSettings,
|
|
486
|
+
me as FileChipToggles,
|
|
470
487
|
ue as PersonalDefaultInlineToggle,
|
|
471
488
|
fe as PersonalDefaultToggle,
|
|
472
489
|
se as RecommendedToggle,
|
|
473
|
-
|
|
490
|
+
de as RepeatLastToggle,
|
|
491
|
+
he as SummaryToggleSetting,
|
|
474
492
|
re as TextRulesSetting,
|
|
475
493
|
z as takesText
|
|
476
494
|
};
|