@nivaro/react 0.3.46 → 0.3.47
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 +248 -16
- package/dist/index.js +679 -659
- package/dist/shared/components/CollectionBrowserView.js +813 -826
- package/dist/shared/components/ErrorNotice.js +169 -0
- package/dist/shared/components/ErrorSurface.js +23 -17
- package/dist/shared/components/ListLoadError.js +8 -29
- package/dist/shared/components/LoadErrorNote.js +38 -21
- package/dist/shared/components/QueryErrorState.js +8 -11
- package/dist/shared/components/ReportView.js +1320 -1291
- package/dist/shared/components/chat/ChannelArchive.js +60 -60
- package/dist/shared/components/chat/ChannelExtras.js +74 -74
- package/dist/shared/components/chat/ChatPanel.js +368 -367
- package/dist/shared/components/command-center/PeekPanel.js +33 -32
- package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
- package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
- package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
- package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
- package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
- package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
- package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
- package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
- package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
- package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
- package/dist/shared/components/import/ImportFromFileButton.js +61 -60
- package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
- package/dist/shared/components/imports/NewImportDialog.js +29 -28
- package/dist/shared/components/imports/RunDetailSheet.js +63 -63
- package/dist/shared/components/item-edit/FieldRow.js +329 -329
- package/dist/shared/components/item-edit/InlineTableField.js +898 -898
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
- package/dist/shared/components/item-edit/PlanGrid.js +220 -221
- package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
- package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
- package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
- package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
- package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
- package/dist/shared/components/panels/SlaClock.js +35 -36
- package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
- package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
- package/dist/shared/components/profile/AgentsPanel.js +73 -72
- package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
- package/dist/shared/components/support/SupportRequestDialog.js +85 -81
- package/dist/shared/components/support/SupportView.js +94 -87
- package/dist/shared/lib/autofill-poll.js +21 -18
- package/dist/shared/lib/error-actions.js +85 -0
- package/dist/shared/lib/error-message.js +223 -82
- package/dist/shared/lib/error-toast.js +71 -13
- package/dist/shared/lib/safe-error.js +136 -38
- package/package.json +1 -1
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as D, useQuery as I, useMutation as q } from "@tanstack/react-query";
|
|
3
3
|
import { Loader2 as K, EyeOff as L, CalendarClock as Q, ChevronsUpDown as j, Check as H } from "lucide-react";
|
|
4
|
-
import { useState as m, useId as
|
|
5
|
-
import { toast as
|
|
4
|
+
import { useState as m, useId as M, useMemo as A } from "react";
|
|
5
|
+
import { toast as g } from "sonner";
|
|
6
6
|
import { useNivaroClient as F } from "../../context.js";
|
|
7
|
-
import { get as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { get as B, post as O } from "../../lib/commands.js";
|
|
8
|
+
import { userErrorMessage as U } from "../../lib/safe-error.js";
|
|
9
|
+
import { titleCase as V, cn as W } from "../../lib/utils.js";
|
|
10
|
+
import { PICKER_EXCLUSIONS_PAGE_KEY as z } from "../PickerExcludedRows.js";
|
|
10
11
|
import { Button as S } from "../ui/button.js";
|
|
11
|
-
import { Command as
|
|
12
|
+
import { Command as G, CommandInput as R, CommandList as X, CommandEmpty as Y, CommandItem as J } from "../ui/command.js";
|
|
12
13
|
import { Input as w } from "../ui/input.js";
|
|
13
14
|
import { Popover as E, PopoverTrigger as _, PopoverContent as P } from "../ui/popover.js";
|
|
14
|
-
function $(
|
|
15
|
-
return
|
|
15
|
+
function $(i, l) {
|
|
16
|
+
return U(i, l);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const o = F(), s = D(), h = ["picker-exclusion",
|
|
18
|
+
function Z(i, l, r = {}) {
|
|
19
|
+
const o = F(), s = D(), h = ["picker-exclusion", i, l], { data: c, isLoading: p } = I({
|
|
19
20
|
queryKey: h,
|
|
20
21
|
queryFn: () => o.request(
|
|
21
|
-
|
|
22
|
-
).then((
|
|
23
|
-
enabled:
|
|
22
|
+
B(`/picker-exclusions/status/${i}/${l}`)
|
|
23
|
+
).then((a) => a.data),
|
|
24
|
+
enabled: r.enabled ?? !0,
|
|
24
25
|
staleTime: 6e4
|
|
25
26
|
}), d = (c == null ? void 0 : c.excluded) ?? !1, u = q({
|
|
26
27
|
mutationFn: () => {
|
|
27
|
-
const
|
|
28
|
+
const a = { collection: i, item_id: l, layout: r.layoutSlug ?? null };
|
|
28
29
|
return o.request(
|
|
29
|
-
d ? { _method: "DELETE", _path: "/picker-exclusions", _body:
|
|
30
|
+
d ? { _method: "DELETE", _path: "/picker-exclusions", _body: a } : O("/picker-exclusions", a)
|
|
30
31
|
);
|
|
31
32
|
},
|
|
32
33
|
onSuccess: () => {
|
|
33
|
-
var
|
|
34
|
-
s.invalidateQueries({ queryKey: h }), s.invalidateQueries({ queryKey: [
|
|
34
|
+
var a;
|
|
35
|
+
s.invalidateQueries({ queryKey: h }), s.invalidateQueries({ queryKey: [z, i] }), g.success(d ? "Shown in pickers again" : "Hidden from pickers"), (a = r.onDone) == null || a.call(r);
|
|
35
36
|
},
|
|
36
|
-
onError: (
|
|
37
|
+
onError: (a) => g.error($(a, "Could not change picker visibility"))
|
|
37
38
|
});
|
|
38
39
|
return { excluded: d, isLoading: p, toggle: u };
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
collection:
|
|
42
|
-
itemId:
|
|
43
|
-
layoutSlug:
|
|
41
|
+
function pe({
|
|
42
|
+
collection: i,
|
|
43
|
+
itemId: l,
|
|
44
|
+
layoutSlug: r
|
|
44
45
|
}) {
|
|
45
|
-
const { excluded: o, toggle: s } =
|
|
46
|
+
const { excluded: o, toggle: s } = Z(i, l, { layoutSlug: r });
|
|
46
47
|
return /* @__PURE__ */ n(
|
|
47
48
|
"button",
|
|
48
49
|
{
|
|
@@ -60,20 +61,20 @@ function me({
|
|
|
60
61
|
}
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
collection:
|
|
65
|
-
itemId:
|
|
66
|
-
fields:
|
|
64
|
+
function fe({
|
|
65
|
+
collection: i,
|
|
66
|
+
itemId: l,
|
|
67
|
+
fields: r,
|
|
67
68
|
layoutSlug: o
|
|
68
69
|
}) {
|
|
69
|
-
const s = F(), [h, c] = m(!1), [p, d] = m(!1), [u,
|
|
70
|
-
() =>
|
|
71
|
-
[
|
|
70
|
+
const s = F(), [h, c] = m(!1), [p, d] = m(!1), [u, a] = m(""), [b, N] = m(""), [f, C] = m(""), x = M(), k = A(
|
|
71
|
+
() => r.filter((e) => !e.field.startsWith("__") && !e.field.includes(".")).map((e) => ({ field: e.field, label: e.label || V(e.field) })),
|
|
72
|
+
[r]
|
|
72
73
|
), y = k.find((e) => e.field === u), v = q({
|
|
73
74
|
mutationFn: () => s.request(
|
|
74
75
|
O("/scheduled-changes", {
|
|
75
|
-
collection:
|
|
76
|
-
item_id:
|
|
76
|
+
collection: i,
|
|
77
|
+
item_id: l,
|
|
77
78
|
change_type: "field_update",
|
|
78
79
|
changes: { [u]: b },
|
|
79
80
|
// datetime-local is the viewer's local time; the API stores UTC.
|
|
@@ -82,9 +83,9 @@ function he({
|
|
|
82
83
|
})
|
|
83
84
|
),
|
|
84
85
|
onSuccess: () => {
|
|
85
|
-
c(!1),
|
|
86
|
+
c(!1), a(""), N(""), C(""), g.success("Change scheduled");
|
|
86
87
|
},
|
|
87
|
-
onError: (e) =>
|
|
88
|
+
onError: (e) => g.error($(e, "Could not schedule the change"))
|
|
88
89
|
}), T = f !== "" && !Number.isNaN(new Date(f).getTime());
|
|
89
90
|
return /* @__PURE__ */ n(E, { open: h, onOpenChange: c, children: [
|
|
90
91
|
/* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ n(
|
|
@@ -121,23 +122,23 @@ function he({
|
|
|
121
122
|
]
|
|
122
123
|
}
|
|
123
124
|
) }),
|
|
124
|
-
/* @__PURE__ */ t(P, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: /* @__PURE__ */ n(
|
|
125
|
-
/* @__PURE__ */ t(
|
|
126
|
-
/* @__PURE__ */ n(
|
|
127
|
-
/* @__PURE__ */ t(
|
|
125
|
+
/* @__PURE__ */ t(P, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: /* @__PURE__ */ n(G, { children: [
|
|
126
|
+
/* @__PURE__ */ t(R, { placeholder: "Search fields…", className: "h-8 text-[12px]" }),
|
|
127
|
+
/* @__PURE__ */ n(X, { children: [
|
|
128
|
+
/* @__PURE__ */ t(Y, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No field matches" }),
|
|
128
129
|
k.map((e) => /* @__PURE__ */ n(
|
|
129
|
-
|
|
130
|
+
J,
|
|
130
131
|
{
|
|
131
132
|
value: `${e.label} ${e.field}`,
|
|
132
133
|
onSelect: () => {
|
|
133
|
-
|
|
134
|
+
a(e.field), d(!1);
|
|
134
135
|
},
|
|
135
136
|
className: "text-[12px]",
|
|
136
137
|
children: [
|
|
137
138
|
/* @__PURE__ */ t(
|
|
138
139
|
H,
|
|
139
140
|
{
|
|
140
|
-
className:
|
|
141
|
+
className: W(
|
|
141
142
|
"mr-2 h-3.5 w-3.5",
|
|
142
143
|
u === e.field ? "opacity-100" : "opacity-0"
|
|
143
144
|
)
|
|
@@ -157,7 +158,7 @@ function he({
|
|
|
157
158
|
/* @__PURE__ */ t(
|
|
158
159
|
"label",
|
|
159
160
|
{
|
|
160
|
-
htmlFor: `${
|
|
161
|
+
htmlFor: `${x}-value`,
|
|
161
162
|
className: "mb-1 block text-[11px] font-medium text-muted-foreground",
|
|
162
163
|
children: "New value"
|
|
163
164
|
}
|
|
@@ -165,7 +166,7 @@ function he({
|
|
|
165
166
|
/* @__PURE__ */ t(
|
|
166
167
|
w,
|
|
167
168
|
{
|
|
168
|
-
id: `${
|
|
169
|
+
id: `${x}-value`,
|
|
169
170
|
value: b,
|
|
170
171
|
onChange: (e) => N(e.target.value),
|
|
171
172
|
className: "h-8 text-[12px]"
|
|
@@ -176,7 +177,7 @@ function he({
|
|
|
176
177
|
/* @__PURE__ */ t(
|
|
177
178
|
"label",
|
|
178
179
|
{
|
|
179
|
-
htmlFor: `${
|
|
180
|
+
htmlFor: `${x}-at`,
|
|
180
181
|
className: "mb-1 block text-[11px] font-medium text-muted-foreground",
|
|
181
182
|
children: "When"
|
|
182
183
|
}
|
|
@@ -184,7 +185,7 @@ function he({
|
|
|
184
185
|
/* @__PURE__ */ t(
|
|
185
186
|
w,
|
|
186
187
|
{
|
|
187
|
-
id: `${
|
|
188
|
+
id: `${x}-at`,
|
|
188
189
|
type: "datetime-local",
|
|
189
190
|
value: f,
|
|
190
191
|
onChange: (e) => C(e.target.value),
|
|
@@ -208,7 +209,7 @@ function he({
|
|
|
208
209
|
] });
|
|
209
210
|
}
|
|
210
211
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
pe as PickerExclusionToggle,
|
|
213
|
+
fe as ScheduleChangeButton,
|
|
214
|
+
Z as usePickerExclusion
|
|
214
215
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { Loader2 as y, Repeat2 as v, Sigma as b } from "lucide-react";
|
|
3
3
|
import { useContext as h, createContext as g, useState as k, useMemo as _ } from "react";
|
|
4
|
-
import { toast as
|
|
4
|
+
import { toast as m } from "sonner";
|
|
5
5
|
import { useNivaroClient as w } from "../../context.js";
|
|
6
6
|
import { get as C } from "../../lib/commands.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { toastError as N } from "../../lib/error-toast.js";
|
|
8
|
+
import { parseExpression as F, readPath as R, evaluateExpression as $ } from "../../lib/expression.js";
|
|
9
|
+
import { textRulesOf as E, isRecommended as T, resolvePlacementText as j, counterError as D, confirmChangeApplies as S, isEmptyValue as f, isDisplayFormulaField as A, counterOf as L, displayFormulaOf as c, formatDisplayValue as P, countValue as V, counterState as B } from "../../lib/placement-behaviour.js";
|
|
10
|
+
import { cn as p, formatRelative as O } from "../../lib/utils.js";
|
|
11
|
+
import { useFieldAffordances as q } from "./FieldAffordances.js";
|
|
12
|
+
const M = g(null);
|
|
13
|
+
function te() {
|
|
14
|
+
const e = q(), o = h(M);
|
|
14
15
|
return (e == null ? void 0 : e.placementText) ?? o;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function re(e, o) {
|
|
17
18
|
const r = { label: e.label, note: e.note };
|
|
18
19
|
if (!o || !e._overrides) return r;
|
|
19
20
|
const t = j(e._overrides, o);
|
|
@@ -23,31 +24,31 @@ function ee(e, o) {
|
|
|
23
24
|
note: t.note ?? r.note
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function oe(e) {
|
|
27
28
|
let o = !1, r = !1;
|
|
28
29
|
for (const t of e) {
|
|
29
30
|
if (!t._overrides) continue;
|
|
30
|
-
for (const
|
|
31
|
-
|
|
31
|
+
for (const n of E(t._overrides))
|
|
32
|
+
n.type === "role" ? o = !0 : r = !0;
|
|
32
33
|
const a = t._overrides.confirm_change;
|
|
33
34
|
if (a && typeof a == "object" && Array.isArray(a.state_keys) && a.state_keys.length && (r = !0), o && r) break;
|
|
34
35
|
}
|
|
35
36
|
return { role: o, state: r };
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
return e.filter((a) =>
|
|
38
|
+
const z = (e) => !e.required && T(e._overrides);
|
|
39
|
+
function ae(e, o, r, t) {
|
|
40
|
+
return e.filter((a) => z(a) && !a.hidden && !a.readonly && r(a)).filter((a) => f(o[a.field])).map(t);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
return e.filter((t) => o.has(t.field) &&
|
|
42
|
+
function ne(e, o, r) {
|
|
43
|
+
return e.filter((t) => o.has(t.field) && S(t._overrides, r)).map((t) => t.field);
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function le(e, o, r) {
|
|
45
46
|
return e._overrides ? D(o, e._overrides, r) : null;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
return e.interface === "display-formula" ||
|
|
48
|
+
function ie(e) {
|
|
49
|
+
return e.interface === "display-formula" || A(e.field);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function se() {
|
|
51
52
|
return /* @__PURE__ */ s(
|
|
52
53
|
"span",
|
|
53
54
|
{
|
|
@@ -59,56 +60,56 @@ function le() {
|
|
|
59
60
|
}
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function ue({
|
|
63
64
|
collection: e,
|
|
64
65
|
itemId: o,
|
|
65
66
|
field: r,
|
|
66
67
|
label: t,
|
|
67
68
|
onFill: a
|
|
68
69
|
}) {
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
const n = w(), [l, d] = k(!1), x = async () => {
|
|
71
|
+
d(!0);
|
|
71
72
|
try {
|
|
72
|
-
const
|
|
73
|
+
const i = await n.request(
|
|
73
74
|
C("/revisions/my-last-value", {
|
|
74
75
|
collection: e,
|
|
75
76
|
field: r,
|
|
76
77
|
...o && o !== "new" ? { exclude: o } : {}
|
|
77
78
|
})
|
|
78
79
|
);
|
|
79
|
-
if (!
|
|
80
|
-
|
|
80
|
+
if (!i.data) {
|
|
81
|
+
m.info(`Nothing to repeat — you have not filled ${t} on another record yet`);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
|
-
a(
|
|
84
|
-
`Filled ${t} from your last record${
|
|
84
|
+
a(i.data.value), m.success(
|
|
85
|
+
`Filled ${t} from your last record${i.data.at ? ` (${O(i.data.at)})` : ""}`
|
|
85
86
|
);
|
|
86
|
-
} catch (
|
|
87
|
-
|
|
87
|
+
} catch (i) {
|
|
88
|
+
N(i, "Could not read your last value");
|
|
88
89
|
} finally {
|
|
89
|
-
|
|
90
|
+
d(!1);
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ u(
|
|
93
94
|
"button",
|
|
94
95
|
{
|
|
95
96
|
type: "button",
|
|
96
97
|
onClick: () => void x(),
|
|
97
|
-
disabled:
|
|
98
|
+
disabled: l,
|
|
98
99
|
"data-repeat-last": r,
|
|
99
100
|
"aria-label": `Repeat the last ${t} you entered`,
|
|
100
101
|
"data-tip": "Fill in what you entered on your previous record",
|
|
101
102
|
className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground",
|
|
102
103
|
children: [
|
|
103
|
-
|
|
104
|
+
l ? /* @__PURE__ */ s(y, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ s(v, { className: "h-3 w-3" }),
|
|
104
105
|
"Repeat last"
|
|
105
106
|
]
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
const r =
|
|
111
|
-
return /* @__PURE__ */
|
|
110
|
+
function de({ value: e, config: o }) {
|
|
111
|
+
const r = V(e, o.unit), t = B(r, o.limit), a = o.unit === "words" ? r === 1 ? "word" : "words" : "characters";
|
|
112
|
+
return /* @__PURE__ */ u(
|
|
112
113
|
"p",
|
|
113
114
|
{
|
|
114
115
|
"data-field-counter": t,
|
|
@@ -127,27 +128,27 @@ function se({ value: e, config: o }) {
|
|
|
127
128
|
}
|
|
128
129
|
);
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
-
return e._overrides ?
|
|
131
|
+
function me(e) {
|
|
132
|
+
return e._overrides ? L(e._overrides) : null;
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function G(e, o) {
|
|
134
135
|
if (!e.trim()) return { value: null, error: "No formula yet" };
|
|
135
|
-
const r =
|
|
136
|
+
const r = F(e);
|
|
136
137
|
if (!r.ok) return { value: null, error: r.error };
|
|
137
|
-
if (r.tokens.length && r.tokens.every((a) => f(
|
|
138
|
+
if (r.tokens.length && r.tokens.every((a) => f(R(o, a))))
|
|
138
139
|
return { value: null, error: null };
|
|
139
|
-
const t =
|
|
140
|
+
const t = $(e, o);
|
|
140
141
|
return typeof t == "boolean" ? { value: t ? 1 : 0, error: null } : { value: typeof t == "number" && Number.isFinite(t) ? t : null, error: null };
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function ce({
|
|
143
144
|
field: e,
|
|
144
145
|
values: o
|
|
145
146
|
}) {
|
|
146
147
|
const r = _(() => {
|
|
147
|
-
const
|
|
148
|
-
return c(e._overrides) ?? c({ display_formula:
|
|
149
|
-
}, [e._overrides, e.options]), t = (r == null ? void 0 : r.expr) ?? "", { value: a, error:
|
|
150
|
-
return /* @__PURE__ */
|
|
148
|
+
const l = e.options && typeof e.options == "object" ? e.options : null;
|
|
149
|
+
return c(e._overrides) ?? c({ display_formula: l == null ? void 0 : l.display_formula });
|
|
150
|
+
}, [e._overrides, e.options]), t = (r == null ? void 0 : r.expr) ?? "", { value: a, error: n } = G(t, o);
|
|
151
|
+
return /* @__PURE__ */ u(
|
|
151
152
|
"div",
|
|
152
153
|
{
|
|
153
154
|
"data-display-formula": e.field,
|
|
@@ -158,9 +159,9 @@ function de({
|
|
|
158
159
|
{
|
|
159
160
|
className: p(
|
|
160
161
|
"min-w-0 truncate text-sm tabular-nums",
|
|
161
|
-
|
|
162
|
+
n ? "text-[12px] text-amber-700 dark:text-amber-300" : "font-medium text-slate-900 dark:text-foreground"
|
|
162
163
|
),
|
|
163
|
-
children:
|
|
164
|
+
children: n ? t.trim() ? "This formula needs fixing" : "No formula yet" : P(a, r ?? { format: "", currency: null })
|
|
164
165
|
}
|
|
165
166
|
),
|
|
166
167
|
t.trim() && /* @__PURE__ */ s(
|
|
@@ -178,19 +179,19 @@ function de({
|
|
|
178
179
|
);
|
|
179
180
|
}
|
|
180
181
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
182
|
+
ce as DisplayFormulaValue,
|
|
183
|
+
de as FieldCounter,
|
|
184
|
+
M as PlacementTextContext,
|
|
185
|
+
se as RecommendedMarker,
|
|
186
|
+
ue as RepeatLastButton,
|
|
187
|
+
ne as confirmChangeFields,
|
|
188
|
+
G as evaluateDisplayFormula,
|
|
189
|
+
me as fieldCounterConfig,
|
|
190
|
+
le as fieldCounterError,
|
|
191
|
+
z as fieldIsRecommended,
|
|
192
|
+
ie as isDisplayFormulaRow,
|
|
193
|
+
ae as missingRecommended,
|
|
194
|
+
oe as placementBehaviourNeeds,
|
|
195
|
+
re as placementFieldText,
|
|
196
|
+
te as usePlacementTextContext
|
|
196
197
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { jsxs as s, jsx as l, Fragment as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { useContext as
|
|
1
|
+
import { jsxs as s, jsx as l, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle as j, Ruler as F } from "lucide-react";
|
|
3
|
+
import { useContext as R, useState as A } from "react";
|
|
4
|
+
import { userErrorMessage as L } from "../../../lib/safe-error.js";
|
|
4
5
|
import { cn as O } from "../../../lib/utils.js";
|
|
5
|
-
import { useColumnFacts as V, columnOf as $, useValueLengths as
|
|
6
|
-
import { fitWarnings as
|
|
7
|
-
import { labelText as
|
|
8
|
-
import { useFieldCtx as
|
|
9
|
-
import { GlobalWriterContext as
|
|
10
|
-
import { asObject as
|
|
6
|
+
import { useColumnFacts as V, columnOf as $, useValueLengths as E } from "../inspect/inspect-api.js";
|
|
7
|
+
import { fitWarnings as P, widthCheckApplies as U, widthVerdict as D, typeWords as G, SPAN_WORDS as i, capacityChars as M } from "../inspect/width-fit.js";
|
|
8
|
+
import { labelText as q, effectText as c, tintCard as z } from "../panel-style.js";
|
|
9
|
+
import { useFieldCtx as B } from "./field-context.js";
|
|
10
|
+
import { GlobalWriterContext as H } from "./kit.js";
|
|
11
|
+
import { asObject as I } from "./model.js";
|
|
11
12
|
const p = (d) => d.toLocaleString();
|
|
12
|
-
function
|
|
13
|
-
var w
|
|
14
|
-
const d =
|
|
13
|
+
function ne() {
|
|
14
|
+
var w;
|
|
15
|
+
const d = B(), { info: h, row: o, ov: m, env: r, globalOptions: N } = d, { data: v } = V(r.collection), a = $(v, o.field), f = (w = R(H)) == null ? void 0 : w.draft.options, C = String((f == null ? void 0 : f.input_mask) ?? N.input_mask ?? ""), b = I(r.bundle.layout.default_values), T = typeof m.label == "string" && m.label ? m.label : h.label, _ = r.layoutType !== "table", y = P({
|
|
15
16
|
column: a,
|
|
16
|
-
mask:
|
|
17
|
+
mask: C || null,
|
|
17
18
|
defaultValue: o.field in b ? b[o.field] : void 0,
|
|
18
|
-
label: m.label === "" ? null :
|
|
19
|
+
label: m.label === "" ? null : T,
|
|
19
20
|
span: o.col_span,
|
|
20
21
|
layoutType: r.layoutType
|
|
21
|
-
}), g =
|
|
22
|
+
}), g = _ && !!a && U(h), [x, S] = A(!1), t = E(r.collection, o.field, x && g);
|
|
22
23
|
if (!a && !y.length) return null;
|
|
23
|
-
const u = o.col_span ?? 12, e = t.data ?
|
|
24
|
+
const u = o.col_span ?? 12, e = t.data ? D(u, t.data.p95) : null, k = (n) => d.setPlacement(
|
|
24
25
|
{ col_span: n === 12 ? null : n },
|
|
25
26
|
`Set the width of ${h.label} to ${i[n]}`
|
|
26
27
|
);
|
|
27
28
|
return /* @__PURE__ */ s("div", { "data-setting": "field.column_fit", className: "space-y-1.5", children: [
|
|
28
29
|
/* @__PURE__ */ s("div", { className: "flex min-h-5 items-center justify-between gap-3", children: [
|
|
29
|
-
/* @__PURE__ */ l("span", { className:
|
|
30
|
+
/* @__PURE__ */ l("span", { className: q, children: "Stored as" }),
|
|
30
31
|
a && /* @__PURE__ */ l("span", { className: "font-mono text-[12px] text-slate-700 dark:text-foreground", children: G(a) })
|
|
31
32
|
] }),
|
|
32
33
|
/* @__PURE__ */ l("p", { "data-effect": "", className: c, children: (a == null ? void 0 : a.max_length) != null ? `The database keeps up to ${p(a.max_length)} characters.` : a ? "What the database column holds." : "This field has no column of its own." }),
|
|
@@ -36,7 +37,7 @@ function le() {
|
|
|
36
37
|
"data-fit-warning": n.key,
|
|
37
38
|
className: "flex items-start gap-1.5 text-[12px] leading-snug text-amber-700 dark:text-amber-300",
|
|
38
39
|
children: [
|
|
39
|
-
/* @__PURE__ */ l(
|
|
40
|
+
/* @__PURE__ */ l(j, { className: "mt-[2px] h-3 w-3 shrink-0" }),
|
|
40
41
|
n.text
|
|
41
42
|
]
|
|
42
43
|
},
|
|
@@ -47,15 +48,15 @@ function le() {
|
|
|
47
48
|
{
|
|
48
49
|
type: "button",
|
|
49
50
|
"data-width-check": "",
|
|
50
|
-
onClick: () =>
|
|
51
|
+
onClick: () => S(!0),
|
|
51
52
|
className: "inline-flex items-center gap-1.5 text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
|
|
52
53
|
children: [
|
|
53
|
-
/* @__PURE__ */ l(
|
|
54
|
+
/* @__PURE__ */ l(F, { className: "h-3.5 w-3.5" }),
|
|
54
55
|
"Check the width against stored values"
|
|
55
56
|
]
|
|
56
57
|
}
|
|
57
58
|
),
|
|
58
|
-
g && x && /* @__PURE__ */ l("div", { "data-width-result": "", className: O(
|
|
59
|
+
g && x && /* @__PURE__ */ l("div", { "data-width-result": "", className: O(z, "space-y-1.5 p-2.5"), children: t.isLoading ? /* @__PURE__ */ l("p", { className: c, children: "Reading the newest stored values…" }) : t.isError ? /* @__PURE__ */ l("p", { className: "text-[12px] text-red-700 dark:text-red-300", children: L(t.error, "The stored values could not be read.") }) : !t.data || t.data.filled === 0 ? /* @__PURE__ */ l("p", { className: c, children: "No stored values to measure yet." }) : /* @__PURE__ */ s(W, { children: [
|
|
59
60
|
/* @__PURE__ */ s("p", { className: "text-[12px] leading-snug text-slate-700 dark:text-foreground", children: [
|
|
60
61
|
"95% of ",
|
|
61
62
|
p(t.data.filled),
|
|
@@ -67,7 +68,7 @@ function le() {
|
|
|
67
68
|
"). ",
|
|
68
69
|
i[u] ?? u,
|
|
69
70
|
" width shows about ",
|
|
70
|
-
|
|
71
|
+
M(u),
|
|
71
72
|
"."
|
|
72
73
|
] }),
|
|
73
74
|
e != null && e.cut ? /* @__PURE__ */ s("p", { className: "text-[12px] leading-snug text-amber-700 dark:text-amber-300", children: [
|
|
@@ -108,5 +109,5 @@ function le() {
|
|
|
108
109
|
] });
|
|
109
110
|
}
|
|
110
111
|
export {
|
|
111
|
-
|
|
112
|
+
ne as ColumnFit
|
|
112
113
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as A } from "@tanstack/react-query";
|
|
3
|
-
import { AlertTriangle as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as F, post as
|
|
3
|
+
import { AlertTriangle as E } from "lucide-react";
|
|
4
|
+
import { useState as J } from "react";
|
|
5
|
+
import { useNivaroClient as K } from "../../../context.js";
|
|
6
|
+
import { get as F, post as L } from "../../../lib/commands.js";
|
|
7
|
+
import { userErrorMessage as R } from "../../../lib/safe-error.js";
|
|
7
8
|
import { cn as W } from "../../../lib/utils.js";
|
|
8
9
|
import { extractTemplateFields as B, renderDisplayTemplate as D } from "../../pipeline/relations.js";
|
|
9
|
-
import { useCollectionBody as
|
|
10
|
-
import { m2mParents as
|
|
11
|
-
import { labelText as
|
|
10
|
+
import { useCollectionBody as Q } from "../collection-meta.js";
|
|
11
|
+
import { m2mParents as z, previewNarrowing as G } from "../inspect/picker-preview.js";
|
|
12
|
+
import { labelText as H, effectText as u, tintCard as M } from "../panel-style.js";
|
|
12
13
|
import { RelationPicker as U } from "../pickers/relation-picker.js";
|
|
13
14
|
import { useFieldCtx as V } from "./field-context.js";
|
|
14
15
|
import { asObject as X, describeField as j } from "./model.js";
|
|
15
16
|
const l = (c) => c.toLocaleString();
|
|
16
|
-
function
|
|
17
|
-
const n = V(), { info: k, env: d, opts: p, globalOptions: T } = n, w =
|
|
17
|
+
function fe({ rules: c }) {
|
|
18
|
+
const n = V(), { info: k, env: d, opts: p, globalOptions: T } = n, w = K(), a = k.relatedCollection, [s, S] = J(null), { data: h } = Q(a), m = a === "nivaro_users" ? "{{first_name}} {{last_name}}" : (h == null ? void 0 : h.display_template) ?? null, y = X(p.option_filter ?? T.option_filter), b = typeof p.option_sort == "string" && p.option_sort && !/^-?label$/.test(p.option_sort) ? p.option_sort : void 0, C = JSON.stringify([c, y, b, m]), x = A({
|
|
18
19
|
queryKey: ["layout-editor", "picker-preview", d.collection, k.field, s, C],
|
|
19
20
|
enabled: !!s && !!a,
|
|
20
21
|
retry: !1,
|
|
@@ -23,7 +24,7 @@ function pe({ rules: c }) {
|
|
|
23
24
|
const t = (await w.request(
|
|
24
25
|
F(`/items/${d.collection}/${s}`, { fields: "*" })
|
|
25
26
|
)).data ?? {}, v = {};
|
|
26
|
-
for (const o of
|
|
27
|
+
for (const o of z(c, d.collection, n.relations)) {
|
|
27
28
|
const g = (await w.request(
|
|
28
29
|
F(`/items/${o.junction}`, {
|
|
29
30
|
filter: JSON.stringify({ [o.parentFk]: { _eq: s } }),
|
|
@@ -33,7 +34,7 @@ function pe({ rules: c }) {
|
|
|
33
34
|
)).data ?? [];
|
|
34
35
|
v[o.parent] = g.map((f) => f[o.targetFk]).filter((f) => f != null && typeof f != "object");
|
|
35
36
|
}
|
|
36
|
-
const _ =
|
|
37
|
+
const _ = G({
|
|
37
38
|
target: a,
|
|
38
39
|
rules: c,
|
|
39
40
|
optionFilter: y,
|
|
@@ -47,7 +48,7 @@ function pe({ rules: c }) {
|
|
|
47
48
|
d.bundle.placements.find((g) => g.field === o) ?? null
|
|
48
49
|
).label
|
|
49
50
|
}), q = B(m).filter((o) => o !== "*" && o !== "id"), I = await w.request(
|
|
50
|
-
|
|
51
|
+
L("/layout-inspect/picker-preview", {
|
|
51
52
|
collection: a,
|
|
52
53
|
steps: _.steps,
|
|
53
54
|
fields: q,
|
|
@@ -60,7 +61,7 @@ function pe({ rules: c }) {
|
|
|
60
61
|
if (!a) return null;
|
|
61
62
|
const e = x.data, N = x.error, O = (e == null ? void 0 : e.answer.steps) ?? [], P = (t) => (m ? D(m, t) : "") || String(t.id ?? "");
|
|
62
63
|
return /* @__PURE__ */ i("div", { "data-setting": "field.picker_preview", className: "space-y-2", children: [
|
|
63
|
-
/* @__PURE__ */ r("div", { className: "flex min-h-5 items-center justify-between gap-3", children: /* @__PURE__ */ r("span", { className:
|
|
64
|
+
/* @__PURE__ */ r("div", { className: "flex min-h-5 items-center justify-between gap-3", children: /* @__PURE__ */ r("span", { className: H, children: "Options for a record" }) }),
|
|
64
65
|
/* @__PURE__ */ r(
|
|
65
66
|
U,
|
|
66
67
|
{
|
|
@@ -71,7 +72,7 @@ function pe({ rules: c }) {
|
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
74
|
/* @__PURE__ */ r("p", { "data-effect": "", className: u, children: "What this picker offers on the record you pick, after its cascade filters, option filter and picker exclusions." }),
|
|
74
|
-
s && /* @__PURE__ */ r("div", { "data-picker-preview": "", className: W(
|
|
75
|
+
s && /* @__PURE__ */ r("div", { "data-picker-preview": "", className: W(M, "space-y-2 p-2.5"), children: x.isLoading ? /* @__PURE__ */ r("p", { className: u, children: "Working out the options…" }) : N ? /* @__PURE__ */ r("p", { className: "text-[12px] text-red-700 dark:text-red-300", children: R(N, "The options could not be worked out.") }) : e ? /* @__PURE__ */ i($, { children: [
|
|
75
76
|
/* @__PURE__ */ r(
|
|
76
77
|
"p",
|
|
77
78
|
{
|
|
@@ -81,7 +82,7 @@ function pe({ rules: c }) {
|
|
|
81
82
|
}
|
|
82
83
|
),
|
|
83
84
|
e.narrowing.waitsFor && /* @__PURE__ */ i("p", { className: "flex items-start gap-1.5 text-[12px] leading-snug text-amber-700 dark:text-amber-300", children: [
|
|
84
|
-
/* @__PURE__ */ r(
|
|
85
|
+
/* @__PURE__ */ r(E, { className: "mt-[2px] h-3 w-3 shrink-0" }),
|
|
85
86
|
"The picker stays disabled on this record until",
|
|
86
87
|
" ",
|
|
87
88
|
j(e.narrowing.waitsFor, n.globals, n.relations, null).label,
|
|
@@ -130,5 +131,5 @@ function pe({ rules: c }) {
|
|
|
130
131
|
] });
|
|
131
132
|
}
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
fe as PickerPreview
|
|
134
135
|
};
|