@nivaro/react 0.3.32 → 0.3.34
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 +89 -8
- package/dist/index.js +338 -328
- package/dist/shared/components/ForceReloadBanner.js +56 -46
- package/dist/shared/components/ItemEditForm.js +5637 -5442
- package/dist/shared/components/ProfileView.js +46 -44
- package/dist/shared/components/ReportView.js +208 -205
- package/dist/shared/components/SearchHighlight.js +30 -0
- package/dist/shared/components/TipLayer.js +39 -37
- package/dist/shared/components/item-edit/CatalogPickerField.js +1484 -1232
- package/dist/shared/components/item-edit/FieldAffordances.js +370 -203
- package/dist/shared/components/item-edit/FieldRow.js +396 -354
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +50 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +42 -41
- package/dist/shared/components/item-edit/catalog-search.js +34 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +34 -34
- package/dist/shared/components/item-edit/personal-default-checks.js +134 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +358 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +130 -111
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +76 -75
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/profile/MyDefaultsCard.js +667 -0
- package/dist/shared/components/profile/PersonProfile.js +42 -40
- package/dist/shared/components/profile/my-defaults-labels.js +76 -0
- package/dist/shared/components/profile/primitives.js +72 -67
- package/dist/shared/lib/personal-defaults.js +76 -0
- package/dist/shared/lib/request-gate.js +78 -76
- package/dist/shared/lib/search-text.js +111 -0
- package/dist/shared/lib/unsaved-work.js +86 -38
- package/package.json +1 -1
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { jsxs as h, jsx as a, Fragment as C } from "react/jsx-runtime";
|
|
2
|
-
import { X as
|
|
2
|
+
import { X as S } from "lucide-react";
|
|
3
3
|
import { useMemo as N } from "react";
|
|
4
4
|
import { validateExpression as R } from "../../../lib/expression.js";
|
|
5
|
-
import { displayFormulaOf as T, textRulesOf as O, counterOf as L, confirmChangeOf as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { RoleConditionRow as
|
|
8
|
-
import { useColumnFacts as
|
|
9
|
-
import { effectText as
|
|
5
|
+
import { displayFormulaOf as T, textRulesOf as O, counterOf as L, confirmChangeOf as M } from "../../../lib/placement-behaviour.js";
|
|
6
|
+
import { cn as F } from "../../../lib/utils.js";
|
|
7
|
+
import { RoleConditionRow as A, PipelineStateConditionRow as $ } from "../editors/lock-conditions.js";
|
|
8
|
+
import { useColumnFacts as P, columnOf as D } from "../inspect/inspect-api.js";
|
|
9
|
+
import { effectText as I, tintCard as W } from "../panel-style.js";
|
|
10
10
|
import { isRelational as j } from "./applies.js";
|
|
11
11
|
import { useFieldCtx as b } from "./field-context.js";
|
|
12
|
-
import { useInspectorEnv as q, Setting as p, TextInput as
|
|
12
|
+
import { useInspectorEnv as q, Setting as p, TextInput as _, TextArea as K, Segmented as k, DraftInput as E, AddButton as H, Toggle as v } 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(o) {
|
|
15
15
|
if (j(o)) return !1;
|
|
16
16
|
const s = o.iface ?? "";
|
|
17
17
|
return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(o.type) || /textarea|rich|wysiwyg|markdown/i.test(s);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function w(o, s, r = {}) {
|
|
20
|
+
const u = r.allowM2M === !0 && o.relKind === "M2M";
|
|
21
|
+
return !s.startsWith("__") && !o.isPath && (u || o.type !== "alias" && o.relKind !== "M2M") && o.relKind !== "O2M" && o.computedType !== "virtual" && o.computedType !== "read";
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const o = b(), { ov: s, info:
|
|
24
|
-
|
|
23
|
+
function le() {
|
|
24
|
+
const o = b(), { ov: s, info: r, env: u, row: i } = o, c = r.label, d = O(s), f = (l, n, e) => o.setOverride("text_rules", l.length ? l : void 0, n, e), t = (l, n, e, m) => f(
|
|
25
|
+
d.map((g, y) => y === l ? { ...g, ...n } : g),
|
|
25
26
|
e,
|
|
26
27
|
m
|
|
27
28
|
);
|
|
28
|
-
return
|
|
29
|
+
return i.field.startsWith("__") ? null : /* @__PURE__ */ h(
|
|
29
30
|
p,
|
|
30
31
|
{
|
|
31
32
|
k: "field.text_rules",
|
|
32
33
|
label: "Label and help by state or role",
|
|
33
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.",
|
|
34
35
|
children: [
|
|
35
|
-
|
|
36
|
+
d.map((l, n) => /* @__PURE__ */ h(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
38
39
|
"data-text-rule": n,
|
|
39
|
-
className:
|
|
40
|
+
className: F(W, "space-y-2 px-2.5 py-2"),
|
|
40
41
|
children: [
|
|
41
42
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
42
43
|
/* @__PURE__ */ a("div", { className: "flex-1", children: /* @__PURE__ */ a(
|
|
43
44
|
k,
|
|
44
45
|
{
|
|
45
|
-
value:
|
|
46
|
+
value: l.type,
|
|
46
47
|
options: [
|
|
47
48
|
{ value: "pipeline_state", label: "In a state" },
|
|
48
49
|
{ value: "role", label: "For a role" }
|
|
@@ -55,7 +56,7 @@ function re() {
|
|
|
55
56
|
state_keys: void 0,
|
|
56
57
|
pipeline_id: void 0
|
|
57
58
|
} : { type: "pipeline_state", state_keys: [], role_ids: void 0 },
|
|
58
|
-
`Change when ${
|
|
59
|
+
`Change when ${c} reads differently`
|
|
59
60
|
)
|
|
60
61
|
}
|
|
61
62
|
) }),
|
|
@@ -66,46 +67,46 @@ function re() {
|
|
|
66
67
|
"aria-label": "Remove this rule",
|
|
67
68
|
"data-tip": "Remove this rule",
|
|
68
69
|
className: U,
|
|
69
|
-
onClick: () =>
|
|
70
|
-
|
|
71
|
-
`Remove a label rule from ${
|
|
70
|
+
onClick: () => f(
|
|
71
|
+
d.filter((e, m) => m !== n),
|
|
72
|
+
`Remove a label rule from ${c}`
|
|
72
73
|
),
|
|
73
|
-
children: /* @__PURE__ */ a(
|
|
74
|
+
children: /* @__PURE__ */ a(S, { className: "h-3.5 w-3.5" })
|
|
74
75
|
}
|
|
75
76
|
)
|
|
76
77
|
] }),
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
l.type === "role" ? /* @__PURE__ */ a(
|
|
79
|
+
A,
|
|
79
80
|
{
|
|
80
|
-
roleIds:
|
|
81
|
-
onRoleIdsChange: (e) => t(n, { role_ids: e }, `Change the roles for ${
|
|
81
|
+
roleIds: l.role_ids ?? [],
|
|
82
|
+
onRoleIdsChange: (e) => t(n, { role_ids: e }, `Change the roles for ${c}`)
|
|
82
83
|
}
|
|
83
84
|
) : /* @__PURE__ */ a(
|
|
84
|
-
|
|
85
|
+
$,
|
|
85
86
|
{
|
|
86
|
-
collection:
|
|
87
|
-
pipelineId:
|
|
88
|
-
stateKeys:
|
|
89
|
-
onPipelineChange: (e) => t(n, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${
|
|
90
|
-
onStateKeysChange: (e) => t(n, { state_keys: e }, `Change the states for ${
|
|
87
|
+
collection: u.collection,
|
|
88
|
+
pipelineId: l.pipeline_id,
|
|
89
|
+
stateKeys: l.state_keys ?? [],
|
|
90
|
+
onPipelineChange: (e) => t(n, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${c}`),
|
|
91
|
+
onStateKeysChange: (e) => t(n, { state_keys: e }, `Change the states for ${c}`)
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
94
|
/* @__PURE__ */ a(
|
|
94
|
-
|
|
95
|
+
_,
|
|
95
96
|
{
|
|
96
97
|
ariaLabel: "Label in this case",
|
|
97
|
-
value:
|
|
98
|
-
placeholder: `Label (${
|
|
99
|
-
onChange: (e) => t(n, { label: e || void 0 }, `Change a label rule of ${
|
|
98
|
+
value: l.label ?? "",
|
|
99
|
+
placeholder: `Label (${c})`,
|
|
100
|
+
onChange: (e) => t(n, { label: e || void 0 }, `Change a label rule of ${c}`, !0)
|
|
100
101
|
}
|
|
101
102
|
),
|
|
102
103
|
/* @__PURE__ */ a(
|
|
103
|
-
|
|
104
|
+
_,
|
|
104
105
|
{
|
|
105
106
|
ariaLabel: "Help text in this case",
|
|
106
|
-
value:
|
|
107
|
+
value: l.note ?? "",
|
|
107
108
|
placeholder: "Help text (unchanged when empty)",
|
|
108
|
-
onChange: (e) => t(n, { note: e || void 0 }, `Change a help rule of ${
|
|
109
|
+
onChange: (e) => t(n, { note: e || void 0 }, `Change a help rule of ${c}`, !0)
|
|
109
110
|
}
|
|
110
111
|
)
|
|
111
112
|
]
|
|
@@ -115,9 +116,9 @@ function re() {
|
|
|
115
116
|
/* @__PURE__ */ a(
|
|
116
117
|
H,
|
|
117
118
|
{
|
|
118
|
-
onClick: () =>
|
|
119
|
-
[...
|
|
120
|
-
`Add a label rule to ${
|
|
119
|
+
onClick: () => f(
|
|
120
|
+
[...d, { type: "pipeline_state", state_keys: [] }],
|
|
121
|
+
`Add a label rule to ${c}`
|
|
121
122
|
),
|
|
122
123
|
children: "+ Add a rule"
|
|
123
124
|
}
|
|
@@ -126,21 +127,21 @@ function re() {
|
|
|
126
127
|
}
|
|
127
128
|
);
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
-
const o = b(), { ov: s, info:
|
|
131
|
-
if (!z(
|
|
132
|
-
const
|
|
130
|
+
function re() {
|
|
131
|
+
const o = b(), { ov: s, info: r, env: u, row: i } = o, { data: c } = P(u.collection), d = D(c, i.field);
|
|
132
|
+
if (!z(r) || i.field.startsWith("__")) return null;
|
|
133
|
+
const f = r.label, t = L(s), l = (d == null ? void 0 : d.max_length) != null && d.max_length > 0 ? d.max_length : null, n = (e, m, g) => o.setOverride("counter", e, m, g);
|
|
133
134
|
return /* @__PURE__ */ h("div", { "data-setting": "field.counter", className: "space-y-3", children: [
|
|
134
135
|
/* @__PURE__ */ a(
|
|
135
|
-
|
|
136
|
+
v,
|
|
136
137
|
{
|
|
137
138
|
k: "field.counter.on",
|
|
138
139
|
label: "Counter and limit",
|
|
139
|
-
effect:
|
|
140
|
+
effect: l ? `Counts as people type. The limit starts at the column size (${l.toLocaleString()} characters); past it the form will not save.` : "Counts as people type; past a limit the form will not save.",
|
|
140
141
|
checked: !!t,
|
|
141
142
|
onChange: (e) => n(
|
|
142
|
-
e ? { unit: "characters", ...
|
|
143
|
-
e ? `Count the characters of ${
|
|
143
|
+
e ? { unit: "characters", ...l ? { limit: l } : {} } : void 0,
|
|
144
|
+
e ? `Count the characters of ${f}` : `Stop counting ${f}`
|
|
144
145
|
)
|
|
145
146
|
}
|
|
146
147
|
),
|
|
@@ -156,9 +157,9 @@ function le() {
|
|
|
156
157
|
onChange: (e) => n(
|
|
157
158
|
{
|
|
158
159
|
unit: e,
|
|
159
|
-
...e === "words" ? {} : t.limit != null ? { limit: t.limit } :
|
|
160
|
+
...e === "words" ? {} : t.limit != null ? { limit: t.limit } : l ? { limit: l } : {}
|
|
160
161
|
},
|
|
161
|
-
`Count the ${e} of ${
|
|
162
|
+
`Count the ${e} of ${f}`
|
|
162
163
|
)
|
|
163
164
|
}
|
|
164
165
|
) }),
|
|
@@ -167,19 +168,19 @@ function le() {
|
|
|
167
168
|
{
|
|
168
169
|
k: "field.counter.limit",
|
|
169
170
|
label: "Limit",
|
|
170
|
-
effect: t.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${
|
|
171
|
+
effect: t.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${l ? `; the column holds ${l.toLocaleString()}` : ""}.`,
|
|
171
172
|
children: /* @__PURE__ */ a(
|
|
172
|
-
|
|
173
|
+
_,
|
|
173
174
|
{
|
|
174
175
|
type: "number",
|
|
175
176
|
ariaLabel: "Limit",
|
|
176
177
|
value: t.limit == null ? "" : String(t.limit),
|
|
177
|
-
placeholder: t.unit === "characters" &&
|
|
178
|
+
placeholder: t.unit === "characters" && l ? String(l) : "No limit",
|
|
178
179
|
onChange: (e) => {
|
|
179
180
|
const m = e === "" ? void 0 : Math.max(1, Math.floor(Number(e)));
|
|
180
181
|
m !== void 0 && !Number.isFinite(m) || n(
|
|
181
182
|
{ unit: t.unit, ...m ? { limit: m } : {} },
|
|
182
|
-
`Set the limit of ${
|
|
183
|
+
`Set the limit of ${f}`,
|
|
183
184
|
!0
|
|
184
185
|
);
|
|
185
186
|
}
|
|
@@ -191,63 +192,63 @@ function le() {
|
|
|
191
192
|
] });
|
|
192
193
|
}
|
|
193
194
|
function ie() {
|
|
194
|
-
var
|
|
195
|
-
const o = b(), { ov: s, info:
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
195
|
+
var c;
|
|
196
|
+
const o = b(), { ov: s, info: r, row: u } = o;
|
|
197
|
+
if (u.field.startsWith("__")) return null;
|
|
198
|
+
const i = s.required === !0 || s.required === void 0 && !!((c = r.global) != null && c.required);
|
|
198
199
|
return /* @__PURE__ */ a(
|
|
199
|
-
|
|
200
|
+
v,
|
|
200
201
|
{
|
|
201
202
|
k: "field.recommended",
|
|
202
203
|
label: "Recommended",
|
|
203
|
-
effect:
|
|
204
|
-
checked: s.recommended === !0 && !
|
|
205
|
-
disabled:
|
|
206
|
-
onChange: (
|
|
204
|
+
effect: i ? "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: s.recommended === !0 && !i,
|
|
206
|
+
disabled: i,
|
|
207
|
+
onChange: (d) => o.setOverride(
|
|
207
208
|
"recommended",
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
d ? !0 : void 0,
|
|
210
|
+
d ? `Recommend ${r.label}` : `Stop recommending ${r.label}`
|
|
210
211
|
)
|
|
211
212
|
}
|
|
212
213
|
);
|
|
213
214
|
}
|
|
214
215
|
function se() {
|
|
215
|
-
const o = b(), { ov: s, info:
|
|
216
|
-
if (!
|
|
217
|
-
const
|
|
216
|
+
const o = b(), { ov: s, info: r, env: u, row: i } = o;
|
|
217
|
+
if (!w(r, i.field)) return null;
|
|
218
|
+
const c = r.label, d = M(s), f = s.confirm_change && typeof s.confirm_change == "object" ? s.confirm_change : {}, t = typeof f.pipeline_id == "string" ? f.pipeline_id : void 0, l = (n, e) => o.setOverride("confirm_change", n, e);
|
|
218
219
|
return /* @__PURE__ */ h("div", { "data-setting": "field.confirm_change", className: "space-y-3", children: [
|
|
219
220
|
/* @__PURE__ */ a(
|
|
220
|
-
|
|
221
|
+
v,
|
|
221
222
|
{
|
|
222
223
|
k: "field.confirm_change.on",
|
|
223
224
|
label: "Confirm changes on saved records",
|
|
224
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.",
|
|
225
|
-
checked: !!
|
|
226
|
-
onChange: (n) =>
|
|
226
|
+
checked: !!d,
|
|
227
|
+
onChange: (n) => l(
|
|
227
228
|
n ? { state_keys: [] } : void 0,
|
|
228
|
-
n ? `Confirm changes to ${
|
|
229
|
+
n ? `Confirm changes to ${c}` : `Stop confirming changes to ${c}`
|
|
229
230
|
)
|
|
230
231
|
}
|
|
231
232
|
),
|
|
232
|
-
|
|
233
|
+
d && /* @__PURE__ */ a(
|
|
233
234
|
p,
|
|
234
235
|
{
|
|
235
236
|
k: "field.confirm_change.states",
|
|
236
237
|
label: "Only in these states",
|
|
237
|
-
effect:
|
|
238
|
+
effect: d.state_keys.length ? "Asked only while the record is in a ticked state." : "No state ticked: asked in every state.",
|
|
238
239
|
children: /* @__PURE__ */ a(
|
|
239
|
-
|
|
240
|
+
$,
|
|
240
241
|
{
|
|
241
|
-
collection:
|
|
242
|
+
collection: u.collection,
|
|
242
243
|
pipelineId: t,
|
|
243
|
-
stateKeys:
|
|
244
|
-
onPipelineChange: (n) =>
|
|
244
|
+
stateKeys: d.state_keys,
|
|
245
|
+
onPipelineChange: (n) => l(
|
|
245
246
|
{ ...n ? { pipeline_id: n } : {}, state_keys: [] },
|
|
246
|
-
`Change the pipeline that confirms ${
|
|
247
|
+
`Change the pipeline that confirms ${c}`
|
|
247
248
|
),
|
|
248
|
-
onStateKeysChange: (n) =>
|
|
249
|
+
onStateKeysChange: (n) => l(
|
|
249
250
|
{ ...t ? { pipeline_id: t } : {}, state_keys: n },
|
|
250
|
-
`Change the states that confirm ${
|
|
251
|
+
`Change the states that confirm ${c}`
|
|
251
252
|
)
|
|
252
253
|
}
|
|
253
254
|
)
|
|
@@ -256,18 +257,35 @@ function se() {
|
|
|
256
257
|
] });
|
|
257
258
|
}
|
|
258
259
|
function ce() {
|
|
259
|
-
const o = b(), { ov: s, info:
|
|
260
|
-
return !
|
|
261
|
-
|
|
260
|
+
const o = b(), { ov: s, info: r, row: u } = o;
|
|
261
|
+
return !w(r, u.field) || r.computedType ? null : /* @__PURE__ */ a(
|
|
262
|
+
v,
|
|
262
263
|
{
|
|
263
264
|
k: "field.repeat_last",
|
|
264
265
|
label: "Repeat last value",
|
|
265
266
|
effect: "A “Repeat last” button beside the label fills in what this person entered on their previous record here.",
|
|
266
267
|
checked: s.repeat_last === !0,
|
|
267
|
-
onChange: (
|
|
268
|
+
onChange: (i) => o.setOverride(
|
|
268
269
|
"repeat_last",
|
|
269
|
-
|
|
270
|
-
|
|
270
|
+
i ? !0 : void 0,
|
|
271
|
+
i ? `Offer to repeat the last ${r.label}` : `Stop offering to repeat ${r.label}`
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
function de() {
|
|
277
|
+
const o = b(), { ov: s, info: r, row: u } = o;
|
|
278
|
+
return !w(r, u.field, { allowM2M: !0 }) || r.computedType ? null : /* @__PURE__ */ a(
|
|
279
|
+
v,
|
|
280
|
+
{
|
|
281
|
+
k: "field.personal_default",
|
|
282
|
+
label: "Personal default",
|
|
283
|
+
effect: "On this form, people can save their own starting value for this field, and new records start with it.",
|
|
284
|
+
checked: s.personal_default === !0,
|
|
285
|
+
onChange: (i) => o.setOverride(
|
|
286
|
+
"personal_default",
|
|
287
|
+
i ? !0 : void 0,
|
|
288
|
+
i ? `Allow personal defaults for ${r.label}` : `Stop personal defaults for ${r.label}`
|
|
271
289
|
)
|
|
272
290
|
}
|
|
273
291
|
);
|
|
@@ -279,11 +297,11 @@ const B = [
|
|
|
279
297
|
{ value: "currency", label: "Money" },
|
|
280
298
|
{ value: "percent", label: "Percent" }
|
|
281
299
|
];
|
|
282
|
-
function
|
|
300
|
+
function ue({
|
|
283
301
|
row: o,
|
|
284
302
|
fields: s
|
|
285
303
|
}) {
|
|
286
|
-
const
|
|
304
|
+
const r = q(), u = N(() => {
|
|
287
305
|
const e = o.overrides;
|
|
288
306
|
if (typeof e == "string")
|
|
289
307
|
try {
|
|
@@ -292,24 +310,24 @@ function de({
|
|
|
292
310
|
return {};
|
|
293
311
|
}
|
|
294
312
|
return e && typeof e == "object" ? e : {};
|
|
295
|
-
}, [o.overrides]),
|
|
296
|
-
const y = { ...
|
|
313
|
+
}, [o.overrides]), i = T(u) ?? { expr: "", format: "", currency: null }, c = typeof u.label == "string" ? u.label : "", d = { field: o.field, group_key: o.group_key }, f = (e, m, g) => {
|
|
314
|
+
const y = { ...u, ...e };
|
|
297
315
|
for (const x of Object.keys(y)) y[x] === void 0 && delete y[x];
|
|
298
|
-
|
|
316
|
+
r.apply([{ op: "update_placement", at: d, patch: { overrides: y } }], {
|
|
299
317
|
label: m,
|
|
300
318
|
text: g
|
|
301
319
|
});
|
|
302
|
-
}, t =
|
|
303
|
-
|
|
304
|
-
), n = t != null && t.ok ? t.tokens.filter((e) => !
|
|
320
|
+
}, t = i.expr.trim() ? R(i.expr, s) : null, l = new Set(
|
|
321
|
+
r.bundle.placements.filter((e) => !e.field.startsWith("__")).map((e) => e.field)
|
|
322
|
+
), n = t != null && t.ok ? t.tokens.filter((e) => !l.has(e.split(".")[0])) : [];
|
|
305
323
|
return /* @__PURE__ */ h("div", { className: "space-y-5", children: [
|
|
306
324
|
/* @__PURE__ */ a(p, { k: "display_formula.label", label: "Label", effect: "What the form calls the value.", children: /* @__PURE__ */ a(
|
|
307
|
-
|
|
325
|
+
_,
|
|
308
326
|
{
|
|
309
327
|
ariaLabel: "Label",
|
|
310
|
-
value:
|
|
328
|
+
value: c,
|
|
311
329
|
placeholder: "Remaining",
|
|
312
|
-
onChange: (e) =>
|
|
330
|
+
onChange: (e) => f({ label: e || void 0 }, "Rename the formula", !0)
|
|
313
331
|
}
|
|
314
332
|
) }),
|
|
315
333
|
/* @__PURE__ */ h(
|
|
@@ -330,8 +348,8 @@ function de({
|
|
|
330
348
|
ariaLabel: "Formula",
|
|
331
349
|
rows: 3,
|
|
332
350
|
mono: !0,
|
|
333
|
-
value:
|
|
334
|
-
onChange: (e) =>
|
|
351
|
+
value: i.expr,
|
|
352
|
+
onChange: (e) => f({ display_formula: { ...i, expr: e } }, "Change the formula", !0)
|
|
335
353
|
}
|
|
336
354
|
),
|
|
337
355
|
t && !t.ok && /* @__PURE__ */ a(
|
|
@@ -348,7 +366,7 @@ function de({
|
|
|
348
366
|
" ",
|
|
349
367
|
/* @__PURE__ */ a("span", { className: "font-mono", children: t.unknownTokens.join(", ") })
|
|
350
368
|
] }),
|
|
351
|
-
(t == null ? void 0 : t.ok) && !t.unknownTokens.length && n.length > 0 && /* @__PURE__ */ h("p", { "data-formula-offform": "", className:
|
|
369
|
+
(t == null ? void 0 : t.ok) && !t.unknownTokens.length && n.length > 0 && /* @__PURE__ */ h("p", { "data-formula-offform": "", className: I, children: [
|
|
352
370
|
"Not on this form, so they read as empty here:",
|
|
353
371
|
" ",
|
|
354
372
|
/* @__PURE__ */ a("span", { className: "font-mono", children: n.join(", ") })
|
|
@@ -359,12 +377,12 @@ function de({
|
|
|
359
377
|
/* @__PURE__ */ a(p, { k: "display_formula.format", label: "Show as", effect: "How the number is written.", children: /* @__PURE__ */ a(
|
|
360
378
|
k,
|
|
361
379
|
{
|
|
362
|
-
value:
|
|
380
|
+
value: i.format,
|
|
363
381
|
options: B,
|
|
364
|
-
onChange: (e) =>
|
|
382
|
+
onChange: (e) => f({ display_formula: { ...i, format: e } }, "Change how the formula shows")
|
|
365
383
|
}
|
|
366
384
|
) }),
|
|
367
|
-
|
|
385
|
+
i.format === "currency" && /* @__PURE__ */ a(
|
|
368
386
|
p,
|
|
369
387
|
{
|
|
370
388
|
k: "display_formula.currency",
|
|
@@ -374,13 +392,13 @@ function de({
|
|
|
374
392
|
E,
|
|
375
393
|
{
|
|
376
394
|
ariaLabel: "Currency",
|
|
377
|
-
value:
|
|
395
|
+
value: i.currency ?? "",
|
|
378
396
|
mono: !0,
|
|
379
397
|
placeholder: "USD",
|
|
380
398
|
onCommit: (e) => {
|
|
381
399
|
const m = e.trim().toUpperCase();
|
|
382
|
-
m && !/^[A-Z]{3}$/.test(m) ||
|
|
383
|
-
{ display_formula: { ...
|
|
400
|
+
m && !/^[A-Z]{3}$/.test(m) || f(
|
|
401
|
+
{ display_formula: { ...i, currency: m || null } },
|
|
384
402
|
"Change the currency of the formula",
|
|
385
403
|
!0
|
|
386
404
|
);
|
|
@@ -393,10 +411,11 @@ function de({
|
|
|
393
411
|
}
|
|
394
412
|
export {
|
|
395
413
|
se as ConfirmChangeSetting,
|
|
396
|
-
|
|
397
|
-
|
|
414
|
+
re as CounterSetting,
|
|
415
|
+
ue as DisplayFormulaSettings,
|
|
416
|
+
de as PersonalDefaultToggle,
|
|
398
417
|
ie as RecommendedToggle,
|
|
399
418
|
ce as RepeatLastToggle,
|
|
400
|
-
|
|
419
|
+
le as TextRulesSetting,
|
|
401
420
|
z as takesText
|
|
402
421
|
};
|